Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Randomize
- On Error Resume Next
- ExecuteGlobal GetTextFile("controller.vbs")
- If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
- On Error Goto 0
- Const cGameName="vegas",UseSolenoids=2,UseLamps=0,UseGI=0,sCoin="coin"
- LoadVPM "01120100", "gts3.vbs", 3.10
- Dim DesktopMode: DesktopMode = Table1.ShowDT
- If DesktopMode = True Then 'Show Desktop components
- Ramp001.visible=1
- Ramp002.visible=1
- Primitive019.visible=1
- Else
- Ramp001.visible=0
- Ramp002.visible=0
- Primitive019.visible=0
- End if
- '*************************************************************
- 'Playfiled Glass
- Dim Glass:
- Glass = 0 'Choose: 0 Glass OFF\Invisible or 1 Glass ON\Visible
- If Glass = 1 Then
- WallGlass.visible = 1
- Else
- WallGlass.visible=0
- End if
- '*************************************************************
- 'Solenoid Call backs
- '**********************************************************************************************************
- 'SolCallback(1) = "vpmSolSound ""Jet1"","
- 'SolCallback(2) = "vpmSolSound ""Jet2"","
- 'SolCallback(3) = "vpmSolSound ""Jet2"","
- 'SolCallback(4) = "vpmSolSound ""Sensor""," 'Left Slingshot
- 'SolCallback(5) = "vpmSolSound ""Sensor""," 'Right Slingshot
- SolCallback(6) = "bsSaucer42.SolOut"
- SolCallback(7) = "dtLDrop.SolDropUp"
- 'SolCallback(8) = "Sol8," 'V - Backglass
- 'SolCallback(9) = "Sol9," 'E - Backglass
- 'SolCallback(10) = "Sol10," 'G - Backglass
- 'SolCallback(11) = "Sol11," 'A - Backglass
- 'SolCallback(12) = "Sol12," 'S - Backglass
- 'SolCallback(13) = "Sol13" '1 - Backglass
- 'SolCallback(14) = "Sol14" '2 - Backglass
- 'SolCallback(15) = "Sol15," '3 - Backglass
- 'SolCallback(16) = "Sol16," '4 - Backglass
- 'SolCallback(17) = "Sol17," 'LED Display - Backglass
- SolCallback(18) = "FlashRed2" 'Top Left Flashers
- SolCallback(19) = "FlashRed6" 'Top Right Flasher
- SolCallback(20) = "SetLamp 142," 'Top Right White Target
- SolCallback(21) = "SetLamp 143," 'Drop Targets
- SolCallback(22) = "SetLamp 144," 'Yellow Targets
- SolCallback(23) = "SetLamp 145," 'Bottom Right Star Trigger
- SolCallback(24) = "SetLamp 146," 'Bottom Left Star Trigger
- SolCallback(25) = "FlashRed8" 'Red Dome above kicker
- 'SolCallback(35)="FlashRed8" 'Red Dome above kicker
- SolCallback(26) = "PFGI" 'lightbox relay
- 'SolCallback(27) = "Sol27," 'ticketdispencer
- SolCallback(28) = "bsTrough.SolOut"
- SolCallback(29) = "bsTrough.SolIn"
- SolCallback(30) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
- 'SolCallback(31) = "vpmNudge.SolGameOn" 'SolCallback(31) = "vpmNudge.SolGameOn"
- 'SolCallback(32) = "vpmSolSound ""sensor""," 'SolCallback(32) = "Sol Game Over"
- SolCallback(sLRFlipper) = "SolRFlipper"
- SolCallback(sLLFlipper) = "SolLFlipper"
- Sub SolLFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFx("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd
- Else
- PlaySound SoundFx("fx_FlipperDown",DOFFlippers):LeftFlipper.RotateToStart
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFx("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd
- Else
- PlaySound SoundFx("fx_FlipperDown",DOFFlippers):RightFlipper.RotateToStart
- End If
- End Sub
- '**********************************************************************************************************
- 'Solenoid Controlled toys
- '**********************************************************************************************************
- 'Playfield GI
- Sub PFGI(Enabled)
- If Enabled Then
- dim xx
- For each xx in GI:xx.State = 0: Next
- PlaySound "fx_relay"
- Else
- For each xx in GI:xx.State = 1: Next
- PlaySound "fx_relay"
- End If
- End Sub
- '**********************************************************************************************************
- 'Initiate Table
- '**********************************************************************************************************
- Dim bsTrough,bsSaucer42,dtLDrop
- Sub Table1_Init
- vpminit me
- On Error Resume Next
- With Controller
- .GameName = cGameName
- If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
- .SplashInfoLine = ""&chr(13)&"You Suck"
- .HandleMechanics=0
- .HandleKeyboard=0
- .ShowDMDOnly=1
- .ShowFrame=0
- .ShowTitle=0
- .hidden = 1 'enable to hide DMD if You use a B2S backglass
- .Games(cGameName).Settings.Value("sound")=1
- '.PuPHide = 1
- On Error Resume Next
- .Run GetPlayerHWnd
- If Err Then MsgBox Err.Description
- On Error Goto 0
- End With
- On Error Goto 0
- PinMAMETimer.Interval=PinMAMEInterval
- PinMAMETimer.Enabled = true
- vpmNudge.TiltSwitch=swTilt
- vpmNudge.Sensitivity=5
- vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,RightSlingShot,LeftSlingShot)
- Set bsTrough=new cvpmBallStack
- bsTrough.InitSw 6,7,0,0,0,0,0,0
- bsTrough.InitKick BallRelease,110,3
- bsTrough.InitExitSnd SoundFX("BallRel",DOFContactors),SoundFX("Solenoid",DOFContactors)
- ' bsTrough.Balls=3
- Set dtLDrop = new cvpmDropTarget
- dtLDrop.InitDrop Array(sw17,sw27,sw37,sw47,sw57), Array(17,27,37,47,57)
- dtLDrop.InitSnd SoundFX("Targetdrop1",DOFDropTargets),SoundFX("TargetBankreset1",DOFContactors)
- Set bsSaucer42 = New cvpmBallStack
- bsSaucer42.InitSaucer sw42,42,120,14
- bsSaucer42.InitExitSnd SoundFX("Popper",DOFContactors),SoundFX("Solenoid",DOFContactors)
- bsSaucer42.KickAngleVar=30
- bsSaucer42.KickForceVar = 5
- End Sub
- Sub Timer1_Timer
- Me.Enabled=0
- bsTrough.Balls=3
- End Sub
- '**********************************************************************************************************
- 'Plunger code
- '**********************************************************************************************************
- Sub Table1_KeyDown(ByVal keycode)
- If keycode = LeftMagnaSave Then bLutActive = True
- If keycode = RightMagnaSave Then
- If bLutActive Then NextLUT: End If
- End If
- If LeftMagnaSave Then Controller.Switch(4)=1
- If RightMagnaSave Then Controller.Switch(5)=1
- iF KEYCODE = StartGameKey THEN CONTROLLER.SWITCH(3)=1
- If keycode = PlungerKey Then Plunger.Pullback:playsound"PlungerPull"
- ' If keycode = 21 Then Controller.Switch(152) = 1
- If KeyDownHandler(keycode) Then Exit Sub
- End Sub
- Sub Table1_KeyUp(ByVal keycode)
- If keycode = LeftMagnaSave Then bLutActive = False
- If LeftMagnaSave Then Controller.Switch(4)=0
- If RightMagnaSave Then Controller.Switch(5)=0
- iF KEYCODE = StartGameKey THEN CONTROLLER.SWITCH(3)=0
- If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
- ' If keycode = 21 Then Controller.Switch(152) = 0
- If KeyUpHandler(keycode) Then Exit Sub
- End Sub
- '------------------------------
- '------ Trough Handler ------
- '------------------------------
- ' Drain
- Sub Drain_Hit:bsTrough.addball me : playsound "Drain": End Sub
- ' Kickers
- Sub sw42_Hit:bsSaucer42.AddBall 0 : playsound "Popper_Ball": End Sub
- ' Drop Targets
- Sub sw17_Hit() dtLDrop.Hit 1 : End Sub
- Sub sw27_Hit() dtLDrop.Hit 2 : End Sub
- Sub sw37_Hit() dtLDrop.Hit 3 : End Sub
- Sub sw47_Hit() dtLDrop.Hit 4 : End Sub
- Sub sw57_Hit() dtLDrop.Hit 5 : End Sub
- ' Star Triggers
- sub sw21_hit:Controller.Switch(21)=1:PlaySound "trigger":End Sub
- sub sw21_unhit:Controller.Switch(21)=0:End Sub
- sub sw22_hit:Controller.Switch(22)=1:PlaySound "trigger":End Sub
- sub sw22_unhit:Controller.Switch(22)=0:End Sub
- sub sw31_hit:Controller.Switch(31)=1:PlaySound "trigger":End Sub
- sub sw31_unhit:Controller.Switch(31)=0:End Sub
- sub sw32_hit:Controller.Switch(32)=1:PlaySound "trigger":End Sub
- sub sw32_unhit:Controller.Switch(32)=0:End Sub
- 'Wire Triggers
- sub sw20_hit:Controller.Switch(20)=1:PlaySound "rollover":End Sub
- sub sw20_unhit:Controller.Switch(20)=0:End Sub
- sub sw23_hit:Controller.Switch(23)=1:PlaySound "rollover":End Sub
- sub sw23_unhit:Controller.Switch(23)=0:End Sub
- sub sw30_hit:Controller.Switch(30)=1:PlaySound "rollover":End Sub
- sub sw30_unhit:Controller.Switch(30)=0:End Sub
- sub sw33_hit:Controller.Switch(33)=1:PlaySound "rollover":End Sub
- sub sw33_unhit:Controller.Switch(33)=0:End Sub
- sub sw40_hit:Controller.Switch(40)=1:PlaySound "rollover":End Sub
- sub sw40_unhit:Controller.Switch(40)=0:End Sub
- sub sw41_hit:Controller.Switch(41)=1:PlaySound "rollover":End Sub
- sub sw41_unhit:Controller.Switch(41)=0:End Sub
- sub sw43_hit:Controller.Switch(43)=1:PlaySound "rollover":End Sub
- sub sw43_unhit:Controller.Switch(43)=0:End Sub
- 'Stand Up Targets
- Sub sw16_Hit:vpmTimer.PulseSw 16:PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw24_Hit:vpmTimer.PulseSw 24:PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw25_Hit:vpmTimer.PulseSw 25:PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw26_Hit:vpmTimer.PulseSw 26:PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw34_Hit:vpmTimer.PulseSw 34:PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw35_Hit:vpmTimer.PulseSw 35:PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw36_Hit:vpmTimer.PulseSw 36:PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw45_Hit:vpmTimer.PulseSw 45:PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw46_Hit:vpmTimer.PulseSw 46:PlaySound SoundFX("Target",DOFTargets):End Sub
- ' Rubber Wall
- Sub sw15_hit:vpmTimer.PulseSw 15: PlaySound "wallhit":End Sub
- ' Bumpers
- Sub Bumper1_Hit:vpmTimer.PulseSw 10:Playsound SoundFX("jet1",DOFContactors): End Sub
- Sub Bumper2_Hit:vpmTimer.PulseSw 11:Playsound SoundFX("jet2",DOFContactors): End Sub
- Sub Bumper3_Hit:vpmTimer.PulseSw 12:Playsound SoundFX("jet2",DOFContactors): End Sub
- 'Sons ambiente
- Sub Wall297_hit():playsound "bhit":end sub
- Sub Wall323_hit():playsound "bhit":end sub
- Sub Wall318_hit():playsound "bhit":end sub
- Sub Wall333_hit():playsound "bhit":end sub
- Sub Wall296_hit():playsound "bhit":end sub
- Sub Wall290_hit():playsound "bhit":end sub
- Sub Wall314_hit():playsound "bhit":end sub
- Sub Wall315_hit():playsound "bhit":end sub
- Sub Wall332_hit():playsound "bhit":end sub
- Sub Wall272_hit():playsound "bhit":end sub
- Sub Wall270_hit():playsound "bhit":end sub
- Sub Wall268_hit():playsound "bhit":end sub
- Sub Wall293_hit():playsound "bhit":end sub
- Sub Wall397_hit():playsound "bhit":end sub
- Sub Wall263_hit():playsound "bhit":end sub
- Sub Wall252_hit():playsound "bhit":end sub
- Sub Gate_Hit:playsound "Gate5":End Sub
- Sub Gate1_Hit:playsound "Gate5":End Sub
- Sub Gate2_Hit:playsound "Gate5":End Sub
- Sub Fundo_hit:playsound "wallhit":end sub
- '**********Sling Shot Animations
- ' Rstep and Lstep are the variables that increment the animation
- '****************
- Dim RStep, Lstep
- Sub RightSlingShot_Slingshot
- vpmTimer.PulseSw 14
- PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
- RSling.Visible = 0
- RSling1.Visible = 1
- sling1.rotx = 20
- RStep = 0
- RightSlingShot.TimerEnabled = 1
- End Sub
- Sub RightSlingShot_Timer
- Select Case RStep
- Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
- Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0:
- End Select
- RStep = RStep + 1
- End Sub
- Sub LeftSlingShot_Slingshot
- vpmTimer.PulseSw 13
- PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
- LSling.Visible = 0
- LSling1.Visible = 1
- sling2.rotx = 20
- LStep = 0
- LeftSlingShot.TimerEnabled = 1
- End Sub
- Sub LeftSlingShot_Timer
- Select Case LStep
- Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
- Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0:
- End Select
- LStep = LStep + 1
- End Sub
- Dim Digits(3)
- Dim NumLED
- Dim QuantLED
- NumLED=39
- QuantLED=3
- Digits(0)=Array(D1,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13,D14,D15,D16)
- Digits(1)=Array(D17,D18,D19,D20,D21,D22,D23,D24,D25,D26,D27,D28,D29,D30,D31,D32)
- Digits(2)=Array(D33,D34,D35,D36,D37,D38,D39,D40,D41,D42,D43,D44,D45,D46,D47,D48)
- Set MotorCallback=GetRef("Display")
- Sub Display
- Dim ChgLED,II,Num,Chg,Stat,Obj
- ChgLED=Controller.ChangedLEDs(&Hffffffff,&Hffffffff)
- If Not IsEmpty(ChgLED) Then
- For II=0 To UBound(chgLED)
- Num=ChgLED(II,0)
- Chg=ChgLED(II,1)
- Stat=ChgLED(II,2)
- If (Num>NumLED) and (Num<=NumLED+QuantLED) then
- For Each Obj In Digits(Num-NumLED-1)
- If Chg And 1 Then
- Obj.State=Stat And 1
- End If
- Chg=int(Chg/2)
- Stat=int(Stat/2)
- Next
- End If
- Next
- End If
- End Sub
- '***************************************************
- ' JP's VP10 Fading Lamps & Flashers
- ' Based on PD's Fading Light System
- ' SetLamp 0 is Off
- ' SetLamp 1 is On
- ' fading for non opacity objects is 4 steps
- '***************************************************
- Dim LampState(200), FadingLevel(200)
- Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
- InitLamps() ' turn off the lights and flashers and reset them to the default parameters
- LampTimer.Interval = 5 'lamp fading speed
- LampTimer.Enabled = 1
- ' Lamp & Flasher Timers
- Sub LampTimer_Timer()
- Dim chgLamp, num, chg, ii
- chgLamp = Controller.ChangedLamps
- If Not IsEmpty(chgLamp) Then
- For ii = 0 To UBound(chgLamp)
- LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
- FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
- Next
- End If
- UpdateLamps
- End Sub
- Sub UpdateLamps()
- NFadeL 0, Light0
- NFadeL 1, Light1
- NFadeL 2, Light2
- NFadeL 3, Light3
- NFadeL 4, Light4
- NFadeL 5, Light5
- NFadeL 6, Light6
- NFadeL 7, Light7
- NFadeL 11, Light11
- NFadeL 12, Light12
- NFadeL 13, Light13
- NFadeL 14, Light14
- NFadeL 15, Light15
- NFadeL 16, Light16
- NFadeL 17, Light17
- NFadeL 20, Light20
- NFadeL 21, Light21
- NFadeL 22, Light22
- NFadeL 23, Light23
- NFadeL 24, Light24
- NFadeL 25, Light25
- NFadeL 26, Light26
- NFadeL 27, Light27
- NFadeL 30, Light30
- NFadeL 31, Light31
- NFadeL 33, Light33
- NFadeL 34, Light34
- NFadeL 35, Light35
- NFadeL 36, Light36
- NFadeL 37, Light37
- NFadeL 40, Light40
- NFadeL 41, Light41
- NFadeL 42, Light42
- NFadeL 43, Light43
- NFadeL 44, Light44
- NFadeL 45, Light45
- NFadeL 46, Light46
- NFadeL 47, Light47
- NFadeL 50, Light50
- NFadeL 51, Light51
- NFadeL 52, Light52
- NFadeL 53, Light53
- NFadeL 54, Light54
- NFadeL 55, Light55
- NFadeL 56, Light56
- NFadeL 57, Light57
- NFadeL 60, Light60
- NFadeL 61, Light61
- NFadeL 62, Light62
- NFadeL 63, Light63
- NFadeL 64, Light64
- NFadeL 65, Light65
- NFadeL 66, Light66
- NFadeL 67, Light67
- NFadeLm 70, Light70
- NFadeL 70, Light70a
- NFadeLm 71, Light71
- NFadeL 71, Light71a
- NFadeLm 72, Light72
- NFadeL 72, Light72a
- NFadeLm 73, Light73
- NFadeL 73, Light73a
- NFadeLm 74, Light74
- NFadeL 74, Light74a
- NFadeL 75, Light75
- NFadeL 76, Light76
- NFadeL 77, Light77
- NFadeL 80, Light80
- ' NFadeL 81, Light81 'Right Outside Rollover
- NFadeLm 82, Light82 'Bumper 1
- NFadeL 82, Light82a 'Bumper 1
- NFadeLm 83, Light83 'Bumper 2
- NFadeL 83, Light83a 'Bumper 2
- NFadeLm 84, Light84 'Bumper 3
- NFadeL 84, Light84a 'Bumper 3
- NFadeL 90, Light90 ' #1 Lucky 7 Backglass & Apron
- NFadeL 91, Light91 ' #2 Lucky 7 Backglass & Apron
- NFadeL 92, Light92 ' #3 Lucky 7 Backglass & Apron
- NFadeL 93, Light93 ' #4 Lucky 7 Backglass & Apron
- NFadeL 94, Light94 ' #5 Lucky 7 Backglass & Apron
- NFadeL 95, Light95 ' #6 Lucky 7 Backglass & Apron
- NFadeL 96, Light96 ' #7 Lucky 7 Backglass & Apron
- NFadeL 100, L100 '#1 Star Backglass & Apron LA0
- NFadeL 101, L101 '#2 Star Backglass & Apron LA1
- NFadeL 102, L102 '#3 Star Backglass & Apron LA2
- 'NfadeL 103, L103 'LA3
- 'NFadeL 104, L104 'LA4
- NFadeL 105, L105 ' Catch Up Apron Backglass & Apron LA5
- NfadeL 110, LB0 'LB0
- NfadeL 111, LB1 'LB1
- NfadeL 112, LB2 'LB2
- NfadeL 113, LB3 'LB3
- NfadeL 114, LB4 'LB4
- NfadeL 115, LB5 'LB5
- NfadeL 116, LB6 'LB6
- NfadeL 117, LB7 'LB7
- 'Solenid Controlled Lamps
- NFadeL 142, L142
- NFadeL 143, L143
- NFadeL 144, L144
- NFadeL 145, L145
- NFadeL 146, L146
- End Sub
- ' div lamp subs
- Sub InitLamps()
- Dim x
- For x = 0 to 200
- LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
- FadingLevel(x) = 4 ' used to track the fading state
- FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
- FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
- FlashMax(x) = 1 ' the maximum value when on, usually 1
- FlashMin(x) = 0 ' the minimum value when off, usually 0
- FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
- Next
- End Sub
- Sub AllLampsOff
- Dim x
- For x = 0 to 200
- SetLamp x, 0
- Next
- End Sub
- Sub SetLamp(nr, value)
- If value <> LampState(nr) Then
- LampState(nr) = abs(value)
- FadingLevel(nr) = abs(value) + 4
- End If
- End Sub
- ' Lights: used for VP10 standard lights, the fading is handled by VP itself
- Sub NFadeL(nr, object)
- Select Case FadingLevel(nr)
- Case 4:object.state = 0:FadingLevel(nr) = 0
- Case 5:object.state = 1:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub NFadeLm(nr, object) ' used for multiple lights
- Select Case FadingLevel(nr)
- Case 4:object.state = 0
- Case 5:object.state = 1
- End Select
- End Sub
- 'Lights, Ramps & Primitives used as 4 step fading lights
- 'a,b,c,d are the images used from on to off
- Sub FadeObj(nr, object, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
- Case 5:object.image = a:FadingLevel(nr) = 1 'ON
- Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
- Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
- Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
- Case 13:object.image = d:FadingLevel(nr) = 0 'Off
- End Select
- End Sub
- Sub FadeObjm(nr, object, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 4:object.image = b
- Case 5:object.image = a
- Case 9:object.image = c
- Case 13:object.image = d
- End Select
- End Sub
- Sub NFadeObj(nr, object, a, b)
- Select Case FadingLevel(nr)
- Case 4:object.image = b:FadingLevel(nr) = 0 'off
- Case 5:object.image = a:FadingLevel(nr) = 1 'on
- End Select
- End Sub
- Sub NFadeObjm(nr, object, a, b)
- Select Case FadingLevel(nr)
- Case 4:object.image = b
- Case 5:object.image = a
- End Select
- End Sub
- ' Flasher objects
- Sub Flash(nr, object)
- Select Case FadingLevel(nr)
- Case 4 'off
- FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
- If FlashLevel(nr) < FlashMin(nr) Then
- FlashLevel(nr) = FlashMin(nr)
- FadingLevel(nr) = 0 'completely off
- End if
- Object.IntensityScale = FlashLevel(nr)
- Case 5 ' on
- FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
- If FlashLevel(nr) > FlashMax(nr) Then
- FlashLevel(nr) = FlashMax(nr)
- FadingLevel(nr) = 1 'completely on
- End if
- Object.IntensityScale = FlashLevel(nr)
- End Select
- End Sub
- Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
- Object.IntensityScale = FlashLevel(nr)
- End Sub
- ' *********************************************************************
- 'Fluppers Domes V2
- ' *********************************************************************
- Sub FlashRed2(flstate) 'Red Domes
- If Flstate Then
- Objlevel(2) = 1 : FlasherFlash2_Timer
- Objlevel(4) = 1 : FlasherFlash4_Timer
- End If
- End Sub
- Sub FlashRed6(flstate) 'Red Domes
- If Flstate Then
- Objlevel(6) = 1 : FlasherFlash6_Timer
- End If
- End Sub
- Sub FlashRed8(flstate) 'Red Domes
- If Flstate Then
- Objlevel(8) = 1 : FlasherFlash8_Timer
- End If
- End Sub
- Dim TestFlashers, TableRef, FlasherLightIntensity, FlasherFlareIntensity, FlasherOffBrightness
- ' *********************************************************************
- TestFlashers = 0 ' *** set this to 1 to check position of flasher object ***
- Set TableRef = Table1 ' *** change this, if your table has another name ***
- FlasherLightIntensity = 1 ' *** lower this, if the VPX lights are too bright (i.e. 0.1) ***
- FlasherFlareIntensity = 1 ' *** lower this, if the flares are too bright (i.e. 0.1) ***
- FlasherOffBrightness = 0.5 ' *** brightness of the flasher dome when switched off (range 0-2) ***
- ' *********************************************************************
- Dim ObjLevel(20), objbase(20), objlit(20), objflasher(20), objlight(20)
- Dim tablewidth, tableheight : tablewidth = TableRef.width : tableheight = TableRef.height
- 'initialise the flasher color, you can only choose from "green", "red", "purple", "blue", "white" and "yellow"
- InitFlasher 2, "red"
- InitFlasher 4, "red"
- InitFlasher 6, "red"
- InitFlasher 8, "red"
- 'InitFlasher 9, "white"
- 'InitFlasher 10, "red"
- 'InitFlasher 11, "red"
- 'InitFlasher 13, "red"
- 'InitFlasher 16, "yellow"
- 'InitFlasher 17, "yellow"
- 'InitFlasher 18, "yellow"
- ' rotate the flasher with the command below (first argument = flasher nr, second argument = angle in degrees)
- 'RotateFlasher 11,90
- Sub InitFlasher(nr, col)
- ' store all objects in an array for use in FlashFlasher subroutine
- Set objbase(nr) = Eval("Flasherbase" & nr) : Set objlit(nr) = Eval("Flasherlit" & nr)
- Set objflasher(nr) = Eval("Flasherflash" & nr) : Set objlight(nr) = Eval("Flasherlight" & nr)
- ' If the flasher is parallel to the playfield, rotate the VPX flasher object for POV and place it at the correct height
- If objbase(nr).RotY = 0 Then
- objbase(nr).ObjRotZ = atn( (tablewidth/2 - objbase(nr).x) / (objbase(nr).y - tableheight*1.1)) * 180 / 3.14159
- objflasher(nr).RotZ = objbase(nr).ObjRotZ : objflasher(nr).height = objbase(nr).z + 60
- End If
- ' set all effects to invisible and move the lit primitive at the same position and rotation as the base primitive
- objlight(nr).IntensityScale = 0 : objlit(nr).visible = 0 : objlit(nr).material = "Flashermaterial" & nr
- objlit(nr).RotX = objbase(nr).RotX : objlit(nr).RotY = objbase(nr).RotY : objlit(nr).RotZ = objbase(nr).RotZ
- objlit(nr).ObjRotX = objbase(nr).ObjRotX : objlit(nr).ObjRotY = objbase(nr).ObjRotY : objlit(nr).ObjRotZ = objbase(nr).ObjRotZ
- objlit(nr).x = objbase(nr).x : objlit(nr).y = objbase(nr).y : objlit(nr).z = objbase(nr).z
- objbase(nr).BlendDisableLighting = FlasherOffBrightness
- ' set the texture and color of all objects
- select case objbase(nr).image
- Case "dome2basewhite" : objbase(nr).image = "dome2base" & col : objlit(nr).image = "dome2lit" & col :
- Case "ronddomebasewhite" : objbase(nr).image = "ronddomebase" & col : objlit(nr).image = "ronddomelit" & col
- Case "domeearbasewhite" : objbase(nr).image = "domeearbase" & col : objlit(nr).image = "domeearlit" & col
- end select
- If TestFlashers = 0 Then objflasher(nr).imageA = "domeflashwhite" : objflasher(nr).visible = 0 : End If
- select case col
- Case "blue" : objlight(nr).color = RGB(4,120,255) : objflasher(nr).color = RGB(200,255,255) : objlight(nr).intensity = 5000
- Case "green" : objlight(nr).color = RGB(12,255,4) : objflasher(nr).color = RGB(12,255,4)
- Case "red" : objlight(nr).color = RGB(255,32,4) : objflasher(nr).color = RGB(255,32,4)
- Case "purple" : objlight(nr).color = RGB(230,49,255) : objflasher(nr).color = RGB(255,64,255)
- Case "yellow" : objlight(nr).color = RGB(200,173,25) : objflasher(nr).color = RGB(255,200,50)
- Case "white" : objlight(nr).color = RGB(255,240,150) : objflasher(nr).color = RGB(100,86,59)
- end select
- objlight(nr).colorfull = objlight(nr).color
- If TableRef.ShowDT and ObjFlasher(nr).RotX = -45 Then
- objflasher(nr).height = objflasher(nr).height - 20 * ObjFlasher(nr).y / tableheight
- ObjFlasher(nr).y = ObjFlasher(nr).y + 10
- End If
- End Sub
- Sub RotateFlasher(nr, angle) : angle = ((angle + 360 - objbase(nr).ObjRotZ) mod 180)/30 : objbase(nr).showframe(angle) : objlit(nr).showframe(angle) : End Sub
- Sub FlashFlasher(nr)
- If not objflasher(nr).TimerEnabled Then objflasher(nr).TimerEnabled = True : objflasher(nr).visible = 1 : objlit(nr).visible = 1 : End If
- objflasher(nr).opacity = 1000 * FlasherFlareIntensity * ObjLevel(nr)^2.5
- objlight(nr).IntensityScale = 0.5 * FlasherLightIntensity * ObjLevel(nr)^3
- objbase(nr).BlendDisableLighting = FlasherOffBrightness + 10 * ObjLevel(nr)^3
- objlit(nr).BlendDisableLighting = 10 * ObjLevel(nr)^2
- UpdateMaterial "Flashermaterial" & nr,0,0,0,0,0,0,ObjLevel(nr),RGB(255,255,255),0,0,False,True,0,0,0,0
- ObjLevel(nr) = ObjLevel(nr) * 0.9 - 0.01
- If ObjLevel(nr) < 0 Then objflasher(nr).TimerEnabled = False : objflasher(nr).visible = 0 : objlit(nr).visible = 0 : End If
- End Sub
- Sub FlasherFlash2_Timer() : FlashFlasher(2) : End Sub
- Sub FlasherFlash4_Timer() : FlashFlasher(4) : End Sub
- Sub FlasherFlash6_Timer() : FlashFlasher(6) : End Sub
- Sub FlasherFlash8_Timer() : FlashFlasher(8) : End Sub
- 'Sub FlasherFlash9_Timer() : FlashFlasher(9) : End Sub
- 'Sub FlasherFlash10_Timer() : FlashFlasher(10) : End Sub
- 'Sub FlasherFlash11_Timer() : FlashFlasher(11) : End Sub
- 'Sub FlasherFlash13_Timer() : FlashFlasher(13) : End Sub
- 'Sub FlasherFlash16_Timer() : FlashFlasher(16) : End Sub
- 'Sub FlasherFlash17_Timer() : FlashFlasher(17) : End Sub
- 'Sub FlasherFlash18_Timer() : FlashFlasher(18) : End Sub
- '*************
- ' JP'S LUT
- '*************
- Dim bLutActive, LUTImage
- Sub LoadLUT
- Dim x
- x = LoadValue(cGameName, "LUTImage")
- If(x <> "") Then LUTImage = x Else LUTImage = 0
- UpdateLUT
- End Sub
- Sub SaveLUT
- SaveValue cGameName, "LUTImage", LUTImage
- End Sub
- Sub NextLUT: LUTImage = (LUTImage +1 ) MOD 10: UpdateLUT: SaveLUT: End Sub
- Sub UpdateLUT
- Select Case LutImage
- Case 0: table1.ColorGradeImage = "LUT0"
- Case 1: table1.ColorGradeImage = "LUT1"
- Case 2: table1.ColorGradeImage = "LUT2"
- Case 3: table1.ColorGradeImage = "LUT3"
- Case 4: table1.ColorGradeImage = "LUT4"
- Case 5: table1.ColorGradeImage = "LUT5"
- Case 6: table1.ColorGradeImage = "LUT6"
- Case 7: table1.ColorGradeImage = "LUT7"
- Case 8: table1.ColorGradeImage = "LUT8"
- Case 9: table1.ColorGradeImage = "LUT9"
- End Select
- End Sub
- '*********************************************************************
- ' Positional Sound Playback Functions
- '*********************************************************************
- ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
- ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
- ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
- Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
- PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
- End Sub
- ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
- Sub PlaySoundAt(soundname, tableobj)
- PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBall(soundname)
- PlaySoundAt soundname, ActiveBall
- End Sub
- '*********************************************************************
- ' Supporting Ball & Sound Functions
- '*********************************************************************
- Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.y * 2 / table1.height-1
- If tmp > 0 Then
- AudioFade = Csng(tmp ^10)
- Else
- AudioFade = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.x * 2 / table1.width-1
- If tmp > 0 Then
- AudioPan = Csng(tmp ^10)
- Else
- AudioPan = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2 / 2000)
- End Function
- Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
- Pitch = BallVel(ball) * 20
- End Function
- Function BallVel(ball) 'Calculates the ball speed
- BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
- End Function
- '********************************************************************
- ' JP's VP10 Rolling Sounds (+rothbauerw's Dropping Sounds)
- '********************************************************************
- Const tnob = 5 ' total number of balls
- ReDim rolling(tnob)
- InitRolling
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingTimer_Timer()
- Dim BOT, b
- BOT = GetBalls
- ' stop the sound of deleted balls
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & b)
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- For b = 0 to UBound(BOT)
- ' play the rolling sound for each ball
- If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
- rolling(b) = True
- PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- Else
- If rolling(b) = True Then
- StopSound("fx_ballrolling" & b)
- rolling(b) = False
- End If
- End If
- ' play ball drop sounds
- If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
- PlaySound "fx_ball_drop" & b, 0, ABS(BOT(b).velz)/17, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- End If
- Next
- End Sub
- '**********************
- ' Ball Collision Sound
- '**********************
- Sub OnBallBallCollision(ball1, ball2, velocity)
- PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
- End Sub
- '*****************************************
- ' ninuzzu's FLIPPER SHADOWS
- '*****************************************
- sub FlipperTimer_Timer()
- FlipperLSh.RotZ = LeftFlipper.currentangle
- FlipperRSh.RotZ = RightFlipper.currentangle
- Prim_LeftFlipper.RotY=LeftFlipper.currentangle-90
- Prim_RightFlipper.RotY=RightFlipper.currentangle-90
- End Sub
- '*****************************************
- ' ninuzzu's BALL SHADOW
- '*****************************************
- Dim BallShadow
- BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
- Sub BallShadowUpdate_timer()
- Dim BOT, b
- BOT = GetBalls
- ' hide shadow of deleted balls
- If UBound(BOT)<(tnob-1) Then
- For b = (UBound(BOT) + 1) to (tnob-1)
- BallShadow(b).visible = 0
- Next
- End If
- ' exit the Sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' render the shadow for each ball
- For b = 0 to UBound(BOT)
- If BOT(b).X < Table1.Width/2 Then
- BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
- Else
- BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
- End If
- ballShadow(b).Y = BOT(b).Y + 12
- If BOT(b).Z > 20 Then
- BallShadow(b).visible = 1
- Else
- BallShadow(b).visible = 0
- End If
- Next
- End Sub
- '************************************
- ' What you need to add to your table
- '************************************
- ' a timer called RollingTimer. With a fast interval, like 10
- ' one collision sound, in this script is called fx_collide
- ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
- ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
- '******************************************
- ' Explanation of the rolling sound routine
- '******************************************
- ' sounds are played based on the ball speed and position
- ' the routine checks first for deleted balls and stops the rolling sound.
- ' The For loop goes through all the balls on the table and checks for the ball speed and
- ' if the ball is on the table (height lower than 30) then then it plays the sound
- ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
- ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
- ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
- ' according to the position of the ball on the table.
- '**************************************
- ' Explanation of the collision routine
- '**************************************
- ' The collision is built in VP.
- ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
- ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
- ' depending of the speed of the collision.
- Sub Pins_Hit (idx)
- PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Targets_Hit (idx)
- PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Thin_Hit (idx)
- PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Medium_Hit (idx)
- PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals2_Hit (idx)
- PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Spinner_Spin
- PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
- End Sub
- Sub Rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 20 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 20 then
- RandomSoundRubber()
- End If
- End Sub
- Sub Posts_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- RandomSoundRubber()
- End If
- End Sub
- Sub RandomSoundRubber()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- Sub LeftFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RightFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RandomSoundFlipper()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- Sub Table1_Exit()
- If B2SOn Then
- Controller.Pause = False
- Controller.Stop
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment