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 BallSize = 50 ' sets the ball size
- Const BallMass = 1.8 ' sets the ball mass
- LoadVPM "01560000","SYS80.VBS",3.2
- Const cgamename = "arena", UseSolenoids=2,UseLamps=1,SCoin="coin3"
- Dim DesktopMode: DesktopMode = Table1.ShowDT
- If DesktopMode = True Then 'Show Desktop components
- Ramp001.visible=1
- Ramp002.visible=1
- Primitive019.visible=1
- Else
- Ramp001.visible=0
- Ramp002.visible=0
- Primitive019.visible=0
- End if
- '*************************************************************
- 'Solenoid Call backs
- '**********************************************************************************************************
- SolCallback(1) = "Sol1" 'Light left backdrop skull F1
- SolCallback(2) = "DropTargetBank.soldropup"
- SolCallback(3) = "Sol3" 'Light right backdrop skull F3
- SolCallback(4) = "Sol4" 'Ramp entrance Flasher F4
- SolCallback(5) = "bsSecondKicker.solout"
- SolCallback(6) = "bsFirstkicker.solout"
- SolCallback(7) = "Sol7" 'Ramp made Flasher F7
- SolCallback(8) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker)," 'Knocker
- SolCallback(9) = "bsTrough.SolIn"
- SolCallback(10)= "Sol10" 'GameOn
- SolCallback(sLRFlipper) = "SolRFlipper"
- SolCallback(sLLFlipper) = "SolLFlipper"
- Sub SolLFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("flipperup",DOFFlippers):LeftFlipper.RotateToEnd
- Else
- PlaySound SoundFX("flipperdown",DOFFlippers):LeftFlipper.RotateToStart
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("flipperup",DOFFlippers):RightFlipper.RotateToEnd
- Else
- PlaySound SoundFX("flipperdown",DOFFlippers):RightFlipper.RotateToStart
- End If
- End Sub
- '**********************************************************************************************************
- 'Solenoid Controlled toys
- '**********************************************************************************************************
- Sub Sol1(enabled)
- if enabled then
- F1a.state=1
- ' F1b.state=1
- playsound "fx_relay"
- else
- F1a.state=0
- ' F1b.state=0
- end if
- End Sub
- Sub Sol3(enabled)
- if enabled then
- F3a.state=1
- ' F3b.state=1
- playsound "fx_relay"
- else
- F3a.state=0
- ' F3b.state=0
- end if
- End Sub
- Sub Sol4(enabled)
- if enabled then
- F4a.state=1
- F4b.state=1
- playsound "fx_relay"
- else
- F4a.state=0
- F4b.state=0
- end if
- End Sub
- Sub Sol7(enabled)
- if enabled then
- F7a.state=1
- F7b.state=1
- playsound "fx_relay"
- else
- F7a.state=0
- F7b.state=0
- end if
- End Sub
- Dim FlipperActive
- Sub Sol10(enabled)
- FlipperActive = Enabled
- End Sub
- 'Playfield GI
- '*****GI Lights On
- dim xx
- For each xx in GI:xx.State = 1: Next
- '**********************************************************************************************************
- 'Initiate Table
- '**********************************************************************************************************
- Dim bsTrough,bsFirstKicker,bsSecondKicker,DropTargetBank,obj
- '
- 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 = "Sega Viper Night Drivin'"&chr(13)&"You Suck"
- .HandleMechanics=0
- .HandleKeyboard=0
- .ShowDMDOnly=1
- .ShowFrame=0
- .ShowTitle=0
- .hidden = 0
- .Games(cGameName).Settings.Value("sound")=1
- '.PuPHide = 1
- On Error Resume Next
- .Run GetPlayerHWnd
- If Err Then MsgBox Err.Description
- On Error Goto 0
- End With
- On Error Goto 0
- PinMAMETimer.Interval=PinMAMEInterval
- PinMAMETimer.Enabled= true
- vpmNudge.TiltSwitch=57
- vpmNudge.Sensitivity=5
- vpmNudge.TiltObj=Array(LeftslingShot,RightslingShot)
- Set bsTrough=New cvpmBallStack
- bsTrough.InitSw 66,0,0,20,0,0,0,0
- bsTrough.Balls=3
- bsTrough.initkick BallRelease,90,5
- bsTrough.InitExitSnd SoundFX("BallRel",DOFContactors),SoundFX("Solenoid",DOFContactors)
- Set bsFirstKicker=New cvpmBallStack
- bsFirstKicker.InitSaucer Kicker21,21,120,5
- bsFirstKicker.InitExitSnd SoundFX("Kicker",DOFContactors),SoundFX("solon",DOFContactors)
- Set bsSecondKicker=New cvpmBallStack
- bsSecondKicker.InitSaucer Kicker31,31,120,5
- bsSecondKicker.InitExitSnd SoundFX("Kicker",DOFContactors),SoundFX("solon",DOFContactors)
- Set DropTargetBank=New cvpmDropTarget
- DropTargetBank.InitDrop array(DT40,DT50,DT60,DT70), Array(40,50,60,70)
- DropTargetBank.InitSnd SoundFX("Targetdrop1",DOFDropTargets),SoundFX("TargetBankreset1",DOFContactors)
- DropTargetBank.CreateEvents "DropTargetBank"
- vpmMapLights AllLights
- End Sub
- Sub Table1_Exit()
- Controller.Pause = False
- Controller.Stop
- 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=LeftFlipperKey Then
- Controller.Switch(6)=1
- if FlipperActive then
- end if
- end if
- If KeyCode=RightFlipperKey Then
- Controller.Switch(16)=1
- Controller.Switch(45)=1
- if FlipperActive then
- end if
- end if
- If vpmKeyDown(KeyCode) Then Exit Sub
- If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
- End Sub
- Sub Table1_KeyUp(ByVal KeyCode)
- If keycode = LeftMagnaSave Then bLutActive = False
- If KeyCode=LeftFlipperKey Then
- Controller.Switch(6)=0
- if FlipperActive then
- end if
- end if
- If KeyCode=RightFlipperKey Then
- Controller.Switch(16)=0
- Controller.Switch(45)=0
- if FlipperActive then
- end if
- end if
- If vpmKeyUp(KeyCode) Then Exit Sub
- If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
- End Sub
- '**********************************************************************************************************
- ' Drain hole and kickers
- '**********************************************************************************************************
- Sub Drain_Hit:bsTrough.AddBall Me :playsound"drain5" : End Sub
- '------------------------------
- '------ Switch Handler ------
- '------------------------------
- Sub Kicker21_hit:bsFirstKicker.addball me:End Sub
- Sub Kicker31_hit:bsSecondKicker.addball me:End Sub
- '------------------------------
- '------ Gates & Spinner ------
- '------------------------------
- sub Trigger34_hit:Controller.Switch(34)=1:PlaySound "Gate5",0,0.1,-0.05,0.1:End Sub
- sub Gate4_hit:PlaySound "Gate5",0,0.1,-0.05,0.1:End Sub
- sub Gate5_hit:PlaySound "Gate5",0,0.1,-0.05,0.1:End Sub
- Sub Spinner24_Spin:vpmTimer.PulseSwitch 24,0,0:playsound "fx_spinner",0,0.1,-0.1,0.1:End Sub
- '------------------------------
- '------ Wire Triggers ------
- '------------------------------
- sub Trigger30_hit:Controller.Switch(30)=1:PlaySound "rollover",0,0.1,-0.08,0.1:End Sub
- sub Trigger30_unhit:Controller.Switch(30)=0:End Sub
- sub Trigger22_hit:Controller.Switch(22)=1:PlaySound "rollover",0,0.1,-0.18,0.1:End Sub
- sub Trigger22_unhit:Controller.Switch(22)=0:End Sub
- sub Trigger32_hit:Controller.Switch(32)=1:PlaySound "rollover",0,0.1,-0.15,0.1:End Sub
- sub Trigger32_unhit:Controller.Switch(32)=0:End Sub
- sub Trigger42_hit:Controller.Switch(42)=1:PlaySound "rollover",0,0.1,-0.12,0.1:End Sub
- sub Trigger42_unhit:Controller.Switch(42)=0:End Sub
- sub Trigger41_hit:Controller.Switch(41)=1:PlaySound "rollover",0,0.1,-0.05,0.1:End Sub
- sub Trigger41_unhit:Controller.Switch(41)=0:End Sub
- sub Trigger51_hit:Controller.Switch(51)=1:PlaySound "rollover",0,0.1,-0.05,0.1:End Sub
- sub Trigger51_unhit:Controller.Switch(51)=0:End Sub
- sub Trigger61_hit:Controller.Switch(61)=1:PlaySound "rollover",0,0.1,-0.05,0.1:End Sub
- sub Trigger61_unhit:Controller.Switch(61)=0:End Sub
- sub Trigger71_hit:Controller.Switch(71)=1:PlaySound "rollover",0,0.1,-0.05,0.1:End Sub
- sub Trigger71_unhit:Controller.Switch(71)=0:End Sub
- sub Trigger44_hit:Controller.Switch(44)=1:PlaySound "rollover",0,0.1,-0.05,0.1:End Sub
- sub Trigger44_unhit:Controller.Switch(44)=0:End Sub
- sub Trigger55_hit:Controller.Switch(55)=1:PlaySound "rollover",0,0.1,0.15,0.1:End Sub
- sub Trigger55_unhit:Controller.Switch(55)=0:End Sub
- sub Trigger54_hit:Controller.Switch(54)=1:PlaySound "rollover",0,0.1,-0.18,0.1:End Sub
- sub Trigger54_unhit:Controller.Switch(54)=0:End Sub
- sub Trigger74_hit:Controller.Switch(74)=1:PlaySound "rollover",0,0.1,-0.18,0.1:End Sub
- sub Trigger74_unhit:Controller.Switch(74)=0:End Sub
- sub Trigger64_hit:Controller.Switch(64)=1:PlaySound "rollover",0,0.1,-0.16,0.1:End Sub
- sub Trigger64_unhit:Controller.Switch(64)=0:End Sub
- sub Trigger65_hit:Controller.Switch(65)=1:PlaySound "rollover",0,0.1,0.12,0.1:End Sub
- sub Trigger65_unhit:Controller.Switch(65)=0:End Sub
- sub Trigger75_hit:Controller.Switch(75)=1:PlaySound "rollover",0,0.1,0.15,0.1:End Sub
- sub Trigger75_unhit:Controller.Switch(75)=0:End Sub
- '------------------------------
- '------ Drop Targets ------
- '------------------------------
- Sub DT40_Hit:DropTargetBank.Hit 1:End Sub '40
- Sub DT50_Hit:DropTargetBank.Hit 2:End Sub '50
- Sub DT60_Hit:DropTargetBank.Hit 3:End Sub '60
- Sub DT70_Hit:DropTargetBank.Hit 4:End Sub '70
- '------------------------------
- '------ Stand Up Targets ------
- '------------------------------
- Sub Target23_Hit:vpmTimer.PulseSw 23:PlaySound SoundFX("Target1",DOFTargets),0,1,0.02,0.25:End Sub
- Sub Target33_Hit:vpmTimer.PulseSw 33:PlaySound SoundFX("Target1",DOFTargets),0,1,0.05,0.25:End Sub
- Sub Target43_Hit:vpmTimer.PulseSw 43:PlaySound SoundFX("Target1",DOFTargets),0,1,0.08,0.25:End Sub
- Sub Target53_Hit:vpmTimer.PulseSw 53:PlaySound SoundFX("Target1",DOFTargets),0,1,0.12,0.25:End Sub
- Sub Target63_Hit:vpmTimer.PulseSw 63:PlaySound SoundFX("Target1",DOFTargets),0,1,0.12,0.25:End Sub
- Sub Target73_Hit:vpmTimer.PulseSw 73:PlaySound SoundFX("Target1",DOFTargets),0,1,0.12,0.25:End Sub
- Sub Target52_Hit:vpmTimer.PulseSw 52:PlaySound SoundFX("Target1",DOFTargets),0,1,-0.15,0.25:End Sub
- Sub Target62_Hit:vpmTimer.PulseSw 62:PlaySound SoundFX("Target1",DOFTargets),0,1,-0.15,0.25:End Sub
- Sub Target72_Hit:vpmTimer.PulseSw 72:PlaySound SoundFX("Target1",DOFTargets),0,1,-0.15,0.25:End Sub
- '**********Sling Shot Animations
- ' Rstep and Lstep are the variables that increment the animation
- '****************
- Dim RStep, Lstep
- Sub RightSlingShot_Slingshot
- vpmTimer.PulseSw 25
- DOF 102, DOFPulse
- PlaySound SoundFX("RSling",DOFContactors), 0,1,0.15,0.1 '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
- ' gi1.State = 0:Gi2.State = 0
- 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 25
- DOF 101, DOFPulse
- PlaySound SoundFX("LSling",DOFContactors), 0,1,-0.16,0.1 '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
- ' gi3.State = 0:Gi4.State = 0
- 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
- '--------------------------------
- '------ Helper Functions ------
- '--------------------------------
- 'Ramp running Light
- Dim LSPos1,LSPos2,LSPos3,LSPos4
- LSPos1 = 0
- LSPos2 = 3
- LSPos3 = 6
- LSPos4 = 9
- Sub LightSeqTimer_Timer
- LS(LSPos1).state = 0
- LS(LSPos2).state = 0
- LS(LSPos3).state = 0
- LS(LSPos4).state = 0
- LSPos1 = LSPos1 + 1
- LSPos2 = LSPos2 + 1
- LSPos3 = LSPos3 + 1
- LSPos4 = LSPos4 + 1
- if LSPos1 > 9 then
- LSPos1 = 0
- end if
- if LSPos2 > 9 then
- LSPos2 = 0
- end if
- if LSPos3 > 9 then
- LSPos3 = 0
- end if
- if LSPos4 > 9 then
- LSPos4 = 0
- end if
- LS(LSPos1).state = 1
- LS(LSPos2).state = 1
- LS(LSPos3).state = 1
- LS(LSPos4).state = 1
- End Sub
- 'Lamp Callback for Ball Release and Ballsaver
- Dim O12,OL12,O13,OL13,O14,OL14
- O12=0:OL12=0:O13=0:OL13=0:O14=0:OL14=0
- Sub LampTimer_Timer
- if Controller.Lamp(17) <> 0 then
- LightSeqTimer.enabled = True
- else
- LightSeqTimer.enabled = False
- LS(LSPos1).state = 0
- LS(LSPos2).state = 0
- LS(LSPos3).state = 0
- LS(LSPos4).state = 0
- end if
- O12=Controller.Lamp(12)
- If OL12<>O12 Then
- If O12=0 Then bsTrough.ExitSol_On
- End If
- OL12=O12
- O13=Controller.Lamp(13)
- If OL13<>O13 Then
- If (O13=0) and (O14=0) Then
- RightInlaneGate1.RotateToStart
- RightInlaneGate2.RotateToStart
- Controller.Switch(35)=0
- Else
- RightInlaneGate1.RotateToEnd
- RightInlaneGate2.RotateToEnd
- Controller.Switch(35)=1
- End If
- End If
- OL13=O13
- O14=Controller.Lamp(14)
- If OL14<>O14 Then
- If O14=0 Then
- RightOutlaneGate1.RotateToStart
- RightOutlaneGate2.RotateToStart
- Else
- RightOutlaneGate1.RotateToEnd
- RightOutlaneGate2.RotateToEnd
- End If
- End If
- OL14=O14
- End Sub
- '---------------------------------------
- 'Gottlieb Arena
- 'added by Inkochnito
- '---------------------------------------
- Sub EditDips
- Dim vpmDips:Set vpmDips = New cvpmDips
- With vpmDips
- .AddForm 700,400,"Arena - DIP switches"
- .AddFrame 2,4,190,"Maximum credits",49152,Array("8 credits",0,"10 credits",32768,"15 credits",&H00004000,"20 credits",49152)'dip 15&16
- .AddFrame 2,80,190,"Coin chute 1 and 2 control",&H00002000,Array("seperate",0,"same",&H00002000)'dip 14
- .AddFrame 2,126,190,"Playfield special",&H00200000,Array("replay",0,"extra ball",&H00200000)'dip 22
- .AddFrame 2,172,190,"High games to date control",&H00000020,Array("no effect",0,"reset high games 2-5 on power off",&H00000020)'dip 6
- .AddFrame 2,218,190,"Auto-percentage control",&H00000080,Array("disabled (normal high score mode)",0,"enabled",&H00000080)'dip 8
- .AddFrame 2,264,190,"Top 'GUARDS' targets",&H40000000,Array("are reset every ball",0,"are memorized ball to ball",&H40000000)'dip 31
- .AddFrame 2,310,190,"Completing all 6 spot targets",&H80000000,Array("2X lights special",0,"1X lights special",&H80000000)'dip 32
- .AddFrame 205,4,190,"High game to date awards",&H00C00000,Array("not displayed and no award",0,"displayed and no award",&H00800000,"displayed and 2 replays",&H00400000,"displayed and 3 replays",&H00C00000)'dip 23&24
- .AddFrame 205,80,190,"Balls per game",&H01000000,Array("5 balls",0,"3 balls",&H01000000)'dip 25
- .AddFrame 205,126,190,"Replay limit",&H04000000,Array("no limit",0,"one per game",&H04000000)'dip 27
- .AddFrame 205,172,190,"Novelty",&H08000000,Array("normal",0,"extra ball and replay scores 500K",&H08000000)'dip 28
- .AddFrame 205,218,190,"Game mode",&H10000000,Array("replay",0,"extra ball",&H10000000)'dip 29
- .AddFrame 205,264,190,"3rd coin chute credits control",&H20000000,Array("no effect",0,"add 9",&H20000000)'dip 30
- .AddChk 205,316,180,Array("Match feature",&H02000000)'dip 26
- .AddChk 205,331,190,Array("Attract sound",&H00000040)'dip 7
- .AddLabel 50,360,300,20,"After hitting OK, press F3 to reset game with new settings."
- .ViewDips
- End With
- End Sub
- Set vpmShowDips=GetRef("EditDips")
- '*************
- ' JP'S LUT
- '*************
- Dim bLutActive, LUTImage
- Sub LoadLUT
- Dim x
- x = LoadValue(cGameName, "LUTImage")
- If(x <> "") Then LUTImage = x Else LUTImage = 0
- UpdateLUT
- End Sub
- Sub SaveLUT
- SaveValue cGameName, "LUTImage", LUTImage
- End Sub
- Sub NextLUT: LUTImage = (LUTImage +1 ) MOD 10: UpdateLUT: SaveLUT: End Sub
- Sub UpdateLUT
- Select Case LutImage
- Case 0: table1.ColorGradeImage = "LUT0"
- Case 1: table1.ColorGradeImage = "LUT1"
- Case 2: table1.ColorGradeImage = "LUT2"
- Case 3: table1.ColorGradeImage = "LUT3"
- Case 4: table1.ColorGradeImage = "LUT4"
- Case 5: table1.ColorGradeImage = "LUT5"
- Case 6: table1.ColorGradeImage = "LUT6"
- Case 7: table1.ColorGradeImage = "LUT7"
- Case 8: table1.ColorGradeImage = "LUT8"
- Case 9: table1.ColorGradeImage = "LUT9"
- End Select
- End Sub
- '*********************************************************************
- ' Positional Sound Playback Functions
- '*********************************************************************
- ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
- ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
- ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
- Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
- PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
- End Sub
- ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
- Sub PlaySoundAt(soundname, tableobj)
- PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBall(soundname)
- PlaySoundAt soundname, ActiveBall
- End Sub
- '*********************************************************************
- ' Supporting Ball & Sound Functions
- '*********************************************************************
- Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.y * 2 / Table1.height-1
- If tmp > 0 Then
- AudioFade = Csng(tmp ^10)
- Else
- AudioFade = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.x * 2 / Table1.width-1
- If tmp > 0 Then
- AudioPan = Csng(tmp ^10)
- Else
- AudioPan = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2 / 2000)
- End Function
- Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
- Pitch = BallVel(ball) * 20
- End Function
- Function BallVel(ball) 'Calculates the ball speed
- BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
- End Function
- '********************************************************************
- ' JP's VP10 Rolling Sounds (+rothbauerw's Dropping Sounds)
- '********************************************************************
- Const tnob = 5 ' total number of balls
- ReDim rolling(tnob)
- InitRolling
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingTimer_Timer()
- Dim BOT, b
- BOT = GetBalls
- ' stop the sound of deleted balls
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & b)
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- For b = 0 to UBound(BOT)
- ' play the rolling sound for each ball
- If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
- rolling(b) = True
- PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- Else
- If rolling(b) = True Then
- StopSound("fx_ballrolling" & b)
- rolling(b) = False
- End If
- End If
- ' play ball drop sounds
- If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
- PlaySound "fx_ball_drop" & b, 0, ABS(BOT(b).velz)/17, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- End If
- Next
- End Sub
- '**********************
- ' Ball Collision Sound
- '**********************
- Sub OnBallBallCollision(ball1, ball2, velocity)
- PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
- End Sub
- '*****************************************
- ' ninuzzu's FLIPPER SHADOWS
- '*****************************************
- sub FlipperTimer_Timer()
- FlipperLSh.RotZ = LeftFlipper.currentangle
- FlipperRSh.RotZ = RightFlipper.currentangle
- Prim_LeftFlipper.RotY=LeftFlipper.currentangle-90
- Prim_RightFlipper.RotY=RightFlipper.currentangle-90
- End Sub
- '*****************************************
- ' ninuzzu's BALL SHADOW
- '*****************************************
- Dim BallShadow
- BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
- Sub BallShadowUpdate_timer()
- Dim BOT, b
- BOT = GetBalls
- ' hide shadow of deleted balls
- If UBound(BOT)<(tnob-1) Then
- For b = (UBound(BOT) + 1) to (tnob-1)
- BallShadow(b).visible = 0
- Next
- End If
- ' exit the Sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' render the shadow for each ball
- For b = 0 to UBound(BOT)
- If BOT(b).X < Table1.Width/2 Then
- BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
- Else
- BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
- End If
- ballShadow(b).Y = BOT(b).Y + 12
- If BOT(b).Z > 20 Then
- BallShadow(b).visible = 1
- Else
- BallShadow(b).visible = 0
- End If
- Next
- End Sub
- '************************************
- ' What you need to add to your table
- '************************************
- ' a timer called RollingTimer. With a fast interval, like 10
- ' one collision sound, in this script is called fx_collide
- ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
- ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
- '******************************************
- ' Explanation of the rolling sound routine
- '******************************************
- ' sounds are played based on the ball speed and position
- ' the routine checks first for deleted balls and stops the rolling sound.
- ' The For loop goes through all the balls on the table and checks for the ball speed and
- ' if the ball is on the table (height lower than 30) then then it plays the sound
- ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
- ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
- ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
- ' according to the position of the ball on the table.
- '**************************************
- ' Explanation of the collision routine
- '**************************************
- ' The collision is built in VP.
- ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
- ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
- ' depending of the speed of the collision.
- Sub Pins_Hit (idx)
- PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Targets_Hit (idx)
- PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Thin_Hit (idx)
- PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Medium_Hit (idx)
- PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals2_Hit (idx)
- PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Spinner_Spin
- PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
- End Sub
- Sub Rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 20 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 20 then
- RandomSoundRubber()
- End If
- End Sub
- Sub Posts_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- RandomSoundRubber()
- End If
- End Sub
- Sub RandomSoundRubber()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- Sub LeftFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RightFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RandomSoundFlipper()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- ' Ramps sounds
- Sub RampSound2_Hit: PlaySound "fx_plasticrolling1": End Sub
- Sub RampSound3_Hit: PlaySound "fx_metalrolling1": End Sub
- ' Stop Ramps Sounds
- Sub RampSound1_Hit: StopSound "fx_plasticrolling1": End Sub
- Sub RampSound1a_Hit: StopSound "fx_plasticrolling1": End Sub
- Sub RampSound4_Hit: StopSound "fx_metalrolling1": End Sub
- Sub RampSound5_Hit: StopSound "fx_plasticrolling1": End Sub
- Sub Table1_Exit
- If B2SOn Then Controller.Stop
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment