Advertisement
Arngrim

Count Down DOF

Dec 9th, 2016
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.73 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="countdwn",UseSolenoids=1,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="fx_Flipperup",SFlipperOff="fx_Flipperdown"
  10. Const SCoin="coin",cCredits=""
  11.  
  12. LoadVPM "01001100", "gts1.vbs", 3.02
  13. Dim DesktopMode: DesktopMode = Table1.ShowDT
  14.  
  15. 'Solenoid Call backs
  16. '**********************************************************************************************************
  17. SolCallback(1)="bsTrough.SolOut"
  18. SolCallback(2)="VpmSolSound SoundFX(""knock"",DOFKnocker),"
  19. SolCallback(3)="VpmSolSound SoundFX(""10"",DOFChimes),"
  20. SolCallback(4)="VpmSolSound SoundFX(""100"",DOFChimes),"
  21. SolCallback(5)="VpmSolSound SoundFX(""1000"",DOFChimes),"
  22. SolCallback(6)="bsSaucer1.SolOut"
  23. SolCallback(7)="dtGDrop.SolDropUp" 'Green Drop Target Reset
  24. SolCallback(8)="dtRDrop.SolDropUp" 'Red Drop Target Reset
  25. 'SolCallback(sLLFlipper)="vpmSolFlipper LeftFlipper,LeftFlipper1,"
  26. 'SolCallback(sLRFlipper)="vpmSolFlipper RightFlipper,RightFlipper1,"
  27. '**********************************************************************************************************
  28.  
  29. SolCallback(sLRFlipper) = "SolRFlipper"
  30. SolCallback(sLLFlipper) = "SolLFlipper"
  31.  
  32. Sub SolLFlipper(Enabled)
  33. If Enabled Then
  34. PlaySound SoundFX("FlipperUp",DOFFlippers):LeftFlipper.RotateToEnd:LeftFlipper1.RotateToEnd
  35. Else
  36. PlaySound SoundFX("FlipperDown",DOFFlippers):LeftFlipper.RotateToStart:LeftFlipper1.RotateToStart
  37. End If
  38. End Sub
  39.  
  40. Sub SolRFlipper(Enabled)
  41. If Enabled Then
  42. PlaySound SoundFX("FlipperUp",DOFFlippers):RightFlipper.RotateToEnd:RightFlipper1.RotateToEnd
  43. Else
  44. PlaySound SoundFX("FlipperDown",DOFFlippers):RightFlipper.RotateToStart:RightFlipper1.RotateToStart
  45. End If
  46. End Sub
  47.  
  48.  
  49. 'Primitive Flipper
  50. '**********************************************************************************************************
  51. sub flippertimer_timer()
  52. LFlip.RotY = LeftFlipper.CurrentAngle
  53. RFlip.RotY = RightFlipper.CurrentAngle
  54. LFlip1.ObjRotZ = LeftFlipper1.CurrentAngle-90
  55. RFlip1.ObjRotZ = RightFlipper1.CurrentAngle+90
  56. end sub
  57.  
  58. '**********************************************************************************************************
  59.  
  60. 'Initiate Table
  61. '**********************************************************************************************************
  62. Dim bsTrough,dtRDrop,dtGDrop,dtYDrop,dtBDrop,bsSaucer1
  63.  
  64. Sub Table1_Init
  65. vpmInit Me
  66. On Error Resume Next
  67. With Controller
  68. .GameName = cGameName
  69. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  70. .SplashInfoLine = "Countdown (Gottlieb)"&chr(13)&"You Suck"
  71. .HandleMechanics=0
  72. .HandleKeyboard=0
  73. .ShowDMDOnly=1
  74. .ShowFrame=0
  75. .ShowTitle=0
  76. .Hidden = 1
  77. If Err Then MsgBox Err.Description
  78. End With
  79. On Error Goto 0
  80. Controller.SolMask(0)=0
  81. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  82. Controller.Run
  83. If Err Then MsgBox Err.Description
  84. On Error Goto 0
  85.  
  86. PinMAMETimer.Interval=PinMAMEInterval
  87. PinMAMETimer.Enabled=1
  88.  
  89. vpmNudge.TiltSwitch = 4
  90. vpmNudge.Sensitivity = 5
  91. vpmNudge.TiltObj = Array(Bumper1,RightSlingshot,LeftSlingshot)
  92.  
  93. Set bsTrough = New cvpmBallStack
  94. bsTrough.initnotrough BallExit, 66, 55, 6
  95. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors),SoundFX("solenoid",DOFContactors)
  96.  
  97. Set bsSaucer1=New cvpmBallstack
  98. bsSaucer1.InitSaucer TopHole,41,235,6
  99. bsSaucer1.InitExitSnd SoundFX("Popper",DOFContactors),SoundFX("Solenoid",DOFContactors)
  100.  
  101. Set dtRDrop=New cvpmDropTarget'
  102. dtRDrop.InitDrop Array(sw20,sw21,sw23,sw24),Array(20,21,23,24)
  103. dtRDrop.InitSnd SoundFX("DTDrop",DOFDropTargets), SoundFX("DTReset",DOFContactors)
  104.  
  105. Set dtGDrop=New cvpmDropTarget'
  106. dtGDrop.InitDrop Array(sw30,sw31,sw33,sw34),Array(30,31,33,34)
  107. dtGDrop.InitSnd SoundFX("DTDrop",DOFDropTargets), SoundFX("DTReset",DOFContactors)
  108.  
  109. Set dtYDrop=New cvpmDropTarget'
  110. dtYDrop.InitDrop Array(sw60,sw61,sw63,sw64),Array(60,61,63,64)
  111. dtYDrop.InitSnd SoundFX("DTDrop",DOFDropTargets), SoundFX("DTReset",DOFContactors)
  112.  
  113. Set dtBDrop=New cvpmDropTarget'
  114. dtBDrop.InitDrop Array(sw70,sw71,sw73,sw74),Array(70,71,73,74)
  115. dtBDrop.InitSnd SoundFX("DTDrop",DOFDropTargets), SoundFX("DTReset",DOFContactors)
  116. End Sub
  117.  
  118.  
  119. 'Plunger code
  120. '**********************************************************************************************************
  121. Sub Table1_KeyDown(ByVal keycode)
  122. If vpmKeyDown(KeyCode) Then Exit Sub
  123. If keycode=PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  124. End Sub
  125.  
  126. Sub Table1_KeyUp(ByVal keycode)
  127. If vpmKeyUp(KeyCode) Then Exit Sub
  128. If keycode=PlungerKey Then Plunger.Fire:playsound"plunger"
  129. End Sub
  130. '**********************************************************************************************************
  131.  
  132. 'table switches and triggers
  133. '**********************************************************************************************************
  134.  
  135. Sub Drain_Hit:playsound"drain":bsTrough.addball me:End Sub
  136. Sub TopHole_Hit():bsSaucer1.Addball 0:End Sub
  137.  
  138. 'Bumpers
  139. Sub Bumper1_Hit:vpmTimer.PulseSw 11 : playsound SoundFXDOF("fx_bumper1",104,DOFPulse,DOFContactors)
  140. : B1L1.State = 1:B1L2. State = 1 : Me.TimerEnabled = 1 : End Sub
  141. Sub Bumper1_Timer : B1L1.State = 0:B1L2. State = 0 : Me.Timerenabled = 0 : End Sub
  142.  
  143. 'Upper Wire Triggers
  144. Sub sw43_Hit():Controller.Switch(43)=1 : playsound"rollover": End Sub
  145. Sub sw43_UnHit:Controller.Switch(43)=0:End Sub
  146. Sub sw44_Hit():Controller.Switch(44)=1 : playsound"rollover": End Sub
  147. Sub sw44_UnHit:Controller.Switch(44)=0:End Sub
  148.  
  149. 'Star Triggers
  150. Sub sw40_Hit():Controller.Switch(40)=1 : playsound"rollover": End Sub
  151. Sub sw40_UnHit:Controller.Switch(40)=0:End Sub
  152. Sub sw50_Hit():Controller.Switch(50)=1 : playsound"rollover": End Sub
  153. Sub sw50_UnHit:Controller.Switch(50)=0:End Sub
  154.  
  155. 'Drop Targets
  156. Sub Sw20_Hit: dtRDrop.Hit 1: End Sub
  157. Sub Sw21_Hit: dtRDrop.Hit 2: End Sub
  158. Sub Sw23_Hit: dtRDrop.Hit 3: End Sub
  159. Sub Sw24_Hit: dtRDrop.Hit 4: End Sub
  160.  
  161. Sub Sw30_Hit: dtGDrop.Hit 1: End Sub
  162. Sub Sw31_Hit: dtGDrop.Hit 2: End Sub
  163. Sub Sw33_Hit: dtGDrop.Hit 3: End Sub
  164. Sub Sw34_Hit: dtGDrop.Hit 4: End Sub
  165.  
  166. Sub Sw60_Hit: dtYDrop.Hit 1: End Sub
  167. Sub Sw61_Hit: dtYDrop.Hit 2: End Sub
  168. Sub Sw63_Hit: dtYDrop.Hit 3: End Sub
  169. Sub Sw64_Hit: dtYDrop.Hit 4: End Sub
  170.  
  171. Sub Sw70_Hit: dtBDrop.Hit 1: End Sub
  172. Sub Sw71_Hit: dtBDrop.Hit 2: End Sub
  173. Sub Sw73_Hit: dtBDrop.Hit 3: End Sub
  174. Sub Sw74_Hit: dtBDrop.Hit 4: End Sub
  175.  
  176.  
  177. 'Non Primitive Slingshots
  178. Sub sw53_1_Slingshot():vpmtimer.pulsesw 53: playsound"slingshot": End Sub
  179. Sub sw53_2_Slingshot():vpmtimer.pulsesw 53: playsound"slingshot": End Sub
  180. Sub sw53_3_Slingshot():vpmtimer.pulsesw 53: playsound"slingshot": End Sub
  181. Sub sw53_4_Slingshot():vpmtimer.pulsesw 53: playsound"slingshot": End Sub
  182. Sub sw53_5_Slingshot():vpmtimer.pulsesw 53: playsound"slingshot": End Sub
  183. Sub sw53_6_Slingshot():vpmtimer.pulsesw 53: playsound"slingshot": End Sub
  184. Sub sw53_7_Slingshot():vpmtimer.pulsesw 53: playsound"slingshot": End Sub
  185. Sub sw53_8_Slingshot():vpmtimer.pulsesw 53: playsound"slingshot": End Sub
  186.  
  187. 'Lower trigger Wires
  188. Sub sw10_Hit():Controller.Switch(10)=1 : playsound"rollover": End Sub
  189. Sub sw10_UnHit():Controller.Switch(10)=0:End Sub
  190. Sub sw11_Hit():Controller.Switch(11)=1 : playsound"rollover":DOF 103, DOFOn:End Sub
  191. Sub sw11_UnHit():Controller.Switch(11)=0:DOF 103, DOFOff:End Sub
  192. Sub sw13_Hit():Controller.Switch(13)=1 : playsound"rollover": End Sub
  193. Sub sw13_UnHit():Controller.Switch(13)=0:End Sub
  194. Sub sw14_Hit():Controller.Switch(14)=1 : playsound"rollover": End Sub
  195. Sub sw14_UnHit():Controller.Switch(14)=0:End Sub
  196. '**********************************************************************************************************
  197.  
  198. 'Map lights to an array
  199. '**********************************************************************************************************
  200. 'Set Lights(1)=L1
  201. 'Set Lights(2)=L2
  202. 'Set Lights(3)=L3
  203. Set Lights(4)=L4
  204. Set Lights(5)=L5
  205. Set Lights(6)=L6
  206. Set Lights(7)=L7
  207. Set Lights(8)=L8
  208. Set Lights(9)=L9
  209. Set Lights(10)=L10
  210. Set Lights(11)=L11
  211. Set Lights(12)=L12
  212. Set Lights(13)=L13
  213. Set Lights(14)=L14
  214. Set Lights(15)=L15
  215. Set Lights(16)=L16
  216. Set Lights(17)=L17
  217. Set Lights(18)=L18
  218. Set Lights(19)=L19
  219. Set Lights(20)=L20
  220. Set Lights(21)=L21
  221. Set Lights(22)=L22
  222. Set Lights(23)=L23
  223. Set Lights(24)=L24
  224. Set Lights(25)=L25
  225. Set Lights(26)=L26
  226. Set Lights(27)=L27
  227. Set Lights(28)=L28
  228. Set Lights(29)=L29
  229. Set Lights(30)=L30
  230. Set Lights(31)=L31
  231. Set Lights(32)=L32
  232. Set Lights(33)=L33
  233. 'Set Lights(34)= 'Not used
  234. Set Lights(35)=L35
  235. Set Lights(36)=L36
  236. '**********************************************************************************************************
  237.  
  238. 'Drop Targets reset by lamps
  239.  
  240. Dim N1,O1,N2,O2
  241. N1=0:O1=0:N2=0:O2=0
  242.  
  243. Set LampCallback=GetRef("UpdateMultipleLamps")
  244. Sub UpdateMultipleLamps
  245. N1=Controller.Lamp(17) 'Yellow Drop Target Reset
  246. N2=Controller.Lamp(18) 'Blue Drop Target Reset
  247. If N1<>O1 Then
  248. If N1 Then
  249. dtYDrop.DropSol_On
  250. End If
  251. O1=N1
  252. End If
  253. If N2<>O2 Then
  254. If N2 Then
  255. dtBDrop.DropSol_On
  256. End If
  257. O2=N2
  258. End If
  259. End Sub
  260.  
  261.  
  262. '**********************************************************************************************************
  263. '**********************************************************************************************************
  264.  
  265. Dim Digits(32)
  266. Digits(0)=Array(a00,a01,a02,a03,a04,a05,a06,n,a08)
  267. Digits(1)=Array(a10,a11,a12,a13,a14,a15,a16,n,a18)
  268. Digits(2)=Array(a20,a21,a22,a23,a24,a25,a26,n,a28)
  269. Digits(3)=Array(a30,a31,a32,a33,a34,a35,a36,n,a38)
  270. Digits(4)=Array(a40,a41,a42,a43,a44,a45,a46,n,a48)
  271. Digits(5)=Array(a50,a51,a52,a53,a54,a55,a56,n,a58)
  272. Digits(6)=Array(b00,b01,b02,b03,b04,b05,b06,n,b08)
  273. Digits(7)=Array(b10,b11,b12,b13,b14,b15,b16,n,b18)
  274. Digits(8)=Array(b20,b21,b22,b23,b24,b25,b26,n,b28)
  275. Digits(9)=Array(b30,b31,b32,b33,b34,b35,b36,n,b38)
  276. Digits(10)=Array(b40,b41,b42,b43,b44,b45,b46,n,b48)
  277. Digits(11)=Array(b50,b51,b52,b53,b54,b55,b56,n,b58)
  278. Digits(12)=Array(c00,c01,c02,c03,c04,c05,c06,n,c08)
  279. Digits(13)=Array(c10,c11,c12,c13,c14,c15,c16,n,c18)
  280. Digits(14)=Array(c20,c21,c22,c23,c24,c25,c26,n,c28)
  281. Digits(15)=Array(c30,c31,c32,c33,c34,c35,c36,n,c38)
  282. Digits(16)=Array(c40,c41,c42,c43,c44,c45,c46,n,c48)
  283. Digits(17)=Array(c50,c51,c52,c53,c54,c55,c56,n,c58)
  284. Digits(18)=Array(d00,d01,d02,d03,d04,d05,d06,n,d08)
  285. Digits(19)=Array(d10,d11,d12,d13,d14,d15,d16,n,d18)
  286. Digits(20)=Array(d20,d21,d22,d23,d24,d25,d26,n,d28)
  287. Digits(21)=Array(d30,d31,d32,d33,d34,d35,d36,n,d38)
  288. Digits(22)=Array(d40,d41,d42,d43,d44,d45,d46,n,d48)
  289. Digits(23)=Array(d50,d51,d52,d53,d54,d55,d56,n,d58)
  290. Digits(26)=Array(e00,e01,e02,e03,e04,e05,e06,n,e08)
  291. Digits(27)=Array(e10,e11,e12,e13,e14,e15,e16,n,e18)
  292. Digits(24)=Array(f00,f01,f02,f03,f04,f05,f06,n,f08)
  293. Digits(25)=Array(f10,f11,f12,f13,f14,f15,f16,n,f18)
  294.  
  295.  
  296.  
  297. Sub DisplayTimer_Timer
  298. Dim ChgLED,ii,num,chg,stat,obj
  299. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  300. If Not IsEmpty(ChgLED) Then
  301. If DesktopMode = True Then
  302. For ii = 0 To UBound(chgLED)
  303. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  304. if (num < 32) then
  305. For Each obj In Digits(num)
  306. If chg And 1 Then obj.State = stat And 1
  307. chg = chg\2 : stat = stat\2
  308. Next
  309. else
  310. 'if char(stat) > "" then msg(num) = char(stat)
  311. end if
  312. next
  313. end if
  314. end if
  315. End Sub
  316.  
  317.  
  318.  
  319. '**********************************************************************************************************
  320. 'Gottlieb System 1
  321. 'added by Inkochnito
  322. Sub editDips
  323. Dim vpmDips : Set vpmDips = New cvpmDips
  324. With vpmDips
  325. .AddForm 700,400,"System 1 - DIP switches"
  326. .AddFrame 205,0,190,"Maximum credits",&H00030000,Array("5 credits",0,"8 credits",&H00020000,"10 credits",&H00010000,"15 credits",&H00030000)'dip 17&18
  327. .AddFrame 0,0,190,"Coin chute control",&H00040000,Array("seperate",0,"same",&H00040000)'dip 19
  328. .AddFrame 0,46,190,"Game mode",&H00000400,Array("extra ball",0,"replay",&H00000400)'dip 11
  329. .AddFrame 0,92,190,"High game to date awards",&H00200000,Array("no award",0,"3 replays",&H00200000)'dip 22
  330. .AddFrame 0,138,190,"Balls per game",&H00000100,Array("5 balls",0,"3 balls",&H00000100)'dip 9
  331. .AddFrame 0,184,190,"Tilt effect",&H00000800,Array("game over",0,"ball in play only",&H00000800)'dip 12
  332. .AddChk 205,80,190,Array("Match feature",&H00000200)'dip 10
  333. .AddChk 205,95,190,Array("Credits displayed",&H00001000)'dip 13
  334. .AddChk 205,110,190,Array("Play credit button tune",&H00002000)'dip 14
  335. .AddChk 205,125,190,Array("Play tones when scoring",&H00080000)'dip 20
  336. .AddChk 205,140,190,Array("Play coin switch tune",&H00400000)'dip 23
  337. .AddChk 205,155,190,Array("High game to date displayed",&H00100000)'dip 21
  338. .AddLabel 50,240,300,20,"After hitting OK, press F3 to reset game with new settings."
  339. .ViewDips
  340. End With
  341. End Sub
  342. Set vpmShowDips = GetRef("editDips")
  343.  
  344.  
  345. '****************************************************************************
  346. '**********************************************************************************************************
  347. '**********************************************************************************************************
  348.  
  349. '*****GI Lights On
  350. dim xx
  351.  
  352. For each xx in GI:xx.State = 1: Next
  353.  
  354. '**********Sling Shot Animations
  355. ' Rstep and Lstep are the variables that increment the animation
  356. '****************
  357. Dim RStep, Lstep
  358.  
  359. Sub RightSlingShot_Slingshot
  360. vpmtimer.pulsesw 53
  361. PlaySound SoundFXDOF("right_slingshot",102,DOFPulse,DOFContactors), 0, 1, 0.05, 0.05
  362. RSling.Visible = 0
  363. RSling1.Visible = 1
  364. sling1.TransZ = -20
  365. RStep = 0
  366. RightSlingShot.TimerEnabled = 1
  367. End Sub
  368.  
  369. Sub RightSlingShot_Timer
  370. Select Case RStep
  371. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  372. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  373. End Select
  374. RStep = RStep + 1
  375. End Sub
  376.  
  377. Sub LeftSlingShot_Slingshot
  378. vpmtimer.pulsesw 53
  379. PlaySound SoundFXDOF("left_slingshot",101,DOFPulse,DOFContactors),0,1,-0.05,0.05
  380. LSling.Visible = 0
  381. LSling1.Visible = 1
  382. sling2.TransZ = -20
  383. LStep = 0
  384. LeftSlingShot.TimerEnabled = 1
  385. End Sub
  386.  
  387. Sub LeftSlingShot_Timer
  388. Select Case LStep
  389. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  390. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  391. End Select
  392. LStep = LStep + 1
  393. End Sub
  394.  
  395.  
  396.  
  397. ' *********************************************************************
  398. ' Supporting Ball & Sound Functions
  399. ' *********************************************************************
  400.  
  401. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  402. Vol = Csng(BallVel(ball) ^2 / 2000)
  403. End Function
  404.  
  405. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  406. Dim tmp
  407. tmp = ball.x * 2 / table1.width-1
  408. If tmp > 0 Then
  409. Pan = Csng(tmp ^10)
  410. Else
  411. Pan = Csng(-((- tmp) ^10) )
  412. End If
  413. End Function
  414.  
  415. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  416. Pitch = BallVel(ball) * 20
  417. End Function
  418.  
  419. Function BallVel(ball) 'Calculates the ball speed
  420. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  421. End Function
  422.  
  423. '*****************************************
  424. ' JP's VP10 Rolling Sounds
  425. '*****************************************
  426.  
  427. Const tnob = 5 ' total number of balls
  428. ReDim rolling(tnob)
  429. InitRolling
  430.  
  431. Sub InitRolling
  432. Dim i
  433. For i = 0 to tnob
  434. rolling(i) = False
  435. Next
  436. End Sub
  437.  
  438. Sub RollingTimer_Timer()
  439. Dim BOT, b
  440. BOT = GetBalls
  441.  
  442. ' stop the sound of deleted balls
  443. For b = UBound(BOT) + 1 to tnob
  444. rolling(b) = False
  445. StopSound("fx_ballrolling" & b)
  446. Next
  447.  
  448. ' exit the sub if no balls on the table
  449. If UBound(BOT) = -1 Then Exit Sub
  450.  
  451. ' play the rolling sound for each ball
  452. For b = 0 to UBound(BOT)
  453. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  454. rolling(b) = True
  455. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  456. Else
  457. If rolling(b) = True Then
  458. StopSound("fx_ballrolling" & b)
  459. rolling(b) = False
  460. End If
  461. End If
  462. Next
  463. End Sub
  464.  
  465. '**********************
  466. ' Ball Collision Sound
  467. '**********************
  468.  
  469. Sub OnBallBallCollision(ball1, ball2, velocity)
  470. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  471. End Sub
  472.  
  473.  
  474.  
  475. '************************************
  476. ' What you need to add to your table
  477. '************************************
  478.  
  479. ' a timer called RollingTimer. With a fast interval, like 10
  480. ' one collision sound, in this script is called fx_collide
  481. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  482. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  483.  
  484.  
  485. '******************************************
  486. ' Explanation of the rolling sound routine
  487. '******************************************
  488.  
  489. ' sounds are played based on the ball speed and position
  490.  
  491. ' the routine checks first for deleted balls and stops the rolling sound.
  492.  
  493. ' The For loop goes through all the balls on the table and checks for the ball speed and
  494. ' if the ball is on the table (height lower than 30) then then it plays the sound
  495. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  496.  
  497. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  498. ' will change according to the ball speed, and the PAN function will change the stereo position according
  499. ' to the position of the ball on the table.
  500.  
  501.  
  502. '**************************************
  503. ' Explanation of the collision routine
  504. '**************************************
  505.  
  506. ' The collision is built in VP.
  507. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  508. ' 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
  509. ' depending of the speed of the collision.
  510.  
  511.  
  512. Sub Pins_Hit (idx)
  513. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  514. End Sub
  515.  
  516. Sub Targets_Hit (idx)
  517. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  518. End Sub
  519.  
  520. Sub Metals_Thin_Hit (idx)
  521. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  522. End Sub
  523.  
  524. Sub Metals_Medium_Hit (idx)
  525. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  526. End Sub
  527.  
  528. Sub Metals2_Hit (idx)
  529. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  530. End Sub
  531.  
  532. Sub Gates_Hit (idx)
  533. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  534. End Sub
  535.  
  536. Sub Spinner_Spin
  537. PlaySound "fx_spinner",0,.25,0,0.25
  538. End Sub
  539.  
  540. Sub Rubbers_Hit(idx)
  541. dim finalspeed
  542. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  543. If finalspeed > 20 then
  544. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  545. End if
  546. If finalspeed >= 6 AND finalspeed <= 20 then
  547. RandomSoundRubber()
  548. End If
  549. End Sub
  550.  
  551. Sub Posts_Hit(idx)
  552. dim finalspeed
  553. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  554. If finalspeed > 16 then
  555. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  556. End if
  557. If finalspeed >= 6 AND finalspeed <= 16 then
  558. RandomSoundRubber()
  559. End If
  560. End Sub
  561.  
  562. Sub RandomSoundRubber()
  563. Select Case Int(Rnd*3)+1
  564. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  565. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  566. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  567. End Select
  568. End Sub
  569.  
  570. Sub LeftFlipper_Collide(parm)
  571. RandomSoundFlipper()
  572. End Sub
  573.  
  574. Sub RightFlipper_Collide(parm)
  575. RandomSoundFlipper()
  576. End Sub
  577.  
  578. Sub RandomSoundFlipper()
  579. Select Case Int(Rnd*3)+1
  580. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  581. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  582. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  583. End Select
  584. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement