Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Back to the Future Collectors Edition
- ' Based on Back to the Future / IPD No. 126 / Data East June, 1990 / 4 Players
- ' VP911 version 1.0 by JPSalas Mars 2011
- 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
- LoadVPM "01560000", "DE.VBS", 3.26
- '********************
- 'Standard definitions
- '********************
- Const cGameName = "bttf_a27"
- Const UseSolenoids = 1
- Const UseLamps = 0
- Const UseGI = 0
- Const UseSync = 0
- Const HandleMech = 0
- ' Standard Sounds
- Const SSolenoidOn = "Solenoid"
- Const SSolenoidOff = ""
- Const SFlipperOn = "FlipperUp"
- Const SFlipperOff = "FlipperDown"
- Const SCoin = "Coin"
- Dim bsTrough, bsVuk, bsTR, vLock, x, bump1, bump2, bump3, DTBank
- '************
- ' Table init.
- '************
- Sub Table1_Init
- vpmInit Me
- With Controller
- .GameName = cGameName
- If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
- .SplashInfoLine = "Back to the Future Collectors Edition" & vbNewLine & "VP911 by JPSalas v1.0"
- ' DMD position and size, example
- '.Games(cGameName).Settings.Value("dmd_pos_x")=500
- '.Games(cGameName).Settings.Value("dmd_pos_y")=2
- '.Games(cGameName).Settings.Value("dmd_width")=400
- '.Games(cGameName).Settings.Value("dmd_height")=90
- .Games(cGameName).Settings.Value("rol") = 0 'rotate DMD to the left
- .HandleKeyboard = 0
- .ShowTitle = 0
- .ShowDMDOnly = 1
- .ShowFrame = 0
- .HandleMechanics = 0
- .Hidden = 0
- On Error Resume Next
- .Run GetPlayerHWnd
- If Err Then MsgBox Err.Description
- On Error Goto 0
- End With
- ' Nudging
- vpmNudge.TiltSwitch = swTilt
- vpmNudge.Sensitivity = 1
- vpmNudge.TiltObj = Array(bumper1, bumper2, bumper3, LeftSlingshot, RightSlingshot)
- ' Trough
- Set bsTrough = New cvpmBallStack
- With bsTrough
- .InitSw 0, 13, 12, 11, 0, 0, 0, 0
- .InitKick BallRelease, 90, 4
- .InitExitSnd SoundFX("ballrel",DOFContactors), SoundFX("Solenoid",DOFContactors)
- .Balls = 3
- End With
- ' Vuk
- Set bsVuk = New cvpmBallStack
- With bsVuk
- .InitSw 0, 29, 0, 0, 0, 0, 0, 0
- .InitKick sw29a, 160, 16
- .InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
- End With
- ' Drop Targets
- Set DTBank = New cvpmDropTarget
- With DTBank
- .InitDrop Array(Array(sw41,sw41a),Array(sw42,sw42a),Array(sw43,sw43a)), Array(41,42,43)
- .Initsnd SoundFX("droptarget",DOFDropTargets), SoundFX("resetdrop",DOFContactors)
- End With
- ' Top Right Saucer
- Set bsTR = New cvpmBallStack
- With bsTR
- .InitSaucer sw45, 45, 194, 20
- .KickForceVar = 2
- .KickBalls = 1
- .InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
- End With
- ' Visible Lock
- Set vLock = New cvpmVLock2
- With vLock
- .InitVLock Array(sw38, sw39, sw40), Array(sw38k, sw39k, sw40k), Array(38, 39, 40)
- .InitSnd SoundFX("Solenoid",DOFContactors), SoundFX("Solenoid",DOFContactors)
- .ExitDir = 194
- .ExitForce = 8
- .CreateEvents "vLock"
- End With
- ' Main Timer init
- PinMAMETimer.Interval = PinMameInterval
- PinMAMETimer.Enabled = 1
- ' reset sling posts
- LeftSlingshotpostb.IsDropped = true
- LeftSlingshotpostc.IsDropped = true
- LeftSlingshotpostd.IsDropped = true
- RightSlingshotpostb.IsDropped = true
- RightSlingshotpostc.IsDropped = true
- RightSlingshotpostd.IsDropped = true
- sw33a.IsDropped = 1:sw34a.IsDropped = 1:sw35a.IsDropped = 1:sw36a.IsDropped = 1:sw37a.IsDropped = 1
- sw25a.IsDropped = 1:sw26a.IsDropped = 1:sw27a.IsDropped = 1
- bump1 = 0:bump2 = 0:bump3 = 0
- Llogo2.IsDropped = 1:Rlogo2.IsDropped = 1
- SolGi 1
- StartLampTimer
- End Sub
- Sub table1_Paused:Controller.Pause = 1:End Sub
- Sub table1_unPaused:Controller.Pause = 0:End Sub
- '**********
- ' Keys
- '**********
- Sub table1_KeyDown(ByVal Keycode)
- If KeyDownHandler(KeyCode) Then Exit Sub
- If keycode = PlungerKey Then Plunger.Pullback:'Pcount = 0:'PTime.Enabled = 1
- If keycode = LeftTiltKey Then LeftNudge 110, 1.8, 20
- If keycode = RightTiltKey Then RightNudge 250, 1.8, 20
- If keycode = CenterTiltKey Then CenterNudge 180, 2.8, 25
- End Sub
- Sub table1_KeyUp(ByVal Keycode)
- If KeyUpHandler(KeyCode) Then Exit Sub
- If keycode = PlungerKey Then Plunger.Fire:'PTime.Enabled = 0:Pcount = 0:PTime2.Enabled = 1
- End Sub
- '#############################
- ' Rotate Primitive Things
- '#############################
- Sub Timer_Timer()
- p_gate1.Rotx = gate1.CurrentAngle + 90
- p_gate3.Rotx = gate3.CurrentAngle + 90
- p_gate4.Rotx = gate4.CurrentAngle + 90
- End Sub
- '*************************************
- ' Nudge System
- ' based on Noah's nudgetest table
- ' added a counterforce effect
- '*************************************
- Dim LeftNudgeEffect, RightNudgeEffect, NudgeEffect
- 'StartShake
- Sub LeftNudge(angle, strength, delay)
- Dim a
- a = (strength * (delay-LeftNudgeEffect) / delay) + RightNudgeEffect / delay
- vpmNudge.DoNudge angle, a
- a = - a / 0.6:vpmTimer.AddTimer 100, "CounterForce angle, a '"
- LeftNudgeEffect = delay
- RightNudgeEffect = 0
- RightNudgeTimer.Enabled = 0
- LeftNudgeTimer.Interval = delay
- LeftNudgeTimer.Enabled = 1
- End Sub
- Sub RightNudge(angle, strength, delay)
- Dim a
- a = (strength * (delay-RightNudgeEffect) / delay) + LeftNudgeEffect / delay
- vpmNudge.DoNudge angle, a
- a = - a / 0.6:vpmTimer.AddTimer 100, "CounterForce angle, a '"
- RightNudgeEffect = delay
- LeftNudgeEffect = 0
- LeftNudgeTimer.Enabled = 0
- RightNudgeTimer.Interval = delay
- RightNudgeTimer.Enabled = 1
- End Sub
- Sub CenterNudge(angle, strength, delay)
- Dim a
- a = strength * (delay-NudgeEffect) / delay
- vpmNudge.DoNudge angle, a
- a = - a / 0.8:vpmTimer.AddTimer 100, "CounterForce angle, a '"
- NudgeEffect = delay
- NudgeTimer.Interval = delay
- NudgeTimer.Enabled = 1
- End Sub
- Sub LeftNudgeTimer_Timer()
- LeftNudgeEffect = LeftNudgeEffect-1
- If LeftNudgeEffect = 0 then LeftNudgeTimer.Enabled = False
- End Sub
- Sub RightNudgeTimer_Timer()
- RightNudgeEffect = RightNudgeEffect-1
- If RightNudgeEffect = 0 then RightNudgeTimer.Enabled = False
- End Sub
- Sub NudgeTimer_Timer()
- NudgeEffect = NudgeEffect-1
- If NudgeEffect = 0 then NudgeTimer.Enabled = False
- End Sub
- Sub CounterForce(angle, strength)
- Nudge angle, strength
- End Sub
- '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 'Slingshot animation
- '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Dim LeftSlingshotStep,RightSlingshotStep
- Sub LeftSlingShot_Slingshot:LeftSlingshota.visible = false:LeftSlingshotposta.IsDropped = true:LeftSlingshotb.visible = true:LeftSlingshotpostb.IsDropped = false:PlaySound SoundFX("slingshot",DOFContactors):vpmTimer.PulseSw 21:LeftSlingshotStep = 0:Me.TimerEnabled = 1:End Sub
- Sub LeftSlingshot_Timer
- Select Case LeftSlingshotStep
- Case 0:LeftSlingshotb.visible = false:LeftSlingshotpostb.IsDropped = true:LeftSlingshotc.visible = true:LeftSlingshotpostc.IsDropped = false
- Case 1:LeftSlingshotc.visible = false:LeftSlingshotpostc.IsDropped = true:LeftSlingshotd.visible = true:LeftSlingshotpostd.IsDropped = false
- Case 2:LeftSlingshotd.visible = false:LeftSlingshotpostd.IsDropped = true:LeftSlingshotc.visible = true:LeftSlingshotpostc.IsDropped = false
- Case 3:LeftSlingshotc.visible = false:LeftSlingshotpostc.IsDropped = true:LeftSlingshotb.visible = true:LeftSlingshotpostb.IsDropped = false
- Case 4:LeftSlingshotb.visible = false:LeftSlingshotpostb.IsDropped = true:LeftSlingshota.visible = true:LeftSlingshotposta.IsDropped = false:Me.TimerEnabled = 0 '
- End Select
- LeftSlingshotStep = LeftSlingshotStep + 1
- End Sub
- Sub RightSlingShot_Slingshot:RightSlingshota.visible = false:RightSlingshotposta.IsDropped = true:RightSlingshotb.visible = true:RightSlingshotpostb.IsDropped = false:PlaySound SoundFX("slingshot",DOFContactors):vpmTimer.PulseSw 22:RightSlingshotStep = 0:Me.TimerEnabled = 1:End Sub
- Sub RightSlingshot_Timer
- Select Case RightSlingshotStep
- Case 0:RightSlingshotb.visible = false:RightSlingshotpostb.IsDropped = true:RightSlingshotc.visible = true:RightSlingshotpostc.IsDropped = false
- Case 1:RightSlingshotc.visible = false:RightSlingshotpostc.IsDropped = true:RightSlingshotd.visible = true:RightSlingshotpostd.IsDropped = false
- Case 2:RightSlingshotd.visible = false:RightSlingshotpostd.IsDropped = true:RightSlingshotc.visible = true:RightSlingshotpostc.IsDropped = false
- Case 3:RightSlingshotc.visible = false:RightSlingshotpostc.IsDropped = true:RightSlingshotb.visible = true:RightSlingshotpostb.IsDropped = false
- Case 4:RightSlingshotb.visible = false:RightSlingshotpostb.IsDropped = true:RightSlingshota.visible = true:RightSlingshotposta.IsDropped = false:Me.TimerEnabled = 0 '
- End Select
- RightSlingshotStep = RightSlingshotStep + 1
- End Sub
- ' Bumpers
- Sub Bumper1_Hit:vpmTimer.PulseSw 46:PlaySound SoundFX("bumper1",DOFContactors):bump1 = 1:Me.TimerEnabled = 1:End Sub
- Sub Bumper1_Timer()
- Select Case bump1
- Case 1:
- Case 2:
- Case 3:
- Case 4:Me.TimerEnabled = 0
- End Select
- End Sub
- Sub Bumper2_Hit:vpmTimer.PulseSw 47:PlaySound SoundFX("bumper2",DOFContactors):bump2 = 1:Me.TimerEnabled = 1:End Sub
- Sub Bumper2_Timer()
- Select Case bump2
- Case 1:
- Case 2:
- Case 3:
- Case 4:Me.TimerEnabled = 0
- End Select
- End Sub
- Sub Bumper3_Hit:vpmTimer.PulseSw 48:PlaySound SoundFX("bumper1",DOFContactors):bump3 = 1:Me.TimerEnabled = 1:End Sub
- Sub Bumper3_Timer()
- Select Case bump3
- Case 1:
- Case 2:
- Case 3:
- Case 4:Me.TimerEnabled = 0
- End Select
- End Sub
- ' Drain holes, vuks & saucers
- Sub Drain_Hit:PlaySound "drain":vpmTimer.PulseSw 10:bsTrough.AddBall Me:End Sub
- Sub Drain1_Hit:PlaySound "drain":vpmTimer.PulseSw 10:bsTrough.AddBall Me:End Sub
- Sub Drain2_Hit:PlaySound "drain":vpmTimer.PulseSw 10:bsTrough.AddBall Me:End Sub
- Sub Drain3_Hit:PlaySound "drain":vpmTimer.PulseSw 10:bsTrough.AddBall Me:End Sub
- Sub Drain4_Hit:PlaySound "drain":vpmTimer.PulseSw 10:bsTrough.AddBall Me:End Sub
- Sub sw45_Hit:bsTR.AddBall 0:End Sub
- 'VUK Lock
- Sub sw29_Hit():PlaySound "kicker_enter":bsVUK.AddBall Me:End Sub
- ' Rollovers & Ramp Switches
- Sub sw17_Hit:P_Trigger17.TransZ = -5:Controller.Switch(17) = 1:PlaySound "sensor":End Sub
- Sub sw17_UnHit:P_Trigger17.TransZ = 0:Controller.Switch(17) = 0:End Sub
- Sub sw18_Hit:P_Trigger18.TransZ = -5:Controller.Switch(18) = 1:PlaySound "sensor":End Sub
- Sub sw18_UnHit:P_Trigger18.TransZ = 0:Controller.Switch(18) = 0:End Sub
- Sub sw20_Hit:P_Trigger20.TransZ = -5:Controller.Switch(20) = 1:PlaySound "sensor":End Sub
- Sub sw20_UnHit:P_Trigger20.TransZ = 0:Controller.Switch(20) = 0:End Sub
- Sub sw19_Hit:P_Trigger19.TransZ = -5:Controller.Switch(19) = 1:PlaySound "sensor":End Sub
- Sub sw19_UnHit:P_Trigger19.TransZ = 0:Controller.Switch(19) = 0:End Sub
- Sub sw30_Hit:Controller.Switch(30) = 1:PlaySound "sensor":End Sub
- Sub sw30_Unhit:Controller.Switch(30) = 0:End Sub
- Sub sw31_Hit:Controller.Switch(31) = 1:PlaySound "sensor":End Sub
- Sub sw31_Unhit:Controller.Switch(31) = 0:End Sub
- Sub sw14_Hit:Controller.Switch(14) = 1:PlaySound "sensor":End Sub
- Sub sw14_Unhit:Controller.Switch(14) = 0:End Sub
- '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ' Drop Targets
- '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- dim sw41Dir, sw42Dir, sw43Dir
- dim sw41Pos, sw42Pos, sw43Pos
- sw41Dir = 1:sw42Dir = 1:sw43Dir = 1
- sw41Pos = 0:sw42Pos = 0:sw43Pos = 0
- 'Targets Init
- sw41a.TimerEnabled = 1:sw42a.TimerEnabled = 1:sw43a.TimerEnabled = 1
- Sub sw41_Hit:DTBank.Hit 1:sw41Dir = 0:sw41a.TimerEnabled = 1:End Sub
- Sub sw42_Hit:DTBank.Hit 2:sw42Dir = 0:sw42a.TimerEnabled = 1:End Sub
- Sub sw43_Hit:DTBank.Hit 3:sw43Dir = 0:sw43a.TimerEnabled = 1:End Sub
- '''Target animation
- Sub sw41a_Timer()
- Select Case sw41Pos
- Case 0: sw41P.z=0
- If sw41Dir = 1 then
- sw41a.TimerEnabled = 0
- else
- end if
- Case 1: sw41P.z=0
- Case 2: sw41P.z=-4
- Case 3: sw41P.z=-8
- Case 4: sw41P.z=-12
- Case 5: sw41P.z=-16
- Case 6: sw41P.z=-20
- Case 7: sw41P.z=-24
- Case 8: sw41P.z=-28
- Case 9: sw41P.z=-32
- Case 10: sw41P.z=-36
- Case 11: sw41P.z=-40
- Case 12: sw41P.z=-44
- Case 13: sw41P.z=-48:sw41P.ReflectionEnabled = true
- Case 14: sw41P.z=-52:sw41P.ReflectionEnabled = false
- If sw41Dir = 1 then
- else
- sw41a.TimerEnabled = 0
- end if
- End Select
- If sw41Dir = 1 then
- If sw41pos>0 then sw41pos=sw41pos-1
- else
- If sw41pos<14 then sw41pos=sw41pos+1
- end if
- End Sub
- Sub sw42a_Timer()
- Select Case sw42Pos
- Case 0: sw42P.z=0
- If sw42Dir = 1 then
- sw42a.TimerEnabled = 0
- else
- end if
- Case 1: sw42P.z=0
- Case 2: sw42P.z=-4
- Case 3: sw42P.z=-8
- Case 4: sw42P.z=-12
- Case 5: sw42P.z=-16
- Case 6: sw42P.z=-20
- Case 7: sw42P.z=-24
- Case 8: sw42P.z=-28
- Case 9: sw42P.z=-32
- Case 10: sw42P.z=-36
- Case 11: sw42P.z=-40
- Case 12: sw42P.z=-44
- Case 13: sw42P.z=-48:sw42P.ReflectionEnabled = true
- Case 14: sw42P.z=-52:sw42P.ReflectionEnabled = false
- If sw42Dir = 1 then
- else
- sw42a.TimerEnabled = 0
- end if
- End Select
- If sw42Dir = 1 then
- If sw42pos>0 then sw42pos=sw42pos-1
- else
- If sw42pos<14 then sw42pos=sw42pos+1
- end if
- End Sub
- Sub sw43a_Timer()
- Select Case sw43Pos
- Case 0: sw43P.z=0
- If sw43Dir = 1 then
- sw43a.TimerEnabled = 0
- else
- end if
- Case 1: sw43P.z=0
- Case 2: sw43P.z=-4
- Case 3: sw43P.z=-8
- Case 4: sw43P.z=-12
- Case 5: sw43P.z=-16
- Case 6: sw43P.z=-20
- Case 7: sw43P.z=-24
- Case 8: sw43P.z=-28
- Case 9: sw43P.z=-32
- Case 10: sw43P.z=-36
- Case 11: sw43P.z=-40
- Case 12: sw43P.z=-44
- Case 13: sw43P.z=-48:sw43P.ReflectionEnabled = true
- Case 14: sw43P.z=-52:sw43P.ReflectionEnabled = false
- If sw43Dir = 1 then
- else
- sw43a.TimerEnabled = 0
- end if
- End Select
- If sw43Dir = 1 then
- If sw43pos>0 then sw43pos=sw43pos-1
- else
- If sw43pos<14 then sw43pos=sw43pos+1
- end if
- End Sub
- 'DT Subs
- Sub ResetDrops(Enabled)
- If Enabled Then
- sw41Dir = 1:sw42Dir = 1:sw43Dir = 1
- sw41a.TimerEnabled = 1:sw42a.TimerEnabled = 1:sw43a.TimerEnabled = 1
- DTBank.DropSol_On
- End if
- End Sub
- '***************************************
- ' Targets
- '***************************************
- Dim Target25Step, Target26Step, Target27Step, Target33Step, Target34Step, Target35Step, Target36Step, Target37Step
- Sub sw25_Hit:vpmTimer.PulseSw(25):P_Target25.TransX = -5:Target25Step = 1:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):End Sub
- Sub sw25_timer()
- Select Case Target25Step
- Case 1:P_Target25.TransX = 3
- Case 2:P_Target25.TransX = -2
- Case 3:P_Target25.TransX = 1
- Case 4:P_Target25.TransX = 0:Me.TimerEnabled = 0
- End Select
- Target25Step = Target25Step + 1
- End Sub
- Sub sw26_Hit:vpmTimer.PulseSw(26):P_Target26.TransX = -5:Target26Step = 1:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):End Sub
- Sub sw26_timer()
- Select Case Target26Step
- Case 1:P_Target26.TransX = 3
- Case 2:P_Target26.TransX = -2
- Case 3:P_Target26.TransX = 1
- Case 4:P_Target26.TransX = 0:Me.TimerEnabled = 0
- End Select
- Target26Step = Target26Step + 1
- End Sub
- Sub sw27_Hit:vpmTimer.PulseSw(27):P_Target27.TransX = -5:Target27Step = 1:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):End Sub
- Sub sw27_timer()
- Select Case Target27Step
- Case 1:P_Target27.TransX = 3
- Case 2:P_Target27.TransX = -2
- Case 3:P_Target27.TransX = 1
- Case 4:P_Target27.TransX = 0:Me.TimerEnabled = 0
- End Select
- Target27Step = Target27Step + 1
- End Sub
- Sub sw33_Hit:vpmTimer.PulseSw(33):P_Target33.TransX = -5:Target33Step = 1:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):End Sub
- Sub sw33_timer()
- Select Case Target33Step
- Case 1:P_Target33.TransX = 3
- Case 2:P_Target33.TransX = -2
- Case 3:P_Target33.TransX = 1
- Case 4:P_Target33.TransX = 0:Me.TimerEnabled = 0
- End Select
- Target33Step = Target33Step + 1
- End Sub
- Sub sw34_Hit:vpmTimer.PulseSw(34):P_Target34.TransX = -5:Target34Step = 1:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):End Sub
- Sub sw34_timer()
- Select Case Target34Step
- Case 1:P_Target34.TransX = 3
- Case 2:P_Target34.TransX = -2
- Case 3:P_Target34.TransX = 1
- Case 4:P_Target34.TransX = 0:Me.TimerEnabled = 0
- End Select
- Target34Step = Target34Step + 1
- End Sub
- Sub sw35_Hit:vpmTimer.PulseSw(35):P_Target35.TransX = -5:Target35Step = 1:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):End Sub
- Sub sw35_timer()
- Select Case Target35Step
- Case 1:P_Target35.TransX = 3
- Case 2:P_Target35.TransX = -2
- Case 3:P_Target35.TransX = 1
- Case 4:P_Target35.TransX = 0:Me.TimerEnabled = 0
- End Select
- Target35Step = Target35Step + 1
- End Sub
- Sub sw36_Hit:vpmTimer.PulseSw(36):P_Target36.TransX = -5:Target36Step = 1:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):End Sub
- Sub sw36_timer()
- Select Case Target36Step
- Case 1:P_Target36.TransX = 3
- Case 2:P_Target36.TransX = -2
- Case 3:P_Target36.TransX = 1
- Case 4:P_Target36.TransX = 0:Me.TimerEnabled = 0
- End Select
- Target36Step = Target36Step + 1
- End Sub
- Sub sw37_Hit:vpmTimer.PulseSw(37):P_Target37.TransX = -5:Target37Step = 1:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):End Sub
- Sub sw37_timer()
- Select Case Target37Step
- Case 1:P_Target37.TransX = 3
- Case 2:P_Target37.TransX = -2
- Case 3:P_Target37.TransX = 1
- Case 4:P_Target37.TransX = 0:Me.TimerEnabled = 0
- End Select
- Target37Step = Target37Step + 1
- End Sub
- ' Spinners
- Sub sw28_Spin():vpmTimer.PulseSw 28:PlaySound "spinner":End Sub
- ' Ramps helpers
- Sub RHelp1_Hit:StopSound "metalrolling":PlaySound "BallHit":End Sub
- Sub RHelp2_Hit:StopSound "metalrolling":PlaySound "BallHit":End Sub
- ' Extra Sounds
- Sub Rubbers_Hit(idx):PlaySound "rubber":End Sub
- Sub Metals_Hit(idx):PlaySound "metalhit":End Sub
- Sub Sound1_Hit:PlaySound "metalrolling":End Sub
- Sub Sound2_Hit:PlaySound "metalrolling":End Sub
- Sub Sound3_Hit:PlaySound "metalrolling":End Sub
- Sub BallRol1_Hit:PlaySound "ballrolling":End Sub
- '*********
- 'Solenoids
- '*********
- SolCallBack(25) = "bsTrough.SolIn"
- SolCallBack(26) = "bsTrough.SolOut"
- SolCallBack(27) = "vLock.SolExit"
- SolCallBack(28) = "bsTR.SolOut"
- SolCallBack(29) = "bsVuk.SolOut"
- SolCallBack(30) = "ResetDrops"
- SolCallBack(32) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
- SolCallBack(1) = "SetLamp 101,"
- SolCallBack(2) = "SetLamp 102,"
- SolCallback(3) = "SetLamp 103,"
- SolCallback(4) = "SetLamp 104,"
- SolCallback(5) = "SetLamp 105,"
- ' SolCallback(6) = "SetLamp 106," left side
- ' SolCallback(7) = "SetLamp 107," center
- SolCallback(8) = "SetLamp 108,"
- ' SolCallback(9) = "SetLamp 109," 'right side
- SolCallback(11) = "SolGi"
- SolCallback(12) = "SetLamp 112,"
- SolCallback(13) = "SetLamp 113,"
- SolCallback(14) = "SetLamp 114,"
- SolCallback(15) = "SetLamp 115,"
- SolCallback(16) = "SetLamp 116,"
- '**************
- ' Flipper Subs
- '**************
- SolCallback(sLRFlipper) = "SolRFlipper"
- SolCallback(sLLFlipper) = "SolLFlipper"
- Sub SolLFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("FlipperUp",DOFFlippers):LeftFlipper.RotateToEnd
- Llogo.IsDropped = 1:Llogo2.IsDropped = 0
- Else
- PlaySound SoundFX("FlipperDown",DOFFlippers):LeftFlipper.RotateToStart
- Llogo2.IsDropped = 1:Llogo.IsDropped = 0
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("FlipperUp",DOFFlippers):RightFlipper.RotateToEnd
- Rlogo.IsDropped = 1:Rlogo2.IsDropped = 0
- Else
- PlaySound SoundFX("FlipperDown",DOFFlippers):RightFlipper.RotateToStart
- Rlogo2.IsDropped = 1:Rlogo.IsDropped = 0
- End If
- End Sub
- Sub LeftFlipper_Collide(parm)
- PlaySound "rubber_flipper"
- End Sub
- Sub RightFlipper_Collide(parm)
- PlaySound "rubber_flipper"
- End Sub
- '**********
- ' Gi Lights
- '**********
- Sub SolGi(Enabled)
- Dim obj
- If Enabled Then
- gi1.state = 0
- gi2.state = 0
- gi3.state = 0
- gi4.state = 0
- gi5.state = 0
- gi6.state = 0
- gi7.state = 0
- gi8.state = 0
- gi9.state = 0
- gi10.state = 0
- gi11.state = 0
- gi12.state = 0
- gi13.state = 0
- gi14.state = 0
- gi15.state = 0
- gi16.state = 0
- gi17.state = 0
- gi18.state = 0
- gi19.state = 0
- gi20.state = 0
- gi21.state = 0
- gi22.state = 0
- gi23.state = 0
- gi24.state = 0
- gi25.state = 0
- bLight1.state = 0
- bLight2.state = 0
- bLight3.state = 0
- bLight1z.state = 0
- bLight2z.state = 0
- bLight3z.state = 0
- bLight1zb.state = 0
- bLight2zb.state = 0
- bLight3zb.state = 0
- Else
- gi1.state = 1
- gi2.state = 1
- gi3.state = 1
- gi4.state = 1
- gi5.state = 1
- gi6.state = 1
- gi7.state = 1
- gi8.state = 1
- gi9.state = 1
- gi10.state = 1
- gi11.state = 1
- gi12.state = 1
- gi13.state = 1
- gi14.state = 1
- gi15.state = 1
- gi16.state = 1
- gi17.state = 1
- gi18.state = 1
- gi19.state = 1
- gi20.state = 1
- gi21.state = 1
- gi22.state = 1
- gi23.state = 1
- gi24.state = 1
- gi25.state = 1
- bLight1.state = 1
- bLight2.state = 1
- bLight3.state = 1
- bLight1z.state = 1
- bLight2z.state = 1
- bLight3z.state = 1
- bLight1zb.state = 1
- bLight2zb.state = 1
- bLight3zb.state = 1
- End If
- End Sub
- '***************************************************
- ' JP's Fading Lamps & Flashers version 9 for VP921
- ' Based on PD's Fading Lights
- ' SetLamp 0 is Off
- ' SetLamp 1 is On
- ' FadingLevel(x) = fading state
- ' LampState(x) = light state
- ' Includes the flash element (needs own timer)
- ' Flashers can be used as lights too
- '***************************************************
- Dim LampState(200), FadingLevel(200)
- Dim FlashState(200), FlashLevel(200)
- Dim FlashSpeedUp, FlashSpeedDown
- Dim TextureArray1: TextureArray1 = Array("Plastic with an image trans", "Plastic with an image")
- Const LightHaloBrightness = 200
- FlashInit()
- FlasherTimer.Interval = 10 'flash fading speed
- FlasherTimer.Enabled = 1
- ' Lamp & Flasher Timers
- Sub StartLampTimer
- AllLampsOff()
- LampTimer.Interval = 30 'lamp fading speed
- LampTimer.Enabled = 1
- End Sub
- 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)
- FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4
- FlashState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
- Next
- End If
- UpdateLamps
- 'UpdateMultipleLamps
- End Sub
- ' ****************************************************************
- ' * JPJ duplication des lumières Bulbs pour reflets sur la bille *
- ' ****************************************************************
- Sub UpdateLamps
- FadeL 1, l1, l1z
- FadeL 2, l2, l2z
- FadeL 3, l3, l3z
- FadeL 4, l4, l4z
- FadeL 5, l5, l5z
- FadeL 6, l6, l6z
- FadeL 7, l7, l7z
- FadeL 8, l8, l8z
- FadeL 9, l9, l9z
- FadeL 10, l10, l10z
- FadeL 11, l11, l11z
- FadeL 12, l12, l12z
- FadeL 13, l13, l13z
- FadeL 14, l14, l14z
- FadeMaterialW 15, Wall356, TextureArray1
- FadeL 16, l16, l16z
- FadeL 17, l17, l17z
- FadeL 18, l18, l18z
- FadeL 19, l19, l19z
- FadeL 20, l20, l20z
- FadeL 21, l21, l21z
- FadeL 22, l22, l22z
- FadeL 23, l23, l23z
- FadeL 24, l24, l24z
- FadeW 25, l25, l25a, l25b
- FadeW 26, l26, l26a, l26b
- FadeW 27, l27, l27a, l27b
- FadeW 28, l28, l28a, l28b
- FadeW 29, l29, l29a, l29b
- FadeW 30, l30, l30a, l30b
- FadeW 31, l31, l31a, l31b
- FadeW 32, l32, l32a, l32b
- FadeL 33, l33, l33z
- FadeL 40, l40, l40z
- FadeL 41, l41, l41z
- FadeL 42, l42, l42z
- FadeL 43, l43, l43z
- FadeL 44, l44, l44z
- FadeL 45, l45, l45z
- FadeMaterialW 46, Wall355, TextureArray1
- FadeL 49, l49, l49z
- FadeL 50, l50, l50z
- FadeL 51, l51, l51z
- FadeL 52, l52, l52z
- FadeL 53, l53, l53z
- FadeL 54, l54, l54z
- FadeL 55, l55, l55z
- FadeL 57, l57, l57z
- FadeL 58, l58, l58z
- FadeL 59, l59, l59z
- FadeL 61, l61, l61z
- FadeL 62, l62, l62z
- FadeL 63, l63, l63z
- FadeL 64, l64, l64z
- ' ***************************************************
- ' * JPJ Déjà en bulb donc pas besoin de les doubler * *
- ' ***************************************************
- NFadeLm 15, l15a
- NFadeL 15, l15
- NFadeLm 46, l46a
- NFadeL 46, l46
- NFadeLm 47, l47a
- NFadeL 47, l47
- NFadeLm 48, l48a
- NFadeL 48, l48
- ' ***************************************************************************
- ' * JPJ EMREELs dans le backglass sonc pas besoin de reflechir sur la bille * *
- ' ***************************************************************************
- FadeR 34, l34
- FadeR 35, l35
- FadeR 36, l36
- FadeR 37, l37
- FadeR 38, l38
- FadeR 39, l39
- FadeRm 47, l47c
- FadeMaterialW 47, Wall355, TextureArray1
- FadeMaterialW 48, Wall355, TextureArray1
- FadeRm 56, l56c
- FadeMaterialW 56, Wall356, TextureArray1
- NFadeLm 56, l56a
- NFadeL 56, l56
- FadeMaterialW 60, Wall356, TextureArray1
- NFadeLm 60, l60a
- NFadeL 60, l60
- ' FadeW 60, l60, l60a, l60b
- 'Flashers
- NFadeLm 101, f1a
- NFadeLm 101, f1b
- NFadeLm 101, f1c
- FadeL 101, f1d, f1dz
- NFadeLm 102, f2a
- NFadeLm 102, f2b
- NFadeLm 102, f2c
- FadeL 102, f2d, f2dz
- NFadeLm 103, f3a
- NFadeLm 103, f3b
- NFadeLm 103, f3c
- FadeL 103, f3d, f3dz
- FadeMaterialW 104, Wall347, TextureArray1
- FadeMaterialP 104, Primitive10, TextureArray1
- NFadeL 104, f4
- FadeMaterialP 105, Primitive3, TextureArray1
- NFadeL 105, f5
- ' FadeR 107, f7
- FadeMaterialP 108, Primitive2, TextureArray1
- NFadeLm 108, f8c
- FadeW 108, f8, f8a, f8b
- FadeMaterialP 112, Primitive1, TextureArray1
- NFadeL 112, f12
- NFadeL 113, f13
- NFadeL 114, f14
- NFadeL 115, f15
- ' NFadeWm 116, f16c
- FadeMaterialP 116, Primitive16, TextureArray1
- NFadeL 116, f16
- End Sub
- Sub FadeLight(nr, light)
- Select Case FadingState(nr)
- Case 2:FadingState(nr) = 0
- Case 3:FadingState(nr) = 2
- Case 4:light.State = LightStateOff:FadingState(nr) = 3
- Case 5:light.State = LightStateOn:FadingState(nr) = 1
- End Select
- End Sub
- Sub FadeLights(nr, lights)
- Dim ip
- Select Case FadingState(nr)
- Case 2:FadingState(nr) = 0
- Case 3:FadingState(nr) = 2
- Case 4:For each ip in lights:ip.State = LightStateOff:Next:FadingState(nr) = 3
- Case 5:For each ip in lights:ip.State = LightStateOn:Next:FadingState(nr) = 1
- End Select
- End Sub
- 'Sindbad: You can use this instead of FadeLN
- ' call it this way: FadeLight lampnumber, light, Array
- 'Sub FadeLight(nr, Light, group)
- ' Select Case FadingLevel(nr)
- ' Case 2:Light.image = group(3):FadingLevel(nr) = 0 'Off
- ' Case 3:Light.image = group(2):FadingLevel(nr) = 2 'fading...
- ' Case 4:Light.image = group(1):FadingLevel(nr) = 3 'fading...
- ' Case 5:Light.image = group(0):FadingLevel(nr) = 1 'ON
- ' End Select
- 'End Sub
- Sub NFadeL(nr, a)
- Select Case FadingLevel(nr)
- Case 4:a.state = 0:FadingLevel(nr) = 0
- Case 5:a.State = 1:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub NFadeLm(nr, a)
- Select Case FadingLevel(nr)
- Case 4:a.state = 0
- Case 5:a.State = 1
- End Select
- End Sub
- 'trxture swap
- dim itemw, itemp
- Sub FadeMaterialW(nr, itemw, group)
- Select Case FadingLevel(nr)
- Case 4:itemw.TopMaterial = group(1):itemw.SideMaterial = group(1)
- Case 5:itemw.TopMaterial = group(0):itemw.SideMaterial = group(0)
- End Select
- End Sub
- Sub FadeMaterialP(nr, itemp, group)
- Select Case FadingLevel(nr)
- Case 4:itemp.Material = group(1)
- Case 5:itemp.Material = group(0)
- End Select
- End Sub
- ' div lamp subs
- Sub AllLampsOff()
- Dim x
- For x = 0 to 200
- LampState(x) = 0
- FadingLevel(x) = 4
- Next
- UpdateLamps:UpdateLamps:Updatelamps
- End Sub
- Sub SetLamp(nr, value)
- If value <> LampState(nr) Then
- LampState(nr) = abs(value)
- FadingLevel(nr) = abs(value) + 4
- End If
- End Sub
- ' div flasher subs
- Sub FlashInit
- Dim i
- For i = 0 to 200
- FlashState(i) = 0
- FlashLevel(i) = 0
- Next
- FlashSpeedUp = 30 ' fast speed when turning on the flasher
- FlashSpeedDown = 10 ' slow speed when turning off the flasher, gives a smooth fading
- ' you could also change the default images for each flasher or leave it as in the editor
- ' for example
- ' Flasher1.Image = "fr"
- AllFlashOff()
- End Sub
- Sub AllFlashOff
- Dim i
- For i = 0 to 200
- FlashState(i) = 0
- Next
- End Sub
- Sub SetFlash(nr, stat)
- FlashState(nr) = ABS(stat)
- End Sub
- ' Flasher objects
- ' Uses own faster timer
- Sub Flash(nr, object)
- Select Case FlashState(nr)
- Case 0 'off
- FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown
- If FlashLevel(nr) < 0 Then
- FlashLevel(nr) = 0
- FlashState(nr) = -1 'completely off
- End if
- Object.opacity = FlashLevel(nr)
- Case 1 ' on
- FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp
- If FlashLevel(nr) > 250 Then
- FlashLevel(nr) = 250
- FlashState(nr) = -2 'completely on
- End if
- Object.opacity = FlashLevel(nr)
- End Select
- End Sub
- Sub Flashm(nr, object) 'multiple flashers, it doesn't change the flashstate
- Select Case FlashState(nr)
- Case 0 'off
- Object.opacity = FlashLevel(nr)
- Case 1 ' on
- Object.opacity = FlashLevel(nr)
- End Select
- End Sub
- Sub FlashVal(nr, object, value)
- Select Case FlashState(nr)
- Case 0 'off
- FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown
- If FlashLevel(nr) < 0 Then
- FlashLevel(nr) = 0
- FlashState(nr) = -1 'completely off
- End if
- Object.opacity = FlashLevel(nr)
- Case 1 ' on
- FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp
- If FlashLevel(nr) > value Then
- FlashLevel(nr) = value
- FlashState(nr) = -2 'completely on
- End if
- Object.opacity = FlashLevel(nr)
- End Select
- End Sub
- Sub FlashValm(nr, object, value) 'multiple flashers, it doesn't change the flashstate
- Select Case FlashState(nr)
- Case 0 'off
- Object.opacity = FlashLevel(nr)
- Case 1 ' on
- Object.opacity = FlashLevel(nr)
- End Select
- End Sub
- Sub FadeLn(nr, Light, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:Light.Offimage = d:FadingLevel(nr) = 0 'Off
- Case 3:Light.Offimage = c:FadingLevel(nr) = 2 'fading...
- Case 4:Light.Offimage = b:FadingLevel(nr) = 3 'fading...
- Case 5:Light.Offimage = a:FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FadeLnm(nr, Light, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:Light.Offimage = d
- Case 3:Light.Offimage = c
- Case 4:Light.Offimage = b
- Case 5:Light.Offimage = a
- End Select
- End Sub
- Sub LMapn(nr, Light, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:Light.Onimage = d:FadingLevel(nr) = 0 'Off
- Case 3:Light.ONimage = c:FadingLevel(nr) = 2 'fading...
- Case 4:Light.ONimage = b:FadingLevel(nr) = 3 'fading...
- Case 5:Light.ONimage = a:FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub LMapnm(nr, Light, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:Light.ONimage = d
- Case 3:Light.ONimage = c
- Case 4:Light.ONimage = b
- Case 5:Light.ONimage = a
- End Select
- End Sub
- ' Walls
- Sub FadeW(nr, a, b, c)
- Select Case FadingLevel(nr)
- Case 2:c.IsDropped = 1:FadingLevel(nr) = 0 'Off
- Case 3:b.IsDropped = 1:c.IsDropped = 0:FadingLevel(nr) = 2 'fading...
- Case 4:a.IsDropped = 1:b.IsDropped = 0:FadingLevel(nr) = 3 'fading...
- Case 5:a.IsDropped = 0:FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FadeWm(nr, a, b, c)
- Select Case FadingLevel(nr)
- Case 2:c.IsDropped = 1
- Case 3:b.IsDropped = 1:c.IsDropped = 0
- Case 4:a.IsDropped = 1:b.IsDropped = 0
- Case 5:a.IsDropped = 0
- End Select
- End Sub
- Sub NFadeW(nr, a)
- Select Case FadingLevel(nr)
- Case 4:a.IsDropped = 1:FadingLevel(nr) = 0
- Case 5:a.IsDropped = 0:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub NFadeWm(nr, a)
- Select Case FadingLevel(nr)
- Case 4:a.IsDropped = 1
- Case 5:a.IsDropped = 0
- End Select
- End Sub
- Sub NFadeWi(nr, a)
- Select Case FadingLevel(nr)
- Case 4:a.IsDropped = 0:FadingLevel(nr) = 0
- Case 5:a.IsDropped = 1:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub NFadeWim(nr, a)
- Select Case FadingLevel(nr)
- Case 4:a.IsDropped = 0
- Case 5:a.IsDropped = 1
- End Select
- End Sub
- 'Lights
- Sub FadeL(nr, a, b)
- Select Case FadingLevel(nr)
- Case 4:a.state = 0:FadingLevel(nr) = 0:b.state = 0:FadingLevel(nr) = 0
- Case 5:a.state = 1:FadingLevel(nr) = 1:b.state = 1:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub FadeLm(nr, a, b)
- Select Case FadingLevel(nr)
- Case 2:b.state = 0
- Case 3:b.state = 1
- Case 4:a.state = 0
- Case 5:a.state = 1
- End Select
- End Sub
- 'Sub NFadeL(nr, a)
- ' Select Case FadingLevel(nr)
- ' Case 4:a.state = 0:FadingLevel(nr) = 0
- ' Case 5:a.State = 1:FadingLevel(nr) = 1
- ' End Select
- 'End Sub
- '
- 'Sub NFadeLm(nr, a)
- ' Select Case FadingLevel(nr)
- ' Case 4:a.state = 0
- ' Case 5:a.State = 1
- ' End Select
- 'End Sub
- Sub LMap(nr, a, b, c) 'can be used with normal/olod style lights too
- Select Case FadingLevel(nr)
- Case 2:c.state = 0:FadingLevel(nr) = 0
- Case 3:b.state = 0:c.state = 1:FadingLevel(nr) = 2
- Case 4:a.state = 0:b.state = 1:FadingLevel(nr) = 3
- Case 5:b.state = 0:c.state = 0:a.state = 1:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub LMapm(nr, a, b, c)
- Select Case FadingLevel(nr)
- Case 2:c.state = 0
- Case 3:b.state = 0:c.state = 1
- Case 4:a.state = 0:b.state = 1
- Case 5:b.state = 0:c.state = 0:a.state = 1
- End Select
- End Sub
- 'Reels
- Sub FadeR(nr, a)
- Select Case FadingLevel(nr)
- Case 2:a.SetValue 3:FadingLevel(nr) = 0
- Case 3:a.SetValue 2:FadingLevel(nr) = 2
- Case 4:a.SetValue 1:FadingLevel(nr) = 3
- Case 5:a.SetValue 1:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub FadeRm(nr, a)
- Select Case FadingLevel(nr)
- Case 2:a.SetValue 3
- Case 3:a.SetValue 2
- Case 4:a.SetValue 1
- Case 5:a.SetValue 1
- End Select
- End Sub
- 'Texts
- Sub NFadeT(nr, a, b)
- Select Case FadingLevel(nr)
- Case 4:a.Text = "":FadingLevel(nr) = 0
- Case 5:a.Text = b:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub NFadeTm(nr, a, b)
- Select Case FadingLevel(nr)
- Case 4:a.Text = ""
- Case 5:a.Text = b
- End Select
- End Sub
- ' Flash a light, not controlled by the rom
- Sub FlashL(nr, a, b)
- Select Case FadingLevel(nr)
- Case 1:b.state = 0:FadingLevel(nr) = 0
- Case 2:b.state = 1:FadingLevel(nr) = 1
- Case 3:a.state = 0:FadingLevel(nr) = 2
- Case 4:a.state = 1:FadingLevel(nr) = 3
- Case 5:b.state = 1:FadingLevel(nr) = 4
- End Select
- End Sub
- ' Light acting as a flash. C is the light number to be restored
- Sub MFadeL(nr, a, b, c)
- Select Case FadingLevel(nr)
- Case 2:b.state = 0:FadingLevel(nr) = 0:SetLamp c, FadingLevel(c)
- Case 3:b.state = 1:FadingLevel(nr) = 2
- Case 4:a.state = 0:FadingLevel(nr) = 3
- Case 5:a.state = 1:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub MFadeLm(nr, a, b, c)
- Select Case FadingLevel(nr)
- Case 2:b.state = 0:SetLamp c, FadingLevel(c)
- Case 3:b.state = 1
- Case 4:a.state = 0
- Case 5:a.state = 1
- End Select
- End Sub
- 'Alpha Ramps used as fading lights
- 'ramp is the name of the ramp
- 'a,b,c,d are the images used for on...off
- 'r is the refresh light
- Sub FadeAR(nr, ramp, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:ramp.image = d:FadingLevel(nr) = 0 'Off
- Case 3:ramp.image = c:FadingLevel(nr) = 2 'fading...
- Case 4:ramp.image = b:FadingLevel(nr) = 3 'fading...
- Case 5:ramp.image = a:FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FadeARm(nr, ramp, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:ramp.image = d
- Case 3:ramp.image = c
- Case 4:ramp.image = b
- Case 5:ramp.image = a
- End Select
- End Sub
- Sub FlashFO(nr, ramp, a, b, c) 'used for reflections when there is no off ramp
- Select Case FadingLevel(nr)
- Case 2:ramp.IsVisible = 0:FadingLevel(nr) = 0 'Off
- Case 3:ramp.image = c:FadingLevel(nr) = 2 'fading...
- Case 4:ramp.image = b:FadingLevel(nr) = 3 'fading...
- Case 5:ramp.image = a:ramp.IsVisible = 1:FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FlashAR(nr, ramp, a, b, c) 'used for reflections when there is no off ramp
- Select Case FadingLevel(nr)
- Case 2:ramp.alpha = 0:FadingLevel(nr) = 0 'Off
- Case 3:ramp.image = c:FadingLevel(nr) = 2 'fading...
- Case 4:ramp.image = b:FadingLevel(nr) = 3 'fading...
- Case 5:ramp.image = a:ramp.alpha = 1:FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FlashARm(nr, ramp, a, b, c)
- Select Case FadingLevel(nr)
- Case 2:ramp.alpha = 0
- Case 3:ramp.image = c
- Case 4:ramp.image = b
- Case 5:ramp.image = a:ramp.alpha = 1
- End Select
- End Sub
- Sub NFadeAR(nr, ramp, a, b)
- Select Case FadingLevel(nr)
- Case 4:ramp.image = b:FadingLevel(nr) = 0 'off
- Case 5:ramp.image = a:FadingLevel(nr) = 1 'on
- End Select
- End Sub
- Sub NFadeARm(nr, ramp, a, b)
- Select Case FadingLevel(nr)
- Case 4:ramp.image = b
- Case 5:ramp.image = a
- End Select
- End Sub
- Sub MNFadeAR(nr, ramp, a, b, c)
- Select Case FadingLevel(nr)
- Case 4:ramp.image = b:FadingLevel(nr) = 0:SetLamp c, FadingLevel(c) 'off
- Case 5:ramp.image = a:FadingLevel(nr) = 1 'on
- End Select
- End Sub
- Sub MNFadeARm(nr, ramp, a, b, c)
- Select Case FadingLevel(nr)
- Case 4:ramp.image = b:SetLamp c, FadingLevel(c) 'off
- Case 5:ramp.image = a 'on
- End Select
- End Sub
- ' Flashers using PRIMITIVES
- ' pri is the name of the primitive
- ' a,b,c,d are the images used for on...off
- Sub FadePri(nr, pri, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:pri.image = d:FadingLevel(nr) = 0 'Off
- Case 3:pri.image = c:FadingLevel(nr) = 2 'fading...
- Case 4:pri.image = b:FadingLevel(nr) = 3 'fading...
- Case 5:pri.image = a:FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FadePri3m(nr, pri, group)
- Select Case FadingLevel(nr)
- Case 3:pri.image = group(2)
- Case 4:pri.image = group(1)
- Case 5:pri.image = group(0)
- End Select
- End Sub
- Sub FadePri3(nr, pri, group)
- Select Case FadingLevel(nr)
- Case 3:pri.image = group(2):FadingLevel(nr) = 0 'Off
- Case 4:pri.image = group(1):FadingLevel(nr) = 3 'fading...
- Case 5:pri.image = group(0):FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FadePri4m(nr, pri, group)
- Select Case FadingLevel(nr)
- Case 2:pri.image = group(3) 'Off
- Case 3:pri.image = group(2) 'Fading...
- Case 4:pri.image = group(1) 'Fading...
- Case 5:pri.image = group(0) 'ON
- End Select
- End Sub
- Sub FadePri4(nr, pri, group)
- Select Case FadingLevel(nr)
- Case 2:pri.image = group(3):FadingLevel(nr) = 0 'Off
- Case 3:pri.image = group(2):FadingLevel(nr) = 2 'Fading...
- Case 4:pri.image = group(1):FadingLevel(nr) = 3 'Fading...
- Case 5:pri.image = group(0):FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FadePriC(nr, pri, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:For each xx in pri:xx.image = d:Next:FadingLevel(nr) = 0 'Off
- Case 3:For each xx in pri:xx.image = c:Next:FadingLevel(nr) = 2 'fading...
- Case 4:For each xx in pri:xx.image = b:Next:FadingLevel(nr) = 3 'fading...
- Case 5:For each xx in pri:xx.image = a:Next:FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FadePrih(nr, pri, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:pri.image = d:SetFlash nr, 0:FadingLevel(nr) = 0 'Off
- Case 3:pri.image = c:FadingLevel(nr) = 2 'fading...
- Case 4:pri.image = b:FadingLevel(nr) = 3 'fading...
- Case 5:pri.image = a:SetFlash nr, 1:FadingLevel(nr) = 1 'ON
- End Select
- End Sub
- Sub FadePrim(nr, pri, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 2:pri.image = d
- Case 3:pri.image = c
- Case 4:pri.image = b
- Case 5:pri.image = a
- End Select
- End Sub
- Sub NFadePri(nr, pri, a, b)
- Select Case FadingLevel(nr)
- Case 4:pri.image = b:FadingLevel(nr) = 0 'off
- Case 5:pri.image = a:FadingLevel(nr) = 1 'on
- End Select
- End Sub
- Sub NFadePrim(nr, pri, a, b)
- Select Case FadingLevel(nr)
- Case 4:pri.image = b
- Case 5:pri.image = a
- End Select
- End Sub
- 'Fade a collection of lights
- Sub FadeLCo(nr, a, b) 'fading collection of lights
- Dim obj
- Select Case FadingLevel(nr)
- Case 2:vpmSolToggleObj b, Nothing, 0, 0:FadingLevel(nr) = 0
- Case 3:vpmSolToggleObj b, Nothing, 0, 1:FadingLevel(nr) = 2
- Case 4:vpmSolToggleObj a, Nothing, 0, 0:FadingLevel(nr) = 3
- Case 5:vpmSolToggleObj a, Nothing, 0, 1:FadingLevel(nr) = 1
- End Select
- End Sub
- 'only for this table
- ' Alternate two lights made with walls
- Sub AlternateW(nr, a, b)
- Select Case LampState(nr)
- Case 4:SetLamp a, 0:SetLamp b, 0:LampState(nr) = 0 'both off
- Case 5:SetLamp a, 1:SetLamp b, 0:LampState(nr) = 6 'On - Off
- Case 6:LampState(nr) = 7 'wait
- Case 7:LampState(nr) = 8 'wait
- Case 8:LampState(nr) = 9 'wait
- Case 9:LampState(nr) = 10 'wait
- Case 10:SetLamp a, 0:SetLamp b, 1:LampState(nr) = 11 'Off - On
- Case 11:LampState(nr) = 12 'wait
- Case 12:LampState(nr) = 13 'wait
- Case 13:LampState(nr) = 14 'wait
- Case 14:LampState(nr) = 15 'wait
- Case 15:LampState(nr) = 5
- End Select
- End Sub
- '***********************
- ' Visible Locks
- ' Adapted to this table
- ' based on the core.vbs
- '***********************
- Class cvpmVLock2
- Private mTrig, mKick, mSw(), mSize, mBalls, mGateOpen, mRealForce, mBallSnd, mNoBallSnd
- Public ExitDir, ExitForce, KickForceVar
- Private Sub Class_Initialize
- mBalls = 0:ExitDir = 0:ExitForce = 0:KickForceVar = 0:mGateOpen = False
- vpmTimer.addResetObj Me
- End Sub
- Public Sub InitVLock(aTrig, aKick, aSw)
- Dim ii
- mSize = vpmSetArray(mTrig, aTrig)
- If vpmSetArray(mKick, aKick) <> mSize Then MsgBox "cvpmVLock: Unmatched kick+trig":Exit Sub
- On Error Resume Next
- ReDim mSw(mSize)
- If IsArray(aSw) Then
- For ii = 0 To UBound(aSw):mSw(ii) = aSw(ii):Next
- ElseIf aSw = 0 Or Err Then
- For ii = 0 To mSize:mSw(ii) = mTrig(ii).TimerInterval:Next
- Else
- mSw(0) = aSw
- End If
- End Sub
- Public Sub InitSnd(aBall, aNoBall):mBallSnd = aBall:mNoBallSnd = aNoBall:End Sub
- Public Sub CreateEvents(aName)
- Dim ii
- If Not vpmCheckEvent(aName, Me) Then Exit Sub
- For ii = 0 To mSize
- vpmBuildEvent mTrig(ii), "Hit", aName & ".TrigHit ActiveBall," & ii + 1
- vpmBuildEvent mTrig(ii), "Unhit", aName & ".TrigUnhit ActiveBall," & ii + 1
- vpmBuildEvent mKick(ii), "Hit", aName & ".KickHit " & ii + 1
- Next
- End Sub
- Public Sub SolExit(aEnabled)
- Dim ii
- mGateOpen = aEnabled
- If Not aEnabled Then Exit Sub
- If mBalls> 0 Then PlaySound mBallSnd:Else PlaySound mNoBallSnd:Exit Sub
- For ii = 0 To mBalls-1
- mKick(ii).Enabled = False:If mSw(ii) Then Controller.Switch(mSw(ii) ) = False
- Next
- ' If ExitForce > 0 Then ' Up
- ' mRealForce = ExitForce + (Rnd - 0.5)*KickForceVar : mKick(mBalls-1).Kick ExitDir, mRealForce
- ' Else ' Down
- mRealForce = ExitForce + (Rnd - 0.5) * KickForceVar:mKick(0).Kick ExitDir, mRealForce
- ' End If
- End Sub
- Public Sub Reset
- Dim ii:If mBalls = 0 Then Exit Sub
- For ii = 0 To mBalls-1
- If mSw(ii) Then Controller.Switch(mSw(ii) ) = True
- Next
- End Sub
- Public Property Get Balls:Balls = mBalls:End Property
- Public Property Let Balls(aBalls)
- Dim ii:mBalls = aBalls
- For ii = 0 To mSize
- If ii >= aBalls Then
- mKick(ii).DestroyBall:If mSw(ii) Then Controller.Switch(mSw(ii) ) = False
- Else
- vpmCreateBall mKick(ii):If mSw(ii) Then Controller.Switch(mSw(ii) ) = True
- End If
- Next
- End Property
- Public Sub TrigHit(aBall, aNo)
- aNo = aNo - 1:If mSw(aNo) Then Controller.Switch(mSw(aNo) ) = True
- If aBall.VelY <-1 Then Exit Sub ' Allow small upwards speed
- If aNo = mSize Then mBalls = mBalls + 1
- If mBalls> aNo Then mKick(aNo).Enabled = Not mGateOpen
- End Sub
- Public Sub TrigUnhit(aBall, aNo)
- aNo = aNo - 1:If mSw(aNo) Then Controller.Switch(mSw(aNo) ) = False
- If aBall.VelY> -1 Then
- If aNo = 0 Then mBalls = mBalls - 1
- If aNo <mSize Then mKick(aNo + 1).Kick 0, 0
- Else
- If aNo = mSize Then mBalls = mBalls - 1
- If aNo> 0 Then mKick(aNo-1).Kick ExitDir, mRealForce
- End If
- End Sub
- Public Sub KickHit(aNo):mKick(aNo-1).Enabled = False:End Sub
- End Class
- ' *********************************************************************
- ' Supporting Ball & Sound Functions
- ' *********************************************************************
- Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2 / 2000) * 100
- End Function
- Function Vol2(ball1, ball2) ' Calculates the Volume of the sound based on the speed of two balls
- Vol2 = (Vol(ball1) + Vol(ball2) ) / 2
- End Function
- Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = ball.x * 2 / table1.width-1
- If tmp> 0 Then
- Pan = Csng(tmp ^10)
- Else
- Pan = Csng(-((- tmp) ^10) )
- End If
- 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 Collision & Rolling Sounds
- '*****************************************
- Const tnob = 8 ' total number of balls
- ReDim rolling(tnob)
- ReDim collision(tnob)
- Initcollision
- Sub Initcollision
- Dim i
- For i = 0 to tnob
- collision(i) = -1
- rolling(i) = False
- Next
- End Sub
- Sub CollisionTimer_Timer()
- Dim BOT, B, B1, B2, dx, dy, dz, distance, radii
- BOT = GetBalls
- ' rolling
- For B = UBound(BOT) +1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & b)
- Next
- If UBound(BOT) = -1 Then Exit Sub
- For B = 0 to UBound(BOT)
- If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
- rolling(b) = True
- PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
- Else
- If rolling(b) = True Then
- StopSound("fx_ballrolling" & b)
- rolling(b) = False
- End If
- End If
- Next
- 'collision
- If UBound(BOT) < 1 Then Exit Sub
- For B1 = 0 to UBound(BOT)
- For B2 = B1 + 1 to UBound(BOT)
- dz = INT(ABS((BOT(b1).z - BOT(b2).z) ) )
- radii = BOT(b1).radius + BOT(b2).radius
- If dz <= radii Then
- dx = INT(ABS((BOT(b1).x - BOT(b2).x) ) )
- dy = INT(ABS((BOT(b1).y - BOT(b2).y) ) )
- distance = INT(SQR(dx ^2 + dy ^2) )
- If distance <= radii AND (collision(b1) = -1 OR collision(b2) = -1) Then
- collision(b1) = b2
- collision(b2) = b1
- PlaySound("fx_collide"), 0, Vol2(BOT(b1), BOT(b2)), Pan(BOT(b1)), 0, Pitch(BOT(b1)), 0, 0
- Else
- If distance > (radii + 10) Then
- If collision(b1) = b2 Then collision(b1) = -1
- If collision(b2) = b1 Then collision(b2) = -1
- End If
- End If
- End If
- Next
- Next
- End Sub
- '************************************
- ' What you need to add to your table
- '************************************
- ' a timer called CollisionTimer. With a fast interval, like from 1 to 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, PAN and PITCH functions, so the volume and pitch of the sound
- ' will change according to the ball speed, and the PAN function will change the stereo position according
- ' to the position of the ball on the table.
- '**************************************
- ' Explanation of the collision routine
- '**************************************
- ' The Double For loop: This is a double cycle used to check the collision between a ball and the other ones.
- ' If you look at the parameters of both cycles, you’ll notice they are designed to avoid checking
- ' collision twice. For example, I will never check collision between ball 2 and ball 1,
- ' because I already checked collision between ball 1 and 2. So, if we have 4 balls,
- ' the collision checks will be: ball 1 with 2, 1 with 3, 1 with 4, 2 with 3, 2 with 4 and 3 with 4.
- ' Sum first the radius of both balls, and if the height between them is higher then do not calculate anything more,
- ' since the balls are on different heights so they can't collide.
- ' The next 3 lines calculates distance between xth and yth balls with the Pytagorean theorem,
- ' The first "If": Checking if the distance between the two balls is less than the sum of the radius of both balls,
- ' and both balls are not already colliding.
- ' Why are we checking if balls are already in collision?
- ' Because we do not want the sound repeting when two balls are resting closed to each other.
- ' Set the collision property of both balls to True, and we assign the number of the ball colliding
- ' Play the collide sound of your choice using the VOL, PAN and PITCH functions
- ' Last lines: If the distance between 2 balls is more than the radius of a ball,
- ' then there is no collision and then set the collision property of the ball to False (-1).
- Sub Pins_Hit (idx)
- PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
- End Sub
- Sub Targets_Hit (idx)
- PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
- End Sub
- Sub Metals_Thin_Hit (idx)
- PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Metals_Medium_Hit (idx)
- PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Metals2_Hit (idx)
- PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Spinner_Spin
- PlaySound "fx_spinner",0,.25,0,0.25
- 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), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- 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), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- 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), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- 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), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Select
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment