Outhere

Space Mission Loserman76_(Williams 1976)1.0.0f

Mar 11th, 2022
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 104.80 KB | None | 0 0
  1. '*
  2. '* Williams' Space Mission (1976)
  3. '* Table scripted by Loserman76
  4. '*
  5. '*
  6. '*
  7.  
  8. 'Some DOF Config by Outhere
  9. '101, Left Flipper
  10. '102, Right Flipper
  11. '103, Left Slingshot
  12. '104, Right Slingshot
  13. '105, Bumper Right
  14. '106, Bumper Left
  15. '107,
  16. '108,
  17. '109,
  18. '110,
  19. '111, kicker Right
  20. '112, kicker Left
  21. '113,
  22. '114, LeftSpinner = Shaker
  23. '115,
  24. '116
  25. '117
  26. '118,
  27. '119,
  28. '120, Ball Release
  29. '121,
  30. '122
  31. '123
  32. '124
  33. '128, Knocker
  34.  
  35. option explicit
  36. Randomize
  37. ExecuteGlobal GetTextFile("core.vbs")
  38.  
  39. On Error Resume Next
  40. ExecuteGlobal GetTextFile("Controller.vbs")
  41. If Err Then MsgBox "Unable to open Controller.vbs. Ensure that it is in the scripts folder."
  42. On Error Goto 0
  43.  
  44. Const cGameName = "SpaceMission_1976"
  45.  
  46. Const ShadowFlippersOn = true
  47. Const ShadowBallOn = true
  48.  
  49. Const ShadowConfigFile = false
  50.  
  51. Dim Controller ' B2S
  52. Dim B2SScore ' B2S Score Displayed
  53.  
  54. Const HSFileName="SpaceMission_76VPX.txt"
  55. Const B2STableName="SpaceMission_1976"
  56. Const LMEMTableConfig="LMEMTables.txt"
  57. Const LMEMShadowConfig="LMEMShadows.txt"
  58. Dim EnableBallShadow
  59. Dim EnableFlipperShadow
  60.  
  61.  
  62. '* 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
  63. Const ScoreMotorAdjustment=1
  64.  
  65. '* this is a debug setting to use an older scoring routine vs a newer score routine - don't change this value
  66. Const ScoreAdditionAdjustment=1
  67.  
  68. dim ScoreChecker
  69. dim CheckAllScores,CheckAllPoints
  70. dim sortscores(4)
  71. dim sortpoints(4)
  72. dim sortplayerpoints(4)
  73. dim sortplayers(4)
  74. Dim B2SOn 'True/False if want backglass
  75. dim ChimesOn
  76. Dim TextStr,TextStr2
  77. Dim i,xx, LStep, RStep
  78. Dim obj
  79. Dim bgpos
  80. Dim kgpos
  81. Dim dooralreadyopen
  82. Dim kgdooralreadyopen
  83. Dim TargetSpecialLit
  84. Dim Points210counter
  85. Dim Points500counter
  86. Dim Points1000counter
  87. Dim Points2000counter
  88. Dim BallsPerGame
  89. Dim InProgress
  90. Dim BallInPlay
  91. Dim CreditsPerCoin
  92. Dim Score100K(4)
  93. Dim Score(4)
  94. Dim ScoreDisplay(4)
  95. Dim HighScorePaid(4)
  96. Dim HighScore
  97. Dim HighScoreReward
  98. Dim BonusMultiplier
  99. Dim Credits
  100. Dim Match
  101. Dim Replay1
  102. Dim Replay2
  103. Dim Replay3
  104. Dim Replay4
  105. Dim Replay1Paid(4)
  106. Dim Replay2Paid(4)
  107. Dim Replay3Paid(4)
  108. Dim Replay4Paid(4)
  109. Dim BallReplay1
  110. Dim BallReplay2
  111. Dim BallReplay3
  112. Dim ReplayBalls1Paid(4)
  113. Dim ReplayBalls2Paid(4)
  114. Dim ReplayBalls3Paid(4)
  115. Dim TableTilted
  116. Dim TiltCount
  117. Dim debugscore
  118.  
  119. Dim AltRelayValue
  120.  
  121. Dim OperatorMenu
  122.  
  123. Dim BonusBooster
  124. Dim BonusBoosterCounter
  125. Dim BonusCounter
  126. Dim HoleCounter
  127.  
  128. Dim Ones
  129. Dim Tens
  130. Dim Hundreds
  131. Dim Thousands
  132.  
  133. Dim Player
  134. Dim Players
  135.  
  136. Dim rst
  137. Dim bonuscountdown
  138. Dim TempMultiCounter
  139. dim TempPlayerup
  140. dim RotatorTemp
  141.  
  142. dim GreenTargetsDownCounter
  143. dim BlueTargetsDownCounter
  144. dim YellowTargetsDownCounter
  145.  
  146. Dim bump1
  147. Dim bump2
  148. Dim bump3
  149. Dim bump4
  150.  
  151. Dim LastChime10
  152. Dim LastChime100
  153. Dim LastChime1000
  154.  
  155. Dim Score10
  156. Dim Score100
  157.  
  158. dim tempbumper
  159.  
  160. Dim MotorRunning
  161.  
  162. Dim Replay1Table(35)
  163. Dim Replay2Table(35)
  164. Dim Replay3Table(35)
  165. Dim Replay4Table(35)
  166. Dim ReplayBallsTable1(16)
  167. Dim ReplayBallsTable2(16)
  168. Dim ReplayBallsTable3(16)
  169.  
  170. Dim ReplayTableSet
  171. Dim ReplayLevel
  172. Dim ReplayBalls
  173. Dim ReplayTableMax
  174. Dim ReplayBallsTableMax
  175.  
  176. Dim BaseHit,BaseHitCounter, x
  177.  
  178. Dim LeftTargetFlag,RightTargetFlag
  179.  
  180. Dim FootballPosition,FootballResetFlag,FootballScore
  181.  
  182. Dim ImpulseReelCount,ScoreMotorPosition
  183.  
  184. Dim TempScore, TempAdvance, KickoffFlag, MatchCount
  185.  
  186. Dim StartGameState, ExtraBallFlag, DoodleBugFlag, AdvanceFlag, SuperAdvanceFlag
  187.  
  188. Dim KickerCounter, DoodleTargetCount, YellowBumperFlag, GreenBumperFlag, DoodleBGLight, SpecialFlag, SpecialSetting, ScoreMotorStepper, SlingHoldCounter
  189.  
  190. Dim RightBonusCounter, BonusSide, LeftSpinnerCounter, RightSpinnerCounter, TopTargetCounter, BottomTargetCounter, movetarget, movedirection, movetargetup, movetargetupcount
  191.  
  192. Sub Table1_Init()
  193. If Table1.ShowDT = false then
  194. For each obj in DesktopCrap
  195. obj.visible=False
  196. next
  197. End If
  198.  
  199. OperatorMenuBackdrop.image = "PostitBL"
  200. For XOpt = 1 to MaxOption
  201. Eval("OperatorOption"&XOpt).image = "PostitBL"
  202. next
  203.  
  204. For XOpt = 1 to 256
  205. Eval("Option"&XOpt).image = "PostItBL"
  206. next
  207.  
  208.  
  209. LoadEM
  210. LoadLMEMConfig2
  211. HideOptions
  212. SetupReplayTables
  213. PlasticsOff
  214. BumpersOff
  215. OperatorMenu=0
  216. StartGameState=0
  217. ChimesOn=1
  218. ReplayLevel=1
  219. ReplayBalls=1
  220. BallsPerGame=5
  221. ExtraBallFlag=0
  222. EMReel1.ResetToZero
  223. EMReel2.ResetToZero
  224. HighScore=0
  225. MotorRunning=0
  226. BaseHit=0
  227. BaseHitCounter=0
  228. AdvanceFlag=1000
  229. SuperAdvanceFlag=5
  230. DoodleBGLight=1
  231. HighScoreReward=1
  232. BallTextBox.text=""
  233. MatchTextBox.text=""
  234. SpecialSetting=1
  235. Credits=0
  236. loadhs
  237. if HighScore=0 then HighScore=5000
  238.  
  239.  
  240.  
  241. TableTilted=false
  242. TiltReel.SetValue(1)
  243.  
  244. Match=int(Rnd*10)
  245. MatchReel.SetValue((Match)+1)
  246.  
  247. CanPlayReel.SetValue(0)
  248. BaseRunner1.SetValue(1)
  249. BaseRunner2.SetValue(1)
  250. BaseRunner3.SetValue(1)
  251.  
  252. OverTheTopReel.SetValue(0)
  253. RolloverReel1.SetValue(0)
  254. For each obj in PlayerHuds
  255. obj.SetValue(0)
  256. next
  257. For each obj in PlayerHUDScores
  258. obj.state=0
  259. next
  260. If Table1.ShowDT = True then
  261. For each obj in PlayerScores
  262. obj.visible=1
  263. Next
  264. For each obj in PlayerScoresOn
  265. obj.visible=0
  266. Next
  267. end If
  268. For each obj in PlayerScores
  269. obj.ResetToZero
  270. next
  271.  
  272. KickerCounter=0
  273.  
  274. DoodleTargetCount=1
  275. DoodleBugFlag=false
  276. YellowBumperFlag=false
  277. GreenBumperFlag=false
  278.  
  279. Replay1=Replay1Table(ReplayLevel)
  280. Replay2=Replay2Table(ReplayLevel)
  281. Replay3=Replay3Table(ReplayLevel)
  282. Replay4=Replay4Table(ReplayLevel)
  283. BallReplay1=ReplayBallsTable1(ReplayBalls)
  284. BallReplay2=ReplayBallsTable2(ReplayBalls)
  285. BallReplay3=ReplayBallsTable3(ReplayBalls)
  286.  
  287.  
  288. BonusCounter=0
  289. HoleCounter=0
  290. bgpos=6
  291. kgpos=0
  292. FootballPosition=int(Rnd*12)+3
  293. If B2SOn then
  294. For i = 60 to 81
  295. Controller.B2SSetData i,0
  296. next
  297. Controller.B2SSetData 60+FootballPosition+1,1
  298. end if
  299. FootballReel.setvalue(FootballPosition+1)
  300. ImpulseReelCount=int(Rnd*4)+1
  301. dooralreadyopen=0
  302. kgdooralreadyopen=0
  303.  
  304.  
  305.  
  306. for i = 0 to 49
  307. Collection2(i).Visible=0
  308. Collection2(i).collidable=false
  309. Collection2(i).hashitevent=False
  310. Next
  311. ' CenterT50.Visible=1
  312. CenterT50.Collidable=True
  313. CenterT50.Hashitevent=True
  314.  
  315. movetarget=0
  316. movetargetup=0
  317. movetargetupcount=0
  318. movedirection=1
  319. MovingTargetTimer.enabled=true
  320. PtargetC.objroty=((movetarget*.8)-20.5)*-1
  321. RightBonusCounter=1
  322. RightBonus(RightBonusCounter).state=1
  323. InstructCard.image="IC"
  324. ReplayCard.image="BC"+FormatNumber(BallsPerGame,0)
  325.  
  326. RefreshReplayCard
  327. ' ResetBalls
  328. ' PlaySound "Plunger"
  329.  
  330. TargetSpecialLit = 0
  331. Points210counter=0
  332. Points500counter=0
  333. Points1000counter=0
  334. Points2000counter=0
  335. BonusBooster=3
  336. BonusBoosterCounter=0
  337. Players=0
  338. RotatorTemp=1
  339. InProgress=false
  340.  
  341. ScoreText.text=HighScore
  342.  
  343.  
  344. If B2SOn Then
  345.  
  346.  
  347. if Match=0 then
  348. Controller.B2SSetMatch 10
  349. else
  350. Controller.B2SSetMatch Match
  351. end if
  352. Controller.B2SSetScoreRolloverPlayer1 0
  353.  
  354. 'Controller.B2SSetScore 4,HighScore
  355. Controller.B2SSetTilt 1
  356. Controller.B2SSetCredits Credits
  357. Controller.B2SSetGameOver 1
  358. End If
  359. GameOverReel.setvalue(1)
  360. CreditsReel.SetValue(Credits)
  361. If Credits > 0 Then DOF 127, 1:CreditLight.state=1
  362. for i=1 to 2
  363. player=i
  364. If B2SOn Then
  365. Controller.B2SSetScorePlayer player, 0
  366. End If
  367. next
  368. bump1=1
  369. bump2=1
  370. bump3=1
  371. bump4=1
  372.  
  373. InitPauser5.enabled=true
  374. End Sub
  375.  
  376. Sub Table1_exit()
  377. savehs
  378. SaveLMEMConfig
  379. SaveLMEMConfig2
  380. If B2SOn Then Controller.Stop
  381. end sub
  382.  
  383. Sub Table1_KeyDown(ByVal keycode)
  384.  
  385. ' GNMOD
  386. if EnteringInitials then
  387. CollectInitials(keycode)
  388. exit sub
  389. end if
  390.  
  391.  
  392. if EnteringOptions then
  393. CollectOptions(keycode)
  394. exit sub
  395. end if
  396.  
  397.  
  398.  
  399. If keycode = PlungerKey Then
  400. Plunger.PullBack
  401. PlungerPulled = 1
  402. End If
  403.  
  404. if keycode = LeftFlipperKey and InProgress = false then
  405. OperatorMenuTimer.Enabled = true
  406. end if
  407. ' END GNMOD
  408.  
  409.  
  410. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  411. LeftFlipper.RotateToEnd
  412. PlaySound SoundFXDOF("FlipperUp",101,DOFOn,DOFContactors)
  413. PlaySound "buzzL",-1
  414.  
  415. End If
  416.  
  417. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  418. RightFlipper.RotateToEnd
  419. PlaySound "buzz",-1
  420. PlaySound SoundFXDOF("FlipperUp",102,DOFOn,DOFContactors)
  421.  
  422. End If
  423.  
  424.  
  425.  
  426. If keycode = LeftTiltKey Then
  427. Nudge 90, 2
  428. TiltIt
  429. End If
  430.  
  431. If keycode = RightTiltKey Then
  432. Nudge 270, 2
  433. TiltIt
  434. End If
  435.  
  436. If keycode = CenterTiltKey Then
  437. Nudge 0, 2
  438. TiltIt
  439. End If
  440.  
  441. If keycode = MechanicalTilt Then
  442. TiltCount=2
  443. TiltIt
  444. End If
  445.  
  446. If keycode = AddCreditKey or keycode = 4 then
  447. If B2SOn Then
  448. 'Controller.B2SSetScorePlayer6 HighScore
  449.  
  450. End If
  451.  
  452. playsound "coinin"
  453. AddSpecial2
  454. CreditLight.state=1
  455. end if
  456.  
  457. if keycode = 5 then
  458. playsound "coinin"
  459. AddSpecial2
  460. keycode= StartGameKey
  461. CreditLight.state=1
  462. end if
  463.  
  464. if keycode = StartGameKey and Credits>0 and InProgress=true and Players>0 and Players<4 and BallInPlay<2 then
  465. Credits=Credits-1
  466. If Credits <1 Then DOF 127, DOFOff:CreditLight.state=0
  467. CreditsReel.SetValue(Credits)
  468. EMReel7.SetValue(Credits)
  469. Players=Players+1
  470. for each obj in CanPlayLights
  471. obj.state=0
  472. next
  473. CanPlayLights(Players-1).state=1
  474.  
  475. playsound "click"
  476. If B2SOn Then
  477. Controller.B2SSetCanPlay Players
  478. Controller.B2SSetCredits Credits
  479. End If
  480. end if
  481.  
  482.  
  483. if keycode=StartGameKey and Credits>0 and InProgress=false and Players=0 and EnteringOptions = 0 then
  484. 'GNMOD
  485. OperatorMenuTimer.Enabled = false
  486. 'END GNMODthen
  487. Credits=Credits-1
  488. If Credits < 1 Then DOF 127, 0:CreditLight.state=0
  489. CreditsReel.SetValue(Credits)
  490. Players=1
  491.  
  492. CanPlay1.state=1
  493. MatchReel.SetValue(0)
  494. Player=1
  495. playsound "startup_norm"
  496. TempPlayerUp=Player
  497. ' PlayerUpRotator.enabled=true
  498. rst=0
  499. BallInPlay=1
  500. InProgress=true
  501. GameOverReel.setvalue(0)
  502. resettimer.enabled=true
  503. RolloverReel1.SetValue(0)
  504. RolloverReel2.SetValue(0)
  505. RolloverReel3.SetValue(0)
  506. RolloverReel4.SetValue(0)
  507. OverTheTopReel.SetValue(0)
  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 4,HighScore
  515. Controller.B2SSetCanPlay 1
  516. Controller.B2SSetPlayerUp 1
  517. ' Controller.B2SSetBallInPlay BallInPlay
  518. Controller.B2SSetScoreRolloverPlayer1 0
  519. Controller.B2SSetScoreRolloverPlayer2 0
  520. Controller.B2SSetScoreRolloverPlayer3 0
  521. Controller.B2SSetScoreRolloverPlayer4 0
  522. Controller.B2SSetData 81,1
  523. Controller.B2SSetData 82,0
  524. Controller.B2SSetData 83,0
  525. Controller.B2SSetData 84,0
  526.  
  527.  
  528. End If
  529. For each obj in PlayerScores
  530. ' obj.ResetToZero
  531. next
  532. For each obj in PlayerHuds
  533. obj.SetValue(0)
  534. next
  535. If Table1.ShowDT = True then
  536. For each obj in PlayerScores
  537. ' obj.ResetToZero
  538. obj.Visible=true
  539. next
  540. For each obj in PlayerScoresOn
  541. ' obj.ResetToZero
  542. obj.Visible=false
  543. next
  544.  
  545. For each obj in PlayerHuds
  546. obj.SetValue(0)
  547. next
  548. For each obj in PlayerHUDScores
  549. obj.state=0
  550. next
  551. PlayerHuds(Player-1).SetValue(1)
  552. PlayerHUDScores(Player-1).state=1
  553. PlayerHUDScores(Player+3).state=1
  554. PlayerScores(Player-1).Visible=0
  555. PlayerScoresOn(Player-1).Visible=1
  556.  
  557.  
  558. end If
  559.  
  560. end if
  561.  
  562.  
  563.  
  564. End Sub
  565.  
  566. Sub Table1_KeyUp(ByVal keycode)
  567.  
  568. ' GNMOD
  569. if EnteringInitials then
  570. exit sub
  571. end if
  572.  
  573. If keycode = PlungerKey Then
  574.  
  575. if PlungerPulled = 0 then
  576. exit sub
  577. end if
  578.  
  579. PlaySound"plungerrelease"
  580. Plunger.Fire
  581. End If
  582.  
  583. if keycode = LeftFlipperKey then
  584. OperatorMenuTimer.Enabled = false
  585. end if
  586.  
  587. ' END GNMOD
  588.  
  589. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  590. LeftFlipper.RotateToStart
  591. PlaySound SoundFXDOF("FlipperDown",101,DOFOff,DOFContactors)
  592. StopSound "buzzL"
  593. End If
  594.  
  595. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  596. RightFlipper.RotateToStart
  597. StopSound "buzz"
  598. PlaySound SoundFXDOF("FlipperDown",102,DOFOff,DOFContactors)
  599. End If
  600.  
  601. End Sub
  602.  
  603.  
  604.  
  605. Sub Drain_Hit()
  606. Drain.DestroyBall
  607. PlaySound "fx_drain"
  608. DOF 130,2
  609.  
  610. Pause4Bonustimer.enabled=true
  611.  
  612.  
  613. End Sub
  614.  
  615.  
  616. Sub Pause4Bonustimer_timer
  617. Pause4Bonustimer.enabled=0
  618. AddBonus
  619. 'NextBallDelay.enabled=true
  620.  
  621. End Sub
  622.  
  623. Sub CloseGateTrigger_hit
  624. DOF 121, DOFPulse
  625.  
  626. End Sub
  627.  
  628. '***********************
  629. ' Flipper Logos
  630. '***********************
  631.  
  632. dim angle
  633.  
  634. Function PI()
  635. PI = 4*Atn(1)
  636. End Function
  637.  
  638. Sub UpdateFlipperLogos_Timer
  639. ' LFlip.ObjRotZ = LeftFlipper.CurrentAngle-90
  640. ' RFlip.ObjRotZ = RightFlipper.CurrentAngle+90
  641. ' LFlip1.RotZ = LeftFlipper.CurrentAngle
  642. ' RFlip1.RotZ = RightFlipper.CurrentAngle
  643.  
  644. PGate.Rotz = (Gate.CurrentAngle*.75) + 25
  645. PGate1.Rotz = (Gate3.CurrentAngle*.75) + 25
  646. FlipperLSh.RotZ = LeftFlipper.currentangle
  647. FlipperRSh.RotZ = RightFlipper.currentangle
  648.  
  649. Dim SpinnerRadius: SpinnerRadius=7
  650.  
  651. SpinnerRod.TransZ = (cos((leftspinner.CurrentAngle + 180) * (PI/180))+1) * SpinnerRadius
  652. SpinnerRod.TransY = sin((leftspinner.CurrentAngle) * (PI/180)) * -SpinnerRadius
  653. End Sub
  654.  
  655. '***********************
  656. ' Moving Target
  657. '***********************
  658.  
  659. sub MovingTargetTimer_timer
  660. if movedirection=1 Then
  661. Collection2(movetarget).visible=0
  662. Collection2(movetarget).collidable=False
  663. Collection2(movetarget).hashitevent=False
  664. movetarget=movetarget+1
  665. ' Collection2(movetarget).visible=1
  666. Collection2(movetarget).collidable=True
  667. Collection2(movetarget).hashitevent=True
  668.  
  669. if movetarget>48 then
  670. movedirection=0
  671. end If
  672. PtargetC.objroty=((movetarget*.8)-20.5)*-1
  673. exit sub
  674. Else
  675. Collection2(movetarget).Visible=0
  676. Collection2(movetarget).collidable=False
  677. Collection2(movetarget).hashitevent=False
  678.  
  679. movetarget=movetarget-1
  680. ' Collection2(movetarget).visible=1
  681. Collection2(movetarget).collidable=True
  682. Collection2(movetarget).hashitevent=True
  683.  
  684. if movetarget<1 then
  685. movedirection=1
  686. end If
  687. end If
  688. PtargetC.objroty=((movetarget*.8)-20.5)*-1
  689.  
  690. Select case ExtraBallFlag
  691. case 0:
  692. if RightBonusCounter=1 or RightBonusCounter=4 or RightBonusCounter=7 or RightBonusCounter=10 then
  693. LeftSpinnerLight.state=1
  694. if DoubleBonus002.state=1 or DoubleBonus003.state=1 or DoubleBonus004.state=1 then
  695. UpperLightCenter.state=1
  696. else
  697. UpperLightCenter.state=0
  698. end if
  699. else
  700. LeftSpinnerLight.state=0
  701. UpperLightCenter.state=0
  702. end if
  703.  
  704. case 1:
  705. if RightBonusCounter=4 or RightBonusCounter=7 or RightBonusCounter=10 then
  706. LeftSpinnerLight.state=1
  707. if DoubleBonus002.state=1 or DoubleBonus003.state=1 or DoubleBonus004.state=1 then
  708. UpperLightCenter.state=1
  709. else
  710. UpperLightCenter.state=0
  711. end if
  712. else
  713. LeftSpinnerLight.state=0
  714. UpperLightCenter.state=0
  715. end if
  716.  
  717. case 2:
  718. if RightBonusCounter=4 or RightBonusCounter=10 then
  719. LeftSpinnerLight.state=1
  720. if DoubleBonus002.state=1 or DoubleBonus003.state=1 or DoubleBonus004.state=1 then
  721. UpperLightCenter.state=1
  722. else
  723. UpperLightCenter.state=0
  724. end if
  725. else
  726. LeftSpinnerLight.state=0
  727. UpperLightCenter.state=0
  728. end if
  729. end select
  730. end sub
  731.  
  732. '***********************
  733. ' slingshots
  734. '
  735.  
  736. Sub RightSlingShot_Timer
  737. Select Case RStep
  738. Case 3:sling2.rotx = 10:sling1.rotx = 10
  739. Case 4:sling2.rotx=0:sling1.rotx=0:RightSlingShot.TimerEnabled = 0
  740. End Select
  741. RStep = RStep + 1
  742. DOF 103, DOFPulse
  743. End Sub
  744.  
  745.  
  746. Sub LeftSlingShot_Timer
  747. Select Case LStep
  748. Case 3:sling2.rotx = 10:sling1.rotx = 10
  749. Case 4:sling2.rotx=0:sling1.rotx=0:LeftSlingShot.TimerEnabled = 0
  750. End Select
  751. LStep = LStep + 1
  752. DOF 104, DOFPulse
  753. End Sub
  754.  
  755. '***********************************
  756. ' Walls
  757. '***********************************
  758.  
  759. Sub RubberWallSwitches_Hit(idx)
  760. if TableTilted=false then
  761. If idx<3 then
  762. SetMotor(50)
  763. else
  764. AddScore(10)
  765. end if
  766. end if
  767. end Sub
  768.  
  769. '***********************************
  770. ' Spinners
  771. '***********************************
  772. Sub LeftSpinner_Spin
  773. if TableTilted=false then
  774. DOF 114, DOFPulse
  775. If LeftSpinnerLight.state=1 then
  776. AddScore(1000)
  777. else
  778. AddScore(100)
  779. end if
  780.  
  781. end if
  782. end sub
  783.  
  784. '***********************************
  785. Sub Collection2_hit(idx)
  786. If TableTilted=false then
  787. IncreaseBonus
  788. Select case RightBonusCounter
  789. case 1,4,7,10:
  790. SetMotor(5000)
  791. case 2,3:
  792. AddScore(1000)
  793. DoubleBonus002.state=1
  794. LeftKickerLight.state=1
  795. RightKickerLight.state=1
  796. DisplayAltRelay
  797. case 5,6:
  798. AddScore(1000)
  799. LeftSlingLight.state=1
  800. RightSlingLight.state=1
  801. DoubleBonus003.state=1
  802. LeftKickerLight.state=1
  803. RightKickerLight.state=1
  804. DisplayAltRelay
  805. case 8,9:
  806. AddScore(1000)
  807. DoubleBonus004.state=1
  808. LeftKickerLight.state=1
  809. RightKickerLight.state=1
  810. DisplayAltRelay
  811. end select
  812. IncreaseRightBonus
  813. end if
  814. end sub
  815.  
  816. Sub AllTargets_Hit(idx)
  817. if TableTilted=false then
  818. DOF 107+idx,DOFPulse
  819. IncreaseBonus
  820. AddScore(AdvanceFlag)
  821. end if
  822. end sub
  823.  
  824. 'target001_hit
  825. ' target1.transy-5
  826.  
  827.  
  828.  
  829. '***********************************
  830. Sub Bumper1_Hit
  831. If TableTilted=false then
  832. PlaySound SoundFXDOF("bump",105,DOFPulse,DOFContactors)
  833.  
  834. bump1 = 1
  835.  
  836. AddScore(100)
  837.  
  838. end if
  839.  
  840. End Sub
  841.  
  842.  
  843. Sub Bumper2_Hit
  844. If TableTilted=false then
  845. PlaySound SoundFXDOF("bump",106,DOFPulse,DOFContactors)
  846.  
  847. bump2 = 1
  848.  
  849. AddScore(100)
  850. end if
  851.  
  852. End Sub
  853.  
  854.  
  855.  
  856.  
  857. '***********************************
  858. Sub TriggerCollection_Hit(idx)
  859. If TableTilted=false then
  860. PlaySound "sensor"
  861. DOF 116+idx,DOFPulse
  862. Select case idx
  863.  
  864. case 0:
  865. AddScore(1000)
  866. If LeftOutlaneLight.state=1 then AddSpecial
  867. case 1:
  868.  
  869.  
  870. if UpperLightLeft.state=1 then
  871. Collection2_hit(0)
  872. else
  873. AddScore(100)
  874.  
  875. end if
  876. case 2:
  877.  
  878.  
  879. if UpperLightRight.state=1 then
  880. Collection2_hit(0)
  881. else
  882. AddScore(100)
  883. end if
  884. case 3:
  885. AddScore(1000)
  886.  
  887. If RightOutlaneLight.state=1 then AddSpecial
  888. case 4:
  889. IncreaseBonus
  890. AddScore(AdvanceFlag)
  891. if UpperLightCenter.state=1 then
  892. ShootAgainLight.state=1
  893. ShootAgainReel.Setvalue(1)
  894. If B2SOn then
  895. Controller.B2SSetShootAgain 1
  896. end if
  897. end if
  898. case 5:
  899. IncreaseBonus
  900. AddScore(AdvanceFlag)
  901. case 6:
  902. BonusBoosterCounter=SuperAdvanceFlag
  903. BonusBoost.enabled=true
  904.  
  905. end select
  906. end if
  907. end sub
  908.  
  909.  
  910.  
  911. '*********************************** KICKERS
  912.  
  913. Dim rkickstep, lkickstep, ktimer, kickFill
  914.  
  915.  
  916. Dim kickBalls
  917. Dim kickerBall1
  918. Sub kickBall(kball, kangle, kvel, kvelz, kzlift)
  919. dim rangle
  920. rangle = 3.14 * (kangle - 90) / 180
  921. kball.z = kball.z + kzlift
  922. kball.velz = kvelz
  923. kball.velx = cos(rangle)*kvel
  924. kball.vely = sin(rangle)*kvel
  925. End Sub
  926.  
  927. sub Kicker001_Hit()
  928. set kickerBall1 = activeball
  929. if TableTilted=true then
  930. Kicker001.Timerenabled=1
  931. exit sub
  932. end if
  933. KickerHold2.enabled=1
  934. end sub
  935.  
  936. Sub KickerHold2_timer
  937.  
  938. if MotorRunning=0 then
  939. SetMotor(500)
  940. If LeftKickerLight.state=1 then
  941. DoubleBonus001.state=1
  942. end if
  943. KickerHold2.enabled=false
  944. Kicker001.timerenabled=true
  945. end if
  946. end sub
  947.  
  948. Sub Kicker001_Timer()
  949. if MotorRunning<>0 then exit sub
  950. Kicker001.timerenabled=0
  951. if kicker001.ballcntover > 0 Then
  952. Pkickarm2.rotz=15
  953. kickBall KickerBall1, 150, 15, 5, 30
  954. PlaySound SoundFXDOF("scoopexit",111,DOFPulse,DOFContactors)
  955. DOF 126, DOFPulse
  956. Pkickarm2.rotz=15
  957. Pkickarm3.rotz=15
  958. KickerArm2.enabled=true
  959. end if
  960. end sub
  961.  
  962. sub KickerArm2_timer
  963. Pkickarm2.rotz=0
  964. Pkickarm3.rotz=0
  965. KickerArm2.enabled=false
  966. end sub
  967.  
  968.  
  969. sub kicker002_Hit()
  970. set kickerBall1 = activeball
  971. if TableTilted=true then
  972. kicker002.Timerenabled=1
  973. exit sub
  974. end if
  975. KickerHold3.enabled=1
  976. end sub
  977.  
  978. Sub KickerHold3_timer
  979.  
  980. if MotorRunning=0 then
  981. SetMotor(500)
  982. If RightKickerLight.state=1 then
  983. DoubleBonus001.state=1
  984. end if
  985. KickerHold3.enabled=false
  986. kicker002.timerenabled=true
  987. end if
  988. end sub
  989.  
  990. Sub kicker002_Timer()
  991. if MotorRunning<>0 then exit sub
  992. kicker002.timerenabled=0
  993. if kicker002.ballcntover > 0 Then
  994. PlaySound SoundFXDOF("scoopexit",112,DOFPulse,DOFContactors)
  995. DOF 126, DOFPulse
  996. kickBall KickerBall1, 210, 15, 5, 30
  997. Pkickarm2.rotz=15
  998. Pkickarm3.rotz=15
  999. KickerArm2.enabled=true
  1000. end if
  1001. end sub
  1002.  
  1003. Sub LeftSlingKicker_hit
  1004. set kickerBall1 = activeball
  1005. if TableTilted=true then
  1006. kickBall KickerBall1, 20, 20, 2, 5
  1007. exit sub
  1008. else
  1009. SlingHoldCounter=0
  1010. LeftSlingKicker.timerenabled=true
  1011. end if
  1012. end sub
  1013.  
  1014. sub LeftSlingKicker_timer
  1015. if MotorRunning<>0 then exit sub
  1016. SlingHoldCounter=SlingHoldCounter+1
  1017.  
  1018. select case SlingHoldCounter
  1019. case 1,2,3,4,5:
  1020. If LeftSlingLight.state=1 then
  1021. AddScore(100)
  1022. else
  1023. AddScore(10)
  1024. end if
  1025. case 7:
  1026. if leftslingkicker.ballcntover > 0 Then
  1027. kickBall KickerBall1, 20, 25, 2, 5
  1028. LeftSlingKicker.timerenabled=false
  1029. sling1.rotx = 20
  1030. sling2.rotx = 20
  1031. LStep = 0
  1032. LeftSlingShot.TimerEnabled = 1
  1033. end if
  1034. end select
  1035. end sub
  1036.  
  1037. Sub RightSlingKicker_hit
  1038. set kickerBall1 = activeball
  1039. if TableTilted=true then
  1040. kickBall KickerBall1, 340, 20, 2, 5
  1041. exit sub
  1042. else
  1043. SlingHoldCounter=0
  1044. RightSlingKicker.timerenabled=true
  1045. end if
  1046. end sub
  1047.  
  1048. sub RightSlingKicker_timer
  1049. if MotorRunning<>0 then exit sub
  1050. SlingHoldCounter=SlingHoldCounter+1
  1051.  
  1052. select case SlingHoldCounter
  1053. case 1,2,3,4,5:
  1054. If RightSlingLight.state=1 then
  1055. AddScore(100)
  1056. else
  1057. AddScore(10)
  1058. end if
  1059. case 7:
  1060. if rightslingkicker.ballcntover > 0 Then
  1061. kickBall KickerBall1, 340, 25, 2, 5
  1062. RightSlingKicker.timerenabled=false
  1063. sling1.rotx = 20
  1064. sling2.rotx = 20
  1065. rStep = 0
  1066. RightSlingShot.TimerEnabled = 1
  1067. end if
  1068. end select
  1069. end sub
  1070.  
  1071.  
  1072. '****************************************************
  1073. Sub AddSpecial()
  1074. If ExtraBallFlag=1 then AddExtraBall:Exit Sub
  1075. if ExtraBallFlag=2 then AddExtraBall:exit sub
  1076. PlaySound SoundFXDOF("knocker",128,DOFPulse,DOFContactors)
  1077. DOF 126,2
  1078. Credits=Credits+1
  1079. DOF 127,1
  1080. if Credits>15 then Credits=15
  1081. If B2SOn Then
  1082. Controller.B2SSetCredits Credits
  1083. End If
  1084. CreditsReel.SetValue(Credits)
  1085. End Sub
  1086.  
  1087. Sub AddSpecial2()
  1088. PlaySound"click"
  1089. Credits=Credits+1
  1090. DOF 127,1
  1091. if Credits>15 then Credits=15
  1092. If B2SOn Then
  1093. Controller.B2SSetCredits Credits
  1094. End If
  1095. CreditsReel.SetValue(Credits)
  1096. End Sub
  1097.  
  1098. Sub AddExtraBall
  1099. PlaySound SoundFXDOF("knocker",128,DOFPulse,DOFContactors)
  1100. DOF 126,2
  1101. If ExtraBallFlag=2 then AddScore(100000):Exit Sub
  1102. BallInPlay=BallInPlay+1
  1103. If BallInPlay>10 then BallInPlay=10
  1104. BallInPlayReel.SetValue(BallInPlay)
  1105. If B2SOn then
  1106. Controller.B2SSetBallInPlay BallInPlay
  1107. end if
  1108.  
  1109. end sub
  1110.  
  1111. sub openg_timer
  1112. openg.enabled=false
  1113.  
  1114.  
  1115. end sub
  1116.  
  1117. sub closeg_timer
  1118. closeg.enabled=false
  1119. end sub
  1120.  
  1121. Sub AddBonus()
  1122. BonusSide=1
  1123. bonuscountdown=bonuscounter
  1124. ScoreMotorStepper=0
  1125. ScoreBonus.enabled=true
  1126. End Sub
  1127.  
  1128.  
  1129. Sub ToggleOutlane
  1130.  
  1131. end sub
  1132.  
  1133. Sub ToggleBumper
  1134.  
  1135.  
  1136. end sub
  1137.  
  1138.  
  1139. sub ToggleAltRelay
  1140. if AltRelayValue=1 then
  1141. AltRelayValue=0
  1142. else
  1143. AltRelayValue=1
  1144. end if
  1145. DisplayAltRelay
  1146. end sub
  1147.  
  1148. Sub DisplayAltRelay
  1149.  
  1150. If AltRelayValue=0 then
  1151. UpperLightRight.state=0
  1152. UpperLightLeft.state=0
  1153. LeftOutlaneLight.state=0
  1154. RightOutlaneLight.state=0
  1155. If DoubleBonus002.state=1 AND DoubleBonus003.state=1 AND DoubleBonus004.state=1 then
  1156. RightOutlaneLight.state=1
  1157. end if
  1158.  
  1159. else
  1160. UpperLightRight.state=1
  1161. UpperLightLeft.state=1
  1162. LeftOutlaneLight.state=0
  1163. RightOutlaneLight.state=0
  1164. If DoubleBonus002.state=1 AND DoubleBonus003.state=1 AND DoubleBonus004.state=1 then
  1165. LeftOutlaneLight.state=1
  1166. end if
  1167. end if
  1168. end sub
  1169.  
  1170.  
  1171. Sub ResetBallDrops()
  1172.  
  1173.  
  1174.  
  1175. BonusCounter=0
  1176. HoleCounter=0
  1177. End Sub
  1178.  
  1179.  
  1180. Sub LightsOut
  1181. BonusCounter=0
  1182. HoleCounter=0
  1183.  
  1184.  
  1185.  
  1186. end sub
  1187.  
  1188. Sub ResetDrops()
  1189.  
  1190.  
  1191. End Sub
  1192.  
  1193.  
  1194. Sub LightsOff
  1195.  
  1196.  
  1197. end sub
  1198.  
  1199. Sub LightsOn
  1200.  
  1201. end sub
  1202.  
  1203.  
  1204. Sub FireAlternatingRelay
  1205.  
  1206. end sub
  1207.  
  1208. Sub ToggleArrowRelay
  1209. Select Case BallInPlay
  1210. case 1,3,5:
  1211.  
  1212. case 2,4:
  1213.  
  1214. end select
  1215. end sub
  1216.  
  1217.  
  1218. Sub ResetBalls()
  1219.  
  1220. TempMultiCounter=BallsPerGame-BallInPlay
  1221.  
  1222.  
  1223. RightTargetFlag=false
  1224. LeftTargetFlag=false
  1225. BonusMultiplier=1
  1226. YellowBumperFlag=false
  1227. GreenBumperFlag=false
  1228. for each obj in StarLights
  1229. obj.state=0
  1230. next
  1231. for x = 1 to 10
  1232. LeftBonus(x).state=0
  1233.  
  1234. next
  1235. BonusCounter=1
  1236. LeftSpinnerLight.state=0
  1237. LeftSlingLight.state=0
  1238. RightSlingLight.state=0
  1239. LeftKickerLight.state=0
  1240. RightKickerLight.state=0
  1241. LeftBonus(BonusCounter).state=1
  1242.  
  1243. ResetDrops
  1244.  
  1245. TableTilted=false
  1246. TiltReel.SetValue(0)
  1247. BumpersOn
  1248. PlasticsOn
  1249. DisplayAltRelay
  1250.  
  1251. 'CreateBallID BallRelease
  1252. Ballrelease.CreateSizedBall 25
  1253. Ballrelease.Kick 40,7
  1254. DOF 120,2
  1255. 'InstructCard.image="IC"+FormatNumber(BallsPerGame,0)+FormatNumber(BallInPlay,0)
  1256.  
  1257.  
  1258. BallInPlayReel.SetValue(BallInPlay)
  1259.  
  1260. End Sub
  1261.  
  1262. sub delaykgclose_timer
  1263. delaykgclose.enabled=false
  1264.  
  1265. end sub
  1266.  
  1267. sub resettimer_timer
  1268. rst=rst+1
  1269. if rst>1 and rst<20 then
  1270. ResetReelsToZero(1)
  1271. ResetReelsToZero(2)
  1272. end if
  1273.  
  1274. if rst=22 then
  1275. 'playsound "KickerKick"
  1276. end if
  1277. if rst=24 then
  1278. newgame
  1279. resettimer.enabled=false
  1280. end if
  1281. end sub
  1282.  
  1283. Sub ResetReelsToZero(reelzeroflag)
  1284. dim d1(5)
  1285. dim d2(5)
  1286. dim scorestring1, scorestring2
  1287.  
  1288. If reelzeroflag=1 then
  1289. scorestring1=CStr(Score(1))
  1290. scorestring2=CStr(Score(2))
  1291. scorestring1=right("00000" & scorestring1,5)
  1292. scorestring2=right("00000" & scorestring2,5)
  1293. for i=0 to 4
  1294. d1(i)=CInt(mid(scorestring1,i+1,1))
  1295. d2(i)=CInt(mid(scorestring2,i+1,1))
  1296. next
  1297. for i=0 to 4
  1298. if d1(i)>0 then
  1299. d1(i)=d1(i)+1
  1300. if d1(i)>9 then d1(i)=0
  1301. end if
  1302. if d2(i)>0 then
  1303. d2(i)=d2(i)+1
  1304. if d2(i)>9 then d2(i)=0
  1305. end if
  1306.  
  1307. next
  1308. Score(1)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  1309. Score(2)=(d2(0)*10000) + (d2(1)*1000) + (d2(2)*100) + (d2(3)*10) + d2(4)
  1310. If B2SOn Then
  1311. Controller.B2SSetScorePlayer 1, Score(1)
  1312. Controller.B2SSetScorePlayer 2, Score(2)
  1313. End If
  1314. PlayerScores(0).SetValue(Score(1))
  1315. PlayerScoresOn(0).SetValue(Score(1))
  1316. PlayerScores(1).SetValue(Score(2))
  1317. PlayerScoresOn(1).SetValue(Score(2))
  1318.  
  1319. scorestring1=CStr(Score(3))
  1320. scorestring2=CStr(Score(4))
  1321. scorestring1=right("00000" & scorestring1,5)
  1322. scorestring2=right("00000" & scorestring2,5)
  1323. for i=0 to 4
  1324. d1(i)=CInt(mid(scorestring1,i+1,1))
  1325. d2(i)=CInt(mid(scorestring2,i+1,1))
  1326. next
  1327. for i=0 to 4
  1328. if d1(i)>0 then
  1329. d1(i)=d1(i)+1
  1330. if d1(i)>9 then d1(i)=0
  1331. end if
  1332. if d2(i)>0 then
  1333. d2(i)=d2(i)+1
  1334. if d2(i)>9 then d2(i)=0
  1335. end if
  1336.  
  1337. next
  1338. Score(3)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  1339. Score(4)=(d2(0)*10000) + (d2(1)*1000) + (d2(2)*100) + (d2(3)*10) + d2(4)
  1340. If B2SOn Then
  1341. Controller.B2SSetScorePlayer 3, Score(3)
  1342. Controller.B2SSetScorePlayer 4, Score(4)
  1343. End If
  1344. PlayerScores(2).SetValue(Score(3))
  1345. PlayerScoresOn(2).SetValue(Score(3))
  1346. PlayerScores(3).SetValue(Score(4))
  1347. PlayerScoresOn(3).SetValue(Score(4))
  1348.  
  1349. end if
  1350.  
  1351. end sub
  1352.  
  1353.  
  1354.  
  1355. sub ScoreBonus_timer
  1356. if MotorRunning=1 then
  1357. exit sub
  1358. end if
  1359. if bonuscountdown<1 then
  1360. ScoreBonus.enabled=0
  1361. NextBallDelay.enabled=true
  1362. else
  1363. If DoubleBonus001.state=1 then
  1364. Select case ScoreMotorStepper
  1365. case 0,1,3,4:
  1366. AddScore(1000)
  1367.  
  1368. case 2,5:
  1369. PlaySound"MotorPause"
  1370. If bonuscountdown=20 then
  1371. LeftBonus(11).state=0
  1372. elseif bonuscountdown>10 and bonuscountdown<20 then
  1373. LeftBonus(bonuscountdown-10).state=0
  1374. else
  1375. LeftBonus(bonuscountdown).state=0
  1376. end if
  1377.  
  1378.  
  1379. bonuscountdown=bonuscountdown-1
  1380. if bonuscountdown>0 then
  1381. if bonuscountdown<=10 then
  1382. LeftBonus(bonuscountdown).state=1
  1383. elseif bonuscountdown>10 AND bonuscountdown<20 then
  1384. LeftBonus(10).state=1
  1385. LeftBonus(bonuscountdown-10).state=1
  1386. else
  1387. LeftBonus(11).state=1
  1388. end if
  1389. end if
  1390. case 6:
  1391.  
  1392.  
  1393. end select
  1394. ScoreMotorStepper=ScoreMotorStepper+1
  1395. If ScoreMotorStepper>6 then
  1396. ScoreMotorStepper=0
  1397. end if
  1398. else
  1399. Select Case ScoreMotorStepper
  1400. case 0,1,2,3,4:
  1401. AddScore(1000)
  1402. If bonuscountdown=20 then
  1403. LeftBonus(11).state=0
  1404. elseif bonuscountdown>10 and bonuscountdown<20 then
  1405. LeftBonus(bonuscountdown-10).state=0
  1406. else
  1407. LeftBonus(bonuscountdown).state=0
  1408. end if
  1409. bonuscountdown=bonuscountdown-1
  1410.  
  1411. if bonuscountdown>0 then
  1412. if bonuscountdown<=10 then
  1413. LeftBonus(bonuscountdown).state=1
  1414. elseif bonuscountdown>10 AND bonuscountdown<20 then
  1415. LeftBonus(10).state=1
  1416. LeftBonus(bonuscountdown-10).state=1
  1417. else
  1418. LeftBonus(11).state=1
  1419. end if
  1420. end if
  1421. case 5:
  1422. PlaySound"MotorPause"
  1423.  
  1424.  
  1425. end select
  1426. ScoreMotorStepper=ScoreMotorStepper+1
  1427. If ScoreMotorStepper>5 then
  1428. ScoreMotorStepper=0
  1429. end if
  1430. end if
  1431. end if
  1432.  
  1433. end sub
  1434.  
  1435. Sub AddBonusInGame()
  1436. If BonusSide=1 then
  1437. bonuscountdown=bonuscounter
  1438. else
  1439. bonuscountdown=rightbonuscounter
  1440. end if
  1441. ScoreMotorStepper=0
  1442. ScoreBonusInGame.enabled=true
  1443. End Sub
  1444.  
  1445. sub ScoreBonusInGame_timer
  1446. if MotorRunning=1 then
  1447. exit sub
  1448. end if
  1449. if bonuscountdown<1 then
  1450. ScoreBonusInGame.enabled=0
  1451.  
  1452. else
  1453. If DoubleBonus001.state=0 then
  1454. Select case ScoreMotorStepper
  1455. case 0,1,2,3,4:
  1456. AddScore(1000)
  1457.  
  1458. case 5:
  1459. PlaySound"MotorPause"
  1460. If BonusSide=1 then
  1461. LeftBonus(bonuscountdown).state=0
  1462. LeftSpinnerLight.state=0
  1463. else
  1464. RightBonus(bonuscountdown).state=0
  1465. RightSpinnerLight.state=0
  1466. end if
  1467.  
  1468. bonuscountdown=bonuscountdown-1
  1469. if bonuscountdown>0 then
  1470. if BonusSide=1 then
  1471. LeftBonus(bonuscountdown).state=1
  1472. else
  1473. RightBonus(bonuscountdown).state=1
  1474. end if
  1475.  
  1476. end if
  1477. case 6:
  1478.  
  1479.  
  1480. end select
  1481. ScoreMotorStepper=ScoreMotorStepper+1
  1482. If ScoreMotorStepper>6 then
  1483. ScoreMotorStepper=0
  1484. end if
  1485. else
  1486. Select Case ScoreMotorStepper
  1487. case 0,1,2,3,4:
  1488. AddScore(10000)
  1489. if BonusSide=1 then
  1490. LeftBonus(bonuscountdown).state=0
  1491. LeftSpinnerLight.state=0
  1492. else
  1493. RightBonus(bonuscountdown).state=0
  1494. RightSpinnerLight.state=0
  1495. end if
  1496. bonuscountdown=bonuscountdown-1
  1497. if bonuscountdown>0 then
  1498. if BonusSide=1 then
  1499. LeftBonus(bonuscountdown).state=1
  1500. else
  1501. RightBonus(bonuscountdown).state=1
  1502. end if
  1503. end if
  1504. case 5:
  1505. PlaySound"MotorPause"
  1506.  
  1507.  
  1508. end select
  1509. ScoreMotorStepper=ScoreMotorStepper+1
  1510. If ScoreMotorStepper>5 then
  1511. ScoreMotorStepper=0
  1512. end if
  1513. end if
  1514. end if
  1515.  
  1516. end sub
  1517.  
  1518. sub NextBallDelay_timer()
  1519. If KickoffFlag=true then exit sub
  1520. NextBallDelay.enabled=false
  1521. nextball
  1522.  
  1523. end sub
  1524.  
  1525. Sub NewGameHoldTimer_timer
  1526. if KickoffFlag=true then exit sub
  1527. NewGameHoldTimer.enabled=false
  1528. newgame
  1529. end sub
  1530.  
  1531. sub newgame
  1532. InProgress=true
  1533. debugscore=0
  1534. EMReel1.ResetToZero
  1535. EMReel2.ResetToZero
  1536. MatchTextBox.text=""
  1537. 'BallTextBox.text=FormatNumber(BallInPlay,0)
  1538. for i = 1 to 2
  1539. Score(i)=0
  1540. Score100K(1)=0
  1541. HighScorePaid(i)=false
  1542. Replay1Paid(i)=false
  1543. Replay2Paid(i)=false
  1544. Replay3Paid(i)=false
  1545. Replay4Paid(i)=false
  1546. ReplayBalls1Paid(i)=false
  1547. ReplayBalls2Paid(i)=false
  1548. ReplayBalls3Paid(i)=false
  1549.  
  1550. next
  1551. If B2SOn Then
  1552. Controller.B2SSetTilt 0
  1553. Controller.B2SSetGameOver 0
  1554. Controller.B2SSetMatch 0
  1555. Controller.B2SSetScorePlayer1 0
  1556. Controller.B2SSetScorePlayer2 0
  1557. ' Controller.B2SSetScorePlayer3 0
  1558. ' Controller.B2SSetScorePlayer4 0
  1559. Controller.B2SSetBallInPlay BallInPlay
  1560. End if
  1561.  
  1562.  
  1563. AltRelayValue=0
  1564.  
  1565. BaseHit=0
  1566. BaseHitCounter=0
  1567. BonusCounter=0
  1568. For each obj in LeftBonus
  1569. obj.state=0
  1570. next
  1571.  
  1572. For each obj in LeftSpinnerLights
  1573. obj.state=0
  1574. next
  1575. For each obj in RightSpinnerLights
  1576. obj.state=0
  1577. next
  1578. For each obj in StarLights
  1579. obj.state=0
  1580. next
  1581. For each obj in TargetAdvanceLights
  1582. obj.state=0
  1583. next
  1584.  
  1585.  
  1586. LeftOutlaneLight.state=0
  1587. RightOutlaneLight.state=0
  1588. LeftSpinnerLight.state=0
  1589.  
  1590.  
  1591. ToggleArrowRelay
  1592. ResetBalls
  1593. playsound "StartBall1"
  1594. End sub
  1595.  
  1596. sub nextball
  1597. ' If B2SOn Then
  1598. ' Controller.B2SSetTilt 0
  1599. ' End If
  1600. If ShootAgainLight.state=1 then
  1601. ShootAgainLight.state=0
  1602. ShootAgainReel.Setvalue(0)
  1603. If B2SOn then Controller.B2SSetShootAgain 0
  1604. else
  1605. Player=Player+1
  1606. end if
  1607. If Player>Players Then
  1608. BallInPlay=BallInPlay+1
  1609. If BallInPlay>BallsPerGame then
  1610. PlaySound("MotorLeer")
  1611. InProgress=false
  1612.  
  1613. If B2SOn Then
  1614. Controller.B2SSetGameOver 1
  1615. Controller.B2SSetPlayerUp 0
  1616. Controller.B2SSetBallInPlay 0
  1617. Controller.B2SSetCanPlay 0
  1618. Controller.B2SSetData 81,0
  1619. Controller.B2SSetData 82,0
  1620. Controller.B2SSetData 83,0
  1621. Controller.B2SSetData 84,0
  1622. End If
  1623. For each obj in PlayerHuds
  1624. obj.SetValue(0)
  1625. next
  1626. For each obj in PlayerHUDScores
  1627. obj.state=0
  1628. next
  1629. If Table1.ShowDT = True then
  1630. For each obj in PlayerScores
  1631. obj.visible=1
  1632. Next
  1633. For each obj in PlayerScoresOn
  1634. obj.visible=0
  1635. Next
  1636. end If
  1637. 'InstructCard.image="IC"
  1638.  
  1639. BallInPlayReel.SetValue(0)
  1640. CanPlayReel.SetValue(0)
  1641. GameOverReel.setvalue(1)
  1642. LeftFlipper.RotateToStart
  1643. RightFlipper.RotateToStart
  1644. LightsOut
  1645. PlasticsOff
  1646. BallTextBox.text=""
  1647. if TableTilted=false then
  1648. checkmatch
  1649. end if
  1650. CheckHighScore
  1651. Players=0
  1652. HighScoreTimer.interval=100
  1653. HighScoreTimer.enabled=True
  1654. Else
  1655. Player=1
  1656. If B2SOn Then
  1657. Controller.B2SSetPlayerUp Player
  1658. Controller.B2SSetData 81,0
  1659. Controller.B2SSetData 82,0
  1660. Controller.B2SSetData 83,0
  1661. Controller.B2SSetData 84,0
  1662. Controller.B2SSetData 80+Player,1
  1663. Controller.B2SSetBallInPlay BallInPlay
  1664.  
  1665. End If
  1666. ' PlaySound("RotateThruPlayers")
  1667. TempPlayerUp=Player
  1668. PlayerUpRotator.enabled=true
  1669. PlayStartBall.enabled=true
  1670. For each obj in PlayerHuds
  1671. obj.SetValue(0)
  1672. next
  1673. For each obj in PlayerHUDScores
  1674. obj.state=0
  1675. next
  1676. If Table1.ShowDT = True then
  1677. For each obj in PlayerScores
  1678. obj.visible=1
  1679. Next
  1680. For each obj in PlayerScoresOn
  1681. obj.visible=0
  1682. Next
  1683. PlayerHuds(Player-1).SetValue(1)
  1684. PlayerHUDScores(Player-1).state=1
  1685. PlayerHUDScores(Player+3).state=1
  1686. PlayerScores(Player-1).visible=0
  1687. PlayerScoresOn(Player-1).visible=1
  1688. ' PlayerHuds(Player).SetValue(1)
  1689. ' PlayerHUDScores(Player).state=1
  1690. ' PlayerScores(Player).visible=0
  1691. ' PlayerScoresOn(Player).visible=1
  1692. end If
  1693. ToggleArrowRelay
  1694. ResetBalls
  1695. End If
  1696. Else
  1697. If B2SOn Then
  1698. Controller.B2SSetPlayerUp Player
  1699. Controller.B2SSetData 81,0
  1700. Controller.B2SSetData 82,0
  1701. Controller.B2SSetData 83,0
  1702. Controller.B2SSetData 84,0
  1703. Controller.B2SSetData 80+Player,1
  1704. Controller.B2SSetBallInPlay BallInPlay
  1705. End If
  1706. ' PlaySound("RotateThruPlayers")
  1707. TempPlayerUp=Player
  1708. ' PlayerUpRotator.enabled=true
  1709. PlayStartBall.enabled=true
  1710. For each obj in PlayerHuds
  1711. obj.SetValue(0)
  1712. next
  1713. For each obj in PlayerHUDScores
  1714. obj.state=0
  1715. next
  1716. If Table1.ShowDT = True then
  1717. For each obj in PlayerScores
  1718. obj.visible=1
  1719. Next
  1720. For each obj in PlayerScoresOn
  1721. obj.visible=0
  1722. Next
  1723. PlayerHuds(Player-1).SetValue(1)
  1724. PlayerHUDScores(Player-1).state=1
  1725. PlayerHUDScores(Player+3).state=1
  1726. PlayerScores(Player-1).visible=0
  1727. PlayerScoresOn(Player-1).visible=1
  1728. ' PlayerHuds(Player).SetValue(1)
  1729. ' PlayerHUDScores(Player).state=1
  1730. ' PlayerScores(Player).visible=0
  1731. ' PlayerScoresOn(Player).visible=1
  1732. end If
  1733. ResetBalls
  1734. End If
  1735.  
  1736. End sub
  1737.  
  1738. sub CheckHighScore
  1739. Dim playertops
  1740. dim si
  1741. dim sj
  1742. dim stemp
  1743. dim stempplayers
  1744. for i=1 to 4
  1745. sortscores(i)=0
  1746. sortplayers(i)=0
  1747. sortpoints(i)=0
  1748. sortplayerpoints(i)=0
  1749. next
  1750. playertops=0
  1751. for i = 1 to Players
  1752. sortscores(i)=Score(i)
  1753. sortplayers(i)=i
  1754.  
  1755. next
  1756.  
  1757. ScoreChecker=5
  1758. CheckAllScores=1
  1759. CheckAllPoints=0
  1760. NewHighScore sortscores(ScoreChecker-1),sortplayers(ScoreChecker-1)
  1761. savehs
  1762. end sub
  1763.  
  1764. sub checkmatch
  1765. Dim tempmatch
  1766. If ExtraBallFlag>0 then Exit Sub
  1767. tempmatch=Int(Rnd*10)
  1768. Match=tempmatch
  1769. MatchReel.SetValue(tempmatch+1)
  1770. if Match=0 then
  1771. MatchTextBox.text="Match: 0"
  1772. else
  1773. MatchTextBox.text="Match: " + FormatNumber(Match,0)
  1774. end if
  1775.  
  1776. If B2SOn Then
  1777. If Match = 0 Then
  1778. Controller.B2SSetMatch 100
  1779. Else
  1780. Controller.B2SSetMatch Match*10
  1781. End If
  1782. End if
  1783. Match=Match*10
  1784. for i = 1 to Players
  1785. if Match=(Score(i) mod 100) then
  1786. AddSpecial
  1787. end if
  1788. next
  1789. end sub
  1790.  
  1791. Sub TiltTimer_Timer()
  1792. if TiltCount > 0 then TiltCount = TiltCount - 1
  1793. if TiltCount = 0 then
  1794. TiltTimer.Enabled = False
  1795. end if
  1796. end sub
  1797.  
  1798. Sub TiltIt()
  1799. TiltCount = TiltCount + 1
  1800. if TiltCount = 3 then
  1801. TableTilted=True
  1802. PlasticsOff
  1803.  
  1804. BumpersOff
  1805. LeftFlipper.RotateToStart
  1806. RightFlipper.RotateToStart
  1807. TiltReel.SetValue(1)
  1808. If B2Son then
  1809. Controller.B2SSetTilt 1
  1810. end if
  1811.  
  1812. else
  1813. TiltTimer.Interval = 500
  1814. TiltTimer.Enabled = True
  1815. end if
  1816.  
  1817. end sub
  1818.  
  1819. Sub IncreaseBonus()
  1820.  
  1821.  
  1822. If BonusCounter>=10 and BonusCounter<20 then
  1823. LeftBonus(BonusCounter-10).state=0
  1824. BonusCounter=BonusCounter+1
  1825. If BonusCounter<20 then
  1826. LeftBonus(10).state=1
  1827. LeftBonus(BonusCounter-10).state=1
  1828. else
  1829. LeftBonus(10).state=0
  1830. LeftBonus(11).state=1
  1831. end if
  1832. elseif BonusCounter=20 then
  1833. exit sub
  1834. else
  1835. If BonusCounter>0 then
  1836. LeftBonus(BonusCounter).state=0
  1837. end if
  1838. BonusCounter=BonusCounter+1
  1839. LeftBonus(BonusCounter).State=1
  1840. ' PlaySound("Score100")
  1841.  
  1842. end if
  1843.  
  1844. End Sub
  1845.  
  1846. Sub IncreaseRightBonus()
  1847.  
  1848.  
  1849. If RightBonusCounter=10 then
  1850. RightBonusCounter=1
  1851. RightBonus(RightBonusCounter).state=1
  1852. RightBonus(10).state=0
  1853. else
  1854. If RightBonusCounter>0 then
  1855. RightBonus(RightBonusCounter).state=0
  1856. end if
  1857. RightBonusCounter=RightBonusCounter+1
  1858. RightBonus(RightBonusCounter).State=1
  1859. 'PlaySound("Score100")
  1860. end if
  1861.  
  1862. End Sub
  1863.  
  1864. Sub BonusBoost_Timer()
  1865. IncreaseBonus
  1866. AddScore(AdvanceFlag)
  1867. BonusBoosterCounter=BonusBoosterCounter-1
  1868. if BonusBoosterCounter<1 then
  1869. BonusBoost.enabled=false
  1870. end if
  1871. end sub
  1872.  
  1873. Sub CheckForLightSpecial()
  1874.  
  1875. end sub
  1876.  
  1877. Sub PlayStartBall_timer()
  1878.  
  1879. PlayStartBall.enabled=false
  1880. PlaySound("StartBall2-5")
  1881. end sub
  1882.  
  1883. Sub PlayerUpRotator_timer()
  1884. Exit Sub
  1885. If RotatorTemp<5 then
  1886. TempPlayerUp=TempPlayerUp+1
  1887. If TempPlayerUp>4 then
  1888. TempPlayerUp=1
  1889. end if
  1890. For each obj in PlayerHuds
  1891. obj.SetValue(0)
  1892. next
  1893. For each obj in PlayerHUDScores
  1894. obj.state=0
  1895. next
  1896. If Table1.ShowDT = True then
  1897. For each obj in PlayerScores
  1898. obj.visible=1
  1899. Next
  1900. For each obj in PlayerScoresOn
  1901. obj.visible=0
  1902. Next
  1903. PlayerHuds(TempPlayerUp-1).SetValue(1)
  1904.  
  1905. PlayerScores(TempPlayerUp-1).visible=0
  1906. PlayerScoresOn(TempPlayerUp-1).visible=1
  1907. end If
  1908. If B2SOn Then
  1909. Controller.B2SSetPlayerUp TempPlayerUp
  1910. Controller.B2SSetData 81,0
  1911. Controller.B2SSetData 82,0
  1912. Controller.B2SSetData 83,0
  1913. Controller.B2SSetData 84,0
  1914. Controller.B2SSetData 80+TempPlayerUp,1
  1915. End If
  1916.  
  1917. else
  1918. if B2SOn then
  1919. Controller.B2SSetPlayerUp Player
  1920. Controller.B2SSetData 81,0
  1921. Controller.B2SSetData 82,0
  1922. Controller.B2SSetData 83,0
  1923. Controller.B2SSetData 84,0
  1924. Controller.B2SSetData 80+Player,1
  1925. end if
  1926. PlayerUpRotator.enabled=false
  1927. RotatorTemp=1
  1928. For each obj in PlayerHuds
  1929. obj.SetValue(0)
  1930. next
  1931. For each obj in PlayerHUDScores
  1932. obj.state=0
  1933. next
  1934. If Table1.ShowDT = True then
  1935. For each obj in PlayerScores
  1936. obj.visible=1
  1937. Next
  1938. For each obj in PlayerScoresOn
  1939. obj.visible=0
  1940. Next
  1941. PlayerHuds(Player-1).SetValue(1)
  1942.  
  1943. PlayerScores(Player-1).visible=0
  1944. PlayerScoresOn(Player-1).visible=1
  1945. end If
  1946. end if
  1947. RotatorTemp=RotatorTemp+1
  1948.  
  1949.  
  1950. end sub
  1951.  
  1952.  
  1953. sub savehs
  1954. ' Based on Black's Highscore routines
  1955. Dim FileObj
  1956. Dim ScoreFile
  1957. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1958. If Not FileObj.FolderExists(UserDirectory) then
  1959. Exit Sub
  1960. End if
  1961. Set ScoreFile=FileObj.CreateTextFile(UserDirectory & HSFileName,True)
  1962. ScoreFile.WriteLine 2
  1963. ScoreFile.WriteLine Credits
  1964. scorefile.writeline BallsPerGame
  1965. ScoreFile.WriteLine ReplayLevel
  1966. ScoreFile.WriteLine SuperAdvanceFlag
  1967. ScoreFile.WriteLine ExtraBallFlag
  1968. ScoreFile.WriteLine AdvanceFlag
  1969.  
  1970. for xx=1 to 5
  1971. scorefile.writeline HSScore(xx)
  1972. next
  1973. for xx=1 to 5
  1974. scorefile.writeline HSName(xx)
  1975. next
  1976. for xx=6 to 10
  1977. scorefile.writeline HSScore(xx)
  1978. next
  1979. for xx=6 to 10
  1980. scorefile.writeline HSName(xx)
  1981. next
  1982. ScoreFile.Close
  1983. Set ScoreFile=Nothing
  1984. Set FileObj=Nothing
  1985. end sub
  1986.  
  1987. sub loadhs
  1988. ' Based on Black's Highscore routines
  1989. Dim FileObj
  1990. Dim ScoreFile
  1991. dim temp1
  1992. dim temp2
  1993. dim temp3
  1994. dim temp4
  1995. dim temp5
  1996. dim temp6
  1997. dim temp7
  1998. dim temp8
  1999. dim temp9
  2000. dim temp10
  2001. dim temp11
  2002. dim temp12
  2003. dim temp13
  2004. dim temp14
  2005. dim temp15
  2006. dim temp16
  2007. dim temp17
  2008. dim temp18
  2009. dim temp19
  2010. dim temp20
  2011. dim temp21
  2012. dim temp22
  2013. dim temp23
  2014. dim temp24
  2015. dim temp25
  2016. dim temp26
  2017. dim temp27
  2018.  
  2019. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2020. If Not FileObj.FolderExists(UserDirectory) then
  2021. Exit Sub
  2022. End if
  2023. If Not FileObj.FileExists(UserDirectory & HSFileName) then
  2024. Exit Sub
  2025. End if
  2026. Set ScoreFile=FileObj.GetFile(UserDirectory & HSFileName)
  2027. Set TextStr=ScoreFile.OpenAsTextStream(1,0)
  2028. If (TextStr.AtEndOfStream=True) then
  2029. Exit Sub
  2030. End if
  2031. temp1=TextStr.ReadLine
  2032. temp2=textstr.readline
  2033. temp3=textstr.readline
  2034. temp4=textstr.readline
  2035. temp5=textstr.readline
  2036. temp6=textstr.readline
  2037. temp7=textstr.readline
  2038. HighScore=cdbl(temp1)
  2039. if HighScore=2 then
  2040.  
  2041. temp8=textstr.readline
  2042. temp9=textstr.readline
  2043. temp10=textstr.readline
  2044. temp11=textstr.readline
  2045. temp12=textstr.readline
  2046. temp13=textstr.readline
  2047. temp14=textstr.readline
  2048. temp15=textstr.readline
  2049. temp16=textstr.readline
  2050. temp17=textstr.readline
  2051. temp18=textstr.readline
  2052. temp19=textstr.readline
  2053. temp20=textstr.readline
  2054. temp21=textstr.readline
  2055. temp22=textstr.readline
  2056. temp23=textstr.readline
  2057. temp24=textstr.readline
  2058. temp25=textstr.readline
  2059. temp26=textstr.readline
  2060. temp27=textstr.readline
  2061. end if
  2062. TextStr.Close
  2063. if HighScore=2 then
  2064.  
  2065. Credits=cdbl(temp2)
  2066. BallsPerGame=cdbl(temp3)
  2067. ReplayLevel=cdbl(temp4)
  2068. SuperAdvanceFlag=int(temp5)
  2069. ExtraBallFlag=cdbl(temp6)
  2070. AdvanceFlag= int(temp7)
  2071. HSScore(1) = int(temp8)
  2072. HSScore(2) = int(temp9)
  2073. HSScore(3) = int(temp10)
  2074. HSScore(4) = int(temp11)
  2075. HSScore(5) = int(temp12)
  2076.  
  2077. HSName(1) = temp13
  2078. HSName(2) = temp14
  2079. HSName(3) = temp15
  2080. HSName(4) = temp16
  2081. HSName(5) = temp17
  2082.  
  2083. HSScore(6) = int(temp18)
  2084. HSScore(7) = int(temp19)
  2085. HSScore(8) = int(temp20)
  2086. HSScore(9) = int(temp21)
  2087. HSScore(10) = int(temp22)
  2088.  
  2089. HSName(6) = temp23
  2090. HSName(7) = temp24
  2091. HSName(8) = temp25
  2092. HSName(9) = temp26
  2093. HSName(10) = temp27
  2094.  
  2095. end if
  2096. Set ScoreFile=Nothing
  2097. Set FileObj=Nothing
  2098. end sub
  2099.  
  2100. sub SaveLMEMConfig
  2101. Dim FileObj
  2102. Dim LMConfig
  2103. dim temp1
  2104. dim tempb2s
  2105. tempb2s=0
  2106. if B2SOn=true then
  2107. tempb2s=1
  2108. else
  2109. tempb2s=0
  2110. end if
  2111. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2112. If Not FileObj.FolderExists(UserDirectory) then
  2113. Exit Sub
  2114. End if
  2115. Set LMConfig=FileObj.CreateTextFile(UserDirectory & LMEMTableConfig,True)
  2116. LMConfig.WriteLine tempb2s
  2117. LMConfig.Close
  2118. Set LMConfig=Nothing
  2119. Set FileObj=Nothing
  2120.  
  2121. end Sub
  2122.  
  2123. sub LoadLMEMConfig
  2124. Dim FileObj
  2125. Dim LMConfig
  2126. dim tempC
  2127. dim tempb2s
  2128.  
  2129. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2130. If Not FileObj.FolderExists(UserDirectory) then
  2131. Exit Sub
  2132. End if
  2133. If Not FileObj.FileExists(UserDirectory & LMEMTableConfig) then
  2134. Exit Sub
  2135. End if
  2136. Set LMConfig=FileObj.GetFile(UserDirectory & LMEMTableConfig)
  2137. Set TextStr2=LMConfig.OpenAsTextStream(1,0)
  2138. If (TextStr2.AtEndOfStream=True) then
  2139. Exit Sub
  2140. End if
  2141. tempC=TextStr2.ReadLine
  2142. TextStr2.Close
  2143. tempb2s=cdbl(tempC)
  2144. if tempb2s=0 then
  2145. B2SOn=false
  2146. else
  2147. B2SOn=true
  2148. end if
  2149. Set LMConfig=Nothing
  2150. Set FileObj=Nothing
  2151. end sub
  2152.  
  2153. sub SaveLMEMConfig2
  2154. If ShadowConfigFile=false then exit sub
  2155. Dim FileObj
  2156. Dim LMConfig2
  2157. dim temp1
  2158. dim temp2
  2159. dim tempBS
  2160. dim tempFS
  2161.  
  2162. if EnableBallShadow=true then
  2163. tempBS=1
  2164. else
  2165. tempBS=0
  2166. end if
  2167. if EnableFlipperShadow=true then
  2168. tempFS=1
  2169. else
  2170. tempFS=0
  2171. end if
  2172.  
  2173. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2174. If Not FileObj.FolderExists(UserDirectory) then
  2175. Exit Sub
  2176. End if
  2177. Set LMConfig2=FileObj.CreateTextFile(UserDirectory & LMEMShadowConfig,True)
  2178. LMConfig2.WriteLine tempBS
  2179. LMConfig2.WriteLine tempFS
  2180. LMConfig2.Close
  2181. Set LMConfig2=Nothing
  2182. Set FileObj=Nothing
  2183.  
  2184. end Sub
  2185.  
  2186. sub LoadLMEMConfig2
  2187. If ShadowConfigFile=false then
  2188. EnableBallShadow = ShadowBallOn
  2189. BallShadowUpdate.enabled = ShadowBallOn
  2190. EnableFlipperShadow = ShadowFlippersOn
  2191. FlipperLSh.visible = ShadowFlippersOn
  2192. FlipperRSh.visible = ShadowFlippersOn
  2193. exit sub
  2194. end if
  2195. Dim FileObj
  2196. Dim LMConfig2
  2197. dim tempC
  2198. dim tempD
  2199. dim tempFS
  2200. dim tempBS
  2201.  
  2202. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2203. If Not FileObj.FolderExists(UserDirectory) then
  2204. Exit Sub
  2205. End if
  2206. If Not FileObj.FileExists(UserDirectory & LMEMShadowConfig) then
  2207. Exit Sub
  2208. End if
  2209. Set LMConfig2=FileObj.GetFile(UserDirectory & LMEMShadowConfig)
  2210. Set TextStr2=LMConfig2.OpenAsTextStream(1,0)
  2211. If (TextStr2.AtEndOfStream=True) then
  2212. Exit Sub
  2213. End if
  2214. tempC=TextStr2.ReadLine
  2215. tempD=TextStr2.Readline
  2216. TextStr2.Close
  2217. tempBS=cdbl(tempC)
  2218. tempFS=cdbl(tempD)
  2219. if tempBS=0 then
  2220. EnableBallShadow=false
  2221. BallShadowUpdate.enabled=false
  2222. else
  2223. EnableBallShadow=true
  2224. end if
  2225. if tempFS=0 then
  2226. EnableFlipperShadow=false
  2227. FlipperLSh.visible=false
  2228. FLipperRSh.visible=false
  2229. else
  2230. EnableFlipperShadow=true
  2231. end if
  2232. Set LMConfig2=Nothing
  2233. Set FileObj=Nothing
  2234.  
  2235. end sub
  2236.  
  2237. Sub DisplayHighScore
  2238.  
  2239. end sub
  2240.  
  2241.  
  2242. sub InitPauser5_timer
  2243. If B2SOn Then
  2244. 'Controller.B2SSetScore 4,HighScore
  2245. End If
  2246. DisplayHighScore
  2247. InitPauser5.enabled=false
  2248. end sub
  2249.  
  2250. sub target001_hit
  2251. target1.transy=-4
  2252. target001.timerenabled=1
  2253. end sub
  2254.  
  2255. sub target002_hit
  2256. target2.transy=-4
  2257. target001.timerenabled=1
  2258. end sub
  2259.  
  2260. sub target001_timer
  2261. target1.transy=0
  2262. target2.transy=0
  2263. target001.timerenabled=0
  2264. end sub
  2265.  
  2266. sub BumpersOff
  2267.  
  2268. ' Bumper1Light.visible=0
  2269. ' Bumper2Light.visible=0
  2270.  
  2271.  
  2272.  
  2273. end sub
  2274.  
  2275. sub BumpersOn
  2276. ' Bumper1Light.visible=1
  2277. ' Bumper2Light.visible=1
  2278.  
  2279.  
  2280. end sub
  2281.  
  2282. Sub PlasticsOn
  2283.  
  2284. For each xx in flashers:xx.State = 1: Next
  2285. playfield_off.visible=0
  2286. For each xx in layercol1: xx.image = "layer1": Next
  2287. For each xx in layercol2: xx.image = "layer2": Next
  2288. For each xx in layercol3: xx.image = "layer3": Next
  2289. For each xx in layercol4: xx.image = "layer4": Next
  2290. backmetal.image="backmetal"
  2291. toparch.image="archmission"
  2292. ' toparch.image="archodyssey" 'for odyssey
  2293. bumpcaps.image="bumpcapsmission"
  2294. ' bumpcaps.image="bumpcapsodyssey" 'for odyssey
  2295.  
  2296.  
  2297. end sub
  2298.  
  2299. Sub PlasticsOff
  2300. dim xx
  2301. For each xx in flashers:xx.State = 0: Next
  2302. StopSound "buzz"
  2303. StopSound "buzzL"
  2304. playfield_off.visible=1
  2305. For each xx in layercol1: xx.image = "layer1off": Next
  2306. For each xx in layercol2: xx.image = "layer2off": Next
  2307. For each xx in layercol3: xx.image = "layer3off": Next
  2308. For each xx in layercol4: xx.image = "layer4off": Next
  2309. backmetal.image="backmetaloff"
  2310. toparch.image="archmissionoff"
  2311. ' toparch.image="archodysseyoff" 'for odyssey
  2312. bumpcaps.image="bumpcapsmissionoff"
  2313. ' bumpcaps.image="bumpcapsodysseyoff" 'for odyssey
  2314. end sub
  2315.  
  2316. Sub SetupReplayTables
  2317.  
  2318. Replay1Table(1)=114000
  2319. Replay1Table(2)=116000
  2320. Replay1Table(3)=118000
  2321. Replay1Table(4)=120000
  2322. Replay1Table(5)=122000
  2323. Replay1Table(6)=124000
  2324. Replay1Table(7)=126000
  2325. Replay1Table(8)=128000
  2326. Replay1Table(9)=130000
  2327. Replay1Table(10)=132000
  2328. Replay1Table(11)=134000
  2329. Replay1Table(12)=136000
  2330. Replay1Table(13)=138000
  2331. Replay1Table(14)=140000
  2332. Replay1Table(15)=142000
  2333. Replay1Table(16)=130000
  2334. Replay1Table(17)=132000
  2335. Replay1Table(18)=134000
  2336. Replay1Table(19)=136000
  2337. Replay1Table(20)=138000
  2338. Replay1Table(21)=140000
  2339. Replay1Table(22)=142000
  2340. Replay1Table(23)=144000
  2341. Replay1Table(24)=146000
  2342. Replay1Table(25)=148000
  2343. Replay1Table(26)=150000
  2344. Replay1Table(27)=152000
  2345. Replay1Table(28)=154000
  2346. Replay1Table(29)=156000
  2347. Replay1Table(30)=158000
  2348. Replay1Table(31)=160000
  2349. Replay1Table(32)=162000
  2350. Replay1Table(33)=164000
  2351. Replay1Table(34)=166000
  2352. Replay1Table(35)=168000
  2353.  
  2354.  
  2355.  
  2356. Replay2Table(1)=145000
  2357. Replay2Table(2)=147000
  2358. Replay2Table(3)=149000
  2359. Replay2Table(4)=151000
  2360. Replay2Table(5)=153000
  2361. Replay2Table(6)=155000
  2362. Replay2Table(7)=157000
  2363. Replay2Table(8)=159000
  2364. Replay2Table(9)=161000
  2365. Replay2Table(10)=163000
  2366. Replay2Table(11)=165000
  2367. Replay2Table(12)=167000
  2368. Replay2Table(13)=169000
  2369. Replay2Table(14)=171000
  2370. Replay2Table(15)=173000
  2371. Replay2Table(16)=174000
  2372. Replay2Table(17)=176000
  2373. Replay2Table(18)=178000
  2374. Replay2Table(19)=180000
  2375. Replay2Table(20)=182000
  2376. Replay2Table(21)=184000
  2377. Replay2Table(22)=186000
  2378. Replay2Table(23)=188000
  2379. Replay2Table(24)=190000
  2380. Replay2Table(25)=192000
  2381. Replay2Table(26)=194000
  2382. Replay2Table(27)=196000
  2383. Replay2Table(28)=198000
  2384. Replay2Table(29)=198000
  2385. Replay2Table(30)=197000
  2386. Replay2Table(31)=198000
  2387. Replay2Table(32)=198000
  2388. Replay2Table(33)=198000
  2389. Replay2Table(34)=198000
  2390. Replay2Table(35)=197000
  2391.  
  2392.  
  2393. Replay3Table(1)=176000
  2394. Replay3Table(2)=178000
  2395. Replay3Table(3)=180000
  2396. Replay3Table(4)=182000
  2397. Replay3Table(5)=184000
  2398. Replay3Table(6)=186000
  2399. Replay3Table(7)=188000
  2400. Replay3Table(8)=190000
  2401. Replay3Table(9)=192000
  2402. Replay3Table(10)=194000
  2403. Replay3Table(11)=196000
  2404. Replay3Table(12)=198000
  2405. Replay3Table(13)=197000
  2406. Replay3Table(14)=198000
  2407. Replay3Table(15)=198000
  2408. Replay3Table(16)=999000
  2409. Replay3Table(17)=999000
  2410. Replay3Table(18)=999000
  2411. Replay3Table(19)=999000
  2412. Replay3Table(20)=999000
  2413. Replay3Table(21)=999000
  2414. Replay3Table(22)=999000
  2415. Replay3Table(23)=999000
  2416. Replay3Table(24)=999000
  2417. Replay3Table(25)=999000
  2418. Replay3Table(26)=999000
  2419. Replay3Table(27)=999000
  2420. Replay3Table(28)=999000
  2421. Replay3Table(29)=999000
  2422. Replay3Table(30)=999000
  2423. Replay3Table(31)=999000
  2424. Replay3Table(32)=999000
  2425. Replay3Table(33)=999000
  2426. Replay3Table(34)=999000
  2427. Replay3Table(35)=999000
  2428.  
  2429.  
  2430. Replay4Table(1)=999000
  2431. Replay4Table(2)=999000
  2432. Replay4Table(3)=999000
  2433. Replay4Table(4)=999000
  2434. Replay4Table(5)=999000
  2435. Replay4Table(6)=999000
  2436. Replay4Table(7)=999000
  2437. Replay4Table(8)=999000
  2438. Replay4Table(9)=999000
  2439. Replay4Table(10)=999000
  2440. Replay4Table(11)=999000
  2441. Replay4Table(12)=999000
  2442. Replay4Table(13)=999000
  2443. Replay4Table(14)=999000
  2444. Replay4Table(15)=999000
  2445. Replay4Table(16)=999000
  2446. Replay4Table(17)=999000
  2447. Replay4Table(18)=999000
  2448. Replay4Table(19)=999000
  2449. Replay4Table(20)=999000
  2450. Replay4Table(21)=999000
  2451. Replay4Table(22)=999000
  2452. Replay4Table(23)=999000
  2453. Replay4Table(24)=999000
  2454. Replay4Table(25)=999000
  2455. Replay4Table(26)=999000
  2456. Replay4Table(27)=999000
  2457. Replay4Table(28)=999000
  2458. Replay4Table(29)=999000
  2459. Replay4Table(30)=999000
  2460. Replay4Table(31)=999000
  2461. Replay4Table(32)=999000
  2462. Replay4Table(33)=999000
  2463. Replay4Table(34)=999000
  2464. Replay4Table(35)=999000
  2465.  
  2466.  
  2467. ReplayTableMax=35
  2468.  
  2469. ReplayBallsTable1(1)=99
  2470. ReplayBallsTable1(2)=99
  2471. ReplayBallsTable1(3)=11
  2472. ReplayBallsTable1(4)=11
  2473. ReplayBallsTable1(5)=12
  2474. ReplayBallsTable1(6)=16
  2475. ReplayBallsTable1(7)=17
  2476. ReplayBallsTable1(8)=18
  2477. ReplayBallsTable1(9)=19
  2478. ReplayBallsTable1(10)=19
  2479. ReplayBallsTable1(11)=99
  2480. ReplayBallsTable1(12)=99
  2481. ReplayBallsTable1(13)=99
  2482. ReplayBallsTable1(14)=99
  2483. ReplayBallsTable1(15)=99
  2484. ReplayBallsTable1(16)=99
  2485.  
  2486. ReplayBallsTable2(1)=99
  2487. ReplayBallsTable2(2)=99
  2488. ReplayBallsTable2(3)=15
  2489. ReplayBallsTable2(4)=16
  2490. ReplayBallsTable2(5)=15
  2491. ReplayBallsTable2(6)=22
  2492. ReplayBallsTable2(7)=22
  2493. ReplayBallsTable2(8)=23
  2494. ReplayBallsTable2(9)=23
  2495. ReplayBallsTable2(10)=24
  2496. ReplayBallsTable2(11)=99
  2497. ReplayBallsTable2(12)=99
  2498. ReplayBallsTable2(13)=99
  2499. ReplayBallsTable2(14)=99
  2500. ReplayBallsTable2(15)=99
  2501. ReplayBallsTable2(16)=99
  2502.  
  2503. ReplayBallsTable3(1)=99
  2504. ReplayBallsTable3(2)=99
  2505. ReplayBallsTable3(3)=17
  2506. ReplayBallsTable3(4)=18
  2507. ReplayBallsTable3(5)=17
  2508. ReplayBallsTable3(6)=28
  2509. ReplayBallsTable3(7)=28
  2510. ReplayBallsTable3(8)=29
  2511. ReplayBallsTable3(9)=28
  2512. ReplayBallsTable3(10)=30
  2513. ReplayBallsTable3(11)=99
  2514. ReplayBallsTable3(12)=99
  2515. ReplayBallsTable3(13)=99
  2516. ReplayBallsTable3(14)=99
  2517. ReplayBallsTable3(15)=99
  2518. ReplayBallsTable3(16)=99
  2519.  
  2520. ReplayBallsTableMax=2
  2521.  
  2522. end sub
  2523.  
  2524. Sub RefreshReplayCard
  2525. Dim tempst1
  2526. Dim tempst2
  2527. Dim tempst3
  2528.  
  2529. tempst1=FormatNumber(BallsPerGame,0)
  2530. tempst2=FormatNumber(ReplayLevel,0)
  2531. tempst3=FormatNumber(ReplayBalls,0)
  2532.  
  2533. ReplayCard.image="BC" + tempst1
  2534. ReplayCard1.image = "SC" + tempst2
  2535. ReplayCard2.image = "PR"
  2536.  
  2537. Replay1=Replay1Table(ReplayLevel)
  2538. Replay2=Replay2Table(ReplayLevel)
  2539. Replay3=Replay3Table(ReplayLevel)
  2540. Replay4=Replay4Table(ReplayLevel)
  2541. BallReplay1=ReplayBallsTable1(ReplayBalls)
  2542. BallReplay2=ReplayBallsTable2(ReplayBalls)
  2543. BallReplay3=ReplayBallsTable3(ReplayBalls)
  2544. end sub
  2545.  
  2546. '****************************************
  2547. ' SCORE MOTOR
  2548. '****************************************
  2549.  
  2550.  
  2551. ScoreMotorTimer.Enabled = 1
  2552. ScoreMotorTimer.Interval = 135 '135
  2553. AddScoreTimer.Enabled = 1
  2554. AddScoreTimer.Interval = 135
  2555.  
  2556. Dim queuedscore
  2557. Dim MotorMode
  2558. Dim MotorPosition
  2559.  
  2560. Sub SetMotor(y)
  2561. Select Case ScoreMotorAdjustment
  2562. Case 0:
  2563. queuedscore=queuedscore+y
  2564. Case 1:
  2565. If MotorRunning<>1 And InProgress=true then
  2566. queuedscore=queuedscore+y
  2567. end if
  2568. end Select
  2569. end sub
  2570.  
  2571. Sub SetMotor2(x)
  2572. If MotorRunning<>1 And InProgress=true then
  2573. MotorRunning=1
  2574. BaseHitCounter=BaseHit
  2575. LightsOff
  2576. Select Case x
  2577. Case 10:
  2578. AddScore(10)
  2579. MotorRunning=0
  2580. LightsOn
  2581.  
  2582. Case 20:
  2583. MotorMode=10
  2584. MotorPosition=2
  2585. Case 30:
  2586. MotorMode=10
  2587. MotorPosition=3
  2588. Case 40:
  2589. MotorMode=10
  2590. MotorPosition=4
  2591. Case 50:
  2592. MotorMode=10
  2593. ToggleAltRelay
  2594. MotorPosition=5
  2595. Case 100:
  2596. MotorMode=100
  2597. MotorPosition=1
  2598. Case 200:
  2599. MotorMode=100
  2600. MotorPosition=2
  2601. Case 300:
  2602. MotorMode=100
  2603. MotorPosition=3
  2604. Case 400:
  2605. MotorMode=100
  2606. MotorPosition=4
  2607. Case 500:
  2608. MotorMode=100
  2609. ToggleAltRelay
  2610. MotorPosition=5
  2611. Case 1000:
  2612. AddScore(1000)
  2613. MotorRunning=0
  2614. LightsOn
  2615. Case 2000:
  2616. MotorMode=1000
  2617. MotorPosition=2
  2618. Case 3000:
  2619. MotorMode=1000
  2620. MotorPosition=3
  2621. Case 4000:
  2622. MotorMode=1000
  2623. MotorPosition=4
  2624. Case 5000:
  2625. MotorMode=1000
  2626. ToggleAltRelay
  2627. MotorPosition=5
  2628. case 10000:
  2629. AddScore(10000)
  2630. MotorRunning=0
  2631. LightsOn
  2632. Case 50000:
  2633. MotorMode=10000
  2634. MotorPosition=5
  2635.  
  2636. End Select
  2637. End If
  2638. End Sub
  2639.  
  2640. Sub AddScoreTimer_Timer
  2641. Dim tempscore
  2642.  
  2643.  
  2644. If MotorRunning<>1 And InProgress=true then
  2645. if queuedscore>=50000 then
  2646. tempscore=50000
  2647. queuedscore=queuedscore-50000
  2648. SetMotor2(50000)
  2649. exit sub
  2650. end if
  2651. if queuedscore>=10000 then
  2652. tempscore=10000
  2653. queuedscore=queuedscore-10000
  2654. SetMotor2(10000)
  2655. exit sub
  2656. end if
  2657. if queuedscore>=5000 then
  2658. tempscore=5000
  2659. queuedscore=queuedscore-5000
  2660. SetMotor2(5000)
  2661. exit sub
  2662. end if
  2663. if queuedscore>=4000 then
  2664. tempscore=4000
  2665. queuedscore=queuedscore-4000
  2666. SetMotor2(4000)
  2667. exit sub
  2668. end if
  2669.  
  2670. if queuedscore>=3000 then
  2671. tempscore=3000
  2672. queuedscore=queuedscore-3000
  2673. SetMotor2(3000)
  2674. exit sub
  2675. end if
  2676.  
  2677. if queuedscore>=2000 then
  2678. tempscore=2000
  2679. queuedscore=queuedscore-2000
  2680. SetMotor2(2000)
  2681. exit sub
  2682. end if
  2683.  
  2684. if queuedscore>=1000 then
  2685. tempscore=1000
  2686. queuedscore=queuedscore-1000
  2687. SetMotor2(1000)
  2688. exit sub
  2689. end if
  2690.  
  2691. if queuedscore>=500 then
  2692. tempscore=500
  2693. queuedscore=queuedscore-500
  2694. SetMotor2(500)
  2695. exit sub
  2696. end if
  2697. if queuedscore>=400 then
  2698. tempscore=400
  2699. queuedscore=queuedscore-400
  2700. SetMotor2(400)
  2701. exit sub
  2702. end if
  2703. if queuedscore>=300 then
  2704. tempscore=300
  2705. queuedscore=queuedscore-300
  2706. SetMotor2(300)
  2707. exit sub
  2708. end if
  2709. if queuedscore>=200 then
  2710. tempscore=200
  2711. queuedscore=queuedscore-200
  2712. SetMotor2(200)
  2713. exit sub
  2714. end if
  2715. if queuedscore>=100 then
  2716. tempscore=100
  2717. queuedscore=queuedscore-100
  2718. SetMotor2(100)
  2719. exit sub
  2720. end if
  2721.  
  2722. if queuedscore>=50 then
  2723. tempscore=50
  2724. queuedscore=queuedscore-50
  2725. SetMotor2(50)
  2726. exit sub
  2727. end if
  2728. if queuedscore>=40 then
  2729. tempscore=40
  2730. queuedscore=queuedscore-40
  2731. SetMotor2(40)
  2732. exit sub
  2733. end if
  2734. if queuedscore>=30 then
  2735. tempscore=30
  2736. queuedscore=queuedscore-30
  2737. SetMotor2(30)
  2738. exit sub
  2739. end if
  2740. if queuedscore>=20 then
  2741. tempscore=20
  2742. queuedscore=queuedscore-20
  2743. SetMotor2(20)
  2744. exit sub
  2745. end if
  2746. if queuedscore>=10 then
  2747. tempscore=10
  2748. queuedscore=queuedscore-10
  2749. SetMotor2(10)
  2750. exit sub
  2751. end if
  2752.  
  2753. End If
  2754.  
  2755.  
  2756. end Sub
  2757.  
  2758. Sub ScoreMotorTimer_Timer
  2759. If MotorPosition > 0 Then
  2760. Select Case MotorPosition
  2761. Case 5,4,3,2:
  2762. If BaseHitCounter>0 then
  2763. MoveRunners
  2764. BaseHitCounter=BaseHitCounter-1
  2765. end if
  2766. If MotorMode=10000 Then
  2767. AddScore(10000)
  2768. End if
  2769.  
  2770. If MotorMode=1000 Then
  2771. AddScore(1000)
  2772. End if
  2773. if MotorMode=100 then
  2774. AddScore(100)
  2775. End If
  2776. if MotorMode=10 then
  2777. AddScore(10)
  2778. End if
  2779. MotorPosition=MotorPosition-1
  2780. Case 1:
  2781. If MotorMode=10000 Then
  2782. AddScore(10000)
  2783. End if
  2784.  
  2785. If MotorMode=1000 Then
  2786. AddScore(1000)
  2787. end if
  2788. if MotorMode=100 then
  2789. AddScore(100)
  2790. End If
  2791. if MotorMode=10 then
  2792. AddScore(10)
  2793.  
  2794. End if
  2795. MotorPosition=0:MotorRunning=0:LightsOn: BaseHit=0: BaseHitCounter=0
  2796. End Select
  2797. End If
  2798. End Sub
  2799.  
  2800. Sub AddScore(x)
  2801. If TableTilted=true then exit sub
  2802. ImpulseReelCount=ImpulseReelCount+1
  2803. if ImpulseReelCount>4 then
  2804. ImpulseReelCount=0
  2805. end if
  2806. Select Case ScoreAdditionAdjustment
  2807. Case 0:
  2808. AddScore1(x)
  2809. Case 1:
  2810. AddScore2(x)
  2811. end Select
  2812.  
  2813. end sub
  2814.  
  2815.  
  2816. Sub AddScore1(x)
  2817. ' debugtext.text=score
  2818. Select Case x
  2819. Case 1:
  2820. PlayChime(10)
  2821. Score(Player)=Score(Player)+1
  2822. '
  2823. Case 10:
  2824. PlayChime(100)
  2825. Score(Player)=Score(Player)+10
  2826. ' debugscore=debugscore+10
  2827.  
  2828. Case 100:
  2829. PlayChime(1000)
  2830. Score(Player)=Score(Player)+100
  2831. ' debugscore=debugscore+100
  2832. Case 1000:
  2833. PlayChime(1000)
  2834. Score(Player)=Score(Player)+1000
  2835. ' debugscore=debugscore+1000
  2836. End Select
  2837. PlayerScores(Player-1).AddValue(x)
  2838. PlayerScoresOn(Player-1).AddValue(x)
  2839. If ScoreDisplay(Player)<100000 then
  2840. ScoreDisplay(Player)=Score(Player)
  2841. Else
  2842. Score100K(Player)=Int(Score(Player)/100000)
  2843. ScoreDisplay(Player)=Score(Player)-100000
  2844. End If
  2845. if Score(Player)=>1000000 then
  2846. If B2SOn Then
  2847. If Player=1 Then
  2848. Controller.B2SSetScoreRolloverPlayer1 Score100K(Player)
  2849. End If
  2850. If Player=2 Then
  2851. Controller.B2SSetScoreRolloverPlayer2 Score100K(Player)
  2852. End If
  2853.  
  2854. If Player=3 Then
  2855. Controller.B2SSetScoreRolloverPlayer3 Score100K(Player)
  2856. End If
  2857.  
  2858. If Player=4 Then
  2859. Controller.B2SSetScoreRolloverPlayer4 Score100K(Player)
  2860. End If
  2861. End If
  2862. End If
  2863. If B2SOn Then
  2864. Controller.B2SSetScorePlayer Player, ScoreDisplay(Player)
  2865. End If
  2866. If Score(Player)>Replay1 and Replay1Paid(Player)=false then
  2867. Replay1Paid(Player)=True
  2868. AddSpecial
  2869. End If
  2870. If Score(Player)>Replay2 and Replay2Paid(Player)=false then
  2871. Replay2Paid(Player)=True
  2872. AddSpecial
  2873. End If
  2874. If Score(Player)>Replay3 and Replay3Paid(Player)=false then
  2875. Replay3Paid(Player)=True
  2876. AddSpecial
  2877. End If
  2878. ' ScoreText.text=debugscore
  2879. End Sub
  2880.  
  2881. Sub AddScore2(x)
  2882. Dim OldScore, NewScore, OldTestScore, NewTestScore
  2883. OldScore = Score(Player)
  2884.  
  2885. Select Case x
  2886. Case 1:
  2887. Score(Player)=Score(Player)+1
  2888. Case 10:
  2889. Score(Player)=Score(Player)+10
  2890. Case 100:
  2891. Score(Player)=Score(Player)+100
  2892. Case 1000:
  2893. Score(Player)=Score(Player)+1000
  2894. Case 10000:
  2895. Score(Player)=Score(Player)+10000
  2896. Case 100000:
  2897. Score(Player)=Score(Player)+100000
  2898. End Select
  2899. NewScore = Score(Player)
  2900.  
  2901. If NewScore>=100000 then
  2902. EVAL("RolloverReel"&Player).SetValue(1)
  2903. If B2SOn then
  2904. If Player=1 Then
  2905. Controller.B2SSetScoreRolloverPlayer1 1
  2906. End If
  2907. If Player=2 Then
  2908. Controller.B2SSetScoreRolloverPlayer2 1
  2909. End If
  2910.  
  2911. If Player=3 Then
  2912. Controller.B2SSetScoreRolloverPlayer3 1
  2913. End If
  2914.  
  2915. If Player=4 Then
  2916. Controller.B2SSetScoreRolloverPlayer4 1
  2917. End If
  2918. end if
  2919. end if
  2920.  
  2921. OldTestScore = OldScore
  2922. NewTestScore = NewScore
  2923. Do
  2924. if OldTestScore < Replay1 and NewTestScore >= Replay1 And Replay1Paid(Player)=FALSE then
  2925. AddSpecial()
  2926. Replay1Paid(Player)=TRUE
  2927. NewTestScore = 0
  2928. Elseif OldTestScore < Replay2 and NewTestScore >= Replay2 AND Replay2Paid(Player)=FALSE then
  2929. AddSpecial()
  2930. Replay2Paid(Player)=TRUE
  2931. NewTestScore = 0
  2932. Elseif OldTestScore < Replay3 and NewTestScore >= Replay3 AND Replay3Paid(Player)=FALSE then
  2933. AddSpecial()
  2934. Replay3Paid(Player)=TRUE
  2935. NewTestScore = 0
  2936. Elseif OldTestScore < Replay4 and NewTestScore >= Replay4 AND Replay4Paid(Player)=FALSE then
  2937. AddSpecial()
  2938. Replay4Paid(Player)=TRUE
  2939. NewTestScore = 0
  2940. End if
  2941.  
  2942. NewTestScore = NewTestScore - 1000000
  2943. OldTestScore = OldTestScore - 1000000
  2944. Loop While NewTestScore > 0
  2945.  
  2946. OldScore = int(OldScore / 10) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  2947. NewScore = int(NewScore / 10) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  2948. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore&", OldScore Mod 10="&OldScore Mod 10 & ", NewScore % 10="&NewScore Mod 10)
  2949.  
  2950. if (OldScore Mod 10 <> NewScore Mod 10) then
  2951. PlayChime(10)
  2952.  
  2953. end if
  2954.  
  2955. OldScore = int(OldScore / 10)
  2956. NewScore = int(NewScore / 10)
  2957. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2958. if (OldScore Mod 10 <> NewScore Mod 10) then
  2959. PlayChime(100)
  2960.  
  2961.  
  2962. end if
  2963.  
  2964. OldScore = int(OldScore / 10)
  2965. NewScore = int(NewScore / 10)
  2966. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2967. if (OldScore Mod 10 <> NewScore Mod 10) then
  2968. PlayChime(1000)
  2969.  
  2970.  
  2971. end if
  2972.  
  2973. OldScore = int(OldScore / 10)
  2974. NewScore = int(NewScore / 10)
  2975. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2976. if (OldScore Mod 10 <> NewScore Mod 10) then
  2977. PlayChime(1000)
  2978. end if
  2979.  
  2980. OldScore = int(OldScore / 10)
  2981. NewScore = int(NewScore / 10)
  2982. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2983. if (OldScore Mod 10 <> NewScore Mod 10) then
  2984. PlayChime(1000)
  2985. end if
  2986.  
  2987. If B2SOn Then
  2988. Controller.B2SSetScorePlayer Player, Score(Player)
  2989. End If
  2990. ' EMReel1.SetValue Score(Player)
  2991. PlayerScores(Player-1).AddValue(x)
  2992. PlayerScoresOn(Player-1).AddValue(x)
  2993. End Sub
  2994.  
  2995.  
  2996.  
  2997. Sub PlayChime(x)
  2998. If DoodleBugFlag=true then
  2999. exit sub
  3000. end if
  3001. if ChimesOn=0 then
  3002. Select Case x
  3003. Case 10
  3004. If LastChime10=1 Then
  3005. PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
  3006. LastChime10=0
  3007. Else
  3008. PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
  3009. LastChime10=1
  3010. End If
  3011. Case 100,1000
  3012. If LastChime100=1 Then
  3013. PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
  3014. LastChime100=0
  3015. Else
  3016. PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
  3017. LastChime100=1
  3018. End If
  3019.  
  3020. End Select
  3021. else
  3022. Select Case x
  3023. Case 10
  3024. If LastChime10=1 Then
  3025. PlaySound SoundFXDOF("SJ_Chime_10a",141,DOFPulse,DOFChimes)
  3026. LastChime10=0
  3027. Else
  3028. PlaySound SoundFXDOF("SJ_Chime_10b",141,DOFPulse,DOFChimes)
  3029. LastChime10=1
  3030. End If
  3031. Case 100
  3032. If LastChime100=1 Then
  3033. PlaySound SoundFXDOF("SJ_Chime_100a",142,DOFPulse,DOFChimes)
  3034. LastChime100=0
  3035. Else
  3036. PlaySound SoundFXDOF("SJ_Chime_100b",142,DOFPulse,DOFChimes)
  3037. LastChime100=1
  3038. End If
  3039. Case 1000,10000
  3040. If LastChime1000=1 Then
  3041. PlaySound SoundFXDOF("SJ_Chime_1000a",143,DOFPulse,DOFChimes)
  3042. LastChime1000=0
  3043. Else
  3044. PlaySound SoundFXDOF("SJ_Chime_1000b",143,DOFPulse,DOFChimes)
  3045. LastChime1000=1
  3046. End If
  3047. End Select
  3048. end if
  3049. End Sub
  3050.  
  3051. Sub HideOptions()
  3052.  
  3053. end sub
  3054.  
  3055. '*********************************************************************
  3056. ' Positional Sound Playback Functions
  3057. '*********************************************************************
  3058.  
  3059. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  3060. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  3061. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  3062. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  3063. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  3064. End Sub
  3065.  
  3066. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  3067. Sub PlaySoundAt(soundname, tableobj)
  3068. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  3069. End Sub
  3070.  
  3071. Sub PlaySoundAtBall(soundname)
  3072. PlaySoundAt soundname, ActiveBall
  3073. End Sub
  3074.  
  3075.  
  3076. '*********************************************************************
  3077. ' Supporting Ball & Sound Functions
  3078. '*********************************************************************
  3079.  
  3080. 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
  3081. Dim tmp
  3082. tmp = tableobj.y * 2 / table1.height-1
  3083. If tmp > 0 Then
  3084. AudioFade = Csng(tmp ^10)
  3085. Else
  3086. AudioFade = Csng(-((- tmp) ^10) )
  3087. End If
  3088. End Function
  3089.  
  3090. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  3091. Dim tmp
  3092. tmp = tableobj.x * 2 / table1.width-1
  3093. If tmp > 0 Then
  3094. AudioPan = Csng(tmp ^10)
  3095. Else
  3096. AudioPan = Csng(-((- tmp) ^10) )
  3097. End If
  3098. End Function
  3099.  
  3100. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  3101. Vol = Csng(BallVel(ball) ^2 / 2000)
  3102. End Function
  3103.  
  3104. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  3105. Pitch = BallVel(ball) * 20
  3106. End Function
  3107.  
  3108. Function BallVel(ball) 'Calculates the ball speed
  3109. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  3110. End Function
  3111.  
  3112. '*****************************************
  3113. ' JP's VP10 Rolling Sounds
  3114. '*****************************************
  3115.  
  3116. Const tnob = 5 ' total number of balls
  3117. ReDim rolling(tnob)
  3118. InitRolling
  3119.  
  3120. Sub InitRolling
  3121. Dim i
  3122. For i = 0 to tnob
  3123. rolling(i) = False
  3124. Next
  3125. End Sub
  3126.  
  3127. Sub RollingSoundTimer_Timer()
  3128. Dim BOT, b
  3129. BOT = GetBalls
  3130.  
  3131. ' stop the sound of deleted balls
  3132. For b = UBound(BOT) + 1 to tnob
  3133. rolling(b) = False
  3134. StopSound("fx_ballrolling" & b)
  3135. Next
  3136.  
  3137. ' exit the sub if no balls on the table
  3138. If UBound(BOT) = -1 Then Exit Sub
  3139.  
  3140. ' play the rolling sound for each ball
  3141. For b = 0 to UBound(BOT)
  3142. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  3143. rolling(b) = True
  3144. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  3145. Else
  3146. If rolling(b) = True Then
  3147. StopSound("fx_ballrolling" & b)
  3148. rolling(b) = False
  3149. End If
  3150. End If
  3151. Next
  3152. End Sub
  3153.  
  3154. '**********************
  3155. ' Ball Collision Sound
  3156. '**********************
  3157.  
  3158. Sub OnBallBallCollision(ball1, ball2, velocity)
  3159. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  3160. End Sub
  3161.  
  3162.  
  3163.  
  3164. '*****************************************
  3165. ' ninuzzu's BALL SHADOW
  3166. '*****************************************
  3167. Dim BallShadow
  3168. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  3169.  
  3170. Sub BallShadowUpdate_timer()
  3171. Dim BOT, b
  3172. BOT = GetBalls
  3173. ' hide shadow of deleted balls
  3174. If UBound(BOT)<(tnob-1) Then
  3175. For b = (UBound(BOT) + 1) to (tnob-1)
  3176. BallShadow(b).visible = 0
  3177. Next
  3178. End If
  3179. ' exit the Sub if no balls on the table
  3180. If UBound(BOT) = -1 Then Exit Sub
  3181. ' render the shadow for each ball
  3182. For b = 0 to UBound(BOT)
  3183. If BOT(b).X < Table1.Width/2 Then
  3184. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  3185. Else
  3186. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  3187. End If
  3188. ballShadow(b).Y = BOT(b).Y + 12
  3189. If BOT(b).Z > 20 Then
  3190. BallShadow(b).visible = 1
  3191. Else
  3192. BallShadow(b).visible = 0
  3193. End If
  3194. Next
  3195. End Sub
  3196.  
  3197. '*****************************************
  3198. ' Object sounds
  3199. '*****************************************
  3200.  
  3201. Sub Plastics_Hit (idx)
  3202. PlaySound "woodhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  3203. End Sub
  3204.  
  3205. Sub Pins_Hit (idx)
  3206. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  3207. End Sub
  3208.  
  3209. Sub Targets_Hit (idx)
  3210. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  3211. End Sub
  3212.  
  3213. Sub Metals_Thin_Hit (idx)
  3214. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3215. End Sub
  3216.  
  3217. Sub Metals_Medium_Hit (idx)
  3218. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3219. End Sub
  3220.  
  3221. Sub Metals2_Hit (idx)
  3222. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3223. End Sub
  3224.  
  3225. Sub Gates_Hit (idx)
  3226. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3227. End Sub
  3228.  
  3229. Sub Spinner_Spin
  3230. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  3231. End Sub
  3232.  
  3233. Sub Rubbers_Hit(idx)
  3234. dim finalspeed
  3235. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  3236. If finalspeed > 20 then
  3237. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3238. End if
  3239. If finalspeed >= 6 AND finalspeed <= 20 then
  3240. RandomSoundRubber()
  3241. End If
  3242. End Sub
  3243.  
  3244. Sub Posts_Hit(idx)
  3245. dim finalspeed
  3246. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  3247. If finalspeed > 16 then
  3248. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3249. End if
  3250. If finalspeed >= 6 AND finalspeed <= 16 then
  3251. RandomSoundRubber()
  3252. End If
  3253. End Sub
  3254.  
  3255. Sub RandomSoundRubber()
  3256. Select Case Int(Rnd*3)+1
  3257. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3258. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3259. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3260. End Select
  3261. End Sub
  3262.  
  3263. Sub LeftFlipper_Collide(parm)
  3264. RandomSoundFlipper()
  3265. End Sub
  3266.  
  3267. Sub RightFlipper_Collide(parm)
  3268. RandomSoundFlipper()
  3269. End Sub
  3270.  
  3271. Sub RandomSoundFlipper()
  3272. Select Case Int(Rnd*3)+1
  3273. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3274. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3275. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  3276. End Select
  3277. End Sub
  3278.  
  3279. ' ============================================================================================
  3280. ' GNMOD - Multiple High Score Display and Collection
  3281. ' ============================================================================================
  3282. Dim EnteringInitials ' Normally zero, set to non-zero to enter initials
  3283. EnteringInitials = 0
  3284.  
  3285. Dim PlungerPulled
  3286. PlungerPulled = 0
  3287.  
  3288. Dim SelectedChar ' character under the "cursor" when entering initials
  3289.  
  3290. Dim HSTimerCount ' Pass counter for HS timer, scores are cycled by the timer
  3291. HSTimerCount = 5 ' Timer is initially enabled, it'll wrap from 5 to 1 when it's displayed
  3292.  
  3293. Dim InitialString ' the string holding the player's initials as they're entered
  3294.  
  3295. Dim AlphaString ' A-Z, 0-9, space (_) and backspace (<)
  3296. Dim AlphaStringPos ' pointer to AlphaString, move forward and backward with flipper keys
  3297. AlphaString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_<"
  3298.  
  3299. Dim HSNewHigh ' The new score to be recorded
  3300.  
  3301. Dim HSScore(10) ' High Scores read in from config file
  3302. Dim HSName(10) ' High Score Initials read in from config file
  3303.  
  3304. ' default high scores, remove this when the scores are available from the config file
  3305. HSScore(1) = 75000
  3306. HSScore(2) = 70000
  3307. HSScore(3) = 60000
  3308. HSScore(4) = 55000
  3309. HSScore(5) = 50000
  3310.  
  3311. HSName(1) = "AAA"
  3312. HSName(2) = "ZZZ"
  3313. HSName(3) = "XXX"
  3314. HSName(4) = "ABC"
  3315. HSName(5) = "BBB"
  3316.  
  3317. HSScore(6) = 750000
  3318. HSScore(7) = 700000
  3319. HSScore(8) = 600000
  3320. HSScore(9) = 550000
  3321. HSScore(10) = 500000
  3322.  
  3323. HSName(6) = "AAA"
  3324. HSName(7) = "ZZZ"
  3325. HSName(8) = "XXX"
  3326. HSName(9) = "ABC"
  3327. HSName(10) = "BBB"
  3328.  
  3329. Sub HighScoreTimer_Timer
  3330.  
  3331. if EnteringInitials then
  3332. if HSTimerCount = 1 then
  3333. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  3334. HSTimerCount = 2
  3335. else
  3336. SetHSLine 3, InitialString
  3337. HSTimerCount = 1
  3338. end if
  3339. elseif InProgress then
  3340. SetHSLine 1, "HIGH SCORE1"
  3341. SetHSLine 2, HSScore(1)
  3342. SetHSLine 3, HSName(1)
  3343. HSTimerCount = 5 ' set so the highest score will show after the game is over
  3344. HighScoreTimer.enabled=false
  3345. elseif CheckAllScores then
  3346. NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
  3347.  
  3348. else
  3349. ' cycle through high scores
  3350. HighScoreTimer.interval=2000
  3351. HSTimerCount = HSTimerCount + 1
  3352. if HsTimerCount > 5 then
  3353. HSTimerCount = 1
  3354. End If
  3355. SetHSLine 1, "HIGH SCORE"+FormatNumber(HSTimerCount,0)
  3356. SetHSLine 2, HSScore(HSTimerCount)
  3357. SetHSLine 3, HSName(HSTimerCount)
  3358. end if
  3359. End Sub
  3360.  
  3361. Function GetHSChar(String, Index)
  3362. dim ThisChar
  3363. dim FileName
  3364. ThisChar = Mid(String, Index, 1)
  3365. FileName = "PostIt"
  3366. if ThisChar = " " or ThisChar = "" then
  3367. FileName = FileName & "BL"
  3368. elseif ThisChar = "<" then
  3369. FileName = FileName & "LT"
  3370. elseif ThisChar = "_" then
  3371. FileName = FileName & "SP"
  3372. else
  3373. FileName = FileName & ThisChar
  3374. End If
  3375. GetHSChar = FileName
  3376. End Function
  3377.  
  3378. Sub SetHsLine(LineNo, String)
  3379. dim Letter
  3380. dim ThisDigit
  3381. dim ThisChar
  3382. dim StrLen
  3383. dim LetterLine
  3384. dim Index
  3385. dim StartHSArray
  3386. dim EndHSArray
  3387. dim LetterName
  3388. dim xfor
  3389. StartHSArray=array(0,1,12,22)
  3390. EndHSArray=array(0,11,21,31)
  3391. StrLen = len(string)
  3392. Index = 1
  3393.  
  3394. for xfor = StartHSArray(LineNo) to EndHSArray(LineNo)
  3395. Eval("HS"&xfor).image = GetHSChar(String, Index)
  3396. Index = Index + 1
  3397. next
  3398.  
  3399. End Sub
  3400.  
  3401. Sub NewHighScore(NewScore, PlayNum)
  3402. if NewScore > HSScore(5) then
  3403. HighScoreTimer.interval = 500
  3404. HSTimerCount = 1
  3405. AlphaStringPos = 1 ' start with first character "A"
  3406. EnteringInitials = 1 ' intercept the control keys while entering initials
  3407. InitialString = "" ' initials entered so far, initialize to empty
  3408. SetHSLine 1, "PLAYER "+FormatNumber(PlayNum,0)
  3409. SetHSLine 2, "ENTER NAME"
  3410. SetHSLine 3, MID(AlphaString, AlphaStringPos, 1)
  3411. HSNewHigh = NewScore
  3412. For xx=1 to HighScoreReward
  3413. AddSpecial
  3414. next
  3415. End if
  3416. ScoreChecker=ScoreChecker-1
  3417. if ScoreChecker=0 then
  3418. CheckAllScores=0
  3419. end if
  3420. End Sub
  3421.  
  3422. Sub CollectInitials(keycode)
  3423. If keycode = LeftFlipperKey Then
  3424. ' back up to previous character
  3425. AlphaStringPos = AlphaStringPos - 1
  3426. if AlphaStringPos < 1 then
  3427. AlphaStringPos = len(AlphaString) ' handle wrap from beginning to end
  3428. if InitialString = "" then
  3429. ' Skip the backspace if there are no characters to backspace over
  3430. AlphaStringPos = AlphaStringPos - 1
  3431. End if
  3432. end if
  3433. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  3434. PlaySound "DropTargetDropped"
  3435. elseif keycode = RightFlipperKey Then
  3436. ' advance to next character
  3437. AlphaStringPos = AlphaStringPos + 1
  3438. if AlphaStringPos > len(AlphaString) or (AlphaStringPos = len(AlphaString) and InitialString = "") then
  3439. ' Skip the backspace if there are no characters to backspace over
  3440. AlphaStringPos = 1
  3441. end if
  3442. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  3443. PlaySound "DropTargetDropped"
  3444. elseif keycode = StartGameKey or keycode = PlungerKey Then
  3445. SelectedChar = MID(AlphaString, AlphaStringPos, 1)
  3446. if SelectedChar = "_" then
  3447. InitialString = InitialString & " "
  3448. PlaySound("Ding10")
  3449. elseif SelectedChar = "<" then
  3450. InitialString = MID(InitialString, 1, len(InitialString) - 1)
  3451. if len(InitialString) = 0 then
  3452. ' If there are no more characters to back over, don't leave the < displayed
  3453. AlphaStringPos = 1
  3454. end if
  3455. PlaySound("Ding100")
  3456. else
  3457. InitialString = InitialString & SelectedChar
  3458. PlaySound("Ding10")
  3459. end if
  3460. if len(InitialString) < 3 then
  3461. SetHSLine 3, InitialString & SelectedChar
  3462. End If
  3463. End If
  3464. if len(InitialString) = 3 then
  3465. ' save the score
  3466. for i = 5 to 1 step -1
  3467. if i = 1 or (HSNewHigh > HSScore(i) and HSNewHigh <= HSScore(i - 1)) then
  3468. ' Replace the score at this location
  3469. if i < 5 then
  3470. ' MsgBox("Moving " & i & " to " & (i + 1))
  3471. HSScore(i + 1) = HSScore(i)
  3472. HSName(i + 1) = HSName(i)
  3473. end if
  3474. ' MsgBox("Saving initials " & InitialString & " to position " & i)
  3475. EnteringInitials = 0
  3476. HSScore(i) = HSNewHigh
  3477. HSName(i) = InitialString
  3478. HSTimerCount = 5
  3479. HighScoreTimer_Timer
  3480. HighScoreTimer.interval = 2000
  3481. PlaySound("Ding1000")
  3482. exit sub
  3483. elseif i < 5 then
  3484. ' move the score in this slot down by 1, it's been exceeded by the new score
  3485. ' MsgBox("Moving " & i & " to " & (i + 1))
  3486. HSScore(i + 1) = HSScore(i)
  3487. HSName(i + 1) = HSName(i)
  3488. end if
  3489. next
  3490. End If
  3491.  
  3492. End Sub
  3493. ' END GNMOD
  3494. ' ============================================================================================
  3495. ' GNMOD - New Options menu
  3496. ' ============================================================================================
  3497. Dim EnteringOptions
  3498. Dim CurrentOption
  3499. Dim OptionCHS
  3500. Dim MaxOption
  3501. Dim OptionHighScorePosition
  3502. Dim XOpt
  3503. Dim StartingArray
  3504. Dim EndingArray
  3505.  
  3506. StartingArray=Array(0,1,2,30,33,61,89,117,145,173,201,229)
  3507. EndingArray=Array(0,1,29,32,60,88,116,144,172,200,228,256)
  3508. EnteringOptions = 0
  3509. MaxOption = 9
  3510. OptionCHS = 0
  3511. OptionHighScorePosition = 0
  3512. Const OptionLinesToMark="111111011"
  3513. Const OptionLine1="" 'do not use this line
  3514. Const OptionLine2="" 'do not use this line
  3515. Const OptionLine3="" 'do not use this line
  3516. Const OptionLine4="Add Bonus Score"
  3517. Const OptionLine5="Super Bonus Adds"
  3518. Const OptionLine6="Spinner and Ex. Ball Option"
  3519. Const OptionLine7=""
  3520. Const OptionLine8="" 'do not use this line
  3521. Const OptionLine9="" 'do not use this line
  3522.  
  3523. Sub OperatorMenuTimer_Timer
  3524. EnteringOptions = 1
  3525. OperatorMenuTimer.enabled=false
  3526. ShowOperatorMenu
  3527. end sub
  3528.  
  3529. sub ShowOperatorMenu
  3530. OperatorMenuBackdrop.image = "OperatorMenu"
  3531.  
  3532. OptionCHS = 0
  3533. CurrentOption = 1
  3534. DisplayAllOptions
  3535. OperatorOption1.image = "BluePlus"
  3536. SetHighScoreOption
  3537.  
  3538. End Sub
  3539.  
  3540. Sub DisplayAllOptions
  3541. dim linecounter
  3542. dim tempstring
  3543. dim TempText1
  3544. dim TempText2
  3545. dim TempText3
  3546. For linecounter = 1 to MaxOption
  3547. tempstring=Eval("OptionLine"&linecounter)
  3548. Select Case linecounter
  3549. Case 1:
  3550. tempstring=tempstring + FormatNumber(BallsPerGame,0)
  3551. SetOptLine 1,tempstring
  3552. Case 2:
  3553. if Replay3Table(ReplayLevel)=999000 then
  3554. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0)
  3555. elseif Replay4Table(ReplayLevel)=999000 then
  3556. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0)
  3557. else
  3558. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0) + "/" + FormatNumber(Replay4Table(ReplayLevel),0)
  3559. end if
  3560. SetOptLine 2,tempstring
  3561. Case 3:
  3562. If OptionCHS=0 then
  3563. tempstring = "NO"
  3564. else
  3565. tempstring = "YES"
  3566. end if
  3567. SetOptLine 3,tempstring
  3568. Case 4:
  3569. SetOptLine 4, tempstring
  3570. tempstring = AdvanceFlag
  3571.  
  3572. SetOptLine 5, tempstring
  3573. Case 5:
  3574. SetOptLine 6, tempstring
  3575. tempstring = SuperAdvanceFlag
  3576. SetOptLine 7, tempstring
  3577.  
  3578. Case 6:
  3579. SetOptLine 8, tempstring
  3580. Select case ExtraBallFlag
  3581. case 0:
  3582. tempstring="Liberal"
  3583. case 1:
  3584. tempstring="Medium"
  3585. case 2:
  3586. tempstring="Conservative"
  3587. end select
  3588. SetOptLine 9, tempstring
  3589.  
  3590. Case 7:
  3591. SetOptLine 10, tempstring
  3592. SetOptLine 11, tempstring
  3593.  
  3594. Case 8:
  3595.  
  3596. Case 9:
  3597.  
  3598.  
  3599. End Select
  3600.  
  3601. next
  3602. end sub
  3603.  
  3604. sub MoveArrow
  3605. do
  3606. CurrentOption = CurrentOption + 1
  3607. If CurrentOption>Len(OptionLinesToMark) then
  3608. CurrentOption=1
  3609. end if
  3610. loop until Mid(OptionLinesToMark,CurrentOption,1)="1"
  3611. end sub
  3612.  
  3613. sub CollectOptions(ByVal keycode)
  3614. if Keycode = LeftFlipperKey then
  3615. PlaySound "DropTargetDropped"
  3616. For XOpt = 1 to MaxOption
  3617. Eval("OperatorOption"&XOpt).image = "PostitBL"
  3618. next
  3619. MoveArrow
  3620. if CurrentOption<8 then
  3621. Eval("OperatorOption"&CurrentOption).image = "BluePlus"
  3622. elseif CurrentOption=8 then
  3623. Eval("OperatorOption"&CurrentOption).image = "GreenCheck"
  3624. else
  3625. Eval("OperatorOption"&CurrentOption).image = "RedX"
  3626. end if
  3627.  
  3628. elseif Keycode = RightFlipperKey then
  3629. PlaySound "DropTargetDropped"
  3630. if CurrentOption = 1 then
  3631. If BallsPerGame = 3 then
  3632. BallsPerGame = 5
  3633. else
  3634. BallsPerGame = 3
  3635. end if
  3636. DisplayAllOptions
  3637. elseif CurrentOption = 2 then
  3638. ReplayLevel=ReplayLevel+1
  3639. If ReplayLevel>ReplayTableMax then
  3640. ReplayLevel=1
  3641. end if
  3642. DisplayAllOptions
  3643. elseif CurrentOption = 3 then
  3644. if OptionCHS = 0 then
  3645. OptionCHS = 1
  3646.  
  3647. else
  3648. OptionCHS = 0
  3649.  
  3650. end if
  3651. DisplayAllOptions
  3652.  
  3653. elseif CurrentOption = 4 then
  3654. if AdvanceFlag = 100 then
  3655. AdvanceFlag = 1000
  3656.  
  3657. else
  3658. AdvanceFlag = 100
  3659.  
  3660. end if
  3661. DisplayAllOptions
  3662. elseif CurrentOption = 5 then
  3663. if SuperAdvanceFlag = 5 then
  3664. SuperAdvanceFlag = 3
  3665.  
  3666. else
  3667. SuperAdvanceFlag = 5
  3668.  
  3669. end if
  3670. DisplayAllOptions
  3671. elseif CurrentOption = 6 then
  3672. ExtraBallFlag=ExtraBallFlag+1
  3673. If ExtraBallFlag>2 then ExtraBallFlag=0
  3674. DisplayAllOptions
  3675.  
  3676. elseif CurrentOption = 8 or CurrentOption = 9 then
  3677. if OptionCHS=1 then
  3678. HSScore(1) = 75000
  3679. HSScore(2) = 70000
  3680. HSScore(3) = 60000
  3681. HSScore(4) = 55000
  3682. HSScore(5) = 50000
  3683.  
  3684. HSName(1) = "AAA"
  3685. HSName(2) = "ZZZ"
  3686. HSName(3) = "XXX"
  3687. HSName(4) = "ABC"
  3688. HSName(5) = "BBB"
  3689.  
  3690.  
  3691. HSScore(6) = 35
  3692. HSScore(7) = 30
  3693. HSScore(8) = 25
  3694. HSScore(9) = 20
  3695. HSScore(10) = 15
  3696.  
  3697. HSName(6) = "AAA"
  3698. HSName(7) = "ZZZ"
  3699. HSName(8) = "XXX"
  3700. HSName(9) = "ABC"
  3701. HSName(10) = "BBB"
  3702. end if
  3703.  
  3704. if CurrentOption = 8 then
  3705. savehs
  3706. else
  3707. loadhs
  3708. end if
  3709. OperatorMenuBackdrop.image = "PostitBL"
  3710. For XOpt = 1 to MaxOption
  3711. Eval("OperatorOption"&XOpt).image = "PostitBL"
  3712. next
  3713.  
  3714. For XOpt = 1 to 256
  3715. Eval("Option"&XOpt).image = "PostItBL"
  3716. next
  3717. RefreshReplayCard
  3718. InstructCard.image="IC"
  3719. EnteringOptions = 0
  3720.  
  3721. end if
  3722. end if
  3723. End Sub
  3724.  
  3725. Sub SetHighScoreOption
  3726.  
  3727. End Sub
  3728.  
  3729. Function GetOptChar(String, Index)
  3730. dim ThisChar
  3731. dim FileName
  3732. ThisChar = Mid(String, Index, 1)
  3733. FileName = "PostIt"
  3734. if ThisChar = " " or ThisChar = "" then
  3735. FileName = FileName & "BL"
  3736. elseif ThisChar = "<" then
  3737. FileName = FileName & "LT"
  3738. elseif ThisChar = "_" then
  3739. FileName = FileName & "SP"
  3740. elseif ThisChar = "/" then
  3741. FileName = FileName & "SL"
  3742. elseif ThisChar = "," then
  3743. FileName = FileName & "CM"
  3744. else
  3745. FileName = FileName & ThisChar
  3746. End If
  3747. GetOptChar = FileName
  3748. End Function
  3749.  
  3750. dim LineLengths(22) ' maximum number of lines
  3751. Sub SetOptLine(LineNo, String)
  3752. Dim DispLen
  3753. Dim StrLen
  3754. dim xfor
  3755. dim Letter
  3756. dim ThisDigit
  3757. dim ThisChar
  3758. dim LetterLine
  3759. dim Index
  3760. dim LetterName
  3761. StrLen = len(string)
  3762. Index = 1
  3763.  
  3764. StrLen = len(String)
  3765. DispLen = StrLen
  3766. if (DispLen < LineLengths(LineNo)) Then
  3767. DispLen = LineLengths(LineNo)
  3768. end If
  3769.  
  3770. for xfor = StartingArray(LineNo) to StartingArray(LineNo) + DispLen
  3771. Eval("Option"&xfor).image = GetOptChar(string, Index)
  3772. Index = Index + 1
  3773. next
  3774. LineLengths(LineNo) = StrLen
  3775.  
  3776. End Sub
  3777.  
  3778. '******************************************************
  3779. ' FLIPPER AND RUBBER CORRECTION
  3780. '******************************************************
  3781. dim LFPress, RFPress, EOST, EOSA, EOSTnew, EOSaNew
  3782. dim FStrength, FRampUp, fElasticity, EOSRampUp, SOSRampUp
  3783. dim RFEndAngle, LFEndAngle, LF1EndAngle, RF1EndAngle, LFCount, RFCount, LiveCatch
  3784.  
  3785. LFEndAngle = Leftflipper.EndAngle
  3786. RFEndAngle = RightFlipper.EndAngle
  3787.  
  3788. EOST = leftflipper.eosTorque 'End of Swing Torque
  3789. EOSA = leftflipper.eosTorqueAngle 'End of Swing Torque Angle
  3790. fStrength = LeftFlipper.strength 'Flipper Strength
  3791. fRampUp = LeftFlipper.RampUp 'Flipper Ramp Up
  3792. fElasticity = LeftFlipper.elasticity 'Flipper Elasticity
  3793. EOStNew = 1.0 'new Flipper Torque
  3794. EOSaNew = 0.2 'new FLipper Tprque Angle
  3795. EOSRampUp = 1.5 'new EOS Ramp Up weaker at EOS because of the weaker holding coil
  3796. SOSRampUp = 8.5 'new SOS Ramp Up strong at start because of the stronger starting coil
  3797. LiveCatch = 8 'variable to check elapsed time from
  3798.  
  3799. '********Need to have a flipper timer to check for these values
  3800. Sub flipperTimer_Timer
  3801. ' lFlip.rotz = leftflipper.currentangle -121
  3802. ' rFlip.rotz = rightflipper.currentangle +121
  3803. ' FlipperLSh.RotZ = LeftFlipper.currentangle
  3804. ' FlipperRSh.RotZ = RightFlipper.currentangle
  3805. '
  3806. ' lFlip.rotz = leftflipper.CurrentAngle -121 'silver metal flipper obj
  3807. ' lFlipR.rotz = leftflipper.CurrentAngle -121
  3808. ' rFlip.rotz = RightFlipper.CurrentAngle +121
  3809. ' rFlipR.rotz = RightFlipper.CurrentAngle +121
  3810. ' lFlip001.roty = leftflipper001.CurrentAngle
  3811. ' rFlip001.roty = RightFlipper001.CurrentAngle
  3812. '
  3813. '' FlipperLShadow1.RotZ = LeftFlipper1.CurrentAngle
  3814. '' FlipperRShadow1.RotZ = RightFlipper1.CurrentAngle
  3815.  
  3816. '--------------Flipper Tricks Section
  3817. 'What this code does is swing the flipper fast and make the flipper soft near its EOS to enable live catches. It resets back to the base Table
  3818. 'settings once the flipper reaches the end of swing. The code also makes the flipper starting ramp up high to simulate the stronger starting
  3819. 'coil strength and weaker at its EOS to simulate the weaker hold coil.
  3820.  
  3821. If LeftFlipper.CurrentAngle = LeftFlipper.EndAngle and LFPress = 1 Then 'If the flipper is fully swung and the flipper button is pressed then...
  3822. LeftFlipper.eosTorqueAngle = EOSaNew 'sets flipper EOS Torque Angle to .2
  3823. LeftFlipper.eosTorque = EOStNew 'sets flipper EOS Torque to 1
  3824. LeftFlipper.RampUp = EOSRampUp 'sets flipper ramp up to 1.5
  3825. If LFCount = 0 Then LFCount = GameTime 'sets the variable LFCount = to the elapsed game time
  3826. If GameTime - LFCount < LiveCatch Then 'if less than 8ms have elasped then we are in a "Live Catch" scenario
  3827. LeftFlipper.Elasticity = 0.1 'sets flipper elasticity WAY DOWN to allow Live Catches
  3828. If LeftFlipper.EndAngle <> LFEndAngle Then LeftFlipper.EndAngle = LFEndAngle 'Keep the flipper at its EOS and don't let it deflect
  3829. Else
  3830. LeftFlipper.Elasticity = fElasticity 'reset flipper elasticity to the base table setting
  3831. End If
  3832. Elseif LeftFlipper.CurrentAngle > LeftFlipper.startangle - 0.05 Then 'If the flipper has started its swing, make it swing fast to nearly the end...
  3833. LeftFlipper.RampUp = SOSRampUp 'set flipper Ramp Up high
  3834. LeftFlipper.EndAngle = LFEndAngle - 3 'swing to within 3 degrees of EOS
  3835. LeftFlipper.Elasticity = fElasticity 'Set the elasticity to the base table elasticity
  3836. LFCount = 0
  3837. Elseif LeftFlipper.CurrentAngle > LeftFlipper.EndAngle + 0.01 Then 'If the flipper has swung past it's end of swing then...
  3838. LeftFlipper.eosTorque = EOST 'set the flipper EOS Torque back to the base table setting
  3839. LeftFlipper.eosTorqueAngle = EOSA 'set the flipper EOS Torque Angle back to the base table setting
  3840. LeftFlipper.RampUp = fRampUp 'set the flipper Ramp Up back to the base table setting
  3841. LeftFlipper.Elasticity = fElasticity 'set the flipper Elasticity back to the base table setting
  3842. End If
  3843.  
  3844. If RightFlipper.CurrentAngle = RightFlipper.EndAngle and RFPress = 1 Then
  3845. RightFlipper.eosTorqueAngle = EOSaNew
  3846. RightFlipper.eosTorque = EOStNew
  3847. RightFlipper.RampUp = EOSRampUp
  3848. If RFCount = 0 Then RFCount = GameTime
  3849. If GameTime - RFCount < LiveCatch Then
  3850. RightFlipper.Elasticity = 0.1
  3851. If RightFlipper.EndAngle <> RFEndAngle Then RightFlipper.EndAngle = RFEndAngle
  3852. Else
  3853. RightFlipper.Elasticity = fElasticity
  3854. End If
  3855. Elseif RightFlipper.CurrentAngle < RightFlipper.StartAngle + 0.05 Then
  3856. RightFlipper.RampUp = SOSRampUp
  3857. RightFlipper.EndAngle = RFEndAngle + 3
  3858. RightFlipper.Elasticity = fElasticity
  3859. RFCount = 0
  3860. Elseif RightFlipper.CurrentAngle < RightFlipper.EndAngle - 0.01 Then
  3861. RightFlipper.eosTorque = EOST
  3862. RightFlipper.eosTorqueAngle = EOSA
  3863. RightFlipper.RampUp = fRampUp
  3864. RightFlipper.Elasticity = fElasticity
  3865. End If
  3866. End Sub
  3867.  
  3868. dim LF : Set LF = New FlipperPolarity
  3869. dim RF : Set RF = New FlipperPolarity
  3870. dim LF1 : Set LF1 = New FlipperPolarity
  3871. dim RF1 : Set RF1 = New FlipperPolarity
  3872.  
  3873. InitPolarity
  3874.  
  3875. Sub InitPolarity()
  3876. dim x, a : a = Array(LF, RF, LF1, RF1)
  3877. for each x in a
  3878. 'safety coefficient (diminishes polarity correction only)
  3879. x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
  3880. x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
  3881.  
  3882. x.enabled = True
  3883. x.TimeDelay = 69 '*****Important, this variable is an offset for the speed that the ball travels down the table to determine if the flippers have been fired
  3884. 'This is needed because the corrections to ball trajectory should only applied if the flippers have been fired and the ball is in the trigger zones.
  3885. 'FlipAT is set to GameTime when the ball enters the flipper trigger zones and if GameTime is less than FlipAT + this time delay then changes to velocity
  3886. 'and trajectory are applied. If the flipper is fired before the ball enters the trigger zone then with this delay added to FlipAT the changes
  3887. 'to tragectory and velocity will not be applied. Also if the flipper is in the final 20 degrees changes to ball values will also not be applied.
  3888. '"Faster" tables will need a smaller value while "slower" tables will need a larger value to give the ball more time to get to the flipper.
  3889. 'If this value is not set high enough the Flipper Velocity and Polarity corrections will NEVER be applied.
  3890. Next
  3891.  
  3892. 'rf.report "Polarity"
  3893. AddPt "Polarity", 0, 0, -2.7
  3894. AddPt "Polarity", 1, 0.16, -2.7
  3895. AddPt "Polarity", 2, 0.33, -2.7
  3896. AddPt "Polarity", 3, 0.37, -2.7 '4.2
  3897. AddPt "Polarity", 4, 0.41, -2.7
  3898. AddPt "Polarity", 5, 0.45, -2.7 '4.2
  3899. AddPt "Polarity", 6, 0.576,-2.7
  3900. AddPt "Polarity", 7, 0.66, -1.8'-2.1896
  3901. AddPt "Polarity", 8, 0.743, -0.5
  3902. AddPt "Polarity", 9, 0.81, -0.5
  3903. AddPt "Polarity", 10, 0.88, 0
  3904.  
  3905. '"Velocity" Profile
  3906. addpt "Velocity", 0, 0, 1
  3907. addpt "Velocity", 1, 0.16, 1.06
  3908. addpt "Velocity", 2, 0.41, 1.05
  3909. addpt "Velocity", 3, 0.53, 1'0.982
  3910. addpt "Velocity", 4, 0.702, 0.968
  3911. addpt "Velocity", 5, 0.95, 0.968
  3912. addpt "Velocity", 6, 1.03, 0.945
  3913.  
  3914. LF.Object = LeftFlipper
  3915. ' LF1.Object = LeftFlipper001
  3916. LF.EndPoint = EndPointLp 'you can use just a coordinate, or an object with a .x property. Using a couple of simple primitive objects
  3917. ' LF1.EndPoint = EndPointLp001
  3918. RF.Object = RightFlipper
  3919. ' RF1.Object = RightFlipper001
  3920. ' RF1.EndPoint = EndPointRp001
  3921. RF.EndPoint = EndPointRp
  3922. End Sub
  3923.  
  3924. Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
  3925. dim a : a = Array(LF, RF, LF1, RF1)
  3926. dim x : for each x in a
  3927. x.addpoint aStr, idx, aX, aY
  3928. Next
  3929. End Sub
  3930.  
  3931.  
  3932. Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
  3933. Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
  3934. Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
  3935. Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
  3936. Sub TriggerLF1_Hit() : LF.Addball activeball : End Sub
  3937. Sub TriggerLF1_UnHit() : LF.PolarityCorrect activeball : End Sub
  3938. Sub TriggerRF1_Hit() : RF.Addball activeball : End Sub
  3939. Sub TriggerRF1_UnHit() : RF.PolarityCorrect activeball : End Sub
  3940.  
  3941. 'Methods:
  3942. '.TimeDelay - Delay before trigger shuts off automatically. Default = 80 (ms)
  3943. '.AddPoint - "Polarity", "Velocity", "Ycoef" coordinate points. Use one of these 3 strings, keep coordinates sequential. x = %position on the flipper, y = output
  3944. '.Object - set to flipper reference. Optional.
  3945. '.StartPoint - set start point coord. Unnecessary, if .object is used.
  3946.  
  3947. 'Called with flipper -
  3948. 'ProcessBalls - catches ball data.
  3949. ' - OR -
  3950. '.Fire - fires flipper.rotatetoend automatically + processballs. Requires .Object to be set to the flipper.
  3951.  
  3952. '***************This is flipperPolarity's addPoint Sub
  3953. Class FlipperPolarity
  3954. Public Enabled
  3955. Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
  3956. Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
  3957. private Flipper, FlipperStart, FlipperEnd, LR, PartialFlipCoef
  3958. Private Balls(20), balldata(20)
  3959.  
  3960. dim PolarityIn, PolarityOut
  3961. dim VelocityIn, VelocityOut
  3962. dim YcoefIn, YcoefOut
  3963.  
  3964. Public Sub Class_Initialize
  3965. redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
  3966. Enabled = True: TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new spoofBall: next
  3967. End Sub
  3968.  
  3969. Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
  3970. Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
  3971. Public Property Get StartPoint : StartPoint = FlipperStart : End Property
  3972. Public Property Let EndPoint(aInput) : if IsObject(aInput) then FlipperEnd = aInput.x else FlipperEnd = aInput : end if : End Property
  3973. Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
  3974.  
  3975. Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
  3976. Select Case aChooseArray
  3977. case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
  3978. Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
  3979. Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
  3980. End Select
  3981.  
  3982. End Sub
  3983.  
  3984. '********Triggered by a ball hitting the flipper trigger area
  3985. Public Sub AddBall(aBall) : dim x :
  3986. for x = 0 to uBound(balls)
  3987. if IsEmpty(balls(x)) then set balls(x) = aBall : exit sub :end if
  3988. Next
  3989. End Sub
  3990.  
  3991. Private Sub RemoveBall(aBall)
  3992. dim x : for x = 0 to uBound(balls)
  3993. if TypeName(balls(x) ) = "IBall" then
  3994. if aBall.ID = Balls(x).ID Then
  3995. balls(x) = Empty
  3996. Balldata(x).Reset
  3997. End If
  3998. End If
  3999. Next
  4000. End Sub
  4001.  
  4002. '*********Used to rotate flipper since this is removed from the key down for the flippers
  4003. Public Sub Fire()
  4004. Flipper.RotateToEnd
  4005. processballs
  4006. End Sub
  4007.  
  4008. Public Sub ProcessBalls() 'save data of balls in flipper range
  4009. FlipAt = GameTime
  4010. dim x : for x = 0 to uBound(balls)
  4011. if not IsEmpty(balls(x) ) then balldata(x).Data = balls(x)
  4012. Next
  4013. PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle)) '% of flipper swing
  4014. PartialFlipCoef = abs(PartialFlipCoef-1)
  4015. if abs(Flipper.currentAngle - Flipper.EndAngle) < 20 Then 'last 20 degrees of swing is not dealt with
  4016. PartialFlipCoef = 0
  4017. End If
  4018. End Sub
  4019.  
  4020. '***********gameTime is a global variable of how long the game has progressed in ms
  4021. '***********This function lets the table know if the flipper has been fired
  4022. Private Function FlipperOn()
  4023. ' TB.text = gameTime & ":" & (FlipAT + TimeDelay) ' ******MOVE TB into view WHEN THIS FLIPPER FUNCTIONALITY IS ADDED TO A NEW TABLE TO CHECK IF THE TIME DELAY IS LONG ENOUGH*****
  4024. if gameTime < FlipAt + TimeDelay then FlipperOn = True
  4025. End Function 'Timer shutoff for polaritycorrect
  4026.  
  4027. '***********This is turned on when a ball leaves the flipper trigger area
  4028. Public Sub PolarityCorrect(aBall)
  4029. if FlipperOn() then 'don't run this if the flippers are at rest
  4030. ' tb.text = "In"
  4031. dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
  4032. dim teststr : teststr = "Cutoff"
  4033. tmp = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
  4034. if tmp < 0.1 then 'if real ball position is behind flipper, exit Sub to prevent stucks 'Disabled 1.03, I think it's the Mesh that's causing stucks, not this
  4035. end if
  4036.  
  4037. 'y safety Exit
  4038. if aBall.VelY > -8 then 'if ball going down then remove the ball
  4039. RemoveBall aBall
  4040. exit Sub
  4041. end if
  4042. 'Find balldata. BallPos = % on Flipper
  4043. for x = 0 to uBound(Balls)
  4044. if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
  4045. idx = x
  4046. BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
  4047. if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  4048. end if
  4049. Next
  4050.  
  4051. 'Velocity correction
  4052. if not IsEmpty(VelocityIn(0) ) then
  4053. ' tb.text = "Vel corr"
  4054. Dim VelCoef
  4055. if IsEmpty(BallData(idx).id) and aBall.VelY < -12 then 'if tip hit with no collected data, do vel correction anyway
  4056. if PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1) > 1.1 then 'adjust plz
  4057. VelCoef = LinearEnvelope(5, VelocityIn, VelocityOut)
  4058. if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
  4059. if Enabled then aBall.Velx = aBall.Velx*VelCoef'VelCoef
  4060. if Enabled then aBall.Vely = aBall.Vely*VelCoef'VelCoef
  4061. end if
  4062. Else
  4063. : VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
  4064. if Enabled then aBall.Velx = aBall.Velx*VelCoef
  4065. if Enabled then aBall.Vely = aBall.Vely*VelCoef
  4066. end if
  4067. End If
  4068.  
  4069. 'Polarity Correction (optional now)
  4070. if not IsEmpty(PolarityIn(0) ) then
  4071. If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
  4072. dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
  4073. if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
  4074. End If
  4075. End If
  4076. RemoveBall aBall
  4077. End Sub
  4078. End Class
  4079.  
  4080. '================================
  4081. 'Helper Functions
  4082.  
  4083.  
  4084. Sub ShuffleArray(ByRef aArray, byVal offset) 'shuffle 1d array
  4085. dim x, aCount : aCount = 0
  4086. redim a(uBound(aArray) )
  4087. for x = 0 to uBound(aArray) 'Shuffle objects in a temp array
  4088. if not IsEmpty(aArray(x) ) Then
  4089. if IsObject(aArray(x)) then
  4090. Set a(aCount) = aArray(x) 'Set creates an object in VB
  4091. Else
  4092. a(aCount) = aArray(x)
  4093. End If
  4094. aCount = aCount + 1
  4095. End If
  4096. Next
  4097. if offset < 0 then offset = 0
  4098. redim aArray(aCount-1+offset) 'Resize original array
  4099. for x = 0 to aCount-1 'set objects back into original array
  4100. if IsObject(a(x)) then
  4101. Set aArray(x) = a(x)
  4102. Else
  4103. aArray(x) = a(x)
  4104. End If
  4105. Next
  4106. End Sub
  4107.  
  4108. '**********Takes in more than one array and passes them to ShuffleArray
  4109. Sub ShuffleArrays(aArray1, aArray2, offset)
  4110. ShuffleArray aArray1, offset
  4111. ShuffleArray aArray2, offset
  4112. End Sub
  4113.  
  4114. '**********Calculate ball speed as hypotenuse of velX/velY triangle
  4115. Function BallSpeed(ball) 'Calculates the ball speed
  4116. BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
  4117. End Function
  4118.  
  4119. '**********Calculates the value of Y for an input x using the slope intercept equation
  4120. Function PSlope(Input, X1, Y1, X2, Y2) 'Set up line via two points, no clamping. Input X, output Y
  4121. dim x, y, b, m : x = input : m = (Y2 - Y1) / (X2 - X1) : b = Y2 - m*X2
  4122. Y = M*x+b
  4123. PSlope = Y
  4124. End Function
  4125.  
  4126. Class spoofball
  4127. Public X, Y, Z, VelX, VelY, VelZ, ID, Mass, Radius
  4128. Public Property Let Data(aBall)
  4129. With aBall
  4130. x = .x : y = .y : z = .z : velx = .velx : vely = .vely : velz = .velz
  4131. id = .ID : mass = .mass : radius = .radius
  4132. end with
  4133. End Property
  4134. Public Sub Reset()
  4135. x = Empty : y = Empty : z = Empty : velx = Empty : vely = Empty : velz = Empty
  4136. id = Empty : mass = Empty : radius = Empty
  4137. End Sub
  4138. End Class
  4139.  
  4140. '****************************************************************************
  4141. 'PHYSICS DAMPENERS
  4142.  
  4143. 'These are data mined bounce curves,
  4144. 'dialed in with the in-game elasticity as much as possible to prevent angle / spin issues.
  4145. 'Requires tracking ballspeed to calculate COR
  4146.  
  4147.  
  4148. Sub dPosts_Hit(idx)
  4149. RubbersD.dampen Activeball
  4150. End Sub
  4151.  
  4152. Sub dSleeves_Hit(idx)
  4153. SleevesD.Dampen Activeball
  4154. End Sub
  4155.  
  4156. '*********This sets up the rubbers:
  4157. dim RubbersD
  4158. Set RubbersD = new Dampener 'Makes a Dampener Class Object
  4159. RubbersD.name = "Rubbers"
  4160.  
  4161. 'cor bounce curve (linear)
  4162. 'for best results, try to match in-game velocity as closely as possible to the desired curve
  4163. RubbersD.addpoint 0, 0, 0.935 '0.96 'point# (keep sequential), ballspeed, CoR (elasticity)
  4164. RubbersD.addpoint 1, 3.77, 0.935 '0.96
  4165. RubbersD.addpoint 2, 5.76, 0.942 '0.967 'dont take this as gospel. if you can data mine rubber elasticitiy, please help!
  4166. RubbersD.addpoint 3, 15.84, 0.874
  4167. RubbersD.addpoint 4, 56, 0.64 'there's clamping so interpolate up to 56 at least
  4168.  
  4169. dim SleevesD : Set SleevesD = new Dampener 'this is just rubber but cut down to 85%...
  4170. SleevesD.name = "Sleeves"
  4171. SleevesD.CopyCoef RubbersD, 0.85
  4172.  
  4173. '**********Class for dampener section of nfozzy's code
  4174. Class Dampener
  4175. Public Print, debugOn 'tbpOut.text
  4176. public name, Threshold 'Minimum threshold. Useful for Flippers, which don't have a hit threshold.
  4177. Public ModIn, ModOut
  4178. Private Sub Class_Initialize : redim ModIn(0) : redim Modout(0): End Sub
  4179.  
  4180. Public Sub AddPoint(aIdx, aX, aY)
  4181. ShuffleArrays ModIn, ModOut, 1 : ModIn(aIDX) = aX : ModOut(aIDX) = aY : ShuffleArrays ModIn, ModOut, 0
  4182. End Sub
  4183.  
  4184. public sub Dampen(aBall)
  4185. if threshold then if BallSpeed(aBall) < threshold then exit sub end if end if
  4186. dim RealCOR, DesiredCOR, str, coef
  4187. ' Uses the LinearEnvelope function to calculate the correction based upon where it's value sits in relation
  4188.  
  4189. ' to the addpoint parameters set above. Basically interpolates values between set points in a linear fashion
  4190. DesiredCor = LinearEnvelope(cor.ballvel(aBall.id), ModIn, ModOut )
  4191.  
  4192. ' Uses the function BallSpeed's value at the point of impact/the active ball's velocity which is constantly being updated
  4193. ' RealCor is always less than 1
  4194. RealCOR = BallSpeed(aBall) / cor.ballvel(aBall.id)
  4195.  
  4196. ' Divides the desired CoR by the real COR to make a multiplier to correct velocity in x and y
  4197. coef = desiredcor / realcor
  4198. ' tb.text = "Coef = " & coef
  4199.  
  4200. ' Applies the coef to x and y velocities
  4201. aBall.velx = aBall.velx * coef : aBall.vely = aBall.vely * coef
  4202. End Sub
  4203.  
  4204. '***********This Sub sets the values for Sleeves (or any other future objects) to 85% (or whatever is passed in) of Posts
  4205. Public Sub CopyCoef(aObj, aCoef) 'alternative addpoints, copy with coef
  4206. dim x : for x = 0 to uBound(aObj.ModIn)
  4207. addpoint x, aObj.ModIn(x), aObj.ModOut(x)*aCoef
  4208. Next
  4209. End Sub
  4210. End Class
  4211.  
  4212. '*****************************Generates cor.ballVel for dampener
  4213. Sub RDampen_Timer() ' 1 ms timer always on
  4214. CoR.Update
  4215. End Sub
  4216.  
  4217. '*********CoR is Coefficient of Restitution defined as "how much of the kinetic energy remains for the objects
  4218. 'to rebound from one another vs. how much is lost as heat, or work done deforming the objects
  4219. dim cor : set cor = New CoRTracker
  4220.  
  4221. Class CoRTracker
  4222.  
  4223. public ballvel
  4224.  
  4225. Private Sub Class_Initialize : redim ballvel(0) : End Sub
  4226.  
  4227. Public Sub Update() 'tracks in-ball-velocity
  4228. dim str, b, allBalls, highestID :
  4229. allBalls = getballs
  4230.  
  4231. for each b in allballs
  4232. if b.id >= HighestID then highestID = b.id
  4233. Next
  4234.  
  4235. if uBound(ballvel) < highestID then redim ballvel(highestID) 'set bounds
  4236.  
  4237. for each b in allballs
  4238. ballvel(b.id) = BallSpeed(b)
  4239. Next
  4240. End Sub
  4241. End Class
  4242.  
  4243. '********Interpolates the value for areas between the low and upper bounds sent to it
  4244. Function LinearEnvelope(xInput, xKeyFrame, yLvl)
  4245. dim y 'Y output
  4246. dim L 'Line
  4247. dim ii : for ii = 1 to uBound(xKeyFrame) 'find active line
  4248. if xInput <= xKeyFrame(ii) then L = ii : exit for : end if
  4249. Next
  4250. if xInput > xKeyFrame(uBound(xKeyFrame) ) then L = uBound(xKeyFrame) 'catch line overrun
  4251. Y = pSlope(xInput, xKeyFrame(L-1), yLvl(L-1), xKeyFrame(L), yLvl(L) )
  4252.  
  4253. 'clamp 2.0
  4254. if xInput <= xKeyFrame(lBound(xKeyFrame) ) then Y = yLvl(lBound(xKeyFrame) ) 'Clamp lower
  4255. if xInput >= xKeyFrame(uBound(xKeyFrame) ) then Y = yLvl(uBound(xKeyFrame) ) 'Clamp upper
  4256.  
  4257. LinearEnvelope = Y
  4258. End Function
  4259.  
Advertisement
Add Comment
Please, Sign In to add comment