Arngrim

hawkman

Jul 2nd, 2017
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.22 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="hawkman",UseSolenoids=1,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
  10.  
  11. LoadVPM "01200100","Taito.VBS",3.1
  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) = "bsTopEject.SolOut" 'Top Kicker
  28. SolCallback(2) = "bsTrough.SolOut"
  29. SolCallback(3) = "bsRightEject.SolOut" 'Right Kicker
  30. SolCallback(5) = "dtL2.SolDropUp" 'Left top 3
  31. SolCallback(6) = "dtL.SolDropUp" 'Left bottom 3
  32. SolCallback(7) = "dtT.SolDropUp" 'Top DT
  33. SolCallback(8) = "dtM.SolDropUp" 'Middle DT
  34. SolCallback(9) = "dtR.SolDropUp" 'Right DT
  35. SolCallback(18) = "vpmNudge.SolGameOn"
  36.  
  37. SolCallback(sLRFlipper) = "SolRFlipper"
  38. SolCallback(sLLFlipper) = "SolLFlipper"
  39.  
  40. Sub SolLFlipper(Enabled)
  41. If Enabled Then
  42. PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd
  43. Else
  44. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart
  45. End If
  46. End Sub
  47.  
  48. Sub SolRFlipper(Enabled)
  49. If Enabled Then
  50. PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd:RightFlipper1.RotateToEnd
  51. Else
  52. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart:RightFlipper1.RotateToStart
  53. End If
  54. End Sub
  55.  
  56. '**********************************************************************************************************
  57.  
  58. 'Solenoid Controlled toys
  59. '**********************************************************************************************************
  60.  
  61. '*****GI Lights On
  62. dim xx
  63. For each xx in GI:xx.State = 1: Next
  64.  
  65. 'Primitive Gate
  66. Sub FlipperTimer_Timer
  67. PrimGate2.Rotz = Gate7.Currentangle
  68. End Sub
  69.  
  70. '**********************************************************************************************************
  71.  
  72. 'Initiate Table
  73. '**********************************************************************************************************
  74. Dim bsTrough, bsRightEject, bsTopEject, dtT, dtL, dtL2, dtM, dtR
  75.  
  76. Sub Table1_Init
  77. vpmInit Me
  78. On Error Resume Next
  79. With Controller
  80. .GameName = cGameName
  81. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  82. .SplashInfoLine = "Taito Hawkman"&chr(13)&"You Suck"
  83. .HandleMechanics=0
  84. .HandleKeyboard=0
  85. .ShowDMDOnly=1
  86. .ShowFrame=0
  87. .ShowTitle=0
  88. .hidden = 1
  89. If Err Then MsgBox Err.Description
  90. End With
  91. On Error Goto 0
  92. Controller.SolMask(0)=0
  93. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  94. Controller.Run
  95. If Err Then MsgBox Err.Description
  96. On Error Goto 0
  97.  
  98. PinMAMETimer.Interval=PinMAMEInterval
  99. PinMAMETimer.Enabled=1
  100.  
  101. vpmNudge.TiltSwitch = 30
  102. vpmNudge.Sensitivity = 5
  103. vpmNudge.Tiltobj = Array(LeftSlingshot,RightSlingshot,Bumper1,Bumper2,Bumper3)
  104.  
  105. ' Trough
  106. Set bsTrough=New cvpmBallStack
  107. bsTrough.InitSw 0,51,41,31,0,0,0,0
  108. bsTrough.InitKick BallRelease,180,3
  109. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  110. bsTrough.Balls=3
  111.  
  112. ' Top Saucer
  113. Set bsTopEject = New cvpmBallStack
  114. bsTopEject.InitSaucer sw1, 1, 275, 13
  115. bsTopEject.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  116.  
  117. ' Right Saucer
  118. Set bsRightEject = New cvpmBallStack
  119. bsRightEject.InitSaucer sw3, 3, 180, 9
  120. bsRightEject.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  121.  
  122. Set dtL=New cvpmDropTarget
  123. dtL.InitDrop Array(sw13,sw23,sw33),Array(13,23,33)
  124. dtL.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  125.  
  126. Set dtL2=New cvpmDropTarget
  127. dtL2.InitDrop Array(sw43,sw53,sw63),Array(43,53,63)
  128. dtL2.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  129.  
  130. Set dtM=New cvpmDropTarget
  131. dtM.InitDrop Array(sw54,sw64,sw74),Array(54,64,74)
  132. dtM.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  133.  
  134. Set dtR=New cvpmDropTarget
  135. dtR.InitDrop Array(sw42,sw52,sw62),Array(42,52,62)
  136. dtR.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  137.  
  138. Set dtT=New cvpmDropTarget
  139. dtT.InitDrop Array(sw2,sw12,sw22),Array(2,12,22)
  140. dtT.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  141.  
  142. End Sub
  143.  
  144. '**********************************************************************************************************
  145. 'Plunger code
  146. '**********************************************************************************************************
  147.  
  148. Sub Table1_KeyDown(ByVal KeyCode)
  149. If KeyDownHandler(keycode) Then Exit Sub
  150. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  151. If keycode = RightFlipperKey Then Controller.Switch(72) = 1
  152. End Sub
  153.  
  154. Sub Table1_KeyUp(ByVal KeyCode)
  155. If KeyUpHandler(keycode) Then Exit Sub
  156. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  157. If keycode = RightFlipperKey Then Controller.Switch(72) = 0
  158. End Sub
  159.  
  160. '**********************************************************************************************************
  161.  
  162. 'Drain hole
  163. Sub Drain_Hit:playsound"drain":bsTrough.addball me:End Sub
  164. Sub sw1_Hit() : bsTopEject.Addball 0 : playsound SoundFX("popper_ball",DOFContactors): End Sub
  165. Sub sw3_Hit() : bsRightEject.Addball 0 : playsound SoundFX("popper_ball",DOFContactors): End Sub
  166.  
  167. 'Stand Up Target
  168. Sub sw61_Hit : vpmTimer.PulseSw(61) : End Sub
  169.  
  170. 'Spinners
  171. Sub sw18_Spin:vpmTimer.PulseSw 32 : playsound"fx_spinner" : End Sub
  172.  
  173. 'Scoring rubber
  174. Sub sw11_Hit(): vpmtimer.pulsesw 11 : playsound"rubber_hit_3" : End Sub
  175. Sub sw11a_Hit(): vpmtimer.pulsesw 11 : playsound"rubber_hit_3" : End Sub
  176.  
  177. 'Wire Triggers
  178. Sub SW25_Hit:Controller.Switch(25)=1 : playsound"rollover" : End Sub
  179. Sub SW25_unHit:Controller.Switch(25)=0:End Sub
  180. Sub SW35_Hit:Controller.Switch(35)=1 : playsound"rollover" : End Sub
  181. Sub SW35_unHit:Controller.Switch(35)=0:End Sub
  182. Sub SW45_Hit:Controller.Switch(45)=1 : playsound"rollover" : End Sub
  183. Sub SW45_unHit:Controller.Switch(45)=0:End Sub
  184.  
  185. Sub SW21_Hit:Controller.Switch(21)=1 : playsound"rollover" : End Sub
  186. Sub SW21_unHit:Controller.Switch(21)=0:End Sub
  187. Sub SW55_Hit:Controller.Switch(55)=1 : playsound"rollover" : End Sub
  188. Sub SW55_unHit:Controller.Switch(55)=0:End Sub
  189. Sub SW65_Hit:Controller.Switch(65)=1 : playsound"rollover" : End Sub
  190. Sub SW65_unHit:Controller.Switch(65)=0:End Sub
  191. Sub SW75_Hit:Controller.Switch(75)=1 : playsound"rollover" : End Sub
  192. Sub SW75_unHit:Controller.Switch(75)=0:End Sub
  193.  
  194. 'Star Triggers
  195. Sub SW4_Hit:Controller.Switch(4)=1 : playsound"rollover" : End Sub
  196. Sub SW4_unHit:Controller.Switch(4)=0:End Sub
  197. Sub SW14_Hit:Controller.Switch(14)=1 : playsound"rollover" : End Sub
  198. Sub SW14_unHit:Controller.Switch(14)=0:End Sub
  199. Sub SW24_Hit:Controller.Switch(24)=1 : playsound"rollover" : End Sub
  200. Sub SW24_unHit:Controller.Switch(24)=0:End Sub
  201. Sub SW34_Hit:Controller.Switch(34)=1 : playsound"rollover" : End Sub
  202. Sub SW34_unHit:Controller.Switch(34)=0:End Sub
  203.  
  204. 'Bumpers
  205. Sub Bumper1_Hit : vpmTimer.PulseSw(44) : playsound SoundFXDOF("fx_bumper1",101,DOFPulse,DOFContactors): End Sub
  206. Sub Bumper2_Hit : vpmTimer.PulseSw(44) : playsound SoundFXDOF("fx_bumper1",102,DOFPulse,DOFContactors): End Sub
  207. Sub Bumper3_Hit : vpmTimer.PulseSw(44) : playsound SoundFXDOF("fx_bumper1",103,DOFPulse,DOFContactors): End Sub
  208.  
  209. 'Drop Targets
  210. Sub sw13_Dropped:dtL.Hit 1:End Sub
  211. Sub sw23_Dropped:dtL.Hit 2:End Sub
  212. Sub sw33_Dropped:dtL.Hit 3:End Sub
  213.  
  214. Sub sw43_Dropped:dtL2.Hit 1:End Sub
  215. Sub sw53_Dropped:dtL2.Hit 2:End Sub
  216. Sub sw63_Dropped:dtL2.Hit 3:End Sub
  217.  
  218. Sub sw54_Dropped:dtM.Hit 1:End Sub
  219. Sub sw64_Dropped:dtM.Hit 2:End Sub
  220. Sub sw74_Dropped:dtM.Hit 3:End Sub
  221.  
  222. Sub sw42_Dropped:dtR.Hit 1:End Sub
  223. Sub sw52_Dropped:dtR.Hit 2:End Sub
  224. Sub sw62_Dropped:dtR.Hit 3:End Sub
  225.  
  226. Sub sw2_Dropped :dtT.Hit 1:End Sub
  227. Sub sw12_Dropped:dtT.Hit 2:End Sub
  228. Sub sw22_Dropped:dtT.Hit 3:End Sub
  229.  
  230.  
  231.  
  232. Set Lights(0)=L0
  233. Set Lights(1)=L1
  234. Set Lights(2)=L2
  235.  
  236. Set Lights(10)=L10
  237. Set Lights(11)=L11
  238. Set Lights(12)=L12
  239.  
  240. Set Lights(20)=L20
  241. Set Lights(21)=L21
  242. Set Lights(22)=L22
  243.  
  244. Set Lights(30)=L30
  245. Set Lights(31)=L31
  246. Set Lights(32)=L32
  247.  
  248. Set Lights(40)=L40
  249. Set Lights(41)=L41
  250. Set Lights(42)=L42
  251.  
  252. Set Lights(50)=L50
  253. Set Lights(51)=L51
  254. Set Lights(52)=L52
  255.  
  256. Set Lights(60)=L60
  257. Set Lights(61)=L61
  258. Set Lights(62)=L62
  259.  
  260. Set Lights(70)=L70
  261. Set Lights(71)=L71
  262. Set Lights(72)=L72
  263.  
  264. Set Lights(79)=L79
  265. Set Lights(80)=L80
  266. Set Lights(81)=L81
  267. Lights(82)=array(L82,L82a)
  268. Set Lights(83)=L83
  269.  
  270. Set Lights(89)=L89
  271. Set Lights(90)=L90
  272. Set Lights(91)=L91
  273. Lights(92)=array(L92,L92a)
  274. Set Lights(93)=L93
  275.  
  276. Set Lights(99)=L99
  277. Set Lights(100)=L100
  278. Set Lights(101)=L101
  279. Set Lights(102)=L102
  280. Set Lights(103)=L103
  281.  
  282. Set Lights(110)=L110
  283. Set Lights(111)=L111
  284. Set Lights(112)=L112
  285. Set Lights(113)=L113
  286.  
  287. Set Lights(119)=L119
  288. Set Lights(120)=L120
  289. Set Lights(121)=L121
  290. Set Lights(122)=L122
  291. Set Lights(123)=L123
  292.  
  293. Set Lights(129)=L129
  294. Set Lights(130)=L130
  295. Set Lights(131)=L131
  296. Set Lights(132)=L132
  297. Set Lights(133)=L133
  298.  
  299. Set Lights(143)=L143
  300. Lights(151)=array(L151a,L151b,L151c,L151d,L151e,L151f,L151g,L151h,L151i) 'Bumpers
  301. Set Lights(153)=L153
  302.  
  303.  
  304. 'BackGlass
  305. 'Set Lights(149)=L149 'Game Over
  306. 'Set Lights(150)=L150 'Tilt
  307. 'Set Lights(152)=L152 'New Record
  308.  
  309. '**********************************************************************************************************
  310. 'Digital Display
  311. '**********************************************************************************************************
  312.  
  313. Dim Digits(28)
  314. ' 1st Player
  315. Digits(0) = Array(LED10,LED11,LED12,LED13,LED14,LED15,LED16)
  316. Digits(1) = Array(LED20,LED21,LED22,LED23,LED24,LED25,LED26)
  317. Digits(2) = Array(LED30,LED31,LED32,LED33,LED34,LED35,LED36)
  318. Digits(3) = Array(LED40,LED41,LED42,LED43,LED44,LED45,LED46)
  319. Digits(4) = Array(LED50,LED51,LED52,LED53,LED54,LED55,LED56)
  320. Digits(5) = Array(LED60,LED61,LED62,LED63,LED64,LED65,LED66)
  321.  
  322. ' 2nd Player
  323. Digits(6) = Array(LED80,LED81,LED82,LED83,LED84,LED85,LED86)
  324. Digits(7) = Array(LED90,LED91,LED92,LED93,LED94,LED95,LED96)
  325. Digits(8) = Array(LED100,LED101,LED102,LED103,LED104,LED105,LED106)
  326. Digits(9) = Array(LED110,LED111,LED112,LED113,LED114,LED115,LED116)
  327. Digits(10) = Array(LED120,LED121,LED122,LED123,LED124,LED125,LED126)
  328. Digits(11) = Array(LED130,LED131,LED132,LED133,LED134,LED135,LED136)
  329.  
  330. ' 3rd Player
  331. Digits(12) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156)
  332. Digits(13) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166)
  333. Digits(14) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176)
  334. Digits(15) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186)
  335. Digits(16) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196)
  336. Digits(17) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206)
  337.  
  338. ' 4th Player
  339. Digits(18) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226)
  340. Digits(19) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236)
  341. Digits(20) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246)
  342. Digits(21) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256)
  343. Digits(22) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266)
  344. Digits(23) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276)
  345.  
  346. ' Credits
  347. Digits(24) = Array(LED4,LED2,LED6,LED7,LED5,LED1,LED3)
  348. Digits(25) = Array(LED18,LED9,LED27,LED28,LED19,LED8,LED17)
  349. ' Balls
  350. Digits(26) = Array(LED39,LED37,LED48,LED49,LED47,LED29,LED38)
  351. Digits(27) = Array(LED67,LED58,LED69,LED77,LED68,LED57,LED59)
  352.  
  353. Sub DisplayTimer_Timer
  354. Dim ChgLED,ii,num,chg,stat,obj
  355. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  356. If Not IsEmpty(ChgLED) Then
  357. If DesktopMode = True Then
  358. For ii = 0 To UBound(chgLED)
  359. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  360. if (num < 28) then
  361. For Each obj In Digits(num)
  362. If chg And 1 Then obj.State = stat And 1
  363. chg = chg\2 : stat = stat\2
  364. Next
  365. else
  366. end if
  367. next
  368. end if
  369. end if
  370. End Sub
  371.  
  372.  
  373. '**********************************************************************************************************
  374. '**********************************************************************************************************
  375.  
  376.  
  377.  
  378.  
  379.  
  380. ' *********************************************************************
  381. ' *********************************************************************
  382.  
  383. 'Start of VPX call back Functions
  384.  
  385. ' *********************************************************************
  386. ' *********************************************************************
  387.  
  388.  
  389. '**********Sling Shot Animations
  390. ' Rstep and Lstep are the variables that increment the animation
  391. '****************
  392. Dim RStep, Lstep
  393.  
  394. Sub RightSlingShot_Slingshot
  395. vpmTimer.PulseSw 71
  396. PlaySound SoundFXDOF("right_slingshot",105,DOFPulse,DOFContactors), 0, 1, 0.05, 0.05
  397. RSling.Visible = 0
  398. RSling1.Visible = 1
  399. sling1.TransZ = -20
  400. RStep = 0
  401. RightSlingShot.TimerEnabled = 1
  402. End Sub
  403.  
  404. Sub RightSlingShot_Timer
  405. Select Case RStep
  406. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  407. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  408. End Select
  409. RStep = RStep + 1
  410. End Sub
  411.  
  412. Sub LeftSlingShot_Slingshot
  413. vpmTimer.PulseSw 71
  414. PlaySound SoundFXDOF("left_slingshot",104,DOFPulse,DOFContactors),0,1,-0.05,0.05
  415. LSling.Visible = 0
  416. LSling1.Visible = 1
  417. sling2.TransZ = -20
  418. LStep = 0
  419. LeftSlingShot.TimerEnabled = 1
  420. End Sub
  421.  
  422. Sub LeftSlingShot_Timer
  423. Select Case LStep
  424. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  425. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  426. End Select
  427. LStep = LStep + 1
  428. End Sub
  429.  
  430.  
  431.  
  432. ' *********************************************************************
  433. ' Supporting Ball & Sound Functions
  434. ' *********************************************************************
  435.  
  436. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  437. Vol = Csng(BallVel(ball) ^2 / 2000)
  438. End Function
  439.  
  440. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  441. Dim tmp
  442. tmp = ball.x * 2 / table1.width-1
  443. If tmp > 0 Then
  444. Pan = Csng(tmp ^10)
  445. Else
  446. Pan = Csng(-((- tmp) ^10) )
  447. End If
  448. End Function
  449.  
  450. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  451. Pitch = BallVel(ball) * 20
  452. End Function
  453.  
  454. Function BallVel(ball) 'Calculates the ball speed
  455. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  456. End Function
  457.  
  458. '*****************************************
  459. ' JP's VP10 Rolling Sounds
  460. '*****************************************
  461.  
  462. Const tnob = 5 ' total number of balls
  463. ReDim rolling(tnob)
  464. InitRolling
  465.  
  466. Sub InitRolling
  467. Dim i
  468. For i = 0 to tnob
  469. rolling(i) = False
  470. Next
  471. End Sub
  472.  
  473. Sub RollingTimer_Timer()
  474. Dim BOT, b
  475. BOT = GetBalls
  476.  
  477. ' stop the sound of deleted balls
  478. For b = UBound(BOT) + 1 to tnob
  479. rolling(b) = False
  480. StopSound("fx_ballrolling" & b)
  481. Next
  482.  
  483. ' exit the sub if no balls on the table
  484. If UBound(BOT) = -1 Then Exit Sub
  485.  
  486. ' play the rolling sound for each ball
  487. For b = 0 to UBound(BOT)
  488. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  489. rolling(b) = True
  490. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  491. Else
  492. If rolling(b) = True Then
  493. StopSound("fx_ballrolling" & b)
  494. rolling(b) = False
  495. End If
  496. End If
  497. Next
  498. End Sub
  499.  
  500. '**********************
  501. ' Ball Collision Sound
  502. '**********************
  503.  
  504. Sub OnBallBallCollision(ball1, ball2, velocity)
  505. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  506. End Sub
  507.  
  508.  
  509.  
  510. '************************************
  511. ' What you need to add to your table
  512. '************************************
  513.  
  514. ' a timer called RollingTimer. With a fast interval, like 10
  515. ' one collision sound, in this script is called fx_collide
  516. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  517. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  518.  
  519.  
  520. '******************************************
  521. ' Explanation of the rolling sound routine
  522. '******************************************
  523.  
  524. ' sounds are played based on the ball speed and position
  525.  
  526. ' the routine checks first for deleted balls and stops the rolling sound.
  527.  
  528. ' The For loop goes through all the balls on the table and checks for the ball speed and
  529. ' if the ball is on the table (height lower than 30) then then it plays the sound
  530. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  531.  
  532. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  533. ' will change according to the ball speed, and the PAN function will change the stereo position according
  534. ' to the position of the ball on the table.
  535.  
  536.  
  537. '**************************************
  538. ' Explanation of the collision routine
  539. '**************************************
  540.  
  541. ' The collision is built in VP.
  542. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  543. ' 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
  544. ' depending of the speed of the collision.
  545.  
  546.  
  547. Sub Pins_Hit (idx)
  548. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  549. End Sub
  550.  
  551. Sub Targets_Hit (idx)
  552. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  553. End Sub
  554.  
  555. Sub Metals_Thin_Hit (idx)
  556. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  557. End Sub
  558.  
  559. Sub Metals_Medium_Hit (idx)
  560. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  561. End Sub
  562.  
  563. Sub Metals2_Hit (idx)
  564. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  565. End Sub
  566.  
  567. Sub Gates_Hit (idx)
  568. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  569. End Sub
  570.  
  571. Sub Spinner_Spin
  572. PlaySound "fx_spinner",0,.25,0,0.25
  573. End Sub
  574.  
  575. Sub Rubbers_Hit(idx)
  576. dim finalspeed
  577. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  578. If finalspeed > 20 then
  579. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  580. End if
  581. If finalspeed >= 6 AND finalspeed <= 20 then
  582. RandomSoundRubber()
  583. End If
  584. End Sub
  585.  
  586. Sub Posts_Hit(idx)
  587. dim finalspeed
  588. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  589. If finalspeed > 16 then
  590. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  591. End if
  592. If finalspeed >= 6 AND finalspeed <= 16 then
  593. RandomSoundRubber()
  594. End If
  595. End Sub
  596.  
  597. Sub RandomSoundRubber()
  598. Select Case Int(Rnd*3)+1
  599. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  600. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  601. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  602. End Select
  603. End Sub
  604.  
  605. Sub LeftFlipper_Collide(parm)
  606. RandomSoundFlipper()
  607. End Sub
  608.  
  609. Sub RightFlipper_Collide(parm)
  610. RandomSoundFlipper()
  611. End Sub
  612.  
  613. Sub RandomSoundFlipper()
  614. Select Case Int(Rnd*3)+1
  615. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  616. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  617. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  618. End Select
  619. End Sub
Advertisement
Add Comment
Please, Sign In to add comment