Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- 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 VarRol, VarHidden,dto
- Dim Lstep,Rstep,Lstep1,Rstep1,Kstep
- If Table1.ShowDT = true then
- VarRol=0:VarHidden=1
- For Each dto in desktopobjects
- dto.visible = True
- Next
- DisplayTimer.Enabled = True
- Else
- VarRol=1:VarHidden=0
- For Each dto in desktopobjects
- dto.visible = False
- Next
- DisplayTimer.Enabled = False
- End If
- If B2SOn = true Then VarHidden=1
- Const cGameName="forceii",UseSolenoids=2,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="fx_FlipperUp",SFlipperOff="fx_FlipperDown"
- Const SCoin="coin3"
- LoadVPM "01120100","sys80.vbs",3.10
- Sub Table1_KeyDown(ByVal keycode)
- If vpmKeyDown(KeyCode) Then Exit Sub
- If keycode=PlungerKey Then Plunger.Pullback:PlaySound "plungerpull",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
- End Sub
- Sub Table1_KeyUp(ByVal keycode)
- If vpmKeyUp(KeyCode) Then Exit Sub
- If keycode=PlungerKey Then Plunger.Fire:PlaySound "plunger",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
- End Sub
- Set LampCallback=GetRef("UpdateMultipleLamps")
- Sub UpdateMultipleLamps
- vpmNudge.solGameOn (Controller.Lamp(0) and not Controller.Lamp(1))
- End Sub
- Set MotorCallback=GetRef("Update12") 'Ball Release Routine
- Dim LS12,CS12,LS14,CS14,LS13,CS13,LS15,LastLight
- LastLight=0
- LS14=0:LS12=0:LS13=0:LS15=0
- Sub Update12
- CS14=Light14.State
- If LS14<>CS14 Then
- If LS14=1 Then
- If bsSaucer2.Balls Then
- bsSaucer2.ExitSol_On
- LastLight=14
- LS12=0
- LS14=CS14
- Exit Sub
- End If
- End If
- End If
- CS13=Light13.State
- If LS13<>CS13 Then
- If LS13=1 Then
- If bsSaucer.Balls Then
- bsSaucer.ExitSol_On
- LastLight=13
- LS12=0
- LS13=CS13
- Exit Sub
- End If
- End If
- End If
- CS12=Light12.State
- If LS12<>CS12 Then
- If LS12=1 Then LastLight=12
- End If
- LS14=CS14
- LS13=CS13
- LS12=CS12
- End Sub
- Const sdtT=2
- Const sCoin1=3
- Const sCoin2=4
- Const sdtR=5
- Const sdtL=6
- Const sCoin3=7
- Const sKnocker=8
- SolCallback(1)="SolOutHole"
- SolCallback(sdtL)="dtL.SolDropUp"
- SolCallback(sdtT)="dtT.SolDropUp"
- SolCallback(sdtR)="dtR.SolDropUp"
- SolCallback(sKnocker)="VpmSolSound SoundFX(""knocker"",DOFKnocker),"
- SolCallback(9)="SolTrough Not"
- Sub SolTrough(Enabled)
- If Enabled Then
- If bsSaucer.Balls Or bsSaucer2.Balls Then
- If BallInPlay<2 Then
- BallRelease.CreateBall
- BallRelease.Kick 120,5
- PlaySound SoundFX("BallRel",DOFContactors)
- BallInPlay=BallInPlay+1
- LastLight=0
- Controller.Switch(73)=0
- End If
- End If
- End If
- End Sub
- Sub SolOutHole(Enabled)
- If Enabled Then
- If LastLight=12 Then
- If BallInPlay<2 Then
- BallRelease.CreateBall
- BallRelease.Kick 120,5
- PlaySound SoundFX("BallRel",DOFContactors)
- BallInPlay=BallInPlay+1
- Controller.Switch(63)=0
- Controller.Switch(73)=0
- LastLight=0
- End If
- End If
- End If
- End Sub
- 'SolCallback(sLLFlipper)="VpmSolFlipper LeftFlipper,Flipper1,"
- 'SolCallback(sLRFlipper)="VpmSolFlipper RightFlipper,Flipper2,"
- SolCallback(sLRFlipper) = "SolRFlipper"
- SolCallback(sLLFlipper) = "SolLFlipper"
- Sub SolLFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("fx_flipperup",DOFFlippers)
- LeftFlipper.RotateToEnd
- Flipper1.RotateToEnd
- Else
- PlaySound SoundFX("fx_flipperdown",DOFFlippers)
- LeftFlipper.RotateToStart
- Flipper1.RotateToStart
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("fx_flipperup",DOFFlippers)
- RightFlipper.RotateToEnd
- Flipper2.RotateToEnd
- Else
- PlaySound SoundFX("fx_flipperdown",DOFFlippers)
- RightFlipper.RotateToStart
- Flipper2.RotateToStart
- End If
- End Sub
- Dim dtL,dtT,dtR,BallInPlay,bsSaucer,bsSaucer2
- BallInPlay=0
- Sub Table1_Init
- On Error Resume Next
- With Controller
- .GameName=cGameName
- If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
- .SplashInfoLine="Force II, Gottlieb 1981"
- .HandleMechanics=0
- .HandleKeyboard=0
- .ShowDMDOnly=1
- .ShowFrame=0
- .ShowTitle=0
- .Games(cGameName).Settings.Value("rol") = VarRol
- .Hidden=VarHidden
- If Err Then MsgBox Err.Description
- End With
- On Error Goto 0
- 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
- ' Main Timer init
- PinMAMETimer.Interval=PinMAMEInterval
- PinMAMETimer.Enabled=1
- ' Nudging
- vpmNudge.TiltSwitch=57
- vpmNudge.Sensitivity=5
- vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,OuterWall)
- 'drop targets
- Set dtL=New cvpmDropTarget
- dtL.InitDrop Array(dt1,dt2,dt3,dt4,dt5),Array(21,31,41,51,61)
- dtL.initsnd SoundFX("target",DOFTargets),SoundFX("flapopen",DOFContactors)
- Set dtT=New cvpmDropTarget
- dtT.InitDrop Array(dt6,dt7,dt8,dt9),Array(00,10,20,30)
- dtT.initsnd SoundFX("target",DOFTargets),SoundFX("flapopen",DOFContactors)
- Set dtR=New cvpmDropTarget
- dtR.InitDrop Array(dt10,dt11,dt12,dt13,dt14),Array(3,13,23,33,43)
- dtR.initsnd SoundFX("target",DOFTargets),SoundFX("flapopen",DOFContactors)
- Set bsSaucer=New cvpmBallstack
- bsSaucer.InitSaucer Kicker1,32,324,30
- bsSaucer.InitExitSnd SoundFX("popper",DOFContactors),SoundFX("popper",DOFContactors)
- Set bsSaucer2=New cvpmBallstack
- bsSaucer2.InitSaucer Kicker2,72,170,10
- bsSaucer2.InitExitSnd SoundFX("popper",DOFContactors),SoundFX("popper",DOFContactors)
- Controller.Switch(63)=1
- Controller.Switch(73)=1
- End Sub
- Sub Drain_Hit()Playsound "drain"
- Me.DestroyBall
- BallInPlay=BallInPlay-1
- If BallInPlay<0 Then BallInPlay=0
- If BallInPlay=0 Then
- Controller.Switch(63)=1
- Controller.Switch(73)=1
- End If
- If BallInPlay=1 Then Controller.Switch(73)=1
- End Sub
- Sub Kicker1_Hit
- LS15=Light15.State
- If LS15=1 And BallInPlay=1 Then
- Controller.Switch(73)=1
- bsSaucer.AddBall 0
- Kstep=0
- Else
- bsSaucer.AddBall 0
- Kstep=0
- End If
- End Sub
- Sub Trigger6_Unhit
- Kicker1.timerenabled=1
- End Sub
- Sub Kicker1_Timer
- sling5.rotx = 20
- Select Case KStep
- Case 1:Sling5.rotx = 10
- Case 2:Sling5.rotx = 0:Kicker1.TimerEnabled = 0
- End Select
- KStep = KStep + 1
- End Sub
- Sub Kicker2_Hit
- LS15=Light15.State
- If LS15=1 And BallInPlay=1 Then
- Controller.Switch(73)=1
- bsSaucer2.AddBall 0
- Else
- bsSaucer2.AddBall 0
- End If
- End Sub
- Sub dt1_Hit:dtL.Hit 1:End Sub
- Sub dt2_Hit:dtL.Hit 2:End Sub
- Sub dt3_Hit:dtL.Hit 3:End Sub
- Sub dt4_Hit:dtL.Hit 4:End Sub
- Sub dt5_Hit:dtL.Hit 5:End Sub
- Sub dt6_Hit:dtT.Hit 1:End Sub
- Sub dt7_Hit:dtT.Hit 2:End Sub
- Sub dt8_Hit:dtT.Hit 3:End Sub
- Sub dt9_Hit:dtT.Hit 4:End Sub
- Sub dt10_Hit:dtR.Hit 1:End Sub
- Sub dt11_Hit:dtR.Hit 2:End Sub
- Sub dt12_Hit:dtR.Hit 3:End Sub
- Sub dt13_Hit:dtR.Hit 4:End Sub
- Sub dt14_Hit:dtR.Hit 5:End Sub
- Sub Bumper1_Hit:vpmTimer.PulseSw(52):Playsound SoundFX("fx_bumper1",DOFContactors):DOF 101, DOFPulse:End Sub
- Sub Bumper2_Hit:vpmTimer.PulseSw(52):Playsound SoundFX("fx_bumper2",DOFContactors):DOF 103, DOFPulse:End Sub
- Sub Bumper3_Hit:vpmTimer.PulseSw(62):Playsound SoundFX("fx_bumper3",DOFContactors):DOF 102, DOFPulse:End Sub
- Sub LeftOutlane_Hit:Controller.Switch(12)=1:End Sub
- Sub LeftOutlane_unHit:Controller.Switch(12)=0:End Sub
- Sub LeftInlane_Hit:Controller.Switch(22)=1:End Sub
- Sub LeftInlane_unHit:Controller.Switch(22)=0:End Sub
- Sub RightInlane_Hit:Controller.Switch(42)=1:End Sub
- Sub RightInlane_unHit:Controller.Switch(42)=0:End Sub
- Sub Trigger1_Hit:Controller.Switch(40)=1:End Sub
- Sub Trigger1_unHit:Controller.Switch(40)=0:End Sub
- Sub Trigger2_Hit:Controller.Switch(50)=1:End Sub
- Sub Trigger2_unHit:Controller.Switch(50)=0:End Sub
- Sub Trigger3_Hit:Controller.Switch(60)=1:End Sub
- Sub Trigger3_unHit:Controller.Switch(60)=0:End Sub
- Sub Trigger4_Hit:Controller.Switch(11)=1:End Sub
- Sub Trigger4_unHit:Controller.Switch(11)=0:End Sub
- Sub Trigger5_Hit:Controller.Switch(1)=1:End Sub
- Sub Trigger5_unHit:Controller.Switch(1)=0:End Sub
- Sub Spinner_Spin:vpmTimer.PulseSw(70): PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner):End Sub
- Sub Target2_Hit:vpmTimer.PulseSw(71):End Sub
- Sub Target3_Hit:vpmTimer.PulseSw(53):End Sub
- Sub Target1_Hit:vpmTimer.PulseSw(2):End Sub
- Sub LeftSlingShot_Slingshot
- PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05
- DOF 104, DOFPulse
- vpmTimer.PulseSw(4)
- 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
- Sub LeftSlingShot1_Slingshot
- PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05
- DOF 104, DOFPulse
- vpmTimer.PulseSw(4)
- LSling4.Visible = 0
- LSling5.Visible = 1
- sling4.rotx = 20
- LStep1 = 0
- LeftSlingShot1.TimerEnabled = 1
- End Sub
- Sub LeftSlingShot1_Timer
- Select Case LStep1
- Case 3:LSLing5.Visible = 0:LSLing3.Visible = 1:sling4.rotx = 10
- Case 4:LSLing3.Visible = 0:LSLing4.Visible = 1:sling4.rotx = 0:LeftSlingShot1.TimerEnabled = 0
- End Select
- LStep1 = LStep1 + 1
- End Sub
- Sub RightSlingShot_Slingshot
- PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05
- DOF 105, DOFPulse
- vpmTimer.PulseSw(4)
- 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 RightSlingShot1_Slingshot
- PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05
- vpmTimer.PulseSw(4)
- RSling5.Visible = 0
- RSling4.Visible = 1
- sling3.rotx = 20
- RStep1 = 0
- RightSlingShot1.TimerEnabled = 1
- End Sub
- Sub RightSlingShot1_Timer
- Select Case RStep1
- Case 3:RSling4.Visible = 0:RSling3.Visible = 1:sling3.rotx = 10
- Case 4:RSling3.Visible = 0:RSLing5.Visible = 1:sling3.rotx = 0:RightSlingShot1.TimerEnabled = 0
- End Select
- RStep1 = RStep1 + 1
- End Sub
- Set Lights(0)=Light0 'GAME OVER RELAY
- Set Lights(1)=Light1 'TILT
- Set Lights(2)=Light2 'COIN LOCKOUT
- Set Lights(3)=Light3 'SHOOT AGAIN
- 'Set Lights(4)=Light4 'PLAYER 1
- 'Set Lights(5)=Light5 'PLAYER 2
- 'Set Lights(6)=Light6 'PLAYER 3
- 'Set Lights(7)=Light7 'PLAYER 4
- Set Lights(10)=Light10 'HIGH SCORE
- Set Lights(11)=Light11 'GAME OVER
- Set Lights(12)=Light12
- Lights(15)=Array(Light15B,Light15)
- Set Lights(16)=Light16B
- Set Lights(17)=Light17B
- Set Lights(18)=Light18B
- Set Lights(19)=Light19B
- Set Lights(20)=Light20B
- Set Lights(21)=Light21B
- Set Lights(22)=Light22B
- Set Lights(23)=Light23B
- Set Lights(24)=Light24B
- Set Lights(25)=Light25B
- Set Lights(26)=Light26B
- Set Lights(27)=Light27B
- Set Lights(28)=Light28B
- Set Lights(29)=Light29
- Set Lights(30)=Light30
- Set Lights(31)=Light31
- Set Lights(32)=Light32
- Set Lights(33)=Light33
- Set Lights(34)=Light34
- Set Lights(35)=Light35
- Set Lights(36)=Light36
- Set Lights(37)=Light37
- Set Lights(38)=Light38
- Set Lights(39)=Light39
- Set Lights(40)=Light40
- Set Lights(41)=Light41
- Set Lights(42)=Light42
- Set Lights(43)=Light43
- Set Lights(44)=Light44
- Set Lights(45)=Light45
- Set Lights(46)=Light46
- Set Lights(47)=Light47
- Set Lights(48)=Light48
- Set Lights(49)=Light49
- Lights(50)=Array(Light50B,Light50A)
- Set Lights(51)=Light51
- Set Lights(8)=Light8
- Set Lights(9)=Light9
- Set Lights(13)=Light13
- Set Lights(14)=Light14
- Sub Gate_Hit: PlaySound "Gate" : End Sub
- 'Gottlieb Force II
- 'added by Inkochnito
- Sub editDips
- Dim vpmDips : Set vpmDips = New cvpmDips
- With vpmDips
- .AddForm 700,400,"Force II - DIP switches"
- .AddFrame 2,10,190,"Maximum credits",49152,Array("8 credits",0,"10 credits",32768,"15 credits",&H00004000,"25 credits",49152)'dip 15&16
- .AddFrame 2,86,190,"Coin chute 1 and 2 control",&H00002000,Array("seperate",0,"same",&H00002000)'dip 14
- .AddFrame 2,132,190,"Playfield special",&H00200000,Array("replay",0,"extra ball",&H00200000)'dip 22
- .AddFrame 2,178,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
- .AddChk 2,260,190,Array("Sound when scoring?",&H01000000)'dip 25
- .AddChk 2,275,190,Array("Replay button tune?",&H02000000)'dip 26
- .AddChk 2,290,190,Array("Coin switch tune?",&H04000000)'dip 27
- .AddChk 2,305,190,Array("Credits displayed?",&H08000000)'dip 28
- .AddChk 2,320,190,Array("Match feature",&H00020000)'dip 18
- .AddChk 2,335,190,Array("Attract features",&H20000000)'dip 30
- .AddChk 2,350,190,Array("Replay at 1.000.000",&H80000000)'dip 32
- .AddFrameExtra 205,10,190,"Attract tune",&H0200,Array("no attract tune",0,"attract tune played every 6 minutes",&H0200)'S-board dip 2
- .AddFrame 205,56,190,"Balls per game",&H00010000,Array("5 balls",0,"3 balls",&H00010000)'dip 17
- .AddFrame 205,102,190,"Replay limit",&H00040000,Array("no limit",0,"one per game",&H00040000)'dip 19
- .AddFrame 205,148,190,"Novelty",&H00080000,Array("normal game mode",0,"50,000 points for special/extra ball",&H0080000)'dip 20
- .AddFrame 205,194,190,"Game mode",&H00100000,Array("replay",0,"extra ball",&H00100000)'dip 21
- .AddFrame 205,240,190,"3rd coin chute credits control",&H00001000,Array("no effect",0,"add 9",&H00001000)'dip 13
- .AddFrame 205,286,190,"Tilt penalty",&H10000000,Array("game over",0,"ball in play",&H10000000)'dip 29
- .AddLabel 50,375,300,20,"After hitting OK, press F3 to reset game with new settings."
- End With
- Dim extra
- extra = Controller.Dip(4) + Controller.Dip(5)*256
- extra = vpmDips.ViewDipsExtra(extra)
- Controller.Dip(4) = extra And 255
- Controller.Dip(5) = (extra And 65280)\256 And 255
- End Sub
- Set vpmShowDips = GetRef("editDips")
- Dim n
- Dim Digits(32)
- Digits(0)=Array(a00,a01,a02,a03,a04,a05,a06,n,a08)
- Digits(1)=Array(a10,a11,a12,a13,a14,a15,a16,n,a18)
- Digits(2)=Array(a20,a21,a22,a23,a24,a25,a26,n,a28)
- Digits(3)=Array(a30,a31,a32,a33,a34,a35,a36,n,a38)
- Digits(4)=Array(a40,a41,a42,a43,a44,a45,a46,n,a48)
- Digits(5)=Array(a50,a51,a52,a53,a54,a55,a56,n,a58)
- Digits(6)=Array(b00,b01,b02,b03,b04,b05,b06,n,b08)
- Digits(7)=Array(b10,b11,b12,b13,b14,b15,b16,n,b18)
- Digits(8)=Array(b20,b21,b22,b23,b24,b25,b26,n,b28)
- Digits(9)=Array(b30,b31,b32,b33,b34,b35,b36,n,b38)
- Digits(10)=Array(b40,b41,b42,b43,b44,b45,b46,n,b48)
- Digits(11)=Array(b50,b51,b52,b53,b54,b55,b56,n,b58)
- Digits(12)=Array(c00,c01,c02,c03,c04,c05,c06,n,c08)
- Digits(13)=Array(c10,c11,c12,c13,c14,c15,c16,n,c18)
- Digits(14)=Array(c20,c21,c22,c23,c24,c25,c26,n,c28)
- Digits(15)=Array(c30,c31,c32,c33,c34,c35,c36,n,c38)
- Digits(16)=Array(c40,c41,c42,c43,c44,c45,c46,n,c48)
- Digits(17)=Array(c50,c51,c52,c53,c54,c55,c56,n,c58)
- Digits(18)=Array(d00,d01,d02,d03,d04,d05,d06,n,d08)
- Digits(19)=Array(d10,d11,d12,d13,d14,d15,d16,n,d18)
- Digits(20)=Array(d20,d21,d22,d23,d24,d25,d26,n,d28)
- Digits(21)=Array(d30,d31,d32,d33,d34,d35,d36,n,d38)
- Digits(22)=Array(d40,d41,d42,d43,d44,d45,d46,n,d48)
- Digits(23)=Array(d50,d51,d52,d53,d54,d55,d56,n,d58)
- Digits(26)=Array(e00,e01,e02,e03,e04,e05,e06,n,e08)
- Digits(27)=Array(e10,e11,e12,e13,e14,e15,e16,n,e18)
- Digits(24)=Array(f00,f01,f02,f03,f04,f05,f06,n,f08)
- Digits(25)=Array(f10,f11,f12,f13,f14,f15,f16,n,f18)
- Sub DisplayTimer_Timer
- 'Dim ChgLED,ii,num,chg,stat
- 'ChgLED = Controller.ChangedLEDs(0, &H0fffffff)
- 'If Not IsEmpty(ChgLED) Then
- ' For ii = 0 To UBound(chgLED)
- ' num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
- ' if char(stat) > "" then msg(num) = char(stat)
- ' next
- ' TextBox1.Text = msg(0) & msg(1) & msg(2) & char(0) & msg(3) & msg(4) & msg(5)
- ' TextBox2.Text = msg(6) & msg(7) & msg(8) & char(0) & msg(9) & msg(10) & msg(11)
- ' TextBox3.Text = msg(12) & msg(13) & msg(14) & char(0) & msg(15) & msg(16) & msg(17)
- ' TextBox4.Text = msg(18) & msg(19) & msg(20) & char(0) & msg(21) & msg(22) & msg(23)
- ' TextBox5.text = msg(24) & msg(25)
- ' TextBox6.text = msg(26) & msg(27)
- 'end if
- Dim ChgLED,ii,num,chg,stat,obj
- ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
- If Not IsEmpty(ChgLED) Then
- 'If not b2son Then
- For ii = 0 To UBound(chgLED)
- num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
- if (num < 32) 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
- '*********************************************************************
- ' 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
- '*****************************************
- ' rothbauerw's Manual Ball Control
- '*****************************************
- Dim BCup, BCdown, BCleft, BCright
- Dim ControlBallInPlay, ControlActiveBall
- Dim BCvel, BCyveloffset, BCboostmulti, BCboost
- BCboost = 1 'Do Not Change - default setting
- BCvel = 4 'Controls the speed of the ball movement
- BCyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
- BCboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
- ControlBallInPlay = false
- Sub StartBallControl_Hit()
- Set ControlActiveBall = ActiveBall
- ControlBallInPlay = true
- End Sub
- Sub StopBallControl_Hit()
- ControlBallInPlay = false
- End Sub
- Sub BallControlTimer_Timer()
- If EnableBallControl and ControlBallInPlay then
- If BCright = 1 Then
- ControlActiveBall.velx = BCvel*BCboost
- ElseIf BCleft = 1 Then
- ControlActiveBall.velx = -BCvel*BCboost
- Else
- ControlActiveBall.velx = 0
- End If
- If BCup = 1 Then
- ControlActiveBall.vely = -BCvel*BCboost
- ElseIf BCdown = 1 Then
- ControlActiveBall.vely = BCvel*BCboost
- Else
- ControlActiveBall.vely = bcyveloffset
- End If
- End If
- End Sub
- '*****************************************
- ' JP's VP10 Rolling Sounds
- '*****************************************
- Const tnob = 5 ' total number of balls
- ReDim rolling(tnob)
- InitRolling
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingTimer_Timer()
- Dim BOT, b
- BOT = GetBalls
- ' stop the sound of deleted balls
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & b)
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' play the rolling sound for each ball
- For b = 0 to UBound(BOT)
- If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
- rolling(b) = True
- PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), 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
- 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
- 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 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
Advertisement
Add Comment
Please, Sign In to add comment