Arngrim

TX-Sector

Jan 18th, 2020
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.26 KB | None | 0 0
  1. Option Explicit
  2. Randomize
  3.  
  4. On Error Resume Next
  5. ExecuteGlobal GetTextFile("controller.vbs")
  6. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  7. On Error Goto 0
  8.  
  9. 'Arngrim
  10. 'DOF added manual mapping for shared switches to separate for DOF
  11. 'Please copy the respective commands in case of a future version of the table to have full DOF force feedback experience
  12. 'DOF 104 : Left oultane switch
  13. 'DOF 105 : Right outlane switch
  14. 'DOF 121 : Right slingshot
  15. 'DOF 122 : Left slingshot
  16. 'DOF 123 : Left lower trigger switch
  17. 'DOF 124 : Right lower trigger switch
  18.  
  19.  
  20. Const cGameName = "txsector",UseSolenoids=2,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="Flipper2",SFlipperOff="Flipper"
  21. Const SCoin="coin3",cCredits=""
  22.  
  23. Const Ballsize = 50
  24.  
  25.  
  26. LoadVPM "01110000", "sys80.vbs", 3.1
  27.  
  28.  
  29. If Table1.ShowDT = True Then 'Show Desktop components
  30. 'wall7.visible=0
  31. Wall77.visible=1
  32. Primitive13.visible=1
  33. ramp016.visible=0
  34. Ramp017.visible=0
  35. ramp15.visible=1
  36. Ramp16.visible=1
  37. DisplayTimer.Enabled = 1
  38. Else
  39. 'wall77.visible=0
  40. wall7.visible=0
  41. Primitive13.visible=0
  42. ramp016.visible=1
  43. Ramp017.visible=1
  44. ramp15.visible=0
  45. Ramp16.visible=0
  46. DisplayTimer.Enabled = 0
  47. End if
  48.  
  49. Set LampCallback=GetRef("UpdateMultipleLamps")
  50.  
  51. gion()
  52.  
  53.  
  54. sub gion()
  55. gi_1.state=1
  56. gi_2.state=1
  57. GI_3.state=1
  58. GI_4.state=1
  59. gi_5.state=1
  60. GI_6.state=1
  61. GI_7.state=1
  62. gi_8.state=1
  63. gi_9.state=1
  64. GI_10.state=1
  65. GI_12.state=1
  66. gi_13.state=1
  67. gi_20.state=1
  68. GI_28.state=1
  69. GI_29.state=1
  70. gi_31.state=1
  71. GI_34.state=1
  72. GI_43.state=1
  73. GI_53.state=1
  74. End Sub
  75.  
  76. sub gioff()
  77. gi_1.state=0
  78. gi_2.state=0
  79. gi_3.state=0
  80. gi_4.state=0
  81. gi_5.state=0
  82. GI_6.state=0
  83. GI_7.state=0
  84. gi_8.state=0
  85. gi_9.state=0
  86. GI_10.state=0
  87. GI_12.state=0
  88. gi_13.state=0
  89. gi_20.state=0
  90. GI_28.state=0
  91. GI_29.state=0
  92. gi_31.state=0
  93. GI_34.state=0
  94. GI_43.state=0
  95. GI_53.state=0
  96. End Sub
  97. if rnd*2 > 1 Then
  98. ball2.CreateSizedBall(25)
  99. ball2.Kick 180,1
  100. ball2.enabled=false
  101. Else
  102. ball3.CreateSizedBall(25)
  103. ball3.Kick 180,1
  104. ball3.enabled=false
  105. end If
  106. ball4.CreateSizedBall(25)
  107. ball4.Kick 180,1
  108. ball4.enabled=false
  109. ball5.CreateSizedBall(25)
  110. ball5.Kick 180,1
  111. ball5.enabled=false
  112.  
  113. '*************************************************************
  114. 'Solenoid Call backs
  115. '**********************************************************************************************************
  116.  
  117. SolCallback(sLRFlipper) = "SolRFlipper"
  118. SolCallback(sLLFlipper) = "SolLFlipper"
  119. SolCallback(1)="sol1"
  120. SolCallback(2)="sol2"
  121. SolCallback(5)="sol5"
  122. SolCallback(6)="sol6"
  123. SolCallback(8)="vpmSolSound SoundFX(""knocker"",DOFKnocker)," 'knocker
  124. SolCallback(9)="k4" 'outhole
  125. SolCallback(3) = "dtr4.SolDropUp"
  126. SolCallback(4) = "DTt4.SolDropUp"
  127. SolCallback(7) = "DTl1.SolDropUp"
  128.  
  129.  
  130.  
  131.  
  132. sub sol1 (enabled)
  133. if enabled Then
  134. if light12.state =1 Then
  135. lightsol1.state=1
  136. lightsol1a.state=1
  137. Else
  138. Kicker5.kick 135,2
  139. lightsol1.state=0
  140. lightsol1a.state=0
  141. end If
  142. Else
  143. lightsol1.state=0
  144. lightsol1a.state=0
  145. end If
  146. end Sub
  147.  
  148. sub sol2 (enabled)
  149. if enabled Then
  150. if light12.state =1Then
  151. lightsol2.state=1
  152. lightsol2a.state=1
  153. Else
  154. Kicker5.kick 135,2
  155. Kicker2.kick 200,2
  156. lightsol2.state=0
  157. lightsol2a.state=0
  158. end If
  159. Else
  160. lightsol2.state=0
  161. lightsol2a.state=0
  162. end If
  163. end Sub
  164.  
  165. sub sol5 (enabled)
  166. if enabled Then
  167. if light12.state =1 Then
  168. lightsol5.state=1
  169. lightsol5a.state=1
  170. Else
  171. Kicker3.kick 270,2
  172. lightsol5.state=0
  173. lightsol5a.state=0
  174. end If
  175. Else
  176. lightsol5.state=0
  177. lightsol5a.state=0
  178. end If
  179. end Sub
  180.  
  181. sub sol6 (enabled)
  182. if enabled Then
  183. if light12.state =1 Then
  184. lightsol6a.state=1
  185. lightsol6.state=1
  186. Else
  187. Kicker1.kick 135,2
  188. lightsol6.state=0
  189. lightsol6a.state=0
  190. end If
  191. Else
  192. lightsol6.state=0
  193. lightsol6a.state=0
  194. end If
  195. end Sub
  196.  
  197. Sub sollFlipper(Enabled)
  198. If Enabled Then
  199. PlaySound SoundFX("fx_Flipperup",DOFContactors):LeftFlipper.RotateToEnd:LeftFlipper1.RotateToEnd
  200. Else
  201. PlaySound SoundFX("fx_Flipperdown",DOFContactors):LeftFlipper.RotateToStart:LeftFlipper1.RotateToStart
  202. End If
  203. End Sub
  204.  
  205. Sub solrflipper(Enabled)
  206. If Enabled Then
  207. PlaySound SoundFX("fx_Flipperup",DOFContactors):RightFlipper.RotateToEnd
  208. Else
  209. PlaySound SoundFX("fx_Flipperdown",DOFContactors):RightFlipper.RotateToStart
  210. End If
  211. End Sub
  212.  
  213. '**********************************************************************************************************
  214.  
  215. 'Solenoid Controlled toys
  216. '**********************************************************************************************************
  217.  
  218. Dim FlipperActive
  219.  
  220.  
  221.  
  222.  
  223. 'Primitive Flipper
  224. Sub FlipperTimer_Timer
  225. FlipperT1.roty = LeftFlipper.currentangle + 237
  226. FlipperT2.roty = LeftFlipper1.currentangle + 200
  227. FlipperT5.roty = RightFlipper.currentangle + 120
  228.  
  229.  
  230. End Sub
  231.  
  232. Sub UpdateMultipleLamps
  233.  
  234. End Sub
  235.  
  236.  
  237.  
  238. '**********************************************************************************************************
  239.  
  240. 'Initiate Table
  241. '**********************************************************************************************************
  242.  
  243. Dim bsTrough, bsKicker, bsHole, DTl1, DTt4, dtr4, bssaucer,k1,k2
  244.  
  245. Sub Table1_Init
  246.  
  247. On Error Resume Next
  248. With Controller
  249. .GameName = cGameName
  250. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  251. .SplashInfoLine = "TX-Sector"
  252. .HandleMechanics=0
  253. .HandleKeyboard=0
  254. .ShowDMDOnly=1
  255. .ShowFrame=0
  256. .ShowTitle=0
  257. .hidden = 1
  258. If Err Then MsgBox Err.Description
  259. End With
  260. On Error Goto 0
  261. Controller.SolMask(0)=0
  262. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  263. Controller.Run
  264. If Err Then MsgBox Err.Description
  265. On Error Goto 0
  266.  
  267. PinMAMETimer.Interval=PinMAMEInterval
  268. PinMAMETimer.Enabled=1
  269.  
  270. vpmNudge.TiltSwitch=57
  271. vpmNudge.Sensitivity=5
  272. vpmNudge.TiltObj = Array(Bumper1,Bumper2,Bumper3)
  273.  
  274. Set dtt4=New cvpmDropTarget
  275. dtt4.InitDrop Array(Targt4a,Targt4b,Targt4c,Targt4d),Array(40,50,60,70)
  276. dtt4.InitSnd SoundFX("flapclos",DOFContactors),SoundFX("flapopen",DOFContactors)
  277.  
  278. Set dtr4=New cvpmDropTarget
  279. dtr4.InitDrop Array(Targr4a,Targr4b,Targr4c,targr4d),Array(41,51,61,71)
  280. dtr4.InitSnd SoundFX("flapclos",DOFContactors),SoundFX("flapopen",DOFContactors)
  281.  
  282.  
  283. Set dtl1=New cvpmDropTarget
  284. dtl1.InitDrop Array(Targl1a),Array(42)
  285. dtl1.InitSnd SoundFX("flapclos",DOFContactors),SoundFX("flapopen",DOFContactors)
  286.  
  287.  
  288.  
  289.  
  290.  
  291. End Sub
  292.  
  293. '**********************************************************************************************************
  294. 'Plunger code
  295. '**********************************************************************************************************
  296.  
  297. Sub Table1_KeyDown(ByVal KeyCode)
  298. If KeyCode=LeftFlipperKey Then Controller.Switch(6)=1
  299. If KeyCode=RightFlipperKey Then Controller.Switch(16)=1
  300.  
  301. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  302. If vpmKeyDown(KeyCode) Then Exit Sub
  303. End Sub
  304.  
  305. Sub Table1_KeyUp(ByVal KeyCode)
  306.  
  307. If KeyCode=RightFlipperKey Then
  308. Controller.Switch(46)=0
  309. Controller.Switch(16)=0
  310. end If
  311. If KeyCode=LeftFlipperKey Then Controller.Switch(6)=0
  312. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  313. If vpmKeyUp(KeyCode) Then Exit Sub
  314. End Sub
  315.  
  316. '**********************************************************************************************************
  317.  
  318.  
  319.  
  320.  
  321. Sub Targt4a_dropped:DTt4.Hit 1:End Sub
  322. Sub Targt4b_dropped:DTt4.Hit 2:End Sub
  323. Sub Targt4c_dropped:DTt4.Hit 3:End Sub
  324. Sub Targt4d_dropped:DTt4.Hit 4:End Sub
  325. Sub Targr4a_dropped:dtr4.Hit 1:End Sub
  326. Sub Targr4b_dropped:dtr4.Hit 2:End Sub
  327. Sub Targr4c_dropped:dtr4.Hit 3:End Sub
  328. Sub Targr4d_dropped:dtr4.Hit 4:End Sub
  329. Sub Targl1a_dropped:dtl1.Hit 1:End Sub
  330.  
  331. Sub sw35_Hit:Controller.Switch(35)=1:End Sub 'switch 35
  332. Sub sw35_unHit:Controller.Switch(35)=0:End Sub 'switch 35
  333. Sub sw36_Hit:Controller.Switch(36)=1:End Sub 'switch 36
  334. Sub sw36_unHit:Controller.Switch(36)=0:End Sub 'switch 36
  335. Sub sw46l_Hit:Controller.Switch(46)=1:DOF 104, DOFOn:End Sub 'switch 46
  336. Sub sw46l_unHit:Controller.Switch(46)=0:DOF 104, DOFOff:End Sub 'switch 46
  337. Sub sw46r_Hit:Controller.Switch(46)=1:DOF 105, DOFOn:End Sub 'switch 46
  338. Sub sw46r_unHit:Controller.Switch(46)=0:DOF 105, DOFOff:End Sub 'switch 46
  339.  
  340. Sub sw44_Hit:Controller.Switch(44)=1:End Sub 'switch 44
  341. Sub sw44_unHit:Controller.Switch(44)=0:End Sub 'switch 44
  342. Sub sw43_Hit:Controller.Switch(43)=1:End Sub 'switch 43
  343. Sub sw43_unHit:Controller.Switch(43)=0:End Sub 'switch 43
  344.  
  345. Sub sw45_Hit:Controller.Switch(45)=1:End Sub'switch 45
  346. Sub sw45_unHit:Controller.Switch(45)=0:End Sub'switch 45
  347. Sub sw55_Hit:Controller.Switch(55)=1:End Sub'switch 55
  348. Sub sw55_unHit:Controller.Switch(55)=0:End Sub'switch 55
  349. Sub sw65_Hit:Controller.Switch(65)=1:End Sub'switch 65
  350. Sub sw65_unHit:Controller.Switch(65)=0:End Sub'switch 65
  351. Sub sw75_Hit:Controller.Switch(75)=1:End Sub'switch 75
  352. Sub sw75_unHit:Controller.Switch(75)=0:End Sub'switch 75
  353. Sub sw66_Hit:Controller.Switch(66)=1:End Sub'switch 66
  354. Sub sw66_unHit:Controller.Switch(66)=0:End Sub'switch 66
  355. Sub sw63_Hit:Controller.Switch(63)=1:End Sub'switch 63
  356. Sub sw63_unHit:Controller.Switch(63)=0:End Sub'switch 63
  357.  
  358. Sub sw53_Hit:vpmTimer.PulseSw(53):End Sub 'switch 53
  359. Sub sw54_Hit:vpmTimer.PulseSw(54):End Sub 'switch 54
  360. Sub sw64_Hit:vpmTimer.PulseSw(64):End Sub 'switch 64
  361.  
  362. Sub sw76l_Hit:vpmTimer.PulseSw(76):PlaySound SoundFXDOF("left_slingshot",123,DOFPulse,DOFContactors), 0, 1, 0.05, 0.05:End Sub 'switch 76
  363. Sub sw76r_Hit:vpmTimer.PulseSw(76):PlaySound SoundFX("right_slingshot",124,DOFPulse,DOFContactors), 0, 1, 0.05, 0.05:End Sub 'switch 76
  364. Sub sw76lt_Hit:vpmTimer.PulseSw(76):End Sub 'switch 76
  365. Sub sw76t_Hit:vpmTimer.PulseSw(76):End Sub 'switch 76
  366. Sub sw76rt_Hit:vpmTimer.PulseSw(76):End Sub 'switch 76
  367.  
  368. Sub sw73_Spin:vpmTimer.PulseSw(73):End Sub 'switch 73
  369. Sub sw74_Spin:vpmTimer.PulseSw(74):End Sub 'switch 74 'switch 57 Tilt
  370.  
  371.  
  372.  
  373.  
  374. Sub sw56_Hit:Controller.Switch(56)=1:End Sub'switch 56
  375. Sub sw56_unHit:Controller.Switch(56)=0:End Sub'switch 56
  376.  
  377. Sub Bumper1_Hit:vpmTimer.PulseSw(72):RandomSoundbumper:End Sub 'switch 72
  378. Sub Bumper2_Hit:vpmTimer.PulseSw(52):RandomSoundbumper:End Sub 'switch 52
  379. Sub Bumper3_Hit:vpmTimer.PulseSw(62):RandomSoundbumper:End Sub 'switch 62
  380.  
  381.  
  382. Sub sw43b_Hit
  383. if k2=1 then
  384. dtl1.hit 1
  385. k2=0
  386. Else
  387. k2=1
  388. end If
  389. End Sub
  390. Sub sw43t_Hit:k2=0:End Sub
  391.  
  392. Sub sw451_Hit
  393. Kicker5.kick 135,2
  394. Kicker3.kick 270,2
  395. End Sub
  396. Sub sw551_Hit
  397. Kicker2.kick 200,2
  398. End Sub
  399. Sub sw651_Hit
  400. Kicker3.kick 270,2
  401. Kicker5.kick 135,2
  402. end Sub
  403. Sub sw751_Hit
  404. Kicker1.kick 135,2
  405. End Sub
  406. sub k4(Enabled)
  407. Kicker4.kick 70,20
  408. End Sub
  409.  
  410. '
  411.  
  412. Dim BallsInPlay
  413.  
  414.  
  415.  
  416. '**********************************************************************************************************
  417. ' Map Lights to Array
  418. '**********************************************************************************************************
  419. set Lights(13)=light13
  420. set lights(12)=light12
  421. set Lights(2)=light2
  422. lights(3)=array(Light3,light3a)
  423. set lights(5)=light5
  424. set lights(4)=light4
  425. set lights(6)=light6
  426. set lights(7)=light7
  427. set lights(8)=light8
  428. set lights(9)=light9
  429. set lights(10)=light10
  430. set lights(11)=light11
  431. set lights(1)=light1
  432. lights(15)=array(Light15,Light15a,light15b,Light15h,Light15ah,Light15bh)
  433. lights(16)=array(Light16,Light16a,light16b,Light16h,Light16ah,Light16bh)
  434. lights(17)=array(Light17,Light17a,light17b,light17h,Light17ah,Light17bh)
  435. lights(18)=array(Light18,Light18a,light18b,Light18h,Light18ah,Light18bh)
  436. lights(19)=array(Light19,Light19a,light19b,Light19h,Light19ah,Light19bh)
  437. set lights(20)=Light20
  438. set lights(21)=Light21
  439. set lights(22)=light22
  440. set lights(23)=light23
  441. set lights(24)=light24
  442. set lights(25)=light25
  443. set lights(26)=light26
  444. set lights(27)=light27
  445. set lights(28)=light28
  446. set lights(29)=light29
  447.  
  448. set lights(30)=light30
  449. set lights(31)=light31
  450. set lights(32)=light32
  451. set lights(33)=light33
  452. set lights(34)=light34
  453. set lights(35)=light35
  454. set lights(36)=light36
  455. set lights(37)=light37
  456. set lights(38)=light38
  457. set lights(39)=light39
  458. set lights(40)=light40
  459. set lights(41)=light41
  460. set lights(42)=light42
  461. set lights(43)=light43
  462. set lights(44)=light44
  463. set lights(45)=light45
  464. set lights(46)=light46
  465. lights(47)=array(light47,light47a)
  466. set lights(50)=light50
  467. lights(51)=array(light51,light51a)
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480. '**********************************************************************************************************
  481. ' Backglass Light Displays
  482. '**********************************************************************************************************
  483.  
  484.  
  485. Sub LampTimer_Timer()
  486. if light1.state=0 Then
  487. gion()
  488. Else
  489. gioff()
  490. end If
  491.  
  492. If light2.State=1 Then
  493. releasein.collidable=1
  494. releaseout.collidable=0
  495. kicker001.kick 100,5
  496. Else
  497. releaseout.collidable=1
  498. releasein.collidable=0
  499. End If
  500. if k1<>light13.state Then
  501. if light13.state then
  502. dtl1.hit 1
  503. k1=light13.state
  504. end If
  505. end If
  506. end Sub
  507.  
  508.  
  509.  
  510. '**********************************************************************************************************
  511. 'Digital Display
  512. '**********************************************************************************************************
  513. Dim Digits(40)
  514. Digits(0)=Array(a00, a05, a0c, a0d, a08, a01, a06, a0f, a02, a03, a04, a07, a0b, a0a, a09, a0e)
  515. Digits(1)=Array(a10, a15, a1c, a1d, a18, a11, a16, a1f, a12, a13, a14, a17, a1b, a1a, a19, a1e)
  516. Digits(2)=Array(a20, a25, a2c, a2d, a28, a21, a26, a2f, a22, a23, a24, a27, a2b, a2a, a29, a2e)
  517. Digits(3)=Array(a30, a35, a3c, a3d, a38, a31, a36, a3f, a32, a33, a34, a37, a3b, a3a, a39, a3e)
  518. Digits(4)=Array(a40, a45, a4c, a4d, a48, a41, a46, a4f, a42, a43, a44, a47, a4b, a4a, a49, a4e)
  519. Digits(5)=Array(a50, a55, a5c, a5d, a58, a51, a56, a5f, a52, a53, a54, a57, a5b, a5a, a59, a5e)
  520. Digits(6)=Array(a60, a65, a6c, a6d, a68, a61, a66, a6f, a62, a63, a64, a67, a6b, a6a, a69, a6e)
  521. Digits(7)=Array(a70, a75, a7c, a7d, a78, a71, a76, a7f, a72, a73, a74, a77, a7b, a7a, a79, a7e)
  522. Digits(8)=Array(a80, a85, a8c, a8d, a88, a81, a86, a8f, a82, a83, a84, a87, a8b, a8a, a89, a8e)
  523. Digits(9)=Array(a90, a95, a9c, a9d, a98, a91, a96, a9f, a92, a93, a94, a97, a9b, a9a, a99, a9e)
  524. Digits(10)=Array(aa0, aa5, aac, aad, aa8, aa1, aa6, aaf, aa2, aa3, aa4, aa7, aab, aaa, aa9, aae)
  525. Digits(11)=Array(ab0, ab5, abc, abd, ab8, ab1, ab6, abf, ab2, ab3, ab4, ab7, abb, aba, ab9, abe)
  526. Digits(12)=Array(ac0, ac5, acc, acd, ac8, ac1, ac6, acf, ac2, ac3, ac4, ac7, acb, aca, ac9, ace)
  527. Digits(13)=Array(ad0, ad5, adc, add, ad8, ad1, ad6, adf, ad2, ad3, ad4, ad7, adb, ada, ad9, ade)
  528. Digits(14)=Array(ae0, ae5, aec, aed, ae8, ae1, ae6, aef, ae2, ae3, ae4, ae7, aeb, aea, ae9, aee)
  529. Digits(15)=Array(af0, af5, afc, afd, af8, af1, af6, aff, af2, af3, af4, af7, afb, afa, af9, afe)
  530. Digits(16)=Array(b00, b05, b0c, b0d, b08, b01, b06, b0f, b02, b03, b04, b07, b0b, b0a, b09, b0e)
  531. Digits(17)=Array(b10, b15, b1c, b1d, b18, b11, b16, b1f, b12, b13, b14, b17, b1b, b1a, b19, b1e)
  532. Digits(18)=Array(b20, b25, b2c, b2d, b28, b21, b26, b2f, b22, b23, b24, b27, b2b, b2a, b29, b2e)
  533. Digits(19)=Array(b30, b35, b3c, b3d, b38, b31, b36, b3f, b32, b33, b34, b37, b3b, b3a, b39, b3e)
  534.  
  535. Digits(20)=Array(b40, b45, b4c, b4d, b48, b41, b46, b4f, b42, b43, b44, b47, b4b, b4a, b49, b4e)
  536. Digits(21)=Array(b50, b55, b5c, b5d, b58, b51, b56, b5f, b52, b53, b54, b57, b5b, b5a, b59, b5e)
  537. Digits(22)=Array(b60, b65, b6c, b6d, b68, b61, b66, b6f, b62, b63, b64, b67, b6b, b6a, b69, b6e)
  538. Digits(23)=Array(b70, b75, b7c, b7d, b78, b71, b76, b7f, b72, b73, b74, b77, b7b, b7a, b79, b7e)
  539. Digits(24)=Array(b80, b85, b8c, b8d, b88, b81, b86, b8f, b82, b83, b84, b87, b8b, b8a, b89, b8e)
  540. Digits(25)=Array(b90, b95, b9c, b9d, b98, b91, b96, b9f, b92, b93, b94, b97, b9b, b9a, b99, b9e)
  541. Digits(26)=Array(ba0, ba5, bac, bad, ba8, ba1, ba6, baf, ba2, ba3, ba4, ba7, bab, baa, ba9, bae)
  542. Digits(27)=Array(bb0, bb5, bbc, bbd, bb8, bb1, bb6, bbf, bb2, bb3, bb4, bb7, bbb, bba, bb9, bbe)
  543. Digits(28)=Array(bc0, bc5, bcc, bcd, bc8, bc1, bc6, bcf, bc2, bc3, bc4, bc7, bcb, bca, bc9, bce)
  544. Digits(29)=Array(bd0, bd5, bdc, bdd, bd8, bd1, bd6, bdf, bd2, bd3, bd4, bd7, bdb, bda, bd9, bde)
  545. Digits(30)=Array(be0, be5, bec, bed, be8, be1, be6, bef, be2, be3, be4, be7, beb, bea, be9, bee)
  546. Digits(31)=Array(bf0, bf5, bfc, bfd, bf8, bf1, bf6, bff, bf2, bf3, bf4, bf7, bfb, bfa, bf9, bfe)
  547. Digits(32)=Array(ac18, ac16, acc1, acd1, ac19, ac17, ac15, acf1, ac11, ac13, ac12, ac14, acb1, aca1, ac10, ace1)
  548. Digits(33)=Array(ad18, ad16, adc1, add1, ad19, ad17, ad15, adf1, ad11, ad13, ad12, ad14, adb1, ada1, ad10, ade1)
  549. Digits(34)=Array(ae18, ae16, aec1, aed1, ae19, ae17, ae15, aef1, ae11, ae13, ae12, ae14, aeb1, aea1, ae10, aee1)
  550. Digits(35)=Array(af18, af16, afc1, afd1, af19, af17, af15, aff1, af11, af13, af12, af14, afb1, afa1, af10, afe1)
  551. Digits(36)=Array(b9, b7, b0c1, b0d1, b100, b8, b6, b0f1, b2, b4, b3, b5, b0b1, b0a1, b1,b0e1)
  552. Digits(37)=Array(b109, b107, b1c1, b1d1, b110, b108, b106, b1f1, b102, b104, b103, b105, b1b1, b1a1, b101,b1e1)
  553. Digits(38)=Array(b119, b117, b2c1, b2d1, b120, b118, b116, b2f1, b112, b114, b113, b115, b2b1, b2a1, b111, b2e1)
  554. Digits(39)=Array(b129, b127, b3c1, b3d1, b130, b128, b126, b3f1, b122, b3b1, b123, b125, b3b1, b3a1, b121, b3e1)
  555.  
  556.  
  557. Sub DisplayTimer_Timer
  558. Dim ChgLED, ii, jj, num, chg, stat, obj, b, x
  559. ChgLED=Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  560. If Not IsEmpty(ChgLED)Then
  561. ' If DesktopMode = True Then
  562. For ii=0 To UBound(chgLED)
  563. num=chgLED(ii, 0) : chg=chgLED(ii, 1) : stat=chgLED(ii, 2)
  564. if (num < 40) then
  565. For Each obj In Digits(num)
  566. If chg And 1 Then obj.State=stat And 1
  567. chg=chg\2 : stat=stat\2
  568. Next
  569. Else
  570. end if
  571. Next
  572. ' end if
  573. End If
  574. End Sub
  575. '**********************************************************************************************************
  576. '**********************************************************************************************************
  577.  
  578. ' Dip Switches
  579. ' ==================================================================
  580. ' Gottlieb TX-Section
  581. ' originally added by Inkochnito
  582. ' Added Coins chute by Mike da Spike
  583. Sub editDips
  584. Dim vpmDips : Set vpmDips = New cvpmDips
  585. With vpmDips
  586. .AddForm 700,400,"TX-Section - DIP switches"
  587. .AddFrame 2,4,190,"Left Coin Chute (Coins/Credit)",&H0000001F,Array("1/4",&H00000018,"1/2",&H00000010,"1/1",&H00000000,"2/1",&H0000000A) 'Dip 1-5
  588. .AddFrame 2,80,190,"Right Coin Chute (Coins/Credit)",&H00001F00,Array("1/4",&H00001800,"1/2",&H00001000,"1/1",&H00000000,"2/1",&H00000A00) 'Dip 9-13
  589. .AddFrame 2,160,190,"Center Coin Chute (Coins/Credit)",&H001F0000,Array("1/4",&H00180000,"1/2",&H00100000,"1/1",&H00000000,"2/1",&H000A0000) 'Dip 17-21
  590. .AddFrame 2,240,190,"3rd coin chute credits control",&H20000000,Array("no effect",0,"add 9",&H20000000)'dip 30
  591. .AddFrame 207,4,190,"Maximum credits",49152,Array("8 credits",0,"10 credits",32768,"15 credits",&H00004000,"20 credits",49152)'dip 15&16
  592. .AddFrame 207,80,190,"Coin chute 1 and 2 control",&H00002000,Array("seperate",0,"same",&H00002000)'dip 14
  593. .AddFrame 207,126,190,"Playfield special",&H00200000,Array("replay",0,"extra ball",&H00200000)'dip 22
  594. .AddFrame 207,172,190,"High games to date control",&H00000020,Array("no effect",0,"reset high games 2-5 on power off",&H00000020)'dip 6
  595. .AddFrame 207,218,190,"Auto-percentage control",&H00000080,Array("disabled (normal high score mode)",0,"enabled",&H00000080)'dip 8
  596. .AddFrame 207,264,190,"Playfield special control",&H40000000,Array("special lit after banks compl. 3 times",0,"special lit after banks compl. 2 times",&H40000000)'dip 31
  597. .AddFrame 412,4,190,"High game 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
  598. .AddFrame 412,80,190,"Balls per game",&H01000000,Array("5 balls",0,"3 balls",&H01000000)'dip 25
  599. .AddFrame 412,126,190,"Replay limit",&H04000000,Array("no limit",0,"one per game",&H04000000)'dip 27
  600. .AddFrame 412,172,190,"Novelty",&H08000000,Array("normal",0,"extra ball and replay scores 500K",&H08000000)'dip 28
  601. .AddFrame 412,218,190,"Game mode",&H10000000,Array("replay",0,"extra ball",&H10000000)'dip 29
  602. .AddFrame 412,264,190,"Extra bal control",&H80000000,Array("Reset energy level",0,"Memorize energy level",&H80000000)'dip 32
  603. .AddChk 412,316,180,Array("Match feature",&H02000000)'dip 26
  604. .AddChk 412,331,190,Array("Attract sound",&H00000040)'dip 7
  605. .AddLabel 50,360,300,20,"After hitting OK, press F3 to reset game with new settings."
  606. .ViewDips
  607. End With
  608. End Sub
  609. Set vpmShowDips = GetRef("editDips")
  610.  
  611. Sub Table1_Exit ' in some tables this needs to be Table1_Exit
  612. Controller.Stop
  613. End Sub
  614.  
  615. '**********************************************************************************************************
  616.  
  617. '**********Sling Shot Animations
  618. ' Rstep and Lstep are the variables that increment the animation
  619. '****************
  620. Dim RStep,LStep
  621.  
  622. Sub RightSlingShot_Slingshot
  623. vpmTimer.PulseSw(76)
  624. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  625. DOF 121, DOFPulse
  626. RSling.Visible = 0
  627. RSling1.Visible = 1
  628. sling1.TransZ = -20
  629. RStep = 0
  630. RightSlingShot.TimerEnabled = 1
  631. End Sub
  632.  
  633. Sub RightSlingShot_Timer
  634. Select Case RStep
  635. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  636. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  637. End Select
  638. RStep = RStep + 1
  639. End Sub
  640.  
  641.  
  642. Sub leftSlingShot_Slingshot
  643. vpmTimer.PulseSw(76)
  644. PlaySound SoundFX("left_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  645. DOF 122, DOFPulse
  646. LSling.Visible = 0
  647. LSling1.Visible = 1
  648. sling2.TransZ = -20
  649. LStep = 0
  650. leftSlingShot.TimerEnabled = 1
  651. End Sub
  652.  
  653. Sub leftSlingShot_Timer
  654. Select Case LStep
  655. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  656. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:leftSlingShot.TimerEnabled = 0:
  657. End Select
  658. LStep = LStep + 1
  659. End Sub
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668. ' *********************************************************************
  669. ' Supporting Ball & Sound Functions
  670. ' *********************************************************************
  671.  
  672. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  673. Vol = Csng(BallVel(ball) ^2 /500)
  674. End Function
  675.  
  676. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  677. Dim tmp
  678. tmp = ball.x * 2 / table1.width-1
  679. If tmp > 0 Then
  680. Pan = Csng(tmp ^10)
  681. Else
  682. Pan = Csng(-((- tmp) ^10) )
  683. End If
  684. End Function
  685.  
  686. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  687. Pitch = BallVel(ball) * 20
  688. End Function
  689.  
  690. Function BallVel(ball) 'Calculates the ball speed
  691. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  692. End Function
  693.  
  694. '*****************************************
  695. ' JP's VP10 Rolling Sounds
  696. '*****************************************
  697.  
  698. Const tnob = 5 ' total number of balls
  699. ReDim rolling(tnob)
  700. InitRolling
  701.  
  702. Sub InitRolling
  703. Dim i
  704. For i = 0 to tnob
  705. rolling(i) = False
  706. Next
  707. End Sub
  708.  
  709. Sub RollingTimer_Timer()
  710. Dim BOT, b
  711. BOT = GetBalls
  712.  
  713. ' stop the sound of deleted balls
  714. For b = UBound(BOT) + 1 to tnob
  715. rolling(b) = False
  716. StopSound("fx_ballrolling" & b)
  717. Next
  718.  
  719. ' exit the sub if no balls on the table
  720. If UBound(BOT) = -1 Then Exit Sub
  721.  
  722. ' play the rolling sound for each ball
  723. For b = 0 to UBound(BOT)
  724. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  725. rolling(b) = True
  726. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  727. Else
  728. If rolling(b) = True Then
  729. StopSound("fx_ballrolling" & b)
  730. rolling(b) = False
  731. End If
  732. End If
  733. Next
  734. End Sub
  735.  
  736. '**********************
  737. ' Ball Collision Sound
  738. '**********************
  739.  
  740. Sub OnBallBallCollision(ball1, ball2, velocity)
  741. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  742. End Sub
  743.  
  744.  
  745.  
  746. '************************************
  747. ' What you need to add to your table
  748. '************************************
  749.  
  750. ' a timer called RollingTimer. With a fast interval, like 10
  751. ' one collision sound, in this script is called fx_collide
  752. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  753. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  754.  
  755.  
  756. '******************************************
  757. ' Explanation of the rolling sound routine
  758. '******************************************
  759.  
  760. ' sounds are played based on the ball speed and position
  761.  
  762. ' the routine checks first for deleted balls and stops the rolling sound.
  763.  
  764. ' The For loop goes through all the balls on the table and checks for the ball speed and
  765. ' if the ball is on the table (height lower than 30) then then it plays the sound
  766. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  767.  
  768. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  769. ' will change according to the ball speed, and the PAN function will change the stereo position according
  770. ' to the position of the ball on the table.
  771.  
  772.  
  773. '**************************************
  774. ' Explanation of the collision routine
  775. '**************************************
  776.  
  777. ' The collision is built in VP.
  778. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  779. ' 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
  780. ' depending of the speed of the collision.
  781.  
  782. Sub rollingmetal_Hit (idx)
  783. 'PlaySound SoundFX("Wire ramp",DOFContactors), 0, 1, 0.05, 0.05
  784. PlaySound "Wire Ramp", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  785. End Sub
  786.  
  787.  
  788. Sub Pins_Hit (idx)
  789. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  790. End Sub
  791.  
  792.  
  793.  
  794. Sub Metals_Thin_Hit (idx)
  795. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  796. End Sub
  797.  
  798. Sub Metals_Medium_Hit (idx)
  799. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  800. End Sub
  801.  
  802.  
  803. Sub Gates_Hit (idx)
  804. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  805. End Sub
  806.  
  807.  
  808.  
  809. Sub Rubbers_Hit(idx)
  810. dim finalspeed
  811. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  812. If finalspeed > 20 then
  813. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  814. End if
  815. If finalspeed >= 6 AND finalspeed <= 20 then
  816. RandomSoundRubber()
  817. End If
  818. End Sub
  819.  
  820.  
  821.  
  822. Sub RandomSoundRubber()
  823. Select Case Int(Rnd*3)+1
  824. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  825. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  826. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  827. End Select
  828. End Sub
  829.  
  830. Sub RandomSoundbumper()
  831. Select Case Int(Rnd*5)+1
  832. Case 1 : PlaySound SoundFX("fx_Bumper",DOFContactors)
  833. Case 2 : PlaySound SoundFX("fx_Bumper1",DOFContactors)
  834. Case 3 : PlaySound SoundFX("fx_Bumper2",DOFContactors)
  835. Case 4 : PlaySound SoundFX("fx_bumper3",DOFContactors)
  836. Case 5 : PlaySound SoundFX("fx_bumper4",DOFContactors)
  837. End Select
  838. End Sub
  839.  
  840. Sub LeftFlipper_Collide(parm)
  841. RandomSoundFlipper()
  842. End Sub
  843. Sub LeftFlipper1_Collide(parm)
  844. RandomSoundFlipper()
  845. End Sub
  846.  
  847. Sub RightFlipper_Collide(parm)
  848. RandomSoundFlipper()
  849. End Sub
  850. Sub RightFlipper1_Collide(parm)
  851. RandomSoundFlipper()
  852. End Sub
  853.  
  854. Sub RandomSoundFlipper()
  855. Select Case Int(Rnd*3)+1
  856. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  857. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  858. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  859. End Select
  860. End Sub
Advertisement
Add Comment
Please, Sign In to add comment