Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Split Second / IPD No. 2297 / Stern August, 1981 / 4 Players
- ' vpinmame script based on destruk's script
- ' Dip switch menu by inkochnito
- Option Explicit
- Randomize
- ' Physics 3.0.1
- Const BallSize = 50
- Const BallMass = 1.7
- 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
- Dim bsTrough, dtT, dtR, dtR2, bsLock, x
- Const cGameName = "splitsec"
- Dim VarHidden
- If Table1.ShowDT = true then
- VarHidden = 1
- For each x in aReels: x.Visible = 1: Next
- Else
- VarHidden = 0
- For each x in aReels: x.Visible = 0: Next
- End If
- if B2SOn = true then
- VarHidden = 1
- For each x in aReels: x.Visible = 0: Next
- End If
- LoadVPM "01210000", "STERN.VBS", 3.1
- '********************
- 'Standard definitions
- '********************
- Const UseSolenoids = 2
- Const UseLamps = 1
- Const UseGI = 0
- Const UseSync = 0
- Const HandleMech = 0
- ' Standard Sounds
- Const SSolenoidOn = "fx_SolenoidOn"
- Const SSolenoidOff = "fx_SolenoidOff"
- Const SCoin = "fx_Coin"
- '************
- ' Table init.
- '************
- Sub table1_Init
- vpmInit me
- With Controller
- .GameName = cGameName
- If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description:Exit Sub
- .SplashInfoLine = "Split Second, Stern 1980" & vbNewLine & "VPX table by JPSalas 1.0.0"
- .HandleKeyboard = 0
- .ShowTitle = 0
- .ShowDMDOnly = 1
- .ShowFrame = 0
- .HandleMechanics = 0
- .Hidden = VarHidden
- .Games(cGameName).Settings.Value("rol") = 0
- '.SetDisplayPosition 0,0,GetPlayerHWnd 'uncomment if you can't see the dmd
- On Error Resume Next
- Controller.SolMask(0) = 0
- vpmTimer.AddTimer 2000, "Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the Timer to renable all the solenoids after 2 seconds
- Controller.Run GetPlayerHWnd
- On Error Goto 0
- End With
- ' Nudging
- vpmNudge.TiltSwitch = 7
- vpmNudge.Sensitivity = 3
- vpmNudge.TiltObj = Array(Bumper001, Bumper002, LeftSlingshot, RightSlingshot)
- ' Trough
- Set bsTrough = New cvpmBallStack
- With bsTrough
- .InitSw 4, 33, 34, 35, 0, 0, 0, 0
- .InitKick BallRelease, 90, 4
- .InitExitSnd SoundFX("fx_ballrel", DOFContactors), SoundFX("fx_Solenoid", DOFContactors)
- .Balls = 3
- .IsTrough = 1
- End With
- ' Saucer
- Set bsLock = New cvpmBallStack
- With bsLock
- .InitSaucer Kicker1, 36, 270, 5
- .InitExitSnd SoundFX("fx_kicker", DOFContactors), SoundFX("fx_Solenoid", DOFContactors)
- .KickForceVar = 2
- .KickAngleVar = 2
- End With
- ' Drop targets
- Set dtT = New cvpmDropTarget
- With dtT
- .InitDrop Array(TargetT1, TargetT2, TargetT3, TargetT4, TargetT5), Array(28, 29, 30, 31, 32)
- .InitSnd SoundFX("fx_droptarget", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
- .CreateEvents "dtT"
- End With
- Set dtR = New cvpmDropTarget
- With dtR
- .InitDrop Array(TargetM1, TargetM2, TargetM3), Array(25, 26, 27)
- .InitSnd SoundFX("fx_droptarget", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
- .CreateEvents "dtR"
- End With
- Set dtR2 = New cvpmDropTarget
- With dtR2
- .InitDrop Array(TargetR1, TargetR2, TargetR3), Array(17, 18, 19)
- .InitSnd SoundFX("fx_droptarget", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
- .CreateEvents "dtR2"
- End With
- ' Main Timer init
- PinMAMETimer.Interval = PinMAMEInterval
- PinMAMETimer.Enabled = 1
- RealTime.Enabled = 1
- UpdateLeds.Enabled = 1
- vpmMapLights AllLights
- ' Turn on Gi
- vpmtimer.addtimer 1500, "GiOn '"
- LoadLUT
- End Sub
- '*****************
- ' Gi Effects
- '*****************
- Dim OldGiState
- OldGiState = -1 'start witht he Gi off
- Sub GiON
- For each x in aGiLights
- x.State = 1
- Next
- End Sub
- Sub GiOFF
- For each x in aGiLights
- x.State = 0
- Next
- End Sub
- Sub GiEffect(value) ' value is the duration of the blink
- For each x in aGiLights
- x.Duration 2, 500 * value, 1
- Next
- End Sub
- Sub GIUpdate
- Dim tmp, obj
- tmp = Getballs
- If UBound(tmp) <> OldGiState Then
- OldGiState = Ubound(tmp)
- If UBound(tmp) = -1 Then
- GiOff
- Else
- GiOn
- End If
- End If
- End Sub
- '*************************
- ' GI - needs new vpinmame
- '*************************
- Set GICallback = GetRef("GIUpdate")
- Sub GIUpdate(no, Enabled)
- For each x in aGiLights
- x.State = ABS(Enabled)
- Next
- End Sub
- '******************
- ' RealTime Updates
- '******************
- Sub RealTime_Timer
- RollingUpdate
- LeftFlipperTop.RotZ = LeftFlipper.CurrentAngle
- RightFlipperTop.RotZ = RightFlipper.CurrentAngle
- RightFlipperTop2.RotZ = RightFlipper2.CurrentAngle
- End Sub
- '**********
- ' Keys
- '**********
- Sub table1_KeyDown(ByVal Keycode)
- If keycode = LeftTiltKey Then Nudge 90, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25
- If keycode = RightTiltKey Then Nudge 270, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25
- If keycode = CenterTiltKey Then Nudge 0, 8:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25
- If keycode = LeftMagnaSave Then bLutActive = True
- If keycode = RightMagnaSave Then
- If bLutActive Then NextLUT:End If
- End If
- If vpmKeyDown(keycode)Then Exit Sub
- If keycode = PlungerKey Then PlaySoundat "fx_PlungerPull", Plunger:Plunger.Pullback
- If keycode = KeyRules Then Rules
- End Sub
- Sub table1_KeyUp(ByVal Keycode)
- If keycode = LeftMagnaSave Then bLutActive = False
- If vpmKeyUp(keycode)Then Exit Sub
- If keycode = PlungerKey Then PlaySoundAt "fx_plunger", Plunger:Plunger.Fire
- End Sub
- '*********
- ' LUT
- '*********
- Dim bLutActive, LUTImage
- Sub LoadLUT
- bLutActive = False
- 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
- '*********
- ' Switches
- '*********
- ' Slings
- Dim LStep, RStep
- Sub LeftSlingShot_Slingshot
- PlaySoundAt SoundFX("fx_slingshot", DOFContactors), Lemk
- 'DOF 101, DOFPulse
- LeftSling004.Visible = 1
- Lemk.RotX = 26
- LStep = 0
- vpmTimer.PulseSw 14
- LeftSlingShot.TimerEnabled = 1
- End Sub
- Sub LeftSlingShot_Timer
- Select Case LStep
- Case 1:LeftSLing004.Visible = 0:LeftSLing003.Visible = 1:Lemk.RotX = 14
- Case 2:LeftSLing003.Visible = 0:LeftSLing002.Visible = 1:Lemk.RotX = 2
- Case 3:LeftSLing002.Visible = 0:Lemk.RotX = -20:LeftSlingShot.TimerEnabled = 0
- End Select
- LStep = LStep + 1
- End Sub
- Sub RightSlingShot_Slingshot
- PlaySoundAt SoundFX("fx_slingshot", DOFContactors), Remk
- 'DOF 102, DOFPulse
- RightSling004.Visible = 1
- Remk.RotX = 26
- RStep = 0
- vpmTimer.PulseSw 13
- RightSlingShot.TimerEnabled = 1
- End Sub
- Sub RightSlingShot_Timer
- Select Case RStep
- Case 1:RightSLing004.Visible = 0:RightSLing003.Visible = 1:Remk.RotX = 14
- Case 2:RightSLing003.Visible = 0:RightSLing002.Visible = 1:Remk.RotX = 2
- Case 3:RightSLing002.Visible = 0:Remk.RotX = -20:RightSlingShot.TimerEnabled = 0
- End Select
- RStep = RStep + 1
- End Sub
- ' Bumpers
- Sub Bumper001_Hit:vpmTimer.PulseSw 16:PlaySoundAt SoundFX("fx_bumper", DOFContactors), Bumper001:End Sub
- Sub Bumper002_Hit:vpmTimer.PulseSw 15:PlaySoundAt SoundFX("fx_bumper", DOFContactors), Bumper002:End Sub
- ' Drain & holes
- Sub Drain_Hit:PlaysoundAt "fx_drain", Drain:bsTrough.AddBall Me:End Sub
- ' Lock system
- Dim Kicker2Balls
- Dim Kicker3Balls
- Kicker2Balls = 0
- Kicker3Balls = 0
- Sub Kicker1_Hit:PlaysoundAt "fx_drain", Kicker1:bsLock.AddBall 0:End Sub
- Sub Kicker2_Hit
- PlaysoundAt "fx_sensor", Kicker2
- If bsLock.Balls = 0 Then
- vpmTimer.PulseSw(37)
- Me.Kick 180, 1
- Else
- Controller.Switch(37) = 1
- Kicker2Balls = 1
- End If
- End Sub
- Sub Kicker3_Hit
- PlaysoundAt "fx_sensor", Kicker3
- If Kicker2Balls = 0 Then
- vpmTimer.PulseSw(38)
- Me.Kick 180, 1
- Else
- Controller.Switch(38) = 1
- Kicker3Balls = 1
- End If
- End Sub
- Sub Lockout(Enabled)
- If Enabled Then
- bsLock.ExitSol_On
- If Kicker2Balls = 1 Then
- Kicker2.Kick 180, 1
- Controller.Switch(37) = 0
- Kicker2Balls = 0
- End If
- If Kicker3Balls = 1 Then
- Kicker3.Kick 180, 1
- Controller.Switch(38) = 0
- Kicker3Balls = 0
- End If
- End If
- End Sub
- ' Rollovers
- Sub Trigger3_Hit:Controller.Switch(5) = 1:PlaySoundAt "fx_sensor", Trigger3:topramp.Rotx = -6:End Sub
- Sub Trigger3_UnHit:Controller.Switch(5) = 0:topramp.Rotx = 0:End Sub
- Sub TriggerR4_Hit:Controller.Switch(8) = 1:PlaySoundAt "fx_sensor", TriggerR4:End Sub
- Sub TriggerR4_UnHit:Controller.Switch(8) = 0:End Sub
- Sub TriggerT2_Hit:Controller.Switch(9) = 1:PlaySoundAt "fx_sensor", TriggerT2:DOF 106, DOFOn:End Sub
- Sub TriggerT2_UnHit:Controller.Switch(9) = 0:DOF 106, DOFOff:End Sub
- Sub TriggerT1_Hit:Controller.Switch(10) = 1:PlaySoundAt "fx_sensor", TriggerT1:DOF 108, DOFOn:End Sub
- Sub TriggerT1_UnHit:Controller.Switch(10) = 0:DOF 108, DOFOff:End Sub
- Sub TriggerT3_Hit:Controller.Switch(11) = 1:PlaySoundAt "fx_sensor", TriggerT3:DOF 110, DOFOn:End Sub
- Sub TriggerT3_UnHit:Controller.Switch(11) = 0:DOF 110, DOFOff:End Sub
- Sub TriggerR1_Hit:Controller.Switch(12) = 1:PlaySoundAt "fx_sensor", TriggerR1:DOF 101, DOFOn:End Sub
- Sub TriggerR1_UnHit:Controller.Switch(12) = 0:DOF 101, DOFOff:End Sub
- Sub Trigger2_Hit:Controller.Switch(20) = 1:PlaySoundAt "fx_sensor", Trigger2:End Sub
- Sub Trigger2_UnHit:Controller.Switch(20) = 0:End Sub
- Sub Trigger1_Hit:Controller.Switch(21) = 1:PlaySoundAt "fx_sensor", Trigger1:End Sub
- Sub Trigger1_UnHit:Controller.Switch(21) = 0:End Sub
- Sub TriggerR2_Hit:Controller.Switch(22) = 1:PlaySoundAt "fx_sensor", TriggerR2:End Sub
- Sub TriggerR2_UnHit:Controller.Switch(22) = 0:End Sub
- Sub TriggerL2_Hit:Controller.Switch(23) = 1:PlaySoundAt "fx_sensor", TriggerL2:DOF 102, DOFOn:End Sub
- Sub TriggerL2_UnHit:Controller.Switch(23) = 0:DOF 102, DOFOff:End Sub
- Sub TriggerL3_Hit:Controller.Switch(24) = 1:PlaySoundAt "fx_sensor", TriggerL3:DOF 103, DOFOn:End Sub
- Sub TriggerL3_UnHit:Controller.Switch(24) = 0:DOF 103, DOFOff:End Sub
- Sub TriggerL1_Hit:Controller.Switch(39) = 1:PlaySoundAt "fx_sensor", TriggerL1:DOF 104, DOFOn:End Sub
- Sub TriggerL1_UnHit:Controller.Switch(39) = 0:DOF 104, DOFOff:End Sub
- Sub TriggerR3_Hit:Controller.Switch(40) = 1:PlaySoundAt "fx_sensor", TriggerR3:End Sub
- Sub TriggerR3_UnHit:Controller.Switch(40) = 0:End Sub
- 'Spinners
- Sub Spinner1_Spin():vpmTimer.PulseSw 5:PlaySoundAt "fx_spinner", spinner1:End Sub
- 'Targets
- Sub TargetT6_Hit:vpmTimer.PulseSw 9:PlaySoundAtBall SoundFXDOF("fx_target",107,DOFPulse,DOFTargets):End Sub
- Sub TargetT7_Hit:vpmTimer.PulseSw 10:PlaySoundAtBall SoundFXDOF("fx_target",109,DOFPulse,DOFTargets):End Sub
- Sub TargetT8_Hit:vpmTimer.PulseSw 11:PlaySoundAtBall SoundFXDOF("fx_target",111,DOFPulse,DOFTargets):End Sub
- Sub TargetL2_Hit:vpmTimer.PulseSw 12:PlaySoundAtBall SoundFX("fx_target", DOFTargets):End Sub
- Sub TargetL1_Hit:vpmTimer.PulseSw 24:PlaySoundAtBall SoundFX("fx_target", DOFTargets):End Sub
- '*********
- 'Solenoids
- '*********
- SolCallback(6) = "vpmSolSound SoundFX(""fx_Knocker"",DOFKnocker),"
- SolCallback(7) = "bsTrough.SolIn"
- SolCallback(8) = "bsTrough.SolOut"
- SolCallback(9) = "dtT.SolDropUp"
- SolCallback(10) = "dtR.SolDropUp"
- SolCallback(11) = "dtR2.SolDropUp"
- SolCallback(12) = "Lockout"
- SolCallback(19) = "vpmNudge.SolGameOn"
- '*******************
- ' Flipper Subs v3.0
- '*******************
- SolCallback(sLRFlipper) = "SolRFlipper"
- SolCallback(sLLFlipper) = "SolLFlipper"
- Sub SolLFlipper(Enabled)
- If Enabled Then
- PlaySoundAt SoundFX("fx_flipperup", DOFFlippers), LeftFlipper
- LeftFlipper.EOSTorque = 0.75:LeftFlipper.RotateToEnd
- LeftFlipper2.EOSTorque = 0.75:LeftFlipper2.RotateToEnd
- Else
- PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers), LeftFlipper
- LeftFlipper.EOSTorque = 0.2:LeftFlipper.RotateToStart
- LeftFlipper2.EOSTorque = 0.2:LeftFlipper2.RotateToStart
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- PlaySoundAt SoundFX("fx_flipperup", DOFFlippers), RightFlipper
- RightFlipper.EOSTorque = 0.75:RightFlipper.RotateToEnd
- RightFlipper2.EOSTorque = 0.75:RightFlipper2.RotateToEnd
- Else
- PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers), RightFlipper
- RightFlipper.EOSTorque = 0.2:RightFlipper.RotateToStart
- RightFlipper2.EOSTorque = 0.2:RightFlipper2.RotateToStart
- End If
- End Sub
- Sub LeftFlipper_Collide(parm)
- PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub RightFlipper_Collide(parm)
- PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub LeftFlipper2_Collide(parm)
- PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub RightFlipper2_Collide(parm)
- PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
- End Sub
- '************************************
- ' LEDs Display
- ' Based on Scapino's LEDs
- '************************************
- Dim Digits(32)
- Dim Patterns(11)
- Dim Patterns2(11)
- Patterns(0) = 0 'empty
- Patterns(1) = 63 '0
- Patterns(2) = 6 '1
- Patterns(3) = 91 '2
- Patterns(4) = 79 '3
- Patterns(5) = 102 '4
- Patterns(6) = 109 '5
- Patterns(7) = 125 '6
- Patterns(8) = 7 '7
- Patterns(9) = 127 '8
- Patterns(10) = 111 '9
- Patterns2(0) = 128 'empty
- Patterns2(1) = 191 '0
- Patterns2(2) = 134 '1
- Patterns2(3) = 219 '2
- Patterns2(4) = 207 '3
- Patterns2(5) = 230 '4
- Patterns2(6) = 237 '5
- Patterns2(7) = 253 '6
- Patterns2(8) = 135 '7
- Patterns2(9) = 255 '8
- Patterns2(10) = 239 '9
- 'Assign 6-digit output to reels
- Set Digits(0) = a0
- Set Digits(1) = a1
- Set Digits(2) = a2
- Set Digits(3) = a3
- Set Digits(4) = a4
- Set Digits(5) = a5
- Set Digits(6) = a6
- Set Digits(7) = b0
- Set Digits(8) = b1
- Set Digits(9) = b2
- Set Digits(10) = b3
- Set Digits(11) = b4
- Set Digits(12) = b5
- Set Digits(13) = b6
- Set Digits(14) = c0
- Set Digits(15) = c1
- Set Digits(16) = c2
- Set Digits(17) = c3
- Set Digits(18) = c4
- Set Digits(19) = c5
- Set Digits(20) = c6
- Set Digits(21) = d0
- Set Digits(22) = d1
- Set Digits(23) = d2
- Set Digits(24) = d3
- Set Digits(25) = d4
- Set Digits(26) = d5
- Set Digits(27) = d6
- Set Digits(28) = e0
- Set Digits(29) = e1
- Set Digits(30) = e2
- Set Digits(31) = e3
- Sub UpdateLeds_Timer
- On Error Resume Next
- Dim ChgLED, ii, jj, chg, stat
- ChgLED = Controller.ChangedLEDs(&HFF, &HFFFF)
- If Not IsEmpty(ChgLED)Then
- For ii = 0 To UBound(ChgLED)
- chg = chgLED(ii, 1):stat = chgLED(ii, 2)
- For jj = 0 to 10
- If stat = Patterns(jj)OR stat = Patterns2(jj)then Digits(chgLED(ii, 0)).SetValue jj
- Next
- Next
- End IF
- End Sub
- '************************************
- ' Diverse Collection Hit Sounds v3.0
- '************************************
- Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
- Sub aMetalWires_Hit(idx):PlaySoundAtBall "fx_MetalWire":End Sub
- Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
- Sub aRubber_LongBands_Hit(idx):PlaySoundAtBall "fx_rubber_longband":End Sub
- Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
- Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
- Sub aRubber_Pegs_Hit(idx):PlaySoundAtBall "fx_rubber_peg":End Sub
- Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
- Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
- Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub
- '***************************************************************
- ' Supporting Ball & Sound Functions v3.0
- ' includes random pitch in PlaySoundAt and PlaySoundAtBall
- '***************************************************************
- Dim TableWidth, TableHeight
- TableWidth = Table1.width
- TableHeight = Table1.height
- 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 / TableWidth-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 = (SQR((ball.VelX ^2) + (ball.VelY ^2)))
- End Function
- Function AudioFade(ball) 'only on VPX 10.4 and newer
- Dim tmp
- tmp = ball.y * 2 / TableHeight-1
- If tmp> 0 Then
- AudioFade = Csng(tmp ^10)
- Else
- AudioFade = Csng(-((- tmp) ^10))
- End If
- End Function
- Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
- PlaySound soundname, 0, 1, Pan(tableobj), 0.1, 0, 0, 0, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets, metals, plastics
- PlaySound soundname, 0, Vol(ActiveBall), pan(ActiveBall), 0.4, 0, 0, 0, AudioFade(ActiveBall)
- End Sub
- '***********************************************
- ' JP's VP10 Rolling Sounds + Ballshadow v3.0
- ' uses a collection of shadows, aBallShadow
- '***********************************************
- Const tnob = 19 'total number of balls, 20 balls, from 0 to 19
- Const lob = 0 'number of locked balls
- Const maxvel = 40 'max ball velocity 25-50
- ReDim rolling(tnob)
- InitRolling
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingUpdate()
- Dim BOT, b, ballpitch, ballvol, speedfactorx, speedfactory
- BOT = GetBalls
- ' stop the sound of deleted balls and hide the shadow
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & b)
- aBallShadow(b).Y = 3000
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table
- ' play the rolling sound for each ball and draw the shadow
- For b = lob to UBound(BOT)
- aBallShadow(b).X = BOT(b).X
- aBallShadow(b).Y = BOT(b).Y
- aBallShadow(b).Height = BOT(b).Z -24
- If BallVel(BOT(b))> 1 Then
- If BOT(b).z <30 Then
- ballpitch = Pitch(BOT(b))
- ballvol = Vol(BOT(b))
- Else
- ballpitch = Pitch(BOT(b)) + 25000 'increase the pitch on a ramp
- ballvol = Vol(BOT(b)) * 10
- End If
- rolling(b) = True
- PlaySound("fx_ballrolling" & b), -1, ballvol, Pan(BOT(b)), 0, ballpitch, 1, 0, AudioFade(BOT(b))
- Else
- If rolling(b) = True Then
- StopSound("fx_ballrolling" & b)
- rolling(b) = False
- End If
- End If
- ' rothbauerw's Dropping 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_balldrop", 0, ABS(BOT(b).velz) / 17, Pan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- End If
- ' jps ball speed control
- If BOT(b).VelX AND BOT(b).VelY <> 0 Then
- speedfactorx = ABS(maxvel / BOT(b).VelX)
- speedfactory = ABS(maxvel / BOT(b).VelY)
- If speedfactorx <1 Then
- BOT(b).VelX = BOT(b).VelX * speedfactorx
- BOT(b).VelY = BOT(b).VelY * speedfactorx
- End If
- If speedfactory <1 Then
- BOT(b).VelX = BOT(b).VelX * speedfactory
- BOT(b).VelY = BOT(b).VelY * speedfactory
- 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, AudioFade(ball1)
- End Sub
- 'Switch menu by Inkochnito
- Sub editDips
- Dim vpmDips:Set vpmDips = New cvpmDips
- With vpmDips
- .AddForm 700, 400, "Split second - DIP switches"
- .AddFrame 2, 5, 110, "Maximum credits", &H00060000, Array("10 credits", 0, "15 credits", &H00020000, "25 credits", &H00040000, "40 credits", &H00060000) 'dip 18&19
- .AddFrame 2, 80, 110, "High game to date", 49152, Array("points", 0, "1 free game", &H00004000, "2 free games", 32768, "3 free games", 49152) 'dip 15&16
- .AddFrame 2, 155, 110, "Special award", &HC0000000, Array("no award", 0, "100.000 points", &H40000000, "free ball", &H80000000, "free game", &HC0000000) 'dip 31&32
- .AddFrame 125, 5, 110, "High score feature", &H00000020, Array("extra ball", 0, "replay", &H00000020) 'dip 6
- .AddFrame 125, 57, 110, "Extra ball limit", &H00400000, Array("one per game", 0, "one per ball", &H00400000) 'dip 23
- .AddFrame 125, 108, 110, "Add-a-ball memory", &H00001000, Array("three balls", 0, "five balls", &H00001000) 'dip 13
- .AddChk 125, 162, 110, Array("Match feature", &H00100000) 'dip 21
- .AddChk 125, 180, 110, Array("Credits display", &H00080000) 'dip 20
- .AddChk 125, 198, 110, Array("Extra ball", &H00200000) 'dip 22
- .AddChk 248, 162, 110, Array("Talking sound", &H00010000) 'dip 17
- .AddChk 125, 216, 110, Array("Bonus ball feature", &H00000010) 'dip 5
- .AddFrame 248, 5, 110, "Balls per game", &H00000040, Array("3 balls", 0, "5 balls", &H00000040) 'dip 7
- .AddFrame 248, 57, 110, "Special limit", &H20000000, Array("one per game", 0, "one per ball", &H20000000) 'dip 30
- .AddFrame 248, 108, 110, "Outlane special adjust", &H10000000, Array("alternating", 0, "both lit", &H10000000) 'dip 29
- .AddLabel 50, 250, 300, 20, "After hitting OK, press F3 to reset game with new settings."
- .ViewDips
- End With
- End Sub
- Set vpmShowDips = GetRef("editDips")
Advertisement
Add Comment
Please, Sign In to add comment