Arngrim

Untitled

Feb 9th, 2019
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.31 KB | None | 0 0
  1. Option Explicit
  2. On Error Resume Next
  3. ExecuteGlobal GetTextFile("controller.vbs")
  4. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  5. On Error Goto 0
  6.  
  7. Dim VarRol, VarHidden,dto
  8. Dim Lstep,Rstep,Lstep1,Rstep1,Kstep
  9.  
  10. If Table1.ShowDT = true then
  11. VarRol=0:VarHidden=1
  12. For Each dto in desktopobjects
  13. dto.visible = True
  14. Next
  15. DisplayTimer.Enabled = True
  16. Else
  17. VarRol=1:VarHidden=0
  18. For Each dto in desktopobjects
  19. dto.visible = False
  20. Next
  21. DisplayTimer.Enabled = False
  22. End If
  23.  
  24. If B2SOn = true Then VarHidden=1
  25.  
  26. Const cGameName="forceii",UseSolenoids=2,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="fx_FlipperUp",SFlipperOff="fx_FlipperDown"
  27. Const SCoin="coin3"
  28.  
  29. LoadVPM "01120100","sys80.vbs",3.10
  30.  
  31. Sub Table1_KeyDown(ByVal keycode)
  32. If vpmKeyDown(KeyCode) Then Exit Sub
  33. If keycode=PlungerKey Then Plunger.Pullback:PlaySound "plungerpull",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
  34. End Sub
  35.  
  36. Sub Table1_KeyUp(ByVal keycode)
  37. If vpmKeyUp(KeyCode) Then Exit Sub
  38. If keycode=PlungerKey Then Plunger.Fire:PlaySound "plunger",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
  39. End Sub
  40.  
  41. Set LampCallback=GetRef("UpdateMultipleLamps")
  42.  
  43. Sub UpdateMultipleLamps
  44. vpmNudge.solGameOn (Controller.Lamp(0) and not Controller.Lamp(1))
  45. End Sub
  46.  
  47.  
  48. Set MotorCallback=GetRef("Update12") 'Ball Release Routine
  49.  
  50. Dim LS12,CS12,LS14,CS14,LS13,CS13,LS15,LastLight
  51. LastLight=0
  52. LS14=0:LS12=0:LS13=0:LS15=0
  53.  
  54. Sub Update12
  55. CS14=Light14.State
  56. If LS14<>CS14 Then
  57. If LS14=1 Then
  58. If bsSaucer2.Balls Then
  59. bsSaucer2.ExitSol_On
  60. LastLight=14
  61. LS12=0
  62. LS14=CS14
  63. Exit Sub
  64. End If
  65. End If
  66. End If
  67.  
  68. CS13=Light13.State
  69. If LS13<>CS13 Then
  70. If LS13=1 Then
  71. If bsSaucer.Balls Then
  72. bsSaucer.ExitSol_On
  73. LastLight=13
  74. LS12=0
  75. LS13=CS13
  76. Exit Sub
  77. End If
  78. End If
  79. End If
  80.  
  81. CS12=Light12.State
  82. If LS12<>CS12 Then
  83. If LS12=1 Then LastLight=12
  84. End If
  85. LS14=CS14
  86. LS13=CS13
  87. LS12=CS12
  88. End Sub
  89.  
  90. Const sdtT=2
  91. Const sCoin1=3
  92. Const sCoin2=4
  93. Const sdtR=5
  94. Const sdtL=6
  95. Const sCoin3=7
  96. Const sKnocker=8
  97.  
  98. SolCallback(1)="SolOutHole"
  99. SolCallback(sdtL)="dtL.SolDropUp"
  100. SolCallback(sdtT)="dtT.SolDropUp"
  101. SolCallback(sdtR)="dtR.SolDropUp"
  102. SolCallback(sKnocker)="VpmSolSound SoundFX(""knocker"",DOFKnocker),"
  103. SolCallback(9)="SolTrough Not"
  104.  
  105. Sub SolTrough(Enabled)
  106. If Enabled Then
  107. If bsSaucer.Balls Or bsSaucer2.Balls Then
  108. If BallInPlay<2 Then
  109. BallRelease.CreateBall
  110. BallRelease.Kick 120,5
  111. PlaySound SoundFX("BallRel",DOFContactors)
  112. BallInPlay=BallInPlay+1
  113. LastLight=0
  114. Controller.Switch(73)=0
  115. End If
  116. End If
  117. End If
  118. End Sub
  119.  
  120. Sub SolOutHole(Enabled)
  121. If Enabled Then
  122. If LastLight=12 Then
  123. If BallInPlay<2 Then
  124. BallRelease.CreateBall
  125. BallRelease.Kick 120,5
  126. PlaySound SoundFX("BallRel",DOFContactors)
  127. BallInPlay=BallInPlay+1
  128. Controller.Switch(63)=0
  129. Controller.Switch(73)=0
  130. LastLight=0
  131. End If
  132. End If
  133. End If
  134. End Sub
  135.  
  136. 'SolCallback(sLLFlipper)="VpmSolFlipper LeftFlipper,Flipper1,"
  137. 'SolCallback(sLRFlipper)="VpmSolFlipper RightFlipper,Flipper2,"
  138.  
  139. SolCallback(sLRFlipper) = "SolRFlipper"
  140. SolCallback(sLLFlipper) = "SolLFlipper"
  141.  
  142. Sub SolLFlipper(Enabled)
  143. If Enabled Then
  144. PlaySound SoundFX("fx_flipperup",DOFFlippers)
  145. LeftFlipper.RotateToEnd
  146. Flipper1.RotateToEnd
  147. Else
  148. PlaySound SoundFX("fx_flipperdown",DOFFlippers)
  149. LeftFlipper.RotateToStart
  150. Flipper1.RotateToStart
  151. End If
  152. End Sub
  153.  
  154. Sub SolRFlipper(Enabled)
  155. If Enabled Then
  156. PlaySound SoundFX("fx_flipperup",DOFFlippers)
  157. RightFlipper.RotateToEnd
  158. Flipper2.RotateToEnd
  159. Else
  160. PlaySound SoundFX("fx_flipperdown",DOFFlippers)
  161. RightFlipper.RotateToStart
  162. Flipper2.RotateToStart
  163. End If
  164. End Sub
  165.  
  166. Dim dtL,dtT,dtR,BallInPlay,bsSaucer,bsSaucer2
  167. BallInPlay=0
  168.  
  169. Sub Table1_Init
  170. On Error Resume Next
  171. With Controller
  172. .GameName=cGameName
  173. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  174. .SplashInfoLine="Force II, Gottlieb 1981"
  175. .HandleMechanics=0
  176. .HandleKeyboard=0
  177. .ShowDMDOnly=1
  178. .ShowFrame=0
  179. .ShowTitle=0
  180. .Games(cGameName).Settings.Value("rol") = VarRol
  181. .Hidden=VarHidden
  182. If Err Then MsgBox Err.Description
  183. End With
  184. On Error Goto 0
  185. Controller.SolMask(0)=0
  186. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  187. Controller.Run
  188.  
  189. ' Main Timer init
  190. PinMAMETimer.Interval=PinMAMEInterval
  191. PinMAMETimer.Enabled=1
  192.  
  193. ' Nudging
  194. vpmNudge.TiltSwitch=57
  195. vpmNudge.Sensitivity=5
  196. vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,OuterWall)
  197.  
  198. 'drop targets
  199. Set dtL=New cvpmDropTarget
  200. dtL.InitDrop Array(dt1,dt2,dt3,dt4,dt5),Array(21,31,41,51,61)
  201. dtL.initsnd SoundFX("target",DOFTargets),SoundFX("flapopen",DOFContactors)
  202.  
  203. Set dtT=New cvpmDropTarget
  204. dtT.InitDrop Array(dt6,dt7,dt8,dt9),Array(00,10,20,30)
  205. dtT.initsnd SoundFX("target",DOFTargets),SoundFX("flapopen",DOFContactors)
  206.  
  207. Set dtR=New cvpmDropTarget
  208. dtR.InitDrop Array(dt10,dt11,dt12,dt13,dt14),Array(3,13,23,33,43)
  209. dtR.initsnd SoundFX("target",DOFTargets),SoundFX("flapopen",DOFContactors)
  210.  
  211. Set bsSaucer=New cvpmBallstack
  212. bsSaucer.InitSaucer Kicker1,32,324,30
  213. bsSaucer.InitExitSnd SoundFX("popper",DOFContactors),SoundFX("popper",DOFContactors)
  214.  
  215. Set bsSaucer2=New cvpmBallstack
  216. bsSaucer2.InitSaucer Kicker2,72,170,10
  217. bsSaucer2.InitExitSnd SoundFX("popper",DOFContactors),SoundFX("popper",DOFContactors)
  218.  
  219. Controller.Switch(63)=1
  220. Controller.Switch(73)=1
  221.  
  222. End Sub
  223.  
  224. Sub Drain_Hit()Playsound "drain"
  225. Me.DestroyBall
  226. BallInPlay=BallInPlay-1
  227. If BallInPlay<0 Then BallInPlay=0
  228. If BallInPlay=0 Then
  229. Controller.Switch(63)=1
  230. Controller.Switch(73)=1
  231. End If
  232. If BallInPlay=1 Then Controller.Switch(73)=1
  233. End Sub
  234.  
  235. Sub Kicker1_Hit
  236. LS15=Light15.State
  237. If LS15=1 And BallInPlay=1 Then
  238. Controller.Switch(73)=1
  239. bsSaucer.AddBall 0
  240. Kstep=0
  241. Else
  242. bsSaucer.AddBall 0
  243. Kstep=0
  244. End If
  245. End Sub
  246.  
  247. Sub Trigger6_Unhit
  248. Kicker1.timerenabled=1
  249. End Sub
  250.  
  251. Sub Kicker1_Timer
  252. sling5.rotx = 20
  253. Select Case KStep
  254. Case 1:Sling5.rotx = 10
  255. Case 2:Sling5.rotx = 0:Kicker1.TimerEnabled = 0
  256. End Select
  257. KStep = KStep + 1
  258. End Sub
  259.  
  260. Sub Kicker2_Hit
  261. LS15=Light15.State
  262. If LS15=1 And BallInPlay=1 Then
  263. Controller.Switch(73)=1
  264. bsSaucer2.AddBall 0
  265. Else
  266. bsSaucer2.AddBall 0
  267. End If
  268. End Sub
  269.  
  270. Sub dt1_Hit:dtL.Hit 1:End Sub
  271. Sub dt2_Hit:dtL.Hit 2:End Sub
  272. Sub dt3_Hit:dtL.Hit 3:End Sub
  273. Sub dt4_Hit:dtL.Hit 4:End Sub
  274. Sub dt5_Hit:dtL.Hit 5:End Sub
  275. Sub dt6_Hit:dtT.Hit 1:End Sub
  276. Sub dt7_Hit:dtT.Hit 2:End Sub
  277. Sub dt8_Hit:dtT.Hit 3:End Sub
  278. Sub dt9_Hit:dtT.Hit 4:End Sub
  279. Sub dt10_Hit:dtR.Hit 1:End Sub
  280. Sub dt11_Hit:dtR.Hit 2:End Sub
  281. Sub dt12_Hit:dtR.Hit 3:End Sub
  282. Sub dt13_Hit:dtR.Hit 4:End Sub
  283. Sub dt14_Hit:dtR.Hit 5:End Sub
  284. Sub Bumper1_Hit:vpmTimer.PulseSw(52):Playsound SoundFX("fx_bumper1",DOFContactors):DOF 101, DOFPulse:End Sub
  285. Sub Bumper2_Hit:vpmTimer.PulseSw(52):Playsound SoundFX("fx_bumper2",DOFContactors):DOF 103, DOFPulse:End Sub
  286. Sub Bumper3_Hit:vpmTimer.PulseSw(62):Playsound SoundFX("fx_bumper3",DOFContactors):DOF 102, DOFPulse:End Sub
  287. Sub LeftOutlane_Hit:Controller.Switch(12)=1:End Sub
  288. Sub LeftOutlane_unHit:Controller.Switch(12)=0:End Sub
  289. Sub LeftInlane_Hit:Controller.Switch(22)=1:End Sub
  290. Sub LeftInlane_unHit:Controller.Switch(22)=0:End Sub
  291. Sub RightInlane_Hit:Controller.Switch(42)=1:End Sub
  292. Sub RightInlane_unHit:Controller.Switch(42)=0:End Sub
  293. Sub Trigger1_Hit:Controller.Switch(40)=1:End Sub
  294. Sub Trigger1_unHit:Controller.Switch(40)=0:End Sub
  295. Sub Trigger2_Hit:Controller.Switch(50)=1:End Sub
  296. Sub Trigger2_unHit:Controller.Switch(50)=0:End Sub
  297. Sub Trigger3_Hit:Controller.Switch(60)=1:End Sub
  298. Sub Trigger3_unHit:Controller.Switch(60)=0:End Sub
  299. Sub Trigger4_Hit:Controller.Switch(11)=1:End Sub
  300. Sub Trigger4_unHit:Controller.Switch(11)=0:End Sub
  301. Sub Trigger5_Hit:Controller.Switch(1)=1:End Sub
  302. Sub Trigger5_unHit:Controller.Switch(1)=0:End Sub
  303. Sub Spinner_Spin:vpmTimer.PulseSw(70): PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner):End Sub
  304. Sub Target2_Hit:vpmTimer.PulseSw(71):End Sub
  305. Sub Target3_Hit:vpmTimer.PulseSw(53):End Sub
  306. Sub Target1_Hit:vpmTimer.PulseSw(2):End Sub
  307.  
  308. Sub LeftSlingShot_Slingshot
  309. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05
  310. DOF 104, DOFPulse
  311. vpmTimer.PulseSw(4)
  312. LSling.Visible = 0
  313. LSling1.Visible = 1
  314. sling2.rotx = 20
  315. LStep = 0
  316. LeftSlingShot.TimerEnabled = 1
  317. End Sub
  318.  
  319. Sub LeftSlingShot_Timer
  320. Select Case LStep
  321. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
  322. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0
  323. End Select
  324. LStep = LStep + 1
  325. End Sub
  326.  
  327. Sub LeftSlingShot1_Slingshot
  328. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05
  329. DOF 104, DOFPulse
  330. vpmTimer.PulseSw(4)
  331. LSling4.Visible = 0
  332. LSling5.Visible = 1
  333. sling4.rotx = 20
  334. LStep1 = 0
  335. LeftSlingShot1.TimerEnabled = 1
  336. End Sub
  337.  
  338. Sub LeftSlingShot1_Timer
  339. Select Case LStep1
  340. Case 3:LSLing5.Visible = 0:LSLing3.Visible = 1:sling4.rotx = 10
  341. Case 4:LSLing3.Visible = 0:LSLing4.Visible = 1:sling4.rotx = 0:LeftSlingShot1.TimerEnabled = 0
  342. End Select
  343. LStep1 = LStep1 + 1
  344. End Sub
  345.  
  346.  
  347. Sub RightSlingShot_Slingshot
  348. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05
  349. DOF 105, DOFPulse
  350. vpmTimer.PulseSw(4)
  351. RSling.Visible = 0
  352. RSling1.Visible = 1
  353. sling1.rotx = 20
  354. RStep = 0
  355. RightSlingShot.TimerEnabled = 1
  356. End Sub
  357.  
  358. Sub RightSlingShot_Timer
  359. Select Case RStep
  360. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
  361. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0
  362. End Select
  363. RStep = RStep + 1
  364. End Sub
  365.  
  366. Sub RightSlingShot1_Slingshot
  367. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05
  368. vpmTimer.PulseSw(4)
  369. RSling5.Visible = 0
  370. RSling4.Visible = 1
  371. sling3.rotx = 20
  372. RStep1 = 0
  373. RightSlingShot1.TimerEnabled = 1
  374. End Sub
  375.  
  376. Sub RightSlingShot1_Timer
  377. Select Case RStep1
  378. Case 3:RSling4.Visible = 0:RSling3.Visible = 1:sling3.rotx = 10
  379. Case 4:RSling3.Visible = 0:RSLing5.Visible = 1:sling3.rotx = 0:RightSlingShot1.TimerEnabled = 0
  380. End Select
  381. RStep1 = RStep1 + 1
  382. End Sub
  383.  
  384. Set Lights(0)=Light0 'GAME OVER RELAY
  385. Set Lights(1)=Light1 'TILT
  386. Set Lights(2)=Light2 'COIN LOCKOUT
  387. Set Lights(3)=Light3 'SHOOT AGAIN
  388. 'Set Lights(4)=Light4 'PLAYER 1
  389. 'Set Lights(5)=Light5 'PLAYER 2
  390. 'Set Lights(6)=Light6 'PLAYER 3
  391. 'Set Lights(7)=Light7 'PLAYER 4
  392. Set Lights(10)=Light10 'HIGH SCORE
  393. Set Lights(11)=Light11 'GAME OVER
  394. Set Lights(12)=Light12
  395. Lights(15)=Array(Light15B,Light15)
  396. Set Lights(16)=Light16B
  397. Set Lights(17)=Light17B
  398. Set Lights(18)=Light18B
  399. Set Lights(19)=Light19B
  400. Set Lights(20)=Light20B
  401. Set Lights(21)=Light21B
  402. Set Lights(22)=Light22B
  403. Set Lights(23)=Light23B
  404. Set Lights(24)=Light24B
  405. Set Lights(25)=Light25B
  406. Set Lights(26)=Light26B
  407. Set Lights(27)=Light27B
  408. Set Lights(28)=Light28B
  409. Set Lights(29)=Light29
  410. Set Lights(30)=Light30
  411. Set Lights(31)=Light31
  412. Set Lights(32)=Light32
  413. Set Lights(33)=Light33
  414. Set Lights(34)=Light34
  415. Set Lights(35)=Light35
  416. Set Lights(36)=Light36
  417. Set Lights(37)=Light37
  418. Set Lights(38)=Light38
  419. Set Lights(39)=Light39
  420. Set Lights(40)=Light40
  421. Set Lights(41)=Light41
  422. Set Lights(42)=Light42
  423. Set Lights(43)=Light43
  424. Set Lights(44)=Light44
  425. Set Lights(45)=Light45
  426. Set Lights(46)=Light46
  427. Set Lights(47)=Light47
  428. Set Lights(48)=Light48
  429. Set Lights(49)=Light49
  430. Lights(50)=Array(Light50B,Light50A)
  431. Set Lights(51)=Light51
  432.  
  433. Set Lights(8)=Light8
  434. Set Lights(9)=Light9
  435. Set Lights(13)=Light13
  436. Set Lights(14)=Light14
  437.  
  438. Sub Gate_Hit: PlaySound "Gate" : End Sub
  439.  
  440. 'Gottlieb Force II
  441. 'added by Inkochnito
  442. Sub editDips
  443. Dim vpmDips : Set vpmDips = New cvpmDips
  444. With vpmDips
  445. .AddForm 700,400,"Force II - DIP switches"
  446. .AddFrame 2,10,190,"Maximum credits",49152,Array("8 credits",0,"10 credits",32768,"15 credits",&H00004000,"25 credits",49152)'dip 15&16
  447. .AddFrame 2,86,190,"Coin chute 1 and 2 control",&H00002000,Array("seperate",0,"same",&H00002000)'dip 14
  448. .AddFrame 2,132,190,"Playfield special",&H00200000,Array("replay",0,"extra ball",&H00200000)'dip 22
  449. .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
  450. .AddChk 2,260,190,Array("Sound when scoring?",&H01000000)'dip 25
  451. .AddChk 2,275,190,Array("Replay button tune?",&H02000000)'dip 26
  452. .AddChk 2,290,190,Array("Coin switch tune?",&H04000000)'dip 27
  453. .AddChk 2,305,190,Array("Credits displayed?",&H08000000)'dip 28
  454. .AddChk 2,320,190,Array("Match feature",&H00020000)'dip 18
  455. .AddChk 2,335,190,Array("Attract features",&H20000000)'dip 30
  456. .AddChk 2,350,190,Array("Replay at 1.000.000",&H80000000)'dip 32
  457. .AddFrameExtra 205,10,190,"Attract tune",&H0200,Array("no attract tune",0,"attract tune played every 6 minutes",&H0200)'S-board dip 2
  458. .AddFrame 205,56,190,"Balls per game",&H00010000,Array("5 balls",0,"3 balls",&H00010000)'dip 17
  459. .AddFrame 205,102,190,"Replay limit",&H00040000,Array("no limit",0,"one per game",&H00040000)'dip 19
  460. .AddFrame 205,148,190,"Novelty",&H00080000,Array("normal game mode",0,"50,000 points for special/extra ball",&H0080000)'dip 20
  461. .AddFrame 205,194,190,"Game mode",&H00100000,Array("replay",0,"extra ball",&H00100000)'dip 21
  462. .AddFrame 205,240,190,"3rd coin chute credits control",&H00001000,Array("no effect",0,"add 9",&H00001000)'dip 13
  463. .AddFrame 205,286,190,"Tilt penalty",&H10000000,Array("game over",0,"ball in play",&H10000000)'dip 29
  464. .AddLabel 50,375,300,20,"After hitting OK, press F3 to reset game with new settings."
  465. End With
  466. Dim extra
  467. extra = Controller.Dip(4) + Controller.Dip(5)*256
  468. extra = vpmDips.ViewDipsExtra(extra)
  469. Controller.Dip(4) = extra And 255
  470. Controller.Dip(5) = (extra And 65280)\256 And 255
  471. End Sub
  472. Set vpmShowDips = GetRef("editDips")
  473. Dim n
  474. Dim Digits(32)
  475. Digits(0)=Array(a00,a01,a02,a03,a04,a05,a06,n,a08)
  476. Digits(1)=Array(a10,a11,a12,a13,a14,a15,a16,n,a18)
  477. Digits(2)=Array(a20,a21,a22,a23,a24,a25,a26,n,a28)
  478. Digits(3)=Array(a30,a31,a32,a33,a34,a35,a36,n,a38)
  479. Digits(4)=Array(a40,a41,a42,a43,a44,a45,a46,n,a48)
  480. Digits(5)=Array(a50,a51,a52,a53,a54,a55,a56,n,a58)
  481. Digits(6)=Array(b00,b01,b02,b03,b04,b05,b06,n,b08)
  482. Digits(7)=Array(b10,b11,b12,b13,b14,b15,b16,n,b18)
  483. Digits(8)=Array(b20,b21,b22,b23,b24,b25,b26,n,b28)
  484. Digits(9)=Array(b30,b31,b32,b33,b34,b35,b36,n,b38)
  485. Digits(10)=Array(b40,b41,b42,b43,b44,b45,b46,n,b48)
  486. Digits(11)=Array(b50,b51,b52,b53,b54,b55,b56,n,b58)
  487. Digits(12)=Array(c00,c01,c02,c03,c04,c05,c06,n,c08)
  488. Digits(13)=Array(c10,c11,c12,c13,c14,c15,c16,n,c18)
  489. Digits(14)=Array(c20,c21,c22,c23,c24,c25,c26,n,c28)
  490. Digits(15)=Array(c30,c31,c32,c33,c34,c35,c36,n,c38)
  491. Digits(16)=Array(c40,c41,c42,c43,c44,c45,c46,n,c48)
  492. Digits(17)=Array(c50,c51,c52,c53,c54,c55,c56,n,c58)
  493. Digits(18)=Array(d00,d01,d02,d03,d04,d05,d06,n,d08)
  494. Digits(19)=Array(d10,d11,d12,d13,d14,d15,d16,n,d18)
  495. Digits(20)=Array(d20,d21,d22,d23,d24,d25,d26,n,d28)
  496. Digits(21)=Array(d30,d31,d32,d33,d34,d35,d36,n,d38)
  497. Digits(22)=Array(d40,d41,d42,d43,d44,d45,d46,n,d48)
  498. Digits(23)=Array(d50,d51,d52,d53,d54,d55,d56,n,d58)
  499. Digits(26)=Array(e00,e01,e02,e03,e04,e05,e06,n,e08)
  500. Digits(27)=Array(e10,e11,e12,e13,e14,e15,e16,n,e18)
  501. Digits(24)=Array(f00,f01,f02,f03,f04,f05,f06,n,f08)
  502. Digits(25)=Array(f10,f11,f12,f13,f14,f15,f16,n,f18)
  503.  
  504. Sub DisplayTimer_Timer
  505. 'Dim ChgLED,ii,num,chg,stat
  506. 'ChgLED = Controller.ChangedLEDs(0, &H0fffffff)
  507. 'If Not IsEmpty(ChgLED) Then
  508. ' For ii = 0 To UBound(chgLED)
  509. ' num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  510. ' if char(stat) > "" then msg(num) = char(stat)
  511. ' next
  512. ' TextBox1.Text = msg(0) & msg(1) & msg(2) & char(0) & msg(3) & msg(4) & msg(5)
  513. ' TextBox2.Text = msg(6) & msg(7) & msg(8) & char(0) & msg(9) & msg(10) & msg(11)
  514. ' TextBox3.Text = msg(12) & msg(13) & msg(14) & char(0) & msg(15) & msg(16) & msg(17)
  515. ' TextBox4.Text = msg(18) & msg(19) & msg(20) & char(0) & msg(21) & msg(22) & msg(23)
  516. ' TextBox5.text = msg(24) & msg(25)
  517. ' TextBox6.text = msg(26) & msg(27)
  518. 'end if
  519. Dim ChgLED,ii,num,chg,stat,obj
  520. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  521. If Not IsEmpty(ChgLED) Then
  522. 'If not b2son Then
  523. For ii = 0 To UBound(chgLED)
  524. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  525. if (num < 32) then
  526. For Each obj In Digits(num)
  527. If chg And 1 Then obj.State = stat And 1
  528. chg = chg\2 : stat = stat\2
  529. Next
  530. else
  531.  
  532. end if
  533. next
  534. 'end if
  535. end if
  536. End Sub
  537. '*********************************************************************
  538. ' Positional Sound Playback Functions
  539. '*********************************************************************
  540.  
  541. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  542. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  543. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  544. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  545. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  546. End Sub
  547.  
  548. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  549. Sub PlaySoundAt(soundname, tableobj)
  550. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  551. End Sub
  552.  
  553. Sub PlaySoundAtBall(soundname)
  554. PlaySoundAt soundname, ActiveBall
  555. End Sub
  556.  
  557.  
  558. '*********************************************************************
  559. ' Supporting Ball & Sound Functions
  560. '*********************************************************************
  561.  
  562. 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
  563. Dim tmp
  564. tmp = tableobj.y * 2 / table1.height-1
  565. If tmp > 0 Then
  566. AudioFade = Csng(tmp ^10)
  567. Else
  568. AudioFade = Csng(-((- tmp) ^10) )
  569. End If
  570. End Function
  571.  
  572. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  573. Dim tmp
  574. tmp = tableobj.x * 2 / table1.width-1
  575. If tmp > 0 Then
  576. AudioPan = Csng(tmp ^10)
  577. Else
  578. AudioPan = Csng(-((- tmp) ^10) )
  579. End If
  580. End Function
  581.  
  582. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  583. Vol = Csng(BallVel(ball) ^2 / 2000)
  584. End Function
  585.  
  586. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  587. Pitch = BallVel(ball) * 20
  588. End Function
  589.  
  590. Function BallVel(ball) 'Calculates the ball speed
  591. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  592. End Function
  593.  
  594.  
  595. '*****************************************
  596. ' rothbauerw's Manual Ball Control
  597. '*****************************************
  598.  
  599. Dim BCup, BCdown, BCleft, BCright
  600. Dim ControlBallInPlay, ControlActiveBall
  601. Dim BCvel, BCyveloffset, BCboostmulti, BCboost
  602.  
  603. BCboost = 1 'Do Not Change - default setting
  604. BCvel = 4 'Controls the speed of the ball movement
  605. BCyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
  606. BCboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
  607.  
  608. ControlBallInPlay = false
  609.  
  610. Sub StartBallControl_Hit()
  611. Set ControlActiveBall = ActiveBall
  612. ControlBallInPlay = true
  613. End Sub
  614.  
  615. Sub StopBallControl_Hit()
  616. ControlBallInPlay = false
  617. End Sub
  618.  
  619. Sub BallControlTimer_Timer()
  620. If EnableBallControl and ControlBallInPlay then
  621. If BCright = 1 Then
  622. ControlActiveBall.velx = BCvel*BCboost
  623. ElseIf BCleft = 1 Then
  624. ControlActiveBall.velx = -BCvel*BCboost
  625. Else
  626. ControlActiveBall.velx = 0
  627. End If
  628.  
  629. If BCup = 1 Then
  630. ControlActiveBall.vely = -BCvel*BCboost
  631. ElseIf BCdown = 1 Then
  632. ControlActiveBall.vely = BCvel*BCboost
  633. Else
  634. ControlActiveBall.vely = bcyveloffset
  635. End If
  636. End If
  637. End Sub
  638.  
  639.  
  640. '*****************************************
  641. ' JP's VP10 Rolling Sounds
  642. '*****************************************
  643.  
  644. Const tnob = 5 ' total number of balls
  645. ReDim rolling(tnob)
  646. InitRolling
  647.  
  648. Sub InitRolling
  649. Dim i
  650. For i = 0 to tnob
  651. rolling(i) = False
  652. Next
  653. End Sub
  654.  
  655. Sub RollingTimer_Timer()
  656. Dim BOT, b
  657. BOT = GetBalls
  658.  
  659. ' stop the sound of deleted balls
  660. For b = UBound(BOT) + 1 to tnob
  661. rolling(b) = False
  662. StopSound("fx_ballrolling" & b)
  663. Next
  664.  
  665. ' exit the sub if no balls on the table
  666. If UBound(BOT) = -1 Then Exit Sub
  667.  
  668. ' play the rolling sound for each ball
  669. For b = 0 to UBound(BOT)
  670. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  671. rolling(b) = True
  672. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  673. Else
  674. If rolling(b) = True Then
  675. StopSound("fx_ballrolling" & b)
  676. rolling(b) = False
  677. End If
  678. End If
  679. Next
  680. End Sub
  681.  
  682. '**********************
  683. ' Ball Collision Sound
  684. '**********************
  685.  
  686. Sub OnBallBallCollision(ball1, ball2, velocity)
  687. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  688. End Sub
  689.  
  690.  
  691. Sub Pins_Hit (idx)
  692. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  693. End Sub
  694.  
  695. Sub Targets_Hit (idx)
  696. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  697. End Sub
  698.  
  699. Sub Metals_Thin_Hit (idx)
  700. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  701. End Sub
  702.  
  703. Sub Metals_Medium_Hit (idx)
  704. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  705. End Sub
  706.  
  707. Sub Metals2_Hit (idx)
  708. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  709. End Sub
  710.  
  711. Sub Gates_Hit (idx)
  712. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  713. End Sub
  714.  
  715.  
  716.  
  717. Sub Rubbers_Hit(idx)
  718. dim finalspeed
  719. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  720. If finalspeed > 20 then
  721. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  722. End if
  723. If finalspeed >= 6 AND finalspeed <= 20 then
  724. RandomSoundRubber()
  725. End If
  726. End Sub
  727.  
  728. Sub Posts_Hit(idx)
  729. dim finalspeed
  730. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  731. If finalspeed > 16 then
  732. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  733. End if
  734. If finalspeed >= 6 AND finalspeed <= 16 then
  735. RandomSoundRubber()
  736. End If
  737. End Sub
  738.  
  739. Sub RandomSoundRubber()
  740. Select Case Int(Rnd*3)+1
  741. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  742. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  743. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  744. End Select
  745. End Sub
  746.  
  747. Sub LeftFlipper_Collide(parm)
  748. RandomSoundFlipper()
  749. End Sub
  750.  
  751. Sub RightFlipper_Collide(parm)
  752. RandomSoundFlipper()
  753. End Sub
  754.  
  755. Sub RandomSoundFlipper()
  756. Select Case Int(Rnd*3)+1
  757. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  758. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  759. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  760. End Select
  761. End Sub
Advertisement
Add Comment
Please, Sign In to add comment