Arngrim

lotr soundfx

Jun 9th, 2017
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.54 KB | None | 0 0
  1. ' The Lord of the Rings / IPD No. 4858 / October, 2003 / 4 Players
  2. ' VPX version by jpsalas
  3.  
  4. Option Explicit
  5. Randomize
  6.  
  7. On Error Resume Next
  8. ExecuteGlobal GetTextFile("controller.vbs")
  9. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  10. On Error Goto 0
  11.  
  12. Const BallSize = 50
  13.  
  14. Dim VarHidden, UseVPMColoredDMD
  15. If Table1.ShowDT = true then
  16. UseVPMColoredDMD = true
  17. VarHidden = 1
  18. else
  19. UseVPMColoredDMD = False
  20. VarHidden = 0
  21. TextBox1.Visible = 0
  22. end if
  23.  
  24. LoadVPM "01560000", "SEGA.VBS", 3.26
  25.  
  26. '********************
  27. 'Standard definitions
  28. '********************
  29.  
  30. Const UseSolenoids = 1
  31. Const UseLamps = 0
  32. Const UseGI = 0
  33. Const UseSync = 0
  34. Const HandleMech = 0
  35.  
  36. ' Standard Sounds
  37. Const SSolenoidOn = "fx_Solenoid"
  38. Const SSolenoidOff = ""
  39. Const SCoin = "fx_Coin"
  40.  
  41. Dim x, i, j, k 'used in loops
  42. Dim bsTrough, bsL, bsR, bsTR, bsTL, vlLock, mRingMagnet, plungerIM
  43.  
  44. '************
  45. ' Table init.
  46. '************
  47.  
  48. ' choose the ROM
  49. Const cGameName = "lotr" 'USA
  50. 'Const cGameName = "lotr_fr" 'France
  51. 'Const cGameName = "lotr_gr" 'Germany
  52. 'Const cGameName = "lotr_it" 'Italy
  53. 'Const cGameName = "lotr_sp" 'Spain
  54.  
  55.  
  56. Sub Table1_Init
  57. vpmInit Me
  58. With Controller
  59. .GameName = cGameName
  60. .Games(cGameName).Settings.Value("sound") = 1 'ensure the sound is on
  61. If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  62. .SplashInfoLine = "The Lord of the Rings - Stern 2003" & vbNewLine & "VPX table by JPSalas v1.0.2"
  63. .Games(cGameName).Settings.Value("rol") = 0
  64. .HandleKeyboard = 0
  65. .ShowTitle = 0
  66. .ShowDMDOnly = 1
  67. .ShowFrame = 0
  68. .HandleMechanics = 0
  69. .Hidden = VarHidden
  70. On Error Resume Next
  71. .Run GetPlayerHWnd
  72. If Err Then MsgBox Err.Description
  73.  
  74. On Error Goto 0
  75. End With
  76.  
  77. ' Nudging
  78. vpmNudge.TiltSwitch = 56
  79. vpmNudge.Sensitivity = 1
  80. vpmNudge.TiltObj = Array(bumper1, bumper2, bumper3, LeftSlingshot, RightSlingshot)
  81.  
  82. ' Trough
  83. Set bsTrough = New cvpmBallStack
  84. With bsTrough
  85. .InitSw 0, 14, 13, 12, 11, 0, 0, 0
  86. .InitKick BallRelease, 90, 3
  87. .InitEntrySnd "fx_Solenoid", "fx_Solenoid"
  88. .InitExitSnd SoundFX("fx_ballrel",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
  89. .Balls = 4
  90. End With
  91.  
  92. ' Left vuk
  93. Set bsL = New cvpmBallStack
  94. With bsL
  95. .InitSaucer sw9, 9, 0, 30
  96. .KickZ = 1.56
  97. .InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
  98. End With
  99.  
  100. ' Right vuk
  101. Set bsR = New cvpmBallStack
  102. With bsR
  103. .InitSaucer sw30, 30, 0, 30
  104. .KickZ = 1.56
  105. .InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
  106. End With
  107.  
  108. ' Top Right Saucer
  109. Set bsTR = New cvpmBallStack
  110. With bsTR
  111. .InitSaucer sw46, 46, 270, 3
  112. .KickForceVar = 2
  113. .InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_popper",DOFContactors)
  114. End With
  115.  
  116. ' Top Left vuk
  117. Set bsTL = New cvpmBallStack
  118. With bsTL
  119. .InitSw 0, 41, 0, 0, 0, 0, 0, 0
  120. .InitKick sw41, 270, 6
  121. .InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
  122. .KickForceVar = 2
  123. End With
  124.  
  125. ' Visible Lock - implements post ball lock
  126. Set vlLock = New cvpmVLock
  127. With vlLock
  128. .InitVLock Array(sw19, sw18, sw17), Array(sw19k, sw18k, sw17k), Array(19, 18, 17)
  129. .InitSnd "fx_sensor", "fx_sensor"
  130. .CreateEvents "vlLock"
  131. End With
  132.  
  133. ' Impulse Plunger - used as the autoplunger
  134. Const IMPowerSetting = 60 ' Plunger Power
  135. Const IMTime = 0.7 ' Time in seconds for Full Plunge
  136. Set plungerIM = New cvpmImpulseP
  137. With plungerIM
  138. .InitImpulseP swPlunger, IMPowerSetting, IMTime
  139. .Random 0.3
  140. .switch 16
  141. .InitExitSnd "fx_kicker", "fx_kicker"
  142. .CreateEvents "plungerIM"
  143. End With
  144.  
  145. Set mRingMagnet = New cvpmMagnet
  146. With mRingMagnet
  147. .InitMagnet sw47a, 30
  148. .GrabCenter = True
  149. .solenoid = 6 'Ring Magnet
  150. .CreateEvents "mRingMagnet"
  151. End With
  152.  
  153. ' Main Timer init
  154. PinMAMETimer.Interval = PinMAMEInterval
  155. PinMAMETimer.Enabled = 1
  156.  
  157. ' Div Init
  158. OrbitPin.IsDropped = 1
  159. SolBalrog 0
  160. End Sub
  161.  
  162. Sub table1_Paused:Controller.Pause = 1:End Sub
  163. Sub table1_unPaused:Controller.Pause = 0:End Sub
  164.  
  165. '****************
  166. ' Handle Options
  167. '****************
  168.  
  169. Sub JPLOTRSetOptions
  170. End Sub
  171.  
  172. '**********
  173. ' Keys
  174. '**********
  175.  
  176. Sub table1_KeyDown(ByVal Keycode)
  177. If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound SoundFX("fx_nudge",0), 0, 1, -0.1, 0.25
  178. If keycode = RightTiltKey Then Nudge 270, 5:PlaySound SoundFX("fx_nudge",0), 0, 1, 0.1, 0.25
  179. If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge",0), 0, 1, 0, 0.25
  180. If keycode = PlungerKey Then PlaySound "fx_PlungerPull", 0, 1, 0.1, 0.25:Plunger.Pullback
  181. If KeyDownHandler(KeyCode)Then Exit Sub
  182. End Sub
  183.  
  184. Sub table1_KeyUp(ByVal Keycode)
  185. If KeyUpHandler(KeyCode)Then Exit Sub
  186. If keycode = PlungerKey Then PlaySound "fx_plunger", 0, 1, 0.1, 0.25:Plunger.Fire
  187. End Sub
  188.  
  189. '*********
  190. ' Switches
  191. '*********
  192.  
  193. ' Slings & div switches
  194.  
  195. Dim LStep, RStep
  196.  
  197. Sub LeftSlingShot_Slingshot
  198. PlaySound SoundFX("fx_slingshot",DOFContactors), 0, 1, -0.05, 0.05
  199. LeftSling4.Visible = 1
  200. Lemk.RotX = 26
  201. LStep = 0
  202. vpmTimer.PulseSw 59
  203. LeftSlingShot.TimerEnabled = 1
  204. End Sub
  205.  
  206. Sub LeftSlingShot_Timer
  207. Select Case LStep
  208. Case 1:LeftSLing4.Visible = 0:LeftSLing3.Visible = 1:Lemk.RotX = 14
  209. Case 2:LeftSLing3.Visible = 0:LeftSLing2.Visible = 1:Lemk.RotX = 2
  210. Case 3:LeftSLing2.Visible = 0:Lemk.RotX = -10:LeftSlingShot.TimerEnabled = 0
  211. End Select
  212. LStep = LStep + 1
  213. End Sub
  214.  
  215. Sub RightSlingShot_Slingshot
  216. PlaySound SoundFX("fx_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  217. RightSling4.Visible = 1
  218. Remk.RotX = 26
  219. RStep = 0
  220. vpmTimer.PulseSw 62
  221. RightSlingShot.TimerEnabled = 1
  222. End Sub
  223.  
  224. Sub RightSlingShot_Timer
  225. Select Case RStep
  226. Case 1:RightSLing4.Visible = 0:RightSLing3.Visible = 1:Remk.RotX = 14
  227. Case 2:RightSLing3.Visible = 0:RightSLing2.Visible = 1:Remk.RotX = 2
  228. Case 3:RightSLing2.Visible = 0:Remk.RotX = -10:RightSlingShot.TimerEnabled = 0
  229. End Select
  230. RStep = RStep + 1
  231. End Sub
  232.  
  233. ' Bumpers
  234. Sub Bumper1_Hit:vpmTimer.PulseSw 49:PlaySound SoundFX("fx_bumper",DOFContactors), 0, 1, 0.15, 0.15:End Sub
  235. Sub Bumper2_Hit:vpmTimer.PulseSw 50:PlaySound SoundFX("fx_bumper",DOFContactors), 0, 1, 0.15, 0.15:End Sub
  236. Sub Bumper3_Hit:vpmTimer.PulseSw 51:PlaySound SoundFX("fx_bumper",DOFContactors), 0, 1, 0.15, 0.15:End Sub
  237.  
  238. ' Drain holes, vuks & saucers
  239. Sub Drain_Hit:Playsound "fx_drain":bsTrough.AddBall Me:End Sub
  240. Sub sw9_Hit:Playsound "fx_kicker_enter":bsL.AddBall 0:End Sub
  241. Sub sw30_Hit:Playsound "fx_kicker_enter":bsR.AddBall 0:End Sub
  242. Sub sw41a_Hit:Playsound "fx_hole-enter":bsTL.AddBall Me:End Sub
  243. Sub sw41b_Hit:Playsound "fx_hole-enter":bsTL.AddBall Me:End Sub
  244. Sub sw41c_Hit:Playsound "fx_hole-enter":bsTL.AddBall Me:End Sub
  245. Sub sw41d_Hit:Playsound "fx_hole-enter":bsTL.AddBall Me:End Sub
  246. Sub sw46_Hit:Playsound "fx_kicker_enter":bsTR.AddBall 0:End Sub
  247.  
  248. ' Rollovers & Ramp Switches
  249. Sub sw57_Hit:Controller.Switch(57) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  250. Sub sw57_UnHit:Controller.Switch(57) = 0:End Sub
  251.  
  252. Sub sw58_Hit:Controller.Switch(58) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  253. Sub sw58_UnHit:Controller.Switch(58) = 0:End Sub
  254.  
  255. Sub sw60_Hit:Controller.Switch(60) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  256. Sub sw60_Unhit:Controller.Switch(60) = 0:End Sub
  257.  
  258. Sub sw61_Hit:Controller.Switch(61) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  259. Sub sw61_Unhit:Controller.Switch(61) = 0:End Sub
  260.  
  261. Sub sw20_Hit:Controller.Switch(20) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  262. Sub sw20_UnHit:Controller.Switch(20) = 0:End Sub
  263.  
  264. Sub sw21_Hit:Controller.Switch(21) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  265. Sub sw21_Unhit:Controller.Switch(21) = 0:End Sub
  266.  
  267. Sub sw43_Hit:Controller.Switch(43) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  268. Sub sw43_Unhit:Controller.Switch(43) = 0:End Sub
  269.  
  270. Sub sw44_Hit:Controller.Switch(44) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  271. Sub sw44_Unhit:Controller.Switch(44) = 0:End Sub
  272.  
  273. Sub sw45_Hit:Controller.Switch(45) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  274. Sub sw45_Unhit:Controller.Switch(45) = 0:End Sub
  275.  
  276. Sub sw37_Hit:Controller.Switch(37) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  277. Sub sw37_Unhit:Controller.Switch(37) = 0:End Sub
  278.  
  279. Sub sw38_Hit:Controller.Switch(38) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  280. Sub sw38_Unhit:Controller.Switch(38) = 0:End Sub
  281.  
  282. Sub sw39_Hit:Controller.Switch(39) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  283. Sub sw39_Unhit:Controller.Switch(39) = 0:End Sub
  284.  
  285. Sub sw33_Hit:Controller.Switch(33) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  286. Sub sw33_Unhit:Controller.Switch(33) = 0:End Sub
  287.  
  288. Sub sw34_Hit:Controller.Switch(34) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  289. Sub sw34_Unhit:Controller.Switch(34) = 0:End Sub
  290.  
  291. Sub sw35_Hit:Controller.Switch(35) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  292. Sub sw35_Unhit:Controller.Switch(35) = 0:End Sub
  293.  
  294. Sub sw36_Hit:Controller.Switch(36) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  295. Sub sw36_Unhit:Controller.Switch(36) = 0:End Sub
  296.  
  297. Sub sw40_Hit:Controller.Switch(40) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  298. Sub sw40_Unhit:Controller.Switch(40) = 0:PlaySound "fx_metalrolling", 0, 1, -0.15, 0.25:End Sub
  299.  
  300. Sub sw42_Hit:Controller.Switch(42) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  301. Sub sw42_Unhit:Controller.Switch(42) = 0:End Sub
  302.  
  303. Sub sw24_Hit:Controller.Switch(24) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  304. Sub sw24_Unhit:Controller.Switch(24) = 0:End Sub
  305.  
  306. Sub sw22_Hit:Controller.Switch(22) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  307. Sub sw22_Unhit:Controller.Switch(22) = 0:StopSound "fx_metalrolling":PlaySound "fx_metalrolling", 0, 1, 0.15, 0.25:End Sub
  308.  
  309. Sub sw48_Hit:Controller.Switch(48) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):PlaySound "fx_metallrolling", 0, 1, pan(ActiveBall):End Sub
  310. Sub sw48_Unhit:Controller.Switch(48) = 0:ActiveBall.VelX = 3:End Sub
  311.  
  312. Sub sw16_Hit:Controller.Switch(16) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall):End Sub
  313. Sub sw16_Unhit:Controller.Switch(16) = 0:End Sub
  314.  
  315. Sub sw25_Hit:Controller.Switch(25) = 1:End Sub
  316. Sub sw25_Unhit:Controller.Switch(25) = 0:End Sub
  317.  
  318. Sub sw47_Hit:Controller.Switch(47) = 1:End Sub
  319. Sub sw47_Unhit:Controller.Switch(47) = 0:End Sub
  320.  
  321. ' Targets
  322. Sub sw10_Hit:vpmTimer.PulseSw 10:PlaySound SoundFX("fx_target",DOFTargets), 0, 1, pan(ActiveBall):End Sub
  323.  
  324. Sub sw23_Hit:vpmTimer.PulseSw 23:PlaySound SoundFX("fx_target",DOFTargets), 0, 1, pan(ActiveBall):End Sub
  325.  
  326. Sub sw28_Collide(parm):vpmTimer.PulseSw 28:PlaySound SoundFX("fx_target",DOFTargets):End Sub
  327.  
  328. Sub sw29_Hit:vpmTimer.PulseSw 29:PlaySound SoundFX("fx_target",DOFTargets), 0, 1, pan(ActiveBall):End Sub
  329.  
  330. Sub sw53_Hit:vpmTimer.PulseSw 53:PlaySound SoundFX("fx_target",DOFTargets), 0, 1, pan(ActiveBall):End Sub
  331.  
  332. Sub sw52_Spin():vpmTimer.PulseSw 52:PlaySound "fx_spinner":End Sub
  333.  
  334. ' lock post
  335.  
  336. Sub lock1_Hit:lock.Isdropped = 1:End Sub
  337. Sub lock1_UnHit:lock.Isdropped = 0:End Sub
  338.  
  339. '*********
  340. 'Solenoids
  341. '*********
  342.  
  343. SolCallBack(1) = "SolRelease"
  344. SolCallBack(2) = "Auto_Plunger"
  345. SolCallback(3) = "bsL.SolOut"
  346. SolCallback(4) = "bsTL.SolOut"
  347. SolCallback(5) = "bsR.SolOut"
  348. ' SolCallback(6) = "SolRingMagnet"
  349. SolCallback(7) = "SolTower"
  350. SolCallback(8) = "SolDiv"
  351. ' 9 left bumper
  352. '10 right bumper
  353. '11 bottom bumper
  354. '12 not used
  355. SolCallback(13) = "SolOrbit"
  356. SolCallback(14) = "SetLamp 114,"
  357. '15 left flipper
  358. '16 right flipper
  359. '17 left slingshot
  360. '18 right slingshot
  361. SolCallBack(19) = "bsTR.SolOut"
  362. '20 balrog motor relay
  363. SolCallBack(21) = "SolLockRelease"
  364. SolCallBack(22) = "SolBalrog"
  365. SolCallBack(23) = "SetLamp 123,"
  366. SolCallBack(24) = "vpmsolsound SoundFX(""fx_knocker"",DOFKnocker),"
  367. SolCallBack(25) = "SetLamp 125,"
  368. SolCallBack(26) = "SetLamp 126,"
  369. SolCallBack(27) = "SetLamp 127,"
  370. '28 not used
  371. SolCallBack(29) = "SetLamp 129,"
  372. SolCallBack(30) = "SetLamp 130,"
  373. SolCallBack(31) = "SetLamp 131,"
  374. SolCallBack(32) = "SetLamp 132,"
  375.  
  376. Sub Auto_Plunger(Enabled)
  377. If Enabled Then
  378. PlungerIM.AutoFire
  379. End If
  380. End Sub
  381.  
  382. Sub SolLockRelease(enabled)
  383. vlLock.SolExit enabled
  384. End Sub
  385.  
  386. Sub SolRelease(Enabled)
  387. If Enabled And bsTrough.Balls > 0 Then
  388. bsTrough.ExitSol_On
  389. vpmTimer.PulseSw 15
  390. End If
  391. End Sub
  392.  
  393. Sub SolOrbit(Enabled):OrbitPin.IsDropped = NOT Enabled:End Sub
  394.  
  395. '********************
  396. ' Flippers
  397. '********************
  398.  
  399. SolCallback(sLRFlipper) = "SolRFlipper"
  400. SolCallback(sLLFlipper) = "SolLFlipper"
  401.  
  402. Sub SolLFlipper(Enabled)
  403. If Enabled Then
  404. PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, 1, -0.1, 0.25
  405. LeftFlipper.RotateToEnd
  406. Else
  407. PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, -0.1, 0.25
  408. LeftFlipper.RotateToStart
  409. End If
  410. End Sub
  411.  
  412. Sub SolRFlipper(Enabled)
  413. If Enabled Then
  414. PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, 1, 0.1, 0.25
  415. RightFlipper.RotateToEnd
  416. Else
  417. PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, 0.1, 0.25
  418. RightFlipper.RotateToStart
  419. End If
  420. End Sub
  421.  
  422. Sub LeftFlipper_Collide(parm)
  423. PlaySound "fx_rubber_flipper", 0, parm / 10, -0.1, 0.25
  424. End Sub
  425.  
  426. Sub RightFlipper_Collide(parm)
  427. PlaySound "fx_rubber_flipper", 0, parm / 10, 0.1, 0.25
  428. End Sub
  429.  
  430. '************************
  431. ' Tower animation
  432. '************************
  433.  
  434. Sub SolTower(Enabled)
  435. If Enabled Then
  436. TowerFlipper.RotateToEnd
  437. Else
  438. TowerFlipper.RotateToStart
  439. End If
  440. End Sub
  441.  
  442. '************************
  443. ' Diverter animation
  444. '************************
  445.  
  446. Sub SolDiv(Enabled)
  447. If Enabled Then
  448. DiverterFlipper.RotateToEnd
  449. Else
  450. DiverterFlipper.RotateToStart
  451. End If
  452. End Sub
  453.  
  454. '************************
  455. ' Balrog Animation
  456. '************************
  457.  
  458. Dim BalrogDir
  459. BalrogDir = 0
  460.  
  461. Sub SolBalrog(Enabled)
  462. If Enabled Then
  463. If BalrogDir = 0 Then
  464. Controller.Switch(32) = 0
  465. Controller.Switch(31) = 1
  466. sw28.RotateToStart
  467. BalrogDir = 1
  468. Else
  469. Controller.Switch(31) = 0
  470. Controller.Switch(32) = 1
  471. sw28.RotateToEnd
  472. BalrogDir = 0
  473. End If
  474. End If
  475. End Sub
  476.  
  477. '***************************************************
  478. ' JP's VP10 Fading Lamps & Flashers
  479. ' Based on PD's Fading Light System
  480. ' SetLamp 0 is Off
  481. ' SetLamp 1 is On
  482. ' fading for non opacity objects is 4 steps
  483. '***************************************************
  484.  
  485. Dim LampState(200), FadingLevel(200)
  486. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200), FlashRepeat(200)
  487.  
  488. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  489. LampTimer.Interval = 10 'lamp fading speed
  490. LampTimer.Enabled = 1
  491.  
  492. ' Lamp & Flasher Timers
  493.  
  494. Sub LampTimer_Timer()
  495. Dim chgLamp, num, chg, ii
  496. chgLamp = Controller.ChangedLamps
  497. If Not IsEmpty(chgLamp)Then
  498. For ii = 0 To UBound(chgLamp)
  499. LampState(chgLamp(ii, 0)) = chgLamp(ii, 1) 'keep the real state in an array
  500. FadingLevel(chgLamp(ii, 0)) = chgLamp(ii, 1) + 4 'actual fading step
  501. Next
  502. End If
  503. UpdateLamps
  504. End Sub
  505.  
  506. Sub UpdateLamps
  507. NFadeLm 1, l1
  508. Flashm 1, l1b
  509. Flash 1, l1a
  510. NFadeL 2, l2
  511. NFadeL 3, l3
  512. NFadeL 4, l4
  513. NFadeL 5, l5
  514. NFadeL 6, l6
  515. NFadeL 7, l7
  516. NFadeL 8, l8
  517. NFadeL 9, l9
  518. NFadeL 10, l10
  519. NFadeL 11, l11
  520. NFadeL 12, l12
  521. NFadeL 13, l13
  522. NFadeL 14, l14
  523. NFadeL 15, l15
  524. NFadeL 16, l16
  525. NFadeL 17, l17
  526. NFadeL 18, l18
  527. NFadeL 19, l19
  528. NFadeL 20, l20
  529. NFadeL 21, l21
  530. NFadeL 22, l22
  531. NFadeLm 23, l23
  532. FadeObj 23, globe, "globe_on", "globe_a", "globe_b", "globe"
  533.  
  534. NFadeL 24, l24
  535. NFadeL 25, l25
  536. NFadeL 26, l26
  537. NFadeL 27, l27
  538. NFadeL 28, l28
  539. NFadeL 29, l29
  540. NFadeL 30, l30
  541. NFadeL 31, l31
  542. NFadeL 32, l32
  543. NFadeL 33, l33
  544. NFadeL 34, l34
  545. NFadeL 35, l35
  546. NFadeL 36, l36
  547. NFadeL 37, l37
  548. NFadeL 38, l38
  549. NFadeL 39, l39
  550. NFadeL 40, l40
  551. NFadeL 41, l41
  552. NFadeL 42, l42
  553. NFadeL 43, l43
  554. NFadeL 44, l44
  555. NFadeL 45, l45
  556. NFadeL 46, l46
  557. NFadeL 47, l47
  558. NFadeL 48, l48
  559. NFadeL 49, l49
  560. NFadeL 50, l50
  561. NFadeL 51, l51
  562. NFadeL 52, l52
  563. NFadeL 53, l53
  564. NFadeL 54, l54
  565. NFadeL 55, l55
  566. NFadeL 56, l56
  567. NFadeL 57, l57
  568. NFadeL 58, l58
  569. NFadeL 59, l59
  570. Flashm 60, l60a
  571. Flash 60, l60
  572. Flash 61, l61
  573. Flashm 62, l62a
  574. Flash 62, l62
  575. Flash 63, l63
  576. NFadeLm 64, l64
  577. Flash 64, l64a
  578. NFadeLm 65, l65
  579. Flash 65, l65a
  580. NFadeLm 66, l66
  581. Flash 66, l66a
  582. NFadeLm 67, l67
  583. Flash 67, l67a
  584. NFadeLm 68, l68
  585. Flash 68, l68a
  586. NFadeLm 69, l69
  587. Flash 69, l69a
  588. NFadeLm 70, l70
  589. Flash 70, l70a
  590. NFadeLm 71, l71
  591. Flash 71, l71a
  592. NFadeLm 72, l72
  593. Flash 72, l72a
  594. Flash 73, l73
  595. Flash 74, l74
  596. Flash 75, l75
  597. Flash 76, l76
  598. Flash 77, l77
  599. Flash 78, l78
  600. 'NFadeL 79, l79
  601. 'NFadeL 80, l80
  602. NFadeL 81, l81
  603. NFadeL 82, l82
  604. NFadeL 83, l83
  605. NFadeL 84, l84
  606. NFadeL 85, l85
  607. NFadeL 86, l86
  608. NFadeL 87, l87
  609. NFadeL 88, l88
  610. NFadeL 89, l89
  611. NFadeL 90, l90
  612. NFadeL 91, l91
  613. NFadeL 92, l92
  614. NFadeL 93, l93
  615. NFadeL 94, l94
  616. NFadeL 95, l95
  617. NFadeL 96, l96
  618. NFadeL 97, l97
  619. NFadeL 98, l98
  620. NFadeL 99, l99
  621.  
  622. 'flashers
  623. Flash 114, f14
  624. Flash 123, f23
  625. Flashm 125, f25a
  626. Flashm 125, f25b
  627. Flash 125, f25c
  628. Flash 126, f26
  629. Flashm 127, f27a
  630. Flash 127, f27b
  631. Flashm 129, f29a
  632. Flash 129, f29b
  633. NFadeL 130, f30
  634. Flash 131, f31
  635. 'NFadeL 132, f32
  636. FadeObj 132, balrog, "balrog_on", "balrog_a", "balrog_b", "balrog"
  637. End Sub
  638.  
  639. ' div lamp subs
  640.  
  641. Sub InitLamps()
  642. Dim x
  643. For x = 0 to 200
  644. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  645. FadingLevel(x) = 4 ' used to track the fading state
  646. FlashSpeedUp(x) = 0.2 ' faster speed when turning on the flasher
  647. FlashSpeedDown(x) = 0.1 ' slower speed when turning off the flasher
  648. FlashMax(x) = 1 ' the maximum value when on, usually 1
  649. FlashMin(x) = 0 ' the minimum value when off, usually 0
  650. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  651. FlashRepeat(x) = 20 ' how many times the flash repeats
  652. Next
  653. End Sub
  654.  
  655. Sub AllLampsOff
  656. Dim x
  657. For x = 0 to 200
  658. SetLamp x, 0
  659. Next
  660. End Sub
  661.  
  662. Sub SetLamp(nr, value)
  663. If value <> LampState(nr)Then
  664. LampState(nr) = abs(value)
  665. FadingLevel(nr) = abs(value) + 4
  666. End If
  667. End Sub
  668.  
  669. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  670.  
  671. Sub NFadeL(nr, object)
  672. Select Case FadingLevel(nr)
  673. Case 4:object.state = 0:FadingLevel(nr) = 0
  674. Case 5:object.state = 1:FadingLevel(nr) = 1
  675. End Select
  676. End Sub
  677.  
  678. Sub NFadeLm(nr, object) ' used for multiple lights
  679. Select Case FadingLevel(nr)
  680. Case 4:object.state = 0
  681. Case 5:object.state = 1
  682. End Select
  683. End Sub
  684.  
  685. 'Lights, Ramps & Primitives used as 4 step fading lights
  686. 'a,b,c,d are the images used from on to off
  687.  
  688. Sub FadeObj(nr, object, a, b, c, d)
  689. Select Case FadingLevel(nr)
  690. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  691. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  692. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  693. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  694. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  695. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  696. End Select
  697. End Sub
  698.  
  699. Sub FadeObjm(nr, object, a, b, c, d)
  700. Select Case FadingLevel(nr)
  701. Case 4:object.image = b
  702. Case 5:object.image = a
  703. Case 9:object.image = c
  704. Case 13:object.image = d
  705. End Select
  706. End Sub
  707.  
  708. Sub NFadeObj(nr, object, a, b)
  709. Select Case FadingLevel(nr)
  710. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  711. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  712. End Select
  713. End Sub
  714.  
  715. Sub NFadeObjm(nr, object, a, b)
  716. Select Case FadingLevel(nr)
  717. Case 4:object.image = b
  718. Case 5:object.image = a
  719. End Select
  720. End Sub
  721.  
  722. ' Flasher objects
  723.  
  724. Sub Flash(nr, object)
  725. Select Case FadingLevel(nr)
  726. Case 4 'off
  727. FlashLevel(nr) = FlashLevel(nr)- FlashSpeedDown(nr)
  728. If FlashLevel(nr) < FlashMin(nr)Then
  729. FlashLevel(nr) = FlashMin(nr)
  730. FadingLevel(nr) = 0 'completely off
  731. End if
  732. Object.IntensityScale = FlashLevel(nr)
  733. Case 5 ' on
  734. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  735. If FlashLevel(nr) > FlashMax(nr)Then
  736. FlashLevel(nr) = FlashMax(nr)
  737. FadingLevel(nr) = 1 'completely on
  738. End if
  739. Object.IntensityScale = FlashLevel(nr)
  740. End Select
  741. End Sub
  742.  
  743. Sub Flashm(nr, object) 'multiple flashers, it doesn't change anything, it just follows the main flasher
  744. Select Case FadingLevel(nr)
  745. Case 4, 5
  746. Object.IntensityScale = FlashLevel(nr)
  747. End Select
  748. End Sub
  749.  
  750. Sub FlashBlink(nr, object)
  751. Select Case FadingLevel(nr)
  752. Case 4 'off
  753. FlashLevel(nr) = FlashLevel(nr)- FlashSpeedDown(nr)
  754. If FlashLevel(nr) < FlashMin(nr)Then
  755. FlashLevel(nr) = FlashMin(nr)
  756. FadingLevel(nr) = 0 'completely off
  757. End if
  758. Object.IntensityScale = FlashLevel(nr)
  759. If FadingLevel(nr) = 0 AND FlashRepeat(nr)Then 'repeat the flash
  760. FlashRepeat(nr) = FlashRepeat(nr)-1
  761. If FlashRepeat(nr)Then FadingLevel(nr) = 5
  762. End If
  763. Case 5 ' on
  764. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  765. If FlashLevel(nr) > FlashMax(nr)Then
  766. FlashLevel(nr) = FlashMax(nr)
  767. FadingLevel(nr) = 1 'completely on
  768. End if
  769. Object.IntensityScale = FlashLevel(nr)
  770. If FadingLevel(nr) = 1 AND FlashRepeat(nr)Then FadingLevel(nr) = 4
  771. End Select
  772. End Sub
  773.  
  774. ' Desktop Objects: Reels & texts (you may also use lights on the desktop)
  775.  
  776. ' Reels
  777.  
  778. Sub FadeR(nr, object)
  779. Select Case FadingLevel(nr)
  780. Case 4:object.SetValue 1:FadingLevel(nr) = 6 'fading to off...
  781. Case 5:object.SetValue 0:FadingLevel(nr) = 1 'ON
  782. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  783. Case 9:object.SetValue 2:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  784. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  785. Case 13:object.SetValue 3:FadingLevel(nr) = 0 'Off
  786. End Select
  787. End Sub
  788.  
  789. Sub FadeRm(nr, object)
  790. Select Case FadingLevel(nr)
  791. Case 4:object.SetValue 1
  792. Case 5:object.SetValue 0
  793. Case 9:object.SetValue 2
  794. Case 3:object.SetValue 3
  795. End Select
  796. End Sub
  797.  
  798. 'Texts
  799.  
  800. Sub NFadeT(nr, object, message)
  801. Select Case FadingLevel(nr)
  802. Case 4:object.Text = "":FadingLevel(nr) = 0
  803. Case 5:object.Text = message:FadingLevel(nr) = 1
  804. End Select
  805. End Sub
  806.  
  807. Sub NFadeTm(nr, object, b)
  808. Select Case FadingLevel(nr)
  809. Case 4:object.Text = ""
  810. Case 5:object.Text = message
  811. End Select
  812. End Sub
  813.  
  814. '******************************
  815. ' Diverse Collection Hit Sounds
  816. '******************************
  817.  
  818. Sub aMetal_Wires_Hit(idx):PlaySound "fx_MetalHit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  819. Sub aMetal_Lanes_Hit(idx):PlaySound "fx_MetalHit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  820. Sub aMetal_Guides_Hit(idx):PlaySound "fx_MetalHit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  821. Sub aRubber_Bands_Hit(idx):PlaySound "fx_rubber_band", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  822. Sub aRubber_Posts_Hit(idx):PlaySound "fx_rubber", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  823. Sub aRubber_Pins_Hit(idx):PlaySound "fx_postrubber", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  824. Sub aRubber_Thin_Posts_Hit(idx):PlaySound "fx_postrubber", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  825. Sub aPlastics_Hit(idx):PlaySound "fx_PlasticHit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  826. Sub aGates_Hit(idx):PlaySound "fx_Gate", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  827. Sub aWoods_Hit(idx):PlaySound "fx_Woodhit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  828.  
  829. Sub sw_Hit:PlaySound "fx_metalrolling", 0, 1, 0.15, 0.25:End Sub
  830.  
  831. ' Ramp Soundss & Help triggers
  832. Sub REnd1_Hit()
  833. StopSound "fx_metalrolling"
  834. PlaySound "fx_ballrampdrop", 0, 1, pan(ActiveBall)
  835. End Sub
  836.  
  837. Sub REnd2_Hit()
  838. StopSound "fx_metalrolling"
  839. PlaySound "fx_ballrampdrop", 0, 1, pan(ActiveBall)
  840. End Sub
  841.  
  842. ' *********************************************************************
  843. ' Supporting Ball & Sound Functions
  844. ' *********************************************************************
  845.  
  846. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  847. Vol = Csng(BallVel(ball) ^2 / 2000)
  848. End Function
  849.  
  850. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  851. Dim tmp
  852. tmp = ball.x * 2 / table1.width-1
  853. If tmp > 0 Then
  854. Pan = Csng(tmp ^10)
  855. Else
  856. Pan = Csng(-((- tmp) ^10))
  857. End If
  858. End Function
  859.  
  860. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  861. Pitch = BallVel(ball) * 20
  862. End Function
  863.  
  864. Function BallVel(ball) 'Calculates the ball speed
  865. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2)))
  866. End Function
  867.  
  868. '*****************************************
  869. ' JP's VP10 Rolling Sounds
  870. '*****************************************
  871.  
  872. Const tnob = 5 ' total number of balls in this table is 4, but always use a higher number here because of the timing
  873. ReDim rolling(tnob)
  874. InitRolling
  875.  
  876. Sub InitRolling
  877. Dim i
  878. For i = 0 to tnob
  879. rolling(i) = False
  880. Next
  881. End Sub
  882.  
  883. Sub RollingUpdate()
  884. Dim BOT, b
  885. BOT = GetBalls
  886.  
  887. ' stop the sound of deleted balls
  888. For b = UBound(BOT) + 1 to tnob
  889. rolling(b) = False
  890. StopSound("fx_ballrolling" & b)
  891. Next
  892.  
  893. ' exit the sub if no balls on the table
  894. If UBound(BOT) = -1 Then Exit Sub
  895.  
  896. ' play the rolling sound for each ball
  897. For b = 0 to UBound(BOT)
  898. If BallVel(BOT(b)) > 1 AND BOT(b).z < 30 Then
  899. rolling(b) = True
  900. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), Pan(BOT(b)), 0, Pitch(BOT(b)), 1, 0
  901. Else
  902. If rolling(b) = True Then
  903. StopSound("fx_ballrolling" & b)
  904. rolling(b) = False
  905. End If
  906. End If
  907. Next
  908. End Sub
  909.  
  910. '**********************
  911. ' Ball Collision Sound
  912. '**********************
  913.  
  914. Sub OnBallBallCollision(ball1, ball2, velocity)
  915. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  916. End Sub
  917.  
  918. '******************
  919. ' RealTime Updates
  920. '******************
  921.  
  922. Set MotorCallback = GetRef("RealTimeUpdates")
  923.  
  924. Sub RealTimeUpdates
  925. RollingUpdate
  926. Diverter.RotZ = DiverterFlipper.CurrentAngle
  927. Balrog.RotZ = sw28.CurrentAngle
  928. Tower.RotX = TowerFlipper.CurrentAngle
  929. End Sub
  930.  
  931. '*************************
  932. ' GI - needs new vpinmame
  933. '*************************
  934.  
  935. Set GICallback = GetRef("GIUpdate")
  936.  
  937. Sub GIUpdate(no, Enabled)
  938. For each x in aGiLights
  939. x.State = ABS(Enabled)
  940. Next
  941. For each x in aGiFlashers
  942. x.visible = Enabled
  943. Next
  944. End Sub
Advertisement
Add Comment
Please, Sign In to add comment