Advertisement
Arngrim

Untitled

Mar 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.76 KB | None | 0 0
  1. Option Explicit
  2.  
  3. On Error Resume Next
  4. ExecuteGlobal GetTextFile("controller.vbs")
  5. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  6. On Error Goto 0
  7.  
  8. ' Options
  9. ' Volume devided by - lower gets higher sound
  10.  
  11. Const VolDiv = 2000 ' Lower number, louder ballrolling/collition sound
  12. Const VolCol = 10 ' Ball collition divider ( voldiv/volcol )
  13.  
  14.  
  15. Dim VarRol, VarHidden
  16. VarHidden=0
  17. If Table1.ShowDT = true then VarRol=0 Else VarRol=1
  18.  
  19. If B2SOn = true Then VarHidden=1
  20.  
  21. Const cGameName="icefever",UseSolenoids=2,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="FlipperUp",SFlipperOff="FlipperDown"
  22. Const SCoin="coin3",cCredits=""
  23.  
  24. LoadVPM "01120100","sys80.vbs",3.02
  25.  
  26.  
  27. '**********************************************************
  28. '******** OPTIONS *******************************
  29. '**********************************************************
  30.  
  31. Dim BallShadows: Ballshadows=1 '******************set to 1 to turn on Ball shadows
  32. Dim FlipperShadows: FlipperShadows=1 '***********set to 1 to turn on Flipper shadows
  33. Dim ROMSounds: ROMSounds=1 '**********set to 0 for no rom sounds, 1 to play rom sounds.. mostly used for testing
  34.  
  35. Sub Table1_KeyDown(ByVal keycode)
  36. If vpmKeyDown(KeyCode) Then Exit Sub
  37. If keycode=PlungerKey Then Plunger.Pullback
  38.  
  39. if keycode = 46 then ' C Key
  40. If contball = 1 Then
  41. contball = 0
  42. Else
  43. contball = 1
  44. End If
  45. End If
  46. if keycode = 48 then 'B Key
  47. If bcboost = 1 Then
  48. bcboost = bcboostmulti
  49. Else
  50. bcboost = 1
  51. End If
  52. End If
  53. if keycode = 203 then bcleft = 1 ' Left Arrow
  54. if keycode = 200 then bcup = 1 ' Up Arrow
  55. if keycode = 208 then bcdown = 1 ' Down Arrow
  56. if keycode = 205 then bcright = 1 ' Right Arrow
  57.  
  58. End Sub
  59.  
  60. Sub Table1_KeyUp(ByVal keycode)
  61. If vpmKeyUp(KeyCode) Then Exit Sub
  62. If keycode=PlungerKey Then
  63. Plunger.Fire
  64. if ballhome.BallCntOver>0 then
  65. PlaySoundAt "plungerreleaseball", Plunger 'PLAY WHEN BALL IS HIT
  66. else
  67. PlaySoundAt "plungerreleasefree", Plunger 'PLAY WHEN NO BALL TO PLUNGE
  68. end if
  69. end If
  70.  
  71. if keycode = 203 then bcleft = 0 ' Left Arrow
  72. if keycode = 200 then bcup = 0 ' Up Arrow
  73. if keycode = 208 then bcdown = 0 ' Down Arrow
  74. if keycode = 205 then bcright = 0 ' Right Arrow
  75.  
  76. End Sub
  77.  
  78. Sub StartControl_Hit()
  79. Set ControlBall = ActiveBall
  80. contballinplay = true
  81. End Sub
  82.  
  83. Sub StopControl_Hit()
  84. contballinplay = false
  85. End Sub
  86.  
  87. Dim bcup, bcdown, bcleft, bcright, contball, contballinplay, ControlBall, bcboost
  88. Dim bcvel, bcyveloffset, bcboostmulti
  89.  
  90. bcboost = 1 'Do Not Change - default setting
  91. bcvel = 4 'Controls the speed of the ball movement
  92. bcyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
  93. bcboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
  94.  
  95. Sub BallControl_Timer()
  96. If Contball and ContBallInPlay then
  97. If bcright = 1 Then
  98. ControlBall.velx = bcvel*bcboost
  99. ElseIf bcleft = 1 Then
  100. ControlBall.velx = - bcvel*bcboost
  101. Else
  102. ControlBall.velx=0
  103. End If
  104.  
  105. If bcup = 1 Then
  106. ControlBall.vely = -bcvel*bcboost
  107. ElseIf bcdown = 1 Then
  108. ControlBall.vely = bcvel*bcboost
  109. Else
  110. ControlBall.vely= bcyveloffset
  111. End If
  112. End If
  113. End Sub
  114.  
  115.  
  116. Const sDrop=2
  117. Const sPuck=5' backglass hockey puck
  118. Const sknocker=8
  119. Const sOutHole=9
  120.  
  121. SolCallback(sDrop)="dtL.SolDropUp"
  122. SolCallback(sKnocker)="VpmSolSound SoundFX(""knocker"",DOFKnocker),"
  123. SolCallback(sOutHole)="bsTrough.SolOut"
  124. 'SolCallback(sLLFlipper)="VpmSolFlipper LeftFlipper,nothing,"
  125. 'SolCallback(sLRFlipper)="VpmSolFlipper RightFlipper,nothing,"
  126. SolCallback(sPuck)="AnimationStart"
  127.  
  128. SolCallback(sLRFlipper) = "SolRFlipper"
  129. SolCallback(sLLFlipper) = "SolLFlipper"
  130.  
  131. Sub SolLFlipper(Enabled)
  132. If Enabled Then
  133. PlaySound SoundFX("FlipperUp",DOFFlippers)
  134. LeftFlipper.RotateToEnd
  135. Else
  136. PlaySound SoundFX("FlipperDown",DOFFlippers)
  137. LeftFlipper.RotateToStart
  138. End If
  139. End Sub
  140.  
  141. Sub SolRFlipper(Enabled)
  142. If Enabled Then
  143. PlaySound SoundFX("FlipperUp",DOFFlippers)
  144. RightFlipper.RotateToEnd
  145. Else
  146. PlaySound SoundFX("FlipperDown",DOFFlippers)
  147. RightFlipper.RotateToStart
  148. End If
  149. End Sub
  150.  
  151.  
  152. Sub FlipperTimer_Timer
  153. Dim PI: PI=3.1415926
  154.  
  155. LFlip.RotZ = LeftFlipper.CurrentAngle
  156. RFlip.RotZ = RightFlipper.CurrentAngle
  157. LflipRubber.RotZ = LeftFlipper.CurrentAngle
  158. RFlipRubber.RotZ = RightFlipper.CurrentAngle
  159.  
  160. Pgate.Rotz = Gate1.CurrentAngle*0.7
  161. PrimGate2.rotx = Gate2.currentangle*0.5
  162. PrimGate3.rotx = Gate3.currentangle*0.5
  163.  
  164. Dim SpinnerRadius: SpinnerRadius=7
  165.  
  166. SpinnerRod.TransZ = (cos((spinner.CurrentAngle + 180) * (PI/180))+1) * SpinnerRadius
  167. SpinnerRod.TransY = (sin((spinner.CurrentAngle) * (PI/180))) * -SpinnerRadius
  168.  
  169.  
  170.  
  171. if FlipperShadows=1 then
  172. FlipperLSh.RotZ = LeftFlipper.currentangle
  173. FlipperRSh.RotZ = RightFlipper.currentangle
  174. end if
  175. End Sub
  176.  
  177. Kicker2.CreateBall.Image="HPuck"
  178. Sub AnimationStart(Enabled)
  179. Kicker2.Kick 180,5
  180. End Sub
  181.  
  182. Sub Kicker3_Hit:Me.DestroyBall:Kicker2.CreateBall.Image="HPuck":End Sub
  183.  
  184. Dim bsTrough,dtL,bsCaptive
  185.  
  186. Sub Table1_Init
  187. On Error Resume Next
  188.  
  189. With Controller
  190. .GameName=cGameName
  191. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  192. .SplashInfoLine="Ice Fever, Gottlieb 1985" & vbNewLine & "by Destruk, itchigo, Inkochnito, and lolo" & vbNewLine & "VPX conversion by Rascal"
  193. .HandleMechanics=0
  194. .HandleKeyboard=0
  195. .ShowDMDOnly=1
  196. .ShowFrame=0
  197. .ShowTitle=0
  198. .Hidden = VarHidden
  199. .Games(cGameName).Settings.Value("rol")=VarRol
  200. If Err Then MsgBox Err.Description
  201. End With
  202. On Error Goto 0
  203. Controller.SolMask(0)=0
  204. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  205. Controller.Run
  206.  
  207.  
  208. ' Controller.Dip(0) = (0*1 + 0*2 + 0*4 + 0*8 + 0*16 + 0*32 + 0*64 + 1*128) '01-08
  209. ' Controller.Dip(1) = (0*1 + 0*2 + 0*4 + 0*8 + 0*16 + 0*32 + 1*64 + 1*128) '09-16
  210. ' Controller.Dip(2) = (0*1 + 0*2 + 0*4 + 0*8 + 0*16 + 1*32 + 1*64 + 1*128) '17-24
  211. ' Controller.Dip(3) = (1*1 + 1*2 + 0*4 + 0*8 + 1*16 + 0*32 + 0*64 + 0*128) '25-32
  212.  
  213. 'Switch 25 Number Of Balls
  214. ' ON = 3
  215. ' OFF = 5
  216.  
  217. if ballshadows=1 then
  218. BallShadowUpdate.enabled=1
  219. else
  220. BallShadowUpdate.enabled=0
  221. end if
  222.  
  223. if flippershadows=1 then
  224. FlipperLSh.visible=1
  225. FlipperRSh.visible=1
  226. else
  227. FlipperLSh.visible=0
  228. FlipperRSh.visible=0
  229. end if
  230.  
  231. PinMAMETimer.Interval=PinMAMEInterval
  232. PinMAMETimer.Enabled=1
  233.  
  234. vpmNudge.TiltSwitch=57
  235. vpmNudge.Sensitivity=5
  236. vpmNudge.TiltObj=Array(LeftSlingshot,RightSlingshot,Bumper1,Bumper2,Bumper3,Bumper4)
  237.  
  238. Set bsTrough=New cvpmBallstack
  239. bsTrough.InitSw 0,67,0,0,0,0,0,0
  240. bsTrough.InitKick BallRelease,90,5
  241. bsTrough.InitExitSnd SoundFX("ballrel",DOFContactors),SoundFX("solon",DOFContactors)
  242. bsTrough.Balls=1
  243.  
  244. Set dtL=New cvpmDropTarget
  245. dtL.InitDrop Array(Target5,Target6,Target7),Array(40,50,60)
  246. dtL.initsnd SoundFX("flapclos",DOFContactors),SoundFX("flapopen",DOFContactors)
  247.  
  248. kicker1.createball
  249. kicker1.kick 0, 1
  250.  
  251. ' Set bsCaptive=New cvpmCaptiveBall
  252. ' bsCaptive.InitCaptive Trigger5,Wall10,Kicker1,351
  253. ' bsCaptive.Start
  254. ' bsCaptive.MinForce=3.5
  255. ' bsCaptive.ForceTrans=.8
  256. ' bsCaptive.CreateEvents "bsCaptive"
  257. End Sub
  258.  
  259. Sub Trigger1_Hit:Controller.Switch(41)=1:End Sub
  260. Sub Trigger1_unHit:Controller.switch(41)=0:End Sub
  261. Sub LeftInlane_Hit:Controller.Switch(43)=1:End Sub
  262. Sub LeftInlane_unHit:Controller.Switch(43)=0:End Sub
  263. Sub Bumper1_Hit:vpmTimer.PulseSw 44:PlaySoundAt SoundFX("JetBumper",DOFContactors), ActiveBall:DOF 103, DOFPulse:End Sub
  264. Sub Bumper2_Hit:vpmTimer.PulseSw 44:PlaySoundAt SoundFX("JetBumper2",DOFContactors), ActiveBall:DOF 105, DOFPulse:End Sub
  265. Sub Bumper3_Hit:vpmTimer.PulseSw 44:PlaySoundAt SoundFX("JetBumper3",DOFContactors), ActiveBall:DOF 106, DOFPulse:End Sub
  266. Sub Bumper4_Hit:vpmTimer.PulseSw 44:PlaySoundAt SoundFX("JetBumper4",DOFContactors), ActiveBall:DOF 104, DOFPulse:End Sub
  267. Sub Trigger2_Hit:Controller.Switch(51)=1:End Sub
  268. Sub Trigger2_unHit:Controller.switch(51)=0:End Sub
  269. Sub RightInlane_Hit:Controller.Switch(53)=1:End Sub
  270. Sub RightInlane_UnHit:Controller.Switch(53)=0:End Sub
  271. Sub Trigger3_Hit:Controller.Switch(61)=1:End Sub
  272. Sub Trigger3_unHit:Controller.switch(61)=0:End Sub
  273. Sub LeftOutlane_Hit:Controller.Switch(63)=1:DOF 107, DOFOn:End Sub
  274. Sub LeftOutlane_unHit:Controller.Switch(63)=0:DOF 107, DOFOff:End Sub
  275. Sub RightOutlane_Hit:Controller.Switch(63)=1:DOF 108, DOFOn:End Sub
  276. Sub RightOutlane_UnHit:Controller.Switch(63)=0:DOF 108, DOFOff:End Sub
  277. Sub Drain_Hit()PlaysoundAt "drain", Drain:bsTrough.AddBall Me:End Sub 'switch 67
  278. Sub Trigger4_Hit:Controller.Switch(71)=1:End Sub
  279. Sub Trigger4_unHit:Controller.switch(71)=0:End Sub
  280.  
  281.  
  282. Sub LeftSlingShot_Slingshot
  283. VpmTimer.PulseSw 73
  284. PlaySoundAt SoundFX("sling",DOFContactors), slingL
  285. DOF 101,DOFPulse
  286. LSling.Visible = 0
  287. LSling1.Visible = 1
  288. slingL.rotx = 20
  289. me.uservalue = 1
  290. Me.TimerEnabled = 1
  291. End Sub
  292.  
  293. Sub LeftSlingShot_Timer
  294. Select Case me.uservalue
  295. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:slingL.rotx = 10
  296. Case 4:slingL.rotx = 0:LSLing2.Visible = 0:LSLing.Visible = 1:me.TimerEnabled = 0
  297. End Select
  298. me.uservalue = me.uservalue + 1
  299. End Sub
  300.  
  301. Sub RightSlingShot_Slingshot
  302. VpmTimer.PulseSw 73
  303. PlaySoundAt SoundFX("sling2",DOFContactors), slingR
  304. DOF 102,DOFPulse
  305. RSling.Visible = 0
  306. RSling1.Visible = 1
  307. slingR.rotx = 20
  308. me.uservalue = 1
  309. Me.TimerEnabled = 1
  310. End Sub
  311.  
  312. Sub RightSlingShot_Timer
  313. Select Case me.uservalue
  314. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:slingR.rotx = 10
  315. Case 4:slingR.rotx = 0:RSLing2.Visible = 0:RSLing.Visible = 1:me.TimerEnabled = 0
  316. End Select
  317. me.uservalue = me.uservalue + 1
  318. End Sub
  319.  
  320.  
  321.  
  322. Sub Spinner_Spin
  323. vpmTimer.PulseSw 74
  324. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  325. End Sub
  326.  
  327.  
  328.  
  329. '****Targets***
  330.  
  331. Sub Target1_hit:vpmTimer.PulseSw 62:PlaySoundAtBall SoundFX("fx_target",DOFTargets):End Sub
  332. Sub Target2_hit:vpmTimer.PulseSw 52:PlaySoundAtBall SoundFX("fx_target",DOFTargets):End Sub
  333. Sub Target3_hit:vpmTimer.PulseSw 42:PlaySoundAtBall SoundFX("fx_target",DOFTargets):End Sub
  334. Sub Target4_hit:vpmTimer.PulseSw 72:PlaySoundAtBall SoundFX("fx_target",DOFTargets):End Sub
  335. Sub Target5_dropped:vpmTimer.PulseSw 40:PlaySoundAtBall SoundFX("fx_target",DOFDropTargets):End Sub
  336. Sub Target6_dropped:vpmTimer.PulseSw 50:PlaySoundAtBall SoundFX("fx_target",DOFDropTargets):End Sub
  337. Sub Target7_dropped:vpmTimer.PulseSw 60:PlaySoundAtBall SoundFX("fx_target",DOFDropTargets):End Sub
  338. Sub Target8_hit:vpmTimer.PulseSw 70:PlaySoundAtBall SoundFX("fx_target",DOFTargets):End Sub
  339.  
  340.  
  341. '****Lights***
  342.  
  343. set lights(3)=Light3
  344. set lights(4)=light4
  345. set lights(5)=light5
  346. set lights(6)=light6
  347. set lights(7)=light7
  348. set lights(12)=light12
  349. set lights(13)=light13
  350. set lights(14)=light14
  351. set lights(15)=light15
  352. set lights(16)=light16
  353. set lights(17)=light17
  354. set lights(18)=light18
  355. set lights(19)=light19
  356. set lights(20)=light20
  357. set lights(21)=light21
  358. set lights(22)=light22
  359. set lights(23)=light23
  360. set lights(24)=light24
  361. set lights(25)=light25
  362. set lights(26)=light26
  363. set lights(27)=light27
  364. set lights(28)=light28
  365. set lights(29)=light29
  366. set lights(30)=light30
  367. set lights(31)=light31
  368. set lights(32)=light32
  369. set lights(33)=light33
  370. set lights(34)=light34
  371. set lights(35)=light35
  372. set lights(36)=light36
  373. set lights(37)=light37
  374. set lights(38)=light38
  375. set lights(39)=light39
  376. set lights(40)=light40
  377. set lights(41)=light41
  378. set lights(42)=light42
  379. set lights(43)=light43
  380. set lights(44)=light44
  381. set lights(45)=light45
  382. set lights(46)=light46
  383. set lights(47)=light47
  384. set lights(48)=light48
  385. set lights(49)=light49
  386. set lights(50)=light50
  387. set lights(51)=light51
  388.  
  389. 'Gottlieb Ice Fever
  390. 'added by Inkochnito
  391. Sub editDips
  392. Dim vpmDips : Set vpmDips = New cvpmDips
  393. With vpmDips
  394. .AddForm 700,400,"Ice Fever - DIP switches"
  395. .AddFrame 0,0,190,"Maximum credits",49152,Array("8 credits",0,"10 credits",32768,"15 credits",&H00004000,"20 credits",49152)'dip 15&16
  396. .AddFrame 0,76,190,"Coin chute 1 and 2 control",&H00002000,Array("seperate",0,"same",&H00002000)'dip 14
  397. .AddFrame 0,122,190,"3rd coin chute credits control",&H20000000,Array("no effect",0,"add 9",&H20000000)'dip 30
  398. .AddFrame 0,168,190,"Novelty mode",&H08000000,Array("normal game mode",0,"50K per special/extra ball",&H08000000)'dip 28
  399. .AddFrame 0,214,190,"Background sound volume",&H40000000,Array("half volume",0,"full volume",&H40000000)'dip 31
  400. .AddFrame 205,0,190,"High score to date awards",&H00C00000,Array("not displayed and no award",0,"displayed and no award",&H00800000,"displayed and 2 credits",&H00400000,"displayed and 3 credits",&H00C00000)'dip 23&24
  401. .AddFrame 205,76,190,"Game mode",&H10000000,Array("replay",0,"extra ball",&H10000000)'dip 29
  402. .AddFrame 205,122,190,"Playfield special",&H00200000,Array("replay",0,"extra ball",&H00200000)'dip 22
  403. .AddFrame 205,168,190,"Replay limit",&H04000000,Array("no limit",0,"one per game",&H04000000)'dip 27
  404. .AddFrame 205,214,190,"Balls per game",&H01000000,Array("5 balls",0,"3 balls",&H01000000)'dip 25
  405. .AddChk 205,265,190,Array("Match feature",&H02000000)'dip 26
  406. .AddChk 0,265,190,Array("Spare (game option)",&H80000000)'dip 32
  407. .AddLabel 50,290,300,20,"After hitting OK, press F3 to reset game with new settings."
  408. .ViewDips
  409. End With
  410. End Sub
  411. Set vpmShowDips = GetRef("editDips")
  412.  
  413. Sub Gate1_Hit: PlaySoundAtBall "Gate" : End Sub
  414. Sub Gate2_Hit: PlaySoundAtBall "Gate" : End Sub
  415.  
  416.  
  417. '*********************************************************************
  418. ' Positional Sound Playback Functions
  419. '*********************************************************************
  420.  
  421. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  422. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  423. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  424. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  425. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  426. End Sub
  427.  
  428. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  429. Sub PlaySoundAt(soundname, tableobj)
  430. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  431. End Sub
  432.  
  433. Sub PlaySoundAtBall(soundname)
  434. PlaySoundAt soundname, ActiveBall
  435. End Sub
  436.  
  437. '**************************************************************************
  438. ' Additional Positional Sound Playback Functions by DJRobX
  439. '**************************************************************************
  440.  
  441. Sub PlaySoundAtVol(sound, tableobj, Vol)
  442. PlaySound sound, 1, Vol, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  443. End Sub
  444.  
  445. 'Set position at table object, vol, and loops manually.
  446.  
  447. Sub PlaySoundAtVolLoops(sound, tableobj, Vol, Loops)
  448. PlaySound sound, Loops, Vol, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  449. End Sub
  450.  
  451.  
  452. '*********************************************************************
  453. ' Supporting Ball & Sound Functions
  454. '*********************************************************************
  455.  
  456. 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
  457. Dim tmp
  458. tmp = tableobj.y * 2 / Table1.height-1
  459. If tmp > 0 Then
  460. AudioFade = Csng(tmp ^10)
  461. Else
  462. AudioFade = Csng(-((- tmp) ^10) )
  463. End If
  464. End Function
  465.  
  466. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  467. Dim tmp
  468. tmp = tableobj.x * 2 / Table1.width-1
  469. If tmp > 0 Then
  470. AudioPan = Csng(tmp ^10)
  471. Else
  472. AudioPan = Csng(-((- tmp) ^10) )
  473. End If
  474. End Function
  475.  
  476. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  477. Vol = Csng(BallVel(ball) ^2 / 2000)
  478. End Function
  479.  
  480. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  481. Pitch = BallVel(ball) * 20
  482. End Function
  483.  
  484. Function BallVel(ball) 'Calculates the ball speed
  485. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  486. End Function
  487.  
  488. '*****************************************
  489. ' JP's VP10 Rolling Sounds
  490. '*****************************************
  491.  
  492. Const tnob = 5 ' total number of balls
  493. ReDim rolling(tnob)
  494. InitRolling
  495.  
  496. Sub InitRolling
  497. Dim i
  498. For i = 0 to tnob
  499. rolling(i) = False
  500. Next
  501. End Sub
  502.  
  503. Sub RollingTimer_Timer()
  504. Dim BOT, b
  505. BOT = GetBalls
  506.  
  507. ' stop the sound of deleted balls
  508. For b = UBound(BOT) + 1 to tnob
  509. rolling(b) = False
  510. StopSound("fx_ballrolling" & b)
  511. Next
  512.  
  513. ' exit the sub if no balls on the table
  514. If UBound(BOT) = -1 Then Exit Sub
  515.  
  516. ' play the rolling sound for each ball
  517. For b = 0 to UBound(BOT)
  518. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  519. rolling(b) = True
  520. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  521. Else
  522. If rolling(b) = True Then
  523. StopSound("fx_ballrolling" & b)
  524. rolling(b) = False
  525. End If
  526. End If
  527. Next
  528. End Sub
  529.  
  530. '**********************
  531. ' Ball Collision Sound
  532. '**********************
  533.  
  534. Sub OnBallBallCollision(ball1, ball2, velocity)
  535. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / (VolDiv/VolCol), AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  536. End Sub
  537.  
  538. '*****************************************
  539. ' BALL SHADOW by ninnuzu
  540. '*****************************************
  541. Dim BallShadow
  542. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  543.  
  544. Sub BallShadowUpdate_timer()
  545. Dim BOT, b
  546. Dim maxXoffset
  547. maxXoffset=13
  548. BOT = GetBalls
  549.  
  550. ' render the shadow for each ball
  551. For b = 0 to UBound(BOT)
  552. BallShadow(b).X = BOT(b).X-maxXoffset*(1-(Bot(b).X)/(Table1.Width/2))
  553. BallShadow(b).Y = BOT(b).Y + 10
  554. If BOT(b).Z > 0 and BOT(b).Z < 30 Then
  555. BallShadow(b).visible = 1
  556. Else
  557. BallShadow(b).visible = 0
  558. End If
  559. Next
  560. End Sub
  561.  
  562. Sub a_Triggers_Hit (idx)
  563. 'debug.print "Trigger hit"
  564. playsound "fx_sensor", 0,1,AudioPan(ActiveBall),0,0,0,1,AudioFade(ActiveBall)
  565. End sub
  566.  
  567. Sub a_Pins_Hit (idx)
  568. 'debug.print "Pins hit"
  569. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  570. End Sub
  571.  
  572. Sub a_Targets_Hit (idx)
  573. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  574. End Sub
  575.  
  576. Sub a_DropTargets_Hit (idx)
  577. PlaySound "DTDrop", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  578. End Sub
  579.  
  580. Sub a_Metals_Thin_Hit (idx)
  581. 'debug.print "Metals Thin hit"
  582. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  583. End Sub
  584.  
  585. Sub a_Metals_Medium_Hit (idx)
  586. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  587. End Sub
  588.  
  589. Sub a_Metals2_Hit (idx)
  590. 'debug.print "Metals2 hit"
  591. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  592. End Sub
  593.  
  594. Sub a_Gates_Hit (idx)
  595. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  596. End Sub
  597.  
  598. 'Sub Spinner_Spin
  599. ' PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  600. 'End Sub
  601.  
  602. Sub a_Rubbers_Hit(idx)
  603. dim finalspeed
  604. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  605. If finalspeed > 20 then
  606. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  607. End if
  608. If finalspeed >= 6 AND finalspeed <= 20 then
  609. RandomSoundRubber()
  610. End If
  611. End Sub
  612.  
  613. Sub a_Posts_Hit(idx)
  614. dim finalspeed
  615. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  616. If finalspeed > 16 then
  617. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  618. End if
  619. If finalspeed >= 6 AND finalspeed <= 16 then
  620. RandomSoundRubber()
  621. End If
  622. End Sub
  623.  
  624. Sub RandomSoundRubber()
  625. Select Case Int(Rnd*3)+1
  626. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  627. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  628. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  629. End Select
  630. End Sub
  631.  
  632. Sub LeftFlipper_Collide(parm)
  633. RandomSoundFlipper()
  634. End Sub
  635.  
  636.  
  637. Sub RightFlipper_Collide(parm)
  638. RandomSoundFlipper()
  639. End Sub
  640.  
  641. Sub RandomSoundFlipper()
  642. Select Case Int(Rnd*3)+1
  643. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  644. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  645. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  646. End Select
  647. End Sub
  648.  
  649. Sub Table1_exit()
  650. Controller.Pause = False
  651. Controller.Stop
  652. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement