Arngrim

Knock Out

Sep 11th, 2021
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 89.03 KB | None | 0 0
  1. '*
  2. '* Gottlieb's Knoutout (1950)
  3. '*
  4.  
  5. option explicit
  6. Randomize
  7. ExecuteGlobal GetTextFile("core.vbs")
  8.  
  9. On Error Resume Next
  10. ExecuteGlobal GetTextFile("Controller.vbs")
  11. If Err Then MsgBox "Unable to open Controller.vbs. Ensure that it is in the scripts folder."
  12. On Error Goto 0
  13.  
  14. Const cGameName = "Knockout_1950"
  15.  
  16.  
  17. Const ShadowFlippersOn = true
  18. Const ShadowBallOn = false
  19.  
  20. Const ShadowConfigFile = false
  21.  
  22.  
  23.  
  24.  
  25. Dim Controller ' B2S
  26. Dim B2SScore ' B2S Score Displayed
  27. Const HSFileName="Knockout_50VPX.txt"
  28. Const B2STableName="Knockout_1950"
  29. Const LMEMTableConfig="LMEMTables.txt"
  30. Const LMEMShadowConfig="LMEMShadows.txt"
  31. Dim EnableBallShadow
  32. Dim EnableFlipperShadow
  33.  
  34. '* 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
  35. Const ScoreMotorAdjustment=1
  36.  
  37. '* this is a debug setting to use an older scoring routine vs a newer score routine - don't change this value
  38. Const ScoreAdditionAdjustment=1
  39.  
  40. dim ScoreChecker
  41. dim CheckAllScores
  42. dim sortscores(4)
  43. dim sortplayers(4)
  44. Dim B2SOn
  45. Dim B2SFrameCounter
  46. Dim BackglassBallFlagColor
  47. Dim TextStr,TextStr2,LaneClear
  48. Dim i
  49. Dim obj
  50. Dim Points210counter
  51. Dim Points500counter
  52. Dim Points1000counter
  53. Dim Points2000counter
  54. Dim BallsPerGame
  55. Dim InProgress
  56. Dim BallInPlay
  57. Dim CreditsPerCoin
  58. Dim Score100K(4)
  59. Dim Score(4)
  60. Dim ScoreDisplay(4)
  61. Dim HighScorePaid(4)
  62. Dim HighScore
  63. Dim HighScoreReward
  64. Dim BonusMultiplier
  65. Dim Credits
  66. Dim Match
  67. Dim Replay1
  68. Dim Replay2
  69. Dim Replay3
  70. Dim Replay4
  71. Dim Replay1Paid(4)
  72. Dim Replay2Paid(4)
  73. Dim Replay3Paid(4)
  74. Dim Replay4Paid(4)
  75. Dim TableTilted
  76. Dim TiltCount
  77.  
  78. Dim OperatorMenu
  79.  
  80. Dim BonusBooster
  81. Dim BonusBoosterCounter
  82. Dim BonusCounter
  83. Dim HoleCounter
  84.  
  85. Dim Ones
  86. Dim Tens
  87. Dim Hundreds
  88. Dim Thousands
  89.  
  90. Dim Player
  91. Dim Players
  92.  
  93. Dim rst
  94. Dim bonuscountdown
  95. Dim TempMultiCounter
  96. dim TempPlayerup
  97. dim RotatorTemp
  98.  
  99. Dim bump1
  100. Dim bump2
  101. Dim bump3
  102. Dim bump4
  103. Dim bump5
  104.  
  105. Dim LastChime10
  106. Dim LastChime100
  107. Dim LastChime1000
  108.  
  109. Dim Score10
  110. Dim Score100
  111.  
  112. Dim targettempscore
  113. Dim SpecialLightCounter
  114. Dim SpecialLightOption
  115. Dim HorseshoeCounter
  116. Dim DropTargetCounter
  117.  
  118. Dim LeftTargetCounter
  119. Dim RightTargetCounter
  120.  
  121. Dim MotorRunning
  122. Dim Replay1Table(15)
  123. Dim Replay2Table(15)
  124. Dim Replay3Table(15)
  125. Dim Replay4Table(15)
  126. Dim ReplayTableSet
  127. Dim ReplayLevel
  128. Dim ReplayTableMax
  129.  
  130. Dim BonusSpecialThreshold
  131. Dim TargetLightsOn
  132. Dim AdvanceLightCounter
  133. dim bonustempcounter
  134.  
  135. dim raceRflag
  136. dim raceAflag
  137. dim raceCflag
  138. dim raceEflag
  139. dim race5flag
  140.  
  141. Dim LStep, LStep2, RStep, xx
  142.  
  143. Dim ReelCounter
  144. Dim BallCounter
  145. Dim BallReelAddStart(12)
  146. Dim BallReelAddFrames(12)
  147. Dim BallReelDropStart(12)
  148. Dim BallReelDropFrames(12)
  149.  
  150. Dim EightLit
  151.  
  152. Dim X
  153. Dim Y
  154. Dim Z
  155. Dim AddABall
  156. Dim AddABallFrames
  157. Dim DropABall
  158. Dim DropABallFrames
  159. Dim CurrentFrame
  160. Dim BonusMotorRunning
  161. Dim QueuedBonusAdds
  162. Dim QueuedBonusDrops
  163.  
  164. Dim ChimesOn
  165.  
  166. Dim TempLightTracker
  167.  
  168. Dim TargetLeftFlag
  169. Dim TargetCenterFlag
  170. Dim TargetRightFlag
  171.  
  172. Dim TargetSequenceComplete
  173.  
  174. Dim SpecialLightsFlag
  175.  
  176. Dim BumperSequenceCompleted,AdvancesCompleted, Motor3EToggle
  177.  
  178. Dim AdvanceBonusMax, AdvanceSpecialMax
  179.  
  180. Dim BonusScoreLevel1,BonusScoreLevel2,BonusScoreLevel3,BonusScoreLevel4,BonusScoreLevel5,EndGameCount
  181.  
  182. Dim AlternatingRelay
  183.  
  184. Dim ZeroToNineUnit
  185.  
  186. Dim SlickCounter,ChickCounter,SlickChickFlag,SlickChickComplete,NumberCounter
  187.  
  188. Dim Kicker1Hold,Kicker2Hold
  189.  
  190. Dim mHole,mHole2,mHole3,mHole4
  191.  
  192. Dim GreenBumpersOn, YellowBumpersOn, ArrowCounter, CardSequenceComplete, MatchLit2
  193.  
  194. Dim WhiteComplete,RedComplete,YellowComplete,GreenComplete,DisableKeysInit,BallLiftOption,BallsPlayed,BallsDrained
  195.  
  196. Dim SpinPos,Spin,Count,Count1,Count2,Count3,Reset,VelX,VelY,LitSpinner,BallIndicatorCount,CenterTargetTracker,BallsOnTable,TiltEndsGame, WildArray, KickerHoldFlag
  197.  
  198. Dim tKickerTCount1,tKickerTCount2,tKickerTCount3,tKickerTCount4
  199. Dim ArrowCounter1,ArrowCounter2,ArrowCounter3,ArrowCounter4
  200. Dim CardCounter,Player1Tilted,Player2Tilted,NewPoints,JokerCount,Points,PlusPoints,CenterLightCount,BallsExited
  201.  
  202. Spin=Array("5","6","7","8","9","10","J","Q","K","A")
  203. WildArray = Array(0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6)
  204. Dim WildBallNumber, Off123Bumpers, Off345Bumpers, Off12345Bumpers
  205. Dim RefMoveCount, Boxer1MoveCount, Boxer2MoveCount, BallPoints
  206.  
  207. Sub Table1_Init()
  208. DisableKeysInit=0
  209. LoadEM
  210. LoadLMEMConfig2
  211. If Table1.ShowDT = false then
  212. For each obj in DesktopCrap
  213. obj.visible=False
  214. next
  215.  
  216. End If
  217.  
  218. OperatorMenuBackdrop.image = "PostitBL"
  219. For XOpt = 1 to MaxOption
  220. Eval("OperatorOption"&XOpt).image = "PostitBL"
  221. next
  222.  
  223. For XOpt = 1 to 256
  224. Eval("Option"&XOpt).image = "PostItBL"
  225. next
  226.  
  227. BallIndicatorCount=0
  228. InitBallLoad.enabled=true
  229.  
  230.  
  231. Points=39
  232. Count=0
  233. Count1=0
  234. Count2=0
  235. Count3=0
  236. Reset=0
  237. ZeroToNineUnit=Int(Rnd*10)
  238. Kicker1Hold=0
  239. ArrowCounter=0
  240. EightLit=0
  241. TiltEndsGame=1
  242. BallCounter=0
  243. ReelCounter=0
  244. AddABall=0
  245. DropABall=0
  246. BallsOnTable=0
  247. HideOptions
  248. SetupReplayTables
  249. PlasticsOff
  250. BumpersOff
  251. OperatorMenu=0
  252. HighScore=0
  253. MotorRunning=0
  254. HighScoreReward=1
  255. Motor3EToggle=0
  256. Credits=0
  257. BallsPerGame=5
  258. ReplayLevel=1
  259. AdvanceBonusMax=5
  260. AdvanceSpecialMax=3
  261. ChimesOn=0
  262. BallRelease.enabled=false
  263. AlternatingRelay=0
  264. BumperSequenceCompleted=0
  265. SpecialLightOption=2
  266. BallLiftOption=1
  267. BackglassBallFlagColor=1
  268. loadhs
  269. if HighScore=0 then HighScore=5000
  270.  
  271.  
  272. TableTilted=false
  273.  
  274. Match=int(Rnd*10)
  275. Do
  276. MatchLit2=int(Rnd*10)
  277. loop while MatchLit2=Match
  278.  
  279. DisplayMatch
  280.  
  281. SpinPos=int(Rnd*10)
  282.  
  283. ' CanPlayReel.SetValue(0)
  284. GameOverReel.SetValue(1)
  285. TiltReel.SetValue(1)
  286. Reel1000.SetValue(0)
  287. CanPlayLight1.state=0
  288. CanPlayLight2.state=0
  289.  
  290. BallInPlayLight.state=0
  291. GameOverLight.state=1.
  292. BallInPlayReel.setvalue(0)
  293. TiltPlayer1.setvalue(1)
  294. TiltPlayer2.setvalue(1)
  295. For each obj in PlayerHuds
  296. obj.SetValue(0)
  297. next
  298. For each obj in PlayerScores
  299. obj.ResetToZero
  300. next
  301. for each obj in AllLights
  302. obj.state=0
  303. next
  304.  
  305. Replay1=Replay1Table(ReplayLevel)
  306. Replay2=Replay2Table(ReplayLevel)
  307. Replay3=Replay3Table(ReplayLevel)
  308. Replay4=Replay4Table(ReplayLevel)
  309.  
  310.  
  311. BonusCounter=0
  312. HoleCounter=0
  313.  
  314.  
  315. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)
  316.  
  317. RefreshReplayCard
  318.  
  319. CurrentFrame=0
  320. CenterLightCount=1
  321. For each obj in CenterLights
  322. obj.state=0
  323. next
  324. CenterLights(CenterLightCount-1).state=1
  325.  
  326.  
  327.  
  328. AdvanceLightCounter=0
  329.  
  330. Players=0
  331. RotatorTemp=1
  332. InProgress=false
  333. TargetLightsOn=false
  334. BallLiftOption=1
  335. ScoreText.text=HighScore
  336.  
  337.  
  338. If B2SOn Then
  339.  
  340.  
  341. Controller.B2SSetScoreRolloverPlayer1 0
  342. Controller.B2SSetScoreRolloverPlayer2 0
  343. Controller.B2SSetScoreRolloverPlayer3 0
  344. Controller.B2SSetScoreRolloverPlayer4 0
  345. Controller.B2SSetData 99,0
  346. Controller.B2SSetScore 3,HighScore
  347. Controller.B2SSetTilt 41,1
  348. Controller.B2SSetTilt 42,1
  349. Controller.B2SSetCredits Credits
  350. Controller.B2SSetGameOver 1
  351. End If
  352.  
  353. for i=1 to 4
  354. player=i
  355. If B2SOn Then
  356. Controller.B2SSetScorePlayer player, 0
  357. End If
  358. next
  359. bump1=1
  360. bump2=1
  361. bump3=1
  362. bump4=1
  363. bump5=1
  364. InitPauser5.enabled=true
  365. If B2SOn then
  366. Controller.B2SSetCredits Credits
  367. end if
  368. if Credits > 0 then DOF 144, DOFOn
  369. End Sub
  370.  
  371. Sub InitBallLoad_timer
  372. Kicker3.CreateSizedBall 25
  373. Kicker3.Kick 120,5
  374. BallIndicatorCount=BallIndicatorCount+1
  375. if BallIndicatorCount=5 then
  376. Kicker3.enabled=false
  377. InitBallLoad.enabled=false
  378. DisableKeysInit=0
  379. end if
  380. end sub
  381.  
  382. Sub Kicker2_Hit
  383. Kicker2.DestroyBall
  384. BallIndicatorCount=BallIndicatorCount-1
  385. If BallIndicatorCount=0 then
  386. Gate2.Collidable=true
  387. end if
  388. end sub
  389.  
  390. Sub Table1_exit()
  391. savehs
  392. SaveLMEMConfig
  393. SaveLMEMConfig2
  394. If B2SOn Then Controller.Stop
  395. end sub
  396.  
  397.  
  398.  
  399.  
  400.  
  401. Sub Table1_KeyDown(ByVal keycode)
  402. If DisableKeysInit=1 then
  403. exit sub
  404. end if
  405.  
  406. ' GNMOD
  407. if EnteringInitials then
  408. CollectInitials(keycode)
  409. exit sub
  410. end if
  411.  
  412.  
  413. if EnteringOptions then
  414. CollectOptions(keycode)
  415. exit sub
  416. end if
  417.  
  418.  
  419.  
  420. If keycode = PlungerKey Then
  421. Plunger.PullBack
  422. PlungerPulled = 1
  423. End If
  424.  
  425. if keycode = LeftFlipperKey and InProgress = false then
  426. OperatorMenuTimer.Enabled = true
  427. end if
  428. ' END GNMOD
  429.  
  430.  
  431. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  432. LeftFlipper.RotateToEnd
  433. PlaySound "buzzL",-1
  434. PlaySound SoundFXDOF("FlipperUp",101,DOFOn,DOFFlippers)
  435. End If
  436.  
  437. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  438. RightFlipper.RotateToEnd
  439.  
  440. PlaySound SoundFXDOF("FlipperUp",102,DOFOn,DOFFlippers)
  441. PlaySound "buzz",-1
  442. End If
  443.  
  444. If keycode = LeftTiltKey Then
  445. Nudge 90, 2
  446. TiltIt
  447. End If
  448.  
  449. If keycode = RightTiltKey Then
  450. Nudge 270, 2
  451. TiltIt
  452. End If
  453.  
  454. If keycode = CenterTiltKey Then
  455. Nudge 0, 2
  456. TiltIt
  457. End If
  458.  
  459. If keycode = MechanicalTilt Then
  460. TiltCount=3
  461. TiltIt
  462. End If
  463.  
  464. if keycode=3 then
  465.  
  466. end if
  467.  
  468. If keycode = AddCreditKey or keycode = 4 then
  469. If B2SOn Then
  470. 'Controller.B2SSetScorePlayer6 HighScore
  471.  
  472. End If
  473.  
  474. playsound "coinin"
  475. AddSpecial2
  476. end if
  477.  
  478. if keycode = 5 then
  479. playsound "coinin"
  480. AddSpecial2
  481. keycode= StartGameKey
  482. end if
  483.  
  484. if (keycode=30 OR keycode=RightMagnasave) and InProgress=true and BallLiftOption=1 and BallsPlayed<BallsPerGame and LaneClear=0 then
  485. PlaySound SoundFXDOF("BallLifter",130,DOFPulse,DOFcontactors)
  486. BallsPlayed=BallsPlayed+1
  487. 'CreateBallID BallRelease
  488. Ballrelease.CreateSizedBall 25
  489. Ballrelease.Kick 270,5
  490. Playsound SoundFX("ballrelease",DOFContactors)
  491. BallsOnTable=BallsOnTable+1
  492. end if
  493.  
  494.  
  495. if keycode=StartGameKey and Credits>0 and (InProgress=false OR BallsOnTable=5) and EnteringOptions = 0 then
  496. 'GNMOD
  497. OperatorMenuTimer.Enabled = false
  498. 'END GNMOD
  499. BallsDrained=0
  500. DisableKeysInit=1
  501. Credits=Credits-1
  502. if Credits <1 then DOF 144, DOFOff
  503. CreditsReel.SetValue(Credits)
  504. ' DrainLock.IsDropped=true
  505. drain.enabled=1
  506. drainopen.visible=1
  507. drainlock001.collidable=0
  508. Players=1
  509. ' CanPlayReel.SetValue(Players)
  510. ClearMatch
  511. Player=1
  512. CanPlayLight1.state=1
  513. GameOverLight.state=0
  514. If BallLiftOption=2 then
  515. playsound "BallsAPoppinStartup"
  516. else
  517. playsound "startup_manual"
  518. end if
  519. TempPlayerUp=Player
  520. ' PlayerUpRotator.enabled=true
  521. rst=0
  522. BallInPlay=1
  523. Light3.state=1
  524. CenterTargetTracker=1
  525. Points=Points MOD 10
  526. InProgress=true
  527. resettimer.enabled=true
  528. BonusMultiplier=1
  529. LaneClear=0
  530. TableTilted=false
  531. TiltTimer.Interval = 500
  532. TiltTimer.Enabled = True
  533.  
  534. TiltPlayer1.setvalue(0)
  535. TiltPlayer2.setvalue(0)
  536. Player1Tilted=false
  537. Player2Tilted=false
  538. If B2SOn Then
  539. Controller.B2SSetTilt 0
  540. Controller.B2SSetGameOver 0
  541. Controller.B2SSetMatch 0
  542. Controller.B2SSetCredits Credits
  543. '
  544. Controller.B2SSetCanPlay 1
  545. Controller.B2SSetPlayerUp 1
  546. Controller.B2SSetBallInPlay BallInPlay
  547. Controller.B2SSetScoreRolloverPlayer1 0
  548. Controller.B2SSetData 99,0
  549. Controller.B2SSetData 11,0
  550. Controller.B2SSetData 12,0
  551. Controller.B2SSetData 13,0
  552. Controller.B2SSetData 14,0
  553. Controller.B2SSetData 15,0
  554. Controller.B2SSetData 41,0
  555. Controller.B2SSetData 42,0
  556. For i = 70 to 84
  557. Controller.B2SSetData i,0
  558. next
  559. End If
  560. If Table1.ShowDT = True then
  561. For each obj in PlayerScores
  562. ' obj.ResetToZero
  563. obj.Visible=false
  564. next
  565. For each obj in PlayerScoresOn
  566. ' obj.ResetToZero
  567. obj.Visible=true
  568. next
  569.  
  570. For each obj in PlayerHuds
  571. obj.SetValue(0)
  572. next
  573. Reel1000.SetValue(0)
  574. GameOverReel.SetValue(0)
  575. PlayerHuds(Player-1).SetValue(1)
  576. PlayerScores(Player-1).visible=0
  577. PlayerScoresOn(Player-1).visible=1
  578.  
  579.  
  580. end If
  581. BallsPlayed=0
  582. BallsDrained=0
  583. BumperSequenceCompleted=0
  584. end if
  585.  
  586.  
  587.  
  588. End Sub
  589.  
  590. Sub Table1_KeyUp(ByVal keycode)
  591. If DisableKeysInit=1 then
  592. exit sub
  593. end if
  594.  
  595.  
  596. ' GNMOD
  597. if EnteringInitials then
  598. exit sub
  599. end if
  600.  
  601. If keycode = PlungerKey Then
  602.  
  603. if PlungerPulled = 0 then
  604. exit sub
  605. end if
  606.  
  607. PlaySound"plungerrelease"
  608. Plunger.Fire
  609. End If
  610.  
  611. if keycode = LeftFlipperKey then
  612. OperatorMenuTimer.Enabled = false
  613. end if
  614.  
  615. ' END GNMOD
  616.  
  617. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  618. LeftFlipper.RotateToStart
  619. PlaySound SoundFXDOF("FlipperDown",101,DOFOff,DOFFlippers)
  620. StopSound "buzzL"
  621. End If
  622.  
  623. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  624. RightFlipper.RotateToStart
  625. StopSound "buzz"
  626. PlaySound SoundFXDOF("FlipperDown",102,DOFOff,DOFFlippers)
  627. End If
  628.  
  629. End Sub
  630.  
  631. Sub ShooterLaneClear_Hit
  632. LaneClear=1
  633. end sub
  634.  
  635. Sub ShooterLaneClear_Unhit
  636. LaneClear=0
  637. end sub
  638.  
  639. Sub Drain_Hit()
  640.  
  641. BallsDrained=BallsDrained+1
  642. If BallsDrained>=5 then
  643. BallsDrained=0
  644. BallsExited=0
  645. ' DrainLock.IsDropped=false
  646. drain.enabled=false
  647. drainopen.visible=0
  648. drainlock001.collidable=1
  649. end if
  650. Drain.DestroyBall
  651.  
  652. BallsOnTable=BallsOnTable-1
  653. 'PlaySound "fx_drain"
  654. DOF 107, DOFPulse
  655. 'Pause4Bonustimer.enabled=true
  656. If BallsOnTable<1 then
  657. BallsOnTable=0
  658. Pause4BonusTimer.enabled=1
  659. end if
  660. End Sub
  661.  
  662.  
  663.  
  664. Sub CloseGateTrigger_Hit()
  665. DOF 149, DOFPulse
  666. End Sub
  667.  
  668. Sub Pause4Bonustimer_timer
  669. Pause4Bonustimer.enabled=0
  670. NextBallDelay.enabled=true
  671.  
  672. End Sub
  673.  
  674. Sub BallExit
  675.  
  676. end sub
  677.  
  678. Sub RefTimer_timer
  679. RefMoveCount=RefMoveCount+1
  680. If RefMoveCount<11 then
  681. select case RefMoveCount
  682. case 1,3,5,7,9,11,13:
  683. refarm.RotY=-40
  684. refarm.image="render3UVa"
  685. case 2,4,6,8,10,12,14:
  686. refarm.RotY=0
  687. refarm.image="render3UV"
  688. end select
  689. else
  690. RefTimer.enabled=false
  691. ResetBumperLights
  692. end if
  693. end sub
  694.  
  695. Sub Boxer1Timer_timer
  696. Boxer1MoveCount=Boxer1MoveCount+1
  697. If Boxer1MoveCount<15 then
  698. select case Boxer1MoveCount
  699. case 1:
  700. boxer1arm.RotY=-40
  701. boxer1arm.image="render3UVa"
  702. RefMoveCount=0
  703. RefTimer.enabled=true
  704.  
  705.  
  706.  
  707. case 14:
  708. boxer1arm.RotY=0
  709. boxer1arm.image="render3UV"
  710. end select
  711. else
  712. Boxer1Timer.enabled=false
  713. end if
  714. end sub
  715.  
  716. Sub Boxer2Timer_timer
  717. Boxer2MoveCount=Boxer2MoveCount+1
  718. If Boxer2MoveCount<16 then
  719. if Boxer2MoveCount<2 or Boxer2MoveCount>11 then
  720.  
  721. else
  722. boxer2.RotY=40
  723. render3_.image="render3UVa"
  724. DOF 122, DOFPulse
  725. end if
  726. else
  727. Boxer2Timer.enabled=false
  728. end if
  729. end sub
  730.  
  731. '***********************
  732. ' Flipper Logos
  733. '***********************
  734.  
  735. Sub UpdateFlipperLogos_Timer
  736. LFlip.RotZ = LeftFlipper.CurrentAngle
  737. RFlip.RotZ = RightFlipper.CurrentAngle
  738. LFlip1.RotZ = LeftFlipper.CurrentAngle
  739. RFlip1.RotZ = RightFlipper.CurrentAngle
  740.  
  741. PGate.Rotz = (Gate.CurrentAngle*.75) + 25
  742.  
  743. FlipperLSh.RotZ = LeftFlipper.currentangle
  744. FlipperRSh.RotZ = RightFlipper.currentangle
  745. End Sub
  746.  
  747.  
  748. '***********************************
  749. ' Walls
  750. '***********************************
  751.  
  752. Sub RubberWallSwitches_Hit(idx)
  753. if TableTilted=false then
  754. AddScore(1)
  755.  
  756. end if
  757. end Sub
  758.  
  759.  
  760. '***********************************
  761. ' Bumpers
  762. '***********************************
  763. Sub Bumper1_Hit
  764. If TableTilted=false then
  765. PlaySound SoundFXDOF("bumper1",112,DOFPulse,DOFContactors)
  766. DOF 113, DOFPulse
  767. bump3 = 1
  768. AddScore(1)
  769. OneBumperLightOff(1)
  770. end if
  771. Check4KO
  772. End Sub
  773.  
  774.  
  775. Sub Bumper2_Hit
  776. If TableTilted=false then
  777. bump2 = 1
  778. AddScore(1)
  779. OneBumperLightOff(2)
  780. end if
  781. Check4KO
  782. End Sub
  783.  
  784. Sub Bumper3_Hit
  785. If TableTilted=false then
  786. bump1 = 1
  787. AddScore(1)
  788. OneBumperLightOff(3)
  789. end if
  790. Check4KO
  791. End Sub
  792.  
  793.  
  794. Sub Bumper4_Hit
  795. If TableTilted=false then
  796. bump1 = 1
  797. AddScore(1)
  798. OneBumperLightOff(4)
  799. end if
  800. Check4KO
  801. End Sub
  802.  
  803.  
  804. Sub Bumper5_Hit
  805. If TableTilted=false then
  806. PlaySound SoundFXDOF("bumper1",110,DOFPulse,DOFContactors)
  807. DOF 111, DOFPulse
  808. AddScore(1)
  809. OneBumperLightOff(5)
  810. end if
  811. Check4KO
  812. End Sub
  813.  
  814. Sub Bumper100k_001_Hit
  815. If TableTilted=false then
  816.  
  817. If Bumper6Light.state=1 then
  818. AddScore(10)
  819. else
  820. AddScore(1)
  821. end if
  822.  
  823. end if
  824.  
  825. End Sub
  826.  
  827. Sub Bumper100k_002_Hit
  828. If TableTilted=false then
  829.  
  830. If Bumper7Light.state=1 then
  831. AddScore(10)
  832. else
  833. AddScore(1)
  834. end if
  835.  
  836. end if
  837.  
  838. End Sub
  839.  
  840. Sub OneBumperLightOff(x)
  841. BumperLights(x-1).state=0
  842. if x<6 then
  843. EVAL("bumpermesh00"&x).image="render2UV"
  844. else
  845. EVAL("bumpermesh100K00"&x-5).image="render2UV"
  846. end if
  847. end sub
  848.  
  849. Sub OneBumperLightOn(x)
  850. BumperLights(x-1).state=1
  851. If x<6 then
  852. EVAL("bumpermesh00"&x).image="render2UVlit"
  853. else
  854. EVAL("bumpermesh100K00"&x-5).image="render2UVlit"
  855. end if
  856. end sub
  857.  
  858. Sub Check4KO
  859. If Bumper1Light.state=0 AND Bumper2Light.state=0 AND Bumper3Light.state=0 AND Bumper4Light.state=0 AND Bumper5Light.state=0 then
  860. AddPoints(1)
  861. SetMotor(5)
  862. Boxer1MoveCount=0
  863. Boxer1Timer.enabled=true
  864. Boxer2MoveCount=0
  865. Boxer2Timer.enabled=true
  866.  
  867. end if
  868.  
  869. end sub
  870.  
  871.  
  872. Sub ResetBumperLights
  873. For x=1 to 5
  874. OneBumperLightOn(x)
  875. next
  876. boxer2.RotY=0
  877. render3_.image="render3UV"
  878. end sub
  879.  
  880. sub AddPoints(NewPoints)
  881. PlusPoints=NewPoints
  882. PointsTimer.enabled=true
  883. end sub
  884.  
  885.  
  886. Sub PointsTimer_timer
  887. If PlusPoints<1 then
  888. PointsTimer.enabled=false
  889. exit sub
  890. end if
  891. Points=Points+1
  892. ToggleAlternatingRelay
  893. PlaySound SoundFX("Bell100",DOFBell)
  894. PlusPoints=PlusPoints-1
  895. if Points>19 then Points=19
  896. If Points>=15 and Points<=19 then AddSpecial
  897. For each obj in PointsLights
  898. obj.state=0
  899. next
  900. if Points<10 then
  901. PointsLights(Points-1).state=1
  902. elseif Points=10 then
  903. PointsLights(9).state=1
  904. elseif Points>10 AND Points<20 then
  905. PointsLights(9).state=1
  906. PointsLights(Points-11).state=1
  907. elseif Points=20 then
  908. PointsLights(10).state=1
  909. elseif Points>20 AND Points<30 then
  910. PointsLights(10).state=1
  911. PointsLights(Points-21).state=1
  912. elseif Points=30 then
  913. PointsLights(11).state=1
  914. else
  915. PointsLights(11).state=1
  916. PointsLights(Points-31).state=1
  917. end if
  918. If Points>12 then
  919. JokerLight2.State=1
  920. JokerLight4.state=1
  921. end if
  922. end sub
  923.  
  924. Sub AddKO
  925. Off12345Bumpers=0
  926. Off12345.enabled=true
  927. Boxer1MoveCount=0
  928. Boxer1Timer.enabled=true
  929. Boxer2MoveCount=0
  930. Boxer2Timer.enabled=true
  931.  
  932.  
  933. end sub
  934.  
  935. '************************************
  936. ' Targets
  937. '************************************
  938. sub StandupTargets_Hit(idx)
  939. DOF 116 + idx, DOFPulse
  940. If TableTilted=true then Exit Sub
  941.  
  942.  
  943. Select case idx
  944. case 0:
  945. Off123Bumpers=0
  946. targetface1.TransY=-5
  947. Off123.enabled=true
  948. case 1:
  949. AddKO
  950. targetface2.TransY=-5
  951. case 2:
  952. Off345Bumpers=2
  953. Off345.enabled=true
  954. targetface3.TransY=-5
  955. end select
  956. StandupTargets(idx).timerenabled=true
  957. end sub
  958.  
  959. Sub Target001_timer
  960. targetface1.TransY=0
  961. Target001.timerenabled=false
  962. end sub
  963.  
  964. Sub Target002_timer
  965. targetface2.TransY=0
  966. Target002.timerenabled=false
  967. end sub
  968.  
  969. Sub Target003_timer
  970. targetface3.TransY=0
  971. Target003.timerenabled=false
  972. end sub
  973.  
  974. sub Off123_timer
  975. Off123Bumpers=Off123Bumpers+1
  976. OneBumperLightOff(Off123Bumpers)
  977. AddScore(1)
  978. If Off123Bumpers>2 then
  979. Off123.enabled=false
  980. Check4KO
  981. end if
  982. end sub
  983.  
  984. sub Off345_timer
  985. Off345Bumpers=Off345Bumpers+1
  986. OneBumperLightOff(Off345Bumpers)
  987. AddScore(1)
  988. If Off345Bumpers>4 then
  989. Off345.enabled=false
  990. Check4KO
  991. end if
  992. end sub
  993.  
  994. sub Off12345_timer
  995. Off12345Bumpers=Off12345Bumpers+1
  996. If Off12345Bumpers<6 then
  997. OneBumperLightOff(Off12345Bumpers)
  998. AddScore(1)
  999. end if
  1000. If Off12345Bumpers>6 then
  1001. Off12345.enabled=false
  1002. Check4KO
  1003. end if
  1004. end sub
  1005.  
  1006. '************************************
  1007. ' Kickers
  1008. '************************************
  1009. sub MidKicker1_Hit()
  1010. Dim tempkickscore
  1011. Dim speedx,speedy,finalspeed
  1012. speedx=activeball.velx
  1013. speedy=activeball.vely
  1014. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1015. if TableTilted=true then
  1016. MidKicker1.Timerenabled=1
  1017. tKickerTCount1=0
  1018. exit sub
  1019. end if
  1020. KickerHoldFlag=1
  1021. KickerHold1.enabled=1
  1022.  
  1023. tKickerTCount1=CenterLightCount
  1024.  
  1025. end sub
  1026.  
  1027. Sub KickerHold1_timer
  1028. If MotorRunning<>0 then
  1029. exit sub
  1030. else
  1031. If CenterLight3.state=1 then
  1032. SetMotor(50)
  1033. elseif CenterLight2.state=1 then
  1034. SetMotor(20)
  1035. else
  1036. SetMotor(5)
  1037. end if
  1038. KickerHold1.enabled=0
  1039. MidKicker1.timerenabled=1
  1040. tKickerTCount1=0
  1041.  
  1042. end if
  1043.  
  1044. end sub
  1045.  
  1046. Sub MidKicker1_Timer()
  1047. if MotorRunning<>0 then
  1048. exit sub
  1049. end if
  1050. tKickerTCount1=tKickerTCount1+1
  1051. select case tKickerTCount1
  1052. case 1:
  1053. Pkickarm1.rotz=15
  1054. Playsound SoundFXDOF("saucer",120,DOFPulse,DOFContactors)
  1055. DOF 121, DOFPulse
  1056. MidKicker1.kick 37,20
  1057. KickerHoldFlag=0
  1058. case 2:
  1059. MidKicker1.timerenabled=0
  1060. Pkickarm1.rotz=0
  1061. end Select
  1062.  
  1063. end sub
  1064.  
  1065.  
  1066. sub MidKicker2_Hit()
  1067. Dim tempkickscore
  1068. Dim speedx,speedy,finalspeed
  1069. speedx=activeball.velx
  1070. speedy=activeball.vely
  1071. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1072. if TableTilted=true then
  1073. MidKicker2.Timerenabled=1
  1074. tKickerTCount2=0
  1075. exit sub
  1076. end if
  1077. KickerHoldFlag=1
  1078. KickerHold2.enabled=1
  1079.  
  1080.  
  1081. tKickerTCount2=CenterLightCount
  1082.  
  1083.  
  1084. end sub
  1085.  
  1086. Sub KickerHold2_timer
  1087. If MotorRunning<>0 then
  1088. exit sub
  1089. else
  1090. If CenterLight3.state=1 then
  1091. SetMotor(50)
  1092. elseif CenterLight2.state=1 then
  1093. SetMotor(20)
  1094. else
  1095. SetMotor(5)
  1096. end if
  1097.  
  1098. KickerHold2.enabled=0
  1099. MidKicker2.timerenabled=1
  1100. tKickerTCount2=0
  1101.  
  1102. end if
  1103.  
  1104. end sub
  1105.  
  1106. Sub MidKicker2_Timer()
  1107. if MotorRunning<>0 then
  1108. exit sub
  1109. end if
  1110. tKickerTCount2=tKickerTCount2+1
  1111. select case tKickerTCount2
  1112. case 1:
  1113. Pkickarm2.rotz=15
  1114. Playsound SoundFXDOF("saucer",126,DOFPulse,DOFContactors)
  1115. DOF 121, DOFPulse
  1116. MidKicker2.kick -37,20
  1117. KickerHoldFlag=0
  1118. case 2:
  1119. MidKicker2.timerenabled=0
  1120. Pkickarm2.rotz=0
  1121. end Select
  1122.  
  1123. end sub
  1124.  
  1125. '************************************
  1126. ' Rollover lanes/Trigger Button
  1127. '************************************
  1128.  
  1129. Sub TriggerCollection_Hit(idx)
  1130.  
  1131. If TableTilted=false then
  1132. DOF 136+idx,DOFPulse
  1133. select case idx
  1134.  
  1135. case 0:
  1136. OneBumperLightOn(6)
  1137. If JokerLight2.state=1 then AddSpecial
  1138. If JokerLight1.state=1 then AddKO
  1139. CenterLight2.state=1
  1140. If Bumper6Light.state=1 AND Bumper7Light.state=1 then
  1141. CenterLight3.state=1
  1142.  
  1143. end if
  1144.  
  1145.  
  1146. case 1:
  1147. OneBumperLightOn(7)
  1148. If JokerLight4.state=1 then AddSpecial
  1149. If JokerLight3.state=1 then AddKO
  1150. CenterLight2.state=1
  1151. If Bumper6Light.state=1 AND Bumper7Light.state=1 then
  1152. CenterLight3.state=1
  1153.  
  1154. end if
  1155. case 2:
  1156. blockplate.transz=-5
  1157. metalguard.collidable=true
  1158. BallPoints=0
  1159. Trigger001Light.state=0
  1160. Playsound SoundFXDOF("solenoid",123,DOFPulse,DOFContactors)
  1161. case 3:
  1162. if Trigger001Light.state=1 then
  1163. AddKO
  1164. end if
  1165. end select
  1166.  
  1167. end if
  1168.  
  1169. end Sub
  1170.  
  1171.  
  1172. '**************************************
  1173.  
  1174.  
  1175. Sub AddSpecial()
  1176. PlaySound SoundFXDOF("knocker",142,DOFPulse,DOFContactors)
  1177. DOF 143, DOFPulse
  1178. Credits=Credits+1
  1179. DOF 144, DOFOn
  1180. if Credits>15 then Credits=15
  1181. If B2SOn Then
  1182. Controller.B2SSetCredits Credits
  1183. End If
  1184. CreditsReel.SetValue(Credits)
  1185. End Sub
  1186.  
  1187. Sub AddSpecial2()
  1188. PlaySound"click"
  1189. Credits=Credits+1
  1190. DOF 144, DOFOn
  1191. if Credits>25 then Credits=25
  1192. If B2SOn Then
  1193. Controller.B2SSetCredits Credits
  1194. End If
  1195. CreditsReel.SetValue(Credits)
  1196. End Sub
  1197.  
  1198. Sub LightTheBumpers
  1199.  
  1200. end sub
  1201.  
  1202. sub AdvanceCenterCounter
  1203. CenterLightCount=CenterLightCount+1
  1204. If CenterLightCount>3 then CenterLightCount=1
  1205. For each obj in CenterLights
  1206. obj.state=0
  1207. next
  1208. CenterLights(CenterLightCount-1).state=1
  1209.  
  1210. end sub
  1211.  
  1212. Sub AdvanceZeroToNine
  1213. AlternatingRelay=AlternatingRelay+1
  1214. if AlternatingRelay>1 then
  1215. AlternatingRelay=0
  1216. end if
  1217. ToggleAlternatingRelay
  1218. end sub
  1219.  
  1220. Sub ToggleAlternatingRelay
  1221.  
  1222.  
  1223. end sub
  1224.  
  1225. Sub ResetBallDrops
  1226.  
  1227.  
  1228.  
  1229. HoleCounter=0
  1230. YellowBumpersOn=false
  1231. GreenBumpersOn=false
  1232. LightTheBumpers
  1233. End Sub
  1234.  
  1235.  
  1236. Sub LightsOut
  1237.  
  1238. BonusCounter=0
  1239. HoleCounter=0
  1240.  
  1241. StopSound "buzz"
  1242. StopSound "buzzL"
  1243.  
  1244. end sub
  1245.  
  1246. Sub ResetBalls()
  1247.  
  1248. TempMultiCounter=BallsPerGame-BallInPlay
  1249.  
  1250. ResetBallDrops
  1251. BonusMultiplier=1
  1252. If BallsOnTable<1 then
  1253. TableTilted=false
  1254. TiltReel.SetValue(0)
  1255. If B2Son then
  1256. Controller.B2SSetTilt 0
  1257. end if
  1258.  
  1259. PlasticsOn
  1260. BumpersOn
  1261. end if
  1262. If BallLiftOption=2 then
  1263. PlayerUpLight1.state=0
  1264. PlayerUpLight2.state=0
  1265. Eval("PlayerUpLight"&Player).state=1
  1266. PlayStartBall.enabled=true
  1267. BallsPlayed=BallsPlayed+1
  1268. 'CreateBallID BallRelease
  1269. Ballrelease.CreateSizedBall 25
  1270. Ballrelease.Kick 90,5
  1271. DOF 145,DOFPulse
  1272. BallsOnTable=BallsOnTable+1
  1273. BallInPlayLight.state=1
  1274. BallInPlayReel.SetValue(BallInPlay)
  1275. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)
  1276. end if
  1277.  
  1278.  
  1279. End Sub
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285. sub resettimer_timer
  1286. rst=rst+1
  1287. AdvanceZeroToNine
  1288. Points=Points-1
  1289. if Points>0 then
  1290. For each obj in PointsLights
  1291. obj.state=0
  1292. next
  1293. if Points<10 then
  1294. PointsLights(Points-1).state=1
  1295. elseif Points=10 then
  1296. PointsLights(9).state=1
  1297. elseif Points>10 AND Points<20 then
  1298. PointsLights(9).state=1
  1299. PointsLights(Points-11).state=1
  1300. elseif Points=20 then
  1301. PointsLights(10).state=1
  1302. elseif Points>20 AND Points<30 then
  1303. PointsLights(10).state=1
  1304. PointsLights(Points-21).state=1
  1305. elseif Points=30 then
  1306. PointsLights(11).state=1
  1307. else
  1308. PointsLights(11).state=1
  1309. PointsLights(Points-31).state=1
  1310. end if
  1311. else
  1312. For each obj in PointsLights
  1313. obj.state=0
  1314. next
  1315. end if
  1316. if rst>0 and rst<11 then
  1317. ResetReelsToZero(1)
  1318. end if
  1319. if rst=11 then
  1320. if BallLiftOption=2 then
  1321. playsound "StartBall1"
  1322. end if
  1323. end if
  1324. if rst=12 then
  1325. newgame
  1326. DisableKeysInit=0
  1327. resettimer.enabled=false
  1328. end if
  1329. end sub
  1330.  
  1331. Sub ResetReelsToZero(reelzeroflag)
  1332. dim d1(5)
  1333. dim d2(5)
  1334. dim scorestring1, scorestring2,OldB2SScoreSplit,OldB2SScoreMod
  1335.  
  1336. If reelzeroflag=1 then
  1337. scorestring1=CStr(Score(1))
  1338. scorestring2=CStr(Score(2))
  1339. scorestring1=right("00000" & scorestring1,5)
  1340. scorestring2=right("00000" & scorestring2,5)
  1341. for i=0 to 4
  1342. d1(i)=CInt(mid(scorestring1,i+1,1))
  1343. d2(i)=CInt(mid(scorestring2,i+1,1))
  1344. next
  1345. for i=0 to 4
  1346. if d1(i)>0 then
  1347. d1(i)=d1(i)-1
  1348. if d1(i)<1 then d1(i)=0
  1349. end if
  1350. if d2(i)>0 then
  1351. d2(i)=d2(i)-1
  1352. if d2(i)<1 then d2(i)=0
  1353. end if
  1354.  
  1355. next
  1356. Score(1)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  1357. Score(2)=(d2(0)*10000) + (d2(1)*1000) + (d2(2)*100) + (d2(3)*10) + d2(4)
  1358.  
  1359. If B2SOn Then
  1360. for i= 160 to 234
  1361. Controller.B2SSetData i,0
  1362. next
  1363. OldB2SScoreSplit = Score(1)
  1364. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  1365. For x=50 to 59
  1366. Controller.B2SSetData x,0
  1367. next
  1368. Controller.B2SSetData 50+OldB2SScoreMod,1
  1369. OldB2SScoreSplit = int(OldB2SScoreSplit/10)
  1370. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  1371. For x=60 to 69
  1372. Controller.B2SSetData x,0
  1373. next
  1374. Controller.B2SSetData 60+OldB2SScoreMod,1
  1375. OldB2SScoreSplit = int(OldB2SScoreSplit/10)
  1376. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  1377. For x=70 to 79
  1378. Controller.B2SSetData x,0
  1379. next
  1380. Controller.B2SSetData 70+OldB2SScoreMod,1
  1381.  
  1382. End If
  1383. OldB2SScoreSplit = Score(1)
  1384. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  1385. 'Scores11.SetValue(OldB2SScoreMod)
  1386. for x=1 to 9
  1387. EVAL("TenK00"&x).setvalue(0)
  1388. next
  1389. If OldB2SScoreMod>0 then EVAL("TenK00"&OldB2SScoreMod).setvalue(1)
  1390. OldB2SScoreSplit = int(OldB2SScoreSplit/10)
  1391. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  1392. 'Scores101.SetValue(OldB2SScoreMod)
  1393. for x=0 to 8
  1394. HundKLights(x).state=0
  1395. next
  1396. If OldB2SScoreMod>0 then HundKLights(OldB2SScoreMod-1).state=1
  1397. OldB2SScoreSplit = int(OldB2SScoreSplit/10)
  1398. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  1399. 'Scores1001.SetValue(OldB2SScoreMod)
  1400. for x=1 to 5
  1401. EVAL("Million00"&x).state=0
  1402. if x=3 then EVAL("Million00"&x&"_2").state=0
  1403. next
  1404. If OldB2SScoreMod>0 then EVAL("Million00"&OldB2SScoreMod).state=1
  1405.  
  1406.  
  1407. end if
  1408. If reelzeroflag=2 then
  1409. scorestring1=CStr(Score(2))
  1410. scorestring1=right("00000" & scorestring1,5)
  1411. for i=0 to 4
  1412. d1(i)=CInt(mid(scorestring1,i+1,1))
  1413. next
  1414. for i=0 to 4
  1415. if d1(i)>0 then
  1416. d1(i)=d1(i)+1
  1417. if d1(i)>9 then d1(i)=0
  1418. end if
  1419.  
  1420. next
  1421. Score(2)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  1422. If B2SOn Then
  1423. Controller.B2SSetScorePlayer 2, Score(2)
  1424. End If
  1425. PlayerScores(1).SetValue(Score(2))
  1426. PlayerScoresOn(1).SetValue(Score(2))
  1427.  
  1428. end if
  1429.  
  1430. end sub
  1431.  
  1432.  
  1433. sub NextBallDelay_timer()
  1434. NextBallDelay.enabled=false
  1435. nextball
  1436.  
  1437. end sub
  1438.  
  1439. sub newgame
  1440. InProgress=true
  1441. queuedscore=0
  1442. ClearMatch
  1443. for i = 1 to 4
  1444. Score(i)=0
  1445. Score100K(1)=0
  1446. HighScorePaid(i)=false
  1447. Replay1Paid(i)=false
  1448. Replay2Paid(i)=false
  1449. Replay3Paid(i)=false
  1450. next
  1451. If B2SOn Then
  1452. Controller.B2SSetTilt 0
  1453. Controller.B2SSetGameOver 0
  1454.  
  1455. ' Controller.B2SSetScorePlayer1 0
  1456. ' Controller.B2SSetScorePlayer2 0
  1457. ' Controller.B2SSetScorePlayer3 0
  1458. ' Controller.B2SSetScorePlayer4 0
  1459. Controller.B2SSetBallInPlay BallInPlay
  1460. End if
  1461.  
  1462. If B2SOn then
  1463. For i=60 to 92
  1464. Controller.B2SSetData i,0
  1465. next
  1466. end if
  1467. CardSequenceComplete=false
  1468. AlternatingRelay=0
  1469. ZeroToNineUnit=4
  1470. ToggleAlternatingRelay
  1471. ResetBumperLights
  1472. Points=0
  1473. For each obj in PointsLights
  1474. obj.state=0
  1475. next
  1476. For each obj in SpecialLights
  1477. obj.state=0
  1478. next
  1479. CenterLight1.state=1
  1480. CenterLight2.state=0
  1481. CenterLight3.state=0
  1482. JokerLight1.state=1
  1483. JokerLight3.state=1
  1484. JokerLight2.state=0
  1485. JokerLight4.state=0
  1486. OneBumperLightOff(6)
  1487. OneBumperLightOff(7)
  1488.  
  1489. BumperSequenceCompleted=0
  1490. SlickCounter=0
  1491. ChickCounter=0
  1492. NumberCounter=0
  1493. BumpersOn
  1494. BonusCounter=0
  1495. BallCounter=0
  1496. TargetLeftFlag=1
  1497. TargetCenterFlag=1
  1498. TargetRightFlag=1
  1499. TargetSequenceComplete=0
  1500. AdvancesCompleted=0
  1501. ' IncreaseBonus
  1502. ' ToggleBumper
  1503. EightLit=1
  1504. ResetBalls
  1505. End sub
  1506.  
  1507.  
  1508. sub EndOfGame
  1509.  
  1510. InProgress=false
  1511. PlaySound("MotorLeer")
  1512. If B2SOn Then
  1513. Controller.B2SSetGameOver 1
  1514. Controller.B2SSetPlayerUp 0
  1515. Controller.B2SSetBallInPlay 0
  1516. Controller.B2SSetCanPlay 0
  1517. End If
  1518. For each obj in PlayerHuds
  1519. obj.SetValue(0)
  1520. next
  1521. GameOverReel.SetValue(1)
  1522. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)
  1523.  
  1524. ' BallInPlayReel.SetValue(0)
  1525. ' CanPlayReel.SetValue(0)
  1526. LeftFlipper.RotateToStart
  1527. RightFlipper.RotateToStart
  1528. LightsOut
  1529. Light3.state=0
  1530. BumpersOff
  1531. PlasticsOff
  1532. 'checkmatch
  1533. CheckHighScore
  1534.  
  1535. Players=0
  1536. If Table1.ShowDT = True Then
  1537. PlayerScores(Player-1).visible=1
  1538. PlayerScoresOn(Player-1).visible=0
  1539. end If
  1540.  
  1541. HighScoreTimer.interval=100
  1542. HighScoreTimer.enabled=True
  1543. end sub
  1544.  
  1545. sub EndOfGameTimer_timer
  1546. EndOfGameTimer.enabled=false
  1547. EndOfGame
  1548. end sub
  1549.  
  1550. sub nextball
  1551.  
  1552. If TiltEndsGame=1 and TableTilted=true and BallsOnTable>0 then
  1553. exit sub
  1554. end if
  1555. Player=Player+1
  1556. If Player>Players Then
  1557. BallInPlay=BallInPlay+1
  1558. If (BallInPlay>BallsPerGame) then
  1559. PlaySound("MotorLeer")
  1560.  
  1561.  
  1562. EndGameCount=0
  1563. EndOfGameTimer.enabled=true
  1564. exit sub
  1565. Else
  1566. Player=1
  1567. If Player1Tilted=True then
  1568. Player=2
  1569. end if
  1570. If B2SOn Then
  1571. Controller.B2SSetPlayerUp Player
  1572. Controller.B2SSetBallInPlay BallInPlay
  1573.  
  1574. End If
  1575. ' PlaySound("RotateThruPlayers")
  1576. TempPlayerUp=Player
  1577. ' PlayerUpRotator.enabled=true
  1578. ' PlayStartBall.enabled=true
  1579. For each obj in PlayerHuds
  1580. obj.SetValue(0)
  1581. next
  1582. If Table1.ShowDT = True then
  1583. For each obj in PlayerScores
  1584. obj.visible=1
  1585. Next
  1586.  
  1587. PlayerHuds(Player-1).SetValue(1)
  1588.  
  1589. end If
  1590.  
  1591. ResetBalls
  1592. End If
  1593. Else
  1594. If Player2Tilted=true then
  1595. nextball
  1596. exit sub
  1597. end if
  1598. If B2SOn Then
  1599. Controller.B2SSetPlayerUp Player
  1600. Controller.B2SSetBallInPlay BallInPlay
  1601. End If
  1602. ' PlaySound("RotateThruPlayers")
  1603. TempPlayerUp=Player
  1604. ' PlayerUpRotator.enabled=true
  1605. ' PlayStartBall.enabled=true
  1606. For each obj in PlayerHuds
  1607. obj.SetValue(0)
  1608. next
  1609. If Table1.ShowDT = True then
  1610. For each obj in PlayerScores
  1611. obj.visible=1
  1612. Next
  1613.  
  1614. PlayerHuds(Player-1).SetValue(1)
  1615.  
  1616. end If
  1617. ResetBalls
  1618. End If
  1619.  
  1620. End sub
  1621.  
  1622. sub CheckHighScore
  1623. Dim playertops
  1624. dim si
  1625. dim sj
  1626. dim stemp
  1627. dim stempplayers
  1628. for i=1 to 4
  1629. sortscores(i)=0
  1630. sortplayers(i)=0
  1631. next
  1632. playertops=0
  1633. for i = 1 to Players
  1634. sortscores(i)=Score(i)*10000
  1635. sortplayers(i)=i
  1636. next
  1637.  
  1638. for si = 1 to Players
  1639. for sj = 1 to Players-1
  1640. if sortscores(sj)>sortscores(sj+1) then
  1641. stemp=sortscores(sj+1)
  1642. stempplayers=sortplayers(sj+1)
  1643. sortscores(sj+1)=sortscores(sj)
  1644. sortplayers(sj+1)=sortplayers(sj)
  1645. sortscores(sj)=stemp
  1646. sortplayers(sj)=stempplayers
  1647. end if
  1648. next
  1649. next
  1650. ScoreChecker=4
  1651. CheckAllScores=1
  1652. NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
  1653. savehs
  1654. end sub
  1655.  
  1656.  
  1657. sub checkmatch
  1658. Dim tempmatch
  1659. Dim tempmatch2
  1660. tempmatch=Int(Rnd*10)
  1661. do
  1662. tempmatch2=Int(Rnd*10)
  1663. loop while tempmatch2=tempmatch
  1664.  
  1665. Match=tempmatch
  1666. MatchLit2=tempmatch2
  1667. If TableTilted=True and TiltEndsGame then
  1668. exit sub
  1669. end if
  1670. DisplayMatch
  1671.  
  1672.  
  1673. for i = 1 to Players
  1674. if Match=(Score(i) mod 10) then
  1675. AddSpecial
  1676. end if
  1677.  
  1678. next
  1679. end sub
  1680.  
  1681. Sub TiltTimer_Timer()
  1682. if InProgress=false then
  1683. exit sub
  1684. end if
  1685. if TiltCount > 0 then TiltCount = TiltCount - 1
  1686. if TiltCount = 0 then
  1687. TiltTimer.Enabled = False
  1688. end if
  1689. end sub
  1690.  
  1691. Sub TiltIt()
  1692. TiltCount = TiltCount + 1
  1693. if TiltCount > 3 then
  1694. TableTilted=True
  1695. PlasticsOff
  1696. BumpersOff
  1697.  
  1698. LeftFlipper.RotateToStart
  1699. RightFlipper.RotateToStart
  1700. StopSound "buzz"
  1701. StopSound "buzzL"
  1702. TiltReel.SetValue(1)
  1703.  
  1704. If B2Son then
  1705. Controller.B2SSetTilt 1
  1706. end if
  1707.  
  1708. If Player=1 then
  1709. Player1Tilted=true
  1710. TiltPlayer1.SetValue(1)
  1711. else
  1712. Player2Tilted=true
  1713. TiltPlayer2.SetValue(1)
  1714. end if
  1715.  
  1716.  
  1717. If ((Player1Tilted=true) and (Players=1)) or ((Player1Tilted=true) and (Player2Tilted=true)) then
  1718.  
  1719. 'InProgress=false
  1720. 'BallInPlay=5
  1721. If B2SOn Then
  1722. Controller.B2SSetGameOver 1
  1723. Controller.B2SSetPlayerUp 0
  1724. Controller.B2SSetBallInPlay 0
  1725. Controller.B2SSetCanPlay 0
  1726. End If
  1727. For each obj in PlayerHuds
  1728. obj.SetValue(0)
  1729. next
  1730. GameOverReel.SetValue(1)
  1731. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)
  1732. metalguard.collidable=false
  1733. blockplate.transz=-52
  1734. Playsound SoundFXDOF("Soloff",124,DOFPulse,DOFContactors)
  1735. Players=0
  1736.  
  1737.  
  1738.  
  1739. end if
  1740. else
  1741. TiltTimer.Interval = 500
  1742. TiltTimer.Enabled = True
  1743. end if
  1744.  
  1745. end sub
  1746.  
  1747.  
  1748.  
  1749.  
  1750. Sub PlayerUpRotator_timer()
  1751. If RotatorTemp<5 then
  1752. TempPlayerUp=TempPlayerUp+1
  1753. If TempPlayerUp>4 then
  1754. TempPlayerUp=1
  1755. end if
  1756. If B2SOn Then
  1757. Controller.B2SSetPlayerUp TempPlayerUp
  1758. End If
  1759.  
  1760. else
  1761. if B2SOn then
  1762. Controller.B2SSetPlayerUp Player
  1763. end if
  1764. PlayerUpRotator.enabled=false
  1765. RotatorTemp=1
  1766. end if
  1767. RotatorTemp=RotatorTemp+1
  1768.  
  1769.  
  1770. end sub
  1771.  
  1772. sub savehs
  1773. ' Based on Black's Highscore routines
  1774. Dim FileObj
  1775. Dim ScoreFile
  1776. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1777. If Not FileObj.FolderExists(UserDirectory) then
  1778. Exit Sub
  1779. End if
  1780. Set ScoreFile=FileObj.CreateTextFile(UserDirectory & HSFileName,True)
  1781. ScoreFile.WriteLine 0
  1782. ScoreFile.WriteLine Credits
  1783. scorefile.writeline BallsPerGame
  1784. scorefile.writeline ArrowCounter
  1785. scorefile.writeline AdvanceSpecialMax
  1786. scorefile.writeline BallLiftOption
  1787. scorefile.writeline TiltEndsGame
  1788. scorefile.writeline ReplayLevel
  1789. for xx=1 to 5
  1790. scorefile.writeline HSScore(xx)
  1791. next
  1792. for xx=1 to 5
  1793. scorefile.writeline HSName(xx)
  1794. next
  1795. ScoreFile.Close
  1796. Set ScoreFile=Nothing
  1797. Set FileObj=Nothing
  1798. end sub
  1799.  
  1800. sub SaveLMEMConfig
  1801. Dim FileObj
  1802. Dim LMConfig
  1803. dim temp1
  1804. dim tempb2s
  1805. tempb2s=0
  1806. if B2SOn=true then
  1807. tempb2s=1
  1808. else
  1809. tempb2s=0
  1810. end if
  1811. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1812. If Not FileObj.FolderExists(UserDirectory) then
  1813. Exit Sub
  1814. End if
  1815. Set LMConfig=FileObj.CreateTextFile(UserDirectory & LMEMTableConfig,True)
  1816. LMConfig.WriteLine tempb2s
  1817. LMConfig.Close
  1818. Set LMConfig=Nothing
  1819. Set FileObj=Nothing
  1820.  
  1821. end Sub
  1822.  
  1823. sub LoadLMEMConfig
  1824. Dim FileObj
  1825. Dim LMConfig
  1826. dim tempC
  1827. dim tempb2s
  1828.  
  1829. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1830. If Not FileObj.FolderExists(UserDirectory) then
  1831. Exit Sub
  1832. End if
  1833. If Not FileObj.FileExists(UserDirectory & LMEMTableConfig) then
  1834. Exit Sub
  1835. End if
  1836. Set LMConfig=FileObj.GetFile(UserDirectory & LMEMTableConfig)
  1837. Set TextStr2=LMConfig.OpenAsTextStream(1,0)
  1838. If (TextStr2.AtEndOfStream=True) then
  1839. Exit Sub
  1840. End if
  1841. tempC=TextStr2.ReadLine
  1842. TextStr2.Close
  1843. tempb2s=cdbl(tempC)
  1844. if tempb2s=0 then
  1845. B2SOn=false
  1846. else
  1847. B2SOn=true
  1848. end if
  1849. Set LMConfig=Nothing
  1850. Set FileObj=Nothing
  1851. end sub
  1852.  
  1853. sub SaveLMEMConfig2
  1854. If ShadowConfigFile=false then exit sub
  1855. Dim FileObj
  1856. Dim LMConfig2
  1857. dim temp1
  1858. dim temp2
  1859. dim tempBS
  1860. dim tempFS
  1861.  
  1862. if EnableBallShadow=true then
  1863. tempBS=1
  1864. else
  1865. tempBS=0
  1866. end if
  1867. if EnableFlipperShadow=true then
  1868. tempFS=1
  1869. else
  1870. tempFS=0
  1871. end if
  1872.  
  1873. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1874. If Not FileObj.FolderExists(UserDirectory) then
  1875. Exit Sub
  1876. End if
  1877. Set LMConfig2=FileObj.CreateTextFile(UserDirectory & LMEMShadowConfig,True)
  1878. LMConfig2.WriteLine tempBS
  1879. LMConfig2.WriteLine tempFS
  1880. LMConfig2.Close
  1881. Set LMConfig2=Nothing
  1882. Set FileObj=Nothing
  1883.  
  1884. end Sub
  1885.  
  1886. sub LoadLMEMConfig2
  1887. If ShadowConfigFile=false then
  1888. EnableBallShadow = ShadowBallOn
  1889. BallShadowUpdate.enabled = ShadowBallOn
  1890. EnableFlipperShadow = ShadowFlippersOn
  1891. FlipperLSh.visible = ShadowFlippersOn
  1892. FlipperRSh.visible = ShadowFlippersOn
  1893. exit sub
  1894. end if
  1895. Dim FileObj
  1896. Dim LMConfig2
  1897. dim tempC
  1898. dim tempD
  1899. dim tempFS
  1900. dim tempBS
  1901.  
  1902. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1903. If Not FileObj.FolderExists(UserDirectory) then
  1904. Exit Sub
  1905. End if
  1906. If Not FileObj.FileExists(UserDirectory & LMEMShadowConfig) then
  1907. Exit Sub
  1908. End if
  1909. Set LMConfig2=FileObj.GetFile(UserDirectory & LMEMShadowConfig)
  1910. Set TextStr2=LMConfig2.OpenAsTextStream(1,0)
  1911. If (TextStr2.AtEndOfStream=True) then
  1912. Exit Sub
  1913. End if
  1914. tempC=TextStr2.ReadLine
  1915. tempD=TextStr2.Readline
  1916. TextStr2.Close
  1917. tempBS=cdbl(tempC)
  1918. tempFS=cdbl(tempD)
  1919. if tempBS=0 then
  1920. EnableBallShadow=false
  1921. BallShadowUpdate.enabled=false
  1922. else
  1923. EnableBallShadow=true
  1924. end if
  1925. if tempFS=0 then
  1926. EnableFlipperShadow=false
  1927. FlipperLSh.visible=false
  1928. FLipperRSh.visible=false
  1929. else
  1930. EnableFlipperShadow=true
  1931. end if
  1932. Set LMConfig2=Nothing
  1933. Set FileObj=Nothing
  1934.  
  1935. end sub
  1936.  
  1937.  
  1938. sub loadhs
  1939. ' Based on Black's Highscore routines
  1940. Dim FileObj
  1941. Dim ScoreFile
  1942. dim temp1
  1943. dim temp2
  1944. dim temp3
  1945. dim temp4
  1946. dim temp5
  1947. dim temp6
  1948. dim temp7
  1949. dim temp8
  1950. dim temp9
  1951. dim temp10
  1952. dim temp11
  1953. dim temp12
  1954. dim temp13
  1955. dim temp14
  1956. dim temp15
  1957. dim temp16
  1958. dim temp17
  1959. dim temp18
  1960.  
  1961.  
  1962. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1963. If Not FileObj.FolderExists(UserDirectory) then
  1964. Exit Sub
  1965. End if
  1966. If Not FileObj.FileExists(UserDirectory & HSFileName) then
  1967. Exit Sub
  1968. End if
  1969. Set ScoreFile=FileObj.GetFile(UserDirectory & HSFileName)
  1970. Set TextStr=ScoreFile.OpenAsTextStream(1,0)
  1971. If (TextStr.AtEndOfStream=True) then
  1972. Exit Sub
  1973. End if
  1974. temp1=TextStr.ReadLine
  1975. temp2=textstr.readline
  1976. temp3=textstr.readline
  1977. temp4=textstr.readline
  1978. temp5=textstr.readline
  1979. temp6=textstr.readline
  1980. temp7=textstr.readline
  1981. temp8=textstr.readline
  1982.  
  1983. HighScore=cdbl(temp1)
  1984. if HighScore<1 then
  1985.  
  1986. temp9=textstr.readline
  1987. temp10=textstr.readline
  1988. temp11=textstr.readline
  1989. temp12=textstr.readline
  1990. temp13=textstr.readline
  1991. temp14=textstr.readline
  1992. temp15=textstr.readline
  1993. temp16=textstr.readline
  1994. temp17=textstr.readline
  1995. temp18=textstr.readline
  1996. end if
  1997. TextStr.Close
  1998. Credits=cdbl(temp2)
  1999. BallsPerGame=cdbl(temp3)
  2000. ArrowCounter=cdbl(temp4)
  2001. AdvanceSpecialMax=cdbl(temp5)
  2002. BallLiftOption=cdbl(temp6)
  2003. TiltEndsGame=cdbl(temp7)
  2004. ReplayLevel=cdbl(temp8)
  2005. if HighScore<1 then
  2006. HSScore(1) = int(temp9)
  2007. HSScore(2) = int(temp10)
  2008. HSScore(3) = int(temp11)
  2009. HSScore(4) = int(temp12)
  2010. HSScore(5) = int(temp13)
  2011.  
  2012. HSName(1) = temp14
  2013. HSName(2) = temp15
  2014. HSName(3) = temp16
  2015. HSName(4) = temp17
  2016. HSName(5) = temp18
  2017. end if
  2018. Set ScoreFile=Nothing
  2019. Set FileObj=Nothing
  2020. end sub
  2021.  
  2022. Sub DisplayHighScore
  2023.  
  2024.  
  2025. end sub
  2026.  
  2027. Sub DisplayMatch
  2028. MatchReels(Match).SetValue(1)
  2029. If B2SOn then
  2030. If Match = 0 then
  2031. Controller.B2SSetMatch 10
  2032. else
  2033. Controller.B2SSetMatch Match
  2034. end if
  2035. end if
  2036. ' if LowerLight4.state=1 then
  2037. ' MatchReels(MatchLit2).SetValue(1)
  2038. ' If B2SOn then
  2039. ' Controller.B2SSetData MatchLit2+70,1
  2040. ' end if
  2041. ' end if
  2042.  
  2043. end sub
  2044.  
  2045. Sub ClearMatch
  2046. For each obj in MatchReels
  2047. obj.SetValue(0)
  2048. next
  2049. If B2SOn then
  2050. For i = 70 to 79
  2051. Controller.B2SSetData i,0
  2052. next
  2053. end if
  2054. end sub
  2055.  
  2056. sub InitPauser5_timer
  2057. If B2SOn then
  2058. Controller.B2SSetCredits Credits
  2059. end if
  2060. DisplayHighScore
  2061. CreditsReel.SetValue(Credits)
  2062.  
  2063. InitPauser5.enabled=false
  2064. end sub
  2065.  
  2066.  
  2067.  
  2068. sub BumpersOff
  2069.  
  2070. Bumper1Light.visible=0
  2071. Bumper2Light.visible=0
  2072. Bumper3Light.visible=0
  2073. Bumper4Light.visible=0
  2074.  
  2075. Bumper5Light.visible=0
  2076. Bumper6Light.visible=0
  2077. Bumper7Light.visible=0
  2078.  
  2079.  
  2080. end sub
  2081.  
  2082. sub BumpersOn
  2083.  
  2084. Bumper1Light.visible=1
  2085. Bumper2Light.visible=1
  2086. Bumper3Light.visible=1
  2087. Bumper4Light.visible=1
  2088.  
  2089. Bumper5Light.visible=1
  2090. Bumper6Light.visible=1
  2091. Bumper7Light.visible=1
  2092.  
  2093.  
  2094. end sub
  2095.  
  2096. Sub PlasticsOn
  2097.  
  2098. For each obj in Flashers
  2099. obj.visible=1
  2100. next
  2101.  
  2102.  
  2103.  
  2104.  
  2105. end sub
  2106.  
  2107. Sub PlasticsOff
  2108.  
  2109. For each obj in Flashers
  2110. obj.visible=0
  2111. next
  2112.  
  2113. StopSound "buzz"
  2114. StopSound "buzzL"
  2115.  
  2116. end sub
  2117.  
  2118. Sub SetupReplayTables
  2119.  
  2120. Replay1Table(1)=1800000
  2121. Replay1Table(2)=1000
  2122. Replay1Table(3)=1200
  2123. Replay1Table(4)=1500
  2124. Replay1Table(5)=1500
  2125. Replay1Table(6)=2000
  2126. Replay1Table(7)=1200
  2127. Replay1Table(8)=1200
  2128. Replay1Table(9)=1300
  2129. Replay1Table(10)=1300
  2130. Replay1Table(11)=1400
  2131. Replay1Table(12)=1400
  2132. Replay1Table(13)=999000
  2133. Replay1Table(14)=999000
  2134. Replay1Table(15)=999000
  2135.  
  2136. Replay2Table(1)=1900000
  2137. Replay2Table(2)=1500
  2138. Replay2Table(3)=1500
  2139. Replay2Table(4)=2000
  2140. Replay2Table(5)=2000
  2141. Replay2Table(6)=2500
  2142. Replay2Table(7)=1300
  2143. Replay2Table(8)=1400
  2144. Replay2Table(9)=1400
  2145. Replay2Table(10)=1500
  2146. Replay2Table(11)=1500
  2147. Replay2Table(12)=1600
  2148. Replay2Table(13)=999000
  2149. Replay2Table(14)=999000
  2150. Replay2Table(15)=999000
  2151.  
  2152. Replay3Table(1)=999000
  2153. Replay3Table(2)=2500
  2154. Replay3Table(3)=2500
  2155. Replay3Table(4)=2500
  2156. Replay3Table(5)=3000
  2157. Replay3Table(6)=3500
  2158. Replay3Table(7)=1400
  2159. Replay3Table(8)=1500
  2160. Replay3Table(9)=1500
  2161. Replay3Table(10)=1600
  2162. Replay3Table(11)=1600
  2163. Replay3Table(12)=1700
  2164. Replay3Table(13)=999000
  2165. Replay3Table(14)=999000
  2166. Replay3Table(15)=999000
  2167.  
  2168. Replay4Table(1)=999000
  2169. Replay4Table(2)=3500
  2170. Replay4Table(3)=3500
  2171. Replay4Table(4)=3000
  2172. Replay4Table(5)=4000
  2173. Replay4Table(6)=4500
  2174. Replay4Table(7)=1500
  2175. Replay4Table(8)=1600
  2176. Replay4Table(9)=1600
  2177. Replay4Table(10)=1700
  2178. Replay4Table(11)=1700
  2179. Replay4Table(12)=1800
  2180. Replay4Table(13)=999000
  2181. Replay4Table(14)=999000
  2182. Replay4Table(15)=999000
  2183.  
  2184. ReplayTableMax=1
  2185.  
  2186.  
  2187. end sub
  2188.  
  2189. Sub RefreshReplayCard
  2190. Dim tempst1
  2191. Dim tempst2
  2192.  
  2193. tempst1=FormatNumber(BallsPerGame,0)
  2194. tempst2=FormatNumber(ReplayLevel,0)
  2195.  
  2196.  
  2197. ReplayCard.image = "SC" + tempst2
  2198. Replay1=Replay1Table(ReplayLevel)
  2199. Replay2=Replay2Table(ReplayLevel)
  2200. Replay3=Replay3Table(ReplayLevel)
  2201. Replay4=Replay4Table(ReplayLevel)
  2202. end sub
  2203.  
  2204.  
  2205. '****************************************
  2206. ' SCORE MOTOR
  2207. '****************************************
  2208.  
  2209. ScoreMotorTimer.Enabled = 1
  2210. ScoreMotorTimer.Interval = 135 '135
  2211. AddScoreTimer.Enabled = 1
  2212. AddScoreTimer.Interval = 135
  2213.  
  2214. Dim queuedscore
  2215. Dim MotorMode
  2216. Dim MotorPosition
  2217.  
  2218. Sub SetMotor(y)
  2219. Select Case ScoreMotorAdjustment
  2220. Case 0:
  2221. queuedscore=queuedscore+y
  2222. Case 1:
  2223. If MotorRunning<>1 And InProgress=true then
  2224. queuedscore=queuedscore+y
  2225. end if
  2226. end Select
  2227. end sub
  2228.  
  2229. Sub SetMotor2(x)
  2230. If MotorRunning<>1 And InProgress=true then
  2231. MotorRunning=1
  2232.  
  2233. Select Case x
  2234. Case 1:
  2235. AddScore(1)
  2236. MotorRunning=0
  2237. BumpersOn
  2238.  
  2239. Case 2:
  2240. MotorMode=1
  2241. MotorPosition=2
  2242. 'BumpersOff
  2243. Case 3:
  2244. MotorMode=1
  2245. MotorPosition=3
  2246. 'BumpersOff
  2247. Case 4:
  2248. MotorMode=1
  2249. MotorPosition=4
  2250. 'BumpersOff
  2251. Case 5:
  2252. MotorMode=1
  2253. MotorPosition=5
  2254. 'BumpersOff
  2255. Case 10:
  2256. AddScore(10)
  2257. MotorRunning=0
  2258. BumpersOn
  2259.  
  2260. Case 20:
  2261. MotorMode=10
  2262. MotorPosition=2
  2263. 'BumpersOff
  2264. Case 30:
  2265. MotorMode=10
  2266. MotorPosition=3
  2267. 'BumpersOff
  2268. Case 40:
  2269. MotorMode=10
  2270. MotorPosition=4
  2271. 'BumpersOff
  2272. Case 50:
  2273. MotorMode=10
  2274. MotorPosition=5
  2275. 'BumpersOff
  2276.  
  2277.  
  2278. End Select
  2279. End If
  2280. End Sub
  2281.  
  2282. Sub AddScoreTimer_Timer
  2283. Dim tempscore
  2284.  
  2285.  
  2286. If MotorRunning<>1 And InProgress=true then
  2287.  
  2288. if queuedscore>=50 then
  2289. tempscore=50
  2290. queuedscore=queuedscore-50
  2291. SetMotor2(50)
  2292. exit sub
  2293. end if
  2294. if queuedscore>=40 then
  2295. tempscore=40
  2296. queuedscore=queuedscore-40
  2297. SetMotor2(40)
  2298. exit sub
  2299. end if
  2300. if queuedscore>=30 then
  2301. tempscore=30
  2302. queuedscore=queuedscore-30
  2303. SetMotor2(30)
  2304. exit sub
  2305. end if
  2306. if queuedscore>=20 then
  2307. tempscore=20
  2308. queuedscore=queuedscore-20
  2309. SetMotor2(20)
  2310. exit sub
  2311. end if
  2312. if queuedscore>=10 then
  2313. tempscore=10
  2314. queuedscore=queuedscore-10
  2315. SetMotor2(10)
  2316. exit sub
  2317. end if
  2318.  
  2319. if queuedscore>=5 then
  2320. tempscore=5
  2321. queuedscore=queuedscore-5
  2322. SetMotor2(5)
  2323. exit sub
  2324. end if
  2325. if queuedscore>=4 then
  2326. tempscore=4
  2327. queuedscore=queuedscore-4
  2328. SetMotor2(4)
  2329. exit sub
  2330. end if
  2331. if queuedscore>=3 then
  2332. tempscore=3
  2333. queuedscore=queuedscore-3
  2334. SetMotor2(3)
  2335. exit sub
  2336. end if
  2337. if queuedscore>=2 then
  2338. tempscore=2
  2339. queuedscore=queuedscore-2
  2340. SetMotor2(2)
  2341. exit sub
  2342. end if
  2343. if queuedscore>=1 then
  2344. tempscore=1
  2345. queuedscore=queuedscore-1
  2346. SetMotor2(1)
  2347. exit sub
  2348. end if
  2349.  
  2350. End If
  2351.  
  2352.  
  2353. end Sub
  2354.  
  2355. Sub ScoreMotorTimer_Timer
  2356. If MotorPosition > 0 Then
  2357. Select Case MotorPosition
  2358. Case 5,4,3,2:
  2359. If MotorMode=1000 Then
  2360. AddScore(1000)
  2361. end if
  2362. if MotorMode=100 then
  2363. AddScore(100)
  2364. End If
  2365. if MotorMode=10 then
  2366. AddScore(10)
  2367. End if
  2368. If MotorMode=1 then
  2369. AddScore(1)
  2370. end if
  2371. MotorPosition=MotorPosition-1
  2372. Case 1:
  2373. If MotorMode=1000 Then
  2374. AddScore(1000)
  2375. end if
  2376. If MotorMode=100 then
  2377. AddScore(100)
  2378. End If
  2379. if MotorMode=10 then
  2380. AddScore(10)
  2381. End if
  2382. If MotorMode=1 then
  2383. AddScore(1)
  2384. end if
  2385. MotorPosition=0:MotorRunning=0:BumpersOn
  2386. End Select
  2387. End If
  2388. End Sub
  2389.  
  2390.  
  2391. Sub AddScore(x)
  2392. If TableTilted=true then exit sub
  2393. Select Case ScoreAdditionAdjustment
  2394. Case 0:
  2395. AddScore1(x)
  2396. Case 1:
  2397. AddScore2(x)
  2398. end Select
  2399.  
  2400. end sub
  2401.  
  2402.  
  2403. Sub AddScore1(x)
  2404. ' debugtext.text=score
  2405.  
  2406.  
  2407. Select Case x
  2408. Case 1:
  2409. PlayChime(10)
  2410. Score(Player)=Score(Player)+1
  2411.  
  2412. Case 10:
  2413. PlayChime(10)
  2414. Score(Player)=Score(Player)+10
  2415. ' debugscore=debugscore+10
  2416. ToggleAlternatingRelay
  2417. Case 100:
  2418. PlayChime(100)
  2419. Score(Player)=Score(Player)+100
  2420. ' debugscore=debugscore+100
  2421.  
  2422.  
  2423. Case 1000:
  2424. PlayChime(100)
  2425. Score(Player)=Score(Player)+1000
  2426. ' debugscore=debugscore+1000
  2427. End Select
  2428. PlayerScores(0).AddValue(x)
  2429. PlayerScoresOn(0).AddValue(x)
  2430. If ScoreDisplay(Player)<100000 then
  2431. ScoreDisplay(Player)=Score(Player)
  2432. Else
  2433. Score100K(Player)=Int(Score(Player)/100000)
  2434. ScoreDisplay(Player)=Score(Player)-100000
  2435. End If
  2436. if Score(Player)=>100000 then
  2437. If B2SOn Then
  2438. If Player=1 Then
  2439. Controller.B2SSetScoreRolloverPlayer1 Score100K(Player)
  2440. End If
  2441. If Player=2 Then
  2442. Controller.B2SSetScoreRolloverPlayer2 Score100K(Player)
  2443. End If
  2444.  
  2445. If Player=3 Then
  2446. Controller.B2SSetScoreRolloverPlayer3 Score100K(Player)
  2447. End If
  2448.  
  2449. If Player=4 Then
  2450. Controller.B2SSetScoreRolloverPlayer4 Score100K(Player)
  2451. End If
  2452. End If
  2453. End If
  2454. If B2SOn Then
  2455. Controller.B2SSetScorePlayer Player, ScoreDisplay(Player)
  2456. End If
  2457. If Score(Player)>Replay1 and Replay1Paid(Player)=false then
  2458. Replay1Paid(Player)=True
  2459. AddSpecial
  2460. End If
  2461. If Score(Player)>Replay2 and Replay2Paid(Player)=false then
  2462. Replay2Paid(Player)=True
  2463. AddSpecial
  2464. End If
  2465. If Score(Player)>Replay3 and Replay3Paid(Player)=false then
  2466. Replay3Paid(Player)=True
  2467. AddSpecial
  2468. End If
  2469. If Score(Player)>Replay4 and Replay4Paid(Player)=false then
  2470. Replay4Paid(Player)=True
  2471. AddSpecial
  2472. End If
  2473. ' ScoreText.text=debugscore
  2474. End Sub
  2475.  
  2476. Sub AddScore2(x)
  2477. Dim OldScore, NewScore, OldTestScore, NewTestScore, OldB2SScoreSplit, OldB2SScoreMod
  2478. OldScore = Score(Player)
  2479. BallPoints=BallPoints+x
  2480. If BallPoints>=30 then
  2481. metalguard.collidable=false
  2482. blockplate.transz=-52
  2483. Trigger001Light.state=1
  2484. Playsound SoundFXDOF("soloff",124,DOFPulse,DOFContactors)
  2485. end if
  2486. Select Case x
  2487. Case 1:
  2488. Score(Player)=Score(Player)+1
  2489. Case 10:
  2490. Score(Player)=Score(Player)+10
  2491. Case 100:
  2492. Score(Player)=Score(Player)+100
  2493. Case 1000:
  2494. Score(Player)=Score(Player)+1000
  2495. End Select
  2496. NewScore = Score(Player)
  2497.  
  2498. OldTestScore = OldScore
  2499. NewTestScore = NewScore
  2500. If Score(Player)=350 then AddSpecial
  2501. If Score(Player)=380 then AddSpecial
  2502. If Score(Player)=400 then AddSpecial
  2503. If Score(Player)=450 then AddSpecial
  2504. If Score(Player)=480 then AddSpecial
  2505. If Score(Player)=500 then AddSpecial
  2506.  
  2507. If Score(Player)=37 OR Score(Player)=87 OR Score(Player)=157 OR Score(Player)=197 OR Score(Player)=257 OR Score(Player)=307 then
  2508. JokerLight2.state=1
  2509. JokerLight4.state=1
  2510. else
  2511. JokerLight2.state=0
  2512. JokerLight4.state=0
  2513. end if
  2514.  
  2515.  
  2516. OldScore = int(OldScore / 1) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  2517. NewScore = int(NewScore / 1) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  2518. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore&", OldScore Mod 10="&OldScore Mod 10 & ", NewScore % 10="&NewScore Mod 10)
  2519.  
  2520. if (OldScore Mod 10 <> NewScore Mod 10) then
  2521. PlayChime(10)
  2522. AdvanceZeroToNine
  2523. end if
  2524.  
  2525. OldScore = int(OldScore / 10)
  2526. NewScore = int(NewScore / 10)
  2527. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2528. if (OldScore Mod 10 <> NewScore Mod 10) then
  2529. PlayChime(100)
  2530.  
  2531.  
  2532. end if
  2533.  
  2534. OldScore = int(OldScore / 10)
  2535. NewScore = int(NewScore / 10)
  2536. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2537. if (OldScore Mod 10 <> NewScore Mod 10) then
  2538. PlayChime(100)
  2539.  
  2540.  
  2541. end if
  2542.  
  2543. OldScore = int(OldScore / 10)
  2544. NewScore = int(NewScore / 10)
  2545. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2546. if (OldScore Mod 10 <> NewScore Mod 10) then
  2547. PlayChime(1000)
  2548. end if
  2549.  
  2550. If B2SOn Then
  2551. OldB2SScoreSplit = Score(1)
  2552. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  2553. For x=50 to 59
  2554. Controller.B2SSetData x,0
  2555. next
  2556. Controller.B2SSetData 50+OldB2SScoreMod,1
  2557. OldB2SScoreSplit = int(OldB2SScoreSplit/10)
  2558. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  2559. For x=60 to 69
  2560. Controller.B2SSetData x,0
  2561. next
  2562. Controller.B2SSetData 60+OldB2SScoreMod,1
  2563. OldB2SScoreSplit = int(OldB2SScoreSplit/10)
  2564. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  2565. For x=70 to 79
  2566. Controller.B2SSetData x,0
  2567. next
  2568. Controller.B2SSetData 70+OldB2SScoreMod,1
  2569.  
  2570. End If
  2571. OldB2SScoreSplit = Score(1)
  2572. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  2573. 'Scores11.SetValue(OldB2SScoreMod)
  2574. for x=1 to 9
  2575. EVAL("TenK00"&x).setvalue(0)
  2576. next
  2577. If OldB2SScoreMod>0 then EVAL("TenK00"&OldB2SScoreMod).setvalue(1)
  2578. OldB2SScoreSplit = int(OldB2SScoreSplit/10)
  2579. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  2580. 'Scores101.SetValue(OldB2SScoreMod)
  2581. for x=0 to 8
  2582. HundKLights(x).state=0
  2583. next
  2584. If OldB2SScoreMod>0 then HundKLights(OldB2SScoreMod-1).state=1
  2585. OldB2SScoreSplit = int(OldB2SScoreSplit/10)
  2586. OldB2SScoreMod = OldB2SScoreSplit Mod 10
  2587. 'Scores1001.SetValue(OldB2SScoreMod)
  2588. for x=1 to 4
  2589. EVAL("Million00"&x).state=0
  2590. If x=3 then EVAL("Million00"&x&"_2").state=0
  2591. next
  2592. If OldB2SScoreMod>0 then EVAL("Million00"&OldB2SScoreMod).state=1
  2593. If OldB2SScoreMod=3 then EVAL("Million00"&OldB2SScoreMod&"_2").state=1
  2594.  
  2595. ' EMReel1.SetValue Score(Player)
  2596. PlayerScores(Player).AddValue(x)
  2597. PlayerScoresOn(Player).AddValue(x)
  2598.  
  2599. End Sub
  2600.  
  2601.  
  2602.  
  2603. Sub PlayChime(x)
  2604. if ChimesOn=0 then
  2605. Select Case x
  2606. Case 10
  2607. If LastChime10=1 Then
  2608. 'PlaySound "1"
  2609. PlaySound SoundFXDOF("1",146,DOFPulse,DOFChimes)
  2610. LastChime10=0
  2611. Else
  2612. 'PlaySound "1"
  2613. PlaySound SoundFXDOF("1",146,DOFPulse,DOFChimes)
  2614. LastChime10=1
  2615. End If
  2616. Case 100
  2617. If LastChime100=1 Then
  2618. 'PlaySound "10"
  2619. PlaySound SoundFXDOF("10",147,DOFPulse,DOFChimes)
  2620. LastChime100=0
  2621. Else
  2622. 'PlaySound "10"
  2623. PlaySound SoundFXDOF("10",147,DOFPulse,DOFChimes)
  2624. LastChime100=1
  2625. End If
  2626.  
  2627. End Select
  2628. else
  2629. Select Case x
  2630. Case 10
  2631. If LastChime10=1 Then
  2632. PlaySound SoundFXDOF("SJ_Chime_10a",146,DOFPulse,DOFChimes)
  2633. LastChime10=0
  2634. Else
  2635. PlaySound SoundFXDOF("SJ_Chime_10b",146,DOFPulse,DOFChimes)
  2636. LastChime10=1
  2637. End If
  2638. Case 100
  2639. If LastChime100=1 Then
  2640. PlaySound SoundFXDOF("SJ_Chime_100a",147,DOFPulse,DOFChimes)
  2641. LastChime100=0
  2642. Else
  2643. PlaySound SoundFXDOF("SJ_Chime_100b",147,DOFPulse,DOFChimes)
  2644. LastChime100=1
  2645. End If
  2646. Case 1000
  2647. If LastChime1000=1 Then
  2648. PlaySound SoundFXDOF("SJ_Chime_1000a",148,DOFPulse,DOFChimes)
  2649. LastChime1000=0
  2650. Else
  2651. PlaySound SoundFXDOF("SJ_Chime_1000b",148,DOFPulse,DOFChimes)
  2652. LastChime1000=1
  2653. End If
  2654. End Select
  2655. end if
  2656. End Sub
  2657.  
  2658. Sub HideOptions()
  2659.  
  2660. end sub
  2661.  
  2662. '*********************************************************************
  2663. ' Positional Sound Playback Functions
  2664. '*********************************************************************
  2665.  
  2666. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  2667. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  2668. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  2669. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  2670. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  2671. End Sub
  2672.  
  2673. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  2674. Sub PlaySoundAt(soundname, tableobj)
  2675. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  2676. End Sub
  2677.  
  2678. Sub PlaySoundAtBall(soundname)
  2679. PlaySoundAt soundname, ActiveBall
  2680. End Sub
  2681.  
  2682.  
  2683. '*********************************************************************
  2684. ' Supporting Ball & Sound Functions
  2685. '*********************************************************************
  2686.  
  2687. 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
  2688. Dim tmp
  2689. tmp = tableobj.y * 2 / table1.height-1
  2690. If tmp > 0 Then
  2691. AudioFade = Csng(tmp ^10)
  2692. Else
  2693. AudioFade = Csng(-((- tmp) ^10) )
  2694. End If
  2695. End Function
  2696.  
  2697. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  2698. Dim tmp
  2699. tmp = tableobj.x * 2 / table1.width-1
  2700. If tmp > 0 Then
  2701. AudioPan = Csng(tmp ^10)
  2702. Else
  2703. AudioPan = Csng(-((- tmp) ^10) )
  2704. End If
  2705. End Function
  2706.  
  2707. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  2708. Vol = Csng(BallVel(ball) ^2 / 2000)
  2709. End Function
  2710.  
  2711. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  2712. Pitch = BallVel(ball) * 20
  2713. End Function
  2714.  
  2715. Function BallVel(ball) 'Calculates the ball speed
  2716. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  2717. End Function
  2718.  
  2719. '*****************************************
  2720. ' JP's VP10 Rolling Sounds
  2721. '*****************************************
  2722.  
  2723. Const tnob = 5 ' total number of balls
  2724. ReDim rolling(tnob)
  2725. InitRolling
  2726.  
  2727. Sub InitRolling
  2728. Dim i
  2729. For i = 0 to tnob
  2730. rolling(i) = False
  2731. Next
  2732. End Sub
  2733.  
  2734. Sub RollingSoundTimer_Timer()
  2735. Dim BOT, b
  2736. BOT = GetBalls
  2737.  
  2738. ' stop the sound of deleted balls
  2739. For b = UBound(BOT) + 1 to tnob
  2740. rolling(b) = False
  2741. StopSound("fx_ballrolling" & b)
  2742. Next
  2743.  
  2744. ' exit the sub if no balls on the table
  2745. If UBound(BOT) = -1 Then Exit Sub
  2746.  
  2747. ' play the rolling sound for each ball
  2748. For b = 0 to UBound(BOT)
  2749. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  2750. rolling(b) = True
  2751. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  2752. Else
  2753. If rolling(b) = True Then
  2754. StopSound("fx_ballrolling" & b)
  2755. rolling(b) = False
  2756. End If
  2757. End If
  2758. Next
  2759. End Sub
  2760.  
  2761. '**********************
  2762. ' Ball Collision Sound
  2763. '**********************
  2764.  
  2765. Sub OnBallBallCollision(ball1, ball2, velocity)
  2766. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  2767. End Sub
  2768.  
  2769.  
  2770.  
  2771. '*****************************************
  2772. ' ninuzzu's BALL SHADOW
  2773. '*****************************************
  2774. Dim BallShadow
  2775. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  2776.  
  2777. Sub BallShadowUpdate_timer()
  2778. Dim BOT, b
  2779. BOT = GetBalls
  2780. ' hide shadow of deleted balls
  2781. If UBound(BOT)<(tnob-1) Then
  2782. For b = (UBound(BOT) + 1) to (tnob-1)
  2783. BallShadow(b).visible = 0
  2784. Next
  2785. End If
  2786. ' exit the Sub if no balls on the table
  2787. If UBound(BOT) = -1 Then Exit Sub
  2788. ' render the shadow for each ball
  2789. For b = 0 to UBound(BOT)
  2790. If BOT(b).X < Table1.Width/2 Then
  2791. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  2792. Else
  2793. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  2794. End If
  2795. ballShadow(b).Y = BOT(b).Y + 12
  2796. If BOT(b).Z > 20 Then
  2797. BallShadow(b).visible = 1
  2798. Else
  2799. BallShadow(b).visible = 0
  2800. End If
  2801. Next
  2802. End Sub
  2803.  
  2804. '*****************************************
  2805. ' Object sounds
  2806. '*****************************************
  2807.  
  2808. Sub Plastics_Hit (idx)
  2809. PlaySound "woodhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  2810. End Sub
  2811.  
  2812. Sub Pins_Hit (idx)
  2813. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  2814. End Sub
  2815.  
  2816. Sub Targets_Hit (idx)
  2817. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  2818. End Sub
  2819.  
  2820. Sub Metals_Thin_Hit (idx)
  2821. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2822. End Sub
  2823.  
  2824. Sub Metals_Medium_Hit (idx)
  2825. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2826. End Sub
  2827.  
  2828. Sub Metals2_Hit (idx)
  2829. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2830. End Sub
  2831.  
  2832. Sub Gates_Hit (idx)
  2833. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2834. End Sub
  2835.  
  2836. Sub Spinner_Spin
  2837. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  2838. End Sub
  2839.  
  2840. Sub Rubbers_Hit(idx)
  2841. dim finalspeed
  2842. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2843. If finalspeed > 20 then
  2844. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2845. End if
  2846. If finalspeed >= 6 AND finalspeed <= 20 then
  2847. RandomSoundRubber()
  2848. End If
  2849. End Sub
  2850.  
  2851. Sub Posts_Hit(idx)
  2852. dim finalspeed
  2853. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2854. If finalspeed > 16 then
  2855. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2856. End if
  2857. If finalspeed >= 6 AND finalspeed <= 16 then
  2858. RandomSoundRubber()
  2859. End If
  2860. End Sub
  2861.  
  2862. Sub RandomSoundRubber()
  2863. Select Case Int(Rnd*3)+1
  2864. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2865. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2866. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2867. End Select
  2868. End Sub
  2869.  
  2870. Sub LeftFlipper_Collide(parm)
  2871. RandomSoundFlipper()
  2872. End Sub
  2873.  
  2874. Sub RightFlipper_Collide(parm)
  2875. RandomSoundFlipper()
  2876. End Sub
  2877.  
  2878. Sub RandomSoundFlipper()
  2879. Select Case Int(Rnd*3)+1
  2880. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2881. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2882. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2883. End Select
  2884. End Sub
  2885.  
  2886. ' ============================================================================================
  2887. ' GNMOD - Multiple High Score Display and Collection
  2888. ' ============================================================================================
  2889. Dim EnteringInitials ' Normally zero, set to non-zero to enter initials
  2890. EnteringInitials = 0
  2891.  
  2892. Dim PlungerPulled
  2893. PlungerPulled = 0
  2894.  
  2895. Dim SelectedChar ' character under the "cursor" when entering initials
  2896.  
  2897. Dim HSTimerCount ' Pass counter for HS timer, scores are cycled by the timer
  2898. HSTimerCount = 5 ' Timer is initially enabled, it'll wrap from 5 to 1 when it's displayed
  2899.  
  2900. Dim InitialString ' the string holding the player's initials as they're entered
  2901.  
  2902. Dim AlphaString ' A-Z, 0-9, space (_) and backspace (<)
  2903. Dim AlphaStringPos ' pointer to AlphaString, move forward and backward with flipper keys
  2904. AlphaString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_<"
  2905.  
  2906. Dim HSNewHigh ' The new score to be recorded
  2907.  
  2908. Dim HSScore(5) ' High Scores read in from config file
  2909. Dim HSName(5) ' High Score Initials read in from config file
  2910.  
  2911. ' default high scores, remove this when the scores are available from the config file
  2912. HSScore(1) = 800000
  2913. HSScore(2) = 700000
  2914. HSScore(3) = 600000
  2915. HSScore(4) = 500000
  2916. HSScore(5) = 400000
  2917.  
  2918. HSName(1) = "AAA"
  2919. HSName(2) = "ZZZ"
  2920. HSName(3) = "XXX"
  2921. HSName(4) = "ABC"
  2922. HSName(5) = "BBB"
  2923.  
  2924. Sub HighScoreTimer_Timer
  2925.  
  2926. if EnteringInitials then
  2927. if HSTimerCount = 1 then
  2928. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  2929. HSTimerCount = 2
  2930. else
  2931. SetHSLine 3, InitialString
  2932. HSTimerCount = 1
  2933. end if
  2934. elseif InProgress then
  2935. SetHSLine 1, "HIGH SCORE1"
  2936. SetHSLine 2, HSScore(1)
  2937. SetHSLine 3, HSName(1)
  2938. HSTimerCount = 5 ' set so the highest score will show after the game is over
  2939. HighScoreTimer.enabled=false
  2940. HighScoreReel.SetValue(HSScore(1))
  2941. elseif CheckAllScores then
  2942. NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
  2943.  
  2944. else
  2945. ' cycle through high scores
  2946. HighScoreTimer.interval=2000
  2947. HSTimerCount = HSTimerCount + 1
  2948. if HsTimerCount > 5 then
  2949. HSTimerCount = 1
  2950. End If
  2951. SetHSLine 1, "HIGH SCORE"+FormatNumber(HSTimerCount,0)
  2952. SetHSLine 2, HSScore(HSTimerCount)
  2953. SetHSLine 3, HSName(HSTimerCount)
  2954. HighScoreReel.SetValue(HSScore(1))
  2955. If B2SOn Then
  2956. Controller.B2SSetScorePlayer 2, HSScore(1)
  2957. End if
  2958. end if
  2959. End Sub
  2960.  
  2961. Function GetHSChar(String, Index)
  2962. dim ThisChar
  2963. dim FileName
  2964. ThisChar = Mid(String, Index, 1)
  2965. FileName = "PostIt"
  2966. if ThisChar = " " or ThisChar = "" then
  2967. FileName = FileName & "BL"
  2968. elseif ThisChar = "<" then
  2969. FileName = FileName & "LT"
  2970. elseif ThisChar = "_" then
  2971. FileName = FileName & "SP"
  2972. else
  2973. FileName = FileName & ThisChar
  2974. End If
  2975. GetHSChar = FileName
  2976. End Function
  2977.  
  2978. Sub SetHsLine(LineNo, String)
  2979. dim Letter
  2980. dim ThisDigit
  2981. dim ThisChar
  2982. dim StrLen
  2983. dim LetterLine
  2984. dim Index
  2985. dim StartHSArray
  2986. dim EndHSArray
  2987. dim LetterName
  2988. dim xfor
  2989. StartHSArray=array(0,1,12,22)
  2990. EndHSArray=array(0,11,21,31)
  2991. StrLen = len(string)
  2992. Index = 1
  2993.  
  2994. for xfor = StartHSArray(LineNo) to EndHSArray(LineNo)
  2995. Eval("HS"&xfor).image = GetHSChar(String, Index)
  2996. Index = Index + 1
  2997. next
  2998.  
  2999. End Sub
  3000.  
  3001. Sub NewHighScore(NewScore, PlayNum)
  3002. if NewScore > HSScore(5) then
  3003. HighScoreTimer.interval = 500
  3004. HSTimerCount = 1
  3005. AlphaStringPos = 1 ' start with first character "A"
  3006. EnteringInitials = 1 ' intercept the control keys while entering initials
  3007. InitialString = "" ' initials entered so far, initialize to empty
  3008. SetHSLine 1, "PLAYER "+FormatNumber(PlayNum,0)
  3009. SetHSLine 2, "ENTER NAME"
  3010. SetHSLine 3, MID(AlphaString, AlphaStringPos, 1)
  3011. HSNewHigh = NewScore
  3012. For xx=1 to HighScoreReward
  3013. AddSpecial
  3014. next
  3015. End if
  3016. ScoreChecker=ScoreChecker-1
  3017. if ScoreChecker=0 then
  3018. CheckAllScores=0
  3019. end if
  3020. End Sub
  3021.  
  3022. Sub CollectInitials(keycode)
  3023. If keycode = LeftFlipperKey Then
  3024. ' back up to previous character
  3025. AlphaStringPos = AlphaStringPos - 1
  3026. if AlphaStringPos < 1 then
  3027. AlphaStringPos = len(AlphaString) ' handle wrap from beginning to end
  3028. if InitialString = "" then
  3029. ' Skip the backspace if there are no characters to backspace over
  3030. AlphaStringPos = AlphaStringPos - 1
  3031. End if
  3032. end if
  3033. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  3034. PlaySound "DropTargetDropped"
  3035. elseif keycode = RightFlipperKey Then
  3036. ' advance to next character
  3037. AlphaStringPos = AlphaStringPos + 1
  3038. if AlphaStringPos > len(AlphaString) or (AlphaStringPos = len(AlphaString) and InitialString = "") then
  3039. ' Skip the backspace if there are no characters to backspace over
  3040. AlphaStringPos = 1
  3041. end if
  3042. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  3043. PlaySound "DropTargetDropped"
  3044. elseif keycode = StartGameKey or keycode = PlungerKey Then
  3045. SelectedChar = MID(AlphaString, AlphaStringPos, 1)
  3046. if SelectedChar = "_" then
  3047. InitialString = InitialString & " "
  3048. PlaySound("Ding10")
  3049. elseif SelectedChar = "<" then
  3050. InitialString = MID(InitialString, 1, len(InitialString) - 1)
  3051. if len(InitialString) = 0 then
  3052. ' If there are no more characters to back over, don't leave the < displayed
  3053. AlphaStringPos = 1
  3054. end if
  3055. PlaySound("Ding100")
  3056. else
  3057. InitialString = InitialString & SelectedChar
  3058. PlaySound("Ding10")
  3059. end if
  3060. if len(InitialString) < 3 then
  3061. SetHSLine 3, InitialString & SelectedChar
  3062. End If
  3063. End If
  3064. if len(InitialString) = 3 then
  3065. ' save the score
  3066. for i = 5 to 1 step -1
  3067. if i = 1 or (HSNewHigh > HSScore(i) and HSNewHigh <= HSScore(i - 1)) then
  3068. ' Replace the score at this location
  3069. if i < 5 then
  3070. ' MsgBox("Moving " & i & " to " & (i + 1))
  3071. HSScore(i + 1) = HSScore(i)
  3072. HSName(i + 1) = HSName(i)
  3073. end if
  3074. ' MsgBox("Saving initials " & InitialString & " to position " & i)
  3075. EnteringInitials = 0
  3076. HSScore(i) = HSNewHigh
  3077. HSName(i) = InitialString
  3078. HSTimerCount = 5
  3079. HighScoreTimer_Timer
  3080. HighScoreTimer.interval = 2000
  3081. PlaySound("Ding1000")
  3082. exit sub
  3083. elseif i < 5 then
  3084. ' move the score in this slot down by 1, it's been exceeded by the new score
  3085. ' MsgBox("Moving " & i & " to " & (i + 1))
  3086. HSScore(i + 1) = HSScore(i)
  3087. HSName(i + 1) = HSName(i)
  3088. end if
  3089. next
  3090. End If
  3091.  
  3092. End Sub
  3093.  
  3094. ' END GNMOD
  3095. ' ============================================================================================
  3096. ' GNMOD - New Options menu
  3097. ' ============================================================================================
  3098. Dim EnteringOptions
  3099. Dim CurrentOption
  3100. Dim OptionCHS
  3101. Dim MaxOption
  3102. Dim OptionHighScorePosition
  3103. Dim XOpt
  3104. Dim StartingArray
  3105. Dim EndingArray
  3106.  
  3107. StartingArray=Array(0,1,2,30,33,61,89,117,145,173,201,229)
  3108. EndingArray=Array(0,1,29,32,60,88,116,144,172,200,228,256)
  3109. EnteringOptions = 0
  3110. MaxOption = 9
  3111. OptionCHS = 0
  3112. OptionHighScorePosition = 0
  3113. Const OptionLinesToMark="011000011"
  3114. Const OptionLine1="" 'do not use this line
  3115. Const OptionLine2="" 'do not use this line
  3116. Const OptionLine3="" 'do not use this line
  3117. Const OptionLine4=""
  3118. Const OptionLine5=""
  3119. Const OptionLine6=""
  3120. Const OptionLine7=""
  3121. Const OptionLine8="" 'do not use this line
  3122. Const OptionLine9="" 'do not use this line
  3123.  
  3124. Sub OperatorMenuTimer_Timer
  3125. EnteringOptions = 1
  3126. OperatorMenuTimer.enabled=false
  3127. ShowOperatorMenu
  3128. end sub
  3129.  
  3130. sub ShowOperatorMenu
  3131. OperatorMenuBackdrop.image = "OperatorMenu"
  3132.  
  3133. OptionCHS = 0
  3134. CurrentOption = 2
  3135. DisplayAllOptions
  3136. OperatorOption2.image = "BluePlus"
  3137. SetHighScoreOption
  3138.  
  3139. End Sub
  3140.  
  3141. Sub DisplayAllOptions
  3142. dim linecounter
  3143. dim tempstring
  3144. For linecounter = 2 to MaxOption
  3145. tempstring=Eval("OptionLine"&linecounter)
  3146. Select Case linecounter
  3147. Case 1:
  3148. tempstring=FormatNumber(BallsPerGame,0)
  3149. SetOptLine 1,tempstring
  3150. Case 2:
  3151. if Replay3Table(ReplayLevel)=999000 then
  3152. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0)
  3153. elseif Replay4Table(ReplayLevel)=999000 then
  3154. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0)
  3155. else
  3156. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0) + "/" + FormatNumber(Replay4Table(ReplayLevel),0)
  3157. end if
  3158.  
  3159. SetOptLine 2,tempstring
  3160. Case 3:
  3161. If OptionCHS=0 then
  3162. tempstring = "NO"
  3163. else
  3164. tempstring = "YES"
  3165. end if
  3166. SetOptLine 3,tempstring
  3167. Case 4:
  3168. SetOptLine 4, tempstring
  3169.  
  3170. SetOptLine 5, tempstring
  3171. Case 5:
  3172. SetOptLine 6, tempstring
  3173.  
  3174. SetOptLine 7, tempstring
  3175.  
  3176. Case 6:
  3177. SetOptLine 8, tempstring
  3178.  
  3179. SetOptLine 9, tempstring
  3180.  
  3181. Case 7:
  3182. SetOptLine 10, tempstring
  3183.  
  3184. SetOptLine 11, tempstring
  3185.  
  3186. Case 8:
  3187.  
  3188. Case 9:
  3189.  
  3190.  
  3191. End Select
  3192.  
  3193. next
  3194. end sub
  3195.  
  3196. sub MoveArrow
  3197. do
  3198. CurrentOption = CurrentOption + 1
  3199. If CurrentOption>Len(OptionLinesToMark) then
  3200. CurrentOption=2
  3201. end if
  3202. loop until Mid(OptionLinesToMark,CurrentOption,1)="1"
  3203. end sub
  3204.  
  3205. sub CollectOptions(ByVal keycode)
  3206. if Keycode = LeftFlipperKey then
  3207. PlaySound "DropTargetDropped"
  3208. For XOpt = 2 to MaxOption
  3209. Eval("OperatorOption"&XOpt).image = "PostitBL"
  3210. next
  3211. MoveArrow
  3212. if CurrentOption<8 then
  3213. Eval("OperatorOption"&CurrentOption).image = "BluePlus"
  3214. elseif CurrentOption=8 then
  3215. Eval("OperatorOption"&CurrentOption).image = "GreenCheck"
  3216. else
  3217. Eval("OperatorOption"&CurrentOption).image = "RedX"
  3218. end if
  3219.  
  3220. elseif Keycode = RightFlipperKey then
  3221. PlaySound "DropTargetDropped"
  3222. if CurrentOption = 1 then
  3223. If BallsPerGame = 3 then
  3224. BallsPerGame = 5
  3225. else
  3226. BallsPerGame = 3
  3227. end if
  3228. DisplayAllOptions
  3229. elseif CurrentOption = 2 then
  3230. ReplayLevel=ReplayLevel+1
  3231. If ReplayLevel>ReplayTableMax then
  3232. ReplayLevel=1
  3233. end if
  3234. DisplayAllOptions
  3235. elseif CurrentOption = 3 then
  3236. if OptionCHS = 0 then
  3237. OptionCHS = 1
  3238.  
  3239. else
  3240. OptionCHS = 0
  3241.  
  3242. end if
  3243. DisplayAllOptions
  3244.  
  3245. elseif CurrentOption = 8 or CurrentOption = 9 then
  3246. if OptionCHS=1 then
  3247. HSScore(1) = 800000
  3248. HSScore(2) = 700000
  3249. HSScore(3) = 600000
  3250. HSScore(4) = 500000
  3251. HSScore(5) = 400000
  3252.  
  3253. HSName(1) = "AAA"
  3254. HSName(2) = "ZZZ"
  3255. HSName(3) = "XXX"
  3256. HSName(4) = "ABC"
  3257. HSName(5) = "BBB"
  3258. end if
  3259.  
  3260. if CurrentOption = 8 then
  3261. savehs
  3262. else
  3263. loadhs
  3264. end if
  3265. OperatorMenuBackdrop.image = "PostitBL"
  3266. For XOpt = 1 to MaxOption
  3267. Eval("OperatorOption"&XOpt).image = "PostitBL"
  3268. next
  3269.  
  3270. For XOpt = 1 to 256
  3271. Eval("Option"&XOpt).image = "PostItBL"
  3272. next
  3273. RefreshReplayCard
  3274. InstructCard.image="IC"+FormatNumber(BallsPerGame,0)
  3275. EnteringOptions = 0
  3276.  
  3277. end if
  3278. end if
  3279. End Sub
  3280.  
  3281. Sub SetHighScoreOption
  3282.  
  3283. End Sub
  3284.  
  3285. Function GetOptChar(String, Index)
  3286. dim ThisChar
  3287. dim FileName
  3288. ThisChar = Mid(String, Index, 1)
  3289. FileName = "PostIt"
  3290. if ThisChar = " " or ThisChar = "" then
  3291. FileName = FileName & "BL"
  3292. elseif ThisChar = "<" then
  3293. FileName = FileName & "LT"
  3294. elseif ThisChar = "_" then
  3295. FileName = FileName & "SP"
  3296. elseif ThisChar = "/" then
  3297. FileName = FileName & "SL"
  3298. elseif ThisChar = "," then
  3299. FileName = FileName & "CM"
  3300. else
  3301. FileName = FileName & ThisChar
  3302. End If
  3303. GetOptChar = FileName
  3304. End Function
  3305.  
  3306. dim LineLengths(22) ' maximum number of lines
  3307. Sub SetOptLine(LineNo, String)
  3308. Dim DispLen
  3309. Dim StrLen
  3310. dim xfor
  3311. dim Letter
  3312. dim ThisDigit
  3313. dim ThisChar
  3314. dim LetterLine
  3315. dim Index
  3316. dim LetterName
  3317. StrLen = len(string)
  3318. Index = 1
  3319.  
  3320. StrLen = len(String)
  3321. DispLen = StrLen
  3322. if (DispLen < LineLengths(LineNo)) Then
  3323. DispLen = LineLengths(LineNo)
  3324. end If
  3325.  
  3326. for xfor = StartingArray(LineNo) to StartingArray(LineNo) + DispLen
  3327. Eval("Option"&xfor).image = GetOptChar(string, Index)
  3328. Index = Index + 1
  3329. next
  3330. LineLengths(LineNo) = StrLen
  3331.  
  3332. End Sub
  3333.  
  3334.  
  3335. '******************************************************
  3336. ' FLIPPER CORRECTION FUNCTIONS
  3337. '******************************************************
  3338.  
  3339. Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
  3340. dim a : a = Array(LF, RF)
  3341. dim x : for each x in a
  3342. x.addpoint aStr, idx, aX, aY
  3343. Next
  3344. End Sub
  3345.  
  3346. Class FlipperPolarity
  3347. Public DebugOn, Enabled
  3348. Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
  3349. Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
  3350. private Flipper, FlipperStart,FlipperEnd, FlipperEndY, LR, PartialFlipCoef
  3351. Private Balls(20), balldata(20)
  3352.  
  3353. dim PolarityIn, PolarityOut
  3354. dim VelocityIn, VelocityOut
  3355. dim YcoefIn, YcoefOut
  3356. Public Sub Class_Initialize
  3357. redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
  3358. Enabled = True : TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new SpoofBall : next
  3359. End Sub
  3360.  
  3361. Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
  3362. Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
  3363. Public Property Get StartPoint : StartPoint = FlipperStart : End Property
  3364. Public Property Let EndPoint(aInput) : FlipperEnd = aInput.x: FlipperEndY = aInput.y: End Property
  3365. Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
  3366. Public Property Get EndPointY: EndPointY = FlipperEndY : End Property
  3367.  
  3368. Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
  3369. Select Case aChooseArray
  3370. case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
  3371. Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
  3372. Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
  3373. End Select
  3374. if gametime > 100 then Report aChooseArray
  3375. End Sub
  3376.  
  3377. Public Sub Report(aChooseArray) 'debug, reports all coords in tbPL.text
  3378. if not DebugOn then exit sub
  3379. dim a1, a2 : Select Case aChooseArray
  3380. case "Polarity" : a1 = PolarityIn : a2 = PolarityOut
  3381. Case "Velocity" : a1 = VelocityIn : a2 = VelocityOut
  3382. Case "Ycoef" : a1 = YcoefIn : a2 = YcoefOut
  3383. case else :tbpl.text = "wrong string" : exit sub
  3384. End Select
  3385. dim str, x : for x = 0 to uBound(a1) : str = str & aChooseArray & " x: " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
  3386. tbpl.text = str
  3387. End Sub
  3388.  
  3389. Public Sub AddBall(aBall) : dim x : for x = 0 to uBound(balls) : if IsEmpty(balls(x)) then set balls(x) = aBall : exit sub :end if : Next : End Sub
  3390.  
  3391. Private Sub RemoveBall(aBall)
  3392. dim x : for x = 0 to uBound(balls)
  3393. if TypeName(balls(x) ) = "IBall" then
  3394. if aBall.ID = Balls(x).ID Then
  3395. balls(x) = Empty
  3396. Balldata(x).Reset
  3397. End If
  3398. End If
  3399. Next
  3400. End Sub
  3401.  
  3402. Public Sub Fire()
  3403. Flipper.RotateToEnd
  3404. processballs
  3405. End Sub
  3406.  
  3407. Public Property Get Pos 'returns % position a ball. For debug stuff.
  3408. dim x : for x = 0 to uBound(balls)
  3409. if not IsEmpty(balls(x) ) then
  3410. pos = pSlope(Balls(x).x, FlipperStart, 0, FlipperEnd, 1)
  3411. End If
  3412. Next
  3413. End Property
  3414.  
  3415. Public Sub ProcessBalls() 'save data of balls in flipper range
  3416. FlipAt = GameTime
  3417. dim x : for x = 0 to uBound(balls)
  3418. if not IsEmpty(balls(x) ) then
  3419. balldata(x).Data = balls(x)
  3420. End If
  3421. Next
  3422. PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle))
  3423. PartialFlipCoef = abs(PartialFlipCoef-1)
  3424. End Sub
  3425. Private Function FlipperOn() : if gameTime < FlipAt+TimeDelay then FlipperOn = True : End If : End Function 'Timer shutoff for polaritycorrect
  3426.  
  3427. Public Sub PolarityCorrect(aBall)
  3428. if FlipperOn() then
  3429. dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
  3430.  
  3431. 'y safety Exit
  3432. if aBall.VelY > -8 then 'ball going down
  3433. RemoveBall aBall
  3434. exit Sub
  3435. end if
  3436.  
  3437. 'Find balldata. BallPos = % on Flipper
  3438. for x = 0 to uBound(Balls)
  3439. if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
  3440. idx = x
  3441. BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
  3442. if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  3443. end if
  3444. Next
  3445.  
  3446. If BallPos = 0 Then 'no ball data meaning the ball is entering and exiting pretty close to the same position, use current values.
  3447. BallPos = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
  3448. if ballpos > 0.65 then Ycoef = LinearEnvelope(aBall.Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  3449. End If
  3450.  
  3451. 'Velocity correction
  3452. if not IsEmpty(VelocityIn(0) ) then
  3453. Dim VelCoef
  3454. : VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
  3455.  
  3456. if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
  3457.  
  3458. if Enabled then aBall.Velx = aBall.Velx*VelCoef
  3459. if Enabled then aBall.Vely = aBall.Vely*VelCoef
  3460. End If
  3461.  
  3462. 'Polarity Correction (optional now)
  3463. if not IsEmpty(PolarityIn(0) ) then
  3464. If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
  3465. dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
  3466.  
  3467. if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
  3468. 'playsound "fx_knocker"
  3469. End If
  3470. End If
  3471. RemoveBall aBall
  3472. End Sub
  3473. End Class
  3474.  
  3475. '******************************************************
  3476. ' FLIPPER POLARITY AND RUBBER DAMPENER
  3477. ' SUPPORTING FUNCTIONS
  3478. '******************************************************
  3479.  
  3480. ' Used for flipper correction and rubber dampeners
  3481. Sub ShuffleArray(ByRef aArray, byVal offset) 'shuffle 1d array
  3482. dim x, aCount : aCount = 0
  3483. redim a(uBound(aArray) )
  3484. for x = 0 to uBound(aArray) 'Shuffle objects in a temp array
  3485. if not IsEmpty(aArray(x) ) Then
  3486. if IsObject(aArray(x)) then
  3487. Set a(aCount) = aArray(x)
  3488. Else
  3489. a(aCount) = aArray(x)
  3490. End If
  3491. aCount = aCount + 1
  3492. End If
  3493. Next
  3494. if offset < 0 then offset = 0
  3495. redim aArray(aCount-1+offset) 'Resize original array
  3496. for x = 0 to aCount-1 'set objects back into original array
  3497. if IsObject(a(x)) then
  3498. Set aArray(x) = a(x)
  3499. Else
  3500. aArray(x) = a(x)
  3501. End If
  3502. Next
  3503. End Sub
  3504.  
  3505. ' Used for flipper correction and rubber dampeners
  3506. Sub ShuffleArrays(aArray1, aArray2, offset)
  3507. ShuffleArray aArray1, offset
  3508. ShuffleArray aArray2, offset
  3509. End Sub
  3510.  
  3511. ' Used for flipper correction, rubber dampeners, and drop targets
  3512. Function BallSpeed(ball) 'Calculates the ball speed
  3513. BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
  3514. End Function
  3515.  
  3516. ' Used for flipper correction and rubber dampeners
  3517. Function PSlope(Input, X1, Y1, X2, Y2) 'Set up line via two points, no clamping. Input X, output Y
  3518. dim x, y, b, m : x = input : m = (Y2 - Y1) / (X2 - X1) : b = Y2 - m*X2
  3519. Y = M*x+b
  3520. PSlope = Y
  3521. End Function
  3522.  
  3523. ' Used for flipper correction
  3524. Class spoofball
  3525. Public X, Y, Z, VelX, VelY, VelZ, ID, Mass, Radius
  3526. Public Property Let Data(aBall)
  3527. With aBall
  3528. x = .x : y = .y : z = .z : velx = .velx : vely = .vely : velz = .velz
  3529. id = .ID : mass = .mass : radius = .radius
  3530. end with
  3531. End Property
  3532. Public Sub Reset()
  3533. x = Empty : y = Empty : z = Empty : velx = Empty : vely = Empty : velz = Empty
  3534. id = Empty : mass = Empty : radius = Empty
  3535. End Sub
  3536. End Class
  3537.  
  3538. ' Used for flipper correction and rubber dampeners
  3539. Function LinearEnvelope(xInput, xKeyFrame, yLvl)
  3540. dim y 'Y output
  3541. dim L 'Line
  3542. dim ii : for ii = 1 to uBound(xKeyFrame) 'find active line
  3543. if xInput <= xKeyFrame(ii) then L = ii : exit for : end if
  3544. Next
  3545. if xInput > xKeyFrame(uBound(xKeyFrame) ) then L = uBound(xKeyFrame) 'catch line overrun
  3546. Y = pSlope(xInput, xKeyFrame(L-1), yLvl(L-1), xKeyFrame(L), yLvl(L) )
  3547.  
  3548. if xInput <= xKeyFrame(lBound(xKeyFrame) ) then Y = yLvl(lBound(xKeyFrame) ) 'Clamp lower
  3549. if xInput >= xKeyFrame(uBound(xKeyFrame) ) then Y = yLvl(uBound(xKeyFrame) ) 'Clamp upper
  3550.  
  3551. LinearEnvelope = Y
  3552. End Function
  3553.  
  3554.  
  3555. '****************************************************************************
  3556. 'PHYSICS DAMPENERS
  3557. '****************************************************************************
  3558.  
  3559. 'These are data mined bounce curves,
  3560. 'dialed in with the in-game elasticity as much as possible to prevent angle / spin issues.
  3561. 'Requires tracking ballspeed to calculate COR
  3562.  
  3563.  
  3564. Sub dPosts_Hit(idx)
  3565. RubbersD.dampen Activeball
  3566. End Sub
  3567.  
  3568. Sub dSleeves_Hit(idx)
  3569. SleevesD.Dampen Activeball
  3570. End Sub
  3571.  
  3572.  
  3573. dim RubbersD : Set RubbersD = new Dampener 'frubber
  3574. RubbersD.name = "Rubbers"
  3575. RubbersD.debugOn = False 'shows info in textbox "TBPout"
  3576. RubbersD.Print = False 'debug, reports in debugger (in vel, out cor)
  3577. 'cor bounce curve (linear)
  3578. 'for best results, try to match in-game velocity as closely as possible to the desired curve
  3579. 'RubbersD.addpoint 0, 0, 0.935 'point# (keep sequential), ballspeed, CoR (elasticity)
  3580. RubbersD.addpoint 0, 0, 1.1 'point# (keep sequential), ballspeed, CoR (elasticity)
  3581. RubbersD.addpoint 1, 3.77, 0.96
  3582. RubbersD.addpoint 2, 5.76, 0.967 'dont take this as gospel. if you can data mine rubber elasticitiy, please help!
  3583. RubbersD.addpoint 3, 15.84, 0.874
  3584. RubbersD.addpoint 4, 56, 0.64 'there's clamping so interpolate up to 56 at least
  3585.  
  3586. dim SleevesD : Set SleevesD = new Dampener 'this is just rubber but cut down to 85%...
  3587. SleevesD.name = "Sleeves"
  3588. SleevesD.debugOn = False 'shows info in textbox "TBPout"
  3589. SleevesD.Print = False 'debug, reports in debugger (in vel, out cor)
  3590. SleevesD.CopyCoef RubbersD, 0.85
  3591.  
  3592. Class Dampener
  3593. Public Print, debugOn 'tbpOut.text
  3594. public name, Threshold 'Minimum threshold. Useful for Flippers, which don't have a hit threshold.
  3595. Public ModIn, ModOut
  3596. Private Sub Class_Initialize : redim ModIn(0) : redim Modout(0): End Sub
  3597.  
  3598. Public Sub AddPoint(aIdx, aX, aY)
  3599. ShuffleArrays ModIn, ModOut, 1 : ModIn(aIDX) = aX : ModOut(aIDX) = aY : ShuffleArrays ModIn, ModOut, 0
  3600. if gametime > 100 then Report
  3601. End Sub
  3602.  
  3603. public sub Dampen(aBall)
  3604. if threshold then if BallSpeed(aBall) < threshold then exit sub end if end if
  3605. dim RealCOR, DesiredCOR, str, coef
  3606. DesiredCor = LinearEnvelope(cor.ballvel(aBall.id), ModIn, ModOut )
  3607. RealCOR = BallSpeed(aBall) / cor.ballvel(aBall.id)
  3608. coef = desiredcor / realcor
  3609. if debugOn then str = name & " in vel:" & round(cor.ballvel(aBall.id),2 ) & vbnewline & "desired cor: " & round(desiredcor,4) & vbnewline & _
  3610. "actual cor: " & round(realCOR,4) & vbnewline & "ballspeed coef: " & round(coef, 3) & vbnewline
  3611. if Print then debug.print Round(cor.ballvel(aBall.id),2) & ", " & round(desiredcor,3)
  3612.  
  3613. aBall.velx = aBall.velx * coef : aBall.vely = aBall.vely * coef
  3614. if debugOn then TBPout.text = str
  3615. End Sub
  3616.  
  3617. Public Sub CopyCoef(aObj, aCoef) 'alternative addpoints, copy with coef
  3618. dim x : for x = 0 to uBound(aObj.ModIn)
  3619. addpoint x, aObj.ModIn(x), aObj.ModOut(x)*aCoef
  3620. Next
  3621. End Sub
  3622.  
  3623.  
  3624. Public Sub Report() 'debug, reports all coords in tbPL.text
  3625. if not debugOn then exit sub
  3626. dim a1, a2 : a1 = ModIn : a2 = ModOut
  3627. dim str, x : for x = 0 to uBound(a1) : str = str & x & ": " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
  3628. TBPout.text = str
  3629. End Sub
  3630.  
  3631.  
  3632. End Class
  3633.  
  3634.  
  3635. '******************************************************
  3636. ' TRACK ALL BALL VELOCITIES
  3637. ' FOR RUBBER DAMPENER AND DROP TARGETS
  3638. '******************************************************
  3639.  
  3640. dim cor : set cor = New CoRTracker
  3641.  
  3642. Class CoRTracker
  3643. public ballvel, ballvelx, ballvely
  3644.  
  3645. Private Sub Class_Initialize : redim ballvel(0) : redim ballvelx(0): redim ballvely(0) : End Sub
  3646.  
  3647. Public Sub Update() 'tracks in-ball-velocity
  3648. dim str, b, AllBalls, highestID : allBalls = getballs
  3649.  
  3650. for each b in allballs
  3651. if b.id >= HighestID then highestID = b.id
  3652. Next
  3653.  
  3654. if uBound(ballvel) < highestID then redim ballvel(highestID) 'set bounds
  3655. if uBound(ballvelx) < highestID then redim ballvelx(highestID) 'set bounds
  3656. if uBound(ballvely) < highestID then redim ballvely(highestID) 'set bounds
  3657.  
  3658. for each b in allballs
  3659. ballvel(b.id) = BallSpeed(b)
  3660. ballvelx(b.id) = b.velx
  3661. ballvely(b.id) = b.vely
  3662. Next
  3663. End Sub
  3664. End Class
  3665.  
  3666. '*** Determines if a Points (px,py) is inside a 4 point polygon A-D in Clockwise/CCW order
  3667. Function InRect(px,py,ax,ay,bx,by,cx,cy,dx,dy)
  3668. Dim AB, BC, CD, DA
  3669. AB = (bx*py) - (by*px) - (ax*py) + (ay*px) + (ax*by) - (ay*bx)
  3670. BC = (cx*py) - (cy*px) - (bx*py) + (by*px) + (bx*cy) - (by*cx)
  3671. CD = (dx*py) - (dy*px) - (cx*py) + (cy*px) + (cx*dy) - (cy*dx)
  3672. DA = (ax*py) - (ay*px) - (dx*py) + (dy*px) + (dx*ay) - (dy*ax)
  3673.  
  3674. If (AB <= 0 AND BC <=0 AND CD <= 0 AND DA <= 0) Or (AB >= 0 AND BC >=0 AND CD >= 0 AND DA >= 0) Then
  3675. InRect = True
  3676. Else
  3677. InRect = False
  3678. End If
  3679. End Function
  3680.  
  3681. Sub RDampen_Timer()
  3682. Cor.Update
  3683. End Sub
  3684.  
Advertisement
Add Comment
Please, Sign In to add comment