Advertisement
Arngrim

lah dof validated

Nov 18th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.80 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. Dim Ballsize,BallMass
  10. Ballsize = 50
  11. BallMass = (Ballsize^3)/125000
  12.  
  13. Dim DesktopMode:DesktopMode = LastActionHero.ShowDT
  14. Dim UseVPMColoredDMD
  15.  
  16.  
  17. Dim CraneLenght, CraneSteps, CraneAnimationSteps
  18. CraneLenght = 2880 'vpmMechFast
  19. CraneSteps = 137
  20. CraneAnimationSteps = 0.4166666666667*CraneLenght 'vpmMechFast
  21.  
  22.  
  23. if LastActionHero.ShowDT Then
  24. vidrio.visible = 1
  25. leftrail.visible = 0
  26. rightrail1.visible = 0
  27. backrail.visible = 0
  28. Else
  29. vidrio.visible = 0
  30. leftrail.visible = 1
  31. rightrail1.visible = 1
  32. backrail.visible = 1
  33. End If
  34.  
  35.  
  36. UseVPMColoredDMD = DesktopMode
  37.  
  38. LoadVPM "01000200", "DE.VBS", 3.46
  39.  
  40. '********************
  41. 'Standard definitions
  42. '********************
  43.  
  44. Const UseSolenoids = 1
  45. Const UseLamps = 0
  46. Const UseSync = 0
  47. Const HandleMech = 0
  48.  
  49. ' Standard Sounds
  50. Const SSolenoidOn = "fx_Solenoidon"
  51. Const SSolenoidOff = "fx_solenoidoff"
  52. Const SCoin = "fx_Coin"
  53.  
  54.  
  55. 'Solenoids
  56. SolCallback(1) = "SolTrough" '1L - 6 Ball Assy Lockout
  57. SolCallback(2) = "SolRelease" '2L - Ball Release
  58. SolCallback(3) = "SolAutoPlungerIM" '3L - Ball Launch
  59. SolCallback(4) = "SolCraneLock" '4L - Crane Lock
  60. SolCallback(5) = "bsVuk.SolOut" '5L - VUK
  61. SolCallback(6) = "bsRScoop.SolOut" '6L - Right Scoop
  62. SolCallback(7) = "SolLockRelease" '7L - Ball Lock
  63. SolCallback(8) = "SolKnocker" '8L - Knocker
  64. SolCallback(9) = "SetLamp 99," '09 - Flash Crane(x2) + Backbox Inserts(x2)
  65. 'SolCallback(10) '10 - L/R Relay
  66. SolCallback(11) = "SolGI" '11 - GI Relay
  67. SolCallback(12) = "SolDiv" '12 - Diverter
  68. SolCallback(13) = "SoLDrop" '13 - Drop Target
  69. 'SolCallback(14) '14 - Crane Motor
  70. SolCallback(15) = "bsMLScoop.SolOut" '15 - Middle Scoop
  71. 'SolCallback(16) '16 - Shaker Motor
  72. 'SolCallback(17) '17 - Left Bumper
  73. 'SolCallback(18) '18 - Center bumper
  74. 'SolCallback(19) '19 - Right bumper
  75. 'SolCallback(20) '20 - Left Slinghshot
  76. 'SolCallback(21) '21 - Right Slingshot
  77. SolCallback(22) = "SolRipperKick" '22 - Ripper Kickback
  78.  
  79. 'SolCallBack(25) '1R - Flash Topper Right Police(x4)
  80. SolCallBack(26) = "setlamp 92," '2R - Flash Playfield Upper Left(x3) + Backbox Insert
  81. SolCallback(27) = "SetLamp 93," '3R - Flash Ramp(x2) + Backbox Insert(x2)
  82. SolCallback(28) = "SetLamp 94," '4R - Flash Playfield Upper Right(x2) + Backbox Insert(x2)
  83. SolCallback(29) = "SetLamp 95," '5R - Flash Playfield Mid Right(x3) + Backbox Insert
  84. SolCallBack(30) = "setlamp 96," '6R - Flash Playfield Low Right(x4)
  85. 'SolCallBack(31) '7R - Flash Topper Left Police(x4)
  86. SolCallBack(32) = "setlamp 97," '8R - Flash Playfield Low Left + Backbox Insert(x2)
  87.  
  88. SolCallback(37) = "SolLeftMagnet" 'Left Magnet
  89. SolCallback(38) = "SolCenterMagnet" 'Center Magnet
  90. SolCallback(39) = "SolRightMagnet" 'Right Magnet
  91.  
  92.  
  93. '************
  94. ' Table init.
  95. '************
  96.  
  97. Const cGameName = "lah_112"
  98.  
  99. Dim plungerIM, bsTrough, mCrane, bsRScoop, bsVuk, bsMLScoop, dtLDrop, LMAG, RMAG, CMAG
  100.  
  101. Sub LastActionHero_Init
  102. vpmInit Me
  103. With Controller
  104. .GameName = cGameName
  105. If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  106. .SplashInfoLine = "Last Action Hero" & vbNewLine & "VPX table by Javier v1.0.0"
  107. .Games(cGameName).Settings.Value("rol") = 0
  108. .HandleKeyboard = 0
  109. .ShowTitle = 0
  110. .ShowDMDOnly = 1
  111. .ShowFrame = 0
  112. .HandleMechanics = 0
  113. .Hidden = 0
  114. On Error Resume Next
  115. .Run GetPlayerHWnd
  116. If Err Then MsgBox Err.Description
  117. On Error Goto 0
  118. End With
  119.  
  120. ' Nudging
  121. vpmNudge.TiltSwitch = 1
  122. vpmNudge.Sensitivity = 2
  123. vpmNudge.tiltobj = Array(LeftSlingShot,RightSlingShot,Bumper1b,Bumper2b,Bumper3b)
  124.  
  125. PinMAMETimer.Interval = PinMAMEInterval
  126. PinMAMETimer.Enabled = 1
  127.  
  128. 'Drain & BallRelease
  129. Set bsTrough = New cvpmTrough
  130. With bsTrough
  131. .Size = 6
  132. .InitSwitches Array(14, 13, 12, 11, 10, 9)
  133. .Initexit BallTrough, 90, 5
  134. .Balls = 6
  135. .InitExitSounds SoundFX("fx_trough",DOFContactors), SoundFX("fx_trough",DOFContactors)
  136. End With
  137.  
  138.  
  139. ' Impulse Plunger
  140. Const IMPowerSetting = 33 'Plunger Power
  141. Const IMTime = 0.6 ' Time in seconds for Full Plunge
  142. Set plungerIM = New cvpmImpulseP
  143. With plungerIM
  144. .InitImpulseP swplunger, IMPowerSetting, IMTime
  145. .Random 0.3
  146. .switch 16
  147. .InitExitSnd SoundFX("fx_plunger",DOFContactors), SoundFX("fx_plunger",DOFContactors)
  148. .CreateEvents "plungerIM"
  149. End With
  150.  
  151.  
  152. 'CaptiveBalls
  153. CapKicker1.CreateSizedBallWithMass Ballsize/2,BallMass
  154. CapKicker1.kick 0,1
  155. CapKicker1.enabled= 0
  156.  
  157. CapKicker2.CreateSizedBallWithMass Ballsize/2,BallMass
  158. CapKicker2.kick 0,1
  159. CapKicker2.enabled= 0
  160.  
  161. ' Crane
  162. set mCrane = new cvpmMech
  163. with mCrane
  164. .MType = vpmMechOneSol + vpmMechReverse + vpmMechNonlinear + vpmMechFast
  165. .Sol1 = 14
  166. .Length = CraneLenght
  167. .Steps = CraneSteps
  168. .addsw 60,0,2
  169. .addsw 61,135,138
  170. .Callback = GetRef("UpdateCrane")
  171. .Start
  172. End with
  173.  
  174. 'Middle Scoop Right
  175. Set bsRScoop =new cvpmTrough
  176. With bsRScoop
  177. .size = 4
  178. .initSwitches Array(31)
  179. .Initexit Sw31, 220, 24
  180. .InitExitSounds SoundFX("fx_Solenoid",DOFContactors), SoundFX("fx_popper",DOFContactors)
  181. .InitExitVariance 2, 2
  182. .MaxBallsPerKick = 1
  183. End With
  184.  
  185. ' Right Vuk
  186. Set bsVuk = New cvpmBallStack
  187. With bsVuk
  188. .InitSaucer sw47, 47, 176, 35
  189. .KickZ = 1.48
  190. .InitExitSnd "fx_vukout_LAH", SoundFX("fx_Solenoid",DOFContactors)
  191. End With
  192.  
  193. 'Middle Scoop Left
  194. Set bsMLScoop = New cvpmTrough
  195. With bsMLScoop
  196. .size = 4
  197. .initSwitches Array(57)
  198. .Initexit sw57, 172, 24
  199. .InitExitSounds SoundFX("fx_Solenoid",DOFContactors), SoundFX("fx_popper",DOFContactors)
  200. .InitExitVariance 2, 2
  201. .MaxBallsPerKick = 1
  202. End With
  203.  
  204. Set dtLDrop=New cvpmDropTarget
  205. With dtLDrop
  206. .InitDrop Array(sw17,sw18,sw19,sw20,sw21), Array(17,18,19,20,21)
  207. .InitSnd SoundFX("fx_droptarget",DOFContactors),SoundFX("fx_resetdrop",DOFContactors)
  208. End With
  209.  
  210. ' Left Magnet
  211. Set LMAG = New cvpmMagnet
  212. With LMAG
  213. .InitMagnet LMagnet, 11
  214. .CreateEvents "LMAG"
  215. End With
  216.  
  217. ' Right Magnet
  218. Set RMAG = New cvpmMagnet
  219. With RMAG
  220. .InitMagnet RMagnet, 11
  221. .CreateEvents "RMAG"
  222. End With
  223.  
  224. ' Center Magnet
  225. Set CMAG = New cvpmMagnet
  226. With CMAG
  227. .InitMagnet CMagnet, 11
  228. .CreateEvents "CMAG"
  229. End With
  230.  
  231. SolGi 0
  232.  
  233. End Sub
  234.  
  235. '*****************
  236. 'Trough,Drain and Release
  237. '*****************
  238.  
  239. Sub SolTrough(Enabled)
  240. If enabled Then
  241. bsTrough.ExitSol_On
  242. Controller.Switch(15) = 1
  243. End If
  244. End Sub
  245.  
  246. Sub SolRelease(Enabled)
  247. If enabled Then
  248. BallRelease.kick 90, 8
  249. Controller.Switch(15) = 0
  250. Playsound SoundFX("fx_ballrel",DOFContactors)
  251. End If
  252. End Sub
  253.  
  254. Sub Drain_Hit():PlaySound "fx_drain": BsTrough.AddBall Me:End Sub
  255.  
  256. '*****************
  257. 'Diverter
  258. '*****************
  259.  
  260. Sub SolDiv(Enabled)
  261. If Enabled Then
  262. DivOpen.IsDropped = 1
  263. DivClose.IsDropped = 0
  264. DiverterP.RotY = 15
  265. PlaySound SoundFX("fx_diverter",DOFContactors)
  266. Else
  267. DivClose.IsDropped = 1
  268. DivOpen.IsDropped = 0
  269. DiverterP.RotY = 60
  270. PlaySound SoundFX("fx_diverter",DOFContactors)
  271. End If
  272. End Sub
  273.  
  274. '*****************
  275. 'LockPost
  276. '*****************
  277. Sub SolLockRelease(enabled)
  278. If enabled and IgnorePostSol7 = 0 then
  279. PlaySound SoundFX("fx_diverter",DOFContactors)
  280. Post.isdropped = true
  281. LockReleaseTimer.Enabled = True
  282. End If
  283. End Sub
  284.  
  285. Sub LockReleaseTimer_Timer()
  286. PlaySound SoundFX("fx_diverter",DOFContactors)
  287. Post.IsDropped = False
  288. LockReleaseTimer.Enabled = False
  289. End Sub
  290.  
  291. '*****************
  292. 'AutoPlunger
  293. '*****************
  294.  
  295. Sub SolAutoPlungerIM(Enabled)
  296. If Enabled Then
  297. PlungerIM.AutoFire
  298. End If
  299. End Sub
  300.  
  301. '*****************
  302. 'Knocker
  303. '*****************
  304.  
  305. Sub SolKnocker(enabled)
  306. If enabled then Playsound SoundFX("fx_knocker",DOFKnocker)
  307. End Sub
  308.  
  309. '*****************
  310. 'Ripper Kickback
  311. '*****************
  312.  
  313. Sub SolRipperKick(enabled)
  314. If enabled then sw48.Kick 185,30
  315. End Sub
  316.  
  317. '*****************
  318. 'Crane Animation
  319. '*****************
  320.  
  321. Const Pi = 3.1415927
  322. Dim CraneBall
  323.  
  324. Sub UpdateCrane(aNewPos,aSpeed,aLastPos)
  325. StopSound"motor": PlaySound"motor"
  326. CraneTimer.Enabled = 1
  327. End Sub
  328.  
  329. Sub CraneTimer_Timer()
  330. If mCrane.position > gruap.RotY Then
  331. gruap.RotY = gruap.RotY +(cranesteps/CraneAnimationSteps)/5.1
  332. PinP.RotY = gruap.RotY
  333. End if
  334. if mCrane.position < gruap.roty Then
  335. gruap.roty = gruap.roty -(cranesteps/CraneAnimationSteps)/5.1
  336. PinP.RotY = gruap.RotY
  337. End if
  338. If Not IsEmpty(CraneBall) Then
  339. CraneBall.X=Sin((212-GruaP.RotY)*Pi/180)*80 + GruaP.x
  340. CraneBall.Y=Cos((32-GruaP.RotY)*Pi/180)*80 + GruaP.y
  341. CraneBall.Z=237
  342. End If
  343. If gruap.roty => 131 Then KickerRamp.Enabled = 1:Ramp_Grua.collidable=1
  344. If gruap.roty =< 130 Then KickerRamp.Enabled = 0:Ramp_Grua.collidable=0
  345. End Sub
  346.  
  347. Sub KickerRamp_Hit
  348. PinP.Z = 222
  349. Me.Kick 250,10
  350. PlaySound SoundFX("fx_diverter",DOFContactors)
  351. End Sub
  352.  
  353. Sub KickerBolaIn_Hit
  354. Me.DestroyBall
  355. Set CraneBall = KickerBolaIn.CreateSizedBallWithMass (Ballsize/2,BallMass)
  356. PinP.Z = 235
  357. PlaySound SoundFX("fx_diverter",DOFContactors)
  358. End Sub
  359.  
  360. Sub SolCraneLock(Enabled)
  361. If NOT Enabled AND Controller.Switch(60) Then
  362. If Not IsEmpty(CraneBall) Then
  363. PinP.Z = 222
  364. PlaySound SoundFX("fx_diverter",DOFContactors)
  365. KickerBolaIn.Kick 210,2
  366. CraneBall = Empty
  367. End If
  368. End If
  369. End Sub
  370.  
  371. Sub ExitCrane_UnHit: PinP.Z = 235 : PlaySound SoundFX("fx_diverter",DOFContactors): End Sub
  372.  
  373. '*****************
  374. 'Drop Target
  375. '*****************
  376. Sub SolDrop(enabled)
  377. if enabled then
  378. dtLDrop.DropSol_On
  379. end if
  380. End Sub
  381.  
  382. '*****************
  383. ' Magnets
  384. '*****************
  385.  
  386. Sub SolCenterMagnet(enabled)
  387. If enabled Then
  388. CMAG.MagnetOn = 1
  389. PlaySound SoundFX("fx_magnet",DOFShaker)
  390. Else
  391. CMAG.MagnetOn = 0
  392. End If
  393. End Sub
  394.  
  395. Sub SolLeftMagnet(enabled)
  396. If enabled Then
  397. LMAG.MagnetOn = 1
  398. PlaySound SoundFX("fx_magnet",DOFShaker)
  399. Else
  400. LMAG.MagnetOn = 0
  401. End If
  402. End Sub
  403.  
  404. Sub SolRightMagnet(enabled)
  405. If enabled Then
  406. RMAG.MagnetOn = 1
  407. PlaySound SoundFX("fx_magnet",DOFShaker)
  408. Else
  409. RMAG.MagnetOn = 0
  410. End If
  411. End Sub
  412.  
  413. '******************
  414. 'Keys Up and Down
  415. '*****************
  416.  
  417. Sub LastActionHero_KeyDown(ByVal Keycode)
  418. If keycode = plungerkey then controller.switch(8)=1 :controller.switch(62)=1
  419. If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25
  420. If keycode = RightTiltKey Then Nudge 270, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25
  421. If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25
  422. If vpmKeyDown(keycode) Then Exit Sub
  423. End Sub
  424.  
  425. Sub LastActionHero_KeyUp(ByVal Keycode)
  426. If keycode = plungerkey then controller.switch(8)=0 :controller.switch(62)=0
  427. If vpmKeyUp(keycode) Then Exit Sub
  428. End Sub
  429.  
  430.  
  431. '**************
  432. ' Flipper Subs
  433. '**************
  434.  
  435. SolCallback(sLRFlipper) = "SolRFlipper"
  436. SolCallback(sLLFlipper) = "SolLFlipper"
  437.  
  438. Sub SolLFlipper(Enabled)
  439.  
  440. If Enabled Then
  441. PlaySound SoundFX("fx_flipperup", DOFFlippers), 0, 1, -0.1, 0.15
  442. LeftFlipper.RotateToEnd
  443. Else
  444. PlaySound SoundFX("fx_flipperdown", DOFFlippers), 0, 1, -0.1, 0.15
  445. LeftFlipper.RotateToStart
  446. End If
  447. End Sub
  448.  
  449. Sub SolRFlipper(Enabled)
  450.  
  451. If Enabled Then
  452. PlaySound SoundFX("fx_flipperup", DOFFlippers), 0, 1, 0.1, 0.15
  453. RightFlipper.RotateToEnd
  454. Else
  455. PlaySound SoundFX("fx_flipperdown", DOFFlippers), 0, 1, 0.1, 0.15
  456. RightFlipper.RotateToStart
  457. End If
  458. End Sub
  459.  
  460. Sub LeftFlipper_Collide(parm)
  461. PlaySound "fx_rubber_flipper", 0, parm / 10, -0.1, 0.15
  462. End Sub
  463.  
  464. Sub Rightflipper_Collide(parm)
  465. PlaySound "fx_rubber_flipper", 0, parm / 10, 0.1, 0.15
  466. End Sub
  467.  
  468.  
  469. ' *********
  470. ' Switches
  471. ' *********
  472.  
  473. ' Slings & div switches
  474.  
  475. Dim LStep, RStep
  476.  
  477. Sub LeftSlingShot_Slingshot
  478. PlaySound SoundFX("fx_slingshot",DOFContactors), 0, 1, -0.05, 0.05
  479. LeftSling4.Visible = 1
  480. Lemk.RotX = 26
  481. LStep = 0
  482. vpmTimer.PulseSw 36
  483. LeftSlingShot.TimerEnabled = 1
  484. End Sub
  485.  
  486. Sub LeftSlingShot_Timer
  487. Select Case LStep
  488. Case 1:LeftSLing4.Visible = 0:LeftSLing3.Visible = 1:Lemk.RotX = 14
  489. Case 2:LeftSLing3.Visible = 0:LeftSLing2.Visible = 1:Lemk.RotX = 2
  490. Case 3:LeftSLing2.Visible = 0:Lemk.RotX = -10:LeftSlingShot.TimerEnabled = 0
  491. End Select
  492. LStep = LStep + 1
  493. End Sub
  494.  
  495. Sub RightSlingShot_Slingshot
  496. PlaySound SoundFX("fx_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  497. RightSling4.Visible = 1
  498. Remk.RotX = 26
  499. RStep = 0
  500. vpmTimer.PulseSw 37
  501. RightSlingShot.TimerEnabled = 1
  502. End Sub
  503.  
  504. Sub RightSlingShot_Timer
  505. Select Case RStep
  506. Case 1:RightSLing4.Visible = 0:RightSLing3.Visible = 1:Remk.RotX = 14
  507. Case 2:RightSLing3.Visible = 0:RightSLing2.Visible = 1:Remk.RotX = 2
  508. Case 3:RightSLing2.Visible = 0:Remk.RotX = -10:RightSlingShot.TimerEnabled = 0
  509. End Select
  510. RStep = RStep + 1
  511. End Sub
  512.  
  513.  
  514.  
  515. ' Bumpers
  516. Sub Bumper1b_Hit:vpmTimer.PulseSw 33:PlaySound SoundFX("fx_bumper",DOFContactors), 0, 1, 0.15, 0.15:End Sub
  517.  
  518. Sub Bumper2b_Hit:vpmTimer.PulseSw 35:PlaySound SoundFX("fx_bumper",DOFContactors), 0, 1, 0.15, 0.15:End Sub
  519.  
  520. Sub Bumper3b_Hit:vpmTimer.PulseSw 34:PlaySound SoundFX("fx_bumper",DOFContactors), 0, 1, 0.15, 0.15:End Sub
  521.  
  522.  
  523.  
  524. ' Targets
  525. Sub Sw17_Hit:dtLDrop.Hit 1:End Sub
  526. Sub Sw18_Hit:dtLDrop.Hit 2:End Sub
  527. Sub Sw19_Hit:dtLDrop.Hit 3:End Sub
  528. Sub Sw20_Hit:dtLDrop.Hit 4:End Sub
  529. Sub Sw21_Hit:dtLDrop.Hit 5:End Sub
  530.  
  531.  
  532. Dim IgnorePostSol7
  533. Sub Sw22_Hit: Controller.Switch(22) = 1:PostDebounceTimer.Enabled = 1:IgnorePostSol7=1:End Sub
  534. Sub Sw22_UnHit: Controller.Switch(22) = 0:End Sub
  535. Sub Sw23_Hit: Controller.Switch(23) = 1:PostDebounceTimer.Enabled = 1:IgnorePostSol7=1:End Sub
  536. Sub Sw23_UnHit: Controller.Switch(23) = 0:End Sub
  537. Sub PostDebounceTimer_Timer
  538. IgnorePostSol7 = 0
  539. PostDebounceTimer.Enabled = 0
  540. End Sub
  541.  
  542. Sub Sw24_Hit():Playsound "fx_sensor":Controller.Switch(24)=1: End Sub
  543. Sub Sw24_UnHit():Controller.Switch(24)=0: End Sub
  544.  
  545. Sub sw25_Hit:vpmTimer.PulseSw 25:PlaySound SoundFX("fx_target",DOFTargets):sw25p.transY = -10:Me.TimerEnabled = 1:End Sub
  546. Sub sw25_Timer:sw25p.transY = 0:Me.TimerEnabled = 0:End Sub
  547. Sub sw26_Hit:vpmTimer.PulseSw 26:PlaySound SoundFX("fx_target",DOFTargets):sw26p.transY = -10:Me.TimerEnabled = 1:End Sub
  548. Sub sw26_Timer:sw26p.transY = 0:Me.TimerEnabled = 0:End Sub
  549. Sub sw27_Hit:vpmTimer.PulseSw 27:PlaySound SoundFX("fx_target",DOFTargets):sw27p.transY = -10:Me.TimerEnabled = 1:End Sub
  550. Sub sw27_Timer:sw27p.transY = 0:Me.TimerEnabled = 0:End Sub
  551.  
  552. Sub Sw28_Hit():Playsound "fx_sensor":Controller.Switch(28)=1: End Sub
  553. Sub Sw28_UnHit():Controller.Switch(28)=0: End Sub
  554. Sub Sw29_Hit():Playsound "fx_sensor":Controller.Switch(29)=1: End Sub
  555. Sub Sw29_UnHit():Controller.Switch(29)=0: End Sub
  556. Sub Sw30_Hit():Playsound "fx_sensor":Controller.Switch(30)=1: End Sub
  557. Sub Sw30_UnHit():Controller.Switch(30)=0: End Sub
  558. Sub Sw32_Hit:vpmTimer.PulseSw 32:PlaySound SoundFX("fx_target",DOFTargets):End Sub
  559.  
  560. Sub Sw38_Hit():Playsound "fx_sensor":Controller.Switch(38)=1: End Sub
  561. Sub Sw38_UnHit():Controller.Switch(38)=0: End Sub
  562.  
  563. Sub Sw39_Hit():Playsound "fx_sensor":Controller.Switch(39)=1: End Sub
  564. Sub Sw39_UnHit():Controller.Switch(39)=0: End Sub
  565.  
  566. Sub Sw40_Hit:vpmTimer.PulseSw 40:PlaySound SoundFX("fx_target",DOFTargets):End sub
  567.  
  568. Sub Sw41_Hit():Playsound "fx_sensor":Controller.Switch(41)=1: End Sub
  569. Sub Sw41_UnHit():Controller.Switch(41)=0: End Sub
  570. Sub Sw42_Hit():Playsound "fx_sensor":Controller.Switch(42)=1: End Sub
  571. Sub Sw42_UnHit():Controller.Switch(42)=0: End Sub
  572. Sub Sw43_Hit():Playsound "fx_sensor":Controller.Switch(43)=1: End Sub
  573. Sub Sw43_UnHit():Controller.Switch(43)=0: End Sub
  574. Sub Sw44_Hit():Playsound "fx_sensor":Controller.Switch(44)=1: End Sub
  575. Sub Sw44_UnHit():Controller.Switch(44)=0: End Sub
  576.  
  577. Sub Sw45_Hit():Playsound "fx_sensor":Controller.Switch(45)=1 :End Sub
  578. Sub Sw45_UnHit():Controller.Switch(45)=0: End Sub
  579.  
  580. Sub Sw46_Hit()Controller.Switch(46)=1:PlaySound "Gate" End Sub
  581. Sub Sw46_UnHit()Controller.Switch(46)= 0 End Sub
  582.  
  583. 'Right Up Vuk
  584. Sub Sw47_hit:PlaySound "fx_kicker":bsVuk.AddBall 0:End Sub
  585.  
  586. Sub Sw48_Hit:vpmTimer.PulseSw 48 : PlaySound "bumper_retro":End Sub
  587.  
  588. Sub Sw54_Hit:vpmTimer.PulseSw 54:PlaySound "fx_chapa":End Sub
  589.  
  590. Sub Sw56_Hit:vpmTimer.PulseSw 56:PlaySound SoundFX("fx_target",DOFTargets):End Sub
  591.  
  592. 'Spinner
  593. Sub Sw59_Spin:vpmTimer.PulseSw 59:PlaySound "fx_gate" : End sub
  594.  
  595. 'Holes Animation
  596.  
  597. Dim cball,cball1,cball2
  598.  
  599. Sub sw31_Hit
  600. PlaySound "fx_hole-enter", 0, 1, pan(ActiveBall)
  601. Set cBall = ActiveBall
  602. Me.TimerEnabled = 1
  603. vpmTimer.AddTimer 200, "bsRScoop.AddBall"
  604. Me.Enabled = 0
  605. End Sub
  606.  
  607. Sub sw31_Timer
  608. Do While cBall.Z > 0
  609. cBall.Z = cBall.Z -5
  610. Exit Sub
  611. Loop
  612. Me.DestroyBall
  613. Me.TimerEnabled = 0
  614. Me.Enabled = 1
  615. End Sub
  616.  
  617. Sub sw57_Hit
  618. PlaySound "fx_hole-enter", 0, 1, pan(ActiveBall)
  619. Set cBall1 = ActiveBall
  620. Me.TimerEnabled = 1
  621. vpmTimer.AddTimer 300, "bsMLScoop.AddBall"
  622. Me.Enabled = 0
  623. End Sub
  624.  
  625. Sub sw57_Timer
  626. Do While cBall1.Z > 0
  627. cBall1.Z = cBall1.Z -5
  628. Exit Sub
  629. Loop
  630. Me.DestroyBall
  631. Me.TimerEnabled = 0
  632. Me.Enabled = 1
  633. End Sub
  634.  
  635. Sub sw58_Hit
  636. PlaySound "fx_hole-enter", 0, 1, pan(ActiveBall)
  637. Set cBall2 = ActiveBall
  638. Me.TimerEnabled = 1
  639. Me.Enabled = 0
  640. vpmtimer.pulseswitch 58,700,"bsMLScoop.AddBall"
  641. End Sub
  642.  
  643. Sub sw58_Timer
  644. Do While cBall2.Z > 0
  645. cBall2.Z = cBall2.Z -5
  646. Exit Sub
  647. Loop
  648. Me.DestroyBall
  649. Me.TimerEnabled = 0
  650. Me.Enabled = 1
  651. End Sub
  652.  
  653.  
  654. '***************************************************
  655. ' JP's VP10 Fading Lamps & Flashers
  656. ' Based on PD's Fading Light System
  657. ' SetLamp 0 is Off
  658. ' SetLamp 1 is On
  659. ' fading for non opacity objects is 4 steps
  660. '***************************************************
  661.  
  662. Dim LampState(200), FadingLevel(200)
  663. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  664.  
  665. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  666. LampTimer.Interval = 20 'lamp fading speed
  667. LampTimer.Enabled = 1
  668.  
  669. ' Lamp & Flasher Timers
  670.  
  671. Sub LampTimer_Timer()
  672. Dim chgLamp, num, chg, ii
  673. chgLamp = Controller.ChangedLamps
  674. If Not IsEmpty(chgLamp) Then
  675. For ii = 0 To UBound(chgLamp)
  676. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  677. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  678. Next
  679. End If
  680. UpdateLamps
  681. End Sub
  682.  
  683. Sub InitLamps()
  684. Dim x
  685. For x = 0 to 200
  686. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  687. FadingLevel(x) = 4 ' used to track the fading state
  688. FlashSpeedUp(x) = 0.5 ' faster speed when turning on the flasher
  689. FlashSpeedDown(x) = 0.35 ' slower speed when turning off the flasher
  690. FlashMax(x) = 1 ' the maximum value when on, usually 1
  691. FlashMin(x) = 0 ' the minimum value when off, usually 0
  692. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  693. Next
  694. End Sub
  695.  
  696.  
  697.  
  698. Sub UpdateLamps
  699. nFadeL 1, Light1
  700. nFadeL 2, Light2
  701. nFadeL 3, Light3
  702. nFadeL 4, Light4
  703. nFadeL 5, Light5
  704. NFadeLm 6, l6
  705. nFadeLm 6, l6a
  706. NFadeLm 7, l7
  707. nFadeLm 7, l7a
  708. NFadeLm 8, l8
  709. nFadeLm 8, l8a
  710. nFadeL 9, Light9
  711. nFadeL 10, Light10
  712. nFadeL 11, Light11
  713. nFadeL 12, Light12
  714. nFadeL 13, Light13
  715. nFadeL 14, Light14
  716. nFadeL 15, Light15
  717. nFadeL 16, Light16
  718. nFadeL 17, Light17
  719. nFadeL 18, Light18
  720. nFadeL 19, Light19
  721. nFadeL 20, Light20
  722. nFadeL 21, Light21
  723. nFadeL 22, Light22
  724. Flash 23, Light23
  725. nFadeL 24, Light24
  726. nFadeL 25, Light25
  727. nFadeL 26, Light26
  728. nFadeL 27, Light27
  729. nFadeL 28, Light28
  730. nFadeL 29, Light29
  731. nFadeL 30, Light30
  732. nFadeLm 31, Light31
  733. NFadeLm 31, Light31b
  734. nFadeL 32, Light32
  735. nFadeL 33, Light33
  736. nFadeL 34, Light34
  737. nFadeL 35, Light35
  738. nFadeL 36, Light36
  739. nFadeL 37, Light37
  740. nFadeL 38, Light38
  741. nFadeL 39, Light39
  742. NFadeLm 40, Light40
  743. nFadeLm 40, Light40b
  744. nFadeL 41, Light41
  745. nFadeL 42, Light42
  746. NFadeLm 43, Light43
  747. nFadeLm 43, Light43b
  748. nFadeL 44, Light44
  749. nFadeL 45, Light45
  750. nFadeL 46, Light46
  751. nFadeL 47, Light47
  752. Flash 48, Light48
  753. nFadeL 49, Light49
  754. Flash 50, Light50
  755. Flash 51, Light51
  756. Flash 52, Light52
  757. Flash 53, Light53
  758. Flash 54, Light54
  759. NFadeL 55, Light55
  760. Flash 56, Light56
  761. NFadeL 57, Light57
  762. NFadeL 58, Light58
  763. NFadeL 59, Light59
  764. NFadeL 60, Light60
  765. NFadeL 61, Light61
  766. NFadeL 62, Light62
  767. NFadeL 63, Light63
  768. 'Flashers
  769. NFadeLm 92, f2
  770. NFadeLm 92, f2a
  771. NFadeLm 92, f2b
  772. NFadeLm 93, f3
  773. NFadeLm 93, f3a
  774. NFadeLm 93, f3b
  775. NFadeLm 93, f3c
  776. Flashm 93, f3d
  777. Flashm 93, f3r
  778. Flash 93, f3r1
  779. NFadeLm 94, f4
  780. NFadeLm 94, f4a
  781. NFadeLm 94, f4b
  782. NFadeLm 94, f4c
  783. Flashm 94, f4r
  784. Flash 94, f4r1
  785. NFadeL 95, f5
  786. NFadeLm 96, f6
  787. NFadeLm 96, f6a
  788. NFadeLm 96, f6b
  789. NFadeLm 96, f6c
  790. NFadeLm 96, f6d
  791. NFadeLm 96, f6e
  792. Flashm 96, f6f
  793. Flash 96, f6r
  794. FadeObj 99, GruaP, "CraneTEXTUREMAP_on", "CraneTEXTUREMAP_a", "CraneTEXTUREMAP_b", "CraneTEXTUREMAPFinal"
  795. NFadeL 97, f7
  796. End Sub
  797.  
  798.  
  799.  
  800. Sub SetLamp(nr, value)
  801. If value <> LampState(nr) Then
  802. LampState(nr) = abs(value)
  803. FadingLevel(nr) = abs(value) + 4
  804. End If
  805. End Sub
  806.  
  807. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  808.  
  809. Sub NFadeL(nr, object)
  810. Select Case FadingLevel(nr)
  811. Case 4:object.state = 0:FadingLevel(nr) = 0
  812. Case 5:object.state = 1:FadingLevel(nr) = 1
  813. End Select
  814. End Sub
  815.  
  816. Sub NFadeLm(nr, object) ' used for multiple lights
  817. Select Case FadingLevel(nr)
  818. Case 4:object.state = 0
  819. Case 5:object.state = 1
  820. End Select
  821. End Sub
  822.  
  823. 'Lights, Ramps & Primitives used as 4 step fading lights
  824. 'a,b,c,d are the images used from on to off
  825.  
  826. Sub FadeObj(nr, object, a, b, c, d)
  827. Select Case FadingLevel(nr)
  828. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  829. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  830. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  831. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  832. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  833. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  834. End Select
  835. End Sub
  836.  
  837. Sub FadeObjm(nr, object, a, b, c, d)
  838. Select Case FadingLevel(nr)
  839. Case 4:object.image = b
  840. Case 5:object.image = a
  841. Case 9:object.image = c
  842. Case 13:object.image = d
  843. End Select
  844. End Sub
  845.  
  846. Sub NFadeObj(nr, object, a, b)
  847. Select Case FadingLevel(nr)
  848. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  849. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  850. End Select
  851. End Sub
  852.  
  853. Sub NFadeObjm(nr, object, a, b)
  854. Select Case FadingLevel(nr)
  855. Case 4:object.image = b
  856. Case 5:object.image = a
  857. End Select
  858. End Sub
  859.  
  860. ' Flasher objects
  861.  
  862. Sub Flash(nr, object)
  863. Select Case FadingLevel(nr)
  864. Case 4 'off
  865. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  866. If FlashLevel(nr) < FlashMin(nr) Then
  867. FlashLevel(nr) = FlashMin(nr)
  868. FadingLevel(nr) = 0 'completely off
  869. End if
  870. Object.IntensityScale = FlashLevel(nr)
  871. Case 5 ' on
  872. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  873. If FlashLevel(nr) > FlashMax(nr) Then
  874. FlashLevel(nr) = FlashMax(nr)
  875. FadingLevel(nr) = 1 'completely on
  876. End if
  877. Object.IntensityScale = FlashLevel(nr)
  878. End Select
  879. End Sub
  880.  
  881. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  882. Object.IntensityScale = FlashLevel(nr)
  883. End Sub
  884.  
  885. '******************
  886. ' G. I.
  887. '******************
  888.  
  889. Dim x
  890.  
  891. Sub SolGi(enabled)
  892. If enabled Then
  893. For each x in aGiLights: x.State = 0: Next
  894. gi34.intensityscale=0
  895. Playsound "fx_relay_off"
  896. LastActionHero.ColorGradeImage = "ColorGrade_off"
  897. Else
  898. For each x in aGiLights: x.State = 1: Next
  899. gi34.intensityscale=1
  900. Playsound "fx_relay_on"
  901. LastActionHero.ColorGradeImage = "ColorGrade_on"
  902. End If
  903. End Sub
  904.  
  905. '******************
  906. ' RealTime Updates
  907. '******************
  908.  
  909. Set MotorCallback = GetRef("RealTimeUpdates")
  910.  
  911. Sub RealTimeUpdates
  912. RollingSound()
  913. LFLogo.RotY = LeftFlipper.CurrentAngle
  914. RFlogo.RotY = RightFlipper.CurrentAngle
  915. End Sub
  916.  
  917.  
  918. '******************************************************
  919. '* JP's VP10 Supporting Ball & Sound Functions ********
  920. '******************************************************
  921.  
  922. Function RndNum(min,max)
  923. RndNum = Int(Rnd()*(max-min+1))+min ' Sets a random number between min and max
  924. End Function
  925.  
  926. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  927. Vol = Csng(BallVel(ball) ^2 / 5)
  928. End Function
  929.  
  930. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table.
  931. Dim tmp ' "table1" is the name of the table
  932. tmp = ball.x * 2 / LastActionHero.width-1
  933. If tmp> 0 Then
  934. Pan = Csng(tmp ^10)
  935. Else
  936. Pan = Csng(-((- tmp) ^10) )
  937. End If
  938. End Function
  939.  
  940. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  941. Pitch = BallVel(ball) * 20
  942. End Function
  943.  
  944. Function BallVel(ball) 'Calculates the ball speed
  945. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  946. End Function
  947.  
  948. '******************************************************
  949. '* JP's VP10 COLLISION & ROLLING SOUNDS ***************
  950. '******************************************************
  951.  
  952. Const tnob = 8 ' total number of balls
  953.  
  954. ReDim rolling(tnob)
  955. InitRolling
  956.  
  957. Sub InitRolling
  958. Dim i
  959. For i = 0 to tnob
  960. rolling(i) = False
  961. Next
  962. End Sub
  963.  
  964. Sub RollingSound()
  965. Dim BOT, b
  966. BOT = GetBalls
  967.  
  968. ' stop the sound of deleted balls
  969. For b = UBound(BOT) + 1 to tnob
  970. rolling(b) = False
  971. StopSound("fx_ballrolling" & b)
  972. Next
  973.  
  974. ' exit the sub if no balls on the table
  975. If UBound(BOT) = -1 Then Exit Sub
  976.  
  977. ' play the rolling sound for each ball
  978. For b = 0 to UBound(BOT)
  979. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  980. rolling(b) = True
  981. PlaySound("fx_ballrolling" & b), -1, (Vol(BOT(b) )) *500, Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  982. Else
  983. If rolling(b) = True Then
  984. StopSound("fx_ballrolling" & b)
  985. rolling(b) = False
  986. End If
  987. End If
  988. Next
  989. End Sub
  990.  
  991. Sub OnBallBallCollision(ball1, ball2, velocity)
  992. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 500, Pan(ball1), 0, Pitch(ball1), 0, 0
  993. End Sub
  994.  
  995. '******************************************************
  996. '* SOUND EFFECTS **************************************
  997. '******************************************************
  998.  
  999. Sub aGates_Hit (idx)
  1000. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1001. End Sub
  1002.  
  1003. Sub cRubbers_Hit(idx)
  1004. dim finalspeed
  1005. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1006. If finalspeed > 20 then
  1007. PlaySound "fx_rubber", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1008. End if
  1009. If finalspeed >= 6 AND finalspeed <= 20 then
  1010. RandomSoundRubber()
  1011. End If
  1012. End Sub
  1013.  
  1014.  
  1015. Sub RRampFX_Hit:PlaySound "fx_rampL":End Sub
  1016. Sub RRampFX1_Hit:PlaySound "fx_rampR":End Sub
  1017. Sub LRampFX_Hit:PlaySound "fx_rampL":End Sub
  1018.  
  1019. Sub RailEndTrigger2_Hit
  1020. stopsound "fx_metalrolling"
  1021. vpmTimer.AddTimer 250, "BallHitSound"
  1022. End Sub
  1023.  
  1024. Sub RailEndTrigger1_Hit
  1025. vpmTimer.AddTimer 250, "BallHitSound"
  1026. End Sub
  1027.  
  1028. Sub BallHitSound(dummy):PlaySound "fx_ballrampdrop":End Sub
  1029.  
  1030. Sub RandomSoundRubber()
  1031. Select Case Int(Rnd*3)+1
  1032. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1033. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1034. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1035. End Select
  1036. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement