Outhere

JP's Space Cadet 1.02

Sep 4th, 2021
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 182.47 KB | None | 0 0
  1. ' ****************************************************************
  2. ' JP's Space Cadet for VISUAL PINBALL X 10.7
  3. ' Based on the PC game by Cinematronics/Maxis from 1996
  4. ' Including JP's Arcade Physics 3.0.1
  5. ' ****************************************************************
  6.  
  7. 'DOF Update it by Outhere - Search the word > outhere < for DOF I Changed or Added
  8. '101 Left Flipper
  9. '102 Right Flipper
  10. '103 Left Slingshot
  11. '104 Right Slingshot
  12. '105
  13. '106 Right Slingshot Shake
  14. '107 Top Bumper Left
  15. '108 Top Bumper Center
  16. '109 Top Bumper Right
  17. '110 Lower Bumper Left
  18. '111 Lower Bumper CenterLeft
  19. '112 Lower Bumper Right
  20. '113 Very Top Bumper Left
  21. '114 Wormhole 1
  22. '115 Wormhole 2
  23. '116 Wormhole 3
  24. '117 Drop Targets Left
  25. '118 GI on / off
  26. '119 Drop Targets Center
  27. '120 Drop Targets Right
  28. '121
  29. '122 Knocker
  30. '123 Ball Release
  31. '124 Left Kick Back
  32. '125
  33. '126
  34. '127
  35. '128 Right Kick Back
  36. '129 BlackHole Kick Out
  37. '130 HyperSpaceHole Kick Out
  38. '131 Upper Left Slingshot
  39. '132 Upper Right Slingshot
  40. '133 Shaker
  41. '134 Beacon - BallLock
  42. '135
  43. '136
  44. '137
  45. '138
  46. '139
  47. '140
  48. '141
  49. '142
  50. '143 AutoPlunger
  51. '144
  52. '146
  53. '147
  54. '148
  55. '149
  56. '150
  57. '151
  58. '152
  59. '153
  60. '154
  61. '155
  62.  
  63. Option Explicit
  64. Randomize
  65.  
  66. Const BallSize = 50 ' 50 is the normal size used in the core.vbs, VP kicker routines uses this value divided by 2
  67. Const BallMass = 1.7 ' standard ball mass in JP's VPX Physics 3.0
  68. Const SongVolume = 0.5 ' 1 is full volume, but I set it quite low to listen better the other sounds since I use headphones, adjust to your setup :)
  69.  
  70. 'FlexDMD in high or normal quality
  71. 'True if you have an LCD screen, 256x64
  72. 'or False if you have a real DMD at 128x32 in size
  73. Const FlexDMDHighQuality = False
  74.  
  75. ' Load the core.vbs for supporting Subs and functions
  76. LoadCoreFiles
  77.  
  78. Sub LoadCoreFiles
  79. On Error Resume Next
  80. ExecuteGlobal GetTextFile("core.vbs")
  81. If Err Then MsgBox "Can't open core.vbs"
  82. ExecuteGlobal GetTextFile("controller.vbs")
  83. If Err Then MsgBox "Can't open controller.vbs"
  84. On Error Goto 0
  85. End Sub
  86.  
  87. ' Define any Constants
  88. Const cGameName = "jpspacecadet"
  89. Const myVersion = "1.02"
  90. Const MaxPlayers = 4 ' from 1 to 4
  91. Const BallSaverTime = 20 ' in seconds of the first ball
  92. Const MaxMultiplier = 10 ' limit playfield multiplier
  93. Const MaxBonusMultiplier = 5 'limit Bonus multiplier
  94. Const BallsPerGame = 3 ' usually 3 or 5
  95. Const MaxMultiballs = 5 ' max number of balls during multiballs
  96.  
  97. ' Use FlexDMD if in FS mode
  98. Dim UseFlexDMD
  99. If Table1.ShowDT = True then
  100. UseFlexDMD = False
  101. Else
  102. UseFlexDMD = True
  103. End If
  104.  
  105. ' Define Global Variables
  106. Dim PlayersPlayingGame
  107. Dim CurrentPlayer
  108. Dim Credits
  109. Dim BonusPoints(4)
  110. Dim BonusHeldPoints(4)
  111. Dim BonusMultiplier(4)
  112. Dim PlayfieldMultiplier(4)
  113. Dim PFxSeconds
  114. Dim bBonusHeld
  115. Dim BallsRemaining(4)
  116. Dim ExtraBallsAwards(4)
  117. Dim Score(4)
  118. Dim HighScore(4)
  119. Dim HighScoreName(4)
  120. Dim Jackpot(4)
  121. Dim SuperJackpot(4)
  122. Dim Tilt
  123. Dim TiltSensitivity
  124. Dim Tilted
  125. Dim TotalGamesPlayed
  126. Dim mBalls2Eject
  127. Dim SkillshotValue(4)
  128. Dim SuperSkillshotValue(4)
  129. Dim bAutoPlunger
  130. Dim bInstantInfo
  131. Dim bAttractMode
  132. Dim i, j, k, x 'used in loops
  133.  
  134. ' Define Game Control Variables
  135. Dim LastSwitchHit
  136. Dim BallsOnPlayfield
  137. Dim BallsInLock(4)
  138. Dim BallsInHole
  139.  
  140. ' Define Game Flags
  141. Dim bFreePlay
  142. Dim bGameInPlay
  143. Dim bOnTheFirstBall
  144. Dim bBallInPlungerLane
  145. Dim bBallSaverActive
  146. Dim bBallSaverReady
  147. Dim bMultiBallMode
  148. Dim bMusicOn
  149. Dim bSkillshotReady
  150. Dim bExtraBallWonThisBall
  151. Dim bJustStarted
  152. Dim bJackpot
  153.  
  154. ' core.vbs variables
  155. Dim plungerIM 'used mostly as an autofire plunger during multiballs
  156. Dim leftkickerIM
  157. Dim rightkickerIM
  158. Dim aMagnet
  159.  
  160. ' *********************************************************************
  161. ' Visual Pinball Defined Script Events
  162. ' *********************************************************************
  163.  
  164. Sub Table1_Init()
  165. LoadEM
  166. Dim i
  167. Randomize
  168.  
  169. 'Impulse Plunger as autoplunger
  170. Const IMPowerSetting = 45 ' Plunger Power
  171. Const IMTime = 0.25 ' Time in seconds for Full Plunge
  172. Set plungerIM = New cvpmImpulseP
  173. With plungerIM
  174. .InitImpulseP swplunger, IMPowerSetting, IMTime
  175. .Random 1.5
  176. .InitExitSnd SoundFXDOF("fx_kicker", 141, DOFPulse, DOFContactors), SoundFXDOF("fx_solenoid", 141, DOFPulse, DOFContactors)
  177. .CreateEvents "plungerIM"
  178. End With
  179.  
  180. 'Impulse Plunger as right kickback
  181. Set rightkickerIM = New cvpmImpulseP
  182. With rightkickerIM
  183. .InitImpulseP RightKicker, IMPowerSetting, IMTime
  184. .Random 1.5
  185. .InitExitSnd SoundFXDOF("fx_kicker", 141, DOFPulse, DOFContactors), SoundFXDOF("fx_solenoid", 141, DOFPulse, DOFContactors)
  186. .CreateEvents "rightkickerIM"
  187. End With
  188.  
  189. 'Impulse Plunger as left kickback
  190. Set leftkickerIM = New cvpmImpulseP
  191. With leftkickerIM
  192. .InitImpulseP LeftKicker, IMPowerSetting, IMTime
  193. .Random 1.5
  194. .InitExitSnd SoundFXDOF("fx_kicker", 141, DOFPulse, DOFContactors), SoundFXDOF("fx_solenoid", 141, DOFPulse, DOFContactors)
  195. .CreateEvents "leftkickerIM"
  196. End With
  197.  
  198. ' Magnet
  199. Set aMagnet = New cvpmMagnet
  200. With aMagnet
  201. .InitMagnet GravityMagnet, 6
  202. .GrabCenter = True
  203. .CreateEvents "aMagnet"
  204. End With
  205.  
  206. ' Misc. VP table objects Initialisation, droptargets, animations...
  207. VPObjects_Init
  208.  
  209. ' load saved values, highscore, names, jackpot
  210. Credits = 0
  211. Loadhs
  212.  
  213. ' Initalise the DMD display
  214. DMD_Init
  215.  
  216. ' freeplay or coins
  217. bFreePlay = False 'we want coins
  218.  
  219. if bFreePlay Then DOF 125, DOFOn
  220.  
  221. ' Init main variables and any other flags
  222. bAttractMode = False
  223. bOnTheFirstBall = False
  224. bBallInPlungerLane = False
  225. bBallSaverActive = False
  226. bBallSaverReady = False
  227. bMultiBallMode = False
  228. PFxSeconds = 0
  229. bGameInPlay = False
  230. bAutoPlunger = False
  231. bMusicOn = True
  232. BallsOnPlayfield = 0
  233. BallsInHole = 0
  234. LastSwitchHit = ""
  235. Tilt = 0
  236. TiltSensitivity = 6
  237. Tilted = False
  238. bBonusHeld = False
  239. bJustStarted = True
  240. bJackpot = False
  241. bInstantInfo = False
  242. ' set any lights for the attract mode
  243. GiOff
  244. StartAttractMode
  245.  
  246. ' Start the RealTime timer
  247. RealTime.Enabled = 1
  248.  
  249. ' Load table color
  250. LoadLut
  251. End Sub
  252.  
  253. '******
  254. ' Keys
  255. '******
  256.  
  257. Sub Table1_KeyDown(ByVal Keycode)
  258.  
  259. If keycode = LeftTiltKey Then Nudge 90, 8:PlaySound "fx_nudge", 0, 1, -0.1, 0.25
  260. If keycode = RightTiltKey Then Nudge 270, 8:PlaySound "fx_nudge", 0, 1, 0.1, 0.25
  261. If keycode = CenterTiltKey Then Nudge 0, 9:PlaySound "fx_nudge", 0, 1, 1, 0.25
  262.  
  263. If keycode = LeftMagnaSave Then bLutActive = True
  264. If keycode = RightMagnaSave Then
  265. If bLutActive Then
  266. NextLUT
  267. End If
  268. End If
  269.  
  270. If Keycode = AddCreditKey Then
  271. Credits = Credits + 1
  272. if bFreePlay = False Then DOF 125, DOFOn
  273. If(Tilted = False)Then
  274. DMDFlush
  275. DMD CL(1, "CREDITS " & Credits), "_", "", eNone, eNone, eNone, 500, True, "fx_coin"
  276. If NOT bGameInPlay Then ShowTableInfo
  277. End If
  278. End If
  279.  
  280. If keycode = PlungerKey Then
  281. Plunger.Pullback
  282. PlaySoundAt "fx_plungerpull", plunger
  283. End If
  284.  
  285. If hsbModeActive Then
  286. EnterHighScoreKey(keycode)
  287. Exit Sub
  288. End If
  289.  
  290. ' Normal flipper action
  291.  
  292. If bGameInPlay AND NOT Tilted Then
  293.  
  294. If keycode = LeftTiltKey Then CheckTilt 'only check the tilt during game
  295. If keycode = RightTiltKey Then CheckTilt
  296. If keycode = CenterTiltKey Then CheckTilt
  297.  
  298. If keycode = LeftFlipperKey Then SolLFlipper 1:InstantInfoTimer.Enabled = True:RotateLaneLights 1
  299. If keycode = RightFlipperKey Then SolRFlipper 1:InstantInfoTimer.Enabled = True:RotateLaneLights 0
  300.  
  301. If keycode = StartGameKey Then
  302. If((PlayersPlayingGame <MaxPlayers)AND(bOnTheFirstBall = True))Then
  303.  
  304. If(bFreePlay = True)Then
  305. PlayersPlayingGame = PlayersPlayingGame + 1
  306. TotalGamesPlayed = TotalGamesPlayed + 1
  307. DMD "_", CL(1, PlayersPlayingGame & " PLAYERS"), "", eNone, eNone, eNone, 1000, True, ""
  308. Else
  309. If(Credits> 0)then
  310. PlayersPlayingGame = PlayersPlayingGame + 1
  311. TotalGamesPlayed = TotalGamesPlayed + 1
  312. Credits = Credits - 1
  313. DMD "_", CL(1, PlayersPlayingGame & " PLAYERS"), "", eNone, eNone, eNone, 1000, True, ""
  314. If Credits <1 And bFreePlay = False Then DOF 125, DOFOff
  315. Else
  316. ' Not Enough Credits to start a game.
  317. DMD CL(0, "CREDITS " & Credits), CL(1, "INSERT COIN"), "", eNone, eBlink, eNone, 1000, True, "vo_nocredits"
  318. End If
  319. End If
  320. End If
  321. End If
  322. Else ' If (GameInPlay)
  323.  
  324. If keycode = StartGameKey Then
  325. If(bFreePlay = True)Then
  326. If(BallsOnPlayfield = 0)Then
  327. ResetForNewGame()
  328. End If
  329. Else
  330. If(Credits> 0)Then
  331. If(BallsOnPlayfield = 0)Then
  332. Credits = Credits - 1
  333. If Credits <1 And bFreePlay = False Then DOF 125, DOFOff
  334. ResetForNewGame()
  335. End If
  336. Else
  337. ' Not Enough Credits to start a game.
  338. DMDFlush
  339. DMD CL(0, "CREDITS " & Credits), CL(1, "INSERT COIN"), "", eNone, eBlink, eNone, 1000, True, "vo_nocredits"
  340. ShowTableInfo
  341. End If
  342. End If
  343. End If
  344. End If ' If (GameInPlay)
  345.  
  346. 'test
  347. If keycode = "3" then PromoteRank
  348. End Sub
  349.  
  350. Sub Table1_KeyUp(ByVal keycode)
  351.  
  352. If keycode = LeftMagnaSave Then bLutActive = False
  353.  
  354. If keycode = PlungerKey Then
  355. Plunger.Fire
  356. PlaySoundAt "fx_plunger", plunger
  357. End If
  358.  
  359. If hsbModeActive Then
  360. Exit Sub
  361. End If
  362.  
  363. ' Table specific
  364.  
  365. If bGameInPLay AND NOT Tilted Then
  366. If keycode = LeftFlipperKey Then
  367. SolLFlipper 0
  368. InstantInfoTimer.Enabled = False
  369. If bInstantInfo Then
  370. DMDScoreNow
  371. bInstantInfo = False
  372. End If
  373. End If
  374. If keycode = RightFlipperKey Then
  375. SolRFlipper 0
  376. InstantInfoTimer.Enabled = False
  377. If bInstantInfo Then
  378. DMDScoreNow
  379. bInstantInfo = False
  380. End If
  381. End If
  382. End If
  383. End Sub
  384.  
  385. Sub InstantInfoTimer_Timer
  386. InstantInfoTimer.Enabled = False
  387. If hsbModeActive = False AND bInstantInfo = False Then
  388. bInstantInfo = True
  389. DMDFlush
  390. InstantInfo
  391. End If
  392. End Sub
  393.  
  394. '*************
  395. ' Pause Table
  396. '*************
  397.  
  398. Sub table1_Paused
  399. End Sub
  400.  
  401. Sub table1_unPaused
  402. End Sub
  403.  
  404. Sub Table1_Exit
  405. Savehs
  406. If UseFlexDMD Then FlexDMD.Run = False
  407. If B2SOn = true Then Controller.Stop
  408. End Sub
  409.  
  410. '********************
  411. ' Flippers
  412. '********************
  413.  
  414. Sub SolLFlipper(Enabled)
  415. If Enabled Then
  416. PlaySoundAt SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), LeftFlipper
  417. LeftFlipper.EOSTorque = 0.75:LeftFlipper.RotateToEnd
  418. Else
  419. PlaySoundAt SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), LeftFlipper
  420. LeftFlipper.EOSTorque = 0.2:LeftFlipper.RotateToStart
  421. End If
  422. End Sub
  423.  
  424. Sub SolRFlipper(Enabled)
  425. If Enabled Then
  426. PlaySoundAt SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), RightFlipper
  427. RightFlipper.EOSTorque = 0.75:RightFlipper.RotateToEnd
  428. Else
  429. PlaySoundAt SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), RightFlipper
  430. RightFlipper.EOSTorque = 0.2:RightFlipper.RotateToStart
  431. End If
  432. End Sub
  433.  
  434. ' flippers hit Sound
  435.  
  436. Sub LeftFlipper_Collide(parm)
  437. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  438. End Sub
  439.  
  440. Sub RightFlipper_Collide(parm)
  441. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  442. End Sub
  443.  
  444. '*********
  445. ' TILT
  446. '*********
  447.  
  448. 'NOTE: The TiltDecreaseTimer Subtracts .01 from the "Tilt" variable every round
  449.  
  450. Sub CheckTilt 'Called when table is nudged
  451. Tilt = Tilt + TiltSensitivity 'Add to tilt count
  452. TiltDecreaseTimer.Enabled = True
  453. If(Tilt> TiltSensitivity)AND(Tilt <15)Then 'show a warning
  454. DMD "_", CL(1, "CAREFUL"), "_", eNone, eBlinkFast, eNone, 1500, True, "vo_Careful"
  455. End if
  456. If Tilt> 15 Then 'If more that 15 then TILT the table
  457. Tilted = True
  458. 'display Tilt
  459. DMDFlush
  460. DMD CL(0, "YOU"), CL(1, "TILTED"), "", eNone, eNone, eNone, 200, False, "vo_You tilted"
  461. DisableTable True
  462. TiltRecoveryTimer.Enabled = True 'start the Tilt delay to check for all the balls to be drained
  463. End If
  464. End Sub
  465.  
  466. Sub TiltDecreaseTimer_Timer
  467. ' DecreaseTilt
  468. If Tilt> 0 Then
  469. Tilt = Tilt - 0.1
  470. Else
  471. TiltDecreaseTimer.Enabled = False
  472. End If
  473. End Sub
  474.  
  475. Sub DisableTable(Enabled)
  476. If Enabled Then
  477. 'turn off GI and turn off all the lights
  478. GiOff
  479. LightSeqTilt.Play SeqAllOff
  480. 'Disable slings, bumpers etc
  481. LeftFlipper.RotateToStart
  482. RightFlipper.RotateToStart
  483. Bumper1.Threshold = 100
  484. Bumper2.Threshold = 100
  485. Bumper3.Threshold = 100
  486. Bumper4.Threshold = 100
  487. Bumper5.Threshold = 100
  488. Bumper6.Threshold = 100
  489. Bumper7.Threshold = 100
  490. LeftSlingshot.Disabled = 1
  491. RightSlingshot.Disabled = 1
  492. LeftSlingshot2.Disabled = 1
  493. Rightslingshot2.Disabled = 1
  494. li094.State = 1
  495. Else
  496. 'turn back on GI and the lights
  497. GiOn
  498. LightSeqTilt.StopPlay
  499. Bumper1.Threshold = 1
  500. Bumper2.Threshold = 1
  501. Bumper3.Threshold = 1
  502. Bumper4.Threshold = 1
  503. Bumper5.Threshold = 1
  504. Bumper6.Threshold = 1
  505. Bumper7.Threshold = 1
  506. LeftSlingshot.Disabled = 0
  507. RightSlingshot.Disabled = 0
  508. Leftslingshot2.Disabled = 0
  509. Rightslingshot2.Disabled = 0
  510. li094.State = 0
  511. 'clean up the buffer display
  512. DMDFlush
  513. End If
  514. End Sub
  515.  
  516. Sub TiltRecoveryTimer_Timer()
  517. ' if all the balls have been drained then..
  518. If(BallsOnPlayfield = 0)Then
  519. ' do the normal end of ball thing (this doesn't give a bonus if the table is tilted)
  520. vpmtimer.Addtimer 2000, "EndOfBall() '"
  521. TiltRecoveryTimer.Enabled = False
  522. End If
  523. ' else retry (checks again in another second or so)
  524. End Sub
  525.  
  526. '*****************************************
  527. ' Music as wav sounds
  528. ' in VPX 10.7 you may use also mp3 or ogg
  529. '*****************************************
  530.  
  531. Dim Song
  532. Song = ""
  533.  
  534. Sub PlaySong(name)
  535. If bMusicOn Then
  536. If Song <> name Then
  537. StopSound Song
  538. Song = name
  539. PlaySound Song, -1, SongVolume
  540. End If
  541. End If
  542. End Sub
  543.  
  544. Sub ChangeSong 'not used in this table
  545. Dim a
  546. Select Case Mission(CurrentPlayer)
  547. Case 0 'no Mission active so play the standard songs or the multiball songs
  548. End Select
  549. End Sub
  550.  
  551. '********************
  552. ' Play random soundfx
  553. '********************
  554.  
  555. Sub PlaySfx
  556. Dim tmp
  557. tmp = RndNbr(17)
  558. PlaySound "sc_" &tmp
  559. LightEffect 3
  560. End Sub
  561.  
  562. '**********************
  563. ' GI effects
  564. ' independent routine
  565. ' it turns on the gi
  566. ' when there is a ball
  567. ' in play
  568. '**********************
  569.  
  570. Dim OldGiState
  571. OldGiState = -1 'start witht the Gi off
  572.  
  573. Sub ChangeGi(col) 'changes the gi color
  574. Dim bulb
  575. For each bulb in aGILights
  576. SetLightColor bulb, col, -1
  577. Next
  578. End Sub
  579.  
  580. Sub GIUpdateTimer_Timer
  581. Dim tmp, obj
  582. tmp = Getballs
  583. If UBound(tmp) <> OldGiState Then
  584. OldGiState = Ubound(tmp)
  585. If UBound(tmp) = -1 Then '-1 means no balls, 0 is the first captive ball, 1 is the second captive ball...)
  586. GiOff ' turn off the gi if no active balls on the table, we could also have used the variable ballsonplayfield.
  587. Else
  588. Gion
  589. End If
  590. End If
  591. End Sub
  592.  
  593. Sub GiOn
  594. PlaySoundAt "fx_GiOn", li036 'about the center of the table
  595. DOF 118, DOFOn
  596. Dim bulb
  597. For each bulb in aGiLights
  598. bulb.State = 1
  599. Next
  600. End Sub
  601.  
  602. Sub GiOff
  603. PlaySoundAt "fx_GiOff", li036 'about the center of the table
  604. DOF 118, DOFOff
  605. Dim bulb
  606. For each bulb in aGiLights
  607. bulb.State = 0
  608. Next
  609. End Sub
  610.  
  611. ' GI, light & flashers sequence effects
  612.  
  613. Sub GiEffect(n)
  614. Dim ii
  615. Select Case n
  616. Case 0 'all off
  617. LightSeqGi.Play SeqAlloff
  618. Case 1 'all blink
  619. LightSeqGi.UpdateInterval = 20
  620. LightSeqGi.Play SeqBlinking, , 15, 10
  621. Case 2 'random
  622. LightSeqGi.UpdateInterval = 20
  623. LightSeqGi.Play SeqRandom, 50, , 1000
  624. Case 3 'all blink fast
  625. LightSeqGi.UpdateInterval = 20
  626. LightSeqGi.Play SeqBlinking, , 10, 10
  627. Case 4 'seq up
  628. LightSeqGi.UpdateInterval = 3
  629. LightSeqGi.Play SeqUpOn, 25, 3
  630. Case 5 'seq down
  631. LightSeqGi.UpdateInterval = 3
  632. LightSeqGi.Play SeqDownOn, 25, 3
  633. End Select
  634. End Sub
  635.  
  636. Sub LightEffect(n)
  637. Select Case n
  638. Case 0 ' all off
  639. LightSeqInserts.Play SeqAlloff
  640. Case 1 'all blink
  641. LightSeqInserts.UpdateInterval = 10
  642. LightSeqInserts.Play SeqBlinking, , 15, 10
  643. Case 2 'random
  644. LightSeqInserts.UpdateInterval = 10
  645. LightSeqInserts.Play SeqRandom, 50, , 1000
  646. Case 3 'all blink fast
  647. LightSeqInserts.UpdateInterval = 10
  648. LightSeqInserts.Play SeqBlinking, , 10, 10
  649. Case 4 'center
  650. LightSeqInserts.UpdateInterval = 4
  651. LightSeqInserts.Play SeqCircleOutOn, 15, 2
  652. Case 5 'top down
  653. LightSeqInserts.UpdateInterval = 4
  654. LightSeqInserts.Play SeqDownOn, 15, 1
  655. Case 6 'down to top
  656. LightSeqInserts.UpdateInterval = 4
  657. LightSeqInserts.Play SeqUpOn, 15, 1
  658. End Select
  659. End Sub
  660.  
  661. Sub FlashEffect(n)
  662. Select Case n
  663. Case 0 ' all off
  664. LightSeqFlashers.Play SeqAlloff
  665. Case 1 'all blink
  666. LightSeqFlashers.UpdateInterval = 40
  667. LightSeqFlashers.Play SeqBlinking, , 15, 30
  668. Case 2 'random
  669. LightSeqFlashers.UpdateInterval = 30
  670. LightSeqFlashers.Play SeqRandom, 25, , 1500
  671. Case 3 'all blink fast
  672. LightSeqFlashers.UpdateInterval = 20
  673. LightSeqFlashers.Play SeqBlinking, , 10, 30
  674. Case 4 'center
  675. LightSeqFlashers.UpdateInterval = 4
  676. LightSeqFlashers.Play SeqCircleOutOn, 15, 2
  677. Case 5 'top down
  678. LightSeqFlashers.UpdateInterval = 4
  679. LightSeqFlashers.Play SeqDownOn, 15, 2
  680. Case 6 'down to top
  681. LightSeqFlashers.UpdateInterval = 4
  682. LightSeqFlashers.Play SeqUpOn, 15, 1
  683. End Select
  684. End Sub
  685.  
  686. '***************************************************************
  687. ' Supporting Ball & Sound Functions v3.0
  688. ' includes random pitch in PlaySoundAt and PlaySoundAtBall
  689. '***************************************************************
  690.  
  691. Dim TableWidth, TableHeight
  692.  
  693. TableWidth = Table1.width
  694. TableHeight = Table1.height
  695.  
  696. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  697. Vol = Csng(BallVel(ball) ^2 / 2000)
  698. End Function
  699.  
  700. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  701. Dim tmp
  702. tmp = ball.x * 2 / TableWidth-1
  703. If tmp> 0 Then
  704. Pan = Csng(tmp ^10)
  705. Else
  706. Pan = Csng(-((- tmp) ^10))
  707. End If
  708. End Function
  709.  
  710. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  711. Pitch = BallVel(ball) * 20
  712. End Function
  713.  
  714. Function BallVel(ball) 'Calculates the ball speed
  715. BallVel = (SQR((ball.VelX ^2) + (ball.VelY ^2)))
  716. End Function
  717.  
  718. Function AudioFade(ball) 'only on VPX 10.4 and newer
  719. Dim tmp
  720. tmp = ball.y * 2 / TableHeight-1
  721. If tmp> 0 Then
  722. AudioFade = Csng(tmp ^10)
  723. Else
  724. AudioFade = Csng(-((- tmp) ^10))
  725. End If
  726. End Function
  727.  
  728. Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
  729. PlaySound soundname, 0, 1, Pan(tableobj), 0.1, 0, 0, 0, AudioFade(tableobj)
  730. End Sub
  731.  
  732. Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets, metals, plastics
  733. PlaySound soundname, 0, Vol(ActiveBall), pan(ActiveBall), 0.4, 0, 0, 0, AudioFade(ActiveBall)
  734. End Sub
  735.  
  736. Function RndNbr(n) 'returns a random number between 1 and n
  737. Randomize timer
  738. RndNbr = Int((n * Rnd) + 1)
  739. End Function
  740.  
  741. '***********************************************
  742. ' JP's VP10 Rolling Sounds + Ballshadow v3.0
  743. ' uses a collection of shadows, aBallShadow
  744. '***********************************************
  745.  
  746. Const tnob = 19 'total number of balls, 20 balls, from 0 to 19
  747. Const lob = 0 'number of locked balls
  748. Const maxvel = 32 'max ball velocity
  749. ReDim rolling(tnob)
  750. InitRolling
  751.  
  752. Sub InitRolling
  753. Dim i
  754. For i = 0 to tnob
  755. rolling(i) = False
  756. Next
  757. End Sub
  758.  
  759. Sub RollingUpdate()
  760. Dim BOT, b, ballpitch, ballvol, speedfactorx, speedfactory
  761. BOT = GetBalls
  762.  
  763. ' stop the sound of deleted balls and hide the shadow
  764. For b = UBound(BOT) + 1 to tnob
  765. rolling(b) = False
  766. StopSound("fx_ballrolling" & b)
  767. aBallShadow(b).Y = 3000
  768. Next
  769.  
  770. ' exit the sub if no balls on the table
  771. If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table
  772.  
  773. ' play the rolling sound for each ball and draw the shadow
  774. For b = lob to UBound(BOT)
  775. aBallShadow(b).X = BOT(b).X
  776. aBallShadow(b).Y = BOT(b).Y
  777. aBallShadow(b).Height = BOT(b).Z -24
  778.  
  779. If BallVel(BOT(b))> 1 Then
  780. If BOT(b).z <30 Then
  781. ballpitch = Pitch(BOT(b))
  782. ballvol = Vol(BOT(b))
  783. Else
  784. ballpitch = Pitch(BOT(b)) + 25000 'increase the pitch on a ramp
  785. ballvol = Vol(BOT(b)) * 10
  786. End If
  787. rolling(b) = True
  788. PlaySound("fx_ballrolling" & b), -1, ballvol, Pan(BOT(b)), 0, ballpitch, 1, 0, AudioFade(BOT(b))
  789. Else
  790. If rolling(b) = True Then
  791. StopSound("fx_ballrolling" & b)
  792. rolling(b) = False
  793. End If
  794. End If
  795.  
  796. ' rothbauerw's Dropping Sounds
  797. If BOT(b).VelZ <-1 and BOT(b).z <55 and BOT(b).z> 27 Then 'height adjust for ball drop sounds
  798. PlaySound "fx_balldrop", 0, ABS(BOT(b).velz) / 17, Pan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  799. End If
  800.  
  801. ' jps ball speed control
  802. If BOT(b).VelX AND BOT(b).VelY <> 0 Then
  803. speedfactorx = ABS(maxvel / BOT(b).VelX)
  804. speedfactory = ABS(maxvel / BOT(b).VelY)
  805. If speedfactorx <1 Then
  806. BOT(b).VelX = BOT(b).VelX * speedfactorx
  807. BOT(b).VelY = BOT(b).VelY * speedfactorx
  808. End If
  809. If speedfactory <1 Then
  810. BOT(b).VelX = BOT(b).VelX * speedfactory
  811. BOT(b).VelY = BOT(b).VelY * speedfactory
  812. End If
  813. End If
  814. Next
  815. End Sub
  816.  
  817. '**********************
  818. ' Ball Collision Sound
  819. '**********************
  820.  
  821. Sub OnBallBallCollision(ball1, ball2, velocity)
  822. PlaySound "fx_collide", 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  823. End Sub
  824.  
  825. '************************************
  826. ' Diverse Collection Hit Sounds v3.0
  827. '************************************
  828.  
  829. Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
  830. Sub aMetalWires_Hit(idx):PlaySoundAtBall "fx_MetalWire":End Sub
  831. Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
  832. Sub aRubber_LongBands_Hit(idx):PlaySoundAtBall "fx_rubber_longband":End Sub
  833. Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
  834. Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
  835. Sub aRubber_Pegs_Hit(idx):PlaySoundAtBall "fx_rubber_peg":End Sub
  836. Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
  837. Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
  838. Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub
  839. Sub aTriggers_Hit(idx):PlaySfx:End Sub
  840.  
  841. ' *********************************************************************
  842. ' User Defined Script Events
  843. ' *********************************************************************
  844.  
  845. ' Initialise the Table for a new Game
  846. '
  847. Sub ResetForNewGame()
  848. Dim i
  849.  
  850. bGameInPLay = True
  851.  
  852. 'resets the score display, and turn off attract mode
  853. StopAttractMode
  854. GiOn
  855.  
  856. TotalGamesPlayed = TotalGamesPlayed + 1
  857. CurrentPlayer = 1
  858. PlayersPlayingGame = 1
  859. bOnTheFirstBall = True
  860. For i = 1 To MaxPlayers
  861. Score(i) = 0
  862. BonusPoints(i) = 10000
  863. BonusHeldPoints(i) = 0
  864. BonusMultiplier(i) = 1
  865. PlayfieldMultiplier(i) = 1
  866. BallsRemaining(i) = BallsPerGame
  867. ExtraBallsAwards(i) = 0
  868. Next
  869.  
  870. ' initialise any other flags
  871. Tilt = 0
  872.  
  873. ' initialise Game variables
  874. Game_Init()
  875.  
  876. ' you may wish to start some music, play a sound, do whatever at this point
  877. PlaySound "sc_StartUp"
  878.  
  879. vpmtimer.addtimer 1500, "FirstBall '"
  880. End Sub
  881.  
  882. ' This is used to delay the start of a game to allow any attract sequence to
  883. ' complete. When it expires it creates a ball for the player to start playing with
  884.  
  885. Sub FirstBall
  886. ' reset the table for a new ball
  887. ResetForNewPlayerBall()
  888. ' create a new ball in the shooters lane
  889. CreateNewBall()
  890. End Sub
  891.  
  892. ' (Re-)Initialise the Table for a new ball (either a new ball after the player has
  893. ' lost one or we have moved onto the next player (if multiple are playing))
  894.  
  895. Sub ResetForNewPlayerBall()
  896. ' make sure the correct display is upto date
  897. AddScore 0
  898.  
  899. ' set the current players bonus multiplier back down to 1X
  900. ' SetBonusMultiplier 1
  901.  
  902. ' reduce the playfield multiplier
  903. ' reset any drop targets, lights, game Mode etc..
  904.  
  905. BonusPoints(CurrentPlayer) = 10000
  906. bBonusHeld = False
  907. bExtraBallWonThisBall = False
  908.  
  909. 'Reset any table specific
  910. ResetNewBallVariables
  911.  
  912. 'This is a new ball, so activate the ballsaver
  913. bBallSaverReady = True
  914.  
  915. 'and the skillshot
  916. bSkillShotReady = True
  917.  
  918. 'Change the music ?
  919. End Sub
  920.  
  921. ' Create a new ball on the Playfield
  922.  
  923. Sub CreateNewBall()
  924. ' create a ball in the plunger lane kicker.
  925. BallRelease.CreateSizedBallWithMass BallSize / 2, BallMass
  926.  
  927. ' There is a (or another) ball on the playfield
  928. BallsOnPlayfield = BallsOnPlayfield + 1
  929.  
  930. ' kick it out..
  931. PlaySoundAt SoundFXDOF("fx_Ballrel", 123, DOFPulse, DOFContactors), BallRelease
  932. BallRelease.Kick 90, 4
  933.  
  934. ' if there is 2 or more balls then set the multibal flag (remember to check for locked balls and other balls used for animations)
  935. ' set the bAutoPlunger flag to kick the ball in play automatically
  936. If BallsOnPlayfield> 1 Then
  937. DOF 143, DOFPulse
  938. bMultiBallMode = True
  939. bAutoPlunger = True
  940. End If
  941. End Sub
  942.  
  943. ' Add extra balls to the table with autoplunger
  944. ' Use it as AddMultiball 4 to add 4 extra balls to the table
  945.  
  946. Sub AddMultiball(nballs)
  947. mBalls2Eject = mBalls2Eject + nballs
  948. CreateMultiballTimer.Enabled = True
  949. 'and eject the first ball
  950. CreateMultiballTimer_Timer
  951. End Sub
  952.  
  953. ' Eject the ball after the delay, AddMultiballDelay
  954. Sub CreateMultiballTimer_Timer()
  955. ' wait if there is a ball in the plunger lane
  956. If bBallInPlungerLane Then
  957. Exit Sub
  958. Else
  959. If BallsOnPlayfield <MaxMultiballs Then
  960. CreateNewBall()
  961. mBalls2Eject = mBalls2Eject -1
  962. If mBalls2Eject = 0 Then 'if there are no more balls to eject then stop the timer
  963. CreateMultiballTimer.Enabled = False
  964. End If
  965. Else 'the max number of multiballs is reached, so stop the timer
  966. mBalls2Eject = 0
  967. CreateMultiballTimer.Enabled = False
  968. End If
  969. End If
  970. End Sub
  971.  
  972. ' The Player has lost his ball (there are no more balls on the playfield).
  973. ' Handle any bonus points awarded
  974.  
  975. Sub EndOfBall()
  976. Dim TotalBonus
  977. TotalBonus = 0
  978.  
  979. ' the first ball has been lost. From this point on no new players can join in
  980. bOnTheFirstBall = False
  981.  
  982. ' only process any of this if the table is not tilted.
  983. '(the tilt recovery mechanism will handle any extra balls or end of game)
  984.  
  985. If NOT Tilted Then
  986.  
  987. 'add in any bonus points (multipled by the bonus multiplier)
  988.  
  989. 'Crash Bonus
  990. DMD CL(0, FormatScore(BonusPoints(CurrentPlayer))), CL(1, "CRASH BONUS"), "", eNone, eNone, eNone, 1500, True, "vo_Crash Bonus"
  991.  
  992. ' calculate the totalbonus
  993. ' DMD CL(0, "BONUS MULTIPLIER"), CL(1, "X " &BonusMultiplier(CurrentPlayer)), "", eNone, eNone, eNone, 1000, True, ""
  994. TotalBonus = BonusPoints(CurrentPlayer) * BonusMultiplier(CurrentPlayer) + BonusHeldPoints(CurrentPlayer)
  995.  
  996. ' handle the bonus held
  997. ' reset the bonus held value since it has been already added to the bonus
  998. BonusHeldPoints(CurrentPlayer) = 0
  999.  
  1000. ' the player has won the bonus held award so do something with it :)
  1001. If bBonusHeld Then
  1002. If Balls = BallsPerGame Then ' this is the last ball, so if bonus held has been awarded then double the bonus
  1003. TotalBonus = TotalBonus * 2
  1004. End If
  1005. Else ' this is not the last ball so save the bonus for the next ball
  1006. BonusHeldPoints(CurrentPlayer) = TotalBonus
  1007. End If
  1008. bBonusHeld = False
  1009.  
  1010. ' Add the bonus to the score
  1011. DMD CL(0, FormatScore(TotalBonus)), CL(1, "TOTAL BONUS"), "", eNone, eNone, eNone, 1500, True, ""
  1012.  
  1013. AddScore TotalBonus
  1014.  
  1015. ' add a bit of a delay to allow for the bonus points to be shown & added up
  1016. vpmtimer.addtimer 3000, "EndOfBall2 '"
  1017. Else 'if tilted then only add a short delay and move to the 2nd part of the end of the ball
  1018. vpmtimer.addtimer 100, "EndOfBall2 '"
  1019. End If
  1020. End Sub
  1021.  
  1022. ' The Timer which delays the machine to allow any bonus points to be added up
  1023. ' has expired. Check to see if there are any extra balls for this player.
  1024. ' if not, then check to see if this was the last ball (of the CurrentPlayer)
  1025. '
  1026. Sub EndOfBall2()
  1027. ' if were tilted, reset the internal tilted flag (this will also
  1028. ' set TiltWarnings back to zero) which is useful if we are changing player
  1029. Tilted = False
  1030. Tilt = 0
  1031. DisableTable False 'enable again bumpers and slingshots
  1032.  
  1033. ' has the player won an extra-ball ? (might be multiple outstanding)
  1034. If(ExtraBallsAwards(CurrentPlayer) <> 0)Then
  1035. 'debug.print "Extra Ball"
  1036.  
  1037. ' yep got to give it to them
  1038. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer)- 1
  1039.  
  1040. ' if no more EB's then turn off any shoot again light
  1041. If(ExtraBallsAwards(CurrentPlayer) = 0)Then
  1042. li030.State = 0
  1043. End If
  1044.  
  1045. ' You may wish to do a bit of a song AND dance at this point
  1046. DMD CL(0, "EXTRA BALL"), CL(1, "SHOOT AGAIN"), "", eNone, eNone, eBlink, 1000, True, ""
  1047.  
  1048. ' In this table an extra ball will have the skillshot and ball saver, so we reset the playfield for the new ball
  1049. ResetForNewPlayerBall()
  1050.  
  1051. ' Create a new ball in the shooters lane
  1052. CreateNewBall()
  1053. Else ' no extra balls
  1054.  
  1055. BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer)- 1
  1056.  
  1057. ' was that the last ball ?
  1058. If(BallsRemaining(CurrentPlayer) <= 0)Then
  1059. 'debug.print "No More Balls, High Score Entry"
  1060.  
  1061. ' Submit the CurrentPlayers score to the High Score system
  1062. CheckHighScore()
  1063. ' you may wish to play some music at this point
  1064.  
  1065. Else
  1066.  
  1067. ' not the last ball (for that player)
  1068. ' if multiple players are playing then move onto the next one
  1069. EndOfBallComplete()
  1070. End If
  1071. End If
  1072. End Sub
  1073.  
  1074. ' This function is called when the end of bonus display
  1075. ' (or high score entry finished) AND it either end the game or
  1076. ' move onto the next player (or the next ball of the same player)
  1077. '
  1078. Sub EndOfBallComplete()
  1079. Dim NextPlayer
  1080.  
  1081. 'debug.print "EndOfBall - Complete"
  1082.  
  1083. ' are there multiple players playing this game ?
  1084. If(PlayersPlayingGame> 1)Then
  1085. ' then move to the next player
  1086. NextPlayer = CurrentPlayer + 1
  1087. ' are we going from the last player back to the first
  1088. ' (ie say from player 4 back to player 1)
  1089. If(NextPlayer> PlayersPlayingGame)Then
  1090. NextPlayer = 1
  1091. End If
  1092. Else
  1093. NextPlayer = CurrentPlayer
  1094. End If
  1095.  
  1096. 'debug.print "Next Player = " & NextPlayer
  1097.  
  1098. ' is it the end of the game ? (all balls been lost for all players)
  1099. If((BallsRemaining(CurrentPlayer) <= 0)AND(BallsRemaining(NextPlayer) <= 0))Then
  1100. ' you may wish to do some sort of Point Match free game award here
  1101. ' generally only done when not in free play mode
  1102.  
  1103. ' set the machine into game over mode
  1104. EndOfGame()
  1105.  
  1106. ' you may wish to put a Game Over message on the desktop/backglass
  1107.  
  1108. Else
  1109. ' set the next player
  1110. CurrentPlayer = NextPlayer
  1111.  
  1112. ' make sure the correct display is up to date
  1113. AddScore 0
  1114.  
  1115. ' reset the playfield for the new player (or new ball)
  1116. ResetForNewPlayerBall()
  1117.  
  1118. ' AND create a new ball
  1119. CreateNewBall()
  1120.  
  1121. ' play a sound if more than 1 player
  1122. If PlayersPlayingGame> 1 Then
  1123. Select Case CurrentPlayer
  1124. Case 1:DMD "", CL(1, "PLAYER 1"), "", eNone, eNone, eNone, 1000, True, "vo_player1"
  1125. Case 2:DMD "", CL(1, "PLAYER 2"), "", eNone, eNone, eNone, 1000, True, "vo_player2"
  1126. Case 3:DMD "", CL(1, "PLAYER 3"), "", eNone, eNone, eNone, 1000, True, "vo_player3"
  1127. Case 4:DMD "", CL(1, "PLAYER 4"), "", eNone, eNone, eNone, 1000, True, "vo_player4"
  1128. End Select
  1129. End If
  1130. End If
  1131. End Sub
  1132.  
  1133. ' This function is called at the End of the Game, it should reset all
  1134. ' Drop targets, AND eject any 'held' balls, start any attract sequences etc..
  1135.  
  1136. Sub EndOfGame()
  1137. 'debug.print "End Of Game"
  1138. bGameInPLay = False
  1139. ' just ended your game then play the end of game tune
  1140. If NOT bJustStarted Then
  1141.  
  1142. End If
  1143. bJustStarted = False
  1144. ' ensure that the flippers are down
  1145. SolLFlipper 0
  1146. SolRFlipper 0
  1147.  
  1148. ' terminate all Mode - eject locked balls
  1149. ' most of the Mode/timers terminate at the end of the ball
  1150.  
  1151. ' set any lights for the attract mode
  1152. GiOff
  1153. StartAttractMode
  1154. ' you may wish to light any Game Over Light you may have
  1155. End Sub
  1156.  
  1157. Function Balls
  1158. Dim tmp
  1159. tmp = BallsPerGame - BallsRemaining(CurrentPlayer) + 1
  1160. If tmp> BallsPerGame Then
  1161. Balls = BallsPerGame
  1162. Else
  1163. Balls = tmp
  1164. End If
  1165. End Function
  1166.  
  1167. ' *********************************************************************
  1168. ' Drain / Plunger Functions
  1169. ' *********************************************************************
  1170.  
  1171. ' lost a ball ;-( check to see how many balls are on the playfield.
  1172. ' if only one then decrement the remaining count AND test for End of game
  1173. ' if more than 1 ball (multi-ball) then kill of the ball but don't create
  1174. ' a new one
  1175. '
  1176. Sub Drain_Hit()
  1177. ' Destroy the ball
  1178. Drain.DestroyBall
  1179. If bGameInPLay = False Then Exit Sub 'don't do anything, just delete the ball
  1180. ' Exit Sub ' only for debugging - this way you can add balls from the debug window
  1181.  
  1182. BallsOnPlayfield = BallsOnPlayfield - 1
  1183.  
  1184. ' only for this table
  1185. If BallsOnPlayfield = 2 then li049.State = 0
  1186. If BallsOnPlayfield = 1 then li050.State = 0:li050.State = 0
  1187.  
  1188. ' pretend to knock the ball into the ball storage mech
  1189. PlaySoundAt "fx_drain", Drain
  1190. 'if Tilted the end Ball Mode
  1191. If Tilted Then
  1192. StopEndOfBallMode
  1193. End If
  1194.  
  1195. ' if there is a game in progress AND it is not Tilted
  1196. If(bGameInPLay = True)AND(Tilted = False)Then
  1197.  
  1198. ' is the ball saver active,
  1199. If(bBallSaverActive = True)Then
  1200.  
  1201. ' yep, create a new ball in the shooters lane
  1202. ' we use the Addmultiball in case the multiballs are being ejected
  1203. AddMultiball 1
  1204. ' we kick the ball with the autoplunger
  1205. bAutoPlunger = True
  1206. ' you may wish to put something on a display or play a sound at this point
  1207. DMD "_", CL(1, "RE-DEPLOY"), "_", eNone, eNone, eNone, 1000, True, ""
  1208. Else
  1209. ' cancel any multiball if on last ball (ie. lost all other balls)
  1210. If(BallsOnPlayfield = 1)Then
  1211. ' AND in a multi-ball??
  1212. If(bMultiBallMode = True)then
  1213. ' not in multiball mode any more
  1214. bMultiBallMode = False
  1215. ' you may wish to change any music over at this point and
  1216.  
  1217. ' turn off any multiball specific lights
  1218. ' ChangeGi white
  1219. 'stop any multiball modes
  1220. StopMBmodes
  1221. End If
  1222. End If
  1223.  
  1224. ' was that the last ball on the playfield
  1225. If(BallsOnPlayfield = 0)Then
  1226. ' End Mode and timers
  1227.  
  1228. ' ChangeGi white
  1229. ' Show the end of ball animation
  1230. ' and continue with the end of ball
  1231. ' DMD something?
  1232. StopEndOfBallMode
  1233. vpmtimer.addtimer 200, "EndOfBall '" 'the delay is depending of the animation of the end of ball, if there is no animation then move to the end of ball
  1234. End If
  1235. End If
  1236. End If
  1237. End Sub
  1238.  
  1239. ' The Ball has rolled out of the Plunger Lane and it is pressing down the trigger in the shooters lane
  1240. ' Check to see if a ball saver mechanism is needed and if so fire it up.
  1241.  
  1242. Sub swPlungerRest_Hit()
  1243. 'debug.print "ball in plunger lane"
  1244. ' some sound according to the ball position
  1245. PlaySoundAt "fx_sensor", swPlungerRest
  1246. bBallInPlungerLane = True
  1247. ' turn on Launch light is there is one
  1248. 'LaunchLight.State = 2
  1249.  
  1250. 'be sure to update the Scoreboard after the animations, if any
  1251.  
  1252. ' kick the ball in play if the bAutoPlunger flag is on
  1253. If bAutoPlunger Then
  1254. 'debug.print "autofire the ball"
  1255. vpmtimer.addtimer 1500, "PlungerIM.AutoFire:bAutoPlunger = False:DOF 143, DOFPulse '" ' Outhere
  1256. End If
  1257. 'Start the Selection of the skillshot if ready
  1258. If bSkillShotReady Then
  1259. PlaySong "mu_wait"
  1260. UpdateSkillshot()
  1261. End If
  1262. End Sub
  1263.  
  1264. ' The ball is released from the plunger turn off some flags and check for skillshot
  1265.  
  1266. Sub swPlungerRest_UnHit()
  1267. lighteffect 6
  1268. bBallInPlungerLane = False
  1269. swPlungerRest.TimerEnabled = 0 'stop the launch ball timer if active
  1270. If bSkillShotReady Then
  1271. PlaySong "mu_main"
  1272. End If
  1273. ' if there is a need for a ball saver, then start off a timer
  1274. ' only start if it is ready, and it is currently not running, else it will reset the time period
  1275. If(bBallSaverReady = True)AND(BallSaverTime <> 0)And(bBallSaverActive = False)Then
  1276. EnableBallSaver BallSaverTime
  1277. End If
  1278. ' turn off LaunchLights
  1279. li113.State = 0
  1280. li114.State = 0
  1281. li115.State = 0
  1282. li116.State = 0
  1283. li117.State = 0
  1284. li118.State = 0
  1285. ' Start Fuel & timers
  1286. Fuel = 6
  1287. UpdateFuelLights
  1288. StartFuelTimers
  1289. End Sub
  1290.  
  1291. Sub EnableBallSaver(seconds)
  1292. 'debug.print "Ballsaver started"
  1293. ' set our game flag
  1294. bBallSaverActive = True
  1295. bBallSaverReady = False
  1296. ' start the timer
  1297. BallSaverTimerExpired.Interval = 1000 * seconds
  1298. BallSaverTimerExpired.Enabled = True
  1299. BallSaverSpeedUpTimer.Interval = 1000 * seconds -(1000 * seconds) / 3
  1300. BallSaverSpeedUpTimer.Enabled = True
  1301. ' if you have a ball saver light you might want to turn it on at this point (or make it flash)
  1302. LightShootAgain.BlinkInterval = 160
  1303. LightShootAgain.State = 2
  1304. End Sub
  1305.  
  1306. ' The ball saver timer has expired. Turn it off AND reset the game flag
  1307. '
  1308. Sub BallSaverTimerExpired_Timer()
  1309. 'debug.print "Ballsaver ended"
  1310. BallSaverTimerExpired.Enabled = False
  1311. ' clear the flag
  1312. bBallSaverActive = False
  1313. ' if you have a ball saver light then turn it off at this point
  1314. LightShootAgain.State = 0
  1315. End Sub
  1316.  
  1317. Sub BallSaverSpeedUpTimer_Timer()
  1318. 'debug.print "Ballsaver Speed Up Light"
  1319. BallSaverSpeedUpTimer.Enabled = False
  1320. ' Speed up the blinking
  1321. LightShootAgain.BlinkInterval = 80
  1322. LightShootAgain.State = 2
  1323. End Sub
  1324.  
  1325. ' *********************************************************************
  1326. ' Supporting Score Functions
  1327. ' *********************************************************************
  1328.  
  1329. ' Add points to the score AND update the score board
  1330.  
  1331. Sub AddScore(points)
  1332. If Tilted Then Exit Sub
  1333. ' add the points to the current players score variable
  1334. Score(CurrentPlayer) = Score(CurrentPlayer) + points * PlayfieldMultiplier(CurrentPlayer)
  1335. ' Add some points to the Bonus and Jackpot if they are enabled
  1336. If bBonusActivated Then AddBonus points
  1337. If bJackpotActivated Then AddJackpot points
  1338.  
  1339. ' you may wish to check to see if the player has gotten a replay due to high score
  1340. End Sub
  1341.  
  1342. ' Add bonus to the bonuspoints AND update the score board
  1343.  
  1344. Sub AddBonus(points)
  1345. If Tilted Then Exit Sub
  1346. ' add the bonus to the current players bonus variable
  1347. BonusPoints(CurrentPlayer) = BonusPoints(CurrentPlayer) + points
  1348. If BonusPoints(CurrentPlayer)> 5000000 Then
  1349. BonusPoints(CurrentPlayer) = 5000000
  1350. End If
  1351. End Sub
  1352.  
  1353. ' Add some points to the current Jackpot.
  1354. '
  1355. Sub AddJackpot(points)
  1356. ' Jackpots only generally increment in multiball mode AND not tilted
  1357. ' but this doesn't have to be the case
  1358. If Tilted Then Exit Sub
  1359.  
  1360. ' If(bMultiBallMode = True) Then
  1361. Jackpot(CurrentPlayer) = Jackpot(CurrentPlayer) + points
  1362. ' DMD "_", CL(1, "INCREASED JACKPOT"), "_", eNone, eNone, eNone, 1000, True, ""
  1363. ' you may wish to limit the jackpot to a upper limit, ie..
  1364. ' If (Jackpot >= 6000) Then
  1365. ' Jackpot = 6000
  1366. ' End if
  1367. 'End if
  1368. End Sub
  1369.  
  1370. Sub AwardExtraBall() 'more like a replay in this table
  1371. If NOT bExtraBallWonThisBall Then
  1372. DMD "_", CL(1, ("REPLAY AWARDED")), "_", eNone, eNone, eNone, 1000, True, SoundFXDOF("vo_Replay Awarded", 122, DOFPulse, DOFKnocker)
  1373. DOF 121, DOFPulse
  1374. ExtraBallsAwards(CurrentPlayer) = 1 ' only one ball per ball in this game
  1375. bExtraBallWonThisBall = True
  1376. li030.State = 1 'light the shoot again lamp
  1377. GiEffect 2
  1378. LightEffect 2
  1379. END If
  1380. End Sub
  1381.  
  1382. Sub AwardSpecial()
  1383. DMD "_", CL(1, ("EXTRA GAME WON")), "_", eNone, eNone, eNone, 1000, True, SoundFXDOF("fx_Knocker", 122, DOFPulse, DOFKnocker)
  1384. DOF 121, DOFPulse
  1385. Credits = Credits + 1
  1386. If bFreePlay = False Then DOF 125, DOFOn
  1387. LightEffect 2
  1388. GiEffect 2
  1389. End Sub
  1390.  
  1391. Sub AwardJackpot() 'award a normal jackpot
  1392. DMD CL(0, FormatScore(Jackpot(CurrentPlayer))), CL(1, "JACKPOT"), "", eNone, eNone, eNone, 1000, True, "vo_Jackpot Awarded"
  1393. DOF 126, DOFPulse
  1394. AddScore Jackpot(CurrentPlayer)
  1395. 'reset the Jackpot Value
  1396. Jackpot(CurrentPlayer) = 20000
  1397. LightEffect 2
  1398. GiEffect 2
  1399. End Sub
  1400.  
  1401. Sub AwardSkillshot()
  1402. 'stop the skillshot lights
  1403. StopSkillshot
  1404. 'show dmd animation
  1405. DMD CL(0, FormatScore(SkillshotValue(CurrentPlayer))), CL(1, "SKILLSHOT"), "", eNone, eNone, eNone, 1000, True, "vo_Skill Shot"
  1406. DOF 127, DOFPulse
  1407. Addscore SkillShotValue(CurrentPlayer)
  1408. 'do some light show
  1409. GiEffect 2
  1410. LightEffect 2
  1411. End Sub
  1412.  
  1413. '*****************************
  1414. ' Load / Save / Highscore
  1415. '*****************************
  1416.  
  1417. Sub Loadhs
  1418. Dim x
  1419. x = LoadValue(cGameName, "HighScore1")
  1420. If(x <> "")Then HighScore(0) = CDbl(x)Else HighScore(0) = 100000 End If
  1421. x = LoadValue(cGameName, "HighScore1Name")
  1422. If(x <> "")Then HighScoreName(0) = x Else HighScoreName(0) = "AAA" End If
  1423. x = LoadValue(cGameName, "HighScore2")
  1424. If(x <> "")then HighScore(1) = CDbl(x)Else HighScore(1) = 100000 End If
  1425. x = LoadValue(cGameName, "HighScore2Name")
  1426. If(x <> "")then HighScoreName(1) = x Else HighScoreName(1) = "BBB" End If
  1427. x = LoadValue(cGameName, "HighScore3")
  1428. If(x <> "")then HighScore(2) = CDbl(x)Else HighScore(2) = 100000 End If
  1429. x = LoadValue(cGameName, "HighScore3Name")
  1430. If(x <> "")then HighScoreName(2) = x Else HighScoreName(2) = "CCC" End If
  1431. x = LoadValue(cGameName, "HighScore4")
  1432. If(x <> "")then HighScore(3) = CDbl(x)Else HighScore(3) = 100000 End If
  1433. x = LoadValue(cGameName, "HighScore4Name")
  1434. If(x <> "")then HighScoreName(3) = x Else HighScoreName(3) = "DDD" End If
  1435. x = LoadValue(cGameName, "Credits")
  1436. If(x <> "")then Credits = CInt(x)Else Credits = 0:If bFreePlay = False Then DOF 125, DOFOff:End If
  1437. x = LoadValue(cGameName, "TotalGamesPlayed")
  1438. If(x <> "")then TotalGamesPlayed = CInt(x)Else TotalGamesPlayed = 0 End If
  1439. End Sub
  1440.  
  1441. Sub Savehs
  1442. SaveValue cGameName, "HighScore1", HighScore(0)
  1443. SaveValue cGameName, "HighScore1Name", HighScoreName(0)
  1444. SaveValue cGameName, "HighScore2", HighScore(1)
  1445. SaveValue cGameName, "HighScore2Name", HighScoreName(1)
  1446. SaveValue cGameName, "HighScore3", HighScore(2)
  1447. SaveValue cGameName, "HighScore3Name", HighScoreName(2)
  1448. SaveValue cGameName, "HighScore4", HighScore(3)
  1449. SaveValue cGameName, "HighScore4Name", HighScoreName(3)
  1450. SaveValue cGameName, "Credits", Credits
  1451. SaveValue cGameName, "TotalGamesPlayed", TotalGamesPlayed
  1452. End Sub
  1453.  
  1454. Sub Reseths
  1455. HighScoreName(0) = "AAA"
  1456. HighScoreName(1) = "BBB"
  1457. HighScoreName(2) = "CCC"
  1458. HighScoreName(3) = "DDD"
  1459. HighScore(0) = 150000
  1460. HighScore(1) = 140000
  1461. HighScore(2) = 130000
  1462. HighScore(3) = 120000
  1463. Savehs
  1464. Loadhs
  1465. End Sub
  1466.  
  1467. ' ***********************************************************
  1468. ' High Score Initals Entry Functions - based on Black's code
  1469. ' ***********************************************************
  1470.  
  1471. Dim hsbModeActive
  1472. Dim hsEnteredName
  1473. Dim hsEnteredDigits(3)
  1474. Dim hsCurrentDigit
  1475. Dim hsValidLetters
  1476. Dim hsCurrentLetter
  1477. Dim hsLetterFlash
  1478.  
  1479. Sub CheckHighscore()
  1480. Dim tmp
  1481. tmp = Score(CurrentPlayer)
  1482.  
  1483. If tmp> HighScore(0)Then 'add 1 credit for beating the highscore
  1484. Credits = Credits + 1
  1485. DOF 125, DOFOn
  1486. End If
  1487.  
  1488. If tmp> HighScore(3)Then
  1489. PlaySound SoundFXDOF("fx_Knocker", 122, DOFPulse, DOFKnocker)
  1490. DOF 121, DOFPulse
  1491. HighScore(3) = tmp
  1492. 'enter player's name
  1493. HighScoreEntryInit()
  1494. Else
  1495. EndOfBallComplete()
  1496. End If
  1497. End Sub
  1498.  
  1499. Sub HighScoreEntryInit()
  1500. hsbModeActive = True
  1501. PlaySound "vo_enterinitials"
  1502. hsLetterFlash = 0
  1503.  
  1504. hsEnteredDigits(0) = " "
  1505. hsEnteredDigits(1) = " "
  1506. hsEnteredDigits(2) = " "
  1507. hsCurrentDigit = 0
  1508.  
  1509. hsValidLetters = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<" ' < is back arrow
  1510. hsCurrentLetter = 1
  1511. DMDFlush()
  1512. HighScoreDisplayNameNow()
  1513.  
  1514. HighScoreFlashTimer.Interval = 250
  1515. HighScoreFlashTimer.Enabled = True
  1516. End Sub
  1517.  
  1518. Sub EnterHighScoreKey(keycode)
  1519. If keycode = LeftFlipperKey Then
  1520. playsound "fx_Previous"
  1521. hsCurrentLetter = hsCurrentLetter - 1
  1522. if(hsCurrentLetter = 0)then
  1523. hsCurrentLetter = len(hsValidLetters)
  1524. end if
  1525. HighScoreDisplayNameNow()
  1526. End If
  1527.  
  1528. If keycode = RightFlipperKey Then
  1529. playsound "fx_Next"
  1530. hsCurrentLetter = hsCurrentLetter + 1
  1531. if(hsCurrentLetter> len(hsValidLetters))then
  1532. hsCurrentLetter = 1
  1533. end if
  1534. HighScoreDisplayNameNow()
  1535. End If
  1536.  
  1537. If keycode = PlungerKey OR keycode = StartGameKey Then
  1538. if(mid(hsValidLetters, hsCurrentLetter, 1) <> "<")then
  1539. playsound "fx_Enter"
  1540. hsEnteredDigits(hsCurrentDigit) = mid(hsValidLetters, hsCurrentLetter, 1)
  1541. hsCurrentDigit = hsCurrentDigit + 1
  1542. if(hsCurrentDigit = 3)then
  1543. HighScoreCommitName()
  1544. else
  1545. HighScoreDisplayNameNow()
  1546. end if
  1547. else
  1548. playsound "fx_Esc"
  1549. hsEnteredDigits(hsCurrentDigit) = " "
  1550. if(hsCurrentDigit> 0)then
  1551. hsCurrentDigit = hsCurrentDigit - 1
  1552. end if
  1553. HighScoreDisplayNameNow()
  1554. end if
  1555. end if
  1556. End Sub
  1557.  
  1558. Sub HighScoreDisplayNameNow()
  1559. HighScoreFlashTimer.Enabled = False
  1560. hsLetterFlash = 0
  1561. HighScoreDisplayName()
  1562. HighScoreFlashTimer.Enabled = True
  1563. End Sub
  1564.  
  1565. Sub HighScoreDisplayName()
  1566. Dim i
  1567. Dim TempTopStr
  1568. Dim TempBotStr
  1569.  
  1570. TempTopStr = "YOUR NAME:"
  1571. dLine(0) = ExpandLine(TempTopStr, 0)
  1572. DMDUpdate 0
  1573.  
  1574. TempBotStr = " > "
  1575. if(hsCurrentDigit> 0)then TempBotStr = TempBotStr & hsEnteredDigits(0)
  1576. if(hsCurrentDigit> 1)then TempBotStr = TempBotStr & hsEnteredDigits(1)
  1577. if(hsCurrentDigit> 2)then TempBotStr = TempBotStr & hsEnteredDigits(2)
  1578.  
  1579. if(hsCurrentDigit <> 3)then
  1580. if(hsLetterFlash <> 0)then
  1581. TempBotStr = TempBotStr & "_"
  1582. else
  1583. TempBotStr = TempBotStr & mid(hsValidLetters, hsCurrentLetter, 1)
  1584. end if
  1585. end if
  1586.  
  1587. if(hsCurrentDigit <1)then TempBotStr = TempBotStr & hsEnteredDigits(1)
  1588. if(hsCurrentDigit <2)then TempBotStr = TempBotStr & hsEnteredDigits(2)
  1589.  
  1590. TempBotStr = TempBotStr & " < "
  1591. dLine(1) = ExpandLine(TempBotStr, 1)
  1592. DMDUpdate 1
  1593. End Sub
  1594.  
  1595. Sub HighScoreFlashTimer_Timer()
  1596. HighScoreFlashTimer.Enabled = False
  1597. hsLetterFlash = hsLetterFlash + 1
  1598. if(hsLetterFlash = 2)then hsLetterFlash = 0
  1599. HighScoreDisplayName()
  1600. HighScoreFlashTimer.Enabled = True
  1601. End Sub
  1602.  
  1603. Sub HighScoreCommitName()
  1604. HighScoreFlashTimer.Enabled = False
  1605. hsbModeActive = False
  1606.  
  1607. hsEnteredName = hsEnteredDigits(0) & hsEnteredDigits(1) & hsEnteredDigits(2)
  1608. if(hsEnteredName = " ")then
  1609. hsEnteredName = "YOU"
  1610. end if
  1611.  
  1612. HighScoreName(3) = hsEnteredName
  1613. SortHighscore
  1614. EndOfBallComplete()
  1615. End Sub
  1616.  
  1617. Sub SortHighscore
  1618. Dim tmp, tmp2, i, j
  1619. For i = 0 to 3
  1620. For j = 0 to 2
  1621. If HighScore(j) <HighScore(j + 1)Then
  1622. tmp = HighScore(j + 1)
  1623. tmp2 = HighScoreName(j + 1)
  1624. HighScore(j + 1) = HighScore(j)
  1625. HighScoreName(j + 1) = HighScoreName(j)
  1626. HighScore(j) = tmp
  1627. HighScoreName(j) = tmp2
  1628. End If
  1629. Next
  1630. Next
  1631. End Sub
  1632.  
  1633. '*********
  1634. ' LUT
  1635. '*********
  1636.  
  1637. Dim bLutActive, LUTImage
  1638. Sub LoadLUT
  1639. bLutActive = False
  1640. x = LoadValue(cGameName, "LUTImage")
  1641. If(x <> "")Then LUTImage = x Else LUTImage = 0
  1642. UpdateLUT
  1643. End Sub
  1644.  
  1645. Sub SaveLUT
  1646. SaveValue cGameName, "LUTImage", LUTImage
  1647. End Sub
  1648.  
  1649. Sub NextLUT:LUTImage = (LUTImage + 1)MOD 10:UpdateLUT:SaveLUT:End Sub
  1650.  
  1651. Sub UpdateLUT
  1652. Select Case LutImage
  1653. Case 0:table1.ColorGradeImage = "LUT0"
  1654. Case 1:table1.ColorGradeImage = "LUT1"
  1655. Case 2:table1.ColorGradeImage = "LUT2"
  1656. Case 3:table1.ColorGradeImage = "LUT3"
  1657. Case 4:table1.ColorGradeImage = "LUT4"
  1658. Case 5:table1.ColorGradeImage = "LUT5"
  1659. Case 6:table1.ColorGradeImage = "LUT6"
  1660. Case 7:table1.ColorGradeImage = "LUT7"
  1661. Case 8:table1.ColorGradeImage = "LUT8"
  1662. Case 9:table1.ColorGradeImage = "LUT9"
  1663. End Select
  1664. End Sub
  1665.  
  1666. ' *************************************************************************
  1667. ' JP's Reduced Display Driver Functions (based on script by Black)
  1668. ' only 5 effects: none, scroll left, scroll right, blink and blinkfast
  1669. ' 3 Lines, treats all 3 lines as text. 3rd line is just 1 character
  1670. ' Example format:
  1671. ' DMD "text1","text2","backpicture", eNone, eNone, eNone, 250, True, "sound"
  1672. ' Short names:
  1673. ' dq = display queue
  1674. ' de = display effect
  1675. ' *************************************************************************
  1676.  
  1677. Const eNone = 0 ' Instantly displayed
  1678. Const eScrollLeft = 1 ' scroll on from the right
  1679. Const eScrollRight = 2 ' scroll on from the left
  1680. Const eBlink = 3 ' Blink (blinks for 'TimeOn')
  1681. Const eBlinkFast = 4 ' Blink (blinks for 'TimeOn') at user specified intervals (fast speed)
  1682.  
  1683. Const dqSize = 64
  1684.  
  1685. Dim dqHead
  1686. Dim dqTail
  1687. Dim deSpeed
  1688. Dim deBlinkSlowRate
  1689. Dim deBlinkFastRate
  1690.  
  1691. Dim dCharsPerLine(2)
  1692. Dim dLine(2)
  1693. Dim deCount(2)
  1694. Dim deCountEnd(2)
  1695. Dim deBlinkCycle(2)
  1696.  
  1697. Dim dqText(2, 64)
  1698. Dim dqEffect(2, 64)
  1699. Dim dqTimeOn(64)
  1700. Dim dqbFlush(64)
  1701. Dim dqSound(64)
  1702.  
  1703. Dim FlexDMD
  1704. Dim DMDScene
  1705.  
  1706. Sub DMD_Init() 'default/startup values
  1707. If UseFlexDMD Then
  1708. Set FlexDMD = CreateObject("FlexDMD.FlexDMD")
  1709. If Not FlexDMD is Nothing Then
  1710. If FlexDMDHighQuality Then
  1711. FlexDMD.TableFile = Table1.Filename & ".vpx"
  1712. FlexDMD.RenderMode = 2
  1713. FlexDMD.Width = 256
  1714. FlexDMD.Height = 64
  1715. FlexDMD.Clear = True
  1716. FlexDMD.GameName = cGameName
  1717. FlexDMD.Run = True
  1718. Set DMDScene = FlexDMD.NewGroup("Scene")
  1719. DMDScene.AddActor FlexDMD.NewImage("Back", "VPX.bkborder")
  1720. DMDScene.GetImage("Back").SetSize FlexDMD.Width, FlexDMD.Height
  1721. For i = 0 to 40
  1722. DMDScene.AddActor FlexDMD.NewImage("Dig" & i, "VPX.d_empty&dmd=2")
  1723. Digits(i).Visible = False
  1724. Next
  1725. digitgrid.Visible = False
  1726. For i = 0 to 19 ' Top
  1727. DMDScene.GetImage("Dig" & i).SetBounds 8 + i * 12, 6, 12, 22
  1728. Next
  1729. For i = 20 to 39 ' Bottom
  1730. DMDScene.GetImage("Dig" & i).SetBounds 8 + (i - 20) * 12, 34, 12, 22
  1731. Next
  1732. FlexDMD.LockRenderThread
  1733. FlexDMD.Stage.AddActor DMDScene
  1734. FlexDMD.UnlockRenderThread
  1735. Else
  1736. FlexDMD.TableFile = Table1.Filename & ".vpx"
  1737. FlexDMD.RenderMode = 2
  1738. FlexDMD.Width = 128
  1739. FlexDMD.Height = 32
  1740. FlexDMD.Clear = True
  1741. FlexDMD.GameName = cGameName
  1742. FlexDMD.Run = True
  1743. Set DMDScene = FlexDMD.NewGroup("Scene")
  1744. DMDScene.AddActor FlexDMD.NewImage("Back", "VPX.bkborder")
  1745. DMDScene.GetImage("Back").SetSize FlexDMD.Width, FlexDMD.Height
  1746. For i = 0 to 40
  1747. DMDScene.AddActor FlexDMD.NewImage("Dig" & i, "VPX.d_empty&dmd=2")
  1748. Digits(i).Visible = False
  1749. Next
  1750. digitgrid.Visible = False
  1751. For i = 0 to 19 ' Top
  1752. DMDScene.GetImage("Dig" & i).SetBounds 4 + i * 6, 3, 6, 11
  1753. Next
  1754. For i = 20 to 39 ' Bottom
  1755. DMDScene.GetImage("Dig" & i).SetBounds 4 + (i - 20) * 6, 17, 6, 11
  1756. Next
  1757. FlexDMD.LockRenderThread
  1758. FlexDMD.Stage.AddActor DMDScene
  1759. FlexDMD.UnlockRenderThread
  1760. End If
  1761. End If
  1762. End If
  1763.  
  1764. Dim i, j
  1765. DMDFlush()
  1766. deSpeed = 20
  1767. deBlinkSlowRate = 5
  1768. deBlinkFastRate = 2
  1769. dCharsPerLine(0) = 20 'characters lower line
  1770. dCharsPerLine(1) = 20 'characters top line
  1771. dCharsPerLine(2) = 1 'characters back line
  1772. For i = 0 to 2
  1773. dLine(i) = Space(dCharsPerLine(i))
  1774. deCount(i) = 0
  1775. deCountEnd(i) = 0
  1776. deBlinkCycle(i) = 0
  1777. dqTimeOn(i) = 0
  1778. dqbFlush(i) = True
  1779. dqSound(i) = ""
  1780. Next
  1781. For i = 0 to 2
  1782. For j = 0 to 64
  1783. dqText(i, j) = ""
  1784. dqEffect(i, j) = eNone
  1785. Next
  1786. Next
  1787. DMD dLine(0), dLine(1), dLine(2), eNone, eNone, eNone, 25, True, ""
  1788. End Sub
  1789.  
  1790. Sub DMDFlush()
  1791. Dim i
  1792. DMDTimer.Enabled = False
  1793. DMDEffectTimer.Enabled = False
  1794. dqHead = 0
  1795. dqTail = 0
  1796. For i = 0 to 2
  1797. deCount(i) = 0
  1798. deCountEnd(i) = 0
  1799. deBlinkCycle(i) = 0
  1800. Next
  1801. End Sub
  1802.  
  1803. Sub DMDScore()
  1804. Dim tmp, tmp1, tmp1a, tmp1b, tmp2, tmp3, tmp4
  1805. if(dqHead = dqTail)Then
  1806. 'tmp = CL(0, FormatScore(Score(Currentplayer) ) )
  1807. tmp = FL(0, "P" &CurrentPlayer& " B" &Balls, FormatScore(Score(Currentplayer)))
  1808. tmp1 = ""
  1809. tmp2 = "bkborder"
  1810. tmp3 = True 'true or False
  1811.  
  1812. 'tmp1 = CL(1, "PLAYER " & CurrentPlayer & " BALL " & Balls)
  1813. 'tmp1 = FormatScore(Bonuspoints(Currentplayer) ) & " X" &BonusMultiplier(Currentplayer)
  1814. Select Case Mission(CurrentPlayer)
  1815. Case 0: 'no Mission active
  1816. If Score(CurrentPlayer) = 0 OR bSkillshotReady OR bGameInPlay = False Then
  1817. tmp1 = CL(1, "AWAITING DEPLOYMENT")
  1818. Else
  1819. If MissionSelected Then
  1820. tmp1 = CL(1, "ACCEPT MISSION")
  1821. Else
  1822. tmp1 = CL(1, "SELECT A MISSION")
  1823. End If
  1824. End If
  1825. Case 1:tmp1 = " RAMP HITS LEFT " &MissionHits
  1826. Case 2:tmp1 = " LANE HITS LEFT " &MissionHits
  1827. Case 3:tmp1 = "BUMPER HITS LEFT " &MissionHits
  1828. Case 4:tmp1 = "DROPTARGETS LEFT " &MissionHits
  1829. Case 5:tmp1 = "TARGET HITS LEFT " &MissionHits
  1830. Case 6:tmp1 = " UPGRADE FLAGS"
  1831. Case 61:tmp1 = "ENTER THE HYPERSPACE"
  1832. Case 7:tmp1 = "UPGRADE ATT. BUMPERS"
  1833. Case 71:tmp1 = "BUMPER HITS LEFT " &MissionHits
  1834. Case 8:tmp1 = "HIT YELLOW WORMHOLE"
  1835. Case 81:tmp1 = "HIT RED WORMHOLE"
  1836. Case 82:tmp1 = "HIT GREEN WORMHOLE"
  1837. Case 9:tmp1 = " HIT COMET TARGETS"
  1838. Case 91:tmp1 = "ENTER THE HYPERSPACE"
  1839. Case 10:tmp1 = "HIT RADIATION TRGETS"
  1840. Case 101:tmp1 = "ENTER ANY WORMHOLE"
  1841. Case 11:tmp1 = " UPGRADE ENG BUMPERS"
  1842. Case 111:tmp1 = "ENTER THE BLACK HOLE"
  1843. Case 12:tmp1 = "FLAG SPINS LEFT " &MissionHits
  1844. Case 121:tmp1 = " HIT SPACE WARP"
  1845. Case 13:tmp1 = "SATELLITE HITS " &MissionHits
  1846. Case 14:tmp1 = "LANE HITS LEFT " &MissionHits
  1847. Case 15:tmp1 = "OUTLANE HITS LEFT " &MissionHits
  1848. Case 16:tmp1 = "REBOUND HITS LEFT " &MissionHits
  1849. Case 161:tmp1 = "RAMP OR HYPERSPACE"
  1850. 'Maelstrom
  1851. Case 17:tmp1 = "DROPTARGETS LEFT " & MissionHits
  1852. Case 171:tmp1 = "SPOT TARGETS LEFT " & MissionHits
  1853. Case 172:tmp1 = "LANES LEFT " & MissionHits
  1854. Case 173:tmp1 = " HIT THE FUEL CHUTE"
  1855. Case 174:tmp1 = "HIT THE LAUNCH RAMP"
  1856. Case 175:tmp1 = " ROLL A FLAG"
  1857. Case 176:tmp1 = "ENTER A WORMHOLE"
  1858. Case 177:tmp1 = "ENTER HYPERSPACE"
  1859.  
  1860. End Select
  1861. End If
  1862. If Fuel = 1 then tmp1 = CL(1, "WARNING - LOW FUEL")
  1863. If Fuel = 0 then tmp1 = CL(1, "RE-FUEL SHIP")
  1864. DMD tmp, tmp1, tmp2, eNone, eNone, eNone, 25, tmp3, ""
  1865. End Sub
  1866.  
  1867. Sub DMDScoreNow
  1868. DMDFlush
  1869. DMDScore
  1870. End Sub
  1871.  
  1872. Sub DMD(Text0, Text1, Text2, Effect0, Effect1, Effect2, TimeOn, bFlush, Sound)
  1873. if(dqTail <dqSize)Then
  1874. if(Text0 = "_")Then
  1875. dqEffect(0, dqTail) = eNone
  1876. dqText(0, dqTail) = "_"
  1877. Else
  1878. dqEffect(0, dqTail) = Effect0
  1879. dqText(0, dqTail) = ExpandLine(Text0, 0)
  1880. End If
  1881.  
  1882. if(Text1 = "_")Then
  1883. dqEffect(1, dqTail) = eNone
  1884. dqText(1, dqTail) = "_"
  1885. Else
  1886. dqEffect(1, dqTail) = Effect1
  1887. dqText(1, dqTail) = ExpandLine(Text1, 1)
  1888. End If
  1889.  
  1890. if(Text2 = "_")Then
  1891. dqEffect(2, dqTail) = eNone
  1892. dqText(2, dqTail) = "_"
  1893. Else
  1894. dqEffect(2, dqTail) = Effect2
  1895. dqText(2, dqTail) = Text2 'it is always 1 letter in this table
  1896. End If
  1897.  
  1898. dqTimeOn(dqTail) = TimeOn
  1899. dqbFlush(dqTail) = bFlush
  1900. dqSound(dqTail) = Sound
  1901. dqTail = dqTail + 1
  1902. if(dqTail = 1)Then
  1903. DMDHead()
  1904. End If
  1905. End If
  1906. End Sub
  1907.  
  1908. Sub DMDHead()
  1909. Dim i
  1910. deCount(0) = 0
  1911. deCount(1) = 0
  1912. deCount(2) = 0
  1913. DMDEffectTimer.Interval = deSpeed
  1914.  
  1915. For i = 0 to 2
  1916. Select Case dqEffect(i, dqHead)
  1917. Case eNone:deCountEnd(i) = 1
  1918. Case eScrollLeft:deCountEnd(i) = Len(dqText(i, dqHead))
  1919. Case eScrollRight:deCountEnd(i) = Len(dqText(i, dqHead))
  1920. Case eBlink:deCountEnd(i) = int(dqTimeOn(dqHead) / deSpeed)
  1921. deBlinkCycle(i) = 0
  1922. Case eBlinkFast:deCountEnd(i) = int(dqTimeOn(dqHead) / deSpeed)
  1923. deBlinkCycle(i) = 0
  1924. End Select
  1925. Next
  1926. if(dqSound(dqHead) <> "")Then
  1927. PlaySound(dqSound(dqHead))
  1928. End If
  1929. DMDEffectTimer.Enabled = True
  1930. End Sub
  1931.  
  1932. Sub DMDEffectTimer_Timer()
  1933. DMDEffectTimer.Enabled = False
  1934. DMDProcessEffectOn()
  1935. End Sub
  1936.  
  1937. Sub DMDTimer_Timer()
  1938. Dim Head
  1939. DMDTimer.Enabled = False
  1940. Head = dqHead
  1941. dqHead = dqHead + 1
  1942. if(dqHead = dqTail)Then
  1943. if(dqbFlush(Head) = True)Then
  1944. DMDScoreNow()
  1945. Else
  1946. dqHead = 0
  1947. DMDHead()
  1948. End If
  1949. Else
  1950. DMDHead()
  1951. End If
  1952. End Sub
  1953.  
  1954. Sub DMDProcessEffectOn()
  1955. Dim i
  1956. Dim BlinkEffect
  1957. Dim Temp
  1958.  
  1959. BlinkEffect = False
  1960.  
  1961. For i = 0 to 2
  1962. if(deCount(i) <> deCountEnd(i))Then
  1963. deCount(i) = deCount(i) + 1
  1964.  
  1965. select case(dqEffect(i, dqHead))
  1966. case eNone:
  1967. Temp = dqText(i, dqHead)
  1968. case eScrollLeft:
  1969. Temp = Right(dLine(i), dCharsPerLine(i)- 1)
  1970. Temp = Temp & Mid(dqText(i, dqHead), deCount(i), 1)
  1971. case eScrollRight:
  1972. Temp = Mid(dqText(i, dqHead), (dCharsPerLine(i) + 1)- deCount(i), 1)
  1973. Temp = Temp & Left(dLine(i), dCharsPerLine(i)- 1)
  1974. case eBlink:
  1975. BlinkEffect = True
  1976. if((deCount(i)MOD deBlinkSlowRate) = 0)Then
  1977. deBlinkCycle(i) = deBlinkCycle(i)xor 1
  1978. End If
  1979.  
  1980. if(deBlinkCycle(i) = 0)Then
  1981. Temp = dqText(i, dqHead)
  1982. Else
  1983. Temp = Space(dCharsPerLine(i))
  1984. End If
  1985. case eBlinkFast:
  1986. BlinkEffect = True
  1987. if((deCount(i)MOD deBlinkFastRate) = 0)Then
  1988. deBlinkCycle(i) = deBlinkCycle(i)xor 1
  1989. End If
  1990.  
  1991. if(deBlinkCycle(i) = 0)Then
  1992. Temp = dqText(i, dqHead)
  1993. Else
  1994. Temp = Space(dCharsPerLine(i))
  1995. End If
  1996. End Select
  1997.  
  1998. if(dqText(i, dqHead) <> "_")Then
  1999. dLine(i) = Temp
  2000. DMDUpdate i
  2001. End If
  2002. End If
  2003. Next
  2004.  
  2005. if(deCount(0) = deCountEnd(0))and(deCount(1) = deCountEnd(1))and(deCount(2) = deCountEnd(2))Then
  2006.  
  2007. if(dqTimeOn(dqHead) = 0)Then
  2008. DMDFlush()
  2009. Else
  2010. if(BlinkEffect = True)Then
  2011. DMDTimer.Interval = 10
  2012. Else
  2013. DMDTimer.Interval = dqTimeOn(dqHead)
  2014. End If
  2015.  
  2016. DMDTimer.Enabled = True
  2017. End If
  2018. Else
  2019. DMDEffectTimer.Enabled = True
  2020. End If
  2021. End Sub
  2022.  
  2023. Function ExpandLine(TempStr, id) 'id is the number of the dmd line
  2024. If TempStr = "" Then
  2025. TempStr = Space(dCharsPerLine(id))
  2026. Else
  2027. if(Len(TempStr)> Space(dCharsPerLine(id)))Then
  2028. TempStr = Left(TempStr, Space(dCharsPerLine(id)))
  2029. Else
  2030. if(Len(TempStr) <dCharsPerLine(id))Then
  2031. TempStr = TempStr & Space(dCharsPerLine(id)- Len(TempStr))
  2032. End If
  2033. End If
  2034. End If
  2035. ExpandLine = TempStr
  2036. End Function
  2037.  
  2038. Function FormatScore(ByVal Num) 'it returns a string with commas (as in Black's original font)
  2039. dim i
  2040. dim NumString
  2041.  
  2042. NumString = CStr(abs(Num))
  2043.  
  2044. For i = Len(NumString)-3 to 1 step -3
  2045. if IsNumeric(mid(NumString, i, 1))then
  2046. NumString = left(NumString, i-1) & chr(asc(mid(NumString, i, 1)) + 128) & right(NumString, Len(NumString)- i)
  2047. end if
  2048. Next
  2049. FormatScore = NumString
  2050. End function
  2051.  
  2052. Function FL(id, NumString1, NumString2) 'Fill line
  2053. Dim Temp, TempStr
  2054. Temp = dCharsPerLine(id)- Len(NumString1)- Len(NumString2)
  2055. TempStr = NumString1 & Space(Temp) & NumString2
  2056. FL = TempStr
  2057. End Function
  2058.  
  2059. Function CL(id, NumString) 'center line
  2060. Dim Temp, TempStr
  2061. If Len(NumString) <dCharsPerLine(id)Then
  2062. Temp = (dCharsPerLine(id)- Len(NumString)) \ 2
  2063. TempStr = Space(Temp) & NumString & Space(Temp)
  2064. CL = TempStr
  2065. Else
  2066. CL = LEFT(NumString, dCharsPerLine(id))
  2067. End If
  2068. End Function
  2069.  
  2070. Function RL(id, NumString) 'right line
  2071. Dim Temp, TempStr
  2072. If Len(NumString) <dCharsPerLine(id)Then
  2073. Temp = dCharsPerLine(id)- Len(NumString)
  2074. TempStr = Space(Temp) & NumString
  2075. RL = TempStr
  2076. Else
  2077. RL = LEFT(NumString, dCharsPerLine(id))
  2078. End If
  2079. End Function
  2080.  
  2081. '**************
  2082. ' Update DMD
  2083. '**************
  2084.  
  2085. Sub DMDUpdate(id)
  2086. Dim digit, value
  2087. If UseFlexDMD Then FlexDMD.LockRenderThread
  2088. Select Case id
  2089. Case 0 'top text line
  2090. For digit = 0 to 19
  2091. DMDDisplayChar mid(dLine(0), digit + 1, 1), digit
  2092. Next
  2093. Case 1 'bottom text line
  2094. For digit = 20 to 39
  2095. DMDDisplayChar mid(dLine(1), digit -19, 1), digit
  2096. Next
  2097. Case 2 ' back image - back animations
  2098. If dLine(2) = "" OR dLine(2) = " " Then dLine(2) = "bkborder"
  2099. Digits(40).ImageA = dLine(2)
  2100. If UseFlexDMD Then DMDScene.GetImage("Back").Bitmap = FlexDMD.NewImage("", "VPX." & dLine(2) & "&dmd=2").Bitmap
  2101. End Select
  2102. If UseFlexDMD Then FlexDMD.UnlockRenderThread
  2103. End Sub
  2104.  
  2105. Sub DMDDisplayChar(achar, adigit)
  2106. If achar = "" Then achar = " "
  2107. achar = ASC(achar)
  2108. Digits(adigit).ImageA = Chars(achar)
  2109. If UseFlexDMD Then DMDScene.GetImage("Dig" & adigit).Bitmap = FlexDMD.NewImage("", "VPX." & Chars(achar) & "&dmd=2&add").Bitmap
  2110. End Sub
  2111.  
  2112. '*******************************
  2113. ' JP's new DMD using flashers
  2114. ' can now use small letters too
  2115. '*******************************
  2116.  
  2117. Dim Digits, Chars(255), Images(255)
  2118.  
  2119. DMDInit
  2120.  
  2121. Sub DMDInit
  2122. Dim i
  2123. Digits = Array(digit001, digit002, digit003, digit004, digit005, digit006, digit007, digit008, digit009, digit010, _
  2124. digit011, digit012, digit013, digit014, digit015, digit016, digit017, digit018, digit019, digit020, _
  2125. digit021, digit022, digit023, digit024, digit025, digit026, digit027, digit028, digit029, digit030, _
  2126. digit031, digit032, digit033, digit034, digit035, digit036, digit037, digit038, digit039, digit040, _
  2127. digit041)
  2128. For i = 0 to 255:Chars(i) = "d_empty":Next
  2129.  
  2130. Chars(32) = "d_empty"
  2131. Chars(33) = "" '!
  2132. Chars(34) = "" '"
  2133. Chars(35) = "" '#
  2134. Chars(36) = "" '$
  2135. Chars(37) = "" '%
  2136. Chars(38) = "" '&
  2137. Chars(39) = "" ''
  2138. Chars(40) = "" '(
  2139. Chars(41) = "" ')
  2140. Chars(42) = "" '*
  2141. Chars(43) = "d_plus" '+
  2142. Chars(44) = "" '
  2143. Chars(45) = "d_minus" '-
  2144. Chars(46) = "d_dot" '.
  2145. Chars(47) = "" '/
  2146. Chars(48) = "d_0" '0
  2147. Chars(49) = "d_1" '1
  2148. Chars(50) = "d_2" '2
  2149. Chars(51) = "d_3" '3
  2150. Chars(52) = "d_4" '4
  2151. Chars(53) = "d_5" '5
  2152. Chars(54) = "d_6" '6
  2153. Chars(55) = "d_7" '7
  2154. Chars(56) = "d_8" '8
  2155. Chars(57) = "d_9" '9
  2156. Chars(60) = "d_less" '<
  2157. Chars(61) = "" '=
  2158. Chars(62) = "d_more" '>
  2159. Chars(64) = "" '@
  2160. Chars(65) = "d_a" 'A
  2161. Chars(66) = "d_b" 'B
  2162. Chars(67) = "d_c" 'C
  2163. Chars(68) = "d_d" 'D
  2164. Chars(69) = "d_e" 'E
  2165. Chars(70) = "d_f" 'F
  2166. Chars(71) = "d_g" 'G
  2167. Chars(72) = "d_h" 'H
  2168. Chars(73) = "d_i" 'I
  2169. Chars(74) = "d_j" 'J
  2170. Chars(75) = "d_k" 'K
  2171. Chars(76) = "d_l" 'L
  2172. Chars(77) = "d_m" 'M
  2173. Chars(78) = "d_n" 'N
  2174. Chars(79) = "d_o" 'O
  2175. Chars(80) = "d_p" 'P
  2176. Chars(81) = "d_q" 'Q
  2177. Chars(82) = "d_r" 'R
  2178. Chars(83) = "d_s" 'S
  2179. Chars(84) = "d_t" 'T
  2180. Chars(85) = "d_u" 'U
  2181. Chars(86) = "d_v" 'V
  2182. Chars(87) = "d_w" 'W
  2183. Chars(88) = "d_x" 'X
  2184. Chars(89) = "d_y" 'Y
  2185. Chars(90) = "d_z" 'Z
  2186. Chars(94) = "d_up" '^
  2187. ' Chars(95) = '_
  2188. Chars(96) = "" '`
  2189. Chars(97) = "" 'a
  2190. Chars(98) = "" 'b
  2191. Chars(99) = "" 'c
  2192. Chars(100) = "" 'd
  2193. Chars(101) = "" 'e
  2194. Chars(102) = "" 'f
  2195. Chars(103) = "" 'g
  2196. Chars(104) = "" 'h
  2197. Chars(105) = "" 'i
  2198. Chars(106) = "" 'j
  2199. Chars(107) = "" 'k
  2200. Chars(108) = "" 'l
  2201. Chars(109) = "" 'm
  2202. Chars(110) = "" 'n
  2203. Chars(111) = "" 'o
  2204. Chars(112) = "" 'p
  2205. Chars(113) = "" 'q
  2206. Chars(114) = "" 'r
  2207. Chars(115) = "" 's
  2208. Chars(116) = "" 't
  2209. Chars(117) = "" 'u
  2210. Chars(118) = "" 'v
  2211. Chars(119) = "" 'w
  2212. Chars(120) = "" 'x
  2213. Chars(121) = "" 'y
  2214. Chars(122) = "" 'z
  2215. Chars(123) = "" '{
  2216. Chars(124) = "" '|
  2217. Chars(125) = "" '}
  2218. Chars(126) = "" '~
  2219. ' numbers with the dot
  2220. Chars(176) = "d_0a" '0.
  2221. Chars(177) = "d_1a" '1.
  2222. Chars(178) = "d_2a" '2.
  2223. Chars(179) = "d_3a" '3.
  2224. Chars(180) = "d_4a" '4.
  2225. Chars(181) = "d_5a" '5.
  2226. Chars(182) = "d_6a" '6.
  2227. Chars(183) = "d_7a" '7.
  2228. Chars(184) = "d_8a" '8.
  2229. Chars(185) = "d_9a" '9.
  2230. End Sub
  2231.  
  2232. '********************
  2233. ' Real Time updates
  2234. '********************
  2235. 'used for all the real time updates
  2236.  
  2237. Sub Realtime_Timer
  2238. RollingUpdate
  2239. LeftFlipperTop.RotZ = LeftFlipper.CurrentAngle
  2240. RightFlipperTop.RotZ = RightFlipper.CurrentAngle
  2241. ' add any other real time update subs, like gates or diverters
  2242. LeftDiverter.RotZ = LeftLaneGate.CurrentAngle
  2243. RightDiverter.RotZ = RightLaneGate.CurrentAngle
  2244. End Sub
  2245.  
  2246. '********************************************************************************************
  2247. ' Only for VPX 10.2 and higher.
  2248. ' FlashForMs will blink light or a flasher for TotalPeriod(ms) at rate of BlinkPeriod(ms)
  2249. ' When TotalPeriod done, light or flasher will be set to FinalState value where
  2250. ' Final State values are: 0=Off, 1=On, 2=Return to previous State
  2251. '********************************************************************************************
  2252.  
  2253. Sub FlashForMs(MyLight, TotalPeriod, BlinkPeriod, FinalState) 'thanks gtxjoe for the first version
  2254.  
  2255. If TypeName(MyLight) = "Light" Then
  2256.  
  2257. If FinalState = 2 Then
  2258. FinalState = MyLight.State 'Keep the current light state
  2259. End If
  2260. MyLight.BlinkInterval = BlinkPeriod
  2261. MyLight.Duration 2, TotalPeriod, FinalState
  2262. ElseIf TypeName(MyLight) = "Flasher" Then
  2263.  
  2264. Dim steps
  2265.  
  2266. ' Store all blink information
  2267. steps = Int(TotalPeriod / BlinkPeriod + .5) 'Number of ON/OFF steps to perform
  2268. If FinalState = 2 Then 'Keep the current flasher state
  2269. FinalState = ABS(MyLight.Visible)
  2270. End If
  2271. MyLight.UserValue = steps * 10 + FinalState 'Store # of blinks, and final state
  2272.  
  2273. ' Start blink timer and create timer subroutine
  2274. MyLight.TimerInterval = BlinkPeriod
  2275. MyLight.TimerEnabled = 0
  2276. MyLight.TimerEnabled = 1
  2277. ExecuteGlobal "Sub " & MyLight.Name & "_Timer:" & "Dim tmp, steps, fstate:tmp=me.UserValue:fstate = tmp MOD 10:steps= tmp\10 -1:Me.Visible = steps MOD 2:me.UserValue = steps *10 + fstate:If Steps = 0 then Me.Visible = fstate:Me.TimerEnabled=0:End if:End Sub"
  2278. End If
  2279. End Sub
  2280.  
  2281. '******************************************
  2282. ' Change light color - simulate color leds
  2283. ' changes the light color and state
  2284. ' 11 colors: red, orange, amber, yellow...
  2285. '******************************************
  2286. ' in this table this colors are use to keep track of the progress during the modes
  2287.  
  2288. 'colors
  2289. Const red = 10
  2290. Const orange = 9
  2291. Const amber = 8
  2292. Const yellow = 7
  2293. Const darkgreen = 6
  2294. Const green = 5
  2295. Const blue = 4
  2296. Const darkblue = 3
  2297. Const purple = 2
  2298. Const white = 1
  2299. Const teal = 0
  2300.  
  2301. Sub SetLightColor(n, col, stat) 'stat 0 = off, 1 = on, 2 = blink, -1= no change
  2302. Select Case col
  2303. Case red
  2304. n.color = RGB(18, 0, 0)
  2305. n.colorfull = RGB(128, 0, 0)
  2306. Case orange
  2307. n.color = RGB(18, 3, 0)
  2308. n.colorfull = RGB(255, 64, 0)
  2309. Case amber
  2310. n.color = RGB(193, 49, 0)
  2311. n.colorfull = RGB(255, 153, 0)
  2312. Case yellow
  2313. n.color = RGB(18, 18, 0)
  2314. n.colorfull = RGB(255, 240, 0)
  2315. Case darkgreen
  2316. n.color = RGB(0, 8, 0)
  2317. n.colorfull = RGB(0, 64, 0)
  2318. Case green
  2319. n.color = RGB(0, 16, 0)
  2320. n.colorfull = RGB(0, 128, 0)
  2321. Case blue
  2322. n.color = RGB(0, 8, 18)
  2323. n.colorfull = RGB(0, 64, 128)
  2324. Case darkblue
  2325. n.color = RGB(0, 8, 8)
  2326. n.colorfull = RGB(0, 64, 64)
  2327. Case purple
  2328. n.color = RGB(64, 0, 96)
  2329. n.colorfull = RGB(128, 0, 192)
  2330. Case white
  2331. n.color = RGB(255, 197, 143)
  2332. n.colorfull = RGB(255, 252, 224)
  2333. Case teal
  2334. n.color = RGB(1, 64, 62)
  2335. n.colorfull = RGB(2, 128, 126)
  2336. End Select
  2337. If stat <> -1 Then
  2338. n.State = 0
  2339. n.State = stat
  2340. End If
  2341. End Sub
  2342.  
  2343. Sub SetFlashColor(n, col, stat) 'stat 0 = off, 1 = on, -1= no change - no blink for the flashers
  2344. Select Case col
  2345. Case red
  2346. n.color = RGB(255, 0, 0)
  2347. Case orange
  2348. n.color = RGB(255, 64, 0)
  2349. Case amber
  2350. n.color = RGB(255, 153, 0)
  2351. Case yellow
  2352. n.color = RGB(255, 255, 0)
  2353. Case darkgreen
  2354. n.color = RGB(0, 64, 0)
  2355. Case green
  2356. n.color = RGB(0, 128, 0)
  2357. Case blue
  2358. n.color = RGB(0, 255, 255)
  2359. Case darkblue
  2360. n.color = RGB(0, 64, 64)
  2361. Case purple
  2362. n.color = RGB(128, 0, 192)
  2363. Case white
  2364. n.color = RGB(255, 252, 224)
  2365. Case teal
  2366. n.color = RGB(2, 128, 126)
  2367. End Select
  2368. If stat <> -1 Then
  2369. n.Visible = stat
  2370. End If
  2371. End Sub
  2372.  
  2373. '*************************
  2374. ' Rainbow Changing Lights
  2375. '*************************
  2376.  
  2377. Dim RGBStep, RGBFactor, rRed, rGreen, rBlue, RainbowLights
  2378.  
  2379. Sub StartRainbow(n) 'n is a collection
  2380. set RainbowLights = n
  2381. RGBStep = 0
  2382. RGBFactor = 5
  2383. rRed = 255
  2384. rGreen = 0
  2385. rBlue = 0
  2386. RainbowTimer.Enabled = 1
  2387. End Sub
  2388.  
  2389. Sub StopRainbow()
  2390. RainbowTimer.Enabled = 0
  2391. TurnOffArrows
  2392. End Sub
  2393.  
  2394. Sub TurnOffArrows() 'during Missions when changing modes
  2395. For each x in aArrows
  2396. x.State = 0
  2397. Next
  2398. End Sub
  2399.  
  2400. Sub RainbowTimer_Timer 'rainbow led light color changing
  2401. Dim obj
  2402. Select Case RGBStep
  2403. Case 0 'Green
  2404. rGreen = rGreen + RGBFactor
  2405. If rGreen> 255 then
  2406. rGreen = 255
  2407. RGBStep = 1
  2408. End If
  2409. Case 1 'Red
  2410. rRed = rRed - RGBFactor
  2411. If rRed <0 then
  2412. rRed = 0
  2413. RGBStep = 2
  2414. End If
  2415. Case 2 'Blue
  2416. rBlue = rBlue + RGBFactor
  2417. If rBlue> 255 then
  2418. rBlue = 255
  2419. RGBStep = 3
  2420. End If
  2421. Case 3 'Green
  2422. rGreen = rGreen - RGBFactor
  2423. If rGreen <0 then
  2424. rGreen = 0
  2425. RGBStep = 4
  2426. End If
  2427. Case 4 'Red
  2428. rRed = rRed + RGBFactor
  2429. If rRed> 255 then
  2430. rRed = 255
  2431. RGBStep = 5
  2432. End If
  2433. Case 5 'Blue
  2434. rBlue = rBlue - RGBFactor
  2435. If rBlue <0 then
  2436. rBlue = 0
  2437. RGBStep = 0
  2438. End If
  2439. End Select
  2440. For each obj in RainbowLights
  2441. obj.color = RGB(rRed \ 10, rGreen \ 10, rBlue \ 10)
  2442. obj.colorfull = RGB(rRed, rGreen, rBlue)
  2443. Next
  2444. End Sub
  2445.  
  2446. ' ********************************
  2447. ' Table info & Attract Mode
  2448. ' ********************************
  2449.  
  2450. Sub ShowTableInfo
  2451. Dim ii
  2452. 'info goes in a loop only stopped by the credits and the startkey
  2453. If Score(1)Then
  2454. DMD CL(0, "LAST SCORE"), CL(1, "PLAYER 1 " &FormatScore(Score(1))), "", eNone, eNone, eNone, 3000, False, ""
  2455. End If
  2456. If Score(2)Then
  2457. DMD CL(0, "LAST SCORE"), CL(1, "PLAYER 2 " &FormatScore(Score(2))), "", eNone, eNone, eNone, 3000, False, ""
  2458. End If
  2459. If Score(3)Then
  2460. DMD CL(0, "LAST SCORE"), CL(1, "PLAYER 3 " &FormatScore(Score(3))), "", eNone, eNone, eNone, 3000, False, ""
  2461. End If
  2462. If Score(4)Then
  2463. DMD CL(0, "LAST SCORE"), CL(1, "PLAYER 4 " &FormatScore(Score(4))), "", eNone, eNone, eNone, 3000, False, ""
  2464. End If
  2465. DMD "", CL(1, "GAME OVER"), "", eNone, eNone, eNone, 2000, False, ""
  2466. If bFreePlay Then
  2467. DMD "", CL(1, "FREE PLAY"), "", eNone, eNone, eNone, 2000, False, ""
  2468. Else
  2469. If Credits> 0 Then
  2470. DMD CL(0, "CREDITS " & Credits), CL(1, "PRESS START"), "", eNone, eNone, eNone, 2000, False, ""
  2471. Else
  2472. DMD CL(0, "CREDITS " & Credits), CL(1, "INSERT COIN"), "", eNone, eBlink, eNone, 2000, False, ""
  2473. End If
  2474. End If
  2475. DMD " JPSALAS", " PRESENTS", "d_jppresents", eNone, eNone, eNone, 3000, False, ""
  2476. DMD "", "", "d_title", eNone, eNone, eNone, 4000, False, ""
  2477. DMD "", CL(1, "ROM VERSION " &myversion), "", eNone, eNone, eNone, 2000, False, ""
  2478. DMD CL(0, "HIGHSCORES"), Space(dCharsPerLine(1)), "", eScrollLeft, eScrollLeft, eNone, 20, False, ""
  2479. DMD CL(0, "HIGHSCORES"), "", "", eNone, eNone, eNone, 1000, False, ""
  2480. DMD CL(0, "HIGHSCORES"), "1> " &HighScoreName(0) & " " &FormatScore(HighScore(0)), "", eNone, eScrollLeft, eNone, 2000, False, ""
  2481. DMD "_", "2> " &HighScoreName(1) & " " &FormatScore(HighScore(1)), "", eNone, eScrollLeft, eNone, 2000, False, ""
  2482. DMD "_", "3> " &HighScoreName(2) & " " &FormatScore(HighScore(2)), "", eNone, eScrollLeft, eNone, 2000, False, ""
  2483. DMD "_", "4> " &HighScoreName(3) & " " &FormatScore(HighScore(3)), "", eNone, eScrollLeft, eNone, 2000, False, ""
  2484. DMD Space(dCharsPerLine(0)), Space(dCharsPerLine(1)), "", eScrollLeft, eScrollLeft, eNone, 500, False, ""
  2485. End Sub
  2486.  
  2487. Sub StartAttractMode
  2488. Dim a
  2489. StartRainbow BumperLights
  2490. StartLightSeq
  2491. DMDFlush
  2492. ShowTableInfo
  2493. PlaySong "mu_end"
  2494. End Sub
  2495.  
  2496. Sub StopAttractMode
  2497. StopRainbow
  2498. DMDScoreNow
  2499. LightSeqAttract.StopPlay
  2500. End Sub
  2501.  
  2502. Sub StartLightSeq()
  2503. 'lights sequences
  2504. LightSeqAttract.UpdateInterval = 100
  2505. LightSeqAttract.Play SeqRandom, 50, , 1000
  2506. End Sub
  2507.  
  2508. Sub LightSeqAttract_PlayDone()
  2509. StartLightSeq()
  2510. End Sub
  2511.  
  2512. Sub LightSeqTilt_PlayDone()
  2513. LightSeqTilt.Play SeqAllOff
  2514. End Sub
  2515.  
  2516. Sub LightSeqSkillshot_PlayDone()
  2517. LightSeqSkillshot.Play SeqAllOff
  2518. End Sub
  2519.  
  2520. '***********************************************************************
  2521. ' *********************************************************************
  2522. ' Table Specific Script Starts Here
  2523. ' *********************************************************************
  2524. '***********************************************************************
  2525.  
  2526. ' droptargets, animations, timers, etc
  2527. Sub VPObjects_Init
  2528. LowerPost
  2529. End Sub
  2530.  
  2531. ' tables variables and Mode init
  2532. Dim BallsinWormHole
  2533. Dim WormHoleColor
  2534. Dim WormholeMBStep
  2535. Dim CurrentWormhole
  2536. Dim AttackBumperColor
  2537. Dim EngineBumperColor
  2538. Dim bFlagsUpgraded
  2539. Dim HyperSpaceHits
  2540. Dim bJackpotActivated
  2541. Dim bReflexRampShot
  2542. Dim bReflexHyperShot
  2543. Dim Fuel
  2544. Dim BoosterTarget1
  2545. Dim BoosterTarget2
  2546. Dim BoosterTarget3
  2547. Dim BoosterCount
  2548. Dim bBonusActivated
  2549. Dim MedalTarget1
  2550. Dim MedalTarget2
  2551. Dim MedalTarget3
  2552. Dim MedalCount
  2553. Dim xTarget1
  2554. Dim xTarget2
  2555. Dim xTarget3
  2556. Dim xTargetCount
  2557. Dim bMissionBonus
  2558. Dim Mission(4)
  2559. Dim Progress(4)
  2560. Dim Rank(4)
  2561. Dim MissionSelected
  2562. Dim MissionTarget1
  2563. Dim MissionTarget2
  2564. Dim MissionTarget3
  2565. Dim MissionHits 'hits to finish each Mission
  2566.  
  2567. Sub Game_Init() 'called at the start of a new game
  2568. Dim i, j
  2569. bExtraBallWonThisBall = False
  2570. TurnOffPlayfieldLights()
  2571. 'Play some Music
  2572.  
  2573. 'Init Variables
  2574. WormholeMBStep = 0
  2575. MissionSelected = 0
  2576. MissionHits = 0
  2577. Fuel = 6
  2578. For i = 0 to 4
  2579. BonusPoints(i) = 10000 'crash bonus start points
  2580. BonusMultiplier(i) = 1
  2581. PlayfieldMultiplier(i) = 1
  2582. BallsInLock(i) = 0
  2583. Progress(i) = -1 'because the lights array starts at 0 and counts as 1
  2584. Rank(i) = 0
  2585. Mission(i) = 0
  2586. Next
  2587. 'MainMode Init()
  2588. End Sub
  2589.  
  2590. Sub InstantInfo
  2591. DMD CL(0, "INSTANT INFO"), "", "", eScrollLeft, eNone, eNone, 1000, False, ""
  2592. Select Case Mission(CurrentPlayer)
  2593. Case 0
  2594. case 1 'Launch Training 'top target
  2595. DMD CL(0, "MISSION ACCEPTED"), CL(1, "LAUNCH TRAINING"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2596. DMD CL(0, "PASS THE LAUNCH"), CL(1, "RAMP 3 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2597. case 2 'Re-entry Training 'middle target
  2598. DMD CL(0, "MISSION ACCEPTED"), CL(1, "RE-ENTRY TRAINING"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2599. DMD CL(0, "PASS THE RE-ENTRY"), CL(1, "LANES 3 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2600. case 3 'Target Practice 'lower target
  2601. DMD CL(0, "MISSION ACCEPTED"), CL(1, "TARGET PRACTICE"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2602. DMD CL(0, "HIT THE ATTACK"), CL(1, "BUMPERS 8 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2603. case 4 'Science Mission 'all three targets
  2604. DMD CL(0, "MISSION ACCEPTED"), CL(1, "SCIENCE MISSION"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2605. DMD CL(0, "HIT 9"), CL(1, "DROPTARGETS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2606. case 5 'Bug Hunt Mission
  2607. DMD CL(0, "MISSION ACCEPTED"), CL(1, "BUG HUNT MISSION"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2608. DMD CL(0, "HIT 15"), CL(1, "TARGETS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2609. case 6, 61 'Rescue Mission
  2610. DMD CL(0, "MISSION ACCEPTED"), CL(1, "RESCUE MISSION"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2611. DMD CL(0, "UPGRADE FLAGS +"), CL(1, "ENTER HYPERSPACE"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2612. case 7, 71 'Alien Menace Mission
  2613. DMD CL(0, "MISSION ACCEPTED"), CL(1, "ALIEN MENACE"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2614. DMD CL(0, "UPGRADE THE"), CL(1, "ATTACK BUMPERS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2615. DMD CL(0, "HIT THE ATTACK"), CL(1, "BUMPERS 8 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2616. case 8, 81, 82 'Secret Mission
  2617. DMD CL(0, "MISSION ACCEPTED"), CL(1, "SECRET MISSION"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2618. DMD CL(0, "ENTER THE 3"), CL(1, "WORMHOLES IN ORDER"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2619. case 9, 91 'Stray Comet Mission
  2620. DMD CL(0, "MISSION ACCEPTED"), CL(1, "STRAY COMET"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2621. DMD CL(0, "LIGHT ALL 3"), CL(1, "COMET LIGHTS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2622. DMD CL(0, "ENTER THE"), CL(1, "HYPERSPACE KICKER"), "", ScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2623. case 10, 101 'Space Radiation Mission
  2624. DMD CL(0, "MISSION ACCEPTED"), CL(1, "SPACE RADIATION"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2625. DMD CL(0, "LIGHT ALL 3"), CL(1, "RADIATION LIGHTS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2626. DMD CL(0, "ENTER ANY"), CL(1, "WORMHOLE"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2627. case 11, 111 'Black Hole Mission
  2628. DMD CL(0, "MISSION ACCEPTED"), CL(1, "BLACK HOLE THREAT"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2629. DMD CL(0, "UPGRADE THE"), CL(1, "ENGINE BUMPERS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2630. DMD CL(0, "ENTER THE"), CL(1, "BLACK HOLE"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2631. case 12, 121 'Cosmic Plague Mission
  2632. DMD CL(0, "MISSION ACCEPTED"), CL(1, "COSMIC PLAGUE"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2633. DMD CL(0, "SPIN FLAGS"), CL(1, "75 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2634. DMD CL(0, "HIT THE"), CL(1, "SPACE WARP ROLLOVER"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2635. case 13 'Satellite Retrieval Mission
  2636. DMD CL(0, "MISSION ACCEPTED"), CL(1, "SATELLITE RETRIEVAL"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2637. DMD CL(0, "HIT 3 TIMES"), "THE SATELLITE BUMPER", "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2638. case 14 'Recon Mission
  2639. DMD CL(0, "MISSION ACCEPTED"), CL(1, "RECON MISSION"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2640. DMD CL(0, "PASS ANY OF THE"), CL(1, "LANES 15 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2641. case 15 'Doomsday Machine Mission
  2642. DMD CL(0, "MISSION ACCEPTED"), CL(1, "DOOMSDAY MACHINE"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2643. DMD CL(0, "SEND BALL 3 TIMES"), CL(1, "THROUGH OUTLINES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2644. case 16, 161 'Time Warp Mission
  2645. DMD CL(0, "MISSION ACCEPTED"), CL(1, "TIME WARP"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2646. DMD CL(0, "HIT THE REBOUNDS"), CL(1, "25 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2647. DMD CL(0, "ENTER LAUNCH RAMP"), "OR HYPERSPACE KICKER", "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2648. case 17, 171, 172, 173, 174, 175, 176, 177 'Maelstrom
  2649. DMD CL(0, "MISSION ACCEPTED"), CL(1, "MAELSTROM"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  2650. DMD "_", CL(1, "HIT 3 DROPTARGETS"), "", eNone, eScrollLeft, eNone, 1500, True, ""
  2651. DMD "_", CL(1, "HIT 3 SPOT TARGETS"), "", eNone, eScrollLeft, eNone, 1500, True, ""
  2652. DMD "_", CL(1, "HIT 5 LANES"), "", eNone, eScrollLeft, eNone, 1500, True, ""
  2653. DMD "_", CL(1, "HIT THE FUEL CHUTE"), "", eNone, eScrollLeft, eNone, 1500, True, ""
  2654. DMD "_", CL(1, "HIT THE LAUNCH RAMP"), "", eNone, eScrollLeft, eNone, 1500, True, ""
  2655. DMD "_", CL(1, "ROLL A FLAG"), "", eNone, eScrollLeft, eNone, 1500, True, ""
  2656. DMD "_", CL(1, "ENTER A WORMHOLE"), "", eNone, eScrollLeft, eNone, 1500, True, ""
  2657. DMD "_", CL(1, "ENTER HYPERSPACE"), "", eNone, eScrollLeft, eNone, 1500, True, ""
  2658. End Select
  2659. DMD CL(0, "BONUS POINTS"), CL(1, FormatScore(BonusPoints(CurrentPlayer))), "", eScrollLeft, eScrollLeft, eNone, 1500, False, ""
  2660. DMD CL(0, "JACKPOT POINTS"), CL(1, FormatScore(Jackpot(CurrentPlayer))), "", eScrollLeft, eScrollLeft, eNone, 1500, False, ""
  2661.  
  2662. If Score(1)Then
  2663. DMD CL(0, "PLAYER 1 SCORE"), CL(1, FormatScore(Score(1))), "", eScrollLeft, eScrollLeft, eNone, 3000, False, ""
  2664. End If
  2665. If Score(2)Then
  2666. DMD CL(0, "PLAYER 2 SCORE"), CL(1, FormatScore(Score(2))), "", eScrollLeft, eScrollLeft, eNone, 3000, False, ""
  2667. End If
  2668. If Score(3)Then
  2669. DMD CL(0, "PLAYER 3 SCORE"), CL(1, FormatScore(Score(3))), "", eScrollLeft, eScrollLeft, eNone, 3000, False, ""
  2670. End If
  2671. If Score(4)Then
  2672. DMD CL(0, "PLAYER 4 SCORE"), CL(1, FormatScore(Score(4))), "", eScrollLeft, eScrollLeft, eNone, 3000, False, ""
  2673. End If
  2674. End Sub
  2675.  
  2676. Sub StopMBmodes 'stop multiball modes after loosing the last multibal
  2677. PlaySong "mu_main"
  2678. li049.State = 0
  2679. li050.State = 0
  2680. li051.State = 0
  2681. End Sub
  2682.  
  2683. Sub StopEndOfBallMode() 'this sub is called after the last ball in play is drained, reset skillshot, modes, timers
  2684. DisableGravity
  2685. StopMissions
  2686. DowngradeEngineTimer.Enabled = 0
  2687. DowngradeWeaponsTimer.Enabled = 0
  2688. pfXTimerExpired.Enabled = 0
  2689. BoosterTimerExpired.Enabled = 0
  2690. FuelSpeedUpTimer.Enabled = 0
  2691. FuelTimerExpired.Enabled = 0
  2692. HyperExpiredTimer.Enabled = 0
  2693. End Sub
  2694.  
  2695. Sub ResetNewBallVariables() 'reset objects, variables and lights for a new ball or player
  2696. 'lights
  2697. TurnOffPlayfieldLights
  2698. 'objects
  2699. OpenLeftGate
  2700. vpmtimer.Addtimer 250, "OpenRightGate '"
  2701. vpmtimer.Addtimer 500, "LowerPost '"
  2702. 'variables
  2703. WormHoleColor = 0
  2704. CurrentWormhole = 0
  2705. BallsinWormHole = 0
  2706. AttackBumperColor = 0
  2707. EngineBumperColor = 0
  2708. UpdateBumperColor
  2709. bFlagsUpgraded = False
  2710. BonusPoints(CurrentPlayer) = 10000
  2711. bBonusActivated = False
  2712. bBonusHeld = False
  2713. HyperSpaceHits = 0
  2714. Jackpot(CurrentPLayer) = 20000
  2715. bJackpotActivated = False
  2716. StopReflexRampShot
  2717. StopReflexHyperShot
  2718. vpmtimer.Addtimer 750, "ResetBoosterTargets '"
  2719. BoosterCount = 0
  2720. UpdateBoosterLights
  2721. bFlagsUpgraded = False
  2722. bJackpotActivated = False
  2723. vpmtimer.Addtimer 1000, "ResetMedalDT '"
  2724. MedalCount = 0
  2725. UpdateMedal
  2726. vpmtimer.Addtimer 1250, "ResetXtargets '"
  2727. PlayfieldMultiplier(CurrentPlayer) = 1
  2728. xTargetCount = 0
  2729. UpdatexTargets
  2730. bMissionBonus = False
  2731. PrepareForMission
  2732. UpdateRankLights
  2733. UpdateProgressLights
  2734. End Sub
  2735.  
  2736. Sub TurnOffPlayfieldLights()
  2737. For each i in aLights
  2738. i.State = 0
  2739. Next
  2740. End Sub
  2741.  
  2742. Sub UpdateSkillShot() 'Setup and updates the skillshot lights
  2743. DMD "", "HIT SKILLSHOT LIGHTS", "", eNone, eNone, eNone, 1500, True, ""
  2744. LightSeqSkillshot.Play SeqAllOff 'turn off all the lights but the skillshot lights
  2745. For each i in aSkillshotLights2:i.State = 2:Next
  2746. End Sub
  2747.  
  2748. Sub StopSkillshot() 'turn off the skillshot lights
  2749. DMDScoreNow
  2750. LightSeqSkillshot.StopPlay
  2751. For each i in aSkillshotLights2:i.State = 0:Next
  2752. bSkillshotReady = False
  2753. End Sub
  2754.  
  2755. ' *********************************************************************
  2756. ' Table Object Hit Events
  2757. '
  2758. ' Any target hit Sub will follow this:
  2759. ' - play a sound
  2760. ' - do some physical movement
  2761. ' - add a score, bonus
  2762. ' - check some variables/Mode this trigger is a member of
  2763. ' - set the "LastSwitchHit" variable in case it is needed later
  2764. ' *********************************************************************
  2765.  
  2766. '*********************************************************
  2767. ' Slingshots has been hit
  2768.  
  2769. Dim LStep, RStep
  2770.  
  2771. Sub LeftSlingShot_Slingshot
  2772. If Tilted Then Exit Sub
  2773. PlaySoundAt SoundFXDOF("fx_slingshot", 103, DOFPulse, DOFcontactors), Lemk
  2774. PlaySound "sc_slingshot"
  2775. DOF 105, DOFPulse
  2776. LeftSling004.Visible = 1
  2777. Lemk.RotX = 26
  2778. LStep = 0
  2779. LeftSlingShot.TimerEnabled = True
  2780. ' add some points
  2781. AddScore 500
  2782. ' check modes
  2783. ' add some effect to the table?
  2784. FlashForMs gi002, 500, 50, 0
  2785. FlashForMs gi004, 500, 50, 0
  2786. ' check for modes
  2787. Select Case Mission(CurrentPlayer)
  2788. case 16
  2789. MissionHits = MissionHits-1:CheckMission
  2790. End Select
  2791. End Sub
  2792.  
  2793. Sub LeftSlingShot_Timer
  2794. Select Case LStep
  2795. Case 1:LeftSLing004.Visible = 0:LeftSLing003.Visible = 1:Lemk.RotX = 14
  2796. Case 2:LeftSLing003.Visible = 0:LeftSLing002.Visible = 1:Lemk.RotX = 2
  2797. Case 3:LeftSLing002.Visible = 0:Lemk.RotX = -10:LeftSlingShot.TimerEnabled = 0
  2798. End Select
  2799. LStep = LStep + 1
  2800. End Sub
  2801.  
  2802. Sub RightSlingShot_Slingshot
  2803. If Tilted Then Exit Sub
  2804. PlaySoundAt SoundFXDOF("fx_slingshot", 104, DOFPulse, DOFcontactors), Remk
  2805. PlaySound "sc_slingshot"
  2806. DOF 106, DOFPulse
  2807. RightSling004.Visible = 1
  2808. Remk.RotX = 26
  2809. RStep = 0
  2810. RightSlingShot.TimerEnabled = True
  2811. ' add some points
  2812. AddScore 500
  2813. ' check modes
  2814. ' add some effect to the table?
  2815. FlashForMs gi001, 500, 50, 0
  2816. FlashForMs gi003, 500, 50, 0
  2817. ' check for modes
  2818. Select Case Mission(CurrentPlayer)
  2819. case 16
  2820. MissionHits = MissionHits-1:CheckMission
  2821. End Select
  2822. End Sub
  2823.  
  2824. Sub RightSlingShot_Timer
  2825. Select Case RStep
  2826. Case 1:RightSLing004.Visible = 0:RightSLing003.Visible = 1:Remk.RotX = 14
  2827. Case 2:RightSLing003.Visible = 0:RightSLing002.Visible = 1:Remk.RotX = 2
  2828. Case 3:RightSLing002.Visible = 0:Remk.RotX = -10:RightSlingShot.TimerEnabled = 0
  2829. End Select
  2830. RStep = RStep + 1
  2831. End Sub
  2832.  
  2833. ' Top Slingshots has been hit
  2834.  
  2835. Dim LStep2, RStep2
  2836.  
  2837. Sub LeftSlingShot2_Slingshot
  2838. If Tilted Then Exit Sub
  2839. PlaySoundAt SoundFXDOF("fx_slingshot", 131, DOFPulse, DOFcontactors), Lemk2 ' Outhere
  2840. PlaySound "sc_slingshot"
  2841. DOF 105, DOFPulse
  2842. Rubber018.Visible = 1
  2843. Lemk2.RotX = 26
  2844. LStep2 = 0
  2845. LeftSlingShot2.TimerEnabled = True
  2846. ' add some points
  2847. AddScore 500
  2848. ' check for modes
  2849. Select Case Mission(CurrentPlayer)
  2850. case 16
  2851. MissionHits = MissionHits-1:CheckMission
  2852. End Select
  2853. End Sub
  2854.  
  2855. Sub LeftSlingShot2_Timer
  2856. Select Case LStep2
  2857. Case 1:Rubber018.Visible = 0:Rubber017.Visible = 1:Lemk2.RotX = 14
  2858. Case 2:Rubber017.Visible = 0:Rubber016.Visible = 1:Lemk2.RotX = 2
  2859. Case 3:Rubber016.Visible = 0:Lemk2.RotX = -10:LeftSlingShot2.TimerEnabled = 0
  2860. End Select
  2861. LStep2 = LStep2 + 1
  2862. End Sub
  2863.  
  2864. Sub RightSlingShot2_Slingshot
  2865. If Tilted Then Exit Sub
  2866. PlaySoundAt SoundFXDOF("fx_slingshot", 132, DOFPulse, DOFcontactors), Remk2 ' Outhere
  2867. PlaySound "sc_slingshot"
  2868. DOF 106, DOFPulse
  2869. Rubber015.Visible = 1
  2870. Remk2.RotX = 26
  2871. RStep2 = 0
  2872. RightSlingShot2.TimerEnabled = True
  2873. ' add some points
  2874. AddScore 500
  2875. ' check for modes
  2876. Select Case Mission(CurrentPlayer)
  2877. case 16
  2878. MissionHits = MissionHits-1:CheckMission
  2879. End Select
  2880. End Sub
  2881.  
  2882. Sub RightSlingShot2_Timer
  2883. Select Case RStep2
  2884. Case 1:Rubber015.Visible = 0:Rubber014.Visible = 1:Remk2.RotX = 14
  2885. Case 2:Rubber014.Visible = 0:Rubber013.Visible = 1:Remk2.RotX = 2
  2886. Case 3:Rubber013.Visible = 0:Remk2.RotX = -10:Rightslingshot2.TimerEnabled = 0
  2887. End Select
  2888. RStep2 = RStep2 + 1
  2889. End Sub
  2890.  
  2891. '***********************
  2892. ' Attack Bumpers
  2893. '***********************
  2894.  
  2895. Sub Bumper1_Hit
  2896. If Tilted Then Exit Sub
  2897. PlaySoundAt SoundFXDOF("fx_bumper", 107, DOFPulse, DOFContactors), Bumper1
  2898. DOF 138, DOFPulse
  2899. FlashForms li135, 1500, 75, 1
  2900. ' add some points
  2901. Select Case AttackBumperColor
  2902. Case 0:AddScore 500
  2903. Case 1:AddScore 1000
  2904. Case 2:AddScore 1500
  2905. Case 3:AddScore 2000
  2906. End Select
  2907. ' check for modes
  2908. Select Case Mission(CurrentPlayer)
  2909. case 3, 71:MissionHits = MissionHits-1:CheckMission
  2910. End Select
  2911. End Sub
  2912.  
  2913. Sub Bumper2_Hit
  2914. If Tilted Then Exit Sub
  2915. PlaySoundAt SoundFXDOF("fx_bumper", 108, DOFPulse, DOFContactors), Bumper2
  2916. DOF 138, DOFPulse
  2917. FlashForms li136, 1500, 75, 1
  2918. ' add some points
  2919. Select Case AttackBumperColor
  2920. Case 0:AddScore 500
  2921. Case 1:AddScore 1000
  2922. Case 2:AddScore 1500
  2923. Case 3:AddScore 2000
  2924. End Select
  2925. ' check for modes
  2926. Select Case Mission(CurrentPlayer)
  2927. case 3, 71:MissionHits = MissionHits-1:CheckMission
  2928. End Select
  2929. End Sub
  2930.  
  2931. Sub Bumper3_Hit
  2932. If Tilted Then Exit Sub
  2933. PlaySoundAt SoundFXDOF("fx_bumper", 109, DOFPulse, DOFContactors), Bumper3
  2934. DOF 138, DOFPulse
  2935. FlashForms li137, 1500, 75, 1
  2936. ' add some points
  2937. Select Case AttackBumperColor
  2938. Case 0:AddScore 500
  2939. Case 1:AddScore 1000
  2940. Case 2:AddScore 1500
  2941. Case 3:AddScore 2000
  2942. End Select
  2943. ' check for modes
  2944. Select Case Mission(CurrentPlayer)
  2945. case 3, 71:MissionHits = MissionHits-1:CheckMission
  2946. End Select
  2947. End Sub
  2948.  
  2949. Sub Bumper4_Hit 'Satellite bumper
  2950. If Tilted Then Exit Sub
  2951. PlaySoundAt SoundFXDOF("fx_bumper", 113, DOFPulse, DOFContactors), Bumper4 ' Outhere
  2952. DOF 138, DOFPulse
  2953. FlashForms li138, 1500, 75, 1
  2954. ' add some points
  2955. Select Case AttackBumperColor
  2956. Case 0:AddScore 1500
  2957. Case 1:AddScore 2500
  2958. Case 2:AddScore 3500
  2959. Case 3:AddScore 4500
  2960. End Select
  2961. ' check for modes
  2962. Select Case Mission(CurrentPlayer)
  2963. case 13
  2964. MissionHits = MissionHits-1:CheckMission
  2965. End Select
  2966. End Sub
  2967.  
  2968. Sub UpgradeWeapons 'upgrade the color of the weapon bumpers
  2969. AttackBumperColor = AttackBumperColor + 1
  2970. DMD "_", CL(1, "WEAPONS UPGRADED"), "", eNone, eNone, eNone, 1500, True, "vo_Weapons Upgraded"
  2971. If AttackBumperColor> 3 then AttackBumperColor = 3
  2972. DowngradeWeaponsTimer.Enabled = 0
  2973. DowngradeWeaponsTimer.Enabled = 1
  2974. UpdateBumperColor
  2975. End Sub
  2976.  
  2977. Sub DowngradeWeapons 'upgrade the color of the weapon bumpers
  2978. AttackBumperColor = AttackBumperColor - 1
  2979. If AttackBumperColor <= 0 then
  2980. AttackBumperColor = 0
  2981. DowngradeWeaponsTimer.Enabled = 0
  2982. End If
  2983. UpdateBumperColor
  2984. End Sub
  2985.  
  2986. Sub DowngradeWeaponsTimer_Timer
  2987. DowngradeWeapons
  2988. End Sub
  2989.  
  2990. Sub UpdateBumperColor
  2991. Select case AttackBumperColor
  2992. Case 0 'blue
  2993. For each i in RightBumperLights:SetLightColor i, Blue, 1:next
  2994. Case 1 'green
  2995. For each i in RightBumperLights:SetLightColor i, Green, 1:next
  2996. Case 2 'yellow
  2997. For each i in RightBumperLights:SetLightColor i, Yellow, 1:next
  2998. Case 3 'red
  2999. For each i in RightBumperLights:SetLightColor i, Red, 1:next
  3000. End Select
  3001. Select case EngineBumperColor
  3002. Case 0 'blue
  3003. For each i in LeftBumperLights:SetLightColor i, Blue, 1:next
  3004. Case 1 'green
  3005. For each i in LeftBumperLights:SetLightColor i, Green, 1:next
  3006. Case 2 'yellow
  3007. For each i in LeftBumperLights:SetLightColor i, Yellow, 1:next
  3008. Case 3 'red
  3009. For each i in LeftBumperLights:SetLightColor i, Red, 1:next
  3010. End Select
  3011. End Sub
  3012.  
  3013. '***********************
  3014. ' Engine Bumpers
  3015. '***********************
  3016.  
  3017. Sub Bumper5_Hit
  3018. If Tilted Then Exit Sub
  3019. PlaySoundAt SoundFXDOF("fx_bumper", 110, DOFPulse, DOFContactors), Bumper5 ' Outhere
  3020. DOF 138, DOFPulse
  3021. FlashForms li139, 1500, 75, 1
  3022. ' add some points
  3023. Select Case EngineBumperColor
  3024. Case 0:AddScore 1500
  3025. Case 1:AddScore 2500
  3026. Case 2:AddScore 3500
  3027. Case 3:AddScore 4500
  3028. End Select
  3029. ' check for modes
  3030. Select Case Mission(CurrentPLayer)
  3031. Case 0
  3032. End Select
  3033. End Sub
  3034.  
  3035. Sub Bumper6_Hit
  3036. If Tilted Then Exit Sub
  3037. PlaySoundAt SoundFXDOF("fx_bumper", 111, DOFPulse, DOFContactors), Bumper6 ' Outhere
  3038. DOF 138, DOFPulse
  3039. FlashForms li140, 1500, 75, 1
  3040. ' add some points
  3041. Select Case EngineBumperColor
  3042. Case 0:AddScore 1500
  3043. Case 1:AddScore 2500
  3044. Case 2:AddScore 3500
  3045. Case 3:AddScore 4500
  3046. End Select
  3047. ' check for modes
  3048. Select Case Mission(CurrentPLayer)
  3049. Case 0
  3050. End Select
  3051. End Sub
  3052.  
  3053. Sub Bumper7_Hit
  3054. If Tilted Then Exit Sub
  3055. PlaySoundAt SoundFXDOF("fx_bumper", 112, DOFPulse, DOFContactors), Bumper7 ' Outhere
  3056. DOF 138, DOFPulse
  3057. FlashForms li141, 1500, 75, 1
  3058. ' add some points
  3059. Select Case EngineBumperColor
  3060. Case 0:AddScore 1500
  3061. Case 1:AddScore 2500
  3062. Case 2:AddScore 3500
  3063. Case 3:AddScore 4500
  3064. End Select
  3065. ' check for modes
  3066. Select Case Mission(CurrentPLayer)
  3067. Case 0
  3068. End Select
  3069. End Sub
  3070.  
  3071. Sub UpgradeEngine 'upgrade the color of the engine bumper
  3072. EngineBumperColor = EngineBumperColor + 1
  3073. If EngineBumperColor> 3 then EngineBumperColor = 3
  3074. DMD "_", CL(1, "ENGINES UPGRADED"), "", eNone, eNone, eNone, 1500, True, "vo_Engines Upgraded"
  3075. DowngradeEngineTimer.Enabled = 0
  3076. DowngradeEngineTimer.Enabled = 1
  3077. UpdateBumperColor
  3078. If Mission(CurrentPlayer) = 11 Then CheckMission
  3079. End Sub
  3080.  
  3081. Sub DowngradeEngine 'upgrade the color of the engine bumper
  3082. EngineBumperColor = EngineBumperColor - 1
  3083. If EngineBumperColor <= 0 then
  3084. EngineBumperColor = 0
  3085. DowngradeEngineTimer.Enabled = 0
  3086. End If
  3087. UpdateBumperColor
  3088. End Sub
  3089.  
  3090. Sub DowngradeEngineTimer_Timer
  3091. DowngradeEngine
  3092. End Sub
  3093.  
  3094. ' Rotate lane lights
  3095. Sub RotateLaneLights(n) 'n is the direction, 1 or 0, left or right
  3096. Dim tmp
  3097. If n = 1 Then
  3098. tmp = li124.State
  3099. li124.State = li125.State
  3100. li125.State = li126.State
  3101. li126.State = tmp
  3102. tmp = li063.State
  3103. li063.State = li064.State
  3104. li064.State = li065.State
  3105. li065.State = tmp
  3106. Else
  3107. tmp = li126.State
  3108. li126.State = li125.State
  3109. li125.State = li124.State
  3110. li124.State = tmp
  3111. tmp = li065.State
  3112. li065.State = li064.State
  3113. li064.State = li063.State
  3114. li063.State = tmp
  3115. End If
  3116. End Sub
  3117.  
  3118. '*************
  3119. ' Lower lanes
  3120. '*************
  3121.  
  3122. Sub Trigger001_Hit 'left outlane
  3123. PlaySoundAt "fx_sensor", Trigger001
  3124. If Tilted Then Exit Sub
  3125. playSound "sc_lane"
  3126. Addscore 20000
  3127. If li032.State = 1 Then AwardExtraBall:li032.State = 0
  3128. Select Case Mission(CurrentPlayer)
  3129. case 14, 15, 172
  3130. MissionHits = MissionHits-1:CheckMission
  3131. End Select
  3132. End Sub
  3133.  
  3134. Sub Trigger002_Hit 'left inlane, re-fuel, Bonus lane
  3135. PlaySoundAt "fx_sensor", Trigger002
  3136. If Tilted Then Exit Sub
  3137. AddScore 10000
  3138. 'Mission Bonus AND/OR Booster Bonus activated
  3139. If bMissionBonus OR bBonusActivated Then
  3140. DMD "_", CL(1, "BONUS AWARDED"), "", eNone, eNone, eNone, 1500, True, "vo_Bonus Awarded"
  3141. AddScore BonusHeldPoints(CurrentPlayer)
  3142. If bMissionBonus Then bMissionBonus = False:li034.State = 0
  3143. End If
  3144. 're-fuel
  3145. DMD "", CL(1, "SHIP RE-FUELED"), "", eNone, eNone, eNone, 1500, True, ""
  3146. Fuel = 6:UpdateFuelLights:StartFuelTimers
  3147. Select Case Mission(CurrentPlayer)
  3148. case 14, 172
  3149. MissionHits = MissionHits-1:CheckMission
  3150. End Select
  3151. End Sub
  3152.  
  3153. Sub Trigger003_Hit 'left inlane
  3154. PlaySoundAt "fx_sensor", Trigger003
  3155. If Tilted Then Exit Sub
  3156. playSound "sc_lane"
  3157. Addscore 5000
  3158. If li033.State = 1 Then AddScore 20000
  3159. li033.State = 0
  3160. Select Case Mission(CurrentPlayer)
  3161. case 14, 172
  3162. MissionHits = MissionHits-1:CheckMission
  3163. End Select
  3164. End Sub
  3165.  
  3166. Sub Trigger004_Hit 'right inlane
  3167. PlaySoundAt "fx_sensor", Trigger004
  3168. If Tilted Then Exit Sub
  3169. playSound "sc_lane"
  3170. Addscore 5000
  3171. If li035.State = 1 Then AddScore 20000
  3172. li035.State = 0
  3173. Select Case Mission(CurrentPlayer)
  3174. case 14, 172
  3175. MissionHits = MissionHits-1:CheckMission
  3176. End Select
  3177. End Sub
  3178.  
  3179. Sub Trigger005_Hit 'right outlane
  3180. PlaySoundAt "fx_sensor", Trigger005
  3181. If Tilted Then Exit Sub
  3182. playSound "sc_lane"
  3183. Addscore 20000
  3184. If li036.State = 1 Then AwardExtraBall:li036.State = 0
  3185. Select Case Mission(CurrentPlayer)
  3186. case 14, 15, 172
  3187. MissionHits = MissionHits-1:CheckMission
  3188. End Select
  3189. End Sub
  3190.  
  3191. '***********
  3192. ' Top lanes
  3193. '***********
  3194.  
  3195. Sub Trigger006_Hit 'left
  3196. PlaySoundAt "fx_sensor", Trigger006
  3197. If Tilted Then Exit Sub
  3198. If bSkillShotready Then StopSkillShot
  3199. playSound "sc_lane"
  3200. Addscore 2000
  3201. li063.State = 1
  3202. CheckWeaponLights
  3203. Select Case Mission(CurrentPlayer)
  3204. case 2, 14, 172:MissionHits = MissionHits-1:CheckMission
  3205. End Select
  3206. End Sub
  3207.  
  3208. Sub Trigger007_Hit 'center
  3209. PlaySoundAt "fx_sensor", Trigger007
  3210. If Tilted Then Exit Sub
  3211. If bSkillShotready Then StopSkillShot
  3212. playSound "sc_lane"
  3213. Addscore 2000
  3214. li064.State = 1
  3215. CheckWeaponLights
  3216. Select Case Mission(CurrentPlayer)
  3217. case 2, 14, 172:MissionHits = MissionHits-1:CheckMission
  3218. End Select
  3219. End Sub
  3220.  
  3221. Sub Trigger008_Hit 'right
  3222. PlaySoundAt "fx_sensor", Trigger008
  3223. If Tilted Then Exit Sub
  3224. If bSkillShotready Then StopSkillShot
  3225. playSound "sc_lane"
  3226. Addscore 2000
  3227. li065.State = 1
  3228. CheckWeaponLights
  3229. Select Case Mission(CurrentPlayer)
  3230. case 2, 14, 172:MissionHits = MissionHits-1:CheckMission
  3231. End Select
  3232. End Sub
  3233.  
  3234. Sub CheckWeaponLights
  3235. If li063.State + li064.State + li065.State = 3 then
  3236. UpgradeWeapons
  3237. LightSeqReEntry.Play SeqBlinking, , 15, 10
  3238. li063.State = 0
  3239. li064.State = 0
  3240. li065.State = 0
  3241. If Mission(CurrentPlayer) = 7 Then CheckMission
  3242. End If
  3243. End Sub
  3244.  
  3245. '**************
  3246. ' Engine lanes
  3247. '**************
  3248.  
  3249. Sub Trigger009_Hit 'left
  3250. PlaySoundAt "fx_sensor", Trigger009
  3251. If Tilted Then Exit Sub
  3252. playSound "sc_lane"
  3253. Addscore 500
  3254. li124.State = 1
  3255. CheckEngineLights
  3256. Select Case Mission(CurrentPlayer)
  3257. case 14
  3258. MissionHits = MissionHits-1:CheckMission
  3259. End Select
  3260. End Sub
  3261.  
  3262. Sub Trigger010_Hit 'center
  3263. PlaySoundAt "fx_sensor", Trigger010
  3264. If Tilted Then Exit Sub
  3265. playSound "sc_lane"
  3266. Addscore 500
  3267. li125.State = 1
  3268. CheckEngineLights
  3269. Select Case Mission(CurrentPlayer)
  3270. case 14, 172
  3271. MissionHits = MissionHits-1:CheckMission
  3272. End Select
  3273. End Sub
  3274.  
  3275. Sub Trigger011_Hit 'right
  3276. PlaySoundAt "fx_sensor", Trigger011
  3277. If Tilted Then Exit Sub
  3278. playSound "sc_lane"
  3279. Addscore 500
  3280. li126.State = 1
  3281. CheckEngineLights
  3282. Select Case Mission(CurrentPlayer)
  3283. case 14, 172
  3284. MissionHits = MissionHits-1:CheckMission
  3285. End Select
  3286. End Sub
  3287.  
  3288. Sub CheckEngineLights
  3289. If li124.State + li125.State + li126.State = 3 then
  3290. UpgradeEngine
  3291. LightSeqEngine.Play SeqBlinking, , 15, 10
  3292. li124.State = 0
  3293. li125.State = 0
  3294. li126.State = 0
  3295. End If
  3296. End Sub
  3297.  
  3298. Sub Trigger030_Hit 'ramp done
  3299. If Tilted Then Exit Sub
  3300. Addscore 5000
  3301. If bReflexRampShot Then
  3302. AwardReflexRampShot
  3303. Else
  3304. StartReflexRampShot
  3305. End If
  3306. Select case Mission(CurrentPlayer)
  3307. Case 0 'no mission active
  3308. If MissionSelected Then AcceptMission MissionSelected
  3309. Case 1:MissionHits = MissionHits-1:CheckMission
  3310. Case 161:DemoteRank:CheckMission
  3311. Case 174:CheckMission
  3312. End Select
  3313. End Sub
  3314.  
  3315. '**************
  3316. ' Fuel lanes
  3317. '**************
  3318.  
  3319. Sub Trigger012_Hit
  3320. PlaySoundAt "fx_sensor", Trigger012
  3321. If Tilted Then Exit Sub
  3322. PlaySound "sc_fuellights"
  3323. Addscore 500
  3324. If Fuel <1 Then
  3325. Flashforms li128, 500, 50, 1
  3326. Fuel = 1:StartFuelTimers
  3327. Else
  3328. Flashforms li128, 500, 50, 2
  3329. End If
  3330. End Sub
  3331.  
  3332. Sub Trigger013_Hit
  3333. PlaySoundAt "fx_sensor", Trigger013
  3334. If Tilted Then Exit Sub
  3335. PlaySound "sc_fuellights"
  3336. Addscore 500
  3337. If Fuel <2 Then
  3338. Flashforms li129, 500, 50, 1
  3339. Fuel = 2:StartFuelTimers
  3340. Else
  3341. Flashforms li129, 500, 50, 2
  3342. End If
  3343. End Sub
  3344.  
  3345. Sub Trigger014_Hit
  3346. PlaySoundAt "fx_sensor", Trigger014
  3347. If Tilted Then Exit Sub
  3348. PlaySound "sc_fuellights"
  3349. Addscore 500
  3350. If Fuel <3 Then
  3351. Flashforms li130, 500, 50, 1
  3352. Fuel = 3:StartFuelTimers
  3353. Else
  3354. Flashforms li130, 500, 50, 2
  3355. End If
  3356. End Sub
  3357.  
  3358. Sub Trigger015_Hit
  3359. PlaySoundAt "fx_sensor", Trigger015
  3360. If Tilted Then Exit Sub
  3361. PlaySound "sc_fuellights"
  3362. Addscore 500
  3363. If Fuel <4 Then
  3364. Flashforms li131, 500, 50, 1
  3365. Fuel = 4:StartFuelTimers
  3366. Else
  3367. Flashforms li131, 500, 50, 2
  3368. End If
  3369. End Sub
  3370.  
  3371. Sub Trigger016_Hit
  3372. PlaySoundAt "fx_sensor", Trigger016
  3373. If Tilted Then Exit Sub
  3374. PlaySound "sc_fuellights"
  3375. Addscore 500
  3376. If Fuel <5 Then
  3377. Flashforms li131, 500, 50, 1
  3378. Fuel = 5:StartFuelTimers
  3379. Else
  3380. Flashforms li131, 500, 50, 2
  3381. End If
  3382. End Sub
  3383.  
  3384. Sub Trigger017_Hit
  3385. PlaySoundAt "fx_sensor", Trigger017
  3386. If Tilted Then Exit Sub
  3387. PlaySound "sc_fuellights"
  3388. Addscore 500
  3389. If li133.State = 0 Then Addscore 1000
  3390. 're-fuel
  3391. DMD "", CL(1, "SHIP RE-FUELED"), "", eNone, eNone, eNone, 1000, True, ""
  3392. Fuel = 6:UpdateFuelLights:StartFuelTimers
  3393. If Mission(CurrentPlayer) = 173 Then CheckMission
  3394. End Sub
  3395.  
  3396. '**************
  3397. ' Fuel Timers
  3398. '**************
  3399.  
  3400. Sub StartFuelTimers
  3401. FuelSpeedUpTimer.Enabled = 0
  3402. FuelTimerExpired.Enabled = 0
  3403. FuelSpeedUpTimer.Enabled = 1
  3404. FuelTimerExpired.Enabled = 1
  3405. End Sub
  3406.  
  3407. Sub FuelTimerExpired_Timer 'reduces the fuel after 15 seconds
  3408. Fuel = Fuel - 1
  3409. UpdateFuelLights
  3410. If Fuel = 0 then 'Stop Mission
  3411. StopMissions
  3412. End If
  3413. End Sub
  3414.  
  3415. Sub FuelSpeedUpTimer_Timer 'blinks the light 5 seconds before it expires
  3416. Select Case Fuel
  3417. Case 0:li128.State = 0:li129.State = 0:li130.State = 0:li131.State = 0:li132.State = 0:li133.State = 0
  3418. Case 1:li128.State = 2:li129.State = 0:li130.State = 0:li131.State = 0:li132.State = 0:li133.State = 0
  3419. Case 2:li128.State = 1:li129.State = 2:li130.State = 0:li131.State = 0:li132.State = 0:li133.State = 0
  3420. Case 3:li128.State = 1:li129.State = 1:li130.State = 2:li131.State = 0:li132.State = 0:li133.State = 0
  3421. Case 4:li128.State = 1:li129.State = 1:li130.State = 1:li131.State = 2:li132.State = 0:li133.State = 0
  3422. Case 5:li128.State = 1:li129.State = 1:li130.State = 1:li131.State = 1:li132.State = 2:li133.State = 0
  3423. Case 6:li128.State = 1:li129.State = 1:li130.State = 1:li131.State = 1:li132.State = 1:li133.State = 2
  3424. End Select
  3425. End Sub
  3426.  
  3427. Sub UpdateFuelLights
  3428. Select case Fuel
  3429. Case 0:li128.State = 0:li129.State = 0:li130.State = 0:li131.State = 0:li132.State = 0:li133.State = 0
  3430. Case 1:li128.State = 1:li129.State = 0:li130.State = 0:li131.State = 0:li132.State = 0:li133.State = 0
  3431. Case 2:li128.State = 1:li129.State = 1:li130.State = 0:li131.State = 0:li132.State = 0:li133.State = 0
  3432. Case 3:li128.State = 1:li129.State = 1:li130.State = 1:li131.State = 0:li132.State = 0:li133.State = 0
  3433. Case 4:li128.State = 1:li129.State = 1:li130.State = 1:li131.State = 1:li132.State = 0:li133.State = 0
  3434. Case 5:li128.State = 1:li129.State = 1:li130.State = 1:li131.State = 1:li132.State = 1:li133.State = 0
  3435. Case 6:li128.State = 1:li129.State = 1:li130.State = 1:li131.State = 1:li132.State = 1:li133.State = 1
  3436. End Select
  3437. End Sub
  3438.  
  3439. '*****************
  3440. ' Skillshot lanes
  3441. '*****************
  3442.  
  3443. Sub Trigger018_Hit
  3444. PlaySoundAt "fx_sensor", Trigger018
  3445. If Tilted Then Exit Sub
  3446. If bSkillShotready Then
  3447. If ActiveBall.VelY <0 Then 'only when the ball is going up
  3448. PlaySound "sc_skillshotlight"
  3449. li113.State = 1
  3450. SkillShotValue(CurrentPLayer) = 15000
  3451. End If
  3452. End If
  3453. End Sub
  3454.  
  3455. Sub Trigger019_Hit
  3456. PlaySoundAt "fx_sensor", Trigger019
  3457. If Tilted Then Exit Sub
  3458. If bSkillShotready Then
  3459. If ActiveBall.VelY <0 Then 'only when the ball is going up
  3460. PlaySound "sc_skillshotlight"
  3461. li114.State = 1
  3462. SkillShotValue(CurrentPLayer) = 30000
  3463. End If
  3464. End If
  3465. End Sub
  3466.  
  3467. Sub Trigger020_Hit
  3468. PlaySoundAt "fx_sensor", Trigger020
  3469. If Tilted Then Exit Sub
  3470. If bSkillShotready Then
  3471. If ActiveBall.VelY <0 Then 'only when the ball is going up
  3472. PlaySound "sc_skillshotlight"
  3473. li115.State = 1
  3474. SkillShotValue(CurrentPLayer) = 75000
  3475. End If
  3476. End If
  3477. End Sub
  3478.  
  3479. Sub Trigger021_Hit
  3480. PlaySoundAt "fx_sensor", Trigger021
  3481. If Tilted Then Exit Sub
  3482. If bSkillShotready Then
  3483. If ActiveBall.VelY <0 Then 'only when the ball is going up
  3484. PlaySound "sc_skillshotlight"
  3485. li116.State = 1
  3486. SkillShotValue(CurrentPLayer) = 30000
  3487. End If
  3488. End If
  3489. End Sub
  3490.  
  3491. Sub Trigger022_Hit
  3492. PlaySoundAt "fx_sensor", Trigger022
  3493. If Tilted Then Exit Sub
  3494. If bSkillShotready Then
  3495. If ActiveBall.VelY <0 Then 'only when the ball is going up
  3496. PlaySound "sc_skillshotlight"
  3497. li117.State = 1
  3498. SkillShotValue(CurrentPLayer) = 15000
  3499. End If
  3500. End If
  3501. End Sub
  3502.  
  3503. Sub Trigger023_Hit
  3504. PlaySoundAt "fx_sensor", Trigger023
  3505. If Tilted Then Exit Sub
  3506. If bSkillShotready Then
  3507. If ActiveBall.VelY <0 Then 'only when the ball is going up
  3508. PlaySound "sc_skillshotlight"
  3509. li118.State = 1
  3510. SkillShotValue(CurrentPLayer) = 7500
  3511. End If
  3512. End If
  3513. End Sub
  3514.  
  3515. Sub Trigger029_Hit 'give skillshot
  3516. PlaySoundAt "fx_sensor", Trigger029
  3517. If Tilted Then Exit Sub
  3518. If bSkillShotready Then AwardSkillshot
  3519. End Sub
  3520.  
  3521. '*******************
  3522. ' Space Warp trigger
  3523. '*******************
  3524.  
  3525. Sub Trigger028_Hit
  3526. PlaySoundAt "fx_sensor", Trigger028
  3527. If Tilted Then Exit Sub
  3528. li033.State = 1 'turn on the inlane lights for extra scoring
  3529. li035.State = 1
  3530. If Mission(CurrentPlayer) = 121 Then CheckMission
  3531. End Sub
  3532.  
  3533. '*****************
  3534. ' Wormhole target
  3535. '*****************
  3536.  
  3537. Sub Target001_Hit
  3538. PlaySoundAt "fx_target", Target001
  3539. If Tilted Then Exit Sub
  3540. Addscore 750
  3541. Select Case Mission(CurrentPlayer)
  3542. case 5, 171
  3543. MissionHits = MissionHits-1:CheckMission
  3544. case 8, 81, 82 'do nothing
  3545. case else
  3546. Flashforms li047, 1000, 50, 1
  3547. PlaySound "sc_wormholetarget"
  3548. ' activate Wormholes and change the color of the Wormhole lights
  3549. li142.State = 1
  3550. li143.State = 1
  3551. li144.State = 1
  3552. If WormholeColor = 0 Then WormholeColor = RndNbr(3) 'activate wormholes by giving them a color
  3553. ChangeArrowColor
  3554. End Select
  3555. End Sub
  3556.  
  3557. Sub ChangeArrowColor
  3558. If WormholeColor = 0 Then Exit Sub 'if it is called from the spinners and the wormholes are not activated
  3559. WormHoleColor = WormHoleColor + 1
  3560. If WormHoleColor> 3 Then WormHoleColor = 1
  3561. Select case WormHoleColor
  3562. Case 1
  3563. SetLightColor li080, yellow, 1
  3564. SetLightColor li081, yellow, 1
  3565. SetLightColor li082, yellow, 1
  3566. Case 2
  3567. SetLightColor li080, red, 1
  3568. SetLightColor li081, red, 1
  3569. SetLightColor li082, red, 1
  3570. Case 3
  3571. SetLightColor li080, green, 1
  3572. SetLightColor li081, green, 1
  3573. SetLightColor li082, green, 1
  3574. End Select
  3575. End Sub
  3576.  
  3577. '*****************
  3578. ' Mission targets
  3579. '*****************
  3580.  
  3581. Sub Target002_Hit 'lower
  3582. PlaySoundAt "fx_target", Target002
  3583. If Tilted Then Exit Sub
  3584. Select Case Mission(CurrentPlayer)
  3585. case 0
  3586. FlashForMs li043, 500, 50, 1
  3587. FlashForMs li096, 500, 50, 1
  3588. MissionTarget3 = 1
  3589. CheckMissiontargets 3
  3590. case 5, 171
  3591. MissionHits = MissionHits-1:CheckMission
  3592. End Select
  3593. End Sub
  3594.  
  3595. Sub Target003_Hit 'center
  3596. PlaySoundAt "fx_target", Target003
  3597. If Tilted Then Exit Sub
  3598. Select Case Mission(CurrentPlayer)
  3599. case 0
  3600. FlashForMs li042, 500, 50, 1
  3601. FlashForMs li096, 500, 50, 1
  3602. MissionTarget2 = 1
  3603. CheckMissiontargets 2
  3604. case 5, 171
  3605. MissionHits = MissionHits-1:CheckMission
  3606. End Select
  3607. End Sub
  3608.  
  3609. Sub Target004_Hit 'upper
  3610. PlaySoundAt "fx_target", Target004
  3611. If Tilted Then Exit Sub
  3612. Select Case Mission(CurrentPlayer)
  3613. case 0
  3614. FlashForMs li041, 500, 50, 1
  3615. FlashForMs li096, 500, 50, 1
  3616. MissionTarget1 = 1
  3617. CheckMissiontargets 1
  3618. case 5, 171
  3619. MissionHits = MissionHits-1:CheckMission
  3620. End Select
  3621. End Sub
  3622.  
  3623. '********************
  3624. ' Top re-fuel targets
  3625. '********************
  3626.  
  3627. Sub Target005_Hit
  3628. PlaySoundAt "fx_target", Target005
  3629. If Tilted Then Exit Sub
  3630. Addscore 750
  3631. li066.State = 1
  3632. CheckTopTargets
  3633. Select Case Mission(CurrentPlayer)
  3634. case 5, 171
  3635. MissionHits = MissionHits-1:CheckMission
  3636. End Select
  3637. End Sub
  3638.  
  3639. Sub Target006_Hit
  3640. PlaySoundAt "fx_target", Target006
  3641. If Tilted Then Exit Sub
  3642. Addscore 750
  3643. li067.State = 1
  3644. CheckTopTargets
  3645. Select Case Mission(CurrentPlayer)
  3646. case 5, 171
  3647. MissionHits = MissionHits-1:CheckMission
  3648. End Select
  3649. End Sub
  3650.  
  3651. Sub Target007_Hit
  3652. PlaySoundAt "fx_target", Target007
  3653. If Tilted Then Exit Sub
  3654. Addscore 750
  3655. li068.State = 1
  3656. CheckTopTargets
  3657. Select Case Mission(CurrentPlayer)
  3658. case 5, 171
  3659. MissionHits = MissionHits-1:CheckMission
  3660. End Select
  3661. End Sub
  3662.  
  3663. Sub CheckTopTargets
  3664. If li066.State + li067.State + li068.State = 3 then
  3665. 're-fuel
  3666. DMD "", CL(1, "SHIP RE-FUELED"), "", eNone, eNone, eNone, 1500, True, ""
  3667. Fuel = 6:UpdateFuelLights:StartFuelTimers
  3668. FlashForms li066, 1000, 50, 0
  3669. FlashForms li067, 1000, 50, 0
  3670. FlashForms li068, 1000, 50, 0
  3671. End If
  3672. End Sub
  3673.  
  3674. '*****************************
  3675. ' Comet targets -Right Hazard
  3676. '*****************************
  3677.  
  3678. Sub Target008_Hit 'lower
  3679. PlaySoundAt "fx_target", Target008
  3680. If Tilted Then Exit Sub
  3681. Addscore 750
  3682. li052.State = 1
  3683. CheckCometLights
  3684. Select Case Mission(CurrentPlayer)
  3685. case 5, 171
  3686. MissionHits = MissionHits-1:CheckMission
  3687. End Select
  3688. End Sub
  3689.  
  3690. Sub Target009_Hit 'center
  3691. PlaySoundAt "fx_target", Target009
  3692. If Tilted Then Exit Sub
  3693. Addscore 750
  3694. li053.State = 1
  3695. CheckCometLights
  3696. Select Case Mission(CurrentPlayer)
  3697. case 5, 171
  3698. MissionHits = MissionHits-1:CheckMission
  3699. End Select
  3700. End Sub
  3701.  
  3702. Sub Target010_Hit 'upper
  3703. PlaySoundAt "fx_target", Target010
  3704. If Tilted Then Exit Sub
  3705. Addscore 750
  3706. li054.State = 1
  3707. CheckCometLights
  3708. Select Case Mission(CurrentPlayer)
  3709. case 5, 171
  3710. MissionHits = MissionHits-1:CheckMission
  3711. End Select
  3712. End Sub
  3713.  
  3714. Sub CheckCometLights
  3715. If li052.State + li053.State + li054.State = 3 Then
  3716. li052.State = 0
  3717. li053.State = 0
  3718. li054.State = 0
  3719. LightSeqComet.Play SeqBlinking, , 15, 10
  3720. OpenRightGate
  3721. If Mission(CurrentPlayer) = 9 Then CheckMission
  3722. End If
  3723. End Sub
  3724.  
  3725. '********************************
  3726. ' Radiation targets -Left Hazard
  3727. '********************************
  3728.  
  3729. Sub Target011_Hit 'lower
  3730. PlaySoundAt "fx_target", Target011
  3731. If Tilted Then Exit Sub
  3732. Addscore 750
  3733. li056.State = 1
  3734. CheckRadiationLights
  3735. Select Case Mission(CurrentPlayer)
  3736. case 5, 171
  3737. MissionHits = MissionHits-1:CheckMission
  3738. End Select
  3739. End Sub
  3740.  
  3741. Sub Target012_Hit 'center
  3742. PlaySoundAt "fx_target", Target012
  3743. If Tilted Then Exit Sub
  3744. Addscore 750
  3745. li057.State = 1
  3746. CheckRadiationLights
  3747. Select Case Mission(CurrentPlayer)
  3748. case 5, 171
  3749. MissionHits = MissionHits-1:CheckMission
  3750. End Select
  3751. End Sub
  3752.  
  3753. Sub Target013_Hit 'upper
  3754. PlaySoundAt "fx_target", Target013
  3755. If Tilted Then Exit Sub
  3756. Addscore 750
  3757. li058.State = 1
  3758. CheckRadiationLights
  3759. Select Case Mission(CurrentPlayer)
  3760. case 5, 171
  3761. MissionHits = MissionHits-1:CheckMission
  3762. End Select
  3763. End Sub
  3764.  
  3765. Sub CheckRadiationLights
  3766. If li056.State + li057.State + li058.State = 3 Then
  3767. li056.State = 0
  3768. li057.State = 0
  3769. li058.State = 0
  3770. LightSeqRadiation.Play SeqBlinking, , 15, 10
  3771. OpenLeftGate
  3772. If Mission(CurrentPlayer) = 10 Then CheckMission
  3773. End If
  3774. End Sub
  3775.  
  3776. '*******************
  3777. ' Medal droptargets
  3778. '*******************
  3779.  
  3780. Sub Target014_Hit 'right
  3781. PlaySoundAt "fx_droptarget", Target014
  3782. If Tilted Then Exit Sub
  3783. MedalTarget1 = 1
  3784. CheckMedal
  3785. Select Case Mission(CurrentPlayer)
  3786. case 4, 5, 17
  3787. MissionHits = MissionHits-1:CheckMission
  3788. End Select
  3789. End Sub
  3790.  
  3791. Sub Target015_Hit 'center
  3792. PlaySoundAt "fx_droptarget", Target015
  3793. If Tilted Then Exit Sub
  3794. MedalTarget2 = 1
  3795. CheckMedal
  3796. Select Case Mission(CurrentPlayer)
  3797. case 4, 5, 15
  3798. MissionHits = MissionHits-1:CheckMission
  3799. End Select
  3800. End Sub
  3801.  
  3802. Sub Target016_Hit 'left
  3803. PlaySoundAt "fx_droptarget", Target016
  3804. If Tilted Then Exit Sub
  3805. MedalTarget3 = 1
  3806. CheckMedal
  3807. Select Case Mission(CurrentPlayer)
  3808. case 4, 5, 17
  3809. MissionHits = MissionHits-1:CheckMission
  3810. End Select
  3811. End Sub
  3812.  
  3813. Sub ResetMedalDT
  3814. PlaySoundAt SoundFXDOF("fx_resetdrop", 119, DOFPulse, DOFcontactors), Target015 ' Outhere
  3815. ' PlaySoundAt "fx_resetdrop", Target015
  3816. PlaySound "sc_topdtreset"
  3817. Target014.IsDropped = 0
  3818. Target015.IsDropped = 0
  3819. Target016.IsDropped = 0
  3820. MedalTarget1 = 0
  3821. MedalTarget2 = 0
  3822. MedalTarget3 = 0
  3823. End Sub
  3824.  
  3825. Sub CheckMedal
  3826. If MedalTarget1 + MedalTarget2 + MedalTarget3 = 3 Then
  3827. Addscore 1500
  3828. MedalCount = MedalCount + 1
  3829. UpdateMedal
  3830. vpmtimer.addtimer 2000, "ResetMedalDT '"
  3831. Select Case MedalCount
  3832. Case 1
  3833. DMD "_", CL(1, "LEVEL 1 COMMENDATION"), "", eNone, eNone, eNone, 1000, True, "vo_Level 1 Commendation"
  3834. Addscore 10000
  3835. EnableBallSaver 10
  3836. Case 2
  3837. DMD "_", CL(1, "LEVEL 2 COMMENDATION"), "", eNone, eNone, eNone, 1000, True, "vo_Level 2 Commendation"
  3838. Addscore 50000
  3839. EnableBallSaver 20
  3840. Case 3
  3841. DMD "_", CL(1, "LEVEL 3 COMMENDATION"), "", eNone, eNone, eNone, 1000, True, "vo_Level 3 Commendation"
  3842. AwardExtraBall
  3843. End Select
  3844. Else
  3845. AddScore 500
  3846. End if
  3847. End Sub
  3848.  
  3849. Sub UpdateMedal
  3850. Select Case MedalCount
  3851. case 0:li044.State = 0:li045.State = 0:li046.State = 0
  3852. Case 1:li046.State = 1
  3853. Case 2:li045.State = 1
  3854. Case 3:li044.State = 1
  3855. End Select
  3856. End Sub
  3857.  
  3858. '*********************
  3859. ' Field X droptargets
  3860. '*********************
  3861.  
  3862. Sub Target017_Hit 'right
  3863. PlaySoundAt "fx_droptarget", Target017
  3864. If Tilted Then Exit Sub
  3865. xTarget1 = 1
  3866. CheckPFX
  3867. Select Case Mission(CurrentPlayer)
  3868. case 4, 5, 17
  3869. MissionHits = MissionHits-1:CheckMission
  3870. End Select
  3871. End Sub
  3872.  
  3873. Sub Target018_Hit 'center
  3874. PlaySoundAt "fx_droptarget", Target018
  3875. If Tilted Then Exit Sub
  3876. xTarget2 = 1
  3877. CheckPFX
  3878. Select Case Mission(CurrentPlayer)
  3879. case 4, 5, 17
  3880. MissionHits = MissionHits-1:CheckMission
  3881. End Select
  3882. End Sub
  3883.  
  3884. Sub Target019_Hit 'left
  3885. PlaySoundAt "fx_droptarget", Target019
  3886. If Tilted Then Exit Sub
  3887. xTarget3 = 1
  3888. CheckPFX
  3889. Select Case Mission(CurrentPlayer)
  3890. case 4, 5, 17
  3891. MissionHits = MissionHits-1:CheckMission
  3892. End Select
  3893. End Sub
  3894.  
  3895. Sub ResetxTargets
  3896. PlaySoundAt SoundFXDOF("fx_resetdrop", 117, DOFPulse, DOFcontactors), Target018 ' Outhere
  3897. ' PlaySoundAt "fx_resetdrop", Target018
  3898. PlaySound "sc_topdtreset"
  3899. Target019.IsDropped = 0
  3900. Target018.IsDropped = 0
  3901. Target017.IsDropped = 0
  3902. xTarget1 = 0
  3903. xTarget2 = 0
  3904. xTarget3 = 0
  3905. End Sub
  3906.  
  3907. Sub CheckPFX
  3908. If xTarget1 + xTarget2 + xTarget3 = 3 Then 'all targets has been hit
  3909. Addscore 1500
  3910. xTargetCount = xTargetCount + 1
  3911. If xTargetCount> 4 then xTargetCount = 4
  3912. UpdatexTargets
  3913. SetPlayfieldX
  3914. pfXTimerExpired.Enabled = 0 're-start the timer to reset the countdown
  3915. pfXTimerExpired.Enabled = 1
  3916. vpmTimer.AddTimer 2000, "ResetxTargets '"
  3917. Else
  3918. Addscore 500
  3919. End If
  3920. End Sub
  3921.  
  3922. Sub UpdatexTargets
  3923. Select Case xTargetCount
  3924. Case 0:li059.State = 0:li060.State = 0:li061.State = 0:li062.State = 0
  3925. Case 1:li059.State = 1:li060.State = 0:li061.State = 0:li062.State = 0
  3926. Case 2:li059.State = 1:li060.State = 1:li061.State = 0:li062.State = 0
  3927. Case 3:li059.State = 1:li060.State = 1:li061.State = 1:li062.State = 0
  3928. Case 4:li059.State = 1:li060.State = 1:li061.State = 1:li062.State = 1
  3929. End Select
  3930. End Sub
  3931.  
  3932. Sub SetPlayfieldX
  3933. Select case xTargetCount
  3934. Case 0: '1x
  3935. DMD "_", CL(1, "PLAYFIELD 1 X"), "", eNone, eNone, eNone, 1500, True, ""
  3936. PlayfieldMultiplier(CurrentPlayer) = 1
  3937. UpdatexTargets
  3938. vpmtimer.AddTimer 500, "ResetxTargets '"
  3939. Case 1: '2x
  3940. DMD "_", CL(1, "PLAYFIELD 2 X"), "", eNone, eNone, eNone, 1500, True, "vo_Field Multiplier 2x"
  3941. PlayfieldMultiplier(CurrentPlayer) = 2
  3942. UpdatexTargets
  3943. vpmtimer.AddTimer 500, "ResetxTargets '"
  3944. Case 2: '3x
  3945. DMD "_", CL(1, "PLAYFIELD 3 X"), "", eNone, eNone, eNone, 1500, True, "vo_Field Multiplier 3x"
  3946. PlayfieldMultiplier(CurrentPlayer) = 3
  3947. UpdatexTargets
  3948. vpmtimer.AddTimer 500, "ResetxTargets '"
  3949. Case 3: '5x
  3950. DMD "_", CL(1, "PLAYFIELD 5 X"), "", eNone, eNone, eNone, 1500, True, "vo_Field Multiplier 5x"
  3951. PlayfieldMultiplier(CurrentPlayer) = 5
  3952. UpdatexTargets
  3953. vpmtimer.AddTimer 500, "ResetxTargets '"
  3954. Case 4: '10x
  3955. DMD "_", CL(1, "PLAYFIELD 10 X"), "", eNone, eNone, eNone, 2000, True, "vo_Field Multiplier 10x"
  3956. PlayfieldMultiplier(CurrentPlayer) = 10
  3957. UpdatexTargets
  3958. vpmtimer.AddTimer 500, "ResetxTargets '"
  3959. End Select
  3960. End Sub
  3961.  
  3962. Sub pfXTimerExpired_Timer
  3963. xTargetCount = xTargetCount - 1
  3964. If xTargetCount <= 0 Then
  3965. xTargetCount = 0
  3966. Me.Enabled = 0
  3967. End If
  3968. SetPlayfieldX
  3969. End Sub
  3970.  
  3971. '**********************
  3972. ' Booster droptargets
  3973. '***********************
  3974.  
  3975. Sub Target020_Hit 'lower
  3976. PlaySoundAt "fx_droptarget", Target020
  3977. If Tilted Then Exit Sub
  3978. BoosterTarget1 = 1
  3979. CheckBooster
  3980. Select Case Mission(CurrentPlayer)
  3981. case 4, 5, 17
  3982. MissionHits = MissionHits-1:CheckMission
  3983. End Select
  3984. End Sub
  3985.  
  3986. Sub Target021_Hit 'center
  3987. PlaySoundAt "fx_droptarget", Target021
  3988. If Tilted Then Exit Sub
  3989. BoosterTarget2 = 1
  3990. CheckBooster
  3991. Select Case Mission(CurrentPlayer)
  3992. case 4, 5, 17
  3993. MissionHits = MissionHits-1:CheckMission
  3994. End Select
  3995. End Sub
  3996.  
  3997. Sub Target022_Hit 'upper
  3998. PlaySoundAt "fx_droptarget", Target022
  3999. If Tilted Then Exit Sub
  4000. BoosterTarget3 = 1
  4001. CheckBooster
  4002. Select Case Mission(CurrentPlayer)
  4003. case 4, 5, 17
  4004. MissionHits = MissionHits-1:CheckMission
  4005. End Select
  4006. End Sub
  4007.  
  4008. Sub ResetBoosterTargets
  4009. PlaySoundAt SoundFXDOF("fx_resetdrop", 120, DOFPulse, DOFcontactors), Target021 ' Outhere
  4010. ' PlaySoundAt "fx_resetdrop", Target021
  4011. PlaySound "sc_rightdtreset"
  4012. Target020.isDropped = 0
  4013. Target021.isDropped = 0
  4014. Target022.isDropped = 0
  4015. BoosterTarget1 = 0
  4016. BoosterTarget2 = 0
  4017. BoosterTarget3 = 0
  4018. End Sub
  4019.  
  4020. Sub CheckBooster
  4021. If BoosterTarget1 + BoosterTarget2 + BoosterTarget3 = 3 Then 'all targets has been hit
  4022. Addscore 5000
  4023. BoosterCount = BoosterCount + 1
  4024. vpmTimer.AddTimer 2000, "ResetBoosterTargets '"
  4025. If BoosterCount> 4 Then
  4026. BoosterCount = 4
  4027. Exit Sub
  4028. End If
  4029. UpdateBoosterLights
  4030. BoosterTimerExpired.Enabled = 0 'stop and start the timer to reset the count
  4031. BoosterTimerExpired.Enabled = 1
  4032. Select case BoosterCount
  4033. Case 1: 'Upgrade Flags
  4034. DMD "_", CL(1, "FLAGS UPGRADED"), "", eNone, eNone, eNone, 1500, True, "vo_Flags Upgraded"
  4035. bFlagsUpgraded = True
  4036. li055.State = 1
  4037. li048.State = 1
  4038. If Mission(CurrentPlayer) = 6 Then CheckMission
  4039. Case 2: 'Activate Jackpot
  4040. DMD "_", CL(1, "JACKPOT ACTIVATED"), "", eNone, eNone, eNone, 1500, True, "vo_Jackpot Activated"
  4041. bJackpotActivated = True
  4042. Case 3: 'Activate Bonus at the Bonus lane
  4043. DMD "_", CL(1, "BONUS ACTIVATED"), "", eNone, eNone, eNone, 1500, True, "vo_Bonus Activated"
  4044. bBonusActivated = True
  4045. li034.State = 1
  4046. Case 4: 'Bonus Hold
  4047. DMD "_", "BONUS HOLD ACTIVATED", "", eNone, eNone, eNone, 1500, True, "vo_Bonus Hold"
  4048. bBonusHeld = True
  4049. End Select
  4050. Else
  4051. Addscore 500
  4052. End If
  4053. End Sub
  4054.  
  4055. Sub UpdateBoosterLights
  4056. Select Case BoosterCount
  4057. Case 0:li040.State = 0:li039.State = 0:li038.State = 0:li037.State = 0
  4058. Case 1:li040.State = 1:li039.State = 0:li038.State = 0:li037.State = 0
  4059. Case 2:li040.State = 1:li039.State = 1:li038.State = 0:li037.State = 0
  4060. Case 3:li040.State = 1:li039.State = 1:li038.State = 1:li037.State = 0
  4061. Case 4:li040.State = 1:li039.State = 1:li038.State = 1:li037.State = 1
  4062. End Select
  4063. End Sub
  4064.  
  4065. Sub BoosterTimerExpired_Timer
  4066. ' Stop current mode
  4067. Select Case BoosterCount
  4068. Case 1: 'flags
  4069. bFlagsUpgraded = False
  4070. li055.State = 0
  4071. li048.State = 0
  4072. Case 2: 'Jackpot
  4073. bJackpotActivated = False
  4074. Case 3: 'Bonus
  4075. bBonusActivated = false
  4076. li034.State = 0
  4077. Case 4: 'Bonus Hold
  4078. 'bBonusHeld = False 'do not reset it as it will be active when the ball drains
  4079. End Select
  4080. If BoosterCount> 0 Then
  4081. BoosterCount = BoosterCount -1
  4082. UpdateBoosterLights
  4083. Else
  4084. BoosterTimerExpired.Enabled = 0
  4085. End If
  4086. End Sub
  4087.  
  4088. '**********
  4089. ' Spinners
  4090. '**********
  4091.  
  4092. Sub Spinner001_Spin 'left
  4093. DOF 133,2 ' Outhere
  4094. PlaySoundAt "fx_spinner", Spinner001
  4095. If Tilted Then Exit Sub
  4096. PlaySound "sc_spinner"
  4097. If bFlagsUpgraded Then
  4098. Addscore 2500
  4099. Else
  4100. Addscore 500
  4101. End If
  4102. ChangeArrowColor
  4103. Select Case Mission(CurrentPlayer)
  4104. Case 12
  4105. MissionHits = MissionHits-1:CheckMission
  4106. Case 175
  4107. CheckMission
  4108. End Select
  4109. End Sub
  4110.  
  4111. Sub Spinner002_Spin 'right
  4112. DOF 133,2 ' Outhere
  4113. PlaySoundAt "fx_spinner", Spinner002
  4114. If Tilted Then Exit Sub
  4115. PlaySound "sc_spinner"
  4116. If bFlagsUpgraded Then
  4117. Addscore 2500
  4118. Else
  4119. Addscore 500
  4120. End If
  4121. ChangeArrowColor
  4122. Select Case Mission(CurrentPlayer)
  4123. Case 12
  4124. MissionHits = MissionHits-1:CheckMission
  4125. Case 175
  4126. CheckMission
  4127. End Select
  4128. End Sub
  4129.  
  4130. '************
  4131. ' Black Hole
  4132. '************
  4133.  
  4134. Sub BlackHole_Hit
  4135. PlaySoundAt "fx_kicker_enter", BlackHole
  4136. If Not Tilted Then
  4137. DMD CL(0, "BLACK HOLE"), CL(1, "20000"), "", eNone, eNone, eNone, 1500, True, "vo_Black Hole"
  4138. Addscore 20000
  4139. End If
  4140. If Mission(CurrentPlayer) = 111 Then CheckMission
  4141. ' Nothing left to do, so kick out the ball
  4142. vpmtimer.addtimer 1500, "PlaySoundAt""fx_kicker"",BlackHole: BlackHole.kick 48+RND*6, 30:DOF 129,2 '" ' Outhere
  4143. End Sub
  4144.  
  4145. '******************
  4146. ' Hyper Space Hole
  4147. '******************
  4148.  
  4149. Sub HyperSpaceHole_Hit
  4150. PlaySoundAt "fx_kicker_enter", HyperSpaceHole
  4151. If Not Tilted Then
  4152. HyperSpaceHits = HyperSpaceHits + 1
  4153. HyperExpiredTimer.Enabled = 0 'stop and start the timer to reduce the hyperscape hits
  4154. HyperExpiredTimer.Enabled = 1
  4155. Select Case HyperSpaceHits
  4156. Case 1:Addscore 10000
  4157. Case 2:Addscore 20000
  4158. Case 3:Addscore 20000:RisePost
  4159. Case 4:Addscore 50000:li032.State = 1:li036.State = 1:
  4160. DMD "", "EXTRA BALL AVAILABLE", "", eNone, eNone, eNone, 1500, True, "vo_Extra Ball Available"
  4161. Case 5:Addscore 150000:EnableGravity:HyperSpaceHits = 0
  4162. End Select
  4163. UpdateHyperLights
  4164. If bJackpotActivated Then
  4165. AwardJackpot
  4166. End if
  4167. If bReflexHyperShot Then
  4168. AwardReflexHyperShot
  4169. Else
  4170. StartReflexHyperShot
  4171. End If
  4172. Select Case Mission(CurrentPlayer)
  4173. Case 61, 91, 177:CheckMission
  4174. Case 161:PromoteRank:CheckMission
  4175. End Select
  4176. End If
  4177. ' Nothing left to do, so kick out the ball
  4178. vpmtimer.addtimer 2000, "PlaySoundAt""fx_kicker"",HyperSpaceHole: HyperSpaceHole.kick 135, 2:DOF 130,2 '" ' Outhere
  4179. End Sub
  4180.  
  4181. Sub UpdateHyperLights
  4182. Select case HyperSpaceHits
  4183. Case 0:li119.State = 0:li120.State = 0:li121.State = 0:li122.State = 0
  4184. Case 1:li119.State = 1:li120.State = 0:li121.State = 0:li122.State = 0
  4185. Case 2:li119.State = 1:li120.State = 1:li121.State = 0:li122.State = 0
  4186. Case 3:li119.State = 1:li120.State = 1:li121.State = 1:li122.State = 0
  4187. Case 4:li119.State = 1:li120.State = 1:li121.State = 1:li122.State = 1
  4188. End Select
  4189. End Sub
  4190.  
  4191. Sub HyperExpiredTimer_Timer
  4192. HyperSpaceHits = HyperSpaceHits - 1
  4193. If HyperSpaceHits = 0 Then
  4194. HyperExpiredTimer.Enabled = 0
  4195. End If
  4196. UpdateHyperLights
  4197. End Sub
  4198.  
  4199. '************
  4200. ' Wormholes
  4201. '************
  4202.  
  4203. Sub Wormhole1_Hit
  4204. PlaySoundAt "fx_hole_enter", Wormhole1
  4205. Wormhole1.Destroyball
  4206. BallsOnPlayfield = BallsOnPlayfield - 1
  4207. BallsinWormHole = BallsinWormHole + 1
  4208. Flashforms li142, 500, 50, 2
  4209. PlaySound "sc_wormhole"
  4210. ' Score some points
  4211. Select Case WormHoleColor
  4212. Case 0 'wormhole no activated
  4213. Addscore 2000
  4214. vpmtimer.addtimer 1500, "kickWormhole 1 '"
  4215. Case 1 'same color then lock the ball or award extraball if in multiball mode
  4216. Addscore 5000
  4217. If bMultiBallMode Then
  4218. AwardExtraball
  4219. vpmtimer.addtimer 1500, "kickWormhole 1 '"
  4220. Else
  4221. vpmtimer.addtimer 1000, "LockBall '"
  4222. End If
  4223. Case 2, 3 'kick the ball from the other hole
  4224. Addscore 7500
  4225. vpmtimer.addtimer 1500, "kickWormhole WormHoleColor '"
  4226. End Select
  4227. Select Case Mission(CurrentPlayer)
  4228. Case 8, 101, 176
  4229. CheckMission
  4230. End Select
  4231. End Sub
  4232.  
  4233. Sub Wormhole2_Hit
  4234. PlaySoundAt "fx_hole_enter", Wormhole2
  4235. Wormhole2.Destroyball
  4236. BallsOnPlayfield = BallsOnPlayfield - 1
  4237. BallsinWormHole = BallsinWormHole + 1
  4238. Flashforms li143, 500, 50, 2
  4239. PlaySound "sc_wormhole"
  4240. ' Score some points
  4241. Select Case WormHoleColor
  4242. Case 0 'wormhole no activated
  4243. Addscore 2000
  4244. vpmtimer.addtimer 1500, "kickWormhole 2 '"
  4245. Case 2 'same color then lock the ball or award extraball if in multiball mode
  4246. Addscore 5000
  4247. If bMultiBallMode Then
  4248. AwardExtraball
  4249. vpmtimer.addtimer 1500, "kickWormhole 2 '"
  4250. Else
  4251. vpmtimer.addtimer 1000, "LockBall '"
  4252. End If
  4253. Case 1, 3 'kick the ball from the other holes
  4254. Addscore 7500
  4255. vpmtimer.addtimer 1500, "kickWormhole WormHoleColor '"
  4256. End Select
  4257. Select Case Mission(CurrentPlayer)
  4258. Case 81, 101, 176
  4259. CheckMission
  4260. End Select
  4261. End Sub
  4262.  
  4263. Sub Wormhole3_Hit
  4264. PlaySoundAt "fx_hole_enter", Wormhole3
  4265. Wormhole3.Destroyball
  4266. BallsOnPlayfield = BallsOnPlayfield - 1
  4267. BallsinWormHole = BallsinWormHole + 1
  4268. Flashforms li144, 500, 50, 2
  4269. PlaySound "sc_wormhole"
  4270. ' Score some points
  4271. Select Case WormHoleColor
  4272. Case 0 'wormhole no activated
  4273. Addscore 2000
  4274. vpmtimer.addtimer 1500, "kickWormhole 3 '"
  4275. Case 3 'same color then lock the ball or award extraball if in multiball mode
  4276. Addscore 5000
  4277. If bMultiBallMode Then
  4278. AwardExtraball
  4279. vpmtimer.addtimer 1500, "kickWormhole 3 '"
  4280. Else
  4281. vpmtimer.addtimer 1000, "LockBall '"
  4282. End If
  4283. Case 1, 2 'kick the ball from the other holes
  4284. Addscore 7500
  4285. vpmtimer.addtimer 1500, "kickWormhole WormHoleColor '"
  4286. End Select
  4287. Select Case Mission(CurrentPlayer)
  4288. Case 82, 101, 176
  4289. CheckMission
  4290. End Select
  4291. End Sub
  4292.  
  4293. Sub LockBall
  4294. ' remove the ball from the wormhole count as new ball will be kicked out from the wormholes or to the plunger
  4295. BallsinWormHole = BallsinWormHole - 1
  4296. ' add the ball to the lock
  4297. BallsInLock(CurrentPlayer) = BallsInLock(CurrentPlayer) + 1
  4298. DMD "_", CL(1, "BALL " &BallsInLock(CurrentPlayer) & " LOCKED"), "", eNone, eNone, eNone, 1000, True, "vo_Balllocked" &BallsInLock(CurrentPlayer):DOF 134,2 ' Outhere
  4299. If BallsInLock(CurrentPlayer) = 3 Then
  4300. StartWormholeMultiball
  4301. Else
  4302. ' we use the Addmultiball to create a ball at the plunger lane
  4303. AddMultiball 1
  4304. ' we kick the ball with the autoplunger
  4305. bAutoPlunger = True
  4306. ' turn off the wormholes
  4307. TurnOffWormholes
  4308. End If
  4309. End Sub
  4310.  
  4311. Sub kickWormhole(hole) 'kicks the ball out in the color wormhole
  4312. CurrentWormhole = hole
  4313. If BallsinWormHole> 0 Then
  4314. BallsinWormHole = BallsinWormHole - 1
  4315. BallsOnPlayfield = BallsOnPlayfield + 1
  4316. PlaySound "sc_wormhole"
  4317. Select case hole
  4318. Case 1 'yellow
  4319. PlaySoundAt SoundFXDOF("fx_popper", 114, DOFPulse, DOFcontactors), WormHole1 ' Outhere
  4320. Flashforms li142, 500, 50, 2
  4321. Wormhole1.CreateSizedBallWithMass BallSize / 2, BallMass
  4322. Wormhole1.kick 220, 20
  4323. Case 2 'red
  4324. PlaySoundAt SoundFXDOF("fx_popper", 115, DOFPulse, DOFcontactors), WormHole2 ' Outhere
  4325. Flashforms li143, 500, 50, 2
  4326. Wormhole2.CreateSizedBallWithMass BallSize / 2, BallMass
  4327. Wormhole2.kick 220, 20
  4328. Case 3 'green
  4329. PlaySoundAt SoundFXDOF("fx_popper", 116, DOFPulse, DOFcontactors), WormHole3 ' Outhere
  4330. Flashforms li144, 1500, 50, 2
  4331. Wormhole3.CreateSizedBallWithMass BallSize / 2, BallMass
  4332. Wormhole3.kick 312, 20
  4333. End Select
  4334. vpmtimer.addtimer 500, "kickWormhole CurrentWormhole '" 'kick out the rest of the balls, if any
  4335. End If
  4336. End Sub
  4337.  
  4338. Sub TurnOffWormholes
  4339. WormHoleColor = 0
  4340. li047.State = 0
  4341. li142.State = 0
  4342. li143.State = 0
  4343. li144.State = 0
  4344. li080.State = 0
  4345. li081.State = 0
  4346. li082.State = 0
  4347. End Sub
  4348.  
  4349. Sub StartWormholeMultiball
  4350. DMD CL(0, "WORMHOLE"), CL(1, "MULTI BALL"), "", eNone, eNone, eNone, 1000, True, ""
  4351. WormholeMBStep = 0
  4352. BallsInLock(CurrentPlayer) = 0
  4353. WormHoleMultiball.Enabled = 1
  4354. li049.State = 2
  4355. li050.State = 2
  4356. li051.State = 2
  4357. TurnOffWormholes
  4358. PlaySong "mu_multiball"
  4359. End Sub
  4360.  
  4361. Sub WormHoleMultiball_Timer
  4362. Select case WormholeMBStep
  4363. Case 0
  4364. PlaySoundAt SoundFXDOF("fx_popper", 114, DOFPulse, DOFcontactors), WormHole1 ' Outhere
  4365. Flashforms li142, 500, 50, 2
  4366. Wormhole1.CreateSizedBallWithMass BallSize / 2, BallMass
  4367. BallsOnPlayfield = BallsOnPlayfield + 1
  4368. Wormhole1.kick 220, 20
  4369. WormholeMBStep = 1
  4370. EnableBallSaver 20
  4371. Case 1
  4372. PlaySoundAt SoundFXDOF("fx_popper", 115, DOFPulse, DOFcontactors), WormHole2 ' Outhere
  4373. Flashforms li143, 500, 50, 2
  4374. Wormhole2.CreateSizedBallWithMass BallSize / 2, BallMass
  4375. BallsOnPlayfield = BallsOnPlayfield + 1
  4376. Wormhole2.kick 220, 20
  4377. DOF 143, DOFPulse
  4378. bMultiBallMode = True
  4379. WormholeMBStep = 2
  4380. Case 2
  4381. PlaySoundAt SoundFXDOF("fx_popper", 116, DOFPulse, DOFcontactors), WormHole3 ' Outhere
  4382. Flashforms li144, 1500, 50, 2
  4383. Wormhole3.CreateSizedBallWithMass BallSize / 2, BallMass
  4384. BallsOnPlayfield = BallsOnPlayfield + 1
  4385. Wormhole3.kick 312, 20
  4386. WormHoleMultiball.Enabled = 0
  4387. End Select
  4388. End Sub
  4389.  
  4390. '***********************
  4391. ' Left & Right KickBaks
  4392. '***********************
  4393.  
  4394. Sub LeftKickerRest_Hit
  4395. PlaySoundAt "fx_kicker_enter", LeftKickerRest
  4396. FlashForMs li102, 2000, 50, 0
  4397. vpmtimer.addtimer 1500, "PlaySound ""sc_wormhole"":LeftKickerIM.AutoFire:DOF 124,2 '" ' Outhere
  4398. vpmtimer.addtimer 1600, "CloseLeftGate '"
  4399. End Sub
  4400.  
  4401. Sub RightKickerRest_Hit
  4402. PlaySoundAt "fx_kicker_enter", RightKickerRest
  4403. FlashForMs li103, 2000, 50, 0
  4404. vpmtimer.addtimer 1500, "PlaySound ""sc_wormhole"":RightKickerIM.AutoFire:DOF 128,2 '" ' Outhere
  4405. vpmtimer.addtimer 1600, "CloseRightGate '"
  4406. End Sub
  4407.  
  4408. Sub OpenLeftGate
  4409. PlaySoundAt "fx_diverter", LeftLaneGate
  4410. LeftLaneGate.RotateToStart
  4411. li072.State = 1
  4412. End Sub
  4413.  
  4414. Sub CloseLeftGate
  4415. PlaySoundAt "fx_diverter", LeftLaneGate
  4416. LeftLaneGate.RotateToEnd
  4417. li072.State = 0
  4418. End Sub
  4419.  
  4420. Sub OpenRightGate
  4421. PlaySoundAt "fx_diverter", RightLaneGate
  4422. RightLaneGate.RotateToStart
  4423. li095.State = 1
  4424. End Sub
  4425.  
  4426. Sub CloseRightGate
  4427. PlaySoundAt "fx_diverter", RightLaneGate
  4428. RightLaneGate.RotateToEnd
  4429. li095.State = 0
  4430. End Sub
  4431.  
  4432. '*****************
  4433. ' Gravity Magnet
  4434. '*****************
  4435.  
  4436. Sub GravityCenter_Hit 'the ball rests on this target, so kick the ball upwards
  4437. If NOT Tilted Then
  4438. If aMagnet.MagnetON Then
  4439. Addscore 50000
  4440. 'deactivate magnet
  4441. vpmtimer.Addtimer 2000, "GravityReleaseBall '"
  4442. End If
  4443. End If
  4444. End Sub
  4445.  
  4446. Sub EnableGravity 'aMagnet On. After 5 hits to the Hyper Space hole
  4447. If NOT Tilted Then
  4448. DMD "_", CL(1, "GRAVITY WELL"), "", eNone, eNone, eNone, 1500, True, "vo_Gravity Well"
  4449. aMagnet.MagnetON = True
  4450. li002.State = 2
  4451. End If
  4452. End Sub
  4453.  
  4454. Sub DisableGravity
  4455. li002.State = 0
  4456. aMagnet.MagnetOn = False
  4457. End Sub
  4458.  
  4459. Sub GravityReleaseBall 'aMagnet off and kick the ball if any
  4460. Dim dir, speed, ball
  4461. For Each ball In aMagnet.Balls
  4462. With ball
  4463. dir = Rnd * 6.28:speed = 25 + Rnd * 5
  4464. .VelX = speed * Sin(dir)
  4465. .VelY = - speed * ABS(Cos(dir)) 'only upwards
  4466. End With
  4467. Next
  4468. DMD "_", CL(1, "GRAVITY NORMALIZED"), "", eNone, eNone, eNone, 1500, True, "vo_Gravity Normalized"
  4469. DisableGravity
  4470. End Sub
  4471.  
  4472. '**************
  4473. ' Flipper Post
  4474. '**************
  4475.  
  4476. Sub RisePost
  4477. PlaySoundAt "Fx_SolenoidOn", rpeg001
  4478. DMD "_", CL(1, "CENTER POST ACTIVE"), "", eNone, eNone, eNone, 1500, True, "vo_Center post"
  4479. li001.State = 1:li001.TimerEnabled = 1
  4480. rpeg001.Z = 0
  4481. rpin009.IsDropped = 0
  4482. rpin009.TimerEnabled = 1
  4483. End Sub
  4484.  
  4485. Sub LowerPost
  4486. PlaySoundAt "Fx_SolenoidOff", rpeg001
  4487. li001.TimerEnabled = 0
  4488. li001.State = 0
  4489. rpeg001.Z = -52
  4490. rpin009.IsDropped = 1
  4491. rpin009.TimerEnabled = 0
  4492. End Sub
  4493.  
  4494. Sub li001_Timer
  4495. li001.TimerEnabled = 0
  4496. li001.State = 2
  4497. End Sub
  4498.  
  4499. Sub rpin009_Timer '60 seconds
  4500. LowerPost
  4501. End Sub
  4502.  
  4503. '***********************************
  4504. ' Reflex Shots: Ramp and Hyper Space
  4505. '***********************************
  4506.  
  4507. Sub AwardReflexRampShot
  4508. DMD "_", CL(1, "REFLEX SHOT"), "", eNone, eNone, eNone, 1500, True, "vo_Reflex Shot"
  4509. Addscore 20000
  4510. StopReflexRampShot
  4511. End Sub
  4512.  
  4513. Sub AwardReflexHyperShot
  4514. DMD "_", CL(1, "REFLEX SHOT"), "", eNone, eNone, eNone, 1500, True, "vo_Reflex Shot"
  4515. Addscore 20000
  4516. StopReflexHyperShot
  4517. End Sub
  4518.  
  4519. Sub StartReflexRampShot
  4520. li098.State = 2
  4521. li098.TimerEnabled = 1
  4522. bReflexRampShot = True
  4523. End Sub
  4524.  
  4525. Sub li098_Timer
  4526. StopReflexRampShot
  4527. End Sub
  4528.  
  4529. Sub StopReflexRampShot
  4530. li098.State = 0
  4531. li098.TimerEnabled = 0
  4532. bReflexRampShot = False
  4533. End Sub
  4534.  
  4535. Sub StartReflexHyperShot
  4536. li101.State = 2
  4537. li101.TimerEnabled = 1
  4538. bReflexHyperShot = True
  4539. End Sub
  4540.  
  4541. Sub li101_Timer
  4542. StopReflexHyperShot
  4543. End Sub
  4544.  
  4545. Sub StopReflexHyperShot
  4546. li101.State = 0
  4547. li101.TimerEnabled = 0
  4548. bReflexHyperShot = False
  4549. End Sub
  4550.  
  4551. '**********************
  4552. ' Rotate lights Timers
  4553. '**********************
  4554.  
  4555. Sub RotateRankLights_Timer
  4556. Dim tmp
  4557. tmp = li003.State
  4558. For i = 0 to 7
  4559. RankLights(i).State = RankLights(i + 1).State
  4560. Next
  4561. li011.State = tmp
  4562. End Sub
  4563.  
  4564. Sub RotateProgressLights_Timer
  4565. Dim tmp
  4566. tmp = li029.State
  4567. For i = 17 to 1 step -1
  4568. ProgressLights(i).State = ProgressLights(i-1).State
  4569. Next
  4570. li012.State = tmp
  4571. End Sub
  4572.  
  4573. '****************
  4574. ' Progress Lights
  4575. '****************
  4576. ' Collection ProgressLights, 18 Lights
  4577. ' variables Progress(CurrentPlayer) value 0 to 17
  4578.  
  4579. Sub UpdateProgressLights
  4580. For i = 0 to 17
  4581. ProgressLights(i).State = 0
  4582. Next
  4583. If Progress(CurrentPlayer)> 0 Then
  4584. For i = 0 to Progress(CurrentPlayer)
  4585. ProgressLights(i).State = 1
  4586. Next
  4587. End If
  4588. End Sub
  4589.  
  4590. Sub AddProgress(n)
  4591. Progress(CurrentPlayer) = Progress(CurrentPlayer) + n
  4592. If Progress(CurrentPlayer) >= 17 Then '+ winmission and update rank
  4593. PromoteRank
  4594. Progress(CurrentPlayer) = 0
  4595. End If
  4596. UpdateProgressLights
  4597. End Sub
  4598.  
  4599. '****************
  4600. ' Rank
  4601. '****************
  4602. ' Collection RankLights, 9 Lights
  4603. ' variables Rank(CurrentPlayer) value 0 to 8
  4604.  
  4605. Sub UpdateRankLights
  4606. For i = 0 to 8
  4607. RankLights(i).State = 0
  4608. Next
  4609. For i = 0 to Rank(CurrentPlayer)
  4610. RankLights(i).State = 1
  4611. Next
  4612. End Sub
  4613.  
  4614. Sub PromoteRank
  4615. If Rank(CurrentPlayer) <9 Then
  4616. LightEffect 4
  4617. Rank(CurrentPlayer) = Rank(CurrentPlayer) + 1
  4618. If Rank(CurrentPlayer)> 8 then Rank(CurrentPlayer) = 8
  4619. UpdateRankLights
  4620. 'show DMD new rank
  4621. Select Case Rank(CurrentPlayer)
  4622. Case 0:DMD CL(0, "PROMOTION TO"), CL(1, "CADET"), "", eNone, eNone, eNone, 1500, True, "" 'it should not happen :)
  4623. Case 1:DMD CL(0, "PROMOTION TO"), CL(1, "ENSIGN"), "", eNone, eNone, eNone, 1500, True, "vo_Promotion to Ensign"
  4624. Case 2:DMD CL(0, "PROMOTION TO"), CL(1, "LIEUTENANT"), "", eNone, eNone, eNone, 1500, True, "vo_Promotion to Lieutenant"
  4625. Case 3:DMD CL(0, "PROMOTION TO"), CL(1, "CAPTAIN"), "", eNone, eNone, eNone, 1500, True, "vo_Promotion to Captain"
  4626. Case 4:DMD CL(0, "PROMOTION TO"), CL(1, "LT COMMANDER"), "", eNone, eNone, eNone, 1500, True, "vo_Promotion to Lieutenant Commander"
  4627. Case 5:DMD CL(0, "PROMOTION TO"), CL(1, "COMMANDER"), "", eNone, eNone, eNone, 1500, True, "vo_Promotion to Commander"
  4628. Case 6:DMD CL(0, "PROMOTION TO"), CL(1, "COMMODORE"), "", eNone, eNone, eNone, 1500, True, "vo_Promotion to Commodore"
  4629. Case 7:DMD CL(0, "PROMOTION TO"), CL(1, "ADMIRAL"), "", eNone, eNone, eNone, 1500, True, "vo_Promotion to Admiral"
  4630. Case 8:DMD CL(0, "PROMOTION TO"), CL(1, "FLEET ADMIRAL"), "", eNone, eNone, eNone, 1500, True, "vo_Promotion to Fleet Admiral"
  4631. End Select
  4632. End If
  4633. End Sub
  4634.  
  4635. Sub DemoteRank
  4636. If Rank(CurrentPlayer)> 0 Then
  4637. LightEffect 6
  4638. Rank(CurrentPlayer) = Rank(CurrentPlayer)-1
  4639. If Rank(CurrentPlayer) <0 then Rank(CurrentPlayer) = 0
  4640. UpdateRankLights
  4641. 'show DMD new rank
  4642. Select Case Rank(CurrentPlayer)
  4643. Case 0:DMD CL(0, "DEMOTION TO"), CL(1, "CADET"), "", eNone, eNone, eNone, 1500, True, "vo_Demotion to Cadet"
  4644. Case 1:DMD CL(0, "DEMOTION TO"), CL(1, "ENSIGN"), "", eNone, eNone, eNone, 1500, True, "vo_Demotion to Ensign"
  4645. Case 2:DMD CL(0, "DEMOTION TO"), CL(1, "LIEUTENANT"), "", eNone, eNone, eNone, 1500, True, "vo_Demotion to Lieutenant"
  4646. Case 3:DMD CL(0, "DEMOTION TO"), CL(1, "CAPTAIN"), "", eNone, eNone, eNone, 1500, True, "vo_Demotion to Captain"
  4647. Case 4:DMD CL(0, "DEMOTION TO"), CL(1, "LT COMMANDER"), "", eNone, eNone, eNone, 1500, True, "vo_Demotion to Lieutenant Commander"
  4648. Case 5:DMD CL(0, "DEMOTION TO"), CL(1, "COMMANDER"), "", eNone, eNone, eNone, 1500, True, "vo_Demotion to Commander"
  4649. Case 6:DMD CL(0, "DEMOTION TO"), CL(1, "COMMODORE"), "", eNone, eNone, eNone, 1500, True, "vo_Demotion to Commodore"
  4650. Case 7:DMD CL(0, "DEMOTION TO"), CL(1, "ADMIRAL"), "", eNone, eNone, eNone, 1500, True, "vo_Demotion to Admiral"
  4651. Case 8:DMD CL(0, "DEMOTION TO"), CL(1, "FLEET ADMIRAL"), "", eNone, eNone, eNone, 1500, True, "" 'it should not happen :)
  4652. End Select
  4653. End If
  4654. End Sub
  4655.  
  4656. '***************
  4657. ' MISSIONS
  4658. '***************
  4659. ' variables used:
  4660. ' MissionSelected = 1 to 4 after a target has been hit
  4661. ' Mission(CurrentPlayer) = x, being x the mission number currently active
  4662.  
  4663. Sub PrepareForMission 'called after the skillshot on a new ball or after a mission is completed
  4664. RotateProgressLights.Enabled = 0:UpdateProgressLights
  4665. RotateRankLights.Enabled = 0:UpdateRankLights
  4666. For each i in aArrows
  4667. i.State = 0
  4668. Next
  4669. Mission(CurrentPlayer) = 0
  4670. MissionSelected = 0
  4671. li041.State = 0
  4672. li042.State = 0
  4673. li043.State = 0
  4674. li123.State = 0
  4675. li076.State = 2 'arrow light
  4676. MissionTarget1 = 0
  4677. MissionTarget2 = 0
  4678. MissionTarget3 = 0
  4679. If bMultiballMode Then
  4680. PlaySong "mu_Multiball"
  4681. Else
  4682. PlaySong "mu_main"
  4683. End If
  4684. End Sub
  4685.  
  4686. Sub CheckMissionTargets(n)
  4687. ' a target has been hit, select mission
  4688. ' n is from 1 to 4, 123 are target hits, mission 4 is when all 3 targets are hit
  4689. If MissionTarget1 + MissionTarget2 + MissionTarget3 = 3 Then
  4690. MissionSelected = 4
  4691. ' turn off the targets lights
  4692. li041.State = 0
  4693. li042.State = 0
  4694. li043.State = 0
  4695. LightSeqMission.Play SeqBlinking, , 15, 10
  4696. MissionTarget1 = 0
  4697. MissionTarget2 = 0
  4698. MissionTarget3 = 0
  4699. Else
  4700. MissionSelected = n
  4701. li076.State = 0
  4702. li078.State = 2
  4703. li123.State = 2
  4704. End If
  4705. ' Select Mission
  4706. Select Case Rank(CurrentPlayer)
  4707. Case 0 'Cadet
  4708. Select case MissionSelected
  4709. case 1 'Launch Training 'top target
  4710. DMD CL(0, "MISSION SELECTED"), CL(1, "LAUNCH TRAINING"), "", eNone, eNone, eNone, 1500, True, ""
  4711. case 2 'Re-entry Training
  4712. DMD CL(0, "MISSION SELECTED"), CL(1, "RE-ENTRY TRAINING"), "", eNone, eNone, eNone, 1500, True, ""
  4713. case 3 'Target Practice
  4714. DMD CL(0, "MISSION SELECTED"), CL(1, "TARGET PRACTICE"), "", eNone, eNone, eNone, 1500, True, ""
  4715. case 4 'Science Mission
  4716. DMD CL(0, "MISSION SELECTED"), CL(1, "SCIENCE MISSION"), "", eNone, eNone, eNone, 1500, True, ""
  4717. End Select
  4718. Case 1, 2 'Ensign & Lieutenant
  4719. Select case MissionSelected
  4720. case 1 'Bug Hunt Mission
  4721. DMD CL(0, "MISSION SELECTED"), CL(1, "BUG HUNT MISSION"), "", eNone, eNone, eNone, 1500, True, ""
  4722. case 2 'Rescue Mission
  4723. DMD CL(0, "MISSION SELECTED"), CL(1, "RESCUE MISSION"), "", eNone, eNone, eNone, 1500, True, ""
  4724. case 3 'Alien Menace Mission
  4725. DMD CL(0, "MISSION SELECTED"), CL(1, "ALIEN MENACE"), "", eNone, eNone, eNone, 1500, True, ""
  4726. case 4 'Secret Mission
  4727. DMD CL(0, "MISSION SELECTED"), CL(1, "SECRET MISSION"), "", eNone, eNone, eNone, 1500, True, ""
  4728. End Select
  4729. Case 3, 4 'Captain & Lieut. Commander
  4730. Select case MissionSelected
  4731. case 1 'Stray Comet Mission
  4732. DMD CL(0, "MISSION SELECTED"), CL(1, "STRAY COMET"), "", eNone, eNone, eNone, 1500, True, ""
  4733. case 2 'Space Radiation Mission
  4734. DMD CL(0, "MISSION SELECTED"), CL(1, "SPACE RADIATION"), "", eNone, eNone, eNone, 1500, True, ""
  4735. case 3 'Black Hole Mission
  4736. DMD CL(0, "MISSION SELECTED"), CL(1, "BLACK HOLE"), "", eNone, eNone, eNone, 1500, True, ""
  4737. case 4 'Cosmic Plague Mission
  4738. DMD CL(0, "MISSION SELECTED"), CL(1, "COSMIC PLAGUE"), "", eNone, eNone, eNone, 1500, True, ""
  4739. End Select
  4740. Case 5, 6 'Commander & Commodore
  4741. Select case MissionSelected
  4742. case 1 'Satellite Retrieval Mission
  4743. DMD CL(0, "MISSION SELECTED"), CL(1, "SATELLITE RETRIEVAL"), "", eNone, eNone, eNone, 1500, True, ""
  4744. case 2 'Recon Mission
  4745. DMD CL(0, "MISSION SELECTED"), CL(1, "RECON MISSION"), "", eNone, eNone, eNone, 1500, True, ""
  4746. case 3 'Doomsday Machine Mission
  4747. DMD CL(0, "MISSION SELECTED"), CL(1, "DOOMSDAY MACHINE"), "", eNone, eNone, eNone, 1500, True, ""
  4748. case 4 'Time Warp Mission
  4749. DMD CL(0, "MISSION SELECTED"), CL(1, "TIME WARP"), "", eNone, eNone, eNone, 1500, True, ""
  4750. End Select
  4751. Case 7, 8 'Admiral & Fleet Admiral
  4752. Select case MissionSelected
  4753. case 1 'Cosmic Plague Mission
  4754. DMD CL(0, "MISSION SELECTED"), CL(1, "COSMIC PLAGUE"), "", eNone, eNone, eNone, 1500, True, ""
  4755. case 2 'Secret Mission
  4756. DMD CL(0, "MISSION SELECTED"), CL(1, "SECRET MISSION"), "", eNone, eNone, eNone, 1500, True, ""
  4757. case 3 'Time Warp Mission
  4758. DMD CL(0, "MISSION SELECTED"), CL(1, "TIME WARP"), "", eNone, eNone, eNone, 1500, True, ""
  4759. case 4 'Maelstrom
  4760. DMD CL(0, "MISSION SELECTED"), CL(1, "MAELSTROM"), "", eNone, eNone, eNone, 1500, True, ""
  4761. End Select
  4762. End Select
  4763. End Sub
  4764.  
  4765. Sub AcceptMission(n)
  4766. For each i in aArrows
  4767. i.State = 0
  4768. Next
  4769. FlashForMs li123, 750, 50, 0
  4770. FlashForMs li096, 750, 50, 0
  4771. li123.State = 1
  4772. ' rotate progress lights during a mission
  4773. RotateProgressLights.Enabled = 1
  4774. RotateRankLights.Enabled = 1
  4775. PLaySong "mu_mission"
  4776. ' increase the base value of the crash bonus if it is still 10000
  4777. If BonusPoints(CurrentPlayer) = 10000 Then BonusPoints(CurrentPlayer) = 25000
  4778. ' a mission has been accepted, select the mission based on the rank,
  4779. Select Case Rank(CurrentPlayer)
  4780. Case 0 'Cadet
  4781. Select case MissionSelected
  4782. case 1 'Launch Training 'top target
  4783. DMD CL(0, "MISSION ACCEPTED"), CL(1, "LAUNCH TRAINING"), "", eNone, eNone, eNone, 1500, True, "vo_LAUNCH TRAINING"
  4784. DMD CL(0, "PASS THE LAUNCH"), CL(1, "RAMP 3 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4785. Mission(CurrentPlayer) = 1
  4786. MissionHits = 3
  4787. li078.State = 2
  4788. Addscore 10000 '10000 points to accept mission
  4789. case 2 'Re-entry Training 'middle target
  4790. DMD CL(0, "MISSION ACCEPTED"), CL(1, "RE-ENTRY TRAINING"), "", eNone, eNone, eNone, 1500, True, "vo_RE-ENTRY TRAINING"
  4791. DMD CL(0, "PASS THE RE-ENTRY"), CL(1, "LANES 3 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4792. Mission(CurrentPlayer) = 2
  4793. MissionHits = 3
  4794. li091.State = 2
  4795. Addscore 10000 '10000 points to accept mission
  4796. case 3 'Target Practice 'lower target
  4797. DMD CL(0, "MISSION ACCEPTED"), CL(1, "TARGET PRACTICE"), "", eNone, eNone, eNone, 1500, True, "vo_TARGET PRACTICE"
  4798. DMD CL(0, "HIT THE ATTACK"), CL(1, "BUMPERS 8 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4799. Mission(CurrentPlayer) = 3
  4800. MissionHits = 8
  4801. li085.State = 2
  4802. Addscore 10000 '10000 points to accept mission
  4803. case 4 'Science Mission 'all three targets
  4804. DMD CL(0, "MISSION ACCEPTED"), CL(1, "SCIENCE MISSION"), "", eNone, eNone, eNone, 1500, True, "vo_SCIENCE MISSION"
  4805. DMD CL(0, "HIT 9"), CL(1, "DROPTARGETS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4806. Mission(CurrentPlayer) = 4
  4807. MissionHits = 9
  4808. li088.State = 2
  4809. li079.State = 2
  4810. li084.State = 2
  4811. Addscore 10000 '10000 points to accept mission
  4812. 'reset droptargets
  4813. ResetMedalDT
  4814. ResetxTargets
  4815. ResetBoosterTargets
  4816. End Select
  4817. Case 1, 2 'Ensign & Lieutenant
  4818. Select case MissionSelected
  4819. case 1 'Bug Hunt Mission
  4820. DMD CL(0, "MISSION ACCEPTED"), CL(1, "BUG HUNT MISSION"), "", eNone, eNone, eNone, 1500, True, "vo_BUG HUNT"
  4821. DMD CL(0, "HIT 15"), CL(1, "TARGETS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4822. Mission(CurrentPlayer) = 5
  4823. MissionHits = 15
  4824. Addscore 20000 '20000 points to accept mission
  4825. 'hit 15 targets, all target lights goes out and droptargets reset
  4826. 'reset droptargets
  4827. ResetMedalDT
  4828. ResetxTargets
  4829. ResetBoosterTargets
  4830. 'turn off target lights
  4831. li037.State = 0
  4832. li038.State = 0
  4833. li039.State = 0
  4834. li040.State = 0
  4835. li041.State = 0
  4836. li042.State = 0
  4837. li043.State = 0
  4838. li052.State = 0
  4839. li053.State = 0
  4840. li054.State = 0
  4841. li056.State = 0
  4842. li057.State = 0
  4843. li058.State = 0
  4844. li059.State = 0
  4845. li060.State = 0
  4846. li061.State = 0
  4847. li062.State = 0
  4848. li047.State = 0
  4849. 'turn on arrow lights
  4850. li084.State = 2
  4851. li076.State = 2
  4852. li079.State = 2
  4853. li093.State = 2
  4854. li088.State = 2
  4855. li086.State = 2
  4856. li090.State = 2
  4857. case 2 'Rescue Mission
  4858. DMD CL(0, "MISSION ACCEPTED"), CL(1, "RESCUE MISSION"), "", eNone, eNone, eNone, 1500, True, "vo_RESCUE MISSION"
  4859. DMD CL(0, "UPGRADE FLAGS +"), CL(1, "ENTER HYPERSPACE"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4860. Mission(CurrentPlayer) = 6
  4861. Addscore 20000 '20000 points to accept mission
  4862. bFlagsUpgraded = False
  4863. BoosterCount = 0
  4864. ResetBoosterTargets
  4865. li079.State = 2
  4866. case 3 'Alien Menace Mission
  4867. DMD CL(0, "MISSION ACCEPTED"), CL(1, "ALIEN MENACE"), "", eNone, eNone, eNone, 1500, True, "vo_ALIEN MENACE"
  4868. DMD CL(0, "UPGRADE THE"), CL(1, "ATTACK BUMPERS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4869. DMD CL(0, "HIT THE ATTACK"), CL(1, "BUMPERS 8 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4870. Mission(CurrentPlayer) = 7
  4871. Addscore 20000 '20000 points to accept mission
  4872. AttackBumperColor = 0
  4873. UpdateBumperColor
  4874. li091.State = 2
  4875. case 4 'Secret Mission
  4876. DMD CL(0, "MISSION ACCEPTED"), CL(1, "SECRET MISSION"), "", eNone, eNone, eNone, 1500, True, "vo_SECRET MISSION"
  4877. DMD CL(0, "ENTER THE 3"), CL(1, "WORMHOLES IN ORDER"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4878. Mission(CurrentPlayer) = 8
  4879. Addscore 30000 '30000 points to accept mission
  4880. 'prepare the yellow Wormhole
  4881. li144.State = 0
  4882. li143.State = 0
  4883. li142.State = 2
  4884. li080.State = 2
  4885. End Select
  4886. Case 3, 4 'Captain & Lieut. Commander
  4887. Select case MissionSelected
  4888. case 1 'Stray Comet Mission
  4889. DMD CL(0, "MISSION ACCEPTED"), CL(1, "STRAY COMET"), "", eNone, eNone, eNone, 1500, True, "vo_STRAY COMET"
  4890. DMD CL(0, "LIGHT ALL 3"), CL(1, "COMET LIGHTS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4891. Mission(CurrentPlayer) = 9
  4892. Addscore 20000 '20000 points to accept mission
  4893. li093.State = 2
  4894. li052.State = 0
  4895. li053.State = 0
  4896. li054.State = 0
  4897. case 2 'Space Radiation Mission
  4898. DMD CL(0, "MISSION ACCEPTED"), CL(1, "SPACE RADIATION"), "", eNone, eNone, eNone, 1500, True, "vo_SPACE RADIATION"
  4899. DMD CL(0, "LIGHT ALL 3"), CL(1, "RADIATION LIGHTS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4900. Mission(CurrentPlayer) = 10
  4901. Addscore 20000 '20000 points to accept mission
  4902. li056.State = 0
  4903. li057.State = 0
  4904. li058.State = 0
  4905. li086.State = 2
  4906. case 3 'Black Hole Mission
  4907. DMD CL(0, "MISSION ACCEPTED"), CL(1, "BLACK HOLE THREAT"), "", eNone, eNone, eNone, 1500, True, "vo_BLACK HOLE THREAT"
  4908. DMD CL(0, "UPGRADE THE"), CL(1, "ENGINE BUMPERS"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4909. Mission(CurrentPlayer) = 11
  4910. Addscore 20000 '20000 points to accept mission
  4911. EngineBumperColor = 0
  4912. UpdateBumperColor
  4913. li078.State = 2
  4914. case 4 'Cosmic Plague Mission
  4915. DMD CL(0, "MISSION ACCEPTED"), CL(1, "COSMIC PLAGUE"), "", eNone, eNone, eNone, 1500, True, "vo_COSMIC PLAGUE"
  4916. DMD CL(0, "SPIN FLAGS"), CL(1, "75 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4917. Mission(CurrentPlayer) = 12
  4918. MissionHits = 75
  4919. Addscore 30000 '30000 points to accept mission
  4920. li077.State = 2
  4921. li134.State = 2
  4922. End Select
  4923. Case 5, 6 'Commander & Commodore
  4924. Select case MissionSelected
  4925. case 1 'Satellite Retrieval Mission
  4926. DMD CL(0, "MISSION ACCEPTED"), CL(1, "SATELLITE RETRIEVAL"), "", eNone, eNone, eNone, 1500, True, "vo_SATELLITE RETRIEVAL"
  4927. DMD CL(0, "HIT 3 TIMES"), "THE SATELLITE BUMPER", "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4928. Mission(CurrentPlayer) = 13
  4929. MissionHits = 3
  4930. Addscore 20000 '20000 points to accept mission
  4931. li090.State = 2
  4932. case 2 'Recon Mission
  4933. DMD CL(0, "MISSION ACCEPTED"), CL(1, "RECON MISSION"), "", eNone, eNone, eNone, 1500, True, "vo_RECON MISSION"
  4934. DMD CL(0, "PASS ANY OF THE"), CL(1, "LANES 15 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4935. Mission(CurrentPlayer) = 14
  4936. MissionHits = 15
  4937. Addscore 20000 '20000 points to accept mission
  4938. li091.State = 2
  4939. li027.State = 2
  4940. li070.State = 2
  4941. li069.State = 2
  4942. li074.State = 2
  4943. li075.State = 2
  4944. case 3 'Doomsday Machine Mission
  4945. DMD CL(0, "MISSION ACCEPTED"), CL(1, "DOOMSDAY MACHINE"), "", eNone, eNone, eNone, 1500, True, "vo_DOOMSDAY MACHINE"
  4946. DMD CL(0, "SEND BALL 3 TIMES"), CL(1, "THROUGH OUTLINES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4947. Mission(CurrentPlayer) = 15
  4948. MissionHits = 3
  4949. Addscore 20000 '20000 points to accept mission
  4950. li069.State = 2
  4951. li075.State = 2
  4952. case 4 'Time Warp Mission
  4953. DMD CL(0, "MISSION ACCEPTED"), CL(1, "TIME WARP"), "", eNone, eNone, eNone, 1500, True, "vo_TIME WARP"
  4954. DMD CL(0, "HIT THE REBOUNDS"), CL(1, "25 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4955. DMD CL(0, "ENTER LAUNCH RAMP"), "OR HYPERSPACE KICKER", "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4956. Mission(CurrentPlayer) = 16
  4957. MissionHits = 25
  4958. Addscore 30000 '30000 points to accept mission
  4959. li071.State = 2
  4960. li073.State = 2
  4961. End Select
  4962. Case 7, 8 'Admiral & Fleet Admiral
  4963. Select case MissionSelected
  4964. case 1 'Cosmic Plague Mission
  4965. DMD CL(0, "MISSION ACCEPTED"), CL(1, "COSMIC PLAGUE"), "", eNone, eNone, eNone, 1500, True, "vo_COSMIC PLAGUE"
  4966. DMD CL(0, "SPIN FLAGS"), CL(1, "75 TIMES"), "", eNone, eNone, eNone, 1500, True, ""
  4967. Mission(CurrentPlayer) = 12
  4968. MissionHits = 75
  4969. Addscore 30000 '30000 points to accept mission
  4970. li077.State = 2
  4971. li134.State = 2
  4972. case 2 'Secret Mission
  4973. DMD CL(0, "MISSION ACCEPTED"), CL(1, "SECRET MISSION"), "", eNone, eNone, eNone, 1500, True, "vo_SECRET MISSION"
  4974. DMD CL(0, "ENTER THE 3"), CL(1, "WORMHOLES IN ORDER"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4975. Mission(CurrentPlayer) = 8
  4976. Addscore 30000 '30000 points to accept mission
  4977. 'prepare the yellow Wormhole
  4978. li144.State = 0
  4979. li143.State = 0
  4980. li142.State = 2
  4981. li080.State = 2
  4982. case 3 'Time Warp Mission
  4983. DMD CL(0, "MISSION ACCEPTED"), CL(1, "TIME WARP"), "", eNone, eNone, eNone, 1500, True, "vo_TIME WARP"
  4984. DMD CL(0, "HIT THE REBOUNDS"), CL(1, "25 TIMES"), "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4985. DMD CL(0, "ENTER LAUNCH RAMP"), "OR HYPERSPACE KICKER", "", eScrollLeft, eScrollLeft, eNone, 1500, True, ""
  4986. Mission(CurrentPlayer) = 16
  4987. MissionHits = 25
  4988. Addscore 30000 '30000 points to accept mission
  4989. li071.State = 2
  4990. li073.State = 2
  4991. case 4 'Maelstrom
  4992. DMD CL(0, "MISSION ACCEPTED"), CL(1, "MAELSTROM"), "", eNone, eNone, eNone, 1500, True, "vo_MAELSTROM"
  4993. DMD CL(0, "STARTING MAELSTROM"), CL(1, "HIT 3 DROPTARGETS"), "", eNone, eScrollLeft, eNone, 1500, True, ""
  4994. Mission(CurrentPlayer) = 17
  4995. MissionHits = 3
  4996. Addscore 30000 '30000 points to accept mission
  4997. li079.State = 2
  4998. li084.State = 2
  4999. li088.State = 2
  5000. End Select
  5001. End Select
  5002. End Sub
  5003.  
  5004. Sub CheckMission 'check if mission objectives are completed
  5005. Select Case Mission(CurrentPlayer)
  5006. Case 1 'Launch Training
  5007. If Missionhits = 0 then 'win the mission
  5008. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(500000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5009. Addscore 500000 '500k for finishing the mission
  5010. AddProgress 6 'add 6 progress lights
  5011. LightEffect 2
  5012. PrepareForMission 'ready for the next mission
  5013. Else
  5014. PlaySfx
  5015. End If
  5016. Case 2 'Re-entry Training
  5017. If Missionhits = 0 then 'win the mission
  5018. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(500000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5019. Addscore 500000 '500k for finishing the mission
  5020. AddProgress 6 'add 6 progress lights
  5021. LightEffect 2
  5022. PrepareForMission 'ready for the next mission
  5023. Else
  5024. PlaySfx
  5025. End If
  5026. Case 3 'Target Practice
  5027. If Missionhits = 0 then 'win the mission
  5028. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(500000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5029. Addscore 500000 '500k for finishing the mission
  5030. AddProgress 6 'add 6 progress lights
  5031. LightEffect 2
  5032. PrepareForMission 'ready for the next mission
  5033. Else
  5034. PlaySfx
  5035. End If
  5036. Case 4 'Science Mission
  5037. If Missionhits = 0 then 'win the mission
  5038. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(750000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5039. Addscore 750000 '750k for finishing the mission
  5040. AddProgress 9 'add 9 progress lights
  5041. LightEffect 2
  5042. PrepareForMission 'ready for the next mission
  5043. Else
  5044. PlaySfx
  5045. End If
  5046. Case 5 'Bug Hunt Mission
  5047. If Missionhits = 0 then 'win the mission
  5048. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(750000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5049. Addscore 750000 '750k for finishing the mission
  5050. AddProgress 7 'add 7 progress lights
  5051. LightEffect 2
  5052. PrepareForMission 'ready for the next mission
  5053. Else
  5054. PlaySfx
  5055. End If
  5056. Case 6 'Rescue Mission
  5057. If bFlagsUpgraded Then
  5058. DMD CL(0, "ENTER THE"), CL(1, "HYPERSPACE KICKER"), "", eNone, eNone, eNone, 1500, True, ""
  5059. Mission(CurrentPlayer) = 61
  5060. li079.State = 0
  5061. PlaySfx
  5062. li123.State = 0
  5063. End If
  5064. Case 61 'Rescue Mission
  5065. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(750000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5066. Addscore 750000 '750k for finishing the mission
  5067. AddProgress 7 'add 7 progress lights
  5068. LightEffect 2
  5069. PrepareForMission 'ready for the next mission
  5070. Case 7 'Alien Menace Mission
  5071. DMD CL(0, "HIT THE ATTACK"), CL(1, "BUMPERS 8 TIMES"), "", eNone, eNone, eNone, 1500, True, ""
  5072. Mission(CurrentPlayer) = 71
  5073. PlaySfx
  5074. Missionhits = 8
  5075. li091.State = 0
  5076. li085.State = 2
  5077. case 71 'Alien Menace Mission
  5078. If Missionhits = 0 then 'win the mission
  5079. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(750000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5080. Addscore 750000 '750k for finishing the mission
  5081. AddProgress 7 'add 7 progress lights
  5082. LightEffect 2
  5083. PrepareForMission 'ready for the next mission
  5084. Else
  5085. PlaySfx
  5086. End If
  5087. Case 8 'Secret Mission
  5088. DMD " 1ST TASK COMPLETED", " HIT RED WORMHOLE", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5089. PlaySfx
  5090. 'prepare the red Wormhole
  5091. li144.State = 0
  5092. li143.State = 2
  5093. li142.State = 0
  5094. li080.State = 0
  5095. Mission(CurrentPlayer) = 81
  5096. li081.State = 2
  5097. Case 81
  5098. DMD " 2ND TASK COMPLETED", "HIT GREEN WORMHOLE", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5099. PlaySfx
  5100. 'prepare the green Wormhole
  5101. li144.State = 2
  5102. li143.State = 0
  5103. li142.State = 0
  5104. Mission(CurrentPlayer) = 82
  5105. li081.State = 0
  5106. li082.State = 2
  5107. Case 82
  5108. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(1500000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5109. Addscore 1500000 '1,5 Mill for finishing the mission
  5110. AddProgress 10 'add 10 progress lights
  5111. LightEffect 2
  5112. PrepareForMission 'ready for the next mission
  5113. li082.State = 0
  5114. li144.State = 0
  5115. li143.State = 0
  5116. li142.State = 0
  5117. Case 9 'Stray Comet Mission
  5118. DMD "", CL(1, "1ST TASK COMPLETED"), "", eNone, eNone, eNone, 1500, True, ""
  5119. DMD CL(0, "ENTER THE"), CL(1, "HYPERSPACE KICKER"), "", eNone, eNone, eNone, 1500, True, ""
  5120. PlaySfx
  5121. Mission(CurrentPlayer) = 91
  5122. li093.State = 0
  5123. li134.State = 2
  5124. Case 91
  5125. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(1500000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5126. Addscore 1000000 '1 Mill for finishing the mission
  5127. AddProgress 8 'add 8 progress lights
  5128. LightEffect 2
  5129. PrepareForMission 'ready for the next mission
  5130. Case 10 'Space Radiation Mission
  5131. DMD " 1ST TASK COMPLETED", " ENTER ANY WORMHOLE", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5132. PlaySfx
  5133. Mission(CurrentPlayer) = 101
  5134. li086.State = 0
  5135. li080.State = 2
  5136. li081.State = 2
  5137. li082.State = 2
  5138. Case 101 'Space Radiation Mission
  5139. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(1500000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5140. Addscore 1000000 '1 Mill for finishing the mission
  5141. AddProgress 8 'add 8 progress lights
  5142. LightEffect 2
  5143. PrepareForMission 'ready for the next mission
  5144. li080.State = 0
  5145. li081.State = 0
  5146. li082.State = 0
  5147. ChangeArrowColor 'in case the wormholes were activated
  5148. Case 11 'Black Hole Mission
  5149. DMD " 1ST TASK COMPLETED", "ENTER THE BLACK HOLE", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5150. PlaySfx
  5151. Mission(CurrentPlayer) = 111
  5152. li078.State = 0
  5153. li083.State = 2
  5154. Case 111 'Black Hole Mission
  5155. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(1500000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5156. Addscore 1000000 '1 Mill for finishing the mission
  5157. AddProgress 8 'add 8 progress lights
  5158. LightEffect 2
  5159. PrepareForMission 'ready for the next mission
  5160. Case 12 'Cosmic Plague Mission
  5161. If Missionhits = 0 then 'win the mission
  5162. DMD " 1ST TASK COMPLETED", " HIT SPACE WARP", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5163. Mission(CurrentPlayer) = 121
  5164. li077.State = 0
  5165. li134.State = 0
  5166. li087.State = 2
  5167. End If
  5168. Case 121 'Cosmic Plague Mission
  5169. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(1750000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5170. Addscore 1750000 '1 Mill for finishing the mission
  5171. AddProgress 11 'add 11 progress lights
  5172. LightEffect 2
  5173. PrepareForMission 'ready for the next mission
  5174. Case 13 'Satellite Retrieval Mission
  5175. If Missionhits = 0 then 'win the mission
  5176. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(1250000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5177. Addscore 1250000 '1,25 Mill for finishing the mission
  5178. AddProgress 9 'add 9 progress lights
  5179. LightEffect 2
  5180. PrepareForMission 'ready for the next mission
  5181. Else
  5182. PlaySfx
  5183. End If
  5184. Case 14 'Recon Mission
  5185. If Missionhits = 0 then 'win the mission
  5186. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(1250000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5187. Addscore 1250000 '1,25 Mill for finishing the mission
  5188. AddProgress 9 'add 9 progress lights
  5189. LightEffect 2
  5190. PrepareForMission 'ready for the next mission
  5191. Else
  5192. PlaySfx
  5193. End If
  5194. Case 15 'Doomsday Machine Mission
  5195. If Missionhits = 0 then 'win the mission
  5196. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(1250000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5197. Addscore 1250000 '1,25 Mill for finishing the mission
  5198. AddProgress 9 'add 9 progress lights
  5199. LightEffect 2
  5200. PrepareForMission 'ready for the next mission
  5201. Else
  5202. PlaySfx
  5203. End If
  5204. Case 16 'Time Warp Mission
  5205. If Missionhits = 0 then 'win the mission
  5206. DMD " 1ST TASK COMPLETED", "", "", eNone, eNone, eNone, 1500, True, ""
  5207. DMD "HIT THE LAUNCH RAMP", " OR THE HYPERSPACE", "", eNone, eNone, eNone, 1500, True, ""
  5208. Mission(CurrentPlayer) = 161
  5209. li071.State = 0
  5210. li073.State = 0
  5211. li078.State = 2
  5212. li134.State = 2
  5213. li097.State = 2
  5214. li100.State = 2
  5215. Else
  5216. PlaySfx
  5217. End If
  5218. Case 161 'Time Warp Mission
  5219. DMD CL(0, "MISSION COMPLETED"), CL(1, FormatScore(2000000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5220. Addscore 2000000 '2 Mill for finishing the mission
  5221. AddProgress 12 'add 12 progress lights
  5222. LightEffect 2
  5223. li097.State = 0
  5224. li100.State = 0
  5225. li034.State = 0
  5226. li078.State = 0
  5227. PrepareForMission 'ready for the next mission
  5228. Case 17 ' Maelstrom "DROPTARGETS LEFT " & MissionHits
  5229. If Missionhits = 0 then '
  5230. DMD CL(0, " 1ST TASK COMPLETED"), "HIT 3 SPOT TARGETS", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5231. li079.State = 0
  5232. li084.State = 0
  5233. li088.State = 0
  5234. Mission(CurrentPlayer) = 171
  5235. Missionhits = 3
  5236. li076.State = 2
  5237. li079.State = 2
  5238. li086.State = 2
  5239. li090.State = 2
  5240. Else
  5241. PlaySfx
  5242. End If
  5243. Case 171 '"SPOT TARGETS LEFT " & MissionHits
  5244. If Missionhits = 0 then
  5245. DMD CL(0, " 2ND TASK COMPLETED"), "HIT 5 LANES", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5246. li076.State = 0
  5247. li079.State = 0
  5248. li086.State = 0
  5249. li090.State = 0
  5250. Mission(CurrentPlayer) = 172
  5251. Missionhits = 5
  5252. li091.State = 2
  5253. li027.State = 2
  5254. li070.State = 2
  5255. li069.State = 2
  5256. li074.State = 2
  5257. li075.State = 2
  5258. Else
  5259. PlaySfx
  5260. End If
  5261. Case 172 '"LANES LEFT " & MissionHits
  5262. If Missionhits = 0 then
  5263. DMD CL(0, " 3RD TASK COMPLETED"), " HIT THE FUEL CHUTE", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5264. li091.State = 0
  5265. li027.State = 0
  5266. li070.State = 0
  5267. li069.State = 0
  5268. li074.State = 0
  5269. li075.State = 0
  5270. Mission(CurrentPlayer) = 173
  5271. li077.State = 2
  5272. Else
  5273. PlaySfx
  5274. End If
  5275. Case 173 '" HIT THE FUEL CHUTE"
  5276. DMD CL(0, " 4TH TASK COMPLETED"), " HIT THE LAUNCH RAMP", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5277. Mission(CurrentPlayer) = 174
  5278. li077.State = 0
  5279. li078.State = 2
  5280. Case 174 '"HIT THE LAUNCH RAMP"
  5281. DMD CL(0, " 5TH TASK COMPLETED"), " ROLL A FLAG", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5282. Mission(CurrentPlayer) = 175
  5283. li078.State = 0
  5284. li077.State = 2
  5285. li134.State = 2
  5286. Case 175 '"ROLL A FLAG"
  5287. DMD CL(0, " 6TH TASK COMPLETED"), " ENTER A WORMHOLE", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5288. Mission(CurrentPlayer) = 176
  5289. li077.State = 0
  5290. li134.State = 0
  5291. li080.State = 2
  5292. li081.State = 2
  5293. li082.State = 2
  5294. Case 176 '"ENTER A WORMHOLE"
  5295. DMD CL(0, " 7TH TASK COMPLETED"), " ENTER HYPERSPACE", "", eNone, eScrollLeft, eNone, 1500, True, ""
  5296. Mission(CurrentPlayer) = 177
  5297. li080.State = 0
  5298. li081.State = 0
  5299. li082.State = 0
  5300. li134.State = 2
  5301. li099.State = 1
  5302. Case 177 '"ENTER HYPERSPACE"
  5303. DMD CL(0, "MAELSTROM COMPLETED"), CL(1, FormatScore(5000000)), "", eNone, eScrollLeft, eNone, 1500, True, "vo_Mission Completed"
  5304. Addscore 5000000 '5 Mill for finishing the mission
  5305. AddProgress 18 'add 12 progress lights
  5306. LightEffect 2
  5307. AddMultiball 3
  5308. PrepareForMission 'ready for the next mission
  5309. End Select
  5310. End Sub
  5311.  
  5312. Sub StopMissions 'this will stop all missions. Called at the end of the ball or when the fuel runs out
  5313. If Fuel = 0 Then
  5314. DMD "", CL(1, "MISSION ABORTED"), "", eNone, eNone, eNone, 1500, True, "vo_Mission Aborted"
  5315. End If
  5316. RotateProgressLights.Enabled = 0:UpdateProgressLights
  5317. RotateRankLights.Enabled = 0:UpdateRankLights
  5318. for each i in aArrows:i.State = 0:Next
  5319. Mission(CurrentPlayer) = 0
  5320. MissionSelected = 0
  5321. li123.State = 0
  5322. End Sub
  5323.  
  5324. 'DMD CL(0,""), CL(1,""), "", eNone, eNone, eNone, 1500, True, ""
Advertisement
Add Comment
Please, Sign In to add comment