Outhere

Hang Glider

Dec 2nd, 2021
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 222.42 KB | None | 0 0
  1. '* Bally's Hang Glider (1976)
  2. '* https://www.ipdb.org/machine.cgi?id=1112
  3. '* Table primary scripted by Loserman76
  4. '* New Playfield by updon
  5. '
  6. '
  7. 'VPW Hang Glider Team
  8. '***********************
  9. 'Project Lead - Benji
  10.  
  11. 'VPW change log
  12. '001-004 - Benji - Intitial import of baked geometry and low rez images. Added nfozzzy physics and fleep code (most not assigned yet).
  13. '005 - apophis - added RTX BS
  14. '006 - Benji - adjusted flipper mesh height. Adjust transparency of plastic over center kicker,changed background color to black, added holes in playfield mesh and added hole meshes
  15. '007 - gtxjoe - scripted spinner and standup prims. added shot tester (W E R Y U I P A S F G H J K). Standup 002-225 and DropTgt need new pivot point. Drops not scripted yet
  16. '008 - Benji - Changed pivot of all drops and targets 'one more time'...
  17. '009 - gtxjoe - Added roth drop target scripting. Drop targets work but sometimes hard to drop. Not sure why.
  18. '011 - Benji - Playfield hole texture adjusted, apron mesh/render fixed/moved VPX GI deleted. DL changed to 1 on all imported/baked prims
  19. '012 - gtxjoe - Worked on drop target animation. Works but target primitives need to be rotated 180 degrees.
  20. '013 - benji - targets rotated 180 degrees vn_kicker mesh added and vn_KickerArm needs to be animated. Baked sling rubber meshes imported to layer 5, need to be hooked up
  21. '014 - gtxjoe - vn_KickerArm and sling rubber meshes animated. There is temp "vn_KickerArmTEST" to show the kicker arm animation - can be deleted after reviewing
  22. '016 - benji - New half-rez baked render set with adjusted moodier lighting. Added Rubbers collection for fleep hit sounds. Hooked up fleep slingshot shounds. Added more visible playfield holes. Removed old non collidable slings
  23. ' Imported baked GI bulbs as separate mesh, settting DL to 1. Moved them down a bit. Adjusted center kicker plywood hole mesh and texture. Adjusted Apron mesh and texture.
  24. '017 - Benji - more fiddling with baked lighting. added Credit light mesh on hapron with on/off image that needs to be hooked up.
  25. '018 - gtxjoe - Scripted Credit Light, Gottlieb chime sounds and Drop target reset sound
  26. '019 - Benji - adjusted flipper mesh height from playfield. tweaked some render things
  27. '020 - scottacus - flipper tricks and the DT code. If you part out posts those could be dampened.
  28. '021 - apophis - Added GI lights back in on layer 9, set all halo heights to -1. Updated RTX BS implementation.
  29. '022 - apophis - Updated RTX BS so that shadows don't disappear when ball over playfield mesh hole.
  30. '023 - apophis - Updated ambient shadow so that it becomes less dark when close to RTX GI light sources
  31. '024 - Sixtoe - Fixed object & graphics conflicts, tweaked rollovers, minor adjustments
  32. '025 - apophis - added drop target shadow functionality
  33. '026 - apophis - fixed drop target shadow heights. Added rubberizer, target bouncer, and coil ramp up options. Fixed a lot of Fleep sound implementation issues. Updated flipper tricks scripts. Tweaked some physics parameters.
  34. '027 - leojreimroc - Added VR Room. Added Buzzer sound for "Over the Top". Slightly enlarge Apron.
  35. '028 - leojreimroc - Added bar and Fancy Minimal Room
  36. '029 - leojreimroc - Removed Bar Room. Disabled Bumpers and Slingshots during tilt. Slightly adjusted VR Cabinet size.
  37. '030 - Sixtoe - Religned primitives, added missing rubber post, realigned all targets, realigned rubber band targets, adjust centre vuk hole, expanded rubber slings, realigned drop target shadows
  38. '031 - Sixtoe - fixed stupid script mistake, removed redundant images
  39. '032 - Wylte - ShadowConfigFile disabled (may require deletion of HangGlider_76VPX HS file, sorry), Ballsize and Ballmass constants added, Dynamic Shadows updated, GILight002 & 003 added (still no vpx lights behind dt's),
  40. '033 - Sixtoe - Added missing GI lights and bulb primitives, added top of inlane rounded top after ball stopped balancing on it!,
  41.  
  42.  
  43. 'DOF UPDATED BY OUTHERE
  44. '101 Left Flipper
  45. '102 Right Flipper
  46. '103 droptargetreset
  47. '104 vn_Kicker
  48. '105 Spinner
  49. '121 Slingshot Left
  50. '122 Slingshot Right
  51. '124 Bumper Left
  52. '125 Bumper Center
  53. '123 Bumper Right
  54. '128 Ball Release
  55. '111 AutoPlunger
  56. '112 White Flash on
  57.  
  58.  
  59. option explicit
  60. Randomize
  61.  
  62.  
  63. Const Ballsize = 50
  64. Const Ballmass = 1
  65.  
  66. ExecuteGlobal GetTextFile("core.vbs")
  67.  
  68. On Error Resume Next
  69. ExecuteGlobal GetTextFile("Controller.vbs")
  70. If Err Then MsgBox "Unable to open Controller.vbs. Ensure that it is in the scripts folder."
  71. On Error Goto 0
  72.  
  73. Const cGameName = "HangGlider_1976"
  74.  
  75. Const TestMode = 0 'Set to 0 to disable. 1 to enable
  76.  
  77. '********************
  78. 'Options
  79. '********************
  80.  
  81. '----- VR Room -----
  82. Const VRRoom = 0 ' 0 = off, 1 = Minimal Room, 2 = Fancy Minimal Room (Room by b4ast1)
  83.  
  84. '----- General Sound Options -----
  85. Const VolumeDial = 0.8 ' Recommended values should be no greater than 1.
  86.  
  87. '----- Shadow Options -----
  88. Const DynamicBallShadowsOn = 1 '0 = no dynamic ball shadow ("triangles" near slings and such), 1 = enable dynamic ball shadow
  89. Const AmbientBallShadowOn = 1 '0 = Static shadow under ball ("flasher" image, like JP's)
  90. '1 = Moving ball shadow ("primitive" object, like ninuzzu's)
  91. '2 = flasher image shadow, but it moves like ninuzzu's
  92. '----- Phsyics Mods -----
  93. Const RubberizerEnabled = 1 '0 = normal flip rubber, 1 = more lively rubber for flips, 2 = a different rubberizer
  94. Const FlipperCoilRampupMode = 1 '0 = fast, 1 = medium, 2 = slow (tap passes should work)
  95. Const TargetBouncerEnabled = 2 '0 = normal standup targets, 1 = bouncy targets, 2 = orig TargetBouncer
  96. Const TargetBouncerFactor = 1.1 'Level of bounces. Recommmended value of 0.7 when TargetBouncerEnabled=1, and 1.1 when TargetBouncerEnabled=2
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104. '*******************************************
  105. ' Constants and Global Variables
  106. '*******************************************
  107.  
  108. Dim Controller ' B2S
  109. Dim B2SScore ' B2S Score Displayed
  110. Const HSFileName="HangGlider_76VPX.txt"
  111. Const B2STableName="HangGlider_1976"
  112. 'Const LMEMTableConfig="LMEMTables.txt"
  113. 'Const LMEMShadowConfig="LMEMShadows.txt"
  114. 'Dim EnableBallShadow
  115. 'Dim EnableFlipperShadow
  116.  
  117. Dim tablewidth: tablewidth = Table1.width
  118. Dim tableheight: tableheight = Table1.height
  119.  
  120. '* 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
  121. Const ScoreMotorAdjustment=1
  122.  
  123. '* this is a debug setting to use an older scoring routine vs a newer score routine - don't change this value
  124. Const ScoreAdditionAdjustment=1
  125.  
  126. dim ScoreChecker
  127. dim CheckAllScores
  128. dim sortscores(4)
  129. dim sortplayers(4)
  130. Dim B2SOn
  131. Dim B2SFrameCounter
  132. Dim BackglassBallFlagColor
  133. Dim TextStr,TextStr2,TiltEndsGame
  134. Dim i
  135. Dim obj
  136. Dim Points210counter
  137. Dim Points500counter
  138. Dim Points1000counter
  139. Dim Points2000counter
  140. Dim BallsPerGame
  141. Dim InProgress
  142. Dim BallInPlay
  143. Dim CreditsPerCoin
  144. Dim Score100K(4)
  145. Dim Score(4)
  146. Dim ScoreDisplay(4)
  147. Dim HighScorePaid(4)
  148. Dim HighScore
  149. Dim HighScoreReward
  150. Dim BonusMultiplier
  151. Dim Credits
  152. Dim Match
  153. Dim Replay1
  154. Dim Replay2
  155. Dim Replay3
  156. Dim Replay4
  157. Dim Replay1Paid(4)
  158. Dim Replay2Paid(4)
  159. Dim Replay3Paid(4)
  160. Dim Replay4Paid(4)
  161. Dim TableTilted
  162. Dim TiltCount
  163.  
  164. Dim OperatorMenu
  165.  
  166. Dim BonusBooster
  167. Dim BonusBoosterCounter
  168. Dim BonusCounter
  169. Dim HoleCounter
  170.  
  171. Dim Ones
  172. Dim Tens
  173. Dim Hundreds
  174. Dim Thousands
  175.  
  176. Dim Player
  177. Dim Players
  178.  
  179. Dim rst
  180. Dim bonuscountdown
  181. Dim TempMultiCounter
  182. dim TempPlayerup
  183. dim RotatorTemp
  184.  
  185. Dim bump1
  186. Dim bump2
  187. Dim bump3
  188. Dim bump4
  189.  
  190. Dim LastChime10
  191. Dim LastChime100
  192. Dim LastChime1000
  193.  
  194. Dim Score10
  195. Dim Score100
  196.  
  197. Dim targettempscore
  198. Dim CardLightOption
  199. Dim HorseshoeCounter
  200. Dim DropTargetCounter
  201.  
  202. Dim LeftTargetCounter
  203. Dim RightTargetCounter
  204.  
  205. Dim MotorRunning
  206. Dim Replay1Table(15)
  207. Dim Replay2Table(15)
  208. Dim Replay3Table(15)
  209. Dim Replay4Table(15)
  210. Dim ReplayTableSet
  211. Dim ReplayLevel
  212. Dim ReplayTableMax
  213.  
  214. Dim BonusSpecialThreshold
  215. Dim TargetLightsOn
  216. Dim AdvanceLightCounter
  217. dim bonustempcounter
  218.  
  219. dim raceRflag
  220. dim raceAflag
  221. dim raceCflag
  222. dim raceEflag
  223. dim race5flag
  224.  
  225. Dim LStep, LStep2, RStep, xx
  226.  
  227. Dim ReelCounter
  228. Dim BallCounter
  229. Dim BallReelAddStart(12)
  230. Dim BallReelAddFrames(12)
  231. Dim BallReelDropStart(12)
  232. Dim BallReelDropFrames(12)
  233.  
  234. Dim EightLit
  235.  
  236. Dim X
  237. Dim Y
  238. Dim Z
  239. Dim AddABall
  240. Dim AddABallFrames
  241. Dim DropABall
  242. Dim DropABallFrames
  243. Dim CurrentFrame
  244. Dim BonusMotorRunning
  245. Dim QueuedBonusAdds
  246. Dim QueuedBonusDrops
  247.  
  248. Dim ChimesOn
  249.  
  250. Dim TempLightTracker
  251.  
  252. Dim TargetLeftFlag
  253. Dim TargetCenterFlag
  254. Dim TargetRightFlag
  255.  
  256. Dim SpecialLightsFlag
  257.  
  258. Dim AlternatingRelay
  259.  
  260. Dim ZeroToNineUnit
  261.  
  262. Dim StarTriggerValue
  263.  
  264. Dim Kicker1Hold,Kicker2Hold, Kicker3Hold, Kicker4Hold, Kicker5Hold
  265. Dim KickerHold1,KickerHold2,KickerHold3,KickerHold4,KickerHold5
  266.  
  267. Dim mHole,mHole2
  268.  
  269. Dim TargetSequenceCompleted,SpecialLightCounter,HighComplete,LowComplete
  270. Dim ArrowTargetCounter1, ArrowTargetCounter2, ArrowTargetCounter3, ArrowTargetCounter4, tKickerTCount
  271.  
  272. Dim SpinPos,Spin,Count,Count1,Count2,Count3,Reset,VelX,VelY,LitSpinner,SpecialOption, dooralreadyopen, bgpos, GoldBonusCounter, ScoreMotorStepper
  273.  
  274. Dim Object
  275.  
  276. '***********Rotate Spinner
  277.  
  278. Dim Angle
  279.  
  280. Sub SpinnerTimer_Timer
  281. SpinnerPlate.Rotx = Spinner1.CurrentAngle
  282. ' Angle = (sin (sw5.CurrentAngle-180))
  283. ' SpinnerRod.TransX = sin( (sw5.CurrentAngle+180) * (2*PI/360)) * 12
  284. ' SpinnerRod.TransZ = sin( (sw5.CurrentAngle- 90) * (2*PI/360)) * 3.5
  285. ' Dim SpinnerRadius: SpinnerRadius=7
  286. End Sub
  287.  
  288.  
  289. Spin=Array("5","6","7","8","9","10","J","Q","K","A")
  290.  
  291. Dim ReplayBalls1, ReplayBalls2
  292. ReplayBalls1=Array(0,80000,120000)
  293. ReplayBalls2=Array(0,100000,120000)
  294.  
  295. Sub Table1_Init()
  296. If Table1.ShowDT = false then
  297. For each obj in DesktopCrap
  298. obj.visible=False
  299. next
  300. End If
  301.  
  302. OperatorMenuBackdrop.image = "PostitBL"
  303. For XOpt = 1 to MaxOption
  304. Eval("OperatorOption"&XOpt).image = "PostitBL"
  305. next
  306.  
  307. For XOpt = 1 to 256
  308. Eval("Option"&XOpt).image = "PostItBL"
  309. next
  310.  
  311.  
  312. LoadEM
  313. ' LoadLMEMConfig2
  314.  
  315. Count=0
  316. Count1=0
  317. Count2=0
  318. Count3=0
  319. Reset=0
  320. ZeroToNineUnit=Int(Rnd*10)
  321. Kicker1Hold=0
  322.  
  323. EightLit=0
  324.  
  325. BallCounter=0
  326. ReelCounter=0
  327. AddABall=0
  328. DropABall=0
  329. HideOptions
  330. SetupReplayTables
  331. PlasticsOff
  332. BumpersOff
  333. OperatorMenu=0
  334. HighScore=0
  335. MotorRunning=0
  336. HighScoreReward=1
  337. Credits=0
  338. BallsPerGame=5
  339. ReplayLevel=1
  340. TiltEndsGame=0
  341. ChimesOn=1
  342. SpecialOption=10
  343. AlternatingRelay=1
  344. CardLightOption=1
  345. BackglassBallFlagColor=1
  346. loadhs
  347. if HighScore=0 then HighScore=5000
  348.  
  349.  
  350. TableTilted=false
  351.  
  352. Match=int(Rnd*10)
  353. MatchReel.SetValue((Match)+1)
  354.  
  355. SpinPos=int(Rnd*10)
  356.  
  357. ' CanPlayReel.SetValue(0)
  358. GameOverReel.SetValue(1)
  359. BallInPlayReel.SetValue(0)
  360. TiltReel.SetValue(1)
  361.  
  362. For each obj in PlayerHuds
  363. obj.state=0
  364. next
  365. For each obj in PlayerScores
  366. obj.ResetToZero
  367. next
  368. for each obj in ShadowDT
  369. obj.visible=True
  370. Next
  371.  
  372.  
  373. dooralreadyopen=0
  374.  
  375.  
  376. Replay1=Replay1Table(ReplayLevel)
  377. Replay2=Replay2Table(ReplayLevel)
  378. Replay3=Replay3Table(ReplayLevel)
  379. Replay4=Replay4Table(ReplayLevel)
  380.  
  381.  
  382. BonusCounter=0
  383. HoleCounter=0
  384.  
  385.  
  386. InstructCard.image="IC"
  387.  
  388. RefreshReplayCard
  389.  
  390. CurrentFrame=0
  391.  
  392. Bumper1Light.state=0
  393.  
  394.  
  395. AdvanceLightCounter=0
  396.  
  397. If VRRoom > 0 Then
  398. for each Object in VRBGGameOver : object.visible = 1 : next
  399. for each Object in VRBGTilt : object.visible = 1 : next
  400. FlasherMatch
  401.  
  402. cred =reels(4, 0)
  403. reels(4, 0) = 0
  404. SetDrum -1,0, 0
  405. SetReel 0,-1, Credits
  406. reels(4, 0) = Credits
  407. End If
  408.  
  409. Players=0
  410. RotatorTemp=1
  411. InProgress=false
  412. TargetLightsOn=false
  413.  
  414. ScoreText.text=HighScore
  415.  
  416.  
  417. If B2SOn Then
  418.  
  419. if Match=0 then
  420. Controller.B2SSetMatch 10
  421. else
  422. Controller.B2SSetMatch Match
  423. end if
  424. Controller.B2SSetScoreRolloverPlayer1 0
  425. Controller.B2SSetScoreRolloverPlayer2 0
  426. Controller.B2SSetScoreRolloverPlayer3 0
  427. Controller.B2SSetScoreRolloverPlayer4 0
  428.  
  429. 'Controller.B2SSetScore 3,HighScore
  430. Controller.B2SSetTilt 1
  431. Controller.B2SSetCredits Credits
  432. Controller.B2SSetGameOver 1
  433. End If
  434.  
  435. for i=1 to 4
  436. player=i
  437. If B2SOn Then
  438. Controller.B2SSetScorePlayer player, 0
  439. End If
  440. next
  441. bump1=1
  442. bump2=1
  443. bump3=1
  444. bump4=1
  445. InitPauser5.enabled=true
  446. If B2SOn then
  447. Controller.B2SSetData 60+SpinPos,1
  448. end if
  449.  
  450. If Credits > 0 Then DOF 129, DOFOn:vn_CreditLight.Image = "b_CreditLightOn" 'CreditLight.state=1
  451. End Sub
  452.  
  453. Sub Table1_exit()
  454. savehs
  455. ' SaveLMEMConfig
  456. ' SaveLMEMConfig2
  457. If B2SOn Then Controller.Stop
  458. end sub
  459.  
  460. Sub BlinkingLogo_timer
  461. LogoReel.SetValue(int((Rnd * 100) / 25))
  462. end sub
  463.  
  464.  
  465. Sub TimerTitle1_timer
  466. if B2SOn then
  467. if raceRflag=1 then
  468. Controller.B2SSetData 11,0
  469. raceRflag=0
  470. else
  471. Controller.B2SSetData 11,1
  472. raceRflag=1
  473. end if
  474. end if
  475. end sub
  476.  
  477. Sub TimerTitle2_timer
  478. if B2SOn then
  479. if raceAflag=1 then
  480. Controller.B2SSetData 12,0
  481. raceAflag=0
  482. else
  483. Controller.B2SSetData 12,1
  484. raceAflag=1
  485. end if
  486. end if
  487. end sub
  488.  
  489. Sub TimerTitle3_timer
  490. if B2SOn then
  491. if raceCflag=1 then
  492. Controller.B2SSetData 13,0
  493. raceCflag=0
  494. else
  495. Controller.B2SSetData 13,1
  496. raceCflag=1
  497. end if
  498. end if
  499. end sub
  500.  
  501. Sub TimerTitle4_timer
  502. if B2SOn then
  503. if raceEflag=1 then
  504. Controller.B2SSetData 14,0
  505. raceEflag=0
  506. else
  507. Controller.B2SSetData 14,1
  508. raceEflag=1
  509. end if
  510. end if
  511. end sub
  512.  
  513. Sub TimerTitle5_timer
  514. if B2SOn then
  515. if race5flag=1 then
  516. Controller.B2SSetData 15,0
  517. race5flag=0
  518. else
  519. Controller.B2SSetData 15,1
  520. race5flag=1
  521. end if
  522. end if
  523. end sub
  524.  
  525.  
  526. Sub Table1_KeyDown(ByVal keycode)
  527.  
  528. TestTableKeyDownCheck keycode
  529.  
  530. ' GNMOD
  531. if EnteringInitials then
  532. CollectInitials(keycode)
  533. exit sub
  534. end if
  535.  
  536.  
  537. if EnteringOptions then
  538. CollectOptions(keycode)
  539. exit sub
  540. end if
  541.  
  542.  
  543. If keycode = PlungerKey Then
  544. Plunger.PullBack
  545. PlungerPulled = 1
  546. If VRRoom > 0 Then
  547. TimerVRPlunger.Enabled = True
  548. TimerVRPlunger2.Enabled = False
  549. End If
  550. End If
  551.  
  552. '********************
  553.  
  554. ' if keycode = LeftFlipperKey and InProgress = false then
  555. ' OperatorMenuTimer.Enabled = true
  556. ' end if
  557. ' END GNMOD
  558.  
  559.  
  560. ' If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  561. ' LeftFlipper.RotateToEnd
  562. ' PlaySound "buzzL",-1
  563. ' PlaySound SoundFXDOF("FlipperUp",101,DOFOn, DOFFlippers)
  564. ' End If
  565.  
  566. ' If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  567. ' RightFlipper.RotateToEnd
  568.  
  569. ' PlaySound SoundFXDOF("FlipperUp",102,DOFOn, DOFFlippers)
  570. ' PlaySound "buzz",-1
  571.  
  572. ' End If
  573.  
  574. '**********************
  575.  
  576. Const ReflipAngle = 20
  577.  
  578. if keycode = LeftFlipperKey and InProgress = false then
  579. OperatorMenuTimer.Enabled = true
  580. end if
  581. ' END GNMOD
  582.  
  583. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  584. LFPress = 1
  585. lf.fire
  586.  
  587. LeftFlipper.RotateToEnd
  588.  
  589. If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
  590. RandomSoundReflipUpLeft LeftFlipper
  591. Else
  592. SoundFlipperUpAttackLeft LeftFlipper
  593. RandomSoundFlipperUpLeft LeftFlipper
  594. End If
  595.  
  596. DOF 101, DOFON
  597. PlaySoundAtVolLoops "buzzL",LeftFlipper,0.05,-1
  598. End If
  599.  
  600. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  601. RFPress = 1
  602. rf.fire
  603. RightFlipper.RotateToEnd
  604.  
  605. If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
  606. RandomSoundReflipUpRight RightFlipper
  607. Else
  608. SoundFlipperUpAttackRight RightFlipper
  609. RandomSoundFlipperUpRight RightFlipper
  610. End If
  611.  
  612. DOF 102, DOFON
  613. PlaySoundAtVolLoops "buzz",LeftFlipper,0.05,-1
  614. End If
  615.  
  616.  
  617. '*******************
  618.  
  619. If keycode = LeftTiltKey Then
  620. Nudge 90, 2
  621. TiltIt
  622. SoundNudgeLeft
  623. End If
  624.  
  625. If keycode = RightTiltKey Then
  626. Nudge 270, 2
  627. TiltIt
  628. SoundNudgeRight
  629. End If
  630.  
  631. If keycode = CenterTiltKey Then
  632. Nudge 0, 2
  633. TiltIt
  634. SoundNudgeCenter
  635. End If
  636.  
  637. If keycode = MechanicalTilt Then
  638. TiltCount=2
  639. TiltIt
  640. End If
  641.  
  642.  
  643. If keycode = AddCreditKey or keycode = 4 then
  644. If B2SOn Then
  645. 'Controller.B2SSetScorePlayer6 HighScore
  646.  
  647. End If
  648.  
  649. Select Case Int(rnd*3)
  650. Case 0: PlaySound ("Coin_In_1"), 0, CoinSoundLevel, 0, 0.25
  651. Case 1: PlaySound ("Coin_In_2"), 0, CoinSoundLevel, 0, 0.25
  652. Case 2: PlaySound ("Coin_In_3"), 0, CoinSoundLevel, 0, 0.25
  653. End Select
  654.  
  655. AddSpecial2
  656. end if
  657.  
  658. if keycode = 5 then
  659. AddSpecial2
  660. keycode= StartGameKey
  661. Select Case Int(rnd*3)
  662. Case 0: PlaySound ("Coin_In_1"), 0, CoinSoundLevel, 0, 0.25
  663. Case 1: PlaySound ("Coin_In_2"), 0, CoinSoundLevel, 0, 0.25
  664. Case 2: PlaySound ("Coin_In_3"), 0, CoinSoundLevel, 0, 0.25
  665. End Select
  666. end if
  667.  
  668.  
  669. if keycode = StartGameKey and Credits>0 and InProgress=true and Players>0 and Players<4 and BallInPlay<2 then
  670. Credits=Credits-1
  671. If Credits <1 Then DOF 129, DOFOff:vn_CreditLight.Image = "b_CreditLightOff" ':CreditLight.state=0
  672. CreditsReel.SetValue(Credits)
  673. EMReel7.SetValue(Credits)
  674. Players=Players+1
  675. for each obj in CanPlayLights
  676. obj.state=0
  677. next
  678. CanPlayLights(Players-1).state=1
  679. If VRRoom > 0 Then
  680. FlasherPlayers
  681. cred =reels(4, 0)
  682. reels(4, 0) = 0
  683. SetDrum -1,0, 0
  684. SetReel 0,-1, Credits
  685. reels(4, 0) = Credits
  686. End If
  687.  
  688. SoundStartButton
  689. If B2SOn Then
  690. Controller.B2SSetCanPlay Players
  691. Controller.B2SSetCredits Credits
  692. End If
  693. end if
  694.  
  695. if keycode=StartGameKey and Credits>0 and InProgress=false and Players=0 and EnteringOptions = 0 then
  696. 'GNMOD
  697. OperatorMenuTimer.Enabled = false
  698. 'END GNMOD
  699. Credits=Credits-1
  700. If Credits < 1 Then DOF 129, DOFOff:vn_CreditLight.Image = "b_CreditLightOff" ':CreditLight.state=0
  701. CreditsReel.SetValue(Credits)
  702. Players=1
  703. for each obj in CanPlayLights
  704. obj.state=0
  705. next
  706. CanPlayLights(Players-1).state=1
  707. MatchReel.SetValue(0)
  708. Player=1
  709. RolloverReel1.SetValue(0)
  710. RolloverReel2.SetValue(0)
  711. RolloverReel3.SetValue(0)
  712. RolloverReel4.SetValue(0)
  713. playsound "startup_norm"
  714. TempPlayerUp=Player
  715. ' PlayerUpRotator.enabled=true
  716. GameOverReel.SetValue(0)
  717. rst=0
  718. BallInPlay=1
  719. InProgress=true
  720. resettimer.enabled=true
  721. BonusMultiplier=1
  722. TiltOff
  723.  
  724. If VRRoom > 0 Then
  725. for each Object in VRBGTilt : object.visible = 0 : next
  726. for each Object in VRBGGameOver : object.visible = 0 : next
  727. for each Object in VRBGMatch : object.visible = 0 : next
  728. for each Object in VRBGShootAgain : object.visible = 0 : Next
  729. for each Object in VRBG100kAll : object.visible = 0 : next
  730. FlasherPlayers
  731. FlasherCurrentPlayer
  732. cred =reels(4, 0)
  733. reels(4, 0) = 0
  734. SetDrum -1,0, 0
  735. SetReel 0,-1, Credits
  736. reels(4, 0) = Credits
  737. End If
  738.  
  739.  
  740. If B2SOn Then
  741. Controller.B2SSetTilt 0
  742. Controller.B2SSetGameOver 0
  743. Controller.B2SSetMatch 0
  744. Controller.B2SSetCredits Credits
  745. 'Controller.B2SSetScore 3,HighScore
  746. Controller.B2SSetCanPlay 1
  747. Controller.B2SSetPlayerUp 1
  748. 'Controller.B2SSetBallInPlay BallInPlay
  749. Controller.B2SSetScoreRolloverPlayer1 0
  750. Controller.B2SSetScoreRolloverPlayer2 0
  751. Controller.B2SSetScoreRolloverPlayer3 0
  752. Controller.B2SSetScoreRolloverPlayer4 0
  753. Controller.B2SSetData 99,1
  754. Controller.B2SSetData 11,0
  755. Controller.B2SSetData 12,0
  756. Controller.B2SSetData 13,0
  757. Controller.B2SSetData 14,0
  758. Controller.B2SSetData 15,0
  759. End If
  760. If Table1.ShowDT = True then
  761. For each obj in PlayerScores
  762. ' obj.ResetToZero
  763. obj.Visible=true
  764. next
  765.  
  766.  
  767. For each obj in PlayerHuds
  768. obj.state=0
  769. next
  770.  
  771. PlayerHuds(Player-1).state=1
  772.  
  773. end If
  774. end if
  775.  
  776. If VRRoom > 0 Then
  777. If keycode = LeftFlipperKey Then
  778. Primary_flipper_button_left.X = 2109.804 + 2
  779. End If
  780. If keycode = RightFlipperKey Then
  781. Primary_flipper_button_right.X = 2104.841 - 2
  782. End If
  783. If keycode = StartGameKey Then
  784. Start_button.y = -245.1216 - 1
  785. End If
  786. End If
  787.  
  788. If keycode = 46 Then' C Key
  789. stopSound "FlipBuzzLA"
  790. stopSound "FlipBuzzLB"
  791. stopSound "FlipBuzzLC"
  792. stopSound "FlipBuzzLD"
  793. stopSound "FlipBuzzRA"
  794. stopSound "FlipBuzzRB"
  795. stopSound "FlipBuzzRC"
  796. stopSound "FlipBuzzRD"
  797. If contball = 1 Then
  798. contball = 0
  799. Else
  800. contball = 1
  801. End If
  802. End If
  803.  
  804. If keycode = 48 Then 'B Key
  805. If bcboost = 1 Then
  806. bcboost = bcboostmulti
  807. Else
  808. bcboost = 1
  809. End If
  810. End If
  811.  
  812. If keycode = 203 Then cLeft = 1' Left Arrow
  813.  
  814. If keycode = 200 Then cUp = 1' Up Arrow
  815.  
  816. If keycode = 208 Then cDown = 1' Down Arrow
  817.  
  818. If keycode = 205 Then cRight = 1' Right Arrow
  819.  
  820. If keycode = 52 Then Zup = 1' Period
  821.  
  822.  
  823. End Sub
  824.  
  825. Sub Table1_KeyUp(ByVal keycode)
  826.  
  827. TestTableKeyUpCheck keycode
  828.  
  829. ' GNMOD
  830. if EnteringInitials then
  831. exit sub
  832. end if
  833.  
  834. If keycode = PlungerKey Then
  835.  
  836. if PlungerPulled = 0 then
  837. exit sub
  838. end if
  839.  
  840. SoundPlungerPull
  841. Plunger.Fire
  842. End If
  843.  
  844. If VRRoom > 0 Then
  845. If keycode = PlungerKey Then
  846. TimerVRPlunger.Enabled = False
  847. TimerVRPlunger2.Enabled = True
  848. End If
  849. End If
  850.  
  851. if keycode = LeftFlipperKey then
  852. OperatorMenuTimer.Enabled = false
  853. end if
  854.  
  855. ' END GNMOD
  856.  
  857. If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
  858. DOF 101, DOFOff
  859. LeftFlipper.RotateToStart
  860. StopSound "buzzL"
  861. If LeftFlipper.currentangle < LeftFlipper.startAngle - 5 Then
  862. RandomSoundFlipperDownLeft LeftFlipper
  863. End If
  864. FlipperLeftHitParm = FlipperUpSoundLevel
  865.  
  866.  
  867. End If
  868.  
  869. If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
  870. DOF 102, DOFOff
  871. RightFlipper.RotateToStart
  872. StopSound "buzz"
  873. If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
  874. RandomSoundFlipperDownRight RightFlipper
  875. End If
  876. FlipperRightHitParm = FlipperUpSoundLevel
  877.  
  878. End If
  879.  
  880. If VRRoom > 0 Then
  881. If keycode = LeftFlipperKey Then
  882. Primary_flipper_button_left.X = 2109.804
  883. End If
  884. If keycode = RightFlipperKey Then
  885. Primary_flipper_button_right.X = 2104.841
  886. End If
  887. If keycode = StartGameKey Then
  888. Start_button.y = -245.1216
  889. End If
  890. End If
  891.  
  892. If keycode = 203 then cLeft = 0' Left Arrow
  893.  
  894. If keycode = 200 then cUp = 0' Up Arrow
  895.  
  896. If keycode = 208 then cDown = 0' Down Arrow
  897.  
  898. If keycode = 205 then cRight = 0' Right Arrow
  899.  
  900. If keycode = 52 Then Zup = 0' Period
  901.  
  902. End Sub
  903.  
  904.  
  905.  
  906. Sub Drain_Hit()
  907. Drain.DestroyBall
  908. RandomSoundDrain Drain
  909. DOF 137, DOFPulse
  910. Pause4Bonustimer.enabled=true
  911.  
  912. End Sub
  913.  
  914. Sub Trigger1_Unhit()
  915. DOF 138, DOFPulse
  916. End Sub
  917.  
  918. Sub Pause4Bonustimer_timer
  919. Pause4Bonustimer.enabled=0
  920. ScoreGoldBonus
  921.  
  922. End Sub
  923.  
  924. '***********************
  925. ' Flipper Logos
  926. '***********************
  927.  
  928. Sub UpdateFlipperLogos_Timer
  929. LFlip.RotZ = LeftFlipper.CurrentAngle
  930. RFlip.RotZ = RightFlipper.CurrentAngle
  931. ' LFlip1.RotZ = LeftFlipper.CurrentAngle
  932. ' RFlip1.RotZ = RightFlipper.CurrentAngle
  933. PGate.Rotz = (Gate.CurrentAngle*.75) + 25
  934. PGate1.Rotz = (Gate002.CurrentAngle*.75) + 25
  935. FlipperLSh.RotZ = LeftFlipper.currentangle
  936. FlipperRSh.RotZ = RightFlipper.currentangle
  937.  
  938. SpinnerPlate.RotX = -Spinner1.currentangle
  939. End Sub
  940.  
  941. '***********************
  942. ' Flipper Collide
  943. '***********************
  944.  
  945. Sub LeftFlipper_Collide(parm)
  946. CheckLiveCatch Activeball, LeftFlipper, LFCount, parm
  947. LeftFlipperCollide parm
  948. if RubberizerEnabled = 1 then Rubberizer(parm)
  949. if RubberizerEnabled = 2 then Rubberizer2(parm)
  950. End Sub
  951.  
  952. Sub RightFlipper_Collide(parm)
  953. CheckLiveCatch Activeball, RightFlipper, RFCount, parm
  954. RightFlipperCollide parm
  955. if RubberizerEnabled = 1 then Rubberizer(parm)
  956. if RubberizerEnabled = 2 then Rubberizer2(parm)
  957. End Sub
  958.  
  959.  
  960.  
  961.  
  962. '*******************************************
  963. ' VPW Rubberizer by Iaakki
  964. '*******************************************
  965.  
  966. ' iaakki Rubberizer
  967. sub Rubberizer(parm)
  968. if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
  969. 'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  970. activeball.angmomz = activeball.angmomz * 1.2
  971. activeball.vely = activeball.vely * 1.2
  972. 'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  973. Elseif parm <= 2 and parm > 0.2 and activeball.vely < 0 Then
  974. 'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  975. activeball.angmomz = activeball.angmomz * -1.1
  976. activeball.vely = activeball.vely * 1.4
  977. 'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  978. end if
  979. end sub
  980.  
  981. ' apophis Rubberizer
  982. sub Rubberizer2(parm)
  983. if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
  984. 'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  985. activeball.angmomz = -activeball.angmomz * 2
  986. activeball.vely = activeball.vely * 1.2
  987. 'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  988. Elseif parm <= 2 and parm > 0.2 and activeball.vely < 0 Then
  989. 'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
  990. activeball.angmomz = -activeball.angmomz * 0.5
  991. activeball.vely = activeball.vely * (1.2 + rnd(1)/3 )
  992. 'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
  993. end if
  994. end sub
  995.  
  996. '******************************************************
  997. ' VPW TargetBouncer for targets and posts by Iaakki, Wrd1972, Apophis
  998. '******************************************************
  999.  
  1000. sub TargetBouncer(aBall,defvalue)
  1001. dim zMultiplier, vel, vratio
  1002. if TargetBouncerEnabled = 1 and aball.z < 30 then
  1003. 'debug.print "velx: " & aball.velx & " vely: " & aball.vely & " velz: " & aball.velz
  1004. vel = BallSpeed(aBall)
  1005. if aBall.velx = 0 then vratio = 1 else vratio = aBall.vely/aBall.velx
  1006. Select Case Int(Rnd * 6) + 1
  1007. Case 1: zMultiplier = 0.2*defvalue
  1008. Case 2: zMultiplier = 0.25*defvalue
  1009. Case 3: zMultiplier = 0.3*defvalue
  1010. Case 4: zMultiplier = 0.4*defvalue
  1011. Case 5: zMultiplier = 0.45*defvalue
  1012. Case 6: zMultiplier = 0.5*defvalue
  1013. End Select
  1014. aBall.velz = abs(vel * zMultiplier * TargetBouncerFactor)
  1015. aBall.velx = sgn(aBall.velx) * sqr(abs((vel^2 - aBall.velz^2)/(1+vratio^2)))
  1016. aBall.vely = aBall.velx * vratio
  1017. 'debug.print "---> velx: " & aball.velx & " vely: " & aball.vely & " velz: " & aball.velz
  1018. 'debug.print "conservation check: " & BallSpeed(aBall)/vel
  1019. elseif TargetBouncerEnabled = 2 and aball.z < 30 then
  1020. 'debug.print "velz: " & activeball.velz
  1021. Select Case Int(Rnd * 4) + 1
  1022. Case 1: zMultiplier = defvalue+1.1
  1023. Case 2: zMultiplier = defvalue+1.05
  1024. Case 3: zMultiplier = defvalue+0.7
  1025. Case 4: zMultiplier = defvalue+0.3
  1026. End Select
  1027. aBall.velz = aBall.velz * zMultiplier * TargetBouncerFactor
  1028. 'debug.print "----> velz: " & activeball.velz
  1029. 'debug.print "conservation check: " & BallSpeed(aBall)/vel
  1030. end if
  1031. end sub
  1032.  
  1033.  
  1034. '***********************
  1035. ' slingshots
  1036. '
  1037.  
  1038. Sub RightSlingShot_Slingshot
  1039. If TableTilted = False Then
  1040. RandomSoundSlingshotRight Sling1
  1041. DOF 122, DOFPulse
  1042. ' RSling0.Visible = 0
  1043. ' RSling1.Visible = 1
  1044. vn_RSling0.Visible = 0
  1045. vn_RSling1.Visible = 1
  1046. sling1.TransZ = -20
  1047. RStep = 0
  1048. RightSlingShot.TimerEnabled = 1
  1049. AddScore 10
  1050. End If
  1051. End Sub
  1052.  
  1053. Sub RightSlingShot_Timer
  1054. Select Case RStep
  1055. Case 3:vn_RSLing1.Visible = 0:vn_RSLing2.Visible = 1:sling1.TransZ = -10
  1056. Case 4:vn_RSLing2.Visible = 0:vn_RSling0.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  1057. ' Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  1058. ' Case 4:RSLing2.Visible = 0:RSling0.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  1059. End Select
  1060. RStep = RStep + 1
  1061. End Sub
  1062.  
  1063.  
  1064. Sub LeftSlingShot_Slingshot
  1065. If TableTilted = False Then
  1066. RandomSoundSlingshotLeft Sling2
  1067. DOF 121, DOFPulse
  1068. ' LSling0.Visible = 0
  1069. ' LSling1.Visible = 1
  1070. vn_LSling0.Visible = 0
  1071. vn_LSling1.Visible = 1
  1072. sling2.TransZ = -20
  1073. LStep = 0
  1074. LeftSlingShot.TimerEnabled = 1
  1075. AddScore 10
  1076. End If
  1077. End Sub
  1078.  
  1079. Sub LeftSlingShot_Timer
  1080. Select Case LStep
  1081. ' Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  1082. ' Case 4:LSLing2.Visible = 0:LSLing0.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  1083. Case 3:vn_LSLing1.Visible = 0:vn_LSLing2.Visible = 1:sling2.TransZ = -10
  1084. Case 4:vn_LSLing2.Visible = 0:vn_LSLing0.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  1085. End Select
  1086. LStep = LStep + 1
  1087. End Sub
  1088.  
  1089.  
  1090.  
  1091. '***********************************
  1092. ' Walls
  1093. '***********************************
  1094.  
  1095. Sub RubberWallSwitches_Hit(idx)
  1096. if TableTilted=false then
  1097. AddScore(10)
  1098. end if
  1099. end Sub
  1100.  
  1101.  
  1102. '***********************************
  1103. ' Bumpers
  1104. '***********************************
  1105.  
  1106.  
  1107. Sub Bumper1_Hit
  1108. If TableTilted=false then
  1109.  
  1110. RandomSoundBumperTop Bumper1
  1111. DOF 124, DOFPulse
  1112. bump1 = 1
  1113. If Bumper1Light.state=1 then
  1114. AddScore(100)
  1115. else
  1116. AddScore(100)
  1117. end if
  1118.  
  1119. end if
  1120. End Sub
  1121.  
  1122. Sub Bumper2_Hit
  1123. If TableTilted=false then
  1124.  
  1125. RandomSoundBumperMiddle Bumper2
  1126. DOF 123, DOFPulse
  1127. bump1 = 1
  1128. If Bumper2Light.state=1 then
  1129. AddScore(100)
  1130. else
  1131. AddScore(100)
  1132. end if
  1133.  
  1134. end if
  1135.  
  1136. End Sub
  1137.  
  1138. Sub Bumper3_Hit
  1139. If TableTilted=false then
  1140.  
  1141. RandomSoundBumperBottom Bumper3
  1142. DOF 125, DOFPulse
  1143. bump1 = 1
  1144. If Bumper3Light.state=1 then
  1145. AddScore(10)
  1146. else
  1147. AddScore(10)
  1148. end if
  1149. end if
  1150.  
  1151. End Sub
  1152.  
  1153.  
  1154.  
  1155. '************************************
  1156. ' Rollover lanes
  1157. '************************************
  1158.  
  1159. Sub TriggerCollection_Hit(idx)
  1160. DOF 110 + idx, DOFPulse
  1161. If TableTilted=false then
  1162.  
  1163.  
  1164. Select Case idx
  1165. case 0:
  1166. AddScore(1000)
  1167. If ExtraBall001.state=1 then
  1168. AddSpecial
  1169. end if
  1170. case 1:
  1171. SetMotor(500)
  1172. IncreaseGoldBonus
  1173.  
  1174. case 2:
  1175. SetMotor(500)
  1176. IncreaseGoldBonus
  1177.  
  1178. case 3:
  1179. AddScore(1000)
  1180. If ExtraBall004.state=1 then
  1181. AddSpecial
  1182. end if
  1183. case 4:
  1184. SetMotor(500)
  1185. IncreaseGoldBonus
  1186. If RightAlleyLight.state=1 then
  1187. DoubleBonus.state=1
  1188. SpinnerLight.state=1
  1189. end if
  1190. end select
  1191.  
  1192. end if
  1193. end sub
  1194. '************************************
  1195. ' Buttons
  1196. '************************************
  1197. Sub Buttons_hit(idx)
  1198. ButtonPrims(idx).z=-2.2
  1199. if TableTilted=false then
  1200. if ButtonLights(idx).state=1 then
  1201. SetMotor(500)
  1202. IncreaseGoldBonus
  1203. end if
  1204. end if
  1205. end sub
  1206. Sub Buttons_unhit(idx)
  1207. ButtonPrims(idx).z=.5
  1208. end sub
  1209.  
  1210.  
  1211. 'Sub Trigger001_Unhit
  1212. ' Button001.z=.5
  1213. 'end sub
  1214. '
  1215. 'Sub Trigger002_Unhit
  1216. ' Button002.z=.5
  1217. 'end sub
  1218. '
  1219. 'Sub Trigger003_Unhit
  1220. ' Button003.z=.5
  1221. 'end sub
  1222. '
  1223. 'Sub Trigger004_Unhit
  1224. ' Button004.z=.5
  1225. 'end sub
  1226. '
  1227. 'Sub Trigger005_Unhit
  1228. ' Button005.z=.5
  1229. 'end sub
  1230. '
  1231. 'Sub Trigger006_Unhit
  1232. ' Button006.z=.5
  1233. 'end sub
  1234. '
  1235. 'Sub Trigger007_Unhit
  1236. ' Button007.z=.5
  1237. 'end sub
  1238. '
  1239. 'Sub Trigger008_Unhit
  1240. ' Button008.z=.5
  1241. 'end sub
  1242. '
  1243. 'Sub Trigger009_Unhit
  1244. ' Button009.z=.5
  1245. 'end sub
  1246. '
  1247. 'Sub Trigger010_Unhit
  1248. ' Button010.z=.5
  1249. 'end sub
  1250.  
  1251.  
  1252.  
  1253. '**************************************
  1254. Sub Postup
  1255.  
  1256. end Sub
  1257.  
  1258. Sub Postdown
  1259. end Sub
  1260.  
  1261. '****************************************************
  1262.  
  1263.  
  1264.  
  1265. ' Targets
  1266. '**************************************
  1267. Sub TargetCollection_hit(idx)
  1268. if TableTilted=false then
  1269. DOF 130+idx,DOFPulse
  1270.  
  1271. Select case idx
  1272. case 0,1,2,3,4:
  1273. if BonusTargetLights(idx).state=1 then
  1274. SetMotor(500)
  1275. IncreaseGoldBonus
  1276. else
  1277. AddScore(100)
  1278. end if
  1279. case 5:
  1280. SetMotor(500)
  1281. ' Target006.IsDropped=true
  1282. ' playsound "droptargetdropped"
  1283. Cards001.state=1
  1284. CheckCardLights
  1285. case 6:
  1286. SetMotor(500)
  1287. ' Target007.IsDropped=true
  1288. ' playsound "droptargetdropped"
  1289. Cards002.state=1
  1290. CheckCardLights
  1291. case 7:
  1292. SetMotor(500)
  1293. ' Target008.IsDropped=true
  1294. ' playsound "droptargetdropped"
  1295. Cards003.state=1
  1296. CheckCardLights
  1297. case 8:
  1298. SetMotor(500)
  1299. ' Target009.IsDropped=true
  1300. ' playsound "droptargetdropped"
  1301. Cards004.state=1
  1302. CheckCardLights
  1303. case 9:
  1304. SetMotor(500)
  1305. ' Target010.IsDropped=true
  1306. ' playsound "droptargetdropped"
  1307. Cards005.state=1
  1308. CheckCardLights
  1309. end select
  1310.  
  1311. end if
  1312. end sub
  1313.  
  1314.  
  1315. sub CheckCardLights
  1316. If Cards001.state=1 AND Cards002.state=1 AND Cards003.state=1 AND Cards004.state=1 AND Cards005.state=1 then
  1317. If KickerLight1.state=0 AND KickerLight2.state=0 AND ShootAgain.state=0 then
  1318. KickerLight1.state=1
  1319.  
  1320. DisplayAltRelay
  1321. elseif ShootAgain.state=1 OR KickerLight1.state=1 then
  1322. KickerLight1.state=0
  1323. KickerLight2.state=1
  1324. end if
  1325. end if
  1326. end sub
  1327.  
  1328.  
  1329. Dim Target001Step
  1330. Sub Target001_Hit
  1331. vca_Target001.RotX = 5
  1332. Target001Step = 0
  1333. Target001.TimerEnabled = True
  1334. 'PlaySoundAt SoundFX("target",DOFTargets),Target001
  1335. End Sub
  1336. Sub Target001_timer()
  1337. Select Case Target001Step
  1338. Case 1:vca_Target001.RotX = 3
  1339. Case 2:vca_Target001.RotX = -2
  1340. Case 3:vca_Target001.RotX = 1
  1341. Case 4:vca_Target001.RotX = 0: Target001.TimerEnabled = False: Target001Step = 0
  1342. End Select
  1343. Target001Step = Target001Step + 1
  1344. End Sub
  1345.  
  1346. Dim Target002Step
  1347. Sub Target002_Hit
  1348. vca_Target002.RotX = 5
  1349. Target002Step = 0
  1350. Target002.TimerEnabled = True
  1351. 'PlaySoundAt SoundFX("target",DOFTargets),Target002
  1352. End Sub
  1353. Sub Target002_timer()
  1354. Select Case Target002Step
  1355. Case 1:vca_Target002.RotX = 3
  1356. Case 2:vca_Target002.RotX = -2
  1357. Case 3:vca_Target002.RotX = 1
  1358. Case 4:vca_Target002.RotX = 0: Target002.TimerEnabled = False: Target002Step = 0
  1359. End Select
  1360. Target002Step = Target002Step + 1
  1361. End Sub
  1362.  
  1363. Dim Target003Step
  1364. Sub Target003_Hit
  1365. vca_Target003.RotX = 5
  1366. Target003Step = 0
  1367. Target003.TimerEnabled = True
  1368. 'PlaySoundAt SoundFX("target",DOFTargets),Target003
  1369. End Sub
  1370. Sub Target003_timer()
  1371. Select Case Target003Step
  1372. Case 1:vca_Target003.RotX = 3
  1373. Case 2:vca_Target003.RotX = -2
  1374. Case 3:vca_Target003.RotX = 1
  1375. Case 4:vca_Target003.RotX = 0: Target003.TimerEnabled = False: Target003Step = 0
  1376. End Select
  1377. Target003Step = Target003Step + 1
  1378. End Sub
  1379.  
  1380. Dim Target004Step
  1381. Sub Target004_Hit
  1382. vca_Target004.RotX = -5
  1383. Target004Step = 0
  1384. Target004.TimerEnabled = True
  1385. 'PlaySoundAt SoundFX("target",DOFTargets),Target004
  1386. End Sub
  1387. Sub Target004_timer()
  1388. Select Case Target004Step
  1389. Case 1:vca_Target004.RotX = -3
  1390. Case 2:vca_Target004.RotX = 2
  1391. Case 3:vca_Target004.RotX = -1
  1392. Case 4:vca_Target004.RotX = 0: Target004.TimerEnabled = False: Target004Step = 0
  1393. End Select
  1394. Target004Step = Target004Step + 1
  1395. End Sub
  1396.  
  1397. Dim Target005Step
  1398. Sub Target005_Hit
  1399. vca_Target005.RotX = -5
  1400. Target005Step = 0
  1401. Target005.TimerEnabled = True
  1402. 'PlaySoundAt SoundFX("target",DOFTargets),Target005
  1403. End Sub
  1404. Sub Target005_timer()
  1405. Select Case Target005Step
  1406. Case 1:vca_Target005.RotX = -3
  1407. Case 2:vca_Target005.RotX = 2
  1408. Case 3:vca_Target005.RotX = -1
  1409. Case 4:vca_Target005.RotX = 0: Target005.TimerEnabled = False: Target005Step = 0
  1410. End Select
  1411. Target005Step = Target005Step + 1
  1412. End Sub
  1413.  
  1414.  
  1415.  
  1416. '******************************************
  1417. ' Drop Targets
  1418.  
  1419. Dim DT006, DT007, DT008, DT009, DT010
  1420. DT006 = Array(WallTarget006, WallTarget006offset, vca_Target006, 06, 0)
  1421. DT007 = Array(WallTarget007, WallTarget007offset, vca_Target007, 07, 0)
  1422. DT008 = Array(WallTarget008, WallTarget008offset, vca_Target008, 08, 0)
  1423. DT009 = Array(WallTarget009, WallTarget009offset, vca_Target009, 09, 0)
  1424. DT010 = Array(WallTarget010, WallTarget010offset, vca_Target010, 10, 0)
  1425.  
  1426. Dim DTArray
  1427. DTArray = Array(DT006, DT007, DT008, DT009, DT010)
  1428.  
  1429. Sub WallTarget006_Hit : DTHit 06 : ShadowDT(0).visible=False : End Sub
  1430. Sub WallTarget007_Hit : DTHit 07 : ShadowDT(1).visible=False : End Sub
  1431. Sub WallTarget008_Hit : DTHit 08 : ShadowDT(2).visible=False : End Sub
  1432. Sub WallTarget009_Hit : DTHit 09 : ShadowDT(3).visible=False : End Sub
  1433. Sub WallTarget010_Hit : DTHit 10 : ShadowDT(4).visible=False : End Sub
  1434.  
  1435.  
  1436. Sub ResetDropsRoth(enabled)
  1437. if enabled then
  1438. DTRaise 06
  1439. DTRaise 07
  1440. DTRaise 08
  1441. DTRaise 09
  1442. DTRaise 10
  1443.  
  1444. PlaySoundAt SoundFX(DTResetSound,DOFDropTargets), vca_Target008
  1445.  
  1446. for each obj in ShadowDT
  1447. obj.visible=True
  1448. Next
  1449.  
  1450. end if
  1451. End Sub
  1452.  
  1453.  
  1454. 'Configure the behavior of Drop Targets.
  1455. Const DTDropSpeed = 110 'in milliseconds
  1456. Const DTDropUpSpeed = 40 'in milliseconds
  1457. Const DTDropUnits = 44 'VP units primitive drops
  1458. Const DTDropUpUnits = 10 'VP units primitive raises above the up position on drops up
  1459. Const DTMaxBend = 8 'max degrees primitive rotates when hit
  1460. Const DTDropDelay = 20 'time in milliseconds before target drops (due to friction/impact of the ball)
  1461. Const DTRaiseDelay = 40 'time in milliseconds before target drops back to normal up position after the solendoid fires to raise the target
  1462. Const DTBrickVel = 30 'velocity at which the target will brick, set to '0' to disable brick
  1463.  
  1464. Const DTEnableBrick = 1 'Set to 0 to disable bricking, 1 to enable bricking
  1465. 'Const DTHitSound = "targethit" 'Drop Target Hit sound
  1466. Const DTDropSound = "DropTarget_Down" 'Drop Target Drop sound
  1467. Const DTResetSound = "DropTarget_Up" 'Drop Target reset sound
  1468. Const DTHitSound = "Target_Hit_1" 'Drop Target Hit sound
  1469.  
  1470.  
  1471. Const DTMass = 0.2 'Mass of the Drop Target (between 0 and 1), higher values provide more resistance
  1472.  
  1473. '******************************************************
  1474. ' DROP TARGETS FUNCTIONS
  1475. '******************************************************
  1476.  
  1477. Sub DTHit(switch)
  1478. Dim i
  1479. i = DTArrayID(switch)
  1480.  
  1481. ' PlaySoundAtVol DTHitSound, Activeball, Vol(Activeball)*22.5
  1482. DTArray(i)(4) = DTCheckBrick(Activeball,DTArray(i)(2))
  1483. If DTArray(i)(4) = 1 or DTArray(i)(4) = 3 or DTArray(i)(4) = 4 Then
  1484. DTBallPhysics Activeball, DTArray(i)(2).rotz, DTMass
  1485. End If
  1486. DoDTAnim
  1487. End Sub
  1488.  
  1489. Sub DTRaise(switch)
  1490. Dim i
  1491. i = DTArrayID(switch)
  1492.  
  1493. DTArray(i)(4) = -1
  1494. DoDTAnim
  1495. End Sub
  1496.  
  1497. Sub DTDrop(switch)
  1498. Dim i
  1499. i = DTArrayID(switch)
  1500.  
  1501. DTArray(i)(4) = 1
  1502. DoDTAnim
  1503. End Sub
  1504.  
  1505. Function DTArrayID(switch)
  1506. Dim i
  1507. For i = 0 to uBound(DTArray)
  1508. If DTArray(i)(3) = switch Then DTArrayID = i:Exit Function
  1509. Next
  1510. End Function
  1511.  
  1512.  
  1513. sub DTBallPhysics(aBall, angle, mass)
  1514. dim rangle,bangle,calc1, calc2, calc3
  1515. rangle = (angle - 90) * 3.1416 / 180
  1516. bangle = atn2(cor.ballvely(aball.id),cor.ballvelx(aball.id))
  1517.  
  1518. calc1 = cor.BallVel(aball.id) * cos(bangle - rangle) * (aball.mass - mass) / (aball.mass + mass)
  1519. calc2 = cor.BallVel(aball.id) * sin(bangle - rangle) * cos(rangle + 4*Atn(1)/2)
  1520. calc3 = cor.BallVel(aball.id) * sin(bangle - rangle) * sin(rangle + 4*Atn(1)/2)
  1521.  
  1522. aBall.velx = calc1 * cos(rangle) + calc2
  1523. aBall.vely = calc1 * sin(rangle) + calc3
  1524. End Sub
  1525.  
  1526. 'Add Timer name DTAnim to editor to handle drop target animations
  1527. DTAnim.interval = 10
  1528. DTAnim.enabled = True
  1529.  
  1530. Sub DTAnim_Timer()
  1531. DoDTAnim
  1532. End Sub
  1533.  
  1534. 'Check if target is hit on it's face or sides and whether a 'brick' occurred
  1535. Function DTCheckBrick(aBall, dtprim)
  1536. dim bangle, bangleafter, rangle, rangle2, Xintersect, Yintersect, cdist, perpvel, perpvelafter, paravel, paravelafter
  1537. rangle = (dtprim.rotz - 90) * 3.1416 / 180
  1538. rangle2 = dtprim.rotz * 3.1416 / 180
  1539. ' bangle = atn2(cor.ballvely(aball.id),cor.ballvelx(aball.id))
  1540. bangleafter = Atn2(aBall.vely,aball.velx)
  1541.  
  1542. Xintersect = (aBall.y - dtprim.y - tan(bangle) * aball.x + tan(rangle2) * dtprim.x) / (tan(rangle2) - tan(bangle))
  1543. Yintersect = tan(rangle2) * Xintersect + (dtprim.y - tan(rangle2) * dtprim.x)
  1544.  
  1545. cdist = Distance(dtprim.x, dtprim.y, Xintersect, Yintersect)
  1546.  
  1547. perpvel = cor.BallVel(aball.id) * cos(bangle-rangle)
  1548. paravel = cor.BallVel(aball.id) * sin(bangle-rangle)
  1549.  
  1550. perpvelafter = BallSpeed(aBall) * cos(bangleafter - rangle)
  1551. paravelafter = BallSpeed(aBall) * sin(bangleafter - rangle)
  1552. 'debug.print "brick " & perpvel & " : " & paravel & " : " & perpvelafter & " : " & paravelafter
  1553.  
  1554. If perpvel > 0 and perpvelafter <= 0 Then
  1555. If DTEnableBrick = 1 and perpvel > DTBrickVel and DTBrickVel <> 0 and cdist < 8 Then
  1556. DTCheckBrick = 3
  1557. Else
  1558. DTCheckBrick = 1
  1559. End If
  1560. ElseIf perpvel > 0 and ((paravel > 0 and paravelafter > 0) or (paravel < 0 and paravelafter < 0)) Then
  1561. DTCheckBrick = 4
  1562. Else
  1563. DTCheckBrick = 0
  1564. End If
  1565.  
  1566. DTCheckBrick = 1
  1567.  
  1568. End Function
  1569.  
  1570.  
  1571.  
  1572.  
  1573. Sub DoDTAnim()
  1574. Dim i
  1575. For i=0 to Ubound(DTArray)
  1576. DTArray(i)(4) = DTAnimate(DTArray(i)(0),DTArray(i)(1),DTArray(i)(2),DTArray(i)(3),DTArray(i)(4))
  1577. Next
  1578. End Sub
  1579.  
  1580. Function DTAnimate(primary, secondary, prim, switch, animate)
  1581. dim transz
  1582. Dim animtime, rangle
  1583. rangle = prim.rotz * 3.1416 / 180
  1584.  
  1585. DTAnimate = animate
  1586.  
  1587. if animate = 0 Then
  1588. primary.uservalue = 0
  1589. DTAnimate = 0
  1590. Exit Function
  1591. Elseif primary.uservalue = 0 then
  1592. primary.uservalue = gametime
  1593. end if
  1594.  
  1595. animtime = gametime - primary.uservalue
  1596.  
  1597. If (animate = 1 or animate = 4) and animtime < DTDropDelay Then
  1598. primary.collidable = 0
  1599. If animate = 1 then secondary.collidable = 1 else secondary.collidable= 0
  1600. prim.rotx = DTMaxBend * cos(rangle)
  1601. prim.roty = DTMaxBend * sin(rangle)
  1602. DTAnimate = animate
  1603. Exit Function
  1604. elseif (animate = 1 or animate = 4) and animtime > DTDropDelay Then
  1605. primary.collidable = 0
  1606. If animate = 1 then secondary.collidable = 1 else secondary.collidable= 0
  1607. prim.rotx = DTMaxBend * cos(rangle)
  1608. prim.roty = DTMaxBend * sin(rangle)
  1609. animate = 2
  1610. PlaySoundAt SoundFX(DTDropSound,DOFDropTargets),prim
  1611. End If
  1612.  
  1613. if animate = 2 Then
  1614. transz = (animtime - DTDropDelay)/DTDropSpeed * DTDropUnits * -1
  1615. if prim.transz > -DTDropUnits Then
  1616. prim.transz = transz
  1617. end if
  1618.  
  1619. prim.rotx = DTMaxBend * cos(rangle)/2
  1620. prim.roty = DTMaxBend * sin(rangle)/2
  1621.  
  1622. if prim.transz <= -DTDropUnits Then
  1623. prim.transz = -DTDropUnits
  1624. secondary.collidable = 0
  1625. 'controller.Switch(Switch) = 1
  1626. primary.uservalue = 0
  1627. DTAnimate = 0
  1628. Exit Function
  1629. Else
  1630. DTAnimate = 2
  1631. Exit Function
  1632. end If
  1633. End If
  1634.  
  1635. If animate = 3 and animtime < DTDropDelay Then
  1636. primary.collidable = 0
  1637. secondary.collidable = 1
  1638. prim.rotx = DTMaxBend * cos(rangle)
  1639. prim.roty = DTMaxBend * sin(rangle)
  1640. elseif animate = 3 and animtime > DTDropDelay Then
  1641. primary.collidable = 1
  1642. secondary.collidable = 0
  1643. prim.rotx = 0
  1644. prim.roty = 0
  1645. primary.uservalue = 0
  1646. DTAnimate = 0
  1647. Exit Function
  1648. End If
  1649.  
  1650. if animate = -1 Then
  1651. transz = (1 - (animtime)/DTDropUpSpeed) * DTDropUnits * -1
  1652.  
  1653. If prim.transz = -DTDropUnits Then
  1654. Dim BOT, b
  1655. BOT = GetBalls
  1656.  
  1657. For b = 0 to UBound(BOT)
  1658. If InRect(BOT(b).x,BOT(b).y,prim.x-25,prim.y-10,prim.x+25, prim.y-10,prim.x+25,prim.y+25,prim.x -25,prim.y+25) Then
  1659. BOT(b).velz = 20
  1660. End If
  1661. Next
  1662. End If
  1663.  
  1664. if prim.transz < 0 Then
  1665. prim.transz = transz
  1666. elseif transz > 0 then
  1667. prim.transz = transz
  1668. end if
  1669.  
  1670. if prim.transz > DTDropUpUnits then
  1671. DTAnimate = -2
  1672. prim.rotx = 0
  1673. prim.roty = 0
  1674. primary.uservalue = gametime
  1675. end if
  1676. primary.collidable = 0
  1677. secondary.collidable = 1
  1678. 'controller.Switch(Switch) = 0
  1679.  
  1680. End If
  1681.  
  1682. if animate = -2 and animtime > DTRaiseDelay Then
  1683. prim.transz = (animtime - DTRaiseDelay)/DTDropSpeed * DTDropUnits * -1 + DTDropUpUnits
  1684. if prim.transz < 0 then
  1685. prim.transz = 0
  1686. primary.uservalue = 0
  1687. DTAnimate = 0
  1688.  
  1689. primary.collidable = 1
  1690. secondary.collidable = 0
  1691. end If
  1692. End If
  1693. End Function
  1694.  
  1695. '******************************************************
  1696. ' DROP TARGET
  1697. ' SUPPORTING FUNCTIONS
  1698. '******************************************************
  1699.  
  1700. ' Used for drop targets
  1701. '*** Determines if a Points (px,py) is inside a 4 point polygon A-D in Clockwise/CCW order
  1702. Function InRect(px,py,ax,ay,bx,by,cx,cy,dx,dy)
  1703. Dim AB, BC, CD, DA
  1704. AB = (bx*py) - (by*px) - (ax*py) + (ay*px) + (ax*by) - (ay*bx)
  1705. BC = (cx*py) - (cy*px) - (bx*py) + (by*px) + (bx*cy) - (by*cx)
  1706. CD = (dx*py) - (dy*px) - (cx*py) + (cy*px) + (cx*dy) - (cy*dx)
  1707. DA = (ax*py) - (ay*px) - (dx*py) + (dy*px) + (dx*ay) - (dy*ax)
  1708.  
  1709. If (AB <= 0 AND BC <=0 AND CD <= 0 AND DA <= 0) Or (AB >= 0 AND BC >=0 AND CD >= 0 AND DA >= 0) Then
  1710. InRect = True
  1711. Else
  1712. InRect = False
  1713. End If
  1714. End Function
  1715.  
  1716. ' Used for drop targets
  1717. Function Distance(ax,ay,bx,by)
  1718. Distance = SQR((ax - bx)^2 + (ay - by)^2)
  1719. End Function
  1720.  
  1721.  
  1722. '************************************************************************
  1723. ' Ball Control - 3 Axis
  1724. '************************************************************************
  1725.  
  1726. Dim Cup, Cdown, Cleft, Cright, Zup, contball, contballinplay, ControlBall, bcboost
  1727. Dim bcvel, bcyveloffset, bcboostmulti
  1728.  
  1729. bcboost = 1 'Do Not Change - default setting
  1730. bcvel = 4 'Controls the speed of the ball movement
  1731. bcyveloffset = -.014 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
  1732. bcboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
  1733.  
  1734. Sub BallControl_Timer()
  1735. If Contball and ContBallInPlay then
  1736. If Cright = 1 Then
  1737. ControlBall.velx = bcvel*bcboost
  1738. ElseIf Cleft = 1 Then
  1739. ControlBall.velx = -bcvel*bcboost
  1740. Else
  1741. ControlBall.velx=0
  1742. End If
  1743. If Cup = 1 Then
  1744. ControlBall.vely = -bcvel*bcboost
  1745. ElseIf Cdown = 1 Then
  1746. ControlBall.vely = bcvel*bcboost
  1747. Else
  1748. ControlBall.vely = bcyveloffset
  1749. End If
  1750. If Zup = 1 Then
  1751. ControlBall.velz = bcvel*bcboost
  1752. Else
  1753. ControlBall.velz = -bcvel*bcboost
  1754. End If
  1755. End If
  1756. End Sub
  1757.  
  1758. '******* for ball control script
  1759. Sub EndControl_Hit()
  1760. contBallinPlay = False
  1761. End Sub
  1762.  
  1763. '******************************************
  1764. ' Spinners
  1765.  
  1766.  
  1767. Sub Spinner1_Spin()
  1768. PlaySoundAtLevelStatic ("Spinner"), SpinnerSoundLevel, Spinner1
  1769. If TableTilted=false and MotorRunning=0 then
  1770. DOF 105, 2
  1771. if SpinnerLight.state=1 then
  1772. AddScore(1000)
  1773. else
  1774. AddScore(100)
  1775. end if
  1776.  
  1777. end if
  1778.  
  1779. end Sub
  1780.  
  1781. '****************************************************
  1782. ' Kickers
  1783.  
  1784. sub Kicker1_Hit()
  1785. SoundSaucerLock
  1786. Dim speedx,speedy,finalspeed
  1787. speedx=activeball.velx
  1788. speedy=activeball.vely
  1789. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1790. if TableTilted=true then
  1791. tKickerTCount=0
  1792. Kicker1.Timerenabled=1
  1793. exit sub
  1794. end if
  1795. KickerHolder1.enabled=1
  1796.  
  1797. end sub
  1798.  
  1799. Sub KickerHolder1_timer
  1800. If MotorRunning<>0 then EXIT SUB
  1801. KickerHolder1.enabled=0
  1802. Kicker1.timerenabled=1
  1803. tKickerTCount=0
  1804. end sub
  1805.  
  1806. Sub Kicker1_Timer()
  1807. tKickerTCount=tKickerTCount+1
  1808. if tKickerTCount>7 then tKickerTCount=0
  1809. select case tKickerTCount
  1810. case 1:
  1811. AddScore(100)
  1812. If Cards001.state=1 then
  1813. IncreaseGoldBonus
  1814. end if
  1815. case 2:
  1816. AddScore(100)
  1817. If Cards002.state=1 then
  1818. IncreaseGoldBonus
  1819. end if
  1820. case 3:
  1821. AddScore(100)
  1822. If Cards003.state=1 then
  1823. IncreaseGoldBonus
  1824. end if
  1825. case 4:
  1826. AddScore(100)
  1827. If Cards004.state=1 then
  1828. IncreaseGoldBonus
  1829. end if
  1830.  
  1831. case 5:
  1832. AddScore(100)
  1833. If Cards005.state=1 then
  1834. IncreaseGoldBonus
  1835. end if
  1836. If KickerLight1.state=1 then
  1837. KickerLight1.state=0
  1838. ShootAgain.state=1
  1839. ShootAgainReel.SetValue(1)
  1840. If VRRoom > 0 Then
  1841. for each Object in VRBGShootAgain : object.visible = 1 : Next
  1842. End If
  1843. If B2SOn Then Controller.B2SSetShootAgain 1
  1844. ResetDrops
  1845. end if
  1846. If KickerLight2.state=1 then
  1847. AddSpecial
  1848. KickerLight2.state=0
  1849. ResetDrops
  1850. DisplayAltRelay
  1851. end if
  1852. case 6:
  1853. ' Pkickarm1.rotz=15
  1854. vn_KickerArm.roty = -15
  1855. vn_KickerArmTEST.roty = -15
  1856. 'Playsound SoundFXDOF("saucer",138,DOFPulse,DOFContactors)
  1857. DOF 104, 2
  1858. Kicker1.kick 195,15
  1859. case 7:
  1860. Kicker1.timerenabled=0
  1861. ' Pkickarm1.rotz=0
  1862. vn_KickerArm.roty = 0
  1863. vn_KickerArmTEST.roty = 0
  1864. end Select
  1865.  
  1866. end sub
  1867.  
  1868.  
  1869.  
  1870. '**************************************
  1871.  
  1872.  
  1873. Sub AddSpecial()
  1874. Select Case SpecialOption
  1875. case 0:
  1876. PlaySound"knocker"
  1877. DOF 140, DOFPulse
  1878. Credits=Credits+1
  1879. :vn_CreditLight.Image = "b_CreditLightOn" 'CreditLight.state=1
  1880. DOF 129, DOFOn
  1881. if Credits>15 then Credits=15
  1882. If VRRoom > 0 Then
  1883. cred =reels(4, 0)
  1884. reels(4, 0) = 0
  1885. SetDrum -1,0, 0
  1886.  
  1887. SetReel 0,-1, Credits
  1888. reels(4, 0) = Credits
  1889. End If
  1890. If B2SOn Then
  1891. Controller.B2SSetCredits Credits
  1892. End If
  1893. CreditsReel.SetValue(Credits)
  1894. case 1:
  1895. PlaySound"knocker"
  1896. DOF 140, DOFPulse
  1897. AddExtraBall
  1898. case 2:
  1899. SetMotor(50000)
  1900. end select
  1901.  
  1902. End Sub
  1903.  
  1904. Sub AddSpecial2()
  1905. PlaySound"click"
  1906. Credits=Credits+1
  1907. :vn_CreditLight.Image = "b_CreditLightOn" 'CreditLight.state=1
  1908. DOF 129, DOFOn
  1909. if Credits>15 then Credits=15
  1910. If VRRoom > 0 Then
  1911. cred =reels(4, 0)
  1912. reels(4, 0) = 0
  1913. SetDrum -1,0, 0
  1914.  
  1915. SetReel 0,-1, Credits
  1916. reels(4, 0) = Credits
  1917. End If
  1918. If B2SOn Then
  1919. Controller.B2SSetCredits Credits
  1920. End If
  1921. CreditsReel.SetValue(Credits)
  1922. End Sub
  1923.  
  1924. Sub AddExtraBall
  1925. If BallInPlay=9 then exit sub
  1926. BallInPlay=BallInPlay+1
  1927. BallInPlayReel.SetValue(BallInPlay)
  1928. If VRRoom > 0 Then
  1929. FlasherBalls
  1930. End If
  1931. If B2SOn then Controller.B2SSetBallInPlay BallInPlay
  1932.  
  1933. end sub
  1934.  
  1935. Sub ToggleAlternatingRelay
  1936. if AlternatingRelay=1 then
  1937. AlternatingRelay=0
  1938. else
  1939. AlternatingRelay=1
  1940. end if
  1941. DisplayAltRelay
  1942. end sub
  1943.  
  1944. Sub AdvanceZeroToNine
  1945. ZeroToNineUnit=ZeroToNineUnit+1
  1946. if ZeroToNineUnit>9 then
  1947. ZeroToNineUnit=0
  1948. end if
  1949. DisplayAltRelay
  1950. end sub
  1951.  
  1952. Sub DisplayAltRelay
  1953. ExtraBall001.state=0
  1954.  
  1955. ExtraBall004.state=0
  1956. if AlternatingRelay=1 then
  1957. if GoldBonusCounter=15 then ExtraBall001.state=1
  1958.  
  1959. else
  1960. if GoldBonusCounter=15 then ExtraBall004.state=1
  1961.  
  1962. end if
  1963. RightAlleyLight.state=0
  1964. Select case CardLightOption
  1965. case 0:
  1966. if ZeroToNineUnit=0 OR ZeroToNineUnit=5 then
  1967. RightAlleyLight.state=1
  1968. end if
  1969. case 1:
  1970. if ZeroToNineUnit=0 OR ZeroToNineUnit=5 or ZeroToNineUnit=7 then
  1971. RightAlleyLight.state=1
  1972. end if
  1973. case 2:
  1974. if ZeroToNineUnit=0 OR ZeroToNineUnit=5 or ZeroToNineUnit=7 OR ZeroToNineUnit=2 OR ZeroToNineUnit=8 then
  1975. RightAlleyLight.state=1
  1976. end if
  1977. end select
  1978. end sub
  1979.  
  1980. sub LightBumpers
  1981.  
  1982.  
  1983. end sub
  1984.  
  1985. Sub Trigger0_Hit
  1986. Set controlBall = ActiveBall
  1987. contBallInPlay = True
  1988. tb.Text = "hit"
  1989. End Sub
  1990.  
  1991. Sub CloseGateTrigger_Hit()
  1992.  
  1993. if dooralreadyopen=1 then
  1994. closeg.enabled=true
  1995.  
  1996. end if
  1997. End Sub
  1998.  
  1999.  
  2000. sub openg_timer
  2001.  
  2002. openg.enabled=false
  2003.  
  2004.  
  2005. end sub
  2006.  
  2007. sub closeg_timer
  2008. closeg.enabled=false
  2009. end sub
  2010.  
  2011. sub IncreaseGoldBonus
  2012. if GoldBonusCounter<15 then
  2013. If GoldBonusCounter<10 then
  2014. GoldBonus(GoldBonusCounter).state=0
  2015. GoldBonusCounter=GoldBonusCounter+1
  2016. GoldBonus(GoldBonusCounter).state=1
  2017. elseIf GoldBonusCounter>9 then
  2018. GoldBonus(GoldBonusCounter-10).state=0
  2019. GoldBonusCounter=GoldBonusCounter+1
  2020. GoldBonus(10).state=1
  2021. GoldBonus(GoldBonusCounter-10).state=1
  2022. end if
  2023. end if
  2024. For each obj in ButtonLights
  2025. obj.state=0
  2026. next
  2027. For each obj in BonusTargetLights
  2028. obj.state=0
  2029. next
  2030. Select case GoldBonusCounter
  2031. case 1,6,11:
  2032. ButtonLights(1).state=1
  2033. ButtonLights(7).state=1
  2034. BonusTargetLights(1).state=1
  2035. case 2,7,12:
  2036. ButtonLights(0).state=1
  2037. ButtonLights(6).state=1
  2038. BonusTargetLights(2).state=1
  2039. case 3,8,13:
  2040. ButtonLights(2).state=1
  2041. ButtonLights(4).state=1
  2042. BonusTargetLights(4).state=1
  2043. case 4,9,14:
  2044. ButtonLights(3).state=1
  2045. ButtonLights(8).state=1
  2046. BonusTargetLights(3).state=1
  2047. case 5,10,15:
  2048. ButtonLights(5).state=1
  2049. ButtonLights(9).state=1
  2050. BonusTargetLights(0).state=1
  2051.  
  2052. end select
  2053. DisplayAltRelay
  2054. end sub
  2055.  
  2056. sub ScoreSilverBonus
  2057.  
  2058. If DoubleBonus.state=0 then
  2059. ScoreMotorStepper=0
  2060.  
  2061. else
  2062. ScoreMotorStepper=0
  2063.  
  2064. end if
  2065. CollectSilverBonus.enabled=1
  2066. end sub
  2067.  
  2068. sub CollectSilverBonus_timer
  2069. if MotorRunning=1 then
  2070. exit sub
  2071. end if
  2072. if GoldBonusCounter<1 then
  2073. CollectSilverBonus.enabled=0
  2074. GoldBonusCounter=1
  2075. GoldBonus(GoldBonusCounter).state=1
  2076. else
  2077. if ScoreMotorStepper<5 then
  2078. ' If TableTilted=false then
  2079. ' SetMotor(5000)
  2080. ' end if
  2081. If DoubleBonus.state=0 then
  2082. if TableTilted=false then
  2083. SetMotor(5000)
  2084. end if
  2085. else
  2086. if TableTilted=false then
  2087. AddScore(10000)
  2088. end if
  2089. end if
  2090. GoldBonus(GoldBonusCounter).state=0
  2091. GoldBonusCounter=GoldBonusCounter-1
  2092. if GoldBonusCounter>=0 then
  2093. GoldBonus(GoldBonusCounter).state=1
  2094. end if
  2095. ScoreMotorStepper=ScoreMotorStepper+1
  2096. else
  2097. If DoubleBonus.state=0 then
  2098. ScoreMotorStepper=0
  2099. else
  2100. ScoreMotorStepper=0
  2101.  
  2102. end if
  2103. end if
  2104. end if
  2105. end sub
  2106.  
  2107.  
  2108.  
  2109. sub ScoreGoldBonus
  2110. ScoreMotorStepper=0
  2111. CollectGoldBonus.interval=135
  2112. CollectGoldBonus.enabled=1
  2113. end sub
  2114.  
  2115. sub CollectGoldBonus_timer
  2116. if MotorRunning=1 then
  2117. exit sub
  2118. end if
  2119. if GoldBonusCounter<1 then
  2120. CollectGoldBonus.enabled=0
  2121. NextBallDelay.enabled=true
  2122. else
  2123. If DoubleBonus.state=1 then
  2124. Select case ScoreMotorStepper
  2125. case 0,1,3,4:
  2126. AddScore(1000)
  2127.  
  2128. case 2,5:
  2129. PlaySound"BallyClunk"
  2130. If GoldBonusCounter>10 then
  2131. GoldBonus(GoldBonusCounter-10).state=0
  2132. else
  2133. GoldBonus(GoldBonusCounter).state=0
  2134.  
  2135. end if
  2136.  
  2137. GoldBonusCounter=GoldBonusCounter-1
  2138. if GoldBonusCounter>=0 then
  2139. If GoldBonusCounter<=10 then
  2140. GoldBonus(GoldBonusCounter).state=1
  2141. elseif GoldBonusCounter>10 then
  2142. GoldBonus(10).state=1
  2143. GoldBonus(GoldBonusCounter-10).state=1
  2144. end if
  2145. end if
  2146. For each obj in ButtonLights
  2147. obj.state=0
  2148. next
  2149. For each obj in BonusTargetLights
  2150. obj.state=0
  2151. next
  2152. Select case GoldBonusCounter
  2153. case 1,6,11:
  2154. ButtonLights(1).state=1
  2155. ButtonLights(7).state=1
  2156. BonusTargetLights(1).state=1
  2157. case 2,7,12:
  2158. ButtonLights(0).state=1
  2159. ButtonLights(6).state=1
  2160. BonusTargetLights(2).state=1
  2161. case 3,8,13:
  2162. ButtonLights(2).state=1
  2163. ButtonLights(4).state=1
  2164. BonusTargetLights(4).state=1
  2165. case 4,9,14:
  2166. ButtonLights(3).state=1
  2167. ButtonLights(8).state=1
  2168. BonusTargetLights(3).state=1
  2169. case 5,10,15:
  2170. ButtonLights(5).state=1
  2171. ButtonLights(9).state=1
  2172. BonusTargetLights(0).state=1
  2173.  
  2174. end select
  2175. case 6:
  2176.  
  2177.  
  2178. case 7:
  2179.  
  2180.  
  2181. end select
  2182. ScoreMotorStepper=ScoreMotorStepper+1
  2183. If ScoreMotorStepper>7 then
  2184. ScoreMotorStepper=0
  2185. end if
  2186. else
  2187. Select Case ScoreMotorStepper
  2188. case 0,1,2,3,4:
  2189. AddScore(1000)
  2190. If GoldBonusCounter>10 then
  2191. GoldBonus(GoldBonusCounter-10).state=0
  2192. else
  2193. GoldBonus(GoldBonusCounter).state=0
  2194.  
  2195. end if
  2196.  
  2197. GoldBonusCounter=GoldBonusCounter-1
  2198. if GoldBonusCounter>=0 then
  2199. If GoldBonusCounter<=10 then
  2200. GoldBonus(GoldBonusCounter).state=1
  2201. elseif GoldBonusCounter>10 then
  2202. GoldBonus(10).state=1
  2203. GoldBonus(GoldBonusCounter-10).state=1
  2204. end if
  2205. end if
  2206. For each obj in ButtonLights
  2207. obj.state=0
  2208. next
  2209. For each obj in BonusTargetLights
  2210. obj.state=0
  2211. next
  2212. Select case GoldBonusCounter
  2213. case 1,6,11:
  2214. ButtonLights(1).state=1
  2215. ButtonLights(7).state=1
  2216. BonusTargetLights(1).state=1
  2217. case 2,7,12:
  2218. ButtonLights(0).state=1
  2219. ButtonLights(6).state=1
  2220. BonusTargetLights(2).state=1
  2221. case 3,8,13:
  2222. ButtonLights(2).state=1
  2223. ButtonLights(4).state=1
  2224. BonusTargetLights(4).state=1
  2225. case 4,9,14:
  2226. ButtonLights(3).state=1
  2227. ButtonLights(8).state=1
  2228. BonusTargetLights(3).state=1
  2229. case 5,10,15:
  2230. ButtonLights(5).state=1
  2231. ButtonLights(9).state=1
  2232. BonusTargetLights(0).state=1
  2233.  
  2234. end select
  2235. case 5:
  2236. PlaySound"BallyClunk"
  2237.  
  2238. case 6:
  2239.  
  2240.  
  2241. case 7:
  2242.  
  2243.  
  2244. end select
  2245. ScoreMotorStepper=ScoreMotorStepper+1
  2246. If ScoreMotorStepper>7 then
  2247. ScoreMotorStepper=0
  2248. end if
  2249. end if
  2250. end if
  2251. end sub
  2252.  
  2253. Sub ResetDrops
  2254. For each obj in CardsOff
  2255. obj.state=0
  2256. next
  2257. for each obj in CardsOn
  2258. obj.state=1
  2259. next
  2260. DOF 103, DOFPulse
  2261. ' playsound "droptargetreset"
  2262. ' Target006.IsDropped=false
  2263. ' Target007.IsDropped=false
  2264. ' Target008.IsDropped=false
  2265. ' Target009.IsDropped=false
  2266. ' Target010.IsDropped=false
  2267. ResetDropsRoth True
  2268. end sub
  2269.  
  2270. Sub ResetBallDrops
  2271.  
  2272. HoleCounter=0
  2273.  
  2274. End Sub
  2275.  
  2276.  
  2277. Sub LightsOut
  2278.  
  2279. BonusCounter=0
  2280. HoleCounter=0
  2281.  
  2282.  
  2283.  
  2284. StopSound "buzz"
  2285. StopSound "buzzL"
  2286.  
  2287. end sub
  2288.  
  2289. Sub ResetBalls()
  2290.  
  2291. TempMultiCounter=BallsPerGame-BallInPlay
  2292. SpinnerLight.state=0
  2293. For each obj in CardsOff
  2294. obj.state=0
  2295. next
  2296. for each obj in CardsOn
  2297. obj.state=1
  2298. next
  2299. KickerLight1.state=0
  2300. KickerLight2.state=0
  2301. DisplayAltRelay
  2302. ResetBallDrops
  2303. BonusMultiplier=1
  2304. TableTilted=false
  2305. TiltOff
  2306. TiltReel.SetValue(0)
  2307. If VRRoom > 0 Then
  2308. for each Object in VRBGTilt : object.visible = 0 : next
  2309. End If
  2310. If B2Son then
  2311. Controller.B2SSetTilt 0
  2312. end if
  2313. BumpersOn
  2314. Bumper1Light.state=1
  2315. Bumper2Light.state=1
  2316. Bumper3Light.state=1
  2317. if dooralreadyopen=1 then
  2318. closeg.enabled=true
  2319.  
  2320. end if
  2321. Postdown
  2322. IncreaseGoldBonus
  2323. DoubleBonus.state=0
  2324. ResetDrops
  2325.  
  2326. PlasticsOn
  2327. 'CreateBallID BallRelease
  2328. Ballrelease.CreateSizedBall 25
  2329. Ballrelease.Kick 40,7
  2330. RandomSoundBallRelease Ballrelease
  2331. DOF 128, DOFPulse
  2332. BallInPlayReel.SetValue(BallInPlay)
  2333. InstructCard.image="IC"
  2334.  
  2335.  
  2336.  
  2337. End Sub
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343. sub resettimer_timer
  2344. rst=rst+1
  2345. if rst>1 and rst<12 then
  2346. ResetReelsToZero(1)
  2347. ResetReelsToZero(2)
  2348. end if
  2349.  
  2350. if rst=16 then
  2351. playsound "StartBall1"
  2352. end if
  2353. if rst=18 then
  2354. newgame
  2355. resettimer.enabled=false
  2356. end if
  2357. end sub
  2358.  
  2359. Sub ResetReelsToZero(reelzeroflag)
  2360. dim d1(5)
  2361. dim d2(5)
  2362. dim scorestring1, scorestring2
  2363.  
  2364. If reelzeroflag=1 then
  2365. scorestring1=CStr(Score(1))
  2366. scorestring2=CStr(Score(2))
  2367. scorestring1=right("00000" & scorestring1,5)
  2368. scorestring2=right("00000" & scorestring2,5)
  2369. for i=0 to 4
  2370. d1(i)=CInt(mid(scorestring1,i+1,1))
  2371. d2(i)=CInt(mid(scorestring2,i+1,1))
  2372. next
  2373. for i=0 to 4
  2374. if d1(i)>0 then
  2375. d1(i)=d1(i)+1
  2376. if d1(i)>9 then d1(i)=0
  2377. end if
  2378. if d2(i)>0 then
  2379. d2(i)=d2(i)+1
  2380. if d2(i)>9 then d2(i)=0
  2381. end if
  2382.  
  2383. next
  2384. Score(1)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  2385. Score(2)=(d2(0)*10000) + (d2(1)*1000) + (d2(2)*100) + (d2(3)*10) + d2(4)
  2386. If VRRoom > 0 Then
  2387. EMMODE = 1
  2388. UpdateVRReels 0,0 ,score(0), 0, -1,-1,-1,-1,-1
  2389. UpdateVRReels 1,1 ,score(1), 0, -1,-1,-1,-1,-1
  2390. UpdateVRReels 2,2 ,score(2), 0, -1,-1,-1,-1,-1
  2391. UpdateVRReels 3,3 ,score(3), 0, -1,-1,-1,-1,-1
  2392. UpdateVRReels 4,4 ,score(4), 0, -1,-1,-1,-1,-1
  2393. EMMODE = 0 ' restore EM mode
  2394. End If
  2395. If B2SOn Then
  2396. Controller.B2SSetScorePlayer 1, Score(1)
  2397. Controller.B2SSetScorePlayer 2, Score(2)
  2398. End If
  2399. PlayerScores(0).SetValue(Score(1))
  2400. PlayerScoresOn(0).SetValue(Score(1))
  2401. PlayerScores(1).SetValue(Score(2))
  2402. PlayerScoresOn(1).SetValue(Score(2))
  2403.  
  2404. scorestring1=CStr(Score(3))
  2405. scorestring2=CStr(Score(4))
  2406. scorestring1=right("00000" & scorestring1,5)
  2407. scorestring2=right("00000" & scorestring2,5)
  2408. for i=0 to 4
  2409. d1(i)=CInt(mid(scorestring1,i+1,1))
  2410. d2(i)=CInt(mid(scorestring2,i+1,1))
  2411. next
  2412. for i=0 to 4
  2413. if d1(i)>0 then
  2414. d1(i)=d1(i)+1
  2415. if d1(i)>9 then d1(i)=0
  2416. end if
  2417. if d2(i)>0 then
  2418. d2(i)=d2(i)+1
  2419. if d2(i)>9 then d2(i)=0
  2420. end if
  2421.  
  2422. next
  2423. Score(3)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
  2424. Score(4)=(d2(0)*10000) + (d2(1)*1000) + (d2(2)*100) + (d2(3)*10) + d2(4)
  2425. If VRRoom > 0 Then
  2426. EMMODE = 1
  2427. UpdateVRReels 0,0 ,score(0), 0, -1,-1,-1,-1,-1
  2428. UpdateVRReels 1,1 ,score(1), 0, -1,-1,-1,-1,-1
  2429. UpdateVRReels 2,2 ,score(2), 0, -1,-1,-1,-1,-1
  2430. UpdateVRReels 3,3 ,score(3), 0, -1,-1,-1,-1,-1
  2431. UpdateVRReels 4,4 ,score(4), 0, -1,-1,-1,-1,-1
  2432. EMMODE = 0 ' restore EM mode
  2433. End If
  2434. If B2SOn Then
  2435. Controller.B2SSetScorePlayer 3, Score(3)
  2436. Controller.B2SSetScorePlayer 4, Score(4)
  2437. End If
  2438. PlayerScores(2).SetValue(Score(3))
  2439. PlayerScoresOn(2).SetValue(Score(3))
  2440. PlayerScores(3).SetValue(Score(4))
  2441. PlayerScoresOn(3).SetValue(Score(4))
  2442.  
  2443. end if
  2444.  
  2445. end sub
  2446.  
  2447.  
  2448. sub NextBallDelay_timer()
  2449. NextBallDelay.enabled=false
  2450. nextball
  2451.  
  2452. end sub
  2453.  
  2454. sub newgame
  2455. InProgress=true
  2456. queuedscore=0
  2457. for i = 1 to 4
  2458. Score(i)=0
  2459. Score100K(1)=0
  2460. HighScorePaid(i)=false
  2461. Replay1Paid(i)=false
  2462. Replay2Paid(i)=false
  2463. Replay3Paid(i)=false
  2464. Replay4Paid(i)=false
  2465. next
  2466. TiltOff
  2467.  
  2468. If VRRoom > 0 Then
  2469. for each Object in VRBGTilt : object.visible = 0 : next
  2470. for each Object in VRBGGameOver : object.visible = 0 : next
  2471. for each Object in VRBGMatch : object.visible = 0 : next
  2472. for each Object in VRBG100kAll : object.visible = 0 : next
  2473. FlasherBalls
  2474. UpdateVRReels 0 ,0 ,Score(0), 0, 0,0,0,0,0
  2475. UpdateVRReels 1 ,1 ,Score(0), 0, 0,0,0,0,0
  2476. UpdateVRReels 2 ,2 ,Score(0), 0, 0,0,0,0,0
  2477. UpdateVRReels 3 ,3 ,Score(0), 0, 0,0,0,0,0
  2478. End If
  2479. OTT1 = 0
  2480. OTT2 = 0
  2481. OTT3 = 0
  2482. OTT4 = 0
  2483.  
  2484. If B2SOn Then
  2485. Controller.B2SSetTilt 0
  2486. Controller.B2SSetGameOver 0
  2487. Controller.B2SSetMatch 0
  2488. ' Controller.B2SSetScorePlayer1 0
  2489. ' Controller.B2SSetScorePlayer2 0
  2490. ' Controller.B2SSetScorePlayer3 0
  2491. ' Controller.B2SSetScorePlayer4 0
  2492. Controller.B2SSetBallInPlay BallInPlay
  2493. Controller.B2SSetData 81,1
  2494. Controller.B2SSetData 82,0
  2495. Controller.B2SSetData 83,0
  2496. Controller.B2SSetData 84,0
  2497. End if
  2498. for each obj in CardsOn
  2499. obj.state=1
  2500. next
  2501. for each obj in CardsOff
  2502. obj.state=0
  2503. next
  2504.  
  2505.  
  2506. Bumper1Light.state=0
  2507. Bumper2Light.state=0
  2508. Bumper3Light.state=0
  2509.  
  2510. BumpersOn
  2511. GoldBonusCounter=0
  2512. LowComplete=false
  2513. HighComplete=false
  2514.  
  2515. ResetBalls
  2516. End sub
  2517.  
  2518. sub nextball
  2519. If ShootAgain.state=1 then
  2520. ShootAgain.state=0
  2521. ShootAgainReel.SetValue(0)
  2522. If VRRoom > 0 Then
  2523. for each Object in VRBGShootAgain : object.visible = 0 : next
  2524. End If
  2525. If B2SOn then Controller.B2SSetShootAgain 0
  2526. else
  2527. Player=Player+1
  2528. end if
  2529. If Player>Players Then
  2530. BallInPlay=BallInPlay+1
  2531. If BallInPlay>BallsPerGame then
  2532. PlaySound("MotorLeer")
  2533. InProgress=false
  2534.  
  2535. If VRRoom > 0 Then
  2536. for each Object in VRBGGameOver : object.visible = 1 : next
  2537. for each Object in VRBGPlayers : object.visible = 0 : next
  2538. FlasherBalls
  2539. FlasherMatch
  2540. End If
  2541.  
  2542. If B2SOn Then
  2543. Controller.B2SSetGameOver 1
  2544. Controller.B2SSetPlayerUp 0
  2545. Controller.B2SSetBallInPlay 0
  2546. Controller.B2SSetCanPlay 0
  2547. Controller.B2SSetData 99,0
  2548. Controller.B2SSetData 81,0
  2549. Controller.B2SSetData 82,0
  2550. Controller.B2SSetData 83,0
  2551. Controller.B2SSetData 84,0
  2552. End If
  2553. For each obj in PlayerHuds
  2554. obj.state=0
  2555. next
  2556. If Table1.ShowDT = True then
  2557. For each obj in PlayerScores
  2558. obj.visible=1
  2559. Next
  2560.  
  2561. end If
  2562. GameOverReel.SetValue(1)
  2563. InstructCard.image="IC"
  2564.  
  2565. BallInPlayReel.SetValue(0)
  2566. ' CanPlayReel.SetValue(0)
  2567. LeftFlipper.RotateToStart
  2568. RightFlipper.RotateToStart
  2569. LightsOut
  2570. BumpersOff
  2571. PlasticsOff
  2572. checkmatch
  2573. CheckHighScore
  2574. Players=0
  2575. HighScoreTimer.interval=100
  2576. HighScoreTimer.enabled=True
  2577. TimerTitle1.enabled=1
  2578. TimerTitle2.enabled=1
  2579. TimerTitle3.enabled=1
  2580. TimerTitle4.enabled=1
  2581.  
  2582. Else
  2583. Player=1
  2584. If VRRoom > 0 Then
  2585. FlasherBalls
  2586. FlasherCurrentPlayer
  2587. for each Object in VRBGShootAgain : object.visible = 0 : next
  2588. End If
  2589. If B2SOn Then
  2590. Controller.B2SSetPlayerUp Player
  2591. Controller.B2SSetBallInPlay BallInPlay
  2592. Controller.B2SSetData 81,1
  2593. Controller.B2SSetData 82,0
  2594. Controller.B2SSetData 83,0
  2595. Controller.B2SSetData 84,0
  2596. End If
  2597. ' PlaySound("RotateThruPlayers")
  2598. TempPlayerUp=Player
  2599. ' PlayerUpRotator.enabled=true
  2600. PlayStartBall.enabled=true
  2601. For each obj in PlayerHuds
  2602. obj.state=0
  2603. next
  2604. If Table1.ShowDT = True then
  2605. For each obj in PlayerScores
  2606. obj.visible=1
  2607. Next
  2608.  
  2609. PlayerHuds(Player-1).state=1
  2610.  
  2611. end If
  2612.  
  2613. ResetBalls
  2614. End If
  2615. Else
  2616. If VRRoom > 0 Then
  2617. FlasherBalls
  2618. FlasherCurrentPlayer
  2619. for each Object in VRBGShootAgain : object.visible = 0 : next
  2620. End If
  2621. If B2SOn Then
  2622. Controller.B2SSetPlayerUp Player
  2623. Controller.B2SSetBallInPlay BallInPlay
  2624. Controller.B2SSetData 81,0
  2625. Controller.B2SSetData 82,0
  2626. Controller.B2SSetData 83,0
  2627. Controller.B2SSetData 84,0
  2628. Controller.B2SSetData 80+Player,1
  2629. End If
  2630. ' PlaySound("RotateThruPlayers")
  2631. TempPlayerUp=Player
  2632. ' PlayerUpRotator.enabled=true
  2633. PlayStartBall.enabled=true
  2634. For each obj in PlayerHuds
  2635. obj.state=0
  2636. next
  2637. If Table1.ShowDT = True then
  2638. For each obj in PlayerScores
  2639. obj.visible=1
  2640. Next
  2641.  
  2642. PlayerHuds(Player-1).state=1
  2643.  
  2644. end If
  2645. ResetBalls
  2646. End If
  2647.  
  2648. End sub
  2649.  
  2650. sub CheckHighScore
  2651. Dim playertops
  2652. dim si
  2653. dim sj
  2654. dim stemp
  2655. dim stempplayers
  2656. for i=1 to 4
  2657. sortscores(i)=0
  2658. sortplayers(i)=0
  2659. next
  2660. playertops=0
  2661. for i = 1 to Players
  2662. sortscores(i)=Score(i)
  2663. sortplayers(i)=i
  2664. next
  2665.  
  2666. for si = 1 to Players
  2667. for sj = 1 to Players-1
  2668. if sortscores(sj)>sortscores(sj+1) then
  2669. stemp=sortscores(sj+1)
  2670. stempplayers=sortplayers(sj+1)
  2671. sortscores(sj+1)=sortscores(sj)
  2672. sortplayers(sj+1)=sortplayers(sj)
  2673. sortscores(sj)=stemp
  2674. sortplayers(sj)=stempplayers
  2675. end if
  2676. next
  2677. next
  2678. ScoreChecker=4
  2679. CheckAllScores=1
  2680. NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
  2681. savehs
  2682. end sub
  2683.  
  2684.  
  2685. sub checkmatch
  2686. Dim tempmatch
  2687. if TableTilted=true and TiltEndsGame=1 then
  2688. exit sub
  2689. end if
  2690. tempmatch=Int(Rnd*10)
  2691. Match=tempmatch*10
  2692. MatchReel.SetValue(tempmatch+1)
  2693.  
  2694. If VRRoom > 0 Then
  2695. FlasherMatch
  2696. End If
  2697.  
  2698. If B2SOn Then
  2699. If Match = 0 Then
  2700. Controller.B2SSetMatch 100
  2701. Else
  2702. Controller.B2SSetMatch Match
  2703. End If
  2704. End if
  2705. for i = 1 to Players
  2706. if Match=(Score(i) mod 100) then
  2707. AddSpecial
  2708. end if
  2709. next
  2710. end sub
  2711.  
  2712. Sub TiltTimer_Timer()
  2713. if TiltCount > 0 then TiltCount = TiltCount - 1
  2714. if TiltCount = 0 then
  2715. TiltTimer.Enabled = False
  2716. end if
  2717. end sub
  2718.  
  2719. Sub TiltIt()
  2720. TiltCount = TiltCount + 1
  2721. if TiltCount = 3 then
  2722. TableTilted=True
  2723. If TiltEndsGame=1 then
  2724. BallInPlay=BallsPerGame
  2725. If VRRoom > 0 Then
  2726. for each Object in VRBGGameOver : object.visible = 1 : next
  2727. for each Object in VRBGPlayers : object.visible = 0 : next
  2728. FlasherBalls
  2729. End If
  2730. If B2SOn Then
  2731. Controller.B2SSetGameOver 1
  2732. Controller.B2SSetPlayerUp 0
  2733. Controller.B2SSetBallInPlay 0
  2734. Controller.B2SSetCanPlay 0
  2735. End If
  2736. For each obj in PlayerHuds
  2737. obj.state=0
  2738. next
  2739. GameOverReel.SetValue(1)
  2740. InstructCard.image="IC"
  2741. end if
  2742. TiltOn
  2743. PlasticsOff
  2744. BumpersOff
  2745. Postdown
  2746. if dooralreadyopen=1 then
  2747. closeg.enabled=true
  2748. end if
  2749. LeftFlipper.RotateToStart
  2750. RightFlipper.RotateToStart
  2751. StopSound "buzz"
  2752. StopSound "buzzL"
  2753. TiltReel.SetValue(1)
  2754. If VRRoom > 0 Then
  2755. for each Object in VRBGTilt : object.visible = 1 : next
  2756. End If
  2757. If B2Son then
  2758. Controller.B2SSetTilt 1
  2759. end if
  2760. else
  2761. TiltTimer.Interval = 500
  2762. TiltTimer.Enabled = True
  2763. end if
  2764.  
  2765. end sub
  2766.  
  2767.  
  2768.  
  2769. Sub PlayStartBall_timer()
  2770.  
  2771. PlayStartBall.enabled=false
  2772. PlaySound("StartBall2-5")
  2773. end sub
  2774.  
  2775. Sub PlayerUpRotator_timer()
  2776. If RotatorTemp<5 then
  2777. TempPlayerUp=TempPlayerUp+1
  2778. If TempPlayerUp>4 then
  2779. TempPlayerUp=1
  2780. end if
  2781. If B2SOn Then
  2782. Controller.B2SSetPlayerUp TempPlayerUp
  2783. End If
  2784.  
  2785. else
  2786. if B2SOn then
  2787. Controller.B2SSetPlayerUp Player
  2788. end if
  2789. PlayerUpRotator.enabled=false
  2790. RotatorTemp=1
  2791. end if
  2792. RotatorTemp=RotatorTemp+1
  2793.  
  2794.  
  2795. end sub
  2796.  
  2797. sub savehs
  2798. ' Based on Black's Highscore routines
  2799. Dim FileObj
  2800. Dim ScoreFile
  2801. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2802. If Not FileObj.FolderExists(UserDirectory) then
  2803. Exit Sub
  2804. End if
  2805. Set ScoreFile=FileObj.CreateTextFile(UserDirectory & HSFileName,True)
  2806. ScoreFile.WriteLine 1
  2807. ScoreFile.WriteLine Credits
  2808. scorefile.writeline BallsPerGame
  2809. scorefile.writeline 0
  2810. scorefile.writeline CardLightOption
  2811. scorefile.writeline 0
  2812. scorefile.writeline ReplayLevel
  2813. for xx=1 to 5
  2814. scorefile.writeline HSScore(xx)
  2815. next
  2816. for xx=1 to 5
  2817. scorefile.writeline HSName(xx)
  2818. next
  2819. ScoreFile.Close
  2820. Set ScoreFile=Nothing
  2821. Set FileObj=Nothing
  2822. end sub
  2823.  
  2824. 'sub SaveLMEMConfig
  2825. ' Dim FileObj
  2826. ' Dim LMConfig
  2827. ' dim temp1
  2828. ' dim tempb2s
  2829. ' tempb2s=0
  2830. ' if B2SOn=true then
  2831. ' tempb2s=1
  2832. ' else
  2833. ' tempb2s=0
  2834. ' end if
  2835. ' Set FileObj=CreateObject("Scripting.FileSystemObject")
  2836. ' If Not FileObj.FolderExists(UserDirectory) then
  2837. ' Exit Sub
  2838. ' End if
  2839. ' Set LMConfig=FileObj.CreateTextFile(UserDirectory & LMEMTableConfig,True)
  2840. ' LMConfig.WriteLine tempb2s
  2841. ' LMConfig.Close
  2842. ' Set LMConfig=Nothing
  2843. ' Set FileObj=Nothing
  2844. '
  2845. 'end Sub
  2846.  
  2847. 'sub LoadLMEMConfig
  2848. ' Dim FileObj
  2849. ' Dim LMConfig
  2850. ' dim tempC
  2851. ' dim tempb2s
  2852. '
  2853. ' Set FileObj=CreateObject("Scripting.FileSystemObject")
  2854. ' If Not FileObj.FolderExists(UserDirectory) then
  2855. ' Exit Sub
  2856. ' End if
  2857. ' If Not FileObj.FileExists(UserDirectory & LMEMTableConfig) then
  2858. ' Exit Sub
  2859. ' End if
  2860. ' Set LMConfig=FileObj.GetFile(UserDirectory & LMEMTableConfig)
  2861. ' Set TextStr2=LMConfig.OpenAsTextStream(1,0)
  2862. ' If (TextStr2.AtEndOfStream=True) then
  2863. ' Exit Sub
  2864. ' End if
  2865. ' tempC=TextStr2.ReadLine
  2866. ' TextStr2.Close
  2867. ' tempb2s=cdbl(tempC)
  2868. ' if tempb2s=0 then
  2869. ' B2SOn=false
  2870. ' else
  2871. ' B2SOn=true
  2872. ' end if
  2873. ' Set LMConfig=Nothing
  2874. ' Set FileObj=Nothing
  2875. 'end sub
  2876.  
  2877. 'sub SaveLMEMConfig2
  2878. ' If ShadowConfigFile=false then exit sub
  2879. ' Dim FileObj
  2880. ' Dim LMConfig2
  2881. ' dim temp1
  2882. ' dim temp2
  2883. ' dim tempBS
  2884. ' dim tempFS
  2885.  
  2886. ' if EnableBallShadow=true then
  2887. ' tempBS=1
  2888. ' else
  2889. ' tempBS=0
  2890. ' end if
  2891. ' if EnableFlipperShadow=true then
  2892. ' tempFS=1
  2893. ' else
  2894. ' tempFS=0
  2895. ' end if
  2896. '
  2897. ' Set FileObj=CreateObject("Scripting.FileSystemObject")
  2898. ' If Not FileObj.FolderExists(UserDirectory) then
  2899. ' Exit Sub
  2900. ' End if
  2901. ' Set LMConfig2=FileObj.CreateTextFile(UserDirectory & LMEMShadowConfig,True)
  2902. ' LMConfig2.WriteLine tempBS
  2903. ' LMConfig2.WriteLine tempFS
  2904. ' LMConfig2.Close
  2905. ' Set LMConfig2=Nothing
  2906. ' Set FileObj=Nothing
  2907. '
  2908. 'end Sub
  2909.  
  2910. 'sub LoadLMEMConfig2
  2911. ' If ShadowConfigFile=false then
  2912. ' EnableBallShadow = ShadowBallOn
  2913. ' BallShadowUpdate.enabled = ShadowBallOn
  2914. ' EnableFlipperShadow = ShadowFlippersOn
  2915. ' FlipperLSh.visible = ShadowFlippersOn
  2916. ' FlipperRSh.visible = ShadowFlippersOn
  2917. ' exit sub
  2918. ' end if
  2919. ' Dim FileObj
  2920. ' Dim LMConfig2
  2921. ' dim tempC
  2922. ' dim tempD
  2923. ' dim tempFS
  2924. ' dim tempBS
  2925. '
  2926. ' Set FileObj=CreateObject("Scripting.FileSystemObject")
  2927. ' If Not FileObj.FolderExists(UserDirectory) then
  2928. ' Exit Sub
  2929. ' End if
  2930. ' If Not FileObj.FileExists(UserDirectory & LMEMShadowConfig) then
  2931. ' Exit Sub
  2932. ' End if
  2933. ' Set LMConfig2=FileObj.GetFile(UserDirectory & LMEMShadowConfig)
  2934. ' Set TextStr2=LMConfig2.OpenAsTextStream(1,0)
  2935. ' If (TextStr2.AtEndOfStream=True) then
  2936. ' Exit Sub
  2937. ' End if
  2938. ' tempC=TextStr2.ReadLine
  2939. ' tempD=TextStr2.Readline
  2940. ' TextStr2.Close
  2941. ' tempBS=cdbl(tempC)
  2942. ' tempFS=cdbl(tempD)
  2943. ' if tempBS=0 then
  2944. ' EnableBallShadow=false
  2945. ' BallShadowUpdate.enabled=false
  2946. ' else
  2947. ' EnableBallShadow=true
  2948. ' end if
  2949. ' if tempFS=0 then
  2950. ' EnableShadow=false
  2951. ' FlipperLSh.visible=false
  2952. ' FLipperRSh.visible=false
  2953. ' else
  2954. ' EnableFlipperShadow=true
  2955. ' end if
  2956. ' Set LMConfig2=Nothing
  2957. ' Set FileObj=Nothing
  2958. 'end sub
  2959.  
  2960.  
  2961. sub loadhs
  2962. ' Based on Black's Highscore routines
  2963. Dim FileObj
  2964. Dim ScoreFile
  2965. dim temp1
  2966. dim temp2
  2967. dim temp3
  2968. dim temp4
  2969. dim temp5
  2970. dim temp6
  2971. dim temp7
  2972. dim temp8
  2973. dim temp9
  2974. dim temp10
  2975. dim temp11
  2976. dim temp12
  2977. dim temp13
  2978. dim temp14
  2979. dim temp15
  2980. dim temp16
  2981. dim temp17
  2982.  
  2983.  
  2984. Set FileObj=CreateObject("Scripting.FileSystemObject")
  2985. If Not FileObj.FolderExists(UserDirectory) then
  2986. Exit Sub
  2987. End if
  2988. If Not FileObj.FileExists(UserDirectory & HSFileName) then
  2989. Exit Sub
  2990. End if
  2991. Set ScoreFile=FileObj.GetFile(UserDirectory & HSFileName)
  2992. Set TextStr=ScoreFile.OpenAsTextStream(1,0)
  2993. If (TextStr.AtEndOfStream=True) then
  2994. Exit Sub
  2995. End if
  2996. temp1=TextStr.ReadLine
  2997. temp2=textstr.readline
  2998. temp3=textstr.readline
  2999. temp4=textstr.readline
  3000. temp5=textstr.readline
  3001. temp7=textstr.readline
  3002. temp6=textstr.readline
  3003. HighScore=cdbl(temp1)
  3004. if HighScore=1 then
  3005.  
  3006. temp8=textstr.readline
  3007. temp9=textstr.readline
  3008. temp10=textstr.readline
  3009. temp11=textstr.readline
  3010. temp12=textstr.readline
  3011. temp13=textstr.readline
  3012. temp14=textstr.readline
  3013. temp15=textstr.readline
  3014. temp16=textstr.readline
  3015. temp17=textstr.readline
  3016. end if
  3017. TextStr.Close
  3018. if HighScore=1 then
  3019. Credits=cdbl(temp2)
  3020. BallsPerGame=cdbl(temp3)
  3021. TiltEndsGame=cdbl(temp4)
  3022. CardLightOption=cdbl(temp5)
  3023. SpecialOption=cdbl(temp7)
  3024. ReplayLevel=cdbl(temp6)
  3025.  
  3026. HSScore(1) = int(temp8)
  3027. HSScore(2) = int(temp9)
  3028. HSScore(3) = int(temp10)
  3029. HSScore(4) = int(temp11)
  3030. HSScore(5) = int(temp12)
  3031.  
  3032. HSName(1) = temp13
  3033. HSName(2) = temp14
  3034. HSName(3) = temp15
  3035. HSName(4) = temp16
  3036. HSName(5) = temp17
  3037. end if
  3038. Set ScoreFile=Nothing
  3039. Set FileObj=Nothing
  3040. end sub
  3041.  
  3042. Sub DisplayHighScore
  3043.  
  3044.  
  3045. end sub
  3046.  
  3047. sub InitPauser5_timer
  3048. If B2SOn Then
  3049. 'Controller.B2SSetScore 3,HighScore
  3050. End If
  3051. DisplayHighScore
  3052. CreditsReel.SetValue(Credits)
  3053. InitPauser5.enabled=false
  3054. end sub
  3055.  
  3056.  
  3057.  
  3058. sub BumpersOff
  3059. Bumper1Light.Visible=0
  3060. Bumper2Light.Visible=0
  3061. Bumper3Light.Visible=0
  3062. end sub
  3063.  
  3064. sub BumpersOn
  3065. Bumper1Light.Visible=1
  3066. Bumper2Light.Visible=1
  3067. Bumper3Light.Visible=1
  3068. end sub
  3069.  
  3070. Sub TiltOn
  3071. Bumper1.hashitevent=0
  3072. Bumper2.hashitevent=0
  3073. Bumper3.hashitevent=0
  3074. RightSlingShot.collidable=0
  3075. LeftSlingShot.collidable=0
  3076. End Sub
  3077.  
  3078. Sub TiltOff
  3079. Bumper1.hashitevent=1
  3080. Bumper2.hashitevent=1
  3081. Bumper3.hashitevent=1
  3082. RightSlingShot.collidable=1
  3083. LeftSlingShot.collidable=1
  3084. End Sub
  3085.  
  3086. Sub PlasticsOn
  3087.  
  3088. For each obj in Flashers
  3089. obj.Visible=1
  3090. next
  3091.  
  3092. end sub
  3093.  
  3094. Sub PlasticsOff
  3095.  
  3096. For each obj in Flashers
  3097. obj.Visible=0
  3098. next
  3099.  
  3100. end sub
  3101.  
  3102. Sub SetupReplayTables
  3103.  
  3104.  
  3105. Replay1Table(1)=63000
  3106. Replay1Table(2)=84000
  3107. Replay1Table(3)=90000
  3108. Replay1Table(4)=120000
  3109. Replay1Table(5)=82000
  3110. Replay1Table(6)=84000
  3111. Replay1Table(7)=122000
  3112. Replay1Table(8)=124000
  3113. Replay1Table(9)=128000
  3114. Replay1Table(10)=132000
  3115. Replay1Table(11)=71000
  3116. Replay1Table(12)=74000
  3117. Replay1Table(13)=78000
  3118. Replay1Table(14)=999000
  3119. Replay1Table(15)=999000
  3120.  
  3121.  
  3122. Replay2Table(1)=125000
  3123. Replay2Table(2)=129000
  3124. Replay2Table(3)=120000
  3125. Replay2Table(4)=170000
  3126. Replay2Table(5)=94000
  3127. Replay2Table(6)=96000
  3128. Replay2Table(7)=140000
  3129. Replay2Table(8)=142000
  3130. Replay2Table(9)=146000
  3131. Replay2Table(10)=150000
  3132. Replay2Table(11)=85000
  3133. Replay2Table(12)=88000
  3134. Replay2Table(13)=92000
  3135. Replay2Table(14)=999000
  3136. Replay2Table(15)=999000
  3137.  
  3138. Replay3Table(1)=999000
  3139. Replay3Table(2)=999000
  3140. Replay3Table(3)=170000
  3141. Replay3Table(4)=999000
  3142. Replay3Table(5)=106000
  3143. Replay3Table(6)=108000
  3144. Replay3Table(7)=158000
  3145. Replay3Table(8)=160000
  3146. Replay3Table(9)=164000
  3147. Replay3Table(10)=168000
  3148. Replay3Table(11)=93000
  3149. Replay3Table(12)=96000
  3150. Replay3Table(13)=999000
  3151. Replay3Table(14)=999000
  3152. Replay3Table(15)=999000
  3153.  
  3154. Replay4Table(1)=999000
  3155. Replay4Table(2)=999000
  3156. Replay4Table(3)=999000
  3157. Replay4Table(4)=999000
  3158. Replay4Table(5)=999000
  3159. Replay4Table(6)=999000
  3160. Replay4Table(7)=999000
  3161. Replay4Table(8)=999000
  3162. Replay4Table(9)=999000
  3163. Replay4Table(10)=999000
  3164. Replay4Table(11)=999000
  3165. Replay4Table(12)=999000
  3166. Replay4Table(13)=999000
  3167. Replay4Table(14)=999000
  3168. Replay4Table(15)=999000
  3169.  
  3170. ReplayTableMax=2
  3171.  
  3172.  
  3173. end sub
  3174.  
  3175. Sub RefreshReplayCard
  3176. Dim tempst1
  3177. Dim tempst2
  3178. Dim tempst3
  3179. tempst1=FormatNumber(BallsPerGame,0)
  3180. tempst2=FormatNumber(ReplayLevel,0)
  3181. tempst3=FormatNumber(SpecialOption,0)
  3182.  
  3183. BallCard.image = "BC"+tempst1
  3184. Select case SpecialOption
  3185. case 0:
  3186. Replay1=Replay1Table(ReplayLevel)
  3187. Replay2=Replay2Table(ReplayLevel)
  3188. Replay3=Replay3Table(ReplayLevel)
  3189. Replay4=Replay4Table(ReplayLevel)
  3190. case 1:
  3191. Replay1=EVAL("ReplayBalls"&ReplayLevel)(1)
  3192. Replay2=EVAL("ReplayBalls"&ReplayLevel)(2)
  3193. Replay3=999000
  3194. Replay4=999000
  3195. case 2:
  3196. Replay1=999000
  3197. Replay2=999000
  3198. Replay3=999000
  3199. Replay4=999000
  3200. end select
  3201. ReplayCard.image = "SC" + tempst2
  3202.  
  3203.  
  3204.  
  3205. end sub
  3206.  
  3207.  
  3208. '****************************************
  3209. ' SCORE MOTOR
  3210. '****************************************
  3211.  
  3212. ScoreMotorTimer.Enabled = 1
  3213. ScoreMotorTimer.Interval = 135 '135
  3214. AddScoreTimer.Enabled = 1
  3215. AddScoreTimer.Interval = 135
  3216.  
  3217. Dim queuedscore
  3218. Dim MotorMode
  3219. Dim MotorPosition
  3220.  
  3221. Sub SetMotor(y)
  3222. Select Case ScoreMotorAdjustment
  3223. Case 0:
  3224. queuedscore=queuedscore+y
  3225. Case 1:
  3226. If MotorRunning<>1 And InProgress=true then
  3227. queuedscore=queuedscore+y
  3228. end if
  3229. end Select
  3230. end sub
  3231.  
  3232. Sub SetMotor2(x)
  3233. If MotorRunning<>1 And InProgress=true then
  3234. MotorRunning=1
  3235.  
  3236. Select Case x
  3237. Case 50:
  3238. MotorMode=10
  3239. MotorPosition=5
  3240. 'BumpersOff
  3241.  
  3242. Case 100:
  3243. MotorMode=100
  3244. MotorPosition=1
  3245.  
  3246. Case 500:
  3247. MotorMode=500
  3248. MotorPosition=5
  3249. 'BumpersOff
  3250. LightBumpers
  3251.  
  3252. Case 1000:
  3253. MotorMode=1000
  3254. MotorPosition=1
  3255. Case 2000:
  3256. MotorMode=1000
  3257. MotorPosition=2
  3258. BumpersOff
  3259. Case 3000:
  3260. MotorMode=1000
  3261. MotorPosition=3
  3262. BumpersOff
  3263. Case 4000:
  3264. MotorMode=1000
  3265. MotorPosition=4
  3266. 'BumpersOff
  3267. Case 5000:
  3268. MotorMode=1000
  3269. MotorPosition=5
  3270. 'BumpersOff
  3271. LightBumpers
  3272. Case 10000:
  3273. MotorMode=10000
  3274. MotorPosition=1
  3275. Case 50000:
  3276. MotorMode=10000
  3277. MotorPosition=5
  3278. 'BumpersOff
  3279. LightBumpers
  3280. End Select
  3281. End If
  3282. End Sub
  3283.  
  3284. Sub AddScoreTimer_Timer
  3285. Dim tempscore
  3286.  
  3287.  
  3288. If MotorRunning<>1 And InProgress=true then
  3289. if queuedscore>=50000 then
  3290. tempscore=50000
  3291. queuedscore=queuedscore-50000
  3292. SetMotor2(50000)
  3293. exit sub
  3294. end if
  3295. if queuedscore>=10000 then
  3296. tempscore=10000
  3297. queuedscore=queuedscore-10000
  3298. SetMotor2(10000)
  3299. exit sub
  3300. end if
  3301. if queuedscore>=5000 then
  3302. tempscore=5000
  3303. queuedscore=queuedscore-5000
  3304. SetMotor2(5000)
  3305. exit sub
  3306. end if
  3307. if queuedscore>=4000 then
  3308. tempscore=4000
  3309. queuedscore=queuedscore-4000
  3310. SetMotor2(4000)
  3311. exit sub
  3312. end if
  3313.  
  3314. if queuedscore>=3000 then
  3315. tempscore=3000
  3316. queuedscore=queuedscore-3000
  3317. SetMotor2(3000)
  3318. exit sub
  3319. end if
  3320.  
  3321. if queuedscore>=2000 then
  3322. tempscore=2000
  3323. queuedscore=queuedscore-2000
  3324. SetMotor2(2000)
  3325. exit sub
  3326. end if
  3327.  
  3328. if queuedscore>=1000 then
  3329. tempscore=1000
  3330. queuedscore=queuedscore-1000
  3331. SetMotor2(1000)
  3332. exit sub
  3333. end if
  3334.  
  3335. if queuedscore>=500 then
  3336. tempscore=500
  3337. queuedscore=queuedscore-500
  3338. SetMotor2(500)
  3339. exit sub
  3340. end if
  3341.  
  3342. if queuedscore>=100 then
  3343. tempscore=100
  3344. queuedscore=queuedscore-100
  3345. SetMotor2(100)
  3346. exit sub
  3347. end if
  3348.  
  3349. if queuedscore>=50 then
  3350. tempscore=50
  3351. queuedscore=queuedscore-50
  3352. SetMotor2(50)
  3353. exit sub
  3354. end if
  3355.  
  3356. End If
  3357.  
  3358.  
  3359. end Sub
  3360.  
  3361. Sub ScoreMotorTimer_Timer
  3362. If MotorPosition > 0 Then
  3363. Select Case MotorPosition
  3364. Case 5,4,3,2:
  3365. If MotorMode=10000 Then
  3366. AddScore(10000)
  3367. end if
  3368. If MotorMode=1000 Then
  3369. AddScore(1000)
  3370. end if
  3371. if MotorMode=100 OR MotorMode=500 then
  3372. AddScore(100)
  3373. End If
  3374. if MotorMode=10 then
  3375. AddScore(10)
  3376. End if
  3377. MotorPosition=MotorPosition-1
  3378. Case 1:
  3379. If MotorMode=10000 Then
  3380. AddScore(10000)
  3381. end if
  3382. If MotorMode=1000 Then
  3383. AddScore(1000)
  3384. end if
  3385. If MotorMode=100 or MotorMode=500 then
  3386. AddScore(100)
  3387. End If
  3388. if MotorMode=10 then
  3389. AddScore(10)
  3390. End if
  3391. If MotorMode=500 then ToggleAlternatingRelay
  3392. MotorPosition=0:MotorRunning=0:BumpersOn
  3393. End Select
  3394. End If
  3395. End Sub
  3396.  
  3397.  
  3398. Sub AddScore(x)
  3399. If TableTilted=true then exit sub
  3400. Select Case ScoreAdditionAdjustment
  3401. Case 0:
  3402. AddScore1(x)
  3403. Case 1:
  3404. AddScore2(x)
  3405. end Select
  3406.  
  3407. end sub
  3408.  
  3409.  
  3410. Sub AddScore1(x)
  3411. ' debugtext.text=score
  3412. Select Case x
  3413. Case 1:
  3414. PlayChime(10)
  3415. Score(Player)=Score(Player)+1
  3416.  
  3417. Case 10:
  3418. PlayChime(10)
  3419. Score(Player)=Score(Player)+10
  3420. ' debugscore=debugscore+10
  3421.  
  3422. Case 100:
  3423. PlayChime(100)
  3424. Score(Player)=Score(Player)+100
  3425. ' debugscore=debugscore+100
  3426.  
  3427.  
  3428. Case 1000:
  3429. PlayChime(100)
  3430. Score(Player)=Score(Player)+1000
  3431. ' debugscore=debugscore+1000
  3432. End Select
  3433. PlayerScores(Player-1).AddValue(x)
  3434.  
  3435. If ScoreDisplay(Player)<100000 then
  3436. ScoreDisplay(Player)=Score(Player)
  3437. Else
  3438. Score100K(Player)=Int(Score(Player)/100000)
  3439. ScoreDisplay(Player)=Score(Player)-100000
  3440. End If
  3441. if Score(Player)=>100000 then
  3442. EVAL("RolloverReel"&Player).SetValue(1)
  3443. If VRRoom > 0 Then
  3444. Flasher100k
  3445. End If
  3446. FlasherOverTheTop
  3447. If B2SOn Then
  3448. If Player=1 Then
  3449. Controller.B2SSetScoreRolloverPlayer1 Score100K(Player)
  3450. End If
  3451. If Player=2 Then
  3452. Controller.B2SSetScoreRolloverPlayer2 Score100K(Player)
  3453. End If
  3454.  
  3455. If Player=3 Then
  3456. Controller.B2SSetScoreRolloverPlayer3 Score100K(Player)
  3457. End If
  3458.  
  3459. If Player=4 Then
  3460. Controller.B2SSetScoreRolloverPlayer4 Score100K(Player)
  3461. End If
  3462. End If
  3463. End If
  3464. If B2SOn Then
  3465. Controller.B2SSetScorePlayer Player, ScoreDisplay(Player)
  3466. End If
  3467. If Score(Player)>Replay1 and Replay1Paid(Player)=false then
  3468. Replay1Paid(Player)=True
  3469. AddSpecial
  3470. End If
  3471. If Score(Player)>Replay2 and Replay2Paid(Player)=false then
  3472. Replay2Paid(Player)=True
  3473. AddSpecial
  3474. End If
  3475. If Score(Player)>Replay3 and Replay3Paid(Player)=false then
  3476. Replay3Paid(Player)=True
  3477. AddSpecial
  3478. End If
  3479. If Score(Player)>Replay4 and Replay4Paid(Player)=false then
  3480. Replay4Paid(Player)=True
  3481. AddSpecial
  3482. End If
  3483. ' ScoreText.text=debugscore
  3484. End Sub
  3485.  
  3486. Sub AddScore2(x)
  3487. Dim OldScore, NewScore, OldTestScore, NewTestScore
  3488. OldScore = Score(Player)
  3489.  
  3490. Select Case x
  3491. Case 1:
  3492. Score(Player)=Score(Player)+1
  3493. Case 10:
  3494. Score(Player)=Score(Player)+10
  3495. Case 100:
  3496. Score(Player)=Score(Player)+100
  3497. Case 1000:
  3498. Score(Player)=Score(Player)+1000
  3499. Case 10000:
  3500. Score(Player)=Score(Player)+10000
  3501. End Select
  3502. NewScore = Score(Player)
  3503. If NewScore>=100000 then
  3504. EVAL("RolloverReel"&Player).SetValue(1)
  3505. If VRRoom > 0 Then
  3506. Flasher100k
  3507. End If
  3508. FlasherOverTheTop
  3509. if B2SOn then
  3510. if Player=1 then Controller.B2SSetScoreRolloverPlayer1 1
  3511. elseif Player=2 then Controller.B2SSetScoreRolloverPlayer2 1
  3512. elseif Player=3 then Controller.B2SSetScoreRolloverPlayer3 1
  3513. elseif Player=4 then Controller.B2SSetScoreRolloverPlayer4 1
  3514. end if
  3515. end if
  3516. OldTestScore = OldScore
  3517. NewTestScore = NewScore
  3518. Do
  3519. if OldTestScore < Replay1 and NewTestScore >= Replay1 AND Replay1Paid(Player)=false then
  3520. AddSpecial()
  3521. Replay1Paid(Player)=true
  3522. NewTestScore = 0
  3523. Elseif OldTestScore < Replay2 and NewTestScore >= Replay2 AND Replay2Paid(Player)=false then
  3524. AddSpecial()
  3525. Replay2Paid(Player)=true
  3526. NewTestScore = 0
  3527. Elseif OldTestScore < Replay3 and NewTestScore >= Replay3 AND Replay3Paid(Player)=false then
  3528. AddSpecial()
  3529. Replay3Paid(Player)=true
  3530. NewTestScore = 0
  3531. Elseif OldTestScore < Replay4 and NewTestScore >= Replay4 AND Replay4Paid(Player)=false then
  3532. AddSpecial()
  3533. Replay4Paid(Player)=true
  3534. NewTestScore = 0
  3535. End if
  3536. NewTestScore = NewTestScore - 100000
  3537. OldTestScore = OldTestScore - 100000
  3538. Loop While NewTestScore > 0
  3539.  
  3540. OldScore = int(OldScore / 10) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  3541. NewScore = int(NewScore / 10) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
  3542. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore&", OldScore Mod 10="&OldScore Mod 10 & ", NewScore % 10="&NewScore Mod 10)
  3543.  
  3544. if (OldScore Mod 10 <> NewScore Mod 10) then
  3545. PlayChime(10)
  3546. AdvanceZeroToNine
  3547.  
  3548. end if
  3549.  
  3550. OldScore = int(OldScore / 10)
  3551. NewScore = int(NewScore / 10)
  3552. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  3553. if (OldScore Mod 10 <> NewScore Mod 10) then
  3554. PlayChime(10)
  3555.  
  3556.  
  3557. end if
  3558.  
  3559. OldScore = int(OldScore / 10)
  3560. NewScore = int(NewScore / 10)
  3561. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  3562. if (OldScore Mod 10 <> NewScore Mod 10) then
  3563. PlayChime(100)
  3564.  
  3565.  
  3566. end if
  3567.  
  3568. OldScore = int(OldScore / 10)
  3569. NewScore = int(NewScore / 10)
  3570. ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
  3571. if (OldScore Mod 10 <> NewScore Mod 10) then
  3572. PlayChime(1000)
  3573. end if
  3574.  
  3575. If B2SOn Then
  3576. Controller.B2SSetScorePlayer Player, Score(Player)
  3577. End If
  3578. ' EMReel1.SetValue Score(Player)
  3579. PlayerScores(Player-1).AddValue(x)
  3580.  
  3581. End Sub
  3582.  
  3583.  
  3584.  
  3585. Sub PlayChime(x)
  3586. if ChimesOn=0 then
  3587. Select Case x
  3588. Case 10
  3589. If LastChime10=1 Then
  3590. PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
  3591. LastChime10=0
  3592. Else
  3593. PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
  3594. LastChime10=1
  3595. End If
  3596. Case 100
  3597. If LastChime100=1 Then
  3598. PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
  3599. LastChime100=0
  3600. Else
  3601. PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
  3602. LastChime100=1
  3603. End If
  3604.  
  3605. End Select
  3606.  
  3607. If VRRoom > 0 Then
  3608. EMMODE = 1
  3609. UpdateVRReels 0,0 ,score(0), 0, -1,-1,-1,-1,-1
  3610. UpdateVRReels 1,1 ,score(1), 0, -1,-1,-1,-1,-1
  3611. UpdateVRReels 2,2 ,score(2), 0, -1,-1,-1,-1,-1
  3612. UpdateVRReels 3,3 ,score(3), 0, -1,-1,-1,-1,-1
  3613. UpdateVRReels 4,4 ,score(4), 0, -1,-1,-1,-1,-1
  3614. EMMODE = 0 ' restore EM mode
  3615. End If
  3616.  
  3617. else
  3618. Select Case x
  3619. Case 10
  3620. If LastChime10=1 Then
  3621. PlaySound SoundFXDOF("Gottlieb10Points",141,DOFPulse,DOFChimes)
  3622. LastChime10=0
  3623. Else
  3624. PlaySound SoundFXDOF("Gottlieb10Points",141,DOFPulse,DOFChimes)
  3625. LastChime10=1
  3626. End If
  3627. Case 100
  3628. If LastChime100=1 Then
  3629. PlaySound SoundFXDOF("Gottlieb100Points",142,DOFPulse,DOFChimes)
  3630. LastChime100=0
  3631. Else
  3632. PlaySound SoundFXDOF("Gottlieb100Points",142,DOFPulse,DOFChimes)
  3633. LastChime100=1
  3634. End If
  3635. Case 1000
  3636. If LastChime1000=1 Then
  3637. PlaySound SoundFXDOF("Gottlieb1000Points",143,DOFPulse,DOFChimes)
  3638. LastChime1000=0
  3639. Else
  3640. PlaySound SoundFXDOF("Gottlieb1000Points",143,DOFPulse,DOFChimes)
  3641. LastChime1000=1
  3642. End If
  3643. End Select
  3644. If VRRoom > 0 Then
  3645. EMMODE = 1
  3646. UpdateVRReels 0,0 ,score(0), 0, -1,-1,-1,-1,-1
  3647. UpdateVRReels 1,1 ,score(1), 0, -1,-1,-1,-1,-1
  3648. UpdateVRReels 2,2 ,score(2), 0, -1,-1,-1,-1,-1
  3649. UpdateVRReels 3,3 ,score(3), 0, -1,-1,-1,-1,-1
  3650. UpdateVRReels 4,4 ,score(4), 0, -1,-1,-1,-1,-1
  3651. EMMODE = 0 ' restore EM mode
  3652. End If
  3653. end if
  3654. End Sub
  3655.  
  3656. Sub HideOptions()
  3657.  
  3658. end sub
  3659.  
  3660.  
  3661.  
  3662.  
  3663. '******************************************************
  3664. '**** BALL ROLLING AND DROP SOUNDS
  3665. '******************************************************
  3666.  
  3667. Const tnob = 5 ' total number of balls
  3668. Const lob = 0 'number of locked balls
  3669.  
  3670. ReDim rolling(tnob)
  3671. InitRolling
  3672.  
  3673. Dim DropCount
  3674. ReDim DropCount(tnob)
  3675.  
  3676. Sub InitRolling
  3677. Dim i
  3678. For i = 0 to tnob
  3679. rolling(i) = False
  3680. Next
  3681. End Sub
  3682.  
  3683. Sub RollingSoundTimer_Timer()
  3684. Dim BOT, b
  3685. BOT = GetBalls
  3686.  
  3687. ' stop the sound of deleted balls
  3688. For b = UBound(BOT) + 1 to tnob
  3689. If AmbientBallShadowOn = 0 Then BallShadowA(b).visible = 0
  3690. rolling(b) = False
  3691. StopSound("BallRoll_" & b)
  3692. Next
  3693.  
  3694. ' exit the sub if no balls on the table
  3695. If UBound(BOT) = -1 Then Exit Sub
  3696.  
  3697. ' play the rolling sound for each ball
  3698.  
  3699. For b = 0 to UBound(BOT)
  3700. If BallVel(BOT(b)) > 1 AND BOT(b).z < 30 Then
  3701. rolling(b) = True
  3702. PlaySound ("BallRoll_" & b), -1, VolPlayfieldRoll(BOT(b)) * 1.1 * VolumeDial, AudioPan(BOT(b)), 0, PitchPlayfieldRoll(BOT(b)), 1, 0, AudioFade(BOT(b))
  3703.  
  3704. Else
  3705. If rolling(b) = True Then
  3706. StopSound("BallRoll_" & b)
  3707. rolling(b) = False
  3708. End If
  3709. End If
  3710.  
  3711. ' "Static" Ball Shadows
  3712. If AmbientBallShadowOn = 0 Then
  3713. If BOT(b).Z > 30 Then
  3714. BallShadowA(b).height=BOT(b).z - BallSize/4 'This is technically 1/4 of the ball "above" the ramp, but it keeps it from clipping
  3715. Else
  3716. BallShadowA(b).height=BOT(b).z - BallSize/2 + 5
  3717. End If
  3718. BallShadowA(b).Y = BOT(b).Y + Ballsize/5 + fovY
  3719. BallShadowA(b).X = BOT(b).X
  3720. BallShadowA(b).visible = 1
  3721. End If
  3722.  
  3723. ' Ball Drop Sounds
  3724. If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
  3725. If DropCount(b) >= 5 Then
  3726. DropCount(b) = 0
  3727. If BOT(b).velz > -7 Then
  3728. RandomSoundBallBouncePlayfieldSoft BOT(b)
  3729. Else
  3730. RandomSoundBallBouncePlayfieldHard BOT(b)
  3731. End If
  3732. End If
  3733. End If
  3734. If DropCount(b) < 5 Then
  3735. DropCount(b) = DropCount(b) + 1
  3736. End If
  3737. Next
  3738. End Sub
  3739.  
  3740.  
  3741. '******************************************************
  3742. '**** END BALL ROLLING AND DROP SOUNDS
  3743. '******************************************************
  3744.  
  3745.  
  3746.  
  3747.  
  3748. '***************************************************************
  3749. '**** VPW DYNAMIC BALL SHADOWS by Iakki, Apophis, and Wylte
  3750. '***************************************************************
  3751.  
  3752. '****** INSTRUCTIONS please read ******
  3753.  
  3754. '****** Part A: Table Elements ******
  3755. '
  3756. ' Import the "bsrtx7" and "ballshadow" images
  3757. ' Import the shadow materials file (3 sets included) (you can also export the 3 sets from this table to create the same file)
  3758. ' Copy in the BallShadowA flasher set and the sets of primitives named BallShadow#, RtxBallShadow#, and RtxBall2Shadow#
  3759. ' * with at least as many objects each as there can be balls, including locked balls
  3760. ' Ensure you have a timer with a -1 interval that is always running
  3761.  
  3762. ' Create a collection called DynamicSources that includes all light sources you want to cast ball shadows
  3763. '***These must be organized in order, so that lights that intersect on the table are adjacent in the collection***
  3764. '
  3765. ' This is because the code will only project two shadows if they are coming from lights that are consecutive in the collection
  3766. ' The easiest way to keep track of this is to start with the group on the left slingshot and move clockwise around the table
  3767. ' For example, if you use 6 lights: A & B on the left slingshot and C & D on the right, with E near A&B and F next to C&D, your collection would look like EBACDF
  3768. '
  3769. ' E
  3770. ' A C B
  3771. ' B D your collection should look like A because E&B, B&A, etc. intersect; but B&D or E&F do not
  3772. ' E F C
  3773. ' D
  3774. ' F
  3775. '
  3776. '****** End Part A: Table Elements ******
  3777.  
  3778.  
  3779. '****** Part B: Code and Functions ******
  3780.  
  3781. ' *** Timer sub
  3782. ' The "DynamicBSUpdate" sub should be called by a timer with an interval of -1 (framerate)
  3783. Sub FrameTimer_Timer()
  3784. If DynamicBallShadowsOn Or AmbientBallShadowOn Then DynamicBSUpdate 'update ball shadows
  3785. End Sub
  3786.  
  3787. ' *** User Options - Uncomment here or move to top
  3788. Const fovY = -2 'Offset y position under ball to account for layback or inclination (more pronounced need further back)
  3789. Const DynamicBSFactor = 0.95 '0 to 1, higher is darker
  3790. Const AmbientBSFactor = 0.7 '0 to 1, higher is darker
  3791. Const AmbientMovement = 2 '1 to 4, higher means more movement as the ball moves left and right
  3792. Const Wideness = 20 'Sets how wide the dynamic ball shadows can get (20 +5 thinness should be most realistic for a 50 unit ball)
  3793. Const Thinness = 10 'Sets minimum as ball moves away from source
  3794.  
  3795.  
  3796. ' *** This segment goes within the RollingUpdate sub, so that if Ambient...=0 and Dynamic...=0 the entire DynamicBSUpdate sub can be skipped for max performance
  3797.  
  3798. ' *** Required Functions, enable these if they are not already present elswhere in your table
  3799. Function DistanceFast(x, y)
  3800. dim ratio, ax, ay
  3801. ax = abs(x) 'Get absolute value of each vector
  3802. ay = abs(y)
  3803. ratio = 1 / max(ax, ay) 'Create a ratio
  3804. ratio = ratio * (1.29289 - (ax + ay) * ratio * 0.29289)
  3805. if ratio > 0 then 'Quickly determine if it's worth using
  3806. DistanceFast = 1/ratio
  3807. Else
  3808. DistanceFast = 0
  3809. End if
  3810. end Function
  3811.  
  3812. Function max(a,b)
  3813. if a > b then
  3814. max = a
  3815. Else
  3816. max = b
  3817. end if
  3818. end Function
  3819.  
  3820.  
  3821. '****** End Part B: Code and Functions ******
  3822.  
  3823.  
  3824. '****** Part C: The Magic ******
  3825. Dim sourcenames, currentShadowCount
  3826. sourcenames = Array ("","","","","","","","","","","","")
  3827. currentShadowCount = Array (0,0,0,0,0,0,0,0,0,0,0,0)
  3828.  
  3829. ' *** Trim or extend these to match the number of balls/primitives/flashers on the table!
  3830. dim objrtx1(12), objrtx2(12)
  3831. dim objBallShadow(12)
  3832. Dim BallShadowA
  3833. BallShadowA = Array (BallShadowA0,BallShadowA1,BallShadowA2,BallShadowA3,BallShadowA4,BallShadowA5,BallShadowA6,BallShadowA7,BallShadowA8,BallShadowA9,BallShadowA10,BallShadowA11)
  3834.  
  3835. DynamicBSInit
  3836.  
  3837. sub DynamicBSInit()
  3838. Dim iii
  3839.  
  3840. for iii = 0 to tnob 'Prepares the shadow objects before play begins
  3841. Set objrtx1(iii) = Eval("RtxBallShadow" & iii)
  3842. objrtx1(iii).material = "RtxBallShadow" & iii
  3843. objrtx1(iii).z = iii/1000 + 0.01
  3844. objrtx1(iii).visible = 0
  3845.  
  3846. Set objrtx2(iii) = Eval("RtxBall2Shadow" & iii)
  3847. objrtx2(iii).material = "RtxBallShadow2_" & iii
  3848. objrtx2(iii).z = (iii)/1000 + 0.02
  3849. objrtx2(iii).visible = 0
  3850.  
  3851. currentShadowCount(iii) = 0
  3852.  
  3853. Set objBallShadow(iii) = Eval("BallShadow" & iii)
  3854. objBallShadow(iii).material = "BallShadow" & iii
  3855. UpdateMaterial objBallShadow(iii).material,1,0,0,0,0,0,AmbientBSFactor,RGB(0,0,0),0,0,False,True,0,0,0,0
  3856. objBallShadow(iii).Z = iii/1000 + 0.04
  3857. objBallShadow(iii).visible = 0
  3858.  
  3859. BallShadowA(iii).Opacity = 100*AmbientBSFactor
  3860. BallShadowA(iii).visible = 0
  3861. Next
  3862. end sub
  3863.  
  3864.  
  3865. Sub DynamicBSUpdate
  3866. Dim falloff: falloff = 100 'Max distance to light sources, can be changed if you have a reason
  3867. Dim ShadowOpacity, ShadowOpacity2
  3868. Dim s, Source, LSd, currentMat, AnotherSource, BOT
  3869. BOT = GetBalls
  3870.  
  3871. 'Hide shadow of deleted balls
  3872. For s = UBound(BOT) + 1 to tnob
  3873. objrtx1(s).visible = 0
  3874. objrtx2(s).visible = 0
  3875. objBallShadow(s).visible = 0
  3876. BallShadowA(s).visible = 0
  3877. Next
  3878.  
  3879. If UBound(BOT) < lob Then Exit Sub 'No balls in play, exit
  3880.  
  3881. 'The Magic happens now
  3882. For s = lob to UBound(BOT)
  3883.  
  3884. ' *** Normal "ambient light" ball shadow
  3885. 'Layered from top to bottom. If you had an upper pf at for example 80 and ramps even above that, your segments would be z>110; z<=110 And z>100; z<=100 And z>30; z<=30 And z>20; Else invisible
  3886.  
  3887. If AmbientBallShadowOn = 1 Then 'Primitive shadow on playfield, flasher shadow in ramps
  3888. If BOT(s).Z > 30 Then 'The flasher follows the ball up ramps while the primitive is on the pf
  3889. If BOT(s).X < tablewidth/2 Then
  3890. objBallShadow(s).X = ((BOT(s).X) - (Ballsize/10) + ((BOT(s).X - (tablewidth/2))/(Ballsize/AmbientMovement))) + 5
  3891. Else
  3892. objBallShadow(s).X = ((BOT(s).X) + (Ballsize/10) + ((BOT(s).X - (tablewidth/2))/(Ballsize/AmbientMovement))) - 5
  3893. End If
  3894. objBallShadow(s).Y = BOT(s).Y + BallSize/10 + fovY
  3895. objBallShadow(s).visible = 1
  3896.  
  3897. BallShadowA(s).X = BOT(s).X
  3898. BallShadowA(s).Y = BOT(s).Y + BallSize/5 + fovY
  3899. BallShadowA(s).height=BOT(s).z - BallSize/4 'This is technically 1/4 of the ball "above" the ramp, but it keeps it from clipping
  3900. BallShadowA(s).visible = 1
  3901. Elseif BOT(s).Z <= 30 And BOT(s).Z > 20 Then 'On pf, primitive only
  3902. objBallShadow(s).visible = 1
  3903. If BOT(s).X < tablewidth/2 Then
  3904. objBallShadow(s).X = ((BOT(s).X) - (Ballsize/10) + ((BOT(s).X - (tablewidth/2))/(Ballsize/AmbientMovement))) + 5
  3905. Else
  3906. objBallShadow(s).X = ((BOT(s).X) + (Ballsize/10) + ((BOT(s).X - (tablewidth/2))/(Ballsize/AmbientMovement))) - 5
  3907. End If
  3908. objBallShadow(s).Y = BOT(s).Y + fovY
  3909. BallShadowA(s).visible = 0
  3910. Else 'Under pf, no shadows
  3911. objBallShadow(s).visible = 0
  3912. BallShadowA(s).visible = 0
  3913. end if
  3914.  
  3915. Elseif AmbientBallShadowOn = 2 Then 'Flasher shadow everywhere
  3916. If BOT(s).Z > 30 Then 'In a ramp
  3917. BallShadowA(s).X = BOT(s).X
  3918. BallShadowA(s).Y = BOT(s).Y + BallSize/5 + fovY
  3919. BallShadowA(s).height=BOT(s).z - BallSize/4 'This is technically 1/4 of the ball "above" the ramp, but it keeps it from clipping
  3920. BallShadowA(s).visible = 1
  3921. Elseif BOT(s).Z <= 30 And BOT(s).Z > 20 Then 'On pf
  3922. BallShadowA(s).visible = 1
  3923. If BOT(s).X < tablewidth/2 Then
  3924. BallShadowA(s).X = ((BOT(s).X) - (Ballsize/10) + ((BOT(s).X - (tablewidth/2))/(Ballsize/AmbientMovement))) + 5
  3925. Else
  3926. BallShadowA(s).X = ((BOT(s).X) + (Ballsize/10) + ((BOT(s).X - (tablewidth/2))/(Ballsize/AmbientMovement))) - 5
  3927. End If
  3928. BallShadowA(s).Y = BOT(s).Y + Ballsize/10 + fovY
  3929. BallShadowA(s).height=BOT(s).z - BallSize/2 + 5
  3930. Else 'Under pf
  3931. BallShadowA(s).visible = 0
  3932. End If
  3933. End If
  3934.  
  3935. ' *** Dynamic shadows
  3936. If DynamicBallShadowsOn Then
  3937. If BOT(s).Z < 30 Then 'And BOT(s).Y < (TableHeight - 200) Then 'Or BOT(s).Z > 105 Then 'Defining when and where (on the table) you can have dynamic shadows
  3938. For Each Source in DynamicSources
  3939. LSd=DistanceFast((BOT(s).x-Source.x),(BOT(s).y-Source.y)) 'Calculating the Linear distance to the Source
  3940. If LSd < falloff and Source.state=1 Then 'If the ball is within the falloff range of a light and light is on
  3941. currentShadowCount(s) = currentShadowCount(s) + 1 'Within range of 1 or 2
  3942. if currentShadowCount(s) = 1 Then '1 dynamic shadow source
  3943. sourcenames(s) = source.name
  3944. currentMat = objrtx1(s).material
  3945. objrtx2(s).visible = 0 : objrtx1(s).visible = 1 : objrtx1(s).X = BOT(s).X : objrtx1(s).Y = BOT(s).Y + fovY
  3946. ' objrtx1(s).Z = BOT(s).Z - 25 + s/1000 + 0.01 'Uncomment if you want to add shadows to an upper/lower pf
  3947. objrtx1(s).rotz = AnglePP(Source.x, Source.y, BOT(s).X, BOT(s).Y) + 90
  3948. ShadowOpacity = (falloff-LSd)/falloff 'Sets opacity/darkness of shadow by distance to light
  3949. objrtx1(s).size_y = Wideness*ShadowOpacity+Thinness 'Scales shape of shadow with distance/opacity
  3950. UpdateMaterial currentMat,1,0,0,0,0,0,ShadowOpacity*DynamicBSFactor^2,RGB(0,0,0),0,0,False,True,0,0,0,0
  3951. If AmbientBallShadowOn = 1 Then
  3952. currentMat = objBallShadow(s).material 'Brightens the ambient primitive when it's close to a light
  3953. UpdateMaterial currentMat,1,0,0,0,0,0,AmbientBSFactor*(1-ShadowOpacity),RGB(0,0,0),0,0,False,True,0,0,0,0
  3954. Else
  3955. BallShadowA(s).Opacity = 100*AmbientBSFactor*(1-ShadowOpacity)
  3956. End If
  3957.  
  3958. Elseif currentShadowCount(s) = 2 Then
  3959. 'Same logic as 1 shadow, but twice
  3960. currentMat = objrtx1(s).material
  3961. set AnotherSource = Eval(sourcenames(s))
  3962. objrtx1(s).visible = 1 : objrtx1(s).X = BOT(s).X : objrtx1(s).Y = BOT(s).Y + fovY
  3963. ' objrtx1(s).Z = BOT(s).Z - 25 + s/1000 + 0.01 'Uncomment if you want to add shadows to an upper/lower pf
  3964. objrtx1(s).rotz = AnglePP(AnotherSource.x, AnotherSource.y, BOT(s).X, BOT(s).Y) + 90
  3965. ShadowOpacity = (falloff-(((BOT(s).x-AnotherSource.x)^2+(BOT(s).y-AnotherSource.y)^2)^0.5))/falloff
  3966. objrtx1(s).size_y = Wideness*ShadowOpacity+Thinness
  3967. UpdateMaterial currentMat,1,0,0,0,0,0,ShadowOpacity*DynamicBSFactor^3,RGB(0,0,0),0,0,False,True,0,0,0,0
  3968.  
  3969. currentMat = objrtx2(s).material
  3970. objrtx2(s).visible = 1 : objrtx2(s).X = BOT(s).X : objrtx2(s).Y = BOT(s).Y + fovY
  3971. ' objrtx2(s).Z = BOT(s).Z - 25 + s/1000 + 0.02 'Uncomment if you want to add shadows to an upper/lower pf
  3972. objrtx2(s).rotz = AnglePP(Source.x, Source.y, BOT(s).X, BOT(s).Y) + 90
  3973. ShadowOpacity2 = (falloff-LSd)/falloff
  3974. objrtx2(s).size_y = Wideness*ShadowOpacity2+Thinness
  3975. UpdateMaterial currentMat,1,0,0,0,0,0,ShadowOpacity2*DynamicBSFactor^3,RGB(0,0,0),0,0,False,True,0,0,0,0
  3976. If AmbientBallShadowOn = 1 Then
  3977. currentMat = objBallShadow(s).material 'Brightens the ambient primitive when it's close to a light
  3978. UpdateMaterial currentMat,1,0,0,0,0,0,AmbientBSFactor*(1-max(ShadowOpacity,ShadowOpacity2)),RGB(0,0,0),0,0,False,True,0,0,0,0
  3979. Else
  3980. BallShadowA(s).Opacity = 100*AmbientBSFactor*(1-max(ShadowOpacity,ShadowOpacity2))
  3981. End If
  3982. end if
  3983. Else
  3984. currentShadowCount(s) = 0
  3985. BallShadowA(s).Opacity = 100*AmbientBSFactor
  3986. End If
  3987. Next
  3988. Else 'Hide dynamic shadows everywhere else
  3989. objrtx2(s).visible = 0 : objrtx1(s).visible = 0
  3990. End If
  3991. End If
  3992. Next
  3993. End Sub
  3994. '****************************************************************
  3995. '**** END VPW DYNAMIC BALL SHADOWS by Iakki, Apophis, and Wylte
  3996. '****************************************************************
  3997.  
  3998.  
  3999. ' ============================================================================================
  4000. ' GNMOD - Multiple High Score Display and Collection
  4001. ' ============================================================================================
  4002. Dim EnteringInitials ' Normally zero, set to non-zero to enter initials
  4003. EnteringInitials = 0
  4004.  
  4005. Dim PlungerPulled
  4006. PlungerPulled = 0
  4007.  
  4008. Dim SelectedChar ' character under the "cursor" when entering initials
  4009.  
  4010. Dim HSTimerCount ' Pass counter for HS timer, scores are cycled by the timer
  4011. HSTimerCount = 5 ' Timer is initially enabled, it'll wrap from 5 to 1 when it's displayed
  4012.  
  4013. Dim InitialString ' the string holding the player's initials as they're entered
  4014.  
  4015. Dim AlphaString ' A-Z, 0-9, space (_) and backspace (<)
  4016. Dim AlphaStringPos ' pointer to AlphaString, move forward and backward with flipper keys
  4017. AlphaString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_<"
  4018.  
  4019. Dim HSNewHigh ' The new score to be recorded
  4020.  
  4021. Dim HSScore(5) ' High Scores read in from config file
  4022. Dim HSName(5) ' High Score Initials read in from config file
  4023.  
  4024. ' default high scores, remove this when the scores are available from the config file
  4025. HSScore(1) = 75000
  4026. HSScore(2) = 70000
  4027. HSScore(3) = 60000
  4028. HSScore(4) = 55000
  4029. HSScore(5) = 50000
  4030.  
  4031. HSName(1) = "AAA"
  4032. HSName(2) = "ZZZ"
  4033. HSName(3) = "XXX"
  4034. HSName(4) = "ABC"
  4035. HSName(5) = "BBB"
  4036.  
  4037. Sub HighScoreTimer_Timer
  4038.  
  4039. if EnteringInitials then
  4040. if HSTimerCount = 1 then
  4041. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  4042. HSTimerCount = 2
  4043. else
  4044. SetHSLine 3, InitialString
  4045. HSTimerCount = 1
  4046. end if
  4047. elseif InProgress then
  4048. SetHSLine 1, "HIGH SCORE1"
  4049. SetHSLine 2, HSScore(1)
  4050. SetHSLine 3, HSName(1)
  4051. HSTimerCount = 5 ' set so the highest score will show after the game is over
  4052. HighScoreTimer.enabled=false
  4053. elseif CheckAllScores then
  4054. NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
  4055.  
  4056. else
  4057. ' cycle through high scores
  4058. HighScoreTimer.interval=2000
  4059. HSTimerCount = HSTimerCount + 1
  4060. if HsTimerCount > 5 then
  4061. HSTimerCount = 1
  4062. End If
  4063. SetHSLine 1, "HIGH SCORE"+FormatNumber(HSTimerCount,0)
  4064. SetHSLine 2, HSScore(HSTimerCount)
  4065. SetHSLine 3, HSName(HSTimerCount)
  4066. end if
  4067. End Sub
  4068.  
  4069. Function GetHSChar(String, Index)
  4070. dim ThisChar
  4071. dim FileName
  4072. ThisChar = Mid(String, Index, 1)
  4073. FileName = "PostIt"
  4074. if ThisChar = " " or ThisChar = "" then
  4075. FileName = FileName & "BL"
  4076. elseif ThisChar = "<" then
  4077. FileName = FileName & "LT"
  4078. elseif ThisChar = "_" then
  4079. FileName = FileName & "SP"
  4080. else
  4081. FileName = FileName & ThisChar
  4082. End If
  4083. GetHSChar = FileName
  4084. End Function
  4085.  
  4086. Sub SetHsLine(LineNo, String)
  4087. dim Letter
  4088. dim ThisDigit
  4089. dim ThisChar
  4090. dim StrLen
  4091. dim LetterLine
  4092. dim Index
  4093. dim StartHSArray
  4094. dim EndHSArray
  4095. dim LetterName
  4096. dim xfor
  4097. StartHSArray=array(0,1,12,22)
  4098. EndHSArray=array(0,11,21,31)
  4099. StrLen = len(string)
  4100. Index = 1
  4101.  
  4102. for xfor = StartHSArray(LineNo) to EndHSArray(LineNo)
  4103. Eval("HS"&xfor).image = GetHSChar(String, Index)
  4104. Index = Index + 1
  4105. next
  4106.  
  4107. End Sub
  4108.  
  4109. Sub NewHighScore(NewScore, PlayNum)
  4110. if NewScore > HSScore(5) then
  4111. HighScoreTimer.interval = 500
  4112. HSTimerCount = 1
  4113. AlphaStringPos = 1 ' start with first character "A"
  4114. EnteringInitials = 1 ' intercept the control keys while entering initials
  4115. InitialString = "" ' initials entered so far, initialize to empty
  4116. SetHSLine 1, "PLAYER "+FormatNumber(PlayNum,0)
  4117. SetHSLine 2, "ENTER NAME"
  4118. SetHSLine 3, MID(AlphaString, AlphaStringPos, 1)
  4119. HSNewHigh = NewScore
  4120. For xx=1 to HighScoreReward
  4121. AddSpecial
  4122. next
  4123. End if
  4124. ScoreChecker=ScoreChecker-1
  4125. if ScoreChecker=0 then
  4126. CheckAllScores=0
  4127. end if
  4128. End Sub
  4129.  
  4130. Sub CollectInitials(keycode)
  4131. If keycode = LeftFlipperKey Then
  4132. ' back up to previous character
  4133. AlphaStringPos = AlphaStringPos - 1
  4134. if AlphaStringPos < 1 then
  4135. AlphaStringPos = len(AlphaString) ' handle wrap from beginning to end
  4136. if InitialString = "" then
  4137. ' Skip the backspace if there are no characters to backspace over
  4138. AlphaStringPos = AlphaStringPos - 1
  4139. End if
  4140. end if
  4141. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  4142. PlaySound "DropTargetDropped"
  4143. elseif keycode = RightFlipperKey Then
  4144. ' advance to next character
  4145. AlphaStringPos = AlphaStringPos + 1
  4146. if AlphaStringPos > len(AlphaString) or (AlphaStringPos = len(AlphaString) and InitialString = "") then
  4147. ' Skip the backspace if there are no characters to backspace over
  4148. AlphaStringPos = 1
  4149. end if
  4150. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  4151. PlaySound "DropTargetDropped"
  4152. elseif keycode = StartGameKey or keycode = PlungerKey Then
  4153. SelectedChar = MID(AlphaString, AlphaStringPos, 1)
  4154. if SelectedChar = "_" then
  4155. InitialString = InitialString & " "
  4156. PlaySound("Ding10")
  4157. elseif SelectedChar = "<" then
  4158. InitialString = MID(InitialString, 1, len(InitialString) - 1)
  4159. if len(InitialString) = 0 then
  4160. ' If there are no more characters to back over, don't leave the < displayed
  4161. AlphaStringPos = 1
  4162. end if
  4163. PlaySound("Ding100")
  4164. else
  4165. InitialString = InitialString & SelectedChar
  4166. PlaySound("Ding10")
  4167. end if
  4168. if len(InitialString) < 3 then
  4169. SetHSLine 3, InitialString & SelectedChar
  4170. End If
  4171. End If
  4172. if len(InitialString) = 3 then
  4173. ' save the score
  4174. for i = 5 to 1 step -1
  4175. if i = 1 or (HSNewHigh > HSScore(i) and HSNewHigh <= HSScore(i - 1)) then
  4176. ' Replace the score at this location
  4177. if i < 5 then
  4178. ' MsgBox("Moving " & i & " to " & (i + 1))
  4179. HSScore(i + 1) = HSScore(i)
  4180. HSName(i + 1) = HSName(i)
  4181. end if
  4182. ' MsgBox("Saving initials " & InitialString & " to position " & i)
  4183. EnteringInitials = 0
  4184. HSScore(i) = HSNewHigh
  4185. HSName(i) = InitialString
  4186. HSTimerCount = 5
  4187. HighScoreTimer_Timer
  4188. HighScoreTimer.interval = 2000
  4189. PlaySound("Ding1000")
  4190. exit sub
  4191. elseif i < 5 then
  4192. ' move the score in this slot down by 1, it's been exceeded by the new score
  4193. ' MsgBox("Moving " & i & " to " & (i + 1))
  4194. HSScore(i + 1) = HSScore(i)
  4195. HSName(i + 1) = HSName(i)
  4196. end if
  4197. next
  4198. End If
  4199.  
  4200. End Sub
  4201. ' END GNMOD
  4202. ' ============================================================================================
  4203. ' GNMOD - New Options menu
  4204. ' ============================================================================================
  4205. Dim EnteringOptions
  4206. Dim CurrentOption
  4207. Dim OptionCHS
  4208. Dim MaxOption
  4209. Dim OptionHighScorePosition
  4210. Dim XOpt
  4211. Dim StartingArray
  4212. Dim EndingArray
  4213.  
  4214. StartingArray=Array(0,1,2,30,33,61,89,117,145,173,201,229)
  4215. EndingArray=Array(0,1,29,32,60,88,116,144,172,200,228,256)
  4216. EnteringOptions = 0
  4217. MaxOption = 9
  4218. OptionCHS = 0
  4219. OptionHighScorePosition = 0
  4220. Const OptionLinesToMark="111010011"
  4221. Const OptionLine1="" 'do not use this line
  4222. Const OptionLine2="" 'do not use this line
  4223. Const OptionLine3="" 'do not use this line
  4224. Const OptionLine4=""
  4225. Const OptionLine5="Double Bonus Light Option"
  4226. Const OptionLine6=""
  4227. Const OptionLine7=""
  4228. Const OptionLine8="" 'do not use this line
  4229. Const OptionLine9="" 'do not use this line
  4230.  
  4231. Sub OperatorMenuTimer_Timer
  4232. EnteringOptions = 1
  4233. OperatorMenuTimer.enabled=false
  4234. ShowOperatorMenu
  4235. end sub
  4236.  
  4237. sub ShowOperatorMenu
  4238. OperatorMenuBackdrop.image = "OperatorMenu"
  4239.  
  4240. OptionCHS = 0
  4241. CurrentOption = 1
  4242. DisplayAllOptions
  4243. OperatorOption1.image = "BluePlus"
  4244. SetHighScoreOption
  4245.  
  4246. End Sub
  4247.  
  4248. Sub DisplayAllOptions
  4249. dim linecounter
  4250. dim tempstring
  4251. For linecounter = 1 to MaxOption
  4252. tempstring=Eval("OptionLine"&linecounter)
  4253. Select Case linecounter
  4254. Case 1:
  4255. tempstring=tempstring + FormatNumber(BallsPerGame,0)
  4256. SetOptLine 1,tempstring
  4257. Case 2:
  4258. If SpecialOption = 0 then
  4259. if Replay3Table(ReplayLevel)=999000 then
  4260. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0)
  4261. elseif Replay4Table(ReplayLevel)=999000 then
  4262. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0)
  4263. else
  4264. tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0) + "/" + FormatNumber(Replay4Table(ReplayLevel),0)
  4265. end if
  4266. elseif SpecialOption = 1 then
  4267. tempstring = FormatNumber(EVAL("ReplayBalls"&ReplayLevel)(1),0) + "/" + FormatNumber(EVAL("ReplayBalls"&ReplayLevel)(2),0)
  4268. end if
  4269. SetOptLine 2,tempstring
  4270. Case 3:
  4271. If OptionCHS=0 then
  4272. tempstring = "NO"
  4273. else
  4274. tempstring = "YES"
  4275. end if
  4276. SetOptLine 3,tempstring
  4277. Case 4:
  4278. SetOptLine 4, tempstring
  4279.  
  4280.  
  4281. SetOptLine 5, tempstring
  4282. Case 5:
  4283. SetOptLine 6, tempstring
  4284. Select Case CardLightOption
  4285. Case 0:
  4286. tempstring = "Conservative"
  4287. Case 1:
  4288. tempstring = "Medium"
  4289. Case 2:
  4290. tempstring = "Liberal"
  4291. end select
  4292.  
  4293. SetOptLine 7, tempstring
  4294.  
  4295. Case 6:
  4296. SetOptLine 8, tempstring
  4297.  
  4298.  
  4299.  
  4300.  
  4301. SetOptLine 9, tempstring
  4302.  
  4303. Case 7:
  4304. SetOptLine 10, tempstring
  4305. SetOptLine 11, tempstring
  4306.  
  4307. Case 8:
  4308.  
  4309. Case 9:
  4310.  
  4311.  
  4312. End Select
  4313.  
  4314. next
  4315. end sub
  4316.  
  4317. sub MoveArrow
  4318. do
  4319. CurrentOption = CurrentOption + 1
  4320. If CurrentOption>Len(OptionLinesToMark) then
  4321. CurrentOption=1
  4322. end if
  4323. loop until Mid(OptionLinesToMark,CurrentOption,1)="1"
  4324. end sub
  4325.  
  4326. sub CollectOptions(ByVal keycode)
  4327. if Keycode = LeftFlipperKey then
  4328. PlaySound "DropTargetDropped"
  4329. For XOpt = 1 to MaxOption
  4330. Eval("OperatorOption"&XOpt).image = "PostitBL"
  4331. next
  4332. MoveArrow
  4333. if CurrentOption<8 then
  4334. Eval("OperatorOption"&CurrentOption).image = "BluePlus"
  4335. elseif CurrentOption=8 then
  4336. Eval("OperatorOption"&CurrentOption).image = "GreenCheck"
  4337. else
  4338. Eval("OperatorOption"&CurrentOption).image = "RedX"
  4339. end if
  4340.  
  4341. elseif Keycode = RightFlipperKey then
  4342. PlaySound "DropTargetDropped"
  4343. if CurrentOption = 1 then
  4344. If BallsPerGame = 3 then
  4345. BallsPerGame = 5
  4346. else
  4347. BallsPerGame = 3
  4348. end if
  4349. DisplayAllOptions
  4350. elseif CurrentOption = 2 then
  4351. ReplayLevel=ReplayLevel+1
  4352. if SpecialOption=0 then
  4353. If ReplayLevel>ReplayTableMax then
  4354. ReplayLevel=1
  4355. end if
  4356. end if
  4357. if SpecialOption=1 then
  4358. If ReplayLevel>2 then
  4359. ReplayLevel=1
  4360. end if
  4361. end if
  4362. DisplayAllOptions
  4363. elseif CurrentOption = 3 then
  4364. if OptionCHS = 0 then
  4365. OptionCHS = 1
  4366.  
  4367. else
  4368. OptionCHS = 0
  4369.  
  4370. end if
  4371. DisplayAllOptions
  4372.  
  4373.  
  4374. elseif CurrentOption = 5 then
  4375. CardLightOption=CardLightOption+1
  4376. if CardLightOption>2 then
  4377. CardLightOption=0
  4378. end if
  4379. DisplayAllOptions
  4380.  
  4381.  
  4382.  
  4383. elseif CurrentOption = 8 or CurrentOption = 9 then
  4384. if OptionCHS=1 then
  4385. HSScore(1) = 75000
  4386. HSScore(2) = 70000
  4387. HSScore(3) = 60000
  4388. HSScore(4) = 55000
  4389. HSScore(5) = 50000
  4390.  
  4391. HSName(1) = "AAA"
  4392. HSName(2) = "ZZZ"
  4393. HSName(3) = "XXX"
  4394. HSName(4) = "ABC"
  4395. HSName(5) = "BBB"
  4396. end if
  4397.  
  4398. if CurrentOption = 8 then
  4399. savehs
  4400. else
  4401. loadhs
  4402. end if
  4403. OperatorMenuBackdrop.image = "PostitBL"
  4404. For XOpt = 1 to MaxOption
  4405. Eval("OperatorOption"&XOpt).image = "PostitBL"
  4406. next
  4407.  
  4408. For XOpt = 1 to 256
  4409. Eval("Option"&XOpt).image = "PostItBL"
  4410. next
  4411. RefreshReplayCard
  4412. InstructCard.image="IC"
  4413. EnteringOptions = 0
  4414.  
  4415. end if
  4416. end if
  4417. End Sub
  4418.  
  4419. Sub SetHighScoreOption
  4420.  
  4421. End Sub
  4422.  
  4423. Function GetOptChar(String, Index)
  4424. dim ThisChar
  4425. dim FileName
  4426. ThisChar = Mid(String, Index, 1)
  4427. FileName = "PostIt"
  4428. if ThisChar = " " or ThisChar = "" then
  4429. FileName = FileName & "BL"
  4430. elseif ThisChar = "<" then
  4431. FileName = FileName & "LT"
  4432. elseif ThisChar = ">" then
  4433. FileName = FileName & "GT"
  4434. elseif ThisChar = "_" then
  4435. FileName = FileName & "SP"
  4436. elseif ThisChar = "/" then
  4437. FileName = FileName & "SL"
  4438. elseif ThisChar = "," then
  4439. FileName = FileName & "CM"
  4440. else
  4441. FileName = FileName & ThisChar
  4442. End If
  4443. GetOptChar = FileName
  4444. End Function
  4445.  
  4446. dim LineLengths(22) ' maximum number of lines
  4447. Sub SetOptLine(LineNo, String)
  4448. Dim DispLen
  4449. Dim StrLen
  4450. dim xfor
  4451. dim Letter
  4452. dim ThisDigit
  4453. dim ThisChar
  4454. dim LetterLine
  4455. dim Index
  4456. dim LetterName
  4457. StrLen = len(string)
  4458. Index = 1
  4459.  
  4460. StrLen = len(String)
  4461. DispLen = StrLen
  4462. if (DispLen < LineLengths(LineNo)) Then
  4463. DispLen = LineLengths(LineNo)
  4464. end If
  4465.  
  4466. for xfor = StartingArray(LineNo) to StartingArray(LineNo) + DispLen
  4467. Eval("Option"&xfor).image = GetOptChar(string, Index)
  4468. Index = Index + 1
  4469. next
  4470. LineLengths(LineNo) = StrLen
  4471.  
  4472. End Sub
  4473.  
  4474.  
  4475.  
  4476.  
  4477. '******************************************************
  4478. ' Flippers Polarity (Select appropriate sub based on era)
  4479. '******************************************************
  4480.  
  4481. dim LF : Set LF = New FlipperPolarity
  4482. dim RF : Set RF = New FlipperPolarity
  4483.  
  4484. InitPolarity
  4485.  
  4486.  
  4487. '*******************************************
  4488. ' Late 70's to early 80's
  4489.  
  4490. Sub InitPolarity()
  4491. dim x, a : a = Array(LF, RF)
  4492. for each x in a
  4493. x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
  4494. x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
  4495. x.enabled = True
  4496. x.TimeDelay = 80
  4497. Next
  4498.  
  4499. AddPt "Polarity", 0, 0, 0
  4500. AddPt "Polarity", 1, 0.05, -2.7
  4501. AddPt "Polarity", 2, 0.33, -2.7
  4502. AddPt "Polarity", 3, 0.37, -2.7
  4503. AddPt "Polarity", 4, 0.41, -2.7
  4504. AddPt "Polarity", 5, 0.45, -2.7
  4505. AddPt "Polarity", 6, 0.576,-2.7
  4506. AddPt "Polarity", 7, 0.66, -1.8
  4507. AddPt "Polarity", 8, 0.743, -0.5
  4508. AddPt "Polarity", 9, 0.81, -0.5
  4509. AddPt "Polarity", 10, 0.88, 0
  4510.  
  4511. addpt "Velocity", 0, 0, 1
  4512. addpt "Velocity", 1, 0.16, 1.06
  4513. addpt "Velocity", 2, 0.41, 1.05
  4514. addpt "Velocity", 3, 0.53, 1'0.982
  4515. addpt "Velocity", 4, 0.702, 0.968
  4516. addpt "Velocity", 5, 0.95, 0.968
  4517. addpt "Velocity", 6, 1.03, 0.945
  4518.  
  4519. LF.Object = LeftFlipper
  4520. LF.EndPoint = EndPointLp
  4521. RF.Object = RightFlipper
  4522. RF.EndPoint = EndPointRp
  4523. End Sub
  4524.  
  4525.  
  4526.  
  4527. ' Flipper trigger hit subs
  4528. Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
  4529. Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
  4530. Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
  4531. Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
  4532.  
  4533.  
  4534.  
  4535.  
  4536. '******************************************************
  4537. ' FLIPPER CORRECTION FUNCTIONS
  4538. '******************************************************
  4539.  
  4540. Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
  4541. dim a : a = Array(LF, RF)
  4542. dim x : for each x in a
  4543. x.addpoint aStr, idx, aX, aY
  4544. Next
  4545. End Sub
  4546.  
  4547. Class FlipperPolarity
  4548. Public DebugOn, Enabled
  4549. Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
  4550. Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
  4551. private Flipper, FlipperStart,FlipperEnd, FlipperEndY, LR, PartialFlipCoef
  4552. Private Balls(20), balldata(20)
  4553.  
  4554. dim PolarityIn, PolarityOut
  4555. dim VelocityIn, VelocityOut
  4556. dim YcoefIn, YcoefOut
  4557. Public Sub Class_Initialize
  4558. redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
  4559. Enabled = True : TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new SpoofBall : next
  4560. End Sub
  4561.  
  4562. Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
  4563. Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
  4564. Public Property Get StartPoint : StartPoint = FlipperStart : End Property
  4565. Public Property Let EndPoint(aInput) : FlipperEnd = aInput.x: FlipperEndY = aInput.y: End Property
  4566. Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
  4567. Public Property Get EndPointY: EndPointY = FlipperEndY : End Property
  4568.  
  4569. Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
  4570. Select Case aChooseArray
  4571. case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
  4572. Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
  4573. Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
  4574. End Select
  4575. if gametime > 100 then Report aChooseArray
  4576. End Sub
  4577.  
  4578. Public Sub Report(aChooseArray) 'debug, reports all coords in tbPL.text
  4579. if not DebugOn then exit sub
  4580. dim a1, a2 : Select Case aChooseArray
  4581. case "Polarity" : a1 = PolarityIn : a2 = PolarityOut
  4582. Case "Velocity" : a1 = VelocityIn : a2 = VelocityOut
  4583. Case "Ycoef" : a1 = YcoefIn : a2 = YcoefOut
  4584. case else :tbpl.text = "wrong string" : exit sub
  4585. End Select
  4586. dim str, x : for x = 0 to uBound(a1) : str = str & aChooseArray & " x: " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
  4587. tbpl.text = str
  4588. End Sub
  4589.  
  4590. 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
  4591.  
  4592. Private Sub RemoveBall(aBall)
  4593. dim x : for x = 0 to uBound(balls)
  4594. if TypeName(balls(x) ) = "IBall" then
  4595. if aBall.ID = Balls(x).ID Then
  4596. balls(x) = Empty
  4597. Balldata(x).Reset
  4598. End If
  4599. End If
  4600. Next
  4601. End Sub
  4602.  
  4603. Public Sub Fire()
  4604. Flipper.RotateToEnd
  4605. processballs
  4606. End Sub
  4607.  
  4608. Public Property Get Pos 'returns % position a ball. For debug stuff.
  4609. dim x : for x = 0 to uBound(balls)
  4610. if not IsEmpty(balls(x) ) then
  4611. pos = pSlope(Balls(x).x, FlipperStart, 0, FlipperEnd, 1)
  4612. End If
  4613. Next
  4614. End Property
  4615.  
  4616. Public Sub ProcessBalls() 'save data of balls in flipper range
  4617. FlipAt = GameTime
  4618. dim x : for x = 0 to uBound(balls)
  4619. if not IsEmpty(balls(x) ) then
  4620. balldata(x).Data = balls(x)
  4621. End If
  4622. Next
  4623. PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle))
  4624. PartialFlipCoef = abs(PartialFlipCoef-1)
  4625. End Sub
  4626. Private Function FlipperOn() : if gameTime < FlipAt+TimeDelay then FlipperOn = True : End If : End Function 'Timer shutoff for polaritycorrect
  4627.  
  4628. Public Sub PolarityCorrect(aBall)
  4629. if FlipperOn() then
  4630. dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
  4631.  
  4632. 'y safety Exit
  4633. if aBall.VelY > -8 then 'ball going down
  4634. RemoveBall aBall
  4635. exit Sub
  4636. end if
  4637.  
  4638. 'Find balldata. BallPos = % on Flipper
  4639. for x = 0 to uBound(Balls)
  4640. if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
  4641. idx = x
  4642. BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
  4643. if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  4644. end if
  4645. Next
  4646.  
  4647. If BallPos = 0 Then 'no ball data meaning the ball is entering and exiting pretty close to the same position, use current values.
  4648. BallPos = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
  4649. if ballpos > 0.65 then Ycoef = LinearEnvelope(aBall.Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  4650. End If
  4651.  
  4652. 'Velocity correction
  4653. if not IsEmpty(VelocityIn(0) ) then
  4654. Dim VelCoef
  4655. VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
  4656.  
  4657. if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
  4658.  
  4659. if Enabled then aBall.Velx = aBall.Velx*VelCoef
  4660. if Enabled then aBall.Vely = aBall.Vely*VelCoef
  4661. End If
  4662.  
  4663. 'Polarity Correction (optional now)
  4664. if not IsEmpty(PolarityIn(0) ) then
  4665. If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
  4666. dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
  4667.  
  4668. if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
  4669. End If
  4670. End If
  4671. RemoveBall aBall
  4672. End Sub
  4673. End Class
  4674.  
  4675. '******************************************************
  4676. ' FLIPPER POLARITY AND RUBBER DAMPENER SUPPORTING FUNCTIONS
  4677. '******************************************************
  4678.  
  4679. ' Used for flipper correction and rubber dampeners
  4680. Sub ShuffleArray(ByRef aArray, byVal offset) 'shuffle 1d array
  4681. dim x, aCount : aCount = 0
  4682. redim a(uBound(aArray) )
  4683. for x = 0 to uBound(aArray) 'Shuffle objects in a temp array
  4684. if not IsEmpty(aArray(x) ) Then
  4685. if IsObject(aArray(x)) then
  4686. Set a(aCount) = aArray(x)
  4687. Else
  4688. a(aCount) = aArray(x)
  4689. End If
  4690. aCount = aCount + 1
  4691. End If
  4692. Next
  4693. if offset < 0 then offset = 0
  4694. redim aArray(aCount-1+offset) 'Resize original array
  4695. for x = 0 to aCount-1 'set objects back into original array
  4696. if IsObject(a(x)) then
  4697. Set aArray(x) = a(x)
  4698. Else
  4699. aArray(x) = a(x)
  4700. End If
  4701. Next
  4702. End Sub
  4703.  
  4704. ' Used for flipper correction and rubber dampeners
  4705. Sub ShuffleArrays(aArray1, aArray2, offset)
  4706. ShuffleArray aArray1, offset
  4707. ShuffleArray aArray2, offset
  4708. End Sub
  4709.  
  4710. ' Used for flipper correction, rubber dampeners, and drop targets
  4711. Function BallSpeed(ball) 'Calculates the ball speed
  4712. BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
  4713. End Function
  4714.  
  4715. ' Used for flipper correction and rubber dampeners
  4716. Function PSlope(Input, X1, Y1, X2, Y2) 'Set up line via two points, no clamping. Input X, output Y
  4717. dim x, y, b, m : x = input : m = (Y2 - Y1) / (X2 - X1) : b = Y2 - m*X2
  4718. Y = M*x+b
  4719. PSlope = Y
  4720. End Function
  4721.  
  4722. ' Used for flipper correction
  4723. Class spoofball
  4724. Public X, Y, Z, VelX, VelY, VelZ, ID, Mass, Radius
  4725. Public Property Let Data(aBall)
  4726. With aBall
  4727. x = .x : y = .y : z = .z : velx = .velx : vely = .vely : velz = .velz
  4728. id = .ID : mass = .mass : radius = .radius
  4729. end with
  4730. End Property
  4731. Public Sub Reset()
  4732. x = Empty : y = Empty : z = Empty : velx = Empty : vely = Empty : velz = Empty
  4733. id = Empty : mass = Empty : radius = Empty
  4734. End Sub
  4735. End Class
  4736.  
  4737. ' Used for flipper correction and rubber dampeners
  4738. Function LinearEnvelope(xInput, xKeyFrame, yLvl)
  4739. dim y 'Y output
  4740. dim L 'Line
  4741. dim ii : for ii = 1 to uBound(xKeyFrame) 'find active line
  4742. if xInput <= xKeyFrame(ii) then L = ii : exit for : end if
  4743. Next
  4744. if xInput > xKeyFrame(uBound(xKeyFrame) ) then L = uBound(xKeyFrame) 'catch line overrun
  4745. Y = pSlope(xInput, xKeyFrame(L-1), yLvl(L-1), xKeyFrame(L), yLvl(L) )
  4746.  
  4747. if xInput <= xKeyFrame(lBound(xKeyFrame) ) then Y = yLvl(lBound(xKeyFrame) ) 'Clamp lower
  4748. if xInput >= xKeyFrame(uBound(xKeyFrame) ) then Y = yLvl(uBound(xKeyFrame) ) 'Clamp upper
  4749.  
  4750. LinearEnvelope = Y
  4751. End Function
  4752.  
  4753.  
  4754. '******************************************************
  4755. ' FLIPPER TRICKS
  4756. '******************************************************
  4757.  
  4758. RightFlipper.timerinterval=1
  4759. Rightflipper.timerenabled=True
  4760.  
  4761. sub RightFlipper_timer()
  4762. FlipperTricks LeftFlipper, LFPress, LFCount, LFEndAngle, LFState
  4763. FlipperTricks RightFlipper, RFPress, RFCount, RFEndAngle, RFState
  4764. FlipperNudge RightFlipper, RFEndAngle, RFEOSNudge, LeftFlipper, LFEndAngle
  4765. FlipperNudge LeftFlipper, LFEndAngle, LFEOSNudge, RightFlipper, RFEndAngle
  4766. end sub
  4767.  
  4768. Dim LFEOSNudge, RFEOSNudge
  4769.  
  4770. Sub FlipperNudge(Flipper1, Endangle1, EOSNudge1, Flipper2, EndAngle2)
  4771. Dim b, BOT
  4772. BOT = GetBalls
  4773.  
  4774. If Flipper1.currentangle = Endangle1 and EOSNudge1 <> 1 Then
  4775. EOSNudge1 = 1
  4776. 'debug.print Flipper1.currentangle &" = "& Endangle1 &"--"& Flipper2.currentangle &" = "& EndAngle2
  4777. If Flipper2.currentangle = EndAngle2 Then
  4778. For b = 0 to Ubound(BOT)
  4779. If FlipperTrigger(BOT(b).x, BOT(b).y, Flipper1) Then
  4780. 'Debug.Print "ball in flip1. exit"
  4781. exit Sub
  4782. end If
  4783. Next
  4784. For b = 0 to Ubound(BOT)
  4785. If FlipperTrigger(BOT(b).x, BOT(b).y, Flipper2) Then
  4786. BOT(b).velx = BOT(b).velx / 1.3
  4787. BOT(b).vely = BOT(b).vely - 0.5
  4788. end If
  4789. Next
  4790. End If
  4791. Else
  4792. If Flipper1.currentangle <> EndAngle1 then
  4793. EOSNudge1 = 0
  4794. end if
  4795. End If
  4796. End Sub
  4797.  
  4798. '*****************
  4799. ' Maths
  4800. '*****************
  4801. Dim PI: PI = 4*Atn(1)
  4802.  
  4803. Function dSin(degrees)
  4804. dsin = sin(degrees * Pi/180)
  4805. End Function
  4806.  
  4807. Function dCos(degrees)
  4808. dcos = cos(degrees * Pi/180)
  4809. End Function
  4810.  
  4811. Function Atn2(dy, dx)
  4812. If dx > 0 Then
  4813. Atn2 = Atn(dy / dx)
  4814. ElseIf dx < 0 Then
  4815. If dy = 0 Then
  4816. Atn2 = pi
  4817. Else
  4818. Atn2 = Sgn(dy) * (pi - Atn(Abs(dy / dx)))
  4819. end if
  4820. ElseIf dx = 0 Then
  4821. if dy = 0 Then
  4822. Atn2 = 0
  4823. else
  4824. Atn2 = Sgn(dy) * pi / 2
  4825. end if
  4826. End If
  4827. End Function
  4828.  
  4829. '*************************************************
  4830. ' Check ball distance from Flipper for Rem
  4831. '*************************************************
  4832.  
  4833. Function Distance(ax,ay,bx,by)
  4834. Distance = SQR((ax - bx)^2 + (ay - by)^2)
  4835. End Function
  4836.  
  4837. Function DistancePL(px,py,ax,ay,bx,by) ' Distance between a point and a line where point is px,py
  4838. DistancePL = ABS((by - ay)*px - (bx - ax) * py + bx*ay - by*ax)/Distance(ax,ay,bx,by)
  4839. End Function
  4840.  
  4841. Function Radians(Degrees)
  4842. Radians = Degrees * PI /180
  4843. End Function
  4844.  
  4845. Function AnglePP(ax,ay,bx,by)
  4846. AnglePP = Atn2((by - ay),(bx - ax))*180/PI
  4847. End Function
  4848.  
  4849. Function DistanceFromFlipper(ballx, bally, Flipper)
  4850. DistanceFromFlipper = DistancePL(ballx, bally, Flipper.x, Flipper.y, Cos(Radians(Flipper.currentangle+90))+Flipper.x, Sin(Radians(Flipper.currentangle+90))+Flipper.y)
  4851. End Function
  4852.  
  4853. Function FlipperTrigger(ballx, bally, Flipper)
  4854. Dim DiffAngle
  4855. DiffAngle = ABS(Flipper.currentangle - AnglePP(Flipper.x, Flipper.y, ballx, bally) - 90)
  4856. If DiffAngle > 180 Then DiffAngle = DiffAngle - 360
  4857.  
  4858. If DistanceFromFlipper(ballx,bally,Flipper) < 48 and DiffAngle <= 90 and Distance(ballx,bally,Flipper.x,Flipper.y) < Flipper.Length Then
  4859. FlipperTrigger = True
  4860. Else
  4861. FlipperTrigger = False
  4862. End If
  4863. End Function
  4864.  
  4865.  
  4866. '*************************************************
  4867. ' End - Check ball distance from Flipper for Rem
  4868. '*************************************************
  4869.  
  4870. dim LFPress, RFPress, LFCount, RFCount
  4871. dim LFState, RFState
  4872. dim EOST, EOSA,Frampup, FElasticity,FReturn
  4873. dim RFEndAngle, LFEndAngle
  4874.  
  4875. EOST = leftflipper.eostorque
  4876. EOSA = leftflipper.eostorqueangle
  4877. Frampup = LeftFlipper.rampup
  4878. FElasticity = LeftFlipper.elasticity
  4879. FReturn = LeftFlipper.return
  4880. 'Const EOSTnew = 1 'EM's to late 80's
  4881. Const EOSTnew = 0.8 '90's and later
  4882. Const EOSAnew = 1
  4883. Const EOSRampup = 0
  4884. Dim SOSRampup
  4885. Select Case FlipperCoilRampupMode
  4886. Case 0:
  4887. SOSRampup = 2.5
  4888. Case 1:
  4889. SOSRampup = 6
  4890. Case 2:
  4891. SOSRampup = 8.5
  4892. End Select
  4893.  
  4894. Const LiveCatch = 16
  4895. Const LiveElasticity = 0.45
  4896. Const SOSEM = 0.815
  4897. 'Const EOSReturn = 0.055 'EM's
  4898. 'Const EOSReturn = 0.045 'late 70's to mid 80's
  4899. Const EOSReturn = 0.035 'mid 80's to early 90's
  4900. 'Const EOSReturn = 0.025 'mid 90's and later
  4901.  
  4902. LFEndAngle = Leftflipper.endangle
  4903. RFEndAngle = RightFlipper.endangle
  4904.  
  4905. Sub FlipperActivate(Flipper, FlipperPress)
  4906. FlipperPress = 1
  4907. Flipper.Elasticity = FElasticity
  4908.  
  4909. Flipper.eostorque = EOST
  4910. Flipper.eostorqueangle = EOSA
  4911. End Sub
  4912.  
  4913. Sub FlipperDeactivate(Flipper, FlipperPress)
  4914. FlipperPress = 0
  4915. Flipper.eostorqueangle = EOSA
  4916. Flipper.eostorque = EOST*EOSReturn/FReturn
  4917.  
  4918.  
  4919. If Abs(Flipper.currentangle) <= Abs(Flipper.endangle) + 0.1 Then
  4920. Dim b, BOT
  4921. BOT = GetBalls
  4922.  
  4923. For b = 0 to UBound(BOT)
  4924. If Distance(BOT(b).x, BOT(b).y, Flipper.x, Flipper.y) < 55 Then 'check for cradle
  4925. If BOT(b).vely >= -0.4 Then BOT(b).vely = -0.4
  4926. End If
  4927. Next
  4928. End If
  4929. End Sub
  4930.  
  4931. Sub FlipperTricks (Flipper, FlipperPress, FCount, FEndAngle, FState)
  4932. Dim Dir
  4933. Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
  4934.  
  4935. If Abs(Flipper.currentangle) > Abs(Flipper.startangle) - 0.05 Then
  4936. If FState <> 1 Then
  4937. Flipper.rampup = SOSRampup
  4938. Flipper.endangle = FEndAngle - 3*Dir
  4939. Flipper.Elasticity = FElasticity * SOSEM
  4940. FCount = 0
  4941. FState = 1
  4942. End If
  4943. ElseIf Abs(Flipper.currentangle) <= Abs(Flipper.endangle) and FlipperPress = 1 then
  4944. if FCount = 0 Then FCount = GameTime
  4945.  
  4946. If FState <> 2 Then
  4947. Flipper.eostorqueangle = EOSAnew
  4948. Flipper.eostorque = EOSTnew
  4949. Flipper.rampup = EOSRampup
  4950. Flipper.endangle = FEndAngle
  4951. FState = 2
  4952. End If
  4953. Elseif Abs(Flipper.currentangle) > Abs(Flipper.endangle) + 0.01 and FlipperPress = 1 Then
  4954. If FState <> 3 Then
  4955. Flipper.eostorque = EOST
  4956. Flipper.eostorqueangle = EOSA
  4957. Flipper.rampup = Frampup
  4958. Flipper.Elasticity = FElasticity
  4959. FState = 3
  4960. End If
  4961.  
  4962. End If
  4963. End Sub
  4964.  
  4965. Const LiveDistanceMin = 30 'minimum distance in vp units from flipper base live catch dampening will occur
  4966. Const LiveDistanceMax = 114 'maximum distance in vp units from flipper base live catch dampening will occur (tip protection)
  4967.  
  4968. Sub CheckLiveCatch(ball, Flipper, FCount, parm) 'Experimental new live catch
  4969. Dim Dir
  4970. Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
  4971. Dim LiveCatchBounce 'If live catch is not perfect, it won't freeze ball totally
  4972. Dim CatchTime : CatchTime = GameTime - FCount
  4973.  
  4974. if CatchTime <= LiveCatch and parm > 6 and ABS(Flipper.x - ball.x) > LiveDistanceMin and ABS(Flipper.x - ball.x) < LiveDistanceMax Then
  4975. if CatchTime <= LiveCatch*0.5 Then 'Perfect catch only when catch time happens in the beginning of the window
  4976. LiveCatchBounce = 0
  4977. else
  4978. LiveCatchBounce = Abs((LiveCatch/2) - CatchTime) 'Partial catch when catch happens a bit late
  4979. end If
  4980.  
  4981. If LiveCatchBounce = 0 and ball.velx * Dir > 0 Then ball.velx = 0
  4982. ball.vely = LiveCatchBounce * (32 / LiveCatch) ' Multiplier for inaccuracy bounce
  4983. ball.angmomx= 0
  4984. ball.angmomy= 0
  4985. ball.angmomz= 0
  4986. End If
  4987. End Sub
  4988.  
  4989.  
  4990. '******************************************************
  4991. '**** END FLIPPER CORRECTIONS
  4992. '******************************************************
  4993.  
  4994. '
  4995. ''******************************************************
  4996. '' FLIPPER AND RUBBER CORRECTION
  4997. ''******************************************************
  4998. 'dim LFPress, RFPress, EOST, EOSA, EOSTnew, EOSaNew
  4999. 'dim FStrength, FRampUp, fElasticity, EOSRampUp, SOSRampUp
  5000. 'dim RFEndAngle, LFEndAngle, LFCount, RFCount, LiveCatch
  5001. '
  5002. 'LFEndAngle = Leftflipper.EndAngle
  5003. 'RFEndAngle = RightFlipper.EndAngle
  5004. '
  5005. 'EOST = leftflipper.eosTorque 'End of Swing Torque
  5006. 'EOSA = leftflipper.eosTorqueAngle 'End of Swing Torque Angle
  5007. 'fStrength = LeftFlipper.strength 'Flipper Strength
  5008. 'fRampUp = LeftFlipper.RampUp 'Flipper Ramp Up
  5009. 'fElasticity = LeftFlipper.elasticity 'Flipper Elasticity
  5010. 'EOStNew = 1.0 'new Flipper Torque
  5011. 'EOSaNew = 0.2 'new FLipper Tprque Angle
  5012. 'EOSRampUp = 1.5 'new EOS Ramp Up weaker at EOS because of the weaker holding coil
  5013. 'Select Case FlipperCoilRampupMode
  5014. ' Case 0:
  5015. ' SOSRampup = 2.5
  5016. ' Case 1:
  5017. ' SOSRampup = 6
  5018. ' Case 2:
  5019. ' SOSRampup = 8.5
  5020. 'End Select
  5021. 'LiveCatch = 8 'variable to check elapsed time from
  5022. '
  5023. ''********Need to have a flipper timer to check for these values
  5024. '
  5025. 'Sub flipperTimer_Timer
  5026. ' Dim BOT, b
  5027. ' BOT = GetBalls
  5028. '' For b = 0 to UBound(BOT)
  5029. '' BOT(0).color = vbgreen
  5030. '' If b > 0 then BOT(1).color = vbred
  5031. '' If b > 1 Then BOT(2).color = vbblue
  5032. '' tb.text = "x = " & BOT(0).x
  5033. '' tb1.text = "y = " & BOT(0).y
  5034. '' tb.text = formatnumber(BOT(b).AngMomY,1)
  5035. '' tb.text = "AngMomX = " & formatnumber(BOT(b).AngMomX,1)
  5036. '' tb1.text = "AngMomY = " & formatnumber(BOT(b).AngMomY,1)
  5037. '' tb2.text = "AngMMomZ = " & formatnumber(BOT(b).AngMomZ,1)
  5038. '
  5039. '' Next
  5040. '
  5041. '' lFlip.rotz = leftflipper.CurrentAngle -121 'silver metal flipper obj
  5042. '' lFlipR.rotz = leftflipper.CurrentAngle -121
  5043. '' rFlip.rotz = RightFlipper.CurrentAngle +121
  5044. '' rFlipR.rotz = RightFlipper.CurrentAngle +121
  5045. '
  5046. '
  5047. ' FlipperLSh.RotZ = LeftFlipper.CurrentAngle
  5048. ' FlipperRSh.RotZ = RightFlipper.CurrentAngle
  5049. '
  5050. '
  5051. '
  5052. ' '--------------Flipper Tricks Section
  5053. ' 'What this code does is swing the flipper fast and make the flipper soft near its EOS to enable live catches. It resets back to the base Table
  5054. ' 'settings once the flipper reaches the end of swing. The code also makes the flipper starting ramp up high to simulate the stronger starting
  5055. ' 'coil strength and weaker at its EOS to simulate the weaker hold coil.
  5056. '
  5057. ' If LeftFlipper.CurrentAngle = LeftFlipper.EndAngle and LFPress = 1 Then 'If the flipper is fully swung and the flipper button is pressed then...
  5058. ' LeftFlipper.eosTorqueAngle = EOSaNew 'sets flipper EOS Torque Angle to .2
  5059. ' LeftFlipper.eosTorque = EOStNew 'sets flipper EOS Torque to 1
  5060. ' LeftFlipper.RampUp = EOSRampUp 'sets flipper ramp up to 1.5
  5061. ' If LFCount = 0 Then LFCount = GameTime 'sets the variable LFCount = to the elapsed game time
  5062. ' If GameTime - LFCount < LiveCatch Then 'if less than 8ms have elasped then we are in a "Live Catch" scenario
  5063. ' LeftFlipper.Elasticity = 0.1 'sets flipper elasticity WAY DOWN to allow Live Catches
  5064. ' If LeftFlipper.EndAngle <> LFEndAngle Then LeftFlipper.EndAngle = LFEndAngle 'Keep the flipper at its EOS and don't let it deflect
  5065. ' Else
  5066. ' LeftFlipper.Elasticity = fElasticity 'reset flipper elasticity to the base table setting
  5067. ' End If
  5068. ' Elseif LeftFlipper.CurrentAngle > LeftFlipper.startangle - 0.05 Then 'If the flipper has started its swing, make it swing fast to nearly the end...
  5069. ' LeftFlipper.RampUp = SOSRampUp 'set flipper Ramp Up high
  5070. ' LeftFlipper.EndAngle = LFEndAngle - 3 'swing to within 3 degrees of EOS
  5071. ' LeftFlipper.Elasticity = fElasticity 'Set the elasticity to the base table elasticity
  5072. ' LFCount = 0
  5073. ' Elseif LeftFlipper.CurrentAngle > LeftFlipper.EndAngle + 0.01 Then 'If the flipper has swung past it's end of swing then...
  5074. ' LeftFlipper.eosTorque = EOST 'set the flipper EOS Torque back to the base table setting
  5075. ' LeftFlipper.eosTorqueAngle = EOSA 'set the flipper EOS Torque Angle back to the base table setting
  5076. ' LeftFlipper.RampUp = fRampUp 'set the flipper Ramp Up back to the base table setting
  5077. ' LeftFlipper.Elasticity = fElasticity 'set the flipper Elasticity back to the base table setting
  5078. ' End If
  5079. '
  5080. ' If RightFlipper.CurrentAngle = RightFlipper.EndAngle and RFPress = 1 Then
  5081. ' RightFlipper.eosTorqueAngle = EOSaNew
  5082. ' RightFlipper.eosTorque = EOStNew
  5083. ' RightFlipper.RampUp = EOSRampUp
  5084. ' If RFCount = 0 Then RFCount = GameTime
  5085. ' If GameTime - RFCount < LiveCatch Then
  5086. ' RightFlipper.Elasticity = 0.1
  5087. ' If RightFlipper.EndAngle <> RFEndAngle Then RightFlipper.EndAngle = RFEndAngle
  5088. ' Else
  5089. ' RightFlipper.Elasticity = fElasticity
  5090. ' End If
  5091. ' Elseif RightFlipper.CurrentAngle < RightFlipper.StartAngle + 0.05 Then
  5092. ' RightFlipper.RampUp = SOSRampUp
  5093. ' RightFlipper.EndAngle = RFEndAngle + 3
  5094. ' RightFlipper.Elasticity = fElasticity
  5095. ' RFCount = 0
  5096. ' Elseif RightFlipper.CurrentAngle < RightFlipper.EndAngle - 0.01 Then
  5097. ' RightFlipper.eosTorque = EOST
  5098. ' RightFlipper.eosTorqueAngle = EOSA
  5099. ' RightFlipper.RampUp = fRampUp
  5100. ' RightFlipper.Elasticity = fElasticity
  5101. ' End If
  5102. '
  5103. 'End Sub
  5104. '
  5105. 'dim LF : Set LF = New FlipperPolarity
  5106. 'dim RF : Set RF = New FlipperPolarity
  5107. '
  5108. '
  5109. 'InitPolarity
  5110. '
  5111. 'Sub InitPolarity()
  5112. ' dim x, a : a = Array(LF, RF)
  5113. ' for each x in a
  5114. ' 'safety coefficient (diminishes polarity correction only)
  5115. ' x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
  5116. ' x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
  5117. '
  5118. ' x.enabled = True
  5119. ' x.TimeDelay = 69 '*****Important, this variable is an offset for the speed that the ball travels down the table to determine if the flippers have been fired
  5120. ' 'This is needed because the corrections to ball trajectory should only applied if the flippers have been fired and the ball is in the trigger zones.
  5121. ' 'FlipAT is set to GameTime when the ball enters the flipper trigger zones and if GameTime is less than FlipAT + this time delay then changes to velocity
  5122. ' 'and trajectory are applied. If the flipper is fired before the ball enters the trigger zone then with this delay added to FlipAT the changes
  5123. ' 'to tragectory and velocity will not be applied. Also if the flipper is in the final 20 degrees changes to ball values will also not be applied.
  5124. ' '"Faster" tables will need a smaller value while "slower" tables will need a larger value to give the ball more time to get to the flipper.
  5125. ' 'If this value is not set high enough the Flipper Velocity and Polarity corrections will NEVER be applied.
  5126. ' Next
  5127. '
  5128. ' 'rf.report "Polarity"
  5129. ' AddPt "Polarity", 0, 0, -2.7
  5130. ' AddPt "Polarity", 1, 0.16, -2.7
  5131. ' AddPt "Polarity", 2, 0.33, -2.7
  5132. ' AddPt "Polarity", 3, 0.37, -2.7 '4.2
  5133. ' AddPt "Polarity", 4, 0.41, -2.7
  5134. ' AddPt "Polarity", 5, 0.45, -2.7 '4.2
  5135. ' AddPt "Polarity", 6, 0.576,-2.7
  5136. ' AddPt "Polarity", 7, 0.66, -1.8'-2.1896
  5137. ' AddPt "Polarity", 8, 0.743, -0.5
  5138. ' AddPt "Polarity", 9, 0.81, -0.5
  5139. ' AddPt "Polarity", 10, 0.88, 0
  5140. '
  5141. ' '"Velocity" Profile
  5142. ' addpt "Velocity", 0, 0, 1
  5143. ' addpt "Velocity", 1, 0.16, 1.06
  5144. ' addpt "Velocity", 2, 0.41, 1.05
  5145. ' addpt "Velocity", 3, 0.53, 1'0.982
  5146. ' addpt "Velocity", 4, 0.702, 0.968
  5147. ' addpt "Velocity", 5, 0.95, 0.968
  5148. ' addpt "Velocity", 6, 1.03, 0.945
  5149. '
  5150. ' LF.Object = LeftFlipper
  5151. ' LF.EndPoint = EndPointLp 'you can use just a coordinate, or an object with a .x property. Using a couple of simple primitive objects
  5152. ' RF.Object = RightFlipper
  5153. ' RF.EndPoint = EndPointRp
  5154. 'End Sub
  5155. '
  5156. 'Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
  5157. ' dim a : a = Array(LF, RF)
  5158. ' dim x : for each x in a
  5159. ' x.addpoint aStr, idx, aX, aY
  5160. ' Next
  5161. 'End Sub
  5162. '
  5163. '
  5164. 'Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
  5165. 'Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
  5166. 'Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
  5167. 'Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
  5168. '
  5169. ''Methods:
  5170. ''.TimeDelay - Delay before trigger shuts off automatically. Default = 80 (ms)
  5171. ''.AddPoint - "Polarity", "Velocity", "Ycoef" coordinate points. Use one of these 3 strings, keep coordinates sequential. x = %position on the flipper, y = output
  5172. ''.Object - set to flipper reference. Optional.
  5173. ''.StartPoint - set start point coord. Unnecessary, if .object is used.
  5174. '
  5175. ''Called with flipper -
  5176. ''ProcessBalls - catches ball data.
  5177. '' - OR -
  5178. ''.Fire - fires flipper.rotatetoend automatically + processballs. Requires .Object to be set to the flipper.
  5179. '
  5180. ''***************This is flipperPolarity's addPoint Sub
  5181. 'Class FlipperPolarity
  5182. ' Public Enabled
  5183. ' Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
  5184. ' Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
  5185. ' private Flipper, FlipperStart, FlipperEnd, LR, PartialFlipCoef
  5186. ' Private Balls(20), balldata(20)
  5187. '
  5188. ' dim PolarityIn, PolarityOut
  5189. ' dim VelocityIn, VelocityOut
  5190. ' dim YcoefIn, YcoefOut
  5191. '
  5192. ' Public Sub Class_Initialize
  5193. ' redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
  5194. ' Enabled = True: TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new spoofBall: next
  5195. ' End Sub
  5196. '
  5197. ' Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
  5198. ' Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
  5199. ' Public Property Get StartPoint : StartPoint = FlipperStart : End Property
  5200. ' Public Property Let EndPoint(aInput) : if IsObject(aInput) then FlipperEnd = aInput.x else FlipperEnd = aInput : end if : End Property
  5201. ' Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
  5202. '
  5203. ' Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
  5204. ' Select Case aChooseArray
  5205. ' case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
  5206. ' Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
  5207. ' Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
  5208. ' End Select
  5209. '
  5210. ' End Sub
  5211. '
  5212. ''********Triggered by a ball hitting the flipper trigger area
  5213. ' Public Sub AddBall(aBall) : dim x :
  5214. ' for x = 0 to uBound(balls)
  5215. ' if IsEmpty(balls(x)) then set balls(x) = aBall : exit sub :end if
  5216. ' Next
  5217. ' End Sub
  5218. '
  5219. ' Private Sub RemoveBall(aBall)
  5220. ' dim x : for x = 0 to uBound(balls)
  5221. ' if TypeName(balls(x) ) = "IBall" then
  5222. ' if aBall.ID = Balls(x).ID Then
  5223. ' balls(x) = Empty
  5224. ' Balldata(x).Reset
  5225. ' End If
  5226. ' End If
  5227. ' Next
  5228. ' End Sub
  5229. '
  5230. ''*********Used to rotate flipper since this is removed from the key down for the flippers
  5231. ' Public Sub Fire()
  5232. ' Flipper.RotateToEnd
  5233. ' processballs
  5234. ' End Sub
  5235. '
  5236. ' Public Sub ProcessBalls() 'save data of balls in flipper range
  5237. ' FlipAt = GameTime
  5238. ' dim x : for x = 0 to uBound(balls)
  5239. ' if not IsEmpty(balls(x) ) then balldata(x).Data = balls(x)
  5240. ' Next
  5241. ' PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle)) '% of flipper swing
  5242. ' PartialFlipCoef = abs(PartialFlipCoef-1)
  5243. ' if abs(Flipper.CurrentAngle - Flipper.EndAngle) < 20 Then 'last 20 degrees of swing is not dealt with
  5244. ' PartialFlipCoef = 0
  5245. ' End If
  5246. '' tb.text = FlipAT
  5247. ' End Sub
  5248. '
  5249. ''***********gameTime is a global variable of how long the game has progressed in ms
  5250. ''***********This function lets the table know if the flipper has been fired
  5251. ' Private Function FlipperOn()
  5252. '' TB.text = gameTime & ":" & (FlipAT + TimeDelay) ' ******MOVE TB into view WHEN THIS FLIPPER FUNCTIONALITY IS ADDED TO A NEW TABLE TO CHECK IF THE TIME DELAY IS LONG ENOUGH*****
  5253. ' if gameTime < FlipAt + TimeDelay then FlipperOn = True
  5254. ' End Function 'Timer shutoff for polaritycorrect
  5255. '
  5256. ''***********This is turned on when a ball leaves the flipper trigger area
  5257. ' Public Sub PolarityCorrect(aBall)
  5258. ' if FlipperOn() then 'don't run this if the flippers are at rest
  5259. ' dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
  5260. ' dim teststr : teststr = "Cutoff"
  5261. ' tmp = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
  5262. ' if tmp < 0.1 then 'if real ball position is behind flipper, exit Sub to prevent stucks 'Disabled 1.03, I think it's the Mesh that's causing stucks, not this
  5263. ' end if
  5264. '
  5265. ' 'y safety Exit
  5266. ' if aBall.VelY > -8 then 'if ball going down then remove the ball
  5267. ' RemoveBall aBall
  5268. ' exit Sub
  5269. ' end if
  5270. ' 'Find balldata. BallPos = % on Flipper
  5271. ' for x = 0 to uBound(Balls)
  5272. ' if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
  5273. ' idx = x
  5274. ' BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
  5275. ' if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  5276. ' end if
  5277. ' Next
  5278. '
  5279. ' 'Velocity correction
  5280. ' if not IsEmpty(VelocityIn(0) ) then
  5281. '' tb.text = "Vel corr"
  5282. ' Dim VelCoef
  5283. ' if IsEmpty(BallData(idx).id) and aBall.VelY < -12 then 'if tip hit with no collected data, do vel correction anyway
  5284. ' if PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1) > 1.1 then 'adjust plz
  5285. ' VelCoef = LinearEnvelope(5, VelocityIn, VelocityOut)
  5286. ' if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
  5287. ' if Enabled then aBall.Velx = aBall.Velx*VelCoef'VelCoef
  5288. ' if Enabled then aBall.Vely = aBall.Vely*VelCoef'VelCoef
  5289. ' end if
  5290. ' Else
  5291. ' : VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
  5292. ' if Enabled then aBall.Velx = aBall.Velx*VelCoef
  5293. ' if Enabled then aBall.Vely = aBall.Vely*VelCoef
  5294. ' end if
  5295. ' End If
  5296. '
  5297. ' 'Polarity Correction (optional now)
  5298. ' if not IsEmpty(PolarityIn(0) ) then
  5299. ' If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
  5300. ' dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
  5301. ' if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
  5302. ' End If
  5303. ' End If
  5304. ' RemoveBall aBall
  5305. ' End Sub
  5306. 'End Class
  5307. '
  5308. ''================================
  5309. ''Helper Functions
  5310. '
  5311. '
  5312. 'Sub ShuffleArray(ByRef aArray, byVal offset) 'shuffle 1d array
  5313. ' dim x, aCount : aCount = 0
  5314. ' redim a(uBound(aArray) )
  5315. ' for x = 0 to uBound(aArray) 'Shuffle objects in a temp array
  5316. ' if not IsEmpty(aArray(x) ) Then
  5317. ' if IsObject(aArray(x)) then
  5318. ' Set a(aCount) = aArray(x) 'Set creates an object in VB
  5319. ' Else
  5320. ' a(aCount) = aArray(x)
  5321. ' End If
  5322. ' aCount = aCount + 1
  5323. ' End If
  5324. ' Next
  5325. ' if offset < 0 then offset = 0
  5326. ' redim aArray(aCount-1+offset) 'Resize original array
  5327. ' for x = 0 to aCount-1 'set objects back into original array
  5328. ' if IsObject(a(x)) then
  5329. ' Set aArray(x) = a(x)
  5330. ' Else
  5331. ' aArray(x) = a(x)
  5332. ' End If
  5333. ' Next
  5334. 'End Sub
  5335. '
  5336. ''**********Takes in more than one array and passes them to ShuffleArray
  5337. 'Sub ShuffleArrays(aArray1, aArray2, offset)
  5338. ' ShuffleArray aArray1, offset
  5339. ' ShuffleArray aArray2, offset
  5340. 'End Sub
  5341. '
  5342. ''**********Calculate ball speed as hypotenuse of velX/velY triangle
  5343. 'Function BallSpeed(ball) 'Calculates the ball speed
  5344. ' BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
  5345. 'End Function
  5346. '
  5347. ''**********Calculates the value of Y for an input x using the slope intercept equation
  5348. 'Function PSlope(Input, X1, Y1, X2, Y2) 'Set up line via two points, no clamping. Input X, output Y
  5349. ' dim x, y, b, m : x = input : m = (Y2 - Y1) / (X2 - X1) : b = Y2 - m*X2
  5350. ' Y = M*x+b
  5351. ' PSlope = Y
  5352. 'End Function
  5353. '
  5354. 'Class spoofball
  5355. ' Public X, Y, Z, VelX, VelY, VelZ, ID, Mass, Radius
  5356. ' Public Property Let Data(aBall)
  5357. ' With aBall
  5358. ' x = .x : y = .y : z = .z : velx = .velx : vely = .vely : velz = .velz
  5359. ' id = .ID : mass = .mass : radius = .radius
  5360. ' end with
  5361. ' End Property
  5362. ' Public Sub Reset()
  5363. ' x = Empty : y = Empty : z = Empty : velx = Empty : vely = Empty : velz = Empty
  5364. ' id = Empty : mass = Empty : radius = Empty
  5365. ' End Sub
  5366. 'End Class
  5367.  
  5368. '****************************************************************************
  5369. 'PHYSICS DAMPENERS
  5370.  
  5371. 'These are data mined bounce curves,
  5372. 'dialed in with the in-game elasticity as much as possible to prevent angle / spin issues.
  5373. 'Requires tracking ballspeed to calculate COR
  5374.  
  5375.  
  5376. Sub dPosts_Hit(idx)
  5377. RubbersD.dampen Activeball
  5378. TargetBouncer Activeball, 1
  5379. End Sub
  5380.  
  5381. Sub dSleeves_Hit(idx)
  5382. SleevesD.Dampen Activeball
  5383. TargetBouncer Activeball, 0.7
  5384. End Sub
  5385.  
  5386. '*********This sets up the rubbers:
  5387. dim RubbersD
  5388. Set RubbersD = new Dampener 'Makes a Dampener Class Object
  5389. RubbersD.name = "Rubbers"
  5390.  
  5391. 'cor bounce curve (linear)
  5392. 'for best results, try to match in-game velocity as closely as possible to the desired curve
  5393. 'RubbersD.addpoint 0, 0, 0.935 'point# (keep sequential), ballspeed, CoR (elasticity)
  5394. RubbersD.addpoint 0, 0, 0.96 'point# (keep sequential), ballspeed, CoR (elasticity)
  5395. RubbersD.addpoint 1, 3.77, 0.96
  5396. RubbersD.addpoint 2, 5.76, 0.967 'dont take this as gospel. if you can data mine rubber elasticitiy, please help!
  5397. RubbersD.addpoint 3, 15.84, 0.874
  5398. RubbersD.addpoint 4, 56, 0.64 'there's clamping so interpolate up to 56 at least
  5399.  
  5400. dim SleevesD : Set SleevesD = new Dampener 'this is just rubber but cut down to 85%...
  5401. SleevesD.name = "Sleeves"
  5402. SleevesD.CopyCoef RubbersD, 0.85
  5403.  
  5404. '**********Class for dampener section of nfozzy's code
  5405. Class Dampener
  5406. Public Print, debugOn 'tbpOut.text
  5407. public name, Threshold 'Minimum threshold. Useful for Flippers, which don't have a hit threshold.
  5408. Public ModIn, ModOut
  5409. Private Sub Class_Initialize : redim ModIn(0) : redim Modout(0): End Sub
  5410.  
  5411. Public Sub AddPoint(aIdx, aX, aY)
  5412. ShuffleArrays ModIn, ModOut, 1 : ModIn(aIDX) = aX : ModOut(aIDX) = aY : ShuffleArrays ModIn, ModOut, 0
  5413. End Sub
  5414.  
  5415. public sub Dampen(aBall)
  5416. if threshold then if BallSpeed(aBall) < threshold then exit sub end if end if
  5417. dim RealCOR, DesiredCOR, str, coef
  5418. ' Uses the LinearEnvelope function to calculate the correction based upon where it's value sits in relation
  5419.  
  5420. ' to the addpoint parameters set above. Basically interpolates values between set points in a linear fashion
  5421. DesiredCor = LinearEnvelope(cor.ballvel(aBall.id), ModIn, ModOut )
  5422.  
  5423. ' Uses the function BallSpeed's value at the point of impact/the active ball's velocity which is constantly being updated
  5424. ' RealCor is always less than 1
  5425. RealCOR = BallSpeed(aBall) / cor.ballvel(aBall.id)
  5426.  
  5427. ' Divides the desired CoR by the real COR to make a multiplier to correct velocity in x and y
  5428. coef = desiredcor / realcor
  5429.  
  5430. ' TB.text = coef
  5431.  
  5432. ' Applies the coef to x and y velocities
  5433. aBall.velx = aBall.velx * coef : aBall.vely = aBall.vely * coef
  5434. End Sub
  5435.  
  5436. '***********This Sub sets the values for Sleeves (or any other future objects) to 85% (or whatever is passed in) of Posts
  5437. Public Sub CopyCoef(aObj, aCoef) 'alternative addpoints, copy with coef
  5438. dim x : for x = 0 to uBound(aObj.ModIn)
  5439. addpoint x, aObj.ModIn(x), aObj.ModOut(x)*aCoef
  5440. Next
  5441. End Sub
  5442. End Class
  5443.  
  5444. '*****************************Generates cor.ballVel for dampener
  5445. Sub RDampen_Timer() ' 1 ms timer always on
  5446. CoR.Update
  5447. End Sub
  5448.  
  5449. '*********CoR is Coefficient of Restitution defined as "how much of the kinetic energy remains for the objects
  5450. 'to rebound from one another vs. how much is lost as heat, or work done deforming the objects
  5451. dim cor : set cor = New CoRTracker
  5452.  
  5453. Class CoRTracker
  5454. public ballvel, ballvelx, ballvely
  5455.  
  5456. Private Sub Class_Initialize : redim ballvel(0) : redim ballvelx(0): redim ballvely(0) : End Sub
  5457.  
  5458. Public Sub Update() 'tracks in-ball-velocity
  5459. dim str, b, AllBalls, highestID : allBalls = getballs
  5460.  
  5461. for each b in allballs
  5462. if b.id >= HighestID then highestID = b.id
  5463. Next
  5464.  
  5465. if uBound(ballvel) < highestID then redim ballvel(highestID) 'set bounds
  5466. if uBound(ballvelx) < highestID then redim ballvelx(highestID) 'set bounds
  5467. if uBound(ballvely) < highestID then redim ballvely(highestID) 'set bounds
  5468.  
  5469. for each b in allballs
  5470. ballvel(b.id) = BallSpeed(b)
  5471. ballvelx(b.id) = b.velx
  5472. ballvely(b.id) = b.vely
  5473. Next
  5474. End Sub
  5475. End Class
  5476.  
  5477. '*** Determines if a Points (px,py) is inside a 4 point polygon A-D in Clockwise/CCW order
  5478. Function InRect(px,py,ax,ay,bx,by,cx,cy,dx,dy)
  5479. Dim AB, BC, CD, DA
  5480. AB = (bx*py) - (by*px) - (ax*py) + (ay*px) + (ax*by) - (ay*bx)
  5481. BC = (cx*py) - (cy*px) - (bx*py) + (by*px) + (bx*cy) - (by*cx)
  5482. CD = (dx*py) - (dy*px) - (cx*py) + (cy*px) + (cx*dy) - (cy*dx)
  5483. DA = (ax*py) - (ay*px) - (dx*py) + (dy*px) + (dx*ay) - (dy*ax)
  5484.  
  5485. If (AB <= 0 AND BC <=0 AND CD <= 0 AND DA <= 0) Or (AB >= 0 AND BC >=0 AND CD >= 0 AND DA >= 0) Then
  5486. InRect = True
  5487. Else
  5488. InRect = False
  5489. End If
  5490. End Function
  5491.  
  5492. '********Interpolates the value for areas between the low and upper bounds sent to it
  5493. Function LinearEnvelope(xInput, xKeyFrame, yLvl)
  5494. dim y 'Y output
  5495. dim L 'Line
  5496. dim ii : for ii = 1 to uBound(xKeyFrame) 'find active line
  5497. if xInput <= xKeyFrame(ii) then L = ii : exit for : end if
  5498. Next
  5499. if xInput > xKeyFrame(uBound(xKeyFrame) ) then L = uBound(xKeyFrame) 'catch line overrun
  5500. Y = pSlope(xInput, xKeyFrame(L-1), yLvl(L-1), xKeyFrame(L), yLvl(L) )
  5501.  
  5502. 'clamp 2.0
  5503. if xInput <= xKeyFrame(lBound(xKeyFrame) ) then Y = yLvl(lBound(xKeyFrame) ) 'Clamp lower
  5504. if xInput >= xKeyFrame(uBound(xKeyFrame) ) then Y = yLvl(uBound(xKeyFrame) ) 'Clamp upper
  5505.  
  5506. LinearEnvelope = Y
  5507. End Function
  5508.  
  5509.  
  5510.  
  5511. '******************************************************
  5512. '**** FLEEP MECHANICAL SOUNDS
  5513. '******************************************************
  5514.  
  5515. '/////////////////////////////// SOUNDS PARAMETERS //////////////////////////////
  5516. Dim GlobalSoundLevel, CoinSoundLevel, PlungerReleaseSoundLevel, PlungerPullSoundLevel, NudgeLeftSoundLevel
  5517. Dim NudgeRightSoundLevel, NudgeCenterSoundLevel, StartButtonSoundLevel, RollingSoundFactor
  5518.  
  5519. CoinSoundLevel = 1 'volume level; range [0, 1]
  5520. NudgeLeftSoundLevel = 1 'volume level; range [0, 1]
  5521. NudgeRightSoundLevel = 1 'volume level; range [0, 1]
  5522. NudgeCenterSoundLevel = 1 'volume level; range [0, 1]
  5523. StartButtonSoundLevel = 0.1 'volume level; range [0, 1]
  5524. PlungerReleaseSoundLevel = 0.8 '1 wjr 'volume level; range [0, 1]
  5525. PlungerPullSoundLevel = 1 'volume level; range [0, 1]
  5526. RollingSoundFactor = 1.1/5
  5527.  
  5528. '///////////////////////-----Solenoids, Kickers and Flash Relays-----///////////////////////
  5529. Dim FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel, FlipperUpAttackLeftSoundLevel, FlipperUpAttackRightSoundLevel
  5530. Dim FlipperUpSoundLevel, FlipperDownSoundLevel, FlipperLeftHitParm, FlipperRightHitParm
  5531. Dim SlingshotSoundLevel, BumperSoundFactor, KnockerSoundLevel
  5532.  
  5533. FlipperUpAttackMinimumSoundLevel = 0.010 'volume level; range [0, 1]
  5534. FlipperUpAttackMaximumSoundLevel = 0.635 'volume level; range [0, 1]
  5535. FlipperUpSoundLevel = 1.0 'volume level; range [0, 1]
  5536. FlipperDownSoundLevel = 0.45 'volume level; range [0, 1]
  5537. FlipperLeftHitParm = FlipperUpSoundLevel 'sound helper; not configurable
  5538. FlipperRightHitParm = FlipperUpSoundLevel 'sound helper; not configurable
  5539. SlingshotSoundLevel = 0.95 'volume level; range [0, 1]
  5540. BumperSoundFactor = 4.25 'volume multiplier; must not be zero
  5541. KnockerSoundLevel = 1 'volume level; range [0, 1]
  5542.  
  5543. '///////////////////////-----Ball Drops, Bumps and Collisions-----///////////////////////
  5544. Dim RubberStrongSoundFactor, RubberWeakSoundFactor, RubberFlipperSoundFactor,BallWithBallCollisionSoundFactor
  5545. Dim BallBouncePlayfieldSoftFactor, BallBouncePlayfieldHardFactor, PlasticRampDropToPlayfieldSoundLevel, WireRampDropToPlayfieldSoundLevel, DelayedBallDropOnPlayfieldSoundLevel
  5546. Dim WallImpactSoundFactor, MetalImpactSoundFactor, SubwaySoundLevel, SubwayEntrySoundLevel, ScoopEntrySoundLevel
  5547. Dim SaucerLockSoundLevel, SaucerKickSoundLevel
  5548.  
  5549. BallWithBallCollisionSoundFactor = 3.2 'volume multiplier; must not be zero
  5550. RubberStrongSoundFactor = 0.055/5 'volume multiplier; must not be zero
  5551. RubberWeakSoundFactor = 0.075/5 'volume multiplier; must not be zero
  5552. RubberFlipperSoundFactor = 0.075/5 'volume multiplier; must not be zero
  5553. BallBouncePlayfieldSoftFactor = 0.025 'volume multiplier; must not be zero
  5554. BallBouncePlayfieldHardFactor = 0.025 'volume multiplier; must not be zero
  5555. DelayedBallDropOnPlayfieldSoundLevel = 0.8 'volume level; range [0, 1]
  5556. WallImpactSoundFactor = 0.075 'volume multiplier; must not be zero
  5557. MetalImpactSoundFactor = 0.075/3
  5558. SaucerLockSoundLevel = 0.8
  5559. SaucerKickSoundLevel = 0.8
  5560.  
  5561. '///////////////////////-----Gates, Spinners, Rollovers and Targets-----///////////////////////
  5562.  
  5563. Dim GateSoundLevel, TargetSoundFactor, SpinnerSoundLevel, RolloverSoundLevel, DTSoundLevel
  5564.  
  5565. GateSoundLevel = 0.5/5 'volume level; range [0, 1]
  5566. TargetSoundFactor = 0.0025 * 10 'volume multiplier; must not be zero
  5567. DTSoundLevel = 0.25 'volume multiplier; must not be zero
  5568. RolloverSoundLevel = 0.25 'volume level; range [0, 1]
  5569. SpinnerSoundLevel = 0.5 'volume level; range [0, 1]
  5570.  
  5571. '///////////////////////-----Ball Release, Guides and Drain-----///////////////////////
  5572. Dim DrainSoundLevel, BallReleaseSoundLevel, BottomArchBallGuideSoundFactor, FlipperBallGuideSoundFactor
  5573.  
  5574. DrainSoundLevel = 0.8 'volume level; range [0, 1]
  5575. BallReleaseSoundLevel = 1 'volume level; range [0, 1]
  5576. BottomArchBallGuideSoundFactor = 0.2 'volume multiplier; must not be zero
  5577. FlipperBallGuideSoundFactor = 0.015 'volume multiplier; must not be zero
  5578.  
  5579. '///////////////////////-----Loops and Lanes-----///////////////////////
  5580. Dim ArchSoundFactor
  5581. ArchSoundFactor = 0.025/5 'volume multiplier; must not be zero
  5582.  
  5583.  
  5584. '///////////////////////////// SOUND PLAYBACK FUNCTIONS ////////////////////////////
  5585. '///////////////////////////// POSITIONAL SOUND PLAYBACK METHODS ////////////////////////////
  5586. ' Positional sound playback methods will play a sound, depending on the X,Y position of the table element or depending on ActiveBall object position
  5587. ' These are similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  5588. ' For surround setup - positional sound playback functions will fade between front and rear surround channels and pan between left and right channels
  5589. ' For stereo setup - positional sound playback functions will only pan between left and right channels
  5590. ' For mono setup - positional sound playback functions will not pan between left and right channels and will not fade between front and rear channels
  5591.  
  5592. ' PlaySound full syntax - PlaySound(string, int loopcount, float volume, float pan, float randompitch, int pitch, bool useexisting, bool restart, float front_rear_fade)
  5593. ' Note - These functions will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  5594. Sub PlaySoundAtLevelStatic(playsoundparams, aVol, tableobj)
  5595. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 0, 0, AudioFade(tableobj)
  5596. End Sub
  5597.  
  5598. Sub PlaySoundAtLevelExistingStatic(playsoundparams, aVol, tableobj)
  5599. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 1, 0, AudioFade(tableobj)
  5600. End Sub
  5601.  
  5602. Sub PlaySoundAtLevelStaticLoop(playsoundparams, aVol, tableobj)
  5603. PlaySound playsoundparams, -1, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 0, 0, AudioFade(tableobj)
  5604. End Sub
  5605.  
  5606. Sub PlaySoundAtLevelStaticRandomPitch(playsoundparams, aVol, randomPitch, tableobj)
  5607. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), randomPitch, 0, 0, 0, AudioFade(tableobj)
  5608. End Sub
  5609.  
  5610. Sub PlaySoundAtLevelActiveBall(playsoundparams, aVol)
  5611. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ActiveBall), 0, 0, 0, 0, AudioFade(ActiveBall)
  5612. End Sub
  5613.  
  5614. Sub PlaySoundAtLevelExistingActiveBall(playsoundparams, aVol)
  5615. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ActiveBall), 0, 0, 1, 0, AudioFade(ActiveBall)
  5616. End Sub
  5617.  
  5618. Sub PlaySoundAtLeveTimerActiveBall(playsoundparams, aVol, ballvariable)
  5619. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ballvariable), 0, 0, 0, 0, AudioFade(ballvariable)
  5620. End Sub
  5621.  
  5622. Sub PlaySoundAtLevelTimerExistingActiveBall(playsoundparams, aVol, ballvariable)
  5623. PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ballvariable), 0, 0, 1, 0, AudioFade(ballvariable)
  5624. End Sub
  5625.  
  5626. Sub PlaySoundAtLevelRoll(playsoundparams, aVol, pitch)
  5627. PlaySound playsoundparams, -1, aVol * VolumeDial, AudioPan(tableobj), randomPitch, 0, 0, 0, AudioFade(tableobj)
  5628. End Sub
  5629.  
  5630. ' Previous Positional Sound Subs
  5631.  
  5632. Sub PlaySoundAt(soundname, tableobj)
  5633. PlaySound soundname, 1, 1 * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  5634. End Sub
  5635.  
  5636. Sub PlaySoundAtVol(soundname, tableobj, aVol)
  5637. PlaySound soundname, 1, aVol * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  5638. End Sub
  5639.  
  5640. Sub PlaySoundAtBall(soundname)
  5641. PlaySoundAt soundname, ActiveBall
  5642. End Sub
  5643.  
  5644. Sub PlaySoundAtBallVol (Soundname, aVol)
  5645. Playsound soundname, 1,aVol * VolumeDial, AudioPan(ActiveBall), 0,0,0, 1, AudioFade(ActiveBall)
  5646. End Sub
  5647.  
  5648. Sub PlaySoundAtBallVolM (Soundname, aVol)
  5649. Playsound soundname, 1,aVol * VolumeDial, AudioPan(ActiveBall), 0,0,0, 0, AudioFade(ActiveBall)
  5650. End Sub
  5651.  
  5652. Sub PlaySoundAtVolLoops(sound, tableobj, Vol, Loops)
  5653. PlaySound sound, Loops, Vol * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  5654. End Sub
  5655.  
  5656.  
  5657. '******************************************************
  5658. ' Fleep Supporting Ball & Sound Functions
  5659. '******************************************************
  5660.  
  5661. 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
  5662. Dim tmp
  5663. tmp = tableobj.y * 2 / tableheight-1
  5664.  
  5665. if tmp > 7000 Then
  5666. tmp = 7000
  5667. elseif tmp < -7000 Then
  5668. tmp = -7000
  5669. end if
  5670.  
  5671. If tmp > 0 Then
  5672. AudioFade = Csng(tmp ^10)
  5673. Else
  5674. AudioFade = Csng(-((- tmp) ^10) )
  5675. End If
  5676. End Function
  5677.  
  5678. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  5679. Dim tmp
  5680. tmp = tableobj.x * 2 / tablewidth-1
  5681.  
  5682. if tmp > 7000 Then
  5683. tmp = 7000
  5684. elseif tmp < -7000 Then
  5685. tmp = -7000
  5686. end if
  5687.  
  5688. If tmp > 0 Then
  5689. AudioPan = Csng(tmp ^10)
  5690. Else
  5691. AudioPan = Csng(-((- tmp) ^10) )
  5692. End If
  5693. End Function
  5694.  
  5695. Function Vol(ball) ' Calculates the volume of the sound based on the ball speed
  5696. Vol = Csng(BallVel(ball) ^2)
  5697. End Function
  5698.  
  5699. Function Volz(ball) ' Calculates the volume of the sound based on the ball speed
  5700. Volz = Csng((ball.velz) ^2)
  5701. End Function
  5702.  
  5703. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  5704. Pitch = BallVel(ball) * 20
  5705. End Function
  5706.  
  5707. Function BallVel(ball) 'Calculates the ball speed
  5708. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  5709. End Function
  5710.  
  5711. Function VolPlayfieldRoll(ball) ' Calculates the roll volume of the sound based on the ball speed
  5712. VolPlayfieldRoll = RollingSoundFactor * 0.0005 * Csng(BallVel(ball) ^3)
  5713. End Function
  5714.  
  5715. Function PitchPlayfieldRoll(ball) ' Calculates the roll pitch of the sound based on the ball speed
  5716. PitchPlayfieldRoll = BallVel(ball) ^2 * 15
  5717. End Function
  5718.  
  5719. Function RndInt(min, max)
  5720. RndInt = Int(Rnd() * (max-min + 1) + min)' Sets a random number integer between min and max
  5721. End Function
  5722.  
  5723. Function RndNum(min, max)
  5724. RndNum = Rnd() * (max-min) + min' Sets a random number between min and max
  5725. End Function
  5726.  
  5727. '///////////////////////////// GENERAL SOUND SUBROUTINES ////////////////////////////
  5728. Sub SoundStartButton()
  5729. PlaySound ("Start_Button"), 0, StartButtonSoundLevel, 0, 0.25
  5730. End Sub
  5731.  
  5732. Sub SoundNudgeLeft()
  5733. PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeLeftSoundLevel * VolumeDial, -0.1, 0.25
  5734. End Sub
  5735.  
  5736. Sub SoundNudgeRight()
  5737. PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeRightSoundLevel * VolumeDial, 0.1, 0.25
  5738. End Sub
  5739.  
  5740. Sub SoundNudgeCenter()
  5741. PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeCenterSoundLevel * VolumeDial, 0, 0.25
  5742. End Sub
  5743.  
  5744.  
  5745. Sub SoundPlungerPull()
  5746. PlaySoundAtLevelStatic ("Plunger_Pull_1"), PlungerPullSoundLevel, Plunger
  5747. End Sub
  5748.  
  5749. Sub SoundPlungerReleaseBall()
  5750. PlaySoundAtLevelStatic ("Plunger_Release_Ball"), PlungerReleaseSoundLevel, Plunger
  5751. End Sub
  5752.  
  5753. Sub SoundPlungerReleaseNoBall()
  5754. PlaySoundAtLevelStatic ("Plunger_Release_No_Ball"), PlungerReleaseSoundLevel, Plunger
  5755. End Sub
  5756.  
  5757.  
  5758. '///////////////////////////// KNOCKER SOLENOID ////////////////////////////
  5759. Sub KnockerSolenoid()
  5760. PlaySoundAtLevelStatic SoundFX("Knocker_1",DOFKnocker), KnockerSoundLevel, KnockerPosition
  5761. End Sub
  5762.  
  5763. '///////////////////////////// DRAIN SOUNDS ////////////////////////////
  5764. Sub RandomSoundDrain(drainswitch)
  5765. PlaySoundAtLevelStatic ("Drain_" & Int(Rnd*11)+1), DrainSoundLevel, drainswitch
  5766. End Sub
  5767.  
  5768. '///////////////////////////// TROUGH BALL RELEASE SOLENOID SOUNDS ////////////////////////////
  5769.  
  5770. Sub RandomSoundBallRelease(drainswitch)
  5771. PlaySoundAtLevelStatic SoundFX("BallRelease" & Int(Rnd*7)+1,DOFContactors), BallReleaseSoundLevel, drainswitch
  5772. End Sub
  5773.  
  5774. '///////////////////////////// SLINGSHOT SOLENOID SOUNDS ////////////////////////////
  5775. Sub RandomSoundSlingshotLeft(sling)
  5776. PlaySoundAtLevelStatic SoundFX("Sling_L" & Int(Rnd*10)+1,DOFContactors), SlingshotSoundLevel, Sling
  5777. End Sub
  5778.  
  5779. Sub RandomSoundSlingshotRight(sling)
  5780. PlaySoundAtLevelStatic SoundFX("Sling_R" & Int(Rnd*8)+1,DOFContactors), SlingshotSoundLevel, Sling
  5781. End Sub
  5782.  
  5783. '///////////////////////////// BUMPER SOLENOID SOUNDS ////////////////////////////
  5784. Sub RandomSoundBumperTop(Bump)
  5785. PlaySoundAtLevelStatic SoundFX("Bumpers_Top_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
  5786. End Sub
  5787.  
  5788. Sub RandomSoundBumperMiddle(Bump)
  5789. PlaySoundAtLevelStatic SoundFX("Bumpers_Middle_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
  5790. End Sub
  5791.  
  5792. Sub RandomSoundBumperBottom(Bump)
  5793. PlaySoundAtLevelStatic SoundFX("Bumpers_Bottom_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
  5794. End Sub
  5795.  
  5796. '///////////////////////////// SPINNER SOUNDS ////////////////////////////
  5797. Sub SoundSpinner(spinnerswitch)
  5798. PlaySoundAtLevelStatic ("Spinner"), SpinnerSoundLevel, spinnerswitch
  5799. End Sub
  5800.  
  5801.  
  5802. '///////////////////////////// FLIPPER BATS SOUND SUBROUTINES ////////////////////////////
  5803. '///////////////////////////// FLIPPER BATS SOLENOID ATTACK SOUND ////////////////////////////
  5804. Sub SoundFlipperUpAttackLeft(flipper)
  5805. FlipperUpAttackLeftSoundLevel = RndNum(FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel)
  5806. PlaySoundAtLevelStatic SoundFX("Flipper_Attack-L01",DOFFlippers), FlipperUpAttackLeftSoundLevel, flipper
  5807. End Sub
  5808.  
  5809. Sub SoundFlipperUpAttackRight(flipper)
  5810. FlipperUpAttackRightSoundLevel = RndNum(FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel)
  5811. PlaySoundAtLevelStatic SoundFX("Flipper_Attack-R01",DOFFlippers), FlipperUpAttackLeftSoundLevel, flipper
  5812. End Sub
  5813.  
  5814. '///////////////////////////// FLIPPER BATS SOLENOID CORE SOUND ////////////////////////////
  5815. Sub RandomSoundFlipperUpLeft(flipper)
  5816. PlaySoundAtLevelStatic SoundFX("Flipper_L0" & Int(Rnd*9)+1,DOFFlippers), FlipperLeftHitParm, Flipper
  5817. End Sub
  5818.  
  5819. Sub RandomSoundFlipperUpRight(flipper)
  5820. PlaySoundAtLevelStatic SoundFX("Flipper_R0" & Int(Rnd*9)+1,DOFFlippers), FlipperRightHitParm, Flipper
  5821. End Sub
  5822.  
  5823. Sub RandomSoundReflipUpLeft(flipper)
  5824. PlaySoundAtLevelStatic SoundFX("Flipper_ReFlip_L0" & Int(Rnd*3)+1,DOFFlippers), (RndNum(0.8, 1))*FlipperUpSoundLevel, Flipper
  5825. End Sub
  5826.  
  5827. Sub RandomSoundReflipUpRight(flipper)
  5828. PlaySoundAtLevelStatic SoundFX("Flipper_ReFlip_R0" & Int(Rnd*3)+1,DOFFlippers), (RndNum(0.8, 1))*FlipperUpSoundLevel, Flipper
  5829. End Sub
  5830.  
  5831. Sub RandomSoundFlipperDownLeft(flipper)
  5832. PlaySoundAtLevelStatic SoundFX("Flipper_Left_Down_" & Int(Rnd*7)+1,DOFFlippers), FlipperDownSoundLevel, Flipper
  5833. End Sub
  5834.  
  5835. Sub RandomSoundFlipperDownRight(flipper)
  5836. PlaySoundAtLevelStatic SoundFX("Flipper_Right_Down_" & Int(Rnd*8)+1,DOFFlippers), FlipperDownSoundLevel, Flipper
  5837. End Sub
  5838.  
  5839. '///////////////////////////// FLIPPER BATS BALL COLLIDE SOUND ////////////////////////////
  5840.  
  5841. Sub LeftFlipperCollide(parm)
  5842. FlipperLeftHitParm = parm/10
  5843. If FlipperLeftHitParm > 1 Then
  5844. FlipperLeftHitParm = 1
  5845. End If
  5846. FlipperLeftHitParm = FlipperUpSoundLevel * FlipperLeftHitParm
  5847. RandomSoundRubberFlipper(parm)
  5848. End Sub
  5849.  
  5850. Sub RightFlipperCollide(parm)
  5851. FlipperRightHitParm = parm/10
  5852. If FlipperRightHitParm > 1 Then
  5853. FlipperRightHitParm = 1
  5854. End If
  5855. FlipperRightHitParm = FlipperUpSoundLevel * FlipperRightHitParm
  5856. RandomSoundRubberFlipper(parm)
  5857. End Sub
  5858.  
  5859. Sub RandomSoundRubberFlipper(parm)
  5860. PlaySoundAtLevelActiveBall ("Flipper_Rubber_" & Int(Rnd*7)+1), parm * RubberFlipperSoundFactor
  5861. End Sub
  5862.  
  5863. '///////////////////////////// ROLLOVER SOUNDS ////////////////////////////
  5864. Sub RandomSoundRollover()
  5865. PlaySoundAtLevelActiveBall ("Rollover_" & Int(Rnd*4)+1), RolloverSoundLevel
  5866. End Sub
  5867.  
  5868. Sub Rollovers_Hit(idx)
  5869. RandomSoundRollover
  5870. End Sub
  5871.  
  5872. '///////////////////////////// VARIOUS PLAYFIELD SOUND SUBROUTINES ////////////////////////////
  5873. '///////////////////////////// RUBBERS AND POSTS ////////////////////////////
  5874. '///////////////////////////// RUBBERS - EVENTS ////////////////////////////
  5875. Sub Rubbers_Hit(idx)
  5876. dim finalspeed
  5877. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  5878. If finalspeed > 5 then
  5879. RandomSoundRubberStrong 1
  5880. End if
  5881. If finalspeed <= 5 then
  5882. RandomSoundRubberWeak()
  5883. End If
  5884. End Sub
  5885.  
  5886. '///////////////////////////// RUBBERS AND POSTS - STRONG IMPACTS ////////////////////////////
  5887. Sub RandomSoundRubberStrong(voladj)
  5888. Select Case Int(Rnd*10)+1
  5889. Case 1 : PlaySoundAtLevelActiveBall ("Rubber_Strong_1"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  5890. Case 2 : PlaySoundAtLevelActiveBall ("Rubber_Strong_2"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  5891. Case 3 : PlaySoundAtLevelActiveBall ("Rubber_Strong_3"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  5892. Case 4 : PlaySoundAtLevelActiveBall ("Rubber_Strong_4"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  5893. Case 5 : PlaySoundAtLevelActiveBall ("Rubber_Strong_5"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  5894. Case 6 : PlaySoundAtLevelActiveBall ("Rubber_Strong_6"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  5895. Case 7 : PlaySoundAtLevelActiveBall ("Rubber_Strong_7"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  5896. Case 8 : PlaySoundAtLevelActiveBall ("Rubber_Strong_8"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  5897. Case 9 : PlaySoundAtLevelActiveBall ("Rubber_Strong_9"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
  5898. Case 10 : PlaySoundAtLevelActiveBall ("Rubber_1_Hard"), Vol(ActiveBall) * RubberStrongSoundFactor * 0.6*voladj
  5899. End Select
  5900. End Sub
  5901.  
  5902. '///////////////////////////// RUBBERS AND POSTS - WEAK IMPACTS ////////////////////////////
  5903. Sub RandomSoundRubberWeak()
  5904. PlaySoundAtLevelActiveBall ("Rubber_" & Int(Rnd*9)+1), Vol(ActiveBall) * RubberWeakSoundFactor
  5905. End Sub
  5906.  
  5907. '///////////////////////////// WALL IMPACTS ////////////////////////////
  5908. Sub Walls_Hit(idx)
  5909. RandomSoundWall()
  5910. End Sub
  5911.  
  5912. Sub RandomSoundWall()
  5913. dim finalspeed
  5914. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  5915. If finalspeed > 16 then
  5916. Select Case Int(Rnd*5)+1
  5917. Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_1"), Vol(ActiveBall) * WallImpactSoundFactor
  5918. Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_2"), Vol(ActiveBall) * WallImpactSoundFactor
  5919. Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_5"), Vol(ActiveBall) * WallImpactSoundFactor
  5920. Case 4 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_7"), Vol(ActiveBall) * WallImpactSoundFactor
  5921. Case 5 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_9"), Vol(ActiveBall) * WallImpactSoundFactor
  5922. End Select
  5923. End if
  5924. If finalspeed >= 6 AND finalspeed <= 16 then
  5925. Select Case Int(Rnd*4)+1
  5926. Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_3"), Vol(ActiveBall) * WallImpactSoundFactor
  5927. Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_4"), Vol(ActiveBall) * WallImpactSoundFactor
  5928. Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_6"), Vol(ActiveBall) * WallImpactSoundFactor
  5929. Case 4 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_8"), Vol(ActiveBall) * WallImpactSoundFactor
  5930. End Select
  5931. End If
  5932. If finalspeed < 6 Then
  5933. Select Case Int(Rnd*3)+1
  5934. Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_4"), Vol(ActiveBall) * WallImpactSoundFactor
  5935. Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_6"), Vol(ActiveBall) * WallImpactSoundFactor
  5936. Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_8"), Vol(ActiveBall) * WallImpactSoundFactor
  5937. End Select
  5938. End if
  5939. End Sub
  5940.  
  5941. '///////////////////////////// METAL TOUCH SOUNDS ////////////////////////////
  5942. Sub RandomSoundMetal()
  5943. PlaySoundAtLevelActiveBall ("Metal_Touch_" & Int(Rnd*13)+1), Vol(ActiveBall) * MetalImpactSoundFactor
  5944. End Sub
  5945.  
  5946. '///////////////////////////// METAL - EVENTS ////////////////////////////
  5947.  
  5948. Sub Metals_Hit (idx)
  5949. RandomSoundMetal
  5950. End Sub
  5951.  
  5952. Sub ShooterDiverter_collide(idx)
  5953. RandomSoundMetal
  5954. End Sub
  5955.  
  5956. '///////////////////////////// BOTTOM ARCH BALL GUIDE ////////////////////////////
  5957. '///////////////////////////// BOTTOM ARCH BALL GUIDE - SOFT BOUNCES ////////////////////////////
  5958. Sub RandomSoundBottomArchBallGuide()
  5959. dim finalspeed
  5960. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  5961. If finalspeed > 16 then
  5962. PlaySoundAtLevelActiveBall ("Apron_Bounce_"& Int(Rnd*2)+1), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  5963. End if
  5964. If finalspeed >= 6 AND finalspeed <= 16 then
  5965. Select Case Int(Rnd*2)+1
  5966. Case 1 : PlaySoundAtLevelActiveBall ("Apron_Bounce_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  5967. Case 2 : PlaySoundAtLevelActiveBall ("Apron_Bounce_Soft_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  5968. End Select
  5969. End If
  5970. If finalspeed < 6 Then
  5971. Select Case Int(Rnd*2)+1
  5972. Case 1 : PlaySoundAtLevelActiveBall ("Apron_Bounce_Soft_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  5973. Case 2 : PlaySoundAtLevelActiveBall ("Apron_Medium_3"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
  5974. End Select
  5975. End if
  5976. End Sub
  5977.  
  5978. '///////////////////////////// BOTTOM ARCH BALL GUIDE - HARD HITS ////////////////////////////
  5979. Sub RandomSoundBottomArchBallGuideHardHit()
  5980. PlaySoundAtLevelActiveBall ("Apron_Hard_Hit_" & Int(Rnd*3)+1), BottomArchBallGuideSoundFactor * 0.25
  5981. End Sub
  5982.  
  5983. Sub Apron_Hit (idx)
  5984. ' If Abs(cor.ballvelx(activeball.id) < 4) and cor.ballvely(activeball.id) > 7 then
  5985. ' RandomSoundBottomArchBallGuideHardHit()
  5986. ' Else
  5987. RandomSoundBottomArchBallGuide
  5988. ' End If
  5989. End Sub
  5990.  
  5991. '///////////////////////////// FLIPPER BALL GUIDE ////////////////////////////
  5992. Sub RandomSoundFlipperBallGuide()
  5993. dim finalspeed
  5994. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  5995. If finalspeed > 16 then
  5996. Select Case Int(Rnd*2)+1
  5997. Case 1 : PlaySoundAtLevelActiveBall ("Apron_Hard_1"), Vol(ActiveBall) * FlipperBallGuideSoundFactor
  5998. Case 2 : PlaySoundAtLevelActiveBall ("Apron_Hard_2"), Vol(ActiveBall) * 0.8 * FlipperBallGuideSoundFactor
  5999. End Select
  6000. End if
  6001. If finalspeed >= 6 AND finalspeed <= 16 then
  6002. PlaySoundAtLevelActiveBall ("Apron_Medium_" & Int(Rnd*3)+1), Vol(ActiveBall) * FlipperBallGuideSoundFactor
  6003. End If
  6004. If finalspeed < 6 Then
  6005. PlaySoundAtLevelActiveBall ("Apron_Soft_" & Int(Rnd*7)+1), Vol(ActiveBall) * FlipperBallGuideSoundFactor
  6006. End If
  6007. End Sub
  6008.  
  6009. '///////////////////////////// TARGET HIT SOUNDS ////////////////////////////
  6010. Sub RandomSoundTargetHitStrong()
  6011. PlaySoundAtLevelActiveBall SoundFX("Target_Hit_" & Int(Rnd*4)+5,DOFTargets), Vol(ActiveBall) * 0.45 * TargetSoundFactor
  6012. End Sub
  6013.  
  6014. Sub RandomSoundTargetHitWeak()
  6015. PlaySoundAtLevelActiveBall SoundFX("Target_Hit_" & Int(Rnd*4)+1,DOFTargets), Vol(ActiveBall) * TargetSoundFactor
  6016. End Sub
  6017.  
  6018. Sub PlayTargetSound()
  6019. dim finalspeed
  6020. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  6021. If finalspeed > 10 then
  6022. RandomSoundTargetHitStrong()
  6023. RandomSoundBallBouncePlayfieldSoft Activeball
  6024. Else
  6025. RandomSoundTargetHitWeak()
  6026. End If
  6027. End Sub
  6028.  
  6029. Sub Targets_Hit (idx)
  6030. PlayTargetSound
  6031. End Sub
  6032.  
  6033. '///////////////////////////// BALL BOUNCE SOUNDS ////////////////////////////
  6034. Sub RandomSoundBallBouncePlayfieldSoft(aBall)
  6035. Select Case Int(Rnd*9)+1
  6036. Case 1 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_1"), volz(aBall) * BallBouncePlayfieldSoftFactor, aBall
  6037. Case 2 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_2"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.5, aBall
  6038. Case 3 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_3"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.8, aBall
  6039. Case 4 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_4"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.5, aBall
  6040. Case 5 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_5"), volz(aBall) * BallBouncePlayfieldSoftFactor, aBall
  6041. Case 6 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_1"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
  6042. Case 7 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_2"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
  6043. Case 8 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_5"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
  6044. Case 9 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_7"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.3, aBall
  6045. End Select
  6046. End Sub
  6047.  
  6048. Sub RandomSoundBallBouncePlayfieldHard(aBall)
  6049. PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_" & Int(Rnd*7)+1), volz(aBall) * BallBouncePlayfieldHardFactor, aBall
  6050. End Sub
  6051.  
  6052. '///////////////////////////// DELAYED DROP - TO PLAYFIELD - SOUND ////////////////////////////
  6053. Sub RandomSoundDelayedBallDropOnPlayfield(aBall)
  6054. Select Case Int(Rnd*5)+1
  6055. Case 1 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_1_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  6056. Case 2 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_2_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  6057. Case 3 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_3_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  6058. Case 4 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_4_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  6059. Case 5 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_5_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
  6060. End Select
  6061. End Sub
  6062.  
  6063. '///////////////////////////// BALL GATES AND BRACKET GATES SOUNDS ////////////////////////////
  6064.  
  6065. Sub SoundPlayfieldGate()
  6066. PlaySoundAtLevelStatic ("Gate_FastTrigger_" & Int(Rnd*2)+1), GateSoundLevel, Activeball
  6067. End Sub
  6068.  
  6069. Sub SoundHeavyGate()
  6070. PlaySoundAtLevelStatic ("Gate_2"), GateSoundLevel, Activeball
  6071. End Sub
  6072.  
  6073. Sub Gates_hit(idx)
  6074. SoundHeavyGate
  6075. End Sub
  6076.  
  6077. Sub GatesWire_hit(idx)
  6078. SoundPlayfieldGate
  6079. End Sub
  6080.  
  6081. '///////////////////////////// LEFT LANE ENTRANCE - SOUNDS ////////////////////////////
  6082.  
  6083. Sub RandomSoundLeftArch()
  6084. PlaySoundAtLevelActiveBall ("Arch_L" & Int(Rnd*4)+1), Vol(ActiveBall) * ArchSoundFactor
  6085. End Sub
  6086.  
  6087. Sub RandomSoundRightArch()
  6088. PlaySoundAtLevelActiveBall ("Arch_R" & Int(Rnd*4)+1), Vol(ActiveBall) * ArchSoundFactor
  6089. End Sub
  6090.  
  6091.  
  6092. Sub Arch1_hit()
  6093. If Activeball.velx > 1 Then SoundPlayfieldGate
  6094. StopSound "Arch_L1"
  6095. StopSound "Arch_L2"
  6096. StopSound "Arch_L3"
  6097. StopSound "Arch_L4"
  6098. End Sub
  6099.  
  6100. Sub Arch1_unhit()
  6101. If activeball.velx < -8 Then
  6102. RandomSoundRightArch
  6103. End If
  6104. End Sub
  6105.  
  6106. Sub Arch2_hit()
  6107. If Activeball.velx < 1 Then SoundPlayfieldGate
  6108. StopSound "Arch_R1"
  6109. StopSound "Arch_R2"
  6110. StopSound "Arch_R3"
  6111. StopSound "Arch_R4"
  6112. End Sub
  6113.  
  6114. Sub Arch2_unhit()
  6115. If activeball.velx > 10 Then
  6116. RandomSoundLeftArch
  6117. End If
  6118. End Sub
  6119.  
  6120. '///////////////////////////// SAUCERS (KICKER HOLES) ////////////////////////////
  6121.  
  6122. Sub SoundSaucerLock()
  6123. PlaySoundAtLevelStatic ("Saucer_Enter_" & Int(Rnd*2)+1), SaucerLockSoundLevel, Activeball
  6124. End Sub
  6125.  
  6126. Sub SoundSaucerKick(scenario, saucer)
  6127. Select Case scenario
  6128. Case 0: PlaySoundAtLevelStatic SoundFX("Saucer_Empty", DOFContactors), SaucerKickSoundLevel, saucer
  6129. Case 1: PlaySoundAtLevelStatic SoundFX("Saucer_Kick", DOFContactors), SaucerKickSoundLevel, saucer
  6130. End Select
  6131. End Sub
  6132.  
  6133. '///////////////////////////// BALL COLLISION SOUND ////////////////////////////
  6134. Sub OnBallBallCollision(ball1, ball2, velocity)
  6135. Dim snd
  6136. Select Case Int(Rnd*7)+1
  6137. Case 1 : snd = "Ball_Collide_1"
  6138. Case 2 : snd = "Ball_Collide_2"
  6139. Case 3 : snd = "Ball_Collide_3"
  6140. Case 4 : snd = "Ball_Collide_4"
  6141. Case 5 : snd = "Ball_Collide_5"
  6142. Case 6 : snd = "Ball_Collide_6"
  6143. Case 7 : snd = "Ball_Collide_7"
  6144. End Select
  6145.  
  6146. PlaySound (snd), 0, Csng(velocity) ^2 / 200 * BallWithBallCollisionSoundFactor * VolumeDial, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  6147. End Sub
  6148.  
  6149.  
  6150. '/////////////////////////////////////////////////////////////////
  6151. ' End Mechanical Sounds
  6152. '/////////////////////////////////////////////////////////////////
  6153.  
  6154. '******************************************************
  6155. '**** FLEEP MECHANICAL SOUNDS
  6156. '******************************************************
  6157.  
  6158.  
  6159.  
  6160.  
  6161.  
  6162. '****************************************************************
  6163. ' Section; Debug Shot Tester 2.0
  6164. ' 1. Raise/Lower outlanes and drain posts by pressing 2 key
  6165. ' 2. Capture and Launch ball, Press and hold one of the buttons (W, E, R, Y, U, I, P, A) below to capture ball by flipper. Release key to shoot ball
  6166. ' 3. To change the test shot angles, press and hold a key and use Flipper keys to adjust the shot angle. Shot angles are saved into the User direction as cgamename.txt
  6167. ' 4. Set TestMode = 0 to disable test code.
  6168. '
  6169. ' HOW TO INSTALL: Copy all objects from Layer 2 to table and adjust. Copy the Debug Shot Tester code starting at line 500 to bottom of table script.
  6170. ' Add "TestTableKeyDownCheck keycode" to top of Table1_KeyDown sub and add "TestTableKeyUpCheck keycode" to top of Table1_KeyUp sub
  6171. '****************************************************************
  6172. 'Const TestMode = 0 'Set to 0 to disable. 1 to enable
  6173. Dim KickerDebugForce: KickerDebugForce = 30
  6174.  
  6175. ' Enable Disable Outlane and Drain Blocker Wall for debug testing
  6176. Dim BLState
  6177. debug_BLW1.IsDropped=1:debug_BLP1.Visible=0:debug_BLR1.Visible=0: debug_BLW2.IsDropped=1:debug_BLP2.Visible=0:debug_BLR2.Visible=0: debug_BLW3.IsDropped=1:debug_BLP3.Visible=0:debug_BLR3.Visible=0
  6178. Sub BlockerWalls
  6179.  
  6180. BLState = (BLState + 1) Mod 4
  6181. ' debug.print "BlockerWalls"
  6182. PlaySound ("Start_Button")
  6183. Select Case BLState:
  6184. Case 0
  6185. debug_BLW1.IsDropped=1:debug_BLP1.Visible=0:debug_BLR1.Visible=0: debug_BLW2.IsDropped=1:debug_BLP2.Visible=0:debug_BLR2.Visible=0: debug_BLW3.IsDropped=1:debug_BLP3.Visible=0:debug_BLR3.Visible=0
  6186. Case 1:
  6187. debug_BLW1.IsDropped=0:debug_BLP1.Visible=1:debug_BLR1.Visible=1: debug_BLW2.IsDropped=0:debug_BLP2.Visible=1:debug_BLR2.Visible=1: debug_BLW3.IsDropped=0:debug_BLP3.Visible=1:debug_BLR3.Visible=1
  6188. Case 2:
  6189. debug_BLW1.IsDropped=0:debug_BLP1.Visible=1:debug_BLR1.Visible=1: debug_BLW2.IsDropped=0:debug_BLP2.Visible=1:debug_BLR2.Visible=1: debug_BLW3.IsDropped=1:debug_BLP3.Visible=0:debug_BLR3.Visible=0
  6190. Case 3:
  6191. debug_BLW1.IsDropped=1:debug_BLP1.Visible=0:debug_BLR1.Visible=0: debug_BLW2.IsDropped=1:debug_BLP2.Visible=0:debug_BLR2.Visible=0: debug_BLW3.IsDropped=0:debug_BLP3.Visible=1:debug_BLR3.Visible=1
  6192. End Select
  6193. End Sub
  6194.  
  6195.  
  6196. Sub TestTableKeyDownCheck (Keycode)
  6197.  
  6198. 'Cycle through Outlane/Centerlane blocking posts
  6199. '-----------------------------------------------
  6200. If Keycode = 3 Then
  6201. BlockerWalls
  6202. End If
  6203.  
  6204. If TestMode = 1 Then
  6205.  
  6206. 'Capture and launch ball:
  6207. ' Press and hold one of the buttons (W, E, R, T, Y, U, I, P) below to capture ball by flipper. Release key to shoot ball
  6208. ' In the Keydown sub, set up ball launch angle and force
  6209. '--------------------------------------------------------------------------------------------
  6210. If keycode = 17 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleW 'W key
  6211. If keycode = 18 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleE 'E key
  6212. If keycode = 19 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleR 'R key
  6213. If keycode = 21 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleY 'Y key
  6214. If keycode = 22 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleU 'U key
  6215. If keycode = 23 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleI 'I key
  6216. If keycode = 25 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleP 'P key
  6217. If keycode = 30 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleA 'A key
  6218. If keycode = 31 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleS 'S key
  6219. If keycode = 33 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleF 'F key
  6220. If keycode = 34 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleG 'G key
  6221. If keycode = 35 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleH 'H key
  6222. If keycode = 36 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleJ 'J key
  6223. If keycode = 37 Then KickerDebug.enabled = true : TestKickerVar = TestKickAngleK 'K key
  6224.  
  6225. If KickerDebug.enabled = true Then 'Use Flippers to adjust angle while holding key
  6226. If keycode = leftflipperkey Then
  6227. TestKickAim.Visible = True
  6228. TestKickerVar = TestKickerVar - 1
  6229. 'debug.print TestKickerVar
  6230. ElseIf keycode = rightflipperkey Then
  6231. TestKickAim.Visible = True
  6232. TestKickerVar = TestKickerVar + 1
  6233. 'debug.print TestKickerVar
  6234. End If
  6235. TestKickAim.ObjRotz = TestKickerVar
  6236. End If
  6237.  
  6238. End If
  6239. End Sub
  6240.  
  6241.  
  6242. Sub TestTableKeyUpCheck (Keycode)
  6243.  
  6244. ' Capture and launch ball:
  6245. ' Press and hold one of the buttons below to capture ball by flipper. Release to shoot ball. Set up angle and force as needed for each shot.
  6246. '--------------------------------------------------------------------------------------------
  6247. If TestMode = 1 Then
  6248. If keycode = 17 Then TestKickAngleW = TestKickerVar : KickerDebug.kick TestKickAngleW, KickerDebugForce: KickerDebug.enabled = false 'W key
  6249. If keycode = 18 Then TestKickAngleE = TestKickerVar : KickerDebug.kick TestKickAngleE, KickerDebugForce: KickerDebug.enabled = false 'E key
  6250. If keycode = 19 Then TestKickAngleR = TestKickerVar : KickerDebug.kick TestKickAngleR, KickerDebugForce: KickerDebug.enabled = false: 'R key
  6251. If keycode = 21 Then TestKickAngleY = TestKickerVar : KickerDebug.kick TestKickAngleY, KickerDebugForce: KickerDebug.enabled = false 'Y key
  6252. If keycode = 22 Then TestKickAngleU = TestKickerVar : KickerDebug.kick TestKickAngleU, KickerDebugForce: KickerDebug.enabled = false 'U key
  6253. If keycode = 23 Then TestKickAngleI = TestKickerVar : KickerDebug.kick TestKickAngleI, KickerDebugForce: KickerDebug.enabled = false 'I key
  6254. If keycode = 25 Then TestKickAngleP = TestKickerVar : KickerDebug.kick TestKickAngleP, KickerDebugForce: KickerDebug.enabled = false 'P key
  6255. If keycode = 30 Then TestKickAngleA = TestKickerVar : KickerDebug.kick TestKickAngleA, KickerDebugForce: KickerDebug.enabled = false 'A key
  6256. If keycode = 31 Then TestKickAngleS = TestKickerVar : KickerDebug.kick TestKickAngleS, KickerDebugForce: KickerDebug.enabled = false 'S key
  6257. If keycode = 33 Then TestKickAngleF = TestKickerVar : KickerDebug.kick TestKickAngleF, KickerDebugForce: KickerDebug.enabled = false 'F key
  6258. If keycode = 34 Then TestKickAngleG = TestKickerVar : KickerDebug.kick TestKickAngleG, KickerDebugForce: KickerDebug.enabled = false 'G key
  6259. If keycode = 35 Then TestKickAngleH = TestKickerVar : KickerDebug.kick TestKickAngleH, KickerDebugForce: KickerDebug.enabled = false 'H key
  6260. If keycode = 36 Then TestKickAngleJ = TestKickerVar : KickerDebug.kick TestKickAngleJ, KickerDebugForce: KickerDebug.enabled = false 'J key
  6261. If keycode = 37 Then TestKickAngleK = TestKickerVar : KickerDebugBall.X=430: KickerDebugBall.Y=1456: KickerDebugBall.Z = 25: KickerDebug.kick TestKickAngleK, KickerDebugForce: KickerDebug.enabled = false 'K key
  6262.  
  6263. ' EXAMPLE CODE to set up key to cycle through 3 predefined shots
  6264. ' If keycode = 17 Then 'Cycle through all left target shots
  6265. ' If TestKickerAngle = -28 then
  6266. ' TestKickerAngle = -24
  6267. ' ElseIf TestKickerAngle = -24 Then
  6268. ' TestKickerAngle = -19
  6269. ' Else
  6270. ' TestKickerAngle = -28
  6271. ' End If
  6272. ' KickerDebug.kick TestKickerAngle, KickerDebugforce: KickerDebug.enabled = false 'W key
  6273. ' End If
  6274.  
  6275. End If
  6276.  
  6277. If (KickerDebug.enabled = False and TestKickAim.Visible = True) Then 'Save Angle changes
  6278. TestKickAim.Visible = False
  6279. SaveTestKickAngles
  6280. End If
  6281.  
  6282. End Sub
  6283.  
  6284. Dim KickerDebugBall
  6285. Sub Kickerdebug_Hit ()
  6286. Set KickerDebugBall = ActiveBall
  6287. End Sub
  6288.  
  6289. Dim TestKickerAngle, TestKickerAngle2, TestKickerVar, TeskKickKey, TestKickForce
  6290. Dim TestKickAngleWDefault, TestKickAngleEDefault, TestKickAngleRDefault, TestKickAngleYDefault, TestKickAngleUDefault, TestKickAngleIDefault
  6291. Dim TestKickAnglePDefault, TestKickAngleADefault, TestKickAngleSDefault, TestKickAngleFDefault, TestKickAngleGDefault, TestKickAngleHDefault, TestKickAngleJDefault, TestKickAngleKDefault
  6292. Dim TestKickAngleW, TestKickAngleE, TestKickAngleR, TestKickAngleY, TestKickAngleU, TestKickAngleI
  6293. Dim TestKickAngleP, TestKickAngleA, TestKickAngleS, TestKickAngleF, TestKickAngleG, TestKickAngleH, TestKickAngleJ, TestKickAngleK
  6294. TestKickAngleWDefault = -30
  6295. TestKickAngleEDefault = -26
  6296. TestKickAngleRDefault = -22
  6297. TestKickAngleYDefault = -19
  6298. TestKickAngleUDefault = -11
  6299. TestKickAngleIDefault = 0
  6300. TestKickAnglePDefault = 10
  6301. TestKickAngleADefault = 13
  6302. TestKickAngleSDefault = 19
  6303. TestKickAngleFDefault = 22
  6304. TestKickAngleGDefault = 24
  6305. TestKickAngleHDefault = 27
  6306. TestKickAngleJDefault = 30
  6307. TestKickAngleKDefault = 41
  6308.  
  6309. If TestMode = 1 Then LoadTestKickAngles
  6310.  
  6311. Sub SaveTestKickAngles
  6312. Dim FileObj, OutFile
  6313. Set FileObj = CreateObject("Scripting.FileSystemObject")
  6314. If Not FileObj.FolderExists(UserDirectory) then Exit Sub
  6315. Set OutFile=FileObj.CreateTextFile(UserDirectory & cGameName & ".txt", True)
  6316.  
  6317. OutFile.WriteLine TestKickAngleW
  6318. OutFile.WriteLine TestKickAngleE
  6319. OutFile.WriteLine TestKickAngleR
  6320. OutFile.WriteLine TestKickAngleY
  6321. OutFile.WriteLine TestKickAngleU
  6322. OutFile.WriteLine TestKickAngleI
  6323. OutFile.WriteLine TestKickAngleP
  6324. OutFile.WriteLine TestKickAngleA
  6325. OutFile.WriteLine TestKickAngleS
  6326. OutFile.WriteLine TestKickAngleF
  6327. OutFile.WriteLine TestKickAngleG
  6328. OutFile.WriteLine TestKickAngleH
  6329. OutFile.WriteLine TestKickAngleJ
  6330. OutFile.WriteLine TestKickAngleK
  6331. OutFile.Close
  6332.  
  6333. Set OutFile = Nothing
  6334. Set FileObj = Nothing
  6335. End Sub
  6336.  
  6337. Sub LoadTestKickAngles
  6338. Dim FileObj, OutFile, TextStr
  6339.  
  6340. Set FileObj=CreateObject("Scripting.FileSystemObject")
  6341. If Not FileObj.FolderExists(UserDirectory) then MsgBox "User directory missing": Exit Sub
  6342.  
  6343. If FileObj.FileExists(UserDirectory & cGameName & ".txt") then
  6344.  
  6345. Set OutFile = FileObj.GetFile(UserDirectory & cGameName & ".txt")
  6346. Set TextStr = OutFile.OpenAsTextStream(1,0)
  6347. If (TextStr.AtEndOfStream = True) then Exit Sub
  6348.  
  6349. TestKickAngleW = TextStr.ReadLine
  6350. TestKickAngleE = TextStr.ReadLine
  6351. TestKickAngleR = TextStr.ReadLine
  6352. TestKickAngleY = TextStr.ReadLine
  6353. TestKickAngleU = TextStr.ReadLine
  6354. TestKickAngleI = TextStr.ReadLine
  6355. TestKickAngleP = TextStr.ReadLine
  6356. TestKickAngleA = TextStr.ReadLine
  6357. TestKickAngleS = TextStr.ReadLine
  6358. TestKickAngleF = TextStr.ReadLine
  6359. TestKickAngleG = TextStr.ReadLine
  6360. If (TextStr.AtEndOfStream = True) then TestKickAngleH = TestKickAngleHDefault: Else: TestKickAngleH = TextStr.ReadLine: End If
  6361. If (TextStr.AtEndOfStream = True) then TestKickAngleJ = TestKickAngleJDefault: Else: TestKickAngleJ = TextStr.ReadLine: End If
  6362. If (TextStr.AtEndOfStream = True) then TestKickAngleK = TestKickAngleKDefault: Else: TestKickAngleK = TextStr.ReadLine: End If
  6363. ' TestKickAngleJ = TextStr.ReadLine
  6364. ' TestKickAngleK = TextStr.ReadLine
  6365. TextStr.Close
  6366.  
  6367.  
  6368. Else
  6369. 'create file
  6370. TestKickAngleW = TestKickAngleWDefault:
  6371. TestKickAngleE = TestKickAngleEDefault
  6372. TestKickAngleR = TestKickAngleRDefault
  6373. TestKickAngleY = TestKickAngleYDefault
  6374. TestKickAngleU = TestKickAngleUDefault
  6375. TestKickAngleI = TestKickAngleIDefault
  6376. TestKickAngleP = TestKickAnglePDefault
  6377. TestKickAngleA = TestKickAngleADefault
  6378. TestKickAngleS = TestKickAngleSDefault
  6379. TestKickAngleF = TestKickAngleFDefault
  6380. TestKickAngleG = TestKickAngleGDefault
  6381. TestKickAngleH = TestKickAnglehDefault
  6382. TestKickAngleJ = TestKickAngleJDefault
  6383. TestKickAngleK = TestKickAngleKDefault
  6384. SaveTestKickAngles
  6385.  
  6386. End If
  6387.  
  6388. Set OutFile = Nothing
  6389. Set FileObj = Nothing
  6390.  
  6391. End Sub
  6392.  
  6393.  
  6394. '******************************************************
  6395. '******* Set Up VR Backglass Flashers *******
  6396. '******************************************************
  6397. Dim BGObj
  6398.  
  6399. Sub SetBackglass()
  6400.  
  6401. For Each BGObj In Backglass_flashers
  6402. BGObj.x = BGobj.x
  6403. BGObj.height = - BGObj.y + 140
  6404. BGObj.y =90 'adjusts the distance from the backglass towards the user
  6405. Next
  6406.  
  6407. End Sub
  6408.  
  6409. '**********************************************
  6410.  
  6411. '*********************************
  6412.  
  6413.  
  6414.  
  6415.  
  6416.  
  6417.  
  6418. ' ***************************************************************************
  6419. ' VR Backglass Code
  6420. ' ****************************************************************************
  6421.  
  6422.  
  6423. ' ***************************************************************************
  6424. ' (EM) 1-4 player 5x drums, 1 credit drum CORE CODE
  6425. ' ****************************************************************************
  6426.  
  6427.  
  6428. ' ********************* POSITION EM REEL DRUMS ON BACKGLASS *************************
  6429.  
  6430. Dim xoff,yoff,zoff,xrot,zscale, xcen,ycen
  6431. Dim inx
  6432. xoff =472
  6433. yoff = 0
  6434. zoff =835
  6435. xrot = -90
  6436.  
  6437. Const USEEMS = 4 ' 1-4 set between 1 to 4 based on number of players
  6438.  
  6439. const idx_emp1r1 =0 'player 1
  6440. const idx_emp2r1 =5 'player 2
  6441. const idx_emp3r1 =10 'player 3
  6442. const idx_emp4r1 =15 'player 4
  6443. const idx_emp4r6 =20 'credits
  6444.  
  6445.  
  6446. Dim BGObjEM(1)
  6447. if USEEMS = 1 then
  6448. BGObjEM(0) = Array(emp1r1, emp1r2, emp1r3, emp1r4, emp1r5, _
  6449. Empty,Empty,Empty,Empty,Empty,_
  6450. Empty,Empty,Empty,Empty,Empty,_
  6451. Empty,Empty,Empty,Empty,Empty,_
  6452. emp4r6) ' credits
  6453. elseif USEEMS = 2 then
  6454. BGObjEM(0) = Array(emp1r1, emp1r2, emp1r3, emp1r4, emp1r5, _
  6455. emp2r1, emp2r2, emp2r3, emp2r4, emp2r5, _
  6456. Empty,Empty,Empty,Empty,Empty,_
  6457. Empty,Empty,Empty,Empty,Empty,_
  6458. emp4r6) ' credits
  6459. elseif USEEMS = 3 then
  6460. BGObjEM(0) = Array(emp1r1, emp1r2, emp1r3, emp1r4, emp1r5, _
  6461. emp2r1, emp2r2, emp2r3, emp2r4, emp2r5, _
  6462. emp3r1, emp3r2, emp3r3, emp3r4, emp3r5, _
  6463. Empty,Empty,Empty,Empty,Empty,_
  6464. emp4r6) ' credits
  6465. elseif USEEMS = 4 then
  6466. BGObjEM(0) = Array(emp1r1, emp1r2, emp1r3, emp1r4, emp1r5, _
  6467. emp2r1, emp2r2, emp2r3, emp2r4, emp2r5, _
  6468. emp3r1, emp3r2, emp3r3, emp3r4, emp3r5, _
  6469. emp4r1, emp4r2, emp4r3, emp4r4, emp4r5, _
  6470. emp4r6) ' credits
  6471. end If
  6472.  
  6473. Sub center_objects_em()
  6474. Dim cnt,ii, xx, yy, yfact, xfact, objs
  6475. 'exit sub
  6476. yoff = -150
  6477. zscale = 0.0000001
  6478. xcen =(960 /2) - (17 / 2)
  6479. ycen = (1065 /2 ) + (313 /2)
  6480.  
  6481. yfact = -25
  6482. xfact = 0
  6483.  
  6484. cnt =0
  6485. For Each objs In BGObjEM(0)
  6486. If Not IsEmpty(objs) then
  6487. if objs.name = emp4r6.name then
  6488. yoff = 45 ' credit drum is 60% smaller
  6489. Else
  6490. yoff = 2
  6491. end if
  6492.  
  6493. xx =objs.x
  6494.  
  6495. objs.x = (xoff - xcen) + xx + xfact
  6496. yy = objs.y
  6497. objs.y =yoff
  6498.  
  6499. If yy < 0 then
  6500. yy = yy * -1
  6501. end if
  6502.  
  6503. objs.z = (zoff - ycen) + yy - (yy * zscale) + yfact
  6504.  
  6505. 'objs.rotx = xrot
  6506. end if
  6507. cnt = cnt + 1
  6508. Next
  6509.  
  6510. end sub
  6511.  
  6512.  
  6513.  
  6514. ' ********************* UPDATE EM REEL DRUMS CORE LIB *************************
  6515.  
  6516. Dim cred,ix, np,npp, reels(5, 7), scores(6,2)
  6517.  
  6518. 'reset scores to defaults
  6519. for np =0 to 5
  6520. scores(np,0 ) = 0
  6521. scores(np,1 ) = 0
  6522. Next
  6523.  
  6524. 'reset EM drums to defaults
  6525. For np =0 to 3
  6526. For npp =0 to 6
  6527. reels(np, npp) =0 ' default to zero
  6528. Next
  6529. Next
  6530.  
  6531.  
  6532. Sub SetScore(player, ndx , val)
  6533.  
  6534. Dim ncnt
  6535.  
  6536. if player = 5 or player = 6 then
  6537. if val > 0 then
  6538. If(ndx = 0)Then ncnt = val * 10
  6539. If(ndx = 1)Then ncnt = val
  6540.  
  6541. scores(player, 0) = scores(player, 0) + ncnt
  6542. end if
  6543. else
  6544. if val > 0 then
  6545.  
  6546. If(ndx = 0)then ncnt = val * 10000
  6547. If(ndx = 1)then ncnt = val * 1000
  6548. If(ndx = 2)Then ncnt = val * 100
  6549. If(ndx = 3)Then ncnt = val * 10
  6550. If(ndx = 4)Then ncnt = val
  6551.  
  6552. scores(player, 0) = scores(player, 0) + ncnt
  6553. 'scores(player, 0) + ncnt
  6554.  
  6555. end if
  6556. end if
  6557. End Sub
  6558.  
  6559.  
  6560. Sub SetDrum(player, drum , val)
  6561. Dim cnt
  6562. Dim objs : objs =BGObjEM(0)
  6563.  
  6564. If val = 0 then
  6565. Select case player
  6566. case -1: ' the credit drum
  6567. If Not IsEmpty(objs(idx_emp4r6)) then
  6568. objs(idx_emp4r6).ObjrotX = 0 ' 285
  6569. 'cnt =objs(idx_emp4r6).ObjrotX
  6570. end if
  6571. Case 0:
  6572. Select Case drum
  6573. Case 1: If Not IsEmpty(objs(idx_emp1r1)) then: objs(idx_emp1r1).ObjrotX = 0: end if' 283
  6574. Case 2: If Not IsEmpty(objs(idx_emp1r1+1)) then: objs(idx_emp1r1+1).ObjrotX=0: end if
  6575. Case 3: If Not IsEmpty(objs(idx_emp1r1+2)) then: objs(idx_emp1r1+2).ObjrotX=0: end if
  6576. Case 4: If Not IsEmpty(objs(idx_emp1r1+3)) then: objs(idx_emp1r1+3).ObjrotX=0: end if
  6577. Case 5: If Not IsEmpty(objs(idx_emp1r1+4)) then: objs(idx_emp1r1+4).ObjrotX=0: end if
  6578. End Select
  6579. Case 1:
  6580. Select Case drum
  6581. Case 1: If Not IsEmpty(objs(idx_emp2r1)) then: objs(idx_emp2r1).ObjrotX = 0: end if' 283
  6582. Case 2: If Not IsEmpty(objs(idx_emp2r1+1)) then: objs(idx_emp2r1+1).ObjrotX=0: end if
  6583. Case 3: If Not IsEmpty(objs(idx_emp2r1+2)) then: objs(idx_emp2r1+2).ObjrotX=0: end if
  6584. Case 4: If Not IsEmpty(objs(idx_emp2r1+3)) then: objs(idx_emp2r1+3).ObjrotX=0: end if
  6585. Case 5: If Not IsEmpty(objs(idx_emp2r1+4)) then: objs(idx_emp2r1+4).ObjrotX=0: end if
  6586. End Select
  6587. Case 2:
  6588. Select Case drum
  6589. Case 1: If Not IsEmpty(objs(idx_emp3r1)) then: objs(idx_emp3r1).ObjrotX = 0: end if' 283
  6590. Case 2: If Not IsEmpty(objs(idx_emp3r1+1)) then: objs(idx_emp3r1+1).ObjrotX=0: end if
  6591. Case 3: If Not IsEmpty(objs(idx_emp3r1+2)) then: objs(idx_emp3r1+2).ObjrotX=0: end if
  6592. Case 4: If Not IsEmpty(objs(idx_emp3r1+3)) then: objs(idx_emp3r1+3).ObjrotX=0: end if
  6593. Case 5: If Not IsEmpty(objs(idx_emp3r1+4)) then: objs(idx_emp3r1+4).ObjrotX=0: end if
  6594. End Select
  6595. Case 3:
  6596. Select Case drum
  6597. Case 1: If Not IsEmpty(objs(idx_emp4r1)) then: objs(idx_emp4r1).ObjrotX = 0: end if' 283
  6598. Case 2: If Not IsEmpty(objs(idx_emp4r1+1)) then: objs(idx_emp4r1+1).ObjrotX=0: end if
  6599. Case 3: If Not IsEmpty(objs(idx_emp4r1+2)) then: objs(idx_emp4r1+2).ObjrotX=0: end if
  6600. Case 4: If Not IsEmpty(objs(idx_emp4r1+3)) then: objs(idx_emp4r1+3).ObjrotX=0: end if
  6601. Case 5: If Not IsEmpty(objs(idx_emp4r1+4)) then: objs(idx_emp4r1+4).ObjrotX=0: end if
  6602. End Select
  6603. End Select
  6604.  
  6605. else
  6606. Select case player
  6607.  
  6608. Case -1: ' the credit drum
  6609. 'emp4r6.ObjrotX = emp4r6.ObjrotX + val
  6610. If Not IsEmpty(objs(idx_emp4r6)) then
  6611. objs(idx_emp4r6).ObjrotX = objs(idx_emp4r6).ObjrotX + val
  6612. end if
  6613.  
  6614. Case 0:
  6615. Select Case drum
  6616. Case 1: If Not IsEmpty(objs(idx_emp1r1)) then: objs(idx_emp1r1).ObjrotX= objs(idx_emp1r1).ObjrotX + val: end if
  6617. Case 2: If Not IsEmpty(objs(idx_emp1r1+1)) then: objs(idx_emp1r1+1).ObjrotX= objs(idx_emp1r1+1).ObjrotX + val: end if
  6618. Case 3: If Not IsEmpty(objs(idx_emp1r1+2)) then: objs(idx_emp1r1+2).ObjrotX= objs(idx_emp1r1+2).ObjrotX + val: end if
  6619. Case 4: If Not IsEmpty(objs(idx_emp1r1+3)) then: objs(idx_emp1r1+3).ObjrotX= objs(idx_emp1r1+3).ObjrotX + val: end if
  6620. Case 5: If Not IsEmpty(objs(idx_emp1r1+4)) then: objs(idx_emp1r1+4).ObjrotX= objs(idx_emp1r1+4).ObjrotX + val: end if
  6621. End Select
  6622. Case 1:
  6623. Select Case drum
  6624. Case 1: If Not IsEmpty(objs(idx_emp2r1)) then: objs(idx_emp2r1).ObjrotX= objs(idx_emp2r1).ObjrotX + val: end if
  6625. Case 2: If Not IsEmpty(objs(idx_emp2r1+1)) then: objs(idx_emp2r1+1).ObjrotX= objs(idx_emp2r1+1).ObjrotX + val: end if
  6626. Case 3: If Not IsEmpty(objs(idx_emp2r1+2)) then: objs(idx_emp2r1+2).ObjrotX= objs(idx_emp2r1+2).ObjrotX + val: end if
  6627. Case 4: If Not IsEmpty(objs(idx_emp2r1+3)) then: objs(idx_emp2r1+3).ObjrotX= objs(idx_emp2r1+3).ObjrotX + val: end if
  6628. Case 5: If Not IsEmpty(objs(idx_emp2r1+4)) then: objs(idx_emp2r1+4).ObjrotX= objs(idx_emp2r1+4).ObjrotX + val: end if
  6629. End Select
  6630. Case 2:
  6631. Select Case drum
  6632. Case 1: If Not IsEmpty(objs(idx_emp3r1)) then: objs(idx_emp3r1).ObjrotX= objs(idx_emp3r1).ObjrotX + val: end if
  6633. Case 2: If Not IsEmpty(objs(idx_emp3r1+1)) then: objs(idx_emp3r1+1).ObjrotX= objs(idx_emp3r1+1).ObjrotX + val: end if
  6634. Case 3: If Not IsEmpty(objs(idx_emp3r1+2)) then: objs(idx_emp3r1+2).ObjrotX= objs(idx_emp3r1+2).ObjrotX + val: end if
  6635. Case 4: If Not IsEmpty(objs(idx_emp3r1+3)) then: objs(idx_emp3r1+3).ObjrotX= objs(idx_emp3r1+3).ObjrotX + val: end if
  6636. Case 5: If Not IsEmpty(objs(idx_emp3r1+4)) then: objs(idx_emp3r1+4).ObjrotX= objs(idx_emp3r1+4).ObjrotX + val: end if
  6637. End Select
  6638. Case 3:
  6639. Select Case drum
  6640. Case 1: If Not IsEmpty(objs(idx_emp4r1)) then: objs(idx_emp4r1).ObjrotX= objs(idx_emp4r1).ObjrotX + val: end if
  6641. Case 2: If Not IsEmpty(objs(idx_emp4r1+1)) then: objs(idx_emp4r1+1).ObjrotX= objs(idx_emp4r1+1).ObjrotX + val: end if
  6642. Case 3: If Not IsEmpty(objs(idx_emp4r1+2)) then: objs(idx_emp4r1+2).ObjrotX= objs(idx_emp4r1+2).ObjrotX + val: end if
  6643. Case 4: If Not IsEmpty(objs(idx_emp4r1+3)) then: objs(idx_emp4r1+3).ObjrotX= objs(idx_emp4r1+3).ObjrotX + val: end if
  6644. Case 5: If Not IsEmpty(objs(idx_emp4r1+4)) then: objs(idx_emp4r1+4).ObjrotX= objs(idx_emp4r1+4).ObjrotX + val: end if
  6645. End Select
  6646.  
  6647. End Select
  6648. end if
  6649. End Sub
  6650.  
  6651.  
  6652. Sub SetReel(player, drum, val)
  6653.  
  6654. 'TextBox1.text = "playr:" & player +1 & " drum:" & drum & "val:" & val
  6655.  
  6656. Dim inc , cur, dif, fix, fval
  6657.  
  6658. inc = 33.5
  6659. fval = -5 ' graphic seam between 5 & 6 fix value, easier to fix here than photoshop
  6660.  
  6661. If (player <= 3) or (drum = -1) then
  6662.  
  6663. If drum = -1 then drum = 0
  6664.  
  6665. cur =reels(player, drum)
  6666.  
  6667. If val <> cur then ' something has changed
  6668. Select Case drum
  6669.  
  6670. Case 0: ' credits drum
  6671.  
  6672. if val > cur then
  6673. dif =val - cur
  6674. fix =0
  6675. If cur < 5 and cur+dif > 5 then
  6676. fix = fix- fval
  6677. end if
  6678. dif = dif * inc
  6679.  
  6680. dif = dif-fix
  6681.  
  6682. SetDrum -1,0, -dif
  6683. Else
  6684. if val = 0 Then
  6685. SetDrum -1,0, 0' reset the drum to abs. zero
  6686. Else
  6687. dif = 11 - cur
  6688. dif = dif + val
  6689.  
  6690. dif = dif * inc
  6691. dif = dif-fval
  6692.  
  6693. SetDrum -1,0, -dif
  6694. end if
  6695. end if
  6696. Case 1:
  6697. 'TB1.text = val
  6698. if val > cur then
  6699. dif =val - cur
  6700. fix =0
  6701. If cur < 5 and cur+dif > 5 then
  6702. fix = fix- fval
  6703. end if
  6704. dif = dif * inc
  6705.  
  6706. dif = dif-fix
  6707.  
  6708. SetDrum player,drum, -dif
  6709. Else
  6710. if val = 0 Then
  6711. SetDrum player,drum, 0' reset the drum to abs. zero
  6712. Else
  6713. dif = 11 - cur
  6714. dif = dif + val
  6715.  
  6716. dif = dif * inc
  6717. dif = dif-fval
  6718.  
  6719. SetDrum player,drum, -dif
  6720. end if
  6721.  
  6722. end if
  6723. reels(player, drum) = val
  6724.  
  6725. Case 2:
  6726. 'TB2.text = val
  6727.  
  6728. if val > cur then
  6729. dif =val - cur
  6730. fix =0
  6731. If cur < 5 and cur+dif > 5 then
  6732. fix = fix- fval
  6733. end if
  6734. dif = dif * inc
  6735. dif = dif-fix
  6736. SetDrum player,drum, -dif
  6737. Else
  6738. if val = 0 Then
  6739. SetDrum player,drum, 0 ' reset the drum to abs. zero
  6740. Else
  6741. dif = 11 - cur
  6742. dif = dif + val
  6743. dif = dif * inc
  6744. dif = dif-fval
  6745. SetDrum player,drum, -dif
  6746. end if
  6747. end if
  6748. reels(player, drum) = val
  6749.  
  6750. Case 3:
  6751. 'TB3.text = val
  6752.  
  6753. if val > cur then
  6754. dif =val - cur
  6755. fix =0
  6756. If cur < 5 and cur+dif > 5 then
  6757. fix = fix- fval
  6758. end if
  6759. dif = dif * inc
  6760. dif = dif-fix
  6761.  
  6762. SetDrum player,drum, -dif
  6763. Else
  6764. if val = 0 Then
  6765. SetDrum player,drum, 0 ' reset the drum to abs. zero
  6766. Else
  6767. dif = 11 - cur
  6768. dif = dif + val
  6769. dif = dif * inc
  6770. dif = dif-fval
  6771. SetDrum player,drum, -dif
  6772. end if
  6773.  
  6774. end if
  6775. reels(player, drum) = val
  6776.  
  6777. Case 4:
  6778. 'TB4.text = val
  6779.  
  6780. if val > cur then
  6781. dif =val - cur
  6782. fix =0
  6783. If cur < 5 and cur+dif > 5 then
  6784. fix = fix- fval
  6785. end if
  6786. dif = dif * inc
  6787. dif = dif-fix
  6788. SetDrum player,drum, -dif
  6789. Else
  6790. if val = 0 Then
  6791. SetDrum player,drum, 0 ' reset the drum to abs. zero
  6792. Else
  6793. dif = 11 - cur
  6794. dif = dif + val
  6795. dif = dif * inc
  6796. dif = dif-fval
  6797. SetDrum player,drum, -dif
  6798. end if
  6799.  
  6800. end if
  6801. reels(player, drum) = val
  6802.  
  6803. Case 5:
  6804. 'TB5.text = val
  6805.  
  6806. if val > cur then
  6807. dif =val - cur
  6808. fix =0
  6809. If cur < 5 and cur+dif > 5 then
  6810. fix = fix- fval
  6811. end if
  6812. dif = dif * inc
  6813. dif = dif-fix
  6814. SetDrum player,drum, -dif
  6815. Else
  6816. if val = 0 Then
  6817. SetDrum player,drum, 0 ' reset the drum to abs. zero
  6818. Else
  6819. dif = 11 - cur
  6820. dif = dif + val
  6821. dif = dif * inc
  6822. dif = dif-fval
  6823. SetDrum player,drum, -dif
  6824. end if
  6825.  
  6826. end if
  6827. reels(player, drum) = val
  6828. End Select
  6829.  
  6830. end if
  6831. end if
  6832. End Sub
  6833.  
  6834. Dim EMMODE: EMMODE = 0
  6835. 'Dim Score10,Score100,Score1000,Score10000,Score100000
  6836. Dim Score1000,Score10000,Score100000, ActivePLayer
  6837. Dim nplayer,playr,value,curscr,curplayr
  6838.  
  6839. ' EMMODE = 1
  6840. 'ex: UpdateVRReels 0-3, 0-3, 0-199999, n/a, n/a, n/a, n/a, n/a, n/a
  6841. ' EMMODE = 0
  6842. 'ex: UpdateVRReels 0-3, 0-3, n/a, 0-1,0-99999 ,0-9999, 0-999, 0-99, 0-9
  6843.  
  6844. Sub UpdateVRReels (Player,nReels ,nScore, n100K, Score10000 ,Score1000,Score100,Score10,Score1)
  6845.  
  6846. ' to-do find out if player is one or zero based, if 1 based subtract 1.
  6847. value =nScore'Score(Player)
  6848. nplayer = Player -1
  6849.  
  6850. curscr = value
  6851. curplayr = nplayer
  6852.  
  6853.  
  6854. scores(0,1) = scores(0,0)
  6855. scores(0,0) = 0
  6856. scores(1,1) = scores(1,0)
  6857. scores(1,0) = 0
  6858. scores(2,1) = scores(2,0)
  6859. scores(2,0) = 0
  6860. scores(3,1) = scores(3,0)
  6861. scores(3,0) = 0
  6862.  
  6863. For ix =0 to 6
  6864. reels(0, ix) =0
  6865. reels(1, ix) =0
  6866. reels(2, ix) =0
  6867. reels(3, ix) =0
  6868. Next
  6869.  
  6870. For ix =0 to 4
  6871.  
  6872. SetDrum ix, 1 , 0
  6873. SetDrum ix, 2 , 0
  6874. SetDrum ix, 3 , 0
  6875. SetDrum ix, 4 , 0
  6876. SetDrum ix, 5 , 0
  6877.  
  6878. Next
  6879.  
  6880. For playr =0 to nReels
  6881.  
  6882. if EMMODE = 0 then
  6883. If (ActivePLayer) = playr Then
  6884. nplayer = playr
  6885.  
  6886. SetReel nplayer, 1 , Score10000 : SetScore nplayer,0,Score10000
  6887. SetReel nplayer, 2 , Score1000 : SetScore nplayer,1,Score1000
  6888. SetReel nplayer, 3 , Score100 : SetScore nplayer,2,Score100
  6889. SetReel nplayer, 4 , Score10 : SetScore nplayer,3,Score10
  6890. SetReel nplayer, 5 , 0 : SetScore nplayer,4,0 ' assumes ones position is always zero
  6891.  
  6892. else
  6893. nplayer = playr
  6894. value =scores(nplayer, 1)
  6895.  
  6896.  
  6897. ' do ten thousands
  6898. if(value >= 90000) then: SetReel nplayer, 1 , 9 : SetScore nplayer,0,9 : value = value - 90000: end if
  6899. if(value >= 80000) then: SetReel nplayer, 1 , 8 : SetScore nplayer,0,8 : value = value - 80000: end if
  6900. if(value >= 70000) then: SetReel nplayer, 1 , 7 : SetScore nplayer,0,7 : value = value - 70000: end if
  6901. if(value >= 60000) then: SetReel nplayer, 1 , 6 : SetScore nplayer,0,6 : value = value - 60000: end if
  6902. if(value >= 50000) then: SetReel nplayer, 1 , 5 : SetScore nplayer,0,5 : value = value - 50000: end if
  6903. if(value >= 40000) then: SetReel nplayer, 1 , 4 : SetScore nplayer,0,4 : value = value - 40000: end if
  6904. if(value >= 30000) then: SetReel nplayer, 1 , 3 : SetScore nplayer,0,3 : value = value - 30000: end if
  6905. if(value >= 20000) then: SetReel nplayer, 1 , 2 : SetScore nplayer,0,2 : value = value - 20000: end if
  6906. if(value >= 10000) then: SetReel nplayer, 1 , 1 : SetScore nplayer,0,1 : value = value - 10000: end if
  6907.  
  6908.  
  6909. ' do thousands
  6910. if(value >= 9000) then: SetReel nplayer, 2 , 9 : SetScore nplayer,1,9 : value = value - 9000: end if
  6911. if(value >= 8000) then: SetReel nplayer, 2 , 8 : SetScore nplayer,1,8 : value = value - 8000: end if
  6912. if(value >= 7000) then: SetReel nplayer, 2 , 7 : SetScore nplayer,1,7 : value = value - 7000: end if
  6913. if(value >= 6000) then: SetReel nplayer, 2 , 6 : SetScore nplayer,1,6 : value = value - 6000: end if
  6914. if(value >= 5000) then: SetReel nplayer, 2 , 5 : SetScore nplayer,1,5 : value = value - 5000: end if
  6915. if(value >= 4000) then: SetReel nplayer, 2 , 4 : SetScore nplayer,1,4 : value = value - 4000: end if
  6916. if(value >= 3000) then: SetReel nplayer, 2 , 3 : SetScore nplayer,1,3 : value = value - 3000: end if
  6917. if(value >= 2000) then: SetReel nplayer, 2 , 2 : SetScore nplayer,1,2 : value = value - 2000: end if
  6918. if(value >= 1000) then: SetReel nplayer, 2 , 1 : SetScore nplayer,1,1 : value = value - 1000: end if
  6919.  
  6920. 'do hundreds
  6921.  
  6922. if(value >= 900) then: SetReel nplayer, 3 , 9 : SetScore nplayer,2,9 : value = value - 900: end if
  6923. if(value >= 800) then: SetReel nplayer, 3 , 8 : SetScore nplayer,2,8 : value = value - 800: end if
  6924. if(value >= 700) then: SetReel nplayer, 3 , 7 : SetScore nplayer,2,7 : value = value - 700: end if
  6925. if(value >= 600) then: SetReel nplayer, 3 , 6 : SetScore nplayer,2,6 : value = value - 600: end if
  6926. if(value >= 500) then: SetReel nplayer, 3 , 5 : SetScore nplayer,2,5 : value = value - 500: end if
  6927. if(value >= 400) then: SetReel nplayer, 3 , 4 : SetScore nplayer,2,4 : value = value - 400: end if
  6928. if(value >= 300) then: SetReel nplayer, 3 , 3 : SetScore nplayer,2,3 : value = value - 300: end if
  6929. if(value >= 200) then: SetReel nplayer, 3 , 2 : SetScore nplayer,2,2 : value = value - 200: end if
  6930. if(value >= 100) then: SetReel nplayer, 3 , 1 : SetScore nplayer,2,1 : value = value - 100: end if
  6931.  
  6932. 'do tens
  6933. if(value >= 90) then: SetReel nplayer, 4 , 9 : SetScore nplayer,3,9 : value = value - 90: end if
  6934. if(value >= 80) then: SetReel nplayer, 4 , 8 : SetScore nplayer,3,8 : value = value - 80: end if
  6935. if(value >= 70) then: SetReel nplayer, 4 , 7 : SetScore nplayer,3,7 : value = value - 70: end if
  6936. if(value >= 60) then: SetReel nplayer, 4 , 6 : SetScore nplayer,3,6 : value = value - 60: end if
  6937. if(value >= 50) then: SetReel nplayer, 4 , 5 : SetScore nplayer,3,5 : value = value - 50: end if
  6938. if(value >= 40) then: SetReel nplayer, 4 , 4 : SetScore nplayer,3,4 : value = value - 40: end if
  6939. if(value >= 30) then: SetReel nplayer, 4 , 3 : SetScore nplayer,3,3 : value = value - 30: end if
  6940. if(value >= 20) then: SetReel nplayer, 4 , 2 : SetScore nplayer,3,2 : value = value - 20: end if
  6941. if(value >= 10) then: SetReel nplayer, 4 , 1 : SetScore nplayer,3,1 : value = value - 10: end if
  6942.  
  6943. 'do ones
  6944. if(value >= 9) then: SetReel nplayer, 5 , 9 : SetScore nplayer,4,9 : value = value - 9: end if
  6945. if(value >= 8) then: SetReel nplayer, 5 , 8 : SetScore nplayer,4,8 : value = value - 8: end if
  6946. if(value >= 7) then: SetReel nplayer, 5 , 7 : SetScore nplayer,4,7 : value = value - 7: end if
  6947. if(value >= 6) then: SetReel nplayer, 5 , 6 : SetScore nplayer,4,6 : value = value - 6: end if
  6948. if(value >= 5) then: SetReel nplayer, 5 , 5 : SetScore nplayer,4,5 : value = value - 5: end if
  6949. if(value >= 4) then: SetReel nplayer, 5 , 4 : SetScore nplayer,4,4 : value = value - 4: end if
  6950. if(value >= 3) then: SetReel nplayer, 5 , 3 : SetScore nplayer,4,3 : value = value - 3: end if
  6951. if(value >= 2) then: SetReel nplayer, 5 , 2 : SetScore nplayer,4,2 : value = value - 2: end if
  6952. if(value >= 1) then: SetReel nplayer, 5 , 1 : SetScore nplayer,4,1 : value = value - 1: end if
  6953.  
  6954. end if
  6955. Else
  6956. If curplayr = playr Then
  6957. nplayer = curplayr
  6958. value = curscr
  6959. else
  6960. value =scores(playr, 1) ' store score
  6961. nplayer = playr
  6962. end if
  6963.  
  6964. scores(playr, 0) = 0 ' reset score
  6965.  
  6966. if(value >= 100000) then
  6967.  
  6968. 'if nplayer = 0 then: FL100K1.visible = 1
  6969. 'if nplayer = 1 then: FL100K2.visible = 1
  6970. 'if nplayer = 2 then: FL100K3.visible = 1
  6971. 'if nplayer = 3 then: FL100K4.visible = 1
  6972.  
  6973. value = value - 100000
  6974.  
  6975. end if
  6976.  
  6977.  
  6978. ' do ten thousands
  6979. if(value >= 90000) then: SetReel nplayer, 1 , 9 : SetScore nplayer,0,9 : value = value - 90000: end if
  6980. if(value >= 80000) then: SetReel nplayer, 1 , 8 : SetScore nplayer,0,8 : value = value - 80000: end if
  6981. if(value >= 70000) then: SetReel nplayer, 1 , 7 : SetScore nplayer,0,7 : value = value - 70000: end if
  6982. if(value >= 60000) then: SetReel nplayer, 1 , 6 : SetScore nplayer,0,6 : value = value - 60000: end if
  6983. if(value >= 50000) then: SetReel nplayer, 1 , 5 : SetScore nplayer,0,5 : value = value - 50000: end if
  6984. if(value >= 40000) then: SetReel nplayer, 1 , 4 : SetScore nplayer,0,4 : value = value - 40000: end if
  6985. if(value >= 30000) then: SetReel nplayer, 1 , 3 : SetScore nplayer,0,3 : value = value - 30000: end if
  6986. if(value >= 20000) then: SetReel nplayer, 1 , 2 : SetScore nplayer,0,2 : value = value - 20000: end if
  6987. if(value >= 10000) then: SetReel nplayer, 1 , 1 : SetScore nplayer,0,1 : value = value - 10000: end if
  6988.  
  6989.  
  6990. ' do thousands
  6991. if(value >= 9000) then: SetReel nplayer, 2 , 9 : SetScore nplayer,1,9 : value = value - 9000: end if
  6992. if(value >= 8000) then: SetReel nplayer, 2 , 8 : SetScore nplayer,1,8 : value = value - 8000: end if
  6993. if(value >= 7000) then: SetReel nplayer, 2 , 7 : SetScore nplayer,1,7 : value = value - 7000: end if
  6994. if(value >= 6000) then: SetReel nplayer, 2 , 6 : SetScore nplayer,1,6 : value = value - 6000: end if
  6995. if(value >= 5000) then: SetReel nplayer, 2 , 5 : SetScore nplayer,1,5 : value = value - 5000: end if
  6996. if(value >= 4000) then: SetReel nplayer, 2 , 4 : SetScore nplayer,1,4 : value = value - 4000: end if
  6997. if(value >= 3000) then: SetReel nplayer, 2 , 3 : SetScore nplayer,1,3 : value = value - 3000: end if
  6998. if(value >= 2000) then: SetReel nplayer, 2 , 2 : SetScore nplayer,1,2 : value = value - 2000: end if
  6999. if(value >= 1000) then: SetReel nplayer, 2 , 1 : SetScore nplayer,1,1 : value = value - 1000: end if
  7000.  
  7001. 'do hundreds
  7002.  
  7003. if(value >= 900) then: SetReel nplayer, 3 , 9 : SetScore nplayer,2,9 : value = value - 900: end if
  7004. if(value >= 800) then: SetReel nplayer, 3 , 8 : SetScore nplayer,2,8 : value = value - 800: end if
  7005. if(value >= 700) then: SetReel nplayer, 3 , 7 : SetScore nplayer,2,7 : value = value - 700: end if
  7006. if(value >= 600) then: SetReel nplayer, 3 , 6 : SetScore nplayer,2,6 : value = value - 600: end if
  7007. if(value >= 500) then: SetReel nplayer, 3 , 5 : SetScore nplayer,2,5 : value = value - 500: end if
  7008. if(value >= 400) then: SetReel nplayer, 3 , 4 : SetScore nplayer,2,4 : value = value - 400: end if
  7009. if(value >= 300) then: SetReel nplayer, 3 , 3 : SetScore nplayer,2,3 : value = value - 300: end if
  7010. if(value >= 200) then: SetReel nplayer, 3 , 2 : SetScore nplayer,2,2 : value = value - 200: end if
  7011. if(value >= 100) then: SetReel nplayer, 3 , 1 : SetScore nplayer,2,1 : value = value - 100: end if
  7012.  
  7013. 'do tens
  7014. if(value >= 90) then: SetReel nplayer, 4 , 9 : SetScore nplayer,3,9 : value = value - 90: end if
  7015. if(value >= 80) then: SetReel nplayer, 4 , 8 : SetScore nplayer,3,8 : value = value - 80: end if
  7016. if(value >= 70) then: SetReel nplayer, 4 , 7 : SetScore nplayer,3,7 : value = value - 70: end if
  7017. if(value >= 60) then: SetReel nplayer, 4 , 6 : SetScore nplayer,3,6 : value = value - 60: end if
  7018. if(value >= 50) then: SetReel nplayer, 4 , 5 : SetScore nplayer,3,5 : value = value - 50: end if
  7019. if(value >= 40) then: SetReel nplayer, 4 , 4 : SetScore nplayer,3,4 : value = value - 40: end if
  7020. if(value >= 30) then: SetReel nplayer, 4 , 3 : SetScore nplayer,3,3 : value = value - 30: end if
  7021. if(value >= 20) then: SetReel nplayer, 4 , 2 : SetScore nplayer,3,2 : value = value - 20: end if
  7022. if(value >= 10) then: SetReel nplayer, 4 , 1 : SetScore nplayer,3,1 : value = value - 10: end if
  7023.  
  7024. 'do ones
  7025. if(value >= 9) then: SetReel nplayer, 5 , 9 : SetScore nplayer,4,9 : value = value - 9: end if
  7026. if(value >= 8) then: SetReel nplayer, 5 , 8 : SetScore nplayer,4,8 : value = value - 8: end if
  7027. if(value >= 7) then: SetReel nplayer, 5 , 7 : SetScore nplayer,4,7 : value = value - 7: end if
  7028. if(value >= 6) then: SetReel nplayer, 5 , 6 : SetScore nplayer,4,6 : value = value - 6: end if
  7029. if(value >= 5) then: SetReel nplayer, 5 , 5 : SetScore nplayer,4,5 : value = value - 5: end if
  7030. if(value >= 4) then: SetReel nplayer, 5 , 4 : SetScore nplayer,4,4 : value = value - 4: end if
  7031. if(value >= 3) then: SetReel nplayer, 5 , 3 : SetScore nplayer,4,3 : value = value - 3: end if
  7032. if(value >= 2) then: SetReel nplayer, 5 , 2 : SetScore nplayer,4,2 : value = value - 2: end if
  7033. if(value >= 1) then: SetReel nplayer, 5 , 1 : SetScore nplayer,4,1 : value = value - 1: end if
  7034.  
  7035.  
  7036. end if
  7037.  
  7038. Next
  7039. End Sub
  7040.  
  7041. '******************************************************
  7042. '******* VR Plunger *******
  7043. '******************************************************
  7044.  
  7045. Sub TimerVRPlunger_Timer
  7046. If VR_Primary_plunger.Y < 2185.833 then
  7047. VR_Primary_plunger.Y = VR_Primary_plunger.Y + 4
  7048. End If
  7049. End Sub
  7050.  
  7051. Sub TimerVRPlunger2_Timer
  7052. VR_Primary_plunger.Y = 2070.833 + (5* Plunger.Position) -20
  7053. End Sub
  7054.  
  7055.  
  7056. '******************************************************
  7057. '******* VR Backglass Lighting *******
  7058. '******************************************************
  7059.  
  7060. Sub FlasherMatch
  7061. If Match = 100 Then FlM00.visible = 1 : FlM00A.visible = 1 : FlM00B.visible = 1 Else FlM00.visible = 0 : FlM00A.visible = 0 : FlM00B.visible = 0 End If
  7062. If Match = 10 Then FlM10.visible = 1 : FlM10A.visible = 1 : FlM10B.visible = 1 Else FlM10.visible = 0 : FlM10A.visible = 0 : FlM10B.visible = 0 End If
  7063. If Match = 20 Then FlM20.visible = 1 : FlM20A.visible = 1 : FlM20B.visible = 1 Else FlM20.visible = 0 : FlM20A.visible = 0 : FlM20B.visible = 0 End If
  7064. If Match = 30 Then FlM30.visible = 1 : FlM30A.visible = 1 : FlM30B.visible = 1 Else FlM30.visible = 0 : FlM30A.visible = 0 : FlM30B.visible = 0 End If
  7065. If Match = 40 Then FlM40.visible = 1 : FlM40A.visible = 1 : FlM40B.visible = 1 Else FlM40.visible = 0 : FlM40A.visible = 0 : FlM40B.visible = 0 End If
  7066. If Match = 50 Then FlM50.visible = 1 : FlM50A.visible = 1 : FlM50B.visible = 1 Else FlM50.visible = 0 : FlM50A.visible = 0 : FlM50B.visible = 0 End If
  7067. If Match = 60 Then FlM60.visible = 1 : FlM60A.visible = 1 : FlM60B.visible = 1 Else FlM60.visible = 0 : FlM60A.visible = 0 : FlM60B.visible = 0 End If
  7068. If Match = 70 Then FlM70.visible = 1 : FlM70A.visible = 1 : FlM70B.visible = 1 Else FlM70.visible = 0 : FlM70A.visible = 0 : FlM70B.visible = 0 End If
  7069. If Match = 80 Then FlM80.visible = 1 : FlM80A.visible = 1 : FlM80B.visible = 1 Else FlM80.visible = 0 : FlM80A.visible = 0 : FlM80B.visible = 0 End If
  7070. If Match = 90 Then FlM90.visible = 1 : FlM90A.visible = 1 : FlM90B.visible = 1 Else FlM90.visible = 0 : FlM90A.visible = 0 : FlM90B.visible = 0 End If
  7071. End Sub
  7072.  
  7073. Sub FlasherBalls
  7074. If BallInPlay = 1 Then FlBIP1.visible = 1 : FlBIP1A.visible = 1 Else FlBIP1.visible = 0 : FlBIP1A.visible = 0 End If
  7075. If BallInPlay = 2 Then FlBIP2.visible = 1 : FlBIP2A.visible = 1 Else FlBIP2.visible = 0 : FlBIP2A.visible = 0 End If
  7076. If BallInPlay = 3 Then FlBIP3.visible = 1 : FlBIP3A.visible = 1 Else FlBIP3.visible = 0 : FlBIP3A.visible = 0 End If
  7077. If BallInPlay = 4 Then FlBIP4.visible = 1 : FlBIP4A.visible = 1 Else FlBIP4.visible = 0 : FlBIP4A.visible = 0 End If
  7078. If BallInPlay = 5 Then FlBIP5.visible = 1 : FlBIP5A.visible = 1 Else FlBIP5.visible = 0 : FlBIP5A.visible = 0 End If
  7079. End Sub
  7080.  
  7081. Sub FlasherPlayers
  7082. If Players = 1 Then FlPl1.visible = 1 Else FlPl1.visible = 0 End If
  7083. If Players = 2 Then FlPl2.visible = 1 Else FlPl2.visible = 0 End If
  7084. If Players = 3 Then FlPl3.visible = 1 Else FlPl3.visible = 0 End If
  7085. If Players = 4 Then FlPl4.visible = 1 Else FlPl4.visible = 0 End If
  7086. End Sub
  7087.  
  7088. Sub FlasherCurrentPlayer
  7089. If Player = 1 Then : for each Object in VRBGPlayer1 : object.visible = 1 : Next: Else : for each Object in VRBGPlayer1 : object.visible = 0 :Next
  7090. If Player = 2 Then : for each Object in VRBGPlayer2 : object.visible = 1 : Next: Else : for each Object in VRBGPlayer2 : object.visible = 0 :Next
  7091. If Player = 3 Then : for each Object in VRBGPlayer3 : object.visible = 1 : Next: Else : for each Object in VRBGPlayer3 : object.visible = 0 :Next
  7092. If Player = 4 Then : for each Object in VRBGPlayer4 : object.visible = 1 : Next: Else : for each Object in VRBGPlayer4 : object.visible = 0 :Next
  7093. End Sub
  7094.  
  7095. Sub Flasher100k
  7096. If Player = 1 Then for each Object in VRBG100k1 : object.visible = 1 : next
  7097. If Player = 2 Then for each Object in VRBG100k2 : object.visible = 1 : next
  7098. If Player = 3 Then for each Object in VRBG100k3 : object.visible = 1 : next
  7099. If Player = 4 Then for each Object in VRBG100k4 : object.visible = 1 : next
  7100. If Player = 4 Then for each Object in VRBG100k4 : object.visible = 1 : next
  7101. End Sub
  7102.  
  7103. Dim OTT1, OTT2, OTT3, OTT4
  7104.  
  7105. Sub FlasherOverTheTop
  7106. If Player = 1 Then
  7107. If OTT1 = 0 Then
  7108. If VRRoom > 0 Then
  7109. for each Object in VRBGOTT : object.visible = 1 : Next
  7110. TimerOTT.enabled = 1
  7111. End If
  7112. Playsound "BuzzerOTT"
  7113. OTT1 = 1
  7114. End If
  7115. End If
  7116. If Player = 2 Then
  7117. If OTT2 = 0 Then
  7118. If VRRoom > 0 Then
  7119. for each Object in VRBGOTT : object.visible = 1 : Next
  7120. TimerOTT.enabled = 1
  7121. End If
  7122. Playsound "BuzzerOTT"
  7123. OTT2 = 1
  7124. End If
  7125. End IF
  7126. If Player = 3 Then
  7127. If OTT3 = 0 Then
  7128. If VRRoom > 0 Then
  7129. for each Object in VRBGOTT : object.visible = 1 : Next
  7130. TimerOTT.enabled = 1
  7131. End If
  7132. Playsound "BuzzerOTT"
  7133. OTT3 = 1
  7134. End If
  7135. End IF
  7136. If Player = 4 Then
  7137. If OTT4 = 0 Then
  7138. If VRRoom > 0 Then
  7139. for each Object in VRBGOTT : object.visible = 1 : Next
  7140. TimerOTT.enabled = 1
  7141. End If
  7142. Playsound "BuzzerOTT"
  7143. OTT4 = 1
  7144. End If
  7145. End IF
  7146. End Sub
  7147.  
  7148. Sub TimerOTT_Timer
  7149. for each Object in VRBGOTT : object.visible = 0 : Next
  7150. TimerOTT.enabled = False
  7151. End Sub
  7152.  
  7153.  
  7154. If VRRoom > 0 Then
  7155. SetBackglass
  7156. center_objects_em
  7157. for each Object in VRCabinet : object.visible = 1 : next
  7158. If VRRoom = 1 Then
  7159. for each Object in VRRoomMinimal : object.visible = 1 : next
  7160. BeerTimer.enabled = False
  7161. ClockTimer1.enabled = False
  7162. End If
  7163. If VRRoom = 2 Then
  7164. for each Object in VRRoomFancy : object.visible = 1 : next
  7165. BeerTimer.enabled = True
  7166. ClockTimer1.enabled = True
  7167. VRFrontRightLeg.z = 45
  7168. VRLeftFrontLeg.z = 45
  7169. VRBackRightLeg.z = 60
  7170. VRBackLeftLeg.z = 60
  7171. End If
  7172.  
  7173. vn_CabinetGroupVR.visible = 1
  7174. vn_CabinetGroup.visible = 0
  7175.  
  7176. For each obj in DesktopCrap
  7177. obj.visible=False
  7178. next
  7179.  
  7180. Else
  7181.  
  7182. for each Object in VRCabinet : object.visible = 0 : next
  7183. for each Object in VRBGAll : object.visible = 0 : next
  7184. TimerVRPlunger.Enabled = False
  7185. TimerVRPlunger2.Enabled = False
  7186. BeerTimer.enabled = False
  7187. ClockTimer1.enabled = False
  7188. End If
  7189.  
  7190. ' ***** Beer Bubble Code - Rawd *****
  7191. Sub BeerTimer_Timer()
  7192.  
  7193. Randomize(21)
  7194. BeerBubble1.z = BeerBubble1.z + Rnd(1)*0.5
  7195. if BeerBubble1.z > -771 then BeerBubble1.z = -955
  7196. BeerBubble2.z = BeerBubble2.z + Rnd(1)*1
  7197. if BeerBubble2.z > -768 then BeerBubble2.z = -955
  7198. BeerBubble3.z = BeerBubble3.z + Rnd(1)*1
  7199. if BeerBubble3.z > -768 then BeerBubble3.z = -955
  7200. BeerBubble4.z = BeerBubble4.z + Rnd(1)*0.75
  7201. if BeerBubble4.z > -774 then BeerBubble4.z = -955
  7202. BeerBubble5.z = BeerBubble5.z + Rnd(1)*1
  7203. if BeerBubble5.z > -771 then BeerBubble5.z = -955
  7204. BeerBubble6.z = BeerBubble6.z + Rnd(1)*1
  7205. if BeerBubble6.z > -774 then BeerBubble6.z = -955
  7206. BeerBubble7.z = BeerBubble7.z + Rnd(1)*0.8
  7207. if BeerBubble7.z > -768 then BeerBubble7.z = -955
  7208. BeerBubble8.z = BeerBubble8.z + Rnd(1)*1
  7209. if BeerBubble8.z > -771 then BeerBubble8.z = -955
  7210. End Sub
  7211.  
  7212.  
  7213.  
  7214. ' ***************** VR Clock code below - THANKS RASCAL ******************
  7215. Dim CurrentMinute ' for VR clock
  7216. ' VR Clock code below....
  7217. Sub ClockTimer1_Timer()
  7218. Pminutes.RotAndTra2 = (Minute(Now())+(Second(Now())/100))*6
  7219. Phours.RotAndTra2 = Hour(Now())*30+(Minute(Now())/2)
  7220. Pseconds.RotAndTra2 = (Second(Now()))*6
  7221. CurrentMinute=Minute(Now())
  7222. End Sub
  7223. ' ********************** END CLOCK CODE *********************************
  7224.  
  7225.  
Advertisement
Add Comment
Please, Sign In to add comment