Arngrim

Black Sheep Squadron

Jul 5th, 2017
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.81 KB | None | 0 0
  1. 'Black Sheep Squadron (Astro 1979)
  2.  
  3. 'Version 1.0
  4.  
  5. Option Explicit
  6. Randomize
  7.  
  8. On Error Resume Next
  9. ExecuteGlobal GetTextFile("controller.vbs")
  10. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  11. On Error Goto 0
  12.  
  13. Const cGameName="blkshpsq", UseSolenoids=1,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="fx_Flipperup",SFlipperOff="fx_Flipperdown", SCoin="Coin",cCredits=""
  14. Const BallMass = 1.7
  15.  
  16. LoadVPM "01550000", "Bally.vbs", 3.26
  17. Dim DesktopMode: DesktopMode = Table1.ShowDT
  18.  
  19. '*********
  20. 'Solenoids
  21. '*********
  22. Solcallback(2) = "vpmSolSound SoundFX(""Chime10"",DOFChimes),"
  23. Solcallback(3) = "vpmSolSound SoundFX(""Chime100"",DOFChimes),"
  24. Solcallback(4) = "vpmSolSound SoundFX(""Chime1000"",DOFChimes),"
  25. Solcallback(5) = "vpmSolSound SoundFX(""ChimeExtra"",DOFChimes),"
  26. SolCallback(6) = "vpmSolSound SoundFX(""knocker"",DOFKnocker),"
  27. SolCallback(7) = "bsTrough.SolOut"
  28. SolCallBack(10) = "bsSaucer.SolOut"
  29. SolCallback(19) = "vpmNudge.SolGameOn"
  30.  
  31. '**************
  32. ' Flipper Subs
  33. '**************
  34.  
  35. SolCallback(sLRFlipper) = "SolRFlipper"
  36. SolCallback(sLLFlipper) = "SolLFlipper"
  37.  
  38. Sub SolLFlipper(Enabled)
  39. If Enabled Then
  40. PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd:PlaySound "buzz", -1 , .06, -1
  41. Else
  42. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart:StopSound "buzz"
  43. End If
  44. End Sub
  45.  
  46. Sub SolRFlipper(Enabled)
  47. If Enabled Then
  48. PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd:Playsound "buzz1", -1 , .05, 1
  49. Else
  50. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart:StopSound "buzz1"
  51. End If
  52. End Sub
  53.  
  54. Sub LeftFlipper_Collide(parm)
  55. RandomSoundFlipper()
  56. End Sub
  57.  
  58. Sub RightFlipper_Collide(parm)
  59. RandomSoundFlipper()
  60. End Sub
  61.  
  62. Sub RandomSoundFlipper()
  63. Select Case Int(Rnd*3)+1
  64. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  65. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  66. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  67. End Select
  68. End Sub
  69.  
  70. '**************
  71. ' GI Lights On
  72. '**************
  73.  
  74. dim xx
  75. For each xx in GI:xx.State = 1: Next
  76.  
  77. 'Initiate Table
  78. '**********************************************************************************************************
  79.  
  80. Dim bsTrough,bsSaucer
  81.  
  82. Sub Table1_Init
  83. vpmInit Me
  84. On Error Resume Next
  85. With Controller
  86. .GameName = cGameName
  87. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  88. .SplashInfoLine="Black Sheep Squadron (Astro 1979)"
  89. .HandleMechanics=0
  90. .HandleKeyboard=0
  91. .ShowDMDOnly=1
  92. .ShowFrame=0
  93. .ShowTitle=0
  94. .Hidden = 1
  95. If Err Then MsgBox Err.Description
  96. End With
  97. On Error Goto 0
  98. ' Controller.Dip(0) = (0*1 + 0*2 + 0*4 + 0*8 + 0*16 + 1*32 + 1*64 + 0*128) '01-08
  99. ' Controller.Dip(1) = (0*1 + 0*2 + 0*4 + 0*8 + 0*16 + 1*32 + 0*64 + 1*128) '09-16
  100. ' Controller.Dip(2) = (1*1 + 0*2 + 1*4 + 1*8 + 1*16 + 0*32 + 0*64 + 1*128) '17-24
  101. ' Controller.Dip(3) = (1*1 + 0*2 + 0*4 + 0*8 + 0*16 + 0*32 + 0*64 + 0*128) '25-32
  102.  
  103. Controller.SolMask(0)=0
  104. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  105. Controller.Run
  106. If Err Then MsgBox Err.Description
  107. On Error Goto 0
  108.  
  109. PinMAMETimer.Interval=PinMAMEInterval
  110. PinMAMETimer.Enabled=1
  111.  
  112.  
  113. ' Nudging
  114. vpmNudge.TiltSwitch = 7
  115. vpmNudge.Sensitivity = 5
  116. vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingshot, RightSlingshot)
  117.  
  118. ' Trough
  119. Set bsTrough = New cvpmBallStack
  120. With bsTrough
  121. .InitSw 0, 8, 0, 0, 0, 0, 0, 0
  122. .InitKick BallRelease, 90, 7
  123. .InitEntrySnd "Solenoid", "Solenoid"
  124. .InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  125. .Balls = 1
  126. End With
  127.  
  128. ' Saucer
  129. Set bsSaucer=New cvpmBallStack
  130. bsSaucer.InitSaucer Kicker1,13,131,10
  131. bsSaucer.InitExitSnd SoundFX("metalhit2",DOFContactors),SoundFX("popper_ball",DOFContactors)
  132.  
  133. End Sub
  134.  
  135. Sub table1_Paused:Controller.Pause = 1:End Sub
  136. Sub table1_unPaused:Controller.Pause = 0:End Sub
  137.  
  138. '**********************************************************************************************************
  139. 'Key Handling
  140. '**********************************************************************************************************
  141. Sub Table1_KeyDown(ByVal keycode)
  142. If vpmKeyDown(KeyCode) Then Exit Sub
  143.  
  144. If keycode=PlungerKey Then Plunger.Pullback:playsound"plungerpull",0,1,0.25,0.25
  145.  
  146. If keycode = LeftTiltKey Then LeftNudge 80, 1.2, 20:PlaySound SoundFX("nudge_left",0)
  147. If keycode = RightTiltKey Then RightNudge 280, 1.2, 20:PlaySound SoundFX("nudge_right",0)
  148. If keycode = CenterTiltKey Then CenterNudge 0, 1.6, 25:PlaySound SoundFX("nudge_forward",0)
  149. End Sub
  150.  
  151. Sub Table1_KeyUp(ByVal keycode)
  152. If vpmKeyUp(KeyCode) Then Exit Sub
  153. If keycode=PlungerKey Then Plunger.Fire:playsound"plunger",0,1,0.25,0.25
  154.  
  155. End Sub
  156.  
  157.  
  158. '**********Sling Shot Animations
  159. ' Rstep and Lstep are the variables that increment the animation
  160. '****************
  161. Dim RStep, Lstep
  162.  
  163. Sub RightSlingShot_Slingshot
  164. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  165. vpmTimer.PulseSw 36
  166. RightSling.Visible = 0
  167. RightSling1.Visible = 1
  168. sling1.TransZ = -20
  169. RStep = 0
  170. RightSlingShot.TimerEnabled = 1
  171.  
  172. End Sub
  173.  
  174. Sub RightSlingShot_Timer
  175. Select Case RStep
  176. Case 3:RightSLing1.Visible = 0:RightSLing2.Visible = 1:sling1.TransZ = -10
  177. Case 4:RightSLing2.Visible = 0:RightSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  178. End Select
  179. RStep = RStep + 1
  180. End Sub
  181.  
  182. Sub LeftSlingShot_Slingshot
  183. PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  184. vpmTimer.PulseSw 37
  185. LeftSling.Visible = 0
  186. LeftSling1.Visible = 1
  187. sling2.TransZ = -20
  188. LStep = 0
  189. LeftSlingShot.TimerEnabled = 1
  190.  
  191. End Sub
  192.  
  193. Sub LeftSlingShot_Timer
  194. Select Case LStep
  195. Case 3:LeftSLing1.Visible = 0:LeftSLing2.Visible = 1:sling2.TransZ = -10
  196. Case 4:LeftSLing2.Visible = 0:LeftSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  197. End Select
  198. LStep = LStep + 1
  199. End Sub
  200.  
  201.  
  202. '**********Rubber Compression
  203. ' RUstep, RLstep, and LLstep are the variables that increment the animation
  204. '****************
  205. Dim RUStep, RLstep, LLstep, LUstep, LDstep
  206.  
  207. Sub RubberRL_Hit
  208. 'Rubber Animation
  209. RubberRight.Visible = 0
  210. RubberRightLower.Visible = 1
  211. RLstep = 0
  212. RubberRL.TimerEnabled = 1
  213. End Sub
  214.  
  215.  
  216. Sub RubberRL_Timer
  217. Select Case RLstep
  218. Case 1:RubberRightLower.Visible = 0:RubberRight.Visible = 1:RubberRL.TimerEnabled = 0
  219. End Select
  220. RLStep = RLStep + 1
  221. End Sub
  222.  
  223. Sub RubberLU_Hit
  224. 'Rubber Animation
  225. RubberLeftUpper.Visible = 0
  226. RubberLeftUpper1.Visible = 1
  227. LUstep = 0
  228. RubberLU.TimerEnabled = 1
  229. End Sub
  230.  
  231.  
  232. Sub RubberLU_Timer
  233. Select Case LUstep
  234. Case 1:RubberLeftUpper1.Visible = 0:RubberLeftUpper.Visible = 1:RubberLU.TimerEnabled = 0
  235. End Select
  236. LUStep = LUStep + 1
  237. End Sub
  238.  
  239.  
  240.  
  241. '*********
  242. ' Switches
  243. '*********
  244.  
  245. 'Drain hole
  246. Sub Drain_Hit:bsTrough.AddBall Me : PlaySound "drain",0,1,0,0.25 :End Sub
  247.  
  248. 'Kicker
  249. Sub Kicker1_hit():bsSaucer.AddBall 0:playsound "popper_ball": End Sub
  250.  
  251. '10 point Rubbers
  252. Sub sw17b_Hit:vpmTimer.PulseSw 17
  253. vpmTimer.PulseSw 17
  254. 'Rubber Animation
  255. RubberRight.Visible = 0
  256. RubberRightUpper.Visible = 1
  257. RUstep = 0
  258. sw17b.TimerEnabled = 1
  259. End Sub
  260.  
  261. Sub sw17a_Hit:vpmTimer.PulseSw 17
  262. vpmTimer.PulseSw 17
  263. 'Rubber Animation
  264. RubberLeft.Visible = 0
  265. RubberLeftUpper.Visible = 1
  266. RUstep = 0
  267. sw17a.TimerEnabled = 1
  268. End Sub
  269.  
  270. ' Bumpers
  271. Dim bump1,bump2,bump3
  272.  
  273. Sub Bumper1_Hit:vpmTimer.PulseSw 38:PlaySound SoundFX("fx_bumper1",DOFContactors):bump1 = 1:Me.TimerEnabled = 1::End Sub
  274. Sub Bumper1_timer()
  275. Select Case bump1
  276. Case 1:Ring1.z = 5:bump1 = 2
  277. Case 2:Ring1.z = -5:bump1 = 3
  278. Case 3:Ring1.z = -15:bump1 = 4
  279. Case 4:Ring1.z = -15:bump1 = 5
  280. Case 5:Ring1.z = -5:bump1 = 6
  281. Case 6:Ring1.z = 5:bump1 = 7
  282. Case 7:Ring1.z = 5:Me.TimerEnabled = 0
  283. End Select
  284. End Sub
  285.  
  286. Sub Bumper2_Hit:vpmTimer.PulseSw 39:PlaySound SoundFX("fx_bumper2",DOFContactors): bump2 = 1:Me.TimerEnabled = 1::End Sub
  287. Sub Bumper2_timer()
  288. Select Case bump2
  289. Case 1:Ring2.z = 5:bump2 = 2
  290. Case 2:Ring2.z = -5:bump2 = 3
  291. Case 3:Ring2.z = -15:bump2 = 4
  292. Case 4:Ring2.z = -15:bump2 = 5
  293. Case 5:Ring2.z = -5:bump2 = 6
  294. Case 6:Ring2.z = 5:bump2 = 7
  295. Case 7:Ring2.z = 5:Me.TimerEnabled = 0
  296. End Select
  297. End Sub
  298.  
  299. Sub Bumper3_Hit:vpmTimer.PulseSw 40:PlaySound SoundFX("fx_bumper3",DOFContactors):bump3 = 1:Me.TimerEnabled = 1: End Sub
  300. Sub Bumper3_timer()
  301. Select Case bump3
  302. Case 1:Ring3.z = 5:bump3 = 2
  303. Case 2:Ring3.z = -5:bump3 = 3
  304. Case 3:Ring3.z = -15:bump3 = 4
  305. Case 4:Ring3.z = -15:bump3 = 5
  306. Case 5:Ring3.z = -5:bump3 = 6
  307. Case 6:Ring3.z = 5:bump3 = 7
  308. Case 7:Ring3.z = 5:Me.TimerEnabled = 0
  309. End Select
  310. End Sub
  311.  
  312.  
  313. ' Rollovers
  314. Sub sw34_Hit:Controller.Switch(34) = 1:PlaySound "sensor":PlaySound "outlane":End Sub 'L outlane
  315. Sub sw34_UnHit:Controller.Switch(34) = 0:End Sub
  316.  
  317. Sub sw33_Hit:Controller.Switch(33) = 1:PlaySound "sensor":PlaySound "outlane":End Sub 'R outlane
  318. Sub sw33_UnHit:Controller.Switch(33) = 0:End Sub
  319.  
  320. Sub sw21_Hit:Controller.Switch(21) = 1:PlaySound "sensor":End Sub 'Lane R
  321. Sub sw21_UnHit:Controller.Switch(21) = 0:End Sub
  322.  
  323. Sub sw22_Hit:Controller.Switch(22) = 1:PlaySound "sensor":End Sub 'Lane D
  324. Sub sw22_UnHit:Controller.Switch(22) = 0:End Sub
  325.  
  326. Sub sw23_Hit:Controller.Switch(23) = 1:PlaySound "sensor":End Sub 'Lane A
  327. Sub sw23_UnHit:Controller.Switch(23) = 0:End Sub
  328.  
  329. Sub sw24_Hit:Controller.Switch(24) = 1:PlaySound "sensor":End Sub 'Lane U
  330. Sub sw24_UnHit:Controller.Switch(24) = 0:End Sub
  331.  
  332. Sub sw26_Hit:Controller.Switch(26) = 1:PlaySound "sensor":End Sub 'L inlane
  333. Sub sw26_UnHit:Controller.Switch(26) = 0:End Sub
  334.  
  335. Sub sw25_Hit:Controller.Switch(25) = 1:PlaySound "sensor":End Sub 'R inlane
  336. Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
  337.  
  338. Sub sw12a_Hit:Controller.Switch(12) = 1:PlaySound "sensor":End Sub 'Bottom Rollover
  339. Sub sw12a_UnHit:Controller.Switch(12) = 0:End Sub
  340.  
  341. Sub sw12_Hit:Controller.Switch(12) = 1:PlaySound "sensor":End Sub 'Top Rollover
  342. Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
  343.  
  344. Sub sw1_Hit:Controller.Switch(1) = 1:PlaySound "sensor":End Sub 'Chute rollover
  345. Sub sw1_UnHit:Controller.Switch(1) = 0:End Sub
  346.  
  347. ' Targets
  348. Sub sw29_Hit:vpmTimer.PulseSw 29:PlaySound SoundFX("target",DOFTargets):End Sub 'Target N
  349. Sub sw30_Hit:vpmTimer.PulseSw 30:PlaySound SoundFX("target",DOFTargets):End Sub 'Target O
  350. Sub sw31_Hit:vpmTimer.PulseSw 31:PlaySound SoundFX("target",DOFTargets):End Sub 'Target Q
  351. Sub sw32_Hit:vpmTimer.PulseSw 32:PlaySound SoundFX("target",DOFTargets):End Sub 'Target S
  352.  
  353. ' Spinner1
  354. Sub SPinner1_Spin():vpmTimer.PulseSw(2) : playsound"fx_spinner" : End Sub
  355.  
  356.  
  357. '**************
  358. ' Edit Dips
  359. '**************
  360. '******About the DIP switches******
  361. 'The astro rom and bally.vbs are not quite 100% compatible
  362. 'some of the switches in the manual are correct some are not in earlier versions
  363. 'the third light at the kicker hole would not cycle and you could not add more than 2 players
  364. 'Dip 24 and 25 "ON" solve these issues and must be on for the game to function properly
  365. 'The adjustable Dips are:
  366. 'Dip 7 balls per game on=3 off=5
  367. 'Dip 8 The song "Halls of Montezuma" on the chimes will play off=Only at startup on= With each player add
  368. 'Dip 16 Bumper and extra ball outlane lights alternate on= alternate off= stay on
  369. 'Dip 22 Bonus countdown will cycle through the spots x's how many multipliers or count x's at each spot On=over x's mult off= count mult at each spot
  370.  
  371. Sub EditDips
  372. Dim vpmDips:Set vpmDips=New cvpmDips 'initializes vpmDips to the cvpmDips class to allow creation of a window option menu
  373. With vpmDips
  374. .AddForm 700,400,"Black Sheep - DIP switches"
  375. .AddChk 2,2,190,Array("dip 1 OFF",&H00000001)'dip 1 "1-5 Control coin slot 1 all off is 1 for 1"
  376. .AddChk 2,20,190,Array("dip 2 OFF",&H00000002)'dip 2
  377. .AddChk 2,40,190,Array("dip 3 OFF",&H00000004)'dip 3
  378. .AddChk 2,60,190,Array("dip 4 OFF",&H00000004)'dip 4
  379. .AddChk 2,80,190,Array("dip 5 OFF",&H00000010)'dip 5
  380. .AddChk 2,100,190,Array("dip 6 ON",&H00000020)'dip 6 to give a credit for beating the high game
  381. .AddChk 2,120,190,Array("*dip 7 BPG ON=5 OFF=3",&H00000040)'dip 7 off 3 on 5 balls per game
  382. .AddChk 2,140,190,Array("*dip 8 Song Off=only at begining",&H00000080)'dip 8 halls of montezuma plays at begining if off or on every player add if on
  383. .AddChk 2,160,190,Array("dip 9 OFF",&H00000100)'dip 9 "9-13 control coin slot 2 all of is 3 for 2"
  384. .AddChk 2,180,190,Array("dip 10 OFF",&H00000200)'dip 10
  385. .AddChk 2,200,190,Array("dip 11 OFF",&H00000400)'dip 11
  386. .AddChk 2,220,190,Array("dip 12 OFF",&H00000800)'dip 12
  387. .AddChk 2,240,190,Array("dip 13 OFF",&H00001000)'dip 13
  388. .AddChk 2,260,190,Array("dip 14 ON",&H00002000)'dip 14 & 15 current settings give 1 game for HS
  389. .AddChk 2,280,190,Array("dip 15 OFF",&H00004000)'dip 15
  390. .AddChk 2,300,190,Array("*dip 16 Bumper lights ON=Alternate",32768)'dip 16 for bumper and in lane lights to alternate or stay on
  391. .AddChk 200,2,190,Array("dip 17 ON",&H00010000)'dip 17 17,18,19 control max credits this setup is for 30 max
  392. .AddChk 200,20,190,Array("dip 18 OFF",&H00020000)'dip 18
  393. .AddChk 200,40,190,Array("dip 19 ON",&H00040000)'dip 19
  394. .AddChk 200,60,190,Array("dip 20 ON credit display",&H00080000)'dip 20
  395. .AddChk 200,80,190,Array("dip 21 ON match Function",&H00100000)'dip 21
  396. .AddChk 200,100,190,Array("*dip 22 OFF bns countdown",&H00200000)'dip 22 if on bonus countdown will go through all spots x multiplier - off will count multiplier at each spot
  397. .AddChk 200,120,190,Array("dip 23 OFF",&H00400000)'dip 23 unkown
  398. .AddChk 200,140,190,Array("dip 24 ON For l40 to function",&H00800000)'dip 24 must be on for l40 at the kicker to function otherwise it does not cycle through the "light extra ball lanes" lamp
  399. .AddChk 200,160,190,Array("dip 25 ON for 4 player",&H01000000)'dip 25 must be on for the 4 player to work
  400. .AddChk 200,180,190,Array("dip 26 OFF",&H02000000)'dip 26 26 - 30 are not used by the atro rom but may trigger something inthe bally.vbs
  401. .AddChk 200,200,190,Array("dip 27 OFF",&H04000000)'dip 27
  402. .AddChk 200,220,190,Array("dip 28 OFF",&H08000000)'dip 28
  403. .AddChk 200,240,190,Array("dip 29 OFF",&H10000000)'dip 29
  404. .AddChk 200,260,190,Array("dip 30 OFF",&H20000000)'dip 30
  405. .AddChk 200,280,190,Array("dip 31 OFF",&H40000000)'dip 31 31 and 32 off will give 10,000 points for hitting special
  406. .AddChk 200,300,190,Array("dip 32 OFF",&H80000000)'dip 32
  407. .Addlabel 50,320,340,20,"Rom is not fully Compatible with the Bally.vbs"
  408. .Addlabel 50,340,340,20, "the * dips are switchable"
  409. .AddLabel 50,400,340,20,"After hitting OK, press F3 to reset game with new settings."
  410. .ViewDips
  411. End With
  412. End Sub
  413. Set vpmShowDips=GetRef("EditDips") ' This sets the F6 routine for vpmShowDips to run the subroutine "EditDips" rather than the standard dip menu in the VBS file
  414.  
  415.  
  416. '********
  417. 'LIGHTS
  418. '********
  419.  
  420. Set Lights(1) = l1 '1k bouns
  421. Set Lights(2) = l2 '5k bonus
  422. Set Lights(3) = l3 '9k bonus
  423. Set Lights(4) = l4 'Target S
  424. Set Lights(5) = l5 'Lane U
  425. Lights(6) = Array(l6,l6a,l6b,l6c,l6d,l6e) 'Top & Bottom bumper lights
  426. Lights(7) = Array(l7,l7a,l7b) ' middle bumper light
  427. Set Lights(8) = l8 'Lite Spinner at kicker
  428. Set Lights(9) = l9 '2x bounus enable
  429. Set Lights(10) = l10 '2x bonus
  430. Set Lights(11) = l11 'Shoot again
  431. Set Lights(12) = l12 'BG Same player shoots again
  432. Set Lights(13) = l13 'BG Ball in Play
  433. Set Lights(14) = l14 'BG Can Play 1
  434. Set Lights(15) = l15 'BG Player Up 1
  435. Set Lights(17) = l17 '2k bonus
  436. Set Lights(18) = l18 '6k bonus
  437. Set Lights(19) = l19 '10k bonus
  438. Set Lights(20) = l20 'Target Q
  439. Set Lights(21) = l21 'Lane A
  440. Set Lights(22) = l22 'L inlane
  441. Set Lights(23) = l23 'R inlane
  442. Set Lights(24) = l24 '50000 at kicker
  443. Set Lights(25) = l25 '3x bonus enable
  444. Set Lights(26) = l26 '3x bonus
  445. Set Lights(27) = l27 'BG Match
  446. Set Lights(29) = l29 'BG High Score to Date
  447. Set Lights(30) = l30 'BG Can Play 2
  448. Set Lights(31) = l31 'BG Player Up 2
  449. Set Lights(33) = l33 '3k bonus
  450. Set Lights(34) = l34 '7k bonus
  451. Set Lights(36) = l36 'Target O
  452. Set Lights(37) = l37 'Lane D
  453. Set Lights(38) = l38 'top rollover
  454. Set Lights(39) = l39 'Bottom rollover
  455. Set Lights(40) = l40 'unknown should be lite extra ball lanes at kicker???
  456. Set Lights(41) = l41 '5x bonus enable
  457. Set Lights(42) = l42 '5x Bonus
  458. Set Lights(45) = l45 'BG GAME OVER
  459. Set Lights(46) = l46 'BG can play 3
  460. Set Lights(47) = l47 'BG Player up 3
  461. Set Lights(49) = l49 '4k bonus
  462. Set Lights(50) = l50 '8k bonus
  463. Set Lights(52) = l52 'Target N
  464. Set Lights(53) = l53 'Slot R
  465. 'Set Lights(54) = l54 'on constant in game
  466. 'Set Lights(55) = l55 'on constant in game
  467. Set Lights(57) = l57 'Special Light
  468. Set Lights(60) = l60 'Spinner light
  469. Set Lights(61) = l61 'BG TILT
  470. Set Lights(62) = l62 'BG can play 4
  471. Set Lights(63) = l63 'BG Player up 4
  472.  
  473.  
  474. '******************************************************
  475. ' RealTime Updates
  476. '******************************************************
  477.  
  478. dim defaultEOS,EOSAngle,EOSTorque
  479. defaulteos = leftflipper.eostorque
  480. EOSAngle = 3
  481. EOSTorque = 0.9
  482.  
  483. Sub GameTimer_Timer()
  484. RollingSoundUpdate
  485.  
  486.  
  487. If LeftFlipper.CurrentAngle < LeftFlipper.EndAngle + EOSAngle Then
  488. LeftFlipper.eostorque = EOSTorque
  489. Else
  490. LeftFlipper.eostorque = defaultEOS
  491. End If
  492.  
  493. If RightFlipper.CurrentAngle > RightFlipper.EndAngle - EOSAngle Then
  494. RightFlipper.eostorque = EOSTorque
  495. Else
  496. RightFlipper.eostorque = defaultEOS
  497. End If
  498.  
  499. FlipperLSh.RotZ = LeftFlipper.currentangle
  500. FlipperRSh.RotZ = RightFlipper.currentangle
  501.  
  502. End Sub
  503.  
  504. ' *********************************************************************
  505. ' Supporting Ball & Sound Functions
  506. ' *********************************************************************
  507.  
  508. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  509. Vol = Csng(BallVel(ball) ^2 / 2000)
  510. End Function
  511.  
  512. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  513. Dim tmp
  514. tmp = ball.x * 2 / table1.width-1
  515. If tmp > 0 Then
  516. Pan = Csng(tmp ^10)
  517. Else
  518. Pan = Csng(-((- tmp) ^10) )
  519. End If
  520. End Function
  521.  
  522. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  523. Pitch = BallVel(ball) * 20
  524. End Function
  525.  
  526. Function BallVel(ball) 'Calculates the ball speed
  527. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  528. End Function
  529.  
  530. '*****************************************
  531. ' JP's VP10 Rolling Sounds
  532. '*****************************************
  533.  
  534. Const tnob = 5 ' total number of balls
  535. ReDim rolling(tnob)
  536. InitRolling
  537.  
  538. Sub InitRolling
  539. Dim i
  540. For i = 0 to tnob
  541. rolling(i) = False
  542. Next
  543. End Sub
  544.  
  545. Sub RollingSoundUpdate()
  546. Dim BOT, b
  547. BOT = GetBalls
  548.  
  549. ' stop the sound of deleted balls
  550. For b = UBound(BOT) + 1 to tnob
  551. rolling(b) = False
  552. StopSound("fx_ballrolling" & b)
  553. Next
  554.  
  555. ' exit the sub if no balls on the table
  556. If UBound(BOT) = -1 Then Exit Sub
  557.  
  558. ' play the rolling sound for each ball
  559. For b = 0 to UBound(BOT)
  560. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  561. rolling(b) = True
  562. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  563. Else
  564. If rolling(b) = True Then
  565. StopSound("fx_ballrolling" & b)
  566. rolling(b) = False
  567. End If
  568. End If
  569. Next
  570. End Sub
  571.  
  572. '**********************
  573. ' Ball Collision Sound
  574. '**********************
  575.  
  576. Sub OnBallBallCollision(ball1, ball2, velocity)
  577. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  578. End Sub
  579.  
  580.  
  581. '*********** BALL SHADOW *********************************
  582. Dim BallShadow
  583. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  584.  
  585. Sub BallShadowUpdate_timer()
  586. Dim BOT, b
  587. BOT = GetBalls
  588. ' hide shadow of deleted balls
  589. If UBound(BOT)<(tnob-1) Then
  590. For b = (UBound(BOT) + 1) to (tnob-1)
  591. BallShadow(b).visible = 0
  592. Next
  593. End If
  594. ' exit the Sub if no balls on the table
  595. If UBound(BOT) = -1 Then Exit Sub
  596. ' render the shadow for each ball
  597. For b = 0 to UBound(BOT)
  598. If BOT(b).X < Table1.Width/2 Then
  599. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 10
  600. Else
  601. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 10
  602. End If
  603. ballShadow(b).Y = BOT(b).Y + 20
  604. If BOT(b).Z > 20 Then
  605. BallShadow(b).visible = 1
  606. Else
  607. BallShadow(b).visible = 0
  608. End If
  609. Next
  610. End Sub
  611.  
  612.  
  613.  
  614. '************************************
  615. ' What you need to add to your table
  616. '************************************
  617.  
  618. ' a timer called RollingTimer. With a fast interval, like 10
  619. ' one collision sound, in this script is called fx_collide
  620. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  621. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  622.  
  623.  
  624. '******************************************
  625. ' Explanation of the rolling sound routine
  626. '******************************************
  627.  
  628. ' sounds are played based on the ball speed and position
  629.  
  630. ' the routine checks first for deleted balls and stops the rolling sound.
  631.  
  632. ' The For loop goes through all the balls on the table and checks for the ball speed and
  633. ' if the ball is on the table (height lower than 30) then then it plays the sound
  634. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  635.  
  636. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  637. ' will change according to the ball speed, and the PAN function will change the stereo position according
  638. ' to the position of the ball on the table.
  639.  
  640.  
  641. '**************************************
  642. ' Explanation of the collision routine
  643. '**************************************
  644.  
  645. ' The collision is built in VP.
  646. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  647. ' 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
  648. ' depending of the speed of the collision.
  649.  
  650.  
  651. Sub Pins_Hit (idx)
  652. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  653. End Sub
  654.  
  655. Sub Targets_Hit (idx)
  656. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  657. End Sub
  658.  
  659. Sub Metals_Thin_Hit (idx)
  660. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  661. End Sub
  662.  
  663. Sub Metals_Medium_Hit (idx)
  664. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  665. End Sub
  666.  
  667. Sub Metals2_Hit (idx)
  668. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  669. End Sub
  670.  
  671. Sub Gates_Hit (idx)
  672. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  673. End Sub
  674.  
  675. Sub Spinner_Spin
  676. PlaySound "fx_spinner",0,.25,0,0.25
  677. End Sub
  678.  
  679. Sub Rubbers_Hit(idx)
  680. dim finalspeed
  681. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  682. If finalspeed > 20 then
  683. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  684. End if
  685. If finalspeed >= 6 AND finalspeed <= 20 then
  686. RandomSoundRubber()
  687. End If
  688. End Sub
  689.  
  690.  
  691. Sub Rubbers_Collidable_Hit(idx)
  692. dim finalspeed
  693. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  694. If finalspeed > 20 then
  695. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  696. End if
  697. If finalspeed >= 6 AND finalspeed <= 20 then
  698. RandomSoundRubber()
  699. End If
  700. End Sub
  701.  
  702. Sub Rubbers_Collidable_Wall_Hit(idx)
  703. dim finalspeed
  704. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  705. If finalspeed > 20 then
  706. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  707. End if
  708. If finalspeed >= 6 AND finalspeed <= 20 then
  709. RandomSoundRubber()
  710. End If
  711. End Sub
  712.  
  713. Sub Posts_Hit(idx)
  714. dim finalspeed
  715. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  716. If finalspeed > 16 then
  717. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  718. End if
  719. If finalspeed >= 6 AND finalspeed <= 16 then
  720. RandomSoundRubber()
  721. End If
  722. End Sub
  723.  
  724. Sub RandomSoundRubber()
  725. Select Case Int(Rnd*2)+1
  726. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  727. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  728. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  729. End Select
  730. End Sub
  731.  
  732. Sub Bumpers_Hit(idx)
  733. Select Case Int(Rnd*4)+1
  734. Case 1 : PlaySound SoundFx("fx_bumper2",DOFContactors), 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  735. Case 2 : PlaySound SoundFx("fx_bumper2",DOFContactors), 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  736. Case 3 : PlaySound SoundFx("fx_bumper3",DOFContactors), 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  737. Case 4 : PlaySound SoundFx("fx_bumper4",DOFContactors), 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  738. End Select
  739. End Sub
  740.  
  741. Sub Woods_Hit (idx)
  742. PlaySound "woodhit", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  743. End Sub
  744.  
  745.  
  746. '************************************
  747. ' LEDs Display
  748. 'Based on Scapino's 7 digit Reel LEDs
  749. '************************************
  750.  
  751.  
  752. LampTimer.Interval = 35
  753. LampTimer.Enabled = 1
  754.  
  755. Sub LampTimer_Timer()
  756. UpdateLeds
  757. UpdateTextBoxes
  758. End Sub
  759.  
  760.  
  761. Dim Digits(32)
  762. Dim Patterns(11)
  763. Dim Patterns2(11)
  764.  
  765. Patterns(0) = 0 'empty
  766. Patterns(1) = 63 '0
  767. Patterns(2) = 6 '1
  768. Patterns(3) = 91 '2
  769. Patterns(4) = 79 '3
  770. Patterns(5) = 102 '4
  771. Patterns(6) = 109 '5
  772. Patterns(7) = 125 '6
  773. Patterns(8) = 7 '7
  774. Patterns(9) = 127 '8
  775. Patterns(10) = 111 '9
  776.  
  777. Patterns2(0) = 128 'empty
  778. Patterns2(1) = 191 '0
  779. Patterns2(2) = 134 '1
  780. Patterns2(3) = 219 '2
  781. Patterns2(4) = 207 '3
  782. Patterns2(5) = 230 '4
  783. Patterns2(6) = 237 '5
  784. Patterns2(7) = 253 '6
  785. Patterns2(8) = 135 '7
  786. Patterns2(9) = 255 '8
  787. Patterns2(10) = 239 '9
  788.  
  789. Set Digits(0) = a0
  790. Set Digits(1) = a1
  791. Set Digits(2) = a2
  792. Set Digits(3) = a3
  793. Set Digits(4) = a4
  794. Set Digits(5) = a5
  795. ' Set Digits(6) = a6
  796.  
  797. Set Digits(6) = b0
  798. Set Digits(7) = b1
  799. Set Digits(8) = b2
  800. Set Digits(9) = b3
  801. Set Digits(10) = b4
  802. Set Digits(11) = b5
  803. ' Set Digits(13) = b6
  804.  
  805. Set Digits(12) = c0
  806. Set Digits(13) = c1
  807. Set Digits(14) = c2
  808. Set Digits(15) = c3
  809. Set Digits(16) = c4
  810. Set Digits(17) = c5
  811. ' Set Digits(20) = c6
  812.  
  813. Set Digits(18) = d0
  814. Set Digits(19) = d1
  815. Set Digits(20) = d2
  816. Set Digits(21) = d3
  817. Set Digits(22) = d4
  818. Set Digits(23) = d5
  819. ' Set Digits(27) = d6
  820.  
  821. Set Digits(24) = e0
  822. Set Digits(25) = e1
  823. Set Digits(26) = e2
  824. Set Digits(27) = e3
  825.  
  826. Sub UpdateLeds
  827. On Error Resume Next
  828. Dim ChgLED, ii, jj, chg, stat
  829. ChgLED = Controller.ChangedLEDs(&HFF, &HFFFF)
  830. If Not IsEmpty(ChgLED)Then
  831. For ii = 0 To UBound(ChgLED)
  832. chg = chgLED(ii, 1):stat = chgLED(ii, 2)
  833.  
  834. For jj = 0 to 10
  835. If stat = Patterns(jj)OR stat = Patterns2(jj)then Digits(chgLED(ii, 0)).SetValue jj
  836. Next
  837. Next
  838. End IF
  839. End Sub
  840.  
  841.  
  842. Sub UpdateTextBoxes()
  843. NFadeT 13, l13, "BALL IN PLAY"
  844. NFadeT 27, l27, "MATCH"
  845. NFadeT 29, l29, "HIGH SCORE TO DATE"
  846. NFadeT 12, l12, "SAME PLAYER SHOOTS AGAIN" 'or 43
  847. NFadeT 45, l45, "GAME OVER"
  848. NFadeT 61, l61, "TILT"
  849. NFadeT 14, l14, "1"
  850. NFadeT 30, l30, "2"
  851. NFadeT 46, l46, "3"
  852. NFadeT 62, l62, "4"
  853. End Sub
  854.  
  855. Sub NFadeT(nr, a, b)
  856. Select Case controller.lamp(nr)
  857. Case False:a.Text = ""
  858. Case True:a.Text = b
  859. End Select
  860. End Sub
  861.  
  862. CREDIT.Text = "CREDIT"
  863.  
  864.  
  865. dim zz
  866. If Table1.ShowDT = false then
  867. For each zz in DT:zz.Visible = false: Next
  868. else
  869. For each zz in DT:zz.Visible = true: Next
  870. End If
  871.  
  872.  
  873. Sub Table1_Exit()
  874.  
  875. End Sub
Advertisement
Add Comment
Please, Sign In to add comment