Outhere

Joker Poker ( Goldchicco_Gottlieb 1978) 1.0

Sep 12th, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 77.37 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. Const cGameName="jokrpokr",UseSolenoids=1,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SCoin="coin"
  10.  
  11.  
  12. LoadVPM"01150000","GTS1.VBS",3.10
  13.  
  14. '*******************************************
  15. ' User Options
  16. '*******************************************
  17.  
  18. '----- Shadow Options -----
  19. Const DynamicBallShadowsOn = 1 '0 = no dynamic ball shadow, 1 = enable dynamic ball shadow
  20.  
  21. '----- General Sound Options -----
  22. Const VolumeDial = 0.8 ' Recommended values should be no greater than 1.
  23.  
  24. '----- Phsyics Mods -----
  25. Const RubberizerEnabled = 1 '0 = normal flip rubber, 1 = more lively rubber for flips
  26. Const FlipperCoilRampupMode = 1 '0 = fast, 1 = medium, 2 = slow (tap passes should work)
  27. Const TargetBouncerEnabled = 1 '0 = normal standup targets, 1 = bouncy targets
  28. Const TargetBouncerFactor = 0.7 'Level of bounces. 0.0 thru 1.0, higher value is more bounciness (don't go above 1)
  29.  
  30.  
  31. Dim DesktopMode: DesktopMode = Table1.ShowDT
  32.  
  33. If DesktopMode = True Then 'Show Desktop components
  34. Ramp16.visible=1
  35. Ramp15.visible=1
  36. Primitive35.visible=1
  37. Else
  38. Ramp16.visible=0
  39. Ramp15.visible=0
  40. Primitive35.visible=0
  41. End if
  42.  
  43.  
  44. '*************************************************************
  45.  
  46. 'Solenoid Call backs
  47. '**********************************************************************************************************
  48. 'UpDated by Outhere
  49. '201 Bumper Left
  50. '202 Bumper Right
  51. '203 SlingShot Left
  52.  
  53. SolCallback(1)="bsTrough.SolOut"
  54. SolCallback(2)="SolKnocker"
  55. SolCallback(3)="vpmSolSound ""10"","
  56. SolCallback(4)="vpmSolSound ""100"","
  57. SolCallback(5)="vpmSolSound ""1000"","
  58. SolCallback(6)="dtjj.SolDropUp" '10,J,J
  59. SolCallback(7)="dtqq.SolDropUp" 'Q,Q,Q
  60. SolCallback(8)="dtaa.SolDropUp" 'A,A,JOKER,A,A
  61. SolCallback(17)="vpmNudge.SolGameOn"
  62. 'L17 Is used for DropUp KKKK
  63.  
  64. SolCallback(sLRFlipper) = "SolRFlipper"
  65. SolCallback(sLLFlipper) = "SolLFlipper"
  66.  
  67. Const ReflipAngle = 20
  68.  
  69. Sub SolLFlipper(Enabled)
  70. If Enabled Then
  71. LF.Fire 'leftflipper.rotatetoend
  72. LeftFlipper.RotateToEnd
  73. If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
  74. RandomSoundReflipUpLeft LeftFlipper
  75. Else
  76. SoundFlipperUpAttackLeft LeftFlipper
  77. RandomSoundFlipperUpLeft LeftFlipper
  78. End If
  79. Else
  80. LeftFlipper.RotateToStart
  81. If LeftFlipper.currentangle < LeftFlipper.startAngle - 5 Then
  82. RandomSoundFlipperDownLeft LeftFlipper
  83. End If
  84. FlipperLeftHitParm = FlipperUpSoundLevel
  85. End If
  86. End Sub
  87.  
  88. Sub SolRFlipper(Enabled)
  89. If Enabled Then
  90. RF.Fire 'rightflipper.rotatetoend
  91. RightFlipper.RotateToEnd:RightFlipper1.RotateToEnd
  92. If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
  93. RandomSoundReflipUpRight RightFlipper
  94. Else
  95. SoundFlipperUpAttackRight RightFlipper
  96. RandomSoundFlipperUpRight RightFlipper
  97. End If
  98. Else
  99. RightFlipper.RotateToStart:RightFlipper1.RotateToStart
  100. If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
  101. RandomSoundFlipperDownRight RightFlipper
  102. End If
  103. FlipperRightHitParm = FlipperUpSoundLevel
  104. End If
  105. End Sub
  106.  
  107.  
  108. Sub LeftFlipper_Collide(parm)
  109. CheckLiveCatch Activeball, LeftFlipper, LFCount, parm
  110. LeftFlipperCollide parm
  111. if RubberizerEnabled = 1 then Rubberizer(parm)
  112. if RubberizerEnabled = 2 then Rubberizer2(parm)
  113. End Sub
  114.  
  115. Sub RightFlipper_Collide(parm)
  116. CheckLiveCatch Activeball, RightFlipper, RFCount, parm
  117. RightFlipperCollide parm
  118. if RubberizerEnabled = 1 then Rubberizer(parm)
  119. if RubberizerEnabled = 2 then Rubberizer2(parm)
  120. End Sub
  121.  
  122. ' iaakki Rubberizer
  123. sub Rubberizer(parm)
  124. if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
  125. 'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  126. activeball.angmomz = activeball.angmomz * 1.2
  127. activeball.vely = activeball.vely * 1.2
  128. 'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  129. Elseif parm <= 2 and parm > 0.2 Then
  130. 'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  131. activeball.angmomz = activeball.angmomz * -1.1
  132. activeball.vely = activeball.vely * 1.4
  133. 'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  134. end if
  135. end sub
  136.  
  137. ' apophis rubberizer
  138. sub Rubberizer2(parm)
  139. if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
  140. 'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  141. activeball.angmomz = -activeball.angmomz * 2
  142. activeball.vely = activeball.vely * 1.2
  143. 'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  144. Elseif parm <= 2 and parm > 0.2 Then
  145. 'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  146. activeball.angmomz = -activeball.angmomz * 0.5
  147. activeball.vely = activeball.vely * (1.2 + rnd(1)/3 )
  148. 'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  149. end if
  150. end sub
  151.  
  152.  
  153. Sub SolKnocker(Enabled)
  154. If enabled Then
  155. KnockerSolenoid 'Add knocker position object
  156. End If
  157. End Sub
  158.  
  159. '*****GI Lights On
  160. dim xx
  161. For each xx in GI:xx.State = 1: Next
  162.  
  163. '**********************************************************************************************************
  164.  
  165. 'Initiate Table
  166. '**********************************************************************************************************
  167. Dim bsTrough, dtjj, dtqq, dtaa, dtkk
  168.  
  169. Sub Table1_Init
  170. vpmInit Me
  171. On Error Resume Next
  172. With Controller
  173. .GameName = cGameName
  174. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  175. .SplashInfoLine = "Joker Poker (Gottlieb)"&chr(13)&"You Suck"
  176. .HandleMechanics=0
  177. .HandleKeyboard=0
  178. .ShowDMDOnly=1
  179. .ShowFrame=0
  180. .ShowTitle=0
  181. .hidden = 1
  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. If Err Then MsgBox Err.Description
  189. On Error Goto 0
  190.  
  191. PinMAMETimer.Interval=PinMAMEInterval
  192. PinMAMETimer.Enabled=1
  193.  
  194. vpmNudge.TiltSwitch = 4
  195. vpmNudge.Sensitivity = 2
  196. vpmNudge.TiltObj = Array(Bumper1, Bumper2, LeftSlingshot)
  197.  
  198. ' Trough
  199. Set bsTrough = New cvpmBallStack
  200. bsTrough.initnotrough ballrelease, 66, 90, 10
  201. ' bsTrough.InitExitSnd "ballrelease","solenoid"
  202.  
  203. ' Drop targets
  204. set dtjj=New cvpmDropTarget
  205. dtjj.InitDrop Array(sw21,sw22,sw23),Array(21,22,23)
  206. dtjj.initsnd "DTDrop","DTReset"
  207.  
  208. set dtqq=New cvpmDropTarget
  209. dtqq.InitDrop Array(sw31,sw32,sw33),array(31,32,33)
  210. dtqq.initsnd "DTDrop","DTReset"
  211.  
  212. set dtkk=New cvpmDropTarget
  213. dtkk.InitDrop Array(sw41,sw42,sw43,sw44),array(41,42,43,44)
  214. dtkk.initsnd "DTDrop","DTReset"
  215.  
  216. set dtaa=New cvpmDropTarget
  217. dtaa.InitDrop Array(sw50,sw51,sw52,sw53,sw54),array(50,51,52,53,54)
  218. dtaa.initsnd "DTDrop","DTReset"
  219.  
  220. End Sub
  221.  
  222. '**********************************************************************************************************
  223. 'Plunger code
  224. '**********************************************************************************************************
  225.  
  226. Sub Table1_KeyDown(ByVal keycode)
  227. If vpmKeyDown(KeyCode) Then Exit Sub
  228. If keycode = LeftFlipperKey Then FlipperActivate LeftFlipper, LFPress
  229. If keycode = RightFlipperKey Then FlipperActivate RightFlipper, RFPress
  230.  
  231. If keycode = LeftMagnaSave Then bLutActive = True
  232. If keycode = RightMagnaSave Then
  233. If bLutActive Then NextLUT: End If
  234. End If
  235. If KeyCode = PlungerKey Then Plunger.Pullback:SoundPlungerPull()
  236.  
  237. If keycode = LeftTiltKey Then Nudge 90, 5:SoundNudgeLeft()
  238. If keycode = RightTiltKey Then Nudge 270, 5:SoundNudgeRight()
  239. If keycode = CenterTiltKey Then Nudge 0, 3:SoundNudgeCenter()
  240.  
  241. If keycode = keyInsertCoin1 or keycode = keyInsertCoin2 or keycode = keyInsertCoin3 or keycode = keyInsertCoin4 Then
  242. Select Case Int(rnd*3)
  243. Case 0: PlaySound ("Coin_In_1"), 0, CoinSoundLevel, 0, 0.25
  244. Case 1: PlaySound ("Coin_In_2"), 0, CoinSoundLevel, 0, 0.25
  245. Case 2: PlaySound ("Coin_In_3"), 0, CoinSoundLevel, 0, 0.25
  246.  
  247. End Select
  248.  
  249. End If
  250.  
  251. if keycode=StartGameKey then soundStartButton()
  252.  
  253. End Sub
  254.  
  255. Sub Table1_KeyUp(ByVal keycode)
  256. If vpmKeyUp(KeyCode) Then Exit Sub
  257. If keycode = LeftFlipperKey Then FlipperDeActivate LeftFlipper, LFPress
  258. If keycode = RightFlipperKey Then FlipperDeActivate RightFlipper, RFPress
  259.  
  260. If keycode = LeftMagnaSave Then bLutActive = False
  261.  
  262. If KeyCode = PlungerKey Then
  263. Plunger.Fire
  264. If BIPL = 1 Then
  265. SoundPlungerReleaseBall() 'Plunger release sound when there is a ball in shooter lane
  266. Else
  267. SoundPlungerReleaseNoBall() 'Plunger release sound when there is no ball in shooter lane
  268. End If
  269. End If
  270.  
  271.  
  272. End Sub
  273.  
  274. '**********************************************************************************************************
  275. ' Fleep BIPL
  276. '**********************************************************************************************************
  277. Dim BIPL : BIPL=0
  278.  
  279. Sub swBIPL_Hit
  280. BIPL = 1
  281. End Sub
  282.  
  283. Sub swBIPL_UnHit
  284. BIPL = 0
  285. End Sub
  286.  
  287. '**********************************************************************************************************
  288.  
  289. ' Drain hole
  290. Sub Drain_Hit:bsTrough.addball me:RandomSoundDrain Drain:End Sub
  291. Sub BallRelease_Unhit:RandomSoundBallRelease BallRelease: End Sub
  292.  
  293. ' Bumpers
  294. Sub Bumper1_Hit:vpmTimer.PulseSw 10 :DOF 201,DOFPulse:RandomSoundBumperTop Bumper1 : End Sub
  295. Sub Bumper2_Hit:vpmTimer.PulseSw 10 :DOF 202,DOFPulse: RandomSoundBumperMiddle Bumper2: End Sub
  296.  
  297. ' Rollovers
  298. Sub sw11_Hit:Controller.Switch(11) = 1 : End Sub
  299. Sub sw11_UnHit:Controller.Switch(11) = 0:End Sub
  300. Sub sw12_Hit:Controller.Switch(12) = 1 : End Sub
  301. Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
  302. Sub sw13_Hit:Controller.Switch(13) = 1 : End Sub
  303. Sub sw13_UnHit:Controller.Switch(13) = 0:End Sub
  304. Sub sw30_Hit:Controller.Switch(30) = 1 : End Sub
  305. Sub sw30_UnHit:Controller.Switch(30) = 0:End Sub
  306.  
  307. Sub sw11b_Hit:Controller.Switch(11) = 1 : End Sub
  308. Sub sw11b_UnHit:Controller.Switch(11) = 0:End Sub
  309. Sub sw12b_Hit:Controller.Switch(12) = 1 : End Sub
  310. Sub sw12b_UnHit:Controller.Switch(12) = 0:End Sub
  311. Sub sw12d_Hit:Controller.Switch(12) = 1 : End Sub
  312. Sub sw12d_UnHit:Controller.Switch(12) = 0:End Sub
  313. Sub sw13b_Hit:Controller.Switch(13) = 1 : End Sub
  314. Sub sw13b_UnHit:Controller.Switch(13) = 0:End Sub
  315.  
  316. 'Scoring Rubbers
  317. Sub sw40a_Slingshot():vpmTimer.PulseSw 40:End Sub
  318. Sub sw40b_Slingshot():vpmTimer.PulseSw 40:End Sub
  319. Sub sw40c_Slingshot():vpmTimer.PulseSw 40:End Sub
  320. Sub sw40d_Slingshot():vpmTimer.PulseSw 40:End Sub
  321. Sub sw40e_Slingshot():vpmTimer.PulseSw 40:End Sub
  322. Sub sw40f_Slingshot():vpmTimer.PulseSw 40:End Sub
  323. Sub sw40g_Slingshot():vpmTimer.PulseSw 40:End Sub
  324. Sub sw40h_Slingshot():vpmTimer.PulseSw 40:End Sub
  325. Sub sw40i_Slingshot():vpmTimer.PulseSw 40:End Sub
  326. Sub sw40j_Slingshot():vpmTimer.PulseSw 40:End Sub
  327.  
  328. 'Drop targets
  329. Sub sw21_Hit:dtjj.Hit 1
  330. TargetBouncer Activeball, 1
  331. End Sub
  332. Sub sw22_Hit:dtjj.Hit 2
  333. TargetBouncer Activeball, 1
  334. End Sub
  335. Sub sw23_Hit:dtjj.Hit 3
  336. TargetBouncer Activeball, 1
  337. End Sub
  338. Sub sw31_Hit:dtqq.Hit 1
  339. TargetBouncer Activeball, 1
  340. End Sub
  341. Sub sw32_Hit:dtqq.Hit 2
  342. TargetBouncer Activeball, 1
  343. End Sub
  344. Sub sw33_Hit:dtqq.Hit 3
  345. TargetBouncer Activeball, 1
  346. End Sub
  347.  
  348. Sub sw41_Hit:dtkk.Hit 1
  349. TargetBouncer Activeball, 1
  350. End Sub
  351. Sub sw42_Hit:dtkk.Hit 2
  352. TargetBouncer Activeball, 1
  353. End Sub
  354. Sub sw43_Hit:dtkk.Hit 3
  355. TargetBouncer Activeball, 1
  356. End Sub
  357. Sub sw44_Hit:dtkk.Hit 4
  358. TargetBouncer Activeball, 1
  359. End Sub
  360.  
  361. Sub sw50_Hit:dtaa.Hit 1
  362. TargetBouncer Activeball, 1
  363. End Sub
  364. Sub sw51_Hit:dtaa.Hit 2
  365. TargetBouncer Activeball, 1
  366. End Sub
  367. Sub sw52_Hit:dtaa.Hit 3
  368. TargetBouncer Activeball, 1
  369. End Sub
  370. Sub sw53_Hit:dtaa.Hit 4
  371. TargetBouncer Activeball, 1
  372. End Sub
  373. Sub sw54_Hit:dtaa.Hit 5
  374. TargetBouncer Activeball, 1
  375. End Sub
  376.  
  377. 'Standup target
  378. Sub sw20_Hit:vpmTimer.PulseSw 20
  379. TargetBouncer Activeball, 1
  380. End Sub
  381.  
  382. 'Drop Target Reset with lamp
  383. Dim N1,O1
  384. N1=0:O1=0
  385. Set LampCallback=GetRef("UpdateMultipleLamps")
  386. Sub UpdateMultipleLamps
  387. N1=Controller.Lamp(17)
  388. If N1<>O1 Then
  389. If N1 Then dtkk.DropSol_On
  390. O1=N1
  391. End If
  392. End Sub
  393.  
  394.  
  395. Set Lights(4)=l4
  396. Set Lights(8)=l8
  397. Set Lights(9)=l9
  398. Set Lights(10)=l10
  399. Set Lights(11)=l11
  400. Set Lights(12)=l12
  401. Set Lights(13)=l13
  402. Set Lights(14)=l14
  403. Set Lights(15)=l15
  404. Set Lights(16)=l16
  405. Set Lights(18)=l18
  406. Set Lights(19)=l19
  407. Set Lights(20)=l20
  408. Set Lights(21)=l21
  409. Set Lights(22)=l22
  410. Set Lights(23)=l23
  411. Set Lights(24)=l24
  412. Set Lights(25)=l25
  413. Set Lights(26)=l26
  414. Set Lights(27)=l27
  415. Set Lights(28)=l28
  416.  
  417. '**********************************************************************************************************
  418. ' Backglass Light Displays (7 digit 7 segment displays)
  419. Dim Digits(28)
  420.  
  421. Digits(0)=Array(a00,a01,a02,a03,a04,a05,a06,n,a08)
  422. Digits(1)=Array(a10,a11,a12,a13,a14,a15,a16,n,a18)
  423. Digits(2)=Array(a20,a21,a22,a23,a24,a25,a26,n,a28)
  424. Digits(3)=Array(a30,a31,a32,a33,a34,a35,a36,n,a38)
  425. Digits(4)=Array(a40,a41,a42,a43,a44,a45,a46,n,a48)
  426. Digits(5)=Array(a50,a51,a52,a53,a54,a55,a56,n,a58)
  427.  
  428. Digits(6)=Array(b20,b21,b22,b23,b24,b25,b26,n,b28)
  429. Digits(7)=Array(b30,b31,b32,b33,b34,b35,b36,n,b38)
  430. Digits(8)=Array(b40,b41,b42,b43,b44,b45,b46,n,b48)
  431. Digits(9)=Array(b50,b51,b52,b53,b54,b55,b56,n,b58)
  432. Digits(10)=Array(c00,c01,c02,c03,c04,c05,c06,n,c08)
  433. Digits(11)=Array(c10,c11,c12,c13,c14,c15,c16,n,c18)
  434.  
  435. Digits(12)=Array(c20,c21,c22,c23,c24,c25,c26,n,c28)
  436. Digits(13)=Array(c30,c31,c32,c33,c34,c35,c36,n,c38)
  437. Digits(14)=Array(c40,c41,c42,c43,c44,c45,c46,n,c48)
  438. Digits(15)=Array(c50,c51,c52,c53,c54,c55,c56,n,c58)
  439. Digits(16)=Array(d00,d01,d02,d03,d04,d05,d06,n,d08)
  440. Digits(17)=Array(d10,d11,d12,d13,d14,d15,d16,n,d18)
  441.  
  442. Digits(18)=Array(d40,d41,d42,d43,d44,d45,d46,n,d48)
  443. Digits(19)=Array(d50,d51,d52,d53,d54,d55,d56,n,d58)
  444. Digits(20)=Array(e00,e01,e02,e03,e04,e05,e06,n,e08)
  445. Digits(21)=Array(e10,e11,e12,e13,e14,e15,e16,n,e18)
  446. Digits(22)=Array(f00,f01,f02,f03,f04,f05,f06,n,f08)
  447. Digits(23)=Array(f10,f11,f12,f13,f14,f15,f16,n,f18)
  448.  
  449. 'credit -- Ball In Play
  450. Digits(24) = Array(e2,e3,e7,e4,e5,e1,e6,n,e23)
  451. Digits(25) = Array(e9,e17,e22,e19,e20,e8,e21,n,e24)
  452. Digits(26) = Array(f2,f3,f7,f4,f5,f1,f6,n,f23)
  453. Digits(27) = Array(f9,f17,f22,f19,f20,f8,f21,n,f24)
  454.  
  455. Sub DisplayTimer_Timer
  456. Dim ChgLED,ii,num,chg,stat,obj
  457. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  458. If Not IsEmpty(ChgLED) Then
  459. If DesktopMode = True Then
  460. For ii = 0 To UBound(chgLED)
  461. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  462. if (num < 28) then
  463. For Each obj In Digits(num)
  464. If chg And 1 Then obj.State = stat And 1
  465. chg = chg\2 : stat = stat\2
  466. Next
  467. else
  468. end if
  469. next
  470. end if
  471. end if
  472. End Sub
  473. '**********************************************************************************************************
  474. '**********************************************************************************************************
  475. 'Gottlieb System 1
  476. 'added by Inkochnito
  477. Sub editDips
  478. Dim vpmDips : Set vpmDips = New cvpmDips
  479. With vpmDips
  480. .AddForm 700,400,"System 1 - DIP switches"
  481. .AddFrame 205,0,190,"Maximum credits",&H00030000,Array("5 credits",0,"8 credits",&H00020000,"10 credits",&H00010000,"15 credits",&H00030000)'dip 17&18
  482. .AddFrame 0,0,190,"Coin chute control",&H00040000,Array("seperate",0,"same",&H00040000)'dip 19
  483. .AddFrame 0,46,190,"Game mode",&H00000400,Array("extra ball",0,"replay",&H00000400)'dip 11
  484. .AddFrame 0,92,190,"High game to date awards",&H00200000,Array("no award",0,"3 replays",&H00200000)'dip 22
  485. .AddFrame 0,138,190,"Balls per game",&H00000100,Array("5 balls",0,"3 balls",&H00000100)'dip 9
  486. .AddFrame 0,184,190,"Tilt effect",&H00000800,Array("game over",0,"ball in play only",&H00000800)'dip 12
  487. .AddChk 205,80,190,Array("Match feature",&H00000200)'dip 10
  488. .AddChk 205,95,190,Array("Credits displayed",&H00001000)'dip 13
  489. .AddChk 205,110,190,Array("Play credit button tune",&H00002000)'dip 14
  490. .AddChk 205,125,190,Array("Play tones when scoring",&H00080000)'dip 20
  491. .AddChk 205,140,190,Array("Play coin switch tune",&H00400000)'dip 23
  492. .AddChk 205,155,190,Array("High game to date displayed",&H00100000)'dip 21
  493. .AddLabel 50,240,300,20,"After hitting OK, press F3 to reset game with new settings."
  494. .ViewDips
  495. End With
  496. End Sub
  497. Set vpmShowDips = GetRef("editDips")
  498. '**********************************************************************************************************
  499. '**********************************************************************************************************
  500.  
  501.  
  502. '**********Sling Shot Animations
  503. ' Rstep and Lstep are the variables that increment the animation
  504. '****************
  505. Dim Lstep
  506.  
  507. Sub LeftSlingShot_Slingshot
  508. vpmTimer.PulseSw 40
  509. RandomSoundSlingshotLeft SLING2
  510. LSling.Visible = 0
  511. LSling1.Visible = 1
  512. sling2.TransZ = -20
  513. LStep = 0
  514. LeftSlingShot.TimerEnabled = 1
  515. DOF 203,DOFPulse
  516. End Sub
  517.  
  518. Sub LeftSlingShot_Timer
  519. Select Case LStep
  520. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  521. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  522. End Select
  523. LStep = LStep + 1
  524. End Sub
  525.  
  526. '******************************************************
  527. ' BALL ROLLING AND DROP SOUNDS
  528. '******************************************************
  529.  
  530. Const tnob = 5 ' total number of balls
  531. ReDim rolling(tnob)
  532. InitRolling
  533.  
  534. Dim DropCount
  535. ReDim DropCount(tnob)
  536.  
  537. Sub InitRolling
  538. Dim i
  539. For i = 0 to tnob
  540. rolling(i) = False
  541. Next
  542. End Sub
  543.  
  544. Sub RollingTimer_Timer()
  545. Dim BOT, b
  546. BOT = GetBalls
  547.  
  548. ' stop the sound of deleted balls
  549. For b = UBound(BOT) + 1 to tnob
  550. rolling(b) = False
  551. StopSound("BallRoll_" & b)
  552. Next
  553.  
  554. ' exit the sub if no balls on the table
  555. If UBound(BOT) = -1 Then Exit Sub
  556.  
  557. ' play the rolling sound for each ball
  558.  
  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 ("BallRoll_" & b), -1, VolPlayfieldRoll(BOT(b)) * 1.1 * VolumeDial, AudioPan(BOT(b)), 0, PitchPlayfieldRoll(BOT(b)), 1, 0, AudioFade(BOT(b))
  563.  
  564. Else
  565. If rolling(b) = True Then
  566. StopSound("BallRoll_" & b)
  567. rolling(b) = False
  568. End If
  569. End If
  570.  
  571. '***Ball Drop Sounds***
  572. If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
  573. If DropCount(b) >= 5 Then
  574. DropCount(b) = 0
  575. If BOT(b).velz > -7 Then
  576. RandomSoundBallBouncePlayfieldSoft BOT(b)
  577. Else
  578. RandomSoundBallBouncePlayfieldHard BOT(b)
  579. End If
  580. End If
  581. End If
  582. If DropCount(b) < 5 Then
  583. DropCount(b) = DropCount(b) + 1
  584. End If
  585. Next
  586. End Sub
  587.  
  588.  
  589. '*************
  590. ' JP'S LUT
  591. '*************
  592.  
  593. Dim bLutActive, LUTImage
  594. Sub LoadLUT
  595. Dim x
  596. x = LoadValue(cGameName, "LUTImage")
  597. If(x <> "") Then LUTImage = x Else LUTImage = 0
  598. UpdateLUT
  599. End Sub
  600.  
  601. Sub SaveLUT
  602. SaveValue cGameName, "LUTImage", LUTImage
  603. End Sub
  604.  
  605. Sub NextLUT: LUTImage = (LUTImage +1 ) MOD 10: UpdateLUT: SaveLUT: End Sub
  606.  
  607. Sub UpdateLUT
  608. Select Case LutImage
  609. Case 0: table1.ColorGradeImage = "LUT0"
  610. Case 1: table1.ColorGradeImage = "LUT1"
  611. Case 2: table1.ColorGradeImage = "LUT2"
  612. Case 3: table1.ColorGradeImage = "LUT3"
  613. Case 4: table1.ColorGradeImage = "LUT4"
  614. Case 5: table1.ColorGradeImage = "LUT5"
  615. Case 6: table1.ColorGradeImage = "LUT6"
  616. Case 7: table1.ColorGradeImage = "LUT7"
  617. Case 8: table1.ColorGradeImage = "LUT8"
  618. Case 9: table1.ColorGradeImage = "LUT9"
  619.  
  620. End Select
  621. End Sub
  622.  
  623.  
  624. '*****************************************
  625. ' ninuzzu's FLIPPER SHADOWS
  626. '*****************************************
  627.  
  628. sub FlipperTimer_Timer()
  629. FlipperLSh.RotZ = LeftFlipper.currentangle
  630. FlipperRSh.RotZ = RightFlipper.currentangle
  631. Lflip.roty = LeftFlipper.currentangle
  632. RFlip.roty = RightFlipper.currentangle
  633. Rflip1.roty = RightFlipper1.currentangle -90
  634.  
  635. End Sub
  636.  
  637. '*****************************************
  638. ' ninuzzu's BALL SHADOW
  639. '*****************************************
  640.  
  641. Dim BallShadow
  642. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  643.  
  644. Sub BallShadowUpdate_timer()
  645. Dim BOT, b
  646. BOT = GetBalls
  647. ' hide shadow of deleted balls
  648. If UBound(BOT)<(tnob-1) Then
  649. For b = (UBound(BOT) + 1) to (tnob-1)
  650. BallShadow(b).visible = 0
  651. Next
  652. End If
  653. ' exit the Sub if no balls on the table
  654. If UBound(BOT) = -1 Then Exit Sub
  655. ' render the shadow for each ball
  656. For b = 0 to UBound(BOT)
  657. If BOT(b).X < Table1.Width/2 Then
  658. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) + 6
  659. Else
  660. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) - 6
  661. End If
  662. ballShadow(b).Y = BOT(b).Y + 4
  663. If BOT(b).Z > 20 Then
  664. BallShadow(b).visible = 1
  665. Else
  666. BallShadow(b).visible = 0
  667. End If
  668. Next
  669. End Sub
  670.  
  671.  
  672.  
  673. '******************************************************
  674. ' FLIPPER CORRECTION INITIALIZATION
  675. ' Start nFOZZY FLIPPERS'
  676. '******************************************************
  677.  
  678. 'Flipper Correction Initialization late 80’s to early 90’s
  679. dim LF : Set LF = New FlipperPolarity
  680. dim RF : Set RF = New FlipperPolarity
  681.  
  682. InitPolarity
  683.  
  684. '' Late 70's to early 80's
  685.  
  686. Sub InitPolarity()
  687. dim x, a : a = Array(LF, RF)
  688. for each x in a
  689. x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
  690. x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
  691. x.enabled = True
  692. x.TimeDelay = 80
  693. Next
  694.  
  695. AddPt "Polarity", 0, 0, 0
  696. AddPt "Polarity", 1, 0.05, -2.7
  697. AddPt "Polarity", 2, 0.33, -2.7
  698. AddPt "Polarity", 3, 0.37, -2.7
  699. AddPt "Polarity", 4, 0.41, -2.7
  700. AddPt "Polarity", 5, 0.45, -2.7
  701. AddPt "Polarity", 6, 0.576,-2.7
  702. AddPt "Polarity", 7, 0.66, -1.8
  703. AddPt "Polarity", 8, 0.743, -0.5
  704. AddPt "Polarity", 9, 0.81, -0.5
  705. AddPt "Polarity", 10, 0.88, 0
  706.  
  707. addpt "Velocity", 0, 0, 1
  708. addpt "Velocity", 1, 0.16, 1.06
  709. addpt "Velocity", 2, 0.41, 1.05
  710. addpt "Velocity", 3, 0.53, 1'0.982
  711. addpt "Velocity", 4, 0.702, 0.968
  712. addpt "Velocity", 5, 0.95, 0.968
  713. addpt "Velocity", 6, 1.03, 0.945
  714.  
  715. LF.Object = LeftFlipper
  716. LF.EndPoint = EndPointLp
  717. RF.Object = RightFlipper
  718. RF.EndPoint = EndPointRp
  719. End Sub
  720. '
  721.  
  722. Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
  723. Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
  724. Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
  725. Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
  726.  
  727. '******************************************************
  728. ' FLIPPER CORRECTION FUNCTIONS
  729. '******************************************************
  730.  
  731. Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
  732. dim a : a = Array(LF, RF)
  733. dim x : for each x in a
  734. x.addpoint aStr, idx, aX, aY
  735. Next
  736. End Sub
  737.  
  738. Class FlipperPolarity
  739. Public DebugOn, Enabled
  740. Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
  741. Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
  742. private Flipper, FlipperStart,FlipperEnd, FlipperEndY, LR, PartialFlipCoef
  743. Private Balls(20), balldata(20)
  744.  
  745. dim PolarityIn, PolarityOut
  746. dim VelocityIn, VelocityOut
  747. dim YcoefIn, YcoefOut
  748. Public Sub Class_Initialize
  749. redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
  750. Enabled = True : TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new SpoofBall : next
  751. End Sub
  752.  
  753. Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
  754. Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
  755. Public Property Get StartPoint : StartPoint = FlipperStart : End Property
  756. Public Property Let EndPoint(aInput) : FlipperEnd = aInput.x: FlipperEndY = aInput.y: End Property
  757. Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
  758. Public Property Get EndPointY: EndPointY = FlipperEndY : End Property
  759.  
  760. Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
  761. Select Case aChooseArray
  762. case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
  763. Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
  764. Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
  765. End Select
  766. if gametime > 100 then Report aChooseArray
  767. End Sub
  768.  
  769. Public Sub Report(aChooseArray) 'debug, reports all coords in tbPL.text
  770. if not DebugOn then exit sub
  771. dim a1, a2 : Select Case aChooseArray
  772. case "Polarity" : a1 = PolarityIn : a2 = PolarityOut
  773. Case "Velocity" : a1 = VelocityIn : a2 = VelocityOut
  774. Case "Ycoef" : a1 = YcoefIn : a2 = YcoefOut
  775. case else :tbpl.text = "wrong string" : exit sub
  776. End Select
  777. dim str, x : for x = 0 to uBound(a1) : str = str & aChooseArray & " x: " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
  778. tbpl.text = str
  779. End Sub
  780.  
  781. Public Sub AddBall(aBall) : dim x : for x = 0 to uBound(balls) : if IsEmpty(balls(x)) then set balls(x) = aBall : exit sub :end if : Next : End Sub
  782.  
  783. Private Sub RemoveBall(aBall)
  784. dim x : for x = 0 to uBound(balls)
  785. if TypeName(balls(x) ) = "IBall" then
  786. if aBall.ID = Balls(x).ID Then
  787. balls(x) = Empty
  788. Balldata(x).Reset
  789. End If
  790. End If
  791. Next
  792. End Sub
  793.  
  794. Public Sub Fire()
  795. Flipper.RotateToEnd
  796. processballs
  797. End Sub
  798.  
  799. Public Property Get Pos 'returns % position a ball. For debug stuff.
  800. dim x : for x = 0 to uBound(balls)
  801. if not IsEmpty(balls(x) ) then
  802. pos = pSlope(Balls(x).x, FlipperStart, 0, FlipperEnd, 1)
  803. End If
  804. Next
  805. End Property
  806.  
  807. Public Sub ProcessBalls() 'save data of balls in flipper range
  808. FlipAt = GameTime
  809. dim x : for x = 0 to uBound(balls)
  810. if not IsEmpty(balls(x) ) then
  811. balldata(x).Data = balls(x)
  812. End If
  813. Next
  814. PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle))
  815. PartialFlipCoef = abs(PartialFlipCoef-1)
  816. End Sub
  817. Private Function FlipperOn() : if gameTime < FlipAt+TimeDelay then FlipperOn = True : End If : End Function 'Timer shutoff for polaritycorrect
  818.  
  819. Public Sub PolarityCorrect(aBall)
  820. if FlipperOn() then
  821. dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
  822.  
  823. 'y safety Exit
  824. if aBall.VelY > -8 then 'ball going down
  825. RemoveBall aBall
  826. exit Sub
  827. end if
  828.  
  829. 'Find balldata. BallPos = % on Flipper
  830. for x = 0 to uBound(Balls)
  831. if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
  832. idx = x
  833. BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
  834. if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  835. end if
  836. Next
  837.  
  838. If BallPos = 0 Then 'no ball data meaning the ball is entering and exiting pretty close to the same position, use current values.
  839. BallPos = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
  840. if ballpos > 0.65 then Ycoef = LinearEnvelope(aBall.Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  841. End If
  842.  
  843. 'Velocity correction
  844. if not IsEmpty(VelocityIn(0) ) then
  845. Dim VelCoef
  846. : VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
  847.  
  848. if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
  849.  
  850. if Enabled then aBall.Velx = aBall.Velx*VelCoef
  851. if Enabled then aBall.Vely = aBall.Vely*VelCoef
  852. End If
  853.  
  854. 'Polarity Correction (optional now)
  855. if not IsEmpty(PolarityIn(0) ) then
  856. If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
  857. dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
  858.  
  859. if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
  860. 'playsound "fx_knocker"
  861. End If
  862. End If
  863. RemoveBall aBall
  864. End Sub
  865. End Class
  866.  
  867. '******************************************************
  868. ' FLIPPER POLARITY AND RUBBER DAMPENER
  869. ' SUPPORTING FUNCTIONS
  870. '******************************************************
  871.  
  872. ' Used for flipper correction and rubber dampeners
  873. Sub ShuffleArray(ByRef aArray, byVal offset) 'shuffle 1d array
  874. dim x, aCount : aCount = 0
  875. redim a(uBound(aArray) )
  876. for x = 0 to uBound(aArray) 'Shuffle objects in a temp array
  877. if not IsEmpty(aArray(x) ) Then
  878. if IsObject(aArray(x)) then
  879. Set a(aCount) = aArray(x)
  880. Else
  881. a(aCount) = aArray(x)
  882. End If
  883. aCount = aCount + 1
  884. End If
  885. Next
  886. if offset < 0 then offset = 0
  887. redim aArray(aCount-1+offset) 'Resize original array
  888. for x = 0 to aCount-1 'set objects back into original array
  889. if IsObject(a(x)) then
  890. Set aArray(x) = a(x)
  891. Else
  892. aArray(x) = a(x)
  893. End If
  894. Next
  895. End Sub
  896.  
  897. ' Used for flipper correction and rubber dampeners
  898. Sub ShuffleArrays(aArray1, aArray2, offset)
  899. ShuffleArray aArray1, offset
  900. ShuffleArray aArray2, offset
  901. End Sub
  902.  
  903. ' Used for flipper correction, rubber dampeners, and drop targets
  904. Function BallSpeed(ball) 'Calculates the ball speed
  905. BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
  906. End Function
  907.  
  908. ' Used for flipper correction and rubber dampeners
  909. Function PSlope(Input, X1, Y1, X2, Y2) 'Set up line via two points, no clamping. Input X, output Y
  910. dim x, y, b, m : x = input : m = (Y2 - Y1) / (X2 - X1) : b = Y2 - m*X2
  911. Y = M*x+b
  912. PSlope = Y
  913. End Function
  914.  
  915. ' Used for flipper correction
  916. Class spoofball
  917. Public X, Y, Z, VelX, VelY, VelZ, ID, Mass, Radius
  918. Public Property Let Data(aBall)
  919. With aBall
  920. x = .x : y = .y : z = .z : velx = .velx : vely = .vely : velz = .velz
  921. id = .ID : mass = .mass : radius = .radius
  922. end with
  923. End Property
  924. Public Sub Reset()
  925. x = Empty : y = Empty : z = Empty : velx = Empty : vely = Empty : velz = Empty
  926. id = Empty : mass = Empty : radius = Empty
  927. End Sub
  928. End Class
  929.  
  930. ' Used for flipper correction and rubber dampeners
  931. Function LinearEnvelope(xInput, xKeyFrame, yLvl)
  932. dim y 'Y output
  933. dim L 'Line
  934. dim ii : for ii = 1 to uBound(xKeyFrame) 'find active line
  935. if xInput <= xKeyFrame(ii) then L = ii : exit for : end if
  936. Next
  937. if xInput > xKeyFrame(uBound(xKeyFrame) ) then L = uBound(xKeyFrame) 'catch line overrun
  938. Y = pSlope(xInput, xKeyFrame(L-1), yLvl(L-1), xKeyFrame(L), yLvl(L) )
  939.  
  940. if xInput <= xKeyFrame(lBound(xKeyFrame) ) then Y = yLvl(lBound(xKeyFrame) ) 'Clamp lower
  941. if xInput >= xKeyFrame(uBound(xKeyFrame) ) then Y = yLvl(uBound(xKeyFrame) ) 'Clamp upper
  942.  
  943. LinearEnvelope = Y
  944. End Function
  945.  
  946. ' Used for drop targets and stand up targets
  947. Function Atn2(dy, dx)
  948. dim pi
  949. pi = 4*Atn(1)
  950.  
  951. If dx > 0 Then
  952. Atn2 = Atn(dy / dx)
  953. ElseIf dx < 0 Then
  954. If dy = 0 Then
  955. Atn2 = pi
  956. Else
  957. Atn2 = Sgn(dy) * (pi - Atn(Abs(dy / dx)))
  958. end if
  959. ElseIf dx = 0 Then
  960. if dy = 0 Then
  961. Atn2 = 0
  962. else
  963. Atn2 = Sgn(dy) * pi / 2
  964. end if
  965. End If
  966. End Function
  967.  
  968. ' Used for drop targets and flipper tricks
  969. Function Distance(ax,ay,bx,by)
  970. Distance = SQR((ax - bx)^2 + (ay - by)^2)
  971. End Function
  972.  
  973. '******************************************************
  974. ' FLIPPER TRICKS
  975. '******************************************************
  976.  
  977. RightFlipper.timerinterval=1
  978. Rightflipper.timerenabled=True
  979.  
  980. sub RightFlipper_timer()
  981. FlipperTricks LeftFlipper, LFPress, LFCount, LFEndAngle, LFState
  982. FlipperTricks RightFlipper, RFPress, RFCount, RFEndAngle, RFState
  983. FlipperNudge RightFlipper, RFEndAngle, RFEOSNudge, LeftFlipper, LFEndAngle
  984. FlipperNudge LeftFlipper, LFEndAngle, LFEOSNudge, RightFlipper, RFEndAngle
  985. end sub
  986.  
  987. Dim LFEOSNudge, RFEOSNudge
  988.  
  989. Sub FlipperNudge(Flipper1, Endangle1, EOSNudge1, Flipper2, EndAngle2)
  990. Dim BOT, b
  991.  
  992. If abs(Flipper1.currentangle) < abs(Endangle1) + 3 and EOSNudge1 <> 1 Then
  993. EOSNudge1 = 1
  994. If Flipper2.currentangle = EndAngle2 Then
  995. BOT = GetBalls
  996. For b = 0 to Ubound(BOT)
  997. If FlipperTrigger(BOT(b).x, BOT(b).y, Flipper1) Then
  998. 'Debug.Print "ball in flip1. exit"
  999. exit Sub
  1000. end If
  1001. Next
  1002. For b = 0 to Ubound(BOT)
  1003. If FlipperTrigger(BOT(b).x, BOT(b).y, Flipper2) Then
  1004. 'debug.print "flippernudge!!"
  1005. BOT(b).velx = BOT(b).velx /1.5
  1006. BOT(b).vely = BOT(b).vely - 1
  1007. end If
  1008. Next
  1009. End If
  1010. Else
  1011. If abs(Flipper1.currentangle) > abs(Endangle1) + 30 then EOSNudge1 = 0
  1012. End If
  1013. End Sub
  1014.  
  1015. '*****************
  1016. ' Maths
  1017. '*****************
  1018. Const Pi = 3.1415927
  1019.  
  1020. Function dSin(degrees)
  1021. dsin = sin(degrees * Pi/180)
  1022. End Function
  1023.  
  1024. Function dCos(degrees)
  1025. dcos = cos(degrees * Pi/180)
  1026. End Function
  1027.  
  1028.  
  1029. '*************************************************
  1030. ' Check ball distance from Flipper for Rem
  1031. '*************************************************
  1032.  
  1033. Function Distance(ax,ay,bx,by)
  1034. Distance = SQR((ax - bx)^2 + (ay - by)^2)
  1035. End Function
  1036.  
  1037. Function DistancePL(px,py,ax,ay,bx,by) ' Distance between a point and a line where point is px,py
  1038. DistancePL = ABS((by - ay)*px - (bx - ax) * py + bx*ay - by*ax)/Distance(ax,ay,bx,by)
  1039. End Function
  1040.  
  1041. Function Radians(Degrees)
  1042. Radians = Degrees * PI /180
  1043. End Function
  1044.  
  1045. Function AnglePP(ax,ay,bx,by)
  1046. AnglePP = Atn2((by - ay),(bx - ax))*180/PI
  1047. End Function
  1048.  
  1049. Function DistanceFromFlipper(ballx, bally, Flipper)
  1050. DistanceFromFlipper = DistancePL(ballx, bally, Flipper.x, Flipper.y, Cos(Radians(Flipper.currentangle+90))+Flipper.x, Sin(Radians(Flipper.currentangle+90))+Flipper.y)
  1051. End Function
  1052.  
  1053. Function FlipperTrigger(ballx, bally, Flipper)
  1054. Dim DiffAngle
  1055. DiffAngle = ABS(Flipper.currentangle - AnglePP(Flipper.x, Flipper.y, ballx, bally) - 90)
  1056. If DiffAngle > 180 Then DiffAngle = DiffAngle - 360
  1057.  
  1058. If DistanceFromFlipper(ballx,bally,Flipper) < 48 and DiffAngle <= 90 and Distance(ballx,bally,Flipper.x,Flipper.y) < Flipper.Length Then
  1059. FlipperTrigger = True
  1060. Else
  1061. FlipperTrigger = False
  1062. End If
  1063. End Function
  1064.  
  1065. '*************************************************
  1066. ' End - Check ball distance from Flipper for Rem
  1067. '*************************************************
  1068.  
  1069.  
  1070.  
  1071. dim LFPress, RFPress, LFCount, RFCount
  1072. dim LFState, RFState
  1073. dim EOST, EOSA,Frampup, FElasticity,FReturn
  1074. dim RFEndAngle, LFEndAngle
  1075.  
  1076. EOST = leftflipper.eostorque
  1077. EOSA = leftflipper.eostorqueangle
  1078. Frampup = LeftFlipper.rampup
  1079. FElasticity = LeftFlipper.elasticity
  1080. FReturn = LeftFlipper.return
  1081. Const EOSTnew = 1 '0.8
  1082. Const EOSAnew = 1
  1083. Const EOSRampup = 0
  1084. Dim SOSRampup
  1085. Select Case FlipperCoilRampupMode
  1086. Case 0:
  1087. SOSRampup = 2.5
  1088. Case 1:
  1089. SOSRampup = 4.5
  1090. Case 2:
  1091. SOSRampup = 8.5
  1092. End Select
  1093. Const LiveCatch = 16
  1094. Const LiveElasticity = 0.45
  1095. Const SOSEM = 0.815
  1096. Const EOSReturn = 0.035 '0.025
  1097.  
  1098.  
  1099. LFEndAngle = Leftflipper.endangle
  1100. RFEndAngle = RightFlipper.endangle
  1101.  
  1102. Sub FlipperActivate(Flipper, FlipperPress)
  1103. FlipperPress = 1
  1104. Flipper.Elasticity = FElasticity
  1105.  
  1106. Flipper.eostorque = EOST
  1107. Flipper.eostorqueangle = EOSA
  1108. End Sub
  1109.  
  1110. Sub FlipperDeactivate(Flipper, FlipperPress)
  1111. FlipperPress = 0
  1112. Flipper.eostorqueangle = EOSA
  1113. Flipper.eostorque = EOST*EOSReturn/FReturn
  1114.  
  1115.  
  1116. If Abs(Flipper.currentangle) <= Abs(Flipper.endangle) + 0.1 Then
  1117. Dim BOT, b
  1118. BOT = GetBalls
  1119.  
  1120. For b = 0 to UBound(BOT)
  1121. If Distance(BOT(b).x, BOT(b).y, Flipper.x, Flipper.y) < 55 Then 'check for cradle
  1122. If BOT(b).vely >= -0.4 Then BOT(b).vely = -0.4
  1123. End If
  1124. Next
  1125. End If
  1126. End Sub
  1127.  
  1128. Sub FlipperTricks (Flipper, FlipperPress, FCount, FEndAngle, FState)
  1129. Dim Dir
  1130. Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
  1131.  
  1132. If Abs(Flipper.currentangle) > Abs(Flipper.startangle) - 0.05 Then
  1133. If FState <> 1 Then
  1134. Flipper.rampup = SOSRampup
  1135. Flipper.endangle = FEndAngle - 3*Dir
  1136. Flipper.Elasticity = FElasticity * SOSEM
  1137. FCount = 0
  1138. FState = 1
  1139. End If
  1140. ElseIf Abs(Flipper.currentangle) <= Abs(Flipper.endangle) and FlipperPress = 1 then
  1141. if FCount = 0 Then FCount = GameTime
  1142.  
  1143. If FState <> 2 Then
  1144. Flipper.eostorqueangle = EOSAnew
  1145. Flipper.eostorque = EOSTnew
  1146. Flipper.rampup = EOSRampup
  1147. Flipper.endangle = FEndAngle
  1148. FState = 2
  1149. End If
  1150. Elseif Abs(Flipper.currentangle) > Abs(Flipper.endangle) + 0.01 and FlipperPress = 1 Then
  1151. If FState <> 3 Then
  1152. Flipper.eostorque = EOST
  1153. Flipper.eostorqueangle = EOSA
  1154. Flipper.rampup = Frampup
  1155. Flipper.Elasticity = FElasticity
  1156. FState = 3
  1157. End If
  1158.  
  1159. End If
  1160. End Sub
  1161.  
  1162. Const LiveDistanceMin = 30 'minimum distance in vp units from flipper base live catch dampening will occur
  1163. Const LiveDistanceMax = 117 'maximum distance in vp units from flipper base live catch dampening will occur (tip protection)
  1164.  
  1165. Sub CheckLiveCatch(ball, Flipper, FCount, parm) 'Experimental new live catch
  1166. Dim Dir
  1167. Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
  1168. Dim LiveCatchBounce 'If live catch is not perfect, it won't freeze ball totally
  1169. Dim CatchTime : CatchTime = GameTime - FCount
  1170.  
  1171. if CatchTime <= LiveCatch and parm > 6 and ABS(Flipper.x - ball.x) > LiveDistanceMin and ABS(Flipper.x - ball.x) < LiveDistanceMax Then
  1172. if CatchTime <= LiveCatch*0.8 Then 'Perfect catch only when catch time happens in the beginning of the window
  1173. LiveCatchBounce = 0
  1174. else
  1175. LiveCatchBounce = Abs((LiveCatch/2) - CatchTime) 'Partial catch when catch happens a bit late
  1176. end If
  1177.  
  1178. 'debug.print "Live catch! Bounce: " & LiveCatchBounce
  1179.  
  1180. If LiveCatchBounce = 0 and ball.velx * Dir > 0 Then ball.velx = 0
  1181. ball.vely = LiveCatchBounce * (16 / LiveCatch) ' Multiplier for inaccuracy bounce
  1182. ball.angmomx= 0
  1183. ball.angmomy= 0
  1184. ball.angmomz= 0
  1185. End If
  1186. End Sub
  1187.  
  1188. '*****************************************************************************************************
  1189. 'END nFOZZY FLIPPERS'
  1190.  
  1191.  
  1192. 'PHYSICS DAMPENERS
  1193.  
  1194. 'These are data mined bounce curves,
  1195. 'dialed in with the in-game elasticity as much as possible to prevent angle / spin issues.
  1196. 'Requires tracking ballspeed to calculate COR
  1197.  
  1198. Sub dPosts_Hit(idx)
  1199. RubbersD.dampen Activeball
  1200. TargetBouncer Activeball, 1
  1201. End Sub
  1202.  
  1203. Sub dSleeves_Hit(idx)
  1204. SleevesD.Dampen Activeball
  1205. TargetBouncer Activeball, 0.7
  1206. End Sub
  1207.  
  1208.  
  1209. dim RubbersD : Set RubbersD = new Dampener 'frubber
  1210. RubbersD.name = "Rubbers"
  1211. RubbersD.debugOn = False 'shows info in textbox "TBPout"
  1212. RubbersD.Print = False 'debug, reports in debugger (in vel, out cor)
  1213. 'cor bounce curve (linear)
  1214. 'for best results, try to match in-game velocity as closely as possible to the desired curve
  1215. 'RubbersD.addpoint 0, 0, 0.935 'point# (keep sequential), ballspeed, CoR (elasticity)
  1216. RubbersD.addpoint 0, 0, 0.96 'point# (keep sequential), ballspeed, CoR (elasticity)
  1217. RubbersD.addpoint 1, 3.77, 0.96
  1218. RubbersD.addpoint 2, 5.76, 0.967 'dont take this as gospel. if you can data mine rubber elasticitiy, please help!
  1219. RubbersD.addpoint 3, 15.84, 0.874
  1220. RubbersD.addpoint 4, 56, 0.64 'there's clamping so interpolate up to 56 at least
  1221.  
  1222. dim SleevesD : Set SleevesD = new Dampener 'this is just rubber but cut down to 85%...
  1223. SleevesD.name = "Sleeves"
  1224. SleevesD.debugOn = False 'shows info in textbox "TBPout"
  1225. SleevesD.Print = False 'debug, reports in debugger (in vel, out cor)
  1226. SleevesD.CopyCoef RubbersD, 0.85
  1227.  
  1228. Class Dampener
  1229. Public Print, debugOn 'tbpOut.text
  1230. public name, Threshold 'Minimum threshold. Useful for Flippers, which don't have a hit threshold.
  1231. Public ModIn, ModOut
  1232. Private Sub Class_Initialize : redim ModIn(0) : redim Modout(0): End Sub
  1233.  
  1234. Public Sub AddPoint(aIdx, aX, aY)
  1235. ShuffleArrays ModIn, ModOut, 1 : ModIn(aIDX) = aX : ModOut(aIDX) = aY : ShuffleArrays ModIn, ModOut, 0
  1236. if gametime > 100 then Report
  1237. End Sub
  1238.  
  1239. public sub Dampen(aBall)
  1240. if threshold then if BallSpeed(aBall) < threshold then exit sub end if end if
  1241. dim RealCOR, DesiredCOR, str, coef
  1242. DesiredCor = LinearEnvelope(cor.ballvel(aBall.id), ModIn, ModOut )
  1243. RealCOR = BallSpeed(aBall) / cor.ballvel(aBall.id)
  1244. coef = desiredcor / realcor
  1245. if debugOn then str = name & " in vel:" & round(cor.ballvel(aBall.id),2 ) & vbnewline & "desired cor: " & round(desiredcor,4) & vbnewline & _
  1246. "actual cor: " & round(realCOR,4) & vbnewline & "ballspeed coef: " & round(coef, 3) & vbnewline
  1247. if Print then debug.print Round(cor.ballvel(aBall.id),2) & ", " & round(desiredcor,3)
  1248.  
  1249. aBall.velx = aBall.velx * coef : aBall.vely = aBall.vely * coef
  1250. if debugOn then TBPout.text = str
  1251. End Sub
  1252.  
  1253. Public Sub CopyCoef(aObj, aCoef) 'alternative addpoints, copy with coef
  1254. dim x : for x = 0 to uBound(aObj.ModIn)
  1255. addpoint x, aObj.ModIn(x), aObj.ModOut(x)*aCoef
  1256. Next
  1257. End Sub
  1258.  
  1259.  
  1260. Public Sub Report() 'debug, reports all coords in tbPL.text
  1261. if not debugOn then exit sub
  1262. dim a1, a2 : a1 = ModIn : a2 = ModOut
  1263. dim str, x : for x = 0 to uBound(a1) : str = str & x & ": " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
  1264. TBPout.text = str
  1265. End Sub
  1266.  
  1267.  
  1268. End Class
  1269.  
  1270. '******************************************************
  1271. ' TRACK ALL BALL VELOCITIES
  1272. ' FOR RUBBER DAMPENER AND DROP TARGETS
  1273. '******************************************************
  1274.  
  1275. dim cor : set cor = New CoRTracker
  1276.  
  1277. Class CoRTracker
  1278.  
  1279. public ballvel, ballvelx, ballvely
  1280.  
  1281. Private Sub Class_Initialize : redim ballvel(0) : redim ballvelx(0): redim ballvely(0) : End Sub
  1282.  
  1283. Public Sub Update() 'tracks in-ball-velocity
  1284. dim str, b, AllBalls, highestID : allBalls = getballs
  1285.  
  1286. for each b in allballs
  1287. if b.id >= HighestID then highestID = b.id
  1288. Next
  1289.  
  1290. if uBound(ballvel) < highestID then redim ballvel(highestID) 'set bounds
  1291. if uBound(ballvelx) < highestID then redim ballvelx(highestID) 'set bounds
  1292. if uBound(ballvely) < highestID then redim ballvely(highestID) 'set bounds
  1293.  
  1294. for each b in allballs
  1295. ballvel(b.id) = BallSpeed(b)
  1296. ballvelx(b.id) = b.velx
  1297. ballvely(b.id) = b.vely
  1298. Next
  1299. End Sub
  1300. End Class
  1301.  
  1302.  
  1303. Sub RDampen_Timer()
  1304. Cor.Update
  1305. End Sub
  1306.  
  1307. '******************************************************
  1308. ' TargetBouncer for targets and posts by Iaakki, Wrd1972, Apophis
  1309. '******************************************************
  1310.  
  1311. sub TargetBouncer(aBall,defvalue)
  1312. dim zMultiplier, vel, vratio
  1313. if TargetBouncerEnabled <> 0 and aball.z < 30 then
  1314. 'debug.print "velx: " & aball.velx & " vely: " & aball.vely & " velz: " & aball.velz
  1315. vel = BallSpeed(aBall)
  1316. vratio = aBall.vely/aBall.velx
  1317. Select Case Int(Rnd * 6) + 1
  1318. Case 1: zMultiplier = 0.1*defvalue
  1319. Case 2: zMultiplier = 0.2*defvalue
  1320. Case 3: zMultiplier = 0.3*defvalue
  1321. Case 4: zMultiplier = 0.4*defvalue
  1322. Case 5: zMultiplier = 0.5*defvalue
  1323. Case 6: zMultiplier = 0.6*defvalue
  1324. End Select
  1325. aBall.velz = abs(vel * zMultiplier * TargetBouncerFactor)
  1326. aBall.velx = sgn(aBall.velx) * sqr(abs((vel^2 - aBall.velz^2)/(1+vratio^2)))
  1327. aBall.vely = aBall.velx * vratio
  1328. 'debug.print "---> velx: " & aball.velx & " vely: " & aball.vely & " velz: " & aball.velz
  1329. 'debug.print "conservation check: " & BallSpeed(aBall)/vel
  1330. end if
  1331. end sub
  1332.  
  1333. '//////////////////////////// MECHANICAL SOUNDS ///////////////////////////
  1334. '// This part in the script is an entire block that is dedicated to the physics sound system.
  1335. '// Various scripts and sounds that may be pretty generic and could suit other WPC systems, but the most are tailored specifically for this table.
  1336.  
  1337. '/////////////////////////////// SOUNDS PARAMETERS //////////////////////////////
  1338. Dim GlobalSoundLevel, CoinSoundLevel, PlungerReleaseSoundLevel, PlungerPullSoundLevel, NudgeLeftSoundLevel
  1339. Dim NudgeRightSoundLevel, NudgeCenterSoundLevel, StartButtonSoundLevel, RollingSoundFactor
  1340.  
  1341. CoinSoundLevel = 1 'volume level; range [0, 1]
  1342. NudgeLeftSoundLevel = 1 'volume level; range [0, 1]
  1343. NudgeRightSoundLevel = 1 'volume level; range [0, 1]
  1344. NudgeCenterSoundLevel = 1 'volume level; range [0, 1]
  1345. StartButtonSoundLevel = 0.1 'volume level; range [0, 1]
  1346. PlungerReleaseSoundLevel = 0.8 '1 wjr 'volume level; range [0, 1]
  1347. PlungerPullSoundLevel = 1 'volume level; range [0, 1]
  1348. RollingSoundFactor = 1.1/5
  1349.  
  1350. '///////////////////////-----Solenoids, Kickers and Flash Relays-----///////////////////////
  1351. Dim FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel, FlipperUpAttackLeftSoundLevel, FlipperUpAttackRightSoundLevel
  1352. Dim FlipperUpSoundLevel, FlipperDownSoundLevel, FlipperLeftHitParm, FlipperRightHitParm
  1353. Dim SlingshotSoundLevel, BumperSoundFactor, KnockerSoundLevel
  1354.  
  1355. FlipperUpAttackMinimumSoundLevel = 0.010 'volume level; range [0, 1]
  1356. FlipperUpAttackMaximumSoundLevel = 0.635 'volume level; range [0, 1]
  1357. FlipperUpSoundLevel = 1.0 'volume level; range [0, 1]
  1358. FlipperDownSoundLevel = 0.45 'volume level; range [0, 1]
  1359. FlipperLeftHitParm = FlipperUpSoundLevel 'sound helper; not configurable
  1360. FlipperRightHitParm = FlipperUpSoundLevel 'sound helper; not configurable
  1361. SlingshotSoundLevel = 0.95 'volume level; range [0, 1]
  1362. BumperSoundFactor = 4.25 'volume multiplier; must not be zero
  1363. KnockerSoundLevel = 1 'volume level; range [0, 1]
  1364.  
  1365. '///////////////////////-----Ball Drops, Bumps and Collisions-----///////////////////////
  1366. Dim RubberStrongSoundFactor, RubberWeakSoundFactor, RubberFlipperSoundFactor,BallWithBallCollisionSoundFactor
  1367. Dim BallBouncePlayfieldSoftFactor, BallBouncePlayfieldHardFactor, PlasticRampDropToPlayfieldSoundLevel, WireRampDropToPlayfieldSoundLevel, DelayedBallDropOnPlayfieldSoundLevel
  1368. Dim WallImpactSoundFactor, MetalImpactSoundFactor, SubwaySoundLevel, SubwayEntrySoundLevel, ScoopEntrySoundLevel
  1369. Dim SaucerLockSoundLevel, SaucerKickSoundLevel
  1370.  
  1371. BallWithBallCollisionSoundFactor = 3.2 'volume multiplier; must not be zero
  1372. RubberStrongSoundFactor = 0.055/5 'volume multiplier; must not be zero
  1373. RubberWeakSoundFactor = 0.075/5 'volume multiplier; must not be zero
  1374. RubberFlipperSoundFactor = 0.075/5 'volume multiplier; must not be zero
  1375. BallBouncePlayfieldSoftFactor = 0.025 'volume multiplier; must not be zero
  1376. BallBouncePlayfieldHardFactor = 0.025 'volume multiplier; must not be zero
  1377. DelayedBallDropOnPlayfieldSoundLevel = 0.8 'volume level; range [0, 1]
  1378. WallImpactSoundFactor = 0.075 'volume multiplier; must not be zero
  1379. MetalImpactSoundFactor = 0.075/3
  1380. SaucerLockSoundLevel = 0.8
  1381. SaucerKickSoundLevel = 0.8
  1382.  
  1383. '///////////////////////-----Gates, Spinners, Rollovers and Targets-----///////////////////////
  1384.  
  1385. Dim GateSoundLevel, TargetSoundFactor, SpinnerSoundLevel, RolloverSoundLevel, DTSoundLevel
  1386.  
  1387. GateSoundLevel = 0.5/5 'volume level; range [0, 1]
  1388. TargetSoundFactor = 0.0025 * 10 'volume multiplier; must not be zero
  1389. DTSoundLevel = 0.25 'volume multiplier; must not be zero
  1390. RolloverSoundLevel = 0.25 'volume level; range [0, 1]
  1391.  
  1392. '///////////////////////-----Ball Release, Guides and Drain-----///////////////////////
  1393. Dim DrainSoundLevel, BallReleaseSoundLevel, BottomArchBallGuideSoundFactor, FlipperBallGuideSoundFactor
  1394.  
  1395. DrainSoundLevel = 0.8 'volume level; range [0, 1]
  1396. BallReleaseSoundLevel = 1 'volume level; range [0, 1]
  1397. BottomArchBallGuideSoundFactor = 0.2 'volume multiplier; must not be zero
  1398. FlipperBallGuideSoundFactor = 0.015 'volume multiplier; must not be zero
  1399.  
  1400. '///////////////////////-----Loops and Lanes-----///////////////////////
  1401. Dim ArchSoundFactor
  1402. ArchSoundFactor = 0.025/5 'volume multiplier; must not be zero
  1403.  
  1404.  
  1405. '///////////////////////////// SOUND PLAYBACK FUNCTIONS ////////////////////////////
  1406. '///////////////////////////// POSITIONAL SOUND PLAYBACK METHODS ////////////////////////////
  1407. ' Positional sound playback methods will play a sound, depending on the X,Y position of the table element or depending on ActiveBall object position
  1408. ' These are similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  1409. ' For surround setup - positional sound playback functions will fade between front and rear surround channels and pan between left and right channels
  1410. ' For stereo setup - positional sound playback functions will only pan between left and right channels
  1411. ' For mono setup - positional sound playback functions will not pan between left and right channels and will not fade between front and rear channels
  1412.  
  1413. ' PlaySound full syntax - PlaySound(string, int loopcount, float volume, float pan, float randompitch, int pitch, bool useexisting, bool restart, float front_rear_fade)
  1414. ' Note - These functions will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  1415. Sub PlaySoundAtLevelStatic(playsoundparams, aVol, tableobj)
  1416. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 0, 0, AudioFade(tableobj)
  1417. End Sub
  1418.  
  1419. Sub PlaySoundAtLevelExistingStatic(playsoundparams, aVol, tableobj)
  1420. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 1, 0, AudioFade(tableobj)
  1421. End Sub
  1422.  
  1423. Sub PlaySoundAtLevelStaticLoop(playsoundparams, aVol, tableobj)
  1424. PlaySound playsoundparams, -1, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 0, 0, AudioFade(tableobj)
  1425. End Sub
  1426.  
  1427. Sub PlaySoundAtLevelStaticRandomPitch(playsoundparams, aVol, randomPitch, tableobj)
  1428. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), randomPitch, 0, 0, 0, AudioFade(tableobj)
  1429. End Sub
  1430.  
  1431. Sub PlaySoundAtLevelActiveBall(playsoundparams, aVol)
  1432. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ActiveBall), 0, 0, 0, 0, AudioFade(ActiveBall)
  1433. End Sub
  1434.  
  1435. Sub PlaySoundAtLevelExistingActiveBall(playsoundparams, aVol)
  1436. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ActiveBall), 0, 0, 1, 0, AudioFade(ActiveBall)
  1437. End Sub
  1438.  
  1439. Sub PlaySoundAtLeveTimerActiveBall(playsoundparams, aVol, ballvariable)
  1440. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ballvariable), 0, 0, 0, 0, AudioFade(ballvariable)
  1441. End Sub
  1442.  
  1443. Sub PlaySoundAtLevelTimerExistingActiveBall(playsoundparams, aVol, ballvariable)
  1444. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ballvariable), 0, 0, 1, 0, AudioFade(ballvariable)
  1445. End Sub
  1446.  
  1447. Sub PlaySoundAtLevelRoll(playsoundparams, aVol, pitch)
  1448. PlaySound playsoundparams, -1, aVol * VolumeDial, AudioPan(tableobj), randomPitch, 0, 0, 0, AudioFade(tableobj)
  1449. End Sub
  1450.  
  1451. ' Previous Positional Sound Subs
  1452.  
  1453. Sub PlaySoundAt(soundname, tableobj)
  1454. PlaySound soundname, 1, 1 * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1455. End Sub
  1456.  
  1457. Sub PlaySoundAtVol(soundname, tableobj, aVol)
  1458. PlaySound soundname, 1, aVol * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1459. End Sub
  1460.  
  1461. Sub PlaySoundAtBall(soundname)
  1462. PlaySoundAt soundname, ActiveBall
  1463. End Sub
  1464.  
  1465. Sub PlaySoundAtBallVol (Soundname, aVol)
  1466. Playsound soundname, 1,aVol * VolumeDial, AudioPan(ActiveBall), 0,0,0, 1, AudioFade(ActiveBall)
  1467. End Sub
  1468.  
  1469. Sub PlaySoundAtBallVolM (Soundname, aVol)
  1470. Playsound soundname, 1,aVol * VolumeDial, AudioPan(ActiveBall), 0,0,0, 0, AudioFade(ActiveBall)
  1471. End Sub
  1472.  
  1473. Sub PlaySoundAtVolLoops(sound, tableobj, Vol, Loops)
  1474. PlaySound sound, Loops, Vol * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1475. End Sub
  1476.  
  1477.  
  1478. ' *********************************************************************
  1479. ' Fleep Supporting Ball & Sound Functions
  1480. ' *********************************************************************
  1481.  
  1482. Dim tablewidth, tableheight : tablewidth = table1.width : tableheight = table1.height
  1483.  
  1484. 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
  1485. Dim tmp
  1486. tmp = tableobj.y * 2 / tableheight-1
  1487. If tmp > 0 Then
  1488. AudioFade = Csng(tmp ^10)
  1489. Else
  1490. AudioFade = Csng(-((- tmp) ^10) )
  1491. End If
  1492. End Function
  1493.  
  1494. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  1495. Dim tmp
  1496. tmp = tableobj.x * 2 / tablewidth-1
  1497. If tmp > 0 Then
  1498. AudioPan = Csng(tmp ^10)
  1499. Else
  1500. AudioPan = Csng(-((- tmp) ^10) )
  1501. End If
  1502. End Function
  1503.  
  1504. Function Vol(ball) ' Calculates the volume of the sound based on the ball speed
  1505. Vol = Csng(BallVel(ball) ^2)
  1506. End Function
  1507.  
  1508. Function Volz(ball) ' Calculates the volume of the sound based on the ball speed
  1509. Volz = Csng((ball.velz) ^2)
  1510. End Function
  1511.  
  1512. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1513. Pitch = BallVel(ball) * 20
  1514. End Function
  1515.  
  1516. Function BallVel(ball) 'Calculates the ball speed
  1517. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1518. End Function
  1519.  
  1520. Function VolPlayfieldRoll(ball) ' Calculates the roll volume of the sound based on the ball speed
  1521. VolPlayfieldRoll = RollingSoundFactor * 0.0005 * Csng(BallVel(ball) ^3)
  1522. End Function
  1523.  
  1524. Function PitchPlayfieldRoll(ball) ' Calculates the roll pitch of the sound based on the ball speed
  1525. PitchPlayfieldRoll = BallVel(ball) ^2 * 15
  1526. End Function
  1527.  
  1528. Function RndInt(min, max)
  1529. RndInt = Int(Rnd() * (max-min + 1) + min)' Sets a random number integer between min and max
  1530. End Function
  1531.  
  1532. Function RndNum(min, max)
  1533. RndNum = Rnd() * (max-min) + min' Sets a random number between min and max
  1534. End Function
  1535.  
  1536. '///////////////////////////// GENERAL SOUND SUBROUTINES ////////////////////////////
  1537. Sub SoundStartButton()
  1538. PlaySound ("Start_Button"), 0, StartButtonSoundLevel, 0, 0.25
  1539. End Sub
  1540.  
  1541. Sub SoundNudgeLeft()
  1542. PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeLeftSoundLevel * VolumeDial, -0.1, 0.25
  1543. End Sub
  1544.  
  1545. Sub SoundNudgeRight()
  1546. PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeRightSoundLevel * VolumeDial, 0.1, 0.25
  1547. End Sub
  1548.  
  1549. Sub SoundNudgeCenter()
  1550. PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeCenterSoundLevel * VolumeDial, 0, 0.25
  1551. End Sub
  1552.  
  1553.  
  1554. Sub SoundPlungerPull()
  1555. PlaySoundAtLevelStatic ("Plunger_Pull_1"), PlungerPullSoundLevel, Plunger
  1556. End Sub
  1557.  
  1558. Sub SoundPlungerReleaseBall()
  1559. PlaySoundAtLevelStatic ("Plunger_Release_Ball"), PlungerReleaseSoundLevel, Plunger
  1560. End Sub
  1561.  
  1562. Sub SoundPlungerReleaseNoBall()
  1563. PlaySoundAtLevelStatic ("Plunger_Release_No_Ball"), PlungerReleaseSoundLevel, Plunger
  1564. End Sub
  1565.  
  1566.  
  1567. '///////////////////////////// KNOCKER SOLENOID ////////////////////////////
  1568. Sub KnockerSolenoid()
  1569. PlaySoundAtLevelStatic SoundFX("Knocker_1",DOFKnocker), KnockerSoundLevel, KnockerPosition
  1570. End Sub
  1571.  
  1572. '///////////////////////////// DRAIN SOUNDS ////////////////////////////
  1573. Sub RandomSoundDrain(drainswitch)
  1574. PlaySoundAtLevelStatic ("Drain_" & Int(Rnd*11)+1), DrainSoundLevel, drainswitch
  1575. End Sub
  1576.  
  1577. '///////////////////////////// TROUGH BALL RELEASE SOLENOID SOUNDS ////////////////////////////
  1578.  
  1579. Sub RandomSoundBallRelease(drainswitch)
  1580. PlaySoundAtLevelStatic SoundFX("BallRelease" & Int(Rnd*7)+1,DOFContactors), BallReleaseSoundLevel, drainswitch
  1581. End Sub
  1582.  
  1583. '///////////////////////////// SLINGSHOT SOLENOID SOUNDS ////////////////////////////
  1584. Sub RandomSoundSlingshotLeft(sling)
  1585. PlaySoundAtLevelStatic SoundFX("Sling_L" & Int(Rnd*10)+1,DOFContactors), SlingshotSoundLevel, Sling
  1586. End Sub
  1587.  
  1588. Sub RandomSoundSlingshotRight(sling)
  1589. PlaySoundAtLevelStatic SoundFX("Sling_R" & Int(Rnd*8)+1,DOFContactors), SlingshotSoundLevel, Sling
  1590. End Sub
  1591.  
  1592.  
  1593. '///////////////////////////// BUMPER SOLENOID SOUNDS ////////////////////////////
  1594. Sub RandomSoundBumperTop(Bump)
  1595. PlaySoundAtLevelStatic SoundFX("Bumpers_Top_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
  1596. End Sub
  1597.  
  1598. Sub RandomSoundBumperMiddle(Bump)
  1599. PlaySoundAtLevelStatic SoundFXDOF("Bumpers_Middle_" & Int(Rnd*5)+1, 111, DOFPulse, DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
  1600. End Sub
  1601.  
  1602. Sub RandomSoundBumperBottom(Bump)
  1603. PlaySoundAtLevelStatic SoundFXDOF("Bumpers_Bottom_" & Int(Rnd*5)+1, 112, DOFPulse, DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
  1604. End Sub
  1605.  
  1606.  
  1607. '///////////////////////////// FLIPPER BATS SOUND SUBROUTINES ////////////////////////////
  1608. '///////////////////////////// FLIPPER BATS SOLENOID ATTACK SOUND ////////////////////////////
  1609. Sub SoundFlipperUpAttackLeft(flipper)
  1610. FlipperUpAttackLeftSoundLevel = RndNum(FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel)
  1611. PlaySoundAtLevelStatic ("Flipper_Attack-L01"), FlipperUpAttackLeftSoundLevel, flipper
  1612. End Sub
  1613.  
  1614. Sub SoundFlipperUpAttackRight(flipper)
  1615. FlipperUpAttackRightSoundLevel = RndNum(FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel)
  1616. PlaySoundAtLevelStatic ("Flipper_Attack-R01"), FlipperUpAttackLeftSoundLevel, flipper
  1617. End Sub
  1618.  
  1619. '///////////////////////////// FLIPPER BATS SOLENOID CORE SOUND ////////////////////////////
  1620. Sub RandomSoundFlipperUpLeft(flipper)
  1621. PlaySoundAtLevelStatic SoundFX("Flipper_L0" & Int(Rnd*9)+1,DOFFlippers), FlipperLeftHitParm, Flipper
  1622. End Sub
  1623.  
  1624. Sub RandomSoundFlipperUpRight(flipper)
  1625. PlaySoundAtLevelStatic SoundFX("Flipper_R0" & Int(Rnd*9)+1,DOFFlippers), FlipperRightHitParm, Flipper
  1626. End Sub
  1627.  
  1628. Sub RandomSoundReflipUpLeft(flipper)
  1629. PlaySoundAtLevelStatic SoundFX("Flipper_ReFlip_L0" & Int(Rnd*3)+1,DOFFlippers), (RndNum(0.8, 1))*FlipperUpSoundLevel, Flipper
  1630. End Sub
  1631.  
  1632. Sub RandomSoundReflipUpRight(flipper)
  1633. PlaySoundAtLevelStatic SoundFX("Flipper_ReFlip_R0" & Int(Rnd*3)+1,DOFFlippers), (RndNum(0.8, 1))*FlipperUpSoundLevel, Flipper
  1634. End Sub
  1635.  
  1636. Sub RandomSoundFlipperDownLeft(flipper)
  1637. PlaySoundAtLevelStatic SoundFX("Flipper_Left_Down_" & Int(Rnd*7)+1,DOFFlippers), FlipperDownSoundLevel, Flipper
  1638. End Sub
  1639.  
  1640. Sub RandomSoundFlipperDownRight(flipper)
  1641. PlaySoundAtLevelStatic SoundFX("Flipper_Right_Down_" & Int(Rnd*8)+1,DOFFlippers), FlipperDownSoundLevel, Flipper
  1642. End Sub
  1643.  
  1644. '///////////////////////////// FLIPPER BATS BALL COLLIDE SOUND ////////////////////////////
  1645.  
  1646. Sub LeftFlipperCollide(parm)
  1647. FlipperLeftHitParm = parm/10
  1648. If FlipperLeftHitParm > 1 Then
  1649. FlipperLeftHitParm = 1
  1650. End If
  1651. FlipperLeftHitParm = FlipperUpSoundLevel * FlipperLeftHitParm
  1652. RandomSoundRubberFlipper(parm)
  1653. End Sub
  1654.  
  1655. Sub RightFlipperCollide(parm)
  1656. FlipperRightHitParm = parm/10
  1657. If FlipperRightHitParm > 1 Then
  1658. FlipperRightHitParm = 1
  1659. End If
  1660. FlipperRightHitParm = FlipperUpSoundLevel * FlipperRightHitParm
  1661. RandomSoundRubberFlipper(parm)
  1662. End Sub
  1663.  
  1664. Sub RandomSoundRubberFlipper(parm)
  1665. PlaySoundAtLevelActiveBall ("Flipper_Rubber_" & Int(Rnd*7)+1), parm * RubberFlipperSoundFactor
  1666. End Sub
  1667.  
  1668. '///////////////////////////// ROLLOVER SOUNDS ////////////////////////////
  1669. Sub RandomSoundRollover()
  1670. PlaySoundAtLevelActiveBall ("Rollover_" & Int(Rnd*4)+1), RolloverSoundLevel
  1671. End Sub
  1672.  
  1673. Sub Rollovers_Hit(idx)
  1674. RandomSoundRollover
  1675. End Sub
  1676.  
  1677. '///////////////////////////// VARIOUS PLAYFIELD SOUND SUBROUTINES ////////////////////////////
  1678. '///////////////////////////// RUBBERS AND POSTS ////////////////////////////
  1679. '///////////////////////////// RUBBERS - EVENTS ////////////////////////////
  1680. Sub Rubbers_Hit(idx)
  1681. dim finalspeed
  1682. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1683. If finalspeed > 5 then
  1684. RandomSoundRubberStrong 1
  1685. End if
  1686. If finalspeed <= 5 then
  1687. RandomSoundRubberWeak()
  1688. End If
  1689. End Sub
  1690.  
  1691. '///////////////////////////// RUBBERS AND POSTS - STRONG IMPACTS ////////////////////////////
  1692. Sub RandomSoundRubberStrong(voladj)
  1693. Select Case Int(Rnd*10)+1
  1694. Case 1 : PlaySoundAtLevelActiveBall ("Rubber_Strong_1"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  1695. Case 2 : PlaySoundAtLevelActiveBall ("Rubber_Strong_2"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  1696. Case 3 : PlaySoundAtLevelActiveBall ("Rubber_Strong_3"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  1697. Case 4 : PlaySoundAtLevelActiveBall ("Rubber_Strong_4"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  1698. Case 5 : PlaySoundAtLevelActiveBall ("Rubber_Strong_5"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  1699. Case 6 : PlaySoundAtLevelActiveBall ("Rubber_Strong_6"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  1700. Case 7 : PlaySoundAtLevelActiveBall ("Rubber_Strong_7"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  1701. Case 8 : PlaySoundAtLevelActiveBall ("Rubber_Strong_8"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  1702. Case 9 : PlaySoundAtLevelActiveBall ("Rubber_Strong_9"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  1703. Case 10 : PlaySoundAtLevelActiveBall ("Rubber_1_Hard"), Vol(ActiveBall) * RubberStrongSoundFactor * 0.6*voladj
  1704. End Select
  1705. End Sub
  1706.  
  1707. '///////////////////////////// RUBBERS AND POSTS - WEAK IMPACTS ////////////////////////////
  1708. Sub RandomSoundRubberWeak()
  1709. PlaySoundAtLevelActiveBall ("Rubber_" & Int(Rnd*9)+1), Vol(ActiveBall) * RubberWeakSoundFactor
  1710. End Sub
  1711.  
  1712. '///////////////////////////// WALL IMPACTS ////////////////////////////
  1713. Sub Walls_Hit(idx)
  1714. dim finalspeed
  1715. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1716. If finalspeed > 5 then
  1717. RandomSoundRubberStrong 1
  1718. End if
  1719. If finalspeed <= 5 then
  1720. RandomSoundRubberWeak()
  1721. End If
  1722. End Sub
  1723.  
  1724. Sub RandomSoundWall()
  1725. dim finalspeed
  1726. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1727. If finalspeed > 16 then
  1728. Select Case Int(Rnd*5)+1
  1729. Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_1"), Vol(ActiveBall) * WallImpactSoundFactor
  1730. Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_2"), Vol(ActiveBall) * WallImpactSoundFactor
  1731. Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_5"), Vol(ActiveBall) * WallImpactSoundFactor
  1732. Case 4 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_7"), Vol(ActiveBall) * WallImpactSoundFactor
  1733. Case 5 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_9"), Vol(ActiveBall) * WallImpactSoundFactor
  1734. End Select
  1735. End if
  1736. If finalspeed >= 6 AND finalspeed <= 16 then
  1737. Select Case Int(Rnd*4)+1
  1738. Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_3"), Vol(ActiveBall) * WallImpactSoundFactor
  1739. Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_4"), Vol(ActiveBall) * WallImpactSoundFactor
  1740. Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_6"), Vol(ActiveBall) * WallImpactSoundFactor
  1741. Case 4 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_8"), Vol(ActiveBall) * WallImpactSoundFactor
  1742. End Select
  1743. End If
  1744. If finalspeed < 6 Then
  1745. Select Case Int(Rnd*3)+1
  1746. Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_4"), Vol(ActiveBall) * WallImpactSoundFactor
  1747. Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_6"), Vol(ActiveBall) * WallImpactSoundFactor
  1748. Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_8"), Vol(ActiveBall) * WallImpactSoundFactor
  1749. End Select
  1750. End if
  1751. End Sub
  1752.  
  1753. '///////////////////////////// METAL TOUCH SOUNDS ////////////////////////////
  1754. Sub RandomSoundMetal()
  1755. PlaySoundAtLevelActiveBall ("Metal_Touch_" & Int(Rnd*13)+1), Vol(ActiveBall) * MetalImpactSoundFactor
  1756. End Sub
  1757.  
  1758. '///////////////////////////// METAL - EVENTS ////////////////////////////
  1759.  
  1760. Sub Metals_Hit (idx)
  1761. RandomSoundMetal
  1762. End Sub
  1763.  
  1764. Sub ShooterDiverter_collide(idx)
  1765. RandomSoundMetal
  1766. End Sub
  1767.  
  1768. '///////////////////////////// BOTTOM ARCH BALL GUIDE ////////////////////////////
  1769. '///////////////////////////// BOTTOM ARCH BALL GUIDE - SOFT BOUNCES ////////////////////////////
  1770. Sub RandomSoundBottomArchBallGuide()
  1771. dim finalspeed
  1772. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1773. If finalspeed > 16 then
  1774. PlaySoundAtLevelActiveBall ("Apron_Bounce_"& Int(Rnd*2)+1), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  1775. End if
  1776. If finalspeed >= 6 AND finalspeed <= 16 then
  1777. Select Case Int(Rnd*2)+1
  1778. Case 1 : PlaySoundAtLevelActiveBall ("Apron_Bounce_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  1779. Case 2 : PlaySoundAtLevelActiveBall ("Apron_Bounce_Soft_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  1780. End Select
  1781. End If
  1782. If finalspeed < 6 Then
  1783. Select Case Int(Rnd*2)+1
  1784. Case 1 : PlaySoundAtLevelActiveBall ("Apron_Bounce_Soft_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  1785. Case 2 : PlaySoundAtLevelActiveBall ("Apron_Medium_3"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  1786. End Select
  1787. End if
  1788. End Sub
  1789.  
  1790. '///////////////////////////// BOTTOM ARCH BALL GUIDE - HARD HITS ////////////////////////////
  1791. Sub RandomSoundBottomArchBallGuideHardHit()
  1792. PlaySoundAtLevelActiveBall ("Apron_Hard_Hit_" & Int(Rnd*3)+1), BottomArchBallGuideSoundFactor * 0.25
  1793. End Sub
  1794.  
  1795. Sub Apron_Hit (idx)
  1796. If Abs(cor.ballvelx(activeball.id) < 4) and cor.ballvely(activeball.id) > 7 then
  1797. RandomSoundBottomArchBallGuideHardHit()
  1798. Else
  1799. RandomSoundBottomArchBallGuide
  1800. End If
  1801. End Sub
  1802.  
  1803. '///////////////////////////// FLIPPER BALL GUIDE ////////////////////////////
  1804. Sub RandomSoundFlipperBallGuide()
  1805. dim finalspeed
  1806. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1807. If finalspeed > 16 then
  1808. Select Case Int(Rnd*2)+1
  1809. Case 1 : PlaySoundAtLevelActiveBall ("Apron_Hard_1"), Vol(ActiveBall) * FlipperBallGuideSoundFactor
  1810. Case 2 : PlaySoundAtLevelActiveBall ("Apron_Hard_2"), Vol(ActiveBall) * 0.8 * FlipperBallGuideSoundFactor
  1811. End Select
  1812. End if
  1813. If finalspeed >= 6 AND finalspeed <= 16 then
  1814. PlaySoundAtLevelActiveBall ("Apron_Medium_" & Int(Rnd*3)+1), Vol(ActiveBall) * FlipperBallGuideSoundFactor
  1815. End If
  1816. If finalspeed < 6 Then
  1817. PlaySoundAtLevelActiveBall ("Apron_Soft_" & Int(Rnd*7)+1), Vol(ActiveBall) * FlipperBallGuideSoundFactor
  1818. End If
  1819. End Sub
  1820.  
  1821. '///////////////////////////// TARGET HIT SOUNDS ////////////////////////////
  1822. Sub RandomSoundTargetHitStrong()
  1823. PlaySoundAtLevelActiveBall SoundFX("Target_Hit_" & Int(Rnd*4)+5,DOFTargets), Vol(ActiveBall) * 0.45 * TargetSoundFactor
  1824. End Sub
  1825.  
  1826. Sub RandomSoundTargetHitWeak()
  1827. PlaySoundAtLevelActiveBall SoundFX("Target_Hit_" & Int(Rnd*4)+1,DOFTargets), Vol(ActiveBall) * TargetSoundFactor
  1828. End Sub
  1829.  
  1830. Sub PlayTargetSound()
  1831. dim finalspeed
  1832. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1833. If finalspeed > 10 then
  1834. RandomSoundTargetHitStrong()
  1835. RandomSoundBallBouncePlayfieldSoft Activeball
  1836. Else
  1837. RandomSoundTargetHitWeak()
  1838. End If
  1839. End Sub
  1840.  
  1841. Sub Targets_Hit (idx)
  1842. PlayTargetSound
  1843. End Sub
  1844.  
  1845. '///////////////////////////// BALL BOUNCE SOUNDS ////////////////////////////
  1846. Sub RandomSoundBallBouncePlayfieldSoft(aBall)
  1847. Select Case Int(Rnd*9)+1
  1848. Case 1 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_1"), volz(aBall) * BallBouncePlayfieldSoftFactor, aBall
  1849. Case 2 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_2"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.5, aBall
  1850. Case 3 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_3"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.8, aBall
  1851. Case 4 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_4"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.5, aBall
  1852. Case 5 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_5"), volz(aBall) * BallBouncePlayfieldSoftFactor, aBall
  1853. Case 6 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_1"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
  1854. Case 7 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_2"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
  1855. Case 8 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_5"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
  1856. Case 9 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_7"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.3, aBall
  1857. End Select
  1858. End Sub
  1859.  
  1860. Sub RandomSoundBallBouncePlayfieldHard(aBall)
  1861. PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_" & Int(Rnd*7)+1), volz(aBall) * BallBouncePlayfieldHardFactor, aBall
  1862. End Sub
  1863.  
  1864. '///////////////////////////// DELAYED DROP - TO PLAYFIELD - SOUND ////////////////////////////
  1865. Sub RandomSoundDelayedBallDropOnPlayfield(aBall)
  1866. Select Case Int(Rnd*5)+1
  1867. Case 1 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_1_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  1868. Case 2 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_2_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  1869. Case 3 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_3_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  1870. Case 4 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_4_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  1871. Case 5 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_5_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  1872. End Select
  1873. End Sub
  1874.  
  1875. '///////////////////////////// BALL GATES AND BRACKET GATES SOUNDS ////////////////////////////
  1876.  
  1877. Sub SoundPlayfieldGate()
  1878. PlaySoundAtLevelStatic ("Gate_FastTrigger_" & Int(Rnd*2)+1), GateSoundLevel, Activeball
  1879. End Sub
  1880.  
  1881. Sub SoundHeavyGate()
  1882. PlaySoundAtLevelStatic ("Gate_2"), GateSoundLevel, Activeball
  1883. End Sub
  1884.  
  1885. Sub Gates_hit(idx)
  1886. SoundHeavyGate
  1887. End Sub
  1888.  
  1889. Sub GatesWire_hit(idx)
  1890. SoundPlayfieldGate
  1891. End Sub
  1892.  
  1893. '///////////////////////////// LEFT LANE ENTRANCE - SOUNDS ////////////////////////////
  1894.  
  1895. Sub RandomSoundLeftArch()
  1896. PlaySoundAtLevelActiveBall ("Arch_L" & Int(Rnd*4)+1), Vol(ActiveBall) * ArchSoundFactor
  1897. End Sub
  1898.  
  1899. Sub RandomSoundRightArch()
  1900. PlaySoundAtLevelActiveBall ("Arch_R" & Int(Rnd*4)+1), Vol(ActiveBall) * ArchSoundFactor
  1901. End Sub
  1902.  
  1903.  
  1904. Sub Arch1_hit()
  1905. If Activeball.velx > 1 Then SoundPlayfieldGate
  1906. StopSound "Arch_L1"
  1907. StopSound "Arch_L2"
  1908. StopSound "Arch_L3"
  1909. StopSound "Arch_L4"
  1910. End Sub
  1911.  
  1912. Sub Arch1_unhit()
  1913. If activeball.velx < -8 Then
  1914. RandomSoundRightArch
  1915. End If
  1916. End Sub
  1917.  
  1918. Sub Arch2_hit()
  1919. If Activeball.velx < 1 Then SoundPlayfieldGate
  1920. StopSound "Arch_R1"
  1921. StopSound "Arch_R2"
  1922. StopSound "Arch_R3"
  1923. StopSound "Arch_R4"
  1924. End Sub
  1925.  
  1926. Sub Arch2_unhit()
  1927. If activeball.velx > 10 Then
  1928. RandomSoundLeftArch
  1929. End If
  1930. End Sub
  1931.  
  1932. '///////////////////////////// SAUCERS (KICKER HOLES) ////////////////////////////
  1933.  
  1934. Sub SoundSaucerLock()
  1935. PlaySoundAtLevelStatic ("Saucer_Enter_" & Int(Rnd*2)+1), SaucerLockSoundLevel, Activeball
  1936. End Sub
  1937.  
  1938. Sub SoundSaucerKick(scenario, saucer)
  1939. Select Case scenario
  1940. Case 0: PlaySoundAtLevelStatic SoundFX("Saucer_Empty", DOFContactors), SaucerKickSoundLevel, saucer
  1941. Case 1: PlaySoundAtLevelStatic SoundFX("Saucer_Kick", DOFContactors), SaucerKickSoundLevel, saucer
  1942. End Select
  1943. End Sub
  1944.  
  1945. '///////////////////////////// BALL COLLISION SOUND ////////////////////////////
  1946. Sub OnBallBallCollision(ball1, ball2, velocity)
  1947. Dim snd
  1948. Select Case Int(Rnd*7)+1
  1949. Case 1 : snd = "Ball_Collide_1"
  1950. Case 2 : snd = "Ball_Collide_2"
  1951. Case 3 : snd = "Ball_Collide_3"
  1952. Case 4 : snd = "Ball_Collide_4"
  1953. Case 5 : snd = "Ball_Collide_5"
  1954. Case 6 : snd = "Ball_Collide_6"
  1955. Case 7 : snd = "Ball_Collide_7"
  1956. End Select
  1957.  
  1958. PlaySound (snd), 0, Csng(velocity) ^2 / 200 * BallWithBallCollisionSoundFactor * VolumeDial, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  1959. End Sub
  1960.  
  1961.  
  1962. '/////////////////////////////////////////////////////////////////
  1963. ' End Mechanical Sounds
  1964. '/////////////////////////////////////////////////////////////////
  1965.  
  1966. ' Thalamus : Exit in a clean and proper way
  1967. Sub Table1_exit()
  1968. If B2SOn Then
  1969. Controller.Pause = False
  1970. Controller.Stop
  1971. End If
  1972. End Sub
  1973.  
Add Comment
Please, Sign In to add comment