Outhere

Bow and Arrow EM

Oct 24th, 2021
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 130.31 KB | None | 0 0
  1. 'DOF Config by Outhere
  2. '101 Left Flipper
  3. '102 Right Flipper
  4. '103 Left Slingshot
  5. '104
  6. '105 Right Slingshot
  7. '106
  8. '107 Bumper Center - Top
  9. '108 Bumper Center - Bottom
  10. '109 Bumper Left
  11. '110 Bumper Right
  12. '111
  13. '112
  14. '113
  15. '114
  16. '115
  17. '116
  18. '117
  19. '118
  20. '119
  21. '126 Ball Release
  22. '136 Saucer Left
  23. '139 Saucer Center
  24. '140 Knocker
  25. '141 Chimes
  26. '142 Chimes
  27. '143 Chimes
  28.  
  29.  
  30.  
  31. Option Explicit
  32. Randomize
  33. Randomize
  34. ExecuteGlobal GetTextFile("core.vbs")
  35.  
  36. On Error Resume Next
  37. ExecuteGlobal GetTextFile("Controller.vbs")
  38. Const cGameName = "bowarrowEM_1974"
  39.  
  40. '*******************************************
  41. ' User Options
  42. '*******************************************
  43.  
  44. '----- Shadow Options -----
  45. Const DynamicBallShadowsOn = 1 '0 = no dynamic ball shadow, 1 = enable dynamic ball shadow
  46.  
  47. '----- General Sound Options -----
  48. Const VolumeDial = 0.8 ' Recommended values should be no greater than 1.
  49.  
  50. '----- Phsyics Mods -----
  51. Const RubberizerEnabled = 1 '0 = normal flip rubber, 1 = more lively rubber for flips
  52. Const FlipperCoilRampupMode = 1 '0 = fast, 1 = medium, 2 = slow (tap passes should work)
  53. Const TargetBouncerEnabled = 1 '0 = normal standup targets, 1 = bouncy targets
  54. Const TargetBouncerFactor = 0.7 'Level of bounces. 0.0 thru 1.0, higher value is more bounciness (don't go above 1)
  55.  
  56.  
  57. Dim DesktopMode: DesktopMode = Table1.ShowDT
  58. Dim obj
  59.  
  60. If DesktopMode = True Then 'Show Desktop components
  61. Ramp292.visible=1
  62. Ramp347.visible=1
  63. For each obj in DesktopCrap
  64. obj.visible=true
  65. next
  66.  
  67. 'Primitive13.visible=1
  68. Else
  69. Ramp292.visible=0
  70. Ramp347.visible=0
  71. For each obj in DesktopCrap
  72. obj.visible=false
  73. next
  74. 'Primitive13.visible=0
  75. End if
  76.  
  77. '**********************************************************************************************************
  78. '**********************************************************************************************************
  79. '**********************************************************************************************************
  80. '**********************************************************************************************************
  81. '**********************************************************************************************************
  82. Dim Controller ' B2S
  83. Dim B2SScore ' B2S Score Displayed
  84. Const HSFileName="BowAndArrowEM_74VPX.txt"
  85. Const B2STableName="BowAndArrowEM_1974"
  86. Const LMEMTableConfig="LMEMTables.txt"
  87. Const LMEMShadowConfig="LMEMShadows.txt"
  88. Dim EnableBallShadow
  89. Dim EnableFlipperShadow
  90.  
  91. '* 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
  92. Const ScoreMotorAdjustment=1
  93.  
  94. '* this is a debug setting to use an older scoring routine vs a newer score routine - don't change this value
  95. Const ScoreAdditionAdjustment=1
  96.  
  97. dim ScoreChecker
  98. dim CheckAllScores
  99. dim sortscores(4)
  100. dim sortplayers(4)
  101. Dim B2SOn
  102. Dim B2SFrameCounter
  103. Dim BackglassBallFlagColor
  104. Dim TextStr,TextStr2,TiltEndsGame
  105. Dim i
  106.  
  107. Dim BallsPerGame
  108. Dim InProgress
  109. Dim BallInPlay
  110. Dim CreditsPerCoin
  111. Dim Score100K(4)
  112. Dim Score(4)
  113. Dim ScoreDisplay(4)
  114. Dim HighScorePaid(4)
  115. Dim HighScore
  116. Dim HighScoreReward
  117. Dim BonusMultiplier
  118. Dim Credits
  119. Dim Match
  120. Dim Replay1
  121. Dim Replay2
  122. Dim Replay3
  123. Dim Replay4
  124. Dim Replay1Paid(4)
  125. Dim Replay2Paid(4)
  126. Dim Replay3Paid(4)
  127. Dim Replay4Paid(4)
  128. Dim TableTilted
  129. Dim TiltCount
  130.  
  131. Dim OperatorMenu
  132.  
  133. Dim BonusBooster
  134. Dim BonusBoosterCounter
  135. Dim BonusCounter
  136. Dim HoleCounter
  137.  
  138. Dim Ones
  139. Dim Tens
  140. Dim Hundreds
  141. Dim Thousands
  142.  
  143. Dim Player
  144. Dim Players
  145.  
  146. Dim rst
  147. Dim bonuscountdown
  148. Dim TempMultiCounter
  149. dim TempPlayerup
  150. dim RotatorTemp
  151.  
  152. Dim bump1
  153. Dim bump2
  154. Dim bump3
  155. Dim bump4
  156.  
  157. Dim LastChime10
  158. Dim LastChime100
  159. Dim LastChime1000
  160.  
  161. Dim Score10
  162. Dim Score100
  163.  
  164. Dim targettempscore
  165. Dim CardLightOption
  166. Dim HorseshoeCounter
  167. Dim DropTargetCounter
  168.  
  169. Dim LeftTargetCounter
  170. Dim RightTargetCounter
  171.  
  172. Dim MotorRunning
  173. Dim Replay1Table(15)
  174. Dim Replay2Table(15)
  175. Dim Replay3Table(15)
  176. Dim Replay4Table(15)
  177. Dim ReplayTableSet
  178. Dim ReplayLevel
  179. Dim ReplayTableMax
  180.  
  181. Dim BonusSpecialThreshold
  182. Dim TargetLightsOn
  183. Dim AdvanceLightCounter
  184. dim bonustempcounter
  185.  
  186. dim raceRflag
  187. dim raceAflag
  188. dim raceCflag
  189. dim raceEflag
  190. dim race5flag
  191.  
  192. Dim LStep, LStep2, RStep, xx
  193.  
  194. Dim ReelCounter
  195. Dim BallCounter
  196. Dim BallReelAddStart(12)
  197. Dim BallReelAddFrames(12)
  198. Dim BallReelDropStart(12)
  199. Dim BallReelDropFrames(12)
  200.  
  201. Dim EightLit
  202.  
  203. Dim X
  204. Dim Y
  205. Dim Z
  206. Dim AddABall
  207. Dim AddABallFrames
  208. Dim DropABall
  209. Dim DropABallFrames
  210. Dim CurrentFrame
  211. Dim BonusMotorRunning
  212. Dim QueuedBonusAdds
  213. Dim QueuedBonusDrops
  214.  
  215. Dim ChimesOn
  216.  
  217. Dim TempLightTracker
  218.  
  219. Dim TargetLeftFlag
  220. Dim TargetCenterFlag
  221. Dim TargetRightFlag
  222.  
  223. Dim SpecialLightsFlag
  224.  
  225. Dim AlternatingRelay
  226.  
  227. Dim ZeroToNineUnit
  228.  
  229. Dim StarTriggerValue
  230.  
  231. Dim Kicker1Hold,Kicker2Hold, Kicker3Hold, Kicker4Hold, Kicker5Hold
  232. Dim KickerHold1,KickerHold2,KickerHold3,KickerHold4,KickerHold5
  233.  
  234. Dim mHole,mHole2
  235.  
  236. Dim TargetSequenceCompleted,SpecialLightCounter,HighComplete,LowComplete
  237. Dim ArrowTargetCounter1, ArrowTargetCounter2, ArrowTargetCounter3, ArrowTargetCounter4, tKickerTCount
  238.  
  239. Dim SpinPos,Spin,Count,Count1,Count2,Count3,Reset,LitSpinner,SpecialOption, dooralreadyopen, bgpos, GoldBonusCounter, ScoreMotorStepper
  240.  
  241.  
  242. Spin=Array("5","6","7","8","9","10","J","Q","K","A")
  243.  
  244.  
  245.  
  246. Sub Table1_Init()
  247.  
  248.  
  249. OperatorMenuBackdrop.image = "PostitBL"
  250. For XOpt = 1 to MaxOption
  251. Eval("OperatorOption"&XOpt).image = "PostitBL"
  252. next
  253.  
  254. For XOpt = 1 to 256
  255. Eval("Option"&XOpt).image = "PostItBL"
  256. next
  257.  
  258.  
  259. LoadEM
  260.  
  261. Count=0
  262. Count1=0
  263. Count2=0
  264. Count3=0
  265. Reset=0
  266. ZeroToNineUnit=Int(Rnd*10)
  267. Kicker1Hold=0
  268.  
  269. EightLit=0
  270.  
  271. BallCounter=0
  272. ReelCounter=0
  273. AddABall=0
  274. DropABall=0
  275. HideOptions
  276. SetupReplayTables
  277. PlasticsOff
  278. BumpersOff
  279. OperatorMenu=0
  280. HighScore=0
  281. MotorRunning=0
  282. HighScoreReward=1
  283. Credits=0
  284. BallsPerGame=5
  285. ReplayLevel=9
  286. TiltEndsGame=0
  287. ChimesOn=1
  288. SpecialOption=10
  289. AlternatingRelay=1
  290. CardLightOption=1
  291. BackglassBallFlagColor=1
  292. loadhs
  293. if HighScore=0 then HighScore=5000
  294.  
  295.  
  296. TableTilted=false
  297.  
  298. Match=int(Rnd*10)
  299. MatchReel.SetValue((Match)+1)
  300.  
  301. SpinPos=int(Rnd*10)
  302.  
  303. ' CanPlayReel.SetValue(0)
  304. GameOverReel.SetValue(1)
  305. BallInPlayReel.SetValue(0)
  306. TiltReel.SetValue(1)
  307.  
  308. For each obj in PlayerHuds
  309. obj.state=0
  310. next
  311. For each obj in PlayerScores
  312. obj.ResetToZero
  313. next
  314.  
  315.  
  316. Replay1=Replay1Table(ReplayLevel)
  317. Replay2=Replay2Table(ReplayLevel)
  318. Replay3=Replay3Table(ReplayLevel)
  319. Replay4=Replay4Table(ReplayLevel)
  320.  
  321.  
  322. BonusCounter=0
  323. HoleCounter=0
  324.  
  325.  
  326. InstructCard.image="IC"
  327.  
  328. RefreshReplayCard
  329.  
  330. CurrentFrame=0
  331.  
  332.  
  333.  
  334. AdvanceLightCounter=0
  335.  
  336. Players=0
  337. RotatorTemp=1
  338. InProgress=false
  339. TargetLightsOn=false
  340.  
  341. If SpinPos>9 then SpinPos=9
  342. For each obj in LeftSpinLights
  343. obj.state=0
  344. next
  345. For each obj in RightSpinLights
  346. obj.state=0
  347. next
  348. LeftSpinLights(SpinPos).state=1
  349. RightSpinLights(SpinPos).state=1
  350. SpinningLightTimer.enabled=false
  351. For each obj in KickerLights
  352. obj.state=0
  353. next
  354. For each obj in TargetLights
  355. obj.state=0
  356. next
  357. If B2SOn Then
  358.  
  359. if Match=0 then
  360. Controller.B2SSetMatch 10
  361. else
  362. Controller.B2SSetMatch Match
  363. end if
  364. Controller.B2SSetScoreRolloverPlayer1 0
  365. Controller.B2SSetScoreRolloverPlayer2 0
  366. Controller.B2SSetScoreRolloverPlayer3 0
  367. Controller.B2SSetScoreRolloverPlayer4 0
  368.  
  369. 'Controller.B2SSetScore 3,HighScore
  370. Controller.B2SSetTilt 1
  371. Controller.B2SSetCredits Credits
  372. Controller.B2SSetGameOver 1
  373. End If
  374.  
  375. for i=1 to 4
  376. player=i
  377. If B2SOn Then
  378. Controller.B2SSetScorePlayer player, 0
  379. End If
  380. next
  381. bump1=1
  382. bump2=1
  383. bump3=1
  384. bump4=1
  385. InitPauser5.enabled=true
  386. If B2SOn then
  387. Controller.B2SSetData 60+SpinPos,1
  388. end if
  389.  
  390. If Credits > 0 Then DOF 129, DOFOn: L6.state=1
  391. End Sub
  392.  
  393. Sub Table1_exit()
  394. savehs
  395. SaveLMEMConfig
  396.  
  397. If B2SOn Then Controller.Stop
  398. end sub
  399.  
  400. Sub SpinningLightTimer_timer
  401. ArrowTargetCounter1=ArrowTargetCounter1+1
  402. If ArrowTargetCounter1>4 then ArrowTargetCounter1=0
  403. For each obj in KickerLights
  404. obj.state=0
  405. next
  406. For each obj in TargetLights
  407. obj.state=0
  408. next
  409. KickerLights(ArrowTargetCounter1).state=1
  410. TargetLights(ArrowTargetCounter1).state=1
  411.  
  412. end sub
  413.  
  414. Sub BlinkingLogo_timer
  415. LogoReel.SetValue(int((Rnd * 100) / 25))
  416. end sub
  417.  
  418.  
  419. Sub TimerTitle1_timer
  420. if B2SOn then
  421. if raceRflag=1 then
  422. Controller.B2SSetData 11,0
  423. raceRflag=0
  424. else
  425. Controller.B2SSetData 11,1
  426. raceRflag=1
  427. end if
  428. end if
  429. end sub
  430.  
  431. Sub TimerTitle2_timer
  432. if B2SOn then
  433. if raceAflag=1 then
  434. Controller.B2SSetData 12,0
  435. raceAflag=0
  436. else
  437. Controller.B2SSetData 12,1
  438. raceAflag=1
  439. end if
  440. end if
  441. end sub
  442.  
  443. Sub TimerTitle3_timer
  444. if B2SOn then
  445. if raceCflag=1 then
  446. Controller.B2SSetData 13,0
  447. raceCflag=0
  448. else
  449. Controller.B2SSetData 13,1
  450. raceCflag=1
  451. end if
  452. end if
  453. end sub
  454.  
  455. Sub TimerTitle4_timer
  456. if B2SOn then
  457. if raceEflag=1 then
  458. Controller.B2SSetData 14,0
  459. raceEflag=0
  460. else
  461. Controller.B2SSetData 14,1
  462. raceEflag=1
  463. end if
  464. end if
  465. end sub
  466.  
  467. Sub TimerTitle5_timer
  468. if B2SOn then
  469. if race5flag=1 then
  470. Controller.B2SSetData 15,0
  471. race5flag=0
  472. else
  473. Controller.B2SSetData 15,1
  474. race5flag=1
  475. end if
  476. end if
  477. end sub
  478.  
  479.  
  480. Sub Table1_KeyDown(ByVal keycode)
  481.  
  482. ' GNMOD
  483. if EnteringInitials then
  484. CollectInitials(keycode)
  485. exit sub
  486. end if
  487.  
  488.  
  489. if EnteringOptions then
  490. CollectOptions(keycode)
  491. exit sub
  492. end if
  493.  
  494.  
  495.  
  496. If keycode = PlungerKey Then
  497. Plunger.PullBack
  498. PlungerPulled = 1
  499. End If
  500.  
  501. if keycode = LeftFlipperKey and InProgress = false then
  502. OperatorMenuTimer.Enabled = true
  503. end if
  504. ' END GNMOD
  505.  
  506.  
  507. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  508. lfpress = 1
  509. SolLFlipper(1)
  510. End If
  511.  
  512. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  513. rfpress = 1
  514. SolRFlipper(1)
  515.  
  516. End If
  517.  
  518. If keycode = LeftTiltKey Then
  519. Nudge 90, 2
  520. TiltIt
  521. End If
  522.  
  523. If keycode = RightTiltKey Then
  524. Nudge 270, 2
  525. TiltIt
  526. End If
  527.  
  528. If keycode = CenterTiltKey Then
  529. Nudge 0, 2
  530. TiltIt
  531. End If
  532.  
  533. If keycode = MechanicalTilt Then
  534. TiltCount=2
  535. TiltIt
  536. End If
  537.  
  538.  
  539. If keycode = AddCreditKey or keycode = 4 then
  540. If B2SOn Then
  541. 'Controller.B2SSetScorePlayer6 HighScore
  542.  
  543. End If
  544.  
  545. playsound "coinin"
  546. AddSpecial2
  547. end if
  548.  
  549. if keycode = 5 then
  550. playsound "coinin"
  551. AddSpecial2
  552. keycode= StartGameKey
  553. end if
  554.  
  555.  
  556. if keycode = StartGameKey and Credits>0 and InProgress=true and Players>0 and Players<4 and BallInPlay<2 then
  557. Credits=Credits-1
  558. If Credits <1 Then DOF 129, DOFOff:L6.state=0
  559. CreditsReel.SetValue(Credits)
  560. EMReel7.SetValue(Credits)
  561. Players=Players+1
  562. for each obj in CanPlayLights
  563. obj.state=0
  564. next
  565. CanPlayLights(Players-1).state=1
  566.  
  567. playsound "click"
  568. If B2SOn Then
  569. Controller.B2SSetCanPlay Players
  570. Controller.B2SSetCredits Credits
  571. End If
  572. end if
  573.  
  574. if keycode=StartGameKey and Credits>0 and InProgress=false and Players=0 and EnteringOptions = 0 then
  575. 'GNMOD
  576. OperatorMenuTimer.Enabled = false
  577. 'END GNMOD
  578. Credits=Credits-1
  579. If Credits < 1 Then DOF 129, DOFOff:L6.state=0
  580. CreditsReel.SetValue(Credits)
  581. Players=1
  582. for each obj in CanPlayLights
  583. obj.state=0
  584. next
  585. CanPlayLights(Players-1).state=1
  586. MatchReel.SetValue(0)
  587. Player=1
  588. RolloverReel1.SetValue(0)
  589. RolloverReel2.SetValue(0)
  590. RolloverReel3.SetValue(0)
  591. RolloverReel4.SetValue(0)
  592. playsound "startup_norm"
  593. TempPlayerUp=Player
  594. ' PlayerUpRotator.enabled=true
  595. GameOverReel.SetValue(0)
  596. rst=0
  597. BallInPlay=1
  598. InProgress=true
  599. resettimer.enabled=true
  600. BonusMultiplier=1
  601.  
  602.  
  603. If B2SOn Then
  604. Controller.B2SSetTilt 0
  605. Controller.B2SSetGameOver 0
  606. Controller.B2SSetMatch 0
  607. Controller.B2SSetCredits Credits
  608. 'Controller.B2SSetScore 3,HighScore
  609. Controller.B2SSetCanPlay 1
  610. Controller.B2SSetPlayerUp 1
  611. 'Controller.B2SSetBallInPlay BallInPlay
  612. Controller.B2SSetScoreRolloverPlayer1 0
  613. Controller.B2SSetScoreRolloverPlayer2 0
  614. Controller.B2SSetScoreRolloverPlayer3 0
  615. Controller.B2SSetScoreRolloverPlayer4 0
  616. Controller.B2SSetData 99,1
  617. Controller.B2SSetData 11,0
  618. Controller.B2SSetData 12,0
  619. Controller.B2SSetData 13,0
  620. Controller.B2SSetData 14,0
  621. Controller.B2SSetData 15,0
  622. Controller.B2SSetData 81,0
  623. Controller.B2SSetData 82,0
  624. Controller.B2SSetData 83,0
  625. Controller.B2SSetData 84,0
  626. Controller.B2SSetData 80+Player,1
  627. End If
  628. If Table1.ShowDT = True then
  629. For each obj in PlayerScores
  630. ' obj.ResetToZero
  631. obj.Visible=true
  632. next
  633.  
  634.  
  635. For each obj in PlayerHuds
  636. obj.state=0
  637. next
  638.  
  639. PlayerHuds(Player-1).state=1
  640.  
  641. end If
  642. end if
  643.  
  644. If keycode = LeftMagnaSave Then bLutActive = True
  645. If keycode = RightMagnaSave Then
  646. If bLutActive Then NextLUT: End If
  647. End If
  648.  
  649. End Sub
  650.  
  651. Sub Table1_KeyUp(ByVal keycode)
  652.  
  653. ' GNMOD
  654. if EnteringInitials then
  655. exit sub
  656. end if
  657.  
  658. If keycode = PlungerKey Then
  659.  
  660. if PlungerPulled = 0 then
  661. exit sub
  662. end if
  663.  
  664. PlaySound"plungerrelease"
  665. Plunger.Fire
  666. End If
  667.  
  668. if keycode = LeftFlipperKey then
  669. OperatorMenuTimer.Enabled = false
  670. end if
  671.  
  672. ' END GNMOD
  673.  
  674. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  675. lfpress = 0
  676. leftflipper.eostorqueangle = EOSA
  677. leftflipper.eostorque = EOST
  678. SolLFlipper(0)
  679.  
  680. End If
  681.  
  682. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  683. rfpress = 0
  684. rightflipper.eostorqueangle = EOSA
  685. rightflipper.eostorque = EOST
  686. SolRFlipper(0)
  687.  
  688. End If
  689. If keycode = LeftMagnaSave Then bLutActive = False
  690.  
  691. End Sub
  692.  
  693.  
  694.  
  695. Sub Drain_Hit()
  696. Drain.DestroyBall
  697. PlaySound "fx_drain"
  698. DOF 137, DOFPulse
  699. Pause4Bonustimer.enabled=true
  700.  
  701. End Sub
  702.  
  703. Sub Trigger1_Unhit()
  704. DOF 138, DOFPulse
  705. End Sub
  706.  
  707. Sub Pause4Bonustimer_timer
  708. Pause4Bonustimer.enabled=0
  709. ScoreGoldBonus
  710.  
  711. End Sub
  712.  
  713.  
  714.  
  715.  
  716.  
  717. '***********************************
  718. ' Walls
  719. '***********************************
  720.  
  721. Sub RubberWallSwitches_Hit(idx)
  722. if TableTilted=false then
  723. AddScore(10)
  724. end if
  725. end Sub
  726.  
  727.  
  728.  
  729.  
  730. '****************************************************
  731.  
  732.  
  733.  
  734.  
  735. '****************************************************
  736. ' Kickers
  737. Dim TempBonusMultiplier
  738. Dim TempBonusCount
  739. sub sw10_Hit()
  740. Dim speedx,speedy,finalspeed
  741. speedx=activeball.velx
  742. speedy=activeball.vely
  743. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  744. if TableTilted=true then
  745. tKickerTCount=0
  746. sw10.Timerenabled=1
  747. exit sub
  748. end if
  749. TempBonusMultiplier=BonusMultiplier
  750. BonusMultiplier=1
  751. TempBonusCount=GoldBonusCounter
  752. ScoreSilverBonus
  753. KickerHolder1.enabled=1
  754.  
  755. end sub
  756.  
  757. Sub KickerHolder1_timer
  758. If MotorRunning<>0 then EXIT SUB
  759. If CollectSilverBonus.enabled=true then EXIT SUB
  760. KickerHolder1.enabled=0
  761. tKickerTCount=0
  762. sw10.timerenabled=1
  763.  
  764. end sub
  765.  
  766. Sub sw10_Timer()
  767. tKickerTCount=tKickerTCount+1
  768. if tKickerTCount>2 then tKickerTCount=0
  769. select case tKickerTCount
  770.  
  771. case 1:
  772.  
  773. 'Pkickarm1.rotz=15
  774. Playsound SoundFXDOF("saucer",136,DOFPulse,DOFContactors)
  775. DOF 128, 2
  776. sw10.kick 205,15
  777.  
  778. case 2:
  779. 'GoldBonusCounter=TempBonusCount
  780. BonusMultiplier=TempBonusMultiplier
  781.  
  782. sw10.timerenabled=0
  783. 'Pkickarm1.rotz=0
  784. end Select
  785.  
  786. end sub
  787.  
  788. sub sw2_Hit()
  789. Dim speedx,speedy,finalspeed
  790. speedx=activeball.velx
  791. speedy=activeball.vely
  792. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  793. if TableTilted=true then
  794. tKickerTCount=0
  795. sw2.kick 154,15
  796. exit sub
  797. end if
  798. TempBonusMultiplier=BonusMultiplier
  799. BonusMultiplier=1
  800. TempBonusCount=GoldBonusCounter
  801. SpinningLightTimer.enabled=false
  802. KickerHolder2.enabled=1
  803.  
  804. end sub
  805.  
  806. Sub KickerHolder2_timer
  807. If MotorRunning<>0 then EXIT SUB
  808.  
  809. tKickerTCount=0
  810.  
  811. KickerHolder2.enabled=0
  812. sw2.timerenabled=1
  813.  
  814. end sub
  815.  
  816. Sub sw2_Timer()
  817. if MotorRunning<>0 then EXIT SUB
  818. tKickerTCount=tKickerTCount+1
  819. if tKickerTCount>8 then tKickerTCount=0
  820. select case tKickerTCount
  821. case 1:
  822. AddScore(1000)
  823. case 2:
  824. if ArrowTargetCounter1>0 then AddScore(1000)
  825. case 3:
  826. if ArrowTargetCounter1>1 then AddScore(1000)
  827. case 4:
  828. if ArrowTargetCounter1>2 then AddScore(1000)
  829. case 5:
  830. if ArrowTargetCounter1>3 then AddScore(1000)
  831. case 6:
  832. if ArrowTargetCounter1=2 then OpenGate(1)
  833. case 7:
  834. ToggleAlternatingRelay
  835. 'Pkickarm1.rotz=15
  836. Playsound SoundFXDOF("saucer",139,DOFPulse,DOFContactors)
  837. DOF 128, 2
  838. sw2.kick 154,15
  839.  
  840. case 8:
  841. SpinningLightTimer.enabled=true
  842. sw2.timerenabled=0
  843. 'Pkickarm1.rotz=0
  844. end Select
  845.  
  846. end sub
  847.  
  848. '**************************************
  849.  
  850.  
  851. Sub AddSpecial()
  852. PlaySound"knocker"
  853. DOF 140, DOFPulse
  854.  
  855. Credits=Credits+1
  856. L6.state=1
  857. DOF 129, DOFOn
  858. if Credits>15 then Credits=15
  859. If B2SOn Then
  860. Controller.B2SSetCredits Credits
  861. End If
  862. CreditsReel.SetValue(Credits)
  863.  
  864.  
  865. End Sub
  866.  
  867. Sub AddSpecial2()
  868. PlaySound"click"
  869. Credits=Credits+1
  870. L6.state=1
  871. DOF 129, DOFOn
  872. if Credits>15 then Credits=15
  873. If B2SOn Then
  874. Controller.B2SSetCredits Credits
  875. End If
  876. CreditsReel.SetValue(Credits)
  877. End Sub
  878.  
  879.  
  880. Sub ToggleAlternatingRelay
  881. if AlternatingRelay=1 then
  882. AlternatingRelay=0
  883. else
  884. AlternatingRelay=1
  885. end if
  886. LightAltRelay
  887. end sub
  888.  
  889. Sub LightAltRelay
  890. L72.state=0
  891. If GoldBonusCounter<10 then exit sub
  892. if AlternatingRelay=0 then
  893. L72.state=1
  894. L44.state=1
  895. L43.state=0
  896. else
  897. L72.state=0
  898. L44.state=0
  899. L43.state=1
  900. end if
  901. end sub
  902.  
  903. sub LightBumpers
  904.  
  905.  
  906. end sub
  907.  
  908. Sub CloseGateTrigger_Hit()
  909. if dooralreadyopen=1 then
  910. closeg.enabled=true
  911.  
  912. end if
  913. End Sub
  914.  
  915.  
  916. sub openg_timer
  917. bottgate(bgpos).isdropped=true
  918. bgpos=bgpos-1
  919. bottgate(bgpos).isdropped=false
  920. primgate.RotY=30+(bgpos*10)
  921. if bgpos=0 then
  922. playsound "postup"
  923. RightOutlaneLight.state=1
  924. openg.enabled=false
  925.  
  926. dooralreadyopen=1
  927. end if
  928.  
  929. end sub
  930.  
  931. sub closeg_timer
  932. closeg.interval=10
  933. bottgate(bgpos).isdropped=true
  934. bgpos=bgpos+1
  935. bottgate(bgpos).isdropped=false
  936. primgate.RotY=30+(bgpos*10)
  937. if bgpos=6 then
  938. RightOutlaneLight.state=0
  939. closeg.enabled=false
  940.  
  941. dooralreadyopen=0
  942. end if
  943. end sub
  944.  
  945. sub IncreaseGoldBonus
  946. if GoldBonusCounter<10 then
  947. If GoldBonusCounter<10 then
  948. 'GoldBonus(GoldBonusCounter).state=0
  949. GoldBonusCounter=GoldBonusCounter+1
  950. GoldBonus(GoldBonusCounter).state=1
  951. elseIf GoldBonusCounter>9 then
  952. GoldBonus(GoldBonusCounter-10).state=0
  953. GoldBonusCounter=GoldBonusCounter+1
  954. GoldBonus(10).state=1
  955. GoldBonus(GoldBonusCounter-10).state=1
  956. end if
  957. end if
  958. If GoldBonusCounter>9 then LightAltRelay
  959.  
  960. end sub
  961.  
  962. sub ScoreSilverBonus
  963. ScoreMotorStepper=0
  964. CollectSilverBonus.interval=135
  965. CollectSilverBonus.enabled=1
  966. end sub
  967.  
  968. sub CollectSilverBonus_timer
  969. if MotorRunning=1 then
  970. exit sub
  971. end if
  972. if TempBonusCount<1 then
  973. CollectSilverBonus.enabled=0
  974.  
  975. else
  976. Select Case ScoreMotorStepper
  977. case 0,1,2,3,4:
  978. AddScore(1000)
  979.  
  980.  
  981. TempBonusCount=TempBonusCount-1
  982.  
  983. case 5,6:
  984.  
  985.  
  986.  
  987. case 7:
  988. PlaySound"BallyClunk"
  989.  
  990.  
  991.  
  992.  
  993. end select
  994. ScoreMotorStepper=ScoreMotorStepper+1
  995. If ScoreMotorStepper>7 then
  996. ScoreMotorStepper=0
  997. end if
  998.  
  999. end if
  1000. end sub
  1001.  
  1002.  
  1003.  
  1004. sub ScoreGoldBonus
  1005. ScoreMotorStepper=0
  1006. CollectGoldBonus.interval=135
  1007. CollectGoldBonus.enabled=1
  1008. end sub
  1009.  
  1010. sub CollectGoldBonus_timer
  1011. if MotorRunning=1 then
  1012. exit sub
  1013. end if
  1014. if GoldBonusCounter<1 then
  1015. CollectGoldBonus.enabled=0
  1016. NextBallDelay.enabled=true
  1017. else
  1018. If L63.state=1 then
  1019. Select case ScoreMotorStepper
  1020. case 0,1,3,4:
  1021. AddScore(1000)
  1022.  
  1023. case 2,5:
  1024. PlaySound"BallyClunk"
  1025. If GoldBonusCounter>10 then
  1026. GoldBonus(GoldBonusCounter-10).state=0
  1027. else
  1028. GoldBonus(GoldBonusCounter).state=0
  1029.  
  1030. end if
  1031.  
  1032. GoldBonusCounter=GoldBonusCounter-1
  1033. if GoldBonusCounter>=0 then
  1034. If GoldBonusCounter<=10 then
  1035. GoldBonus(GoldBonusCounter).state=1
  1036. elseif GoldBonusCounter>10 then
  1037. GoldBonus(10).state=1
  1038. GoldBonus(GoldBonusCounter-10).state=1
  1039. end if
  1040. end if
  1041. case 6:
  1042.  
  1043.  
  1044. case 7:
  1045.  
  1046.  
  1047. end select
  1048. ScoreMotorStepper=ScoreMotorStepper+1
  1049. If ScoreMotorStepper>7 then
  1050. ScoreMotorStepper=0
  1051. end if
  1052. else
  1053. Select Case ScoreMotorStepper
  1054. case 0,1,2,3,4:
  1055. AddScore(1000)
  1056. If GoldBonusCounter>10 then
  1057. GoldBonus(GoldBonusCounter-10).state=0
  1058. else
  1059. GoldBonus(GoldBonusCounter).state=0
  1060.  
  1061. end if
  1062.  
  1063. GoldBonusCounter=GoldBonusCounter-1
  1064. if GoldBonusCounter>=0 then
  1065. If GoldBonusCounter<=10 then
  1066. GoldBonus(GoldBonusCounter).state=1
  1067. elseif GoldBonusCounter>10 then
  1068. GoldBonus(10).state=1
  1069. GoldBonus(GoldBonusCounter-10).state=1
  1070. end if
  1071. end if
  1072. case 5,6:
  1073. 'PlaySound"BallyClunk"
  1074.  
  1075.  
  1076. case 7:
  1077. PlaySound"BallyClunk"
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083. end select
  1084. ScoreMotorStepper=ScoreMotorStepper+1
  1085. If ScoreMotorStepper>7 then
  1086. ScoreMotorStepper=0
  1087. end if
  1088. end if
  1089. end if
  1090. end sub
  1091.  
  1092.  
  1093.  
  1094. Sub ResetBallDrops
  1095.  
  1096. HoleCounter=0
  1097. IncreaseGoldBonus
  1098.  
  1099. End Sub
  1100.  
  1101.  
  1102. Sub LightsOut
  1103.  
  1104. BonusCounter=0
  1105. HoleCounter=0
  1106.  
  1107.  
  1108.  
  1109. StopSound "buzz"
  1110. StopSound "buzzL"
  1111.  
  1112. end sub
  1113.  
  1114. Sub ResetBalls()
  1115.  
  1116. TempMultiCounter=BallsPerGame-BallInPlay
  1117. ResetBallDrops
  1118. BonusMultiplier=1
  1119. TableTilted=false
  1120. TiltReel.SetValue(0)
  1121. If B2Son then
  1122. Controller.B2SSetTilt 0
  1123. end if
  1124. BumpersOn
  1125. L65.state=0
  1126. L66.state=0
  1127. L67.state=0
  1128. L68.state=0
  1129. L85.state=1
  1130. L86.state=1
  1131. L87.state=1
  1132. L88.state=1
  1133. L72.state=0
  1134. L44.state=0
  1135. L43.state=0
  1136. L63.state=0
  1137. OpenGate(0)
  1138. PlasticsOn
  1139. 'CreateBallID BallRelease
  1140. Ballrelease.CreateSizedBall 25
  1141. Ballrelease.Kick 40,7
  1142. DOF 126, DOFPulse
  1143. BallInPlayReel.SetValue(BallInPlay)
  1144. InstructCard.image="IC"
  1145.  
  1146.  
  1147.  
  1148. End Sub
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154. sub resettimer_timer
  1155. rst=rst+1
  1156. if rst>1 and rst<12 then
  1157. ResetReelsToZero(1)
  1158. ResetReelsToZero(2)
  1159. end if
  1160.  
  1161. if rst=16 then
  1162. playsound "StartBall1"
  1163. end if
  1164. if rst=18 then
  1165. newgame
  1166. resettimer.enabled=false
  1167. end if
  1168. end sub
  1169.  
  1170. Sub ResetReelsToZero(reelzeroflag)
  1171. dim d1(5)
  1172. dim d2(5)
  1173. dim scorestring1, scorestring2
  1174.  
  1175. If reelzeroflag=1 then
  1176. scorestring1=CStr(Score(1))
  1177. scorestring2=CStr(Score(2))
  1178. scorestring1=right("00000" & scorestring1,5)
  1179. scorestring2=right("00000" & scorestring2,5)
  1180. for i=0 to 4
  1181. d1(i)=CInt(mid(scorestring1,i+1,1))
  1182. d2(i)=CInt(mid(scorestring2,i+1,1))
  1183. next
  1184. for i=0 to 4
  1185. if d1(i)>0 then
  1186. d1(i)=d1(i)+1
  1187. if d1(i)>9 then d1(i)=0
  1188. end if
  1189. if d2(i)>0 then
  1190. d2(i)=d2(i)+1
  1191. if d2(i)>9 then d2(i)=0
  1192. end if
  1193.  
  1194. next
  1195. Score(1)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  1196. Score(2)=(d2(0)*10000) + (d2(1)*1000) + (d2(2)*100) + (d2(3)*10) + d2(4)
  1197. If B2SOn Then
  1198. Controller.B2SSetScorePlayer 1, Score(1)
  1199. Controller.B2SSetScorePlayer 2, Score(2)
  1200. End If
  1201. PlayerScores(0).SetValue(Score(1))
  1202. PlayerScoresOn(0).SetValue(Score(1))
  1203. PlayerScores(1).SetValue(Score(2))
  1204. PlayerScoresOn(1).SetValue(Score(2))
  1205.  
  1206. scorestring1=CStr(Score(3))
  1207. scorestring2=CStr(Score(4))
  1208. scorestring1=right("00000" & scorestring1,5)
  1209. scorestring2=right("00000" & scorestring2,5)
  1210. for i=0 to 4
  1211. d1(i)=CInt(mid(scorestring1,i+1,1))
  1212. d2(i)=CInt(mid(scorestring2,i+1,1))
  1213. next
  1214. for i=0 to 4
  1215. if d1(i)>0 then
  1216. d1(i)=d1(i)+1
  1217. if d1(i)>9 then d1(i)=0
  1218. end if
  1219. if d2(i)>0 then
  1220. d2(i)=d2(i)+1
  1221. if d2(i)>9 then d2(i)=0
  1222. end if
  1223.  
  1224. next
  1225. Score(3)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  1226. Score(4)=(d2(0)*10000) + (d2(1)*1000) + (d2(2)*100) + (d2(3)*10) + d2(4)
  1227. If B2SOn Then
  1228. Controller.B2SSetScorePlayer 3, Score(3)
  1229. Controller.B2SSetScorePlayer 4, Score(4)
  1230. End If
  1231. PlayerScores(2).SetValue(Score(3))
  1232. PlayerScoresOn(2).SetValue(Score(3))
  1233. PlayerScores(3).SetValue(Score(4))
  1234. PlayerScoresOn(3).SetValue(Score(4))
  1235.  
  1236. end if
  1237.  
  1238. end sub
  1239.  
  1240.  
  1241. sub NextBallDelay_timer()
  1242. NextBallDelay.enabled=false
  1243. nextball
  1244.  
  1245. end sub
  1246.  
  1247. sub newgame
  1248. InProgress=true
  1249. queuedscore=0
  1250. for i = 1 to 4
  1251. Score(i)=0
  1252. Score100K(1)=0
  1253. HighScorePaid(i)=false
  1254. Replay1Paid(i)=false
  1255. Replay2Paid(i)=false
  1256. Replay3Paid(i)=false
  1257. Replay4Paid(i)=false
  1258. next
  1259. If B2SOn Then
  1260. Controller.B2SSetTilt 0
  1261. Controller.B2SSetGameOver 0
  1262. Controller.B2SSetMatch 0
  1263. ' Controller.B2SSetScorePlayer1 0
  1264. ' Controller.B2SSetScorePlayer2 0
  1265. ' Controller.B2SSetScorePlayer3 0
  1266. ' Controller.B2SSetScorePlayer4 0
  1267. Controller.B2SSetBallInPlay BallInPlay
  1268. Controller.B2SSetData 81,0
  1269. Controller.B2SSetData 82,0
  1270. Controller.B2SSetData 83,0
  1271. Controller.B2SSetData 84,0
  1272. Controller.B2SSetData 80+Player,1
  1273. End if
  1274.  
  1275.  
  1276. SpinningLightTimer.enabled=true
  1277. BumpersOn
  1278. GoldBonusCounter=0
  1279. LowComplete=false
  1280. HighComplete=false
  1281. For each obj in GoldBonus
  1282. obj.state=0
  1283. next
  1284. ResetBalls
  1285. End sub
  1286.  
  1287. sub nextball
  1288. If L4.state=1 then
  1289. L4.state=0
  1290. ShootAgainReel.Setvalue(0)
  1291. If B2SOn Then
  1292. Controller.B2SSetShootAgain 0
  1293. end if
  1294. else
  1295. Player=Player+1
  1296. end if
  1297. If Player>Players Then
  1298. BallInPlay=BallInPlay+1
  1299. If BallInPlay>BallsPerGame then
  1300. PlaySound("MotorLeer")
  1301. InProgress=false
  1302.  
  1303. If B2SOn Then
  1304. Controller.B2SSetGameOver 1
  1305. Controller.B2SSetPlayerUp 0
  1306. Controller.B2SSetBallInPlay 0
  1307. Controller.B2SSetCanPlay 0
  1308. Controller.B2SSetData 99,0
  1309. Controller.B2SSetData 81,0
  1310. Controller.B2SSetData 82,0
  1311. Controller.B2SSetData 83,0
  1312. Controller.B2SSetData 84,0
  1313.  
  1314. End If
  1315. For each obj in PlayerHuds
  1316. obj.state=0
  1317. next
  1318. If Table1.ShowDT = True then
  1319. For each obj in PlayerScores
  1320. obj.visible=1
  1321. Next
  1322.  
  1323. end If
  1324. SpinningLightTimer.enabled=false
  1325. For each obj in KickerLights
  1326. obj.state=0
  1327. next
  1328. For each obj in TargetLights
  1329. obj.state=0
  1330. next
  1331. GameOverReel.SetValue(1)
  1332. InstructCard.image="IC"
  1333.  
  1334. BallInPlayReel.SetValue(0)
  1335. ' CanPlayReel.SetValue(0)
  1336. LeftFlipper.RotateToStart
  1337. RightFlipper.RotateToStart
  1338. LightsOut
  1339. BumpersOff
  1340. PlasticsOff
  1341. checkmatch
  1342. CheckHighScore
  1343. Players=0
  1344. HighScoreTimer.interval=100
  1345. HighScoreTimer.enabled=True
  1346. TimerTitle1.enabled=1
  1347. TimerTitle2.enabled=1
  1348. TimerTitle3.enabled=1
  1349. TimerTitle4.enabled=1
  1350.  
  1351. Else
  1352. Player=1
  1353. If B2SOn Then
  1354. Controller.B2SSetPlayerUp Player
  1355. Controller.B2SSetBallInPlay BallInPlay
  1356. Controller.B2SSetData 81,0
  1357. Controller.B2SSetData 82,0
  1358. Controller.B2SSetData 83,0
  1359. Controller.B2SSetData 84,0
  1360. Controller.B2SSetData 80+Player,1
  1361. End If
  1362. ' PlaySound("RotateThruPlayers")
  1363. TempPlayerUp=Player
  1364. ' PlayerUpRotator.enabled=true
  1365. PlayStartBall.enabled=true
  1366. For each obj in PlayerHuds
  1367. obj.state=0
  1368. next
  1369. If Table1.ShowDT = True then
  1370. For each obj in PlayerScores
  1371. obj.visible=1
  1372. Next
  1373.  
  1374. PlayerHuds(Player-1).state=1
  1375.  
  1376. end If
  1377.  
  1378. ResetBalls
  1379. End If
  1380. Else
  1381. If B2SOn Then
  1382. Controller.B2SSetPlayerUp Player
  1383. Controller.B2SSetBallInPlay BallInPlay
  1384. Controller.B2SSetData 81,0
  1385. Controller.B2SSetData 82,0
  1386. Controller.B2SSetData 83,0
  1387. Controller.B2SSetData 84,0
  1388. Controller.B2SSetData 80+Player,1
  1389. End If
  1390. ' PlaySound("RotateThruPlayers")
  1391. TempPlayerUp=Player
  1392. ' PlayerUpRotator.enabled=true
  1393. PlayStartBall.enabled=true
  1394. For each obj in PlayerHuds
  1395. obj.state=0
  1396. next
  1397. If Table1.ShowDT = True then
  1398. For each obj in PlayerScores
  1399. obj.visible=1
  1400. Next
  1401.  
  1402. PlayerHuds(Player-1).state=1
  1403.  
  1404. end If
  1405. ResetBalls
  1406. End If
  1407.  
  1408. End sub
  1409.  
  1410. sub CheckHighScore
  1411. Dim playertops
  1412. dim si
  1413. dim sj
  1414. dim stemp
  1415. dim stempplayers
  1416. for i=1 to 4
  1417. sortscores(i)=0
  1418. sortplayers(i)=0
  1419. next
  1420. playertops=0
  1421. for i = 1 to Players
  1422. sortscores(i)=Score(i)
  1423. sortplayers(i)=i
  1424. next
  1425.  
  1426. for si = 1 to Players
  1427. for sj = 1 to Players-1
  1428. if sortscores(sj)>sortscores(sj+1) then
  1429. stemp=sortscores(sj+1)
  1430. stempplayers=sortplayers(sj+1)
  1431. sortscores(sj+1)=sortscores(sj)
  1432. sortplayers(sj+1)=sortplayers(sj)
  1433. sortscores(sj)=stemp
  1434. sortplayers(sj)=stempplayers
  1435. end if
  1436. next
  1437. next
  1438. ScoreChecker=4
  1439. CheckAllScores=1
  1440. NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
  1441. savehs
  1442. end sub
  1443.  
  1444.  
  1445. sub checkmatch
  1446. Dim tempmatch
  1447. if TableTilted=true and TiltEndsGame=1 then
  1448. exit sub
  1449. end if
  1450. tempmatch=Int(Rnd*10)
  1451. Match=tempmatch*10
  1452. MatchReel.SetValue(tempmatch+1)
  1453.  
  1454. If B2SOn Then
  1455. If Match = 0 Then
  1456. Controller.B2SSetMatch 100
  1457. Else
  1458. Controller.B2SSetMatch Match
  1459. End If
  1460. End if
  1461. for i = 1 to Players
  1462. if Match=(Score(i) mod 100) then
  1463. AddSpecial
  1464. end if
  1465. next
  1466. end sub
  1467.  
  1468. Sub TiltTimer_Timer()
  1469. if TiltCount > 0 then TiltCount = TiltCount - 1
  1470. if TiltCount = 0 then
  1471. TiltTimer.Enabled = False
  1472. end if
  1473. end sub
  1474.  
  1475. Sub TiltIt()
  1476. TiltCount = TiltCount + 1
  1477. if TiltCount = 3 then
  1478. TableTilted=True
  1479. If TiltEndsGame=1 then
  1480. BallInPlay=BallsPerGame
  1481. If B2SOn Then
  1482. Controller.B2SSetGameOver 1
  1483. Controller.B2SSetPlayerUp 0
  1484. Controller.B2SSetBallInPlay 0
  1485. Controller.B2SSetCanPlay 0
  1486. End If
  1487. For each obj in PlayerHuds
  1488. obj.state=0
  1489. next
  1490. GameOverReel.SetValue(1)
  1491. InstructCard.image="IC"
  1492.  
  1493. end if
  1494. PlasticsOff
  1495. BumpersOff
  1496.  
  1497. if dooralreadyopen=1 then
  1498. closeg.enabled=true
  1499. end if
  1500. LeftFlipper.RotateToStart
  1501. RightFlipper.RotateToStart
  1502. StopSound "buzz"
  1503. StopSound "buzzL"
  1504. TiltReel.SetValue(1)
  1505. If B2Son then
  1506. Controller.B2SSetTilt 1
  1507. end if
  1508. else
  1509. TiltTimer.Interval = 500
  1510. TiltTimer.Enabled = True
  1511. end if
  1512.  
  1513. end sub
  1514.  
  1515.  
  1516.  
  1517. Sub PlayStartBall_timer()
  1518.  
  1519. PlayStartBall.enabled=false
  1520. PlaySound("StartBall2-5")
  1521. end sub
  1522.  
  1523. Sub PlayerUpRotator_timer()
  1524. If RotatorTemp<5 then
  1525. TempPlayerUp=TempPlayerUp+1
  1526. If TempPlayerUp>4 then
  1527. TempPlayerUp=1
  1528. end if
  1529. If B2SOn Then
  1530. Controller.B2SSetPlayerUp TempPlayerUp
  1531. End If
  1532.  
  1533. else
  1534. if B2SOn then
  1535. Controller.B2SSetPlayerUp Player
  1536. end if
  1537. PlayerUpRotator.enabled=false
  1538. RotatorTemp=1
  1539. end if
  1540. RotatorTemp=RotatorTemp+1
  1541.  
  1542.  
  1543. end sub
  1544.  
  1545. sub savehs
  1546. ' Based on Black's Highscore routines
  1547. Dim FileObj
  1548. Dim ScoreFile
  1549. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1550. If Not FileObj.FolderExists(UserDirectory) then
  1551. Exit Sub
  1552. End if
  1553. Set ScoreFile=FileObj.CreateTextFile(UserDirectory & HSFileName,True)
  1554. ScoreFile.WriteLine 1
  1555. ScoreFile.WriteLine Credits
  1556. scorefile.writeline BallsPerGame
  1557. scorefile.writeline 0
  1558. scorefile.writeline CardLightOption
  1559. scorefile.writeline SpecialOption
  1560. scorefile.writeline ReplayLevel
  1561. for xx=1 to 5
  1562. scorefile.writeline HSScore(xx)
  1563. next
  1564. for xx=1 to 5
  1565. scorefile.writeline HSName(xx)
  1566. next
  1567. ScoreFile.Close
  1568. Set ScoreFile=Nothing
  1569. Set FileObj=Nothing
  1570. end sub
  1571.  
  1572. sub SaveLMEMConfig
  1573. Dim FileObj
  1574. Dim LMConfig
  1575. dim temp1
  1576. dim tempb2s
  1577. tempb2s=0
  1578. if B2SOn=true then
  1579. tempb2s=1
  1580. else
  1581. tempb2s=0
  1582. end if
  1583. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1584. If Not FileObj.FolderExists(UserDirectory) then
  1585. Exit Sub
  1586. End if
  1587. Set LMConfig=FileObj.CreateTextFile(UserDirectory & LMEMTableConfig,True)
  1588. LMConfig.WriteLine tempb2s
  1589. LMConfig.Close
  1590. Set LMConfig=Nothing
  1591. Set FileObj=Nothing
  1592.  
  1593. end Sub
  1594.  
  1595. sub LoadLMEMConfig
  1596. Dim FileObj
  1597. Dim LMConfig
  1598. dim tempC
  1599. dim tempb2s
  1600.  
  1601. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1602. If Not FileObj.FolderExists(UserDirectory) then
  1603. Exit Sub
  1604. End if
  1605. If Not FileObj.FileExists(UserDirectory & LMEMTableConfig) then
  1606. Exit Sub
  1607. End if
  1608. Set LMConfig=FileObj.GetFile(UserDirectory & LMEMTableConfig)
  1609. Set TextStr2=LMConfig.OpenAsTextStream(1,0)
  1610. If (TextStr2.AtEndOfStream=True) then
  1611. Exit Sub
  1612. End if
  1613. tempC=TextStr2.ReadLine
  1614. TextStr2.Close
  1615. tempb2s=cdbl(tempC)
  1616. if tempb2s=0 then
  1617. B2SOn=false
  1618. else
  1619. B2SOn=true
  1620. end if
  1621. Set LMConfig=Nothing
  1622. Set FileObj=Nothing
  1623. end sub
  1624.  
  1625.  
  1626. sub loadhs
  1627. ' Based on Black's Highscore routines
  1628. Dim FileObj
  1629. Dim ScoreFile
  1630. dim temp1
  1631. dim temp2
  1632. dim temp3
  1633. dim temp4
  1634. dim temp5
  1635. dim temp6
  1636. dim temp7
  1637. dim temp8
  1638. dim temp9
  1639. dim temp10
  1640. dim temp11
  1641. dim temp12
  1642. dim temp13
  1643. dim temp14
  1644. dim temp15
  1645. dim temp16
  1646. dim temp17
  1647.  
  1648.  
  1649. Set FileObj=CreateObject("Scripting.FileSystemObject")
  1650. If Not FileObj.FolderExists(UserDirectory) then
  1651. Exit Sub
  1652. End if
  1653. If Not FileObj.FileExists(UserDirectory & HSFileName) then
  1654. Exit Sub
  1655. End if
  1656. Set ScoreFile=FileObj.GetFile(UserDirectory & HSFileName)
  1657. Set TextStr=ScoreFile.OpenAsTextStream(1,0)
  1658. If (TextStr.AtEndOfStream=True) then
  1659. Exit Sub
  1660. End if
  1661. temp1=TextStr.ReadLine
  1662. temp2=textstr.readline
  1663. temp3=textstr.readline
  1664. temp4=textstr.readline
  1665. temp5=textstr.readline
  1666. temp7=textstr.readline
  1667. temp6=textstr.readline
  1668. HighScore=cdbl(temp1)
  1669. if HighScore=1 then
  1670.  
  1671. temp8=textstr.readline
  1672. temp9=textstr.readline
  1673. temp10=textstr.readline
  1674. temp11=textstr.readline
  1675. temp12=textstr.readline
  1676. temp13=textstr.readline
  1677. temp14=textstr.readline
  1678. temp15=textstr.readline
  1679. temp16=textstr.readline
  1680. temp17=textstr.readline
  1681. end if
  1682. TextStr.Close
  1683. if HighScore=1 then
  1684. Credits=cdbl(temp2)
  1685. BallsPerGame=cdbl(temp3)
  1686. TiltEndsGame=cdbl(temp4)
  1687. CardLightOption=cdbl(temp5)
  1688. SpecialOption=cdbl(temp7)
  1689. ReplayLevel=cdbl(temp6)
  1690.  
  1691. HSScore(1) = int(temp8)
  1692. HSScore(2) = int(temp9)
  1693. HSScore(3) = int(temp10)
  1694. HSScore(4) = int(temp11)
  1695. HSScore(5) = int(temp12)
  1696.  
  1697. HSName(1) = temp13
  1698. HSName(2) = temp14
  1699. HSName(3) = temp15
  1700. HSName(4) = temp16
  1701. HSName(5) = temp17
  1702. end if
  1703. Set ScoreFile=Nothing
  1704. Set FileObj=Nothing
  1705. end sub
  1706.  
  1707. Sub DisplayHighScore
  1708.  
  1709.  
  1710. end sub
  1711.  
  1712. sub InitPauser5_timer
  1713. If B2SOn Then
  1714. 'Controller.B2SSetScore 3,HighScore
  1715. End If
  1716. DisplayHighScore
  1717. CreditsReel.SetValue(Credits)
  1718. InitPauser5.enabled=false
  1719. end sub
  1720.  
  1721.  
  1722.  
  1723. sub BumpersOff
  1724.  
  1725.  
  1726. end sub
  1727.  
  1728. sub BumpersOn
  1729.  
  1730. end sub
  1731.  
  1732. Sub PlasticsOn
  1733.  
  1734. For each obj in GI
  1735. obj.state=1
  1736. next
  1737.  
  1738. end sub
  1739.  
  1740. Sub PlasticsOff
  1741.  
  1742. For each obj in GI
  1743. obj.state=0
  1744. next
  1745.  
  1746. end sub
  1747.  
  1748. Sub SetupReplayTables
  1749.  
  1750.  
  1751. Replay1Table(1)=68000
  1752. Replay1Table(2)=71000
  1753. Replay1Table(3)=74000
  1754. Replay1Table(4)=77000
  1755. Replay1Table(5)=80000
  1756. Replay1Table(6)=91000
  1757. Replay1Table(7)=94000
  1758. Replay1Table(8)=97000
  1759. Replay1Table(9)=103000
  1760. Replay1Table(10)=132000
  1761. Replay1Table(11)=71000
  1762. Replay1Table(12)=74000
  1763. Replay1Table(13)=78000
  1764. Replay1Table(14)=999000
  1765. Replay1Table(15)=999000
  1766.  
  1767.  
  1768. Replay2Table(1)=111000
  1769. Replay2Table(2)=114000
  1770. Replay2Table(3)=117000
  1771. Replay2Table(4)=119000
  1772. Replay2Table(5)=118000
  1773. Replay2Table(6)=143000
  1774. Replay2Table(7)=145000
  1775. Replay2Table(8)=148000
  1776. Replay2Table(9)=150000
  1777. Replay2Table(10)=150000
  1778. Replay2Table(11)=85000
  1779. Replay2Table(12)=88000
  1780. Replay2Table(13)=92000
  1781. Replay2Table(14)=999000
  1782. Replay2Table(15)=999000
  1783.  
  1784. Replay3Table(1)=145000
  1785. Replay3Table(2)=147000
  1786. Replay3Table(3)=149000
  1787. Replay3Table(4)=150000
  1788. Replay3Table(5)=149000
  1789. Replay3Table(6)=182000
  1790. Replay3Table(7)=181000
  1791. Replay3Table(8)=181000
  1792. Replay3Table(9)=184000
  1793. Replay3Table(10)=168000
  1794. Replay3Table(11)=93000
  1795. Replay3Table(12)=96000
  1796. Replay3Table(13)=999000
  1797. Replay3Table(14)=999000
  1798. Replay3Table(15)=999000
  1799.  
  1800. Replay4Table(1)=999000
  1801. Replay4Table(2)=999000
  1802. Replay4Table(3)=999000
  1803. Replay4Table(4)=999000
  1804. Replay4Table(5)=999000
  1805. Replay4Table(6)=999000
  1806. Replay4Table(7)=999000
  1807. Replay4Table(8)=999000
  1808. Replay4Table(9)=999000
  1809. Replay4Table(10)=999000
  1810. Replay4Table(11)=999000
  1811. Replay4Table(12)=999000
  1812. Replay4Table(13)=999000
  1813. Replay4Table(14)=999000
  1814. Replay4Table(15)=999000
  1815.  
  1816. ReplayTableMax=9
  1817.  
  1818.  
  1819. end sub
  1820.  
  1821. Sub RefreshReplayCard
  1822. Dim tempst1
  1823. Dim tempst2
  1824.  
  1825. tempst1=FormatNumber(BallsPerGame,0)
  1826. tempst2=FormatNumber(ReplayLevel,0)
  1827.  
  1828. BallCard.image = "BC"+tempst1
  1829. Replay1=Replay1Table(ReplayLevel)
  1830. Replay2=Replay2Table(ReplayLevel)
  1831. Replay3=Replay3Table(ReplayLevel)
  1832. Replay4=Replay4Table(ReplayLevel)
  1833. ReplayCard.image = "SC" + tempst2
  1834.  
  1835.  
  1836.  
  1837. end sub
  1838.  
  1839.  
  1840. '****************************************
  1841. ' SCORE MOTOR
  1842. '****************************************
  1843.  
  1844. ScoreMotorTimer.Enabled = 1
  1845. ScoreMotorTimer.Interval = 135 '135
  1846. AddScoreTimer.Enabled = 1
  1847. AddScoreTimer.Interval = 135
  1848.  
  1849. Dim queuedscore
  1850. Dim MotorMode
  1851. Dim MotorPosition
  1852.  
  1853. Sub SetMotor(y)
  1854. Select Case ScoreMotorAdjustment
  1855. Case 0:
  1856. queuedscore=queuedscore+y
  1857. Case 1:
  1858. If MotorRunning<>1 And InProgress=true then
  1859. queuedscore=queuedscore+y
  1860. end if
  1861. end Select
  1862. end sub
  1863.  
  1864. Sub SetMotor2(x)
  1865. If MotorRunning<>1 And InProgress=true then
  1866. MotorRunning=1
  1867.  
  1868. Select Case x
  1869. Case 50:
  1870. MotorMode=10
  1871. MotorPosition=5
  1872. BumpersOff
  1873.  
  1874. Case 100:
  1875. AddScore(100)
  1876. MotorRunning=0
  1877. Case 500:
  1878. MotorMode=100
  1879. MotorPosition=5
  1880. BumpersOff
  1881. LightBumpers
  1882.  
  1883. Case 1000:
  1884. AddScore(1000)
  1885. MotorRunning=0
  1886. Case 2000:
  1887. MotorMode=1000
  1888. MotorPosition=2
  1889. BumpersOff
  1890. Case 3000:
  1891. MotorMode=1000
  1892. MotorPosition=3
  1893. BumpersOff
  1894. Case 4000:
  1895. MotorMode=1000
  1896. MotorPosition=4
  1897. BumpersOff
  1898. Case 5000:
  1899. MotorMode=1000
  1900. MotorPosition=5
  1901. BumpersOff
  1902. LightBumpers
  1903. End Select
  1904. End If
  1905. End Sub
  1906.  
  1907. Sub AddScoreTimer_Timer
  1908. Dim tempscore
  1909.  
  1910.  
  1911. If MotorRunning<>1 And InProgress=true then
  1912. if queuedscore>=5000 then
  1913. tempscore=5000
  1914. queuedscore=queuedscore-5000
  1915. SetMotor2(5000)
  1916. exit sub
  1917. end if
  1918. if queuedscore>=4000 then
  1919. tempscore=4000
  1920. queuedscore=queuedscore-4000
  1921. SetMotor2(4000)
  1922. exit sub
  1923. end if
  1924.  
  1925. if queuedscore>=3000 then
  1926. tempscore=3000
  1927. queuedscore=queuedscore-3000
  1928. SetMotor2(3000)
  1929. exit sub
  1930. end if
  1931.  
  1932. if queuedscore>=2000 then
  1933. tempscore=2000
  1934. queuedscore=queuedscore-2000
  1935. SetMotor2(2000)
  1936. exit sub
  1937. end if
  1938.  
  1939. if queuedscore>=1000 then
  1940. tempscore=1000
  1941. queuedscore=queuedscore-1000
  1942. SetMotor2(1000)
  1943. exit sub
  1944. end if
  1945.  
  1946. if queuedscore>=500 then
  1947. tempscore=500
  1948. queuedscore=queuedscore-500
  1949. SetMotor2(500)
  1950. exit sub
  1951. end if
  1952.  
  1953. if queuedscore>=100 then
  1954. tempscore=100
  1955. queuedscore=queuedscore-100
  1956. SetMotor2(100)
  1957. exit sub
  1958. end if
  1959.  
  1960. if queuedscore>=50 then
  1961. tempscore=50
  1962. queuedscore=queuedscore-50
  1963. SetMotor2(50)
  1964. exit sub
  1965. end if
  1966.  
  1967. End If
  1968.  
  1969.  
  1970. end Sub
  1971.  
  1972. Sub ScoreMotorTimer_Timer
  1973. If MotorPosition > 0 Then
  1974. Select Case MotorPosition
  1975. Case 5,4,3,2:
  1976. If MotorMode=1000 Then
  1977. AddScore(1000)
  1978. end if
  1979. if MotorMode=100 then
  1980. AddScore(100)
  1981. End If
  1982. if MotorMode=10 then
  1983. AddScore(10)
  1984. End if
  1985. MotorPosition=MotorPosition-1
  1986. Case 1:
  1987. If MotorMode=1000 Then
  1988. AddScore(1000)
  1989. end if
  1990. If MotorMode=100 then
  1991. AddScore(100)
  1992. End If
  1993. if MotorMode=10 then
  1994. AddScore(10)
  1995. End if
  1996. MotorPosition=0:MotorRunning=0:BumpersOn:ToggleAlternatingRelay
  1997. End Select
  1998. End If
  1999. End Sub
  2000.  
  2001.  
  2002. Sub AddScore(x)
  2003. If TableTilted=true then exit sub
  2004. Select Case ScoreAdditionAdjustment
  2005. Case 0:
  2006. AddScore1(x)
  2007. Case 1:
  2008. AddScore2(x)
  2009. end Select
  2010.  
  2011. end sub
  2012.  
  2013.  
  2014. Sub AddScore1(x)
  2015. ' debugtext.text=score
  2016. Select Case x
  2017. Case 1:
  2018. PlayChime(10)
  2019. Score(Player)=Score(Player)+1
  2020.  
  2021. Case 10:
  2022. PlayChime(10)
  2023. Score(Player)=Score(Player)+10
  2024. ' debugscore=debugscore+10
  2025.  
  2026. Case 100:
  2027. PlayChime(100)
  2028. Score(Player)=Score(Player)+100
  2029. ' debugscore=debugscore+100
  2030.  
  2031.  
  2032. Case 1000:
  2033. PlayChime(100)
  2034. Score(Player)=Score(Player)+1000
  2035. ' debugscore=debugscore+1000
  2036. End Select
  2037. PlayerScores(Player-1).AddValue(x)
  2038.  
  2039. If ScoreDisplay(Player)<100000 then
  2040. ScoreDisplay(Player)=Score(Player)
  2041. Else
  2042. Score100K(Player)=Int(Score(Player)/100000)
  2043. ScoreDisplay(Player)=Score(Player)-100000
  2044. End If
  2045. if Score(Player)=>100000 then
  2046. EVAL("RolloverReel"&Player).SetValue(1)
  2047. If B2SOn Then
  2048. If Player=1 Then
  2049. Controller.B2SSetScoreRolloverPlayer1 Score100K(Player)
  2050. End If
  2051. If Player=2 Then
  2052. Controller.B2SSetScoreRolloverPlayer2 Score100K(Player)
  2053. End If
  2054.  
  2055. If Player=3 Then
  2056. Controller.B2SSetScoreRolloverPlayer3 Score100K(Player)
  2057. End If
  2058.  
  2059. If Player=4 Then
  2060. Controller.B2SSetScoreRolloverPlayer4 Score100K(Player)
  2061. End If
  2062. End If
  2063. End If
  2064. If B2SOn Then
  2065. Controller.B2SSetScorePlayer Player, ScoreDisplay(Player)
  2066. End If
  2067. If Score(Player)>Replay1 and Replay1Paid(Player)=false then
  2068. Replay1Paid(Player)=True
  2069. AddSpecial
  2070. End If
  2071. If Score(Player)>Replay2 and Replay2Paid(Player)=false then
  2072. Replay2Paid(Player)=True
  2073. AddSpecial
  2074. End If
  2075. If Score(Player)>Replay3 and Replay3Paid(Player)=false then
  2076. Replay3Paid(Player)=True
  2077. AddSpecial
  2078. End If
  2079. If Score(Player)>Replay4 and Replay4Paid(Player)=false then
  2080. Replay4Paid(Player)=True
  2081. AddSpecial
  2082. End If
  2083. ' ScoreText.text=debugscore
  2084. End Sub
  2085.  
  2086. Sub AddScore2(x)
  2087. Dim OldScore, NewScore, OldTestScore, NewTestScore
  2088. OldScore = Score(Player)
  2089.  
  2090. Select Case x
  2091. Case 1:
  2092. Score(Player)=Score(Player)+1
  2093. Case 10:
  2094. Score(Player)=Score(Player)+10
  2095. Case 100:
  2096. Score(Player)=Score(Player)+100
  2097. Case 1000:
  2098. Score(Player)=Score(Player)+1000
  2099. End Select
  2100. NewScore = Score(Player)
  2101. If NewScore>=100000 then
  2102. EVAL("RolloverReel"&Player).SetValue(1)
  2103. if B2SOn then
  2104. if Player=1 then Controller.B2SSetScoreRolloverPlayer1 1
  2105. if Player=2 then Controller.B2SSetScoreRolloverPlayer2 1
  2106. if Player=3 then Controller.B2SSetScoreRolloverPlayer3 1
  2107. if Player=4 then Controller.B2SSetScoreRolloverPlayer4 1
  2108. end if
  2109. end if
  2110. OldTestScore = OldScore
  2111. NewTestScore = NewScore
  2112. Do
  2113. if OldTestScore < Replay1 and NewTestScore >= Replay1 AND Replay1Paid(Player)=false then
  2114. AddSpecial()
  2115. Replay1Paid(Player)=true
  2116. NewTestScore = 0
  2117. Elseif OldTestScore < Replay2 and NewTestScore >= Replay2 AND Replay2Paid(Player)=false then
  2118. AddSpecial()
  2119. Replay2Paid(Player)=true
  2120. NewTestScore = 0
  2121. Elseif OldTestScore < Replay3 and NewTestScore >= Replay3 AND Replay3Paid(Player)=false then
  2122. AddSpecial()
  2123. Replay3Paid(Player)=true
  2124. NewTestScore = 0
  2125. Elseif OldTestScore < Replay4 and NewTestScore >= Replay4 AND Replay4Paid(Player)=false then
  2126. AddSpecial()
  2127. Replay4Paid(Player)=true
  2128. NewTestScore = 0
  2129. End if
  2130. NewTestScore = NewTestScore - 100000
  2131. OldTestScore = OldTestScore - 100000
  2132. Loop While NewTestScore > 0
  2133.  
  2134. OldScore = int(OldScore / 10) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  2135. NewScore = int(NewScore / 10) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  2136. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore&", OldScore Mod 10="&OldScore Mod 10 & ", NewScore % 10="&NewScore Mod 10)
  2137.  
  2138. if (OldScore Mod 10 <> NewScore Mod 10) then
  2139. PlayChime(10)
  2140.  
  2141. end if
  2142.  
  2143. OldScore = int(OldScore / 10)
  2144. NewScore = int(NewScore / 10)
  2145. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2146. if (OldScore Mod 10 <> NewScore Mod 10) then
  2147. PlayChime(10)
  2148.  
  2149.  
  2150. end if
  2151.  
  2152. OldScore = int(OldScore / 10)
  2153. NewScore = int(NewScore / 10)
  2154. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2155. if (OldScore Mod 10 <> NewScore Mod 10) then
  2156. PlayChime(100)
  2157.  
  2158.  
  2159. end if
  2160.  
  2161. OldScore = int(OldScore / 10)
  2162. NewScore = int(NewScore / 10)
  2163. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  2164. if (OldScore Mod 10 <> NewScore Mod 10) then
  2165. PlayChime(1000)
  2166. end if
  2167.  
  2168. If B2SOn Then
  2169. Controller.B2SSetScorePlayer Player, Score(Player)
  2170. End If
  2171. ' EMReel1.SetValue Score(Player)
  2172. PlayerScores(Player-1).AddValue(x)
  2173.  
  2174. End Sub
  2175.  
  2176.  
  2177.  
  2178. Sub PlayChime(x)
  2179. if ChimesOn=0 then
  2180. Select Case x
  2181. Case 10
  2182. If LastChime10=1 Then
  2183. PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
  2184. LastChime10=0
  2185. Else
  2186. PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
  2187. LastChime10=1
  2188. End If
  2189. Case 100
  2190. If LastChime100=1 Then
  2191. PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
  2192. LastChime100=0
  2193. Else
  2194. PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
  2195. LastChime100=1
  2196. End If
  2197.  
  2198. End Select
  2199. else
  2200. Select Case x
  2201. Case 10
  2202. If LastChime10=1 Then
  2203. PlaySound SoundFXDOF("10a",141,DOFPulse,DOFChimes)
  2204. LastChime10=0
  2205. Else
  2206. PlaySound SoundFXDOF("10a",141,DOFPulse,DOFChimes)
  2207. LastChime10=1
  2208. End If
  2209. Case 100
  2210. If LastChime100=1 Then
  2211. PlaySound SoundFXDOF("100a",142,DOFPulse,DOFChimes)
  2212. LastChime100=0
  2213. Else
  2214. PlaySound SoundFXDOF("100a",142,DOFPulse,DOFChimes)
  2215. LastChime100=1
  2216. End If
  2217. Case 1000
  2218. If LastChime1000=1 Then
  2219. PlaySound SoundFXDOF("1000a",143,DOFPulse,DOFChimes)
  2220. LastChime1000=0
  2221. Else
  2222. PlaySound SoundFXDOF("1000a",143,DOFPulse,DOFChimes)
  2223. LastChime1000=1
  2224. End If
  2225. End Select
  2226. end if
  2227. End Sub
  2228.  
  2229. Sub HideOptions()
  2230.  
  2231. end sub
  2232. '**********************************************************************************************************
  2233. '**********************************************************************************************************
  2234. '**********************************************************************************************************
  2235. '**********************************************************************************************************
  2236.  
  2237. '*************************************************************
  2238. 'Solenoid Call backs
  2239. '**********************************************************************************************************
  2240.  
  2241. ' SolCallback(1) = "if solEnable then KickBall"
  2242. ' SolCallback(2) = "if solEnable then vpmSolSound ""Knocker"","
  2243. ' SolCallback(3) = "if solEnable then bsTop.SolOut"
  2244. ' SolCallback(4) = "if solEnable then bsLeft.SolOut"
  2245. ' SolCallback(5) = "if solEnable then vpmSolSound ""Bell10"","
  2246. ' SolCallback(6) = "if solEnable then vpmSolSound ""Bell100"","
  2247. ' SolCallback(7) = "if solEnable then vpmSolSound ""Bell1000"","
  2248. ' SolCallback(15) = "if solEnable then vpmSolSound ""Bell10000"","
  2249. ' SolCallback(16) = "if solEnable then OpenGate"
  2250. ' SolCallback(18) = "if solEnable then vpmNudge.SolGameOn"
  2251.  
  2252. 'SolCallback(sLRFlipper) = "SolRFlipper"
  2253. 'SolCallback(sLLFlipper) = "SolLFlipper"
  2254.  
  2255. Const ReflipAngle = 20
  2256.  
  2257.  
  2258. Sub SolLFlipper(Enabled)
  2259. If Enabled Then
  2260. LF.Fire 'leftflipper.rotatetoend
  2261. If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
  2262. RandomSoundReflipUpLeft LeftFlipper
  2263. DOF 101, DOFOn
  2264. Else
  2265. SoundFlipperUpAttackLeft LeftFlipper
  2266. RandomSoundFlipperUpLeft LeftFlipper
  2267. DOF 101, DOFOn
  2268. End If
  2269. Else
  2270. LeftFlipper.RotateToStart
  2271. If LeftFlipper.currentangle < LeftFlipper.startAngle - 5 Then
  2272. RandomSoundFlipperDownLeft LeftFlipper
  2273. DOF 101, DOFOff
  2274. End If
  2275. FlipperLeftHitParm = FlipperUpSoundLevel
  2276. End If
  2277. End Sub
  2278.  
  2279. Sub SolRFlipper(Enabled)
  2280. If Enabled Then
  2281. RF.Fire 'rightflipper.rotatetoend
  2282. If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
  2283. RandomSoundReflipUpRight RightFlipper
  2284. DOF 102, DOFOn
  2285. Else
  2286. SoundFlipperUpAttackRight RightFlipper
  2287. RandomSoundFlipperUpRight RightFlipper
  2288. DOF 102, DOFOn
  2289. End If
  2290. Else
  2291. RightFlipper.RotateToStart
  2292. If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
  2293. RandomSoundFlipperDownRight RightFlipper
  2294. DOF 102, DOFOff
  2295. End If
  2296. FlipperRightHitParm = FlipperUpSoundLevel
  2297. End If
  2298. End Sub
  2299.  
  2300.  
  2301. Sub LeftFlipper_Collide(parm)
  2302. CheckLiveCatch Activeball, LeftFlipper, LFCount, parm
  2303. LeftFlipperCollide parm
  2304. if RubberizerEnabled = 1 then Rubberizer(parm)
  2305. if RubberizerEnabled = 2 then Rubberizer2(parm)
  2306. End Sub
  2307.  
  2308. Sub RightFlipper_Collide(parm)
  2309. CheckLiveCatch Activeball, RightFlipper, RFCount, parm
  2310. RightFlipperCollide parm
  2311. if RubberizerEnabled = 1 then Rubberizer(parm)
  2312. if RubberizerEnabled = 2 then Rubberizer2(parm)
  2313. End Sub
  2314.  
  2315. ' iaakki Rubberizer
  2316. sub Rubberizer(parm)
  2317. if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
  2318. 'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  2319. activeball.angmomz = activeball.angmomz * 1.2
  2320. activeball.vely = activeball.vely * 1.2
  2321. 'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  2322. Elseif parm <= 2 and parm > 0.2 Then
  2323. 'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  2324. activeball.angmomz = activeball.angmomz * -1.1
  2325. activeball.vely = activeball.vely * 1.4
  2326. 'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  2327. end if
  2328. end sub
  2329.  
  2330. ' apophis rubberizer
  2331. sub Rubberizer2(parm)
  2332. if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
  2333. 'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  2334. activeball.angmomz = -activeball.angmomz * 2
  2335. activeball.vely = activeball.vely * 1.2
  2336. 'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  2337. Elseif parm <= 2 and parm > 0.2 Then
  2338. 'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  2339. activeball.angmomz = -activeball.angmomz * 0.5
  2340. activeball.vely = activeball.vely * (1.2 + rnd(1)/3 )
  2341. 'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  2342. end if
  2343. end sub
  2344.  
  2345.  
  2346. '**********************************************************************************************************
  2347.  
  2348. 'Solenoid Controlled toys
  2349. '**********************************************************************************************************
  2350.  
  2351. Sub KickBall(Enabled)
  2352. If Enabled Then
  2353. Controller.Switch(18) = False
  2354. PlaySound "BallRelease"
  2355. BallRelease.Kick 60, 5
  2356. End If
  2357. End Sub
  2358.  
  2359. Sub OpenGate(Enabled)
  2360. Gate1.Open = Enabled
  2361. L71.state = Enabled
  2362. PlaySound "Gate"
  2363. End Sub
  2364.  
  2365.  
  2366. '*****GI Lights On
  2367.  
  2368. For each xx in GI:xx.State = 1: Next
  2369.  
  2370.  
  2371. '**********************************************************************************************************
  2372.  
  2373. 'Initiate Table
  2374. '**********************************************************************************************************
  2375.  
  2376.  
  2377. dim bsTop, bsLeft, solEnable
  2378.  
  2379. ' Sub table1_Init()
  2380. '
  2381. '
  2382. ' Top Saucer
  2383. ' Set bsTop = New cvpmBallStack
  2384. ' bsTop.InitSaucer sw2, 2, 154, 12
  2385. ' bsTop.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  2386. ' bsTop.KickAngleVar=30
  2387. ' bsTop.KickForceVar = 4
  2388.  
  2389. ' Left Saucer
  2390. ' Set bsLeft = New cvpmBallStack
  2391. ' bsLeft.InitSaucer sw10, 10, 205, 12
  2392. ' bsLeft.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  2393. ' bsLeft.KickAngleVar=15
  2394. ' bsLeft.KickForceVar = 4
  2395.  
  2396. ' solEnable = False
  2397. ' BallRelease.CreateBall
  2398.  
  2399. 'End Sub
  2400.  
  2401.  
  2402. '**********************************************************************************************************
  2403. ' Fleep BIPL
  2404. '**********************************************************************************************************
  2405. Dim BIPL : BIPL=0
  2406.  
  2407. Sub swBIPL_Hit
  2408. BIPL = 1
  2409. End Sub
  2410.  
  2411. Sub swBIPL_UnHit
  2412. BIPL = 0
  2413. End Sub
  2414.  
  2415. '*******************
  2416. ' Switches & Targets
  2417. '*******************
  2418.  
  2419.  
  2420.  
  2421.  
  2422. ' Bumper animation
  2423.  
  2424. Sub Bumper1_Hit()
  2425. DOF 107,DOFPulse
  2426. If TableTilted=true then Exit Sub
  2427. If l68.state=1 then
  2428. AddScore(100)
  2429. else
  2430. AddScore(10)
  2431. end if
  2432.  
  2433. End Sub
  2434.  
  2435. Sub Bumper2_Hit()
  2436. DOF 108,DOFPulse
  2437. If TableTilted=true then Exit Sub
  2438. If l66.state=1 then
  2439. AddScore(100)
  2440. else
  2441. AddScore(10)
  2442. end if
  2443.  
  2444. End Sub
  2445.  
  2446. Sub Bumper3_Hit()
  2447. DOF 109,DOFPulse
  2448. If TableTilted=true then Exit Sub
  2449. If l67.state=1 then
  2450. AddScore(100)
  2451. else
  2452. AddScore(10)
  2453. end if
  2454.  
  2455. End Sub
  2456.  
  2457. Sub Bumper4_Hit()
  2458. DOF 110,DOFPulse
  2459. If TableTilted=true then Exit Sub
  2460. If l65.state=1 then
  2461. AddScore(100)
  2462. else
  2463. AddScore(10)
  2464. end if
  2465.  
  2466. End Sub
  2467.  
  2468.  
  2469.  
  2470. ' Wired Triggers
  2471.  
  2472. Sub sw8_Hit() 'Left Outlane
  2473. If TableTilted=true then EXIT SUB
  2474. AddScore(1000)
  2475. if l43.state=1 then AddSpecial
  2476.  
  2477. End Sub
  2478.  
  2479. Sub sw16_Hit() 'Left Inlane
  2480. If TableTilted=true then EXIT SUB
  2481. SetMotor(500)
  2482. IncreaseGoldBonus
  2483. End Sub
  2484.  
  2485. Sub sw16a_Hit() 'Right inlane
  2486. If TableTilted=true then EXIT SUB
  2487. SetMotor(500)
  2488. IncreaseGoldBonus
  2489. End Sub
  2490.  
  2491. Sub sw24_Hit() 'Right Outlane
  2492. If TableTilted=true then EXIT SUB
  2493. AddScore(1000)
  2494. if l43.state=1 then AddSpecial
  2495.  
  2496. End Sub
  2497.  
  2498. Sub sw9_Hit() 'plunger lane trigger
  2499. If TableTilted=true then EXIT SUB
  2500. If l71.state = 1 then
  2501. l71.state=0
  2502. SetMotor(3000)
  2503. OpenGate(0)
  2504. end if
  2505. End Sub
  2506.  
  2507. ' Star Triggers
  2508.  
  2509. Sub sw11_Hit() 'Top left Star
  2510. If TableTilted=True then Exit Sub
  2511. SetMotor(500)
  2512.  
  2513. End Sub
  2514.  
  2515.  
  2516.  
  2517. Sub sw11a_Hit() 'Top Right Star
  2518. If TableTilted=True then Exit Sub
  2519. SetMotor(500)
  2520.  
  2521. End Sub
  2522.  
  2523. ' Targets
  2524.  
  2525. Sub sw21_Hit
  2526. If TableTilted=True then exit sub
  2527. If L86.state=1 then
  2528. L86.state=0
  2529. SetMotor(3000)
  2530. L66.state=1
  2531. CheckForDouble
  2532. else
  2533. SetMotor(500)
  2534. end if
  2535. End Sub
  2536.  
  2537. Sub sw6_Hit
  2538. If TableTilted=True then exit sub
  2539. If L88.state=1 then
  2540. L88.state=0
  2541. SetMotor(3000)
  2542. L68.state=1
  2543. CheckForDouble
  2544. else
  2545. SetMotor(500)
  2546. end if
  2547. End Sub
  2548.  
  2549. Sub sw22_Hit
  2550. If TableTilted=True then exit sub
  2551. If L85.state=1 then
  2552. L85.state=0
  2553. SetMotor(3000)
  2554. L65.state=1
  2555. CheckForDouble
  2556. else
  2557. SetMotor(500)
  2558. end if
  2559. End Sub
  2560.  
  2561. Sub sw5_Hit
  2562. If TableTilted=True then exit sub
  2563. If L87.state=1 then
  2564. L87.state=0
  2565. SetMotor(3000)
  2566. L67.state=1
  2567. CheckForDouble
  2568. else
  2569. SetMotor(500)
  2570. end if
  2571. End Sub
  2572.  
  2573. Sub CheckForDouble
  2574. if L65.state=1 and L66.state=1 and L67.state=1 and L68.state=1 then
  2575. BonusMultiplier=2
  2576. L63.state=1
  2577. else
  2578. L63.state=0
  2579. end if
  2580. end sub
  2581.  
  2582. Sub sw12_Hit
  2583. if TableTilted=True then Exit Sub
  2584. SpinningLightTimer.enabled=false
  2585. sw12.timerenabled=true
  2586.  
  2587. End Sub
  2588.  
  2589. Sub sw12_timer
  2590. SetMotor(1000+(ArrowTargetCounter1*1000))
  2591. if ArrowTargetCounter1=2 then OpenGate(1)
  2592. If ArrowTargetCounter1=0 then ToggleAlternatingRelay
  2593. If L72.state=1 then
  2594. L4.state=1
  2595. ShootAgainReel.setvalue(1)
  2596. If B2SOn then Controller.B2SSetShootAgain 1
  2597. end if
  2598. sw12.timerenabled=false
  2599. SpinningLightTimer.enabled=true
  2600. end sub
  2601.  
  2602. Sub sw15_Hit
  2603. If TableTilted=True then exit sub
  2604. IncreaseGoldBonus
  2605. AddScore(1000)
  2606. End Sub
  2607.  
  2608.  
  2609. ' Spinners
  2610.  
  2611. Sub Spinner1_Spin()
  2612. Playsound "fx_spinner"
  2613. If TableTilted=True then Exit Sub
  2614. AddScore(10)
  2615. SpinnerLights
  2616. End Sub
  2617.  
  2618. Sub Spinner2_Spin()
  2619. Playsound "fx_spinner"
  2620. If TableTilted=True then Exit Sub
  2621. AddScore(10)
  2622. SpinnerLights
  2623. End Sub
  2624.  
  2625. Sub SpinnerLights
  2626. SpinPos=SpinPos+1
  2627. If SpinPos>9 then
  2628. IncreaseGoldBonus
  2629. SpinPos=0
  2630. end if
  2631. For each obj in LeftSpinLights
  2632. obj.state=0
  2633. next
  2634. For each obj in RightSpinLights
  2635. obj.state=0
  2636. next
  2637. LeftSpinLights(SpinPos).state=1
  2638. RightSpinLights(SpinPos).state=1
  2639. end sub
  2640.  
  2641.  
  2642. '**********Sling Shot Animations
  2643. ' Rstep and Lstep are the variables that increment the animation
  2644. '****************
  2645.  
  2646.  
  2647. Sub RightSlingShot_Slingshot
  2648. DOF 105,DOFPulse
  2649. If TableTilted=true then exit sub
  2650. AddScore(10)
  2651. RandomSoundSlingshotRight SLING1
  2652. RSling.Visible = 0
  2653. RSling1.Visible = 1
  2654. sling1.TransZ = -20
  2655. RStep = 0
  2656. RightSlingShot.TimerEnabled = 1
  2657. End Sub
  2658.  
  2659. Sub RightSlingShot_Timer
  2660. Select Case RStep
  2661. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  2662. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  2663. End Select
  2664. RStep = RStep + 1
  2665. End Sub
  2666.  
  2667. Sub LeftSlingShot_Slingshot
  2668. DOF 103,DOFPulse
  2669. If TableTilted=true then exit sub
  2670. AddScore(10)
  2671. RandomSoundSlingshotLeft SLING2
  2672. LSling.Visible = 0
  2673. LSling1.Visible = 1
  2674. sling2.TransZ = -20
  2675. LStep = 0
  2676. LeftSlingShot.TimerEnabled = 1
  2677. End Sub
  2678.  
  2679. Sub LeftSlingShot_Timer
  2680. Select Case LStep
  2681. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  2682. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  2683. End Select
  2684. LStep = LStep + 1
  2685. End Sub
  2686.  
  2687.  
  2688. '****************************************
  2689. ' JP's Fading Lamps 3.4 VP9 Fading only
  2690. ' Based on PD's Fading Lights
  2691. ' SetLamp 0 is Off
  2692. ' SetLamp 1 is On
  2693. ' LampState(x) current state
  2694. '****************************************
  2695.  
  2696. Dim LampState(200)
  2697.  
  2698. AllLampsOff()
  2699. LampTimer.Interval = 40
  2700. LampTimer.Enabled = 0
  2701.  
  2702. Sub LampTimer_Timer()
  2703. Dim chgLamp, num, chg, ii
  2704. chgLamp = Controller.ChangedLamps
  2705. If Not IsEmpty(chgLamp) Then
  2706. For ii = 0 To UBound(chgLamp)
  2707. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4
  2708. Next
  2709. End If
  2710.  
  2711. UpdateLamps
  2712. End Sub
  2713.  
  2714. Sub UpdateLamps
  2715. 'NFadeL 1, l1
  2716. NFadeL 4, l4
  2717. NFadeLm 5, l5b
  2718. NFadeL 5, l5
  2719. NFadeL 6, l6 'Apron Credit
  2720. ' NFadeT 7, l7, "GAME OVER"
  2721. 'NFadeT 8, l8, "TILT"
  2722. ' NFadeL 21, l21
  2723. ' NFadeL 22, l22
  2724. ' NFadeL 23, l23
  2725. 'NFadeL 24, l24
  2726. NFadeLm 25, l25b
  2727. NFadeL 25, l25
  2728. NFadeLm 26, l26b
  2729. NFadeL 26, l26
  2730. NFadeLm 27, l27b
  2731. NFadeL 27, l27
  2732. NFadeLm 28, l28b
  2733. NFadeL 28, l28
  2734. NFadeL 43, l43
  2735. NFadeL 44, l44
  2736. ' NFadeL 45, l45
  2737. ' NFadeL 46, l46
  2738. ' NFadeL 47, l47
  2739. ' NFadeL 48, l48
  2740. NFadeL 61, l61
  2741. NFadeL 62, l62
  2742. NFadeL 63, l63
  2743. NFadeL 65, l65 'Bumper4
  2744. NFadeL 66, l66 'Bumper2
  2745. NFadeL 67, l67 'Bumper3
  2746. NFadeL 68, l68 'Bumper1
  2747. NFadeLm 69, l69b
  2748. NFadeL 69, l69
  2749. NFadeLm 70, l70b
  2750. NFadeL 70, l70
  2751. NFadeL 71, l71
  2752. NFadeL 72, l72
  2753. NFadeL 81, l81
  2754. NFadeL 82, l82
  2755. NFadeL 83, l83
  2756. NFadeL 84, l84
  2757. NFadeL 85, l85
  2758. NFadeL 86, l86
  2759. NFadeL 87, l87
  2760. NFadeL 88, l88
  2761. NFadeLm 89, l89b
  2762. NFadeL 89, l89
  2763. NFadeLm 90, l90b
  2764. NFadeL 90, l90
  2765. NFadeLm 91, l91b
  2766. NFadeL 91, l91
  2767. NFadeLm 92, l92b
  2768. NFadeL 92, l92
  2769. NFadeL 101, l101
  2770. NFadeL 102, l102
  2771. NFadeL 103, l103
  2772. NFadeL 104, l104
  2773. ' NFadeL 105, l105
  2774. ' NFadeL 106, l106
  2775. ' NFadeL 107, l107
  2776. ' NFadeL 108, l108
  2777. NFadeLm 109, l109b
  2778. NFadeL 109, l109
  2779. NFadeLm 110, l110b
  2780. NFadeL 110, l110
  2781. NFadeLm 111, l111b
  2782. NFadeL 111, l111
  2783. NFadeLm 112, l112b
  2784. NFadeL 112, l112
  2785. solEnable = Controller.Lamp(120)
  2786. End Sub
  2787.  
  2788. Sub AllLampsOff():For x = 1 to 200:LampState(x) = 4:Next:UpdateLamps:UpdateLamps:Updatelamps:End Sub
  2789.  
  2790. Sub SetLamp(nr, value):LampState(nr) = abs(value) + 4:End Sub
  2791.  
  2792. Sub FadeW(nr, a, b, c)
  2793. Select Case LampState(nr)
  2794. Case 2:c.IsDropped = 1:LampState(nr) = 0 'Off
  2795. Case 3:b.IsDropped = 1:c.IsDropped = 0:LampState(nr) = 2 'fading...
  2796. Case 4:a.IsDropped = 1:b.IsDropped = 0:LampState(nr) = 3 'fading...
  2797. Case 5:b.IsDropped = 1:c.IsDropped = 0:LampState(nr) = 6 'turning ON
  2798. Case 6:c.IsDropped = 1:a.IsDropped = 0:LampState(nr) = 1 'ON
  2799. End Select
  2800. End Sub
  2801.  
  2802. Sub FadeWm(nr, a, b, c)
  2803. Select Case LampState(nr)
  2804. Case 2:c.IsDropped = 1
  2805. Case 3:b.IsDropped = 1:c.IsDropped = 0
  2806. Case 4:a.IsDropped = 1:b.IsDropped = 0
  2807. Case 5:b.IsDropped = 1:c.IsDropped = 0
  2808. Case 6:c.IsDropped = 1:a.IsDropped = 0
  2809. End Select
  2810. End Sub
  2811.  
  2812. Sub NFadeW(nr, a)
  2813. Select Case LampState(nr)
  2814. Case 4:a.IsDropped = 1:LampState(nr) = 0
  2815. Case 5:a.IsDropped = 0:LampState(nr) = 1
  2816. End Select
  2817. End Sub
  2818.  
  2819. Sub NFadeWm(nr, a)
  2820. Select Case LampState(nr)
  2821. Case 4:a.IsDropped = 1
  2822. Case 5:a.IsDropped = 0
  2823. End Select
  2824. End Sub
  2825.  
  2826. Sub NFadeWi(nr, a)
  2827. Select Case LampState(nr)
  2828. Case 5:a.IsDropped = 1:LampState(nr) = 0
  2829. Case 4:a.IsDropped = 0:LampState(nr) = 1
  2830. End Select
  2831. End Sub
  2832.  
  2833. Sub FadeL(nr, a, b)
  2834. Select Case LampState(nr)
  2835. Case 2:b.state = 0:LampState(nr) = 0
  2836. Case 3:b.state = 1:LampState(nr) = 2
  2837. Case 4:a.state = 0:LampState(nr) = 3
  2838. Case 5:b.state = 1:LampState(nr) = 6
  2839. Case 6:a.state = 1:LampState(nr) = 1
  2840. End Select
  2841. End Sub
  2842.  
  2843. Sub FadeLm(nr, a, b)
  2844. Select Case LampState(nr)
  2845. Case 2:b.state = 0
  2846. Case 3:b.state = 1
  2847. Case 4:a.state = 0
  2848. Case 5:b.state = 1
  2849. Case 6:a.state = 1
  2850. End Select
  2851. End Sub
  2852.  
  2853. Sub NFadeL(nr, a)
  2854. Select Case LampState(nr)
  2855. Case 4:a.state = 0:LampState(nr) = 0
  2856. Case 5:a.State = 1:LampState(nr) = 1
  2857. End Select
  2858. End Sub
  2859.  
  2860. Sub NFadeLm(nr, a)
  2861. Select Case LampState(nr)
  2862. Case 4:a.state = 0
  2863. Case 5:a.State = 1
  2864. End Select
  2865. End Sub
  2866.  
  2867. Sub FadeR(nr, a)
  2868. Select Case LampState(nr)
  2869. Case 2:a.SetValue 3:LampState(nr) = 0
  2870. Case 3:a.SetValue 2:LampState(nr) = 2
  2871. Case 4:a.SetValue 1:LampState(nr) = 3
  2872. Case 5:a.SetValue 1:LampState(nr) = 6
  2873. Case 6:a.SetValue 0:LampState(nr) = 1
  2874. End Select
  2875. End Sub
  2876.  
  2877. Sub FadeRm(nr, a)
  2878. Select Case LampState(nr)
  2879. Case 2:a.SetValue 3
  2880. Case 3:a.SetValue 2
  2881. Case 4:a.SetValue 1
  2882. Case 5:a.SetValue 1
  2883. Case 6:a.SetValue 0
  2884. End Select
  2885. End Sub
  2886.  
  2887. Sub NFadeT(nr, a, b)
  2888. Select Case LampState(nr)
  2889. Case 4:a.Text = "":LampState(nr) = 0
  2890. Case 5:a.Text = b:LampState(nr) = 1
  2891. End Select
  2892. End Sub
  2893.  
  2894. Sub NFadeTm(nr, a, b)
  2895. Select Case LampState(nr)
  2896. Case 4:a.Text = ""
  2897. Case 5:a.Text = b
  2898. End Select
  2899. End Sub
  2900.  
  2901. Sub NFadeWi(nr, a)
  2902. Select Case LampState(nr)
  2903. Case 4:a.IsDropped = 0:LampState(nr) = 0
  2904. Case 5:a.IsDropped = 1:LampState(nr) = 1
  2905. End Select
  2906. End Sub
  2907.  
  2908. Sub NFadeWim(nr, a)
  2909. Select Case LampState(nr)
  2910. Case 4:a.IsDropped = 0
  2911. Case 5:a.IsDropped = 1
  2912. End Select
  2913. End Sub
  2914.  
  2915. Sub FadeLCo(nr, a, b) 'fading collection of lights
  2916. Dim obj
  2917. Select Case LampState(nr)
  2918. Case 2:vpmSolToggleObj b, Nothing, 0, 0:LampState(nr) = 0
  2919. Case 3:vpmSolToggleObj b, Nothing, 0, 1:LampState(nr) = 2
  2920. Case 4:vpmSolToggleObj a, Nothing, 0, 0:LampState(nr) = 3
  2921. Case 5:vpmSolToggleObj b, Nothing, 0, 1:LampState(nr) = 6
  2922. Case 6:vpmSolToggleObj a, Nothing, 0, 1:LampState(nr) = 1
  2923. End Select
  2924. End Sub
  2925.  
  2926. Sub FlashL(nr, a, b) ' simple light flash, not controlled by the rom
  2927. Select Case LampState(nr)
  2928. Case 2:b.state = 0:LampState(nr) = 0
  2929. Case 3:b.state = 1:LampState(nr) = 2
  2930. Case 4:a.state = 0:LampState(nr) = 3
  2931. Case 5:a.state = 1:LampState(nr) = 4
  2932. End Select
  2933. End Sub
  2934.  
  2935. Sub MFadeL(nr, a, b, c) 'Light acting as a flash. C is the light number to be restored
  2936. Select Case LampState(nr)
  2937. Case 2:b.state = 0:LampState(nr) = 0: If LampState(c) = 1 Then SetLamp c, 1
  2938. Case 3:b.state = 1:LampState(nr) = 2
  2939. Case 4:a.state = 0:LampState(nr) = 3
  2940. Case 5:a.state = 1:LampState(nr) = 1
  2941. End Select
  2942. End Sub
  2943.  
  2944. Sub NFadeB(nr, a, b, c, d) 'New Bally Bumpers: a and b are the off state, c and d and on state, no fading
  2945. Select Case LampState(nr)
  2946. Case 4:a.IsDropped = 0:b.IsDropped = 0:c.IsDropped = 1:d.IsDropped = 1:LampState(nr) = 0
  2947. Case 5:a.IsDropped = 1:b.IsDropped = 1:c.IsDropped = 0:d.IsDropped = 0:LampState(nr) = 1
  2948. End Select
  2949. End Sub
  2950.  
  2951.  
  2952.  
  2953. '******************************************************
  2954. ' BALL ROLLING AND DROP SOUNDS
  2955. '******************************************************
  2956.  
  2957. Const tnob = 5 ' total number of balls
  2958. ReDim rolling(tnob)
  2959. InitRolling
  2960.  
  2961. Dim DropCount
  2962. ReDim DropCount(tnob)
  2963.  
  2964. Sub InitRolling
  2965. Dim i
  2966. For i = 0 to tnob
  2967. rolling(i) = False
  2968. Next
  2969. End Sub
  2970.  
  2971. Sub RollingTimer_Timer()
  2972. Dim BOT, b
  2973. BOT = GetBalls
  2974.  
  2975. ' stop the sound of deleted balls
  2976. For b = UBound(BOT) + 1 to tnob
  2977. rolling(b) = False
  2978. StopSound("BallRoll_" & b)
  2979. Next
  2980.  
  2981. ' exit the sub if no balls on the table
  2982. If UBound(BOT) = -1 Then Exit Sub
  2983.  
  2984. ' play the rolling sound for each ball
  2985.  
  2986. For b = 0 to UBound(BOT)
  2987. If BallVel(BOT(b)) > 1 AND BOT(b).z < 30 Then
  2988. rolling(b) = True
  2989. PlaySound ("BallRoll_" & b), -1, VolPlayfieldRoll(BOT(b)) * 1.1 * VolumeDial, AudioPan(BOT(b)), 0, PitchPlayfieldRoll(BOT(b)), 1, 0, AudioFade(BOT(b))
  2990.  
  2991. Else
  2992. If rolling(b) = True Then
  2993. StopSound("BallRoll_" & b)
  2994. rolling(b) = False
  2995. End If
  2996. End If
  2997.  
  2998. '***Ball Drop Sounds***
  2999. If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
  3000. If DropCount(b) >= 5 Then
  3001. DropCount(b) = 0
  3002. If BOT(b).velz > -7 Then
  3003. RandomSoundBallBouncePlayfieldSoft BOT(b)
  3004. Else
  3005. RandomSoundBallBouncePlayfieldHard BOT(b)
  3006. End If
  3007. End If
  3008. End If
  3009. If DropCount(b) < 5 Then
  3010. DropCount(b) = DropCount(b) + 1
  3011. End If
  3012. Next
  3013. End Sub
  3014.  
  3015. '*************
  3016. ' JP'S LUT
  3017. '*************
  3018.  
  3019. Dim bLutActive, LUTImage
  3020. Sub LoadLUT
  3021. Dim x
  3022. x = LoadValue(cGameName, "LUTImage")
  3023. If(x <> "") Then LUTImage = x Else LUTImage = 0
  3024. UpdateLUT
  3025. End Sub
  3026.  
  3027. Sub SaveLUT
  3028. SaveValue cGameName, "LUTImage", LUTImage
  3029. End Sub
  3030.  
  3031. Sub NextLUT: LUTImage = (LUTImage +1 ) MOD 10: UpdateLUT: SaveLUT: End Sub
  3032.  
  3033. Sub UpdateLUT
  3034. Select Case LutImage
  3035. Case 0: table1.ColorGradeImage = "LUT0"
  3036. Case 1: table1.ColorGradeImage = "LUT1"
  3037. Case 2: table1.ColorGradeImage = "LUT2"
  3038. Case 3: table1.ColorGradeImage = "LUT3"
  3039. Case 4: table1.ColorGradeImage = "LUT4"
  3040. Case 5: table1.ColorGradeImage = "LUT5"
  3041. Case 6: table1.ColorGradeImage = "LUT6"
  3042. Case 7: table1.ColorGradeImage = "LUT7"
  3043. Case 8: table1.ColorGradeImage = "LUT8"
  3044. Case 9: table1.ColorGradeImage = "LUT9"
  3045.  
  3046. End Select
  3047. End Sub
  3048.  
  3049.  
  3050. '*****************************************
  3051. ' ninuzzu's FLIPPER SHADOWS
  3052. '*****************************************
  3053.  
  3054. sub FlipperTimer_Timer()
  3055. FlipperLSh.RotZ = LeftFlipper.currentangle
  3056. FlipperRSh.RotZ = RightFlipper.currentangle
  3057. End Sub
  3058.  
  3059. '*****************************************
  3060. ' ninuzzu's BALL SHADOW
  3061. '*****************************************
  3062.  
  3063. Dim BallShadow
  3064. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  3065.  
  3066. Sub BallShadowUpdate_timer()
  3067. Dim BOT, b
  3068. BOT = GetBalls
  3069. ' hide shadow of deleted balls
  3070. If UBound(BOT)<(tnob-1) Then
  3071. For b = (UBound(BOT) + 1) to (tnob-1)
  3072. BallShadow(b).visible = 0
  3073. Next
  3074. End If
  3075. ' exit the Sub if no balls on the table
  3076. If UBound(BOT) = -1 Then Exit Sub
  3077. ' render the shadow for each ball
  3078. For b = 0 to UBound(BOT)
  3079. If BOT(b).X < Table1.Width/2 Then
  3080. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) + 6
  3081. Else
  3082. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) - 6
  3083. End If
  3084. ballShadow(b).Y = BOT(b).Y + 4
  3085. If BOT(b).Z > 20 Then
  3086. BallShadow(b).visible = 1
  3087. Else
  3088. BallShadow(b).visible = 0
  3089. End If
  3090. Next
  3091. End Sub
  3092.  
  3093. '******************************************************
  3094. ' FLIPPER CORRECTION INITIALIZATION
  3095. ' Start nFOZZY FLIPPERS'
  3096. '******************************************************
  3097.  
  3098. 'Flipper Correction Initialization late 80’s to early 90’s
  3099. dim LF : Set LF = New FlipperPolarity
  3100. dim RF : Set RF = New FlipperPolarity
  3101.  
  3102. InitPolarity
  3103.  
  3104. ''*******************************************
  3105. '' Late 70's to early 80's
  3106. '
  3107. Sub InitPolarity()
  3108. dim x, a : a = Array(LF, RF)
  3109. for each x in a
  3110. x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
  3111. x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
  3112. x.enabled = True
  3113. x.TimeDelay = 80
  3114. Next
  3115.  
  3116. AddPt "Polarity", 0, 0, 0
  3117. AddPt "Polarity", 1, 0.05, -2.7
  3118. AddPt "Polarity", 2, 0.33, -2.7
  3119. AddPt "Polarity", 3, 0.37, -2.7
  3120. AddPt "Polarity", 4, 0.41, -2.7
  3121. AddPt "Polarity", 5, 0.45, -2.7
  3122. AddPt "Polarity", 6, 0.576,-2.7
  3123. AddPt "Polarity", 7, 0.66, -1.8
  3124. AddPt "Polarity", 8, 0.743, -0.5
  3125. AddPt "Polarity", 9, 0.81, -0.5
  3126. AddPt "Polarity", 10, 0.88, 0
  3127.  
  3128. addpt "Velocity", 0, 0, 1
  3129. addpt "Velocity", 1, 0.16, 1.06
  3130. addpt "Velocity", 2, 0.41, 1.05
  3131. addpt "Velocity", 3, 0.53, 1'0.982
  3132. addpt "Velocity", 4, 0.702, 0.968
  3133. addpt "Velocity", 5, 0.95, 0.968
  3134. addpt "Velocity", 6, 1.03, 0.945
  3135.  
  3136. LF.Object = LeftFlipper
  3137. LF.EndPoint = EndPointLp
  3138. RF.Object = RightFlipper
  3139. RF.EndPoint = EndPointRp
  3140. End Sub
  3141.  
  3142. Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
  3143. Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
  3144. Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
  3145. Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
  3146.  
  3147. '******************************************************
  3148. ' FLIPPER CORRECTION FUNCTIONS
  3149. '******************************************************
  3150.  
  3151. Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
  3152. dim a : a = Array(LF, RF)
  3153. dim x : for each x in a
  3154. x.addpoint aStr, idx, aX, aY
  3155. Next
  3156. End Sub
  3157.  
  3158. Class FlipperPolarity
  3159. Public DebugOn, Enabled
  3160. Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
  3161. Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
  3162. private Flipper, FlipperStart,FlipperEnd, FlipperEndY, LR, PartialFlipCoef
  3163. Private Balls(20), balldata(20)
  3164.  
  3165. dim PolarityIn, PolarityOut
  3166. dim VelocityIn, VelocityOut
  3167. dim YcoefIn, YcoefOut
  3168. Public Sub Class_Initialize
  3169. redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
  3170. Enabled = True : TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new SpoofBall : next
  3171. End Sub
  3172.  
  3173. Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
  3174. Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
  3175. Public Property Get StartPoint : StartPoint = FlipperStart : End Property
  3176. Public Property Let EndPoint(aInput) : FlipperEnd = aInput.x: FlipperEndY = aInput.y: End Property
  3177. Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
  3178. Public Property Get EndPointY: EndPointY = FlipperEndY : End Property
  3179.  
  3180. Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
  3181. Select Case aChooseArray
  3182. case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
  3183. Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
  3184. Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
  3185. End Select
  3186. if gametime > 100 then Report aChooseArray
  3187. End Sub
  3188.  
  3189. Public Sub Report(aChooseArray) 'debug, reports all coords in tbPL.text
  3190. if not DebugOn then exit sub
  3191. dim a1, a2 : Select Case aChooseArray
  3192. case "Polarity" : a1 = PolarityIn : a2 = PolarityOut
  3193. Case "Velocity" : a1 = VelocityIn : a2 = VelocityOut
  3194. Case "Ycoef" : a1 = YcoefIn : a2 = YcoefOut
  3195. case else :tbpl.text = "wrong string" : exit sub
  3196. End Select
  3197. dim str, x : for x = 0 to uBound(a1) : str = str & aChooseArray & " x: " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
  3198. tbpl.text = str
  3199. End Sub
  3200.  
  3201. 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
  3202.  
  3203. Private Sub RemoveBall(aBall)
  3204. dim x : for x = 0 to uBound(balls)
  3205. if TypeName(balls(x) ) = "IBall" then
  3206. if aBall.ID = Balls(x).ID Then
  3207. balls(x) = Empty
  3208. Balldata(x).Reset
  3209. End If
  3210. End If
  3211. Next
  3212. End Sub
  3213.  
  3214. Public Sub Fire()
  3215. Flipper.RotateToEnd
  3216. processballs
  3217. End Sub
  3218.  
  3219. Public Property Get Pos 'returns % position a ball. For debug stuff.
  3220. dim x : for x = 0 to uBound(balls)
  3221. if not IsEmpty(balls(x) ) then
  3222. pos = pSlope(Balls(x).x, FlipperStart, 0, FlipperEnd, 1)
  3223. End If
  3224. Next
  3225. End Property
  3226.  
  3227. Public Sub ProcessBalls() 'save data of balls in flipper range
  3228. FlipAt = GameTime
  3229. dim x : for x = 0 to uBound(balls)
  3230. if not IsEmpty(balls(x) ) then
  3231. balldata(x).Data = balls(x)
  3232. End If
  3233. Next
  3234. PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle))
  3235. PartialFlipCoef = abs(PartialFlipCoef-1)
  3236. End Sub
  3237. Private Function FlipperOn() : if gameTime < FlipAt+TimeDelay then FlipperOn = True : End If : End Function 'Timer shutoff for polaritycorrect
  3238.  
  3239. Public Sub PolarityCorrect(aBall)
  3240. if FlipperOn() then
  3241. dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
  3242.  
  3243. 'y safety Exit
  3244. if aBall.VelY > -8 then 'ball going down
  3245. RemoveBall aBall
  3246. exit Sub
  3247. end if
  3248.  
  3249. 'Find balldata. BallPos = % on Flipper
  3250. for x = 0 to uBound(Balls)
  3251. if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
  3252. idx = x
  3253. BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
  3254. if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  3255. end if
  3256. Next
  3257.  
  3258. If BallPos = 0 Then 'no ball data meaning the ball is entering and exiting pretty close to the same position, use current values.
  3259. BallPos = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
  3260. if ballpos > 0.65 then Ycoef = LinearEnvelope(aBall.Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  3261. End If
  3262.  
  3263. 'Velocity correction
  3264. if not IsEmpty(VelocityIn(0) ) then
  3265. Dim VelCoef
  3266. : VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
  3267.  
  3268. if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
  3269.  
  3270. if Enabled then aBall.Velx = aBall.Velx*VelCoef
  3271. if Enabled then aBall.Vely = aBall.Vely*VelCoef
  3272. End If
  3273.  
  3274. 'Polarity Correction (optional now)
  3275. if not IsEmpty(PolarityIn(0) ) then
  3276. If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
  3277. dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
  3278.  
  3279. if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
  3280. 'playsound "fx_knocker"
  3281. End If
  3282. End If
  3283. RemoveBall aBall
  3284. End Sub
  3285. End Class
  3286.  
  3287. '******************************************************
  3288. ' FLIPPER POLARITY AND RUBBER DAMPENER
  3289. ' SUPPORTING FUNCTIONS
  3290. '******************************************************
  3291.  
  3292. ' Used for flipper correction and rubber dampeners
  3293. Sub ShuffleArray(ByRef aArray, byVal offset) 'shuffle 1d array
  3294. dim x, aCount : aCount = 0
  3295. redim a(uBound(aArray) )
  3296. for x = 0 to uBound(aArray) 'Shuffle objects in a temp array
  3297. if not IsEmpty(aArray(x) ) Then
  3298. if IsObject(aArray(x)) then
  3299. Set a(aCount) = aArray(x)
  3300. Else
  3301. a(aCount) = aArray(x)
  3302. End If
  3303. aCount = aCount + 1
  3304. End If
  3305. Next
  3306. if offset < 0 then offset = 0
  3307. redim aArray(aCount-1+offset) 'Resize original array
  3308. for x = 0 to aCount-1 'set objects back into original array
  3309. if IsObject(a(x)) then
  3310. Set aArray(x) = a(x)
  3311. Else
  3312. aArray(x) = a(x)
  3313. End If
  3314. Next
  3315. End Sub
  3316.  
  3317. ' Used for flipper correction and rubber dampeners
  3318. Sub ShuffleArrays(aArray1, aArray2, offset)
  3319. ShuffleArray aArray1, offset
  3320. ShuffleArray aArray2, offset
  3321. End Sub
  3322.  
  3323. ' Used for flipper correction, rubber dampeners, and drop targets
  3324. Function BallSpeed(ball) 'Calculates the ball speed
  3325. BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
  3326. End Function
  3327.  
  3328. ' Used for flipper correction and rubber dampeners
  3329. Function PSlope(Input, X1, Y1, X2, Y2) 'Set up line via two points, no clamping. Input X, output Y
  3330. dim x, y, b, m : x = input : m = (Y2 - Y1) / (X2 - X1) : b = Y2 - m*X2
  3331. Y = M*x+b
  3332. PSlope = Y
  3333. End Function
  3334.  
  3335. ' Used for flipper correction
  3336. Class spoofball
  3337. Public X, Y, Z, VelX, VelY, VelZ, ID, Mass, Radius
  3338. Public Property Let Data(aBall)
  3339. With aBall
  3340. x = .x : y = .y : z = .z : velx = .velx : vely = .vely : velz = .velz
  3341. id = .ID : mass = .mass : radius = .radius
  3342. end with
  3343. End Property
  3344. Public Sub Reset()
  3345. x = Empty : y = Empty : z = Empty : velx = Empty : vely = Empty : velz = Empty
  3346. id = Empty : mass = Empty : radius = Empty
  3347. End Sub
  3348. End Class
  3349.  
  3350. ' Used for flipper correction and rubber dampeners
  3351. Function LinearEnvelope(xInput, xKeyFrame, yLvl)
  3352. dim y 'Y output
  3353. dim L 'Line
  3354. dim ii : for ii = 1 to uBound(xKeyFrame) 'find active line
  3355. if xInput <= xKeyFrame(ii) then L = ii : exit for : end if
  3356. Next
  3357. if xInput > xKeyFrame(uBound(xKeyFrame) ) then L = uBound(xKeyFrame) 'catch line overrun
  3358. Y = pSlope(xInput, xKeyFrame(L-1), yLvl(L-1), xKeyFrame(L), yLvl(L) )
  3359.  
  3360. if xInput <= xKeyFrame(lBound(xKeyFrame) ) then Y = yLvl(lBound(xKeyFrame) ) 'Clamp lower
  3361. if xInput >= xKeyFrame(uBound(xKeyFrame) ) then Y = yLvl(uBound(xKeyFrame) ) 'Clamp upper
  3362.  
  3363. LinearEnvelope = Y
  3364. End Function
  3365.  
  3366. ' Used for drop targets and stand up targets
  3367. Function Atn2(dy, dx)
  3368. dim pi
  3369. pi = 4*Atn(1)
  3370.  
  3371. If dx > 0 Then
  3372. Atn2 = Atn(dy / dx)
  3373. ElseIf dx < 0 Then
  3374. If dy = 0 Then
  3375. Atn2 = pi
  3376. Else
  3377. Atn2 = Sgn(dy) * (pi - Atn(Abs(dy / dx)))
  3378. end if
  3379. ElseIf dx = 0 Then
  3380. if dy = 0 Then
  3381. Atn2 = 0
  3382. else
  3383. Atn2 = Sgn(dy) * pi / 2
  3384. end if
  3385. End If
  3386. End Function
  3387.  
  3388. ' Used for drop targets and flipper tricks
  3389. Function Distance(ax,ay,bx,by)
  3390. Distance = SQR((ax - bx)^2 + (ay - by)^2)
  3391. End Function
  3392.  
  3393. '******************************************************
  3394. ' FLIPPER TRICKS
  3395. '******************************************************
  3396.  
  3397. RightFlipper.timerinterval=1
  3398. Rightflipper.timerenabled=True
  3399.  
  3400. sub RightFlipper_timer()
  3401. FlipperTricks LeftFlipper, LFPress, LFCount, LFEndAngle, LFState
  3402. FlipperTricks RightFlipper, RFPress, RFCount, RFEndAngle, RFState
  3403. FlipperNudge RightFlipper, RFEndAngle, RFEOSNudge, LeftFlipper, LFEndAngle
  3404. FlipperNudge LeftFlipper, LFEndAngle, LFEOSNudge, RightFlipper, RFEndAngle
  3405. end sub
  3406.  
  3407. Dim LFEOSNudge, RFEOSNudge
  3408.  
  3409. Sub FlipperNudge(Flipper1, Endangle1, EOSNudge1, Flipper2, EndAngle2)
  3410. Dim BOT, b
  3411.  
  3412. If abs(Flipper1.currentangle) < abs(Endangle1) + 3 and EOSNudge1 <> 1 Then
  3413. EOSNudge1 = 1
  3414. If Flipper2.currentangle = EndAngle2 Then
  3415. BOT = GetBalls
  3416. For b = 0 to Ubound(BOT)
  3417. If FlipperTrigger(BOT(b).x, BOT(b).y, Flipper1) Then
  3418. 'Debug.Print "ball in flip1. exit"
  3419. exit Sub
  3420. end If
  3421. Next
  3422. For b = 0 to Ubound(BOT)
  3423. If FlipperTrigger(BOT(b).x, BOT(b).y, Flipper2) Then
  3424. 'debug.print "flippernudge!!"
  3425. BOT(b).velx = BOT(b).velx /1.5
  3426. BOT(b).vely = BOT(b).vely - 1
  3427. end If
  3428. Next
  3429. End If
  3430. Else
  3431. If abs(Flipper1.currentangle) > abs(Endangle1) + 30 then EOSNudge1 = 0
  3432. End If
  3433. End Sub
  3434.  
  3435. '*****************
  3436. ' Maths
  3437. '*****************
  3438. Const Pi = 3.1415927
  3439.  
  3440. Function dSin(degrees)
  3441. dsin = sin(degrees * Pi/180)
  3442. End Function
  3443.  
  3444. Function dCos(degrees)
  3445. dcos = cos(degrees * Pi/180)
  3446. End Function
  3447.  
  3448.  
  3449. '*************************************************
  3450. ' Check ball distance from Flipper for Rem
  3451. '*************************************************
  3452.  
  3453. Function Distance(ax,ay,bx,by)
  3454. Distance = SQR((ax - bx)^2 + (ay - by)^2)
  3455. End Function
  3456.  
  3457. Function DistancePL(px,py,ax,ay,bx,by) ' Distance between a point and a line where point is px,py
  3458. DistancePL = ABS((by - ay)*px - (bx - ax) * py + bx*ay - by*ax)/Distance(ax,ay,bx,by)
  3459. End Function
  3460.  
  3461. Function Radians(Degrees)
  3462. Radians = Degrees * PI /180
  3463. End Function
  3464.  
  3465. Function AnglePP(ax,ay,bx,by)
  3466. AnglePP = Atn2((by - ay),(bx - ax))*180/PI
  3467. End Function
  3468.  
  3469. Function DistanceFromFlipper(ballx, bally, Flipper)
  3470. DistanceFromFlipper = DistancePL(ballx, bally, Flipper.x, Flipper.y, Cos(Radians(Flipper.currentangle+90))+Flipper.x, Sin(Radians(Flipper.currentangle+90))+Flipper.y)
  3471. End Function
  3472.  
  3473. Function FlipperTrigger(ballx, bally, Flipper)
  3474. Dim DiffAngle
  3475. DiffAngle = ABS(Flipper.currentangle - AnglePP(Flipper.x, Flipper.y, ballx, bally) - 90)
  3476. If DiffAngle > 180 Then DiffAngle = DiffAngle - 360
  3477.  
  3478. If DistanceFromFlipper(ballx,bally,Flipper) < 48 and DiffAngle <= 90 and Distance(ballx,bally,Flipper.x,Flipper.y) < Flipper.Length Then
  3479. FlipperTrigger = True
  3480. Else
  3481. FlipperTrigger = False
  3482. End If
  3483. End Function
  3484.  
  3485. '*************************************************
  3486. ' End - Check ball distance from Flipper for Rem
  3487. '*************************************************
  3488.  
  3489.  
  3490.  
  3491. dim LFPress, RFPress, LFCount, RFCount
  3492. dim LFState, RFState
  3493. dim EOST, EOSA,Frampup, FElasticity,FReturn
  3494. dim RFEndAngle, LFEndAngle
  3495.  
  3496. EOST = leftflipper.eostorque
  3497. EOSA = leftflipper.eostorqueangle
  3498. Frampup = LeftFlipper.rampup
  3499. FElasticity = LeftFlipper.elasticity
  3500. FReturn = LeftFlipper.return
  3501. Const EOSTnew = 1 '0.8
  3502. Const EOSAnew = 1
  3503. Const EOSRampup = 0
  3504. Dim SOSRampup
  3505. Select Case FlipperCoilRampupMode
  3506. Case 0:
  3507. SOSRampup = 2.5
  3508. Case 1:
  3509. SOSRampup = 4.5
  3510. Case 2:
  3511. SOSRampup = 8.5
  3512. End Select
  3513. Const LiveCatch = 16
  3514. Const LiveElasticity = 0.45
  3515. Const SOSEM = 0.815
  3516. Const EOSReturn = 0.035 '0.025
  3517.  
  3518.  
  3519. LFEndAngle = Leftflipper.endangle
  3520. RFEndAngle = RightFlipper.endangle
  3521.  
  3522. Sub FlipperActivate(Flipper, FlipperPress)
  3523. FlipperPress = 1
  3524. Flipper.Elasticity = FElasticity
  3525.  
  3526. Flipper.eostorque = EOST
  3527. Flipper.eostorqueangle = EOSA
  3528. End Sub
  3529.  
  3530. Sub FlipperDeactivate(Flipper, FlipperPress)
  3531. FlipperPress = 0
  3532. Flipper.eostorqueangle = EOSA
  3533. Flipper.eostorque = EOST*EOSReturn/FReturn
  3534.  
  3535.  
  3536. If Abs(Flipper.currentangle) <= Abs(Flipper.endangle) + 0.1 Then
  3537. Dim BOT, b
  3538. BOT = GetBalls
  3539.  
  3540. For b = 0 to UBound(BOT)
  3541. If Distance(BOT(b).x, BOT(b).y, Flipper.x, Flipper.y) < 55 Then 'check for cradle
  3542. If BOT(b).vely >= -0.4 Then BOT(b).vely = -0.4
  3543. End If
  3544. Next
  3545. End If
  3546. End Sub
  3547.  
  3548. Sub FlipperTricks (Flipper, FlipperPress, FCount, FEndAngle, FState)
  3549. Dim Dir
  3550. Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
  3551.  
  3552. If Abs(Flipper.currentangle) > Abs(Flipper.startangle) - 0.05 Then
  3553. If FState <> 1 Then
  3554. Flipper.rampup = SOSRampup
  3555. Flipper.endangle = FEndAngle - 3*Dir
  3556. Flipper.Elasticity = FElasticity * SOSEM
  3557. FCount = 0
  3558. FState = 1
  3559. End If
  3560. ElseIf Abs(Flipper.currentangle) <= Abs(Flipper.endangle) and FlipperPress = 1 then
  3561. if FCount = 0 Then FCount = GameTime
  3562.  
  3563. If FState <> 2 Then
  3564. Flipper.eostorqueangle = EOSAnew
  3565. Flipper.eostorque = EOSTnew
  3566. Flipper.rampup = EOSRampup
  3567. Flipper.endangle = FEndAngle
  3568. FState = 2
  3569. End If
  3570. Elseif Abs(Flipper.currentangle) > Abs(Flipper.endangle) + 0.01 and FlipperPress = 1 Then
  3571. If FState <> 3 Then
  3572. Flipper.eostorque = EOST
  3573. Flipper.eostorqueangle = EOSA
  3574. Flipper.rampup = Frampup
  3575. Flipper.Elasticity = FElasticity
  3576. FState = 3
  3577. End If
  3578.  
  3579. End If
  3580. End Sub
  3581.  
  3582. Const LiveDistanceMin = 30 'minimum distance in vp units from flipper base live catch dampening will occur
  3583. Const LiveDistanceMax = 117 'maximum distance in vp units from flipper base live catch dampening will occur (tip protection)
  3584.  
  3585. Sub CheckLiveCatch(ball, Flipper, FCount, parm) 'Experimental new live catch
  3586. Dim Dir
  3587. Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
  3588. Dim LiveCatchBounce 'If live catch is not perfect, it won't freeze ball totally
  3589. Dim CatchTime : CatchTime = GameTime - FCount
  3590.  
  3591. if CatchTime <= LiveCatch and parm > 6 and ABS(Flipper.x - ball.x) > LiveDistanceMin and ABS(Flipper.x - ball.x) < LiveDistanceMax Then
  3592. if CatchTime <= LiveCatch*0.8 Then 'Perfect catch only when catch time happens in the beginning of the window
  3593. LiveCatchBounce = 0
  3594. else
  3595. LiveCatchBounce = Abs((LiveCatch/2) - CatchTime) 'Partial catch when catch happens a bit late
  3596. end If
  3597.  
  3598. 'debug.print "Live catch! Bounce: " & LiveCatchBounce
  3599.  
  3600. If LiveCatchBounce = 0 and ball.velx * Dir > 0 Then ball.velx = 0
  3601. ball.vely = LiveCatchBounce * (16 / LiveCatch) ' Multiplier for inaccuracy bounce
  3602. ball.angmomx= 0
  3603. ball.angmomy= 0
  3604. ball.angmomz= 0
  3605. End If
  3606. End Sub
  3607.  
  3608. '*****************************************************************************************************
  3609. 'END nFOZZY FLIPPERS'
  3610.  
  3611.  
  3612. 'PHYSICS DAMPENERS
  3613.  
  3614. 'These are data mined bounce curves,
  3615. 'dialed in with the in-game elasticity as much as possible to prevent angle / spin issues.
  3616. 'Requires tracking ballspeed to calculate COR
  3617.  
  3618. Sub dPosts_Hit(idx)
  3619. RubbersD.dampen Activeball
  3620. End Sub
  3621.  
  3622. Sub dSleeves_Hit(idx)
  3623. SleevesD.Dampen Activeball
  3624. End Sub
  3625.  
  3626.  
  3627. dim RubbersD : Set RubbersD = new Dampener 'frubber
  3628. RubbersD.name = "Rubbers"
  3629. RubbersD.debugOn = False 'shows info in textbox "TBPout"
  3630. RubbersD.Print = False 'debug, reports in debugger (in vel, out cor)
  3631. 'cor bounce curve (linear)
  3632. 'for best results, try to match in-game velocity as closely as possible to the desired curve
  3633. 'RubbersD.addpoint 0, 0, 0.935 'point# (keep sequential), ballspeed, CoR (elasticity)
  3634. RubbersD.addpoint 0, 0, 0.96 'point# (keep sequential), ballspeed, CoR (elasticity)
  3635. RubbersD.addpoint 1, 3.77, 0.96
  3636. RubbersD.addpoint 2, 5.76, 0.967 'dont take this as gospel. if you can data mine rubber elasticitiy, please help!
  3637. RubbersD.addpoint 3, 15.84, 0.874
  3638. RubbersD.addpoint 4, 56, 0.64 'there's clamping so interpolate up to 56 at least
  3639.  
  3640. dim SleevesD : Set SleevesD = new Dampener 'this is just rubber but cut down to 85%...
  3641. SleevesD.name = "Sleeves"
  3642. SleevesD.debugOn = False 'shows info in textbox "TBPout"
  3643. SleevesD.Print = False 'debug, reports in debugger (in vel, out cor)
  3644. SleevesD.CopyCoef RubbersD, 0.85
  3645.  
  3646. Class Dampener
  3647. Public Print, debugOn 'tbpOut.text
  3648. public name, Threshold 'Minimum threshold. Useful for Flippers, which don't have a hit threshold.
  3649. Public ModIn, ModOut
  3650. Private Sub Class_Initialize : redim ModIn(0) : redim Modout(0): End Sub
  3651.  
  3652. Public Sub AddPoint(aIdx, aX, aY)
  3653. ShuffleArrays ModIn, ModOut, 1 : ModIn(aIDX) = aX : ModOut(aIDX) = aY : ShuffleArrays ModIn, ModOut, 0
  3654. if gametime > 100 then Report
  3655. End Sub
  3656.  
  3657. public sub Dampen(aBall)
  3658. if threshold then if BallSpeed(aBall) < threshold then exit sub end if end if
  3659. dim RealCOR, DesiredCOR, str, coef
  3660. DesiredCor = LinearEnvelope(cor.ballvel(aBall.id), ModIn, ModOut )
  3661. RealCOR = BallSpeed(aBall) / cor.ballvel(aBall.id)
  3662. coef = desiredcor / realcor
  3663. if debugOn then str = name & " in vel:" & round(cor.ballvel(aBall.id),2 ) & vbnewline & "desired cor: " & round(desiredcor,4) & vbnewline & _
  3664. "actual cor: " & round(realCOR,4) & vbnewline & "ballspeed coef: " & round(coef, 3) & vbnewline
  3665. if Print then debug.print Round(cor.ballvel(aBall.id),2) & ", " & round(desiredcor,3)
  3666.  
  3667. aBall.velx = aBall.velx * coef : aBall.vely = aBall.vely * coef
  3668. if debugOn then TBPout.text = str
  3669. End Sub
  3670.  
  3671. Public Sub CopyCoef(aObj, aCoef) 'alternative addpoints, copy with coef
  3672. dim x : for x = 0 to uBound(aObj.ModIn)
  3673. addpoint x, aObj.ModIn(x), aObj.ModOut(x)*aCoef
  3674. Next
  3675. End Sub
  3676.  
  3677.  
  3678. Public Sub Report() 'debug, reports all coords in tbPL.text
  3679. if not debugOn then exit sub
  3680. dim a1, a2 : a1 = ModIn : a2 = ModOut
  3681. dim str, x : for x = 0 to uBound(a1) : str = str & x & ": " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
  3682. TBPout.text = str
  3683. End Sub
  3684.  
  3685.  
  3686. End Class
  3687.  
  3688. '******************************************************
  3689. ' TRACK ALL BALL VELOCITIES
  3690. ' FOR RUBBER DAMPENER AND DROP TARGETS
  3691. '******************************************************
  3692.  
  3693. dim cor : set cor = New CoRTracker
  3694.  
  3695. Class CoRTracker
  3696.  
  3697. public ballvel, ballvelx, ballvely
  3698.  
  3699. Private Sub Class_Initialize : redim ballvel(0) : redim ballvelx(0): redim ballvely(0) : End Sub
  3700.  
  3701. Public Sub Update() 'tracks in-ball-velocity
  3702. dim str, b, AllBalls, highestID : allBalls = getballs
  3703.  
  3704. for each b in allballs
  3705. if b.id >= HighestID then highestID = b.id
  3706. Next
  3707.  
  3708. if uBound(ballvel) < highestID then redim ballvel(highestID) 'set bounds
  3709. if uBound(ballvelx) < highestID then redim ballvelx(highestID) 'set bounds
  3710. if uBound(ballvely) < highestID then redim ballvely(highestID) 'set bounds
  3711.  
  3712. for each b in allballs
  3713. ballvel(b.id) = BallSpeed(b)
  3714. ballvelx(b.id) = b.velx
  3715. ballvely(b.id) = b.vely
  3716. Next
  3717. End Sub
  3718. End Class
  3719.  
  3720.  
  3721. Sub RDampen_Timer()
  3722. Cor.Update
  3723. End Sub
  3724.  
  3725. '******************************************************
  3726. ' TargetBouncer for targets and posts by Iaakki, Wrd1972, Apophis
  3727. '******************************************************
  3728.  
  3729. sub TargetBouncer(aBall,defvalue)
  3730. dim zMultiplier, vel, vratio
  3731. if TargetBouncerEnabled <> 0 and aball.z < 30 then
  3732. 'debug.print "velx: " & aball.velx & " vely: " & aball.vely & " velz: " & aball.velz
  3733. vel = BallSpeed(aBall)
  3734. vratio = aBall.vely/aBall.velx
  3735. Select Case Int(Rnd * 6) + 1
  3736. Case 1: zMultiplier = 0.1*defvalue
  3737. Case 2: zMultiplier = 0.2*defvalue
  3738. Case 3: zMultiplier = 0.3*defvalue
  3739. Case 4: zMultiplier = 0.4*defvalue
  3740. Case 5: zMultiplier = 0.5*defvalue
  3741. Case 6: zMultiplier = 0.6*defvalue
  3742. End Select
  3743. aBall.velz = abs(vel * zMultiplier * TargetBouncerFactor)
  3744. aBall.velx = sgn(aBall.velx) * sqr(abs((vel^2 - aBall.velz^2)/(1+vratio^2)))
  3745. aBall.vely = aBall.velx * vratio
  3746. 'debug.print "---> velx: " & aball.velx & " vely: " & aball.vely & " velz: " & aball.velz
  3747. 'debug.print "conservation check: " & BallSpeed(aBall)/vel
  3748. end if
  3749. end sub
  3750.  
  3751.  
  3752. '******************************************************
  3753. '**** FLEEP MECHANICAL SOUNDS
  3754. '******************************************************
  3755.  
  3756. ' This part in the script is an entire block that is dedicated to the physics sound system.
  3757. ' Various scripts and sounds that may be pretty generic and could suit other WPC systems, but the most are tailored specifically for the TOM table
  3758.  
  3759. ' Many of the sounds in this package can be added by creating collections and adding the appropriate objects to those collections.
  3760. ' Create the following new collections:
  3761. ' Metals (all metal objects, metal walls, metal posts, metal wire guides)
  3762. ' Apron (the apron walls and plunger wall)
  3763. ' Walls (all wood or plastic walls)
  3764. ' Rollovers (wire rollover triggers, star triggers, or button triggers)
  3765. ' Targets (standup or drop targets, these are hit sounds only ... you will want to add separate dropping sounds for drop targets)
  3766. ' Gates (plate gates)
  3767. ' GatesWire (wire gates)
  3768. ' Rubbers (all rubbers including posts, sleeves, pegs, and bands)
  3769. ' When creating the collections, make sure "Fire events for this collection" is checked.
  3770. ' You'll also need to make sure "Has Hit Event" is checked for each object placed in these collections (not necessary for gates and triggers).
  3771. ' Once the collections and objects are added, the save, close, and restart VPX.
  3772. '
  3773. ' Tutorial vides by Apophis
  3774. ' Part 1: https://youtu.be/PbE2kNiam3g
  3775. ' Part 2: https://youtu.be/B5cm1Y8wQsk
  3776. ' Part 3: https://youtu.be/eLhWyuYOyGg
  3777.  
  3778.  
  3779. '/////////////////////////////// SOUNDS PARAMETERS //////////////////////////////
  3780. Dim GlobalSoundLevel, CoinSoundLevel, PlungerReleaseSoundLevel, PlungerPullSoundLevel, NudgeLeftSoundLevel
  3781. Dim NudgeRightSoundLevel, NudgeCenterSoundLevel, StartButtonSoundLevel, RollingSoundFactor
  3782.  
  3783. CoinSoundLevel = 1 'volume level; range [0, 1]
  3784. NudgeLeftSoundLevel = 1 'volume level; range [0, 1]
  3785. NudgeRightSoundLevel = 1 'volume level; range [0, 1]
  3786. NudgeCenterSoundLevel = 1 'volume level; range [0, 1]
  3787. StartButtonSoundLevel = 0.1 'volume level; range [0, 1]
  3788. PlungerReleaseSoundLevel = 0.8 '1 wjr 'volume level; range [0, 1]
  3789. PlungerPullSoundLevel = 1 'volume level; range [0, 1]
  3790. RollingSoundFactor = 1.1/5
  3791.  
  3792. '///////////////////////-----Solenoids, Kickers and Flash Relays-----///////////////////////
  3793. Dim FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel, FlipperUpAttackLeftSoundLevel, FlipperUpAttackRightSoundLevel
  3794. Dim FlipperUpSoundLevel, FlipperDownSoundLevel, FlipperLeftHitParm, FlipperRightHitParm
  3795. Dim SlingshotSoundLevel, BumperSoundFactor, KnockerSoundLevel
  3796.  
  3797. FlipperUpAttackMinimumSoundLevel = 0.010 'volume level; range [0, 1]
  3798. FlipperUpAttackMaximumSoundLevel = 0.635 'volume level; range [0, 1]
  3799. FlipperUpSoundLevel = 1.0 'volume level; range [0, 1]
  3800. FlipperDownSoundLevel = 0.45 'volume level; range [0, 1]
  3801. FlipperLeftHitParm = FlipperUpSoundLevel 'sound helper; not configurable
  3802. FlipperRightHitParm = FlipperUpSoundLevel 'sound helper; not configurable
  3803. SlingshotSoundLevel = 0.95 'volume level; range [0, 1]
  3804. BumperSoundFactor = 4.25 'volume multiplier; must not be zero
  3805. KnockerSoundLevel = 1 'volume level; range [0, 1]
  3806.  
  3807. '///////////////////////-----Ball Drops, Bumps and Collisions-----///////////////////////
  3808. Dim RubberStrongSoundFactor, RubberWeakSoundFactor, RubberFlipperSoundFactor,BallWithBallCollisionSoundFactor
  3809. Dim BallBouncePlayfieldSoftFactor, BallBouncePlayfieldHardFactor, PlasticRampDropToPlayfieldSoundLevel, WireRampDropToPlayfieldSoundLevel, DelayedBallDropOnPlayfieldSoundLevel
  3810. Dim WallImpactSoundFactor, MetalImpactSoundFactor, SubwaySoundLevel, SubwayEntrySoundLevel, ScoopEntrySoundLevel
  3811. Dim SaucerLockSoundLevel, SaucerKickSoundLevel
  3812.  
  3813. BallWithBallCollisionSoundFactor = 3.2 'volume multiplier; must not be zero
  3814. RubberStrongSoundFactor = 0.055/5 'volume multiplier; must not be zero
  3815. RubberWeakSoundFactor = 0.075/5 'volume multiplier; must not be zero
  3816. RubberFlipperSoundFactor = 0.075/5 'volume multiplier; must not be zero
  3817. BallBouncePlayfieldSoftFactor = 0.025 'volume multiplier; must not be zero
  3818. BallBouncePlayfieldHardFactor = 0.025 'volume multiplier; must not be zero
  3819. DelayedBallDropOnPlayfieldSoundLevel = 0.8 'volume level; range [0, 1]
  3820. WallImpactSoundFactor = 0.075 'volume multiplier; must not be zero
  3821. MetalImpactSoundFactor = 0.075/3
  3822. SaucerLockSoundLevel = 0.8
  3823. SaucerKickSoundLevel = 0.8
  3824.  
  3825. '///////////////////////-----Gates, Spinners, Rollovers and Targets-----///////////////////////
  3826.  
  3827. Dim GateSoundLevel, TargetSoundFactor, SpinnerSoundLevel, RolloverSoundLevel, DTSoundLevel
  3828.  
  3829. GateSoundLevel = 0.5/5 'volume level; range [0, 1]
  3830. TargetSoundFactor = 0.0025 * 10 'volume multiplier; must not be zero
  3831. DTSoundLevel = 0.25 'volume multiplier; must not be zero
  3832. RolloverSoundLevel = 0.25 'volume level; range [0, 1]
  3833. SpinnerSoundLevel = 0.5 'volume level; range [0, 1]
  3834.  
  3835. '///////////////////////-----Ball Release, Guides and Drain-----///////////////////////
  3836. Dim DrainSoundLevel, BallReleaseSoundLevel, BottomArchBallGuideSoundFactor, FlipperBallGuideSoundFactor
  3837.  
  3838. DrainSoundLevel = 0.8 'volume level; range [0, 1]
  3839. BallReleaseSoundLevel = 1 'volume level; range [0, 1]
  3840. BottomArchBallGuideSoundFactor = 0.2 'volume multiplier; must not be zero
  3841. FlipperBallGuideSoundFactor = 0.015 'volume multiplier; must not be zero
  3842.  
  3843. '///////////////////////-----Loops and Lanes-----///////////////////////
  3844. Dim ArchSoundFactor
  3845. ArchSoundFactor = 0.025/5 'volume multiplier; must not be zero
  3846.  
  3847.  
  3848. '///////////////////////////// SOUND PLAYBACK FUNCTIONS ////////////////////////////
  3849. '///////////////////////////// POSITIONAL SOUND PLAYBACK METHODS ////////////////////////////
  3850. ' Positional sound playback methods will play a sound, depending on the X,Y position of the table element or depending on ActiveBall object position
  3851. ' These are similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  3852. ' For surround setup - positional sound playback functions will fade between front and rear surround channels and pan between left and right channels
  3853. ' For stereo setup - positional sound playback functions will only pan between left and right channels
  3854. ' For mono setup - positional sound playback functions will not pan between left and right channels and will not fade between front and rear channels
  3855.  
  3856. ' PlaySound full syntax - PlaySound(string, int loopcount, float volume, float pan, float randompitch, int pitch, bool useexisting, bool restart, float front_rear_fade)
  3857. ' Note - These functions will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  3858. Sub PlaySoundAtLevelStatic(playsoundparams, aVol, tableobj)
  3859. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 0, 0, AudioFade(tableobj)
  3860. End Sub
  3861.  
  3862. Sub PlaySoundAtLevelExistingStatic(playsoundparams, aVol, tableobj)
  3863. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 1, 0, AudioFade(tableobj)
  3864. End Sub
  3865.  
  3866. Sub PlaySoundAtLevelStaticLoop(playsoundparams, aVol, tableobj)
  3867. PlaySound playsoundparams, -1, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 0, 0, AudioFade(tableobj)
  3868. End Sub
  3869.  
  3870. Sub PlaySoundAtLevelStaticRandomPitch(playsoundparams, aVol, randomPitch, tableobj)
  3871. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), randomPitch, 0, 0, 0, AudioFade(tableobj)
  3872. End Sub
  3873.  
  3874. Sub PlaySoundAtLevelActiveBall(playsoundparams, aVol)
  3875. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ActiveBall), 0, 0, 0, 0, AudioFade(ActiveBall)
  3876. End Sub
  3877.  
  3878. Sub PlaySoundAtLevelExistingActiveBall(playsoundparams, aVol)
  3879. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ActiveBall), 0, 0, 1, 0, AudioFade(ActiveBall)
  3880. End Sub
  3881.  
  3882. Sub PlaySoundAtLeveTimerActiveBall(playsoundparams, aVol, ballvariable)
  3883. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ballvariable), 0, 0, 0, 0, AudioFade(ballvariable)
  3884. End Sub
  3885.  
  3886. Sub PlaySoundAtLevelTimerExistingActiveBall(playsoundparams, aVol, ballvariable)
  3887. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ballvariable), 0, 0, 1, 0, AudioFade(ballvariable)
  3888. End Sub
  3889.  
  3890. Sub PlaySoundAtLevelRoll(playsoundparams, aVol, pitch)
  3891. PlaySound playsoundparams, -1, aVol * VolumeDial, AudioPan(tableobj), randomPitch, 0, 0, 0, AudioFade(tableobj)
  3892. End Sub
  3893.  
  3894. ' Previous Positional Sound Subs
  3895.  
  3896. Sub PlaySoundAt(soundname, tableobj)
  3897. PlaySound soundname, 1, 1 * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  3898. End Sub
  3899.  
  3900. Sub PlaySoundAtVol(soundname, tableobj, aVol)
  3901. PlaySound soundname, 1, aVol * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  3902. End Sub
  3903.  
  3904. Sub PlaySoundAtBall(soundname)
  3905. PlaySoundAt soundname, ActiveBall
  3906. End Sub
  3907.  
  3908. Sub PlaySoundAtBallVol (Soundname, aVol)
  3909. Playsound soundname, 1,aVol * VolumeDial, AudioPan(ActiveBall), 0,0,0, 1, AudioFade(ActiveBall)
  3910. End Sub
  3911.  
  3912. Sub PlaySoundAtBallVolM (Soundname, aVol)
  3913. Playsound soundname, 1,aVol * VolumeDial, AudioPan(ActiveBall), 0,0,0, 0, AudioFade(ActiveBall)
  3914. End Sub
  3915.  
  3916. Sub PlaySoundAtVolLoops(sound, tableobj, Vol, Loops)
  3917. PlaySound sound, Loops, Vol * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  3918. End Sub
  3919.  
  3920. ' *********************************************************************
  3921. ' Fleep Supporting Ball & Sound Functions
  3922. ' *********************************************************************
  3923.  
  3924. Dim tablewidth, tableheight : tablewidth = table1.width : tableheight = table1.height
  3925.  
  3926. 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
  3927. Dim tmp
  3928. tmp = tableobj.y * 2 / tableheight-1
  3929. If tmp > 0 Then
  3930. AudioFade = Csng(tmp ^10)
  3931. Else
  3932. AudioFade = Csng(-((- tmp) ^10) )
  3933. End If
  3934. End Function
  3935.  
  3936. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  3937. Dim tmp
  3938. tmp = tableobj.x * 2 / tablewidth-1
  3939. If tmp > 0 Then
  3940. AudioPan = Csng(tmp ^10)
  3941. Else
  3942. AudioPan = Csng(-((- tmp) ^10) )
  3943. End If
  3944. End Function
  3945.  
  3946. Function Vol(ball) ' Calculates the volume of the sound based on the ball speed
  3947. Vol = Csng(BallVel(ball) ^2)
  3948. End Function
  3949.  
  3950. Function Volz(ball) ' Calculates the volume of the sound based on the ball speed
  3951. Volz = Csng((ball.velz) ^2)
  3952. End Function
  3953.  
  3954. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  3955. Pitch = BallVel(ball) * 20
  3956. End Function
  3957.  
  3958. Function BallVel(ball) 'Calculates the ball speed
  3959. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  3960. End Function
  3961.  
  3962. Function VolPlayfieldRoll(ball) ' Calculates the roll volume of the sound based on the ball speed
  3963. VolPlayfieldRoll = RollingSoundFactor * 0.0005 * Csng(BallVel(ball) ^3)
  3964. End Function
  3965.  
  3966. Function PitchPlayfieldRoll(ball) ' Calculates the roll pitch of the sound based on the ball speed
  3967. PitchPlayfieldRoll = BallVel(ball) ^2 * 15
  3968. End Function
  3969.  
  3970. Function RndInt(min, max)
  3971. RndInt = Int(Rnd() * (max-min + 1) + min)' Sets a random number integer between min and max
  3972. End Function
  3973.  
  3974. Function RndNum(min, max)
  3975. RndNum = Rnd() * (max-min) + min' Sets a random number between min and max
  3976. End Function
  3977.  
  3978. '///////////////////////////// GENERAL SOUND SUBROUTINES ////////////////////////////
  3979. Sub SoundStartButton()
  3980. PlaySound ("Start_Button"), 0, StartButtonSoundLevel, 0, 0.25
  3981. End Sub
  3982.  
  3983. Sub SoundNudgeLeft()
  3984. PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeLeftSoundLevel * VolumeDial, -0.1, 0.25
  3985. End Sub
  3986.  
  3987. Sub SoundNudgeRight()
  3988. PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeRightSoundLevel * VolumeDial, 0.1, 0.25
  3989. End Sub
  3990.  
  3991. Sub SoundNudgeCenter()
  3992. PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeCenterSoundLevel * VolumeDial, 0, 0.25
  3993. End Sub
  3994.  
  3995.  
  3996. Sub SoundPlungerPull()
  3997. PlaySoundAtLevelStatic ("Plunger_Pull_1"), PlungerPullSoundLevel, Plunger
  3998. End Sub
  3999.  
  4000. Sub SoundPlungerReleaseBall()
  4001. PlaySoundAtLevelStatic ("Plunger_Release_Ball"), PlungerReleaseSoundLevel, Plunger
  4002. End Sub
  4003.  
  4004. Sub SoundPlungerReleaseNoBall()
  4005. PlaySoundAtLevelStatic ("Plunger_Release_No_Ball"), PlungerReleaseSoundLevel, Plunger
  4006. End Sub
  4007.  
  4008.  
  4009. '///////////////////////////// KNOCKER SOLENOID ////////////////////////////
  4010. Sub KnockerSolenoid()
  4011. PlaySoundAtLevelStatic SoundFX("Knocker_1",DOFKnocker), KnockerSoundLevel, KnockerPosition
  4012. End Sub
  4013.  
  4014. '///////////////////////////// DRAIN SOUNDS ////////////////////////////
  4015. Sub RandomSoundDrain(drainswitch)
  4016. PlaySoundAtLevelStatic ("Drain_" & Int(Rnd*11)+1), DrainSoundLevel, drainswitch
  4017. End Sub
  4018.  
  4019. '///////////////////////////// TROUGH BALL RELEASE SOLENOID SOUNDS ////////////////////////////
  4020.  
  4021. Sub RandomSoundBallRelease(drainswitch)
  4022. PlaySoundAtLevelStatic SoundFX("BallRelease" & Int(Rnd*7)+1,DOFContactors), BallReleaseSoundLevel, drainswitch
  4023. End Sub
  4024.  
  4025. '///////////////////////////// SLINGSHOT SOLENOID SOUNDS ////////////////////////////
  4026. Sub RandomSoundSlingshotLeft(sling)
  4027. PlaySoundAtLevelStatic SoundFX("Sling_L" & Int(Rnd*10)+1,DOFContactors), SlingshotSoundLevel, Sling
  4028. End Sub
  4029.  
  4030. Sub RandomSoundSlingshotRight(sling)
  4031. PlaySoundAtLevelStatic SoundFX("Sling_R" & Int(Rnd*8)+1,DOFContactors), SlingshotSoundLevel, Sling
  4032. End Sub
  4033.  
  4034. '///////////////////////////// BUMPER SOLENOID SOUNDS ////////////////////////////
  4035. Sub RandomSoundBumperTop(Bump)
  4036. PlaySoundAtLevelStatic SoundFX("Bumpers_Top_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
  4037. End Sub
  4038.  
  4039. Sub RandomSoundBumperMiddle(Bump)
  4040. PlaySoundAtLevelStatic SoundFX("Bumpers_Middle_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
  4041. End Sub
  4042.  
  4043. Sub RandomSoundBumperBottom(Bump)
  4044. PlaySoundAtLevelStatic SoundFX("Bumpers_Bottom_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
  4045. End Sub
  4046.  
  4047. '///////////////////////////// SPINNER SOUNDS ////////////////////////////
  4048. Sub SoundSpinner(spinnerswitch)
  4049. PlaySoundAtLevelStatic ("Spinner"), SpinnerSoundLevel, spinnerswitch
  4050. End Sub
  4051.  
  4052.  
  4053. '///////////////////////////// FLIPPER BATS SOUND SUBROUTINES ////////////////////////////
  4054. '///////////////////////////// FLIPPER BATS SOLENOID ATTACK SOUND ////////////////////////////
  4055. Sub SoundFlipperUpAttackLeft(flipper)
  4056. FlipperUpAttackLeftSoundLevel = RndNum(FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel)
  4057. PlaySoundAtLevelStatic SoundFX("Flipper_Attack-L01",DOFFlippers), FlipperUpAttackLeftSoundLevel, flipper
  4058. End Sub
  4059.  
  4060. Sub SoundFlipperUpAttackRight(flipper)
  4061. FlipperUpAttackRightSoundLevel = RndNum(FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel)
  4062. PlaySoundAtLevelStatic SoundFX("Flipper_Attack-R01",DOFFlippers), FlipperUpAttackLeftSoundLevel, flipper
  4063. End Sub
  4064.  
  4065. '///////////////////////////// FLIPPER BATS SOLENOID CORE SOUND ////////////////////////////
  4066. Sub RandomSoundFlipperUpLeft(flipper)
  4067. PlaySoundAtLevelStatic SoundFX("Flipper_L0" & Int(Rnd*9)+1,DOFFlippers), FlipperLeftHitParm, Flipper
  4068. End Sub
  4069.  
  4070. Sub RandomSoundFlipperUpRight(flipper)
  4071. PlaySoundAtLevelStatic SoundFX("Flipper_R0" & Int(Rnd*9)+1,DOFFlippers), FlipperRightHitParm, Flipper
  4072. End Sub
  4073.  
  4074. Sub RandomSoundReflipUpLeft(flipper)
  4075. PlaySoundAtLevelStatic SoundFX("Flipper_ReFlip_L0" & Int(Rnd*3)+1,DOFFlippers), (RndNum(0.8, 1))*FlipperUpSoundLevel, Flipper
  4076. End Sub
  4077.  
  4078. Sub RandomSoundReflipUpRight(flipper)
  4079. PlaySoundAtLevelStatic SoundFX("Flipper_ReFlip_R0" & Int(Rnd*3)+1,DOFFlippers), (RndNum(0.8, 1))*FlipperUpSoundLevel, Flipper
  4080. End Sub
  4081.  
  4082. Sub RandomSoundFlipperDownLeft(flipper)
  4083. PlaySoundAtLevelStatic SoundFX("Flipper_Left_Down_" & Int(Rnd*7)+1,DOFFlippers), FlipperDownSoundLevel, Flipper
  4084. End Sub
  4085.  
  4086. Sub RandomSoundFlipperDownRight(flipper)
  4087. PlaySoundAtLevelStatic SoundFX("Flipper_Right_Down_" & Int(Rnd*8)+1,DOFFlippers), FlipperDownSoundLevel, Flipper
  4088. End Sub
  4089.  
  4090. '///////////////////////////// FLIPPER BATS BALL COLLIDE SOUND ////////////////////////////
  4091.  
  4092. Sub LeftFlipperCollide(parm)
  4093. FlipperLeftHitParm = parm/10
  4094. If FlipperLeftHitParm > 1 Then
  4095. FlipperLeftHitParm = 1
  4096. End If
  4097. FlipperLeftHitParm = FlipperUpSoundLevel * FlipperLeftHitParm
  4098. RandomSoundRubberFlipper(parm)
  4099. End Sub
  4100.  
  4101. Sub RightFlipperCollide(parm)
  4102. FlipperRightHitParm = parm/10
  4103. If FlipperRightHitParm > 1 Then
  4104. FlipperRightHitParm = 1
  4105. End If
  4106. FlipperRightHitParm = FlipperUpSoundLevel * FlipperRightHitParm
  4107. RandomSoundRubberFlipper(parm)
  4108. End Sub
  4109.  
  4110. Sub RandomSoundRubberFlipper(parm)
  4111. PlaySoundAtLevelActiveBall ("Flipper_Rubber_" & Int(Rnd*7)+1), parm * RubberFlipperSoundFactor
  4112. End Sub
  4113.  
  4114. '///////////////////////////// ROLLOVER SOUNDS ////////////////////////////
  4115. Sub RandomSoundRollover()
  4116. PlaySoundAtLevelActiveBall ("Rollover_" & Int(Rnd*4)+1), RolloverSoundLevel
  4117. End Sub
  4118.  
  4119. Sub Rollovers_Hit(idx)
  4120. RandomSoundRollover
  4121. End Sub
  4122.  
  4123. '///////////////////////////// VARIOUS PLAYFIELD SOUND SUBROUTINES ////////////////////////////
  4124. '///////////////////////////// RUBBERS AND POSTS ////////////////////////////
  4125. '///////////////////////////// RUBBERS - EVENTS ////////////////////////////
  4126. Sub Rubbers_Hit(idx)
  4127. dim finalspeed
  4128. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  4129. If finalspeed > 5 then
  4130. RandomSoundRubberStrong 1
  4131. End if
  4132. If finalspeed <= 5 then
  4133. RandomSoundRubberWeak()
  4134. End If
  4135. End Sub
  4136.  
  4137. '///////////////////////////// RUBBERS AND POSTS - STRONG IMPACTS ////////////////////////////
  4138. Sub RandomSoundRubberStrong(voladj)
  4139. Select Case Int(Rnd*10)+1
  4140. Case 1 : PlaySoundAtLevelActiveBall ("Rubber_Strong_1"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  4141. Case 2 : PlaySoundAtLevelActiveBall ("Rubber_Strong_2"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  4142. Case 3 : PlaySoundAtLevelActiveBall ("Rubber_Strong_3"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  4143. Case 4 : PlaySoundAtLevelActiveBall ("Rubber_Strong_4"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  4144. Case 5 : PlaySoundAtLevelActiveBall ("Rubber_Strong_5"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  4145. Case 6 : PlaySoundAtLevelActiveBall ("Rubber_Strong_6"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  4146. Case 7 : PlaySoundAtLevelActiveBall ("Rubber_Strong_7"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  4147. Case 8 : PlaySoundAtLevelActiveBall ("Rubber_Strong_8"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  4148. Case 9 : PlaySoundAtLevelActiveBall ("Rubber_Strong_9"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  4149. Case 10 : PlaySoundAtLevelActiveBall ("Rubber_1_Hard"), Vol(ActiveBall) * RubberStrongSoundFactor * 0.6*voladj
  4150. End Select
  4151. End Sub
  4152.  
  4153. '///////////////////////////// RUBBERS AND POSTS - WEAK IMPACTS ////////////////////////////
  4154. Sub RandomSoundRubberWeak()
  4155. PlaySoundAtLevelActiveBall ("Rubber_" & Int(Rnd*9)+1), Vol(ActiveBall) * RubberWeakSoundFactor
  4156. End Sub
  4157.  
  4158. '///////////////////////////// WALL IMPACTS ////////////////////////////
  4159. Sub Walls_Hit(idx)
  4160. RandomSoundWall()
  4161. End Sub
  4162.  
  4163. Sub RandomSoundWall()
  4164. dim finalspeed
  4165. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  4166. If finalspeed > 16 then
  4167. Select Case Int(Rnd*5)+1
  4168. Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_1"), Vol(ActiveBall) * WallImpactSoundFactor
  4169. Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_2"), Vol(ActiveBall) * WallImpactSoundFactor
  4170. Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_5"), Vol(ActiveBall) * WallImpactSoundFactor
  4171. Case 4 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_7"), Vol(ActiveBall) * WallImpactSoundFactor
  4172. Case 5 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_9"), Vol(ActiveBall) * WallImpactSoundFactor
  4173. End Select
  4174. End if
  4175. If finalspeed >= 6 AND finalspeed <= 16 then
  4176. Select Case Int(Rnd*4)+1
  4177. Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_3"), Vol(ActiveBall) * WallImpactSoundFactor
  4178. Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_4"), Vol(ActiveBall) * WallImpactSoundFactor
  4179. Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_6"), Vol(ActiveBall) * WallImpactSoundFactor
  4180. Case 4 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_8"), Vol(ActiveBall) * WallImpactSoundFactor
  4181. End Select
  4182. End If
  4183. If finalspeed < 6 Then
  4184. Select Case Int(Rnd*3)+1
  4185. Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_4"), Vol(ActiveBall) * WallImpactSoundFactor
  4186. Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_6"), Vol(ActiveBall) * WallImpactSoundFactor
  4187. Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_8"), Vol(ActiveBall) * WallImpactSoundFactor
  4188. End Select
  4189. End if
  4190. End Sub
  4191.  
  4192. '///////////////////////////// METAL TOUCH SOUNDS ////////////////////////////
  4193. Sub RandomSoundMetal()
  4194. PlaySoundAtLevelActiveBall ("Metal_Touch_" & Int(Rnd*13)+1), Vol(ActiveBall) * MetalImpactSoundFactor
  4195. End Sub
  4196.  
  4197. '///////////////////////////// METAL - EVENTS ////////////////////////////
  4198.  
  4199. Sub Metals_Hit (idx)
  4200. RandomSoundMetal
  4201. End Sub
  4202.  
  4203. Sub ShooterDiverter_collide(idx)
  4204. RandomSoundMetal
  4205. End Sub
  4206.  
  4207. '///////////////////////////// BOTTOM ARCH BALL GUIDE ////////////////////////////
  4208. '///////////////////////////// BOTTOM ARCH BALL GUIDE - SOFT BOUNCES ////////////////////////////
  4209. Sub RandomSoundBottomArchBallGuide()
  4210. dim finalspeed
  4211. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  4212. If finalspeed > 16 then
  4213. PlaySoundAtLevelActiveBall ("Apron_Bounce_"& Int(Rnd*2)+1), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  4214. End if
  4215. If finalspeed >= 6 AND finalspeed <= 16 then
  4216. Select Case Int(Rnd*2)+1
  4217. Case 1 : PlaySoundAtLevelActiveBall ("Apron_Bounce_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  4218. Case 2 : PlaySoundAtLevelActiveBall ("Apron_Bounce_Soft_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  4219. End Select
  4220. End If
  4221. If finalspeed < 6 Then
  4222. Select Case Int(Rnd*2)+1
  4223. Case 1 : PlaySoundAtLevelActiveBall ("Apron_Bounce_Soft_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  4224. Case 2 : PlaySoundAtLevelActiveBall ("Apron_Medium_3"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  4225. End Select
  4226. End if
  4227. End Sub
  4228.  
  4229. '///////////////////////////// BOTTOM ARCH BALL GUIDE - HARD HITS ////////////////////////////
  4230. Sub RandomSoundBottomArchBallGuideHardHit()
  4231. PlaySoundAtLevelActiveBall ("Apron_Hard_Hit_" & Int(Rnd*3)+1), BottomArchBallGuideSoundFactor * 0.25
  4232. End Sub
  4233.  
  4234. Sub Apron1_Hit (idx)
  4235. If Abs(cor.ballvelx(activeball.id) < 4) and cor.ballvely(activeball.id) > 7 then
  4236. RandomSoundBottomArchBallGuideHardHit()
  4237. Else
  4238. RandomSoundBottomArchBallGuide
  4239. End If
  4240. End Sub
  4241.  
  4242. '///////////////////////////// FLIPPER BALL GUIDE ////////////////////////////
  4243. Sub RandomSoundFlipperBallGuide()
  4244. dim finalspeed
  4245. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  4246. If finalspeed > 16 then
  4247. Select Case Int(Rnd*2)+1
  4248. Case 1 : PlaySoundAtLevelActiveBall ("Apron_Hard_1"), Vol(ActiveBall) * FlipperBallGuideSoundFactor
  4249. Case 2 : PlaySoundAtLevelActiveBall ("Apron_Hard_2"), Vol(ActiveBall) * 0.8 * FlipperBallGuideSoundFactor
  4250. End Select
  4251. End if
  4252. If finalspeed >= 6 AND finalspeed <= 16 then
  4253. PlaySoundAtLevelActiveBall ("Apron_Medium_" & Int(Rnd*3)+1), Vol(ActiveBall) * FlipperBallGuideSoundFactor
  4254. End If
  4255. If finalspeed < 6 Then
  4256. PlaySoundAtLevelActiveBall ("Apron_Soft_" & Int(Rnd*7)+1), Vol(ActiveBall) * FlipperBallGuideSoundFactor
  4257. End If
  4258. End Sub
  4259.  
  4260. '///////////////////////////// TARGET HIT SOUNDS ////////////////////////////
  4261. Sub RandomSoundTargetHitStrong()
  4262. PlaySoundAtLevelActiveBall SoundFX("Target_Hit_" & Int(Rnd*4)+5,DOFTargets), Vol(ActiveBall) * 0.45 * TargetSoundFactor
  4263. End Sub
  4264.  
  4265. Sub RandomSoundTargetHitWeak()
  4266. PlaySoundAtLevelActiveBall SoundFX("Target_Hit_" & Int(Rnd*4)+1,DOFTargets), Vol(ActiveBall) * TargetSoundFactor
  4267. End Sub
  4268.  
  4269. Sub PlayTargetSound()
  4270. dim finalspeed
  4271. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  4272. If finalspeed > 10 then
  4273. RandomSoundTargetHitStrong()
  4274. RandomSoundBallBouncePlayfieldSoft Activeball
  4275. Else
  4276. RandomSoundTargetHitWeak()
  4277. End If
  4278. End Sub
  4279.  
  4280. Sub Targets_Hit (idx)
  4281. PlayTargetSound
  4282. End Sub
  4283.  
  4284. '///////////////////////////// BALL BOUNCE SOUNDS ////////////////////////////
  4285. Sub RandomSoundBallBouncePlayfieldSoft(aBall)
  4286. Select Case Int(Rnd*9)+1
  4287. Case 1 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_1"), volz(aBall) * BallBouncePlayfieldSoftFactor, aBall
  4288. Case 2 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_2"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.5, aBall
  4289. Case 3 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_3"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.8, aBall
  4290. Case 4 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_4"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.5, aBall
  4291. Case 5 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_5"), volz(aBall) * BallBouncePlayfieldSoftFactor, aBall
  4292. Case 6 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_1"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
  4293. Case 7 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_2"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
  4294. Case 8 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_5"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
  4295. Case 9 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_7"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.3, aBall
  4296. End Select
  4297. End Sub
  4298.  
  4299. Sub RandomSoundBallBouncePlayfieldHard(aBall)
  4300. PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_" & Int(Rnd*7)+1), volz(aBall) * BallBouncePlayfieldHardFactor, aBall
  4301. End Sub
  4302.  
  4303. '///////////////////////////// DELAYED DROP - TO PLAYFIELD - SOUND ////////////////////////////
  4304. Sub RandomSoundDelayedBallDropOnPlayfield(aBall)
  4305. Select Case Int(Rnd*5)+1
  4306. Case 1 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_1_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  4307. Case 2 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_2_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  4308. Case 3 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_3_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  4309. Case 4 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_4_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  4310. Case 5 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_5_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  4311. End Select
  4312. End Sub
  4313.  
  4314. '///////////////////////////// BALL GATES AND BRACKET GATES SOUNDS ////////////////////////////
  4315.  
  4316. Sub SoundPlayfieldGate()
  4317. PlaySoundAtLevelStatic ("Gate_FastTrigger_" & Int(Rnd*2)+1), GateSoundLevel, Activeball
  4318. End Sub
  4319.  
  4320. Sub SoundHeavyGate()
  4321. PlaySoundAtLevelStatic ("Gate_2"), GateSoundLevel, Activeball
  4322. End Sub
  4323.  
  4324. Sub Gates_hit(idx)
  4325. SoundHeavyGate
  4326. End Sub
  4327.  
  4328. Sub GatesWire_hit(idx)
  4329. SoundPlayfieldGate
  4330. End Sub
  4331.  
  4332. '///////////////////////////// LEFT LANE ENTRANCE - SOUNDS ////////////////////////////
  4333.  
  4334. Sub RandomSoundLeftArch()
  4335. PlaySoundAtLevelActiveBall ("Arch_L" & Int(Rnd*4)+1), Vol(ActiveBall) * ArchSoundFactor
  4336. End Sub
  4337.  
  4338. Sub RandomSoundRightArch()
  4339. PlaySoundAtLevelActiveBall ("Arch_R" & Int(Rnd*4)+1), Vol(ActiveBall) * ArchSoundFactor
  4340. End Sub
  4341.  
  4342.  
  4343. Sub Arch1_hit()
  4344. If Activeball.velx > 1 Then SoundPlayfieldGate
  4345. StopSound "Arch_L1"
  4346. StopSound "Arch_L2"
  4347. StopSound "Arch_L3"
  4348. StopSound "Arch_L4"
  4349. End Sub
  4350.  
  4351. Sub Arch1_unhit()
  4352. If activeball.velx < -8 Then
  4353. RandomSoundRightArch
  4354. End If
  4355. End Sub
  4356.  
  4357. Sub Arch2_hit()
  4358. If Activeball.velx < 1 Then SoundPlayfieldGate
  4359. StopSound "Arch_R1"
  4360. StopSound "Arch_R2"
  4361. StopSound "Arch_R3"
  4362. StopSound "Arch_R4"
  4363. End Sub
  4364.  
  4365. Sub Arch2_unhit()
  4366. If activeball.velx > 10 Then
  4367. RandomSoundLeftArch
  4368. End If
  4369. End Sub
  4370.  
  4371. '///////////////////////////// SAUCERS (KICKER HOLES) ////////////////////////////
  4372.  
  4373. Sub SoundSaucerLock()
  4374. PlaySoundAtLevelStatic ("Saucer_Enter_" & Int(Rnd*2)+1), SaucerLockSoundLevel, Activeball
  4375. End Sub
  4376.  
  4377. Sub SoundSaucerKick(scenario, saucer)
  4378. Select Case scenario
  4379. Case 0: PlaySoundAtLevelStatic SoundFX("Saucer_Empty", DOFContactors), SaucerKickSoundLevel, saucer
  4380. Case 1: PlaySoundAtLevelStatic SoundFX("Saucer_Kick", DOFContactors), SaucerKickSoundLevel, saucer
  4381. End Select
  4382. End Sub
  4383.  
  4384. '///////////////////////////// BALL COLLISION SOUND ////////////////////////////
  4385. Sub OnBallBallCollision(ball1, ball2, velocity)
  4386. Dim snd
  4387. Select Case Int(Rnd*7)+1
  4388. Case 1 : snd = "Ball_Collide_1"
  4389. Case 2 : snd = "Ball_Collide_2"
  4390. Case 3 : snd = "Ball_Collide_3"
  4391. Case 4 : snd = "Ball_Collide_4"
  4392. Case 5 : snd = "Ball_Collide_5"
  4393. Case 6 : snd = "Ball_Collide_6"
  4394. Case 7 : snd = "Ball_Collide_7"
  4395. End Select
  4396.  
  4397. PlaySound (snd), 0, Csng(velocity) ^2 / 200 * BallWithBallCollisionSoundFactor * VolumeDial, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  4398. End Sub
  4399.  
  4400.  
  4401.  
  4402. ' ============================================================================================
  4403. ' GNMOD - Multiple High Score Display and Collection
  4404. ' ============================================================================================
  4405. Dim EnteringInitials ' Normally zero, set to non-zero to enter initials
  4406. EnteringInitials = 0
  4407.  
  4408. Dim PlungerPulled
  4409. PlungerPulled = 0
  4410.  
  4411. Dim SelectedChar ' character under the "cursor" when entering initials
  4412.  
  4413. Dim HSTimerCount ' Pass counter for HS timer, scores are cycled by the timer
  4414. HSTimerCount = 5 ' Timer is initially enabled, it'll wrap from 5 to 1 when it's displayed
  4415.  
  4416. Dim InitialString ' the string holding the player's initials as they're entered
  4417.  
  4418. Dim AlphaString ' A-Z, 0-9, space (_) and backspace (<)
  4419. Dim AlphaStringPos ' pointer to AlphaString, move forward and backward with flipper keys
  4420. AlphaString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_<"
  4421.  
  4422. Dim HSNewHigh ' The new score to be recorded
  4423.  
  4424. Dim HSScore(5) ' High Scores read in from config file
  4425. Dim HSName(5) ' High Score Initials read in from config file
  4426.  
  4427. ' default high scores, remove this when the scores are available from the config file
  4428. HSScore(1) = 75000
  4429. HSScore(2) = 70000
  4430. HSScore(3) = 60000
  4431. HSScore(4) = 55000
  4432. HSScore(5) = 50000
  4433.  
  4434. HSName(1) = "AAA"
  4435. HSName(2) = "ZZZ"
  4436. HSName(3) = "XXX"
  4437. HSName(4) = "ABC"
  4438. HSName(5) = "BBB"
  4439.  
  4440. Sub HighScoreTimer_Timer
  4441.  
  4442. if EnteringInitials then
  4443. if HSTimerCount = 1 then
  4444. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  4445. HSTimerCount = 2
  4446. else
  4447. SetHSLine 3, InitialString
  4448. HSTimerCount = 1
  4449. end if
  4450. elseif InProgress then
  4451. SetHSLine 1, "HIGH SCORE1"
  4452. SetHSLine 2, HSScore(1)
  4453. SetHSLine 3, HSName(1)
  4454. HSTimerCount = 5 ' set so the highest score will show after the game is over
  4455. HighScoreTimer.enabled=false
  4456. elseif CheckAllScores then
  4457. NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
  4458.  
  4459. else
  4460. ' cycle through high scores
  4461. HighScoreTimer.interval=2000
  4462. HSTimerCount = HSTimerCount + 1
  4463. if HsTimerCount > 5 then
  4464. HSTimerCount = 1
  4465. End If
  4466. SetHSLine 1, "HIGH SCORE"+FormatNumber(HSTimerCount,0)
  4467. SetHSLine 2, HSScore(HSTimerCount)
  4468. SetHSLine 3, HSName(HSTimerCount)
  4469. end if
  4470. End Sub
  4471.  
  4472. Function GetHSChar(String, Index)
  4473. dim ThisChar
  4474. dim FileName
  4475. ThisChar = Mid(String, Index, 1)
  4476. FileName = "PostIt"
  4477. if ThisChar = " " or ThisChar = "" then
  4478. FileName = FileName & "BL"
  4479. elseif ThisChar = "<" then
  4480. FileName = FileName & "LT"
  4481. elseif ThisChar = "_" then
  4482. FileName = FileName & "SP"
  4483. else
  4484. FileName = FileName & ThisChar
  4485. End If
  4486. GetHSChar = FileName
  4487. End Function
  4488.  
  4489. Sub SetHsLine(LineNo, String)
  4490. dim Letter
  4491. dim ThisDigit
  4492. dim ThisChar
  4493. dim StrLen
  4494. dim LetterLine
  4495. dim Index
  4496. dim StartHSArray
  4497. dim EndHSArray
  4498. dim LetterName
  4499. dim xfor
  4500. StartHSArray=array(0,1,12,22)
  4501. EndHSArray=array(0,11,21,31)
  4502. StrLen = len(string)
  4503. Index = 1
  4504.  
  4505. for xfor = StartHSArray(LineNo) to EndHSArray(LineNo)
  4506. Eval("HS"&xfor).image = GetHSChar(String, Index)
  4507. Index = Index + 1
  4508. next
  4509.  
  4510. End Sub
  4511.  
  4512. Sub NewHighScore(NewScore, PlayNum)
  4513. if NewScore > HSScore(5) then
  4514. HighScoreTimer.interval = 500
  4515. HSTimerCount = 1
  4516. AlphaStringPos = 1 ' start with first character "A"
  4517. EnteringInitials = 1 ' intercept the control keys while entering initials
  4518. InitialString = "" ' initials entered so far, initialize to empty
  4519. SetHSLine 1, "PLAYER "+FormatNumber(PlayNum,0)
  4520. SetHSLine 2, "ENTER NAME"
  4521. SetHSLine 3, MID(AlphaString, AlphaStringPos, 1)
  4522. HSNewHigh = NewScore
  4523. For xx=1 to HighScoreReward
  4524. AddSpecial
  4525. next
  4526. End if
  4527. ScoreChecker=ScoreChecker-1
  4528. if ScoreChecker=0 then
  4529. CheckAllScores=0
  4530. end if
  4531. End Sub
  4532.  
  4533. Sub CollectInitials(keycode)
  4534. If keycode = LeftFlipperKey Then
  4535. ' back up to previous character
  4536. AlphaStringPos = AlphaStringPos - 1
  4537. if AlphaStringPos < 1 then
  4538. AlphaStringPos = len(AlphaString) ' handle wrap from beginning to end
  4539. if InitialString = "" then
  4540. ' Skip the backspace if there are no characters to backspace over
  4541. AlphaStringPos = AlphaStringPos - 1
  4542. End if
  4543. end if
  4544. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  4545. PlaySound "DropTargetDropped"
  4546. elseif keycode = RightFlipperKey Then
  4547. ' advance to next character
  4548. AlphaStringPos = AlphaStringPos + 1
  4549. if AlphaStringPos > len(AlphaString) or (AlphaStringPos = len(AlphaString) and InitialString = "") then
  4550. ' Skip the backspace if there are no characters to backspace over
  4551. AlphaStringPos = 1
  4552. end if
  4553. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  4554. PlaySound "DropTargetDropped"
  4555. elseif keycode = StartGameKey or keycode = PlungerKey Then
  4556. SelectedChar = MID(AlphaString, AlphaStringPos, 1)
  4557. if SelectedChar = "_" then
  4558. InitialString = InitialString & " "
  4559. PlaySound("Ding10")
  4560. elseif SelectedChar = "<" then
  4561. InitialString = MID(InitialString, 1, len(InitialString) - 1)
  4562. if len(InitialString) = 0 then
  4563. ' If there are no more characters to back over, don't leave the < displayed
  4564. AlphaStringPos = 1
  4565. end if
  4566. PlaySound("Ding100")
  4567. else
  4568. InitialString = InitialString & SelectedChar
  4569. PlaySound("Ding10")
  4570. end if
  4571. if len(InitialString) < 3 then
  4572. SetHSLine 3, InitialString & SelectedChar
  4573. End If
  4574. End If
  4575. if len(InitialString) = 3 then
  4576. ' save the score
  4577. for i = 5 to 1 step -1
  4578. if i = 1 or (HSNewHigh > HSScore(i) and HSNewHigh <= HSScore(i - 1)) then
  4579. ' Replace the score at this location
  4580. if i < 5 then
  4581. ' MsgBox("Moving " & i & " to " & (i + 1))
  4582. HSScore(i + 1) = HSScore(i)
  4583. HSName(i + 1) = HSName(i)
  4584. end if
  4585. ' MsgBox("Saving initials " & InitialString & " to position " & i)
  4586. EnteringInitials = 0
  4587. HSScore(i) = HSNewHigh
  4588. HSName(i) = InitialString
  4589. HSTimerCount = 5
  4590. HighScoreTimer_Timer
  4591. HighScoreTimer.interval = 2000
  4592. PlaySound("Ding1000")
  4593. exit sub
  4594. elseif i < 5 then
  4595. ' move the score in this slot down by 1, it's been exceeded by the new score
  4596. ' MsgBox("Moving " & i & " to " & (i + 1))
  4597. HSScore(i + 1) = HSScore(i)
  4598. HSName(i + 1) = HSName(i)
  4599. end if
  4600. next
  4601. End If
  4602.  
  4603. End Sub
  4604. ' END GNMOD
  4605. ' ============================================================================================
  4606. ' GNMOD - New Options menu
  4607. ' ============================================================================================
  4608. Dim EnteringOptions
  4609. Dim CurrentOption
  4610. Dim OptionCHS
  4611. Dim MaxOption
  4612. Dim OptionHighScorePosition
  4613. Dim XOpt
  4614. Dim StartingArray
  4615. Dim EndingArray
  4616.  
  4617. StartingArray=Array(0,1,2,30,33,61,89,117,145,173,201,229)
  4618. EndingArray=Array(0,1,29,32,60,88,116,144,172,200,228,256)
  4619. EnteringOptions = 0
  4620. MaxOption = 9
  4621. OptionCHS = 0
  4622. OptionHighScorePosition = 0
  4623. Const OptionLinesToMark="111000011"
  4624. Const OptionLine1="" 'do not use this line
  4625. Const OptionLine2="" 'do not use this line
  4626. Const OptionLine3="" 'do not use this line
  4627. Const OptionLine4=""
  4628. Const OptionLine5=""
  4629. Const OptionLine6=""
  4630. Const OptionLine7=""
  4631. Const OptionLine8="" 'do not use this line
  4632. Const OptionLine9="" 'do not use this line
  4633.  
  4634. Sub OperatorMenuTimer_Timer
  4635. EnteringOptions = 1
  4636. OperatorMenuTimer.enabled=false
  4637. ShowOperatorMenu
  4638. end sub
  4639.  
  4640. sub ShowOperatorMenu
  4641. OperatorMenuBackdrop.image = "OperatorMenu"
  4642.  
  4643. OptionCHS = 0
  4644. CurrentOption = 1
  4645. DisplayAllOptions
  4646. OperatorOption1.image = "BluePlus"
  4647. SetHighScoreOption
  4648.  
  4649. End Sub
  4650.  
  4651. Sub DisplayAllOptions
  4652. dim linecounter
  4653. dim tempstring
  4654. For linecounter = 1 to MaxOption
  4655. tempstring=Eval("OptionLine"&linecounter)
  4656. Select Case linecounter
  4657. Case 1:
  4658. tempstring=tempstring + FormatNumber(BallsPerGame,0)
  4659. SetOptLine 1,tempstring
  4660. Case 2:
  4661. if Replay3Table(ReplayLevel)=999000 then
  4662. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0)
  4663. elseif Replay4Table(ReplayLevel)=999000 then
  4664. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0)
  4665. else
  4666. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0) + "/" + FormatNumber(Replay4Table(ReplayLevel),0)
  4667. end if
  4668. SetOptLine 2,tempstring
  4669. Case 3:
  4670. If OptionCHS=0 then
  4671. tempstring = "NO"
  4672. else
  4673. tempstring = "YES"
  4674. end if
  4675. SetOptLine 3,tempstring
  4676. Case 4:
  4677. SetOptLine 4, tempstring
  4678.  
  4679.  
  4680. SetOptLine 5, tempstring
  4681. Case 5:
  4682. SetOptLine 6, tempstring
  4683.  
  4684.  
  4685. SetOptLine 7, tempstring
  4686.  
  4687. Case 6:
  4688. SetOptLine 8, tempstring
  4689.  
  4690.  
  4691. SetOptLine 9, tempstring
  4692.  
  4693. Case 7:
  4694. SetOptLine 10, tempstring
  4695. SetOptLine 11, tempstring
  4696.  
  4697. Case 8:
  4698.  
  4699. Case 9:
  4700.  
  4701.  
  4702. End Select
  4703.  
  4704. next
  4705. end sub
  4706.  
  4707. sub MoveArrow
  4708. do
  4709. CurrentOption = CurrentOption + 1
  4710. If CurrentOption>Len(OptionLinesToMark) then
  4711. CurrentOption=1
  4712. end if
  4713. loop until Mid(OptionLinesToMark,CurrentOption,1)="1"
  4714. end sub
  4715.  
  4716. sub CollectOptions(ByVal keycode)
  4717. if Keycode = LeftFlipperKey then
  4718. PlaySound "DropTargetDropped"
  4719. For XOpt = 1 to MaxOption
  4720. Eval("OperatorOption"&XOpt).image = "PostitBL"
  4721. next
  4722. MoveArrow
  4723. if CurrentOption<8 then
  4724. Eval("OperatorOption"&CurrentOption).image = "BluePlus"
  4725. elseif CurrentOption=8 then
  4726. Eval("OperatorOption"&CurrentOption).image = "GreenCheck"
  4727. else
  4728. Eval("OperatorOption"&CurrentOption).image = "RedX"
  4729. end if
  4730.  
  4731. elseif Keycode = RightFlipperKey then
  4732. PlaySound "DropTargetDropped"
  4733. if CurrentOption = 1 then
  4734. If BallsPerGame = 3 then
  4735. BallsPerGame = 5
  4736. else
  4737. BallsPerGame = 3
  4738. end if
  4739. DisplayAllOptions
  4740. elseif CurrentOption = 2 then
  4741. ReplayLevel=ReplayLevel+1
  4742. If ReplayLevel>ReplayTableMax then
  4743. ReplayLevel=1
  4744. end if
  4745. DisplayAllOptions
  4746. elseif CurrentOption = 3 then
  4747. if OptionCHS = 0 then
  4748. OptionCHS = 1
  4749.  
  4750. else
  4751. OptionCHS = 0
  4752.  
  4753. end if
  4754. DisplayAllOptions
  4755.  
  4756.  
  4757.  
  4758.  
  4759. elseif CurrentOption = 8 or CurrentOption = 9 then
  4760. if OptionCHS=1 then
  4761. HSScore(1) = 75000
  4762. HSScore(2) = 70000
  4763. HSScore(3) = 60000
  4764. HSScore(4) = 55000
  4765. HSScore(5) = 50000
  4766.  
  4767. HSName(1) = "AAA"
  4768. HSName(2) = "ZZZ"
  4769. HSName(3) = "XXX"
  4770. HSName(4) = "ABC"
  4771. HSName(5) = "BBB"
  4772. end if
  4773.  
  4774. if CurrentOption = 8 then
  4775. savehs
  4776. else
  4777. loadhs
  4778. end if
  4779. OperatorMenuBackdrop.image = "PostitBL"
  4780. For XOpt = 1 to MaxOption
  4781. Eval("OperatorOption"&XOpt).image = "PostitBL"
  4782. next
  4783.  
  4784. For XOpt = 1 to 256
  4785. Eval("Option"&XOpt).image = "PostItBL"
  4786. next
  4787. RefreshReplayCard
  4788. InstructCard.image="IC"
  4789. EnteringOptions = 0
  4790.  
  4791. end if
  4792. end if
  4793. End Sub
  4794.  
  4795. Sub SetHighScoreOption
  4796.  
  4797. End Sub
  4798.  
  4799. Function GetOptChar(String, Index)
  4800. dim ThisChar
  4801. dim FileName
  4802. ThisChar = Mid(String, Index, 1)
  4803. FileName = "PostIt"
  4804. if ThisChar = " " or ThisChar = "" then
  4805. FileName = FileName & "BL"
  4806. elseif ThisChar = "<" then
  4807. FileName = FileName & "LT"
  4808. elseif ThisChar = ">" then
  4809. FileName = FileName & "GT"
  4810. elseif ThisChar = "_" then
  4811. FileName = FileName & "SP"
  4812. elseif ThisChar = "/" then
  4813. FileName = FileName & "SL"
  4814. elseif ThisChar = "," then
  4815. FileName = FileName & "CM"
  4816. else
  4817. FileName = FileName & ThisChar
  4818. End If
  4819. GetOptChar = FileName
  4820. End Function
  4821.  
  4822. dim LineLengths(22) ' maximum number of lines
  4823. Sub SetOptLine(LineNo, String)
  4824. Dim DispLen
  4825. Dim StrLen
  4826. dim xfor
  4827. dim Letter
  4828. dim ThisDigit
  4829. dim ThisChar
  4830. dim LetterLine
  4831. dim Index
  4832. dim LetterName
  4833. StrLen = len(string)
  4834. Index = 1
  4835.  
  4836. StrLen = len(String)
  4837. DispLen = StrLen
  4838. if (DispLen < LineLengths(LineNo)) Then
  4839. DispLen = LineLengths(LineNo)
  4840. end If
  4841.  
  4842. for xfor = StartingArray(LineNo) to StartingArray(LineNo) + DispLen
  4843. Eval("Option"&xfor).image = GetOptChar(string, Index)
  4844. Index = Index + 1
  4845. next
  4846. LineLengths(LineNo) = StrLen
  4847.  
  4848. End Sub
  4849.  
  4850.  
Advertisement
Add Comment
Please, Sign In to add comment