Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Randomize
- On Error Resume Next
- ExecuteGlobal GetTextFile("controller.vbs")
- If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
- On Error Goto 0
- Const cGameName="tmachzac",UseSolenoids=1,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
- LoadVPM "01560000","ZAC2.VBS",3.2
- Dim DesktopMode: DesktopMode = Table1.ShowDT
- If DesktopMode = True Then 'Show Desktop components
- Ramp16.visible=1
- Ramp15.visible=1
- Primitive46.visible=1
- Else
- Ramp16.visible=0
- Ramp15.visible=0
- Primitive46.visible=0
- End if
- '*************************************************************
- 'Solenoid Call backs
- '**********************************************************************************************************
- SolCallback(1) = "bsKicker.SolOut"
- SolCallback(4) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
- SolCallback(5) = "LeftDropTargetBank.SolDropUp"
- SolCallback(6) = "RightDropTargetBank.SolDropUp"
- SolCallback(21) = "MotorRelay"
- SolCallback(24) = "bsTrough.SolOut"
- SolCallback(sLRFlipper) = "SolRFlipper"
- SolCallback(sLLFlipper) = "SolLFlipper"
- Sub SolLFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd:LeftFlipper1.RotateToEnd
- 'LeftFlipperWall.isdropped = False
- Else
- PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart:LeftFlipper1.RotateToStart
- 'LeftFlipperWall.isdropped = True
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd:RightFlipper1.RotateToEnd
- 'RightFlipperWall.isdropped = False
- Else
- PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart:RightFlipper1.RotateToStart
- 'RightFlipperWall.isdropped = True
- End If
- End Sub
- '**********************************************************************************************************
- 'Solenoid Controlled toys
- '**********************************************************************************************************
- Dim MovingPFHeight,MovingPFDir,EndPositionReached,MovingPFIsUp, obj
- Sub MotorRelay(Enabled)
- if enabled then
- MovingPFDir = -MovingPFDir
- EndPositionReached = False
- MovingPFMoveTimer.enabled = True
- else
- end if
- end sub
- Sub MovingPFMoveTimer_Timer
- Playsound "Motor1",0,0.2,0,0.1
- MovingPFHeight = MovingPFHeight + MovingPFDir
- if (MovingPFHeight >= 99) or (MovingPFHeight <= 0) then
- EndPositionReached = True
- else
- EndPositionReached = False
- end if
- for each obj in MovingPFPrimitives
- obj.TransZ = MovingPFHeight
- next
- P_GateWire.Z = 60 + MovingPFHeight
- L15a.BulbHaloHeight = 60 + MovingPFHeight
- L15b.BulbHaloHeight = 60 + MovingPFHeight
- L15c.BulbHaloHeight = 60 + MovingPFHeight
- L15d.BulbHaloHeight = 60 + MovingPFHeight
- L15e.BulbHaloHeight = 60 + MovingPFHeight
- L15f.BulbHaloHeight = 60 + MovingPFHeight
- if EndPositionReached then
- MovingPFMoveTimer.enabled = False
- if MovingPFHeight > 50 then
- MovingPFIsUp = True
- else
- MovingPFIsUp = False
- end if
- Controller.switch(51) = not MovingPFIsUp
- for each obj in MovingPFWalls
- obj.isdropped = not MovingPFIsUp
- next
- Gate.collidable = MovingPFIsUp
- end if
- end sub
- Sub InitMovingPlayfield
- MovingPFHeight = 0
- MovingPFIsUp = False
- MovingPFDir = -1
- EndPositionReached = False
- Controller.switch(51) = not MovingPFIsUp
- for each obj in MovingPFWalls
- obj.isdropped = not MovingPFIsUp
- next
- Gate.collidable = MovingPFIsUp
- End Sub
- '*****GI Lights On
- dim xx
- For each xx in GI:xx.State = 1: Next
- '**********************************************************************************************************
- 'Initiate Table
- '**********************************************************************************************************
- Dim bsTrough, bsKicker, LeftDropTargetBank, RightDropTargetBank
- Sub Table1_Init
- vpmInit Me
- On Error Resume Next
- With Controller
- .GameName = cGameName
- If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
- .SplashInfoLine = "TimeMachine (Zaccaria 1983)"&chr(13)&"You Suck"
- .HandleMechanics=0
- .HandleKeyboard=0
- .ShowDMDOnly=1
- .ShowFrame=0
- .ShowTitle=0
- .hidden = 1
- On Error Resume Next
- .Run GetPlayerHWnd
- If Err Then MsgBox Err.Description
- On Error Goto 0
- End With
- On Error Goto 0
- PinMAMETimer.Interval=PinMAMEInterval
- PinMAMETimer.Enabled = true
- vpmNudge.TiltSwitch=10
- vpmNudge.Sensitivity=2
- vpmNudge.TiltObj = Array(LeftBumper,RightBumper,CenterBumper,LeftslingShot,RightslingShot)
- Set bsTrough=New cvpmBallStack
- bsTrough.InitSw 0,16,0,0,0,0,0,0
- bsTrough.InitKick BallRelease,90,5
- bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
- bsTrough.Balls=1
- Set bsKicker=New cvpmBallStack
- bsKicker.InitSaucer sw23,23,170,5
- bsKicker.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
- set LeftDropTargetBank = new cvpmDropTarget
- LeftDropTargetBank.InitDrop Array(sw24,sw25,sw26), Array(24,25,26)
- LeftDropTargetBank.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
- set RightDropTargetBank = new cvpmDropTarget
- RightDropTargetBank.InitDrop Array(sw27,sw28,sw29), Array(27,28,29)
- RightDropTargetBank.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
- InitMovingPlayfield
- 'LeftFlipperWall.isdropped = 1
- 'RightFlipperWall.isdropped = 1
- End Sub
- '**********************************************************************************************************
- 'Plunger code
- '**********************************************************************************************************
- Sub Table1_KeyDown(ByVal KeyCode)
- If keycode = LeftMagnaSave Then bLutActive = True
- If keycode = RightMagnaSave Then
- If bLutActive Then NextLUT: End If
- End If
- If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
- If KeyDownHandler(keycode) Then Exit Sub
- End Sub
- Sub Table1_KeyUp(ByVal KeyCode)
- If keycode = LeftMagnaSave Then bLutActive = False
- If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
- If KeyUpHandler(keycode) Then Exit Sub
- End Sub
- '**********************************************************************************************************
- ' Drain hole and kickers
- Sub Drain_Hit:bsTrough.addball me : playsound"drain" : End Sub
- Sub sw23_Hit:bsKicker.AddBall 0 : playsound "popper_ball": End Sub
- 'Drop Targets
- Sub sw24_Dropped:LeftDropTargetBank.Hit 1:End Sub
- Sub sw25_Dropped:LeftDropTargetBank.Hit 2:End Sub
- Sub sw26_Dropped:LeftDropTargetBank.Hit 3:End Sub
- Sub sw27_Dropped:RightDropTargetBank.Hit 1:End Sub
- Sub sw28_Dropped:RightDropTargetBank.Hit 2:End Sub
- Sub sw29_Dropped:RightDropTargetBank.Hit 3:End Sub
- 'Button Triggers
- sub sw17_hit:Controller.Switch(17)=1 : playsound"rollover" : End Sub
- sub sw17_unhit:Controller.Switch(17)=0:End Sub
- sub sw20_hit:Controller.Switch(20)=1 : playsound"rollover" : End Sub
- sub sw20_unhit:Controller.Switch(20)=0:End Sub
- 'Wire Triggers
- sub sw21_hit:Controller.Switch(21)=1 : playsound"rollover" : End Sub
- sub sw21_unhit:Controller.Switch(21)=0:End Sub
- sub sw22_hit:Controller.Switch(22)=1 : playsound"rollover" : End Sub
- sub sw22_unhit:Controller.Switch(22)=0:End Sub
- sub sw39_hit:Controller.Switch(39)=1 : playsound"rollover" : End Sub
- sub sw39_unhit:Controller.Switch(39)=0:End Sub
- 'Ramp Triggers
- sub sw30_hit:Controller.Switch(30)=1 : playsound"rollover" : End Sub
- sub sw30_unhit:Controller.Switch(30)=0:End Sub
- sub sw31_hit:Controller.Switch(31)=1 : playsound"rollover" : End Sub
- sub sw31_unhit:Controller.Switch(31)=0:End Sub
- 'Stand Up Targets Moving PF
- Sub sw40_hit:vpmTimer.pulseSw 40:sw40.TimerEnabled = 1:sw40p.TransY = 4: playsound SoundFX("Target",DOFTargets) : End Sub
- Sub sw40_Timer:sw40p.TransY = 0 : sw40.TimerEnabled = 0 : End Sub
- Sub sw41_hit:vpmTimer.pulseSw 41:sw41.TimerEnabled = 1:sw41p.TransY = 4: playsound SoundFX("Target",DOFTargets) : End Sub
- Sub sw41_Timer:sw41p.TransY = 0 : sw41.TimerEnabled = 0 : End Sub
- Sub sw42_hit:vpmTimer.pulseSw 42:sw42.TimerEnabled = 1:sw42p.TransY = 4: playsound SoundFX("Target",DOFTargets) : End Sub
- Sub sw42_Timer:sw42p.TransY = 0 : sw42.TimerEnabled = 0 : End Sub
- Sub sw43_hit:vpmTimer.pulseSw 43:sw43.TimerEnabled = 1:sw43p.TransY = 4: playsound SoundFX("Target",DOFTargets) : End Sub
- Sub sw43_Timer:sw43p.TransY = 0 : sw43.TimerEnabled = 0 : End Sub
- Sub sw44_hit:vpmTimer.pulseSw 44:sw44.TimerEnabled = 1:sw44p.TransY = 4: playsound SoundFX("Target",DOFTargets) : End Sub
- Sub sw44_Timer:sw44p.TransY = 0 : sw44.TimerEnabled = 0 : End Sub
- Sub sw45_hit:vpmTimer.pulseSw 45:sw45.TimerEnabled = 1:sw45p.TransY = 4: playsound SoundFX("Target",DOFTargets) : End Sub
- Sub sw45_Timer:sw45p.TransY = 0 : sw45.TimerEnabled = 0 : End Sub
- Sub sw46_hit:vpmTimer.pulseSw 46:sw46.TimerEnabled = 1:sw46p.TransY = 4: playsound SoundFX("Target",DOFTargets) : End Sub
- Sub sw46_Timer:sw46p.TransY = 0: : sw46.TimerEnabled = 0 : End Sub
- Sub sw47_hit:vpmTimer.pulseSw 47:sw47.TimerEnabled = 1:sw47p.TransY = 4: playsound SoundFX("Target",DOFTargets) : End Sub
- Sub sw47_Timer:sw47p.TransY = 0 : sw47.TimerEnabled = 0 : End Sub
- 'Stand Up Targets
- Sub sw32_hit:vpmTimer.pulseSw 32 : DOF 102, DOFPulse : End Sub
- Sub sw32a_hit:vpmTimer.pulseSw 32 : DOF 101, DOFPulse : End Sub
- Sub sw33_hit:vpmTimer.pulseSw 33 : End Sub
- Sub sw34_hit:vpmTimer.pulseSw 34 : End Sub
- Sub sw35_hit:vpmTimer.pulseSw 35 : End Sub
- Sub sw36_hit:vpmTimer.pulseSw 36 : End Sub
- Sub sw37_hit:vpmTimer.pulseSw 37 : End Sub
- Sub sw38_hit:vpmTimer.pulseSw 38 : End Sub
- 'Bumpers
- Sub CenterBumper_slingshot
- vpmTimer.PulseSw 48
- playsound SoundFX("fx_bumper1",DOFContactors)
- End Sub
- Sub RightBumper_slingshot
- vpmTimer.PulseSw 49
- playsound SoundFX("fx_bumper1",DOFContactors)
- End Sub
- Sub LeftBumper_slingshot
- vpmTimer.PulseSw 50
- playsound SoundFX("fx_bumper1",DOFContactors)
- End Sub
- 'Generic Sounds
- Sub Trigger1_Hit:PlaySound "Wire Ramp":End Sub
- Sub Trigger2_Hit:PlaySound "Metal_Scoop":StopSound "Wire Ramp":End Sub
- '***************************************************
- 'Left Wire Ramp animation
- '***************************************************
- Dim WireRamp_Dir
- Sub WireRamp_Enter_Hit
- WireRamp_Dir = -1
- WireRampTimer.enabled = False
- WireRampTimer.enabled = True
- End Sub
- Sub WireRamp_Exit_Hit
- WireRamp_Dir = 1
- WireRampTimer.enabled = False
- WireRampTimer.enabled = True
- PlaySound "fx_ballrampdrop"
- End Sub
- Sub WireRampTimer_Timer
- P_WireRamp.ObjRotX = P_WireRamp.ObjRotX + WireRamp_Dir
- if P_WireRamp.ObjRotX <= -15 then
- WireRampTimer.enabled = False
- WireRamp_Dir = 0
- end if
- if P_WireRamp.ObjRotX >= 5 then
- WireRampTimer.enabled = False
- P_WireRamp.ObjRotX = 5
- WireRamp_Dir = 0
- end if
- End Sub
- '***************************************************
- '***************************************************
- ' JP's VP10 Fading Lamps & Flashers
- ' Based on PD's Fading Light System
- ' SetLamp 0 is Off
- ' SetLamp 1 is On
- ' fading for non opacity objects is 4 steps
- '***************************************************
- Dim LampState(200), FadingLevel(200)
- Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
- InitLamps() ' turn off the lights and flashers and reset them to the default parameters
- LampTimer.Interval = 5 'lamp fading speed
- LampTimer.Enabled = 1
- ' Lamp & Flasher Timers
- Sub LampTimer_Timer()
- Dim chgLamp, num, chg, ii
- chgLamp = Controller.ChangedLamps
- If Not IsEmpty(chgLamp) Then
- For ii = 0 To UBound(chgLamp)
- LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
- FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
- 'Special Handling
- 'If chgLamp(ii,0) = 2 Then solTrough chgLamp(ii,1)
- 'If chgLamp(ii,0) = 4 Then PFGI chgLamp(ii,1)
- Next
- End If
- UpdateLamps
- End Sub
- Sub UpdateLamps()
- NFadeL 1, Lamp1 'GI bulb
- NFadeL 2, Lamp2
- NFadeL 3, Lamp3
- NFadeL 4, Lamp4
- NFadeL 5, Lamp5
- NFadeL 8, Lamp8
- NFadeL 9, Lamp9
- NFadeLm 10, Lamp10
- NFadeL 10, Lamp10a
- NFadeLm 11, Lamp11
- NFadeL 11, Lamp11a
- NFadeLm 14, L14 'GI bulb
- NFadeL 14, L14a
- NFadeLm 15, L15a 'Bumpers
- NFadeLm 15, L15b
- NFadeLm 15, L15c
- NFadeLm 15, L15d
- NFadeLm 15, L15e
- NFadeL 15, L15f
- NFadeLm 16, L16 'GI bulb
- NFadeL 16, L16a
- NFadeLm 18, L18 'GI bulb
- NFadeL 18, L18a
- NFadeLm 19, L19 'GI bulb
- NFadeL 19, L19a
- 'NFadeL 20, Lamp20 'flipper
- NFadeLm 21, L21 'GI bulb
- NFadeL 21, L21a
- NFadeL 22, Lamp22
- NFadeL 23, Lamp23
- NFadeL 24, Lamp24
- NFadeL 25, Lamp25
- NFadeL 26, Lamp26
- NFadeObjm 27, P27, "RedApronLight_lit", "RedApronLight"
- NFadeL 27, Lamp27 'Apron
- NFadeL 28, Lamp28
- NFadeL 29, Lamp29
- NFadeL 30, Lamp30
- NFadeL 32, Lamp32
- NFadeL 33, Lamp33
- NFadeL 34, Lamp34
- NFadeL 35, Lamp35
- NFadeL 36, Lamp36
- NFadeL 38, Lamp38
- NFadeL 39, Lamp39
- NFadeL 40, Lamp40
- NFadeL 41, Lamp41
- NFadeL 42, Lamp42
- NFadeL 43, Lamp43
- NFadeL 44, Lamp44
- NFadeL 45, Lamp45
- NFadeL 46, Lamp46
- NFadeL 47, Lamp47
- NFadeL 48, Lamp48
- NFadeL 49, Lamp49
- NFadeL 50, Lamp50
- NFadeL 51, Lamp51
- NFadeL 52, Lamp52
- NFadeL 53, Lamp53
- NFadeL 54, Lamp54
- NFadeL 55, Lamp55
- NFadeL 57, Lamp57
- NFadeL 58, Lamp58
- NFadeL 59, Lamp59
- NFadeL 61, Lamp61
- NFadeL 63, Lamp63
- NFadeL 64, Lamp64
- NFadeL 65, Lamp65
- NFadeL 68, Lamp68
- NFadeL 69, Lamp69
- NFadeL 70, Lamp70
- NFadeObj 71, P71, "Light_A_lit", "Light_A_unlit" 'Moving PF
- NFadeObj 73, P73, "Light_B_lit", "Light_B_unlit" 'Moving PF
- NFadeObj 74, P74, "Light_C_lit", "Light_C_unlit" 'Moving PF
- NFadeObj 75, P75, "Light_D_lit", "Light_D_unlit" 'Moving PF
- NFadeObj 79, P79, "Light_E_lit", "Light_E_unlit" 'Moving PF
- NFadeObj 80, P80, "Light_F_lit", "Light_F_unlit" 'Moving PF
- End Sub
- ' div lamp subs
- Sub InitLamps()
- Dim x
- For x = 0 to 200
- LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
- FadingLevel(x) = 4 ' used to track the fading state
- FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
- FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
- FlashMax(x) = 1 ' the maximum value when on, usually 1
- FlashMin(x) = 0 ' the minimum value when off, usually 0
- FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
- Next
- End Sub
- Sub AllLampsOff
- Dim x
- For x = 0 to 200
- SetLamp x, 0
- Next
- End Sub
- Sub SetLamp(nr, value)
- If value <> LampState(nr) Then
- LampState(nr) = abs(value)
- FadingLevel(nr) = abs(value) + 4
- End If
- End Sub
- ' Lights: used for VP10 standard lights, the fading is handled by VP itself
- Sub NFadeL(nr, object)
- Select Case FadingLevel(nr)
- Case 4:object.state = 0:FadingLevel(nr) = 0
- Case 5:object.state = 1:FadingLevel(nr) = 1
- End Select
- End Sub
- Sub NFadeLm(nr, object) ' used for multiple lights
- Select Case FadingLevel(nr)
- Case 4:object.state = 0
- Case 5:object.state = 1
- End Select
- End Sub
- 'Lights, Ramps & Primitives used as 4 step fading lights
- 'a,b,c,d are the images used from on to off
- Sub FadeObj(nr, object, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
- Case 5:object.image = a:FadingLevel(nr) = 1 'ON
- Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
- Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
- Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
- Case 13:object.image = d:FadingLevel(nr) = 0 'Off
- End Select
- End Sub
- Sub FadeObjm(nr, object, a, b, c, d)
- Select Case FadingLevel(nr)
- Case 4:object.image = b
- Case 5:object.image = a
- Case 9:object.image = c
- Case 13:object.image = d
- End Select
- End Sub
- Sub NFadeObj(nr, object, a, b)
- Select Case FadingLevel(nr)
- Case 4:object.image = b:FadingLevel(nr) = 0 'off
- Case 5:object.image = a:FadingLevel(nr) = 1 'on
- End Select
- End Sub
- Sub NFadeObjm(nr, object, a, b)
- Select Case FadingLevel(nr)
- Case 4:object.image = b
- Case 5:object.image = a
- End Select
- End Sub
- ' Flasher objects
- Sub Flash(nr, object)
- Select Case FadingLevel(nr)
- Case 4 'off
- FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
- If FlashLevel(nr) < FlashMin(nr) Then
- FlashLevel(nr) = FlashMin(nr)
- FadingLevel(nr) = 0 'completely off
- End if
- Object.IntensityScale = FlashLevel(nr)
- Case 5 ' on
- FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
- If FlashLevel(nr) > FlashMax(nr) Then
- FlashLevel(nr) = FlashMax(nr)
- FadingLevel(nr) = 1 'completely on
- End if
- Object.IntensityScale = FlashLevel(nr)
- End Select
- End Sub
- Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
- Object.IntensityScale = FlashLevel(nr)
- End Sub
- '**********************************************************************************************************
- 'Digital Display
- '**********************************************************************************************************
- Dim Digits(40)
- Digits(0) = Array(LED10,LED11,LED12,LED13,LED14,LED15,LED16)
- Digits(1) = Array(LED20,LED21,LED22,LED23,LED24,LED25,LED26)
- Digits(2) = Array(LED30,LED31,LED32,LED33,LED34,LED35,LED36)
- Digits(3) = Array(LED40,LED41,LED42,LED43,LED44,LED45,LED46)
- Digits(4) = Array(LED50,LED51,LED52,LED53,LED54,LED55,LED56)
- Digits(5) = Array(LED60,LED61,LED62,LED63,LED64,LED65,LED66)
- Digits(6) = Array(LED70,LED71,LED72,LED73,LED74,LED75,LED76)
- Digits(7) = Array(LED80,LED81,LED82,LED83,LED84,LED85,LED86)
- Digits(8) = Array(LED90,LED91,LED92,LED93,LED94,LED95,LED96)
- Digits(9) = Array(LED100,LED101,LED102,LED103,LED104,LED105,LED106)
- Digits(10) = Array(LED110,LED111,LED112,LED113,LED114,LED115,LED116)
- Digits(11) = Array(LED120,LED121,LED122,LED123,LED124,LED125,LED126)
- Digits(12) = Array(LED130,LED131,LED132,LED133,LED134,LED135,LED136)
- Digits(13) = Array(LED140,LED141,LED142,LED143,LED144,LED145,LED146)
- Digits(14) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156)
- Digits(15) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166)
- Digits(16) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176)
- Digits(17) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186)
- Digits(18) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196)
- Digits(19) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206)
- Digits(20) = Array(LED210,LED211,LED212,LED213,LED214,LED215,LED216)
- Digits(21) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226)
- Digits(22) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236)
- Digits(23) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246)
- Digits(24) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256)
- Digits(25) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266)
- Digits(26) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276)
- Digits(27) = Array(LED280,LED281,LED282,LED283,LED284,LED285,LED286)
- Digits(28) = Array(LED4,LED2,LED6,LED7,LED5,LED1,LED3)
- Digits(29) = Array(LED18,LED9,LED27,LED28,LED19,LED8,LED17)
- Digits(30) = Array(LED39,LED37,LED48,LED49,LED47,LED29,LED38)
- Digits(31) = Array(LED67,LED58,LED69,LED77,LED68,LED57,LED59)
- Digits(32) = Array(LED88,LED79,LED97,LED98,LED89,LED78,LED87)
- Digits(33) = Array(LED109,LED107,LED118,LED119,LED117,LED99,LED108)
- Digits(34) = Array(LED137,LED128,LED139,LED147,LED138,LED127,LED129)
- Digits(35) = Array(LED158,LED149,LED167,LED168,LED159,LED148,LED157)
- Digits(36) = Array(LED179,LED177,LED188,LED189,LED187,LED169,LED178)
- Digits(37) = Array(LED207,LED198,LED209,LED217,LED208,LED197,LED199)
- Digits(38) = Array(LED228,LED219,LED237,LED238,LED229,LED218,LED227)
- Digits(39) = Array(LED249,LED247,LED258,LED259,LED257,LED239,LED248)
- Sub DisplayTimer_Timer
- Dim ChgLED,ii,num,chg,stat,obj
- ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
- If Not IsEmpty(ChgLED) Then
- If DesktopMode = True Then
- For ii = 0 To UBound(chgLED)
- num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
- if (num < 40) then
- For Each obj In Digits(num)
- If chg And 1 Then obj.State = stat And 1
- chg = chg\2 : stat = stat\2
- Next
- else
- end if
- next
- end if
- end if
- End Sub
- '**********************************************************************************************************
- '**********************************************************************************************************
- '**********Sling Shot Animations
- ' Rstep and Lstep are the variables that increment the animation
- '****************
- Dim RStep, Lstep
- Sub RightSlingShot_Slingshot
- vpmTimer.PulseSw 19
- PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
- RSling.Visible = 0
- RSling1.Visible = 1
- sling1.rotx = 20
- RStep = 0
- RightSlingShot.TimerEnabled = 1
- End Sub
- Sub RightSlingShot_Timer
- Select Case RStep
- Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
- Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0:
- End Select
- RStep = RStep + 1
- End Sub
- Sub LeftSlingShot_Slingshot
- vpmTimer.PulseSw 18
- PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
- LSling.Visible = 0
- LSling1.Visible = 1
- sling2.rotx = 20
- LStep = 0
- LeftSlingShot.TimerEnabled = 1
- End Sub
- Sub LeftSlingShot_Timer
- Select Case LStep
- Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
- Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0:
- End Select
- LStep = LStep + 1
- End Sub
- '*********************************************************************
- ' Positional Sound Playback Functions
- '*********************************************************************
- ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
- ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
- ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
- Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
- PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
- End Sub
- ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
- Sub PlaySoundAt(soundname, tableobj)
- PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBall(soundname)
- PlaySoundAt soundname, ActiveBall
- End Sub
- '*************
- ' JP'S LUT
- '*************
- Dim bLutActive, LUTImage
- Sub LoadLUT
- Dim x
- x = LoadValue(cGameName, "LUTImage")
- If(x <> "") Then LUTImage = x Else LUTImage = 0
- UpdateLUT
- End Sub
- Sub SaveLUT
- SaveValue cGameName, "LUTImage", LUTImage
- End Sub
- Sub NextLUT: LUTImage = (LUTImage +1 ) MOD 10: UpdateLUT: SaveLUT: End Sub
- Sub UpdateLUT
- Select Case LutImage
- Case 0: table1.ColorGradeImage = "LUT0"
- Case 1: table1.ColorGradeImage = "LUT1"
- Case 2: table1.ColorGradeImage = "LUT2"
- Case 3: table1.ColorGradeImage = "LUT3"
- Case 4: table1.ColorGradeImage = "LUT4"
- Case 5: table1.ColorGradeImage = "LUT5"
- Case 6: table1.ColorGradeImage = "LUT6"
- Case 7: table1.ColorGradeImage = "LUT7"
- Case 8: table1.ColorGradeImage = "LUT8"
- Case 9: table1.ColorGradeImage = "LUT9"
- End Select
- End Sub
- '*********************************************************************
- ' Positional Sound Playback Functions
- '*********************************************************************
- ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
- ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
- ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
- Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
- PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
- End Sub
- ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
- Sub PlaySoundAt(soundname, tableobj)
- PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBall(soundname)
- PlaySoundAt soundname, ActiveBall
- End Sub
- '*********************************************************************
- ' Supporting Ball & Sound Functions
- '*********************************************************************
- Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.y * 2 / table1.height-1
- If tmp > 0 Then
- AudioFade = Csng(tmp ^10)
- Else
- AudioFade = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.x * 2 / table1.width-1
- If tmp > 0 Then
- AudioPan = Csng(tmp ^10)
- Else
- AudioPan = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2 / 2000)
- End Function
- Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
- Pitch = BallVel(ball) * 20
- End Function
- Function BallVel(ball) 'Calculates the ball speed
- BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
- End Function
- '********************************************************************
- ' JP's VP10 Rolling Sounds (+rothbauerw's Dropping Sounds)
- '********************************************************************
- Const tnob = 5 ' total number of balls
- ReDim rolling(tnob)
- InitRolling
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingTimer_Timer()
- Dim BOT, b
- BOT = GetBalls
- ' stop the sound of deleted balls
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound "fx_ballrolling" & b
- StopSound "fx_plasticrolling" & b
- StopSound "fx_metalrolling" & b
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' play the rolling sound for each ball
- For b = 0 to UBound(BOT)
- If BallVel(BOT(b) ) > 1 Then
- rolling(b) = True
- If BOT(b).Z > 30 Then
- ' ball on plastic ramp
- StopSound "fx_ballrolling" & b
- StopSound "fx_metalrolling" & b
- PlaySound "fx_plasticrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- Else
- ' ball on playfield
- StopSound "fx_plasticrolling" & b
- StopSound "fx_metalrolling" & b
- PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- End If
- Else
- If rolling(b) Then
- StopSound "fx_ballrolling" & b
- StopSound "fx_plasticrolling" & b
- StopSound "fx_metalrolling" & b
- rolling(b) = False
- End If
- End If
- ' ball drop sounds matching the adjusted height params but not the way down the ramps
- If BOT(b).VelZ < -1 And BOT(b).Z < 55 And BOT(b).Z > 27 then 'And Not InRect(BOT(b).X, BOT(b).Y, 610,320, 740,320, 740,550, 610,550) And Not InRect(BOT(b).X, BOT(b).Y, 180,400, 230,400, 230, 550, 180,550) Then
- PlaySound "fx_ball_drop" & Int(Rnd()*3), 0, ABS(BOT(b).VelZ)/17*5, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- End If
- Next
- End Sub
- '**********************
- ' Ball Collision Sound
- '**********************
- Sub OnBallBallCollision(ball1, ball2, velocity)
- PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
- End Sub
- '*****************************************
- ' ninuzzu's FLIPPER SHADOWS
- '*****************************************
- sub FlipperTimer_Timer()
- FlipperLSh.RotZ = LeftFlipper.currentangle
- FlipperRSh.RotZ = RightFlipper.currentangle
- FlipperLSh1.RotZ = LeftFlipper1.currentangle-15
- FlipperRSh1.RotZ = RightFlipper1.currentangle+15
- FlipperT1.Roty = FlipperLSh1.RotZ + 240
- FlipperT2.Roty = FlipperRSh1.RotZ - 240
- FlipperT3.Roty = FlipperLSh1.RotZ + 240
- FlipperT4.Roty = FlipperRSh1.RotZ - 240
- P_LeftFlipperWing.RotZ = FlipperLSh1.RotZ + 250
- P_RightFlipperWing.RotZ = FlipperRSh1.RotZ - 250
- End Sub
- '*****************************************
- ' ninuzzu's BALL SHADOW
- '*****************************************
- Dim BallShadow
- BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
- dim ShadowRadiusLimit, BallDistance
- ShadowRadiusLimit = 588 / 2 + Ballsize*2 ' 588 is the diameter of the moving playfield
- Sub BallShadowUpdate_timer()
- Dim BOT, b
- BOT = GetBalls
- ' hide shadow of deleted balls
- If UBound(BOT)<(tnob-1) Then
- For b = (UBound(BOT) + 1) to (tnob-1)
- BallShadow(b).visible = 0
- Next
- End If
- ' exit the Sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' render the shadow for each ball
- For b = 0 to UBound(BOT)
- 'If BOT(b).X < Table1.Width/2 Then
- ' BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) + 6
- 'Else
- ' BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) - 6
- 'End If
- BallShadow(b).X = (BOT(b).X)
- ballShadow(b).Y = BOT(b).Y + 12
- ballShadow(b).Z = BOT(b).Z - Ballsize' / 2
- BallDistance=Sqr(((ballShadow(b).X-Primitive98.X)^2)+((ballShadow(b).Y-Primitive98.Y)^2))
- If ((BallDistance> ShadowRadiusLimit) Or (MovingPFIsUp)) And (ballShadow(b).Z > 0) then
- BallShadow(b).visible = 1
- Else
- BallShadow(b).visible = 0
- End If
- Next
- End Sub
- '************************************
- ' What you need to add to your table
- '************************************
- ' a timer called RollingTimer. With a fast interval, like 10
- ' one collision sound, in this script is called fx_collide
- ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
- ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
- '******************************************
- ' Explanation of the rolling sound routine
- '******************************************
- ' sounds are played based on the ball speed and position
- ' the routine checks first for deleted balls and stops the rolling sound.
- ' The For loop goes through all the balls on the table and checks for the ball speed and
- ' if the ball is on the table (height lower than 30) then then it plays the sound
- ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
- ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
- ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
- ' according to the position of the ball on the table.
- '**************************************
- ' Explanation of the collision routine
- '**************************************
- ' The collision is built in VP.
- ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
- ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
- ' depending of the speed of the collision.
- Sub Pins_Hit (idx)
- PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Targets_Hit (idx)
- PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Thin_Hit (idx)
- PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Medium_Hit (idx)
- PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals2_Hit (idx)
- PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Spinner_Spin
- PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
- End Sub
- Sub Rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 20 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 20 then
- RandomSoundRubber()
- End If
- End Sub
- Sub Posts_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- RandomSoundRubber()
- End If
- End Sub
- Sub RandomSoundRubber()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- Sub LeftFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RightFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RandomSoundFlipper()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- Sub LNailWall_Hit()
- Metals_Thin_Hit(1)
- End Sub
- Sub RNailWall_Hit()
- Metals_Thin_Hit(1)
- End Sub
- Sub Nail001_Hit()
- Metals_Thin_Hit(1)
- End Sub
Add Comment
Please, Sign In to add comment