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="eldorado",UseSolenoids=2,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
- LoadVPM "01120100", "sys80.vbs", 3.02
- Dim DesktopMode:DesktopMode = Table1.ShowDT
- ' Thalamus 2020 June : Improved directional sounds
- ' !! NOTE : Table not verified yet !!
- ' Outhere 2020 June: Add DOF for the Bumpers and Slingshots
- ' Slingshot Left 101
- ' Slingshot Right 102
- ' Bumper 103
- ' Bumper 104
- ' Options
- ' Volume devided by - lower gets higher sound
- Const VolDiv = 5000 ' Lower number, louder ballrolling/collition sound
- Const VolCol = 10 ' Ball collition divider ( voldiv/volcol )
- '*************************************************************
- 'Solenoid Call backs
- '**********************************************************************************************************
- SolCallback(5) = "dtRBank.SolDropUp"
- SolCallback(6) = "dtTbank.SolDropUp"
- solcallback(8) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
- solcallback(9) = "bsTrough.SolOut"
- SolCallback(sLRFlipper) = "SolRFlipper"
- SolCallback(sLLFlipper) = "SolLFlipper"
- Sub SolLFlipper(Enabled)
- If Enabled Then
- PlaySoundAtVol"fx_Flipperup", LeftFlipper, 1:LeftFlipper.RotateToEnd:LeftFlipper1.RotateToEnd
- Else
- PlaySoundAtVol "fx_Flipperdown", LeftFlipper, 1:LeftFlipper.RotateToStart:LeftFlipper1.RotateToStart
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- PlaySoundAtVol"fx_Flipperup", RightFlipper, 1:RightFlipper.RotateToEnd:RightFlipper1.RotateToEnd
- Else
- PlaySoundAtVol "fx_Flipperdown", RightFlipper, 1:RightFlipper.RotateToStart:RightFlipper1.RotateToStart
- End If
- End Sub
- '**********************************************************************************************************
- '**********************************************************************************************************
- '**********************************************************************************************************
- 'Primitive Flipper Code
- Sub FlipperTimer_Timer
- FlipperT1.roty = LeftFlipper.currentangle + 90
- FlipperT2.roty = LeftFlipper.currentangle + 110
- FlipperT5.roty = RightFlipper.currentangle + 90
- FlipperT3.roty = RightFlipper1.currentangle - 90
- End Sub
- '**********************************************************************************************************
- 'Solenoid Controlled toys
- '**********************************************************************************************************
- '*****GI Lights On
- dim xx
- For each xx in GI:xx.State = 1: Next
- '**********************************************************************************************************
- 'Initiate Table
- '**********************************************************************************************************
- Dim bsTrough, dtRBank, dtTBank
- 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 = "El Dorado City of Gold (Gottlieb)"&chr(13)&"You Suck"
- .HandleMechanics=0
- .HandleKeyboard=0
- .ShowDMDOnly=1
- .ShowFrame=0
- .ShowTitle=0
- .hidden = 0
- On Error Resume Next
- Controller.SolMask(0)=0
- vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'"
- .Run GetPlayerHWnd
- If Err Then MsgBox Err.Description
- On Error Goto 0
- End With
- On Error Goto 0
- PinMAMETimer.Interval = PinMAMEInterval
- PinMAMETimer.Enabled = 1
- ' Nudging
- vpmNudge.TiltSwitch = 57
- vpmNudge.Sensitivity = 1
- vpmNudge.TiltObj = Array(Bumper1, Bumper2, LeftSlingshot, RightSlingshot)
- ' Trough
- Set bsTrough = New cvpmBallStack
- bsTrough.InitSw 0, 67, 0, 0, 0, 0, 0, 0
- bsTrough.InitKick BallRelease, 80, 6
- bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
- bsTrough.Balls = 1
- ' Top Drop targets
- set dtTBank = new cvpmdroptarget
- dtTBank.InitDrop Array(sw0, sw10, sw20, sw30, sw40, sw1, sw11, sw21, sw31, sw41), Array(0, 10, 20, 30, 40, 1, 11, 21, 31, 41)
- dtTBank.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
- ' Right Drop targets
- set dtRBank = new cvpmdroptarget
- dtRBank.InitDrop Array(sw2, sw12, sw22, sw32, sw42), Array(2, 12, 22, 32, 42)
- dtRBank.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
- End Sub
- '**********************************************************************************************************
- 'Plunger code
- '**********************************************************************************************************
- Sub Table1_KeyDown(ByVal KeyCode)
- If KeyDownHandler(keycode) Then Exit Sub
- If keycode = PlungerKey Then Plunger.Pullback:playsoundAtVol"plungerpull", Plunger, 1
- End Sub
- Sub Table1_KeyUp(ByVal KeyCode)
- If KeyUpHandler(keycode) Then Exit Sub
- If keycode = PlungerKey Then Plunger.Fire:PlaySoundAtVol"plunger", Plunger, 1
- End Sub
- '**********************************************************************************************************
- 'Drain & holes
- Sub Drain_Hit:playsoundAtVol"drain", Drain, 1:bsTrough.addball me:End Sub
- 'Bumpers
- Sub Bumper1_Hit : vpmTimer.PulseSw(55) : PlaySound SoundFX("fx_bumper1", DOFContactors): DOF 103, DOFPulse: End Sub
- Sub Bumper2_Hit : vpmTimer.PulseSw(55) : PlaySound SoundFX("fx_bumper1", DOFContactors): DOF 104, DOFPulse: End Sub
- 'Wire Triggers
- Sub sw53_Hit:Controller.Switch(53) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw53_UnHit:Controller.Switch(53) = 0:End Sub
- Sub sw63_Hit:Controller.Switch(63) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw63_UnHit:Controller.Switch(63) = 0:End Sub
- Sub sw54_Hit:Controller.Switch(54) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw54_UnHit:Controller.Switch(54) = 0:End Sub
- Sub sw64_Hit:Controller.Switch(64) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw64_UnHit:Controller.Switch(64) = 0:End Sub
- Sub sw52_Hit:Controller.Switch(52) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw52_UnHit:Controller.Switch(52) = 0:End Sub
- Sub sw62_Hit:Controller.Switch(62) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw62_UnHit:Controller.Switch(62) = 0:End Sub
- Sub sw61_Hit:Controller.Switch(61) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw61_UnHit:Controller.Switch(61) = 0:End Sub
- Sub sw50_Hit:Controller.Switch(50) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw50_UnHit:Controller.Switch(50) = 0:End Sub
- Sub sw60_Hit:Controller.Switch(60) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw60_UnHit:Controller.Switch(60) = 0:End Sub
- Sub sw51_Hit:Controller.Switch(51) = 1 : playsoundAtVol"rollover" , ActiveBall, 1: End Sub
- Sub sw51_UnHit:Controller.Switch(51) = 0:End Sub
- ' Stand Up Targets
- Sub sw65_Hit:vpmTimer.PulseSw 65:End Sub
- Sub sw65a_Hit:vpmTimer.PulseSw 65:End Sub
- ' Droptargets
- Sub sw0_Dropped :dtTBank.hit 1:End Sub
- Sub sw10_Dropped:dtTBank.hit 2:End Sub
- Sub sw20_Dropped:dtTBank.hit 3:End Sub
- Sub sw30_Dropped:dtTBank.hit 4:End Sub
- Sub sw40_Dropped:dtTBank.hit 5:End Sub
- Sub sw1_Dropped:dtTBank.hit 6:End Sub
- Sub sw11_Dropped:dtTBank.hit 7:End Sub
- Sub sw21_Dropped:dtTBank.hit 8:End Sub
- Sub sw31_Dropped:dtTBank.hit 9:End Sub
- Sub sw41_Dropped:dtTBank.hit 10:End Sub
- Sub sw2_Dropped:dtRBank.hit 1:End Sub
- Sub sw12_Dropped:dtRBank.hit 2:End Sub
- Sub sw22_Dropped:dtRBank.hit 3:End Sub
- Sub sw32_Dropped:dtRBank.hit 4:End Sub
- Sub sw42_Dropped:dtRBank.hit 5:End Sub
- ' Slings & Rubbers
- Sub Sling1_SlingShot:vpmTimer.PulseSw 66:PlaySoundAtVol "fx_rubber2", ActiveBall, .12:End Sub
- Sub Sling2_SlingShot:vpmTimer.PulseSw 66:PlaySoundAtVol "fx_rubber2", ActiveBall, .12:End Sub
- Sub Sling3_SlingShot:vpmTimer.PulseSw 66:PlaySoundAtVol "fx_rubber2", ActiveBall, .12:End Sub
- Sub Sling4_SlingShot:vpmTimer.PulseSw 66:PlaySoundAtVol "fx_rubber2", ActiveBall, .12:End Sub
- Sub Sling5_SlingShot:vpmTimer.PulseSw 66:PlaySoundAtVol "fx_rubber2", ActiveBall, .12:End Sub
- Sub Sling6_SlingShot:vpmTimer.PulseSw 66:PlaySoundAtVol "fx_rubber2", ActiveBall, .12:End Sub
- Sub Sling7_SlingShot:vpmTimer.PulseSw 66:PlaySoundAtVol "fx_rubber2", ActiveBall, .12:End Sub
- '************************************************************************************************************************
- '************************************************************************************************************************
- '************************************************************************************************************************
- '************************************************************************************************************************
- 'NFadeL 2, l2 'always on
- Set Lights(3) = l3
- Set Lights(4) = l4
- Set Lights(5) = l5
- Set Lights(6) = l6
- Set Lights(7) = l7
- Set Lights(12) = l12
- Set Lights(13) = l13
- Set Lights(14) = l14
- Set Lights(15) = l15
- Set Lights(16) = l16
- Set Lights(17) = l17
- Set Lights(18) = l18
- Set Lights(19) = l19
- Set Lights(20) = l20
- Set Lights(21) = l21
- Set Lights(22) = l22
- Set Lights(23) = l23
- Set Lights(24) = l24
- Set Lights(25) = l25
- Set Lights(26) = l26
- Set Lights(27) = l27
- Set Lights(28) = l28
- Set Lights(29) = l29
- Set Lights(30) = l30
- Set Lights(31) = l31
- Set Lights(32) = l32
- Set Lights(33) = l33
- Set Lights(34) = l34
- Set Lights(35) = l35
- Set Lights(36) = l36
- Set Lights(37) = l37
- Set Lights(38) = l38
- Set Lights(39) = l39
- Set Lights(40) = l40
- Set Lights(41) = l41
- Set Lights(42) = l42
- Set Lights(43) = l43
- Set Lights(44) = l44
- Set Lights(45) = l45
- Set Lights(46) = l46
- Set Lights(47) = l47
- 'Lights(90) = array(l90,l90a) 'bumper 1
- 'Lights(91) = array(l91,l91a) 'bumper 2
- 'BackGlass
- 'Set Lights(10) = l10 'Highscore
- 'Set Lights(11) = l11 'GAME OVER
- 'Gottlieb El Dorado City of Gold
- Sub editDips
- Dim vpmDips:Set vpmDips = New cvpmDips
- With vpmDips
- .AddForm 700, 400, "El Dorado City of Gold - DIP switches"
- .AddFrame 2, 2, 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, "Game mode", &H10000000, Array("replay", 0, "extra ball", &H10000000) 'dip 29
- .AddChk 2, 227, 190, Array("Match feature", &H02000000) 'dip 26
- .AddChk 2, 248, 190, Array("Background sound", &H40000000) 'dip 31
- .AddFrame 205, 2, 190, "High score 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 ball", &H04000000) 'dip 27
- .AddFrame 205, 172, 190, "Novelty", &H08000000, Array("normal", 0, "points", &H0800000) 'dip 28
- .AddFrame 205, 218, 190, "3rd coin chute credits control", &H20000000, Array("no effect", 0, "add 9", &H20000000) 'dip 30
- .AddLabel 50, 270, 300, 20, "After hitting OK, press F3 to reset game with new settings."
- .ViewDips
- End With
- End Sub
- Set vpmShowDips = GetRef("editDips")
- ' ********************************************************************************************************************************
- ' ********************************************************************************************************************************
- 'Start of VPX Call Back Functions
- ' ********************************************************************************************************************************
- ' ********************************************************************************************************************************
- '**********Sling Shot Animations
- ' Rstep and Lstep are the variables that increment the animation
- '****************
- Dim RStep, Lstep
- Sub RightSlingShot_Slingshot
- vpmTimer.PulseSw 66
- PlaySoundAtVol SoundFX("right_slingshot",DOFContactors), sling1, 1
- DOF 102, DOFPulse
- RSling.Visible = 0
- RSling1.Visible = 1
- sling1.TransZ = -20
- RStep = 0
- RightSlingShot.TimerEnabled = 1
- End Sub
- Sub RightSlingShot_Timer
- Select Case RStep
- Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
- Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
- End Select
- RStep = RStep + 1
- End Sub
- Sub LeftSlingShot_Slingshot
- vpmTimer.PulseSw 66
- PlaySoundAtVol SoundFX("left_slingshot",DOFContactors), sling2, 1
- DOF 101, DOFPulse
- LSling.Visible = 0
- LSling1.Visible = 1
- sling2.TransZ = -20
- LStep = 0
- LeftSlingShot.TimerEnabled = 1
- End Sub
- Sub LeftSlingShot_Timer
- Select Case LStep
- Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
- Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
- End Select
- LStep = LStep + 1
- End Sub
- ' *******************************************************************************************************
- ' Positional Sound Playback Functions by DJRobX, Rothbauerw, Thalamus and Herweh
- ' PlaySound sound, 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
- ' *******************************************************************************************************
- ' 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
- ' Set position as table object (Use object or light but NOT wall) and Vol to 1
- Sub PlaySoundAt(soundname, tableobj)
- PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- ' set position as table object and Vol + RndPitch manually
- Sub PlaySoundAtVolPitch(sound, tableobj, Vol, RndPitch)
- PlaySound sound, 1, Vol, AudioPan(tableobj), RndPitch, 0, 0, 1, AudioFade(tableobj)
- End Sub
- 'Set all as per ball position & speed.
- Sub PlaySoundAtBall(soundname)
- PlaySoundAt soundname, ActiveBall
- End Sub
- 'Set position as table object and Vol manually.
- Sub PlaySoundAtVol(sound, tableobj, Volume)
- PlaySound sound, 1, Volume, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- 'Set all as per ball position & speed, but Vol Multiplier may be used eg; PlaySoundAtBallVol "sound",3
- Sub PlaySoundAtBallVol(sound, VolMult)
- PlaySound sound, 0, Vol(ActiveBall) * VolMult, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
- End Sub
- Sub PlaySoundAtBallAbsVol(sound, VolMult)
- PlaySound sound, 0, VolMult, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
- End Sub
- ' requires rampbump1 to 7 in Sound Manager
- Sub RandomBump(voladj, freq)
- Dim BumpSnd:BumpSnd= "rampbump" & CStr(Int(Rnd*7)+1)
- PlaySound BumpSnd, 0, Vol(ActiveBall)*voladj, AudioPan(ActiveBall), 0, freq, 0, 1, AudioFade(ActiveBall)
- End Sub
- ' set position as bumperX and Vol manually. Allows rapid repetition/overlaying sound
- Sub PlaySoundAtBumperVol(sound, tableobj, Vol)
- PlaySound sound, 1, Vol, AudioPan(tableobj), 0,0,1, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBOTBallZ(sound, BOT)
- PlaySound sound, 0, ABS(BOT.velz)/17, Pan(BOT), 0, Pitch(BOT), 1, 0, AudioFade(BOT)
- End Sub
- ' play a looping sound at a location with volume
- Sub PlayLoopSoundAtVol(sound, tableobj, Vol)
- PlaySound sound, -1, Vol, AudioPan(tableobj), 0, 0, 1, 0, AudioFade(tableobj)
- End Sub
- '*********************************************************************
- ' Supporting Ball & Sound Functions
- '*********************************************************************
- Function RndNum(min, max)
- RndNum = Int(Rnd() * (max-min + 1) ) + min ' Sets a random number between min and max
- End Function
- 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
- On Error Resume Next
- 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
- On Error Resume Next
- 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 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
- On Error Resume Next
- 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 Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2 / VolDiv)
- End Function
- Function VolMulti(ball,Multiplier) ' Calculates the Volume of the sound based on the ball speed
- VolMulti = Csng(BallVel(ball) ^2 / 150 ) * Multiplier
- End Function
- Function DVolMulti(ball,Multiplier) ' Calculates the Volume of the sound based on the ball speed
- DVolMulti = Csng(BallVel(ball) ^2 / 150 ) * Multiplier
- debug.print DVolMulti
- End Function
- Function BallRollVol(ball) ' Calculates the Volume of the sound based on the ball speed
- BallRollVol = Csng(BallVel(ball) ^2 / (80000 - (79900 * Log(RollVol) / Log(100))))
- 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
- Function BallVelZ(ball) 'Calculates the ball speed in the -Z
- BallVelZ = INT((ball.VelZ) * -1 )
- End Function
- Function VolZ(ball) ' Calculates the Volume of the sound based on the ball speed in the Z
- VolZ = Csng(BallVelZ(ball) ^2 / 200)*1.2
- End Function
- '*** Determines if a Points (px,py) is inside a 4 point polygon A-D in Clockwise/CCW order
- Function InRect(px,py,ax,ay,bx,by,cx,cy,dx,dy)
- Dim AB, BC, CD, DA
- AB = (bx*py) - (by*px) - (ax*py) + (ay*px) + (ax*by) - (ay*bx)
- BC = (cx*py) - (cy*px) - (bx*py) + (by*px) + (bx*cy) - (by*cx)
- CD = (dx*py) - (dy*px) - (cx*py) + (cy*px) + (cx*dy) - (cy*dx)
- DA = (ax*py) - (ay*px) - (dx*py) + (dy*px) + (dx*ay) - (dy*ax)
- If (AB <= 0 AND BC <=0 AND CD <= 0 AND DA <= 0) Or (AB >= 0 AND BC >=0 AND CD >= 0 AND DA >= 0) Then
- InRect = True
- Else
- InRect = False
- End If
- 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
- For b = 0 to UBound(BOT)
- If BallVel(BOT(b) ) > 1 Then
- rolling(b) = True
- if BOT(b).z < 30 Then ' Ball on playfield
- PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), AudioPan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0, AudioFade(BOT(b) )
- Else ' Ball on raised ramp
- PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) )*.5, AudioPan(BOT(b) ), 0, Pitch(BOT(b) )+50000, 1, 0, AudioFade(BOT(b) )
- End If
- 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 / (VolDiv/VolCol), AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
- 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, PAN and PITCH functions, so the volume and pitch of the sound
- ' will change according to the ball speed, and the PAN function will change the stereo position according
- ' to the position of the ball on the table.
- '**************************************
- ' Explanation of the collision routine
- '**************************************
- ' The 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, VolMulti(ActiveBall,.15), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Targets_Hit (idx)
- PlaySound "target", 0, VolMulti(ActiveBall,.15), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Thin_Hit (idx)
- PlaySound "metalhit_thin", 0, VolMulti(ActiveBall,.15), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Medium_Hit (idx)
- PlaySound "metalhit_medium", 0, VolMulti(ActiveBall,.15), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals2_Hit (idx)
- PlaySound "metalhit2", 0, VolMulti(ActiveBall,.15), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate4", 0, VolMulti(ActiveBall,.15), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Gate2_Hit():PlaySound "gate4":End Sub
- Sub Spinner_Spin
- PlaySound "fx_spinner",0,.25,0,0.25
- End Sub
- Sub Rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 20 then
- PlaySound "fx_rubber2", 0, VolMulti(ActiveBall,.15), Pan(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, VolMulti(ActiveBall,.15), Pan(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, VolMulti(ActiveBall,.2), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "rubber_hit_2", 0, VolMulti(ActiveBall,.2), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "rubber_hit_3", 0, VolMulti(ActiveBall,.2), Pan(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, VolMulti(ActiveBall,.1), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "flip_hit_2", 0, VolMulti(ActiveBall,.1), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "flip_hit_3", 0, VolMulti(ActiveBall,.1), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- ' Thalamus : Exit in a clean and proper way
- Sub Table1_exit()
- Controller.Pause = False
- Controller.Stop
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment