Arngrim

IM Willem Controller.vbs

Feb 7th, 2017
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.79 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. LoadVPM "01560000", "sam.VBS", 3.10
  10.  
  11. '********************
  12. 'Standard definitions
  13. '********************
  14.  
  15. Const cGameName = "im_183ve"
  16.  
  17. Const UseSolenoids = 1
  18. Const UseLamps = 0
  19. Const UseSync = 0
  20. Const HandleMech = 1
  21. Const SSolenoidOn = "Solenoid"
  22. Const SSolenoidOff = ""
  23. Const SCoin = "CoinIn"
  24.  
  25. '************
  26. ' Table init.
  27. '************
  28.  
  29. Dim xx
  30. Dim Bump1, Bump2, Bump3, Mech3bank,bsTrough,bsRHole,DTBank4,turntable,Mag1,Mag2
  31. Dim PlungerIM
  32.  
  33. Sub Table_Init
  34. With Controller
  35. .GameName = cGameName
  36. If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  37. .SplashInfoLine = "IronMan (Stern 2010)"
  38. .HandleKeyboard = 0
  39. .ShowTitle = 0
  40. .ShowDMDOnly = 1
  41. .ShowFrame = 0
  42. .HandleMechanics = 0
  43. .Hidden = 0
  44. On Error Resume Next
  45. .Run GetPlayerHWnd
  46. If Err Then MsgBox Err.Description
  47. End With
  48.  
  49. On Error Goto 0
  50.  
  51. 'Trough
  52. Set bsTrough = New cvpmBallStack
  53. bsTrough.InitSw 0, 21, 20, 19, 18, 0, 0, 0
  54. bsTrough.InitKick BallRelease, 90, 8
  55. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  56. bsTrough.Balls = 4
  57.  
  58. Set mag1= New cvpmMagnet
  59. With mag1
  60. .InitMagnet Magnet1, 22
  61. .GrabCenter = False
  62. .solenoid=3
  63. .CreateEvents "mag1"
  64. End With
  65.  
  66. Set mag2= New cvpmMagnet
  67. With mag2
  68. .InitMagnet Magnet2, 22
  69. .GrabCenter = False
  70. .solenoid=4
  71. .CreateEvents "mag2"
  72. End With
  73.  
  74.  
  75. 'Nudging
  76. vpmNudge.TiltSwitch=-7
  77. vpmNudge.Sensitivity=1
  78. vpmNudge.TiltObj=Array(Bumper1b,Bumper2b,Bumper3b,LeftSlingshot,RightSlingshot)
  79.  
  80. 'DropTargets
  81.  
  82. '**Main Timer init
  83. PinMAMETimer.Interval = PinMAMEInterval
  84. PinMAMETimer.Enabled = 1
  85.  
  86. 'StandUp Init
  87. ResetAll
  88.  
  89. End Sub
  90.  
  91. Sub Table_Paused:Controller.Pause = 1:End Sub
  92. Sub Table_unPaused:Controller.Pause = 0:End Sub
  93.  
  94.  
  95.  
  96. '*****Keys
  97. Sub Table_KeyDown(ByVal keycode)
  98.  
  99. If Keycode = LeftFlipperKey then
  100. End If
  101. If Keycode = RightFlipperKey then
  102. End If
  103. If keycode = PlungerKey Then Plunger.Pullback
  104. ' If keycode = LeftTiltKey Then LeftNudge 80, 1, 20
  105. ' If keycode = RightTiltKey Then RightNudge 280, 1, 20
  106. ' If keycode = CenterTiltKey Then CenterNudge 0, 1, 25
  107. If vpmKeyDown(keycode) Then Exit Sub
  108.  
  109. End Sub
  110.  
  111. Sub Table_KeyUp(ByVal keycode)
  112. If vpmKeyUp(keycode) Then Exit Sub
  113. If Keycode = LeftFlipperKey then
  114. SolLFlipper false
  115. End If
  116. If Keycode = RightFlipperKey then
  117. SolRFlipper False
  118. End If
  119. If Keycode = StartGameKey Then Controller.Switch(16) = 0
  120. If keycode = PlungerKey Then
  121. Plunger.Fire
  122. PlaySound "Plunger"
  123. End If
  124. End Sub
  125.  
  126.  
  127. 'Solenoids
  128. SolCallback(1) = "solTrough"
  129. SolCallback(2) = "solAutofire"
  130. 'SolCallback(3) = "MongerMagnet"
  131. 'SolCallback(4) = whiplash magnet
  132. SolCallback(5) = "WMKick"
  133. SolCallback(6) = "orbitpost"
  134. SolCallback(12) = "ClanePost"
  135. SolCallback(15) = "SolLFlipper"
  136. SolCallback(16) = "SolRFlipper"
  137. SolCallback(19) = "Solmonger"
  138. SolCallBack(20) = "SetLamp 120,"
  139. SolCallback(21) = "SetLamp 121,"
  140. SolCallback(22) = "SetLamp 122,"
  141. 'SolCallback(23) = "SetLamp 123,"
  142. 'SolCallback(25) = "SetLamp 125,"
  143. SolCallback(26) = "SetLamp 126,"
  144. SolCallback(27) = "SetLamp 127,"
  145. SolCallback(29) = "SetLamp 129,"
  146. 'SolCallback(30) =
  147. SolCallback(31) = "SetLamp 131,"
  148. SolCallback(32) = "SetLamp 132,"
  149.  
  150.  
  151. Sub solTrough(Enabled)
  152. If Enabled Then
  153. bsTrough.ExitSol_On
  154. vpmTimer.PulseSw 22
  155. End If
  156. End Sub
  157.  
  158. Sub solAutofire(Enabled)
  159. If Enabled Then
  160. PlungerIM.AutoFire
  161. End If
  162. End Sub
  163.  
  164. Sub ClanePost(Enabled)
  165. If Enabled Then
  166. ClaneUpPost.Isdropped=false
  167. Else
  168. ClaneUpPost.Isdropped=true
  169. End If
  170. End Sub
  171.  
  172. Sub orbitpost(Enabled)
  173. If Enabled Then
  174. UpPost.Isdropped=false
  175. Else
  176. UpPost.Isdropped=true
  177. End If
  178. End Sub
  179.  
  180. Sub ClanePost(Enabled)
  181. If Enabled Then
  182. ClaneUpPost.Isdropped=false
  183. Else
  184. ClaneUpPost.Isdropped=true
  185. End If
  186. End Sub
  187.  
  188. Sub WMKick(enabled)
  189. If enabled Then
  190. PlaySound "ballhit"
  191. sw10.Kick 180, 30
  192. controller.switch(10) = false
  193. End If
  194. End Sub
  195.  
  196. '***********************************************
  197. 'Flipper Subs
  198.  
  199.  
  200.  
  201. Sub SolLFlipper(Enabled)
  202. If Enabled Then
  203. PlaySound SoundFX("FlipperUpLeft",DOFFlippers)
  204. LeftFlipper.RotateToEnd
  205. Else
  206. PlaySound SoundFX("FlipperDown",DOFFlippers)
  207. LeftFlipper.RotateToStart
  208. End If
  209. End Sub
  210.  
  211. Sub SolRFlipper(Enabled)
  212. If Enabled Then
  213. PlaySound SoundFX("FlipperUpRight",DOFFlippers)
  214. RightFlipper.RotateToEnd
  215. Else
  216. PlaySound SoundFX("FlipperDown",DOFFlippers)
  217. RightFlipper.RotateToStart
  218. End If
  219. End Sub
  220.  
  221. 'Drains and Kickers
  222. Dim BallCount:BallCount = 0
  223. Sub Drain_Hit():PlaySound "Drain"
  224. 'ClearBallID
  225. BallCount = BallCount - 1
  226. bsTrough.AddBall Me
  227. If BallCount = 0 then GIOff
  228. End Sub
  229. Sub BallRelease_UnHit()
  230. 'NewBallID
  231. BallCount = BallCount + 1
  232. GIOn
  233. End Sub
  234.  
  235.  
  236.  
  237. 'Switches
  238.  
  239. '1 monger down
  240. '3 monger up
  241. '4 monger left shoulder
  242. '5 monger legs
  243. Sub sw5_Hit:vpmTimer.PulseSw 5:PlaySound SoundFX("target",DOFTargets):End Sub
  244. '6 monger rt shoulder
  245.  
  246. Sub sw7_Hit:Controller.Switch(7) = 1:PlaySound "rollover":End Sub
  247. Sub sw7_UnHit:Controller.Switch(7) = 0:End Sub
  248. Sub sw9_Hit:Controller.Switch(9) = 1:PlaySound "rollover":End Sub
  249. Sub sw9_UnHit:Controller.Switch(9) = 0:End Sub
  250. Sub sw10_Hit():controller.switch(10)=true:End Sub
  251. Sub sw11_Spin:vpmTimer.PulseSw 11::playsound"fx_spinner":End Sub
  252. Sub sw12_Hit:Controller.Switch(12) = 1:End Sub
  253. Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
  254. Sub sw13_Spin:vpmTimer.PulseSw 13::playsound"fx_spinner":End Sub
  255. Sub sw14_Spin:vpmTimer.PulseSw 14::playsound"fx_spinner":End Sub
  256. Sub sw23_Hit:Playsound "rollover":Controller.Switch(23)=1:End Sub
  257. Sub sw23_UnHit:Playsound "rollover":Controller.Switch(23)=0:End Sub
  258. Sub sw24_Hit:Controller.Switch(24) = 1:PlaySound "rollover":End Sub
  259. Sub sw24_UnHit:Controller.Switch(24) = 0:End Sub
  260. Sub sw25_Hit:Controller.Switch(25) = 1:PlaySound "rollover":End Sub
  261. Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
  262. Sub sw28_Hit:Controller.Switch(28) = 1:PlaySound "rollover":End Sub
  263. Sub sw28_UnHit:Controller.Switch(28) = 0:End Sub
  264. Sub sw29_Hit:Controller.Switch(29) = 1:PlaySound "rollover":End Sub
  265. Sub sw29_UnHit:Controller.Switch(29) = 0:End Sub
  266. Sub sw33_Hit:vpmTimer.PulseSw 33:PlaySound SoundFX("target",DOFTargets):End Sub
  267. 'Sub sw33_Timer:sw33.IsDropped = 0:sw33a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  268. Sub sw34_Hit:vpmTimer.PulseSw 34:PlaySound SoundFX("target",DOFTargets):End Sub
  269. 'Sub sw34_Timer:sw34.IsDropped = 0:sw34a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  270. Sub sw35_Hit:vpmTimer.PulseSw 35:PlaySound SoundFX("target",DOFTargets):End Sub
  271. 'Sub sw35_Timer:sw35.IsDropped = 0:sw35a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  272. Sub sw36_Hit:vpmTimer.PulseSw 36:PlaySound SoundFX("target",DOFTargets):End Sub
  273. 'Sub sw36_Timer:sw36.IsDropped = 0:sw36a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  274. Sub sw37_Hit:Controller.Switch(37) = 1:PlaySound "Gate":RightCount = RightCount + 1:End Sub
  275. Sub sw37_UnHit:Controller.Switch(37) = 0:End Sub
  276. Sub sw38_Hit:Controller.Switch(38) = 1:PlaySound "rollover":End Sub
  277. Sub sw38_UnHit:Controller.Switch(38) = 0:End Sub
  278. Sub sw39_Hit:Controller.Switch(39) = 1:PlaySound "rollover":End Sub
  279. Sub sw39_UnHit:Controller.Switch(39) = 0:End Sub
  280. Sub sw40_Hit:vpmTimer.PulseSw 40:PlaySound SoundFX("target",DOFTargets):End Sub
  281. 'Sub sw40_Timer:sw40.IsDropped = 0:sw40a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  282. Sub sw41_Hit:vpmTimer.PulseSw 41:PlaySound SoundFX("target",DOFTargets):End Sub
  283. 'Sub sw41_Timer:sw41.IsDropped = 0:sw41a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  284. Sub sw42_Hit:vpmTimer.PulseSw 42:PlaySound SoundFX("target",DOFTargets):End Sub
  285. 'Sub sw42_Timer:sw42.IsDropped = 0:sw42a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  286. Sub sw44_Hit:vpmTimer.PulseSw 44:PlaySound SoundFX("target",DOFTargets):End Sub
  287. Sub sw43_Hit:Controller.Switch(43) = 1:End Sub
  288. Sub sw43_UnHit:Controller.Switch(43) = 0:End Sub
  289. 'Sub sw44_Timer:sw44.IsDropped = 0:sw44a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  290. Sub sw45_Hit:vpmTimer.PulseSw 45:PlaySound SoundFX("target",DOFTargets):End Sub
  291. 'Sub sw45_Timer:sw45.IsDropped = 0:sw45a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  292. Sub sw46_Hit:vpmTimer.PulseSw 46:PlaySound SoundFX("target",DOFTargets):End Sub
  293. 'Sub sw46_Timer:sw46.IsDropped = 0:sw46a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  294. Sub sw47_Hit:vpmTimer.PulseSw 47:PlaySound SoundFX("target",DOFTargets):End Sub
  295. 'Sub sw47_Timer:sw47.IsDropped = 0:sw47a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  296. Sub sw48_Hit:vpmTimer.PulseSw 48:PlaySound SoundFX("target",DOFTargets):End Sub
  297. 'Sub sw48_Timer:sw48.IsDropped = 0:sw48a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  298. Sub sw49_Hit:Controller.Switch(49) = 1:PlaySound "Gate":LeftCount = LeftCount + 1:End Sub
  299. Sub sw49_UnHit:Controller.Switch(49) = 0:End Sub
  300. Sub sw50_Hit:vpmTimer.PulseSw 50:PlaySound SoundFX("target",DOFTargets):End Sub
  301. 'Sub sw50_Timer:sw50.IsDropped = 0:sw50a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  302.  
  303.  
  304.  
  305.  
  306. Sub ResetAll()
  307. ClaneUpPost.Isdropped=true:UpPost.Isdropped=true
  308. mongerhitpoint.isdropped=1:sw5.isdropped=1
  309. End Sub
  310.  
  311. '***Slings and rubbers
  312. ' Slings
  313. Dim LStep, RStep
  314.  
  315. Sub LeftSlingShot_Slingshot
  316. vpmTimer.PulseSw 26
  317. PlaySound SoundFX("left_slingshot",DOFContactors)
  318. Me.TimerEnabled = 1
  319. End Sub
  320.  
  321. Sub LeftSlingShot_Timer
  322.  
  323. End Sub
  324.  
  325. Sub RightSlingShot_Slingshot
  326. vpmTimer.PulseSw 27
  327. PlaySound SoundFX("right_slingshot",DOFContactors)
  328. Me.TimerEnabled = 1
  329. End Sub
  330.  
  331. Sub RightSlingShot_Timer
  332.  
  333. End Sub
  334.  
  335.  
  336. ' Impulse Plunger
  337. Const IMPowerSetting = 50
  338. Const IMTime = 0.6
  339. Set plungerIM = New cvpmImpulseP
  340. With plungerIM
  341. .InitImpulseP swplunger, IMPowerSetting, IMTime
  342. .Random 0.3
  343. .InitExitSnd "plunger2", "plunger"
  344. .CreateEvents "plungerIM"
  345. End With
  346.  
  347. 'Bumpers
  348. Sub Bumper1b_Hit
  349. vpmTimer.PulseSw 31
  350. PlaySound SoundFX("fx_bumper1",DOFContactors)
  351. End Sub
  352.  
  353.  
  354. Sub Bumper2b_Hit
  355. vpmTimer.PulseSw 30
  356. PlaySound SoundFX("fx_bumper1",DOFContactors)
  357. End Sub
  358.  
  359. Sub Bumper3b_Hit
  360. vpmTimer.PulseSw 32
  361. PlaySound SoundFX("fx_bumper1",DOFContactors)
  362. End Sub
  363.  
  364. Dim LampState(200), FadingLevel(200), FadingState(200)
  365. Dim FlashState(200), FlashLevel(200)
  366. Dim FlashSpeedUp, FlashSpeedDown
  367. Dim x
  368.  
  369. AllLampsOff()
  370. LampTimer.Interval = 40 'lamp fading speed
  371. LampTimer.Enabled = 1
  372. '
  373. FlashInit()
  374. FlasherTimer.Interval = 10 'flash fading speed
  375. FlasherTimer.Enabled = 1
  376.  
  377. '' Lamp & Flasher Timers
  378.  
  379. Sub LampTimer_Timer()
  380. Dim chgLamp, num, chg, ii
  381. chgLamp = Controller.ChangedLamps
  382. If Not IsEmpty(chgLamp) Then
  383. For ii = 0 To UBound(chgLamp)
  384. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
  385. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4
  386. FlashState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
  387. Next
  388. End If
  389.  
  390. UpdateLamps
  391. End Sub
  392.  
  393. Sub FlashInit
  394. Dim i
  395. For i = 0 to 200
  396. FlashState(i) = 0
  397. FlashLevel(i) = 0
  398. Next
  399.  
  400. FlashSpeedUp = 50 ' fast speed when turning on the flasher
  401. FlashSpeedDown = 10 ' slow speed when turning off the flasher, gives a smooth fading
  402. AllFlashOff()
  403. End Sub
  404.  
  405. Sub AllFlashOff
  406. Dim i
  407. For i = 0 to 200
  408. FlashState(i) = 0
  409. Next
  410. End Sub
  411.  
  412. Sub UpdateLamps
  413. NFadeL 3, l3
  414. NFadeL 4, l4
  415. NFadeL 5, l5
  416. NFadeL 6, l6
  417. NFadeL 7, l7
  418. NFadeL 8, l8
  419. NFadeL 9, l9
  420. NFadeL 10, l10
  421. NFadeL 11, l11
  422. NFadeL 12, l12
  423. NFadeL 13, l13
  424. NFadeL 14, l14
  425. NFadeL 15, l15
  426. NFadeL 16, l16
  427. NFadeL 17, l17
  428. NFadeL 18, l18
  429. NFadeL 19, l19
  430. NFadeL 20, l20
  431. NFadeL 21, l21
  432. NFadeL 22, l22
  433. NFadeL 23, l23
  434. NFadeL 24, l24
  435. NFadeL 25, l25
  436. NFadeL 26, l26
  437. NFadeL 27, l27
  438. NFadeL 28, l28
  439. NFadeL 29, l29
  440. NFadeL 30, l30
  441. NFadeL 31, l31
  442. NFadeL 32, l32
  443. NFadeL 33, l33
  444. NFadeL 34, l34
  445. NFadeL 35, l35
  446. NFadeL 36, l36
  447. NFadeL 37, l37
  448. NFadeL 38, l38
  449. NFadeL 39, l39
  450. NFadeL 40, l40
  451. NFadeL 41, l41
  452. NFadeL 42, l42
  453. NFadeL 43, l43
  454. NFadeL 44, l44
  455. NFadeL 45, l45
  456. NFadeL 46, l46
  457. NFadeL 47, l47
  458. NFadeL 48, l48
  459. NFadeL 49, l49
  460. NFadeL 50, l50
  461. NFadeL 51, l51
  462. NFadeL 52, l52
  463. NFadeL 53, l53
  464. NFadeL 54, l54
  465. NFadeL 55, l55
  466. NFadeL 56, l56
  467. NFadeL 57, l57
  468. NFadeL 58, l58
  469. NFadeL 59, l59
  470.  
  471. NFadeLm 121, f121a
  472. NFadeL 121, f121b
  473. NFadeLm 126, f126a
  474. NFadeL 126, f126b
  475. NFadeLm 132, f132a
  476. NFadeL 132, f132b
  477. NFadeLm 131, f131a
  478. NFadeLm 131, f131b
  479. NFadeLm 131, f131c
  480. NFadeL 131, f131d
  481.  
  482. ' FlashAR 60, f160, "bf_on", "bf_a", "bf_b", ARRefresh
  483. ' FlashAR 61, f161, "bf_on", "bf_a", "bf_b", ARRefresh
  484. ' FlashAR 62, f162, "bf_on", "bf_a", "bf_b", ARRefresh
  485. ' NFadeL 60, bumper2b
  486. ' NFadeL 61, bumper1b
  487. ' NFadeL 62, bumper3b
  488. ' FadeL 63, l63, l63a
  489. '
  490. ' FadeLm 120, l90, l90a
  491. ' FlashAR 120, f120, "wf_on", "wf_a", "wf_b", ARRefresh
  492. ' FadeLm 122, l89, l89a
  493. ' FlashAR 122, f189, "rf_on", "rf_a", "rf_b", ARRefresh
  494. ' FlashAR 121, f121, "yf_on", "yf_a", "yf_b", ARRefresh
  495. ' FlashARm 123, f125, "bf_on", "bf_a", "bf_b", ARRefresh
  496. ' FlashAR 123, f125a, "bf_on", "bf_a", "bf_b", ARRefresh
  497. ' FlashAR 126, f126, "yf_on", "yf_a", "yf_b", ARRefresh
  498. ' FlashAR 127, f127, "wf_on", "wf_a", "wf_b", ARRefresh
  499. ' FlashAR 129, f129, "wf_on", "wf_a", "wf_b", ARRefresh
  500. ' FlashARm 131, f131a, "rf_on", "rf_a", "rf_b", ARRefresh
  501. ' FlashAR 131, f131, "rf_on", "rf_a", "rf_b", ARRefresh
  502. ' FlashAR 132, f132, "rf_on", "rf_a", "rf_b", ARRefresh
  503. End Sub
  504.  
  505. Sub FadePrim(nr, pri, a, b, c, d)
  506. Select Case FadingLevel(nr)
  507. Case 2:pri.image = d:FadingLevel(nr) = 0
  508. Case 3:pri.image = c:FadingLevel(nr) = 1
  509. Case 4:pri.image = b:FadingLevel(nr) = 2
  510. Case 5:pri.image = a:FadingLevel(nr) = 3
  511. End Select
  512. End Sub
  513.  
  514. ''Lights
  515.  
  516. Sub NFadeL(nr, a)
  517. Select Case FadingLevel(nr)
  518. Case 4:a.state = 0:FadingLevel(nr) = 0
  519. Case 5:a.State = 1:FadingLevel(nr) = 1
  520. End Select
  521. End Sub
  522.  
  523. Sub NFadeLm(nr, a)
  524. Select Case FadingLevel(nr)
  525. Case 4:a.state = 0
  526. Case 5:a.State = 1
  527. End Select
  528. End Sub
  529.  
  530. ' Flasher objects
  531. ' Uses own faster timer
  532.  
  533. Sub Flash(nr, object)
  534. Select Case FlashState(nr)
  535. Case 0 'off
  536. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown
  537. If FlashLevel(nr) < 0 Then
  538. FlashLevel(nr) = 0
  539. FlashState(nr) = -1 'completely off
  540. End if
  541. Object.opacity = FlashLevel(nr)
  542. Case 1 ' on
  543. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp
  544. If FlashLevel(nr) > 1000 Then
  545. FlashLevel(nr) = 1000
  546. FlashState(nr) = -2 'completely on
  547. End if
  548. Object.opacity = FlashLevel(nr)
  549. End Select
  550. End Sub
  551.  
  552. Sub AllLampsOff():For x = 1 to 200:LampState(x) = 4:FadingLevel(x) = 4:Next:UpdateLamps:UpdateLamps:Updatelamps:End Sub
  553.  
  554.  
  555. Sub SetLamp(nr, value)
  556. If value = 0 AND LampState(nr) = 0 Then Exit Sub
  557. If value = 1 AND LampState(nr) = 1 Then Exit Sub
  558. LampState(nr) = abs(value) + 4
  559. FadingLevel(nr ) = abs(value) + 4: FadingState(nr ) = abs(value) + 4
  560. End Sub
  561.  
  562. Sub SetFlash(nr, stat)
  563. FlashState(nr) = ABS(stat)
  564. End Sub
  565.  
  566. Sub FlasherTimer_Timer()
  567. 'Flash 3, fire
  568. '
  569. 'Flash 80, f80
  570. 'Flash 119, f119
  571. 'Flash 120, f120 'right ramp flash
  572. 'Flash 129, f29 'left loop / spinner flash
  573. 'Flash 131, f31 'vengeance flash
  574. End Sub
  575.  
  576. 'MONGER
  577. 'sw1 monger down
  578. 'sw3 monger up
  579. 'sw4 monger left shoulder
  580. 'sw5 monger legs
  581. 'sw6 monger rt shoulder
  582.  
  583.  
  584. '************************
  585. ' monger Animation
  586. '************************
  587.  
  588. Dim monger, mongerPos, mongerDir, mongerFlash
  589. 'monger = Array(monger1, monger2, monger3, monger4, monger5, monger6, monger7, monger8, monger9, monger10)
  590. mongerDir = 0:mongerPos = 0:mongerFlash = 0
  591. sw5.IsDropped = 1
  592. switchframe.IsDropped = 1
  593. 'For x = 1 to 9:monger(x).IsDropped = 1:Next
  594.  
  595. Sub Solmonger(Enabled)
  596. If Enabled Then
  597. If mongerDir = 0 Then
  598. Controller.Switch(3) = 0
  599. Controller.Switch(1) = 1
  600. mongerClose.Enabled = 0
  601. mongerOpen.Enabled = 1
  602. mongerOpen_Timer
  603. mongerDir = 1
  604. Else
  605. Controller.Switch(1) = 0
  606. Controller.Switch(3) = 1
  607. mongerOpen.Enabled = 0
  608. mongerClose.Enabled = 1
  609. mongerClose_Timer
  610. mongerDir = 0
  611. End If
  612. End If
  613. End Sub
  614.  
  615. Sub mongerOpen_Timer()
  616. Updatemonger
  617. mongerPos = mongerPos + 1
  618.  
  619. If mongerPos> 41 Then
  620. mongerPos = 41
  621. mongerOpen.Enabled = 0
  622. End If
  623. End Sub
  624.  
  625. Sub mongerClose_Timer()
  626. Updatemonger
  627. mongerPos = mongerPos - 1
  628.  
  629. If mongerPos <0 Then
  630. mongerPos = 0
  631. mongerClose.Enabled = 0
  632. End If
  633. End Sub
  634.  
  635. Sub Updatemonger
  636. Select Case mongerPos
  637. Case 0:Primitive32.Z=300:Primitive31.Z=300::Primitive2.Z=90:mongerAnim.Enabled = 0:sw3.IsDropped = 0:switchframe.IsDropped = 0:sw5.IsDropped = 0' monger1.IsDropped = 0:monger2.IsDropped = 1:
  638. Case 1:Primitive32.Z=292.5:Primitive31.Z=292.5:Primitive2.Z=82.5
  639. Case 2:Primitive32.Z=285:Primitive31.Z=285:Primitive2.Z=75
  640. Case 3:Primitive32.Z=277.5:Primitive31.Z=277.5:Primitive2.Z=67.5
  641. Case 4:Primitive32.Z=270:Primitive31.Z=270:Primitive2.Z=60
  642. Case 5:Primitive32.Z=262.5:Primitive31.Z=262.5:Primitive2.Z=52.5
  643. Case 6:Primitive32.Z=255:Primitive31.Z=255:Primitive2.Z=45
  644. Case 7:Primitive32.Z=247.5:Primitive31.Z=247.5:Primitive2.Z=37.5
  645. Case 8:Primitive32.Z=240:Primitive31.Z=240:Primitive2.Z=30
  646. Case 9:Primitive32.Z=232.5:Primitive31.Z=232.5:Primitive2.Z=22.5
  647. Case 10:Primitive32.Z=225:Primitive31.Z=225:Primitive2.Z=15
  648. Case 11:Primitive32.Z=217.5:Primitive31.Z=217.5:Primitive2.Z=7.5
  649. Case 12:Primitive32.Z=210:Primitive31.Z=210:Primitive2.Z=0
  650. Case 13:Primitive32.Z=202.5:Primitive31.Z=202.5:Primitive2.Z=-7.5
  651. Case 14:Primitive32.Z=195:Primitive31.Z=195:Primitive2.Z=-15
  652. Case 15:Primitive32.Z=187.5:Primitive31.Z=187.5:Primitive2.Z=-22.5
  653. Case 16:Primitive32.Z=180:Primitive31.Z=180:Primitive2.Z=-30
  654. Case 17:Primitive32.Z=172.5:Primitive31.Z=172.5:Primitive2.Z=-37.5
  655. Case 18:Primitive32.Z=165:Primitive31.Z=165:Primitive2.Z=-45
  656. Case 19:Primitive32.Z=157.5:Primitive31.Z=157.5:Primitive2.Z=-52.5
  657. Case 20:Primitive32.Z=150:Primitive31.Z=150:Primitive2.Z=-60
  658. Case 21:Primitive32.Z=142.5:Primitive31.Z=142.5:Primitive2.Z=-67.5
  659. Case 22:Primitive32.Z=135:Primitive31.Z=135:Primitive2.Z=-75
  660. Case 23:Primitive32.Z=127.5:Primitive31.Z=127.5:Primitive2.Z=-82.5
  661. Case 24:Primitive32.Z=120:Primitive31.Z=120:Primitive2.Z=-90
  662. Case 25:Primitive32.Z=112.5:Primitive31.Z=112.5:Primitive2.Z=-97.5
  663. Case 26:Primitive32.Z=105:Primitive31.Z=105:Primitive2.Z=-105
  664. Case 27:Primitive32.Z=97.5:Primitive31.Z=97.5:Primitive2.Z=-112.5
  665. Case 28:Primitive32.Z=90:Primitive31.Z=90:Primitive2.Z=-120
  666. Case 29:Primitive32.Z=82.5:Primitive31.Z=82.5:Primitive2.Z=-127.5
  667. Case 30:Primitive32.Z=75:Primitive31.Z=75:Primitive2.Z=-135
  668. Case 31:Primitive32.Z=67.5:Primitive31.Z=67.5:Primitive2.Z=-142.5
  669. Case 32:Primitive32.Z=60:Primitive31.Z=60:Primitive2.Z=-150
  670. Case 33:Primitive32.Z=52.5:Primitive31.Z=52.5:Primitive2.Z=-157.5
  671. Case 34:Primitive32.Z=45:Primitive31.Z=45:Primitive2.Z=-165
  672. Case 35:Primitive32.Z=37.5:Primitive31.Z=37.5:Primitive2.Z=-172.5
  673. Case 36:Primitive32.Z=30:Primitive31.Z=30:Primitive2.Z=-180
  674. Case 37:Primitive32.Z=22.5:Primitive31.Z=22.5:Primitive2.Z=-187.5
  675. Case 38:Primitive32.Z=15:Primitive31.Z=15:Primitive2.Z=-195
  676. Case 39:Primitive32.Z=7.5:Primitive31.Z=7.5:Primitive2.Z=-202.5
  677. Case 40:Primitive32.Z=0:Primitive31.Z=0:Primitive2.Z=-210:mongerAnim.Enabled = 0:sw3.IsDropped = 1:switchframe.IsDropped = 1:sw5.IsDropped = 1
  678. End Select
  679. End Sub
  680.  
  681. Sub Trigger1_hit
  682. PlaySound "DROP_LEFT"
  683. End Sub
  684.  
  685. Sub Trigger2_hit
  686. PlaySound "DROP_RIGHT"
  687. End Sub
  688.  
  689. Sub Table_exit()
  690. Controller.Pause = False
  691. Controller.Stop
  692. End Sub
  693.  
  694. Sub UpdateFlipperLogo_Timer
  695. LFLogo.RotY = LeftFlipper.CurrentAngle
  696. RFlogo.RotY = RightFlipper.CurrentAngle
  697. 'LFLogoUP.RotY = LeftFlipper1.CurrentAngle
  698. End Sub
  699.  
  700. Sub GIOn
  701. dim bulb
  702. for each bulb in Collection1
  703. bulb.state = 1
  704. next
  705. End Sub
  706.  
  707. Sub GIOff
  708. dim bulb
  709. for each bulb in Collection1
  710. bulb.state = 0
  711. next
  712. End Sub
  713.  
  714. 'Sub RightSlingShot_Timer:Me.TimerEnabled = 0:End Sub
  715.  
  716. ' *********************************************************************
  717. ' Supporting Ball & Sound Functions
  718. ' *********************************************************************
  719.  
  720. Sub Pins_Hit (idx)
  721. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  722. End Sub
  723.  
  724. Sub Targets_Hit (idx)
  725. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  726. End Sub
  727.  
  728. Sub TargetBankWalls_Hit (idx)
  729. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  730. End Sub
  731.  
  732. Sub Metals_Thin_Hit (idx)
  733. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  734. End Sub
  735.  
  736. Sub Metals_Medium_Hit (idx)
  737. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  738. End Sub
  739.  
  740. Sub Metals2_Hit (idx)
  741. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  742. End Sub
  743.  
  744. Sub Gates_Hit (idx)
  745. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  746. End Sub
  747.  
  748. Sub Spinner_Spin
  749. PlaySound "fx_spinner",0,.25,0,0.25
  750. End Sub
  751.  
  752. Sub Rubbers_Hit(idx)
  753. dim finalspeed
  754. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  755. If finalspeed > 20 then
  756. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  757. End if
  758. If finalspeed >= 6 AND finalspeed <= 20 then
  759. RandomSoundRubber()
  760. End If
  761. End Sub
  762.  
  763. Sub Posts_Hit(idx)
  764. dim finalspeed
  765. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  766. If finalspeed > 16 then
  767. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  768. End if
  769. If finalspeed >= 6 AND finalspeed <= 16 then
  770. RandomSoundRubber()
  771. End If
  772. End Sub
  773.  
  774. Sub RandomSoundRubber()
  775. Select Case Int(Rnd*3)+1
  776. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  777. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  778. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  779. End Select
  780. End Sub
  781.  
  782. Sub LeftFlipper_Collide(parm)
  783. RandomSoundFlipper()
  784. End Sub
  785.  
  786. Sub RightFlipper_Collide(parm)
  787. RandomSoundFlipper()
  788. End Sub
  789.  
  790. Sub RandomSoundFlipper()
  791. Select Case Int(Rnd*3)+1
  792. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  793. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  794. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  795. End Select
  796. End Sub
  797.  
  798.  
  799. 'Sub LRRail_Hit:PlaySound "fx_metalrolling", 0, 150, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0:End Sub
  800. '
  801. 'Sub RLRail_Hit:PlaySound "fx_metalrolling", 0, 150, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0:End Sub
  802.  
  803. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  804. Vol = Csng(BallVel(ball) ^2 / 1)
  805. End Function
  806.  
  807. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  808. Dim tmp
  809. tmp = ball.x * 2 / table.width-1
  810. If tmp > 0 Then
  811. Pan = Csng(tmp ^10)
  812. Else
  813. Pan = Csng(-((- tmp) ^10) )
  814. End If
  815. End Function
  816.  
  817. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  818. Pitch = BallVel(ball) * 20
  819. End Function
  820.  
  821. Function BallVel(ball) 'Calculates the ball speed
  822. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  823. End Function
  824.  
  825. '*****************************************
  826. ' JP's VP10 Rolling Sounds
  827. '*****************************************
  828.  
  829. Const tnob = 5 ' total number of balls
  830. ReDim rolling(tnob)
  831. InitRolling
  832.  
  833. Sub InitRolling
  834. Dim i
  835. For i = 0 to tnob
  836. rolling(i) = False
  837. Next
  838. End Sub
  839.  
  840. Sub RollingTimer_Timer()
  841. Dim BOT, b
  842. BOT = GetBalls
  843.  
  844. ' stop the sound of deleted balls
  845. For b = UBound(BOT) + 1 to tnob
  846. rolling(b) = False
  847. StopSound("fx_ballrolling" & b)
  848. Next
  849.  
  850. ' exit the sub if no balls on the table
  851. If UBound(BOT) = -1 Then Exit Sub
  852.  
  853. ' play the rolling sound for each ball
  854. For b = 0 to UBound(BOT)
  855. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 AND BOT(b).z > 0 Then
  856. rolling(b) = True
  857. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  858. Else
  859. If rolling(b) = True Then
  860. StopSound("fx_ballrolling" & b)
  861. rolling(b) = False
  862. End If
  863. End If
  864. Next
  865. End Sub
  866.  
  867. '**********************
  868. ' Ball Collision Sound
  869. '**********************
  870.  
  871. Sub OnBallBallCollision(ball1, ball2, velocity)
  872. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  873. End Sub
  874.  
  875. Dim LeftCount:LeftCount = 0
  876. Sub leftdrop_hit
  877. If LeftCount = 1 then
  878. playsound "BallDrop"
  879. End If
  880. LeftCount = 0
  881. End Sub
  882.  
  883. Dim RightCount:RightCount = 0
  884. Sub rightdrop_hit
  885. If RightCount = 1 then
  886. playsound "BallDrop"
  887. End If
  888. RightCount = 0
  889. End Sub
  890.  
  891. Sub RLS_Timer()
  892. ' RampGate1.RotZ = -(Spinner4.currentangle)
  893. ' RampGate2.RotZ = -(Spinner1.currentangle)
  894. RampGate1.RotZ = -(leftrampgate.currentangle)
  895. RampGate3.RotZ = -(rightrampgate.currentangle)
  896. SpinnerT3.RotZ = -(sw11.currentangle)
  897. SpinnerT1.RotZ = -(sw13.currentangle)
  898. SpinnerT2.RotZ = -(sw14.currentangle)
  899. End Sub
Advertisement
Add Comment
Please, Sign In to add comment