Advertisement
Arngrim

Untitled

Apr 13th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 75.97 KB | None | 0 0
  1. '*
  2. '* Gottlieb's King of Diamonds (1967)
  3. '* Table build/scripted by Loserman!
  4. '* Images/plastics redrawn by GNance
  5. '*
  6. '*
  7.  
  8. option explicit
  9. Randomize
  10. ExecuteGlobal GetTextFile("core.vbs")
  11.  
  12. On Error Resume Next
  13. ExecuteGlobal GetTextFile("Controller.vbs")
  14. If Err Then MsgBox "Unable to open Controller.vbs. Ensure that it is in the scripts folder."
  15. On Error Goto 0
  16.  
  17. Const cGameName = "KingOfDiamonds_1967"
  18.  
  19. Const ShadowFlippersOn = true
  20. Const ShadowBallOn = true
  21.  
  22. Const ShadowConfigFile = false
  23.  
  24.  
  25.  
  26.  
  27. Dim Controller ' B2S
  28. Dim B2SScore ' B2S Score Displayed
  29. Const HSFileName="KingOfDiamonds_67VPX.txt"
  30. Const B2STableName="KingOfDiamonds_1967"
  31. Const LMEMTableConfig="LMEMTables.txt"
  32. Const LMEMShadowConfig="LMEMShadows.txt"
  33. Dim EnableBallShadow
  34. Dim EnableFlipperShadow
  35.  
  36. '* this value adjusts score motor behavior - 0 allows you to continue scoring while the score motor is running - 1 sets score motor to behave more like a real EM
  37. Const ScoreMotorAdjustment=1
  38.  
  39. '* this is a debug setting to use an older scoring routine vs a newer score routine - don't change this value
  40. Const ScoreAdditionAdjustment=1
  41.  
  42. '* this setting controls whether you hear bells (0) or chimes (1) during scoring
  43. Const ChimesOn=0
  44.  
  45.  
  46. Dim B2SOn 'True/False if want backglass
  47. dim ScoreChecker
  48. dim CheckAllScores
  49. dim sortscores(4)
  50. dim sortplayers(4)
  51. Dim TextStr, TextStr2,TiltEndsGame
  52. Dim i
  53. Dim obj
  54. Dim bgpos
  55. Dim kgpos
  56. Dim dooralreadyopen
  57. Dim kgdooralreadyopen
  58. Dim TargetSpecialLit
  59. Dim Points210counter
  60. Dim Points500counter
  61. Dim Points1000counter
  62. Dim Points2000counter
  63. Dim BallsPerGame
  64. Dim InProgress
  65. Dim BallInPlay
  66. Dim CreditsPerCoin
  67. Dim Score100K(4)
  68. Dim Score(4)
  69. Dim ScoreDisplay(4)
  70. Dim HighScorePaid(4)
  71. Dim HighScore
  72. Dim HighScoreReward
  73. Dim BonusMultiplier
  74. Dim Credits
  75. Dim Match
  76. Dim Replay1
  77. Dim Replay2
  78. Dim Replay3
  79. Dim Replay4
  80. Dim Replay1Paid(4)
  81. Dim Replay2Paid(4)
  82. Dim Replay3Paid(4)
  83. Dim Replay4Paid(4)
  84. Dim TableTilted
  85. Dim TiltCount
  86. Dim debugscore
  87.  
  88. Dim OperatorMenu
  89.  
  90. Dim BonusBooster
  91. Dim BonusBoosterCounter
  92. Dim BonusCounter
  93. Dim HoleCounter
  94.  
  95. Dim Ones
  96. Dim Tens
  97. Dim Hundreds
  98. Dim Thousands
  99.  
  100. Dim Player
  101. Dim Players
  102.  
  103. Dim rst
  104. Dim bonuscountdown
  105. Dim TempMultiCounter
  106. dim TempPlayerup
  107. dim RotatorTemp
  108.  
  109. dim GreenTargetsDownCounter
  110. dim BlueTargetsDownCounter
  111. dim YellowTargetsDownCounter
  112.  
  113. Dim bump1
  114. Dim bump2
  115. Dim bump3
  116. Dim bump4
  117.  
  118. Dim LastChime10
  119. Dim LastChime100
  120. Dim LastChime1000
  121.  
  122. Dim Score10
  123. Dim Score100
  124.  
  125. Dim raceRflag, raceAflag, raceCflag,raceEflag
  126. dim tempbumper
  127.  
  128. Dim MotorRunning
  129.  
  130. Dim Replay1Table(15)
  131. Dim Replay2Table(15)
  132. Dim Replay3Table(15)
  133. Dim Replay4Table(15)
  134. Dim ReplayTableSet
  135. Dim ReplayLevel
  136. Dim ReplayTableMax
  137.  
  138. Dim RelayB
  139. Dim RelayC
  140. Dim RelayE
  141. Dim FlippingFlag
  142.  
  143. Dim TempRotoScore
  144.  
  145. Dim KickerCounter
  146. Dim mHole,mHole2
  147.  
  148.  
  149. Dim RotoCycles ' Number of Digits To Animate on a Spin
  150.  
  151. Dim X, xx
  152. Dim LStep, LStep2, RStep, L2Step, R2Step
  153. Dim RotoImagesL1, RotoImagesL2, RotoImagesR1, RotoImagesR2
  154. Dim RotoMain1, RotoMain2, RotoMain3, RotoMain4, RotoMain5
  155. Dim RotoID1, RotoID2, RotoID3, RotoID4, RotoID5, RotoID0
  156. Dim RotoMainMotion0, RotoMainMotion1, RotoMainMotion2, RotoMainMotion3, RotoMainMotion4, RotoMainMotion5
  157. Dim RotoPosition, RotoFlip, mover
  158. Dim AdvancePosition, DominoAdvance
  159. Dim ZeroNineCounter, AlternatingRelay
  160. Dim AdvanceSetting, SequenceCompletedHigh
  161.  
  162. RotoID0 = array (2,10,6,4,5,11,3,8,1,0,7,12,6,7,9)
  163. RotoID1 = array (10,6,4,5,11,3,8,1,0,7,12,6,7,9,2)
  164. RotoID2 = array (6,4,5,11,3,8,1,0,7,12,6,7,9,2,10)
  165. RotoID3 = array (4,5,11,3,8,1,0,7,12,6,7,9,2,10,6)
  166. RotoID4 = array (5,11,3,8,1,0,7,12,6,7,9,2,10,6,4)
  167. RotoID5 = array (11,3,8,1,0,7,12,6,7,9,2,10,6,4,5)
  168.  
  169. RotoMain1 = array ("4","Q","8","6","7","K","5","10","3","2","9","A","6","9","J")
  170. RotoMain2 = array ("Q","8","6","7","K","5","10","3","2","9","A","6","9","J","4")
  171. RotoMain3 = array ("8","6","7","K","5","10","3","2","9","A","6","9","J","4","Q")
  172. RotoMain4 = array ("6","7","K","5","10","3","2","9","A","6","9","J","4","Q","8")
  173. RotoMain5 = array ("7","K","5","10","3","2","9","A","6","9","J","4","Q","8","6")
  174.  
  175.  
  176. RotoMainMotion0 = array ("4","Q","8","6","7","K","5","10","3","2","9","A","6","9","J")
  177. RotoMainMotion1 = array ("Q","8","6","7","K","5","10","3","2","9","A","6","9","J","4")
  178. RotoMainMotion2 = array ("8","6","7","K","5","10","3","2","9","A","6","9","J","4","Q")
  179. RotoMainMotion3 = array ("6","7","K","5","10","3","2","9","A","6","9","J","4","Q","8")
  180. RotoMainMotion4 = array ("7","K","5","10","3","2","9","A","6","9","J","4","Q","8","6")
  181. RotoMainMotion5 = array ("K","5","10","3","2","9","A","6","9","J","4","Q","8","6","7")
  182.  
  183.  
  184.  
  185. Sub Table1_Init()
  186. If Table1.ShowDT = false then
  187. For each obj in DesktopCrap
  188. obj.visible=False
  189. next
  190. End If
  191.  
  192. OperatorMenuBackdrop.image = "PostitBL"
  193. For XOpt = 1 to MaxOption
  194. Eval("OperatorOption"&XOpt).image = "PostitBL"
  195. next
  196.  
  197. For XOpt = 1 to 256
  198. Eval("Option"&XOpt).image = "PostItBL"
  199. next
  200.  
  201. LoadEM
  202. LoadLMEMConfig2
  203.  
  204. HideOptions
  205. SetupReplayTables
  206. PlasticsOff
  207. BumpersOff
  208. OperatorMenu=0
  209. ReplayLevel=1
  210. BallsPerGame=5
  211. EMReel1.ResetToZero
  212. HighScore=0
  213. MotorRunning=0
  214. AdvanceSetting=0
  215. ZeroNineCounter=0
  216. FlippingFlag=0
  217. HighScoreReward=1
  218. TiltEndsGame=1
  219. BallTextBox.text=""
  220. MatchTextBox.text=""
  221. Credits=0
  222. loadhs
  223. if HighScore=0 then HighScore=5000
  224. for each obj in RotoTargets
  225. obj.visible=true
  226. next
  227. for each obj in RotoTargetsMotion
  228. obj.visible=false
  229. next
  230. for each obj in RotoTargetsHit
  231. obj.collidable = true
  232. next
  233. for each obj in RotoTargetsMotionHit
  234. obj.collidable = false
  235. next
  236. RotoPosition=int(Rnd*15)
  237. RotoA.image = "Roto_T1_"&RotoMain1(RotoPosition)
  238.  
  239. RotoB.image = "Roto_T1_"&RotoMain2(RotoPosition)
  240.  
  241. RotoC.image = "Roto_T1_"&RotoMain3(RotoPosition)
  242.  
  243. RotoD.image = "Roto_T1_"&RotoMain4(RotoPosition)
  244.  
  245. RotoE.image = "Roto_T1_"&RotoMain5(RotoPosition)
  246.  
  247.  
  248.  
  249. TableTilted=false
  250. TiltReel.SetValue(1)
  251. Match=int(Rnd*10)*10
  252. MatchReel.SetValue((Match/10)+1)
  253.  
  254. For each obj in PlayerScores
  255. obj.ResetToZero
  256. next
  257.  
  258. Replay1=Replay1Table(ReplayLevel)
  259. Replay2=Replay2Table(ReplayLevel)
  260. Replay3=Replay3Table(ReplayLevel)
  261. Replay4=Replay4Table(ReplayLevel)
  262.  
  263. BonusCounter=0
  264. HoleCounter=0
  265. bgpos=6
  266. kgpos=0
  267.  
  268. For each obj in AllLights
  269. obj.state=0
  270. next
  271.  
  272. ScoreLight.state=0
  273. dooralreadyopen=0
  274. kgdooralreadyopen=0
  275. Bumper1Light.state=0
  276. Bumper2Light.state=0
  277. Bumper3Light.state=0
  278.  
  279.  
  280.  
  281. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)+"0"
  282.  
  283. RefreshReplayCard
  284. ' ResetBalls
  285. ' PlaySound "Plunger"
  286.  
  287. TargetSpecialLit = 0
  288. Points210counter=0
  289. Points500counter=0
  290. Points1000counter=0
  291. Points2000counter=0
  292. BonusBooster=3
  293. BonusBoosterCounter=0
  294. Players=0
  295. RotatorTemp=1
  296. InProgress=false
  297.  
  298. ScoreText.text=HighScore
  299.  
  300.  
  301. If B2SOn Then
  302.  
  303.  
  304. if Match=0 then
  305. Controller.B2SSetMatch 10
  306. else
  307. Controller.B2SSetMatch Match/10
  308. end if
  309. Controller.B2SSetScoreRolloverPlayer1 0
  310.  
  311. Controller.B2SSetScore 3,HighScore
  312. Controller.B2SSetTilt 1
  313. Controller.B2SSetCredits Credits
  314. Controller.B2SSetGameOver 1
  315. End If
  316.  
  317. EMReel10.SetValue(Credits)
  318. for i=1 to 1
  319. player=i
  320. If B2SOn Then
  321. Controller.B2SSetScorePlayer player, 0
  322. End If
  323. next
  324. bump1=1
  325. bump2=1
  326. bump3=1
  327. bump4=1
  328. InitPauser5.enabled=true
  329. If Credits > 0 Then DOF 125, DOFOn
  330.  
  331. End Sub
  332.  
  333. Sub Table1_exit()
  334. savehs
  335. SaveLMEMConfig
  336. SaveLMEMConfig2
  337. If B2SOn Then Controller.Stop
  338. end sub
  339.  
  340. Sub TimerTitle1_timer
  341. if B2SOn then
  342. if raceRflag=1 then
  343. Controller.B2SSetData 11,0
  344. raceRflag=0
  345. else
  346. Controller.B2SSetData 11,1
  347. raceRflag=1
  348. end if
  349. end if
  350. end sub
  351.  
  352. Sub TimerTitle2_timer
  353. if B2SOn then
  354. if raceAflag=1 then
  355. Controller.B2SSetData 12,0
  356. raceAflag=0
  357. else
  358. Controller.B2SSetData 12,1
  359. raceAflag=1
  360. end if
  361. end if
  362. end sub
  363.  
  364. Sub TimerTitle3_timer
  365. if B2SOn then
  366. if raceCflag=1 then
  367. Controller.B2SSetData 13,0
  368. raceCflag=0
  369. else
  370. Controller.B2SSetData 13,1
  371. raceCflag=1
  372. end if
  373. end if
  374. end sub
  375.  
  376. Sub TimerTitle4_timer
  377. if B2SOn then
  378. if raceEflag=1 then
  379. Controller.B2SSetData 10,0
  380. raceEflag=0
  381. else
  382. Controller.B2SSetData 10,1
  383. raceEflag=1
  384. end if
  385. end if
  386. end sub
  387.  
  388.  
  389.  
  390. Sub Table1_KeyDown(ByVal keycode)
  391.  
  392. ' GNMOD
  393. if EnteringInitials then
  394. CollectInitials(keycode)
  395. exit sub
  396. end if
  397.  
  398.  
  399. if EnteringOptions then
  400. CollectOptions(keycode)
  401. exit sub
  402. end if
  403.  
  404.  
  405.  
  406. If keycode = PlungerKey Then
  407. Plunger.PullBack
  408. PlungerPulled = 1
  409. End If
  410.  
  411. if keycode = LeftFlipperKey and InProgress = false then
  412. OperatorMenuTimer.Enabled = true
  413. end if
  414. ' END GNMOD
  415.  
  416.  
  417. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  418. LeftFlipper.RotateToEnd
  419. PlaySound SoundFXDOF("FlipperUp",101,DOFOn,DOFFlippers)
  420. PlaySound "buzzL",-1
  421. End If
  422.  
  423. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  424. RightFlipper.RotateToEnd
  425. PlaySound "buzz",-1
  426. PlaySound SoundFXDOF("FlipperUp",102,DOFOn,DOFFlippers)
  427. End If
  428.  
  429. If keycode = LeftTiltKey Then
  430. Nudge 90, 2
  431. TiltIt
  432. End If
  433.  
  434. If keycode = RightTiltKey Then
  435. Nudge 270, 2
  436. TiltIt
  437. End If
  438.  
  439. If keycode = CenterTiltKey Then
  440. Nudge 0, 2
  441. TiltIt
  442. End If
  443.  
  444. If keycode = MechanicalTilt Then
  445. TiltCount=2
  446. TiltIt
  447. End If
  448.  
  449.  
  450. If keycode = AddCreditKey or keycode = 4 then
  451. If B2SOn Then
  452. 'Controller.B2SSetScorePlayer6 HighScore
  453.  
  454. End If
  455.  
  456. playsound "coinin"
  457. AddSpecial2
  458. end if
  459.  
  460. if keycode = 5 then
  461. playsound "coinin"
  462. AddSpecial2
  463. keycode= StartGameKey
  464. end if
  465.  
  466.  
  467.  
  468.  
  469. ' if keycode = 2 and Credits>0 and InProgress=true and Players>0 and Players<4 and BallInPlay<2 then
  470. ' Credits=Credits-1
  471. ' Players=Players+1
  472. ' playsound "click"
  473. ' If B2SOn Then
  474. ' Controller.B2SSetCanPlay Players
  475. ' If Players=2 Then
  476. ' Controller.B2SSetScoreRolloverPlayer2 0
  477. ' End If
  478. ' If Players=3 Then
  479. ' Controller.B2SSetScoreRolloverPlayer3 0
  480. ' End If
  481. ' If Players=4 Then
  482. ' Controller.B2SSetScoreRolloverPlayer4 0
  483. ' End If
  484. ' Controller.B2SSetCredits Credits
  485. ' End If
  486. ' end if
  487.  
  488. if keycode=StartGameKey and Credits>0 and InProgress=false and Players=0 and EnteringOptions = 0 then
  489. 'GNMOD
  490. OperatorMenuTimer.Enabled = false
  491. 'END GNMOD
  492. Credits=Credits-1
  493. If Credits < 1 Then DOF 125, DOFOff
  494. EMReel10.SetValue(Credits)
  495. Players=1
  496. MatchReel.SetValue(0)
  497. Reel1000.setvalue(0)
  498.  
  499. Player=1
  500. playsound "startup_norm"
  501. TempPlayerUp=Player
  502. ' PlayerUpRotator.enabled=true
  503. rst=0
  504. BallInPlay=1
  505. ScoreLight.state=1
  506. InProgress=true
  507. resettimer.enabled=true
  508. BonusMultiplier=1
  509. If B2SOn Then
  510. Controller.B2SSetTilt 0
  511. Controller.B2SSetGameOver 0
  512. Controller.B2SSetMatch 0
  513. Controller.B2SSetCredits Credits
  514. Controller.B2SSetScore 3,HighScore
  515. ' Controller.B2SSetCanPlay 1
  516. Controller.B2SSetPlayerUp 1
  517. ' Controller.B2SSetBallInPlay BallInPlay
  518. Controller.B2SSetScoreRolloverPlayer1 0
  519. Controller.B2SSetShootAgain 0
  520.  
  521. Controller.B2SSetData 11,0
  522. Controller.B2SSetData 12,0
  523. Controller.B2SSetData 13,0
  524. Controller.B2SSetData 10,0
  525. Controller.B2SSetData 99,0
  526. End If
  527. If Table1.ShowDT = True then
  528. For each obj in PlayerScores
  529. ' obj.ResetToZero
  530. obj.Visible=true
  531. next
  532.  
  533.  
  534. For each obj in PlayerHuds
  535. obj.SetValue(0)
  536. next
  537.  
  538. PlayerHuds(Player-1).SetValue(1)
  539. PlayerScores(Player-1).visible=0
  540. PlayerScoresOn(Player-1).visible=1
  541.  
  542. end If
  543. ' EMReel1.ResetToZero
  544. end if
  545.  
  546.  
  547.  
  548. End Sub
  549.  
  550. Sub Table1_KeyUp(ByVal keycode)
  551.  
  552. ' GNMOD
  553. if EnteringInitials then
  554. exit sub
  555. end if
  556.  
  557. If keycode = PlungerKey Then
  558.  
  559. if PlungerPulled = 0 then
  560. exit sub
  561. end if
  562.  
  563. PlaySound"plungerrelease"
  564. Plunger.Fire
  565. End If
  566.  
  567. if keycode = LeftFlipperKey then
  568. OperatorMenuTimer.Enabled = false
  569. end if
  570.  
  571. ' END GNMOD
  572.  
  573. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  574. LeftFlipper.RotateToStart
  575. PlaySound SoundFXDOF("FlipperDown",101,DOFOff,DOFFlippers)
  576. StopSound "buzzL"
  577. End If
  578.  
  579. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  580. RightFlipper.RotateToStart
  581. StopSound "buzz"
  582. PlaySound SoundFXDOF("FlipperDown",102,DOFOff,DOFFlippers)
  583. End If
  584.  
  585. End Sub
  586.  
  587.  
  588.  
  589. Sub Drain_Hit()
  590.  
  591. DOF 127, DOFPulse
  592. Drain.DestroyBall
  593. PlaySound "fx_drain"
  594. ' AddBonus
  595. Pause4Bonustimer.enabled=true
  596.  
  597.  
  598. End Sub
  599.  
  600. Sub CloseGateTrigger_hit
  601. DOF 126, DOFPulse
  602. End Sub
  603.  
  604. Sub Pause4Bonustimer_timer
  605. Pause4Bonustimer.enabled=0
  606. NextBallDelay.enabled=true
  607.  
  608. End Sub
  609.  
  610. '***********************
  611. ' Flipper Logos
  612. '***********************
  613.  
  614. Sub UpdateFlipperLogos_Timer
  615. LFlip.RotZ = LeftFlipper.CurrentAngle
  616. RFlip.RotZ = RightFlipper.CurrentAngle
  617. LFlip1.RotZ = LeftFlipper.CurrentAngle
  618. RFlip1.RotZ = RightFlipper.CurrentAngle
  619.  
  620. PGate.Rotz = (Gate.CurrentAngle*.75) + 25
  621. FlipperLSh.RotZ = LeftFlipper.currentangle
  622. FlipperRSh.RotZ = RightFlipper.currentangle
  623. End Sub
  624.  
  625.  
  626.  
  627. '***********************
  628. ' slingshots
  629. '
  630.  
  631. Sub RightSlingShot_Slingshot
  632. PlaySound SoundFXDOF("right_slingshot",104,DOFPulse,DOFContactors), 0, 1, 0.05, 0.05
  633. DOF 133, DOFPulse
  634. RSling0.Visible = 0
  635. RSling1.Visible = 1
  636. sling1.TransZ = -20
  637. RStep = 0
  638. RightSlingShot.TimerEnabled = 1
  639. If RightSlingLight.state=1 then
  640. AddScore 10
  641. else
  642. AddScore 1
  643. end if
  644. End Sub
  645.  
  646. Sub RightSlingShot_Timer
  647. Select Case RStep
  648. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  649. Case 4:RSLing2.Visible = 0:RSling0.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  650. End Select
  651. RStep = RStep + 1
  652. End Sub
  653.  
  654. Sub LeftSlingShot_Slingshot
  655. PlaySound SoundFXDOF("left_slingshot",103,DOFPulse,DOFContactors),0,1,-0.05,0.05
  656. DOF 132, DOFPulse
  657. LSling0.Visible = 0
  658. LSling1.Visible = 1
  659. sling2.TransZ = -20
  660. LStep = 0
  661. LeftSlingShot.TimerEnabled = 1
  662. If LeftSlingLight.state=1 then
  663. AddScore 10
  664. else
  665. AddScore 1
  666. end if
  667. End Sub
  668.  
  669. Sub LeftSlingShot_Timer
  670. Select Case LStep
  671. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  672. Case 4:LSLing2.Visible = 0:LSLing0.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  673. End Select
  674. LStep = LStep + 1
  675. End Sub
  676.  
  677. '***********************************
  678. ' Walls
  679. '***********************************
  680.  
  681. Sub RubberWallSwitches_Hit(idx)
  682. if TableTilted=false then
  683. Select Case idx
  684. Case 0,1: AddScore(1)
  685. end Select
  686. end if
  687. end Sub
  688.  
  689. '**********************************************************
  690.  
  691. Sub Bumper1_Hit
  692. If TableTilted=false then
  693. DOF 129, DOFPulse
  694. PlaySound SoundFXDOF("bumper1",105,DOFPulse,DOFContactors)
  695. bump1 = 1
  696. If Bumper1Light.visible=true then
  697. AddScore(10)
  698. else
  699. AddScore(1)
  700. end if
  701. end if
  702.  
  703. End Sub
  704.  
  705.  
  706. Sub Bumper2_Hit
  707. If TableTilted=false then
  708. DOF 130, DOFPulse
  709. PlaySound SoundFXDOF("bumper1",106,DOFPulse,DOFContactors)
  710. bump2 = 1
  711.  
  712. If Bumper2Light.visible=true then
  713. AddScore(10)
  714. else
  715. AddScore(1)
  716. end if
  717. end if
  718. end sub
  719.  
  720.  
  721. Sub Bumper3_Hit
  722. If TableTilted=false then
  723. DOF 131, DOFPulse
  724. PlaySound SoundFXDOF("bumper1",107,DOFPulse,DOFContactors)
  725. bump3 = 1
  726. If Bumper3Light.visible=true then
  727. AddScore(10)
  728. else
  729. AddScore(1)
  730. end if
  731. end if
  732.  
  733. End Sub
  734.  
  735.  
  736. '***********************************
  737.  
  738. Sub TriggerLight9_Hit()
  739. If TableTilted=false then
  740. PlaySound "sensor"
  741. DOF 109,DOFPulse
  742. if LightNumber9.state=1 then
  743. LightNumber9.state=0
  744. BackglassCard7.SetValue(1)
  745. If BallsPerGame = 3 then
  746. LightNumber2.state=0
  747. BackglassCard0.SetValue(1)
  748. If B2SOn then
  749. Controller.B2SSetData 80,1
  750. end if
  751. end if
  752. If B2SOn then
  753. Controller.B2SSetData 87,1
  754. end if
  755. SetMotor(50)
  756. CheckAllLights
  757. else
  758. SetMotor(5)
  759. end if
  760. RotoSpin
  761. end if
  762. End Sub
  763.  
  764. Sub TriggerLight8_Hit()
  765. If TableTilted=false then
  766. PlaySound "sensor"
  767. DOF 110,DOFPulse
  768. if LightNumber8.state=1 then
  769. LightNumber8.state=0
  770. BackglassCard6.SetValue(1)
  771. If B2SOn then
  772. Controller.B2SSetData 86,1
  773. end if
  774. SetMotor(50)
  775. CheckAllLights
  776. else
  777. SetMotor(5)
  778. end if
  779. RotoSpin
  780. end if
  781. End Sub
  782.  
  783. Sub TriggerLight7_Hit()
  784. If TableTilted=false then
  785. PlaySound "sensor"
  786. DOF 111,DOFPulse
  787. if LightNumber7.state=1 then
  788. LightNumber7.state=0
  789. BackglassCard5.SetValue(1)
  790. If B2SOn then
  791. Controller.B2SSetData 85,1
  792. end if
  793. SetMotor(50)
  794. CheckAllLights
  795. else
  796. SetMotor(5)
  797. end if
  798. RotoSpin
  799. end if
  800. End Sub
  801.  
  802. Sub TriggerLight6_Hit()
  803. If TableTilted=false then
  804. PlaySound "sensor"
  805. DOF 112,DOFPulse
  806. if LightNumber6.state=1 then
  807. LightNumber6.state=0
  808. BackglassCard4.SetValue(1)
  809. If BallsPerGame = 3 then
  810. LightNumber3.state=0
  811. BackglassCard1.SetValue(1)
  812. If B2SOn then
  813. Controller.B2SSetData 81,1
  814. end if
  815. end if
  816. If B2SOn then
  817. Controller.B2SSetData 84,1
  818. end if
  819. SetMotor(50)
  820. CheckAllLights
  821. else
  822. SetMotor(5)
  823. end if
  824. RotoSpin
  825. end if
  826. End Sub
  827.  
  828. Sub TriggerLight5_Hit()
  829. DOF 117, DOFPulse
  830. If TableTilted=false then
  831. PlaySound "sensor"
  832. if LightNumber5.state=1 then
  833. LightNumber5.state=0
  834. BackglassCard3.SetValue(1)
  835. If B2SOn then
  836. Controller.B2SSetData 83,1
  837. end if
  838. SetMotor(50)
  839. CheckAllLights
  840. else
  841. SetMotor(5)
  842. end if
  843. RotoSpin
  844. end if
  845. End Sub
  846.  
  847. Sub TriggerLight4_Hit()
  848. DOF 118, DOFPulse
  849. If TableTilted=false then
  850. PlaySound "sensor"
  851. if LightNumber4.state=1 then
  852. LightNumber4.state=0
  853. BackglassCard2.SetValue(1)
  854. If B2SOn then
  855. Controller.B2SSetData 82,1
  856. end if
  857. SetMotor(50)
  858. CheckAllLights
  859. else
  860. SetMotor(5)
  861. end if
  862. RotoSpin
  863. end if
  864. End Sub
  865.  
  866. Sub TriggerLeftOutlane_Hit()
  867. DOF 119, DOFPulse
  868. If TableTilted=false then
  869. PlaySound "sensor"
  870. if LightNumber3.state=1 then
  871. LightNumber3.state=0
  872. BackglassCard1.SetValue(1)
  873. If BallsPerGame = 3 then
  874. LightNumber6.state=0
  875. BackglassCard4.SetValue(1)
  876. If B2SOn then
  877. Controller.B2SSetData 84,1
  878. end if
  879. end if
  880. If B2SOn then
  881. Controller.B2SSetData 81,1
  882. end if
  883. SetMotor(50)
  884. CheckAllLights
  885. else
  886. SetMotor(5)
  887. end if
  888. RotoSpin
  889. end if
  890. End Sub
  891.  
  892. Sub TriggerRightOutlane_Hit()
  893. DOF 122, DOFPulse
  894. If TableTilted=false then
  895. PlaySound "sensor"
  896. if LightNumber2.state=1 then
  897. LightNumber2.state=0
  898. BackglassCard0.SetValue(1)
  899. If BallsPerGame = 3 then
  900. LightNumber9.state=0
  901. BackglassCard7.SetValue(1)
  902. If B2SOn then
  903. Controller.B2SSetData 87,1
  904. end if
  905. end if
  906. If B2SOn then
  907. Controller.B2SSetData 80,1
  908. end if
  909. SetMotor(50)
  910. CheckAllLights
  911. else
  912. SetMotor(5)
  913. end if
  914. RotoSpin
  915. end if
  916. End Sub
  917.  
  918. Sub TriggerLeftInlane_Hit
  919. DOF 120, DOFPulse
  920. If TableTilted=false then
  921. PlaySound "sensor"
  922. if LeftSpecialLight.state=1 then
  923. AddSpecial
  924. end if
  925. If Left100Light.state=1 then
  926. AddScore(100)
  927. else
  928. SetMotor(50)
  929. end if
  930. RotoSpin
  931. end if
  932. end sub
  933.  
  934. Sub TriggerRightInlane_Hit
  935. DOF 121, DOFPulse
  936. If TableTilted=false then
  937. PlaySound "sensor"
  938. if RightSpecialLight.state=1 then
  939. AddSpecial
  940. end if
  941. If Right100Light.state=1 then
  942. AddScore(100)
  943. else
  944. SetMotor(50)
  945. end if
  946. RotoSpin
  947. end if
  948. end sub
  949.  
  950. '****************************************************
  951. Sub TargetA_Hit()
  952. DOF 108, DOFPulse
  953. if TableTilted=false then
  954. TargetLight12_1.state=0
  955. TargetLight12_2.state=0
  956. Bumper2Light.state=1
  957. SetMotor(50)
  958. CardRack(12).SetValue(1)
  959. If B2SOn then
  960. Controller.B2SSetData 92,1
  961. end if
  962. CheckAllLights
  963.  
  964. end if
  965. end sub
  966.  
  967. Sub TargetK_Hit()
  968. DOF 114, DOFPulse
  969. if TableTilted=false then
  970. TargetLightK_1.state=0
  971. TargetLightK_2.state=0
  972. Bumper1Light.state=1
  973. SetMotor(50)
  974. CardRack(11).SetValue(1)
  975. If B2SOn then
  976. Controller.B2SSetData 91,1
  977. end if
  978. CheckAllLights
  979.  
  980. end if
  981. end sub
  982.  
  983. Sub TargetQ_Hit()
  984. DOF 116, DOFPulse
  985. if TableTilted=false then
  986. TargetLightQ_1.state=0
  987. TargetLightQ_2.state=0
  988. Bumper3Light.state=1
  989. SetMotor(50)
  990. CardRack(10).SetValue(1)
  991. If B2SOn then
  992. Controller.B2SSetData 90,1
  993. end if
  994. CheckAllLights
  995.  
  996. end if
  997. end sub
  998.  
  999. Sub TargetJ_Hit()
  1000. DOF 113, DOFPulse
  1001. if TableTilted=false then
  1002. TargetLightJ_1.state=0
  1003. TargetLightJ_2.state=0
  1004.  
  1005. SetMotor(50)
  1006. CardRack(9).SetValue(1)
  1007. If B2SOn then
  1008. Controller.B2SSetData 89,1
  1009. end if
  1010. CheckAllLights
  1011.  
  1012. end if
  1013. end sub
  1014.  
  1015. Sub Target10_Hit()
  1016. DOF 115, DOFPulse
  1017. if TableTilted=false then
  1018. TargetLight10_1.state=0
  1019. TargetLight10_2.state=0
  1020.  
  1021. SetMotor(50)
  1022. CardRack(8).SetValue(1)
  1023. If B2SOn then
  1024. Controller.B2SSetData 88,1
  1025. end if
  1026. CheckAllLights
  1027.  
  1028. end if
  1029. end sub
  1030.  
  1031.  
  1032. '****************************************************
  1033. Sub RotoSpin()
  1034. Dim X22
  1035. X22=INT(RND()*10) ' get random Number from 0-9
  1036. If X22 < 4 Then
  1037. ' 40% of Time advance 3 positions
  1038. RotoCycles=6
  1039. Else
  1040. If X22 < 8 Then
  1041. ' 40% of Time Advance 4 Positions
  1042. RotoCycles=8
  1043. Else
  1044. ' 20% of Time Advance 5 Positions
  1045. RotoCycles=10
  1046. End If
  1047. End if
  1048. RotoFlip=1
  1049. RotoTimer.enabled=1
  1050. StopSound "BuzzLeft" ' In Case Quick Hit
  1051. PlaySound SoundFXDOF("RotoStart",128,DOFPulse,DOFGear) ' Sound "Kick" Solenoid
  1052. End Sub
  1053. '
  1054. ' RotoWheel Spin Animation Timer moves Through the Animation Stages
  1055. Sub RotoTimer_timer
  1056. RotoPosition=RotoPosition+1
  1057. if RotoPosition>14 then
  1058. RotoPosition=0
  1059. end if
  1060. RotoA.image = "Roto_T1_"&RotoMain1(RotoPosition)
  1061.  
  1062. RotoB.image = "Roto_T1_"&RotoMain2(RotoPosition)
  1063.  
  1064. RotoC.image = "Roto_T1_"&RotoMain3(RotoPosition)
  1065.  
  1066. RotoD.image = "Roto_T1_"&RotoMain4(RotoPosition)
  1067.  
  1068. RotoE.image = "Roto_T1_"&RotoMain5(RotoPosition)
  1069.  
  1070. Roto1.image = "Roto_T1_"&RotoMainMotion0(RotoPosition)
  1071.  
  1072. Roto2.image = "Roto_T1_"&RotoMainMotion1(RotoPosition)
  1073.  
  1074. Roto3.image = "Roto_T1_"&RotoMainMotion2(RotoPosition)
  1075.  
  1076. Roto4.image = "Roto_T1_"&RotoMainMotion3(RotoPosition)
  1077.  
  1078. Roto5.image = "Roto_T1_"&RotoMainMotion4(RotoPosition)
  1079.  
  1080. Roto6.image = "Roto_T1_"&RotoMainMotion5(RotoPosition)
  1081.  
  1082.  
  1083.  
  1084. if RotoFlip = 0 then
  1085. For each obj in RotoTargets
  1086. obj.visible=false
  1087. next
  1088. for each obj in RotoTargetsMotion
  1089. obj.visible=true
  1090. next
  1091. for each obj in RotoTargetsHit
  1092. obj.collidable = false
  1093. next
  1094. for each obj in RotoTargetsMotionHit
  1095. obj.collidable = true
  1096. next
  1097. RotoFlip=1
  1098. else
  1099. For each obj in RotoTargets
  1100. obj.visible=true
  1101. next
  1102. for each obj in RotoTargetsMotion
  1103. obj.visible=false
  1104. next
  1105. for each obj in RotoTargetsHit
  1106. obj.collidable = true
  1107. next
  1108. for each obj in RotoTargetsMotionHit
  1109. obj.collidable = false
  1110. next
  1111.  
  1112. RotoFlip=0
  1113. end if
  1114. RotoCycles=RotoCycles-1
  1115. If RotoCycles<1 then
  1116. For each obj in RotoTargets
  1117. obj.visible=true
  1118. next
  1119. for each obj in RotoTargetsMotion
  1120. obj.visible=false
  1121. next
  1122. for each obj in RotoTargetsHit
  1123. obj.collidable = true
  1124. next
  1125. for each obj in RotoTargetsMotionHit
  1126. obj.collidable = false
  1127. next
  1128. RotoFlip=0
  1129. RotoTimer.enabled=0
  1130. end if
  1131. end sub
  1132.  
  1133.  
  1134. '****************************************************
  1135. Sub RotoTargetsMotionHit_Hit(idx)
  1136. If RotoFlip=0 or TableTilted=true then
  1137. Exit sub
  1138. end if
  1139. mover=idx
  1140. ScoreHitRoto
  1141. end sub
  1142.  
  1143. Sub RotoTargetsHit_Hit(idx)
  1144. If RotoFlip=1 or TableTilted=true then
  1145. Exit sub
  1146. end if
  1147. DOF 134, DOFPulse
  1148. mover=idx
  1149. RotoTargets(idx).transX=-5
  1150. RotoNumAlt5.TimerEnabled=true
  1151. ScoreHitRoto
  1152. end sub
  1153.  
  1154. Sub RotoNumAlt5_timer()
  1155. For each obj in RotoTargets
  1156. obj.transX=0
  1157. next
  1158. RotoNumAlt5.TimerEnabled=false
  1159. end sub
  1160.  
  1161. Sub ScoreHitRoto
  1162. Dim SpotTheRoto
  1163. SpotTheRoto = Eval("RotoID"&mover)(RotoPosition)
  1164. CardRack(SpotTheRoto).SetValue(1)
  1165. If B2SOn then
  1166. Controller.B2SSetdata SpotTheRoto+80,1
  1167. end if
  1168. Select case SpotTheRoto
  1169. case 0:
  1170. If LightNumber2.state=1 then
  1171. SetMotor(50)
  1172. LightNumber2.state=0
  1173. if BallsPerGame = 3 then
  1174. LightNumber9.state=0
  1175. BackglassCard7.SetValue(1)
  1176. If B2SOn then
  1177. Controller.B2SSetData 87,1
  1178. end if
  1179. end if
  1180. else
  1181. SetMotor(5)
  1182. end if
  1183. case 1:
  1184. If LightNumber3.state=1 then
  1185. SetMotor(50)
  1186. LightNumber3.state=0
  1187. if BallsPerGame = 3 then
  1188. LightNumber6.state=0
  1189. BackglassCard4.SetValue(1)
  1190. If B2SOn then
  1191. Controller.B2SSetData 84,1
  1192. end if
  1193. end if
  1194.  
  1195. else
  1196. SetMotor(5)
  1197. end if
  1198. case 2:
  1199. If LightNumber4.state=1 then
  1200. SetMotor(50)
  1201. LightNumber4.state=0
  1202. else
  1203. SetMotor(5)
  1204. end if
  1205. case 3:
  1206. If LightNumber5.state=1 then
  1207. SetMotor(50)
  1208. LightNumber5.state=0
  1209. else
  1210. SetMotor(5)
  1211. end if
  1212. case 4:
  1213. If LightNumber6.state=1 then
  1214. SetMotor(50)
  1215. LightNumber6.state=0
  1216. if BallsPerGame = 3 then
  1217. LightNumber3.state=0
  1218. BackglassCard1.SetValue(1)
  1219. If B2SOn then
  1220. Controller.B2SSetData 81,1
  1221. end if
  1222. end if
  1223.  
  1224. else
  1225. SetMotor(5)
  1226. end if
  1227. case 5:
  1228. If LightNumber7.state=1 then
  1229. SetMotor(50)
  1230. LightNumber7.state=0
  1231. else
  1232. SetMotor(5)
  1233. end if
  1234. case 6:
  1235. If LightNumber8.state=1 then
  1236. SetMotor(50)
  1237. LightNumber8.state=0
  1238. else
  1239. SetMotor(5)
  1240. end if
  1241. case 7:
  1242. If LightNumber9.state=1 then
  1243. SetMotor(50)
  1244. LightNumber9.state=0
  1245. if BallsPerGame = 3 then
  1246. LightNumber2.state=0
  1247. BackglassCard0.SetValue(1)
  1248. If B2SOn then
  1249. Controller.B2SSetData 80,1
  1250. end if
  1251. end if
  1252.  
  1253. else
  1254. SetMotor(5)
  1255. end if
  1256. case 8:
  1257. If TargetLight10_1.state=1 then
  1258. SetMotor(50)
  1259. TargetLight10_1.state=0
  1260. TargetLight10_2.state=0
  1261. else
  1262. SetMotor(5)
  1263. end if
  1264. case 9:
  1265. If TargetLightJ_1.state=1 then
  1266. SetMotor(50)
  1267. TargetLightJ_1.state=0
  1268. TargetLightJ_2.state=0
  1269. else
  1270. SetMotor(5)
  1271. end if
  1272. case 10:
  1273. Bumper3Light.state=1
  1274. If TargetLightQ_1.state=1 then
  1275. SetMotor(50)
  1276. TargetLightQ_1.state=0
  1277. TargetLightQ_2.state=0
  1278. else
  1279. SetMotor(5)
  1280. end if
  1281. case 11:
  1282. Bumper1Light.state=1
  1283. If TargetLightK_1.state=1 then
  1284. SetMotor(50)
  1285. TargetLightK_1.state=0
  1286. TargetLightK_2.state=0
  1287. else
  1288. SetMotor(5)
  1289. end if
  1290. case 12:
  1291. Bumper2Light.state=1
  1292. If TargetLight12_1.state=1 then
  1293. SetMotor(50)
  1294. TargetLight12_1.state=0
  1295. TargetLight12_2.state=0
  1296. else
  1297. SetMotor(5)
  1298. end if
  1299. end select
  1300.  
  1301. CheckAllLights
  1302. end sub
  1303.  
  1304. Sub CheckAllLights
  1305. dim templightcounterLow
  1306. dim templightcounterHigh
  1307. templightcounterLow=0
  1308. templightcounterHigh=0
  1309. for each obj in NumberLightsLow
  1310. if obj.state=0 then
  1311. templightcounterLow=templightcounterLow+1
  1312. end if
  1313. next
  1314. for each obj in NumberLightsHigh
  1315. if obj.state=0 then
  1316. templightcounterHigh=templightcounterHigh+1
  1317. end if
  1318. next
  1319. If templightcounterLow=8 then
  1320. RelayC=1
  1321. else
  1322. RelayC=0
  1323. end if
  1324. If SequenceCompletedHigh=true then
  1325. exit sub
  1326. else
  1327. if (templightcounterHigh=10 and templightcounterLow=8 and BallsPerGame=5) OR (templightcounterHigh=10 and BallsPerGame=3) then
  1328. SequenceCompletedHigh=true
  1329. AddSpecial
  1330. RelayE=1
  1331.  
  1332. else
  1333. RelayE=0
  1334. end if
  1335. end if
  1336.  
  1337. end sub
  1338. '****************************************************
  1339.  
  1340. '
  1341. '
  1342. ' Relay Timers
  1343. '
  1344. '
  1345. Sub TimerAlternatingRelay_timer
  1346. if InProgress=true then
  1347.  
  1348. if RelayB=0 then
  1349. RightSpecialLight.state=0
  1350. RightSlingLight.state=0
  1351. If BallsPerGame=3 then
  1352. RightSlingLight.state=1
  1353. end if
  1354. Right100Light.state=0
  1355. LeftSlingLight.state=1
  1356. If RelayC=1 then
  1357. LeftSpecialLight.state=1
  1358. Left100Light.state=0
  1359. If BallsPerGame=3 then
  1360. RightSpecialLight.state=1
  1361. Right100Light.state=0
  1362. end if
  1363. else
  1364. LeftSpecialLight.state=0
  1365. Left100Light.state=1
  1366. If BallsPerGame=3 then
  1367. RightSpecialLight.state=0
  1368. Right100Light.state=1
  1369. end if
  1370.  
  1371. end if
  1372.  
  1373. else
  1374. LeftSpecialLight.state=0
  1375. LeftSlingLight.state=0
  1376. If BallsPerGame=3 then
  1377. LeftSlingLight.state=1
  1378. end if
  1379. Left100Light.state=0
  1380. RightSlingLight.state=1
  1381. If RelayC=1 then
  1382. RightSpecialLight.state=1
  1383. Right100Light.state=0
  1384. If BallsPerGame=3 then
  1385. LeftSpecialLight.state=1
  1386. Left100Light.state=0
  1387. end if
  1388. else
  1389. RightSpecialLight.state=0
  1390. Right100Light.state=1
  1391. If BallsPerGame=3 then
  1392. LeftSpecialLight.state=0
  1393. Left100Light.state=1
  1394. end if
  1395. end if
  1396. end if
  1397. BumpersOn
  1398. end if
  1399. end sub
  1400.  
  1401. Sub TimerCRelay_timer
  1402.  
  1403. if InProgress=true then
  1404.  
  1405. if RelayC=1 then
  1406. if RelayB=0 then
  1407. LeftSpecialLight.state=1
  1408. Left100Light.state=0
  1409. else
  1410. RightSpecialLight.state=1
  1411. Right100Light.state=0
  1412. end if
  1413. else
  1414. if RelayB=0 then
  1415. LeftSpecialLight.state=0
  1416. Left100Light.state=1
  1417. else
  1418. RightSpecialLight.state=0
  1419. Right100Light.state=1
  1420. end if
  1421. end if
  1422.  
  1423. end if
  1424. end sub
  1425.  
  1426. Sub TimerERelay_timer
  1427. if InProgress=true then
  1428. if RelayE=1 then
  1429. for each obj in LightSpecial
  1430. obj.state=0
  1431. next
  1432. For each obj in NumberLightsHigh
  1433. obj.state=0
  1434. next
  1435. LightSpecial(AdvancePosition).state=1
  1436. NumberLightsHigh(AdvancePosition).state=1
  1437. NumberLightsHigh(AdvancePosition+5).state=1
  1438. else
  1439. for each obj in LightSpecial
  1440. obj.state=0
  1441. next
  1442.  
  1443. end if
  1444.  
  1445. end if
  1446. end sub
  1447.  
  1448.  
  1449. Sub AddSpecial()
  1450. PlaySound SoundFXDOF("knocker",124,DOFPulse,DOFKnocker)
  1451. DOF 121, DOFPulse
  1452. Credits=Credits+1
  1453. DOF 125, DOFOn
  1454. if Credits>9 then Credits=9
  1455. If B2SOn Then
  1456. Controller.B2SSetCredits Credits
  1457. End If
  1458. EMReel10.SetValue(Credits)
  1459. End Sub
  1460.  
  1461. Sub AddSpecial2()
  1462. PlaySound"click"
  1463. Credits=Credits+1
  1464. DOF 125, DOFOn
  1465. if Credits>9 then Credits=9
  1466. If B2SOn Then
  1467. Controller.B2SSetCredits Credits
  1468. End If
  1469. EMReel10.SetValue(Credits)
  1470. End Sub
  1471.  
  1472. Sub AddBonus()
  1473. bonuscountdown=bonuscounter
  1474. ScoreBonus.enabled=true
  1475. End Sub
  1476.  
  1477. Sub ToggleAlternatingRelay
  1478. If RelayB=0 then
  1479. RelayB=1
  1480. else
  1481. RelayB=0
  1482. end if
  1483. AdvancePosition=AdvancePosition+1
  1484. If AdvancePosition>4 then
  1485. AdvancePosition=0
  1486. end if
  1487. end sub
  1488.  
  1489.  
  1490. Sub ResetBallDrops()
  1491. SequenceCompletedHigh=false
  1492. For each obj in CardRack
  1493. obj.SetValue(0)
  1494. next
  1495. If B2SOn then
  1496. for i=80 to 92
  1497. Controller.B2SSetdata i,0
  1498. next
  1499. end if
  1500. For each obj in NumberLightsOn
  1501. obj.state=1
  1502. next
  1503.  
  1504. BonusCounter=0
  1505. HoleCounter=0
  1506. End Sub
  1507.  
  1508.  
  1509. Sub LightsOut
  1510. BonusCounter=0
  1511. HoleCounter=0
  1512.  
  1513. Bumper1Light.state=0
  1514.  
  1515. Bumper2Light.state=0
  1516.  
  1517. Bumper3Light.state=0
  1518.  
  1519. For each obj in AllLights
  1520. obj.state=0
  1521. next
  1522.  
  1523. end sub
  1524.  
  1525. Sub ResetDrops()
  1526.  
  1527.  
  1528.  
  1529. End Sub
  1530.  
  1531. Sub ResetBalls()
  1532.  
  1533. TempMultiCounter=BallsPerGame-BallInPlay
  1534.  
  1535.  
  1536.  
  1537. BonusMultiplier=1
  1538.  
  1539. TableTilted=false
  1540. TiltReel.SetValue(0)
  1541. If B2Son then
  1542. Controller.B2SSetTilt 0
  1543. end if
  1544. If BallInPlay=(BallsPerGame) then
  1545. If B2SOn then
  1546. Controller.B2SSetdata 98,1
  1547. end if
  1548. LastBallReel.SetValue(1)
  1549. end if
  1550. ScoreLight.state=1
  1551. PlasticsOn
  1552. BumpersOn
  1553.  
  1554. 'CreateBallID BallRelease
  1555. Ballrelease.CreateSizedBall 25
  1556. Ballrelease.Kick 40,7
  1557. DOF 123, DOFPulse
  1558. If BallInPlay=BallsPerGame then
  1559. if B2SOn then
  1560. Controller.B2SSetShootAgain 1
  1561. end if
  1562. end if
  1563. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)+FormatNumber(BallInPlay,0)
  1564.  
  1565.  
  1566. End Sub
  1567.  
  1568. sub delaykgclose_timer
  1569. delaykgclose.enabled=false
  1570. closekg.enabled=true
  1571.  
  1572. end sub
  1573.  
  1574. sub resettimer_timer
  1575. rst=rst+1
  1576. if rst>1 and rst<12 then
  1577. ResetReelsToZero(1)
  1578. end if
  1579. if rst=13 then
  1580. playsound "StartBall1"
  1581. end if
  1582. if rst=14 then
  1583. newgame
  1584. resettimer.enabled=false
  1585. end if
  1586. end sub
  1587.  
  1588. Sub ResetReelsToZero(reelzeroflag)
  1589. dim d1(5)
  1590. dim d2(5)
  1591. dim scorestring1, scorestring2
  1592.  
  1593. If reelzeroflag=1 then
  1594. scorestring1=CStr(Score(1))
  1595. scorestring1=right("00000" & scorestring1,5)
  1596. for i=0 to 4
  1597. d1(i)=CInt(mid(scorestring1,i+1,1))
  1598. next
  1599. for i=0 to 4
  1600. if d1(i)>0 then
  1601. d1(i)=d1(i)+1
  1602. if d1(i)>9 then d1(i)=0
  1603. end if
  1604.  
  1605. next
  1606. Score(1)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  1607. If B2SOn Then
  1608. Controller.B2SSetScorePlayer 1, Score(1)
  1609. End If
  1610. PlayerScores(0).SetValue(Score(1))
  1611. PlayerScoresOn(0).SetValue(Score(1))
  1612.  
  1613. end if
  1614. If reelzeroflag=2 then
  1615. scorestring1=CStr(Score(2))
  1616. scorestring1=right("00000" & scorestring1,5)
  1617. for i=0 to 4
  1618. d1(i)=CInt(mid(scorestring1,i+1,1))
  1619. next
  1620. for i=0 to 4
  1621. if d1(i)>0 then
  1622. d1(i)=d1(i)+1
  1623. if d1(i)>9 then d1(i)=0
  1624. end if
  1625.  
  1626. next
  1627. Score(2)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  1628. If B2SOn Then
  1629. Controller.B2SSetScorePlayer 2, Score(2)
  1630. End If
  1631. PlayerScores(1).SetValue(Score(2))
  1632. PlayerScoresOn(1).SetValue(Score(2))
  1633.  
  1634. end if
  1635.  
  1636. end sub
  1637.  
  1638. sub ScoreBonus_timer
  1639.  
  1640. if (Bonus(bonuscountdown).state=1) and (bonuscountdown>0) then
  1641. AddScore2(1000)
  1642. Bonus(bonuscountdown).state=0
  1643. If BonusMultiplier=1 then
  1644. ScoreBonus.interval=300
  1645. Else
  1646. ScoreBonus.interval=300
  1647. end if
  1648. else
  1649. ScoreBonus.interval=10
  1650. end if
  1651. bonuscountdown=bonuscountdown-1
  1652. if bonuscountdown<=0 then
  1653. ScoreBonus.enabled=false
  1654. ScoreBonus.interval=600
  1655. NextBallDelay.enabled=true
  1656. else
  1657. Bonus(bonuscountdown).state=1
  1658. end if
  1659.  
  1660. end sub
  1661.  
  1662. sub NextBallDelay_timer()
  1663. NextBallDelay.enabled=false
  1664. PlaySound"StartBall1"
  1665. nextball
  1666.  
  1667. end sub
  1668.  
  1669. sub newgame
  1670. InProgress=true
  1671. debugscore=0
  1672.  
  1673. AdvancePosition=0
  1674. MatchTextBox.text=""
  1675. BallTextBox.text=FormatNumber(BallInPlay,0)
  1676. for i = 1 to 4
  1677. Score(i)=0
  1678. Score100K(1)=0
  1679. HighScorePaid(i)=false
  1680. Replay1Paid(i)=false
  1681. Replay2Paid(i)=false
  1682. Replay3Paid(i)=false
  1683. Replay4Paid(i)=false
  1684. next
  1685. If B2SOn Then
  1686. Controller.B2SSetTilt 0
  1687. Controller.B2SSetGameOver 0
  1688. Controller.B2SSetMatch 0
  1689. Controller.B2SSetScorePlayer1 0
  1690. ' Controller.B2SSetScorePlayer2 0
  1691. ' Controller.B2SSetScorePlayer3 0
  1692. ' Controller.B2SSetScorePlayer4 0
  1693. Controller.B2SSetBallInPlay BallInPlay
  1694. End if
  1695.  
  1696.  
  1697. For each obj in NumberLightsOn
  1698. obj.state=1
  1699. next
  1700. For each obj in SpecialLights
  1701. obj.state=0
  1702. next
  1703.  
  1704. AlternatingRelay=1
  1705. ZeroNineCounter=0
  1706. FlippingFlag=0
  1707. RelayB=0
  1708. RelayC=0
  1709. RelayE=0
  1710.  
  1711. Bumper1Light.state=0
  1712. Bumper2Light.state=0
  1713. Bumper3Light.state=0
  1714. Bumper1Light.visible=0
  1715. Bumper2Light.visible=0
  1716. Bumper3Light.visible=0
  1717. If BallsPerGame=3 then
  1718. Bumper2Light.state=1
  1719. end if
  1720. ResetBallDrops
  1721. ResetDrops
  1722. ResetBalls
  1723. End sub
  1724.  
  1725. sub nextball
  1726.  
  1727. Player=Player+1
  1728. If Player>Players Then
  1729. BallInPlay=BallInPlay+1
  1730. If BallInPlay>BallsPerGame then
  1731. PlaySound("MotorLeer")
  1732. InProgress=false
  1733.  
  1734. If B2SOn Then
  1735. Controller.B2SSetGameOver 1
  1736. Controller.B2SSetShootAgain 0
  1737. Controller.B2SSetPlayerUp 0
  1738. Controller.B2SSetBallInPlay 0
  1739. ' Controller.B2SSetCanPlay 0
  1740. Controller.B2SSetData 98,0
  1741. End If
  1742. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)+"0"
  1743. ScoreLight.state=0
  1744. LastBallReel.SetValue(0)
  1745. LeftFlipper.RotateToStart
  1746. RightFlipper.RotateToStart
  1747. LightsOut
  1748. PlasticsOff
  1749. BallTextBox.text=""
  1750. checkmatch
  1751. CheckHighScore
  1752. Players=0
  1753. If Table1.ShowDT = True Then
  1754. PlayerScores(Player-1).visible=1
  1755. PlayerScoresOn(Player-1).visible=0
  1756. end If
  1757. HighScoreTimer.interval=100
  1758. HighScoreTimer.enabled=True
  1759. Else
  1760. Player=1
  1761. If B2SOn Then
  1762. Controller.B2SSetPlayerUp Player
  1763. Controller.B2SSetBallInPlay BallInPlay
  1764.  
  1765. End If
  1766. ' PlaySound("RotateThruPlayers")
  1767. TempPlayerUp=Player
  1768. ' PlayerUpRotator.enabled=true
  1769. PlayStartBall.enabled=true
  1770. BallTextBox.text=FormatNumber(BallInPlay,0)
  1771. If Table1.ShowDT = True then
  1772. For each obj in PlayerScores
  1773. obj.visible=1
  1774. Next
  1775.  
  1776. PlayerHuds(Player-1).SetValue(1)
  1777.  
  1778. end If
  1779. ResetBalls
  1780. End If
  1781. Else
  1782. If B2SOn Then
  1783. Controller.B2SSetPlayerUp Player
  1784. Controller.B2SSetBallInPlay BallInPlay
  1785. End If
  1786. ' PlaySound("RotateThruPlayers")
  1787. TempPlayerUp=Player
  1788. ' PlayerUpRotator.enabled=true
  1789. PlayStartBall.enabled=true
  1790. BallTextBox.text=FormatNumber(BallInPlay,0)
  1791. If Table1.ShowDT = True then
  1792. For each obj in PlayerScores
  1793. obj.visible=1
  1794. Next
  1795.  
  1796. PlayerHuds(Player-1).SetValue(1)
  1797.  
  1798. end If
  1799. ResetBalls
  1800. End If
  1801.  
  1802. End sub
  1803.  
  1804. sub CheckHighScore
  1805. Dim playertops
  1806. dim si
  1807. dim sj
  1808. dim stemp
  1809. dim stempplayers
  1810. for i=1 to 4
  1811. sortscores(i)=0
  1812. sortplayers(i)=0
  1813. next
  1814. playertops=0
  1815. for i = 1 to Players
  1816. sortscores(i)=Score(i)
  1817. sortplayers(i)=i
  1818. next
  1819.  
  1820. for si = 1 to Players
  1821. for sj = 1 to Players-1
  1822. if sortscores(sj)>sortscores(sj+1) then
  1823. stemp=sortscores(sj+1)
  1824. stempplayers=sortplayers(sj+1)
  1825. sortscores(sj+1)=sortscores(sj)
  1826. sortplayers(sj+1)=sortplayers(sj)
  1827. sortscores(sj)=stemp
  1828. sortplayers(sj)=stempplayers
  1829. end if
  1830. next
  1831. next
  1832. ScoreChecker=4
  1833. CheckAllScores=1
  1834. NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
  1835. savehs
  1836. end sub
  1837.  
  1838.  
  1839. sub checkmatch
  1840. Dim tempmatch
  1841. if TableTilted=true and TiltEndsGame=1 then
  1842. exit sub
  1843. end if
  1844. tempmatch=Int(Rnd*10)
  1845. Match=tempmatch
  1846. MatchReel.SetValue(tempmatch+1)
  1847. if Match=0 then
  1848. MatchTextBox.text="Match: 00"
  1849. else
  1850. MatchTextBox.text="Match: " + FormatNumber(Match,0)
  1851. end if
  1852.  
  1853. If B2SOn Then
  1854. If Match = 0 Then
  1855. Controller.B2SSetMatch 10
  1856. Else
  1857. Controller.B2SSetMatch Match
  1858. End If
  1859. End if
  1860. for i = 1 to Players
  1861. if Match=(Score(i) mod 10) then
  1862. AddSpecial
  1863. end if
  1864. next
  1865. end sub
  1866.  
  1867. Sub TiltTimer_Timer()
  1868. if TiltCount > 0 then TiltCount = TiltCount - 1
  1869. if TiltCount = 0 then
  1870. TiltTimer.Enabled = False
  1871. end if
  1872. end sub
  1873.  
  1874. Sub TiltIt()
  1875. TiltCount = TiltCount + 1
  1876. if TiltCount = 3 then
  1877. TableTilted=True
  1878. TiltReel.SetValue(1)
  1879. If TiltEndsGame=1 then
  1880. BallInPlay=BallsPerGame
  1881. If B2SOn Then
  1882. Controller.B2SSetGameOver 1
  1883. Controller.B2SSetShootAgain 0
  1884. Controller.B2SSetPlayerUp 0
  1885. Controller.B2SSetBallInPlay 0
  1886. ' Controller.B2SSetCanPlay 0
  1887. End If
  1888. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)+"0"
  1889. ScoreLight.state=0
  1890. end if
  1891. PlasticsOff
  1892. BumpersOff
  1893. ScoreLight.state=0
  1894. LeftFlipper.RotateToStart
  1895. RightFlipper.RotateToStart
  1896. If B2Son then
  1897. Controller.B2SSetTilt 1
  1898. end if
  1899. else
  1900. TiltTimer.Interval = 500
  1901. TiltTimer.Enabled = True
  1902. end if
  1903.  
  1904. end sub
  1905.  
  1906.  
  1907.  
  1908. Sub PlayStartBall_timer()
  1909.  
  1910. PlayStartBall.enabled=false
  1911. PlaySound("ballrel")
  1912. end sub
  1913.  
  1914. Sub PlayerUpRotator_timer()
  1915. If RotatorTemp<5 then
  1916. TempPlayerUp=TempPlayerUp+1
  1917. If TempPlayerUp>4 then
  1918. TempPlayerUp=1
  1919. end if
  1920. If B2SOn Then
  1921. Controller.B2SSetPlayerUp TempPlayerUp
  1922. End If
  1923.  
  1924. else
  1925. if B2SOn then
  1926. Controller.B2SSetPlayerUp Player
  1927. end if
  1928. PlayerUpRotator.enabled=false
  1929. RotatorTemp=1
  1930. end if
  1931. RotatorTemp=RotatorTemp+1
  1932.  
  1933.  
  1934. end sub
  1935.  
  1936. sub savehs
  1937. ' Based on Black's Highscore routines
  1938. Dim FileObj
  1939. Dim ScoreFile
  1940. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1941. If Not FileObj.FolderExists(UserDirectory) then
  1942. Exit Sub
  1943. End if
  1944. Set ScoreFile=FileObj.CreateTextFile(UserDirectory & HSFileName,True)
  1945. ScoreFile.WriteLine 0
  1946. ScoreFile.WriteLine Credits
  1947. scorefile.writeline BallsPerGame
  1948. scorefile.writeline TiltEndsGame
  1949. scorefile.writeline AdvanceSetting
  1950. scorefile.writeline ReplayLevel
  1951. for xx=1 to 5
  1952. scorefile.writeline HSScore(xx)
  1953. next
  1954. for xx=1 to 5
  1955. scorefile.writeline HSName(xx)
  1956. next
  1957. ScoreFile.Close
  1958. Set ScoreFile=Nothing
  1959. Set FileObj=Nothing
  1960. end sub
  1961.  
  1962. sub SaveLMEMConfig
  1963. Dim FileObj
  1964. Dim LMConfig
  1965. dim temp1
  1966. dim tempb2s
  1967. tempb2s=0
  1968. if B2SOn=true then
  1969. tempb2s=1
  1970. else
  1971. tempb2s=0
  1972. end if
  1973. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1974. If Not FileObj.FolderExists(UserDirectory) then
  1975. Exit Sub
  1976. End if
  1977. Set LMConfig=FileObj.CreateTextFile(UserDirectory & LMEMTableConfig,True)
  1978. LMConfig.WriteLine tempb2s
  1979. LMConfig.Close
  1980. Set LMConfig=Nothing
  1981. Set FileObj=Nothing
  1982.  
  1983. end Sub
  1984.  
  1985. sub LoadLMEMConfig
  1986. Dim FileObj
  1987. Dim LMConfig
  1988. dim tempC
  1989. dim tempb2s
  1990.  
  1991. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1992. If Not FileObj.FolderExists(UserDirectory) then
  1993. Exit Sub
  1994. End if
  1995. If Not FileObj.FileExists(UserDirectory & LMEMTableConfig) then
  1996. Exit Sub
  1997. End if
  1998. Set LMConfig=FileObj.GetFile(UserDirectory & LMEMTableConfig)
  1999. Set TextStr2=LMConfig.OpenAsTextStream(1,0)
  2000. If (TextStr2.AtEndOfStream=True) then
  2001. Exit Sub
  2002. End if
  2003. tempC=TextStr2.ReadLine
  2004. TextStr2.Close
  2005. tempb2s=cdbl(tempC)
  2006. if tempb2s=0 then
  2007. B2SOn=false
  2008. else
  2009. B2SOn=true
  2010. end if
  2011. Set LMConfig=Nothing
  2012. Set FileObj=Nothing
  2013. end sub
  2014.  
  2015. sub SaveLMEMConfig2
  2016. If ShadowConfigFile=false then exit sub
  2017. Dim FileObj
  2018. Dim LMConfig2
  2019. dim temp1
  2020. dim temp2
  2021. dim tempBS
  2022. dim tempFS
  2023.  
  2024. if EnableBallShadow=true then
  2025. tempBS=1
  2026. else
  2027. tempBS=0
  2028. end if
  2029. if EnableFlipperShadow=true then
  2030. tempFS=1
  2031. else
  2032. tempFS=0
  2033. end if
  2034.  
  2035. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2036. If Not FileObj.FolderExists(UserDirectory) then
  2037. Exit Sub
  2038. End if
  2039. Set LMConfig2=FileObj.CreateTextFile(UserDirectory & LMEMShadowConfig,True)
  2040. LMConfig2.WriteLine tempBS
  2041. LMConfig2.WriteLine tempFS
  2042. LMConfig2.Close
  2043. Set LMConfig2=Nothing
  2044. Set FileObj=Nothing
  2045.  
  2046. end Sub
  2047.  
  2048. sub LoadLMEMConfig2
  2049. If ShadowConfigFile=false then
  2050. EnableBallShadow = ShadowBallOn
  2051. BallShadowUpdate.enabled = ShadowBallOn
  2052. EnableFlipperShadow = ShadowFlippersOn
  2053. FlipperLSh.visible = ShadowFlippersOn
  2054. FlipperRSh.visible = ShadowFlippersOn
  2055. exit sub
  2056. end if
  2057. Dim FileObj
  2058. Dim LMConfig2
  2059. dim tempC
  2060. dim tempD
  2061. dim tempFS
  2062. dim tempBS
  2063.  
  2064. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2065. If Not FileObj.FolderExists(UserDirectory) then
  2066. Exit Sub
  2067. End if
  2068. If Not FileObj.FileExists(UserDirectory & LMEMShadowConfig) then
  2069. Exit Sub
  2070. End if
  2071. Set LMConfig2=FileObj.GetFile(UserDirectory & LMEMShadowConfig)
  2072. Set TextStr2=LMConfig2.OpenAsTextStream(1,0)
  2073. If (TextStr2.AtEndOfStream=True) then
  2074. Exit Sub
  2075. End if
  2076. tempC=TextStr2.ReadLine
  2077. tempD=TextStr2.Readline
  2078. TextStr2.Close
  2079. tempBS=cdbl(tempC)
  2080. tempFS=cdbl(tempD)
  2081. if tempBS=0 then
  2082. EnableBallShadow=false
  2083. BallShadowUpdate.enabled=false
  2084. else
  2085. EnableBallShadow=true
  2086. end if
  2087. if tempFS=0 then
  2088. EnableFlipperShadow=false
  2089. FlipperLSh.visible=false
  2090. FLipperRSh.visible=false
  2091. else
  2092. EnableFlipperShadow=true
  2093. end if
  2094. Set LMConfig2=Nothing
  2095. Set FileObj=Nothing
  2096.  
  2097. end sub
  2098.  
  2099.  
  2100. sub loadhs
  2101. ' Based on Black's Highscore routines
  2102. Dim FileObj
  2103. Dim ScoreFile
  2104. dim temp1
  2105. dim temp2
  2106. dim temp3
  2107. dim temp4
  2108. dim temp5
  2109. dim temp6
  2110. dim temp8
  2111. dim temp9
  2112. dim temp10
  2113. dim temp11
  2114. dim temp12
  2115. dim temp13
  2116. dim temp14
  2117. dim temp15
  2118. dim temp16
  2119. dim temp17
  2120.  
  2121. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2122. If Not FileObj.FolderExists(UserDirectory) then
  2123. Exit Sub
  2124. End if
  2125. If Not FileObj.FileExists(UserDirectory & HSFileName) then
  2126. Exit Sub
  2127. End if
  2128. Set ScoreFile=FileObj.GetFile(UserDirectory & HSFileName)
  2129. Set TextStr=ScoreFile.OpenAsTextStream(1,0)
  2130. If (TextStr.AtEndOfStream=True) then
  2131. Exit Sub
  2132. End if
  2133. temp1=TextStr.ReadLine
  2134. temp2=textstr.readline
  2135. temp3=textstr.readline
  2136. temp4=textstr.readline
  2137. temp5=textstr.readline
  2138. temp6=textstr.readline
  2139. HighScore=cdbl(temp1)
  2140. if HighScore<1 then
  2141.  
  2142. temp8=textstr.readline
  2143. temp9=textstr.readline
  2144. temp10=textstr.readline
  2145. temp11=textstr.readline
  2146. temp12=textstr.readline
  2147. temp13=textstr.readline
  2148. temp14=textstr.readline
  2149. temp15=textstr.readline
  2150. temp16=textstr.readline
  2151. temp17=textstr.readline
  2152. end if
  2153. TextStr.Close
  2154. Credits=cdbl(temp2)
  2155. BallsPerGame=cdbl(temp3)
  2156. TiltEndsGame=cdbl(temp4)
  2157. AdvanceSetting=cdbl(temp5)
  2158. ReplayLevel=cdbl(temp6)
  2159. if HighScore<1 then
  2160. HSScore(1) = int(temp8)
  2161. HSScore(2) = int(temp9)
  2162. HSScore(3) = int(temp10)
  2163. HSScore(4) = int(temp11)
  2164. HSScore(5) = int(temp12)
  2165.  
  2166. HSName(1) = temp13
  2167. HSName(2) = temp14
  2168. HSName(3) = temp15
  2169. HSName(4) = temp16
  2170. HSName(5) = temp17
  2171. end if
  2172. Set ScoreFile=Nothing
  2173. Set FileObj=Nothing
  2174. end sub
  2175.  
  2176. Sub DisplayHighScore
  2177.  
  2178.  
  2179. end sub
  2180.  
  2181. sub InitPauser5_timer
  2182. If B2SOn Then
  2183. Controller.B2SSetScore 3,HighScore
  2184. End If
  2185. DisplayHighScore
  2186. InitPauser5.enabled=false
  2187. end sub
  2188.  
  2189. sub ResetDropsTimer_timer
  2190. ResetDropsTimer.enabled=0
  2191. ResetDrops
  2192. end sub
  2193.  
  2194. sub BumpersOff
  2195. Bumper1Light.visible=0
  2196. Bumper2Light.visible=0
  2197. Bumper3Light.visible=0
  2198.  
  2199.  
  2200. end sub
  2201.  
  2202. sub BumpersOn
  2203. Bumper1Light.visible=0
  2204. Bumper2Light.visible=0
  2205. Bumper3Light.visible=0
  2206.  
  2207. if MotorRunning=1 then
  2208. exit sub
  2209. end if
  2210. Bumper1Light.visible=1
  2211. Bumper2Light.visible=1
  2212. Bumper3Light.visible=1
  2213.  
  2214.  
  2215. end sub
  2216.  
  2217. Sub PlasticsOn
  2218.  
  2219. For each obj in Flashers
  2220. obj.Visible=1
  2221. next
  2222. end sub
  2223.  
  2224. Sub PlasticsOff
  2225.  
  2226. For each obj in Flashers
  2227. obj.Visible=0
  2228. next
  2229. StopSound "buzz"
  2230. StopSound "buzzL"
  2231. end sub
  2232.  
  2233. Sub SetupReplayTables
  2234.  
  2235. Replay1Table(1)=1000
  2236. Replay1Table(2)=1100
  2237. Replay1Table(3)=1100
  2238. Replay1Table(4)=1200
  2239. Replay1Table(5)=1200
  2240. Replay1Table(6)=1200
  2241. Replay1Table(7)=1300
  2242. Replay1Table(8)=1400
  2243. Replay1Table(9)=1400
  2244. Replay1Table(10)=1400
  2245. Replay1Table(11)=999000
  2246. Replay1Table(12)=999000
  2247. Replay1Table(13)=999000
  2248. Replay1Table(14)=999000
  2249. Replay1Table(15)=999000
  2250.  
  2251. Replay2Table(1)=1200
  2252. Replay2Table(2)=1300
  2253. Replay2Table(3)=1400
  2254. Replay2Table(4)=1400
  2255. Replay2Table(5)=1400
  2256. Replay2Table(6)=1500
  2257. Replay2Table(7)=1500
  2258. Replay2Table(8)=1500
  2259. Replay2Table(9)=1600
  2260. Replay2Table(10)=1700
  2261. Replay2Table(11)=999000
  2262. Replay2Table(12)=999000
  2263. Replay2Table(13)=999000
  2264. Replay2Table(14)=999000
  2265. Replay2Table(15)=999000
  2266.  
  2267. Replay3Table(1)=1400
  2268. Replay3Table(2)=1500
  2269. Replay3Table(3)=1600
  2270. Replay3Table(4)=1500
  2271. Replay3Table(5)=1600
  2272. Replay3Table(6)=1600
  2273. Replay3Table(7)=1700
  2274. Replay3Table(8)=1600
  2275. Replay3Table(9)=1700
  2276. Replay3Table(10)=1800
  2277. Replay3Table(11)=999000
  2278. Replay3Table(12)=999000
  2279. Replay3Table(13)=999000
  2280. Replay3Table(14)=999000
  2281. Replay3Table(15)=999000
  2282.  
  2283. Replay4Table(1)=1500
  2284. Replay4Table(2)=1700
  2285. Replay4Table(3)=1800
  2286. Replay4Table(4)=1600
  2287. Replay4Table(5)=1800
  2288. Replay4Table(6)=1700
  2289. Replay4Table(7)=1900
  2290. Replay4Table(8)=1700
  2291. Replay4Table(9)=1800
  2292. Replay4Table(10)=1900
  2293. Replay4Table(11)=999000
  2294. Replay4Table(12)=999000
  2295. Replay4Table(13)=999000
  2296. Replay4Table(14)=999000
  2297. Replay4Table(15)=999000
  2298.  
  2299. ReplayTableMax=10
  2300.  
  2301.  
  2302. end sub
  2303.  
  2304. Sub RefreshReplayCard
  2305. Dim tempst1
  2306. Dim tempst2
  2307.  
  2308. tempst1=FormatNumber(BallsPerGame,0)
  2309. tempst2=FormatNumber(ReplayLevel,0)
  2310.  
  2311. ReplayCard.image = "SC" + tempst2
  2312. Replay1=Replay1Table(ReplayLevel)
  2313. Replay2=Replay2Table(ReplayLevel)
  2314. Replay3=Replay3Table(ReplayLevel)
  2315. Replay4=Replay4Table(ReplayLevel)
  2316. end sub
  2317.  
  2318. '****************************************
  2319. ' SCORE MOTOR
  2320. '****************************************
  2321.  
  2322. ScoreMotorTimer.Enabled = 1
  2323. ScoreMotorTimer.Interval = 135 '135
  2324. AddScoreTimer.Enabled = 1
  2325. AddScoreTimer.Interval = 135
  2326.  
  2327. Dim queuedscore
  2328. Dim MotorMode
  2329. Dim MotorPosition
  2330.  
  2331. Sub SetMotor(y)
  2332. Select Case ScoreMotorAdjustment
  2333. Case 0:
  2334. queuedscore=queuedscore+y
  2335. Case 1:
  2336. If MotorRunning<>1 And InProgress=true then
  2337. queuedscore=queuedscore+y
  2338. end if
  2339. end Select
  2340. end sub
  2341.  
  2342. Sub SetMotor2(x)
  2343. If MotorRunning<>1 And InProgress=true then
  2344. MotorRunning=1
  2345.  
  2346. Select Case x
  2347. Case 1:
  2348. AddScore(1)
  2349. MotorRunning=0
  2350. BumpersOn
  2351.  
  2352. Case 2:
  2353. MotorMode=1
  2354. MotorPosition=2
  2355. BumpersOff
  2356. Case 3:
  2357. MotorMode=1
  2358. MotorPosition=3
  2359. BumpersOff
  2360. Case 4:
  2361. MotorMode=1
  2362. MotorPosition=4
  2363. BumpersOff
  2364. Case 5:
  2365. MotorMode=1
  2366. MotorPosition=5
  2367. BumpersOff
  2368.  
  2369. Case 10:
  2370. AddScore(10)
  2371. MotorRunning=0
  2372. BumpersOn
  2373.  
  2374. Case 20:
  2375. MotorMode=10
  2376. MotorPosition=2
  2377. BumpersOff
  2378. Case 30:
  2379. MotorMode=10
  2380. MotorPosition=3
  2381. BumpersOff
  2382. Case 40:
  2383. MotorMode=10
  2384. MotorPosition=4
  2385. BumpersOff
  2386. Case 50:
  2387. MotorMode=10
  2388. MotorPosition=5
  2389. BumpersOff
  2390. Case 100:
  2391. MotorMode=100
  2392. MotorPosition=1
  2393.  
  2394. Case 200:
  2395. MotorMode=100
  2396. MotorPosition=2
  2397.  
  2398. Case 300:
  2399. MotorMode=100
  2400. MotorPosition=3
  2401.  
  2402. Case 400:
  2403. MotorMode=100
  2404. MotorPosition=4
  2405.  
  2406. Case 500:
  2407. MotorMode=100
  2408. MotorPosition=5
  2409. 'BumpersOff
  2410. Case 1000:
  2411. MotorMode=1000
  2412. MotorPosition=1
  2413. Case 2000:
  2414. MotorMode=1000
  2415. MotorPosition=2
  2416. 'BumpersOff
  2417. Case 3000:
  2418. MotorMode=1000
  2419. MotorPosition=3
  2420. 'BumpersOff
  2421. Case 4000:
  2422. MotorMode=1000
  2423. MotorPosition=4
  2424. 'BumpersOff
  2425. Case 5000:
  2426. MotorMode=1000
  2427. MotorPosition=5
  2428. 'BumpersOff
  2429. End Select
  2430. End If
  2431. End Sub
  2432.  
  2433. Sub AddScoreTimer_Timer
  2434. Dim tempscore
  2435.  
  2436.  
  2437. If MotorRunning<>1 And InProgress=true then
  2438. if queuedscore>=5000 then
  2439. tempscore=5000
  2440. queuedscore=queuedscore-5000
  2441. SetMotor2(5000)
  2442. exit sub
  2443. end if
  2444. if queuedscore>=4000 then
  2445. tempscore=4000
  2446. queuedscore=queuedscore-4000
  2447. SetMotor2(4000)
  2448. exit sub
  2449. end if
  2450.  
  2451. if queuedscore>=3000 then
  2452. tempscore=3000
  2453. queuedscore=queuedscore-3000
  2454. SetMotor2(3000)
  2455. exit sub
  2456. end if
  2457.  
  2458. if queuedscore>=2000 then
  2459. tempscore=2000
  2460. queuedscore=queuedscore-2000
  2461. SetMotor2(2000)
  2462. exit sub
  2463. end if
  2464.  
  2465. if queuedscore>=1000 then
  2466. tempscore=1000
  2467. queuedscore=queuedscore-1000
  2468. SetMotor2(1000)
  2469. exit sub
  2470. end if
  2471.  
  2472. if queuedscore>=500 then
  2473. tempscore=500
  2474. queuedscore=queuedscore-500
  2475. SetMotor2(500)
  2476. exit sub
  2477. end if
  2478.  
  2479. if queuedscore>=100 then
  2480. tempscore=100
  2481. queuedscore=queuedscore-100
  2482. SetMotor2(100)
  2483. exit sub
  2484. end if
  2485.  
  2486. if queuedscore>=50 then
  2487. tempscore=50
  2488. queuedscore=queuedscore-50
  2489. SetMotor2(50)
  2490. exit sub
  2491. end if
  2492. if queuedscore>=40 then
  2493. tempscore=40
  2494. queuedscore=queuedscore-40
  2495. SetMotor2(40)
  2496. exit sub
  2497. end if
  2498. if queuedscore>=30 then
  2499. tempscore=30
  2500. queuedscore=queuedscore-30
  2501. SetMotor2(30)
  2502. exit sub
  2503. end if
  2504. if queuedscore>=20 then
  2505. tempscore=20
  2506. queuedscore=queuedscore-20
  2507. SetMotor2(20)
  2508. exit sub
  2509. end if
  2510. if queuedscore>=10 then
  2511. tempscore=10
  2512. queuedscore=queuedscore-10
  2513. SetMotor2(10)
  2514. exit sub
  2515. end if
  2516. if queuedscore>=5 then
  2517. tempscore=5
  2518. queuedscore=queuedscore-5
  2519. SetMotor2(5)
  2520. exit sub
  2521. end if
  2522. if queuedscore>=4 then
  2523. tempscore=4
  2524. queuedscore=queuedscore-4
  2525. SetMotor2(4)
  2526. exit sub
  2527. end if
  2528. if queuedscore>=3 then
  2529. tempscore=3
  2530. queuedscore=queuedscore-3
  2531. SetMotor2(3)
  2532. exit sub
  2533. end if
  2534. if queuedscore>=2 then
  2535. tempscore=2
  2536. queuedscore=queuedscore-2
  2537. SetMotor2(2)
  2538. exit sub
  2539. end if
  2540. if queuedscore>=1 then
  2541. tempscore=1
  2542. queuedscore=queuedscore-1
  2543. SetMotor2(1)
  2544. exit sub
  2545. end if
  2546.  
  2547. End If
  2548.  
  2549.  
  2550. end Sub
  2551.  
  2552. Sub ScoreMotorTimer_Timer
  2553. If MotorPosition > 0 Then
  2554. Select Case MotorPosition
  2555. Case 5,4,3,2:
  2556. If MotorMode=1000 Then
  2557. AddScore(1000)
  2558. end if
  2559. if MotorMode=100 then
  2560. AddScore(100)
  2561. End If
  2562. if MotorMode=10 then
  2563. AddScore(10)
  2564. End if
  2565. If MotorMode=1 then
  2566. AddScore(1)
  2567. end if
  2568. MotorPosition=MotorPosition-1
  2569. Case 1:
  2570. If MotorMode=1000 Then
  2571. AddScore(1000)
  2572. end if
  2573. If MotorMode=100 then
  2574. AddScore(100)
  2575. End If
  2576. if MotorMode=10 then
  2577. AddScore(10)
  2578. End if
  2579. If MotorMode=1 then
  2580. AddScore(1)
  2581.  
  2582. end if
  2583. MotorPosition=0:MotorRunning=0:BumpersOn
  2584. End Select
  2585. End If
  2586. End Sub
  2587.  
  2588.  
  2589. Sub AddScore(x)
  2590. If TableTilted=true then exit sub
  2591. Select Case ScoreAdditionAdjustment
  2592. Case 0:
  2593. AddScore1(x)
  2594. Case 1:
  2595. AddScore2(x)
  2596. end Select
  2597.  
  2598. end sub
  2599.  
  2600.  
  2601. Sub AddScore1(x)
  2602. ' debugtext.text=score
  2603. Select Case x
  2604. Case 1:
  2605. PlayChime(10)
  2606. Score(Player)=Score(Player)+1
  2607.  
  2608. Case 10:
  2609. PlayChime(10)
  2610. Score(Player)=Score(Player)+10
  2611. ' debugscore=debugscore+10
  2612. Case 100:
  2613. PlayChime(100)
  2614. Score(Player)=Score(Player)+100
  2615. ' debugscore=debugscore+100
  2616.  
  2617. Case 1000:
  2618. PlayChime(100)
  2619. Score(Player)=Score(Player)+1000
  2620. ' debugscore=debugscore+1000
  2621. End Select
  2622. PlayerScores(Player-1).AddValue(x)
  2623. If ScoreDisplay(Player)<100000 then
  2624. ScoreDisplay(Player)=Score(Player)
  2625. Else
  2626. Score100K(Player)=Int(Score(Player)/100000)
  2627. ScoreDisplay(Player)=Score(Player)-100000
  2628. End If
  2629. if Score(Player)=>100000 then
  2630. If B2SOn Then
  2631. If Player=1 Then
  2632. Controller.B2SSetScoreRolloverPlayer1 Score100K(Player)
  2633. End If
  2634. If Player=2 Then
  2635. Controller.B2SSetScoreRolloverPlayer2 Score100K(Player)
  2636. End If
  2637.  
  2638. If Player=3 Then
  2639. Controller.B2SSetScoreRolloverPlayer3 Score100K(Player)
  2640. End If
  2641.  
  2642. If Player=4 Then
  2643. Controller.B2SSetScoreRolloverPlayer4 Score100K(Player)
  2644. End If
  2645. End If
  2646. End If
  2647. If B2SOn Then
  2648. Controller.B2SSetScorePlayer Player, ScoreDisplay(Player)
  2649. End If
  2650. If Score(Player)>Replay1 and Replay1Paid(Player)=false then
  2651. Replay1Paid(Player)=True
  2652. AddSpecial
  2653. End If
  2654. If Score(Player)>Replay2 and Replay2Paid(Player)=false then
  2655. Replay2Paid(Player)=True
  2656. AddSpecial
  2657. End If
  2658. If Score(Player)>Replay3 and Replay3Paid(Player)=false then
  2659. Replay3Paid(Player)=True
  2660. AddSpecial
  2661. End If
  2662. If Score(Player)>Replay4 and Replay4Paid(Player)=false then
  2663. Replay4Paid(Player)=True
  2664. AddSpecial
  2665. End If
  2666. ' ScoreText.text=debugscore
  2667. End Sub
  2668.  
  2669. Sub AddScore2(x)
  2670. Dim OldScore, NewScore, OldTestScore, NewTestScore
  2671. OldScore = Score(Player)
  2672.  
  2673. Select Case x
  2674. Case 1:
  2675. Score(Player)=Score(Player)+1
  2676. Case 10:
  2677. Score(Player)=Score(Player)+10
  2678. Case 100:
  2679. Score(Player)=Score(Player)+100
  2680. Case 1000:
  2681. Score(Player)=Score(Player)+1000
  2682. End Select
  2683. NewScore = Score(Player)
  2684.  
  2685. OldTestScore = OldScore
  2686. NewTestScore = NewScore
  2687. Do
  2688. if OldTestScore < Replay1 and NewTestScore >= Replay1 then
  2689. AddSpecial()
  2690. NewTestScore = 0
  2691. Elseif OldTestScore < Replay2 and NewTestScore >= Replay2 then
  2692. AddSpecial()
  2693. NewTestScore = 0
  2694. Elseif OldTestScore < Replay3 and NewTestScore >= Replay3 then
  2695. AddSpecial()
  2696. NewTestScore = 0
  2697. Elseif OldTestScore < Replay4 and NewTestScore >= Replay4 then
  2698. AddSpecial()
  2699. NewTestScore = 0
  2700. End if
  2701. NewTestScore = NewTestScore - 100000
  2702. OldTestScore = OldTestScore - 100000
  2703. Loop While NewTestScore > 0
  2704.  
  2705. OldScore = int(OldScore / 1) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  2706. NewScore = int(NewScore / 1) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  2707. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore&", OldScore Mod 10="&OldScore Mod 10 & ", NewScore % 10="&NewScore Mod 10)
  2708.  
  2709. if (OldScore Mod 10 <> NewScore Mod 10) then
  2710. PlayChime(10)
  2711. ToggleAlternatingRelay
  2712. end if
  2713.  
  2714. OldScore = int(OldScore / 10)
  2715. NewScore = int(NewScore / 10)
  2716. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2717. if (OldScore Mod 10 <> NewScore Mod 10) then
  2718. PlayChime(10)
  2719.  
  2720. end if
  2721.  
  2722. OldScore = int(OldScore / 10)
  2723. NewScore = int(NewScore / 10)
  2724. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2725. if (OldScore Mod 10 <> NewScore Mod 10) then
  2726. PlayChime(100)
  2727.  
  2728. end if
  2729.  
  2730. OldScore = int(OldScore / 10)
  2731. NewScore = int(NewScore / 10)
  2732. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2733. if (OldScore Mod 10 <> NewScore Mod 10) then
  2734. PlayChime(1000)
  2735. end if
  2736. If Score(1)>999 then
  2737. Reel1000.SetValue(1)
  2738. end if
  2739. If B2SOn Then
  2740. Controller.B2SSetScorePlayer 1, Score(1)
  2741. If Score(1)>999 then
  2742. Controller.B2SSetData 98,0
  2743.  
  2744. Controller.B2SSetData 99,1
  2745. end if
  2746. End If
  2747. ' EMReel1.SetValue Score(Player)
  2748. PlayerScores(Player-1).AddValue(x)
  2749.  
  2750. End Sub
  2751.  
  2752.  
  2753.  
  2754. Sub PlayChime(x)
  2755. if ChimesOn=0 then
  2756. Select Case x
  2757. Case 10
  2758. If LastChime10=1 Then
  2759. PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
  2760. LastChime10=0
  2761. Else
  2762. PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
  2763. LastChime10=1
  2764. End If
  2765. Case 100,1000
  2766. If LastChime100=1 Then
  2767. PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
  2768. LastChime100=0
  2769. Else
  2770. PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
  2771. LastChime100=1
  2772. End If
  2773.  
  2774. End Select
  2775. else
  2776. Select Case x
  2777. Case 10
  2778. If LastChime10=1 Then
  2779. PlaySound SoundFXDOF("SJ_Chime_10a",141,DOFPulse,DOFChimes)
  2780. LastChime10=0
  2781. Else
  2782. PlaySound SoundFXDOF("SJ_Chime_10b",141,DOFPulse,DOFChimes)
  2783. LastChime10=1
  2784. End If
  2785. Case 100
  2786. If LastChime100=1 Then
  2787. PlaySound SoundFXDOF("SJ_Chime_100a",142,DOFPulse,DOFChimes)
  2788. LastChime100=0
  2789. Else
  2790. PlaySound SoundFXDOF("SJ_Chime_100b",142,DOFPulse,DOFChimes)
  2791. LastChime100=1
  2792. End If
  2793. Case 1000
  2794. If LastChime1000=1 Then
  2795. PlaySound SoundFXDOF("SJ_Chime_1000a",143,DOFPulse,DOFChimes)
  2796. LastChime1000=0
  2797. Else
  2798. PlaySound SoundFXDOF("SJ_Chime_1000b",143,DOFPulse,DOFChimes)
  2799. LastChime1000=1
  2800. End If
  2801. End Select
  2802. end if
  2803. End Sub
  2804.  
  2805. Sub HideOptions()
  2806.  
  2807. end sub
  2808.  
  2809. '*********************************************************************
  2810. ' Positional Sound Playback Functions
  2811. '*********************************************************************
  2812.  
  2813. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  2814. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  2815. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  2816. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  2817. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  2818. End Sub
  2819.  
  2820. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  2821. Sub PlaySoundAt(soundname, tableobj)
  2822. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  2823. End Sub
  2824.  
  2825. Sub PlaySoundAtBall(soundname)
  2826. PlaySoundAt soundname, ActiveBall
  2827. End Sub
  2828.  
  2829.  
  2830. '*********************************************************************
  2831. ' Supporting Ball & Sound Functions
  2832. '*********************************************************************
  2833.  
  2834. Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
  2835. Dim tmp
  2836. tmp = tableobj.y * 2 / table1.height-1
  2837. If tmp > 0 Then
  2838. AudioFade = Csng(tmp ^10)
  2839. Else
  2840. AudioFade = Csng(-((- tmp) ^10) )
  2841. End If
  2842. End Function
  2843.  
  2844. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  2845. Dim tmp
  2846. tmp = tableobj.x * 2 / table1.width-1
  2847. If tmp > 0 Then
  2848. AudioPan = Csng(tmp ^10)
  2849. Else
  2850. AudioPan = Csng(-((- tmp) ^10) )
  2851. End If
  2852. End Function
  2853.  
  2854. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  2855. Vol = Csng(BallVel(ball) ^2 / 2000)
  2856. End Function
  2857.  
  2858. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  2859. Pitch = BallVel(ball) * 20
  2860. End Function
  2861.  
  2862. Function BallVel(ball) 'Calculates the ball speed
  2863. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  2864. End Function
  2865.  
  2866. '*****************************************
  2867. ' JP's VP10 Rolling Sounds
  2868. '*****************************************
  2869.  
  2870. Const tnob = 5 ' total number of balls
  2871. ReDim rolling(tnob)
  2872. InitRolling
  2873.  
  2874. Sub InitRolling
  2875. Dim i
  2876. For i = 0 to tnob
  2877. rolling(i) = False
  2878. Next
  2879. End Sub
  2880.  
  2881. Sub RollingSoundTimer_Timer()
  2882. Dim BOT, b
  2883. BOT = GetBalls
  2884.  
  2885. ' stop the sound of deleted balls
  2886. For b = UBound(BOT) + 1 to tnob
  2887. rolling(b) = False
  2888. StopSound("fx_ballrolling" & b)
  2889. Next
  2890.  
  2891. ' exit the sub if no balls on the table
  2892. If UBound(BOT) = -1 Then Exit Sub
  2893.  
  2894. ' play the rolling sound for each ball
  2895. For b = 0 to UBound(BOT)
  2896. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  2897. rolling(b) = True
  2898. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  2899. Else
  2900. If rolling(b) = True Then
  2901. StopSound("fx_ballrolling" & b)
  2902. rolling(b) = False
  2903. End If
  2904. End If
  2905. Next
  2906. End Sub
  2907.  
  2908. '**********************
  2909. ' Ball Collision Sound
  2910. '**********************
  2911.  
  2912. Sub OnBallBallCollision(ball1, ball2, velocity)
  2913. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  2914. End Sub
  2915.  
  2916.  
  2917.  
  2918. '*****************************************
  2919. ' ninuzzu's BALL SHADOW
  2920. '*****************************************
  2921. Dim BallShadow
  2922. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  2923.  
  2924. Sub BallShadowUpdate_timer()
  2925. Dim BOT, b
  2926. BOT = GetBalls
  2927. ' hide shadow of deleted balls
  2928. If UBound(BOT)<(tnob-1) Then
  2929. For b = (UBound(BOT) + 1) to (tnob-1)
  2930. BallShadow(b).visible = 0
  2931. Next
  2932. End If
  2933. ' exit the Sub if no balls on the table
  2934. If UBound(BOT) = -1 Then Exit Sub
  2935. ' render the shadow for each ball
  2936. For b = 0 to UBound(BOT)
  2937. If BOT(b).X < Table1.Width/2 Then
  2938. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  2939. Else
  2940. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  2941. End If
  2942. ballShadow(b).Y = BOT(b).Y + 12
  2943. If BOT(b).Z > 20 Then
  2944. BallShadow(b).visible = 1
  2945. Else
  2946. BallShadow(b).visible = 0
  2947. End If
  2948. Next
  2949. End Sub
  2950.  
  2951. '*****************************************
  2952. ' Object sounds
  2953. '*****************************************
  2954.  
  2955. Sub Plastics_Hit (idx)
  2956. PlaySound "woodhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  2957. End Sub
  2958.  
  2959. Sub Pins_Hit (idx)
  2960. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  2961. End Sub
  2962.  
  2963. Sub Targets_Hit (idx)
  2964. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  2965. End Sub
  2966.  
  2967. Sub Metals_Thin_Hit (idx)
  2968. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2969. End Sub
  2970.  
  2971. Sub Metals_Medium_Hit (idx)
  2972. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2973. End Sub
  2974.  
  2975. Sub Metals2_Hit (idx)
  2976. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2977. End Sub
  2978.  
  2979. Sub Gates_Hit (idx)
  2980. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2981. End Sub
  2982.  
  2983. Sub Spinner_Spin
  2984. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  2985. End Sub
  2986.  
  2987. Sub Rubbers_Hit(idx)
  2988. dim finalspeed
  2989. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2990. If finalspeed > 20 then
  2991. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2992. End if
  2993. If finalspeed >= 6 AND finalspeed <= 20 then
  2994. RandomSoundRubber()
  2995. End If
  2996. End Sub
  2997.  
  2998. Sub Posts_Hit(idx)
  2999. dim finalspeed
  3000. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  3001. If finalspeed > 16 then
  3002. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3003. End if
  3004. If finalspeed >= 6 AND finalspeed <= 16 then
  3005. RandomSoundRubber()
  3006. End If
  3007. End Sub
  3008.  
  3009. Sub RandomSoundRubber()
  3010. Select Case Int(Rnd*3)+1
  3011. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3012. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3013. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3014. End Select
  3015. End Sub
  3016.  
  3017. Sub LeftFlipper_Collide(parm)
  3018. RandomSoundFlipper()
  3019. End Sub
  3020.  
  3021. Sub RightFlipper_Collide(parm)
  3022. RandomSoundFlipper()
  3023. End Sub
  3024.  
  3025. Sub RandomSoundFlipper()
  3026. Select Case Int(Rnd*3)+1
  3027. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3028. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3029. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3030. End Select
  3031. End Sub
  3032.  
  3033. ' ============================================================================================
  3034. ' GNMOD - Multiple High Score Display and Collection
  3035. ' ============================================================================================
  3036. Dim EnteringInitials ' Normally zero, set to non-zero to enter initials
  3037. EnteringInitials = 0
  3038.  
  3039. Dim PlungerPulled
  3040. PlungerPulled = 0
  3041.  
  3042. Dim SelectedChar ' character under the "cursor" when entering initials
  3043.  
  3044. Dim HSTimerCount ' Pass counter for HS timer, scores are cycled by the timer
  3045. HSTimerCount = 5 ' Timer is initially enabled, it'll wrap from 5 to 1 when it's displayed
  3046.  
  3047. Dim InitialString ' the string holding the player's initials as they're entered
  3048.  
  3049. Dim AlphaString ' A-Z, 0-9, space (_) and backspace (<)
  3050. Dim AlphaStringPos ' pointer to AlphaString, move forward and backward with flipper keys
  3051. AlphaString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_<"
  3052.  
  3053. Dim HSNewHigh ' The new score to be recorded
  3054.  
  3055. Dim HSScore(5) ' High Scores read in from config file
  3056. Dim HSName(5) ' High Score Initials read in from config file
  3057.  
  3058. ' default high scores, remove this when the scores are available from the config file
  3059. HSScore(1) = 1500
  3060. HSScore(2) = 1200
  3061. HSScore(3) = 1000
  3062. HSScore(4) = 800
  3063. HSScore(5) = 600
  3064.  
  3065. HSName(1) = "AAA"
  3066. HSName(2) = "ZZZ"
  3067. HSName(3) = "XXX"
  3068. HSName(4) = "ABC"
  3069. HSName(5) = "BBB"
  3070.  
  3071. Sub HighScoreTimer_Timer
  3072.  
  3073. if EnteringInitials then
  3074. if HSTimerCount = 1 then
  3075. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  3076. HSTimerCount = 2
  3077. else
  3078. SetHSLine 3, InitialString
  3079. HSTimerCount = 1
  3080. end if
  3081. elseif InProgress then
  3082. SetHSLine 1, "HIGH SCORE1"
  3083. SetHSLine 2, HSScore(1)
  3084. SetHSLine 3, HSName(1)
  3085. HSTimerCount = 5 ' set so the highest score will show after the game is over
  3086. HighScoreTimer.enabled=false
  3087. elseif CheckAllScores then
  3088. NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
  3089.  
  3090. else
  3091. ' cycle through high scores
  3092. HighScoreTimer.interval=2000
  3093. HSTimerCount = HSTimerCount + 1
  3094. if HsTimerCount > 5 then
  3095. HSTimerCount = 1
  3096. End If
  3097. SetHSLine 1, "HIGH SCORE"+FormatNumber(HSTimerCount,0)
  3098. SetHSLine 2, HSScore(HSTimerCount)
  3099. SetHSLine 3, HSName(HSTimerCount)
  3100. end if
  3101. End Sub
  3102.  
  3103. Function GetHSChar(String, Index)
  3104. dim ThisChar
  3105. dim FileName
  3106. ThisChar = Mid(String, Index, 1)
  3107. FileName = "PostIt"
  3108. if ThisChar = " " or ThisChar = "" then
  3109. FileName = FileName & "BL"
  3110. elseif ThisChar = "<" then
  3111. FileName = FileName & "LT"
  3112. elseif ThisChar = "_" then
  3113. FileName = FileName & "SP"
  3114. else
  3115. FileName = FileName & ThisChar
  3116. End If
  3117. GetHSChar = FileName
  3118. End Function
  3119.  
  3120. Sub SetHsLine(LineNo, String)
  3121. dim Letter
  3122. dim ThisDigit
  3123. dim ThisChar
  3124. dim StrLen
  3125. dim LetterLine
  3126. dim Index
  3127. dim StartHSArray
  3128. dim EndHSArray
  3129. dim LetterName
  3130. dim xfor
  3131. StartHSArray=array(0,1,12,22)
  3132. EndHSArray=array(0,11,21,31)
  3133. StrLen = len(string)
  3134. Index = 1
  3135.  
  3136. for xfor = StartHSArray(LineNo) to EndHSArray(LineNo)
  3137. Eval("HS"&xfor).image = GetHSChar(String, Index)
  3138. Index = Index + 1
  3139. next
  3140.  
  3141. End Sub
  3142.  
  3143. Sub NewHighScore(NewScore, PlayNum)
  3144. if NewScore > HSScore(5) then
  3145. HighScoreTimer.interval = 500
  3146. HSTimerCount = 1
  3147. AlphaStringPos = 1 ' start with first character "A"
  3148. EnteringInitials = 1 ' intercept the control keys while entering initials
  3149. InitialString = "" ' initials entered so far, initialize to empty
  3150. SetHSLine 1, "PLAYER "+FormatNumber(PlayNum,0)
  3151. SetHSLine 2, "ENTER NAME"
  3152. SetHSLine 3, MID(AlphaString, AlphaStringPos, 1)
  3153. HSNewHigh = NewScore
  3154. For xx=1 to HighScoreReward
  3155. AddSpecial
  3156. next
  3157. End if
  3158. ScoreChecker=ScoreChecker-1
  3159. if ScoreChecker=0 then
  3160. CheckAllScores=0
  3161. end if
  3162. End Sub
  3163.  
  3164. Sub CollectInitials(keycode)
  3165. If keycode = LeftFlipperKey Then
  3166. ' back up to previous character
  3167. AlphaStringPos = AlphaStringPos - 1
  3168. if AlphaStringPos < 1 then
  3169. AlphaStringPos = len(AlphaString) ' handle wrap from beginning to end
  3170. if InitialString = "" then
  3171. ' Skip the backspace if there are no characters to backspace over
  3172. AlphaStringPos = AlphaStringPos - 1
  3173. End if
  3174. end if
  3175. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  3176. PlaySound "DropTargetDropped"
  3177. elseif keycode = RightFlipperKey Then
  3178. ' advance to next character
  3179. AlphaStringPos = AlphaStringPos + 1
  3180. if AlphaStringPos > len(AlphaString) or (AlphaStringPos = len(AlphaString) and InitialString = "") then
  3181. ' Skip the backspace if there are no characters to backspace over
  3182. AlphaStringPos = 1
  3183. end if
  3184. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  3185. PlaySound "DropTargetDropped"
  3186. elseif keycode = StartGameKey or keycode = PlungerKey Then
  3187. SelectedChar = MID(AlphaString, AlphaStringPos, 1)
  3188. if SelectedChar = "_" then
  3189. InitialString = InitialString & " "
  3190. PlaySound("Ding10")
  3191. elseif SelectedChar = "<" then
  3192. InitialString = MID(InitialString, 1, len(InitialString) - 1)
  3193. if len(InitialString) = 0 then
  3194. ' If there are no more characters to back over, don't leave the < displayed
  3195. AlphaStringPos = 1
  3196. end if
  3197. PlaySound("Ding100")
  3198. else
  3199. InitialString = InitialString & SelectedChar
  3200. PlaySound("Ding10")
  3201. end if
  3202. if len(InitialString) < 3 then
  3203. SetHSLine 3, InitialString & SelectedChar
  3204. End If
  3205. End If
  3206. if len(InitialString) = 3 then
  3207. ' save the score
  3208. for i = 5 to 1 step -1
  3209. if i = 1 or (HSNewHigh > HSScore(i) and HSNewHigh <= HSScore(i - 1)) then
  3210. ' Replace the score at this location
  3211. if i < 5 then
  3212. ' MsgBox("Moving " & i & " to " & (i + 1))
  3213. HSScore(i + 1) = HSScore(i)
  3214. HSName(i + 1) = HSName(i)
  3215. end if
  3216. ' MsgBox("Saving initials " & InitialString & " to position " & i)
  3217. EnteringInitials = 0
  3218. HSScore(i) = HSNewHigh
  3219. HSName(i) = InitialString
  3220. HSTimerCount = 5
  3221. HighScoreTimer_Timer
  3222. HighScoreTimer.interval = 2000
  3223. PlaySound("Ding1000")
  3224. exit sub
  3225. elseif i < 5 then
  3226. ' move the score in this slot down by 1, it's been exceeded by the new score
  3227. ' MsgBox("Moving " & i & " to " & (i + 1))
  3228. HSScore(i + 1) = HSScore(i)
  3229. HSName(i + 1) = HSName(i)
  3230. end if
  3231. next
  3232. End If
  3233.  
  3234. End Sub
  3235.  
  3236. ' END GNMOD
  3237. ' ============================================================================================
  3238. ' GNMOD - New Options menu
  3239. ' ============================================================================================
  3240. Dim EnteringOptions
  3241. Dim CurrentOption
  3242. Dim OptionCHS
  3243. Dim MaxOption
  3244. Dim OptionHighScorePosition
  3245. Dim XOpt
  3246. Dim StartingArray
  3247. Dim EndingArray
  3248.  
  3249. StartingArray=Array(0,1,2,30,33,61,89,117,145,173,201,229)
  3250. EndingArray=Array(0,1,29,32,60,88,116,144,172,200,228,256)
  3251. EnteringOptions = 0
  3252. MaxOption = 9
  3253. OptionCHS = 0
  3254. OptionHighScorePosition = 0
  3255. Const OptionLinesToMark="111010011"
  3256. Const OptionLine1="" 'do not use this line
  3257. Const OptionLine2="" 'do not use this line
  3258. Const OptionLine3="" 'do not use this line
  3259. Const OptionLine4=""
  3260. Const OptionLine5="Wedgehead Tilt Setting"
  3261. Const OptionLine6=""
  3262. Const OptionLine7=""
  3263. Const OptionLine8="" 'do not use this line
  3264. Const OptionLine9="" 'do not use this line
  3265.  
  3266. Sub OperatorMenuTimer_Timer
  3267. EnteringOptions = 1
  3268. OperatorMenuTimer.enabled=false
  3269. ShowOperatorMenu
  3270. end sub
  3271.  
  3272. sub ShowOperatorMenu
  3273. OperatorMenuBackdrop.image = "OperatorMenu"
  3274.  
  3275. OptionCHS = 0
  3276. CurrentOption = 1
  3277. DisplayAllOptions
  3278. OperatorOption1.image = "BluePlus"
  3279. SetHighScoreOption
  3280.  
  3281. End Sub
  3282.  
  3283. Sub DisplayAllOptions
  3284. dim linecounter
  3285. dim tempstring
  3286. For linecounter = 1 to MaxOption
  3287. tempstring=Eval("OptionLine"&linecounter)
  3288. Select Case linecounter
  3289. Case 1:
  3290. tempstring=tempstring + FormatNumber(BallsPerGame,0)
  3291. SetOptLine 1,tempstring
  3292. Case 2:
  3293. if Replay3Table(ReplayLevel)=999000 then
  3294. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0)
  3295. elseif Replay4Table(ReplayLevel)=999000 then
  3296. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0)
  3297. else
  3298. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0) + "/" + FormatNumber(Replay4Table(ReplayLevel),0)
  3299. end if
  3300.  
  3301. SetOptLine 2,tempstring
  3302. Case 3:
  3303. If OptionCHS=0 then
  3304. tempstring = "NO"
  3305. else
  3306. tempstring = "YES"
  3307. end if
  3308. SetOptLine 3,tempstring
  3309. Case 4:
  3310. SetOptLine 4, tempstring
  3311.  
  3312.  
  3313. SetOptLine 5, tempstring
  3314. Case 5:
  3315. SetOptLine 6, tempstring
  3316. If TiltEndsGame=0 then
  3317. tempstring="Tilt loses ball in play"
  3318. else
  3319. tempstring="Tilt ends game"
  3320. end if
  3321. SetOptLine 7, tempstring
  3322.  
  3323. Case 6:
  3324. SetOptLine 8, tempstring
  3325.  
  3326. SetOptLine 9, tempstring
  3327.  
  3328. Case 7:
  3329. SetOptLine 10, tempstring
  3330. SetOptLine 11, tempstring
  3331.  
  3332. Case 8:
  3333.  
  3334. Case 9:
  3335.  
  3336.  
  3337. End Select
  3338.  
  3339. next
  3340. end sub
  3341.  
  3342. sub MoveArrow
  3343. do
  3344. CurrentOption = CurrentOption + 1
  3345. If CurrentOption>Len(OptionLinesToMark) then
  3346. CurrentOption=1
  3347. end if
  3348. loop until Mid(OptionLinesToMark,CurrentOption,1)="1"
  3349. end sub
  3350.  
  3351. sub CollectOptions(ByVal keycode)
  3352. if Keycode = LeftFlipperKey then
  3353. PlaySound "DropTargetDropped"
  3354. For XOpt = 1 to MaxOption
  3355. Eval("OperatorOption"&XOpt).image = "PostitBL"
  3356. next
  3357. MoveArrow
  3358. if CurrentOption<8 then
  3359. Eval("OperatorOption"&CurrentOption).image = "BluePlus"
  3360. elseif CurrentOption=8 then
  3361. Eval("OperatorOption"&CurrentOption).image = "GreenCheck"
  3362. else
  3363. Eval("OperatorOption"&CurrentOption).image = "RedX"
  3364. end if
  3365.  
  3366. elseif Keycode = RightFlipperKey then
  3367. PlaySound "DropTargetDropped"
  3368. if CurrentOption = 1 then
  3369. If BallsPerGame = 3 then
  3370. BallsPerGame = 5
  3371. else
  3372. BallsPerGame = 3
  3373. end if
  3374. DisplayAllOptions
  3375. elseif CurrentOption = 2 then
  3376. ReplayLevel=ReplayLevel+1
  3377. If ReplayLevel>ReplayTableMax then
  3378. ReplayLevel=1
  3379. end if
  3380. DisplayAllOptions
  3381. elseif CurrentOption = 3 then
  3382. if OptionCHS = 0 then
  3383. OptionCHS = 1
  3384.  
  3385. else
  3386. OptionCHS = 0
  3387.  
  3388. end if
  3389. DisplayAllOptions
  3390.  
  3391. elseif CurrentOption = 5 then
  3392. if TiltEndsGame=0 then
  3393. TiltEndsGame=1
  3394. else
  3395. TiltEndsGame=0
  3396. end if
  3397. DisplayAllOptions
  3398. elseif CurrentOption = 8 or CurrentOption = 9 then
  3399. if OptionCHS=1 then
  3400. HSScore(1) = 1500
  3401. HSScore(2) = 1200
  3402. HSScore(3) = 1000
  3403. HSScore(4) = 800
  3404. HSScore(5) = 600
  3405.  
  3406. HSName(1) = "AAA"
  3407. HSName(2) = "ZZZ"
  3408. HSName(3) = "XXX"
  3409. HSName(4) = "ABC"
  3410. HSName(5) = "BBB"
  3411. end if
  3412.  
  3413. if CurrentOption = 8 then
  3414. savehs
  3415. else
  3416. loadhs
  3417. end if
  3418. OperatorMenuBackdrop.image = "PostitBL"
  3419. For XOpt = 1 to MaxOption
  3420. Eval("OperatorOption"&XOpt).image = "PostitBL"
  3421. next
  3422.  
  3423. For XOpt = 1 to 256
  3424. Eval("Option"&XOpt).image = "PostItBL"
  3425. next
  3426. RefreshReplayCard
  3427. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)+"0"
  3428. EnteringOptions = 0
  3429.  
  3430. end if
  3431. end if
  3432. End Sub
  3433.  
  3434. Sub SetHighScoreOption
  3435.  
  3436. End Sub
  3437.  
  3438. Function GetOptChar(String, Index)
  3439. dim ThisChar
  3440. dim FileName
  3441. ThisChar = Mid(String, Index, 1)
  3442. FileName = "PostIt"
  3443. if ThisChar = " " or ThisChar = "" then
  3444. FileName = FileName & "BL"
  3445. elseif ThisChar = "<" then
  3446. FileName = FileName & "LT"
  3447. elseif ThisChar = "_" then
  3448. FileName = FileName & "SP"
  3449. elseif ThisChar = "/" then
  3450. FileName = FileName & "SL"
  3451. elseif ThisChar = "," then
  3452. FileName = FileName & "CM"
  3453. else
  3454. FileName = FileName & ThisChar
  3455. End If
  3456. GetOptChar = FileName
  3457. End Function
  3458.  
  3459. dim LineLengths(22) ' maximum number of lines
  3460. Sub SetOptLine(LineNo, String)
  3461. Dim DispLen
  3462. Dim StrLen
  3463. dim xfor
  3464. dim Letter
  3465. dim ThisDigit
  3466. dim ThisChar
  3467. dim LetterLine
  3468. dim Index
  3469. dim LetterName
  3470. StrLen = len(string)
  3471. Index = 1
  3472.  
  3473. StrLen = len(String)
  3474. DispLen = StrLen
  3475. if (DispLen < LineLengths(LineNo)) Then
  3476. DispLen = LineLengths(LineNo)
  3477. end If
  3478.  
  3479. for xfor = StartingArray(LineNo) to StartingArray(LineNo) + DispLen
  3480. Eval("Option"&xfor).image = GetOptChar(string, Index)
  3481. Index = Index + 1
  3482. next
  3483. LineLengths(LineNo) = StrLen
  3484.  
  3485. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement