Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.50 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="stingray",UseSolenoids=2,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
  10.  
  11. LoadVPM "01530000","bally.vbs",3.20
  12.  
  13. Dim DesktopMode: DesktopMode = Table1.ShowDT
  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.  
  28. SolCallback(1)= "vpmSolSound SoundFX(""Chime1"",DOFChimes),"
  29. SolCallback(2)= "vpmSolSound SoundFX(""Chime2"",DOFChimes),"
  30. SolCallback(3)= "vpmSolSound SoundFX(""Chime3"",DOFChimes),"
  31. SolCallback(4)= "vpmSolSound SoundFX(""Chime4"",DOFChimes),"
  32. SolCallback(6)= "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  33. SolCallback(7)="bsTrough.SolOut"
  34. SolCallback(9)="SolSaucerEject"
  35. SolCallback(10)="dtL.SolDropUp"
  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.  
  58. 'Solenoid Controlled toys
  59. '**********************************************************************************************************
  60.  
  61. Sub SolSaucerEject(Enabled)
  62. If Enabled Then
  63. If bsSaucer1.Balls Then bsSaucer1.ExitSol_On
  64. If bsSaucer2.Balls Then bsSaucer2.ExitSol_On
  65. End If
  66. End Sub
  67.  
  68. '*****GI Lights On
  69. dim xx
  70. For each xx in GI:xx.State = 1: Next
  71.  
  72. '**********************************************************************************************************
  73.  
  74. 'Initiate Table
  75. '**********************************************************************************************************
  76. Dim bsTrough,bsSaucer1,bsSaucer2,dtL
  77.  
  78. Sub Table1_Init
  79. vpmInit Me
  80. On Error Resume Next
  81. With Controller
  82. .GameName = cGameName
  83. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  84. .SplashInfoLine = "StingRay (Stern)"&chr(13)&"You Suck"
  85. .HandleMechanics=0
  86. .HandleKeyboard=0
  87. .ShowDMDOnly=1
  88. .ShowFrame=0
  89. .ShowTitle=0
  90. .hidden = 1
  91. On Error Resume Next
  92. .Run
  93. If Err Then MsgBox Err.Description
  94. On Error Goto 0
  95. End With
  96.  
  97. PinmameTimer.Interval=PinMameInterval
  98. PinmameTimer.Enabled=1
  99. vpmNudge.TiltSwitch=7
  100. vpmNudge.Sensitivity=2
  101. vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
  102.  
  103. Set bsTrough=New cvpmBallstack
  104. bsTrough.InitNoTrough BallRelease,8,125,3
  105. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  106.  
  107. Set bsSaucer1=New cvpmBallStack
  108. bsSaucer1.InitSaucer sw12,12,180,8
  109. bsSaucer1.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  110. bsSaucer1.KickAngleVar=30
  111. bsSaucer1.KickForceVar = 2
  112.  
  113. Set bsSaucer2=New cvpmBallStack
  114. bsSaucer2.InitSaucer sw12a,12,207,10
  115. bsSaucer2.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  116. bsSaucer2.KickAngleVar=15
  117. bsSaucer2.KickForceVar = 2
  118.  
  119. Set dtL=New cvpmDropTarget
  120. dtL.InitDrop Array(sw25,sw26,sw27,sw28,sw29),Array(25,26,27,28,29)
  121. dtL.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
  122.  
  123. End Sub
  124.  
  125. '**********************************************************************************************************
  126. 'Plunger code
  127. '**********************************************************************************************************
  128.  
  129. Sub Table1_KeyDown(ByVal KeyCode)
  130. If KeyDownHandler(keycode) Then Exit Sub
  131. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  132. End Sub
  133.  
  134. Sub Table1_KeyUp(ByVal KeyCode)
  135. If KeyUpHandler(keycode) Then Exit Sub
  136. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  137. End Sub
  138.  
  139. '**********************************************************************************************************
  140.  
  141. ' Drain hole
  142. Sub Drain_Hit:playsound"drain":bsTrough.addball me:End Sub
  143. Sub sw12_Hit:bsSaucer1.AddBall 0 : playsound "popper_ball": End Sub
  144. Sub sw12a_Hit:bsSaucer2.AddBall 0 : playsound "popper_ball": End Sub
  145.  
  146. 'Drop Targets
  147. Sub sw25_Dropped:dtL.Hit 1:End Sub
  148. Sub sw26_Dropped:dtL.Hit 2:End Sub
  149. Sub sw27_Dropped:dtL.Hit 3:End Sub
  150. Sub sw28_Dropped:dtL.Hit 4:End Sub
  151. Sub sw29_Dropped:dtL.Hit 5:End Sub
  152.  
  153. 'Stand Up Targets
  154. Sub sw30_Hit:vpmTimer.PulseSw 30:DOF 101, DOFPulse:End Sub
  155. Sub sw30f_Hit:vpmTimer.PulseSw 30:DOF 102, DOFPulse:End Sub
  156. Sub sw32a_Hit:vpmTimer.PulseSw 32:DOF 104, DOFPulse:End Sub
  157.  
  158. 'Wire Triggers
  159. Sub SW23_Hit:Controller.Switch(23)=1 : playsound"rollover" : End Sub
  160. Sub SW23_UnHit:Controller.Switch(23)=0:End Sub
  161. Sub SW24_Hit:Controller.Switch(24)=1 : playsound"rollover" : End Sub
  162. Sub SW24_UnHit:Controller.Switch(24)=0:End Sub
  163. Sub SW31_Hit:Controller.Switch(31)=1 : playsound"rollover" : End Sub
  164. Sub SW31_UnHit:Controller.Switch(31)=0:End Sub
  165. Sub SW32_Hit:Controller.Switch(32)=1 : playsound"rollover" : DOF 105, DOFOn : End Sub
  166. Sub SW32_UnHit:Controller.Switch(32)=0 : DOF 105, DOFOff : End Sub
  167.  
  168. 'Spinners
  169. Sub sw30g_Spin:vpmTimer.PulseSw 30 : playsound"fx_spinner" : DOF 103, DOFPulse : End Sub
  170.  
  171. 'Scoring Rubbers
  172. Sub SW21a_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
  173. Sub SW21b_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
  174. Sub SW21c_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
  175. Sub SW21d_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
  176. Sub SW21e_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
  177. Sub SW22a_Hit:vpmTimer.pulseSw 22 : playsound"flip_hit_3" : End Sub
  178. Sub SW22b_Hit:vpmTimer.pulseSw 22 : playsound"flip_hit_3" : End Sub
  179.  
  180. 'Star Triggers
  181. Sub SW14_Hit:Controller.Switch(14)=1 : playsound"rollover" : End Sub
  182. Sub SW14_unHit:Controller.Switch(14)=0:End Sub
  183. Sub SW30a_Hit:Controller.Switch(30)=1 : playsound"rollover": DOF 110, DOFOn : End Sub
  184. Sub SW30a_unHit:Controller.Switch(30)=0: DOF 110, DOFOff : End Sub
  185. Sub SW30b_Hit:Controller.Switch(30)=1 : playsound"rollover": DOF 109, DOFOn : End Sub
  186. Sub SW30b_unHit:Controller.Switch(30)=0: DOF 109, DOFOff : End Sub
  187. Sub SW30c_Hit:Controller.Switch(30)=1 : playsound"rollover": DOF 108, DOFOn : End Sub
  188. Sub SW30c_unHit:Controller.Switch(30)=0: DOF 108, DOFOff : End Sub
  189. Sub SW30d_Hit:Controller.Switch(30)=1 : playsound"rollover" : DOF 107, DOFOn : End Sub
  190. Sub SW30d_unHit:Controller.Switch(30)=0: DOF 107, DOFOff : End Sub
  191. Sub SW30e_Hit:Controller.Switch(30)=1 : playsound"rollover" : DOF 106, DOFOn : End Sub
  192. Sub SW30e_unHit:Controller.Switch(30)=0: DOF 106, DOFOff : End Sub
  193.  
  194. 'Bumpers
  195. Sub Bumper1_Hit:vpmTimer.PulseSw 39 : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  196. Sub Bumper2_Hit:vpmTimer.PulseSw 40 : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  197. Sub Bumper3_Hit:vpmTimer.PulseSw 38 : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  198.  
  199.  
  200. Set Lights(1)=L1
  201. Lights(2)= array(L2,l2a)
  202. Set Lights(3)=L3
  203.  
  204. Lights(9)= array(L9,L9a)
  205.  
  206. Lights(10)= array(L10,L10a)
  207. Set Lights(11)=L11
  208. Lights(12)= array(L12,L12a,L12b,L12c)
  209.  
  210. Set Lights(17)=L17
  211. Set Lights(18)=L18
  212. Set Lights(19)=L19
  213. Set Lights(20)=L20
  214. Set Lights(21)=L21
  215. Lights(25)= array(L25,L25a)
  216.  
  217. Set Lights(33)=L33
  218. Set Lights(34)=L34
  219. Set Lights(38)=L38
  220.  
  221. Lights(41)= array(L41,l41a)
  222. Set Lights(44)=L44
  223.  
  224. Set Lights(49)=L49
  225. Set Lights(50)=L50
  226. Lights(52)= array(L52,L52a)
  227. Set Lights(53)=L53
  228. Set Lights(57)=L57
  229. Set Lights(58)=L58
  230.  
  231.  
  232. '**********************************************************************************************************
  233. 'Digital Display
  234. '**********************************************************************************************************
  235. Dim Digits(28)
  236.  
  237. ' 1st Player
  238. Digits(0) = Array(LED10,LED11,LED12,LED13,LED14,LED15,LED16)
  239. Digits(1) = Array(LED20,LED21,LED22,LED23,LED24,LED25,LED26)
  240. Digits(2) = Array(LED30,LED31,LED32,LED33,LED34,LED35,LED36)
  241. Digits(3) = Array(LED40,LED41,LED42,LED43,LED44,LED45,LED46)
  242. Digits(4) = Array(LED50,LED51,LED52,LED53,LED54,LED55,LED56)
  243. Digits(5) = Array(LED60,LED61,LED62,LED63,LED64,LED65,LED66)
  244. ' 2nd Player
  245. Digits(6) = Array(LED80,LED81,LED82,LED83,LED84,LED85,LED86)
  246. Digits(7) = Array(LED90,LED91,LED92,LED93,LED94,LED95,LED96)
  247. Digits(8) = Array(LED100,LED101,LED102,LED103,LED104,LED105,LED106)
  248. Digits(9) = Array(LED110,LED111,LED112,LED113,LED114,LED115,LED116)
  249. Digits(10) = Array(LED120,LED121,LED122,LED123,LED124,LED125,LED126)
  250. Digits(11) = Array(LED130,LED131,LED132,LED133,LED134,LED135,LED136)
  251.  
  252.  
  253. ' 3rd Player
  254. Digits(12) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156)
  255. Digits(13) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166)
  256. Digits(14) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176)
  257. Digits(15) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186)
  258. Digits(16) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196)
  259. Digits(17) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206)
  260.  
  261.  
  262. ' 4th Player
  263. Digits(18) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226)
  264. Digits(19) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236)
  265. Digits(20) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246)
  266. Digits(21) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256)
  267. Digits(22) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266)
  268. Digits(23) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276)
  269.  
  270.  
  271. ' Credits
  272. Digits(24) = Array(LED4,LED2,LED6,LED7,LED5,LED1,LED3)
  273. Digits(25) = Array(LED18,LED9,LED27,LED28,LED19,LED8,LED17)
  274. ' Balls
  275. Digits(26) = Array(LED39,LED37,LED48,LED49,LED47,LED29,LED38)
  276. Digits(27) = Array(LED67,LED58,LED69,LED77,LED68,LED57,LED59)
  277.  
  278. Sub DisplayTimer_Timer
  279. Dim ChgLED,ii,num,chg,stat,obj
  280. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  281. If Not IsEmpty(ChgLED) Then
  282. If DesktopMode = True Then
  283. For ii = 0 To UBound(chgLED)
  284. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  285. if (num < 28) then
  286. For Each obj In Digits(num)
  287. If chg And 1 Then obj.State = stat And 1
  288. chg = chg\2 : stat = stat\2
  289. Next
  290. else
  291. 'if char(stat) > "" then msg(num) = char(stat)
  292. end if
  293. next
  294. end if
  295. end if
  296. End Sub
  297.  
  298. '**********************************************************************************************************
  299. '**********************************************************************************************************
  300.  
  301. 'Stern Stingray
  302. 'added by Inkochnito
  303.  
  304. Sub editDips
  305. Dim vpmDips : Set vpmDips = New cvpmDips
  306. With vpmDips
  307. .AddForm 700,400,"Stingray - DIP switches"
  308. .AddFrame 2,0,190,"Maximum credits",&H00070000,Array("10 credits",&H00010000,"20 credits",&H00030000,"30 credits",&H00050000,"40 credits",&H00070000)'dip 17&18&19
  309. .AddFrame 2,76,190,"High game to date award",&H00004000,Array("3 balls - 500K, 5 balls - 840K",0,"3 free games",&H00004000)'dip 15
  310. .AddFrame 2,122,190,"High score award",&H00000020,Array("extra ball",0,"replay",&H00000020)'dip 6
  311. .AddFrame 2,168,190,"Balls per game",&H00000040,Array("3 balls",0,"5 balls",&H00000040)'dip 7
  312. .AddChk 2,220,120,Array("Credits displayed",&H00080000)'dip 20
  313. .AddChk 2,235,120,Array("Match feature",&H00100000)'dip 21
  314. .AddChk 2,250,120,Array("4 player games",&H01000000)'dip 25
  315. .AddFrame 205,0,190,"Special award",&HC0000000,Array("100.000 points",0,"free ball",&H40000000,"free game",&H80000000,"free ball and free game",&HC0000000)'dip 31&32
  316. .AddFrame 205,76,190,"Feature lites adjustment",32768,Array("all lites on",0,"lites alternating",32768)'dip 16
  317. .AddFrame 205,122,190,"Drop target special",&H00800000,Array("special lite on only",0,"special lite on and 1 replay",&H00800000)'dip 24
  318. .AddFrame 205,168,190,"Melody option",&H00000080,Array("2 tones only",0,"full melody",&H00000080)'dip 8
  319. .AddLabel 50,270,300,20,"After hitting OK, press F3 to reset game with new settings."
  320. .ViewDips
  321. End With
  322. End Sub
  323.  
  324. Set vpmShowDips = GetRef("editDips")
  325.  
  326. ' *********************************************************************
  327. ' *********************************************************************
  328.  
  329. 'Start of VPX call back Functions
  330.  
  331. ' *********************************************************************
  332. ' *********************************************************************
  333.  
  334.  
  335. '**********Sling Shot Animations
  336. ' Rstep and Lstep are the variables that increment the animation
  337. '****************
  338. Dim RStep, Lstep
  339.  
  340. Sub RightSlingShot_Slingshot
  341. vpmTimer.PulseSw 36
  342. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
  343. RSling.Visible = 0
  344. RSling1.Visible = 1
  345. sling1.rotx = 20
  346. RStep = 0
  347. RightSlingShot.TimerEnabled = 1
  348. End Sub
  349.  
  350. Sub RightSlingShot_Timer
  351. Select Case RStep
  352. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
  353. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0:
  354. End Select
  355. RStep = RStep + 1
  356. End Sub
  357.  
  358. Sub LeftSlingShot_Slingshot
  359. vpmTimer.PulseSw 37
  360. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
  361. LSling.Visible = 0
  362. LSling1.Visible = 1
  363. sling2.rotx = 20
  364. LStep = 0
  365. LeftSlingShot.TimerEnabled = 1
  366. End Sub
  367.  
  368. Sub LeftSlingShot_Timer
  369. Select Case LStep
  370. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
  371. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0:
  372. End Select
  373. LStep = LStep + 1
  374. End Sub
  375.  
  376.  
  377. '*********************************************************************
  378. ' Positional Sound Playback Functions
  379. '*********************************************************************
  380.  
  381. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  382. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  383. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  384. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  385. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  386. End Sub
  387.  
  388. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  389. Sub PlaySoundAt(soundname, tableobj)
  390. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  391. End Sub
  392.  
  393. Sub PlaySoundAtBall(soundname)
  394. PlaySoundAt soundname, ActiveBall
  395. End Sub
  396.  
  397.  
  398. '*********************************************************************
  399. ' Supporting Ball & Sound Functions
  400. '*********************************************************************
  401.  
  402. 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
  403. Dim tmp
  404. tmp = tableobj.y * 2 / table1.height-1
  405. If tmp > 0 Then
  406. AudioFade = Csng(tmp ^10)
  407. Else
  408. AudioFade = Csng(-((- tmp) ^10) )
  409. End If
  410. End Function
  411.  
  412. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  413. Dim tmp
  414. tmp = tableobj.x * 2 / table1.width-1
  415. If tmp > 0 Then
  416. AudioPan = Csng(tmp ^10)
  417. Else
  418. AudioPan = Csng(-((- tmp) ^10) )
  419. End If
  420. End Function
  421.  
  422. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  423. Vol = Csng(BallVel(ball) ^2 / 2000)
  424. End Function
  425.  
  426. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  427. Pitch = BallVel(ball) * 20
  428. End Function
  429.  
  430. Function BallVel(ball) 'Calculates the ball speed
  431. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  432. End Function
  433.  
  434.  
  435. '*****************************************
  436. ' JP's VP10 Rolling Sounds
  437. '*****************************************
  438.  
  439. Const tnob = 5 ' total number of balls
  440. ReDim rolling(tnob)
  441. InitRolling
  442.  
  443. Sub InitRolling
  444. Dim i
  445. For i = 0 to tnob
  446. rolling(i) = False
  447. Next
  448. End Sub
  449.  
  450. Sub RollingTimer_Timer()
  451. Dim BOT, b
  452. BOT = GetBalls
  453.  
  454. ' stop the sound of deleted balls
  455. For b = UBound(BOT) + 1 to tnob
  456. rolling(b) = False
  457. StopSound("fx_ballrolling" & b)
  458. Next
  459.  
  460. ' exit the sub if no balls on the table
  461. If UBound(BOT) = -1 Then Exit Sub
  462.  
  463. ' play the rolling sound for each ball
  464. For b = 0 to UBound(BOT)
  465. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  466. rolling(b) = True
  467. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  468. Else
  469. If rolling(b) = True Then
  470. StopSound("fx_ballrolling" & b)
  471. rolling(b) = False
  472. End If
  473. End If
  474. Next
  475. End Sub
  476.  
  477. '**********************
  478. ' Ball Collision Sound
  479. '**********************
  480.  
  481. Sub OnBallBallCollision(ball1, ball2, velocity)
  482. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  483. End Sub
  484.  
  485.  
  486. '*****************************************
  487. ' ninuzzu's FLIPPER SHADOWS
  488. '*****************************************
  489.  
  490. sub FlipperTimer_Timer()
  491. FlipperLSh.RotZ = LeftFlipper.currentangle
  492. FlipperRSh.RotZ = RightFlipper.currentangle
  493.  
  494. End Sub
  495.  
  496. '*****************************************
  497. ' ninuzzu's BALL SHADOW
  498. '*****************************************
  499. Dim BallShadow
  500. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  501.  
  502. Sub BallShadowUpdate_timer()
  503. Dim BOT, b
  504. BOT = GetBalls
  505. ' hide shadow of deleted balls
  506. If UBound(BOT)<(tnob-1) Then
  507. For b = (UBound(BOT) + 1) to (tnob-1)
  508. BallShadow(b).visible = 0
  509. Next
  510. End If
  511. ' exit the Sub if no balls on the table
  512. If UBound(BOT) = -1 Then Exit Sub
  513. ' render the shadow for each ball
  514. For b = 0 to UBound(BOT)
  515. If BOT(b).X < Table1.Width/2 Then
  516. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  517. Else
  518. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  519. End If
  520. ballShadow(b).Y = BOT(b).Y + 12
  521. If BOT(b).Z > 20 Then
  522. BallShadow(b).visible = 1
  523. Else
  524. BallShadow(b).visible = 0
  525. End If
  526. Next
  527. End Sub
  528.  
  529.  
  530.  
  531. '************************************
  532. ' What you need to add to your table
  533. '************************************
  534.  
  535. ' a timer called RollingTimer. With a fast interval, like 10
  536. ' one collision sound, in this script is called fx_collide
  537. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  538. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  539.  
  540.  
  541. '******************************************
  542. ' Explanation of the rolling sound routine
  543. '******************************************
  544.  
  545. ' sounds are played based on the ball speed and position
  546.  
  547. ' the routine checks first for deleted balls and stops the rolling sound.
  548.  
  549. ' The For loop goes through all the balls on the table and checks for the ball speed and
  550. ' if the ball is on the table (height lower than 30) then then it plays the sound
  551. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  552.  
  553. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  554. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  555. ' according to the position of the ball on the table.
  556.  
  557.  
  558. '**************************************
  559. ' Explanation of the collision routine
  560. '**************************************
  561.  
  562. ' The collision is built in VP.
  563. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  564. ' 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
  565. ' depending of the speed of the collision.
  566.  
  567.  
  568. Sub Pins_Hit (idx)
  569. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  570. End Sub
  571.  
  572. Sub Targets_Hit (idx)
  573. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  574. End Sub
  575.  
  576. Sub Metals_Thin_Hit (idx)
  577. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  578. End Sub
  579.  
  580. Sub Metals_Medium_Hit (idx)
  581. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  582. End Sub
  583.  
  584. Sub Metals2_Hit (idx)
  585. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  586. End Sub
  587.  
  588. Sub Gates_Hit (idx)
  589. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  590. End Sub
  591.  
  592. Sub Spinner_Spin
  593. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  594. End Sub
  595.  
  596. Sub Rubbers_Hit(idx)
  597. dim finalspeed
  598. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  599. If finalspeed > 20 then
  600. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  601. End if
  602. If finalspeed >= 6 AND finalspeed <= 20 then
  603. RandomSoundRubber()
  604. End If
  605. End Sub
  606.  
  607. Sub Posts_Hit(idx)
  608. dim finalspeed
  609. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  610. If finalspeed > 16 then
  611. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  612. End if
  613. If finalspeed >= 6 AND finalspeed <= 16 then
  614. RandomSoundRubber()
  615. End If
  616. End Sub
  617.  
  618. Sub RandomSoundRubber()
  619. Select Case Int(Rnd*3)+1
  620. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  621. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  622. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  623. End Select
  624. End Sub
  625.  
  626. Sub LeftFlipper_Collide(parm)
  627. RandomSoundFlipper()
  628. End Sub
  629.  
  630. Sub RightFlipper_Collide(parm)
  631. RandomSoundFlipper()
  632. End Sub
  633.  
  634. Sub RandomSoundFlipper()
  635. Select Case Int(Rnd*3)+1
  636. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  637. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  638. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  639. End Select
  640. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement