Advertisement
Guest User

Untitled

a guest
May 28th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.92 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="raven",UseSolenoids=1,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
  10.  
  11. LoadVPM "01120100","sys80.vbs",3.02
  12. Dim DesktopMode: DesktopMode = Table1.ShowDT
  13.  
  14. If DesktopMode = True Then 'Show Desktop components
  15. Ramp16.visible=1
  16. Ramp15.visible=1
  17. Primitive13.visible=1
  18. Else
  19. Ramp16.visible=0
  20. Ramp15.visible=0
  21. Primitive13.visible=0
  22. End if
  23.  
  24. '*************************************************************
  25. 'Solenoid Call backs
  26. '**********************************************************************************************************
  27. SolCallback(1)="TLB.SolDropUp" 'Drop Targets
  28. SolCallback(2)="TRB.SolDropUp" 'Drop Targets
  29. Solcallback(4) = "SetLamp 94,"
  30. SolCallback(5)="BLB.SolDropUp" 'Drop Targets
  31. SolCallback(6)="BRB.SolDropUp" 'Drop Targets
  32. Solcallback(7) = "SetLamp 97,"
  33.  
  34. SolCallback(8)="vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  35. SolCallback(9)="bsTrough.SolOut"
  36.  
  37. SolCallback(sLRFlipper) = "SolRFlipper"
  38. SolCallback(sLLFlipper) = "SolLFlipper"
  39.  
  40. Sub SolLFlipper(Enabled)
  41. If Enabled Then
  42. PlaySound SoundFX("fx_Flipperup",DOFContactors):LeftFlipper.RotateToEnd
  43. Else
  44. PlaySound SoundFX("fx_Flipperdown",DOFContactors):LeftFlipper.RotateToStart
  45. End If
  46. End Sub
  47.  
  48. Sub SolRFlipper(Enabled)
  49. If Enabled Then
  50. PlaySound SoundFX("fx_Flipperup",DOFContactors):RightFlipper.RotateToEnd
  51. Else
  52. PlaySound SoundFX("fx_Flipperdown",DOFContactors):RightFlipper.RotateToStart
  53. End If
  54. End Sub
  55. '**********************************************************************************************************
  56.  
  57. 'Solenoid Controlled toys
  58. '**********************************************************************************************************
  59.  
  60. 'Playfield GI
  61. Sub PFGI(Enabled)
  62. If Enabled Then
  63. dim xx
  64. For each xx in GI:xx.State = 0: Next
  65. PlaySound "fx_relay"
  66. Timer1.Enabled = 0 'Aux Board 1
  67. Else
  68. For each xx in GI:xx.State = 1: Next
  69. PlaySound "fx_relay"
  70. Timer1.Enabled = 1 'Aux Board 1
  71. End If
  72. End Sub
  73.  
  74.  
  75. '**********************************************************************************************************
  76.  
  77. 'Initiate Table
  78. '**********************************************************************************************************
  79.  
  80. Dim bsTrough, TLB, BLB, TRB, BRB
  81.  
  82. Sub Table1_Init
  83. vpmInit Me
  84. On Error Resume Next
  85. With Controller
  86. .GameName = cGameName
  87. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  88. .SplashInfoLine = "Raven Gottlieb"&chr(13)&"You Suck"
  89. .HandleMechanics=0
  90. .HandleKeyboard=0
  91. .ShowDMDOnly=1
  92. .ShowFrame=0
  93. .ShowTitle=0
  94. .hidden = 1
  95. On Error Resume Next
  96. .Run GetPlayerHWnd
  97. If Err Then MsgBox Err.Description
  98. On Error Goto 0
  99. End With
  100. On Error Goto 0
  101.  
  102. PinMAMETimer.Interval=PinMAMEInterval
  103. PinMAMETimer.Enabled=1
  104.  
  105. vpmNudge.TiltSwitch=57
  106. vpmNudge.Sensitivity=5
  107. vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,Bumper4,LeftSlingshot,RightSlingshot)
  108.  
  109. Set bsTrough=New cvpmBallstack
  110. bsTrough.InitSw 0,67,0,0,0,0,0,0
  111. bsTrough.InitKick BallRelease,120,3
  112. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  113. bsTrough.Balls=1
  114.  
  115. Set TLB=New cvpmDropTarget
  116. TLB.InitDrop sw44,44
  117. TLB.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
  118.  
  119. Set TRB=New cvpmDropTarget
  120. TRB.InitDrop sw54,54
  121. TRB.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
  122.  
  123. Set BLB=New cvpmDropTarget
  124. BLB.InitDrop sw64,64
  125. BLB.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
  126.  
  127. Set BRB=New cvpmDropTarget
  128. BRB.InitDrop sw74,74
  129. BRB.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
  130.  
  131. End Sub
  132.  
  133. '**********************************************************************************************************
  134. 'Plunger code
  135. '**********************************************************************************************************
  136.  
  137. Sub Table1_KeyDown(ByVal KeyCode)
  138.  
  139. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  140. if keycode=leftflipperkey then controller.switch(6)=1
  141. if keycode=rightflipperkey then
  142. Controller.Switch(16)=1
  143. controller.switch(75)=1
  144. End If
  145. If KeyDownHandler(keycode) Then Exit Sub
  146. End Sub
  147.  
  148. Sub Table1_KeyUp(ByVal KeyCode)
  149.  
  150. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  151. if keycode=leftflipperkey then controller.switch(6)=0
  152. if keycode=rightflipperkey then
  153. Controller.Switch(16)=0
  154. controller.switch(75)=0
  155. End If
  156. If KeyUpHandler(keycode) Then Exit Sub
  157. End Sub
  158.  
  159. '**********************************************************************************************************
  160.  
  161. ' Drain hole and kickers
  162. Sub Drain_Hit:bsTrough.addball me : playsound"drain" : End Sub
  163.  
  164. 'Drop Targets
  165. Sub sw44_Dropped:TLB.Hit 1:End Sub
  166. Sub sw54_Dropped:TRB.Hit 1:End Sub
  167. Sub sw64_Dropped:BLB.Hit 1:End Sub
  168. Sub sw74_Dropped:BRB.Hit 1:End Sub
  169.  
  170. 'Stand Up Targets
  171. Sub sw40_hit:vpmTimer.pulseSw 40 : End Sub
  172. Sub sw50_hit:vpmTimer.pulseSw 50 : End Sub
  173. Sub sw60_hit:vpmTimer.pulseSw 60 : End Sub
  174. Sub sw70_hit:vpmTimer.pulseSw 70 : End Sub
  175. Sub sw41_Hit:VpmTimer.PulseSw 41 : End Sub
  176. Sub sw51_Hit:VpmTimer.PulseSw 51 : End Sub
  177. Sub sw61_Hit:VpmTimer.PulseSw 61 : End Sub
  178. Sub sw42_Hit:VpmTimer.PulseSw 42 : End Sub
  179. Sub sw52_Hit:VpmTimer.PulseSw 52 : End Sub
  180. Sub sw62_Hit:VpmTimer.PulseSw 62 : End Sub
  181.  
  182. 'Scoring Rubber
  183. Sub sw45a_hit:vpmTimer.pulseSw 45 : playsound"flip_hit_3" : End Sub
  184. Sub sw45b_hit:vpmTimer.pulseSw 45 : playsound"flip_hit_3" : End Sub
  185.  
  186. 'Bumpers
  187. Sub Bumper1_Hit : vpmTimer.PulseSw(46) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  188. Sub Bumper2_Hit : vpmTimer.PulseSw(46) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  189. Sub Bumper3_Hit : vpmTimer.PulseSw(46) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  190. Sub Bumper4_Hit : vpmTimer.PulseSw(46) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  191.  
  192. 'Wire Triggers
  193. Sub SW43_Hit:Controller.Switch(43)=1 : playsound"rollover" : End Sub
  194. Sub SW43_unHit:Controller.Switch(43)=0:End Sub
  195. Sub SW53_Hit:Controller.Switch(53)=1 : playsound"rollover" : End Sub
  196. Sub SW53_unHit:Controller.Switch(53)=0:End Sub
  197. Sub sw55a_Hit:Controller.Switch(55)=1 : playsound"rollover" : End Sub
  198. Sub sw55a_unHit:Controller.Switch(55)=0:End Sub
  199. Sub sw55b_Hit:Controller.Switch(55)=1 : playsound"rollover" : End Sub
  200. Sub sw55b_UnHit:Controller.Switch(55)=0:End Sub
  201. Sub SW63_Hit:Controller.Switch(63)=1 : playsound"rollover" : End Sub
  202. Sub SW63_unHit:Controller.Switch(63)=0:End Sub
  203. Sub sw65a_Hit:Controller.Switch(65)=1 : playsound"rollover" : End Sub
  204. Sub sw65a_unHit:Controller.Switch(65)=0:End Sub
  205. Sub sw65b_Hit:Controller.Switch(65)=1 : playsound"rollover" : End Sub
  206. Sub sw65b_UnHit:Controller.Switch(65)=0:End Sub
  207. Sub sw71_Hit:Controller.Switch(71)=1 : playsound"rollover" : End Sub
  208. Sub sw71_unHit:Controller.switch(71)=0:End Sub
  209. Sub sw72_Hit:Controller.Switch(72)=1 : playsound"rollover" : End Sub
  210. Sub sw72_unHit:Controller.switch(72)=0:End Sub
  211.  
  212. 'Gate Trigger
  213. Sub sw73_hit:vpmTimer.pulseSw 73 : End Sub
  214.  
  215. 'Star Triggers
  216. Sub sw73a_Hit:Controller.Switch(73)=1 : playsound"rollover" : End Sub
  217. Sub sw73a_unHit:Controller.Switch(73)=0:End Sub
  218.  
  219. 'Generic Sounds
  220. Sub Trigger1_Hit: playsound"fx_ballrampdrop" : End Sub
  221. Sub Trigger2_Hit: playsound"fx_ballrampdrop" : End Sub
  222.  
  223.  
  224. '***************************************************
  225. '***************************************************
  226. ' Blade animation based on spinner
  227. '***************************************************
  228. '***************************************************
  229.  
  230. Sub sw76_Spin()
  231. vpmTimer.PulseSw 76
  232. playsound"fx_spinner"
  233. End Sub
  234.  
  235. Const bladeStepMax = 40
  236. Const bladeRevsMax = 300
  237. Dim bladeRevs
  238.  
  239. Randomize
  240. PrimBlades.Roty = rnd() * 360
  241.  
  242. Sub spinnervelocity_hit()
  243. Dim vtemp
  244. vtemp = (int)(abs(activeball.vely))
  245. If vtemp > 8 Then
  246. bladeRevs = bladeRevsMax
  247. bladetimer.interval = 20
  248. bladetimer.enabled = 1
  249. End If
  250. End Sub
  251.  
  252. Sub MotorChooper(Enabled)
  253. If Enabled Then 'Blade On when Light 2 is on
  254. bladeTimer.Enabled = 1
  255. Else
  256. bladeTimer.Enabled = 0
  257. End if
  258. End Sub
  259.  
  260. Sub bladetimer_timer
  261. PrimBlades.Roty = (PrimBlades.Roty - bladeStepMax *(bladeRevs/bladeRevsMax)) MOD 360
  262. bladeRevs = bladeRevs - 1
  263. if bladeRevs = 0 Then bladeTimer.Enabled = 0
  264. End Sub
  265.  
  266.  
  267. '***************************************************
  268. '***************************************************
  269. ' ramp animation
  270. '***************************************************
  271. '***************************************************
  272.  
  273. Ramp_Init
  274. Sub Ramp_Init
  275. Ramp_Move 0
  276. End Sub
  277.  
  278. Sub Ramp_Move (Enabled)
  279. If Enabled = 1 Then 'Up
  280. Botramp.Collidable = False
  281. PlaySound SoundFX("flapopen",DOFContactors)
  282. AuxRampLamps = 0
  283. rampDir = 1
  284. Else 'Down
  285. Botramp.Collidable = True
  286. PlaySound SoundFX("flapclose",DOFContactors)
  287. AuxRampLamps = 1
  288. rampDir = -1
  289. End If
  290. Timer2.Enabled = 0 'Aux Board 2
  291. rampMoveTimer.Enabled = 1
  292. End Sub
  293.  
  294. Const rampMoveMax = 16
  295. Dim rampDir
  296. rampMoveTimer.Interval = 10
  297. Sub rampMoveTimer_Timer
  298. Dim tempa
  299. tempa = ramp.objrotx + 1 * rampDir
  300. if tempa > rampMoveMax then
  301. tempa = rampMoveMax
  302. rampMoveTimer.Enabled = 0
  303. elseif tempa < 0 then
  304. tempa = 0
  305. rampMoveTimer.Enabled = 0
  306. end if
  307. ramp.objrotx = tempa: arm.objrotx = -tempa*1.25
  308. End Sub
  309.  
  310. '***************************************************
  311. ' Aux Board Logic
  312. '***************************************************
  313.  
  314. Dim AuxRampLamps1, AuxLampCount1
  315.  
  316. Sub Timer1_Timer
  317. AuxLampCount1 = (AuxLampCount1 + 1) Mod 10
  318. Select Case AuxLampCount1
  319. Case 0:
  320. SetLamp 101, 1: SetLamp 102,0:SetLamp 103,0:SetLamp 104, 0: SetLamp 105,0:SetLamp 106, 0: SetLamp 107,0:SetLamp 108, 0: SetLamp 109,0: SetLamp 110,0
  321. Case 1:
  322. SetLamp 101, 0: SetLamp 102,1:SetLamp 103,0:SetLamp 104, 0: SetLamp 105,0:SetLamp 106, 0: SetLamp 107,0:SetLamp 108, 0: SetLamp 109,0: SetLamp 110,0
  323. Case 2:
  324. SetLamp 101, 0: SetLamp 102,0:SetLamp 103,1:SetLamp 104, 0: SetLamp 105,0:SetLamp 106, 0: SetLamp 107,0:SetLamp 108, 0: SetLamp 109,0: SetLamp 110,0
  325. Case 3:
  326. SetLamp 101, 0: SetLamp 102,0:SetLamp 103,0:SetLamp 104, 1: SetLamp 105,0:SetLamp 106, 0: SetLamp 107,0:SetLamp 108, 0: SetLamp 109,0: SetLamp 110,0
  327. Case 4:
  328. SetLamp 101, 0: SetLamp 102,0:SetLamp 103,0:SetLamp 104, 0: SetLamp 105,1:SetLamp 106, 0: SetLamp 107,0:SetLamp 108, 0: SetLamp 109,0: SetLamp 110,0
  329. Case 5:
  330. SetLamp 101, 0: SetLamp 102,0:SetLamp 103,0:SetLamp 104, 0: SetLamp 105,0:SetLamp 106, 1: SetLamp 107,0:SetLamp 108, 0: SetLamp 109,0: SetLamp 110,0
  331. Case 6:
  332. SetLamp 101, 0: SetLamp 102,0:SetLamp 103,0:SetLamp 104, 0: SetLamp 105,0:SetLamp 106, 0: SetLamp 107,1:SetLamp 108, 0: SetLamp 109,0: SetLamp 110,0
  333. Case 7:
  334. SetLamp 101, 0: SetLamp 102,0:SetLamp 103,0:SetLamp 104, 0: SetLamp 105,0:SetLamp 106, 0: SetLamp 107,0:SetLamp 108, 1: SetLamp 109,0: SetLamp 110,0
  335. Case 8:
  336. SetLamp 101, 0: SetLamp 102,0:SetLamp 103,0:SetLamp 104, 0: SetLamp 105,0:SetLamp 106, 0: SetLamp 107,0:SetLamp 108, 0: SetLamp 109,1: SetLamp 110,0
  337. Case 9:
  338. SetLamp 101, 0: SetLamp 102,0:SetLamp 103,0:SetLamp 104, 0: SetLamp 105,0:SetLamp 106, 0: SetLamp 107,0:SetLamp 108, 0: SetLamp 109,0: SetLamp 110,1
  339. End Select
  340. End Sub
  341.  
  342.  
  343. Dim AuxRampLamps, AuxLampCount
  344.  
  345. Sub Timer2_Timer
  346. AuxLampCount = (AuxLampCount + 1) Mod 11
  347. Select Case AuxLampCount
  348. Case 0:
  349. SetLamp 111, 1: SetLamp 112, 0: SetLamp 113, 0 : SetLamp 114, 0 : SetLamp 115, 0 : SetLamp 116, 0 : SetLamp 117, 0 : SetLamp 118, 0 : SetLamp 119, 0 : SetLamp 120, 0
  350. Case 1:
  351. SetLamp 111, 0: SetLamp 112, 1: SetLamp 113, 0 : SetLamp 114, 0 : SetLamp 115, 0 : SetLamp 116, 0 : SetLamp 117, 0 : SetLamp 118, 0 : SetLamp 119, 0 : SetLamp 120, 0
  352. Case 3:
  353. SetLamp 111, 0: SetLamp 112, 0: SetLamp 113, 1 : SetLamp 114, 0 : SetLamp 115, 0 : SetLamp 116, 0 : SetLamp 117, 0 : SetLamp 118, 0 : SetLamp 119, 0 : SetLamp 120, 0
  354. Case 4:
  355. SetLamp 111, 0: SetLamp 112, 0: SetLamp 113, 0 : SetLamp 114, 1 : SetLamp 115, 0 : SetLamp 116, 0 : SetLamp 117, 0 : SetLamp 118, 0 : SetLamp 119, 0 : SetLamp 120, 0
  356. Case 5:
  357. SetLamp 111, 0: SetLamp 112, 0: SetLamp 113, 0 : SetLamp 114, 0 : SetLamp 115, 1 : SetLamp 116, 0 : SetLamp 117, 0 : SetLamp 118, 0 : SetLamp 119, 0 : SetLamp 120, 0
  358. Case 6:
  359. SetLamp 111, 0: SetLamp 112, 0: SetLamp 113, 0 : SetLamp 114, 0 : SetLamp 115, 0 : SetLamp 116, 1 : SetLamp 117, 0 : SetLamp 118, 0 : SetLamp 119, 0 : SetLamp 120, 0
  360. Case 7:
  361. SetLamp 111, 0: SetLamp 112, 0: SetLamp 113, 0 : SetLamp 114, 0 : SetLamp 115, 0 : SetLamp 116, 0 : SetLamp 117, 1 : SetLamp 118, 0 : SetLamp 119, 0 : SetLamp 120, 0
  362. Case 8:
  363. SetLamp 111, 0: SetLamp 112, 0: SetLamp 113, 0 : SetLamp 114, 0 : SetLamp 115, 0 : SetLamp 116, 0 : SetLamp 117, 0 : SetLamp 118, 1 : SetLamp 119, 0 : SetLamp 120, 0
  364. Case 9:
  365. SetLamp 111, 0: SetLamp 112, 0: SetLamp 113, 0 : SetLamp 114, 0 : SetLamp 115, 0 : SetLamp 116, 0 : SetLamp 117, 0 : SetLamp 118, 0 : SetLamp 119, 1 : SetLamp 120, 0
  366. Case 10:
  367. SetLamp 111, 0: SetLamp 112, 0: SetLamp 113, 0 : SetLamp 114, 0 : SetLamp 115, 0 : SetLamp 116, 0 : SetLamp 117, 0 : SetLamp 118, 0 : SetLamp 119, 0 : SetLamp 120, 1
  368. End Select
  369. End Sub
  370.  
  371. '***************************************************
  372. ' JP's VP10 Fading Lamps & Flashers
  373. ' Based on PD's Fading Light System
  374. ' SetLamp 0 is Off
  375. ' SetLamp 1 is On
  376. ' fading for non opacity objects is 4 steps
  377. '***************************************************
  378.  
  379. Dim LampState(200), FadingLevel(200)
  380. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  381.  
  382. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  383. LampTimer.Interval = 5 'lamp fading speed
  384. LampTimer.Enabled = 1
  385.  
  386. ' Lamp & Flasher Timers
  387.  
  388. Sub LampTimer_Timer()
  389. Dim chgLamp, num, chg, ii
  390. chgLamp = Controller.ChangedLamps
  391. If Not IsEmpty(chgLamp) Then
  392. For ii = 0 To UBound(chgLamp)
  393. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  394. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  395.  
  396. 'Special Handling
  397. If chgLamp(ii,0) = 2 Then MotorChooper chgLamp(ii,1)
  398. If chgLamp(ii,0) = 4 Then PFGI chgLamp(ii,1)
  399. If (chgLamp(ii,0) = 12 And chgLamp(ii,1) = 1) Then TLB.Hit 1
  400. If (chgLamp(ii,0) = 13 And chgLamp(ii,1) = 1) Then TRB.Hit 1
  401. If (chgLamp(ii,0) = 14 And chgLamp(ii,1) = 1) Then BLB.Hit 1
  402. If (chgLamp(ii,0) = 15 And chgLamp(ii,1) = 1) Then BRB.Hit 1
  403. If chgLamp(ii,0) = 16 Then Ramp_Move chgLamp(ii,1)
  404.  
  405. Next
  406. End If
  407. UpdateLamps
  408. End Sub
  409.  
  410.  
  411.  
  412. Sub UpdateLamps
  413. 'NFadeL 0, l0 'Game Over Relay
  414. 'NFadeL 1, l1 'Tilt Relay
  415. 'NFadeL 2, Light2 'Chopper Motor Relay
  416. NFadeL 3, l3
  417. 'NFadeL 4, Light4 'GI Relay
  418. NFadeL 5, l5
  419. NFadeL 6, l6
  420. NFadeL 7, l7
  421. NFadeL 8, l8
  422. NFadeL 9, l9
  423. NFadeL 10, l10
  424. NFadeL 11, l11
  425. ' NFadeL 12, l12 'Drop Target hit when lit
  426. ' NFadeL 13, l13 'Drop Target hit when lit
  427. ' NFadeL 14, l14 'Drop Target hit when lit
  428. ' NFadeL 15, l15 'Drop Target hit when lit
  429. ' NFadeL 16, l16 'Drop Target hit when lit
  430. NFadeL 17, l17
  431. NFadeLm 18, l18a 'Custom light for Chopper
  432. NFadeL 18, l18
  433. NFadeL 19, l19
  434. NFadeL 20, l20
  435. NFadeL 21, l21
  436. NFadeL 22, l22
  437. NFadeL 23, l23
  438. NFadeL 24, l24
  439. NFadeL 25, l25
  440. NFadeL 26, l26
  441. NFadeL 27, l27
  442. NFadeL 28, l28
  443. NFadeL 29, l29
  444. NFadeL 30, l30
  445. NFadeL 31, l31
  446. NFadeL 32, l32
  447. NFadeL 33, l33
  448. NFadeL 34, l34
  449. NFadeL 35, l35
  450. NFadeL 36, l36
  451. NFadeL 37, l37
  452. NFadeL 38, l38
  453. NFadeL 39, l39
  454. NFadeL 40, l40
  455. NFadeL 41, l41
  456. NFadeL 42, l42
  457. NFadeL 43, l43
  458. NFadeL 44, l44
  459. NFadeL 45, l45
  460. NFadeL 46, l46
  461. NFadeL 47, l47
  462. NFadeL 51, l51
  463.  
  464. 'Solenoid Controlled Flashers
  465. NFadeLm 94, f94
  466. NFadeL 97, f94a
  467.  
  468. ' Aux lights
  469. NFadeL 101, AM1
  470. NFadeL 102, AM2
  471. NFadeL 103, AM3
  472. NFadeL 104, AM4
  473. NFadeL 105, AM5
  474. NFadeL 106, AM6
  475. NFadeL 107, AM7
  476. NFadeL 108, AM8
  477. NFadeL 109, AM9
  478. NFadeL 110, AM10
  479.  
  480. NFadeL 111, AL1
  481. NFadeL 112, AL2
  482. NFadeL 113, AL3
  483. NFadeL 114, AL4
  484. NFadeL 115, AL5
  485. NFadeL 116, AL6
  486. NFadeL 117, AL7
  487. NFadeL 118, AL8
  488. NFadeL 119, AL9
  489. NFadeL 120, AL10
  490. End Sub
  491.  
  492. ' div lamp subs
  493.  
  494. Sub InitLamps()
  495. Dim x
  496. For x = 0 to 200
  497. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  498. FadingLevel(x) = 4 ' used to track the fading state
  499. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  500. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  501. FlashMax(x) = 1 ' the maximum value when on, usually 1
  502. FlashMin(x) = 0 ' the minimum value when off, usually 0
  503. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  504. Next
  505. End Sub
  506.  
  507. Sub AllLampsOff
  508. Dim x
  509. For x = 0 to 200
  510. SetLamp x, 0
  511. Next
  512. End Sub
  513.  
  514. Sub SetLamp(nr, value)
  515. If value <> LampState(nr) Then
  516. LampState(nr) = abs(value)
  517. FadingLevel(nr) = abs(value) + 4
  518. End If
  519. End Sub
  520.  
  521. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  522.  
  523. Sub NFadeL(nr, object)
  524. Select Case FadingLevel(nr)
  525. Case 4:object.state = 0:FadingLevel(nr) = 0
  526. Case 5:object.state = 1:FadingLevel(nr) = 1
  527. End Select
  528. End Sub
  529.  
  530. Sub NFadeLm(nr, object) ' used for multiple lights
  531. Select Case FadingLevel(nr)
  532. Case 4:object.state = 0
  533. Case 5:object.state = 1
  534. End Select
  535. End Sub
  536.  
  537. 'Lights, Ramps & Primitives used as 4 step fading lights
  538. 'a,b,c,d are the images used from on to off
  539.  
  540. Sub FadeObj(nr, object, a, b, c, d)
  541. Select Case FadingLevel(nr)
  542. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  543. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  544. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  545. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  546. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  547. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  548. End Select
  549. End Sub
  550.  
  551. Sub FadeObjm(nr, object, a, b, c, d)
  552. Select Case FadingLevel(nr)
  553. Case 4:object.image = b
  554. Case 5:object.image = a
  555. Case 9:object.image = c
  556. Case 13:object.image = d
  557. End Select
  558. End Sub
  559.  
  560. Sub NFadeObj(nr, object, a, b)
  561. Select Case FadingLevel(nr)
  562. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  563. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  564. End Select
  565. End Sub
  566.  
  567. Sub NFadeObjm(nr, object, a, b)
  568. Select Case FadingLevel(nr)
  569. Case 4:object.image = b
  570. Case 5:object.image = a
  571. End Select
  572. End Sub
  573.  
  574. ' Flasher objects
  575.  
  576. Sub Flash(nr, object)
  577. Select Case FadingLevel(nr)
  578. Case 4 'off
  579. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  580. If FlashLevel(nr) < FlashMin(nr) Then
  581. FlashLevel(nr) = FlashMin(nr)
  582. FadingLevel(nr) = 0 'completely off
  583. End if
  584. Object.IntensityScale = FlashLevel(nr)
  585. Case 5 ' on
  586. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  587. If FlashLevel(nr) > FlashMax(nr) Then
  588. FlashLevel(nr) = FlashMax(nr)
  589. FadingLevel(nr) = 1 'completely on
  590. End if
  591. Object.IntensityScale = FlashLevel(nr)
  592. End Select
  593. End Sub
  594.  
  595. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  596. Object.IntensityScale = FlashLevel(nr)
  597. End Sub
  598.  
  599.  
  600. '**********************************************************************************************************
  601. 'Digital Display
  602. '**********************************************************************************************************
  603. Dim Digits(40)
  604. Digits(0)=Array(a00, a05, a0c, a0d, a08, a01, a06, a0f, a02, a03, a04, a07, a0b, a0a, a09, a0e)
  605. Digits(1)=Array(a10, a15, a1c, a1d, a18, a11, a16, a1f, a12, a13, a14, a17, a1b, a1a, a19, a1e)
  606. Digits(2)=Array(a20, a25, a2c, a2d, a28, a21, a26, a2f, a22, a23, a24, a27, a2b, a2a, a29, a2e)
  607. Digits(3)=Array(a30, a35, a3c, a3d, a38, a31, a36, a3f, a32, a33, a34, a37, a3b, a3a, a39, a3e)
  608. Digits(4)=Array(a40, a45, a4c, a4d, a48, a41, a46, a4f, a42, a43, a44, a47, a4b, a4a, a49, a4e)
  609. Digits(5)=Array(a50, a55, a5c, a5d, a58, a51, a56, a5f, a52, a53, a54, a57, a5b, a5a, a59, a5e)
  610. Digits(6)=Array(a60, a65, a6c, a6d, a68, a61, a66, a6f, a62, a63, a64, a67, a6b, a6a, a69, a6e)
  611. Digits(7)=Array(a70, a75, a7c, a7d, a78, a71, a76, a7f, a72, a73, a74, a77, a7b, a7a, a79, a7e)
  612. Digits(8)=Array(a80, a85, a8c, a8d, a88, a81, a86, a8f, a82, a83, a84, a87, a8b, a8a, a89, a8e)
  613. Digits(9)=Array(a90, a95, a9c, a9d, a98, a91, a96, a9f, a92, a93, a94, a97, a9b, a9a, a99, a9e)
  614. Digits(10)=Array(aa0, aa5, aac, aad, aa8, aa1, aa6, aaf, aa2, aa3, aa4, aa7, aab, aaa, aa9, aae)
  615. Digits(11)=Array(ab0, ab5, abc, abd, ab8, ab1, ab6, abf, ab2, ab3, ab4, ab7, abb, aba, ab9, abe)
  616. Digits(12)=Array(ac0, ac5, acc, acd, ac8, ac1, ac6, acf, ac2, ac3, ac4, ac7, acb, aca, ac9, ace)
  617. Digits(13)=Array(ad0, ad5, adc, add, ad8, ad1, ad6, adf, ad2, ad3, ad4, ad7, adb, ada, ad9, ade)
  618. Digits(14)=Array(ae0, ae5, aec, aed, ae8, ae1, ae6, aef, ae2, ae3, ae4, ae7, aeb, aea, ae9, aee)
  619. Digits(15)=Array(af0, af5, afc, afd, af8, af1, af6, aff, af2, af3, af4, af7, afb, afa, af9, afe)
  620. Digits(16)=Array(b00, b05, b0c, b0d, b08, b01, b06, b0f, b02, b03, b04, b07, b0b, b0a, b09, b0e)
  621. Digits(17)=Array(b10, b15, b1c, b1d, b18, b11, b16, b1f, b12, b13, b14, b17, b1b, b1a, b19, b1e)
  622. Digits(18)=Array(b20, b25, b2c, b2d, b28, b21, b26, b2f, b22, b23, b24, b27, b2b, b2a, b29, b2e)
  623. Digits(19)=Array(b30, b35, b3c, b3d, b38, b31, b36, b3f, b32, b33, b34, b37, b3b, b3a, b39, b3e)
  624.  
  625. Digits(20)=Array(b40, b45, b4c, b4d, b48, b41, b46, b4f, b42, b43, b44, b47, b4b, b4a, b49, b4e)
  626. Digits(21)=Array(b50, b55, b5c, b5d, b58, b51, b56, b5f, b52, b53, b54, b57, b5b, b5a, b59, b5e)
  627. Digits(22)=Array(b60, b65, b6c, b6d, b68, b61, b66, b6f, b62, b63, b64, b67, b6b, b6a, b69, b6e)
  628. Digits(23)=Array(b70, b75, b7c, b7d, b78, b71, b76, b7f, b72, b73, b74, b77, b7b, b7a, b79, b7e)
  629. Digits(24)=Array(b80, b85, b8c, b8d, b88, b81, b86, b8f, b82, b83, b84, b87, b8b, b8a, b89, b8e)
  630. Digits(25)=Array(b90, b95, b9c, b9d, b98, b91, b96, b9f, b92, b93, b94, b97, b9b, b9a, b99, b9e)
  631. Digits(26)=Array(ba0, ba5, bac, bad, ba8, ba1, ba6, baf, ba2, ba3, ba4, ba7, bab, baa, ba9, bae)
  632. Digits(27)=Array(bb0, bb5, bbc, bbd, bb8, bb1, bb6, bbf, bb2, bb3, bb4, bb7, bbb, bba, bb9, bbe)
  633. Digits(28)=Array(bc0, bc5, bcc, bcd, bc8, bc1, bc6, bcf, bc2, bc3, bc4, bc7, bcb, bca, bc9, bce)
  634. Digits(29)=Array(bd0, bd5, bdc, bdd, bd8, bd1, bd6, bdf, bd2, bd3, bd4, bd7, bdb, bda, bd9, bde)
  635. Digits(30)=Array(be0, be5, bec, bed, be8, be1, be6, bef, be2, be3, be4, be7, beb, bea, be9, bee)
  636. Digits(31)=Array(bf0, bf5, bfc, bfd, bf8, bf1, bf6, bff, bf2, bf3, bf4, bf7, bfb, bfa, bf9, bfe)
  637. Digits(32)=Array(ac18, ac16, acc1, acd1, ac19, ac17, ac15, acf1, ac11, ac13, ac12, ac14, acb1, aca1, ac10, ace1)
  638. Digits(33)=Array(ad18, ad16, adc1, add1, ad19, ad17, ad15, adf1, ad11, ad13, ad12, ad14, adb1, ada1, ad10, ade1)
  639. Digits(34)=Array(ae18, ae16, aec1, aed1, ae19, ae17, ae15, aef1, ae11, ae13, ae12, ae14, aeb1, aea1, ae10, aee1)
  640. Digits(35)=Array(af18, af16, afc1, afd1, af19, af17, af15, aff1, af11, af13, af12, af14, afb1, afa1, af10, afe1)
  641. Digits(36)=Array(b9, b7, b0c1, b0d1, b100, b8, b6, b0f1, b2, b4, b3, b5, b0b1, b0a1, b1,b0e1)
  642. Digits(37)=Array(b109, b107, b1c1, b1d1, b110, b108, b106, b1f1, b102, b104, b103, b105, b1b1, b1a1, b101,b1e1)
  643. Digits(38)=Array(b119, b117, b2c1, b2d1, b120, b118, b116, b2f1, b112, b114, b113, b115, b2b1, b2a1, b111, b2e1)
  644. Digits(39)=Array(b129, b127, b3c1, b3d1, b130, b128, b126, b3f1, b122, b3b1, b123, b125, b3b1, b3a1, b121, b3e1)
  645.  
  646.  
  647. Sub DisplayTimer_Timer
  648. Dim ChgLED, ii, jj, num, chg, stat, obj, b, x
  649. ChgLED=Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  650. If Not IsEmpty(ChgLED)Then
  651. If DesktopMode = True Then
  652. For ii=0 To UBound(chgLED)
  653. num=chgLED(ii, 0) : chg=chgLED(ii, 1) : stat=chgLED(ii, 2)
  654. if (num < 40) then
  655. For Each obj In Digits(num)
  656. If chg And 1 Then obj.State=stat And 1
  657. chg=chg\2 : stat=stat\2
  658. Next
  659. Else
  660. end if
  661. Next
  662. end if
  663. End If
  664. End Sub
  665. '**********************************************************************************************************
  666. '**********************************************************************************************************
  667.  
  668. 'Gottlieb Raven
  669. 'added by Inkochnito
  670. Sub editDips
  671. Dim vpmDips : Set vpmDips = New cvpmDips
  672. With vpmDips
  673. .AddForm 700,400,"Raven - DIP switches"
  674. .AddFrame 2,4,190,"Maximum credits",49152,Array("8 credits",0,"10 credits",32768,"15 credits",&H00004000,"20 credits",49152)'dip 15&16
  675. .AddFrame 2,80,190,"Coin chute 1 and 2 control",&H00002000,Array("seperate",0,"same",&H00002000)'dip 14
  676. .AddFrame 2,126,190,"Playfield special",&H00200000,Array("replay",0,"extra ball",&H00200000)'dip 22
  677. .AddFrame 2,172,190,"High games to date control",&H00000020,Array("no effect",0,"reset high games 2-5 on power off",&H00000020)'dip 6
  678. .AddFrame 2,218,190,"Enable Snipers on completing",&H40000000,Array("all 6 bottom targets",0,"either 3 left or 3 right bottom targets",&H40000000)'dip 31
  679. .AddFrame 2,264,190,"Sniper special control",&H80000000,Array("special on all 4 Snipers hit",0,"Special on any 3 Sinpers hit",&H80000000)'dip 32
  680. .AddFrame 205,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
  681. .AddFrame 205,80,190,"Balls per game",&H01000000,Array("5 balls",0,"3 balls",&H01000000)'dip 25
  682. .AddFrame 205,126,190,"Replay limit",&H04000000,Array("no limit",0,"one per game",&H04000000)'dip 27
  683. .AddFrame 205,172,190,"Novelty",&H08000000,Array("normal",0,"extra ball and replay scores points",&H08000000)'dip 28
  684. .AddFrame 205,218,190,"Game mode",&H10000000,Array("replay",0,"extra ball",&H10000000)'dip 29
  685. .AddFrame 205,264,190,"3rd coin chute credits control",&H20000000,Array("no effect",0,"add 9",&H20000000)'dip 30
  686. .AddChk 2,316,120,Array("Match feature",&H02000000)'dip 26
  687. .AddChk 205,316,120,Array("Attract sound",&H00000040)'dip 7
  688. .AddLabel 50,335,300,20,"After hitting OK, press F3 to reset game with new settings."
  689. .ViewDips
  690. End With
  691. End Sub
  692. Set vpmShowDips = GetRef("editDips")
  693.  
  694.  
  695. '**********************************************************************************************************
  696. '**********************************************************************************************************
  697. ' Start of VPX functions
  698. '**********************************************************************************************************
  699. '**********************************************************************************************************
  700.  
  701. '**********Sling Shot Animations
  702. ' Rstep and Lstep are the variables that increment the animation
  703. '****************
  704. Dim RStep, Lstep
  705.  
  706. Sub RightSlingShot_Slingshot
  707. VpmTimer.PulseSw 45
  708. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  709. RSling.Visible = 0
  710. RSling1.Visible = 1
  711. sling1.TransZ = -20
  712. RStep = 0
  713. RightSlingShot.TimerEnabled = 1
  714. End Sub
  715.  
  716. Sub RightSlingShot_Timer
  717. Select Case RStep
  718. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  719. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  720. End Select
  721. RStep = RStep + 1
  722. End Sub
  723.  
  724. Sub LeftSlingShot_Slingshot
  725. VpmTimer.PulseSw 45
  726. PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  727. LSling.Visible = 0
  728. LSling1.Visible = 1
  729. sling2.TransZ = -20
  730. LStep = 0
  731. LeftSlingShot.TimerEnabled = 1
  732. End Sub
  733.  
  734. Sub LeftSlingShot_Timer
  735. Select Case LStep
  736. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  737. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  738. End Select
  739. LStep = LStep + 1
  740. End Sub
  741.  
  742.  
  743.  
  744.  
  745. '*********************************************************************
  746. ' Positional Sound Playback Functions
  747. '*********************************************************************
  748.  
  749. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  750. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  751. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  752. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  753. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  754. End Sub
  755.  
  756. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  757. Sub PlaySoundAt(soundname, tableobj)
  758. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  759. End Sub
  760.  
  761. Sub PlaySoundAtBall(soundname)
  762. PlaySoundAt soundname, ActiveBall
  763. End Sub
  764.  
  765.  
  766. '*********************************************************************
  767. ' Supporting Ball & Sound Functions
  768. '*********************************************************************
  769.  
  770. 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
  771. Dim tmp
  772. tmp = tableobj.y * 2 / table1.height-1
  773. If tmp > 0 Then
  774. AudioFade = Csng(tmp ^10)
  775. Else
  776. AudioFade = Csng(-((- tmp) ^10) )
  777. End If
  778. End Function
  779.  
  780. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  781. Dim tmp
  782. tmp = tableobj.x * 2 / table1.width-1
  783. If tmp > 0 Then
  784. AudioPan = Csng(tmp ^10)
  785. Else
  786. AudioPan = Csng(-((- tmp) ^10) )
  787. End If
  788. End Function
  789.  
  790. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  791. Vol = Csng(BallVel(ball) ^2 / 2000)
  792. End Function
  793.  
  794. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  795. Pitch = BallVel(ball) * 20
  796. End Function
  797.  
  798. Function BallVel(ball) 'Calculates the ball speed
  799. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  800. End Function
  801.  
  802. '*****************************************
  803. ' JP's VP10 Rolling Sounds
  804. '*****************************************
  805.  
  806. Const tnob = 5 ' total number of balls
  807. ReDim rolling(tnob)
  808. InitRolling
  809.  
  810. Sub InitRolling
  811. Dim i
  812. For i = 0 to tnob
  813. rolling(i) = False
  814. Next
  815. End Sub
  816.  
  817. Sub RollingTimer_Timer()
  818. Dim BOT, b
  819. BOT = GetBalls
  820.  
  821. ' stop the sound of deleted balls
  822. For b = UBound(BOT) + 1 to tnob
  823. rolling(b) = False
  824. StopSound("fx_ballrolling" & b)
  825. Next
  826.  
  827. ' exit the sub if no balls on the table
  828. If UBound(BOT) = -1 Then Exit Sub
  829.  
  830. ' play the rolling sound for each ball
  831. For b = 0 to UBound(BOT)
  832. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  833. rolling(b) = True
  834. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  835. Else
  836. If rolling(b) = True Then
  837. StopSound("fx_ballrolling" & b)
  838. rolling(b) = False
  839. End If
  840. End If
  841. Next
  842. End Sub
  843.  
  844. '**********************
  845. ' Ball Collision Sound
  846. '**********************
  847.  
  848. Sub OnBallBallCollision(ball1, ball2, velocity)
  849. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  850. End Sub
  851.  
  852.  
  853. '*****************************************
  854. ' ninuzzu's FLIPPER SHADOWS
  855. '*****************************************
  856.  
  857. sub FlipperTimer_Timer()
  858. FlipperLSh.RotZ = LeftFlipper.currentangle
  859. FlipperRSh.RotZ = RightFlipper.currentangle
  860. LFLogo.roty = LeftFlipper.currentangle + 0
  861. RFLogo.roty = RightFlipper.currentangle + 0
  862. End Sub
  863.  
  864. '*****************************************
  865. ' ninuzzu's BALL SHADOW
  866. '*****************************************
  867. Dim BallShadow
  868. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  869.  
  870. Sub BallShadowUpdate_timer()
  871. Dim BOT, b
  872. BOT = GetBalls
  873. ' hide shadow of deleted balls
  874. If UBound(BOT)<(tnob-1) Then
  875. For b = (UBound(BOT) + 1) to (tnob-1)
  876. BallShadow(b).visible = 0
  877. Next
  878. End If
  879. ' exit the Sub if no balls on the table
  880. If UBound(BOT) = -1 Then Exit Sub
  881. ' render the shadow for each ball
  882. For b = 0 to UBound(BOT)
  883. If BOT(b).X < Table1.Width/2 Then
  884. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  885. Else
  886. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  887. End If
  888. ballShadow(b).Y = BOT(b).Y + 12
  889. If BOT(b).Z > 20 Then
  890. BallShadow(b).visible = 1
  891. Else
  892. BallShadow(b).visible = 0
  893. End If
  894. Next
  895. End Sub
  896.  
  897.  
  898.  
  899. '************************************
  900. ' What you need to add to your table
  901. '************************************
  902.  
  903. ' a timer called RollingTimer. With a fast interval, like 10
  904. ' one collision sound, in this script is called fx_collide
  905. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  906. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  907.  
  908.  
  909. '******************************************
  910. ' Explanation of the rolling sound routine
  911. '******************************************
  912.  
  913. ' sounds are played based on the ball speed and position
  914.  
  915. ' the routine checks first for deleted balls and stops the rolling sound.
  916.  
  917. ' The For loop goes through all the balls on the table and checks for the ball speed and
  918. ' if the ball is on the table (height lower than 30) then then it plays the sound
  919. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  920.  
  921. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  922. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  923. ' according to the position of the ball on the table.
  924.  
  925.  
  926. '**************************************
  927. ' Explanation of the collision routine
  928. '**************************************
  929.  
  930. ' The collision is built in VP.
  931. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  932. ' 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
  933. ' depending of the speed of the collision.
  934.  
  935.  
  936. Sub Pins_Hit (idx)
  937. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  938. End Sub
  939.  
  940. Sub Targets_Hit (idx)
  941. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  942. End Sub
  943.  
  944. Sub Metals_Thin_Hit (idx)
  945. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  946. End Sub
  947.  
  948. Sub Metals_Medium_Hit (idx)
  949. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  950. End Sub
  951.  
  952. Sub Metals2_Hit (idx)
  953. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  954. End Sub
  955.  
  956. Sub Gates_Hit (idx)
  957. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  958. End Sub
  959.  
  960. Sub Spinner_Spin
  961. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  962. End Sub
  963.  
  964. Sub Rubbers_Hit(idx)
  965. dim finalspeed
  966. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  967. If finalspeed > 20 then
  968. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  969. End if
  970. If finalspeed >= 6 AND finalspeed <= 20 then
  971. RandomSoundRubber()
  972. End If
  973. End Sub
  974.  
  975. Sub Posts_Hit(idx)
  976. dim finalspeed
  977. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  978. If finalspeed > 16 then
  979. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  980. End if
  981. If finalspeed >= 6 AND finalspeed <= 16 then
  982. RandomSoundRubber()
  983. End If
  984. End Sub
  985.  
  986. Sub RandomSoundRubber()
  987. Select Case Int(Rnd*3)+1
  988. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  989. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  990. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  991. End Select
  992. End Sub
  993.  
  994. Sub LeftFlipper_Collide(parm)
  995. RandomSoundFlipper()
  996. End Sub
  997.  
  998. Sub RightFlipper_Collide(parm)
  999. RandomSoundFlipper()
  1000. End Sub
  1001.  
  1002. Sub RandomSoundFlipper()
  1003. Select Case Int(Rnd*3)+1
  1004. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1005. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1006. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1007. End Select
  1008. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement