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="milln_l3",UseSolenoids=2,UseLamps=0,UseGI=0,sCoin="coin"
- LoadVPM "01560000", "S11.VBS", 3.26
- 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
- '*************************************************************
- 'Solenoid Call backs
- '**********************************************************************************************************
- SolCallback(1)="bsTrough.SolIn"
- SolCallback(2)="bsTrough.SolOut"
- SolCallback(3)="bsLE.SolOut"
- SolCallback(4)="bsRI.SolOut"
- SolCallback(5)="SolDrop1"
- SolCallback(6)="SolDrop2"
- SolCallback(7)="bsRK.SolOut"
- SolCallback(8)="vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
- SolCallback(9)="bsCK.SolOut"
- SolCallback(11)="PFGI"
- SolCallback(13)="SolRightGate"
- SolCallback(14)="SolBallGate"
- SolCallback(16) = "EngageRoulette" 'Playfield Wheel Relay
- SolCallback(17)="SolLeftGate"
- 'SolCallback(18)="vpmSolSound ""bumper"","
- 'SolCallback(19)="vpmSolSound ""bumper"","
- 'SolCallback(20)="vpmSolSound ""bumper"","
- 'SolCallback(21)="vpmSolSound ""slingshot"","
- 'SolCallback(22)="vpmSolSound ""slingshot"","
- SolCallback(25)="FlashYellow6" 'Top Right Flasher 01C
- SolCallback(26)="FlashYellow4" 'Top Left Flasher 02C
- SolCallback(27)="BsTP.SolOut"
- SolCallback(28)="FlashYellow1" 'Middle Top Flashers 04C
- SolCallback(29)="FlashYellow5" 'Middle Flashers 05C
- SolCallback(30)="FlashYellow9" 'Middle Buttom Flashers 06C
- SolCallback(31)="FlashYellow2" 'Left Flasher 07C
- SolCallback(32)="FlashYellow8" 'Right Flasher 08C
- 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:RightUpperFlipper.RotateToEnd
- Else
- PlaySound SoundFx("fx_FlipperDown",DOFFlippers):RightFlipper.RotateToStart:RightUpperFlipper.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
- Sub SolDrop1(enabled)
- Controller.Switch(39)=0
- Playsound SoundFX("resetdrop",DOFDropTargets)
- End Sub
- Sub SolDrop2(enabled)
- Controller.Switch(40)=0
- Playsound SoundFX("resetdrop",DOFDropTargets)
- End Sub
- Sub SolRightGate(enabled)
- If enabled Then
- RightGate.RotateToEnd
- Else
- RightGate.RotateToStart
- End If
- End Sub
- Sub SolLeftGate(enabled)
- If enabled Then
- LeftGate.RotateToEnd
- Else
- LeftGate.RotateToStart
- End If
- End Sub
- Sub SolBallGate(enabled)
- If enabled Then
- If GateStep=0 Then GateStep=1
- BallGate.Enabled=1 : Bgate=1
- Else
- Bgate=0
- End If
- End Sub
- Sub BallGate_Timer()
- Select Case GateStep
- Case 1 : w1.IsDropped=1 : w2.IsDropped=0 : Ballgate.Interval=210 : GateStep=2
- Case 2 : w2.IsDropped=1 : w3.IsDropped=0 : Ballgate.Interval=175 : GateStep=3
- Case 3 : w3.IsDropped=1 : w4.IsDropped=0 : Ballgate.Interval=140 : GateStep=4
- Case 4 : w4.IsDropped=1 : w5.IsDropped=0 : Ballgate.Interval=105 : GateStep=5
- Case 5 : w5.IsDropped=1 : w6.IsDropped=0 : Ballgate.Interval=70 : GateStep=6
- Case 6 : w6.IsDropped=1 : w7.IsDropped=0 : Ballgate.Interval=35 : GateStep=7
- Case 7 : w7.IsDropped=1 : w8.IsDropped=0 : Ballgate.Interval=35 : GateStep=8
- Case 8 : w8.IsDropped=1 : w9.IsDropped=0 : Ballgate.Interval=35 : GateStep=9
- Case 9 : w9.IsDropped=1 : w10.IsDropped=0 : Ballgate.Interval=35 : GateStep=10
- Case 10 : w10.IsDropped=1 : w11.IsDropped=0 : Ballgate.Interval=35 : GateStep=11
- Case 11 : w11.IsDropped=1 : w12.IsDropped=0 : Ballgate.Interval=35 : GateStep=12
- Case 12 : w12.IsDropped=1 : w13.IsDropped=0 : Ballgate.Interval=35 : GateStep=13
- Case 13 : w13.IsDropped=1 : w14.IsDropped=0 : Ballgate.Interval=70 : GateStep=14
- Case 14 : w14.IsDropped=1 : w15.IsDropped=0 : Ballgate.Interval=105 : GateStep=15
- Case 15 : w15.IsDropped=1 : w16.IsDropped=0 : Ballgate.Interval=140 : GateStep=16
- Case 16 : w16.IsDropped=1 : w17.IsDropped=0 : Ballgate.Interval=175 : GateStep=17
- Case 17 : w17.IsDropped=1 : w18.IsDropped=0 : Ballgate.Interval=210 : GateStep=18
- Case 18 : w18.IsDropped=1 : w17.IsDropped=0 : Ballgate.Interval=175 : GateStep=19
- Case 19 : w17.IsDropped=1 : w16.IsDropped=0 : Ballgate.Interval=140 : GateStep=20
- Case 20 : w16.IsDropped=1 : w15.IsDropped=0 : Ballgate.Interval=105 : GateStep=21
- Case 21 : w15.IsDropped=1 : w14.IsDropped=0 : Ballgate.Interval=70 : GateStep=22
- Case 22 : w14.IsDropped=1 : w13.IsDropped=0 : Ballgate.Interval=35 : GateStep=23
- Case 23 : w13.IsDropped=1 : w12.IsDropped=0 : Ballgate.Interval=35 : GateStep=24
- Case 24 : w12.IsDropped=1 : w11.IsDropped=0 : Ballgate.Interval=35 : GateStep=25
- Case 25 : w11.IsDropped=1 : w10.IsDropped=0 : Ballgate.Interval=35 : GateStep=26
- Case 26 : w10.IsDropped=1 : w9.IsDropped=0 : Ballgate.Interval=35 : GateStep=27
- Case 27 : w9.IsDropped=1 : w8.IsDropped=0 : Ballgate.Interval=35 : GateStep=28
- Case 28 : w8.IsDropped=1 : w7.IsDropped=0 : Ballgate.Interval=35 : GateStep=29
- Case 29 : w7.IsDropped=1 : w6.IsDropped=0 : Ballgate.Interval=70 : GateStep=30
- Case 30 : w6.IsDropped=1 : w5.IsDropped=0 : Ballgate.Interval=105 : GateStep=31
- Case 31 : w5.IsDropped=1 : w4.IsDropped=0 : Ballgate.Interval=140 : GateStep=32
- Case 32 : w4.IsDropped=1 : w3.IsDropped=0 : Ballgate.Interval=175 : GateStep=33
- Case 33 : w3.IsDropped=1 : w2.IsDropped=0 : Ballgate.Interval=210 : GateStep=34
- Case 34 : w2.IsDropped=1 : w1.IsDropped=0
- If Bgate=0 Then Ballgate.Enabled=0
- GateStep=1
- End Select
- End Sub
- '************
- ' Table init.
- '************
- dim bsTrough, bsLE, bsRI, bsCK, bsTP, bsRK, ttRTE, x, BGate, GateStep, ttwheel, ii
- 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=3
- vpmNudge.TiltObj=Array(LBumper, RBumper, BBumper, LeftSlingshot, RightSlingshot)
- ' Trough
- Set bsTrough=New cvpmBallStack
- bsTrough.InitSw 36, 33, 34, 0, 0, 0, 0, 0
- bsTrough.InitKick BallRelease, 80, 6
- bsTrough.InitExitSnd SoundFX("BallRel",DOFContactors),SoundFX("Solenoid",DOFContactors)
- bsTrough.Balls=2
- ' Left Eject
- Set bsLE=New cvpmBallStack
- bsLE.InitSaucer sw31, 31, 158, 8
- bsLE.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
- bsLE.KickAngleVar=1
- bsLE.KickForceVar=1
- ' Right Eject
- Set bsRI=New cvpmBallStack
- bsRI.InitSaucer sw32, 32, 205, 8
- bsRI.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
- bsRI.KickAngleVar=1
- bsRI.KickForceVar=1
- ' Top Kickbig
- Set bsTP=New cvpmBallStack
- bsTP.InitSaucer sw42, 42, 270, 20
- bsTP.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
- ' Right Kickbig
- Set bsRK=New cvpmBallStack
- bsRK.InitSaucer sw60, 60, 90, 18
- bsRK.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
- ' Center Kickbig
- Set bsCK=New cvpmBallStack
- bsCK.InitSaucer sw43, 43, 175, 16
- bsCK.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
- bsCK.KickAngleVar=5
- bsCK.KickForceVar=5
- ' Roulette
- Set ttWheel = New cvpmTurntable
- ttWheel.InitTurntable ttWheelTrig, 30 '20
- ttWheel.spinup=100
- ttWheel.spindown=100
- ttWheel.CreateEvents "ttWheel"
- Init_Roulette
- 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 keycode=RightFlipperKey Then Controller.Switch(38)=1
- If keycode=LeftFlipperKey Then Controller.Switch(37)=1
- If keycode=PlungerKey Then Plunger.Pullback:playsound"plungerpull"
- If KeyDownHandler(keycode) Then Exit Sub
- End Sub
- Sub Table1_KeyUp(ByVal Keycode)
- If keycode = LeftMagnaSave Then bLutActive = False
- If keycode=RightFlipperKey Then Controller.Switch(38)=0
- If keycode=LeftFlipperKey Then Controller.Switch(37)=0
- If keycode=PlungerKey Then Plunger.Fire:playsound"plunger"
- If KeyUpHandler(keycode) Then Exit Sub
- End Sub
- '*********
- ' Switches
- '*********
- 'Rubber Wall
- Sub sw59_Hit:vpmTimer.PulseSw 59:PlaySound"rubber":End Sub
- ' Eject holes
- Sub Drain_Hit:bsTrough.addball me : playsound "Drain": End Sub
- Sub sw31_Hit:bsLE.AddBall Me : playsound "Popper_Ball": End Sub
- Sub sw42_Hit : help1.enabled=1:bsTP.AddBall Me : End Sub
- Sub sw32_Hit : bsRI.AddBall Me : playsound "Popper_Ball": End Sub
- Sub sw43_Hit : bsCK.AddBall Me : playsound "Popper_Ball": End Sub
- Sub sw60_Hit : bsRK.AddBall Me : playsound "Popper_Ball": End Sub
- 'Wire Triggers
- Sub sw11_Hit:Controller.Switch(11)=1:PlaySound"sensor":End Sub
- Sub sw11_UnHit:Controller.Switch(11)=0:End Sub
- Sub sw15_Hit:Controller.Switch(15)=1:PlaySound"sensor":End Sub
- Sub sw15_UnHit:Controller.Switch(15)=0:End Sub
- Sub sw12_Hit:Controller.Switch(12)=1:PlaySound"sensor":End Sub
- Sub sw12_UnHit:Controller.Switch(12)=0:End Sub
- Sub sw16_Hit:Controller.Switch(16)=1:PlaySound"sensor":End Sub
- Sub sw16_UnHit:Controller.Switch(16)=0:End Sub
- Sub sw44_Hit:Controller.Switch(44)=1:PlaySound"sensor":End Sub
- Sub sw44_UnHit:Controller.Switch(44)=0:End Sub
- Sub sw49_Hit:Controller.Switch(49)=1:PlaySound"sensor":End Sub
- Sub sw49_UnHit:Controller.Switch(49)=0:End Sub
- Sub sw24Hit:Controller.Switch(24)=1:PlaySound"sensor":End Sub
- Sub sw24_UnHit:Controller.Switch(24)=0:End Sub
- ' Targets
- Sub sw10_Hit:vpmTimer.PulseSw(10):PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw17_Hit:vpmTimer.PulseSw(17):PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw18_Hit:vpmTimer.PulseSw(18):PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw19_Hit:vpmTimer.PulseSw(19):PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw20_Hit:vpmTimer.PulseSw(20):PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw22_Hit:vpmTimer.PulseSw(22):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 sw27_Hit:vpmTimer.PulseSw(27):PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw28_Hit:vpmTimer.PulseSw(28):PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw29_Hit:vpmTimer.PulseSw(29):PlaySound SoundFX("Target",DOFTargets):End Sub
- Sub sw30_Hit:vpmTimer.PulseSw(30):PlaySound SoundFX("Target",DOFTargets):End Sub
- ' Drop targets
- Sub sw39_Hit : Controller.Switch(39)=1 : PlaySound SoundFX("droptarget",DOFDropTargets) : End Sub
- Sub sw40_Hit : Controller.Switch(40)=1 : PlaySound SoundFX("droptarget",DOFDropTargets) : End Sub
- ' Gates
- Sub Gate1_Hit() : PlaySound "Gate5" : End Sub
- Sub Gate2_Hit() : PlaySound "Gate5" : End Sub
- Sub Gate3_Hit() : PlaySound "Gate5" : End Sub
- Sub sw41_Hit():vpmTimer.PulseSw(41):PlaySound "Gate5":End Sub
- ' Bumpers
- Sub LBumper_Hit:vpmTimer.PulseSw 50:Playsound SoundFX("fx_bumper1",DOFContactors): End Sub
- Sub RBumper_Hit:vpmTimer.PulseSw 51:Playsound SoundFX("fx_bumper2",DOFContactors): End Sub
- Sub BBumper_Hit:vpmTimer.PulseSw 52:Playsound SoundFX("fx_bumper3",DOFContactors): End Sub
- '*****************
- 'Ramp help kickers
- '*****************
- Sub Help1_Hit()
- Help1.DestroyBall
- Help2.CreateBall
- help1.enabled=0
- Help2.Kick 90, 15
- End Sub
- Sub Help3_Hit()
- ActiveBall.VelY=0.1
- End Sub
- Sub Help5_Hit()
- Help5.DestroyBall
- Help6.CreateBall
- Help6.Kick 160, 2
- End Sub
- '*****************************************************************
- 'Functions
- '*****************************************************************
- '*** AngleIsNear returns true if the testangle is within range degrees of the target angle for 0 to 360 degree scale
- Function AngleIsNear(testangle, target, range)
- If target <= range Then
- AngleIsNear = ( (testangle + (range*2) ) mod 360 >= target + range ) AND ( (testangle + (range*2) ) mod 360 <= target + (range*3) )
- ElseIf target >= 360 - range Then
- AngleIsNear = ( (testangle - (range*2) ) mod 360 >= target - (range*3) ) AND ( (testangle - (range*2) ) mod 360 <= target - range )
- Else
- AngleIsNear = (testangle >= target - range) AND (testangle <= target + range)
- End If
- End Function
- '*** CalcAngle returns the angle of a point (x,y) on a circle with center (centerx, centery) with angle 0 at 3 o'clock
- Function CalcAngle(x,y,centerX,centerY)
- Dim tmpAngle
- tmpAngle = Atan2(x - centerX, y - centerY) * 180 / (4*Atn(1)) + 90
- If tmpAngle < 0 Then
- CalcAngle = tmpAngle + 360
- Else
- CalcAngle = tmpAngle
- End If
- End Function
- '*** Atan2 returns the Atan2 for a point on a circle (x,y)
- Function Atan2(x,y)
- If x > 0 Then
- Atan2 = Atn(y/x)
- ElseIf x < 0 Then
- Atan2 = Sgn(y) * ((4*Atn(1)) - Atn(Abs(y/x)))
- ElseIf y = 0 Then
- Atan2 = 0
- Else
- Atan2 = Sgn(y) * (4*Atn(1)) / 2
- End If
- End Function
- '********
- 'Roulette
- '********
- Dim roulette_step, roulette_time, wheelangle, ball, isOn, isOff, holeangle, holeanglemod, prevholeangle, whxx
- roulette_step = 0
- roulette_time = 0
- wheelangle = 0
- isOn = True
- isOff = True
- holeangle = 0
- Dim RouletteBall
- Dim GWHoles
- GWHoles = Array (sw54, sw55, sw56, sw61, sw62, sw63, sw64, sw45, sw46, sw47, sw48, sw53)
- Sub Init_Roulette()
- ' GWRamp.collidable=0
- Set RouletteBall = sw54.CreateSizedBallWithMass(18,20) '23,1.0*((23*2)^3)/125000
- RouletteBall.image = "ball2"
- RouletteSw.enabled = 1
- End Sub
- Sub EngageRoulette(enabled):If enabled then:isOn=True:isOff=true:roulette.enabled = 1:End If:End Sub
- Sub Roulette_Timer()
- Wheel.Rotz = 180 + wheelangle
- wheelangle = wheelangle + roulette_step
- holeangle = wheelangle mod 30
- prevholeangle = holeangle
- if roulette_time < 800 Then '1500
- if isOn = True And isOff = True Then
- For each ii in Rswitches:Controller.switch(ii)=1:next
- roulettesw.enabled = false
- For ii = 0 to 11
- GWHoles(ii).kick (ii+1)*30+60, (rnd(4))+12
- GWHoles(ii).enabled = false
- Next
- ' GWRamp.collidable = 1
- ttWheel.MotorOn = True
- isOn = False
- Playsound "fx_motor"
- End If
- If wheelangle > 360 Then: wheelangle=wheelangle-360:End If
- roulette_step = roulette_step + 0.05
- If roulette_step > 0.75 Then: roulette_step = 0.75:End If
- Else
- if isOff = True Then
- ttWheel.MotorOn = False
- isOff = False
- StopSound "fx_motor"
- End If
- roulette_step = roulette_step - 0.0005
- If roulette_step < 0.15 and holeangle = 0 Then
- ' GWRamp.collidable = 0
- roulette_step=0
- roulette.enabled = false
- roulettesw.enabled = true
- roulette_time = 0
- End If
- End If
- roulette_time = roulette_time + 1
- End Sub
- Dim RouletteAtRest, RouletteBallAngle, RouletteX, RouletteY, RouletteAtn2, Rswitches, Rletters(12)
- Const RouletteCenterX = 435
- Const RouletteCenterY = 1222
- RouletteAtRest = 0
- Rswitches = array(54, 55, 56, 61, 62, 63, 64, 45, 46, 47, 48, 53)
- Sub GetRouletteSw()
- RouletteBallAngle = CalcAngle(RouletteBall.X,RouletteBall.Y,RouletteCenterX,RouletteCenterY)
- 'Rletters(0) = wheelangle + 38
- 'Rletters(0) = 0
- for ii = 0 to 11
- 'Rletters(ii) = (Rletters(0) + (ii*30)) mod 360
- Rletters(ii) = ii*30
- 'debug.print "BallAngle: " & RouletteBallAngle & " Rletters: " & Rletters(ii) & " ii: " & ii
- If AngleIsNear(RouletteBallAngle,Rletters(ii),15) Then
- Controller.Switch(Rswitches(ii)) = 0
- Exit For
- End If
- next
- End Sub
- Sub RouletteSw_Timer()
- 'debug.print BallVel(RouletteBall)
- If BallVel(RouletteBall) < 2 Then
- For each ii in GWKickers
- ii.enabled = true
- next
- End If
- End Sub
- Sub sw54_hit():GetRouletteSw:End Sub
- Sub sw55_hit():GetRouletteSw:End Sub
- Sub sw56_hit():GetRouletteSw:End Sub
- Sub sw61_hit():GetRouletteSw:End Sub
- Sub sw62_hit():GetRouletteSw:End Sub
- Sub sw63_hit():GetRouletteSw:End Sub
- Sub sw64_hit():GetRouletteSw:End Sub
- Sub sw45_hit():GetRouletteSw:End Sub
- Sub sw46_hit():GetRouletteSw:End Sub
- Sub sw47_hit():GetRouletteSw:End Sub
- Sub sw48_hit():GetRouletteSw:End Sub
- Sub sw53_hit():GetRouletteSw:End Sub
- '**********Sling Shot Animations
- ' Rstep and Lstep are the variables that increment the animation
- '****************
- Dim RStep, Lstep
- Sub RightSlingShot_Slingshot
- vpmTimer.PulseSw 58
- 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 57
- 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
- '***************************
- ' LED display
- ' Based on the Eala's rutine
- '***************************
- Dim Digits(32)
- Digits(0)=Array(a00,a05,a0c,a0d,a08,a01,a06,a0f,a02,a03,a04,a07,a0b,a0a,a09,a0e)
- Digits(1)=Array(a10,a15,a1c,a1d,a18,a11,a16,a1f,a12,a13,a14,a17,a1b,a1a,a19,a1e)
- Digits(2)=Array(a20,a25,a2c,a2d,a28,a21,a26,a2f,a22,a23,a24,a27,a2b,a2a,a29,a2e)
- Digits(3)=Array(a30,a35,a3c,a3d,a38,a31,a36,a3f,a32,a33,a34,a37,a3b,a3a,a39,a3e)
- Digits(4)=Array(a40,a45,a4c,a4d,a48,a41,a46,a4f,a42,a43,a44,a47,a4b,a4a,a49,a4e)
- Digits(5)=Array(a50,a55,a5c,a5d,a58,a51,a56,a5f,a52,a53,a54,a57,a5b,a5a,a59,a5e)
- Digits(6)=Array(a60,a65,a6c,a6d,a68,a61,a66,a6f,a62,a63,a64,a67,a6b,a6a,a69,a6e)
- Digits(7)=Array(b00,b05,b0c,b0d,b08,b01,b06,b0f,b02,b03,b04,b07,b0b,b0a,b09,b0e)
- Digits(8)=Array(b10,b15,b1c,b1d,b18,b11,b16,b1f,b12,b13,b14,b17,b1b,b1a,b19,b1e)
- Digits(9)=Array(b20,b25,b2c,b2d,b28,b21,b26,b2f,b22,b23,b24,b27,b2b,b2a,b29,b2e)
- Digits(10)=Array(b30,b35,b3c,b3d,b38,b31,b36,b3f,b32,b33,b34,b37,b3b,b3a,b39,b3e)
- Digits(11)=Array(b40,b45,b4c,b4d,b48,b41,b46,b4f,b42,b43,b44,b47,b4b,b4a,b49,b4e)
- Digits(12)=Array(b50,b55,b5c,b5d,b58,b51,b56,b5f,b52,b53,b54,b57,b5b,b5a,b59,b5e)
- Digits(13)=Array(b60,b65,b6c,b6d,b68,b61,b66,b6f,b62,b63,b64,b67,b6b,b6a,b69,b6e)
- Digits(14)=Array(c00,c02,c05,c06,c04,c01,c03,c07)
- Digits(15)=Array(c10,c12,c15,c16,c14,c11,c13,c17)
- Digits(16)=Array(c20,c22,c25,c26,c24,c21,c23,c27)
- Digits(17)=Array(c30,c32,c35,c36,c34,c31,c33,c37)
- Digits(18)=Array(c40,c42,c45,c46,c44,c41,c43,c47)
- Digits(19)=Array(c50,c52,c55,c56,c54,c51,c53,c57)
- Digits(20)=Array(c60,c62,c65,c66,c64,c61,c63,c67)
- Digits(21)=Array(d00,d02,d05,d06,d04,d01,d03,d07)
- Digits(22)=Array(d10,d12,d15,d16,d14,d11,d13,d17)
- Digits(23)=Array(d20,d22,d25,d26,d24,d21,d23,d27)
- Digits(24)=Array(d30,d32,d35,d36,d34,d31,d33,d37)
- Digits(25)=Array(d40,d42,d45,d46,d44,d41,d43,d47)
- Digits(26)=Array(d50,d52,d55,d56,d54,d51,d53,d57)
- Digits(27)=Array(d60,d62,d65,d66,d64,d61,d63,d67)
- Digits(30)=Array(e00,e02,e05,e06,e04,e01,e03)
- Digits(31)=Array(e10,e12,e15,e16,e14,e11,e13)
- Digits(28)=Array(f00,f02,f05,f06,f04,f01,f03)
- Digits(29)=Array(f10,f12,f15,f16,f14,f11,f13)
- Sub DisplayTimer_Timer
- Dim ChgLED,ii,num,chg,stat,obj
- ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
- If Not IsEmpty(ChgLED) Then
- If DesktopMode = True Then
- For ii = 0 To UBound(chgLED)
- num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
- if (num < 32) then
- For Each obj In Digits(num)
- If chg And 1 Then obj.State = stat And 1
- chg = chg\2 : stat = stat\2
- Next
- else
- end if
- next
- end if
- 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, L0
- ' NFadeL 1, L1
- ' NFadeL 2, L2
- ' NFadeL 3, L3
- NFadeL 4, L4
- NFadeL 5, L5
- NFadeL 6, L6
- NFadeL 7, L7
- NFadeL 8, L8
- NFadeL 9, L9
- NFadeL 10, L10
- NFadeL 11, L11
- NFadeL 12, L12
- NFadeL 13, L13
- NFadeL 14, L14
- NFadeL 15, L15
- NFadeL 16, L16
- NFadeL 17, L17
- NFadeL 18, L18
- NFadeL 19, L19
- NFadeL 20, L20
- NFadeL 21, L21
- NFadeL 22, L22
- NFadeL 23, L23
- NFadeL 24, L24
- NFadeL 25, L25
- NFadeL 26, L26
- NFadeL 27, L27
- NFadeL 28, L28
- NFadeL 29, L29
- NFadeL 30, L30
- NFadeL 31, L31
- NFadeL 32, L32
- NFadeL 33, L33
- NFadeL 34, L34
- NFadeL 35, L35
- NFadeL 36, L36
- NFadeL 37, L37
- NFadeL 38, L38
- NFadeL 39, L39
- NFadeL 40, L40
- NFadeL 41, L41
- NFadeL 42, L42
- NFadeL 43, L43
- NFadeL 44, L44
- NFadeL 45, L45
- NFadeL 46, L46
- NFadeL 47, L47
- NFadeL 48, L48
- NFadeL 49, L49
- NFadeL 50, L50
- NFadeL 51, L51
- NFadeL 52, L52
- NFadeL 53, L53
- NFadeL 54, L54
- NFadeL 55, L55
- NFadeL 56, L56
- NFadeL 57, L57
- NFadeL 58, L58
- NFadeL 59, L59
- NFadeL 60, L60
- NFadeL 61, L61
- NFadeL 62, L62
- NFadeL 63, L63
- NFadeL 64, L64
- 'Solenid Controlled Lamps
- 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 FlashYellow1(flstate) 'Yellow Domes
- If Flstate Then
- Objlevel(1) = 1 : FlasherFlash1_Timer
- PlaySound "fx_relay"
- Objlevel(3) = 1 : FlasherFlash3_Timer
- PlaySound "fx_relay"
- End If
- End Sub
- Sub FlashYellow5(flstate) 'Yellow Domes
- If Flstate Then
- Objlevel(5) = 1 : FlasherFlash5_Timer
- PlaySound "fx_relay"
- Objlevel(7) = 1 : FlasherFlash7_Timer
- PlaySound "fx_relay"
- End If
- End Sub
- Sub FlashYellow9(flstate) 'Yellow Domes
- If Flstate Then
- Objlevel(9) = 1 : FlasherFlash9_Timer
- PlaySound "fx_relay"
- Objlevel(11) = 1 : FlasherFlash11_Timer
- PlaySound "fx_relay"
- End If
- End Sub
- Sub FlashYellow2(flstate) 'Yellow Domes
- If Flstate Then
- Objlevel(2) = 1 : FlasherFlash2_Timer
- PlaySound "fx_relay"
- End If
- End Sub
- Sub FlashYellow4(flstate) 'Yellow Domes
- If Flstate Then
- Objlevel(4) = 1 : FlasherFlash4_Timer
- PlaySound "fx_relay"
- End If
- End Sub
- Sub FlashYellow6(flstate) 'Yellow Domes
- If Flstate Then
- Objlevel(6) = 1 : FlasherFlash6_Timer
- PlaySound "fx_relay"
- End If
- End Sub
- Sub FlashYellow8(flstate) 'Yellow Domes
- If Flstate Then
- Objlevel(8) = 1 : FlasherFlash8_Timer
- PlaySound "fx_relay"
- 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 1, "yellow"
- InitFlasher 3, "yellow"
- InitFlasher 2, "yellow"
- InitFlasher 4, "yellow"
- InitFlasher 5, "yellow"
- InitFlasher 6, "yellow"
- InitFlasher 7, "yellow"
- InitFlasher 8, "yellow"
- InitFlasher 9, "yellow"
- InitFlasher 11, "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 FlasherFlash1_Timer() : FlashFlasher(1) : End Sub
- Sub FlasherFlash3_Timer() : FlashFlasher(3) : End Sub
- Sub FlasherFlash2_Timer() : FlashFlasher(2) : End Sub
- Sub FlasherFlash4_Timer() : FlashFlasher(4) : End Sub
- Sub FlasherFlash5_Timer() : FlashFlasher(5) : End Sub
- Sub FlasherFlash6_Timer() : FlashFlasher(6) : End Sub
- Sub FlasherFlash7_Timer() : FlashFlasher(7) : End Sub
- Sub FlasherFlash8_Timer() : FlashFlasher(8) : End Sub
- Sub FlasherFlash9_Timer() : FlashFlasher(9) : End Sub
- Sub FlasherFlash11_Timer() : FlashFlasher(11) : End Sub
- '******************
- ' real time updates
- '******************
- Set MotorCallback = GetRef("RealTimeUpdates")
- Sub RealTimeUpdates
- Rightgatep.Roty = Rightgate.CurrentAngle
- Leftgatep.Roty = Leftgate.CurrentAngle
- Wheel.rotY 360 = Wheel.currentangle
- 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
- StopSound "fx_plasticrolling" & b
- StopSound "fx_metalrolling" & b
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' play the rolling sound for each ball
- For b = 0 to UBound(BOT)
- If BallVel(BOT(b) ) > 1 Then
- rolling(b) = True
- If BOT(b).Z > 30 Then
- ' ball on plastic ramp
- StopSound "fx_ballrolling" & b
- StopSound "fx_metalrolling" & b
- PlaySound "fx_plasticrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- Else
- ' ball on playfield
- StopSound "fx_plasticrolling" & b
- StopSound "fx_metalrolling" & b
- PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- End If
- Else
- If rolling(b) Then
- StopSound "fx_ballrolling" & b
- StopSound "fx_plasticrolling" & b
- StopSound "fx_metalrolling" & b
- rolling(b) = False
- End If
- End If
- ' ball drop sounds matching the adjusted height params but not the way down the ramps
- If BOT(b).VelZ < -1 And BOT(b).Z < 55 And BOT(b).Z > 27 then 'And Not InRect(BOT(b).X, BOT(b).Y, 610,320, 740,320, 740,550, 610,550) And Not InRect(BOT(b).X, BOT(b).Y, 180,400, 230,400, 230, 550, 180,550) Then
- PlaySound "fx_ball_drop" & Int(Rnd()*3), 0, ABS(BOT(b).VelZ)/17*5, 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
- FlipperURSh.RotZ = RightUpperFlipper.currentangle
- Rightgatep.Roty = Rightgate.CurrentAngle
- Leftgatep.Roty = Leftgate.CurrentAngle
- 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 "Gate5", 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