Outhere

Underwater1.0

Sep 5th, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 64.04 KB | None | 0 0
  1. ' ***********************************************************************
  2. ' VISUAL PINBALL X EM Script by JPSalas
  3. ' Basic EM script up to 4 players
  4. ' uses core.vbs for extra functions
  5. '
  6. ' Underwater / IPD No. 5932 / 4 Players (Petaco)
  7. ' Underwater / IPD No. 2702 / June, 1976 / 4 Players (Recel)
  8. '
  9. ' VPX - version by JPSalas & pedator 2021, version 1.0.0
  10. ' ***********************************************************************
  11.  
  12. 'DOF Added it by Outhere
  13.  
  14. '101 Left Flipper
  15. '102 Right Flipper
  16. '103 Left Slingshot
  17. '104 Right Slingshot
  18. '105 Upper Right Slingshot
  19. '106
  20. '107
  21. '108 Top Bumper Center
  22. '109
  23. '110 Upper Kicker Left
  24. '111
  25. '112
  26. '113
  27. '114 Shaker - Vari-target
  28. '115 Shaker - Spinner
  29. '116
  30. '117 Topper Bell
  31. '118
  32. '119
  33. '120
  34. '121
  35. '122 Knocker
  36. '123 Ball Release
  37. '124
  38. '141 Chime Unit High Tone
  39. '142 Chime Unit Mid Tone
  40. '143 Chime Unit Low Tone
  41.  
  42. Option Explicit
  43. Randomize
  44.  
  45. ' core.vbs constants
  46. Const BallSize = 50 ' 50 is the normal size
  47. Const BallMass = 1.7 ' 1 is the normal ball mass.
  48.  
  49. ' load extra vbs files
  50. LoadCoreFiles
  51.  
  52. Sub LoadCoreFiles
  53. On Error Resume Next
  54. ExecuteGlobal GetTextFile("core.vbs")
  55. If Err Then MsgBox "Can't open core.vbs"
  56. On Error Resume Next
  57. ExecuteGlobal GetTextFile("controller.vbs")
  58. If Err Then MsgBox "Can't open controller.vbs"
  59. End Sub
  60.  
  61. ' Valores Constants
  62. Const cGameName = "Underwater" ' B2S name & file name to save highscores and other variables
  63. Const MaxPlayers = 4 ' 1 to 4 can play
  64. Const MaxMultiplier = 2 ' limit bonus multiplier
  65. Const BallsPerGame = 3 ' 3 or 5
  66. Const FreePlay = False ' Free play or coins
  67. Const Special1 = 500000 ' extra ball or credit
  68. Const Special2 = 750000
  69. Const Special3 = 950000
  70.  
  71. ' Global variables
  72. Dim PlayersPlayingGame
  73. Dim CurrentPlayer
  74. Dim Credits
  75. Dim Bonus
  76. Dim BallsRemaining(4)
  77. Dim BonusMultiplier
  78. Dim ExtraBallsAwards(4)
  79. Dim Special1Awarded(4)
  80. Dim Special2Awarded(4)
  81. Dim Special3Awarded(4)
  82. Dim Score(4)
  83. Dim HighScore
  84. Dim Match
  85. Dim Tilt
  86. Dim TiltSensitivity
  87. Dim Tilted
  88. Dim Add10
  89. Dim Add100
  90. Dim Add1000
  91. Dim Add10000
  92.  
  93. ' Control variables
  94. Dim BallsOnPlayfield
  95.  
  96. ' Boolean variables
  97. Dim bAttractMode
  98. Dim bFreePlay
  99. Dim bGameInPlay
  100. Dim bOnTheFirstBall
  101. Dim bExtraBallWonThisBall
  102. Dim bJustStarted
  103. Dim bBallInPlungerLane
  104. Dim bBallSaverActive
  105.  
  106. ' core.vbs variables
  107. Dim cball1, cball2, cball3
  108.  
  109. ' *********************************************************************
  110. ' Common rutines to all the tables
  111. ' *********************************************************************
  112.  
  113. Sub Table1_Init()
  114. Dim x
  115.  
  116. ' Init som objects, like walls, targets
  117. VPObjects_Init
  118. LoadEM
  119.  
  120. ' init core.vbs objects
  121. Set cball1 = New cvpmCaptiveBall
  122. With cball1
  123. .InitCaptive CapTrigger1, CapWall1, CapKicker1, 0
  124. .ForceTrans = .9
  125. .MinForce = 3.5
  126. .CreateEvents "cball1"
  127. .Start
  128. End With
  129.  
  130. Set cball2 = New cvpmCaptiveBall
  131. With cball2
  132. .InitCaptive CapTrigger2, capwall2, CapKicker2, 0
  133. .ForceTrans = .9
  134. .MinForce = 3.5
  135. .CreateEvents "cball2"
  136. .Start
  137. End With
  138.  
  139. Set cball3 = New cvpmCaptiveBall
  140. With cball3
  141. .InitCaptive CapTrigger3, capwall3, capKicker3, 0
  142. .ForceTrans = .9
  143. .MinForce = 3.5
  144. .CreateEvents "cball3"
  145. .Start
  146. End With
  147.  
  148. ' load highscore
  149. Credits = 0
  150. Loadhs
  151. ScoreReel1.SetValue HSScore(1)
  152. If B2SOn then
  153. Controller.B2SSetScorePlayer 1, HSScore(1)
  154. End If
  155. UpdateCredits
  156.  
  157. ' init all the global variables
  158. bFreePlay = FreePlay
  159. bAttractMode = False
  160. bOnTheFirstBall = False
  161. bGameInPlay = False
  162. bBallInPlungerLane = False
  163. BallsOnPlayfield = 0
  164. Tilt = 0
  165. TiltSensitivity = 6
  166. Tilted = False
  167. Match = 0
  168. bJustStarted = True
  169. Add10 = 0
  170. Add100 = 0
  171. Add1000 = 0
  172.  
  173. ' setup table in game over mode
  174. EndOfGame
  175.  
  176. 'turn on GI lights
  177. vpmtimer.addtimer 1000, "GiOn '"
  178.  
  179. ' Remove desktop items in FS mode
  180. If Table1.ShowDT then
  181. For each x in aReels
  182. x.Visible = 1
  183. Next
  184. Else
  185. For each x in aReels
  186. x.Visible = 0
  187. Next
  188. End If
  189.  
  190. ' Start the RealTime timer
  191. RealTime.Enabled = 1
  192.  
  193. ' Load table color
  194. LoadLut
  195. End Sub
  196.  
  197. '******
  198. ' Keys
  199. '******
  200.  
  201. Sub Table1_KeyDown(ByVal Keycode)
  202.  
  203. If keycode = LeftMagnaSave Then bLutActive = True
  204. If keycode = RightMagnaSave Then
  205. If bLutActive Then NextLUT:End If
  206. End If
  207.  
  208. If EnteringInitials then
  209. CollectInitials(keycode)
  210. Exit Sub
  211. End If
  212.  
  213. ' add coins
  214. If Keycode = AddCreditKey Then
  215. If(Tilted = False)Then
  216. AddCredits 1
  217. PlaySound "fx_coin"
  218. End If
  219. End If
  220.  
  221. ' plunger
  222. If keycode = PlungerKey Then
  223. Plunger.Pullback
  224. PlaySoundAt "fx_plungerpull", plunger
  225. End If
  226.  
  227. ' tilt keys
  228. If keycode = LeftTiltKey Then Nudge 90, 8:PlaySound "fx_nudge", 0, 1, -0.1, 0.25:CheckTilt
  229. If keycode = RightTiltKey Then Nudge 270, 8:PlaySound "fx_nudge", 0, 1, 0.1, 0.25:CheckTilt
  230. If keycode = CenterTiltKey Then Nudge 0, 9:PlaySound "fx_nudge", 0, 1, 1, 0.25:CheckTilt
  231.  
  232. ' keys during game
  233.  
  234. If bGameInPlay AND NOT Tilted Then
  235. If keycode = LeftFlipperKey Then SolLFlipper 1
  236. If keycode = RightFlipperKey Then SolRFlipper 1
  237.  
  238. If keycode = StartGameKey Then
  239. If((PlayersPlayingGame <MaxPlayers)AND(bOnTheFirstBall = True))Then
  240.  
  241. If(bFreePlay = True)Then
  242. PlayersPlayingGame = PlayersPlayingGame + 1
  243. 'PlayersReel.SetValue, PlayersPlayingGame
  244. 'PlaySound "so_fanfare1"
  245. Else
  246. If(Credits> 0)then
  247. PlayersPlayingGame = PlayersPlayingGame + 1
  248. Credits = Credits - 1
  249. UpdateCredits
  250. UpdateBallInPlay
  251. Else
  252. ' Not Enough Credits to start a game.
  253. ' PlaySound "so_nocredits"
  254. End If
  255. End If
  256. End If
  257. End If
  258. Else
  259.  
  260. If keycode = StartGameKey Then
  261. If(bFreePlay = True)Then
  262. If(BallsOnPlayfield = 0)Then
  263. ResetScores
  264. ResetForNewGame()
  265. End If
  266. Else
  267. If(Credits> 0)Then
  268. If(BallsOnPlayfield = 0)Then
  269. Credits = Credits - 1
  270. UpdateCredits
  271. ResetScores
  272. ResetForNewGame()
  273. End If
  274. Else
  275. ' Not Enough Credits to start a game.
  276. ' PlaySound "so_nocredits"
  277. End If
  278. End If
  279. End If
  280. End If ' If (GameInPlay)
  281. End Sub
  282.  
  283. Sub Table1_KeyUp(ByVal keycode)
  284.  
  285. If EnteringInitials then
  286. Exit Sub
  287. End If
  288.  
  289. If bGameInPlay AND NOT Tilted Then
  290. ' teclas de los flipers
  291. If keycode = LeftFlipperKey Then SolLFlipper 0
  292. If keycode = RightFlipperKey Then SolRFlipper 0
  293. End If
  294.  
  295. If keycode = PlungerKey Then
  296. Plunger.Fire
  297. If bBallInPlungerLane Then
  298. PlaySoundAt "fx_plunger", plunger
  299. Else
  300. PlaySoundAt "fx_plunger_empty", plunger
  301. End If
  302. End If
  303. End Sub
  304.  
  305. '******************
  306. ' Table stop/pause
  307. '******************
  308.  
  309. Sub table1_Paused
  310. End Sub
  311.  
  312. Sub table1_unPaused
  313. End Sub
  314.  
  315. Sub table1_Exit
  316. Savehs
  317. 'Controller.Stop
  318. End Sub
  319.  
  320. '********************
  321. ' Flippers
  322. '********************
  323.  
  324. Sub SolLFlipper(Enabled)
  325. If Enabled Then
  326. PlaySoundAt SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), LeftFlipper
  327. LeftFlipper.EOSTorque = 0.75:LeftFlipper.RotateToEnd
  328. Else
  329. PlaySoundAt SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), LeftFlipper
  330. LeftFlipper.EOSTorque = 0.2:LeftFlipper.RotateToStart
  331. End If
  332. End Sub
  333.  
  334. Sub SolRFlipper(Enabled)
  335. If Enabled Then
  336. PlaySoundAt SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), RightFlipper
  337. RightFlipper.EOSTorque = 0.75:RightFlipper.RotateToEnd
  338. Else
  339. PlaySoundAt SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), RightFlipper
  340. RightFlipper.EOSTorque = 0.2:RightFlipper.RotateToStart
  341. End If
  342. End Sub
  343.  
  344. Sub LeftFlipper_Collide(parm)
  345. PlaySoundAtBall "fx_rubber_flipper"
  346. End Sub
  347.  
  348. Sub RightFlipper_Collide(parm)
  349. PlaySoundAtBall "fx_rubber_flipper"
  350. End Sub
  351.  
  352. '***********
  353. ' GI lights
  354. '***********
  355.  
  356. Sub GiOn 'enciende las luces GI
  357. Dim bulb
  358. For each bulb in aGiLights
  359. bulb.State = 1
  360. Next
  361. End Sub
  362.  
  363. Sub GiOff 'apaga las luces GI
  364. Dim bulb
  365. For each bulb in aGiLights
  366. bulb.State = 0
  367. Next
  368. End Sub
  369.  
  370. '**************
  371. ' TILT
  372. '**************
  373.  
  374. Sub CheckTilt
  375. Tilt = Tilt + TiltSensitivity
  376. TiltDecreaseTimer.Enabled = True
  377. If Tilt> 15 Then
  378. Tilted = True
  379. TiltL.State = 1
  380. If B2SOn then
  381. Controller.B2SSetTilt 1
  382. end if
  383. DisableTable True
  384. ' BallsRemaining(CurrentPlayer) = 0 'player looses the game 'mostly on older 1 player games
  385. TiltRecoveryTimer.Enabled = True 'wait for all the balls to drain
  386. End If
  387. End Sub
  388.  
  389. Sub TiltDecreaseTimer_Timer
  390. If Tilt> 0 Then
  391. Tilt = Tilt - 0.1
  392. Else
  393. TiltDecreaseTimer.Enabled = False
  394. End If
  395. End Sub
  396.  
  397. Sub DisableTable(Enabled)
  398. If Enabled Then
  399. GiOff
  400. LeftFlipper.RotateToStart
  401. RightFlipper.RotateToStart
  402. Bumper001.Force = 0
  403. LeftSlingshot.Disabled = 1
  404. RightSlingshot.Disabled = 1
  405. RightSlingshot001.Disabled = 1
  406. Else
  407. GiOn
  408. Bumper001.Force = 10
  409. LeftSlingshot.Disabled = 0
  410. RightSlingshot.Disabled = 0
  411. RightSlingshot001.Disabled = 0
  412. End If
  413. End Sub
  414.  
  415. Sub TiltRecoveryTimer_Timer()
  416. ' all the balls have drained
  417. If(BallsOnPlayfield = 0)Then
  418. EndOfBall()
  419. TiltRecoveryTimer.Enabled = False
  420. End If
  421. ' otherwise repeat
  422. End Sub
  423.  
  424. '***************************************************************
  425. ' Supporting Ball & Sound Functions v3.0
  426. ' includes random pitch in PlaySoundAt and PlaySoundAtBall
  427. '***************************************************************
  428.  
  429. Dim TableWidth, TableHeight
  430.  
  431. TableWidth = Table1.width
  432. TableHeight = Table1.height
  433.  
  434. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  435. Vol = Csng(BallVel(ball) ^2 / 2000)
  436. End Function
  437.  
  438. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  439. Dim tmp
  440. tmp = ball.x * 2 / TableWidth-1
  441. If tmp> 0 Then
  442. Pan = Csng(tmp ^10)
  443. Else
  444. Pan = Csng(-((- tmp) ^10))
  445. End If
  446. End Function
  447.  
  448. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  449. Pitch = BallVel(ball) * 20
  450. End Function
  451.  
  452. Function BallVel(ball) 'Calculates the ball speed
  453. BallVel = (SQR((ball.VelX ^2) + (ball.VelY ^2)))
  454. End Function
  455.  
  456. Function AudioFade(ball) 'only on VPX 10.4 and newer
  457. Dim tmp
  458. tmp = ball.y * 2 / TableHeight-1
  459. If tmp> 0 Then
  460. AudioFade = Csng(tmp ^10)
  461. Else
  462. AudioFade = Csng(-((- tmp) ^10))
  463. End If
  464. End Function
  465.  
  466. Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
  467. PlaySound soundname, 0, 1, Pan(tableobj), 0.1, 0, 0, 0, AudioFade(tableobj)
  468. End Sub
  469.  
  470. Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets, metals, plastics
  471. PlaySound soundname, 0, Vol(ActiveBall), pan(ActiveBall), 0.4, 0, 0, 0, AudioFade(ActiveBall)
  472. End Sub
  473.  
  474. '***********************************************
  475. ' JP's VP10 Rolling Sounds + Ballshadow v3.0
  476. ' uses a collection of shadows, aBallShadow
  477. '***********************************************
  478.  
  479. Const tnob = 19 'total number of balls, 20 balls, from 0 to 19
  480. Const lob = 0 'number of locked balls
  481. Const maxvel = 28 'max ball velocity
  482. ReDim rolling(tnob)
  483. InitRolling
  484.  
  485. Sub InitRolling
  486. Dim i
  487. For i = 0 to tnob
  488. rolling(i) = False
  489. Next
  490. End Sub
  491.  
  492. Sub RollingUpdate()
  493. Dim BOT, b, ballpitch, ballvol, speedfactorx, speedfactory
  494. BOT = GetBalls
  495.  
  496. ' stop the sound of deleted balls and hide the shadow
  497. For b = UBound(BOT) + 1 to tnob
  498. rolling(b) = False
  499. StopSound("fx_ballrolling" & b)
  500. aBallShadow(b).Y = 3000 'simply hide the shadow out of the table
  501. Next
  502.  
  503. ' exit the sub if no balls on the table
  504. If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table
  505.  
  506. ' play the rolling sound for each ball and draw the shadow
  507. For b = lob to UBound(BOT)
  508. aBallShadow(b).X = BOT(b).X
  509. aBallShadow(b).Y = BOT(b).Y
  510.  
  511. If BallVel(BOT(b))> 1 Then
  512. If BOT(b).z <30 Then
  513. ballpitch = Pitch(BOT(b))
  514. ballvol = Vol(BOT(b))
  515. Else
  516. ballpitch = Pitch(BOT(b)) + 25000 'increase the pitch on a ramp
  517. ballvol = Vol(BOT(b)) * 10
  518. End If
  519. rolling(b) = True
  520. PlaySound("fx_ballrolling" & b), -1, ballvol, Pan(BOT(b)), 0, ballpitch, 1, 0, AudioFade(BOT(b))
  521. Else
  522. If rolling(b) = True Then
  523. StopSound("fx_ballrolling" & b)
  524. rolling(b) = False
  525. End If
  526. End If
  527.  
  528. ' rothbauerw's Dropping Sounds
  529. If BOT(b).VelZ <-1 and BOT(b).z <55 and BOT(b).z> 27 Then 'height adjust for ball drop sounds
  530. PlaySound "fx_balldrop", 0, ABS(BOT(b).velz) / 17, Pan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  531. End If
  532.  
  533. ' jps ball speed control
  534. If BOT(b).VelX AND BOT(b).VelY <> 0 Then
  535. speedfactorx = ABS(maxvel / BOT(b).VelX)
  536. speedfactory = ABS(maxvel / BOT(b).VelY)
  537. If speedfactorx <1 Then
  538. BOT(b).VelX = BOT(b).VelX * speedfactorx
  539. BOT(b).VelY = BOT(b).VelY * speedfactorx
  540. End If
  541. If speedfactory <1 Then
  542. BOT(b).VelX = BOT(b).VelX * speedfactory
  543. BOT(b).VelY = BOT(b).VelY * speedfactory
  544. End If
  545. End If
  546. Next
  547. End Sub
  548.  
  549. '**********************
  550. ' Ball Collision Sound
  551. '**********************
  552.  
  553. Sub OnBallBallCollision(ball1, ball2, velocity)
  554. PlaySound "fx_collide", 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  555. End Sub
  556.  
  557. '************************************
  558. ' Diverse Collection Hit Sounds v3.0
  559. '************************************
  560.  
  561. Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
  562. Sub aMetalWires_Hit(idx):PlaySoundAtBall "fx_MetalWire":End Sub
  563. Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
  564. Sub aRubber_LongBands_Hit(idx):PlaySoundAtBall "fx_rubber_longband":End Sub
  565. Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
  566. Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
  567. Sub aRubber_Pegs_Hit(idx):PlaySoundAtBall "fx_rubber_peg":End Sub
  568. Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
  569. Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
  570. Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub
  571. ' Sub aTargets_Hit(idx):ActiveBall.VelZ = BallVel(Activeball) * (RND / 2):End Sub 'not quite sure if I want the ball to bounce when hitting the targets
  572.  
  573. '************************************************************************************************************************
  574. ' Only for VPX 10.2 and higher.
  575. ' FlashForMs will blink light or a flasher for TotalPeriod(ms) at rate of BlinkPeriod(ms)
  576. ' When TotalPeriod done, light or flasher will be set to FinalState value where
  577. ' Final State values are: 0=Off, 1=On, 2=Return to previous State
  578. '************************************************************************************************************************
  579.  
  580. Sub FlashForMs(MyLight, TotalPeriod, BlinkPeriod, FinalState)
  581.  
  582. If TypeName(MyLight) = "Light" Then
  583. If FinalState = 2 Then
  584. FinalState = MyLight.State
  585. End If
  586. MyLight.BlinkInterval = BlinkPeriod
  587. MyLight.Duration 2, TotalPeriod, FinalState
  588. ElseIf TypeName(MyLight) = "Flasher" Then
  589. Dim steps
  590. steps = Int(TotalPeriod / BlinkPeriod + .5)
  591. If FinalState = 2 Then
  592. FinalState = ABS(MyLight.Visible)
  593. End If
  594. MyLight.UserValue = steps * 10 + FinalState
  595. MyLight.TimerInterval = BlinkPeriod
  596. MyLight.TimerEnabled = 0
  597. MyLight.TimerEnabled = 1
  598. 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"
  599. End If
  600. End Sub
  601.  
  602. '****************************************
  603. ' Init table for a new game
  604. '****************************************
  605.  
  606. Sub ResetForNewGame()
  607. 'debug.print "ResetForNewGame"
  608. Dim i
  609.  
  610. bGameInPLay = True
  611. bBallSaverActive = False
  612.  
  613. StopAttractMode
  614. If B2SOn then
  615. Controller.B2SSetGameOver 0
  616. end if
  617.  
  618. GiOn
  619.  
  620. CurrentPlayer = 1
  621. PlayersPlayingGame = 1
  622. bOnTheFirstBall = True
  623. For i = 1 To MaxPlayers
  624. Score(i) = 0
  625. ExtraBallsAwards(i) = 0
  626. Special1Awarded(i) = False
  627. Special2Awarded(i) = False
  628. Special3Awarded(i) = False
  629. BallsRemaining(i) = BallsPerGame
  630. Next
  631. BonusMultiplier = 1
  632. Bonus = 0
  633. UpdateBallInPlay
  634.  
  635. Clear_Match
  636.  
  637. ' init other variables
  638. Tilt = 0
  639.  
  640. ' init game variables
  641. Game_Init()
  642.  
  643. ' start a music?
  644. ' first ball
  645. vpmtimer.addtimer 2000, "FirstBall '"
  646. End Sub
  647.  
  648. Sub FirstBall
  649. 'debug.print "FirstBall"
  650. ' reset table for a new ball, rise droptargets ++
  651. ResetForNewPlayerBall()
  652. CreateNewBall()
  653. End Sub
  654.  
  655. ' (Re-)init table for a new ball or player
  656.  
  657. Sub ResetForNewPlayerBall()
  658. 'debug.print "ResetForNewPlayerBall"
  659. AddScore 0
  660.  
  661. ' reset multiplier to 1x
  662.  
  663. ' turn on lights, and variables
  664. bExtraBallWonThisBall = False
  665. ResetNewBallVariables
  666. End Sub
  667.  
  668. ' Crete new ball
  669.  
  670. Sub CreateNewBall()
  671. BallRelease.CreateSizedBallWithMass BallSize / 2, BallMass
  672. BallsOnPlayfield = BallsOnPlayfield + 1
  673. UpdateBallInPlay
  674. PlaySoundAt SoundFXDOF("fx_Ballrel", 123, DOFPulse, DOFcontactors), BallRelease
  675. BallRelease.Kick 90, 4
  676. End Sub
  677.  
  678. ' player lost the ball
  679.  
  680. Sub EndOfBall()
  681. 'debug.print "EndOfBall"
  682. Dim AwardPoints, TotalBonus, ii
  683. AwardPoints = 0
  684. TotalBonus = 0
  685. ' Lost the first ball, now it cannot accept more players
  686. bOnTheFirstBall = False
  687.  
  688. ' add bonus if no tilt
  689. ' tilt system will take care of the next ball
  690.  
  691. If NOT Tilted Then
  692. BonusCountTimer.Interval = 150 + 50 * BonusMultiplier
  693. BonusCountTimer.Enabled = 1
  694. Else
  695. vpmtimer.addtimer 400, "EndOfBall2 '"
  696. End If
  697. End Sub
  698.  
  699. Sub BonusCountTimer_Timer
  700. 'debug.print "BonusCount_Timer"
  701. If Bonus> 0 Then
  702. If Bonus> 10 Then
  703. Bonus = Bonus -10
  704. AddScore 10000 * BonusMultiplier
  705. UpdateBonusLights
  706. Else
  707. Bonus = Bonus -1
  708. AddScore 1000 * BonusMultiplier
  709. UpdateBonusLights
  710. End If
  711. Else
  712. BonusCountTimer.Enabled = 0
  713. vpmtimer.addtimer 1000, "EndOfBall2 '"
  714. End If
  715. End Sub
  716.  
  717. Sub UpdateBonusLights
  718. Select case Bonus MOD 10
  719. Case 0:t1.State = 1:t2.State = 0:t3.State = 0:t4.State = 0:t5.State = 0:t6.State = 0:t7.State = 0:t8.State = 0:t9.State = 0:t10.State = 0
  720. Case 1:t1.State = 0:t2.State = 1:t3.State = 0:t4.State = 0:t5.State = 0:t6.State = 0:t7.State = 0:t8.State = 0:t9.State = 0:t10.State = 0
  721. Case 2:t1.State = 0:t2.State = 0:t3.State = 1:t4.State = 0:t5.State = 0:t6.State = 0:t7.State = 0:t8.State = 0:t9.State = 0:t10.State = 0
  722. Case 3:t1.State = 0:t2.State = 0:t3.State = 0:t4.State = 1:t5.State = 0:t6.State = 0:t7.State = 0:t8.State = 0:t9.State = 0:t10.State = 0
  723. Case 4:t1.State = 0:t2.State = 0:t3.State = 0:t4.State = 0:t5.State = 1:t6.State = 0:t7.State = 0:t8.State = 0:t9.State = 0:t10.State = 0
  724. Case 5:t1.State = 0:t2.State = 0:t3.State = 0:t4.State = 0:t5.State = 0:t6.State = 1:t7.State = 0:t8.State = 0:t9.State = 0:t10.State = 0
  725. Case 6:t1.State = 0:t2.State = 0:t3.State = 0:t4.State = 0:t5.State = 0:t6.State = 0:t7.State = 1:t8.State = 0:t9.State = 0:t10.State = 0
  726. Case 7:t1.State = 0:t2.State = 0:t3.State = 0:t4.State = 0:t5.State = 0:t6.State = 0:t7.State = 0:t8.State = 1:t9.State = 0:t10.State = 0
  727. Case 8:t1.State = 0:t2.State = 0:t3.State = 0:t4.State = 0:t5.State = 0:t6.State = 0:t7.State = 0:t8.State = 0:t9.State = 1:t10.State = 0
  728. Case 9:t1.State = 0:t2.State = 0:t3.State = 0:t4.State = 0:t5.State = 0:t6.State = 0:t7.State = 0:t8.State = 0:t9.State = 0:t10.State = 1
  729. End Select
  730. Select Case Bonus \ 10
  731. Case 0:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 0
  732. Case 1:bl1.State = 1:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 0
  733. Case 2:bl1.State = 0:bl2.State = 1:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 0
  734. Case 3:bl1.State = 0:bl2.State = 0:bl3.State = 1:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 0
  735. Case 4:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 1:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 0
  736. Case 5:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 1:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 0
  737. Case 6:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 1:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 0
  738. Case 7:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 1:bl8.State = 0:bl9.State = 0:bl10.State = 0
  739. Case 8:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 1:bl9.State = 0:bl10.State = 0
  740. Case 9:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 1:bl10.State = 0
  741. Case 10:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 1
  742. Case 11:bl1.State = 1:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 1
  743. Case 12:bl1.State = 0:bl2.State = 1:bl3.State = 0:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 1
  744. Case 13:bl1.State = 0:bl2.State = 0:bl3.State = 1:bl4.State = 0:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 1
  745. Case 14:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 1:bl5.State = 0:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 1
  746. Case 15:bl1.State = 0:bl2.State = 0:bl3.State = 0:bl4.State = 0:bl5.State = 1:bl6.State = 0:bl7.State = 0:bl8.State = 0:bl9.State = 0:bl10.State = 1
  747. End Select
  748. End Sub
  749.  
  750. ' After bonus count go to the next step
  751. '
  752. Sub EndOfBall2()
  753. 'debug.print "EndOfBall2"
  754.  
  755. Tilted = False
  756. Tilt = 0
  757. TiltL.State = 0
  758. If B2SOn then
  759. Controller.B2SSetTilt 0
  760. end if
  761. DisableTable False
  762.  
  763. ' win extra ball?
  764. If(ExtraBallsAwards(CurrentPlayer)> 0)Then
  765. 'debug.print "Extra Ball"
  766.  
  767. ' if so then give it
  768. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer)- 1
  769.  
  770. ' turn off light if no more extra balls
  771. If(ExtraBallsAwards(CurrentPlayer) = 0)Then
  772. 'LightShootAgain.State = 0
  773. 'If B2SOn then
  774. 'Controller.B2SSetShootAgain 0
  775. 'end if
  776. End If
  777.  
  778. ' extra ball sound?
  779.  
  780. ' reset as in a new ball
  781. ResetForNewPlayerBall()
  782. CreateNewBall()
  783. Else ' no extra ball
  784.  
  785. BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer)- 1
  786.  
  787. ' last ball?
  788. If(BallsRemaining(CurrentPlayer) <= 0)Then
  789. CheckHighScore()
  790. End If
  791.  
  792. ' this is not the last ball, chack for new player
  793. EndOfBallComplete()
  794. End If
  795. End Sub
  796.  
  797. Sub EndOfBallComplete()
  798. 'debug.print "EndOfBallComplete"
  799. Dim NextPlayer
  800.  
  801. ' other players?
  802. If(PlayersPlayingGame> 1)Then
  803. NextPlayer = CurrentPlayer + 1
  804. ' if it is the last player then go to the first one
  805. If(NextPlayer> PlayersPlayingGame)Then
  806. NextPlayer = 1
  807. End If
  808. Else
  809. NextPlayer = CurrentPlayer
  810. End If
  811.  
  812. 'debug.print "Next Player = " & NextPlayer
  813.  
  814. ' end of game?
  815. If((BallsRemaining(CurrentPlayer) <= 0)AND(BallsRemaining(NextPlayer) <= 0))Then
  816.  
  817. ' match if playing with coins
  818. If bFreePlay = False Then
  819. Verification_Match
  820. End If
  821.  
  822. ' end of game
  823. EndOfGame()
  824. Else
  825. ' next player
  826. CurrentPlayer = NextPlayer
  827.  
  828. ' update score
  829. AddScore 0
  830.  
  831. ' reset table for new player
  832. ResetForNewPlayerBall()
  833. CreateNewBall()
  834. End If
  835. End Sub
  836.  
  837. ' Called at the end of the game
  838.  
  839. Sub EndOfGame()
  840. 'debug.print "EndOfGame"
  841. bGameInPLay = False
  842. bJustStarted = False
  843. If B2SOn then
  844. Controller.B2SSetGameOver 1
  845. Controller.B2SSetBallInPlay 0
  846. Controller.B2SSetPlayerUp 0
  847. Controller.B2SSetCanPlay 0
  848. end if
  849. ' turn off flippers
  850. SolLFlipper 0
  851. SolRFlipper 0
  852.  
  853. ' start the attract mode
  854. StartAttractMode
  855. End Sub
  856.  
  857. ' Fuction to calculate the balls left
  858. Function Balls
  859. Dim tmp
  860. tmp = BallsPerGame - BallsRemaining(CurrentPlayer) + 1
  861. If tmp> BallsPerGame Then
  862. Balls = BallsPerGame
  863. Else
  864. Balls = tmp
  865. End If
  866. End Function
  867.  
  868. ' check the highscore
  869. Sub CheckHighscore
  870. Dim playertops, si, sj, i, stemp, stempplayers
  871. For i = 1 to 4
  872. sortscores(i) = 0
  873. sortplayers(i) = 0
  874. Next
  875. playertops = 0
  876. For i = 1 to PlayersPlayingGame
  877. sortscores(i) = Score(i)
  878. sortplayers(i) = i
  879. Next
  880. For si = 1 to PlayersPlayingGame
  881. For sj = 1 to PlayersPlayingGame-1
  882. If sortscores(sj)> sortscores(sj + 1)then
  883. stemp = sortscores(sj + 1)
  884. stempplayers = sortplayers(sj + 1)
  885. sortscores(sj + 1) = sortscores(sj)
  886. sortplayers(sj + 1) = sortplayers(sj)
  887. sortscores(sj) = stemp
  888. sortplayers(sj) = stempplayers
  889. End If
  890. Next
  891. Next
  892. HighScoreTimer.interval = 100
  893. HighScoreTimer.enabled = True
  894. ScoreChecker = 4
  895. CheckAllScores = 1
  896. NewHighScore sortscores(ScoreChecker), sortplayers(ScoreChecker)
  897. End Sub
  898.  
  899. '******************
  900. ' Match
  901. '******************
  902.  
  903. Sub Verification_Match()
  904. PlaySound "fx_match"
  905. Match = INT(RND(1)*10) ' random between 0 and 9
  906. 'debug.print Match
  907. Display_Match
  908. If(Score(CurrentPlayer)MOD 1000) = Match * 100 Then
  909. PlaySound SoundFXDOF("fx_knocker", 122, DOFPulse, DOFknocker)
  910. AddCredits 1
  911. End If
  912. End Sub
  913.  
  914. Sub Clear_Match()
  915. Match = 0
  916. Update_Match
  917. m0.State = 0:m020.state = 0:m021.state = 0 'turn off the 0 Lights
  918. If B2SOn then
  919. Controller.B2SSetMatch Match
  920. end if
  921. End Sub
  922.  
  923. Sub Display_Match()
  924. Update_Match
  925. If B2SOn then
  926. If Match = 0 then
  927. Controller.B2SSetMatch 100
  928. else
  929. Controller.B2SSetMatch Match*10
  930. end if
  931. end if
  932. End Sub
  933.  
  934. Sub Update_Match
  935. Select Case Match
  936. Case 0
  937. m0.State = 1:m020.state = 1:m021.state = 1
  938. m1.State = 0:m001.state = 0:m011.state = 0
  939. m2.State = 0:m002.state = 0:m012.state = 0
  940. m3.State = 0:m003.state = 0:m013.state = 0
  941. m4.State = 0:m004.state = 0:m014.state = 0
  942. m5.State = 0:m005.state = 0:m015.state = 0
  943. m6.State = 0:m006.state = 0:m016.state = 0
  944. m7.State = 0:m007.state = 0:m017.state = 0
  945. m8.State = 0:m008.state = 0:m018.state = 0
  946. m9.State = 0:m009.state = 0:m010.state = 0
  947. Case 1
  948. m0.State = 0:m020.state = 0:m021.state = 0
  949. m1.State = 1:m001.state = 1:m011.state = 1
  950. m2.State = 0:m002.state = 0:m012.state = 0
  951. m3.State = 0:m003.state = 0:m013.state = 0
  952. m4.State = 0:m004.state = 0:m014.state = 0
  953. m5.State = 0:m005.state = 0:m015.state = 0
  954. m6.State = 0:m006.state = 0:m016.state = 0
  955. m7.State = 0:m007.state = 0:m017.state = 0
  956. m8.State = 0:m008.state = 0:m018.state = 0
  957. m9.State = 0:m009.state = 0:m010.state = 0
  958. Case 2
  959. m0.State = 0:m020.state = 0:m021.state = 0
  960. m1.State = 0:m001.state = 0:m011.state = 0
  961. m2.State = 1:m002.state = 1:m012.state = 1
  962. m3.State = 0:m003.state = 0:m013.state = 0
  963. m4.State = 0:m004.state = 0:m014.state = 0
  964. m5.State = 0:m005.state = 0:m015.state = 0
  965. m6.State = 0:m006.state = 0:m016.state = 0
  966. m7.State = 0:m007.state = 0:m017.state = 0
  967. m8.State = 0:m008.state = 0:m018.state = 0
  968. m9.State = 0:m009.state = 0:m010.state = 0
  969. Case 3
  970. m0.State = 0:m020.state = 0:m021.state = 0
  971. m1.State = 0:m001.state = 0:m011.state = 0
  972. m2.State = 0:m002.state = 0:m012.state = 0
  973. m3.State = 1:m003.state = 1:m013.state = 1
  974. m4.State = 0:m004.state = 0:m014.state = 0
  975. m5.State = 0:m005.state = 0:m015.state = 0
  976. m6.State = 0:m006.state = 0:m016.state = 0
  977. m7.State = 0:m007.state = 0:m017.state = 0
  978. m8.State = 0:m008.state = 0:m018.state = 0
  979. m9.State = 0:m009.state = 0:m010.state = 0
  980. Case 4
  981. m0.State = 0:m020.state = 0:m021.state = 0
  982. m1.State = 0:m001.state = 0:m011.state = 0
  983. m2.State = 0:m002.state = 0:m012.state = 0
  984. m3.State = 0:m003.state = 0:m013.state = 0
  985. m4.State = 1:m004.state = 1:m014.state = 1
  986. m5.State = 0:m005.state = 0:m015.state = 0
  987. m6.State = 0:m006.state = 0:m016.state = 0
  988. m7.State = 0:m007.state = 0:m017.state = 0
  989. m8.State = 0:m008.state = 0:m018.state = 0
  990. m9.State = 0:m009.state = 0:m010.state = 0
  991. Case 5
  992. m0.State = 0:m020.state = 0:m021.state = 0
  993. m1.State = 0:m001.state = 0:m011.state = 0
  994. m2.State = 0:m002.state = 0:m012.state = 0
  995. m3.State = 0:m003.state = 0:m013.state = 0
  996. m4.State = 0:m004.state = 0:m014.state = 0
  997. m5.State = 1:m005.state = 1:m015.state = 1
  998. m6.State = 0:m006.state = 0:m016.state = 0
  999. m7.State = 0:m007.state = 0:m017.state = 0
  1000. m8.State = 0:m008.state = 0:m018.state = 0
  1001. m9.State = 0:m009.state = 0:m010.state = 0
  1002. Case 6
  1003. m0.State = 0:m020.state = 0:m021.state = 0
  1004. m1.State = 0:m001.state = 0:m011.state = 0
  1005. m2.State = 0:m002.state = 0:m012.state = 0
  1006. m3.State = 0:m003.state = 0:m013.state = 0
  1007. m4.State = 0:m004.state = 0:m014.state = 0
  1008. m5.State = 0:m005.state = 0:m015.state = 0
  1009. m6.State = 1:m006.state = 1:m016.state = 1
  1010. m7.State = 0:m007.state = 0:m017.state = 0
  1011. m8.State = 0:m008.state = 0:m018.state = 0
  1012. m9.State = 0:m009.state = 0:m010.state = 0
  1013. Case 7
  1014. m0.State = 0:m020.state = 0:m021.state = 0
  1015. m1.State = 0:m001.state = 0:m011.state = 0
  1016. m2.State = 0:m002.state = 0:m012.state = 0
  1017. m3.State = 0:m003.state = 0:m013.state = 0
  1018. m4.State = 0:m004.state = 0:m014.state = 0
  1019. m5.State = 0:m005.state = 0:m015.state = 0
  1020. m6.State = 0:m006.state = 0:m016.state = 0
  1021. m7.State = 1:m007.state = 1:m017.state = 1
  1022. m8.State = 0:m008.state = 0:m018.state = 0
  1023. m9.State = 0:m009.state = 0:m010.state = 0
  1024. Case 8
  1025. m0.State = 0:m020.state = 0:m021.state = 0
  1026. m1.State = 0:m001.state = 0:m011.state = 0
  1027. m2.State = 0:m002.state = 0:m012.state = 0
  1028. m3.State = 0:m003.state = 0:m013.state = 0
  1029. m4.State = 0:m004.state = 0:m014.state = 0
  1030. m5.State = 0:m005.state = 0:m015.state = 0
  1031. m6.State = 0:m006.state = 0:m016.state = 0
  1032. m7.State = 0:m007.state = 0:m017.state = 0
  1033. m8.State = 1:m008.state = 1:m018.state = 1
  1034. m9.State = 0:m009.state = 0:m010.state = 0
  1035. Case 9
  1036. m0.State = 0:m020.state = 0:m021.state = 0
  1037. m1.State = 0:m001.state = 0:m011.state = 0
  1038. m2.State = 0:m002.state = 0:m012.state = 0
  1039. m3.State = 0:m003.state = 0:m013.state = 0
  1040. m4.State = 0:m004.state = 0:m014.state = 0
  1041. m5.State = 0:m005.state = 0:m015.state = 0
  1042. m6.State = 0:m006.state = 0:m016.state = 0
  1043. m7.State = 0:m007.state = 0:m017.state = 0
  1044. m8.State = 0:m008.state = 0:m018.state = 0
  1045. m9.State = 1:m009.state = 1:m010.state = 1
  1046. End Select
  1047. End Sub
  1048.  
  1049. ' *********************************************************************
  1050. ' Drain / Plunger Functions
  1051. ' *********************************************************************
  1052.  
  1053. Sub Drain_Hit()
  1054. Drain.DestroyBall
  1055. BallsOnPlayfield = BallsOnPlayfield - 1
  1056. PlaySoundAt "fx_drain", Drain
  1057.  
  1058. 'tilted?
  1059. If Tilted Then
  1060. StopEndOfBallMode
  1061. End If
  1062.  
  1063. ' if still playing and not tilted
  1064. If(bGameInPLay = True)AND(Tilted = False)Then
  1065.  
  1066. ' ballsaver?
  1067. If(bBallSaverActive = True)Then
  1068. CreateNewBall()
  1069. Else
  1070. ' last ball?
  1071. If(BallsOnPlayfield = 0)Then
  1072. StopEndOfBallMode
  1073. vpmtimer.addtimer 500, "EndOfBall '"
  1074. Exit Sub
  1075. End If
  1076. End If
  1077. End If
  1078. End Sub
  1079.  
  1080. Sub swPlungerRest_Hit()
  1081. bBallInPlungerLane = True
  1082. End Sub
  1083.  
  1084. Sub swPlungerRest_UnHit()
  1085. bBallInPlungerLane = False
  1086. End Sub
  1087.  
  1088. ' ****************************************
  1089. ' Score functions
  1090. ' ****************************************
  1091.  
  1092. Sub AddScore(Points)
  1093. If Tilted Then Exit Sub
  1094. Select Case Points
  1095. Case 100, 1000, 10000
  1096. Score(CurrentPlayer) = Score(CurrentPlayer) + points
  1097. UpdateScore points
  1098. ' sounds
  1099. If Points = 1000 AND(Score(CurrentPlayer)MOD 10000) \ 1000 = 0 Then 'new reel 10000
  1100. PlaySound SoundFXDOF("chime_10000", 143, DOFPulse, DOFChimes)
  1101. ' PlaySound "chime_10000"
  1102. ElseIf Points = 100 AND(Score(CurrentPlayer)MOD 1000) \ 100 = 0 Then 'new reel 1000
  1103. PlaySound SoundFXDOF("chime_1000", 142, DOFPulse, DOFChimes)
  1104. ' PlaySound "chime_1000"
  1105. Else
  1106. PlaySound SoundFXDOF("chime_", 141, DOFPulse, DOFChimes)
  1107. ' PlaySound "chime_" &Points
  1108. End If
  1109. Case 200, 300, 400, 500
  1110. Add100 = Add100 + Points \ 100
  1111. AddScore100Timer.Enabled = TRUE
  1112. Case 2000, 3000, 4000, 5000
  1113. Add1000 = Add1000 + Points \ 1000
  1114. AddScore1000Timer.Enabled = TRUE
  1115. Case 20000, 30000, 40000, 50000
  1116. Add10000 = Add10000 + Points \ 10000
  1117. AddScore10000Timer.Enabled = TRUE
  1118. End Select
  1119.  
  1120. ' check for higher score and specials
  1121. If Score(CurrentPlayer) >= Special1 AND Special1Awarded(CurrentPlayer) = False Then
  1122. AwardSpecial
  1123. Special1Awarded(CurrentPlayer) = True
  1124. End If
  1125. If Score(CurrentPlayer) >= Special2 AND Special2Awarded(CurrentPlayer) = False Then
  1126. AwardSpecial
  1127. Special2Awarded(CurrentPlayer) = True
  1128. End If
  1129. If Score(CurrentPlayer) >= Special3 AND Special3Awarded(CurrentPlayer) = False Then
  1130. AwardSpecial
  1131. Special3Awarded(CurrentPlayer) = True
  1132. End If
  1133. End Sub
  1134.  
  1135. '************************************
  1136. ' Score sound Timers
  1137. '************************************
  1138.  
  1139. Sub AddScore10000Timer_Timer()
  1140. if Add10000> 0 then
  1141. AddScore 10000
  1142. Add10000 = Add10000 - 1
  1143. Else
  1144. Me.Enabled = FALSE
  1145. End If
  1146. End Sub
  1147.  
  1148. Sub AddScore100Timer_Timer()
  1149. if Add100> 0 then
  1150. AddScore 100
  1151. Add100 = Add100 - 1
  1152. Else
  1153. Me.Enabled = FALSE
  1154. End If
  1155. End Sub
  1156.  
  1157. Sub AddScore1000Timer_Timer()
  1158. if Add1000> 0 then
  1159. AddScore 1000
  1160. Add1000 = Add1000 - 1
  1161. Else
  1162. Me.Enabled = FALSE
  1163. End If
  1164. End Sub
  1165.  
  1166. '*******************
  1167. ' BONUS
  1168. '*******************
  1169.  
  1170. Sub AddBonus(bonuspoints)
  1171. If(Tilted = False)Then
  1172. Bonus = Bonus + bonuspoints
  1173. If Bonus> 150 Then
  1174. Bonus = 150
  1175. End If
  1176. UpdateBonusLights
  1177. ' this table only
  1178. Check123
  1179. End if
  1180. End Sub
  1181.  
  1182. Sub AddBonusMultiplier(multi)
  1183. If(Tilted = False)Then
  1184. BonusMultiplier = BonusMultiplier + multi
  1185. If BonusMultiplier> MaxMultiplier Then
  1186. BonusMultiplier = MaxMultiplier
  1187. End If
  1188. UpdateMultiplierLights
  1189. End if
  1190. End Sub
  1191.  
  1192. Sub UpdateMultiplierLights
  1193. Select Case BonusMultiplier
  1194. 'Case 1:li2.State = 1:li3.State = 0:li4.State = 0
  1195. 'Case 2:li2.State = 0:li3.State = 1:li4.State = 0
  1196. 'Case 3:li2.State = 0:li3.State = 0:li4.State = 1
  1197. End Select
  1198. End Sub
  1199.  
  1200. '**********************************
  1201. ' Score EM reels
  1202. '**********************************
  1203.  
  1204. Sub UpdateScore(playerpoints)
  1205. Select Case CurrentPlayer
  1206. Case 1:ScoreReel1.Addvalue playerpoints
  1207. Case 2:ScoreReel2.Addvalue playerpoints
  1208. Case 3:ScoreReel3.Addvalue playerpoints
  1209. Case 4:ScoreReel4.Addvalue playerpoints
  1210. End Select
  1211. If B2SOn then
  1212. Controller.B2SSetScorePlayer CurrentPlayer, Score(CurrentPlayer)
  1213. end if
  1214. End Sub
  1215.  
  1216. Sub ResetScores
  1217. ScoreReel1.SetValue 1:ScoreReel1.ResetToZero
  1218. ScoreReel2.ResetToZero
  1219. ScoreReel3.ResetToZero
  1220. ScoreReel4.ResetToZero
  1221. If B2SOn then
  1222. Controller.B2SSetScorePlayer1 0
  1223. Controller.B2SSetScoreRolloverPlayer1 0
  1224. Controller.B2SSetScorePlayer2 0
  1225. Controller.B2SSetScoreRolloverPlayer2 0
  1226. Controller.B2SSetScorePlayer3 0
  1227. Controller.B2SSetScoreRolloverPlayer3 0
  1228. Controller.B2SSetScorePlayer4 0
  1229. Controller.B2SSetScoreRolloverPlayer4 0
  1230. end if
  1231. End Sub
  1232.  
  1233. Sub AddCredits(value) 'limit to 15 credits
  1234. If Credits <9 Then
  1235. Credits = Credits + value
  1236. CreditsReel.SetValue Credits
  1237. UpdateCredits
  1238. end if
  1239. End Sub
  1240.  
  1241. Sub UpdateCredits
  1242. PlaySound "fx_relay"
  1243. CreditsReel.SetValue credits
  1244. If B2SOn then
  1245. Controller.B2SSetCredits Credits
  1246. end if
  1247. End Sub
  1248.  
  1249. Sub UpdateBallInPlay 'actually updates all backdrop lights
  1250. 'Ball in play
  1251. Select Case Balls
  1252. Case 0:bip1.State = 0:bip2.State = 0:bip3.State = 0:bip4.State = 0:bip5.State = 0
  1253. Case 1:bip1.State = 1:bip2.State = 0:bip3.State = 0:bip4.State = 0:bip5.State = 0
  1254. Case 2:bip1.State = 0:bip2.State = 1:bip3.State = 0:bip4.State = 0:bip5.State = 0
  1255. Case 3:bip1.State = 0:bip2.State = 0:bip3.State = 1:bip4.State = 0:bip5.State = 0
  1256. Case 4:bip1.State = 0:bip2.State = 0:bip3.State = 0:bip4.State = 1:bip5.State = 0
  1257. Case 5:bip1.State = 0:bip2.State = 0:bip3.State = 0:bip4.State = 0:bip5.State = 1
  1258. End Select
  1259. If B2SOn then
  1260. Controller.B2SSetBallInPlay Balls
  1261. End If
  1262. ' Update player light
  1263. Select Case CurrentPlayer
  1264. Case 0:pl1.State = 0:pl2.State = 0:pl3.State = 0:pl4.State = 0
  1265. Case 1:pl1.State = 1:pl2.State = 0:pl3.State = 0:pl4.State = 0
  1266. Case 2:pl1.State = 0:pl2.State = 1:pl3.State = 0:pl4.State = 0
  1267. Case 3:pl1.State = 0:pl2.State = 0:pl3.State = 1:pl4.State = 0
  1268. Case 4:pl1.State = 0:pl2.State = 0:pl3.State = 0:pl4.State = 1
  1269. End Select
  1270. If B2SOn then
  1271. Controller.B2SSetPlayerUp CurrentPlayer
  1272. End If
  1273. ' Player can play
  1274. Select Case PlayersPlayingGame
  1275. Case 0:cp1.State = 0:cp2.State = 0:cp3.State = 0:cp4.State = 0
  1276. Case 1:cp1.State = 1:cp2.State = 0:cp3.State = 0:cp4.State = 0
  1277. Case 2:cp1.State = 0:cp2.State = 1:cp3.State = 0:cp4.State = 0
  1278. Case 3:cp1.State = 0:cp2.State = 0:cp3.State = 1:cp4.State = 0
  1279. Case 4:cp1.State = 0:cp2.State = 0:cp3.State = 0:cp4.State = 1
  1280. End Select
  1281. If B2SOn then
  1282. Controller.B2SSetCanPlay PlayersPlayingGame
  1283. end if
  1284. End Sub
  1285.  
  1286. '*************************
  1287. ' Specials
  1288. '*************************
  1289.  
  1290. Sub AwardExtraBall()
  1291. If NOT bExtraBallWonThisBall Then
  1292. PlaySound SoundFXDOF("fx_knocker", 122, DOFPulse, DOFknocker)
  1293. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) + 1
  1294. bExtraBallWonThisBall = True
  1295. light004.State = 1
  1296. Else
  1297. 'Addscore 5000
  1298. END If
  1299. End Sub
  1300.  
  1301. Sub AwardSpecial()
  1302. PlaySound SoundFXDOF("fx_knocker", 122, DOFPulse, DOFknocker)
  1303. AddCredits 1
  1304. End Sub
  1305.  
  1306. Sub AwardAddaBall()
  1307. If BallsRemaining(CurrentPlayer) <11 Then
  1308. PlaySound SoundFXDOF("fx_knocker", 122, DOFPulse, DOFknocker)
  1309. BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer) + 1
  1310. UpdateBallInPlay
  1311. End If
  1312. End Sub
  1313.  
  1314. ' ********************************
  1315. ' Attract Mode
  1316. ' ********************************
  1317. ' use the"Blink Pattern" of each light
  1318.  
  1319. Sub StartAttractMode()
  1320. Dim x
  1321. bAttractMode = True
  1322. For each x in aLights
  1323. x.State = 2
  1324. Next
  1325. GameOverL.State = 1
  1326. 'update current player and balls
  1327. End Sub
  1328.  
  1329. Sub StopAttractMode()
  1330. Dim x
  1331. bAttractMode = False
  1332. TurnOffPlayfieldLights
  1333. ResetScores
  1334. GameOverL.State = 0
  1335. End Sub
  1336.  
  1337. '*********************************
  1338. ' Load / Save / Highscore
  1339. '*********************************
  1340.  
  1341. Sub Loadhs
  1342. ' Based on Black's Highscore routines
  1343. Dim FileObj
  1344. Dim ScoreFile, TextStr
  1345. Dim temp1
  1346. Dim temp2
  1347. Dim temp3
  1348. Dim temp4
  1349. Dim temp5
  1350. Dim temp6
  1351. Dim temp8
  1352. Dim temp9
  1353. Dim temp10
  1354. Dim temp11
  1355. Dim temp12
  1356. Dim temp13
  1357. Dim temp14
  1358. Dim temp15
  1359. Dim temp16
  1360. Dim temp17
  1361.  
  1362. Set FileObj = CreateObject("Scripting.FileSystemObject")
  1363. If Not FileObj.FolderExists(UserDirectory)then
  1364. Credits = 0
  1365. Exit Sub
  1366. End If
  1367. If Not FileObj.FileExists(UserDirectory & cGameName& ".txt")then
  1368. Credits = 0
  1369. Exit Sub
  1370. End If
  1371. Set ScoreFile = FileObj.GetFile(UserDirectory & cGameName& ".txt")
  1372. Set TextStr = ScoreFile.OpenAsTextStream(1, 0)
  1373. If(TextStr.AtEndOfStream = True)then
  1374. Exit Sub
  1375. End If
  1376. temp1 = TextStr.ReadLine
  1377. temp2 = textstr.readline
  1378.  
  1379. HighScore = cdbl(temp1)
  1380. If HighScore <1 then
  1381. temp8 = textstr.readline
  1382. temp9 = textstr.readline
  1383. temp10 = textstr.readline
  1384. temp11 = textstr.readline
  1385. temp12 = textstr.readline
  1386. temp13 = textstr.readline
  1387. temp14 = textstr.readline
  1388. temp15 = textstr.readline
  1389. temp16 = textstr.readline
  1390. temp17 = textstr.readline
  1391. End If
  1392. TextStr.Close
  1393. Credits = cdbl(temp2)
  1394.  
  1395. If HighScore <1 then
  1396. HSScore(1) = int(temp8)
  1397. HSScore(2) = int(temp9)
  1398. HSScore(3) = int(temp10)
  1399. HSScore(4) = int(temp11)
  1400. HSScore(5) = int(temp12)
  1401.  
  1402. HSName(1) = temp13
  1403. HSName(2) = temp14
  1404. HSName(3) = temp15
  1405. HSName(4) = temp16
  1406. HSName(5) = temp17
  1407. End If
  1408. Set ScoreFile = Nothing
  1409. Set FileObj = Nothing
  1410. SortHighscore 'added to fix a previous error
  1411. End Sub
  1412.  
  1413. Sub Savehs
  1414. ' Based on Black's Highscore routines
  1415. Dim FileObj
  1416. Dim ScoreFile
  1417. Dim xx
  1418. Set FileObj = CreateObject("Scripting.FileSystemObject")
  1419. If Not FileObj.FolderExists(UserDirectory)then
  1420. Exit Sub
  1421. End If
  1422. Set ScoreFile = FileObj.CreateTextFile(UserDirectory & cGameName& ".txt", True)
  1423. ScoreFile.WriteLine 0
  1424. ScoreFile.WriteLine Credits
  1425. For xx = 1 to 5
  1426. scorefile.writeline HSScore(xx)
  1427. Next
  1428. For xx = 1 to 5
  1429. scorefile.writeline HSName(xx)
  1430. Next
  1431. ScoreFile.Close
  1432. Set ScoreFile = Nothing
  1433. Set FileObj = Nothing
  1434. End Sub
  1435.  
  1436. Sub SortHighscore
  1437. Dim tmp, tmp2, i, j
  1438. For i = 1 to 5
  1439. For j = 1 to 4
  1440. If HSScore(j) <HSScore(j + 1)Then
  1441. tmp = HSScore(j + 1)
  1442. tmp2 = HSName(j + 1)
  1443. HSScore(j + 1) = HSScore(j)
  1444. HSName(j + 1) = HSName(j)
  1445. HSScore(j) = tmp
  1446. HSName(j) = tmp2
  1447. End If
  1448. Next
  1449. Next
  1450. End Sub
  1451.  
  1452. ' ***************************************************
  1453. ' GNMOD - Multiple High Score Display and Collection
  1454. ' jpsalas: changed ramps by flashers to remove extra shadow
  1455. ' ***************************************************
  1456.  
  1457. Dim EnteringInitials ' Normally zero, set to non-zero to enter initials
  1458. EnteringInitials = False
  1459. Dim ScoreChecker
  1460. ScoreChecker = 0
  1461. Dim CheckAllScores
  1462. CheckAllScores = 0
  1463. Dim sortscores(4)
  1464. Dim sortplayers(4)
  1465.  
  1466. Dim PlungerPulled
  1467. PlungerPulled = 0
  1468.  
  1469. Dim SelectedChar ' character under the "cursor" when entering initials
  1470.  
  1471. Dim HSTimerCount ' Pass counter For HS timer, scores are cycled by the timer
  1472. HSTimerCount = 5 ' Timer is initially enabled, it'll wrap from 5 to 1 when it's displayed
  1473.  
  1474. Dim InitialString ' the string holding the player's initials as they're entered
  1475.  
  1476. Dim AlphaString ' A-Z, 0-9, space (_) and backspace (<)
  1477. Dim AlphaStringPos ' pointer to AlphaString, move Forward and backward with flipper keys
  1478. AlphaString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_<"
  1479.  
  1480. Dim HSNewHigh ' The new score to be recorded
  1481.  
  1482. Dim HSScore(5) ' High Scores read in from config file
  1483. Dim HSName(5) ' High Score Initials read in from config file
  1484.  
  1485. ' default high scores
  1486. HSScore(1) = 450000
  1487. HSScore(2) = 440000
  1488. HSScore(3) = 430000
  1489. HSScore(4) = 420000
  1490. HSScore(5) = 410000
  1491.  
  1492. HSName(1) = "AAA"
  1493. HSName(2) = "ZZZ"
  1494. HSName(3) = "XXX"
  1495. HSName(4) = "ABC"
  1496. HSName(5) = "BBB"
  1497.  
  1498. Sub HighScoreTimer_Timer
  1499. If EnteringInitials then
  1500. If HSTimerCount = 1 then
  1501. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  1502. HSTimerCount = 2
  1503. Else
  1504. SetHSLine 3, InitialString
  1505. HSTimerCount = 1
  1506. End If
  1507. ElseIf bGameInPlay then
  1508. SetHSLine 1, "HIGH SCORE1"
  1509. SetHSLine 2, HSScore(1)
  1510. SetHSLine 3, HSName(1)
  1511. HSTimerCount = 5 ' set so the highest score will show after the game is over
  1512. HighScoreTimer.enabled = false
  1513. ElseIf CheckAllScores then
  1514. NewHighScore sortscores(ScoreChecker), sortplayers(ScoreChecker)
  1515. Else
  1516. ' cycle through high scores
  1517. HighScoreTimer.interval = 2000
  1518. HSTimerCount = HSTimerCount + 1
  1519. If HsTimerCount> 5 then
  1520. HSTimerCount = 1
  1521. End If
  1522. SetHSLine 1, "HIGH SCORE" + FormatNumber(HSTimerCount, 0)
  1523. SetHSLine 2, HSScore(HSTimerCount)
  1524. SetHSLine 3, HSName(HSTimerCount)
  1525. End If
  1526. End Sub
  1527.  
  1528. Function GetHSChar(String, Index)
  1529. Dim ThisChar
  1530. Dim FileName
  1531. ThisChar = Mid(String, Index, 1)
  1532. FileName = "PostIt"
  1533. If ThisChar = " " or ThisChar = "" then
  1534. FileName = FileName & "BL"
  1535. ElseIf ThisChar = "<" then
  1536. FileName = FileName & "LT"
  1537. ElseIf ThisChar = "_" then
  1538. FileName = FileName & "SP"
  1539. Else
  1540. FileName = FileName & ThisChar
  1541. End If
  1542. GetHSChar = FileName
  1543. End Function
  1544.  
  1545. Sub SetHsLine(LineNo, String)
  1546. Dim Letter
  1547. Dim ThisDigit
  1548. Dim ThisChar
  1549. Dim StrLen
  1550. Dim LetterLine
  1551. Dim Index
  1552. Dim StartHSArray
  1553. Dim EndHSArray
  1554. Dim LetterName
  1555. Dim xFor
  1556. StartHSArray = array(0, 1, 12, 22)
  1557. EndHSArray = array(0, 11, 21, 31)
  1558. StrLen = len(string)
  1559. Index = 1
  1560.  
  1561. For xFor = StartHSArray(LineNo)to EndHSArray(LineNo)
  1562. Eval("HS" &xFor).imageA = GetHSChar(String, Index)
  1563. Index = Index + 1
  1564. Next
  1565. End Sub
  1566.  
  1567. Sub NewHighScore(NewScore, PlayNum)
  1568. If NewScore> HSScore(5)then
  1569. HighScoreTimer.interval = 500
  1570. HSTimerCount = 1
  1571. AlphaStringPos = 1 ' start with first character "A"
  1572. EnteringInitials = true ' intercept the control keys while entering initials
  1573. InitialString = "" ' initials entered so far, initialize to empty
  1574. SetHSLine 1, "PLAYER " + FormatNumber(PlayNum, 0)
  1575. SetHSLine 2, "ENTER NAME"
  1576. SetHSLine 3, MID(AlphaString, AlphaStringPos, 1)
  1577. HSNewHigh = NewScore
  1578. AwardSpecial
  1579. End If
  1580. ScoreChecker = ScoreChecker-1
  1581. If ScoreChecker = 0 then
  1582. CheckAllScores = 0
  1583. End If
  1584. End Sub
  1585.  
  1586. Sub CollectInitials(keycode)
  1587. Dim i
  1588. If keycode = LeftFlipperKey Then
  1589. ' back up to previous character
  1590. AlphaStringPos = AlphaStringPos - 1
  1591. If AlphaStringPos <1 then
  1592. AlphaStringPos = len(AlphaString) ' handle wrap from beginning to End
  1593. If InitialString = "" then
  1594. ' Skip the backspace If there are no characters to backspace over
  1595. AlphaStringPos = AlphaStringPos - 1
  1596. End If
  1597. End If
  1598. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  1599. PlaySound "fx_Previous"
  1600. ElseIf keycode = RightFlipperKey Then
  1601. ' advance to Next character
  1602. AlphaStringPos = AlphaStringPos + 1
  1603. If AlphaStringPos> len(AlphaString)or(AlphaStringPos = len(AlphaString)and InitialString = "")then
  1604. ' Skip the backspace If there are no characters to backspace over
  1605. AlphaStringPos = 1
  1606. End If
  1607. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  1608. PlaySound "fx_Next"
  1609. ElseIf keycode = StartGameKey or keycode = PlungerKey Then
  1610. SelectedChar = MID(AlphaString, AlphaStringPos, 1)
  1611. If SelectedChar = "_" then
  1612. InitialString = InitialString & " "
  1613. PlaySound("fx_Esc")
  1614. ElseIf SelectedChar = "<" then
  1615. InitialString = MID(InitialString, 1, len(InitialString)- 1)
  1616. If len(InitialString) = 0 then
  1617. ' If there are no more characters to back over, don't leave the < displayed
  1618. AlphaStringPos = 1
  1619. End If
  1620. PlaySound("fx_Esc")
  1621. Else
  1622. InitialString = InitialString & SelectedChar
  1623. PlaySound("fx_Enter")
  1624. End If
  1625. If len(InitialString) <3 then
  1626. SetHSLine 3, InitialString & SelectedChar
  1627. End If
  1628. End If
  1629. If len(InitialString) = 3 then
  1630. ' save the score
  1631. For i = 5 to 1 step -1
  1632. If i = 1 or(HSNewHigh> HSScore(i)and HSNewHigh <= HSScore(i - 1))then
  1633. ' Replace the score at this location
  1634. If i <5 then
  1635. HSScore(i + 1) = HSScore(i)
  1636. HSName(i + 1) = HSName(i)
  1637. End If
  1638. EnteringInitials = False
  1639. HSScore(i) = HSNewHigh
  1640. HSName(i) = InitialString
  1641. HSTimerCount = 5
  1642. HighScoreTimer_Timer
  1643. HighScoreTimer.interval = 2000
  1644. PlaySound("fx_Bong")
  1645. Exit Sub
  1646. ElseIf i <5 then
  1647. ' move the score in this slot down by 1, it's been exceeded by the new score
  1648. HSScore(i + 1) = HSScore(i)
  1649. HSName(i + 1) = HSName(i)
  1650. End If
  1651. Next
  1652. End If
  1653. End Sub
  1654. ' End GNMOD
  1655.  
  1656. '*******************
  1657. ' Realtime updates
  1658. '*******************
  1659.  
  1660. Sub Realtime_Timer
  1661. RollingUpdate
  1662. LeftFlipperTop.RotZ = LeftFlipper.CurrentAngle
  1663. RightFlipperTop.RotZ = RightFlipper.CurrentAngle
  1664. End Sub
  1665.  
  1666. '*********
  1667. ' LUT
  1668. '*********
  1669.  
  1670. Dim bLutActive, LUTImage
  1671. Sub LoadLUT
  1672. Dim x
  1673. bLutActive = False
  1674. x = LoadValue(cGameName, "LUTImage")
  1675. If(x <> "")Then LUTImage = x Else LUTImage = 0
  1676. UpdateLUT
  1677. End Sub
  1678.  
  1679. Sub SaveLUT
  1680. SaveValue cGameName, "LUTImage", LUTImage
  1681. End Sub
  1682.  
  1683. Sub NextLUT:LUTImage = (LUTImage + 1)MOD 10:UpdateLUT:SaveLUT:End Sub
  1684.  
  1685. Sub UpdateLUT
  1686. Select Case LutImage
  1687. Case 0:table1.ColorGradeImage = "LUT0"
  1688. Case 1:table1.ColorGradeImage = "LUT1"
  1689. Case 2:table1.ColorGradeImage = "LUT2"
  1690. Case 3:table1.ColorGradeImage = "LUT3"
  1691. Case 4:table1.ColorGradeImage = "LUT4"
  1692. Case 5:table1.ColorGradeImage = "LUT5"
  1693. Case 6:table1.ColorGradeImage = "LUT6"
  1694. Case 7:table1.ColorGradeImage = "LUT7"
  1695. Case 8:table1.ColorGradeImage = "LUT8"
  1696. Case 9:table1.ColorGradeImage = "LUT9"
  1697. End Select
  1698. End Sub
  1699.  
  1700. '***********************************************************************
  1701. ' *********************************************************************
  1702. ' ********* G A M E C O D E S T A R T S H E R E *********
  1703. ' *********************************************************************
  1704. '***********************************************************************
  1705.  
  1706. Sub VPObjects_Init 'init objects
  1707. TurnOffPlayfieldLights()
  1708. ' change the apron
  1709. If BallsPerGame = 5 Then
  1710. Apron.Image = "plastics_5ball"
  1711. End If
  1712. End Sub
  1713.  
  1714. ' Dim all the variables
  1715. Dim TorpedoAdvance
  1716.  
  1717. Sub Game_Init() 'called at the start of a new game
  1718. 'Start music?
  1719. 'Init variables?
  1720. 'ResetDropTargets
  1721. 'Start or init timers
  1722. 'Init lights?
  1723. TurnOffPlayfieldLights()
  1724. End Sub
  1725.  
  1726. Sub StopEndOfBallMode() 'called when the last ball is drained
  1727. End Sub
  1728.  
  1729. Sub ResetNewBallVariables() 'init variables & lights for a new ball or player
  1730. TurnOffPlayfieldLights
  1731. If Balls = BallsPerGame Then
  1732. BonusMultiplier = 2
  1733. Light001.State = 1
  1734. Else
  1735. BonusMultiplier = 1
  1736. End If
  1737. Bonus = 0
  1738. UpdateBonusLights
  1739. If BallsPerGame = 3 Then light002.State = 1
  1740. TorpedoAdvance = 0
  1741. light026.State = 1
  1742. light027.State = 1
  1743. light028.State = 1
  1744. light014.State = 1
  1745. light015.State = 1
  1746. End Sub
  1747.  
  1748. Sub TurnOffPlayfieldLights()
  1749. Dim a
  1750. For each a in aLights
  1751. a.State = 0
  1752. Next
  1753. End Sub
  1754.  
  1755. ' *********************************************************************
  1756. ' Table Object Hit Events
  1757. ' *********************************************************************
  1758. ' Any target hit Sub will do this:
  1759. ' - play a sound
  1760. ' - do some physical movement
  1761. ' - add a score, bonus
  1762. ' - check some variables/modes this trigger is a member of
  1763. ' - set the "LastSwicthHit" variable in case it is needed later
  1764. ' *********************************************************************
  1765.  
  1766. ' Slingshots
  1767. Dim LStep, RStep, RStep2
  1768.  
  1769. Sub LeftSlingShot_Slingshot
  1770. If Tilted Then Exit Sub
  1771. PlaySoundAt SoundFXDOF("fx_slingshot", 103, DOFPulse, DOFcontactors), Lemk
  1772. LeftSling004.Visible = 1
  1773. Lemk.RotX = 26
  1774. LStep = 0
  1775. LeftSlingShot.TimerEnabled = True
  1776. ' add points
  1777. AddScore 100
  1778. AddBonus 1
  1779. ' some effect?
  1780. End Sub
  1781.  
  1782. Sub LeftSlingShot_Timer
  1783. Select Case LStep
  1784. Case 1:LeftSLing004.Visible = 0:LeftSLing003.Visible = 1:Lemk.RotX = 14
  1785. Case 2:LeftSLing003.Visible = 0:LeftSLing002.Visible = 1:Lemk.RotX = 2
  1786. Case 3:LeftSLing002.Visible = 0:Lemk.RotX = -20:LeftSlingShot.TimerEnabled = 0
  1787. End Select
  1788. LStep = LStep + 1
  1789. End Sub
  1790.  
  1791. Sub RightSlingShot_Slingshot
  1792. If Tilted Then Exit Sub
  1793. PlaySoundAt SoundFXDOF("fx_slingshot", 104, DOFPulse, DOFcontactors), Remk
  1794. RightSling004.Visible = 1
  1795. Remk.RotX = 26
  1796. RStep = 0
  1797. RightSlingShot.TimerEnabled = True
  1798. ' add points
  1799. AddScore 100
  1800. AddBonus 1
  1801. ' add effect?
  1802. End Sub
  1803.  
  1804. Sub RightSlingShot_Timer
  1805. Select Case RStep
  1806. Case 1:RightSLing004.Visible = 0:RightSLing003.Visible = 1:Remk.RotX = 14
  1807. Case 2:RightSLing003.Visible = 0:RightSLing002.Visible = 1:Remk.RotX = 2
  1808. Case 3:RightSLing002.Visible = 0:Remk.RotX = -20:RightSlingShot.TimerEnabled = 0
  1809. End Select
  1810. RStep = RStep + 1
  1811. End Sub
  1812.  
  1813. Sub RightSlingShot001_Slingshot
  1814. If Tilted Then Exit Sub
  1815. PlaySoundAt SoundFXDOF("fx_slingshot", 105, DOFPulse, DOFcontactors), Remk001
  1816. Rubber023.Visible = 1
  1817. Remk001.RotX = 26
  1818. RStep2 = 0
  1819. RightSlingShot001.TimerEnabled = True
  1820. ' add points
  1821. AddScore 100
  1822. AddBonus 1
  1823. ' add effect?
  1824. End Sub
  1825.  
  1826. Sub RightSlingShot001_Timer
  1827. Select Case RStep2
  1828. Case 1:Rubber023.Visible = 0:Rubber022.Visible = 1:Remk001.RotX = 14
  1829. Case 2:Rubber022.Visible = 0:Rubber021.Visible = 1:Remk001.RotX = 2
  1830. Case 3:Rubber021.Visible = 0:Remk001.RotX = -20:RightSlingshot001.TimerEnabled = 0
  1831. End Select
  1832. RStep2 = RStep2 + 1
  1833. End Sub
  1834.  
  1835. '***********************
  1836. ' Rubbers
  1837. '***********************
  1838.  
  1839. Sub rlband006_Hit
  1840. If Tilted then Exit Sub
  1841. AddScore 100
  1842. AddBonus 1
  1843. End Sub
  1844.  
  1845. Sub rlband003_Hit
  1846. If Tilted then Exit Sub
  1847. AddScore 100
  1848. AddBonus 1
  1849. End Sub
  1850.  
  1851. Sub rlband002_Hit
  1852. If Tilted then Exit Sub
  1853. AddScore 100
  1854. AddBonus 1
  1855. End Sub
  1856.  
  1857. '*********
  1858. ' Bumpers
  1859. '*********
  1860.  
  1861. Sub Bumper001_Hit
  1862. If Tilted Then Exit Sub
  1863. PlaySoundAt "fx_Bumper", bumper001
  1864. AddScore 100
  1865. AddBonus 1
  1866. End Sub
  1867.  
  1868. '*****************
  1869. ' Lanes
  1870. '*****************
  1871.  
  1872. 'top
  1873.  
  1874. Sub Trigger008_Hit '1
  1875. PlaySoundAt "fx_sensor", Trigger008
  1876. If Tilted Then Exit Sub
  1877. AddScore 1000
  1878. light026.State = 0
  1879. light014.State = 0
  1880. light029.State = 1
  1881. Check123
  1882. End Sub
  1883.  
  1884. Sub Trigger009_Hit '2
  1885. PlaySoundAt "fx_sensor", Trigger009
  1886. If Tilted Then Exit Sub
  1887. AddScore 1000
  1888. light027.State = 0
  1889. light015.State = 0
  1890. light030.State = 1
  1891. Check123
  1892. End Sub
  1893.  
  1894. Sub Trigger010_Hit '3
  1895. PlaySoundAt "fx_sensor", Trigger010
  1896. If Tilted Then Exit Sub
  1897. AddScore 1000
  1898. light028.State = 0
  1899. light031.State = 1
  1900. Check123
  1901. End Sub
  1902.  
  1903. 'outlanes
  1904.  
  1905. Sub Trigger002_Hit
  1906. PlaySoundAt "fx_sensor", Trigger002
  1907. If Tilted Then Exit Sub
  1908. AddScore 10000
  1909. End Sub
  1910.  
  1911. Sub Trigger003_Hit
  1912. PlaySoundAt "fx_sensor", Trigger003
  1913. If Tilted Then Exit Sub
  1914. AddScore 10000
  1915. End Sub
  1916.  
  1917. 'inlanes
  1918.  
  1919. Sub Trigger004_Hit '2
  1920. PlaySoundAt "fx_sensor", Trigger004
  1921. If Tilted Then Exit Sub
  1922. AddScore 1000
  1923. light027.State = 0
  1924. light015.State = 0
  1925. light030.State = 1
  1926. Check123
  1927. End Sub
  1928.  
  1929. Sub Trigger001_Hit '1
  1930. PlaySoundAt "fx_sensor", Trigger001
  1931. If Tilted Then Exit Sub
  1932. AddScore 1000
  1933. light026.State = 0
  1934. light014.State = 0
  1935. light029.State = 1
  1936. Check123
  1937. End Sub
  1938.  
  1939. ' torpedo triggers
  1940.  
  1941. Sub Trigger005_Hit '1
  1942. PlaySoundAt "fx_sensor", Trigger005
  1943. If Tilted Then Exit Sub
  1944. PlaySound "Torpedo1"
  1945. Lbumper1a.Duration 0, 800, 1
  1946. Lbumper1b.Duration 0, 800, 1
  1947. If light029.State Then
  1948. Addscore 5000
  1949. AddBonus 10
  1950. Else
  1951. AddScore 500
  1952. End If
  1953. If light032.State Then
  1954. AwardExtraBall
  1955. light032.State = 0
  1956. End If
  1957. End Sub
  1958.  
  1959. Sub Trigger006_Hit '2
  1960. PlaySoundAt "fx_sensor", Trigger006
  1961. If Tilted Then Exit Sub
  1962. PlaySound "Torpedo1"
  1963. Lbumper1a.Duration 0, 800, 1
  1964. Lbumper1b.Duration 0, 800, 1
  1965. If light030.State Then
  1966. Addscore 5000
  1967. AddBonus 10
  1968. Else
  1969. AddScore 500
  1970. End If
  1971. If light032.State Then
  1972. AwardExtraBall
  1973. light032.State = 0
  1974. End If
  1975. End Sub
  1976.  
  1977. Sub Trigger007_Hit '3
  1978. PlaySoundAt "fx_sensor", Trigger007
  1979. If Tilted Then Exit Sub
  1980. PlaySound "Torpedo1"
  1981. Lbumper1a.Duration 0, 800, 1
  1982. Lbumper1b.Duration 0, 800, 1
  1983. If light031.State Then
  1984. Addscore 5000
  1985. AddBonus 10
  1986. Else
  1987. AddScore 500
  1988. End If
  1989. If light032.State Then
  1990. AwardExtraBall
  1991. light032.State = 0
  1992. End If
  1993. End Sub
  1994.  
  1995. Sub Check123
  1996. If light029.State + light030.State + light031.State = 3 Then
  1997. If Bonus>= 110 AND Bonus <120 Then 'lit extra ball light
  1998. light032.State = 1
  1999. End If
  2000. End If
  2001. If Bonus> 140 Then
  2002. light033.State = 1 'Special light
  2003. End If
  2004. End Sub
  2005.  
  2006. 'right Gate
  2007.  
  2008. Sub Trigger011_Hit
  2009. If Tilted Then Exit Sub
  2010. Addscore 5000
  2011. AddBonus 10
  2012. PlaySound "Torpedo2"
  2013. Lbumper1a.Duration 0, 800, 1
  2014. Lbumper1b.Duration 0, 800, 1
  2015. End Sub
  2016.  
  2017. '************************
  2018. ' Targets
  2019. '************************
  2020.  
  2021. Sub Target001_hit 'lower
  2022. PlaySoundAtBall "fx_target"
  2023. If Tilted Then Exit Sub
  2024. If light003.State Then
  2025. Addscore 50000
  2026. light003.State = 0
  2027. ResetTorpedoLights
  2028. If BallsPerGame = 5 Then
  2029. light002.State = 0
  2030. End If
  2031. Else
  2032. Addscore 10000
  2033. End If
  2034. End Sub
  2035.  
  2036. Sub Target002_hit 'top
  2037. PlaySoundAtBall "fx_target"
  2038. If Tilted Then Exit Sub
  2039. If light003.State Then
  2040. light002.State = 1
  2041. Else
  2042. light003.State = 1
  2043. End If
  2044. Addscore 10000
  2045. End Sub
  2046.  
  2047. Sub ResetTorpedoLights
  2048. Light029.State = 0
  2049. light030.State = 0
  2050. light031.State = 0
  2051. light026.State = 1
  2052. light027.State = 1
  2053. light028.State = 1
  2054. light014.State = 1
  2055. light015.State = 1
  2056. End Sub
  2057.  
  2058. '****************
  2059. ' Kicker
  2060. '****************
  2061.  
  2062. Sub Kicker001_Hit
  2063. If NOT Tilted Then
  2064. Addscore 500
  2065. Addscore 500
  2066. End If
  2067. vpmtimer.AddTimer 2000, "PlaySoundAt SoundFXDOF(""fx_kicker"", 110, DOFPulse, DOFcontactors), Kicker001: Kicker001.Kick 68, 10 '"
  2068. End Sub
  2069.  
  2070. '**************
  2071. ' Spinner
  2072. '**************
  2073.  
  2074. Sub Spinner001_Spin
  2075. PlaySoundAt "fx_spinner", Spinner001
  2076. DOF 115, DOFPulse
  2077. If Tilted Then Exit Sub
  2078. Addscore 100
  2079. AddBonus 1
  2080. End Sub
  2081.  
  2082. '************
  2083. ' Varitarget
  2084. '************
  2085.  
  2086. Dim variawarded, vtpos, varipos
  2087. variawarded = False
  2088. vtpos = Array(20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -12, -14, -16, -18, -20, -22)
  2089.  
  2090. Sub vt_Hit(idx)
  2091. Dim x
  2092. If ActiveBall.VelY <0 Then
  2093. varipos = idx
  2094. ActiveBall.VelY = ActiveBall.VelY * 0.915
  2095. PlaySound SoundFXDOF("fx_solenoidoff", 114, DOFPulse, DOFShaker)
  2096. varitarget.roty = vtpos(idx)
  2097. Else
  2098. If VTTimer.Enabled = False Then
  2099. VTTimer.Interval = 300
  2100. VTTimer.Enabled = True
  2101. End If
  2102. End If
  2103. End Sub
  2104.  
  2105. Sub VTTimer_Timer()
  2106. VTTimer.Interval = 30
  2107. varipos = varipos -1
  2108. If varipos <0 Then varipos = 0
  2109. If varipos> 21 Then varipos = 21
  2110. varitarget.roty = vtpos(varipos)
  2111. If varipos = 19 AND variawarded = False Then
  2112. If light002.State Then AddBonus 50
  2113. If light033.State Then
  2114. AddScore 50000::variawarded = True
  2115. DOF 117, DOFPulse
  2116. Else
  2117. AddScore 5000:variawarded = True
  2118. End If
  2119. End If
  2120. If varipos = 16 AND variawarded = False Then
  2121. AddScore 4000:variawarded = True
  2122. If light002.State Then AddBonus 40
  2123. End If
  2124. If varipos = 13 AND variawarded = False Then
  2125. AddScore 3000:variawarded = True
  2126. If light002.State Then AddBonus 30
  2127. End If
  2128. If varipos = 10 AND variawarded = False Then
  2129. AddScore 2000:variawarded = True
  2130. If light002.State Then AddBonus 20
  2131. End If
  2132. If varipos = 7 AND variawarded = False Then
  2133. AddScore 1000:variawarded = True
  2134. If light002.State Then AddBonus 10
  2135. End If
  2136. If varipos = 4 AND variawarded = False Then
  2137. AddScore 1000:variawarded = True
  2138. If light002.State Then AddBonus 10
  2139. End If
  2140. If varipos = 0 Then
  2141. variawarded = False
  2142. VTTimer.Enabled = False
  2143. End If
  2144. End Sub
Advertisement
Add Comment
Please, Sign In to add comment