Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '********Avengers (Stern 2012) by GTXJOE
- '********* VPX version by sliderpoint
- 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 BallMass = 1.25
- '******************* Options *********************
- 'DMD Color
- Const DMDColor = 4 '1 = Red, 2 = Green, 3=Blue, 4=Normal (do not touch)
- 'General Illumination Color
- Const GIColor = 1 '1 = Red/Green/Blue GI, 2 = White GI
- 'Enable GI flashing
- Const GIFlashing = 1 '0 = GI Flashing Disable, 1 = GI Flashing Enabled
- ' DMD Rotation
- Const cDMDRotation = 99 '0 or 1 for a DMD rotation of 90°, 99 for do not touch
- ' Enable / disable analog plunger motion device
- 'Const MotionDeviceEnabled = 0 '0 disable, 1 enable.
- '******************* Options *********************
- 'Sub LoadCoreVBS
- ' On Error Resume Next
- ' ExecuteGlobal GetTextFile("core.vbs")
- ' If Err Then MsgBox "Can't open core.vbs"
- ' On Error Goto 0
- 'End Sub
- LoadVPM "01560000", "sam.VBS", 3.10
- '********************
- 'Standard definitions
- '********************
- Const cGameName = "avs_170"
- Const UseSolenoids = 1
- Const UseLamps = 1
- Const UseSync = 1
- Const HandleMech = 0
- 'Standard Sounds
- Const SSolenoidOn = "fx_solenoid"
- Const SSolenoidOff = ""
- Const SCoin = "Coin_In"
- 'Variables
- Dim bsL,mHulkMag,tbTrough,dtBank,Bump1, Bump2, Bump3, bsRHole, MsLHole, bsHole, bsTrough, visibleLock ,bsSaucer, mDiverter
- Dim PlungerIM
- Dim DesktopMode: DesktopMode = Table1.ShowDT
- 'Table Init
- Sub Table1_Init
- vpmInit Me
- With Controller
- .GameName = cGameName
- .SplashInfoLine = "Avengers Pro Stern 2012"
- .HandleKeyboard = 0
- .ShowTitle = 0
- .ShowDMDOnly = 1
- .ShowFrame = 0
- .HandleMechanics = 1
- .Hidden = 0
- ' If cDMDRotation <> 99 Then
- ' .Games(cGameName).Settings.Value("rol") = cDMDRotation
- ' End If
- '
- ' Select Case DMDColor:
- ' Case 1:
- ' .Games(cGameName).Settings.Value("dmd_red") = 255
- ' .Games(cGameName).Settings.Value("dmd_green") = 0
- ' .Games(cGameName).Settings.Value("dmd_blue") = 0
- ' Case 2:
- ' .Games(cGameName).Settings.Value("dmd_red") = 0
- ' .Games(cGameName).Settings.Value("dmd_green") = 255
- ' .Games(cGameName).Settings.Value("dmd_blue") = 0
- ' Case 3:
- ' .Games(cGameName).Settings.Value("dmd_red") = 0
- ' .Games(cGameName).Settings.Value("dmd_green") = 0
- ' .Games(cGameName).Settings.Value("dmd_blue") = 255
- ' End Select
- On Error Resume Next
- .Run GetPlayerHWnd
- If Err Then MsgBox Err.Description
- End With
- On Error Goto 0
- '**Trough
- Set bsTrough = New cvpmBallStack
- bsTrough.InitSw 0, 21, 20, 19, 18, 0, 0, 0
- bsTrough.InitKick BallRelease, 80 , 8
- bsTrough.InitExitSnd SoundFX("fx_ballrel",DOFContactors), SoundFX("fx_solenoid",DOFContactors)
- bsTrough.Balls = 4
- ' Loki Lock Init - Optos used so switch is opposite (1=no ball, 0=ball). Default to 1
- Controller.Switch(51) = 1
- Controller.Switch(50) = 1
- Controller.Switch(49) = 1
- Post51.IsDropped = 1
- Post50.IsDropped = 1
- Post49.IsDropped = 0
- Set dtBank = New cvpmDropTarget 'HULK
- dtBank.InitDrop Array(Sw52,Sw53,Sw54,Sw55),Array(52,53,54,55) 'Walls<->Switch No.
- dtBank.InitSnd SoundFX("droptarget",DOFDropTargets),SoundFX("droptargetreset",DOFContactors)
- RampControlGate.IsDropped = 1
- ' Impulse Plunger
- Const IMPowerSetting = 55
- Const IMTime = 0.6
- Set plungerIM = New cvpmImpulseP
- With plungerIM
- .InitImpulseP swplunger, IMPowerSetting, IMTime
- .Random .5
- .InitExitSnd SoundFX("fx_plunger2",DOFContactors), SoundFX("fx_plunger",DOFContactors)
- .CreateEvents "plungerIM"
- End With
- 'Hulk Eject
- Set bsHole = New cvpmSaucer
- bsHole.InitKicker HulkEject, 62, 25, 11, 2
- bsHole.InitSounds "kicker_enter_left","fx_solenoid","popper_ball"
- ' bsHole.InitEntrySnd "kicker_enter_left", "kicker_enter_left"
- 'bsHole.kickanglevar=15
- 'bsHole.kickZ = 0.5
- 'bsHole.KickForceVar = 2
- 'Init Hulk
- 'HulkInit
- 'Init Tesseract
- Dim obj
- For Each obj In colLampPoles:obj.IsDropped = 1:Next
- For Each obj In colLampPoles2:obj.IsDropped = 1:Next
- lampSpinSpeed = 0:lampLastPos = -1:SpinTimer.Enabled = True ' force update
- Set mHulkMag= New cvpmMagnet
- With mHulkMag
- .InitMagnet HulkMag, 16
- .GrabCenter = True
- .solenoid=23
- .CreateEvents "mHulkMag"
- End With
- 'DropTargets
- ' Targets_Init
- '**Main Timer init
- PinMAMETimer.Enabled = 1
- 'Nudging
- vpmNudge.TiltSwitch=-7
- vpmNudge.Sensitivity=7
- vpmNudge.TiltObj=Array(Bumper1b,Bumper2b,Bumper3b,LeftSlingshot,RightSlingshot)
- '**Bumper Rings init
- ' Ring1a1.IsDropped = 1:Ring1b1.IsDropped = 1
- ' Ring1a2.IsDropped = 1:Ring1b2.IsDropped = 1
- ' Ring3a.IsDropped = 1:Ring3b.IsDropped = 1
- 'BumperLights init
- 'B1Off
- 'B2Off
- 'B3Off
- 'Slings
- ' For each xx in RhammerA:xx.IsDropped=1:Next
- ' For each xx in RhammerB:xx.IsDropped=1:Next
- ' For each xx in RhammerC:xx.IsDropped=1:Next
- ' For each xx in LhammerA:xx.IsDropped=1:Next
- ' For each xx in LhammerB:xx.IsDropped=1:Next
- ' For each xx in LhammerC:xx.IsDropped=1:Next
- 'GI Init
- ' SetLamp 135,1
- ' SetLamp 136,1
- ' SetLamp 137,1
- ' SetLamp 140,1
- '
- vpmMapLights AllLights
- DayNight = table1.NightDay
- Intensity 'sets GI brightness depending on day/night slider settings
- End Sub
- Sub Table1_Paused:Controller.Pause = 1:End Sub
- Sub Table1_unPaused:Controller.Pause = 0:End Sub
- Sub Table1_exit():Controller.Stop: End sub
- 'Sub Table1_exit()
- ' Controller.Pause = False
- ' Controller.Stop
- 'End Sub
- '*****Keys
- Sub Table1_KeyDown(ByVal keycode)
- '*****DEBUG
- '*****DEBUG
- '*****DEBUG
- ' rampCheck keycode 'Test Ramps
- If Keycode = StartGameKey Then Controller.Switch(16) = 1
- If Keycode = LeftFlipperKey then
- SolLFlipper true
- '*****DEBUG
- '*****DEBUG
- '*****DEBUG
- 'vpmtimer.pulsesw (25) 'loki multiball
- 'hulkprim.roty = hulkprim.roty-5
- End If
- If Keycode = RightFlipperKey then
- SolRFlipper true
- 'hulkprim.roty = hulkprim.roty+5
- End If
- If keycode = PlungerKey Then Plunger.Pullback:Playsound"fx_plungerpull"
- If keycode = LeftTiltKey Then playsound SoundFX("fx_nudge_left",0)
- If keycode = RightTiltKey Then playsound SoundFX("fx_nudge_right",0)
- If keycode = CenterTiltKey Then playsound SoundFX("fx_nudge_forward",0)
- If vpmKeyDown(keycode) Then Exit Sub
- End Sub
- Sub Table1_KeyUp(ByVal keycode)
- If Keycode = StartGameKey Then Controller.Switch(16) = 0
- If vpmKeyUp(keycode) Then Exit Sub
- If Keycode = LeftFlipperKey then
- SolLFlipper false
- End If
- If Keycode = RightFlipperKey then
- SolRFlipper False
- End If
- If keycode = PlungerKey Then
- Plunger.Fire
- If(BallinPlunger = 1) then 'the ball is in the plunger lane
- PlaySound "fx_Plunger2"
- else
- PlaySound "fx_Plunger"
- end if
- End If
- End Sub
- 'Sub Launchz_Hit
- ' ActiveBall.velz = 0
- 'End Sub
- 'Solenoids
- SolCallback(1) = "solTrough"
- SolCallback(2) = "solAutofire"
- SolCallback(3) = "solHulkCCW"
- SolCallback(4) = "solHulkCW"
- SolCallback(5) = "bsHole.SolOut"
- SolCallback(6) = "solRaiseDtBank"
- SolCallback(7) = "OrbitControlGate"
- SolCallback(9) = "vpmSolSound SoundFX(""bumper"",DOFContactors),"
- SolCallback(10) = "vpmSolSound SoundFX(""bumper"",DOFContactors),"
- SolCallback(11) = "vpmSolSound SoundFX(""bumper"",DOFContactors),"
- SolCallback(12) = "solRampControlGate"
- 'SolCallback(15) = "SolLFlipper" ' Adding this to keydown and up to avoid slight vpm lag in flipper reaction
- 'SolCallback(16) = "SolRFlipper"
- SolCallBack(17) = "solHulkArms" 'Hulk Arms
- SolCallback(18) = "Flash18"'"SetLamp 118," 'Left Flasher
- 'SolCallback(19) = "SetLamp 119," 'Right Flasher
- SolCallback(20) = "Flash20" '"SetLamp 120," 'Sling Flashers
- SolCallback(21) = "Flash21" 'Hulk Flashers
- SolCallback(22) = "solLokiLockup"
- SolCallback(25) = "Flash25" '"SetLamp 125," 'Pop Bumper Flasher
- SolCallback(26) = "Flash26" '"SetLamp 126," 'Teseract Cube Flasher
- SolCallback(27) = "Flash27" '"SetLamp 127," 'Backwall Flasher
- SolCallback(28) = "Flash28" '"SetLamp 128," 'Backwall Flasher
- SolCallback(29) = "Flash29" '"SetLamp 129," 'Backwall Flasher
- SolCallback(30) = "Flash30" '"SetLamp 130," 'Backwall Flasher
- SolCallback(31) = "Flash31" '"SetLamp 131," 'Backwall Flasher
- SolCallback(32) = "Flash32" '"SetLamp 132," 'Backwall Flasher
- set GICallback = GetRef("UpdateGI")
- 'GI related
- 'SolCallback(35) = "ClearLamp 135," '
- 'SolCallback(36) = "ClearLamp 136," '
- 'SolCallback(37) = "GIClearLamp37" 'Toggle GI 140
- 'SolCallback(38) = "GIClearLamp38" 'Toggle GI 140
- 'SolCallback(39) = "GIClearLamp39" 'Toggle GI 140
- 'SolCallback(40) = "GIClearLamp40" 'Toggle GI 140
- Sub GIClearLamp37 (enabled)
- If GIFlashing = 1 Then
- ClearLamp 140,enabled
- 'debug.print "Sol: 37 " & enabled
- End If
- End Sub
- Sub GIClearLamp38 (enabled)
- If GIFlashing = 1 Then
- ClearLamp 140,enabled
- 'debug.print "Sol: 38 " & enabled
- End If
- End Sub
- Sub GIClearLamp39 (enabled)
- If GIFlashing = 1 Then
- ClearLamp 140,enabled
- 'debug.print "Sol: 39 " & enabled
- End If
- End Sub
- Sub GIClearLamp40 (enabled)
- If GIFlashing = 1 Then
- ClearLamp 140,enabled
- 'debug.print "Sol: 40 " & enabled
- End If
- End Sub
- Sub Flash18(enabled)
- If Enabled Then
- Flasher19a.State = 1
- Flasher19b.State = 1
- Flasher19p.image = "DomeOn"
- Else
- Flasher19a.State = 0
- Flasher19b.State = 0
- Flasher19p.image = "DomeOff"
- End If
- End Sub
- Sub Flash20(enabled)
- If Enabled Then
- Flasher20a.State = 1
- Flasher20b.State = 1
- Flasher20c.State = 1
- Flasher20d.State = 1
- Spot20a.State = 1
- Spot20b.State = 1
- Flasher20p1.image = "DomeOn"
- Flasher20p2.image = "DomeOn"
- Else
- Flasher20a.State = 0
- Flasher20b.State = 0
- Flasher20c.State = 0
- Flasher20d.State = 0
- Spot20a.State = 0
- Spot20b.State = 0
- Flasher20p1.image = "DomeOff"
- Flasher20p2.image = "DomeOff"
- end If
- End Sub
- Sub Flash21(enabled)
- If Enabled Then
- Spot21a.State = 1
- Spot21b.State = 1
- Else
- Spot21a.State = 0
- Spot21b.State = 0
- End If
- End Sub
- Sub Flash25(Enabled)
- If Enabled then
- Flasher25.State = 1
- Else
- Flasher25.State = 0
- End If
- End Sub
- Sub Flash26(Enabled)
- If Enabled then
- Flasher26a.State = 1
- Flasher26b.State = 1
- Flasher26c.State = 1
- Else
- Flasher26a.State = 0
- Flasher26b.State = 0
- Flasher26c.State = 0
- End If
- End Sub
- Sub Flash27(enabled)
- If Enabled Then
- Flasher27a.State = 1
- Flasher27b.State = 1
- Flasher27p.Image = "DomeOn"
- Else
- Flasher27a.State = 0
- Flasher27b.state = 0
- Flasher27p.Image = "DomeOff"
- End If
- End Sub
- Sub Flash28(enabled)
- If Enabled Then
- Flasher28a.State = 1
- Flasher28b.State = 1
- Flasher28p.Image = "DomeOn"
- Else
- Flasher28a.State = 0
- Flasher28b.state = 0
- Flasher28p.Image = "DomeOff"
- End If
- End Sub
- Sub Flash29(enabled)
- If Enabled Then
- Flasher29a.State = 1
- Flasher29b.State = 1
- Flasher29p.Image = "DomeOn"
- Else
- Flasher29a.State = 0
- Flasher29b.state = 0
- Flasher29p.Image = "DomeOff"
- End If
- End Sub
- Sub Flash30(enabled)
- If Enabled Then
- Flasher30a.State = 1
- Flasher30b.State = 1
- Flasher30p.Image = "DomeOn"
- Else
- Flasher30a.State = 0
- Flasher30b.state = 0
- Flasher30p.Image = "DomeOff"
- End If
- End Sub
- Sub Flash31(enabled)
- If Enabled Then
- Flasher31a.State = 1
- Flasher31b.State = 1
- Flasher31p.Image = "DomeOn"
- Else
- Flasher31a.State = 0
- Flasher31b.state = 0
- Flasher31p.Image = "DomeOff"
- End If
- End Sub
- Sub Flash32(enabled)
- If Enabled Then
- Flasher32a.State = 1
- Flasher32b.State = 1
- Flasher32p.Image = "DomeOn"
- Else
- Flasher32a.State = 0
- Flasher32b.state = 0
- Flasher32p.Image = "DomeOff"
- End If
- End Sub
- '***DEBUG
- '***DEBUG
- '***DEBUG
- 'SolCallBack(3)="solcheck 3," 'Hulk CCW
- 'SolCallBack(4)="solcheck 4," 'Hulk CW
- 'SolCallBack(13)="solcheck 13,"
- 'SolCallBack(14)="solcheck 14,"
- 'SolCallBack(17)="solcheck 17," 'Hulk Arms
- 'SolCallBack(23)="solcheck 23," 'Hulk Magnet
- 'SolCallBack(24)="solcheck 24," 'Coin Meter
- 'SolCallBack(33)="solcheck 33,"
- 'SolCallBack(34)="solcheck 34,"
- 'SolCallBack(35)="solcheck 35," 'toggled a lot
- 'SolCallBack(36)="solcheck 36," 'toggled a lot
- 'SolCallBack(37)="solcheck 37,"
- 'SolCallBack(38)="solcheck 38,"
- 'SolCallBack(39)="solcheck 39,"
- 'SolCallBack(40)="solcheck 40,"
- SolCallBack(41)="solcheck 41,"
- SolCallBack(42)="solcheck 42,"
- SolCallBack(43)="solcheck 43,"
- SolCallBack(44)="solcheck 44,"
- SolCallBack(45)="solcheck 45,"
- SolCallBack(46)="solcheck 46,"
- SolCallBack(47)="solcheck 47,"
- SolCallBack(48)="solcheck 48,"
- sub solcheck(value,enabled)
- dim solx
- Select Case value
- Case 3: solx = "Hulk CCW"
- Case 4: solx = "Hulk CW"
- Case 5: solx = "Hulk Eject"
- Case 7: solx = "Orbit Control Gate"
- Case 8: solx = "Shaker"
- Case 12: solx = "Ramp Control Gate Left"
- Case 13: solx = "LeftSling"
- Case 14: solx = "RightSling"
- Case 17: solx = "Hulk Arms"
- Case 18: solx = "Flash Left"
- Case 19: solx = "Flash Right"
- Case 20: solx = "Flash Slings"
- Case 21: solx = "Flash Hulk"
- Case 23: solx = "Hulk Magnet"
- Case 24: solx = "Coin Meter"
- Case 25: solx = "Flash Pop Bumper"
- Case 27: solx = "Flash Back1"
- Case 28: solx = "Flash Back2"
- Case 29: solx = "Flash Back3"
- Case 30: solx = "Flash Back4"
- Case 31: solx = "Flash Back5"
- Case 32: solx = "Flash Back6"
- End Select
- 'debug.print solx &": solenoid " & value &"="&enabled
- ' Msgbox solx &": solenoid " & value &"="&enabled
- End Sub
- Sub solTrough(Enabled)
- If Enabled Then
- bsTrough.ExitSol_On
- vpmTimer.PulseSw 22
- End If
- End Sub
- sub solHulkCCW (enabled)
- If enabled Then
- HulkPrim.Roty = HulkPrim.roty + 20
- HulkPrim1.Roty = HulkPrim.Roty
- HulkPrim2.Roty = HulkPrim.Roty
- HulkArm1.RotateToEnd
- Else
- HulkPrim.Roty = 180
- HulkPrim1.Roty = HulkPrim.Roty
- HulkPrim2.Roty = HulkPrim.Roty
- HulkArm1.RotateToStart
- End if
- End Sub
- sub solHulkCW (enabled)
- If enabled Then
- HulkPrim.Roty = HulkPrim.roty - 20
- HulkPrim1.Roty = HulkPrim.Roty
- HulkPrim2.Roty = HulkPrim.Roty
- HulkArm2.RotateToEnd
- Else
- HulkPrim.Roty = 180
- HulkPrim1.Roty = HulkPrim.Roty
- HulkPrim2.Roty = HulkPrim.Roty
- HulkArm2.RotateToStart
- End If
- End Sub
- Dim armsup:armsup=False
- Sub solHulkArms (enabled)
- If enabled Then
- HulkArm1.Enabled = 0
- HulkArm2.Enabled = 0
- armsup = True
- Else
- HulkArm1.Enabled = 1
- HulkArm2.Enabled = 1
- armsup = False
- End If
- End Sub
- Sub solRaiseDtBank(enabled)
- If enabled Then
- dtBank.DropSol_On
- ' sw52back.IsDropped=0
- ' sw53back.IsDropped=0
- ' sw54back.IsDropped=0
- ' sw55back.IsDropped=0
- sw52.IsDropped=0
- sw53.IsDropped=0
- sw54.IsDropped=0
- sw55.IsDropped=0
- End If
- End Sub
- Sub solLokiLockup(Enabled)
- If Enabled Then
- post49.isdropped = 1: playsound SoundFX("fx_woodhit2",DOFContactors): 'DEBUG.PRINT "POST1 DOWN"
- Else
- post49.isdropped = 0: playsound SoundFX("fx_woodhit",DOFContactors)
- End If
- End Sub
- 'Sub lokiTimer_Timer ()
- ' post49.isdropped = 0: playsound "fx_woodhit": DEBUG.PRINT "POST1 UP"
- ' lokiTimer.Enabled=0
- 'End Sub
- Sub solRampControlGate(Enabled)
- If Enabled Then
- RampControlGate.IsDropped = 0: PlaySound SoundFX("fx_diverter",DOFContactors)
- Else
- RampControlGate.IsDropped = 1: PlaySound SoundFX("fx_diverter",DOFContactors)
- End If
- End Sub
- Sub OrbitControlGate(enabled)
- If Enabled Then
- gate1.open=True
- Else
- gate1.open=False
- End If
- End Sub
- Sub solAutofire(Enabled)
- If Enabled Then
- PlungerIM.AutoFire
- End If
- End Sub
- 'Sub HulkEjectTrigger_Hit
- ' If ActiveBall.VelY < -15 OR ActiveBall.VelX > 15 OR ActiveBall.VelX < -15 Then
- ' HulkEject.Enabled = False
- '' HulkEjectDisableTimer.Interval = 300
- '' HulkEjectDisableTimer.Enabled = 1
- ' End If
- 'End Sub
- Sub HulkEject_Hit
- ' PlaySound "kicker_enter_left"
- bsHole.addball me
- ' HulkEject.Enabled = False
- End Sub
- 'Sub HulkEjectDisableTimer_Timer
- ' HulkEject.Enabled = True
- ' HulkEjectDisableTimer.Enabled = 0
- 'End Sub
- '
- '
- 'Sub HulkEjectDisable 'Hulk Eject too easy, so this will disable eject sometime''
- ' 'HulkEjectTrigger.Enabled = False
- ' 'HulkEjectDisableTimer.Interval = 300
- ' 'HulkEjectDisableTimer.Enabled = 1
- ' 'debug.print timer & "hulkejecttrigger disabled for 300ms"
- 'End Sub
- 'Sub HulkEjectTrigger_Hit
- 'debug.print timer & "hulkejecttrigger_hit"
- ' HulkEject.Enabled = True
- 'End Sub
- 'Sub HulkEject_Hit
- ' PlaySound "kicker_enter_left"
- ' 'debug.print timer & "hulkeject_hit"
- ' bsHole.addball 0
- ' HulkEject.Enabled = False
- 'End Sub
- 'Sub HulkEjectDisable 'Hulk Eject too easy, so this will disable eject sometime''
- ' HulkEjectTrigger.Enabled = False
- ' HulkEjectDisableTimer.Interval = 300
- ' HulkEjectDisableTimer.Enabled = 1
- ' 'debug.print timer & "hulkejecttrigger disabled for 300ms"
- 'End Sub
- 'Sub HulkEjectDisableTimer_Timer
- ' HulkEjectTrigger.Enabled = True
- ' HulkEjectDisableTimer.Enabled = 0
- ' 'debug.print timer & "hulkejecttrigger re-enabled"
- 'End Sub
- 'Sub SolDiverter(enabled)
- ' If enabled Then
- ' 'Playsound "Diverter"
- ' RampDiverter.speed=0.5
- ' RampDiverter.rotatetoend : PlaySound "Diverter"
- '
- ' Else
- ' 'Playsound "Diverter"
- ' RampDiverter.speed=5.0
- ' RampDiverter.rotatetostart : PlaySound "Diverter"
- ' End If
- 'End Sub
- Sub Drain_Hit:Playsound "fx_drain":bsTrough.AddBall Me:End Sub
- 'Sub sw1_Hit:Controller.Switch(1) = 1:PlaySound "fx_target_loud":End Sub 'THOR targets
- 'Sub sw1_UnHit:Controller.Switch(1) = 0:End Sub
- 'Sub sw2_Hit:Controller.Switch(2) = 1:PlaySound "fx_target_loud":End Sub 'THOR targets
- 'Sub sw2_UnHit:Controller.Switch(2) = 0:End Sub
- 'Sub sw3_Hit:Controller.Switch(3) = 1:PlaySound "fx_target_loud":End Sub 'THOR targets
- 'Sub sw3_UnHit:Controller.Switch(3) = 0:End Sub
- 'Sub sw4_Hit:Controller.Switch(4) = 1:PlaySound "fx_target_loud":End Sub 'THOR targets
- 'Sub sw4_UnHit:Controller.Switch(4) = 0:End Sub
- 'Sub sw7_Hit:Controller.Switch(7) = 1:PlaySound "fx_target_loud":End sub 'tesseract single target
- 'Sub sw7_UnHit:Controller.Switch(7) = 0:End Sub
- Sub sw10_Hit:Controller.Switch(10) = 1:PlaySound "fx_sensor":End Sub 'top lanes
- Sub sw10_UnHit:Controller.Switch(10) = 0:End Sub
- Sub sw11_Hit:Controller.Switch(11) = 1:PlaySound "fx_sensor":End Sub
- Sub sw11_UnHit:Controller.Switch(11) = 0:End Sub
- Sub sw12_Hit:Controller.Switch(12) = 1:PlaySound "fx_sensor":End Sub
- Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
- 'Sub sw13_Hit:Controller.Switch(13) = 1:PlaySound "fx_target_loud":End Sub 'tesseract targets
- 'Sub sw13_UnHit:Controller.Switch(13) = 0:End Sub
- 'Sub sw14_Hit:Controller.Switch(14) = 1:PlaySound "fx_target_loud":End Sub
- 'Sub sw14_UnHit:Controller.Switch(14) = 0:End Sub
- Sub sw23_Hit:Controller.Switch(23) = 1:clockwise=0:End sub 'shooter lane
- Sub sw23_UnHit:Controller.Switch(23) = 0:End Sub
- Sub sw24_Hit:Controller.Switch(24) = 1:PlaySound "fx_sensor":End Sub 'lanes
- Sub sw24_UnHit:Controller.Switch(24) = 0:End Sub
- Sub sw25_Hit:Controller.Switch(25) = 1:PlaySound "fx_sensor":End Sub 'lanes
- Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
- Sub sw28_Hit:Controller.Switch(28) = 1:PlaySound "fx_sensor":End Sub 'lanes
- Sub sw28_UnHit:Controller.Switch(28) = 0:End Sub
- Sub sw29_Hit:Controller.Switch(29) = 1:PlaySound "fx_sensor":End Sub 'lanes
- Sub sw29_UnHit:Controller.Switch(29) = 0:End Sub
- Sub sw33_Hit:Controller.Switch(33) = 1:End Sub 'Capt America inner loop
- Sub sw33_UnHit:Controller.Switch(33) = 0:End Sub
- 'Sub sw34_Hit:Controller.Switch(34) = 1:PlaySound "fx_target_loud":End Sub 'Shield Target
- 'Sub sw34_UnHit:Controller.Switch(34) = 0:End Sub
- 'Sub sw35_Hit:Controller.Switch(35) = 1:PlaySound "fx_target_loud":End Sub 'Right 2 bank
- 'Sub sw35_UnHit:Controller.Switch(35) = 0:End Sub
- 'Sub sw36_Hit:Controller.Switch(36) = 1:PlaySound "fx_target_loud":End Sub 'Right 2 bank
- 'Sub sw36_UnHit:Controller.Switch(36) = 0:End Sub
- Sub sw43_Hit:Controller.Switch(43) = 1:End Sub 'Black widow ramp
- Sub sw43_UnHit:Controller.Switch(43) = 0:End Sub
- Sub sw44_Spin():vpmtimer.pulsesw 44:End Sub 'Spinner
- Const TesseractSw1 = 45
- Const TesseractSw2 = 46
- Sub sw47_Hit:Controller.Switch(47) = 1:PlaySound "fx_sensor":End Sub 'Hawkeye outer loop
- Sub sw47_UnHit:Controller.Switch(47) = 0:End Sub
- Dim clockwise
- Sub sw48_Hit
- if clockwise = 1 then ' only register from left loop
- Controller.Switch(48) = 1
- clockwise = 0
- end if
- End Sub
- Sub sw48_UnHit:Controller.Switch(48) = 0:End Sub
- Sub Sw48a_Hit: clockwise = 1: end sub
- Sub sw51_hit():Controller.Switch(51) = false::end sub 'Loki Locks
- Sub sw51_unhit():Controller.Switch(51) = true:end sub
- Sub sw50_hit():Controller.Switch(50) = false:post51.isdropped = false:debug.print "POST3 UP":end sub
- Sub sw50_unhit():Controller.Switch(50) = true:post51.isdropped = true:debug.print "POST3 DOWN": end sub
- Sub sw49_hit():Controller.Switch(49) = false:post50.isdropped = false:debug.print "POST2 UP":end sub
- Sub sw49_unhit():Controller.Switch(49) = true:post50.isdropped = true:debug.print "POST2 DOWN":end sub
- Sub sw52_Hit: dtBank.Hit 1:End Sub'sw52back.IsDropped=1:HulkEjectDisable:End Sub
- Sub sw53_Hit: dtBank.Hit 2:End Sub 'sw53back.IsDropped=1:HulkEjectDisable:End Sub
- Sub sw54_Hit: dtBank.Hit 3:End Sub 'sw54back.IsDropped=1:HulkEjectDisable:End Sub
- Sub sw55_Hit: dtBank.Hit 4:End Sub 'sw55back.IsDropped=1
- Sub sw57_Hit:Controller.Switch(57) = 1:PlaySound "fx_sensor":End Sub
- Sub sw57_UnHit:Controller.Switch(57) = 0:End Sub
- Sub sw61_Hit:Controller.Switch(61) = 1:PlaySound "fx_sensor":End Sub 'Iron Man outer loop
- Sub sw61_UnHit:Controller.Switch(61) = 0:End Sub
- 'Sub sw63_Hit:Controller.Switch(63) = 1:PlaySound "fx_target_loud":End Sub 'Right 2 bank
- 'Sub sw63_UnHit:Controller.Switch(63) = 0:End Sub
- Sub swTopRight_Hit:PlaySound "fx_gate":End Sub
- 'Sub Realtime_Timer
- ' ' update realtime variables
- ' RollingSound
- 'End Sub
- 'Animated targets/switches
- 'Dim Sw1cnt,Sw2cnt,Sw3cnt,Sw4cnt,Sw7cnt,Sw13cnt,Sw14cnt,Sw34cnt,Sw35cnt,Sw36cnt,Sw63cnt
- 'Sub Targets_Init
- ' Sw1a.IsDropped = 1
- ' Sw2a.IsDropped = 1
- ' Sw3a.IsDropped = 1
- ' Sw4a.IsDropped = 1
- ' Sw7a.IsDropped = 1
- ' Sw13a.IsDropped = 1
- ' Sw14a.IsDropped = 1
- ' Sw34a.IsDropped = 1
- ' Sw35a.IsDropped = 1
- ' Sw36a.IsDropped = 1
- ' Sw63a.IsDropped = 1
- 'End Sub
- Sub Sw1_Hit:
- ' If Not Sw1.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw1cnt = 0
- ' Sw1.IsDropped = 1
- ' Sw1a.IsDropped = 0
- vpmTimer.PulseSw 1
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw1_Timer
- ' Sw1cnt=Sw1cnt+1
- ' Select Case Sw1cnt
- ' Case 1:Sw1.IsDropped=0:Sw1a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw2_Hit:
- ' If Not Sw2.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw2cnt = 0
- ' Sw2.IsDropped = 1
- ' Sw2a.IsDropped = 0
- vpmTimer.PulseSw 2
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw2_Timer
- ' Sw2cnt=Sw2cnt+1
- ' Select Case Sw2cnt
- ' Case 1:Sw2.IsDropped=0:Sw2a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw3_Hit:
- ' If Not Sw3.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw3cnt = 0
- ' Sw3.IsDropped = 1
- ' Sw3a.IsDropped = 0
- vpmTimer.PulseSw 3
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw3_Timer
- ' Sw3cnt=Sw3cnt+1
- ' Select Case Sw3cnt
- ' Case 1:Sw3.IsDropped=0:Sw3a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw4_Hit:
- ' If Not Sw4.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw4cnt = 0
- ' Sw4.IsDropped = 1
- ' Sw4a.IsDropped = 0
- vpmTimer.PulseSw 4
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw4_Timer
- ' Sw4cnt=Sw4cnt+1
- ' Select Case Sw4cnt
- ' Case 1:Sw4.IsDropped=0:Sw4a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw7_Hit:
- ' If Not Sw7.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw7cnt = 0
- ' Sw7.IsDropped = 1
- ' Sw7a.IsDropped = 0
- vpmTimer.PulseSw 7
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw7_Timer
- ' Sw7cnt=Sw7cnt+1
- ' Select Case Sw7cnt
- ' Case 1:Sw7.IsDropped=0:Sw7a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw13_Hit:
- ' If Not Sw13.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw13cnt = 0
- ' Sw13.IsDropped = 1
- ' Sw13a.IsDropped = 0
- vpmTimer.PulseSw 13
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw13_Timer
- ' Sw13cnt=Sw13cnt+1
- ' Select Case Sw13cnt
- ' Case 1:Sw13.IsDropped=0:Sw13a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw14_Hit:
- ' If Not Sw14.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw14cnt = 0
- ' Sw14.IsDropped = 1
- ' Sw14a.IsDropped = 0
- vpmTimer.PulseSw 14
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw14_Timer
- ' Sw14cnt=Sw14cnt+1
- ' Select Case Sw14cnt
- ' Case 1:Sw14.IsDropped=0:Sw14a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw34_Hit:
- ' If Not Sw34.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw34cnt = 0
- ' Sw34.IsDropped = 1
- ' Sw34a.IsDropped = 0
- vpmTimer.PulseSw 34
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw34_Timer
- ' Sw34cnt=Sw34cnt+1
- ' Select Case Sw34cnt
- ' Case 1:Sw34.IsDropped=0:Sw34a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw35_Hit:
- ' If Not Sw35.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw35cnt = 0
- ' Sw35.IsDropped = 1
- ' Sw35a.IsDropped = 0
- vpmTimer.PulseSw 35
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw35_Timer
- ' Sw35cnt=Sw35cnt+1
- ' Select Case Sw35cnt
- ' Case 1:Sw35.IsDropped=0:Sw35a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw36_Hit:
- ' If Not Sw36.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw36cnt = 0
- ' Sw36.IsDropped = 1
- ' Sw36a.IsDropped = 0
- vpmTimer.PulseSw 36
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- ' End If
- End Sub
- 'Sub Sw36_Timer
- ' Sw36cnt=Sw36cnt+1
- ' Select Case Sw36cnt
- ' Case 1:Sw36.IsDropped=0:Sw36a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- Sub Sw63_Hit:
- ' If Not Sw63.TimerEnabled Then
- ' Me.TimerEnabled = 1
- ' Me.TimerInterval = 200
- ' Sw63cnt = 0
- ' Sw63.IsDropped = 1
- ' Sw63a.IsDropped = 0
- PlaySound SoundFX("fx_target_loud",DOFTargets)
- vpmTimer.PulseSw 63
- ' End If
- End Sub
- 'Sub Sw63_Timer
- ' Sw63cnt=Sw63cnt+1
- ' Select Case Sw63cnt
- ' Case 1:Sw63.IsDropped=0:Sw63a.IsDropped=1:Me.TimerEnabled = 0
- ' End Select
- 'End Sub
- '******************************************
- 'Added by JF
- '******************************************
- 'Dim StartLeftFlipperStrength, StartRightFlipperStrength
- 'Dim StartLeftFlipperSpeed, StartRightFlipperSpeed
- 'Dim StartLeftFlipperReturn, StartRightFlipperReturn
- '
- 'StartLeftFlipperStrength=LeftFlipper.Strength
- 'StartRightFlipperStrength=RightFlipper.Strength
- 'StartLeftFlipperSpeed=LeftFlipper.Speed
- 'StartRightFlipperSpeed=RightFlipper.Speed
- 'StartLeftFlipperReturn=LeftFlipper.Return
- 'StartRightFlipperReturn=RightFlipper.Return
- '******************************************
- ' Use FlipperTimers to call div subs
- '******************************************
- 'Dim LFTCount:LFTCount=1
- '
- 'Sub LeftFlipperTimer_Timer()
- ' If LFTCount < 6 Then
- ' LFTCount = LFTCount + 1
- '' LeftFlipper.Strength = StartLeftFlipperStrength*(LFTCount/6)
- ' Else
- ' Me.Enabled=0
- ' End If
- 'End Sub
- '
- 'Dim RFTCount:RFTCount=1
- '
- 'Sub RightFlipperTimer_Timer()
- ' If RFTCount < 6 Then
- ' RFTCount = RFTCount + 1
- '' RightFlipper.Strength = StartRightFlipperStrength*(RFTCount/6)
- ' Else
- ' Me.Enabled=0
- ' End If
- 'End Sub
- Sub SolLFlipper(Enabled)
- If Enabled Then
- ' LeftFlipperTimer.Enabled=0
- PlaySound SoundFX("flipperup",DOFFlippers)
- LeftFlipper.RotateToEnd
- 'Llogo.IsDropped = 1:Llogo2.IsDropped = 0
- Else
- ' LFTCount=1
- PlaySound SoundFX("flipperdown",DOFFlippers)
- ' LeftFlipper.Speed=.05 'Temporarily drop speed for slower back draw to help visuals on quick tap
- ' LeftFlipper.Return=.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
- LeftFlipper.RotateToStart
- ' LeftFlipper.Strength = StartLeftFlipperStrength*(LFTCount/6)
- ' LeftFlipperTimer.Enabled=1
- ' LeftFlipper.Speed=StartLeftFlipperSpeed
- ' LeftFlipper.Return=StartLeftFlipperReturn
- ' Llogo.IsDropped = 0:Llogo2.IsDropped = 1
- End If
- ' Llogo.IsDropped = Enabled
- ' Llogo2.IsDropped = Not Enabled
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- ' RightFlipperTimer.Enabled=0
- PlaySound SoundFX("flipperup",DOFFlippers)
- RightFlipper.RotateToEnd':RightFlipper1.RotateToEnd
- 'Rlogo.IsDropped = 1:Rlogo2.IsDropped = 0
- Else
- ' RFTCount=1
- PlaySound SoundFX("flipperdown",DOFFlippers)
- ' RightFlipper.Speed=.05 'Temporarily drop speed for slower back draw to help visuals on quick tap
- ' RightFlipper.Return=.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
- RightFlipper.RotateToStart':RightFlipper1.RotateToStart
- ' RightFlipper.Strength = StartRightFlipperStrength*(RFTCount/6)
- ' RightFlipperTimer.Enabled=1
- ' RightFlipper.Speed=StartRightFlipperSpeed
- ' RightFlipper.Return=StartRightFlipperReturn
- 'Rlogo.IsDropped = 0:Rlogo2.IsDropped = 1
- End If
- 'Rlogo.IsDropped = Enabled
- 'Rlogo2.IsDropped = Not Enabled
- End Sub
- Sub BallRelease_UnHit():End Sub
- '***Slings and rubbers
- ' Slings
- Dim LStep, RStep
- Sub LeftSlingShot_Slingshot
- vpmTimer.PulseSw 26
- PlaySound SoundFX("slingshot",DOFContactors)
- End Sub
- Sub RightSlingShot_Slingshot
- vpmTimer.PulseSw 27
- PlaySound SoundFX("slingshot",DOFContactors)
- End Sub
- 'Bumpers
- Sub Bumper1b_Hit:vpmTimer.PulseSw 31:PlaySound SoundFX("bumper",DOFContactors):bump1 = 1:End Sub
- Sub Bumper2b_Hit:vpmTimer.PulseSw 30:PlaySound SoundFX("bumper",DOFContactors):bump2 = 1:End Sub
- Sub Bumper3b_Hit:vpmTimer.PulseSw 32:PlaySound SoundFX("bumper",DOFContactors):bump3 = 1:End Sub
- 'Sounds
- dim speedx
- dim speedy
- dim finalspeed
- 'Sub Rubbers_Hit(IDX)
- ' finalspeed=SQR(ActiveBall.velx * ActiveBall.velx + ActiveBall.vely * ActiveBall.vely)
- ' if finalspeed > 11 then PlaySound "fx_rubber" else PlaySound "fx_rubber_Flipper":end if
- 'End Sub
- 'Rubber Sounds
- Sub Rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 14 then
- PlaySound "bump"
- End if
- If finalspeed >= 4 AND finalspeed <= 14 then
- RandomSoundRubber()
- End If
- If finalspeed < 4 AND finalspeed > 1 then
- RandomSoundRubberLowVolume()
- End If
- Dampen 12, .80, 3
- End sub
- Sub RandomSoundRubber()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1"
- Case 2 : PlaySound "rubber_hit_2"
- Case 3 : PlaySound "rubber_hit_3"
- End Select
- End Sub
- Sub RandomSoundRubberLowVolume()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1_low"
- Case 2 : PlaySound "rubber_hit_2_low"
- Case 3 : PlaySound "rubber_hit_3_low"
- End Select
- End Sub
- Sub Gates_Hit(IDX):PlaySound"fx_gate":End Sub
- 'Sub LeftFlipper_Collide(parm)
- ' PlaySound "fx_rubber_Flipper"
- 'End Sub
- '
- 'Sub RightFlipper_Collide(parm)
- ' PlaySound "fx_rubber_Flipper"
- 'End Sub
- 'Flipper Collide Sounds
- Sub LeftFlipper_Collide(parm)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 4 then
- RandomSoundFlipper()
- Else
- RandomSoundFlipperLowVolume()
- End If
- End Sub
- Sub RightFlipper_Collide(parm)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 4 then
- RandomSoundFlipper()
- Else
- RandomSoundFlipperLowVolume()
- End If
- End Sub
- Sub RandomSoundFlipper()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1"
- Case 2 : PlaySound "flip_hit_2"
- Case 3 : PlaySound "flip_hit_3"
- End Select
- End Sub
- Sub RandomSoundFlipperLowVolume()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1_low"
- Case 2 : PlaySound "flip_hit_2_low"
- Case 3 : PlaySound "flip_hit_3_low"
- End Select
- End Sub
- Sub DropLeft_Hit
- PlaySound "drop_left"
- End Sub
- Sub DropLeft2_Hit
- PlaySound "drop_left"
- End Sub
- Sub DropRight_Hit
- PlaySound "drop_right"
- End Sub
- Sub Post49_Hit
- PlaySound "fx_plastichit"
- End Sub
- Sub Post50_Hit
- PlaySound "fx_ballpool"
- End Sub
- Sub Post51_Hit
- PlaySound "fx_ballpool"
- End Sub
- Sub MetalRamp_Hit
- PlaySound "rail"
- End Sub
- Sub MetalRamp_UnHit
- StopSound "rail"
- End Sub
- 'Dim PlayMetalSound
- 'Dim PlayMetalSound2
- 'Sub MetalIn_Hit
- ' PlayMetalSound = 1
- ' PlayMetalSound2 = 0
- 'End Sub
- '
- 'Sub MetalOut_Hit
- ' if PlayMetalSound = 1 then
- ' PlaySound "rail"
- ' End If
- ' PlayMetalSound = 0
- ' PlayMetalSound2 = 0
- 'End Sub
- '
- 'Sub MetalOut2_Hit
- ' if PlayMetalSound2 = 1 then
- ' PlaySound "rail"
- ' End If
- ' PlayMetalSound = 0
- ' PlayMetalSound2 = 0
- 'End Sub
- '*************************
- ' Plunger kicker animation
- '*************************
- '****************************************
- ' SetLamp 0 is Off
- ' SetLamp 1 is On
- ' LampState(x) current state
- '****************************************
- 'GI - add any new GI lights to the collection "GI" to control them together.
- Dim ig
- Sub UpdateGI(no, Enabled)
- Select Case no
- Case 0 'Top
- If Enabled Then
- DOF 102, DOFOn
- For each ig in GI:ig.State = 1:Next
- For each ig in GIbulbs:ig.State = 1:Next
- Else
- DOF 102, DOFOff
- For each ig in GI:ig.State = 0:Next
- For each ig in GIbulbs:ig.State = 0:Next
- End If
- End Select
- End Sub
- Dim GILevel, DayNight, xx
- Sub Intensity
- If DayNight <= 20 Then
- GILevel = .5
- ElseIf DayNight <= 40 Then
- GILevel = .4125
- ElseIf DayNight <= 60 Then
- GILevel = .325
- ElseIf DayNight <= 80 Then
- GILevel = .2375
- Elseif DayNight <= 100 Then
- GILevel = .15
- End If
- For each xx in GI: xx.IntensityScale = xx.IntensityScale * (GILevel*2): Next
- For each xx in GIbulbs: xx.IntensityScale = xx.IntensityScale * (GILevel*2): Next
- End Sub
- ' end GI subs
- '
- '
- ' Dim LampState(200)
- ' Dim x,RefreshARlight
- ' AllLampsOff()
- ' LampTimer.Interval = 40
- ' LampTimer.Enabled = 1
- '
- ' 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) + 4
- ' Next
- ' End If
- '
- ' UpdateLamps
- ' End Sub
- '
- '
- '
- ' Sub UpdateLamps
- ' FadeL 3, l3, l3a
- ' FadeL2 4, l4
- ' FadeL2 5, l5
- ' FadeL2 6, l6
- ' FadeL2 7, l7
- ' FadeL2 8, l8
- ' FadeL2 9, l9
- ' FadeL2 10, l10
- ' FadeL2 11, l11
- ' FadeL2 12, l12
- ' FadeL2 13, l13
- ' FadeL2 14, l14
- ' FadeL2 15, l15
- ' FadeL2 16, l16
- ' FadeL2 17, l17
- ' FadeL 18, l18, l18a
- ' FadeL 19, l19, l19a
- ' FadeLm 20, l20, l20a
- ' FadeL 20, l20x, l20xa
- ' FadeL 21, l21, l21a
- ' FadeL 22, l22, l22a
- ' FadeL2 23, l23
- ' FadeL 24, l24, l24a
- ' FadeL 25, l25, l25a
- ' FadeL 26, l26, l26a
- ' FadeL 27, l27, l27a
- ' FadeL 28, l28, l28a
- ' FadeL 29, l29, l29a
- ' FadeL 30, l30, l30a
- ' FadeL 31, l31, l31a
- ' FadeL 32, l32, l32a
- ' FadeL 33, l33, l33a
- ' FadeL 34, l34, l34a
- ' FadeL 35, l35, l35a
- ' FadeL 36, l36, l36a
- ' FadeL 37, l37, l37a
- ' FadeL 38, l38, l38a
- ' FadeL 39, l39, l39a
- '' FadeL 40, l40, l40a
- ' FadeL2 41, l41
- ' FadeL2 42, l42
- ' FadeL2 43, l43
- ' FadeL2 44, l44
- ' FadeL2 45, l45
- ' FadeL2 46, l46
- ' FadeL2 47, l47
- '' Reflection 48,l48_r 'hulk target reflection
- ' FadeL2 48, l48
- '' Reflection 49,l49_r 'hulk target reflection
- ' FadeL2 49, l49
- '' Reflection 50,l50_r 'hulk target reflection
- ' FadeL2 50, l50
- ' FadeL2 51, l51
- ' FadeL2 52, l52
- ' FadeL 53, l53, l53a
- ' FadeL 54, l54, l54a
- ' FadeL 55, l55, l55a
- '' FadeL 56, l56, l56a
- ' FadeL 57, l57, l57a
- ' FadeL 58, l58, l58a
- '' FadeL 59, l59, l59a
- '' FlashAR 59, f59b, "wf_on", "wf_a", "wf_b", ARRefresh
- '' FadeL 60, l60, l60 'bumpers
- '' FadeL 61, l61, l61
- '' FadeL 62, l62, l62
- ' 'Reflection 63,l63_r
- ' FadeL 63, l63, l63a
- ' 'debug.print "63:" &lampstate(63)
- ' FadeL 65, l65, l65a
- ' FadeL 66, l66, l66a
- ' FadeL 67, l67, l67a
- ' FadeL 68, l68, l68a
- ' FadeL 69, l69, l69a
- ' 'Reflection 70,l70_r
- ' FadeL 70, l70, l70a
- ' FadeL 78, l78, l78a
- '' FadeL 71, l71, l71a
- ''
- ''
- '' FlashARm 117, f117b, "bf_on", "bf_a", "bf_b", ARRefresh
- '' FlashAR 118, f118, "rf_on", "rf_a", "rf_b", ARRefresh
- '' FlashARm 119, f119a, "rf_on", "rf_a", "rf_b", ARRefresh
- '' FlashAR 119, f119, "rf_on", "rf_a", "rf_b", ARRefresh
- '' FlashARm 120, f120b, "rf_on", "rf_a", "rf_b", ARRefresh
- '' FlashAR 120, f120, "rf_on", "rf_a", "rf_b", ARRefresh
- '' FlashAR 121, f121, "gf_on", "gf_a", "gf_b", ARRefresh
- '' FlashAR 125, f125, "wf_on", "wf_a", "wf_b", ARRefresh
- '' FlashAR 126, f126, "bf_on", "bf_a", "bf_b", ARRefresh
- '' FlashAR 127, f127, "bf_on", "bf_a", "bf_b", ARRefresh
- '' FlashAR 128, f128, "lf_on", "lf_a", "lf_b", ARRefresh
- '' FlashAR 129, f129, "gf_on", "gf_a", "gf_b", ARRefresh
- '' FlashAR 130, f130, "rf_on", "rf_a", "rf_b", ARRefresh
- '' FlashAR 131, f131, "wf_on", "wf_a", "wf_b", ARRefresh
- '' FlashAR 132, f132, "yf_on", "yf_a", "yf_b", ARRefresh
- '' FlashAR 71, f171, "gf_on", "gf_a", "gf_b", ARRefresh
- '' FlashAR 73, f173, "gf_on", "gf_a", "gf_b", ARRefresh
- '' FlashAR 75, f175, "gf_on", "gf_a", "gf_b", ARRefresh
- ''
- '' FlashAR 60, f160, "rf_on", "rf_a", "rf_b", ARRefresh 'bumpers
- '' FlashAR 61, f161, "bf_on", "bf_a", "bf_b", ARRefresh
- '' FlashAR 62, f162, "wf_on", "wf_a", "wf_b", ARRefresh
- '
- ' 'GI hulk blinks 136/137, ramp blinks 135/136 guessing =greenGI, 137=blueGI, 136= redGI
- ' 'black widow when it says black widow all gi went off
- ' ' tessaract when it starts glowing, gi stays blue
- ' 'sol38 for thor - blue,
- ' ' when hulk say bridge out, pf goes green, when yelling pf flash off /green. then blue/red flashing during mball play. green flashed 3:48(jackpot) 3:56, 4;07 when hulk animate
- ' 'https://www.youtube.com/watch?v=VyIqeS1QGKk
- '
- ' If GIColor = 1 Then
- ' FadeGixm 140, gir_pf1, "r", 8
- ' FadeGixm 140, gir_pf4, "r", 8
- ' FadeGixm 140, gir_pf5, "r", 8
- ' FadeGixm 140, gir_pf6, "r", 8
- ' FadeGixm 140, gir_pf8, "r", 8
- ' FadeGixm 140, gir_Plastic1, "r", 8
- ' FadeGixm 140, gir_Plastic10, "r", 8
- ' FadeGixm 140, gir_Plastic11, "r", 8
- ' FadeGixm 140, gir_Plastic12, "r", 8
- ' FadeGixm 140, gir_Plastic13, "r", 8
- ' FadeGixm 140, gir_Plastic4, "r", 8
- ' FadeGixm 140, gir_Plastic5, "r", 5
- ' FadeGixm 140, gir_Plastic6, "r", 5
- ' FadeGixm 140, gir_Plastic7, "r", 5
- ' FadeGixm 140, gir_Plastic9, "r", 8
- '
- ' FadeGixm 140, gig_pf1, "g", 3
- ' FadeGixm 140, gig_pf10, "g", 8
- ' FadeGixm 140, gig_pf100, "g", 8
- ' FadeGixm 140, gig_pf101, "g", 8
- ' FadeGixm 140, gig_pf11, "g", 8
- ' FadeGixm 140, gig_pf14, "g", 8
- ' FadeGixm 140, gig_pf15, "g", 5
- ' FadeGixm 140, gig_pf18, "g", 8
- ' FadeGixm 140, gig_pf2, "g", 8
- ' FadeGixm 140, gig_pf4, "g", 3
- ' FadeGixm 140, gig_pf5, "g", 8
- ' FadeGixm 140, gig_pf6, "g", 5
- ' FadeGixm 140, gig_pf7, "g", 8
- ' FadeGixm 140, gig_pf8, "g", 8
- ' FadeGixm 140, gig_pf9, "g", 8
- ' FadeGixm 140, gig_Plastic1, "g", 8
- ' FadeGixm 140, gig_Plastic10, "g", 8
- ' FadeGixm 140, gig_Plastic11, "g", 8
- ' FadeGixm 140, gig_Plastic12, "g", 8
- ' FadeGixm 140, gig_Plastic13, "g", 8
- ' FadeGixm 140, gig_Plastic15, "g", 8
- ' FadeGixm 140, gig_Plastic16, "g", 8
- ' FadeGixm 140, gig_Plastic17, "g", 8
- ' FadeGixm 140, gig_Plastic18, "g", 8
- ' FadeGixm 140, gig_Plastic2, "g", 8
- ' FadeGixm 140, gig_Plastic3, "g", 8
- ' FadeGixm 140, gig_Plastic4, "g", 8
- ' FadeGixm 140, gig_Plastic5, "g", 8
- ' FadeGixm 140, gig_Plastic6, "g", 8
- ' FadeGixm 140, gig_Plastic8, "g", 8
- ' FadeGixm 140, gig_Plastic9, "g", 8
- '
- ' FadeGixm 140, gib_pf1, "b", 8
- ' FadeGixm 140, gib_pf10, "b", 5
- ' FadeGixm 140, gib_pf11, "b", 5
- ' FadeGixm 140, gib_pf2, "b", 8
- ' FadeGixm 140, gib_pf3, "b", 8
- ' FadeGixm 140, gib_pf4, "b", 8
- ' FadeGixm 140, gib_pf5, "b", 8
- ' FadeGixm 140, gib_pf6, "b", 8
- ' FadeGixm 140, gib_pf8, "b", 5
- ' FadeGixm 140, gib_pf9, "b", 5
- ' FadeGixm 140, gib_Plastic1, "b", 8
- ' FadeGixm 140, gib_Plastic2, "b", 8
- ' FadeGixm 140, gib_Plastic3, "b", 8
- ' FadeGixm 140, gib_Plastic4, "b", 8
- ' FadeGixm 140, gib_Plastic5, "b", 8
- ' FadeGixm 140, gib_Plastic6, "b", 8
- ' FadeGixm 140, gib_Plastic7, "b", 8
- ' FadeGixm 140, gib_Plastic8, "b", 8
- ' FadeGixm 140, gib_Plastic9, "b", 8
- ' FadeGixm 140, gib_Plastic10, "b", 8
- ' FadeGixm 140, gib_Plastic11, "b", 8
- ' FadeGixm 140, gib_Plastic12, "b", 8
- ' FadeGix 140, gib_Plastic13, "b", 8
- '
- ' Else
- ' FadeGixm 140, gir_pf1, "", 8
- ' FadeGixm 140, gir_pf4, "", 8
- ' FadeGixm 140, gir_pf5, "", 8
- ' FadeGixm 140, gir_pf6, "", 8
- ' FadeGixm 140, gir_pf8, "", 8
- ' FadeGixm 140, gir_Plastic1, "", 8
- ' FadeGixm 140, gir_Plastic10, "", 8
- ' FadeGixm 140, gir_Plastic11, "r", 8
- ' FadeGixm 140, gir_Plastic12, "r", 8
- ' FadeGixm 140, gir_Plastic13, "r", 8
- ' FadeGixm 140, gir_Plastic4, "", 8
- ' FadeGixm 140, gir_Plastic5, "", 5
- ' FadeGixm 140, gir_Plastic6, "", 5
- ' FadeGixm 140, gir_Plastic7, "", 5
- ' FadeGixm 140, gir_Plastic9, "", 8
- '
- ' FadeGixm 140, gig_pf1, "", 3
- ' FadeGixm 140, gig_pf10, "", 8
- ' FadeGixm 140, gig_pf100, "g", 8
- ' FadeGixm 140, gig_pf101, "g", 8
- ' FadeGixm 140, gig_pf11, "g", 8
- ' FadeGixm 140, gig_pf14, "g", 8
- ' FadeGixm 140, gig_pf15, "", 5
- ' FadeGixm 140, gig_pf18, "g", 8
- ' FadeGixm 140, gig_pf2, "", 8
- ' FadeGixm 140, gig_pf4, "", 3
- ' FadeGixm 140, gig_pf5, "", 8
- ' FadeGixm 140, gig_pf6, "", 5
- ' FadeGixm 140, gig_pf7, "", 8
- ' FadeGixm 140, gig_pf8, "", 8
- ' FadeGixm 140, gig_pf9, "", 8
- ' FadeGixm 140, gig_Plastic1, "", 8
- ' FadeGixm 140, gig_Plastic10, "", 8
- ' FadeGixm 140, gig_Plastic11, "g", 8
- ' FadeGixm 140, gig_Plastic12, "", 8
- ' FadeGixm 140, gig_Plastic13, "", 8
- ' FadeGixm 140, gig_Plastic15, "", 8
- ' FadeGixm 140, gig_Plastic16, "", 8
- ' FadeGixm 140, gig_Plastic17, "", 8
- ' FadeGixm 140, gig_Plastic18, "g", 8
- ' FadeGixm 140, gig_Plastic2, "", 8
- ' FadeGixm 140, gig_Plastic3, "", 8
- ' FadeGixm 140, gig_Plastic4, "", 8
- ' FadeGixm 140, gig_Plastic5, "", 8
- ' FadeGixm 140, gig_Plastic6, "", 8
- ' FadeGixm 140, gig_Plastic8, "", 8
- ' FadeGixm 140, gig_Plastic9, "", 8
- '
- ' FadeGixm 140, gib_pf1, "", 8
- ' FadeGixm 140, gib_pf10, "", 5
- ' FadeGixm 140, gib_pf11, "", 5
- ' FadeGixm 140, gib_pf2, "", 8
- ' FadeGixm 140, gib_pf3, "", 8
- ' FadeGixm 140, gib_pf4, "", 8
- ' FadeGixm 140, gib_pf5, "", 8
- ' FadeGixm 140, gib_pf6, "", 8
- ' FadeGixm 140, gib_pf8, "", 5
- ' FadeGixm 140, gib_pf9, "", 5
- ' FadeGixm 140, gib_Plastic1, "", 8
- ' FadeGixm 140, gib_Plastic2, "", 8
- ' FadeGixm 140, gib_Plastic3, "", 8
- ' FadeGixm 140, gib_Plastic4, "", 8
- ' FadeGixm 140, gib_Plastic5, "", 8
- ' FadeGixm 140, gib_Plastic6, "", 8
- ' FadeGixm 140, gib_Plastic7, "", 8
- ' FadeGixm 140, gib_Plastic8, "", 8
- ' FadeGixm 140, gib_Plastic9, "", 8
- ' FadeGixm 140, gib_Plastic10, "", 8
- ' FadeGixm 140, gib_Plastic11, "", 8
- ' FadeGixm 140, gib_Plastic12, "", 8
- ' FadeGix 140, gib_Plastic13, "", 8
- ' End If
- '' FlashARm 118, f118b, "of_on", "of_a", "of_b", ARRefresh
- '' FlashAR 118, f118, "of_on", "of_a", "of_b", ARRefresh
- '' FlashAR 121, f121, "yf_on", "yf_a", "yf_b", ARRefresh
- '' FlashAR 122, f122, "rf_on", "rf_a", "rf_b", ARRefresh
- '' FlashAR 125, f125, "wf_on", "wf_a", "wf_b", ARRefresh
- '' FlashAR 127, f127, "rf_on", "rf_a", "rf_b", ARRefresh
- '' FlashARm 128, f128, "yf_on", "yf_a", "yf_b", ARRefresh
- '' FlashARm 128, f128a, "wf_on", "wf_a", "wf_b", ARRefresh
- '' FlashAR 128, f128b, "yf_on", "yf_a", "yf_b", ARRefresh
- '' FlashARm 129, f129, "wf_on", "wf_a", "wf_b", ARRefresh
- '' FlashAR 129, f129a, "yf_on", "yf_a", "yf_b", ARRefresh
- '' FlashAR 131, f131, "rf_on", "rf_a", "rf_b", ARRefresh
- ''
- '
- ''example
- '' FadeGim 100, gi_Plastic12, "", true
- '' FadeGim 100, gi_Plastic13, "", true
- '' FadeGi 100, gi_Plastic14, "", true
- '
- ' End Sub
- '
- 'Sub FadeGix (nr, ramp, color, max)
- 'dim col
- ' col = "gi" & color
- ' Select Case max
- '' Case 8: FlashAr nr, ramp, col & 8, col & 5, col & 2, ARRefresh
- '' Case 6: FlashAr nr, ramp, col & 6, col & 3, col & 2, ARRefresh
- '' Case 5: FlashAr nr, ramp, col & 5, col & 3, col & 2, ARRefresh
- '' Case 3: FlashAr nr, ramp, col & 3, col & 2, col & 2, ARRefresh
- '' Case 2: FlashAr nr, ramp, col & 2, col & 2, col & 2, ARRefresh
- ' End Select
- 'end sub
- '
- 'Sub FadeGixm (nr, ramp, color, max)
- 'dim col
- ' col = "gi" & color
- ' Select Case max
- '' Case 8: FlashArm nr, ramp, col & 8, col & 5, col & 2, ARRefresh
- '' Case 6: FlashArm nr, ramp, col & 6, col & 3, col & 2, ARRefresh
- '' Case 5: FlashArm nr, ramp, col & 5, col & 3, col & 2, ARRefresh
- '' Case 3: FlashArm nr, ramp, col & 3, col & 2, col & 2, ARRefresh
- '' Case 2: FlashArm nr, ramp, col & 2, col & 2, col & 2, ARRefresh
- ' End Select
- 'end sub
- '
- ''Sub Reflection(nr, ramp) 'used for reflections when there is no off ramp
- '' Select Case LampState(nr)
- ''' Case 2:ramp.alpha = 0':ramp.TriggerSingleUpdate:LampState(nr) = 0 'Off
- ''' Case 3:ramp.alpha = 0'.3:ramp.TriggerSingleUpdate:LampState(nr) = 2 'fading...
- ''' Case 4:ramp.alpha = 0'.6:ramp.TriggerSingleUpdate:LampState(nr) = 3 'fading...
- ''' Case 6:ramp.alpha = 1':ramp.TriggerSingleUpdate:LampState(nr) = 1 'ON
- '' End Select
- ''End Sub
- ''
- ''Sub FlashARm(nr, ramp, imga, imgb, imgc, r) 'used for reflections when the off is transparent - no ramp
- '' Select Case LampState(nr)
- '' Case 2:ramp.alpha = 0
- '' r.State = ABS(r.state -1)
- '' Case 3:ramp.image = imgc
- '' r.State = ABS(r.state -1)
- '' Case 4:ramp.image = imgb
- '' r.State = ABS(r.state -1)
- '' Case 5:ramp.alpha = 1
- '' ramp.image = imgb
- '' r.State = ABS(r.state -1)
- '' Case 6:ramp.image = imga
- '' r.State = ABS(r.state -1)
- '' End Select
- ''End Sub
- ''
- ''
- ''Sub FlashAR(nr, ramp, imga, imgb, imgc, r) 'used for reflections when the off is transparent - no ramp
- '' Select Case LampState(nr)
- '' Case 2:ramp.alpha = 0
- '' r.State = ABS(r.state -1)
- '' LampState(nr) = 0 'Off
- '' Case 3:ramp.image = imgc
- '' r.State = ABS(r.state -1)
- '' LampState(nr) = 2 'fading...
- '' Case 4:ramp.image = imgb
- '' r.State = ABS(r.state -1)
- '' LampState(nr) = 3 'fading...
- '' Case 5:ramp.alpha = 1
- '' ramp.image = imgb
- '' r.State = ABS(r.state -1)
- '' LampState(nr) = 6 ' 1/2 ON
- '' Case 6:ramp.image = imga
- '' r.State = ABS(r.state -1)
- '' LampState(nr) = 1 'ON
- '' End Select
- ''End Sub
- '
- ' Sub AllLampsOff():For x = 1 to 200:LampState(x) = 4:Next:UpdateLamps:UpdateLamps:Updatelamps:End Sub
- '
- ' Sub SetLamp(nr, value):LampState(nr) = abs(value) + 4:End Sub
- ' Sub ClearLamp(nr, value)
- ' if value = 0 then
- ' LampState(nr) = abs(1) + 4 ' Opposite of Setlamp
- ' else
- ' LampState(nr) = abs(0) + 4 ' Opposite of Setlamp
- ' End if
- 'End sub
- '
- ' Sub FadeWm(nr, a, b, c)
- ' Select Case LampState(nr)
- ' Case 2:c.IsDropped = 1
- ' Case 3:b.IsDropped = 1:c.IsDropped = 0
- ' Case 4:a.IsDropped = 1:b.IsDropped = 0
- ' Case 5:b.IsDropped = 1:c.IsDropped = 0
- ' Case 6:c.IsDropped = 1:a.IsDropped = 0
- ' End Select
- ' End Sub
- '
- ' Sub FadeW(nr, a, b, c)
- ' Select Case LampState(nr)
- ' Case 2:c.IsDropped = 1:LampState(nr) = 0 'Off
- ' Case 3:b.IsDropped = 1:c.IsDropped = 0:LampState(nr) = 2 'fading...
- ' Case 4:a.IsDropped = 1:b.IsDropped = 0:LampState(nr) = 3 'fading...
- ' Case 5:b.IsDropped = 1:c.IsDropped = 0:LampState(nr) = 6 'turning ON
- ' Case 6:c.IsDropped = 1:a.IsDropped = 0:LampState(nr) = 1 'ON
- ' End Select
- ' End Sub
- '
- ' Sub FadeLm(nr, a, b)
- ' Select Case LampState(nr)
- ' Case 2:b.state = 0
- ' Case 3:b.state = 1
- ' Case 4:a.state = 0
- ' Case 5:a.state = 1
- ' 'Case 5:b.state = 1
- ' 'Case 6:a.state = 1
- ' End Select
- ' End Sub
- '
- ' Sub FadeL(nr, a, b)
- ' Select Case LampState(nr)
- ' Case 2:b.state = 0:LampState(nr) = 0
- ' Case 3:b.state = 1:LampState(nr) = 2
- ' Case 4:a.state = 0:LampState(nr) = 3
- ' Case 5:a.state = 1:LampState(nr) = 1
- '' Case 5:b.state = 1:LampState(nr) = 6
- '' Case 6:a.state = 1:LampState(nr) = 1
- ' End Select
- ' End Sub
- '
- ' Sub FadeL2m(nr, a)
- ' Select Case LampState(nr)
- ' Case 2:a.state = 0:
- ' Case 6:a.state = 1:
- ' End Select
- ' End Sub
- '
- ' Sub FadeL2(nr, a)
- ' Select Case LampState(nr)
- ' Case 2:a.state = 0:LampState(nr) = 0
- ' Case 3:LampState(nr) = 2
- ' Case 4:LampState(nr) = 3
- ' Case 5::LampState(nr) = 6
- ' Case 6:a.state = 1:LampState(nr) = 1
- ' End Select
- ' End Sub
- 'Dim LenghtRamp:LenghtRamp=470
- 'Dim LenghtRampl:LenghtRampl=900
- 'Dim LenghtRamps:LenghtRamps=390
- '
- '
- 'Sub HideRamp (aRamp)
- ' aRamp.WidthBottom = 0
- ' aRamp.WidthTop = 0
- 'End Sub
- '
- 'Sub ShowRamp (aRamp, Width)
- ' aRamp.WidthBottom = Width
- ' aRamp.WidthTop = Width
- 'End Sub
- '
- 'Sub UpdateChangedRamp (aLight)
- ' aLight.State = ABS(aLight.state -1)
- '
- 'End Sub
- '***********************
- 'Alpha Ramp Plunger
- '***********************
- Dim PNewPos, POldPos
- Dim BallinPlunger
- 'InitARPlunger
- 'Dim PlungerWidth
- 'PlungerWidth = 25
- 'Sub InitARPlunger
- ' Dim i
- ' PRefresh.State = ABS(PRefresh.state -1)
- ' PNewPos = 0:POldPos = 0
- ' BallinPlunger = 0
- 'End Sub
- Sub swPlunger_Hit:BallinPlunger = 1:End Sub 'CallGI(1) 'in this sub you may add a switch, for example Controller.Switch(14) = 1
- Sub swPlunger_UnHit:BallinPlunger = 0:End Sub 'in this sub you may add a switch, for example Controller.Switch(14) = 0
- '*************************************
- ' Nudge System
- '*************************************
- '
- 'Dim LeftNudgeEffect, RightNudgeEffect, NudgeEffect
- '
- 'Sub LeftNudge(angle, strength, delay)
- ' vpmNudge.DoNudge angle, (strength * (delay-LeftNudgeEffect) / delay) + RightNudgeEffect / delay
- ' LeftNudgeEffect = delay
- ' RightNudgeEffect = 0
- ' RightNudgeTimer.Enabled = 0
- ' LeftNudgeTimer.Interval = delay
- ' LeftNudgeTimer.Enabled = 1
- 'End Sub
- '
- 'Sub RightNudge(angle, strength, delay)
- ' vpmNudge.DoNudge angle, (strength * (delay-RightNudgeEffect) / delay) + LeftNudgeEffect / delay
- ' RightNudgeEffect = delay
- ' LeftNudgeEffect = 0
- ' LeftNudgeTimer.Enabled = 0
- ' RightNudgeTimer.Interval = delay
- ' RightNudgeTimer.Enabled = 1
- 'End Sub
- '
- 'Sub CenterNudge(angle, strength, delay)
- ' vpmNudge.DoNudge angle, strength * (delay-NudgeEffect) / delay
- ' NudgeEffect = delay
- ' NudgeTimer.Interval = delay
- ' NudgeTimer.Enabled = 1
- 'End Sub
- '
- 'Sub LeftNudgeTimer_Timer()
- ' LeftNudgeEffect = LeftNudgeEffect-1
- ' If LeftNudgeEffect = 0 then LeftNudgeTimer.Enabled = 0
- 'End Sub
- '
- 'Sub RightNudgeTimer_Timer()
- ' RightNudgeEffect = RightNudgeEffect-1
- ' If RightNudgeEffect = 0 then RightNudgeTimer.Enabled = 0
- 'End Sub
- '
- 'Sub NudgeTimer_Timer()
- ' NudgeEffect = NudgeEffect-1
- ' If NudgeEffect = 0 then NudgeTimer.Enabled = 0
- 'End Sub
- 'Sub NewBallID ' Assign new ball object and give it ID for tracking
- 'End Sub
- '
- 'Sub ClearBallID
- 'On Error Resume Next ' Error handling for debugging purposes
- ' On Error Goto 0
- 'End Sub
- ' *********************************************************************
- ' Supporting Ball & Sound Functions
- '**********************************************************************
- Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2 / 2000)
- 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 Rolling Sounds
- '*****************************************
- Const tnob = 5 ' total number of balls
- ReDim rolling(tnob)
- InitRolling
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingTimer_Timer()
- Dim BOT, b
- BOT = GetBalls
- ' stop the sound of deleted balls
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & b)
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' play the rolling sound for each ball
- 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) )*2), 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
- End Sub
- '**********************
- ' Ball Collision Sound
- '**********************
- Sub OnBallBallCollision(ball1, ball2, velocity)
- PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
- End Sub
- ''*****************************************************************************
- ''***************** Ball Rolling Sounds ****************************
- ''*****************************************************************************
- 'Dim VeloY(3), VeloX(3), rolling(3), b
- 'b = 0
- '
- 'Sub RollingSound()
- ' b = b + 1
- ' If b> 3 Then b = 1
- ' If BallStatus(b) = 0 Then
- ' If rolling(b) = True Then
- ' StopSound "fx_ballrolling" &b
- ' rolling(b) = False
- ' Exit Sub
- ' Else
- ' Exit Sub
- ' End If
- ' End if
- '
- ' VeloY(b) = Cint(CurrentBall(b).VelY)
- ' VeloX(b) = Cint(CurrentBall(b).VelX)
- ' If(ABS(VeloY(b) )> 3 or ABS(VeloX(b) )> 3) and CurrentBall(b).Z <55 Then
- ' If rolling(b) = True then
- ' Exit Sub
- ' Else
- ' rolling(b) = True
- ' PlaySound "fx_ballrolling" &b
- ' End If
- ' Else
- ' If rolling(b) = True Then
- ' StopSound "fx_ballrolling" &b
- ' rolling(b) = False
- ' End If
- ' End If
- 'End Sub
- '
- ''*****************************************************************************
- ''***************** B2B ****************************
- ''*****************************************************************************
- '
- 'Set vpmCreateBall = GetRef("mypersonalcreateballroutine")
- 'Function mypersonalcreateballroutine(aKicker)
- ' For cnt = 1 to ubound(ballStatus) ' Loop through all possible ball IDs
- ' If ballStatus(cnt) = 0 Then ' If ball ID is available...
- ' If Not IsEmpty(vpmBallImage) Then
- ' Set currentball(cnt) = aKicker.CreateBall ' Set ball object with the first available ID
- ' Else
- ' Set currentball(cnt) = aKicker.CreateBall
- ' End If
- ' Set mypersonalcreateballroutine = aKicker
- ' currentball(cnt).uservalue = cnt ' Assign the ball's uservalue to it's new ID
- ' ballStatus(cnt) = 1 ' Mark this ball status active
- ' ballStatus(0) = ballStatus(0) + 1 ' Increment ballStatus(0), the number of active balls
- ' If coff = False Then ' If collision off, overrides auto-turn on collision detection
- ' ' If more than one ball active, start collision detection process
- ' If ballStatus(0)> 1 and XYdata.enabled = False Then XYdata.enabled = True
- ' End If
- ' Exit For ' New ball ID assigned, exit loop
- ' End If
- ' Next
- 'End Function
- '
- '
- 'Dim tnopb, nosf
- ''
- 'tnopb = 10
- 'nosf = 10
- '
- 'Dim currentball(10), ballStatus(10)
- 'Dim iball, cnt, coff, errMessage
- '
- 'XYdata.interval = 1
- 'coff = False
- '
- 'For cnt = 0 to ubound(ballStatus)
- ' ballStatus(cnt) = 0
- 'Next
- '
- '' Create ball in kicker and assign a Ball ID used mostly in non-vpm tables
- 'Sub CreateBallID(Kickername)
- ' For cnt = 1 to ubound(ballStatus)
- ' If ballStatus(cnt) = 0 Then
- ' Set currentball(cnt) = Kickername.createball
- ' currentball(cnt).uservalue = cnt
- ' ballStatus(cnt) = 1
- ' ballStatus(0) = ballStatus(0) + 1
- ' If coff = False Then
- ' If ballStatus(0)> 1 and XYdata.enabled = False Then XYdata.enabled = True
- ' End If
- ' Exit For
- ' End If
- ' Next
- 'End Sub
- '
- 'Sub ClearBallID
- ' On Error Resume Next
- ' iball = ActiveBall.uservalue
- ' currentball(iball).UserValue = 0
- ' If Err Then Msgbox Err.description & vbCrLf & iball
- ' ballStatus(iBall) = 0
- ' ballStatus(0) = ballStatus(0) -1
- ' On Error Goto 0
- 'End Sub
- '
- '' Ball data collection and B2B Collision detection. jpsalas: added height check
- 'ReDim baX(tnopb, 4), baY(tnopb, 4), baZ(tnopb, 4), bVx(tnopb, 4), bVy(tnopb, 4), TotalVel(tnopb, 4)
- 'Dim cForce, bDistance, xyTime, cFactor, id, id2, id3, B1, B2
- '
- 'Sub XYdata_Timer()
- ' xyTime = Timer + (XYdata.interval * .001)
- ' If id2 >= 4 Then id2 = 0
- ' id2 = id2 + 1
- ' For id = 1 to ubound(ballStatus)
- ' If ballStatus(id) = 1 Then
- ' baX(id, id2) = round(currentball(id).x, 2)
- ' baY(id, id2) = round(currentball(id).y, 2)
- ' baZ(id, id2) = round(currentball(id).z, 2)
- ' bVx(id, id2) = round(currentball(id).velx, 2)
- ' bVy(id, id2) = round(currentball(id).vely, 2)
- ' TotalVel(id, id2) = (bVx(id, id2) ^2 + bVy(id, id2) ^2)
- ' If TotalVel(id, id2)> TotalVel(0, 0) Then TotalVel(0, 0) = int(TotalVel(id, id2) )
- ' End If
- ' Next
- '
- ' id3 = id2:B2 = 2:B1 = 1
- ' Do
- ' If ballStatus(B1) = 1 and ballStatus(B2) = 1 Then
- ' bDistance = int((TotalVel(B1, id3) + TotalVel(B2, id3) ) ^1.04)
- ' If ABS(baZ(B1, id3) - baZ(B2, id3) ) <50 Then
- ' If((baX(B1, id3) - baX(B2, id3) ) ^2 + (baY(B1, id3) - baY(B2, id3) ) ^2) <2800 + bDistance Then collide B1, B2:Exit Sub
- ' End If
- ' End If
- ' B1 = B1 + 1
- ' If B1 >= ballStatus(0) Then Exit Do
- ' If B1 >= B2 then B1 = 1:B2 = B2 + 1
- ' Loop
- '
- ' If ballStatus(0) <= 1 Then XYdata.enabled = False
- '
- ' If XYdata.interval >= 40 Then coff = True:XYdata.enabled = False
- ' If Timer> xyTime * 3 Then coff = True:XYdata.enabled = False
- ' If Timer> xyTime Then XYdata.interval = XYdata.interval + 1
- 'End Sub
- '
- ''Calculate the collision force and play sound
- 'Dim cTime, cb1, cb2, avgBallx, cAngle, bAngle1, bAngle2
- '
- 'Sub Collide(cb1, cb2)
- ' If TotalVel(0, 0) / 1.8> cFactor Then cFactor = int(TotalVel(0, 0) / 1.8)
- ' avgBallx = (bvX(cb2, 1) + bvX(cb2, 2) + bvX(cb2, 3) + bvX(cb2, 4) ) / 4
- ' If avgBallx <bvX(cb2, id2) + .1 and avgBallx> bvX(cb2, id2) -.1 Then
- ' If ABS(TotalVel(cb1, id2) - TotalVel(cb2, id2) ) <.000005 Then Exit Sub
- ' End If
- ' If Timer <cTime Then Exit Sub
- ' cTime = Timer + .1
- ' GetAngle baX(cb1, id3) - baX(cb2, id3), baY(cb1, id3) - baY(cb2, id3), cAngle
- ' id3 = id3 - 1:If id3 = 0 Then id3 = 4
- ' GetAngle bVx(cb1, id3), bVy(cb1, id3), bAngle1
- ' GetAngle bVx(cb2, id3), bVy(cb2, id3), bAngle2
- ' cForce = Cint((abs(TotalVel(cb1, id3) * Cos(cAngle-bAngle1) ) + abs(TotalVel(cb2, id3) * Cos(cAngle-bAngle2) ) ) )
- ' If cForce <4 Then Exit Sub
- ' cForce = Cint((cForce) / (cFactor / nosf) )
- ' If cForce> nosf-1 Then cForce = nosf-1
- ' PlaySound("fx_collide" & cForce)
- 'End Sub
- '
- '' Get angle
- 'Dim Xin, Yin, rAngle, Radit, wAngle, Pi
- 'Pi = Round(4 * Atn(1), 6) '3.1415926535897932384626433832795
- '
- 'Sub GetAngle(Xin, Yin, wAngle)
- ' If Sgn(Xin) = 0 Then
- ' If Sgn(Yin) = 1 Then rAngle = 3 * Pi / 2 Else rAngle = Pi / 2
- ' If Sgn(Yin) = 0 Then rAngle = 0
- ' Else
- ' rAngle = atn(- Yin / Xin)
- ' End If
- ' If sgn(Xin) = -1 Then Radit = Pi Else Radit = 0
- ' If sgn(Xin) = 1 and sgn(Yin) = 1 Then Radit = 2 * Pi
- ' wAngle = round((Radit + rAngle), 4)
- 'End Sub
- 'Sub Trigger1_hit
- ' PlaySound "DROP_LEFT"
- ' End Sub
- '
- ' Sub Trigger2_hit
- ' PlaySound "DROP_RIGHT"
- ' End Sub
- '==========================================================================================
- ' This code may be freely distributed, but is not to be included with any profit-making
- ' software or product without the express permission from this script author, JimmyFingers.
- '==========================================================================================
- ' '
- ' '
- '==========================================================================================
- ' Many thanks to all of the who people contribute towards the VP code, table builds, scans /
- ' graphics, script writers, etc. Enjoy and if you use in a table build / release, please
- ' only change parameters and not the main script / code (credit would also be appreciated
- '==========================================================================================
- '*****Requires B2B script addition placed before this script addition*****
- '******************************************
- ' Momentum Funtions
- '******************************************
- '
- 'const MomentumEnabled=False
- '
- 'dim m, BallRollAngle, MXQuotient, MYUQuotient, MYDDecayQuotient, XDelta, RealVelX, RealVelY
- 'dim AngleMultiplierX, ChangeFactorX, AngleMultiplierY, ChangeFactorY, BallRollDegrees
- 'ReDim PreviousVeloX(tnopb)
- '
- 'For m = 1 To Ubound(PreviousVeloX)
- ' PreviousVeloX(m)=0
- 'Next
- '
- ''MXThreshold=6 (previously 9)
- ''MXCutoff=.5 (previously 1)
- ''MXLevel=.045 (previously .035)
- ''MYULevel=.09 (previously .08)
- ''MYDThreshold=1 (previously 2)
- '
- 'const MXThreshold=6 'Speed at which X momentum equation kicks in
- 'const MXCutoff=.5 'Speed at which X momentum equation cuts-off
- 'const MXLevel=.045 'Factor for 1 + MXLevel - calculations
- 'MXQuotient=MXThreshold/MXLevel
- '
- 'const MYUThreshold=-6 'Speed at which Y Up momentum equation kicks in (- for up table)
- 'const MYUCutoff=-.5 'Speed at which Y Up momentum equation cuts-off (- for up table)
- 'const MYULevel=.09 'Factor for 1 + MYULevel - calculations
- 'MYUQuotient=ABS(MYUThreshold/MYULevel)
- '
- 'const MYDThreshold=1 'Speed at which Y Down momentum equation kicks in
- 'const MYDMAX=32 'Speed at which Y Down momentum equation steps out
- 'const MYDLevel=.072 'Factor for 1 + MYDLevel - calculations
- 'MYDDecayQuotient=ABS(MYDMAX/MYDLevel)
- '
- 'MomentumTimer.Interval = 60 'Should remain at 60 for proper operation
- '
- ''******************************************
- '' Use Timer to call Momentum subs
- ''******************************************
- '
- 'Sub MomentumTimer_Timer()
- ' Momentum
- 'End Sub
- '
- 'Sub Momentum()
- ' If MomentumEnabled=False Then Exit Sub
- ' 'This section handles Ball Physics, updating all balls every timer interval
- ' For m = 1 to ubound(BallStatus)
- ' If BallStatus(m) = 1 Then
- ' XDelta=ABS(PreviousVeloX(m))-ABS(CurrentBall(m).VelX)
- ' RealVelX = CurrentBall(m).VelX
- ' RealVelY = CurrentBall(m).VelY
- ' GetAngle Cint(RealVelX),Cint(RealVelY), BallRollAngle
- ' BallRollDegrees = Round(BallRollAngle*180/3.141592,3)
- '
- ' If ABS(RealVelX) <= MXThreshold AND ABS(RealVelX) > MXCutoff Then
- ' If XDelta > 0 Then
- ' AngleMultiplierX=Round(ABS(cos(BallRollAngle)),3)
- ' ChangeFactorX=Round(AngleMultiplierX*(MXLevel-ABS(RealVelX)/MXQuotient),3)
- ' CurrentBall(m).VelX=CurrentBall(m).VelX*(1 + ChangeFactorX)
- ' If RealVelX < 0 Then
- ' BlinkLeftLight
- ' ElseIf RealVelX > 0 Then
- ' BlinkRightLight
- ' End If
- ' End If
- ' End If
- ' PreviousVeloX(m)=CurrentBall(m).VelX
- '
- ' If BallRollDegrees >= 0 OR BallRollDegrees <= 180 Then
- ' If RealVelY >= MYUThreshold AND RealVelY < MYUCutoff Then
- ' AngleMultiplierY=Round(ABS(sin(BallRollAngle)),3)
- ' ChangeFactorY=Round(AngleMultiplierY*(MYULevel-ABS(RealVelY)/MYUQuotient),3)
- ' CurrentBall(m).VelY=CurrentBall(m).VelY*(1 + ChangeFactorY)
- ' BlinkUpLight
- ' End If
- ' End If
- '
- ' If BallRollDegrees <= 360 AND BallRollDegrees > 180 Then
- ' If RealVelY >= MYDThreshold AND RealVelY < MYDMAX Then
- ' AngleMultiplierY=Round(ABS(sin(BallRollAngle)),3)
- ' ChangeFactorY=Round(AngleMultiplierY*(MYDLevel-ABS(RealVelY)/MYDDecayQuotient),3)
- ' CurrentBall(m).VelY=CurrentBall(m).VelY*(1 + ChangeFactorY)
- ' BlinkDownLight
- ' End If
- ' End If
- ' End If
- ' Next
- 'End Sub
- '
- 'MXLeftLight.TimerInterval=MomentumTimer.Interval
- 'MXRightLight.TimerInterval=MomentumTimer.Interval
- 'MYULight.TimerInterval=MomentumTimer.Interval
- 'MYDLight.TimerInterval=MomentumTimer.Interval
- 'Sub BlinkLeftLight()
- ' MXLeftLight.State=1
- ' MXLeftLight.TimerEnabled=1
- 'End Sub
- '
- 'Sub MXLeftLight_Timer()
- ' MXLeftLight.State=0
- ' Me.TimerEnabled=0
- 'End Sub
- '
- 'Sub BlinkRightLight()
- ' MXRightLight.State=1
- ' MXRightLight.TimerEnabled=1
- 'End Sub
- '
- 'Sub MXRightLight_Timer()
- ' MXRightLight.State=0
- ' Me.TimerEnabled=0
- 'End Sub
- '
- 'Sub BlinkUpLight()
- ' MYULight.State=1
- ' MYULight.TimerEnabled=1
- 'End Sub
- '
- 'Sub MYULight_Timer()
- ' MYULight.State=0
- ' Me.TimerEnabled=0
- 'End Sub
- '
- 'Sub BlinkDownLight()
- ' MYDLight.State=1
- ' MYDLight.TimerEnabled=1
- 'End Sub
- 'Sub MYDLight_Timer()
- ' MYDLight.State=0
- ' Me.TimerEnabled=0
- 'End Sub
- '
- 'Sub ToggleMomentum()
- ' If MomentumTimer.Enabled=True Then
- ' MomentumTimer.Enabled=0
- ' ElseIf MomentumTimer.Enabled=False Then
- ' MomentumTimer.Enabled=1
- ' End If
- 'End Sub
- '
- '
- '
- 'Sub Dampen(dt,df,r) 'dt is threshold speed, df is dampen factor 0 to 1 (higher more dampening), r is randomness
- ' Dim dfRandomness
- ' r=cint(r)
- ' dfRandomness=INT(RND*(2*r+1))
- ' df=df+(r-dfRandomness)*.01
- ' If ABS(activeball.velx) > dt Then activeball.velx=activeball.velx*(1-df*(ABS(activeball.velx)/100))
- ' If ABS(activeball.vely) > dt Then activeball.vely=activeball.vely*(1-df*(ABS(activeball.vely)/100))
- 'End Sub
- '
- 'Sub DampenXY (dtx,dfx,rx, dty, dfy, ry) 'dt is threshold speed, df is dampen factor 0 to 1 (higher more dampening), r is randomness
- ' Dim dfxRandomness
- ' Dim dfyRandomness
- ' rx=cint(rx)
- ' ry=cint(ry)
- ' dfxRandomness=INT(RND*(2*rx+1))
- ' dfyRandomness=INT(RND*(2*ry+1))
- ' dfx=dfx+(rx-dfxRandomness)*.01
- ' dfy=dfy+(ry-dfyRandomness)*.01
- ' If ABS(activeball.velx) > dtx Then activeball.velx=activeball.velx*(1-dfx*(ABS(activeball.velx)/100))
- ' If ABS(activeball.vely) > dty Then activeball.vely=activeball.vely*(1-dfy*(ABS(activeball.vely)/100))
- 'End Sub
- '
- 'Sub FlipperDampener_Hit ()
- ' Dim YThreshold:YThreshold=-10 'Ball speed threshold to activate routine (-Y veloctiy for up table)
- ' Dim Level:Level=4 'Choose 1-10, 0 for off
- ' Dim XFactor:XFactor=2 'Straightening factor on X axis (higher value for straighter shots)
- ' Dim BallTriggerAngle, AngleMultiplier 'Angle calculated to apply less straightening on more lateral shots (further away from center line yields lower SIN result - used as coefficient)
- ' If ActiveBall.VelY < YThreshold AND Level <> 0 Then
- ' GetAngle ActiveBall.VelX, ActiveBall.VelY, BallTriggerAngle
- ' AngleMultiplier=Round(ABS(sin(BallTriggerAngle)),3)
- ' ActiveBall.VelY = ActiveBall.VelY*((1-(ABS(ActiveBall.VelY)/(200*10/Level-10*Level))))
- ' ActiveBall.VelX = ActiveBall.VelX*((1-XFactor*AngleMultiplier*(ABS(ActiveBall.VelY)/(200*10/Level-10*Level))))
- ' End If
- 'End Sub
- 'sub flashon
- ' SetLamp 127,1
- ' SetLamp 128,1
- ' SetLamp 129,1
- ' SetLamp 130,1
- ' SetLamp 131,1
- ' SetLamp 132,1
- 'end sub
- '
- 'sub flashoff
- ' SetLamp 127,0
- ' SetLamp 128,0
- ' SetLamp 129,0
- ' SetLamp 130,0
- ' SetLamp 131,0
- ' SetLamp 132,0
- 'end sub
- '***************
- 'Lamp Simulator -From TOTAN
- '***************
- Dim lampPosition, lampSpinSpeed, lampLastPos
- Const cLampSpeedMult = 180 ' 180 - Affects speed transfer to object (deg/sec)
- Const cLampFriction = 2.0 ' 2.0 - Friction coefficient (deg/sec/sec)
- Const cLampMinSpeed = 16 ' 20 - Object stops at this speed (deg/sec)
- Const cLampRadius = 72
- Const cBallSpeedDampeningEffect = 0.45 ' 45 - The ball retains this fraction of its speed due to energy absorption by hitting the lamp.
- ' Draw lamp
- Sub SpinTimer_Timer
- Dim curPos
- Dim oldLampSpeed:oldLampSpeed = lampSpinSpeed
- lampPosition = lampPosition + lampSpinSpeed * Me.Interval / 1000
- lampSpinSpeed = lampSpinSpeed * (1 - cLampFriction * Me.Interval / 1000)
- Do While lampPosition < 0
- lampPosition = lampPosition + 360
- Loop
- Do While lampPosition > 360
- lampPosition = lampPosition - 360
- Loop
- curPos = Int((lampPosition * colLampPoles.Count) / 360)
- If curPos <> lampLastPos Then
- 'LampPr.RotZ = 360 -lampPosition 'Not applicable
- If lampLastPos >= 0 Then ' not first time
- colLampPoles(lampLastPos).IsDropped = True
- colLampPoles2(lampLastPos).IsDropped = True
- DOF 101, DOFOn
- cube.ObjRotZ = -curPos*10
- cubeb.ObjRotZ = -curPos*10
- tessbase.ObjRotZ = -curPos*10
- End If
- DOF 101, DOFOff
- On Error Resume Next
- colLampPoles(curPos).IsDropped = False
- If Err Then msgbox curPoles
- colLampPoles2(curPos).IsDropped = False
- If oldLampSpeed > 0 And lampLastPos > curPos Then
- 'rev anticlockwise
- vpmTimer.PulseSw TesseractSW1
- ElseIf oldLampSpeed < 0 And lampLastPos < curPos Then
- 'rev clockwise
- vpmTimer.PulseSw TesseractSW2
- End If
- lampLastPos = curPos
- End If
- If Abs(lampSpinSpeed) < cLampMinSpeed Then
- lampSpinSpeed = 0:Me.Enabled = False
- End If
- End Sub
- Sub colLampPoles_Hit(idx)
- 'play rubber sound
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 14 then
- PlaySound "bump"
- End if
- If finalspeed >= 4 AND finalspeed <= 14 then
- RandomSoundRubber()
- End If
- If finalspeed < 4 AND finalspeed > 1 then
- RandomSoundRubberLowVolume()
- End If
- Dim pi:pi = 3.14159265358979323846
- dim lampangle
- lampangle = NormAngle((idx) / Me.Count * 2 * pi + (pi / 17.6) + pi) ' added (pi / 17.6) because the first lamp post (18) is not quite at 0 angle, added another pi to make it standard angle
- dim mball, mlamp, rlamp, ilamp
- dim collisionangle
- dim ballspeedin, ballspeedout, lampspeedin, lampspeedout
- dim fudge:fudge = cLampSpeedMult / 2
- With ActiveBall
- collisionangle = GetCollisionAngle(idx, Me.Count, .X, -.Y) ' this is the angle from the center of ball to the center of post
- Set ballspeedout = new jVector
- ballspeedout.SetXY .VelX, -.VelY
- ballspeedout.ShiftAxes - collisionangle
- lampSpinSpeed = lampSpinSpeed + sqr(.VelX ^2 + .VelY ^2) * sin(collisionangle - lampangle) * fudge
- ballspeedout.SetXY ballspeedout.x, ballspeedout.y * cos(collisionangle - lampangle)
- ballspeedout.ShiftAxes collisionangle
- ' we can give a more accurate ball return speed or let the normal VP physics give the ball speed
- '.VelX = ballspeedout.x * cBallSpeedDampeningEffect
- '.VelY = - ballspeedout.y * cBallSpeedDampeningEffect
- End With
- SpinTimer.Enabled = True
- End Sub
- Function GetCollisionAngle(idx, count, X, Y)
- Dim pi:pi = 3.14159265358979323846
- dim angle, postx, posty, dX, dY
- Dim ang
- angle = (idx) / count * 2 * pi + (pi / 17.6) ' added (pi / 17.6) because the first lamp post (18) is not quite at 0 angle
- postx = 551 - 60.25 * Cos(angle) ' 551 and 825.25 are the actual coordinates of the center of the lamp
- posty = 885.25 + 60.25 * Sin(angle) ' 60.25 is the radius of the circle with center at the center of the lamp and edge at the centers of all the lamp posts
- posty = -1 * posty
- Dim collisionV:Set collisionV = new jVector
- collisionV.SetXY postx - X, posty - Y
- GetCollisionAngle = collisionV.ang
- End Function
- Function NormAngle(angle)
- NormAngle = angle
- Dim pi:pi = 3.14159265358979323846
- Do While NormAngle > 2 * pi
- NormAngle = NormAngle - 2 * pi
- Loop
- Do While NormAngle < 0
- NormAngle = NormAngle + 2 * pi
- Loop
- End Function
- Class jVector
- Private m_mag, m_ang, pi
- Sub Class_Initialize
- m_mag = CDbl(0)
- m_ang = CDbl(0)
- pi = CDbl(3.14159265358979323846)
- End Sub
- Public Function add(anothervector)
- Dim tx, ty, theta
- If TypeName(anothervector) = "jVector" then
- Set add = new jVector
- add.SetXY x + anothervector.x, y + anothervector.y
- End If
- End Function
- Public Function multiply(scalar)
- Set multiply = new jVector
- multiply.SetXY x * scalar, y * scalar
- End Function
- Sub ShiftAxes(theta)
- ang = ang - theta
- end Sub
- Sub SetXY(tx, ty)
- if tx = 0 And ty = 0 Then
- ang = 0
- elseif tx = 0 And ty < 0 then
- ang = - pi / 180 ' -90 degrees
- elseif tx = 0 And ty > 0 then
- ang = pi / 180 ' 90 degrees
- else
- ang = atn(ty / tx)
- if tx < 0 then ang = ang + pi ' Add 180 deg if in quadrant 2 or 3
- End if
- mag = sqr(tx ^2 + ty ^2)
- End Sub
- Property Let mag(nmag)
- m_mag = nmag
- End Property
- Property Get mag
- mag = m_mag
- End Property
- Property Let ang(nang)
- m_ang = nang
- Do While m_ang > 2 * pi
- m_ang = m_ang - 2 * pi
- Loop
- Do While m_ang < 0
- m_ang = m_ang + 2 * pi
- Loop
- End Property
- Property Get ang
- Do While m_ang > 2 * pi
- m_ang = m_ang - 2 * pi
- Loop
- Do While m_ang < 0
- m_ang = m_ang + 2 * pi
- Loop
- ang = m_ang
- End Property
- Property Get x
- x = m_mag * cos(ang)
- End Property
- Property Get y
- y = m_mag * sin(ang)
- End Property
- Property Get dump
- dump = "vector "
- Select Case CInt(ang + pi / 8)
- case 0, 8:dump = dump & "->"
- case 1:dump = dump & "/'"
- case 2:dump = dump & "/\"
- case 3:dump = dump & "'\"
- case 4:dump = dump & "<-"
- case 5:dump = dump & ":/"
- case 6:dump = dump & "\/"
- case 7:dump = dump & "\:"
- End Select
- dump = dump & " mag:" & CLng(mag * 10) / 10 & ", ang:" & CLng(ang * 180 / pi) & ", x:" & CLng(x * 10) / 10 & ", y:" & CLng(y * 10) / 10
- End Property
- End Class
- 'Custom Vlock for optos
- ' Class cvpmVOptoLock
- ' 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
- '
- ' 'Init optolock to 1 "No ball present
- ' For ii = 0 To mSize
- ' Controller.Switch(mSw(ii)) = True
- ' Next
- '
- ' 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
- ' msgbox "solexit" & aEnabled
- ' 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)) = True 'False
- ' Next
- ' If ExitForce > 0 Then ' Up
- ' mRealForce = ExitForce + (Rnd - 0.5)*KickForceVar : mKick(mBalls-1).Kick ExitDir, mRealForce
- ' Else ' Down
- ' mKick(0).Kick 0, 0
- ' 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)) = False '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)) = True 'False
- ' Else
- ' vpmCreateBall mKick(ii) : If mSw(ii) Then Controller.Switch(mSw(ii)) = False 'True
- ' End If
- ' Next
- ' End Property
- '
- ' Public Sub TrigHit(aBall, aNo)
- ' msgbox "trighit" & aNo & ":" & mGateOpen
- '
- ' aNo = aNo - 1 : If mSw(aNo) Then Controller.Switch(mSw(aNo)) = False '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)
- ' msgbox "untrighit" & aNo
- ' aNo = aNo - 1 : If mSw(aNo) Then Controller.Switch(mSw(aNo)) = True '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 : msgbox "kickHit" & aNo: End Sub
- 'End Class
- '****DEBUG
- '****DEBUG
- '****DEBUG
- 'InitRampGuides
- 'Sub InitRampGuides
- ' RampGuideSetMode 0
- ' rampTempCnt=0
- 'End Sub
- '
- 'Dim rampKeycode,rampKeycodeCount, rampTempCnt, rampModesMax
- 'rampKeycode = 3 'Specify button to enable posts: 3=Extra Ball button or use LeftMagnaSave or RightMagnaSave or any key
- 'rampKeycodeCount = 3 '# of consecutive keypresses before Training Posts feature works(so it is not accidentally enabled)
- 'rampModesMax = 5
- '
- 'Sub rampCheck (keyc)
- ' If keyc = rampKeycode Then
- ' rampTempCnt = rampTempCnt+1
- ' RampGuideSetMode rampTempCnt Mod rampModesMax
- ' End If
- 'End Sub
- 'Sub RampGuideSetMode (input) '+1 for up, -1 for down
- ' Select Case input
- ' Case 0 'No Lanes
- ' Rampguide1.Isdropped=1
- ' Rampguide2.Isdropped=1
- ' Rampguide3.Isdropped=1
- ' Rampguide4.Isdropped=1
- ' Rampguide5.Isdropped=1
- ' Rampguide6.Isdropped=1
- ' Rampguide7.Isdropped=1
- '
- ' Case 1 'All Lanes no flipperwall
- ' Rampguide1.Isdropped=0
- ' Rampguide2.Isdropped=1
- ' Rampguide3.Isdropped=1
- ' Rampguide4.Isdropped=1
- ' Rampguide5.Isdropped=1
- ' Rampguide6.Isdropped=1
- ' Rampguide7.Isdropped=1
- ' Case 2 'All Lanes plus flipperwall
- ' Rampguide1.Isdropped=1
- ' Rampguide2.Isdropped=0
- ' Rampguide3.Isdropped=0
- ' Rampguide4.Isdropped=1
- ' Rampguide5.Isdropped=1
- ' Rampguide6.Isdropped=1
- ' Rampguide7.Isdropped=1
- ' Case 3 'Outer Lanes only
- ' Rampguide1.Isdropped=1
- ' Rampguide2.Isdropped=1
- ' Rampguide3.Isdropped=1
- ' Rampguide4.Isdropped=0
- ' Rampguide5.Isdropped=0
- ' Rampguide6.Isdropped=1
- ' Rampguide7.Isdropped=1
- ' Case 4 'Center Lane only
- ' Rampguide1.Isdropped=1
- ' Rampguide2.Isdropped=1
- ' Rampguide3.Isdropped=1
- ' Rampguide4.Isdropped=1
- ' Rampguide5.Isdropped=1
- ' Rampguide6.Isdropped=0
- ' Rampguide7.Isdropped=0
- ' End Select
- 'End Sub
- 'to do (future release)
- ' lamp in hulk ramp
- ' hulk arm animation
- ' add light reflections
- ' hulk image lighting
- Dim armmove
- Sub Timer1_Timer()
- armmove = 0
- If armsup = false and HulkPrim1.RotX > 130 then armmove = -4
- If armsup = true and HulkPrim1.RotX < 250 then armmove = 4
- HulkPrim1.RotX = HulkPrim1.RotX + armmove
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement