Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'DOF Config by Outhere
- '101 Left Flipper
- '102 Right Flipper
- '103 Left Slingshot
- '104
- '105 Right Slingshot
- '106
- '107 Bumper Center - Top
- '108 Bumper Center - Bottom
- '109 Bumper Left
- '110 Bumper Right
- '111
- '112
- '113
- '114
- '115
- '116
- '117
- '118
- '119
- '126 Ball Release
- '136 Saucer Left
- '139 Saucer Center
- '140 Knocker
- '141 Chimes
- '142 Chimes
- '143 Chimes
- Option Explicit
- Randomize
- Randomize
- ExecuteGlobal GetTextFile("core.vbs")
- On Error Resume Next
- ExecuteGlobal GetTextFile("Controller.vbs")
- Const cGameName = "bowarrowEM_1974"
- '*******************************************
- ' User Options
- '*******************************************
- '----- Shadow Options -----
- Const DynamicBallShadowsOn = 1 '0 = no dynamic ball shadow, 1 = enable dynamic ball shadow
- '----- General Sound Options -----
- Const VolumeDial = 0.8 ' Recommended values should be no greater than 1.
- '----- Phsyics Mods -----
- Const RubberizerEnabled = 1 '0 = normal flip rubber, 1 = more lively rubber for flips
- Const FlipperCoilRampupMode = 1 '0 = fast, 1 = medium, 2 = slow (tap passes should work)
- Const TargetBouncerEnabled = 1 '0 = normal standup targets, 1 = bouncy targets
- Const TargetBouncerFactor = 0.7 'Level of bounces. 0.0 thru 1.0, higher value is more bounciness (don't go above 1)
- Dim DesktopMode: DesktopMode = Table1.ShowDT
- Dim obj
- If DesktopMode = True Then 'Show Desktop components
- Ramp292.visible=1
- Ramp347.visible=1
- For each obj in DesktopCrap
- obj.visible=true
- next
- 'Primitive13.visible=1
- Else
- Ramp292.visible=0
- Ramp347.visible=0
- For each obj in DesktopCrap
- obj.visible=false
- next
- 'Primitive13.visible=0
- End if
- '**********************************************************************************************************
- '**********************************************************************************************************
- '**********************************************************************************************************
- '**********************************************************************************************************
- '**********************************************************************************************************
- Dim Controller ' B2S
- Dim B2SScore ' B2S Score Displayed
- Const HSFileName="BowAndArrowEM_74VPX.txt"
- Const B2STableName="BowAndArrowEM_1974"
- Const LMEMTableConfig="LMEMTables.txt"
- Const LMEMShadowConfig="LMEMShadows.txt"
- Dim EnableBallShadow
- Dim EnableFlipperShadow
- '* 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
- Const ScoreMotorAdjustment=1
- '* this is a debug setting to use an older scoring routine vs a newer score routine - don't change this value
- Const ScoreAdditionAdjustment=1
- dim ScoreChecker
- dim CheckAllScores
- dim sortscores(4)
- dim sortplayers(4)
- Dim B2SOn
- Dim B2SFrameCounter
- Dim BackglassBallFlagColor
- Dim TextStr,TextStr2,TiltEndsGame
- Dim i
- Dim BallsPerGame
- Dim InProgress
- Dim BallInPlay
- Dim CreditsPerCoin
- Dim Score100K(4)
- Dim Score(4)
- Dim ScoreDisplay(4)
- Dim HighScorePaid(4)
- Dim HighScore
- Dim HighScoreReward
- Dim BonusMultiplier
- Dim Credits
- Dim Match
- Dim Replay1
- Dim Replay2
- Dim Replay3
- Dim Replay4
- Dim Replay1Paid(4)
- Dim Replay2Paid(4)
- Dim Replay3Paid(4)
- Dim Replay4Paid(4)
- Dim TableTilted
- Dim TiltCount
- Dim OperatorMenu
- Dim BonusBooster
- Dim BonusBoosterCounter
- Dim BonusCounter
- Dim HoleCounter
- Dim Ones
- Dim Tens
- Dim Hundreds
- Dim Thousands
- Dim Player
- Dim Players
- Dim rst
- Dim bonuscountdown
- Dim TempMultiCounter
- dim TempPlayerup
- dim RotatorTemp
- Dim bump1
- Dim bump2
- Dim bump3
- Dim bump4
- Dim LastChime10
- Dim LastChime100
- Dim LastChime1000
- Dim Score10
- Dim Score100
- Dim targettempscore
- Dim CardLightOption
- Dim HorseshoeCounter
- Dim DropTargetCounter
- Dim LeftTargetCounter
- Dim RightTargetCounter
- Dim MotorRunning
- Dim Replay1Table(15)
- Dim Replay2Table(15)
- Dim Replay3Table(15)
- Dim Replay4Table(15)
- Dim ReplayTableSet
- Dim ReplayLevel
- Dim ReplayTableMax
- Dim BonusSpecialThreshold
- Dim TargetLightsOn
- Dim AdvanceLightCounter
- dim bonustempcounter
- dim raceRflag
- dim raceAflag
- dim raceCflag
- dim raceEflag
- dim race5flag
- Dim LStep, LStep2, RStep, xx
- Dim ReelCounter
- Dim BallCounter
- Dim BallReelAddStart(12)
- Dim BallReelAddFrames(12)
- Dim BallReelDropStart(12)
- Dim BallReelDropFrames(12)
- Dim EightLit
- Dim X
- Dim Y
- Dim Z
- Dim AddABall
- Dim AddABallFrames
- Dim DropABall
- Dim DropABallFrames
- Dim CurrentFrame
- Dim BonusMotorRunning
- Dim QueuedBonusAdds
- Dim QueuedBonusDrops
- Dim ChimesOn
- Dim TempLightTracker
- Dim TargetLeftFlag
- Dim TargetCenterFlag
- Dim TargetRightFlag
- Dim SpecialLightsFlag
- Dim AlternatingRelay
- Dim ZeroToNineUnit
- Dim StarTriggerValue
- Dim Kicker1Hold,Kicker2Hold, Kicker3Hold, Kicker4Hold, Kicker5Hold
- Dim KickerHold1,KickerHold2,KickerHold3,KickerHold4,KickerHold5
- Dim mHole,mHole2
- Dim TargetSequenceCompleted,SpecialLightCounter,HighComplete,LowComplete
- Dim ArrowTargetCounter1, ArrowTargetCounter2, ArrowTargetCounter3, ArrowTargetCounter4, tKickerTCount
- Dim SpinPos,Spin,Count,Count1,Count2,Count3,Reset,LitSpinner,SpecialOption, dooralreadyopen, bgpos, GoldBonusCounter, ScoreMotorStepper
- Spin=Array("5","6","7","8","9","10","J","Q","K","A")
- Sub Table1_Init()
- OperatorMenuBackdrop.image = "PostitBL"
- For XOpt = 1 to MaxOption
- Eval("OperatorOption"&XOpt).image = "PostitBL"
- next
- For XOpt = 1 to 256
- Eval("Option"&XOpt).image = "PostItBL"
- next
- LoadEM
- Count=0
- Count1=0
- Count2=0
- Count3=0
- Reset=0
- ZeroToNineUnit=Int(Rnd*10)
- Kicker1Hold=0
- EightLit=0
- BallCounter=0
- ReelCounter=0
- AddABall=0
- DropABall=0
- HideOptions
- SetupReplayTables
- PlasticsOff
- BumpersOff
- OperatorMenu=0
- HighScore=0
- MotorRunning=0
- HighScoreReward=1
- Credits=0
- BallsPerGame=5
- ReplayLevel=9
- TiltEndsGame=0
- ChimesOn=1
- SpecialOption=10
- AlternatingRelay=1
- CardLightOption=1
- BackglassBallFlagColor=1
- loadhs
- if HighScore=0 then HighScore=5000
- TableTilted=false
- Match=int(Rnd*10)
- MatchReel.SetValue((Match)+1)
- SpinPos=int(Rnd*10)
- ' CanPlayReel.SetValue(0)
- GameOverReel.SetValue(1)
- BallInPlayReel.SetValue(0)
- TiltReel.SetValue(1)
- For each obj in PlayerHuds
- obj.state=0
- next
- For each obj in PlayerScores
- obj.ResetToZero
- next
- Replay1=Replay1Table(ReplayLevel)
- Replay2=Replay2Table(ReplayLevel)
- Replay3=Replay3Table(ReplayLevel)
- Replay4=Replay4Table(ReplayLevel)
- BonusCounter=0
- HoleCounter=0
- InstructCard.image="IC"
- RefreshReplayCard
- CurrentFrame=0
- AdvanceLightCounter=0
- Players=0
- RotatorTemp=1
- InProgress=false
- TargetLightsOn=false
- If SpinPos>9 then SpinPos=9
- For each obj in LeftSpinLights
- obj.state=0
- next
- For each obj in RightSpinLights
- obj.state=0
- next
- LeftSpinLights(SpinPos).state=1
- RightSpinLights(SpinPos).state=1
- SpinningLightTimer.enabled=false
- For each obj in KickerLights
- obj.state=0
- next
- For each obj in TargetLights
- obj.state=0
- next
- If B2SOn Then
- if Match=0 then
- Controller.B2SSetMatch 10
- else
- Controller.B2SSetMatch Match
- end if
- Controller.B2SSetScoreRolloverPlayer1 0
- Controller.B2SSetScoreRolloverPlayer2 0
- Controller.B2SSetScoreRolloverPlayer3 0
- Controller.B2SSetScoreRolloverPlayer4 0
- 'Controller.B2SSetScore 3,HighScore
- Controller.B2SSetTilt 1
- Controller.B2SSetCredits Credits
- Controller.B2SSetGameOver 1
- End If
- for i=1 to 4
- player=i
- If B2SOn Then
- Controller.B2SSetScorePlayer player, 0
- End If
- next
- bump1=1
- bump2=1
- bump3=1
- bump4=1
- InitPauser5.enabled=true
- If B2SOn then
- Controller.B2SSetData 60+SpinPos,1
- end if
- If Credits > 0 Then DOF 129, DOFOn: L6.state=1
- End Sub
- Sub Table1_exit()
- savehs
- SaveLMEMConfig
- If B2SOn Then Controller.Stop
- end sub
- Sub SpinningLightTimer_timer
- ArrowTargetCounter1=ArrowTargetCounter1+1
- If ArrowTargetCounter1>4 then ArrowTargetCounter1=0
- For each obj in KickerLights
- obj.state=0
- next
- For each obj in TargetLights
- obj.state=0
- next
- KickerLights(ArrowTargetCounter1).state=1
- TargetLights(ArrowTargetCounter1).state=1
- end sub
- Sub BlinkingLogo_timer
- LogoReel.SetValue(int((Rnd * 100) / 25))
- end sub
- Sub TimerTitle1_timer
- if B2SOn then
- if raceRflag=1 then
- Controller.B2SSetData 11,0
- raceRflag=0
- else
- Controller.B2SSetData 11,1
- raceRflag=1
- end if
- end if
- end sub
- Sub TimerTitle2_timer
- if B2SOn then
- if raceAflag=1 then
- Controller.B2SSetData 12,0
- raceAflag=0
- else
- Controller.B2SSetData 12,1
- raceAflag=1
- end if
- end if
- end sub
- Sub TimerTitle3_timer
- if B2SOn then
- if raceCflag=1 then
- Controller.B2SSetData 13,0
- raceCflag=0
- else
- Controller.B2SSetData 13,1
- raceCflag=1
- end if
- end if
- end sub
- Sub TimerTitle4_timer
- if B2SOn then
- if raceEflag=1 then
- Controller.B2SSetData 14,0
- raceEflag=0
- else
- Controller.B2SSetData 14,1
- raceEflag=1
- end if
- end if
- end sub
- Sub TimerTitle5_timer
- if B2SOn then
- if race5flag=1 then
- Controller.B2SSetData 15,0
- race5flag=0
- else
- Controller.B2SSetData 15,1
- race5flag=1
- end if
- end if
- end sub
- Sub Table1_KeyDown(ByVal keycode)
- ' GNMOD
- if EnteringInitials then
- CollectInitials(keycode)
- exit sub
- end if
- if EnteringOptions then
- CollectOptions(keycode)
- exit sub
- end if
- If keycode = PlungerKey Then
- Plunger.PullBack
- PlungerPulled = 1
- End If
- if keycode = LeftFlipperKey and InProgress = false then
- OperatorMenuTimer.Enabled = true
- end if
- ' END GNMOD
- If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
- lfpress = 1
- SolLFlipper(1)
- End If
- If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
- rfpress = 1
- SolRFlipper(1)
- End If
- If keycode = LeftTiltKey Then
- Nudge 90, 2
- TiltIt
- End If
- If keycode = RightTiltKey Then
- Nudge 270, 2
- TiltIt
- End If
- If keycode = CenterTiltKey Then
- Nudge 0, 2
- TiltIt
- End If
- If keycode = MechanicalTilt Then
- TiltCount=2
- TiltIt
- End If
- If keycode = AddCreditKey or keycode = 4 then
- If B2SOn Then
- 'Controller.B2SSetScorePlayer6 HighScore
- End If
- playsound "coinin"
- AddSpecial2
- end if
- if keycode = 5 then
- playsound "coinin"
- AddSpecial2
- keycode= StartGameKey
- end if
- if keycode = StartGameKey and Credits>0 and InProgress=true and Players>0 and Players<4 and BallInPlay<2 then
- Credits=Credits-1
- If Credits <1 Then DOF 129, DOFOff:L6.state=0
- CreditsReel.SetValue(Credits)
- EMReel7.SetValue(Credits)
- Players=Players+1
- for each obj in CanPlayLights
- obj.state=0
- next
- CanPlayLights(Players-1).state=1
- playsound "click"
- If B2SOn Then
- Controller.B2SSetCanPlay Players
- Controller.B2SSetCredits Credits
- End If
- end if
- if keycode=StartGameKey and Credits>0 and InProgress=false and Players=0 and EnteringOptions = 0 then
- 'GNMOD
- OperatorMenuTimer.Enabled = false
- 'END GNMOD
- Credits=Credits-1
- If Credits < 1 Then DOF 129, DOFOff:L6.state=0
- CreditsReel.SetValue(Credits)
- Players=1
- for each obj in CanPlayLights
- obj.state=0
- next
- CanPlayLights(Players-1).state=1
- MatchReel.SetValue(0)
- Player=1
- RolloverReel1.SetValue(0)
- RolloverReel2.SetValue(0)
- RolloverReel3.SetValue(0)
- RolloverReel4.SetValue(0)
- playsound "startup_norm"
- TempPlayerUp=Player
- ' PlayerUpRotator.enabled=true
- GameOverReel.SetValue(0)
- rst=0
- BallInPlay=1
- InProgress=true
- resettimer.enabled=true
- BonusMultiplier=1
- If B2SOn Then
- Controller.B2SSetTilt 0
- Controller.B2SSetGameOver 0
- Controller.B2SSetMatch 0
- Controller.B2SSetCredits Credits
- 'Controller.B2SSetScore 3,HighScore
- Controller.B2SSetCanPlay 1
- Controller.B2SSetPlayerUp 1
- 'Controller.B2SSetBallInPlay BallInPlay
- Controller.B2SSetScoreRolloverPlayer1 0
- Controller.B2SSetScoreRolloverPlayer2 0
- Controller.B2SSetScoreRolloverPlayer3 0
- Controller.B2SSetScoreRolloverPlayer4 0
- Controller.B2SSetData 99,1
- Controller.B2SSetData 11,0
- Controller.B2SSetData 12,0
- Controller.B2SSetData 13,0
- Controller.B2SSetData 14,0
- Controller.B2SSetData 15,0
- Controller.B2SSetData 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- Controller.B2SSetData 80+Player,1
- End If
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- ' obj.ResetToZero
- obj.Visible=true
- next
- For each obj in PlayerHuds
- obj.state=0
- next
- PlayerHuds(Player-1).state=1
- end If
- end if
- If keycode = LeftMagnaSave Then bLutActive = True
- If keycode = RightMagnaSave Then
- If bLutActive Then NextLUT: End If
- End If
- End Sub
- Sub Table1_KeyUp(ByVal keycode)
- ' GNMOD
- if EnteringInitials then
- exit sub
- end if
- If keycode = PlungerKey Then
- if PlungerPulled = 0 then
- exit sub
- end if
- PlaySound"plungerrelease"
- Plunger.Fire
- End If
- if keycode = LeftFlipperKey then
- OperatorMenuTimer.Enabled = false
- end if
- ' END GNMOD
- If keycode = LeftFlipperKey and InProgress=true and TableTilted=false Then
- lfpress = 0
- leftflipper.eostorqueangle = EOSA
- leftflipper.eostorque = EOST
- SolLFlipper(0)
- End If
- If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
- rfpress = 0
- rightflipper.eostorqueangle = EOSA
- rightflipper.eostorque = EOST
- SolRFlipper(0)
- End If
- If keycode = LeftMagnaSave Then bLutActive = False
- End Sub
- Sub Drain_Hit()
- Drain.DestroyBall
- PlaySound "fx_drain"
- DOF 137, DOFPulse
- Pause4Bonustimer.enabled=true
- End Sub
- Sub Trigger1_Unhit()
- DOF 138, DOFPulse
- End Sub
- Sub Pause4Bonustimer_timer
- Pause4Bonustimer.enabled=0
- ScoreGoldBonus
- End Sub
- '***********************************
- ' Walls
- '***********************************
- Sub RubberWallSwitches_Hit(idx)
- if TableTilted=false then
- AddScore(10)
- end if
- end Sub
- '****************************************************
- '****************************************************
- ' Kickers
- Dim TempBonusMultiplier
- Dim TempBonusCount
- sub sw10_Hit()
- Dim speedx,speedy,finalspeed
- speedx=activeball.velx
- speedy=activeball.vely
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- if TableTilted=true then
- tKickerTCount=0
- sw10.Timerenabled=1
- exit sub
- end if
- TempBonusMultiplier=BonusMultiplier
- BonusMultiplier=1
- TempBonusCount=GoldBonusCounter
- ScoreSilverBonus
- KickerHolder1.enabled=1
- end sub
- Sub KickerHolder1_timer
- If MotorRunning<>0 then EXIT SUB
- If CollectSilverBonus.enabled=true then EXIT SUB
- KickerHolder1.enabled=0
- tKickerTCount=0
- sw10.timerenabled=1
- end sub
- Sub sw10_Timer()
- tKickerTCount=tKickerTCount+1
- if tKickerTCount>2 then tKickerTCount=0
- select case tKickerTCount
- case 1:
- 'Pkickarm1.rotz=15
- Playsound SoundFXDOF("saucer",136,DOFPulse,DOFContactors)
- DOF 128, 2
- sw10.kick 205,15
- case 2:
- 'GoldBonusCounter=TempBonusCount
- BonusMultiplier=TempBonusMultiplier
- sw10.timerenabled=0
- 'Pkickarm1.rotz=0
- end Select
- end sub
- sub sw2_Hit()
- Dim speedx,speedy,finalspeed
- speedx=activeball.velx
- speedy=activeball.vely
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- if TableTilted=true then
- tKickerTCount=0
- sw2.kick 154,15
- exit sub
- end if
- TempBonusMultiplier=BonusMultiplier
- BonusMultiplier=1
- TempBonusCount=GoldBonusCounter
- SpinningLightTimer.enabled=false
- KickerHolder2.enabled=1
- end sub
- Sub KickerHolder2_timer
- If MotorRunning<>0 then EXIT SUB
- tKickerTCount=0
- KickerHolder2.enabled=0
- sw2.timerenabled=1
- end sub
- Sub sw2_Timer()
- if MotorRunning<>0 then EXIT SUB
- tKickerTCount=tKickerTCount+1
- if tKickerTCount>8 then tKickerTCount=0
- select case tKickerTCount
- case 1:
- AddScore(1000)
- case 2:
- if ArrowTargetCounter1>0 then AddScore(1000)
- case 3:
- if ArrowTargetCounter1>1 then AddScore(1000)
- case 4:
- if ArrowTargetCounter1>2 then AddScore(1000)
- case 5:
- if ArrowTargetCounter1>3 then AddScore(1000)
- case 6:
- if ArrowTargetCounter1=2 then OpenGate(1)
- case 7:
- ToggleAlternatingRelay
- 'Pkickarm1.rotz=15
- Playsound SoundFXDOF("saucer",139,DOFPulse,DOFContactors)
- DOF 128, 2
- sw2.kick 154,15
- case 8:
- SpinningLightTimer.enabled=true
- sw2.timerenabled=0
- 'Pkickarm1.rotz=0
- end Select
- end sub
- '**************************************
- Sub AddSpecial()
- PlaySound"knocker"
- DOF 140, DOFPulse
- Credits=Credits+1
- L6.state=1
- DOF 129, DOFOn
- if Credits>15 then Credits=15
- If B2SOn Then
- Controller.B2SSetCredits Credits
- End If
- CreditsReel.SetValue(Credits)
- End Sub
- Sub AddSpecial2()
- PlaySound"click"
- Credits=Credits+1
- L6.state=1
- DOF 129, DOFOn
- if Credits>15 then Credits=15
- If B2SOn Then
- Controller.B2SSetCredits Credits
- End If
- CreditsReel.SetValue(Credits)
- End Sub
- Sub ToggleAlternatingRelay
- if AlternatingRelay=1 then
- AlternatingRelay=0
- else
- AlternatingRelay=1
- end if
- LightAltRelay
- end sub
- Sub LightAltRelay
- L72.state=0
- If GoldBonusCounter<10 then exit sub
- if AlternatingRelay=0 then
- L72.state=1
- L44.state=1
- L43.state=0
- else
- L72.state=0
- L44.state=0
- L43.state=1
- end if
- end sub
- sub LightBumpers
- end sub
- Sub CloseGateTrigger_Hit()
- if dooralreadyopen=1 then
- closeg.enabled=true
- end if
- End Sub
- sub openg_timer
- bottgate(bgpos).isdropped=true
- bgpos=bgpos-1
- bottgate(bgpos).isdropped=false
- primgate.RotY=30+(bgpos*10)
- if bgpos=0 then
- playsound "postup"
- RightOutlaneLight.state=1
- openg.enabled=false
- dooralreadyopen=1
- end if
- end sub
- sub closeg_timer
- closeg.interval=10
- bottgate(bgpos).isdropped=true
- bgpos=bgpos+1
- bottgate(bgpos).isdropped=false
- primgate.RotY=30+(bgpos*10)
- if bgpos=6 then
- RightOutlaneLight.state=0
- closeg.enabled=false
- dooralreadyopen=0
- end if
- end sub
- sub IncreaseGoldBonus
- if GoldBonusCounter<10 then
- If GoldBonusCounter<10 then
- 'GoldBonus(GoldBonusCounter).state=0
- GoldBonusCounter=GoldBonusCounter+1
- GoldBonus(GoldBonusCounter).state=1
- elseIf GoldBonusCounter>9 then
- GoldBonus(GoldBonusCounter-10).state=0
- GoldBonusCounter=GoldBonusCounter+1
- GoldBonus(10).state=1
- GoldBonus(GoldBonusCounter-10).state=1
- end if
- end if
- If GoldBonusCounter>9 then LightAltRelay
- end sub
- sub ScoreSilverBonus
- ScoreMotorStepper=0
- CollectSilverBonus.interval=135
- CollectSilverBonus.enabled=1
- end sub
- sub CollectSilverBonus_timer
- if MotorRunning=1 then
- exit sub
- end if
- if TempBonusCount<1 then
- CollectSilverBonus.enabled=0
- else
- Select Case ScoreMotorStepper
- case 0,1,2,3,4:
- AddScore(1000)
- TempBonusCount=TempBonusCount-1
- case 5,6:
- case 7:
- PlaySound"BallyClunk"
- end select
- ScoreMotorStepper=ScoreMotorStepper+1
- If ScoreMotorStepper>7 then
- ScoreMotorStepper=0
- end if
- end if
- end sub
- sub ScoreGoldBonus
- ScoreMotorStepper=0
- CollectGoldBonus.interval=135
- CollectGoldBonus.enabled=1
- end sub
- sub CollectGoldBonus_timer
- if MotorRunning=1 then
- exit sub
- end if
- if GoldBonusCounter<1 then
- CollectGoldBonus.enabled=0
- NextBallDelay.enabled=true
- else
- If L63.state=1 then
- Select case ScoreMotorStepper
- case 0,1,3,4:
- AddScore(1000)
- case 2,5:
- PlaySound"BallyClunk"
- If GoldBonusCounter>10 then
- GoldBonus(GoldBonusCounter-10).state=0
- else
- GoldBonus(GoldBonusCounter).state=0
- end if
- GoldBonusCounter=GoldBonusCounter-1
- if GoldBonusCounter>=0 then
- If GoldBonusCounter<=10 then
- GoldBonus(GoldBonusCounter).state=1
- elseif GoldBonusCounter>10 then
- GoldBonus(10).state=1
- GoldBonus(GoldBonusCounter-10).state=1
- end if
- end if
- case 6:
- case 7:
- end select
- ScoreMotorStepper=ScoreMotorStepper+1
- If ScoreMotorStepper>7 then
- ScoreMotorStepper=0
- end if
- else
- Select Case ScoreMotorStepper
- case 0,1,2,3,4:
- AddScore(1000)
- If GoldBonusCounter>10 then
- GoldBonus(GoldBonusCounter-10).state=0
- else
- GoldBonus(GoldBonusCounter).state=0
- end if
- GoldBonusCounter=GoldBonusCounter-1
- if GoldBonusCounter>=0 then
- If GoldBonusCounter<=10 then
- GoldBonus(GoldBonusCounter).state=1
- elseif GoldBonusCounter>10 then
- GoldBonus(10).state=1
- GoldBonus(GoldBonusCounter-10).state=1
- end if
- end if
- case 5,6:
- 'PlaySound"BallyClunk"
- case 7:
- PlaySound"BallyClunk"
- end select
- ScoreMotorStepper=ScoreMotorStepper+1
- If ScoreMotorStepper>7 then
- ScoreMotorStepper=0
- end if
- end if
- end if
- end sub
- Sub ResetBallDrops
- HoleCounter=0
- IncreaseGoldBonus
- End Sub
- Sub LightsOut
- BonusCounter=0
- HoleCounter=0
- StopSound "buzz"
- StopSound "buzzL"
- end sub
- Sub ResetBalls()
- TempMultiCounter=BallsPerGame-BallInPlay
- ResetBallDrops
- BonusMultiplier=1
- TableTilted=false
- TiltReel.SetValue(0)
- If B2Son then
- Controller.B2SSetTilt 0
- end if
- BumpersOn
- L65.state=0
- L66.state=0
- L67.state=0
- L68.state=0
- L85.state=1
- L86.state=1
- L87.state=1
- L88.state=1
- L72.state=0
- L44.state=0
- L43.state=0
- L63.state=0
- OpenGate(0)
- PlasticsOn
- 'CreateBallID BallRelease
- Ballrelease.CreateSizedBall 25
- Ballrelease.Kick 40,7
- DOF 126, DOFPulse
- BallInPlayReel.SetValue(BallInPlay)
- InstructCard.image="IC"
- End Sub
- sub resettimer_timer
- rst=rst+1
- if rst>1 and rst<12 then
- ResetReelsToZero(1)
- ResetReelsToZero(2)
- end if
- if rst=16 then
- playsound "StartBall1"
- end if
- if rst=18 then
- newgame
- resettimer.enabled=false
- end if
- end sub
- Sub ResetReelsToZero(reelzeroflag)
- dim d1(5)
- dim d2(5)
- dim scorestring1, scorestring2
- If reelzeroflag=1 then
- scorestring1=CStr(Score(1))
- scorestring2=CStr(Score(2))
- scorestring1=right("00000" & scorestring1,5)
- scorestring2=right("00000" & scorestring2,5)
- for i=0 to 4
- d1(i)=CInt(mid(scorestring1,i+1,1))
- d2(i)=CInt(mid(scorestring2,i+1,1))
- next
- for i=0 to 4
- if d1(i)>0 then
- d1(i)=d1(i)+1
- if d1(i)>9 then d1(i)=0
- end if
- if d2(i)>0 then
- d2(i)=d2(i)+1
- if d2(i)>9 then d2(i)=0
- end if
- next
- Score(1)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
- Score(2)=(d2(0)*10000) + (d2(1)*1000) + (d2(2)*100) + (d2(3)*10) + d2(4)
- If B2SOn Then
- Controller.B2SSetScorePlayer 1, Score(1)
- Controller.B2SSetScorePlayer 2, Score(2)
- End If
- PlayerScores(0).SetValue(Score(1))
- PlayerScoresOn(0).SetValue(Score(1))
- PlayerScores(1).SetValue(Score(2))
- PlayerScoresOn(1).SetValue(Score(2))
- scorestring1=CStr(Score(3))
- scorestring2=CStr(Score(4))
- scorestring1=right("00000" & scorestring1,5)
- scorestring2=right("00000" & scorestring2,5)
- for i=0 to 4
- d1(i)=CInt(mid(scorestring1,i+1,1))
- d2(i)=CInt(mid(scorestring2,i+1,1))
- next
- for i=0 to 4
- if d1(i)>0 then
- d1(i)=d1(i)+1
- if d1(i)>9 then d1(i)=0
- end if
- if d2(i)>0 then
- d2(i)=d2(i)+1
- if d2(i)>9 then d2(i)=0
- end if
- next
- Score(3)=(d1(0)*10000) + (d1(1)*1000) + (d1(2)*100) + (d1(3)*10) + d1(4)
- Score(4)=(d2(0)*10000) + (d2(1)*1000) + (d2(2)*100) + (d2(3)*10) + d2(4)
- If B2SOn Then
- Controller.B2SSetScorePlayer 3, Score(3)
- Controller.B2SSetScorePlayer 4, Score(4)
- End If
- PlayerScores(2).SetValue(Score(3))
- PlayerScoresOn(2).SetValue(Score(3))
- PlayerScores(3).SetValue(Score(4))
- PlayerScoresOn(3).SetValue(Score(4))
- end if
- end sub
- sub NextBallDelay_timer()
- NextBallDelay.enabled=false
- nextball
- end sub
- sub newgame
- InProgress=true
- queuedscore=0
- for i = 1 to 4
- Score(i)=0
- Score100K(1)=0
- HighScorePaid(i)=false
- Replay1Paid(i)=false
- Replay2Paid(i)=false
- Replay3Paid(i)=false
- Replay4Paid(i)=false
- next
- If B2SOn Then
- Controller.B2SSetTilt 0
- Controller.B2SSetGameOver 0
- Controller.B2SSetMatch 0
- ' Controller.B2SSetScorePlayer1 0
- ' Controller.B2SSetScorePlayer2 0
- ' Controller.B2SSetScorePlayer3 0
- ' Controller.B2SSetScorePlayer4 0
- Controller.B2SSetBallInPlay BallInPlay
- Controller.B2SSetData 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- Controller.B2SSetData 80+Player,1
- End if
- SpinningLightTimer.enabled=true
- BumpersOn
- GoldBonusCounter=0
- LowComplete=false
- HighComplete=false
- For each obj in GoldBonus
- obj.state=0
- next
- ResetBalls
- End sub
- sub nextball
- If L4.state=1 then
- L4.state=0
- ShootAgainReel.Setvalue(0)
- If B2SOn Then
- Controller.B2SSetShootAgain 0
- end if
- else
- Player=Player+1
- end if
- If Player>Players Then
- BallInPlay=BallInPlay+1
- If BallInPlay>BallsPerGame then
- PlaySound("MotorLeer")
- InProgress=false
- If B2SOn Then
- Controller.B2SSetGameOver 1
- Controller.B2SSetPlayerUp 0
- Controller.B2SSetBallInPlay 0
- Controller.B2SSetCanPlay 0
- Controller.B2SSetData 99,0
- Controller.B2SSetData 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- End If
- For each obj in PlayerHuds
- obj.state=0
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- obj.visible=1
- Next
- end If
- SpinningLightTimer.enabled=false
- For each obj in KickerLights
- obj.state=0
- next
- For each obj in TargetLights
- obj.state=0
- next
- GameOverReel.SetValue(1)
- InstructCard.image="IC"
- BallInPlayReel.SetValue(0)
- ' CanPlayReel.SetValue(0)
- LeftFlipper.RotateToStart
- RightFlipper.RotateToStart
- LightsOut
- BumpersOff
- PlasticsOff
- checkmatch
- CheckHighScore
- Players=0
- HighScoreTimer.interval=100
- HighScoreTimer.enabled=True
- TimerTitle1.enabled=1
- TimerTitle2.enabled=1
- TimerTitle3.enabled=1
- TimerTitle4.enabled=1
- Else
- Player=1
- If B2SOn Then
- Controller.B2SSetPlayerUp Player
- Controller.B2SSetBallInPlay BallInPlay
- Controller.B2SSetData 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- Controller.B2SSetData 80+Player,1
- End If
- ' PlaySound("RotateThruPlayers")
- TempPlayerUp=Player
- ' PlayerUpRotator.enabled=true
- PlayStartBall.enabled=true
- For each obj in PlayerHuds
- obj.state=0
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- obj.visible=1
- Next
- PlayerHuds(Player-1).state=1
- end If
- ResetBalls
- End If
- Else
- If B2SOn Then
- Controller.B2SSetPlayerUp Player
- Controller.B2SSetBallInPlay BallInPlay
- Controller.B2SSetData 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- Controller.B2SSetData 80+Player,1
- End If
- ' PlaySound("RotateThruPlayers")
- TempPlayerUp=Player
- ' PlayerUpRotator.enabled=true
- PlayStartBall.enabled=true
- For each obj in PlayerHuds
- obj.state=0
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- obj.visible=1
- Next
- PlayerHuds(Player-1).state=1
- end If
- ResetBalls
- End If
- End sub
- sub CheckHighScore
- Dim playertops
- dim si
- dim sj
- dim stemp
- dim stempplayers
- for i=1 to 4
- sortscores(i)=0
- sortplayers(i)=0
- next
- playertops=0
- for i = 1 to Players
- sortscores(i)=Score(i)
- sortplayers(i)=i
- next
- for si = 1 to Players
- for sj = 1 to Players-1
- if sortscores(sj)>sortscores(sj+1) then
- stemp=sortscores(sj+1)
- stempplayers=sortplayers(sj+1)
- sortscores(sj+1)=sortscores(sj)
- sortplayers(sj+1)=sortplayers(sj)
- sortscores(sj)=stemp
- sortplayers(sj)=stempplayers
- end if
- next
- next
- ScoreChecker=4
- CheckAllScores=1
- NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
- savehs
- end sub
- sub checkmatch
- Dim tempmatch
- if TableTilted=true and TiltEndsGame=1 then
- exit sub
- end if
- tempmatch=Int(Rnd*10)
- Match=tempmatch*10
- MatchReel.SetValue(tempmatch+1)
- If B2SOn Then
- If Match = 0 Then
- Controller.B2SSetMatch 100
- Else
- Controller.B2SSetMatch Match
- End If
- End if
- for i = 1 to Players
- if Match=(Score(i) mod 100) then
- AddSpecial
- end if
- next
- end sub
- Sub TiltTimer_Timer()
- if TiltCount > 0 then TiltCount = TiltCount - 1
- if TiltCount = 0 then
- TiltTimer.Enabled = False
- end if
- end sub
- Sub TiltIt()
- TiltCount = TiltCount + 1
- if TiltCount = 3 then
- TableTilted=True
- If TiltEndsGame=1 then
- BallInPlay=BallsPerGame
- If B2SOn Then
- Controller.B2SSetGameOver 1
- Controller.B2SSetPlayerUp 0
- Controller.B2SSetBallInPlay 0
- Controller.B2SSetCanPlay 0
- End If
- For each obj in PlayerHuds
- obj.state=0
- next
- GameOverReel.SetValue(1)
- InstructCard.image="IC"
- end if
- PlasticsOff
- BumpersOff
- if dooralreadyopen=1 then
- closeg.enabled=true
- end if
- LeftFlipper.RotateToStart
- RightFlipper.RotateToStart
- StopSound "buzz"
- StopSound "buzzL"
- TiltReel.SetValue(1)
- If B2Son then
- Controller.B2SSetTilt 1
- end if
- else
- TiltTimer.Interval = 500
- TiltTimer.Enabled = True
- end if
- end sub
- Sub PlayStartBall_timer()
- PlayStartBall.enabled=false
- PlaySound("StartBall2-5")
- end sub
- Sub PlayerUpRotator_timer()
- If RotatorTemp<5 then
- TempPlayerUp=TempPlayerUp+1
- If TempPlayerUp>4 then
- TempPlayerUp=1
- end if
- If B2SOn Then
- Controller.B2SSetPlayerUp TempPlayerUp
- End If
- else
- if B2SOn then
- Controller.B2SSetPlayerUp Player
- end if
- PlayerUpRotator.enabled=false
- RotatorTemp=1
- end if
- RotatorTemp=RotatorTemp+1
- end sub
- sub savehs
- ' Based on Black's Highscore routines
- Dim FileObj
- Dim ScoreFile
- Set FileObj=CreateObject("Scripting.FileSystemObject")
- If Not FileObj.FolderExists(UserDirectory) then
- Exit Sub
- End if
- Set ScoreFile=FileObj.CreateTextFile(UserDirectory & HSFileName,True)
- ScoreFile.WriteLine 1
- ScoreFile.WriteLine Credits
- scorefile.writeline BallsPerGame
- scorefile.writeline 0
- scorefile.writeline CardLightOption
- scorefile.writeline SpecialOption
- scorefile.writeline ReplayLevel
- for xx=1 to 5
- scorefile.writeline HSScore(xx)
- next
- for xx=1 to 5
- scorefile.writeline HSName(xx)
- next
- ScoreFile.Close
- Set ScoreFile=Nothing
- Set FileObj=Nothing
- end sub
- sub SaveLMEMConfig
- Dim FileObj
- Dim LMConfig
- dim temp1
- dim tempb2s
- tempb2s=0
- if B2SOn=true then
- tempb2s=1
- else
- tempb2s=0
- end if
- Set FileObj=CreateObject("Scripting.FileSystemObject")
- If Not FileObj.FolderExists(UserDirectory) then
- Exit Sub
- End if
- Set LMConfig=FileObj.CreateTextFile(UserDirectory & LMEMTableConfig,True)
- LMConfig.WriteLine tempb2s
- LMConfig.Close
- Set LMConfig=Nothing
- Set FileObj=Nothing
- end Sub
- sub LoadLMEMConfig
- Dim FileObj
- Dim LMConfig
- dim tempC
- dim tempb2s
- Set FileObj=CreateObject("Scripting.FileSystemObject")
- If Not FileObj.FolderExists(UserDirectory) then
- Exit Sub
- End if
- If Not FileObj.FileExists(UserDirectory & LMEMTableConfig) then
- Exit Sub
- End if
- Set LMConfig=FileObj.GetFile(UserDirectory & LMEMTableConfig)
- Set TextStr2=LMConfig.OpenAsTextStream(1,0)
- If (TextStr2.AtEndOfStream=True) then
- Exit Sub
- End if
- tempC=TextStr2.ReadLine
- TextStr2.Close
- tempb2s=cdbl(tempC)
- if tempb2s=0 then
- B2SOn=false
- else
- B2SOn=true
- end if
- Set LMConfig=Nothing
- Set FileObj=Nothing
- end sub
- sub loadhs
- ' Based on Black's Highscore routines
- Dim FileObj
- Dim ScoreFile
- dim temp1
- dim temp2
- dim temp3
- dim temp4
- dim temp5
- dim temp6
- dim temp7
- dim temp8
- dim temp9
- dim temp10
- dim temp11
- dim temp12
- dim temp13
- dim temp14
- dim temp15
- dim temp16
- dim temp17
- Set FileObj=CreateObject("Scripting.FileSystemObject")
- If Not FileObj.FolderExists(UserDirectory) then
- Exit Sub
- End if
- If Not FileObj.FileExists(UserDirectory & HSFileName) then
- Exit Sub
- End if
- Set ScoreFile=FileObj.GetFile(UserDirectory & HSFileName)
- Set TextStr=ScoreFile.OpenAsTextStream(1,0)
- If (TextStr.AtEndOfStream=True) then
- Exit Sub
- End if
- temp1=TextStr.ReadLine
- temp2=textstr.readline
- temp3=textstr.readline
- temp4=textstr.readline
- temp5=textstr.readline
- temp7=textstr.readline
- temp6=textstr.readline
- HighScore=cdbl(temp1)
- if HighScore=1 then
- temp8=textstr.readline
- temp9=textstr.readline
- temp10=textstr.readline
- temp11=textstr.readline
- temp12=textstr.readline
- temp13=textstr.readline
- temp14=textstr.readline
- temp15=textstr.readline
- temp16=textstr.readline
- temp17=textstr.readline
- end if
- TextStr.Close
- if HighScore=1 then
- Credits=cdbl(temp2)
- BallsPerGame=cdbl(temp3)
- TiltEndsGame=cdbl(temp4)
- CardLightOption=cdbl(temp5)
- SpecialOption=cdbl(temp7)
- ReplayLevel=cdbl(temp6)
- HSScore(1) = int(temp8)
- HSScore(2) = int(temp9)
- HSScore(3) = int(temp10)
- HSScore(4) = int(temp11)
- HSScore(5) = int(temp12)
- HSName(1) = temp13
- HSName(2) = temp14
- HSName(3) = temp15
- HSName(4) = temp16
- HSName(5) = temp17
- end if
- Set ScoreFile=Nothing
- Set FileObj=Nothing
- end sub
- Sub DisplayHighScore
- end sub
- sub InitPauser5_timer
- If B2SOn Then
- 'Controller.B2SSetScore 3,HighScore
- End If
- DisplayHighScore
- CreditsReel.SetValue(Credits)
- InitPauser5.enabled=false
- end sub
- sub BumpersOff
- end sub
- sub BumpersOn
- end sub
- Sub PlasticsOn
- For each obj in GI
- obj.state=1
- next
- end sub
- Sub PlasticsOff
- For each obj in GI
- obj.state=0
- next
- end sub
- Sub SetupReplayTables
- Replay1Table(1)=68000
- Replay1Table(2)=71000
- Replay1Table(3)=74000
- Replay1Table(4)=77000
- Replay1Table(5)=80000
- Replay1Table(6)=91000
- Replay1Table(7)=94000
- Replay1Table(8)=97000
- Replay1Table(9)=103000
- Replay1Table(10)=132000
- Replay1Table(11)=71000
- Replay1Table(12)=74000
- Replay1Table(13)=78000
- Replay1Table(14)=999000
- Replay1Table(15)=999000
- Replay2Table(1)=111000
- Replay2Table(2)=114000
- Replay2Table(3)=117000
- Replay2Table(4)=119000
- Replay2Table(5)=118000
- Replay2Table(6)=143000
- Replay2Table(7)=145000
- Replay2Table(8)=148000
- Replay2Table(9)=150000
- Replay2Table(10)=150000
- Replay2Table(11)=85000
- Replay2Table(12)=88000
- Replay2Table(13)=92000
- Replay2Table(14)=999000
- Replay2Table(15)=999000
- Replay3Table(1)=145000
- Replay3Table(2)=147000
- Replay3Table(3)=149000
- Replay3Table(4)=150000
- Replay3Table(5)=149000
- Replay3Table(6)=182000
- Replay3Table(7)=181000
- Replay3Table(8)=181000
- Replay3Table(9)=184000
- Replay3Table(10)=168000
- Replay3Table(11)=93000
- Replay3Table(12)=96000
- Replay3Table(13)=999000
- Replay3Table(14)=999000
- Replay3Table(15)=999000
- Replay4Table(1)=999000
- Replay4Table(2)=999000
- Replay4Table(3)=999000
- Replay4Table(4)=999000
- Replay4Table(5)=999000
- Replay4Table(6)=999000
- Replay4Table(7)=999000
- Replay4Table(8)=999000
- Replay4Table(9)=999000
- Replay4Table(10)=999000
- Replay4Table(11)=999000
- Replay4Table(12)=999000
- Replay4Table(13)=999000
- Replay4Table(14)=999000
- Replay4Table(15)=999000
- ReplayTableMax=9
- end sub
- Sub RefreshReplayCard
- Dim tempst1
- Dim tempst2
- tempst1=FormatNumber(BallsPerGame,0)
- tempst2=FormatNumber(ReplayLevel,0)
- BallCard.image = "BC"+tempst1
- Replay1=Replay1Table(ReplayLevel)
- Replay2=Replay2Table(ReplayLevel)
- Replay3=Replay3Table(ReplayLevel)
- Replay4=Replay4Table(ReplayLevel)
- ReplayCard.image = "SC" + tempst2
- end sub
- '****************************************
- ' SCORE MOTOR
- '****************************************
- ScoreMotorTimer.Enabled = 1
- ScoreMotorTimer.Interval = 135 '135
- AddScoreTimer.Enabled = 1
- AddScoreTimer.Interval = 135
- Dim queuedscore
- Dim MotorMode
- Dim MotorPosition
- Sub SetMotor(y)
- Select Case ScoreMotorAdjustment
- Case 0:
- queuedscore=queuedscore+y
- Case 1:
- If MotorRunning<>1 And InProgress=true then
- queuedscore=queuedscore+y
- end if
- end Select
- end sub
- Sub SetMotor2(x)
- If MotorRunning<>1 And InProgress=true then
- MotorRunning=1
- Select Case x
- Case 50:
- MotorMode=10
- MotorPosition=5
- BumpersOff
- Case 100:
- AddScore(100)
- MotorRunning=0
- Case 500:
- MotorMode=100
- MotorPosition=5
- BumpersOff
- LightBumpers
- Case 1000:
- AddScore(1000)
- MotorRunning=0
- Case 2000:
- MotorMode=1000
- MotorPosition=2
- BumpersOff
- Case 3000:
- MotorMode=1000
- MotorPosition=3
- BumpersOff
- Case 4000:
- MotorMode=1000
- MotorPosition=4
- BumpersOff
- Case 5000:
- MotorMode=1000
- MotorPosition=5
- BumpersOff
- LightBumpers
- End Select
- End If
- End Sub
- Sub AddScoreTimer_Timer
- Dim tempscore
- If MotorRunning<>1 And InProgress=true then
- if queuedscore>=5000 then
- tempscore=5000
- queuedscore=queuedscore-5000
- SetMotor2(5000)
- exit sub
- end if
- if queuedscore>=4000 then
- tempscore=4000
- queuedscore=queuedscore-4000
- SetMotor2(4000)
- exit sub
- end if
- if queuedscore>=3000 then
- tempscore=3000
- queuedscore=queuedscore-3000
- SetMotor2(3000)
- exit sub
- end if
- if queuedscore>=2000 then
- tempscore=2000
- queuedscore=queuedscore-2000
- SetMotor2(2000)
- exit sub
- end if
- if queuedscore>=1000 then
- tempscore=1000
- queuedscore=queuedscore-1000
- SetMotor2(1000)
- exit sub
- end if
- if queuedscore>=500 then
- tempscore=500
- queuedscore=queuedscore-500
- SetMotor2(500)
- exit sub
- end if
- if queuedscore>=100 then
- tempscore=100
- queuedscore=queuedscore-100
- SetMotor2(100)
- exit sub
- end if
- if queuedscore>=50 then
- tempscore=50
- queuedscore=queuedscore-50
- SetMotor2(50)
- exit sub
- end if
- End If
- end Sub
- Sub ScoreMotorTimer_Timer
- If MotorPosition > 0 Then
- Select Case MotorPosition
- Case 5,4,3,2:
- If MotorMode=1000 Then
- AddScore(1000)
- end if
- if MotorMode=100 then
- AddScore(100)
- End If
- if MotorMode=10 then
- AddScore(10)
- End if
- MotorPosition=MotorPosition-1
- Case 1:
- If MotorMode=1000 Then
- AddScore(1000)
- end if
- If MotorMode=100 then
- AddScore(100)
- End If
- if MotorMode=10 then
- AddScore(10)
- End if
- MotorPosition=0:MotorRunning=0:BumpersOn:ToggleAlternatingRelay
- End Select
- End If
- End Sub
- Sub AddScore(x)
- If TableTilted=true then exit sub
- Select Case ScoreAdditionAdjustment
- Case 0:
- AddScore1(x)
- Case 1:
- AddScore2(x)
- end Select
- end sub
- Sub AddScore1(x)
- ' debugtext.text=score
- Select Case x
- Case 1:
- PlayChime(10)
- Score(Player)=Score(Player)+1
- Case 10:
- PlayChime(10)
- Score(Player)=Score(Player)+10
- ' debugscore=debugscore+10
- Case 100:
- PlayChime(100)
- Score(Player)=Score(Player)+100
- ' debugscore=debugscore+100
- Case 1000:
- PlayChime(100)
- Score(Player)=Score(Player)+1000
- ' debugscore=debugscore+1000
- End Select
- PlayerScores(Player-1).AddValue(x)
- If ScoreDisplay(Player)<100000 then
- ScoreDisplay(Player)=Score(Player)
- Else
- Score100K(Player)=Int(Score(Player)/100000)
- ScoreDisplay(Player)=Score(Player)-100000
- End If
- if Score(Player)=>100000 then
- EVAL("RolloverReel"&Player).SetValue(1)
- If B2SOn Then
- If Player=1 Then
- Controller.B2SSetScoreRolloverPlayer1 Score100K(Player)
- End If
- If Player=2 Then
- Controller.B2SSetScoreRolloverPlayer2 Score100K(Player)
- End If
- If Player=3 Then
- Controller.B2SSetScoreRolloverPlayer3 Score100K(Player)
- End If
- If Player=4 Then
- Controller.B2SSetScoreRolloverPlayer4 Score100K(Player)
- End If
- End If
- End If
- If B2SOn Then
- Controller.B2SSetScorePlayer Player, ScoreDisplay(Player)
- End If
- If Score(Player)>Replay1 and Replay1Paid(Player)=false then
- Replay1Paid(Player)=True
- AddSpecial
- End If
- If Score(Player)>Replay2 and Replay2Paid(Player)=false then
- Replay2Paid(Player)=True
- AddSpecial
- End If
- If Score(Player)>Replay3 and Replay3Paid(Player)=false then
- Replay3Paid(Player)=True
- AddSpecial
- End If
- If Score(Player)>Replay4 and Replay4Paid(Player)=false then
- Replay4Paid(Player)=True
- AddSpecial
- End If
- ' ScoreText.text=debugscore
- End Sub
- Sub AddScore2(x)
- Dim OldScore, NewScore, OldTestScore, NewTestScore
- OldScore = Score(Player)
- Select Case x
- Case 1:
- Score(Player)=Score(Player)+1
- Case 10:
- Score(Player)=Score(Player)+10
- Case 100:
- Score(Player)=Score(Player)+100
- Case 1000:
- Score(Player)=Score(Player)+1000
- End Select
- NewScore = Score(Player)
- If NewScore>=100000 then
- EVAL("RolloverReel"&Player).SetValue(1)
- if B2SOn then
- if Player=1 then Controller.B2SSetScoreRolloverPlayer1 1
- if Player=2 then Controller.B2SSetScoreRolloverPlayer2 1
- if Player=3 then Controller.B2SSetScoreRolloverPlayer3 1
- if Player=4 then Controller.B2SSetScoreRolloverPlayer4 1
- end if
- end if
- OldTestScore = OldScore
- NewTestScore = NewScore
- Do
- if OldTestScore < Replay1 and NewTestScore >= Replay1 AND Replay1Paid(Player)=false then
- AddSpecial()
- Replay1Paid(Player)=true
- NewTestScore = 0
- Elseif OldTestScore < Replay2 and NewTestScore >= Replay2 AND Replay2Paid(Player)=false then
- AddSpecial()
- Replay2Paid(Player)=true
- NewTestScore = 0
- Elseif OldTestScore < Replay3 and NewTestScore >= Replay3 AND Replay3Paid(Player)=false then
- AddSpecial()
- Replay3Paid(Player)=true
- NewTestScore = 0
- Elseif OldTestScore < Replay4 and NewTestScore >= Replay4 AND Replay4Paid(Player)=false then
- AddSpecial()
- Replay4Paid(Player)=true
- NewTestScore = 0
- End if
- NewTestScore = NewTestScore - 100000
- OldTestScore = OldTestScore - 100000
- Loop While NewTestScore > 0
- OldScore = int(OldScore / 10) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
- NewScore = int(NewScore / 10) ' divide by 10 for games with fixed 0 in 1s position, by 1 for games with real 1s digits
- ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore&", OldScore Mod 10="&OldScore Mod 10 & ", NewScore % 10="&NewScore Mod 10)
- if (OldScore Mod 10 <> NewScore Mod 10) then
- PlayChime(10)
- end if
- OldScore = int(OldScore / 10)
- NewScore = int(NewScore / 10)
- ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
- if (OldScore Mod 10 <> NewScore Mod 10) then
- PlayChime(10)
- end if
- OldScore = int(OldScore / 10)
- NewScore = int(NewScore / 10)
- ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
- if (OldScore Mod 10 <> NewScore Mod 10) then
- PlayChime(100)
- end if
- OldScore = int(OldScore / 10)
- NewScore = int(NewScore / 10)
- ' MsgBox("OldScore="&OldScore&", NewScore="&NewScore)
- if (OldScore Mod 10 <> NewScore Mod 10) then
- PlayChime(1000)
- end if
- If B2SOn Then
- Controller.B2SSetScorePlayer Player, Score(Player)
- End If
- ' EMReel1.SetValue Score(Player)
- PlayerScores(Player-1).AddValue(x)
- End Sub
- Sub PlayChime(x)
- if ChimesOn=0 then
- Select Case x
- Case 10
- If LastChime10=1 Then
- PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
- LastChime10=0
- Else
- PlaySound SoundFXDOF("SpinACard_1_10_Point_Bell",141,DOFPulse,DOFChimes)
- LastChime10=1
- End If
- Case 100
- If LastChime100=1 Then
- PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
- LastChime100=0
- Else
- PlaySound SoundFXDOF("SpinACard_100_Point_Bell",142,DOFPulse,DOFChimes)
- LastChime100=1
- End If
- End Select
- else
- Select Case x
- Case 10
- If LastChime10=1 Then
- PlaySound SoundFXDOF("10a",141,DOFPulse,DOFChimes)
- LastChime10=0
- Else
- PlaySound SoundFXDOF("10a",141,DOFPulse,DOFChimes)
- LastChime10=1
- End If
- Case 100
- If LastChime100=1 Then
- PlaySound SoundFXDOF("100a",142,DOFPulse,DOFChimes)
- LastChime100=0
- Else
- PlaySound SoundFXDOF("100a",142,DOFPulse,DOFChimes)
- LastChime100=1
- End If
- Case 1000
- If LastChime1000=1 Then
- PlaySound SoundFXDOF("1000a",143,DOFPulse,DOFChimes)
- LastChime1000=0
- Else
- PlaySound SoundFXDOF("1000a",143,DOFPulse,DOFChimes)
- LastChime1000=1
- End If
- End Select
- end if
- End Sub
- Sub HideOptions()
- end sub
- '**********************************************************************************************************
- '**********************************************************************************************************
- '**********************************************************************************************************
- '**********************************************************************************************************
- '*************************************************************
- 'Solenoid Call backs
- '**********************************************************************************************************
- ' SolCallback(1) = "if solEnable then KickBall"
- ' SolCallback(2) = "if solEnable then vpmSolSound ""Knocker"","
- ' SolCallback(3) = "if solEnable then bsTop.SolOut"
- ' SolCallback(4) = "if solEnable then bsLeft.SolOut"
- ' SolCallback(5) = "if solEnable then vpmSolSound ""Bell10"","
- ' SolCallback(6) = "if solEnable then vpmSolSound ""Bell100"","
- ' SolCallback(7) = "if solEnable then vpmSolSound ""Bell1000"","
- ' SolCallback(15) = "if solEnable then vpmSolSound ""Bell10000"","
- ' SolCallback(16) = "if solEnable then OpenGate"
- ' SolCallback(18) = "if solEnable then vpmNudge.SolGameOn"
- 'SolCallback(sLRFlipper) = "SolRFlipper"
- 'SolCallback(sLLFlipper) = "SolLFlipper"
- Const ReflipAngle = 20
- Sub SolLFlipper(Enabled)
- If Enabled Then
- LF.Fire 'leftflipper.rotatetoend
- If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
- RandomSoundReflipUpLeft LeftFlipper
- DOF 101, DOFOn
- Else
- SoundFlipperUpAttackLeft LeftFlipper
- RandomSoundFlipperUpLeft LeftFlipper
- DOF 101, DOFOn
- End If
- Else
- LeftFlipper.RotateToStart
- If LeftFlipper.currentangle < LeftFlipper.startAngle - 5 Then
- RandomSoundFlipperDownLeft LeftFlipper
- DOF 101, DOFOff
- End If
- FlipperLeftHitParm = FlipperUpSoundLevel
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- RF.Fire 'rightflipper.rotatetoend
- If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
- RandomSoundReflipUpRight RightFlipper
- DOF 102, DOFOn
- Else
- SoundFlipperUpAttackRight RightFlipper
- RandomSoundFlipperUpRight RightFlipper
- DOF 102, DOFOn
- End If
- Else
- RightFlipper.RotateToStart
- If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
- RandomSoundFlipperDownRight RightFlipper
- DOF 102, DOFOff
- End If
- FlipperRightHitParm = FlipperUpSoundLevel
- End If
- End Sub
- Sub LeftFlipper_Collide(parm)
- CheckLiveCatch Activeball, LeftFlipper, LFCount, parm
- LeftFlipperCollide parm
- if RubberizerEnabled = 1 then Rubberizer(parm)
- if RubberizerEnabled = 2 then Rubberizer2(parm)
- End Sub
- Sub RightFlipper_Collide(parm)
- CheckLiveCatch Activeball, RightFlipper, RFCount, parm
- RightFlipperCollide parm
- if RubberizerEnabled = 1 then Rubberizer(parm)
- if RubberizerEnabled = 2 then Rubberizer2(parm)
- End Sub
- ' iaakki Rubberizer
- sub Rubberizer(parm)
- if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
- 'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
- activeball.angmomz = activeball.angmomz * 1.2
- activeball.vely = activeball.vely * 1.2
- 'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
- Elseif parm <= 2 and parm > 0.2 Then
- 'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
- activeball.angmomz = activeball.angmomz * -1.1
- activeball.vely = activeball.vely * 1.4
- 'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
- end if
- end sub
- ' apophis rubberizer
- sub Rubberizer2(parm)
- if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
- 'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
- activeball.angmomz = -activeball.angmomz * 2
- activeball.vely = activeball.vely * 1.2
- 'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
- Elseif parm <= 2 and parm > 0.2 Then
- 'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
- activeball.angmomz = -activeball.angmomz * 0.5
- activeball.vely = activeball.vely * (1.2 + rnd(1)/3 )
- 'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
- end if
- end sub
- '**********************************************************************************************************
- 'Solenoid Controlled toys
- '**********************************************************************************************************
- Sub KickBall(Enabled)
- If Enabled Then
- Controller.Switch(18) = False
- PlaySound "BallRelease"
- BallRelease.Kick 60, 5
- End If
- End Sub
- Sub OpenGate(Enabled)
- Gate1.Open = Enabled
- L71.state = Enabled
- PlaySound "Gate"
- End Sub
- '*****GI Lights On
- For each xx in GI:xx.State = 1: Next
- '**********************************************************************************************************
- 'Initiate Table
- '**********************************************************************************************************
- dim bsTop, bsLeft, solEnable
- ' Sub table1_Init()
- '
- '
- ' Top Saucer
- ' Set bsTop = New cvpmBallStack
- ' bsTop.InitSaucer sw2, 2, 154, 12
- ' bsTop.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
- ' bsTop.KickAngleVar=30
- ' bsTop.KickForceVar = 4
- ' Left Saucer
- ' Set bsLeft = New cvpmBallStack
- ' bsLeft.InitSaucer sw10, 10, 205, 12
- ' bsLeft.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
- ' bsLeft.KickAngleVar=15
- ' bsLeft.KickForceVar = 4
- ' solEnable = False
- ' BallRelease.CreateBall
- 'End Sub
- '**********************************************************************************************************
- ' Fleep BIPL
- '**********************************************************************************************************
- Dim BIPL : BIPL=0
- Sub swBIPL_Hit
- BIPL = 1
- End Sub
- Sub swBIPL_UnHit
- BIPL = 0
- End Sub
- '*******************
- ' Switches & Targets
- '*******************
- ' Bumper animation
- Sub Bumper1_Hit()
- DOF 107,DOFPulse
- If TableTilted=true then Exit Sub
- If l68.state=1 then
- AddScore(100)
- else
- AddScore(10)
- end if
- End Sub
- Sub Bumper2_Hit()
- DOF 108,DOFPulse
- If TableTilted=true then Exit Sub
- If l66.state=1 then
- AddScore(100)
- else
- AddScore(10)
- end if
- End Sub
- Sub Bumper3_Hit()
- DOF 109,DOFPulse
- If TableTilted=true then Exit Sub
- If l67.state=1 then
- AddScore(100)
- else
- AddScore(10)
- end if
- End Sub
- Sub Bumper4_Hit()
- DOF 110,DOFPulse
- If TableTilted=true then Exit Sub
- If l65.state=1 then
- AddScore(100)
- else
- AddScore(10)
- end if
- End Sub
- ' Wired Triggers
- Sub sw8_Hit() 'Left Outlane
- If TableTilted=true then EXIT SUB
- AddScore(1000)
- if l43.state=1 then AddSpecial
- End Sub
- Sub sw16_Hit() 'Left Inlane
- If TableTilted=true then EXIT SUB
- SetMotor(500)
- IncreaseGoldBonus
- End Sub
- Sub sw16a_Hit() 'Right inlane
- If TableTilted=true then EXIT SUB
- SetMotor(500)
- IncreaseGoldBonus
- End Sub
- Sub sw24_Hit() 'Right Outlane
- If TableTilted=true then EXIT SUB
- AddScore(1000)
- if l43.state=1 then AddSpecial
- End Sub
- Sub sw9_Hit() 'plunger lane trigger
- If TableTilted=true then EXIT SUB
- If l71.state = 1 then
- l71.state=0
- SetMotor(3000)
- OpenGate(0)
- end if
- End Sub
- ' Star Triggers
- Sub sw11_Hit() 'Top left Star
- If TableTilted=True then Exit Sub
- SetMotor(500)
- End Sub
- Sub sw11a_Hit() 'Top Right Star
- If TableTilted=True then Exit Sub
- SetMotor(500)
- End Sub
- ' Targets
- Sub sw21_Hit
- If TableTilted=True then exit sub
- If L86.state=1 then
- L86.state=0
- SetMotor(3000)
- L66.state=1
- CheckForDouble
- else
- SetMotor(500)
- end if
- End Sub
- Sub sw6_Hit
- If TableTilted=True then exit sub
- If L88.state=1 then
- L88.state=0
- SetMotor(3000)
- L68.state=1
- CheckForDouble
- else
- SetMotor(500)
- end if
- End Sub
- Sub sw22_Hit
- If TableTilted=True then exit sub
- If L85.state=1 then
- L85.state=0
- SetMotor(3000)
- L65.state=1
- CheckForDouble
- else
- SetMotor(500)
- end if
- End Sub
- Sub sw5_Hit
- If TableTilted=True then exit sub
- If L87.state=1 then
- L87.state=0
- SetMotor(3000)
- L67.state=1
- CheckForDouble
- else
- SetMotor(500)
- end if
- End Sub
- Sub CheckForDouble
- if L65.state=1 and L66.state=1 and L67.state=1 and L68.state=1 then
- BonusMultiplier=2
- L63.state=1
- else
- L63.state=0
- end if
- end sub
- Sub sw12_Hit
- if TableTilted=True then Exit Sub
- SpinningLightTimer.enabled=false
- sw12.timerenabled=true
- End Sub
- Sub sw12_timer
- SetMotor(1000+(ArrowTargetCounter1*1000))
- if ArrowTargetCounter1=2 then OpenGate(1)
- If ArrowTargetCounter1=0 then ToggleAlternatingRelay
- If L72.state=1 then
- L4.state=1
- ShootAgainReel.setvalue(1)
- If B2SOn then Controller.B2SSetShootAgain 1
- end if
- sw12.timerenabled=false
- SpinningLightTimer.enabled=true
- end sub
- Sub sw15_Hit
- If TableTilted=True then exit sub
- IncreaseGoldBonus
- AddScore(1000)
- End Sub
- ' Spinners
- Sub Spinner1_Spin()
- Playsound "fx_spinner"
- If TableTilted=True then Exit Sub
- AddScore(10)
- SpinnerLights
- End Sub
- Sub Spinner2_Spin()
- Playsound "fx_spinner"
- If TableTilted=True then Exit Sub
- AddScore(10)
- SpinnerLights
- End Sub
- Sub SpinnerLights
- SpinPos=SpinPos+1
- If SpinPos>9 then
- IncreaseGoldBonus
- SpinPos=0
- end if
- For each obj in LeftSpinLights
- obj.state=0
- next
- For each obj in RightSpinLights
- obj.state=0
- next
- LeftSpinLights(SpinPos).state=1
- RightSpinLights(SpinPos).state=1
- end sub
- '**********Sling Shot Animations
- ' Rstep and Lstep are the variables that increment the animation
- '****************
- Sub RightSlingShot_Slingshot
- DOF 105,DOFPulse
- If TableTilted=true then exit sub
- AddScore(10)
- RandomSoundSlingshotRight SLING1
- RSling.Visible = 0
- RSling1.Visible = 1
- sling1.TransZ = -20
- RStep = 0
- RightSlingShot.TimerEnabled = 1
- End Sub
- Sub RightSlingShot_Timer
- Select Case RStep
- Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
- Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
- End Select
- RStep = RStep + 1
- End Sub
- Sub LeftSlingShot_Slingshot
- DOF 103,DOFPulse
- If TableTilted=true then exit sub
- AddScore(10)
- RandomSoundSlingshotLeft SLING2
- LSling.Visible = 0
- LSling1.Visible = 1
- sling2.TransZ = -20
- LStep = 0
- LeftSlingShot.TimerEnabled = 1
- End Sub
- Sub LeftSlingShot_Timer
- Select Case LStep
- Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
- Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
- End Select
- LStep = LStep + 1
- End Sub
- '****************************************
- ' JP's Fading Lamps 3.4 VP9 Fading only
- ' Based on PD's Fading Lights
- ' SetLamp 0 is Off
- ' SetLamp 1 is On
- ' LampState(x) current state
- '****************************************
- Dim LampState(200)
- AllLampsOff()
- LampTimer.Interval = 40
- LampTimer.Enabled = 0
- Sub LampTimer_Timer()
- Dim chgLamp, num, chg, ii
- chgLamp = Controller.ChangedLamps
- If Not IsEmpty(chgLamp) Then
- For ii = 0 To UBound(chgLamp)
- LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4
- Next
- End If
- UpdateLamps
- End Sub
- Sub UpdateLamps
- 'NFadeL 1, l1
- NFadeL 4, l4
- NFadeLm 5, l5b
- NFadeL 5, l5
- NFadeL 6, l6 'Apron Credit
- ' NFadeT 7, l7, "GAME OVER"
- 'NFadeT 8, l8, "TILT"
- ' NFadeL 21, l21
- ' NFadeL 22, l22
- ' NFadeL 23, l23
- 'NFadeL 24, l24
- NFadeLm 25, l25b
- NFadeL 25, l25
- NFadeLm 26, l26b
- NFadeL 26, l26
- NFadeLm 27, l27b
- NFadeL 27, l27
- NFadeLm 28, l28b
- NFadeL 28, l28
- NFadeL 43, l43
- NFadeL 44, l44
- ' NFadeL 45, l45
- ' NFadeL 46, l46
- ' NFadeL 47, l47
- ' NFadeL 48, l48
- NFadeL 61, l61
- NFadeL 62, l62
- NFadeL 63, l63
- NFadeL 65, l65 'Bumper4
- NFadeL 66, l66 'Bumper2
- NFadeL 67, l67 'Bumper3
- NFadeL 68, l68 'Bumper1
- NFadeLm 69, l69b
- NFadeL 69, l69
- NFadeLm 70, l70b
- NFadeL 70, l70
- NFadeL 71, l71
- NFadeL 72, l72
- NFadeL 81, l81
- NFadeL 82, l82
- NFadeL 83, l83
- NFadeL 84, l84
- NFadeL 85, l85
- NFadeL 86, l86
- NFadeL 87, l87
- NFadeL 88, l88
- NFadeLm 89, l89b
- NFadeL 89, l89
- NFadeLm 90, l90b
- NFadeL 90, l90
- NFadeLm 91, l91b
- NFadeL 91, l91
- NFadeLm 92, l92b
- NFadeL 92, l92
- NFadeL 101, l101
- NFadeL 102, l102
- NFadeL 103, l103
- NFadeL 104, l104
- ' NFadeL 105, l105
- ' NFadeL 106, l106
- ' NFadeL 107, l107
- ' NFadeL 108, l108
- NFadeLm 109, l109b
- NFadeL 109, l109
- NFadeLm 110, l110b
- NFadeL 110, l110
- NFadeLm 111, l111b
- NFadeL 111, l111
- NFadeLm 112, l112b
- NFadeL 112, l112
- solEnable = Controller.Lamp(120)
- End Sub
- Sub AllLampsOff():For x = 1 to 200:LampState(x) = 4:Next:UpdateLamps:UpdateLamps:Updatelamps:End Sub
- Sub SetLamp(nr, value):LampState(nr) = abs(value) + 4:End Sub
- Sub FadeW(nr, a, b, c)
- Select Case LampState(nr)
- Case 2:c.IsDropped = 1:LampState(nr) = 0 'Off
- Case 3:b.IsDropped = 1:c.IsDropped = 0:LampState(nr) = 2 'fading...
- Case 4:a.IsDropped = 1:b.IsDropped = 0:LampState(nr) = 3 'fading...
- Case 5:b.IsDropped = 1:c.IsDropped = 0:LampState(nr) = 6 'turning ON
- Case 6:c.IsDropped = 1:a.IsDropped = 0:LampState(nr) = 1 'ON
- End Select
- End Sub
- Sub FadeWm(nr, a, b, c)
- Select Case LampState(nr)
- Case 2:c.IsDropped = 1
- Case 3:b.IsDropped = 1:c.IsDropped = 0
- Case 4:a.IsDropped = 1:b.IsDropped = 0
- Case 5:b.IsDropped = 1:c.IsDropped = 0
- Case 6:c.IsDropped = 1:a.IsDropped = 0
- End Select
- End Sub
- Sub NFadeW(nr, a)
- Select Case LampState(nr)
- Case 4:a.IsDropped = 1:LampState(nr) = 0
- Case 5:a.IsDropped = 0:LampState(nr) = 1
- End Select
- End Sub
- Sub NFadeWm(nr, a)
- Select Case LampState(nr)
- Case 4:a.IsDropped = 1
- Case 5:a.IsDropped = 0
- End Select
- End Sub
- Sub NFadeWi(nr, a)
- Select Case LampState(nr)
- Case 5:a.IsDropped = 1:LampState(nr) = 0
- Case 4:a.IsDropped = 0:LampState(nr) = 1
- End Select
- End Sub
- Sub FadeL(nr, a, b)
- Select Case LampState(nr)
- Case 2:b.state = 0:LampState(nr) = 0
- Case 3:b.state = 1:LampState(nr) = 2
- Case 4:a.state = 0:LampState(nr) = 3
- Case 5:b.state = 1:LampState(nr) = 6
- Case 6:a.state = 1:LampState(nr) = 1
- End Select
- End Sub
- Sub FadeLm(nr, a, b)
- Select Case LampState(nr)
- Case 2:b.state = 0
- Case 3:b.state = 1
- Case 4:a.state = 0
- Case 5:b.state = 1
- Case 6:a.state = 1
- End Select
- End Sub
- Sub NFadeL(nr, a)
- Select Case LampState(nr)
- Case 4:a.state = 0:LampState(nr) = 0
- Case 5:a.State = 1:LampState(nr) = 1
- End Select
- End Sub
- Sub NFadeLm(nr, a)
- Select Case LampState(nr)
- Case 4:a.state = 0
- Case 5:a.State = 1
- End Select
- End Sub
- Sub FadeR(nr, a)
- Select Case LampState(nr)
- Case 2:a.SetValue 3:LampState(nr) = 0
- Case 3:a.SetValue 2:LampState(nr) = 2
- Case 4:a.SetValue 1:LampState(nr) = 3
- Case 5:a.SetValue 1:LampState(nr) = 6
- Case 6:a.SetValue 0:LampState(nr) = 1
- End Select
- End Sub
- Sub FadeRm(nr, a)
- Select Case LampState(nr)
- Case 2:a.SetValue 3
- Case 3:a.SetValue 2
- Case 4:a.SetValue 1
- Case 5:a.SetValue 1
- Case 6:a.SetValue 0
- End Select
- End Sub
- Sub NFadeT(nr, a, b)
- Select Case LampState(nr)
- Case 4:a.Text = "":LampState(nr) = 0
- Case 5:a.Text = b:LampState(nr) = 1
- End Select
- End Sub
- Sub NFadeTm(nr, a, b)
- Select Case LampState(nr)
- Case 4:a.Text = ""
- Case 5:a.Text = b
- End Select
- End Sub
- Sub NFadeWi(nr, a)
- Select Case LampState(nr)
- Case 4:a.IsDropped = 0:LampState(nr) = 0
- Case 5:a.IsDropped = 1:LampState(nr) = 1
- End Select
- End Sub
- Sub NFadeWim(nr, a)
- Select Case LampState(nr)
- Case 4:a.IsDropped = 0
- Case 5:a.IsDropped = 1
- End Select
- End Sub
- Sub FadeLCo(nr, a, b) 'fading collection of lights
- Dim obj
- Select Case LampState(nr)
- Case 2:vpmSolToggleObj b, Nothing, 0, 0:LampState(nr) = 0
- Case 3:vpmSolToggleObj b, Nothing, 0, 1:LampState(nr) = 2
- Case 4:vpmSolToggleObj a, Nothing, 0, 0:LampState(nr) = 3
- Case 5:vpmSolToggleObj b, Nothing, 0, 1:LampState(nr) = 6
- Case 6:vpmSolToggleObj a, Nothing, 0, 1:LampState(nr) = 1
- End Select
- End Sub
- Sub FlashL(nr, a, b) ' simple light flash, not controlled by the rom
- Select Case LampState(nr)
- Case 2:b.state = 0:LampState(nr) = 0
- Case 3:b.state = 1:LampState(nr) = 2
- Case 4:a.state = 0:LampState(nr) = 3
- Case 5:a.state = 1:LampState(nr) = 4
- End Select
- End Sub
- Sub MFadeL(nr, a, b, c) 'Light acting as a flash. C is the light number to be restored
- Select Case LampState(nr)
- Case 2:b.state = 0:LampState(nr) = 0: If LampState(c) = 1 Then SetLamp c, 1
- Case 3:b.state = 1:LampState(nr) = 2
- Case 4:a.state = 0:LampState(nr) = 3
- Case 5:a.state = 1:LampState(nr) = 1
- End Select
- End Sub
- Sub NFadeB(nr, a, b, c, d) 'New Bally Bumpers: a and b are the off state, c and d and on state, no fading
- Select Case LampState(nr)
- Case 4:a.IsDropped = 0:b.IsDropped = 0:c.IsDropped = 1:d.IsDropped = 1:LampState(nr) = 0
- Case 5:a.IsDropped = 1:b.IsDropped = 1:c.IsDropped = 0:d.IsDropped = 0:LampState(nr) = 1
- End Select
- End Sub
- '******************************************************
- ' BALL ROLLING AND DROP SOUNDS
- '******************************************************
- Const tnob = 5 ' total number of balls
- ReDim rolling(tnob)
- InitRolling
- Dim DropCount
- ReDim DropCount(tnob)
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingTimer_Timer()
- Dim BOT, b
- BOT = GetBalls
- ' stop the sound of deleted balls
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound("BallRoll_" & b)
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' play the rolling sound for each ball
- For b = 0 to UBound(BOT)
- If BallVel(BOT(b)) > 1 AND BOT(b).z < 30 Then
- rolling(b) = True
- PlaySound ("BallRoll_" & b), -1, VolPlayfieldRoll(BOT(b)) * 1.1 * VolumeDial, AudioPan(BOT(b)), 0, PitchPlayfieldRoll(BOT(b)), 1, 0, AudioFade(BOT(b))
- Else
- If rolling(b) = True Then
- StopSound("BallRoll_" & b)
- rolling(b) = False
- End If
- End If
- '***Ball Drop Sounds***
- If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
- If DropCount(b) >= 5 Then
- DropCount(b) = 0
- If BOT(b).velz > -7 Then
- RandomSoundBallBouncePlayfieldSoft BOT(b)
- Else
- RandomSoundBallBouncePlayfieldHard BOT(b)
- End If
- End If
- End If
- If DropCount(b) < 5 Then
- DropCount(b) = DropCount(b) + 1
- End If
- Next
- End Sub
- '*************
- ' JP'S LUT
- '*************
- Dim bLutActive, LUTImage
- Sub LoadLUT
- Dim x
- x = LoadValue(cGameName, "LUTImage")
- If(x <> "") Then LUTImage = x Else LUTImage = 0
- UpdateLUT
- End Sub
- Sub SaveLUT
- SaveValue cGameName, "LUTImage", LUTImage
- End Sub
- Sub NextLUT: LUTImage = (LUTImage +1 ) MOD 10: UpdateLUT: SaveLUT: End Sub
- Sub UpdateLUT
- Select Case LutImage
- Case 0: table1.ColorGradeImage = "LUT0"
- Case 1: table1.ColorGradeImage = "LUT1"
- Case 2: table1.ColorGradeImage = "LUT2"
- Case 3: table1.ColorGradeImage = "LUT3"
- Case 4: table1.ColorGradeImage = "LUT4"
- Case 5: table1.ColorGradeImage = "LUT5"
- Case 6: table1.ColorGradeImage = "LUT6"
- Case 7: table1.ColorGradeImage = "LUT7"
- Case 8: table1.ColorGradeImage = "LUT8"
- Case 9: table1.ColorGradeImage = "LUT9"
- End Select
- End Sub
- '*****************************************
- ' ninuzzu's FLIPPER SHADOWS
- '*****************************************
- sub FlipperTimer_Timer()
- FlipperLSh.RotZ = LeftFlipper.currentangle
- FlipperRSh.RotZ = RightFlipper.currentangle
- End Sub
- '*****************************************
- ' ninuzzu's BALL SHADOW
- '*****************************************
- Dim BallShadow
- BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
- Sub BallShadowUpdate_timer()
- Dim BOT, b
- BOT = GetBalls
- ' hide shadow of deleted balls
- If UBound(BOT)<(tnob-1) Then
- For b = (UBound(BOT) + 1) to (tnob-1)
- BallShadow(b).visible = 0
- Next
- End If
- ' exit the Sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' render the shadow for each ball
- For b = 0 to UBound(BOT)
- If BOT(b).X < Table1.Width/2 Then
- BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) + 6
- Else
- BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) - 6
- End If
- ballShadow(b).Y = BOT(b).Y + 4
- If BOT(b).Z > 20 Then
- BallShadow(b).visible = 1
- Else
- BallShadow(b).visible = 0
- End If
- Next
- End Sub
- '******************************************************
- ' FLIPPER CORRECTION INITIALIZATION
- ' Start nFOZZY FLIPPERS'
- '******************************************************
- 'Flipper Correction Initialization late 80’s to early 90’s
- dim LF : Set LF = New FlipperPolarity
- dim RF : Set RF = New FlipperPolarity
- InitPolarity
- ''*******************************************
- '' Late 70's to early 80's
- '
- Sub InitPolarity()
- dim x, a : a = Array(LF, RF)
- for each x in a
- x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
- x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
- x.enabled = True
- x.TimeDelay = 80
- Next
- AddPt "Polarity", 0, 0, 0
- AddPt "Polarity", 1, 0.05, -2.7
- AddPt "Polarity", 2, 0.33, -2.7
- AddPt "Polarity", 3, 0.37, -2.7
- AddPt "Polarity", 4, 0.41, -2.7
- AddPt "Polarity", 5, 0.45, -2.7
- AddPt "Polarity", 6, 0.576,-2.7
- AddPt "Polarity", 7, 0.66, -1.8
- AddPt "Polarity", 8, 0.743, -0.5
- AddPt "Polarity", 9, 0.81, -0.5
- AddPt "Polarity", 10, 0.88, 0
- addpt "Velocity", 0, 0, 1
- addpt "Velocity", 1, 0.16, 1.06
- addpt "Velocity", 2, 0.41, 1.05
- addpt "Velocity", 3, 0.53, 1'0.982
- addpt "Velocity", 4, 0.702, 0.968
- addpt "Velocity", 5, 0.95, 0.968
- addpt "Velocity", 6, 1.03, 0.945
- LF.Object = LeftFlipper
- LF.EndPoint = EndPointLp
- RF.Object = RightFlipper
- RF.EndPoint = EndPointRp
- End Sub
- Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
- Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
- Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
- Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
- '******************************************************
- ' FLIPPER CORRECTION FUNCTIONS
- '******************************************************
- Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
- dim a : a = Array(LF, RF)
- dim x : for each x in a
- x.addpoint aStr, idx, aX, aY
- Next
- End Sub
- Class FlipperPolarity
- Public DebugOn, Enabled
- Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
- Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
- private Flipper, FlipperStart,FlipperEnd, FlipperEndY, LR, PartialFlipCoef
- Private Balls(20), balldata(20)
- dim PolarityIn, PolarityOut
- dim VelocityIn, VelocityOut
- dim YcoefIn, YcoefOut
- Public Sub Class_Initialize
- redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
- Enabled = True : TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new SpoofBall : next
- End Sub
- Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
- Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
- Public Property Get StartPoint : StartPoint = FlipperStart : End Property
- Public Property Let EndPoint(aInput) : FlipperEnd = aInput.x: FlipperEndY = aInput.y: End Property
- Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
- Public Property Get EndPointY: EndPointY = FlipperEndY : End Property
- Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
- Select Case aChooseArray
- case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
- Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
- Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
- End Select
- if gametime > 100 then Report aChooseArray
- End Sub
- Public Sub Report(aChooseArray) 'debug, reports all coords in tbPL.text
- if not DebugOn then exit sub
- dim a1, a2 : Select Case aChooseArray
- case "Polarity" : a1 = PolarityIn : a2 = PolarityOut
- Case "Velocity" : a1 = VelocityIn : a2 = VelocityOut
- Case "Ycoef" : a1 = YcoefIn : a2 = YcoefOut
- case else :tbpl.text = "wrong string" : exit sub
- End Select
- dim str, x : for x = 0 to uBound(a1) : str = str & aChooseArray & " x: " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
- tbpl.text = str
- End Sub
- 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
- Private Sub RemoveBall(aBall)
- dim x : for x = 0 to uBound(balls)
- if TypeName(balls(x) ) = "IBall" then
- if aBall.ID = Balls(x).ID Then
- balls(x) = Empty
- Balldata(x).Reset
- End If
- End If
- Next
- End Sub
- Public Sub Fire()
- Flipper.RotateToEnd
- processballs
- End Sub
- Public Property Get Pos 'returns % position a ball. For debug stuff.
- dim x : for x = 0 to uBound(balls)
- if not IsEmpty(balls(x) ) then
- pos = pSlope(Balls(x).x, FlipperStart, 0, FlipperEnd, 1)
- End If
- Next
- End Property
- Public Sub ProcessBalls() 'save data of balls in flipper range
- FlipAt = GameTime
- dim x : for x = 0 to uBound(balls)
- if not IsEmpty(balls(x) ) then
- balldata(x).Data = balls(x)
- End If
- Next
- PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle))
- PartialFlipCoef = abs(PartialFlipCoef-1)
- End Sub
- Private Function FlipperOn() : if gameTime < FlipAt+TimeDelay then FlipperOn = True : End If : End Function 'Timer shutoff for polaritycorrect
- Public Sub PolarityCorrect(aBall)
- if FlipperOn() then
- dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
- 'y safety Exit
- if aBall.VelY > -8 then 'ball going down
- RemoveBall aBall
- exit Sub
- end if
- 'Find balldata. BallPos = % on Flipper
- for x = 0 to uBound(Balls)
- if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
- idx = x
- BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
- if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
- end if
- Next
- If BallPos = 0 Then 'no ball data meaning the ball is entering and exiting pretty close to the same position, use current values.
- BallPos = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
- if ballpos > 0.65 then Ycoef = LinearEnvelope(aBall.Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
- End If
- 'Velocity correction
- if not IsEmpty(VelocityIn(0) ) then
- Dim VelCoef
- : VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
- if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
- if Enabled then aBall.Velx = aBall.Velx*VelCoef
- if Enabled then aBall.Vely = aBall.Vely*VelCoef
- End If
- 'Polarity Correction (optional now)
- if not IsEmpty(PolarityIn(0) ) then
- If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
- dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
- if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
- 'playsound "fx_knocker"
- End If
- End If
- RemoveBall aBall
- End Sub
- End Class
- '******************************************************
- ' FLIPPER POLARITY AND RUBBER DAMPENER
- ' SUPPORTING FUNCTIONS
- '******************************************************
- ' Used for flipper correction and rubber dampeners
- Sub ShuffleArray(ByRef aArray, byVal offset) 'shuffle 1d array
- dim x, aCount : aCount = 0
- redim a(uBound(aArray) )
- for x = 0 to uBound(aArray) 'Shuffle objects in a temp array
- if not IsEmpty(aArray(x) ) Then
- if IsObject(aArray(x)) then
- Set a(aCount) = aArray(x)
- Else
- a(aCount) = aArray(x)
- End If
- aCount = aCount + 1
- End If
- Next
- if offset < 0 then offset = 0
- redim aArray(aCount-1+offset) 'Resize original array
- for x = 0 to aCount-1 'set objects back into original array
- if IsObject(a(x)) then
- Set aArray(x) = a(x)
- Else
- aArray(x) = a(x)
- End If
- Next
- End Sub
- ' Used for flipper correction and rubber dampeners
- Sub ShuffleArrays(aArray1, aArray2, offset)
- ShuffleArray aArray1, offset
- ShuffleArray aArray2, offset
- End Sub
- ' Used for flipper correction, rubber dampeners, and drop targets
- Function BallSpeed(ball) 'Calculates the ball speed
- BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
- End Function
- ' Used for flipper correction and rubber dampeners
- Function PSlope(Input, X1, Y1, X2, Y2) 'Set up line via two points, no clamping. Input X, output Y
- dim x, y, b, m : x = input : m = (Y2 - Y1) / (X2 - X1) : b = Y2 - m*X2
- Y = M*x+b
- PSlope = Y
- End Function
- ' Used for flipper correction
- Class spoofball
- Public X, Y, Z, VelX, VelY, VelZ, ID, Mass, Radius
- Public Property Let Data(aBall)
- With aBall
- x = .x : y = .y : z = .z : velx = .velx : vely = .vely : velz = .velz
- id = .ID : mass = .mass : radius = .radius
- end with
- End Property
- Public Sub Reset()
- x = Empty : y = Empty : z = Empty : velx = Empty : vely = Empty : velz = Empty
- id = Empty : mass = Empty : radius = Empty
- End Sub
- End Class
- ' Used for flipper correction and rubber dampeners
- Function LinearEnvelope(xInput, xKeyFrame, yLvl)
- dim y 'Y output
- dim L 'Line
- dim ii : for ii = 1 to uBound(xKeyFrame) 'find active line
- if xInput <= xKeyFrame(ii) then L = ii : exit for : end if
- Next
- if xInput > xKeyFrame(uBound(xKeyFrame) ) then L = uBound(xKeyFrame) 'catch line overrun
- Y = pSlope(xInput, xKeyFrame(L-1), yLvl(L-1), xKeyFrame(L), yLvl(L) )
- if xInput <= xKeyFrame(lBound(xKeyFrame) ) then Y = yLvl(lBound(xKeyFrame) ) 'Clamp lower
- if xInput >= xKeyFrame(uBound(xKeyFrame) ) then Y = yLvl(uBound(xKeyFrame) ) 'Clamp upper
- LinearEnvelope = Y
- End Function
- ' Used for drop targets and stand up targets
- Function Atn2(dy, dx)
- dim pi
- pi = 4*Atn(1)
- If dx > 0 Then
- Atn2 = Atn(dy / dx)
- ElseIf dx < 0 Then
- If dy = 0 Then
- Atn2 = pi
- Else
- Atn2 = Sgn(dy) * (pi - Atn(Abs(dy / dx)))
- end if
- ElseIf dx = 0 Then
- if dy = 0 Then
- Atn2 = 0
- else
- Atn2 = Sgn(dy) * pi / 2
- end if
- End If
- End Function
- ' Used for drop targets and flipper tricks
- Function Distance(ax,ay,bx,by)
- Distance = SQR((ax - bx)^2 + (ay - by)^2)
- End Function
- '******************************************************
- ' FLIPPER TRICKS
- '******************************************************
- RightFlipper.timerinterval=1
- Rightflipper.timerenabled=True
- sub RightFlipper_timer()
- FlipperTricks LeftFlipper, LFPress, LFCount, LFEndAngle, LFState
- FlipperTricks RightFlipper, RFPress, RFCount, RFEndAngle, RFState
- FlipperNudge RightFlipper, RFEndAngle, RFEOSNudge, LeftFlipper, LFEndAngle
- FlipperNudge LeftFlipper, LFEndAngle, LFEOSNudge, RightFlipper, RFEndAngle
- end sub
- Dim LFEOSNudge, RFEOSNudge
- Sub FlipperNudge(Flipper1, Endangle1, EOSNudge1, Flipper2, EndAngle2)
- Dim BOT, b
- If abs(Flipper1.currentangle) < abs(Endangle1) + 3 and EOSNudge1 <> 1 Then
- EOSNudge1 = 1
- If Flipper2.currentangle = EndAngle2 Then
- BOT = GetBalls
- For b = 0 to Ubound(BOT)
- If FlipperTrigger(BOT(b).x, BOT(b).y, Flipper1) Then
- 'Debug.Print "ball in flip1. exit"
- exit Sub
- end If
- Next
- For b = 0 to Ubound(BOT)
- If FlipperTrigger(BOT(b).x, BOT(b).y, Flipper2) Then
- 'debug.print "flippernudge!!"
- BOT(b).velx = BOT(b).velx /1.5
- BOT(b).vely = BOT(b).vely - 1
- end If
- Next
- End If
- Else
- If abs(Flipper1.currentangle) > abs(Endangle1) + 30 then EOSNudge1 = 0
- End If
- End Sub
- '*****************
- ' Maths
- '*****************
- Const Pi = 3.1415927
- Function dSin(degrees)
- dsin = sin(degrees * Pi/180)
- End Function
- Function dCos(degrees)
- dcos = cos(degrees * Pi/180)
- End Function
- '*************************************************
- ' Check ball distance from Flipper for Rem
- '*************************************************
- Function Distance(ax,ay,bx,by)
- Distance = SQR((ax - bx)^2 + (ay - by)^2)
- End Function
- Function DistancePL(px,py,ax,ay,bx,by) ' Distance between a point and a line where point is px,py
- DistancePL = ABS((by - ay)*px - (bx - ax) * py + bx*ay - by*ax)/Distance(ax,ay,bx,by)
- End Function
- Function Radians(Degrees)
- Radians = Degrees * PI /180
- End Function
- Function AnglePP(ax,ay,bx,by)
- AnglePP = Atn2((by - ay),(bx - ax))*180/PI
- End Function
- Function DistanceFromFlipper(ballx, bally, Flipper)
- DistanceFromFlipper = DistancePL(ballx, bally, Flipper.x, Flipper.y, Cos(Radians(Flipper.currentangle+90))+Flipper.x, Sin(Radians(Flipper.currentangle+90))+Flipper.y)
- End Function
- Function FlipperTrigger(ballx, bally, Flipper)
- Dim DiffAngle
- DiffAngle = ABS(Flipper.currentangle - AnglePP(Flipper.x, Flipper.y, ballx, bally) - 90)
- If DiffAngle > 180 Then DiffAngle = DiffAngle - 360
- If DistanceFromFlipper(ballx,bally,Flipper) < 48 and DiffAngle <= 90 and Distance(ballx,bally,Flipper.x,Flipper.y) < Flipper.Length Then
- FlipperTrigger = True
- Else
- FlipperTrigger = False
- End If
- End Function
- '*************************************************
- ' End - Check ball distance from Flipper for Rem
- '*************************************************
- dim LFPress, RFPress, LFCount, RFCount
- dim LFState, RFState
- dim EOST, EOSA,Frampup, FElasticity,FReturn
- dim RFEndAngle, LFEndAngle
- EOST = leftflipper.eostorque
- EOSA = leftflipper.eostorqueangle
- Frampup = LeftFlipper.rampup
- FElasticity = LeftFlipper.elasticity
- FReturn = LeftFlipper.return
- Const EOSTnew = 1 '0.8
- Const EOSAnew = 1
- Const EOSRampup = 0
- Dim SOSRampup
- Select Case FlipperCoilRampupMode
- Case 0:
- SOSRampup = 2.5
- Case 1:
- SOSRampup = 4.5
- Case 2:
- SOSRampup = 8.5
- End Select
- Const LiveCatch = 16
- Const LiveElasticity = 0.45
- Const SOSEM = 0.815
- Const EOSReturn = 0.035 '0.025
- LFEndAngle = Leftflipper.endangle
- RFEndAngle = RightFlipper.endangle
- Sub FlipperActivate(Flipper, FlipperPress)
- FlipperPress = 1
- Flipper.Elasticity = FElasticity
- Flipper.eostorque = EOST
- Flipper.eostorqueangle = EOSA
- End Sub
- Sub FlipperDeactivate(Flipper, FlipperPress)
- FlipperPress = 0
- Flipper.eostorqueangle = EOSA
- Flipper.eostorque = EOST*EOSReturn/FReturn
- If Abs(Flipper.currentangle) <= Abs(Flipper.endangle) + 0.1 Then
- Dim BOT, b
- BOT = GetBalls
- For b = 0 to UBound(BOT)
- If Distance(BOT(b).x, BOT(b).y, Flipper.x, Flipper.y) < 55 Then 'check for cradle
- If BOT(b).vely >= -0.4 Then BOT(b).vely = -0.4
- End If
- Next
- End If
- End Sub
- Sub FlipperTricks (Flipper, FlipperPress, FCount, FEndAngle, FState)
- Dim Dir
- Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
- If Abs(Flipper.currentangle) > Abs(Flipper.startangle) - 0.05 Then
- If FState <> 1 Then
- Flipper.rampup = SOSRampup
- Flipper.endangle = FEndAngle - 3*Dir
- Flipper.Elasticity = FElasticity * SOSEM
- FCount = 0
- FState = 1
- End If
- ElseIf Abs(Flipper.currentangle) <= Abs(Flipper.endangle) and FlipperPress = 1 then
- if FCount = 0 Then FCount = GameTime
- If FState <> 2 Then
- Flipper.eostorqueangle = EOSAnew
- Flipper.eostorque = EOSTnew
- Flipper.rampup = EOSRampup
- Flipper.endangle = FEndAngle
- FState = 2
- End If
- Elseif Abs(Flipper.currentangle) > Abs(Flipper.endangle) + 0.01 and FlipperPress = 1 Then
- If FState <> 3 Then
- Flipper.eostorque = EOST
- Flipper.eostorqueangle = EOSA
- Flipper.rampup = Frampup
- Flipper.Elasticity = FElasticity
- FState = 3
- End If
- End If
- End Sub
- Const LiveDistanceMin = 30 'minimum distance in vp units from flipper base live catch dampening will occur
- Const LiveDistanceMax = 117 'maximum distance in vp units from flipper base live catch dampening will occur (tip protection)
- Sub CheckLiveCatch(ball, Flipper, FCount, parm) 'Experimental new live catch
- Dim Dir
- Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
- Dim LiveCatchBounce 'If live catch is not perfect, it won't freeze ball totally
- Dim CatchTime : CatchTime = GameTime - FCount
- if CatchTime <= LiveCatch and parm > 6 and ABS(Flipper.x - ball.x) > LiveDistanceMin and ABS(Flipper.x - ball.x) < LiveDistanceMax Then
- if CatchTime <= LiveCatch*0.8 Then 'Perfect catch only when catch time happens in the beginning of the window
- LiveCatchBounce = 0
- else
- LiveCatchBounce = Abs((LiveCatch/2) - CatchTime) 'Partial catch when catch happens a bit late
- end If
- 'debug.print "Live catch! Bounce: " & LiveCatchBounce
- If LiveCatchBounce = 0 and ball.velx * Dir > 0 Then ball.velx = 0
- ball.vely = LiveCatchBounce * (16 / LiveCatch) ' Multiplier for inaccuracy bounce
- ball.angmomx= 0
- ball.angmomy= 0
- ball.angmomz= 0
- End If
- End Sub
- '*****************************************************************************************************
- 'END nFOZZY FLIPPERS'
- 'PHYSICS DAMPENERS
- 'These are data mined bounce curves,
- 'dialed in with the in-game elasticity as much as possible to prevent angle / spin issues.
- 'Requires tracking ballspeed to calculate COR
- Sub dPosts_Hit(idx)
- RubbersD.dampen Activeball
- End Sub
- Sub dSleeves_Hit(idx)
- SleevesD.Dampen Activeball
- End Sub
- dim RubbersD : Set RubbersD = new Dampener 'frubber
- RubbersD.name = "Rubbers"
- RubbersD.debugOn = False 'shows info in textbox "TBPout"
- RubbersD.Print = False 'debug, reports in debugger (in vel, out cor)
- 'cor bounce curve (linear)
- 'for best results, try to match in-game velocity as closely as possible to the desired curve
- 'RubbersD.addpoint 0, 0, 0.935 'point# (keep sequential), ballspeed, CoR (elasticity)
- RubbersD.addpoint 0, 0, 0.96 'point# (keep sequential), ballspeed, CoR (elasticity)
- RubbersD.addpoint 1, 3.77, 0.96
- RubbersD.addpoint 2, 5.76, 0.967 'dont take this as gospel. if you can data mine rubber elasticitiy, please help!
- RubbersD.addpoint 3, 15.84, 0.874
- RubbersD.addpoint 4, 56, 0.64 'there's clamping so interpolate up to 56 at least
- dim SleevesD : Set SleevesD = new Dampener 'this is just rubber but cut down to 85%...
- SleevesD.name = "Sleeves"
- SleevesD.debugOn = False 'shows info in textbox "TBPout"
- SleevesD.Print = False 'debug, reports in debugger (in vel, out cor)
- SleevesD.CopyCoef RubbersD, 0.85
- Class Dampener
- Public Print, debugOn 'tbpOut.text
- public name, Threshold 'Minimum threshold. Useful for Flippers, which don't have a hit threshold.
- Public ModIn, ModOut
- Private Sub Class_Initialize : redim ModIn(0) : redim Modout(0): End Sub
- Public Sub AddPoint(aIdx, aX, aY)
- ShuffleArrays ModIn, ModOut, 1 : ModIn(aIDX) = aX : ModOut(aIDX) = aY : ShuffleArrays ModIn, ModOut, 0
- if gametime > 100 then Report
- End Sub
- public sub Dampen(aBall)
- if threshold then if BallSpeed(aBall) < threshold then exit sub end if end if
- dim RealCOR, DesiredCOR, str, coef
- DesiredCor = LinearEnvelope(cor.ballvel(aBall.id), ModIn, ModOut )
- RealCOR = BallSpeed(aBall) / cor.ballvel(aBall.id)
- coef = desiredcor / realcor
- if debugOn then str = name & " in vel:" & round(cor.ballvel(aBall.id),2 ) & vbnewline & "desired cor: " & round(desiredcor,4) & vbnewline & _
- "actual cor: " & round(realCOR,4) & vbnewline & "ballspeed coef: " & round(coef, 3) & vbnewline
- if Print then debug.print Round(cor.ballvel(aBall.id),2) & ", " & round(desiredcor,3)
- aBall.velx = aBall.velx * coef : aBall.vely = aBall.vely * coef
- if debugOn then TBPout.text = str
- End Sub
- Public Sub CopyCoef(aObj, aCoef) 'alternative addpoints, copy with coef
- dim x : for x = 0 to uBound(aObj.ModIn)
- addpoint x, aObj.ModIn(x), aObj.ModOut(x)*aCoef
- Next
- End Sub
- Public Sub Report() 'debug, reports all coords in tbPL.text
- if not debugOn then exit sub
- dim a1, a2 : a1 = ModIn : a2 = ModOut
- dim str, x : for x = 0 to uBound(a1) : str = str & x & ": " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
- TBPout.text = str
- End Sub
- End Class
- '******************************************************
- ' TRACK ALL BALL VELOCITIES
- ' FOR RUBBER DAMPENER AND DROP TARGETS
- '******************************************************
- dim cor : set cor = New CoRTracker
- Class CoRTracker
- public ballvel, ballvelx, ballvely
- Private Sub Class_Initialize : redim ballvel(0) : redim ballvelx(0): redim ballvely(0) : End Sub
- Public Sub Update() 'tracks in-ball-velocity
- dim str, b, AllBalls, highestID : allBalls = getballs
- for each b in allballs
- if b.id >= HighestID then highestID = b.id
- Next
- if uBound(ballvel) < highestID then redim ballvel(highestID) 'set bounds
- if uBound(ballvelx) < highestID then redim ballvelx(highestID) 'set bounds
- if uBound(ballvely) < highestID then redim ballvely(highestID) 'set bounds
- for each b in allballs
- ballvel(b.id) = BallSpeed(b)
- ballvelx(b.id) = b.velx
- ballvely(b.id) = b.vely
- Next
- End Sub
- End Class
- Sub RDampen_Timer()
- Cor.Update
- End Sub
- '******************************************************
- ' TargetBouncer for targets and posts by Iaakki, Wrd1972, Apophis
- '******************************************************
- sub TargetBouncer(aBall,defvalue)
- dim zMultiplier, vel, vratio
- if TargetBouncerEnabled <> 0 and aball.z < 30 then
- 'debug.print "velx: " & aball.velx & " vely: " & aball.vely & " velz: " & aball.velz
- vel = BallSpeed(aBall)
- vratio = aBall.vely/aBall.velx
- Select Case Int(Rnd * 6) + 1
- Case 1: zMultiplier = 0.1*defvalue
- Case 2: zMultiplier = 0.2*defvalue
- Case 3: zMultiplier = 0.3*defvalue
- Case 4: zMultiplier = 0.4*defvalue
- Case 5: zMultiplier = 0.5*defvalue
- Case 6: zMultiplier = 0.6*defvalue
- End Select
- aBall.velz = abs(vel * zMultiplier * TargetBouncerFactor)
- aBall.velx = sgn(aBall.velx) * sqr(abs((vel^2 - aBall.velz^2)/(1+vratio^2)))
- aBall.vely = aBall.velx * vratio
- 'debug.print "---> velx: " & aball.velx & " vely: " & aball.vely & " velz: " & aball.velz
- 'debug.print "conservation check: " & BallSpeed(aBall)/vel
- end if
- end sub
- '******************************************************
- '**** FLEEP MECHANICAL SOUNDS
- '******************************************************
- ' This part in the script is an entire block that is dedicated to the physics sound system.
- ' Various scripts and sounds that may be pretty generic and could suit other WPC systems, but the most are tailored specifically for the TOM table
- ' Many of the sounds in this package can be added by creating collections and adding the appropriate objects to those collections.
- ' Create the following new collections:
- ' Metals (all metal objects, metal walls, metal posts, metal wire guides)
- ' Apron (the apron walls and plunger wall)
- ' Walls (all wood or plastic walls)
- ' Rollovers (wire rollover triggers, star triggers, or button triggers)
- ' Targets (standup or drop targets, these are hit sounds only ... you will want to add separate dropping sounds for drop targets)
- ' Gates (plate gates)
- ' GatesWire (wire gates)
- ' Rubbers (all rubbers including posts, sleeves, pegs, and bands)
- ' When creating the collections, make sure "Fire events for this collection" is checked.
- ' You'll also need to make sure "Has Hit Event" is checked for each object placed in these collections (not necessary for gates and triggers).
- ' Once the collections and objects are added, the save, close, and restart VPX.
- '
- ' Tutorial vides by Apophis
- ' Part 1: https://youtu.be/PbE2kNiam3g
- ' Part 2: https://youtu.be/B5cm1Y8wQsk
- ' Part 3: https://youtu.be/eLhWyuYOyGg
- '/////////////////////////////// SOUNDS PARAMETERS //////////////////////////////
- Dim GlobalSoundLevel, CoinSoundLevel, PlungerReleaseSoundLevel, PlungerPullSoundLevel, NudgeLeftSoundLevel
- Dim NudgeRightSoundLevel, NudgeCenterSoundLevel, StartButtonSoundLevel, RollingSoundFactor
- CoinSoundLevel = 1 'volume level; range [0, 1]
- NudgeLeftSoundLevel = 1 'volume level; range [0, 1]
- NudgeRightSoundLevel = 1 'volume level; range [0, 1]
- NudgeCenterSoundLevel = 1 'volume level; range [0, 1]
- StartButtonSoundLevel = 0.1 'volume level; range [0, 1]
- PlungerReleaseSoundLevel = 0.8 '1 wjr 'volume level; range [0, 1]
- PlungerPullSoundLevel = 1 'volume level; range [0, 1]
- RollingSoundFactor = 1.1/5
- '///////////////////////-----Solenoids, Kickers and Flash Relays-----///////////////////////
- Dim FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel, FlipperUpAttackLeftSoundLevel, FlipperUpAttackRightSoundLevel
- Dim FlipperUpSoundLevel, FlipperDownSoundLevel, FlipperLeftHitParm, FlipperRightHitParm
- Dim SlingshotSoundLevel, BumperSoundFactor, KnockerSoundLevel
- FlipperUpAttackMinimumSoundLevel = 0.010 'volume level; range [0, 1]
- FlipperUpAttackMaximumSoundLevel = 0.635 'volume level; range [0, 1]
- FlipperUpSoundLevel = 1.0 'volume level; range [0, 1]
- FlipperDownSoundLevel = 0.45 'volume level; range [0, 1]
- FlipperLeftHitParm = FlipperUpSoundLevel 'sound helper; not configurable
- FlipperRightHitParm = FlipperUpSoundLevel 'sound helper; not configurable
- SlingshotSoundLevel = 0.95 'volume level; range [0, 1]
- BumperSoundFactor = 4.25 'volume multiplier; must not be zero
- KnockerSoundLevel = 1 'volume level; range [0, 1]
- '///////////////////////-----Ball Drops, Bumps and Collisions-----///////////////////////
- Dim RubberStrongSoundFactor, RubberWeakSoundFactor, RubberFlipperSoundFactor,BallWithBallCollisionSoundFactor
- Dim BallBouncePlayfieldSoftFactor, BallBouncePlayfieldHardFactor, PlasticRampDropToPlayfieldSoundLevel, WireRampDropToPlayfieldSoundLevel, DelayedBallDropOnPlayfieldSoundLevel
- Dim WallImpactSoundFactor, MetalImpactSoundFactor, SubwaySoundLevel, SubwayEntrySoundLevel, ScoopEntrySoundLevel
- Dim SaucerLockSoundLevel, SaucerKickSoundLevel
- BallWithBallCollisionSoundFactor = 3.2 'volume multiplier; must not be zero
- RubberStrongSoundFactor = 0.055/5 'volume multiplier; must not be zero
- RubberWeakSoundFactor = 0.075/5 'volume multiplier; must not be zero
- RubberFlipperSoundFactor = 0.075/5 'volume multiplier; must not be zero
- BallBouncePlayfieldSoftFactor = 0.025 'volume multiplier; must not be zero
- BallBouncePlayfieldHardFactor = 0.025 'volume multiplier; must not be zero
- DelayedBallDropOnPlayfieldSoundLevel = 0.8 'volume level; range [0, 1]
- WallImpactSoundFactor = 0.075 'volume multiplier; must not be zero
- MetalImpactSoundFactor = 0.075/3
- SaucerLockSoundLevel = 0.8
- SaucerKickSoundLevel = 0.8
- '///////////////////////-----Gates, Spinners, Rollovers and Targets-----///////////////////////
- Dim GateSoundLevel, TargetSoundFactor, SpinnerSoundLevel, RolloverSoundLevel, DTSoundLevel
- GateSoundLevel = 0.5/5 'volume level; range [0, 1]
- TargetSoundFactor = 0.0025 * 10 'volume multiplier; must not be zero
- DTSoundLevel = 0.25 'volume multiplier; must not be zero
- RolloverSoundLevel = 0.25 'volume level; range [0, 1]
- SpinnerSoundLevel = 0.5 'volume level; range [0, 1]
- '///////////////////////-----Ball Release, Guides and Drain-----///////////////////////
- Dim DrainSoundLevel, BallReleaseSoundLevel, BottomArchBallGuideSoundFactor, FlipperBallGuideSoundFactor
- DrainSoundLevel = 0.8 'volume level; range [0, 1]
- BallReleaseSoundLevel = 1 'volume level; range [0, 1]
- BottomArchBallGuideSoundFactor = 0.2 'volume multiplier; must not be zero
- FlipperBallGuideSoundFactor = 0.015 'volume multiplier; must not be zero
- '///////////////////////-----Loops and Lanes-----///////////////////////
- Dim ArchSoundFactor
- ArchSoundFactor = 0.025/5 'volume multiplier; must not be zero
- '///////////////////////////// SOUND PLAYBACK FUNCTIONS ////////////////////////////
- '///////////////////////////// POSITIONAL SOUND PLAYBACK METHODS ////////////////////////////
- ' Positional sound playback methods will play a sound, depending on the X,Y position of the table element or depending on ActiveBall object position
- ' These are similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
- ' For surround setup - positional sound playback functions will fade between front and rear surround channels and pan between left and right channels
- ' For stereo setup - positional sound playback functions will only pan between left and right channels
- ' For mono setup - positional sound playback functions will not pan between left and right channels and will not fade between front and rear channels
- ' PlaySound full syntax - PlaySound(string, int loopcount, float volume, float pan, float randompitch, int pitch, bool useexisting, bool restart, float front_rear_fade)
- ' Note - These functions will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
- Sub PlaySoundAtLevelStatic(playsoundparams, aVol, tableobj)
- PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 0, 0, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtLevelExistingStatic(playsoundparams, aVol, tableobj)
- PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 1, 0, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtLevelStaticLoop(playsoundparams, aVol, tableobj)
- PlaySound playsoundparams, -1, aVol * VolumeDial, AudioPan(tableobj), 0, 0, 0, 0, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtLevelStaticRandomPitch(playsoundparams, aVol, randomPitch, tableobj)
- PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(tableobj), randomPitch, 0, 0, 0, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtLevelActiveBall(playsoundparams, aVol)
- PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ActiveBall), 0, 0, 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub PlaySoundAtLevelExistingActiveBall(playsoundparams, aVol)
- PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ActiveBall), 0, 0, 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub PlaySoundAtLeveTimerActiveBall(playsoundparams, aVol, ballvariable)
- PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ballvariable), 0, 0, 0, 0, AudioFade(ballvariable)
- End Sub
- Sub PlaySoundAtLevelTimerExistingActiveBall(playsoundparams, aVol, ballvariable)
- PlaySound playsoundparams, 0, aVol * VolumeDial, AudioPan(ballvariable), 0, 0, 1, 0, AudioFade(ballvariable)
- End Sub
- Sub PlaySoundAtLevelRoll(playsoundparams, aVol, pitch)
- PlaySound playsoundparams, -1, aVol * VolumeDial, AudioPan(tableobj), randomPitch, 0, 0, 0, AudioFade(tableobj)
- End Sub
- ' Previous Positional Sound Subs
- Sub PlaySoundAt(soundname, tableobj)
- PlaySound soundname, 1, 1 * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtVol(soundname, tableobj, aVol)
- PlaySound soundname, 1, aVol * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBall(soundname)
- PlaySoundAt soundname, ActiveBall
- End Sub
- Sub PlaySoundAtBallVol (Soundname, aVol)
- Playsound soundname, 1,aVol * VolumeDial, AudioPan(ActiveBall), 0,0,0, 1, AudioFade(ActiveBall)
- End Sub
- Sub PlaySoundAtBallVolM (Soundname, aVol)
- Playsound soundname, 1,aVol * VolumeDial, AudioPan(ActiveBall), 0,0,0, 0, AudioFade(ActiveBall)
- End Sub
- Sub PlaySoundAtVolLoops(sound, tableobj, Vol, Loops)
- PlaySound sound, Loops, Vol * VolumeDial, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- ' *********************************************************************
- ' Fleep Supporting Ball & Sound Functions
- ' *********************************************************************
- Dim tablewidth, tableheight : tablewidth = table1.width : tableheight = table1.height
- 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
- Dim tmp
- tmp = tableobj.y * 2 / tableheight-1
- If tmp > 0 Then
- AudioFade = Csng(tmp ^10)
- Else
- AudioFade = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.x * 2 / tablewidth-1
- If tmp > 0 Then
- AudioPan = Csng(tmp ^10)
- Else
- AudioPan = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function Vol(ball) ' Calculates the volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2)
- End Function
- Function Volz(ball) ' Calculates the volume of the sound based on the ball speed
- Volz = Csng((ball.velz) ^2)
- End Function
- Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
- Pitch = BallVel(ball) * 20
- End Function
- Function BallVel(ball) 'Calculates the ball speed
- BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
- End Function
- Function VolPlayfieldRoll(ball) ' Calculates the roll volume of the sound based on the ball speed
- VolPlayfieldRoll = RollingSoundFactor * 0.0005 * Csng(BallVel(ball) ^3)
- End Function
- Function PitchPlayfieldRoll(ball) ' Calculates the roll pitch of the sound based on the ball speed
- PitchPlayfieldRoll = BallVel(ball) ^2 * 15
- End Function
- Function RndInt(min, max)
- RndInt = Int(Rnd() * (max-min + 1) + min)' Sets a random number integer between min and max
- End Function
- Function RndNum(min, max)
- RndNum = Rnd() * (max-min) + min' Sets a random number between min and max
- End Function
- '///////////////////////////// GENERAL SOUND SUBROUTINES ////////////////////////////
- Sub SoundStartButton()
- PlaySound ("Start_Button"), 0, StartButtonSoundLevel, 0, 0.25
- End Sub
- Sub SoundNudgeLeft()
- PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeLeftSoundLevel * VolumeDial, -0.1, 0.25
- End Sub
- Sub SoundNudgeRight()
- PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeRightSoundLevel * VolumeDial, 0.1, 0.25
- End Sub
- Sub SoundNudgeCenter()
- PlaySound ("Nudge_" & Int(Rnd*2)+1), 0, NudgeCenterSoundLevel * VolumeDial, 0, 0.25
- End Sub
- Sub SoundPlungerPull()
- PlaySoundAtLevelStatic ("Plunger_Pull_1"), PlungerPullSoundLevel, Plunger
- End Sub
- Sub SoundPlungerReleaseBall()
- PlaySoundAtLevelStatic ("Plunger_Release_Ball"), PlungerReleaseSoundLevel, Plunger
- End Sub
- Sub SoundPlungerReleaseNoBall()
- PlaySoundAtLevelStatic ("Plunger_Release_No_Ball"), PlungerReleaseSoundLevel, Plunger
- End Sub
- '///////////////////////////// KNOCKER SOLENOID ////////////////////////////
- Sub KnockerSolenoid()
- PlaySoundAtLevelStatic SoundFX("Knocker_1",DOFKnocker), KnockerSoundLevel, KnockerPosition
- End Sub
- '///////////////////////////// DRAIN SOUNDS ////////////////////////////
- Sub RandomSoundDrain(drainswitch)
- PlaySoundAtLevelStatic ("Drain_" & Int(Rnd*11)+1), DrainSoundLevel, drainswitch
- End Sub
- '///////////////////////////// TROUGH BALL RELEASE SOLENOID SOUNDS ////////////////////////////
- Sub RandomSoundBallRelease(drainswitch)
- PlaySoundAtLevelStatic SoundFX("BallRelease" & Int(Rnd*7)+1,DOFContactors), BallReleaseSoundLevel, drainswitch
- End Sub
- '///////////////////////////// SLINGSHOT SOLENOID SOUNDS ////////////////////////////
- Sub RandomSoundSlingshotLeft(sling)
- PlaySoundAtLevelStatic SoundFX("Sling_L" & Int(Rnd*10)+1,DOFContactors), SlingshotSoundLevel, Sling
- End Sub
- Sub RandomSoundSlingshotRight(sling)
- PlaySoundAtLevelStatic SoundFX("Sling_R" & Int(Rnd*8)+1,DOFContactors), SlingshotSoundLevel, Sling
- End Sub
- '///////////////////////////// BUMPER SOLENOID SOUNDS ////////////////////////////
- Sub RandomSoundBumperTop(Bump)
- PlaySoundAtLevelStatic SoundFX("Bumpers_Top_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
- End Sub
- Sub RandomSoundBumperMiddle(Bump)
- PlaySoundAtLevelStatic SoundFX("Bumpers_Middle_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
- End Sub
- Sub RandomSoundBumperBottom(Bump)
- PlaySoundAtLevelStatic SoundFX("Bumpers_Bottom_" & Int(Rnd*5)+1,DOFContactors), Vol(ActiveBall) * BumperSoundFactor, Bump
- End Sub
- '///////////////////////////// SPINNER SOUNDS ////////////////////////////
- Sub SoundSpinner(spinnerswitch)
- PlaySoundAtLevelStatic ("Spinner"), SpinnerSoundLevel, spinnerswitch
- End Sub
- '///////////////////////////// FLIPPER BATS SOUND SUBROUTINES ////////////////////////////
- '///////////////////////////// FLIPPER BATS SOLENOID ATTACK SOUND ////////////////////////////
- Sub SoundFlipperUpAttackLeft(flipper)
- FlipperUpAttackLeftSoundLevel = RndNum(FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel)
- PlaySoundAtLevelStatic SoundFX("Flipper_Attack-L01",DOFFlippers), FlipperUpAttackLeftSoundLevel, flipper
- End Sub
- Sub SoundFlipperUpAttackRight(flipper)
- FlipperUpAttackRightSoundLevel = RndNum(FlipperUpAttackMinimumSoundLevel, FlipperUpAttackMaximumSoundLevel)
- PlaySoundAtLevelStatic SoundFX("Flipper_Attack-R01",DOFFlippers), FlipperUpAttackLeftSoundLevel, flipper
- End Sub
- '///////////////////////////// FLIPPER BATS SOLENOID CORE SOUND ////////////////////////////
- Sub RandomSoundFlipperUpLeft(flipper)
- PlaySoundAtLevelStatic SoundFX("Flipper_L0" & Int(Rnd*9)+1,DOFFlippers), FlipperLeftHitParm, Flipper
- End Sub
- Sub RandomSoundFlipperUpRight(flipper)
- PlaySoundAtLevelStatic SoundFX("Flipper_R0" & Int(Rnd*9)+1,DOFFlippers), FlipperRightHitParm, Flipper
- End Sub
- Sub RandomSoundReflipUpLeft(flipper)
- PlaySoundAtLevelStatic SoundFX("Flipper_ReFlip_L0" & Int(Rnd*3)+1,DOFFlippers), (RndNum(0.8, 1))*FlipperUpSoundLevel, Flipper
- End Sub
- Sub RandomSoundReflipUpRight(flipper)
- PlaySoundAtLevelStatic SoundFX("Flipper_ReFlip_R0" & Int(Rnd*3)+1,DOFFlippers), (RndNum(0.8, 1))*FlipperUpSoundLevel, Flipper
- End Sub
- Sub RandomSoundFlipperDownLeft(flipper)
- PlaySoundAtLevelStatic SoundFX("Flipper_Left_Down_" & Int(Rnd*7)+1,DOFFlippers), FlipperDownSoundLevel, Flipper
- End Sub
- Sub RandomSoundFlipperDownRight(flipper)
- PlaySoundAtLevelStatic SoundFX("Flipper_Right_Down_" & Int(Rnd*8)+1,DOFFlippers), FlipperDownSoundLevel, Flipper
- End Sub
- '///////////////////////////// FLIPPER BATS BALL COLLIDE SOUND ////////////////////////////
- Sub LeftFlipperCollide(parm)
- FlipperLeftHitParm = parm/10
- If FlipperLeftHitParm > 1 Then
- FlipperLeftHitParm = 1
- End If
- FlipperLeftHitParm = FlipperUpSoundLevel * FlipperLeftHitParm
- RandomSoundRubberFlipper(parm)
- End Sub
- Sub RightFlipperCollide(parm)
- FlipperRightHitParm = parm/10
- If FlipperRightHitParm > 1 Then
- FlipperRightHitParm = 1
- End If
- FlipperRightHitParm = FlipperUpSoundLevel * FlipperRightHitParm
- RandomSoundRubberFlipper(parm)
- End Sub
- Sub RandomSoundRubberFlipper(parm)
- PlaySoundAtLevelActiveBall ("Flipper_Rubber_" & Int(Rnd*7)+1), parm * RubberFlipperSoundFactor
- End Sub
- '///////////////////////////// ROLLOVER SOUNDS ////////////////////////////
- Sub RandomSoundRollover()
- PlaySoundAtLevelActiveBall ("Rollover_" & Int(Rnd*4)+1), RolloverSoundLevel
- End Sub
- Sub Rollovers_Hit(idx)
- RandomSoundRollover
- End Sub
- '///////////////////////////// VARIOUS PLAYFIELD SOUND SUBROUTINES ////////////////////////////
- '///////////////////////////// RUBBERS AND POSTS ////////////////////////////
- '///////////////////////////// RUBBERS - EVENTS ////////////////////////////
- Sub Rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 5 then
- RandomSoundRubberStrong 1
- End if
- If finalspeed <= 5 then
- RandomSoundRubberWeak()
- End If
- End Sub
- '///////////////////////////// RUBBERS AND POSTS - STRONG IMPACTS ////////////////////////////
- Sub RandomSoundRubberStrong(voladj)
- Select Case Int(Rnd*10)+1
- Case 1 : PlaySoundAtLevelActiveBall ("Rubber_Strong_1"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
- Case 2 : PlaySoundAtLevelActiveBall ("Rubber_Strong_2"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
- Case 3 : PlaySoundAtLevelActiveBall ("Rubber_Strong_3"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
- Case 4 : PlaySoundAtLevelActiveBall ("Rubber_Strong_4"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
- Case 5 : PlaySoundAtLevelActiveBall ("Rubber_Strong_5"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
- Case 6 : PlaySoundAtLevelActiveBall ("Rubber_Strong_6"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
- Case 7 : PlaySoundAtLevelActiveBall ("Rubber_Strong_7"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
- Case 8 : PlaySoundAtLevelActiveBall ("Rubber_Strong_8"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
- Case 9 : PlaySoundAtLevelActiveBall ("Rubber_Strong_9"), Vol(ActiveBall) * RubberStrongSoundFactor*voladj
- Case 10 : PlaySoundAtLevelActiveBall ("Rubber_1_Hard"), Vol(ActiveBall) * RubberStrongSoundFactor * 0.6*voladj
- End Select
- End Sub
- '///////////////////////////// RUBBERS AND POSTS - WEAK IMPACTS ////////////////////////////
- Sub RandomSoundRubberWeak()
- PlaySoundAtLevelActiveBall ("Rubber_" & Int(Rnd*9)+1), Vol(ActiveBall) * RubberWeakSoundFactor
- End Sub
- '///////////////////////////// WALL IMPACTS ////////////////////////////
- Sub Walls_Hit(idx)
- RandomSoundWall()
- End Sub
- Sub RandomSoundWall()
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- Select Case Int(Rnd*5)+1
- Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_1"), Vol(ActiveBall) * WallImpactSoundFactor
- Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_2"), Vol(ActiveBall) * WallImpactSoundFactor
- Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_5"), Vol(ActiveBall) * WallImpactSoundFactor
- Case 4 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_7"), Vol(ActiveBall) * WallImpactSoundFactor
- Case 5 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_9"), Vol(ActiveBall) * WallImpactSoundFactor
- End Select
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- Select Case Int(Rnd*4)+1
- Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_3"), Vol(ActiveBall) * WallImpactSoundFactor
- Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_4"), Vol(ActiveBall) * WallImpactSoundFactor
- Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_6"), Vol(ActiveBall) * WallImpactSoundFactor
- Case 4 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_8"), Vol(ActiveBall) * WallImpactSoundFactor
- End Select
- End If
- If finalspeed < 6 Then
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_4"), Vol(ActiveBall) * WallImpactSoundFactor
- Case 2 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_6"), Vol(ActiveBall) * WallImpactSoundFactor
- Case 3 : PlaySoundAtLevelExistingActiveBall ("Wall_Hit_8"), Vol(ActiveBall) * WallImpactSoundFactor
- End Select
- End if
- End Sub
- '///////////////////////////// METAL TOUCH SOUNDS ////////////////////////////
- Sub RandomSoundMetal()
- PlaySoundAtLevelActiveBall ("Metal_Touch_" & Int(Rnd*13)+1), Vol(ActiveBall) * MetalImpactSoundFactor
- End Sub
- '///////////////////////////// METAL - EVENTS ////////////////////////////
- Sub Metals_Hit (idx)
- RandomSoundMetal
- End Sub
- Sub ShooterDiverter_collide(idx)
- RandomSoundMetal
- End Sub
- '///////////////////////////// BOTTOM ARCH BALL GUIDE ////////////////////////////
- '///////////////////////////// BOTTOM ARCH BALL GUIDE - SOFT BOUNCES ////////////////////////////
- Sub RandomSoundBottomArchBallGuide()
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- PlaySoundAtLevelActiveBall ("Apron_Bounce_"& Int(Rnd*2)+1), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- Select Case Int(Rnd*2)+1
- Case 1 : PlaySoundAtLevelActiveBall ("Apron_Bounce_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
- Case 2 : PlaySoundAtLevelActiveBall ("Apron_Bounce_Soft_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
- End Select
- End If
- If finalspeed < 6 Then
- Select Case Int(Rnd*2)+1
- Case 1 : PlaySoundAtLevelActiveBall ("Apron_Bounce_Soft_1"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
- Case 2 : PlaySoundAtLevelActiveBall ("Apron_Medium_3"), Vol(ActiveBall) * BottomArchBallGuideSoundFactor
- End Select
- End if
- End Sub
- '///////////////////////////// BOTTOM ARCH BALL GUIDE - HARD HITS ////////////////////////////
- Sub RandomSoundBottomArchBallGuideHardHit()
- PlaySoundAtLevelActiveBall ("Apron_Hard_Hit_" & Int(Rnd*3)+1), BottomArchBallGuideSoundFactor * 0.25
- End Sub
- Sub Apron1_Hit (idx)
- If Abs(cor.ballvelx(activeball.id) < 4) and cor.ballvely(activeball.id) > 7 then
- RandomSoundBottomArchBallGuideHardHit()
- Else
- RandomSoundBottomArchBallGuide
- End If
- End Sub
- '///////////////////////////// FLIPPER BALL GUIDE ////////////////////////////
- Sub RandomSoundFlipperBallGuide()
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- Select Case Int(Rnd*2)+1
- Case 1 : PlaySoundAtLevelActiveBall ("Apron_Hard_1"), Vol(ActiveBall) * FlipperBallGuideSoundFactor
- Case 2 : PlaySoundAtLevelActiveBall ("Apron_Hard_2"), Vol(ActiveBall) * 0.8 * FlipperBallGuideSoundFactor
- End Select
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- PlaySoundAtLevelActiveBall ("Apron_Medium_" & Int(Rnd*3)+1), Vol(ActiveBall) * FlipperBallGuideSoundFactor
- End If
- If finalspeed < 6 Then
- PlaySoundAtLevelActiveBall ("Apron_Soft_" & Int(Rnd*7)+1), Vol(ActiveBall) * FlipperBallGuideSoundFactor
- End If
- End Sub
- '///////////////////////////// TARGET HIT SOUNDS ////////////////////////////
- Sub RandomSoundTargetHitStrong()
- PlaySoundAtLevelActiveBall SoundFX("Target_Hit_" & Int(Rnd*4)+5,DOFTargets), Vol(ActiveBall) * 0.45 * TargetSoundFactor
- End Sub
- Sub RandomSoundTargetHitWeak()
- PlaySoundAtLevelActiveBall SoundFX("Target_Hit_" & Int(Rnd*4)+1,DOFTargets), Vol(ActiveBall) * TargetSoundFactor
- End Sub
- Sub PlayTargetSound()
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 10 then
- RandomSoundTargetHitStrong()
- RandomSoundBallBouncePlayfieldSoft Activeball
- Else
- RandomSoundTargetHitWeak()
- End If
- End Sub
- Sub Targets_Hit (idx)
- PlayTargetSound
- End Sub
- '///////////////////////////// BALL BOUNCE SOUNDS ////////////////////////////
- Sub RandomSoundBallBouncePlayfieldSoft(aBall)
- Select Case Int(Rnd*9)+1
- Case 1 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_1"), volz(aBall) * BallBouncePlayfieldSoftFactor, aBall
- Case 2 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_2"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.5, aBall
- Case 3 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_3"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.8, aBall
- Case 4 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_4"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.5, aBall
- Case 5 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Soft_5"), volz(aBall) * BallBouncePlayfieldSoftFactor, aBall
- Case 6 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_1"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
- Case 7 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_2"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
- Case 8 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_5"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.2, aBall
- Case 9 : PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_7"), volz(aBall) * BallBouncePlayfieldSoftFactor * 0.3, aBall
- End Select
- End Sub
- Sub RandomSoundBallBouncePlayfieldHard(aBall)
- PlaySoundAtLevelStatic ("Ball_Bounce_Playfield_Hard_" & Int(Rnd*7)+1), volz(aBall) * BallBouncePlayfieldHardFactor, aBall
- End Sub
- '///////////////////////////// DELAYED DROP - TO PLAYFIELD - SOUND ////////////////////////////
- Sub RandomSoundDelayedBallDropOnPlayfield(aBall)
- Select Case Int(Rnd*5)+1
- Case 1 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_1_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
- Case 2 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_2_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
- Case 3 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_3_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
- Case 4 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_4_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
- Case 5 : PlaySoundAtLevelStatic ("Ball_Drop_Playfield_5_Delayed"), DelayedBallDropOnPlayfieldSoundLevel, aBall
- End Select
- End Sub
- '///////////////////////////// BALL GATES AND BRACKET GATES SOUNDS ////////////////////////////
- Sub SoundPlayfieldGate()
- PlaySoundAtLevelStatic ("Gate_FastTrigger_" & Int(Rnd*2)+1), GateSoundLevel, Activeball
- End Sub
- Sub SoundHeavyGate()
- PlaySoundAtLevelStatic ("Gate_2"), GateSoundLevel, Activeball
- End Sub
- Sub Gates_hit(idx)
- SoundHeavyGate
- End Sub
- Sub GatesWire_hit(idx)
- SoundPlayfieldGate
- End Sub
- '///////////////////////////// LEFT LANE ENTRANCE - SOUNDS ////////////////////////////
- Sub RandomSoundLeftArch()
- PlaySoundAtLevelActiveBall ("Arch_L" & Int(Rnd*4)+1), Vol(ActiveBall) * ArchSoundFactor
- End Sub
- Sub RandomSoundRightArch()
- PlaySoundAtLevelActiveBall ("Arch_R" & Int(Rnd*4)+1), Vol(ActiveBall) * ArchSoundFactor
- End Sub
- Sub Arch1_hit()
- If Activeball.velx > 1 Then SoundPlayfieldGate
- StopSound "Arch_L1"
- StopSound "Arch_L2"
- StopSound "Arch_L3"
- StopSound "Arch_L4"
- End Sub
- Sub Arch1_unhit()
- If activeball.velx < -8 Then
- RandomSoundRightArch
- End If
- End Sub
- Sub Arch2_hit()
- If Activeball.velx < 1 Then SoundPlayfieldGate
- StopSound "Arch_R1"
- StopSound "Arch_R2"
- StopSound "Arch_R3"
- StopSound "Arch_R4"
- End Sub
- Sub Arch2_unhit()
- If activeball.velx > 10 Then
- RandomSoundLeftArch
- End If
- End Sub
- '///////////////////////////// SAUCERS (KICKER HOLES) ////////////////////////////
- Sub SoundSaucerLock()
- PlaySoundAtLevelStatic ("Saucer_Enter_" & Int(Rnd*2)+1), SaucerLockSoundLevel, Activeball
- End Sub
- Sub SoundSaucerKick(scenario, saucer)
- Select Case scenario
- Case 0: PlaySoundAtLevelStatic SoundFX("Saucer_Empty", DOFContactors), SaucerKickSoundLevel, saucer
- Case 1: PlaySoundAtLevelStatic SoundFX("Saucer_Kick", DOFContactors), SaucerKickSoundLevel, saucer
- End Select
- End Sub
- '///////////////////////////// BALL COLLISION SOUND ////////////////////////////
- Sub OnBallBallCollision(ball1, ball2, velocity)
- Dim snd
- Select Case Int(Rnd*7)+1
- Case 1 : snd = "Ball_Collide_1"
- Case 2 : snd = "Ball_Collide_2"
- Case 3 : snd = "Ball_Collide_3"
- Case 4 : snd = "Ball_Collide_4"
- Case 5 : snd = "Ball_Collide_5"
- Case 6 : snd = "Ball_Collide_6"
- Case 7 : snd = "Ball_Collide_7"
- End Select
- PlaySound (snd), 0, Csng(velocity) ^2 / 200 * BallWithBallCollisionSoundFactor * VolumeDial, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
- End Sub
- ' ============================================================================================
- ' GNMOD - Multiple High Score Display and Collection
- ' ============================================================================================
- Dim EnteringInitials ' Normally zero, set to non-zero to enter initials
- EnteringInitials = 0
- Dim PlungerPulled
- PlungerPulled = 0
- Dim SelectedChar ' character under the "cursor" when entering initials
- Dim HSTimerCount ' Pass counter for HS timer, scores are cycled by the timer
- HSTimerCount = 5 ' Timer is initially enabled, it'll wrap from 5 to 1 when it's displayed
- Dim InitialString ' the string holding the player's initials as they're entered
- Dim AlphaString ' A-Z, 0-9, space (_) and backspace (<)
- Dim AlphaStringPos ' pointer to AlphaString, move forward and backward with flipper keys
- AlphaString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_<"
- Dim HSNewHigh ' The new score to be recorded
- Dim HSScore(5) ' High Scores read in from config file
- Dim HSName(5) ' High Score Initials read in from config file
- ' default high scores, remove this when the scores are available from the config file
- HSScore(1) = 75000
- HSScore(2) = 70000
- HSScore(3) = 60000
- HSScore(4) = 55000
- HSScore(5) = 50000
- HSName(1) = "AAA"
- HSName(2) = "ZZZ"
- HSName(3) = "XXX"
- HSName(4) = "ABC"
- HSName(5) = "BBB"
- Sub HighScoreTimer_Timer
- if EnteringInitials then
- if HSTimerCount = 1 then
- SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
- HSTimerCount = 2
- else
- SetHSLine 3, InitialString
- HSTimerCount = 1
- end if
- elseif InProgress then
- SetHSLine 1, "HIGH SCORE1"
- SetHSLine 2, HSScore(1)
- SetHSLine 3, HSName(1)
- HSTimerCount = 5 ' set so the highest score will show after the game is over
- HighScoreTimer.enabled=false
- elseif CheckAllScores then
- NewHighScore sortscores(ScoreChecker),sortplayers(ScoreChecker)
- else
- ' cycle through high scores
- HighScoreTimer.interval=2000
- HSTimerCount = HSTimerCount + 1
- if HsTimerCount > 5 then
- HSTimerCount = 1
- End If
- SetHSLine 1, "HIGH SCORE"+FormatNumber(HSTimerCount,0)
- SetHSLine 2, HSScore(HSTimerCount)
- SetHSLine 3, HSName(HSTimerCount)
- end if
- End Sub
- Function GetHSChar(String, Index)
- dim ThisChar
- dim FileName
- ThisChar = Mid(String, Index, 1)
- FileName = "PostIt"
- if ThisChar = " " or ThisChar = "" then
- FileName = FileName & "BL"
- elseif ThisChar = "<" then
- FileName = FileName & "LT"
- elseif ThisChar = "_" then
- FileName = FileName & "SP"
- else
- FileName = FileName & ThisChar
- End If
- GetHSChar = FileName
- End Function
- Sub SetHsLine(LineNo, String)
- dim Letter
- dim ThisDigit
- dim ThisChar
- dim StrLen
- dim LetterLine
- dim Index
- dim StartHSArray
- dim EndHSArray
- dim LetterName
- dim xfor
- StartHSArray=array(0,1,12,22)
- EndHSArray=array(0,11,21,31)
- StrLen = len(string)
- Index = 1
- for xfor = StartHSArray(LineNo) to EndHSArray(LineNo)
- Eval("HS"&xfor).image = GetHSChar(String, Index)
- Index = Index + 1
- next
- End Sub
- Sub NewHighScore(NewScore, PlayNum)
- if NewScore > HSScore(5) then
- HighScoreTimer.interval = 500
- HSTimerCount = 1
- AlphaStringPos = 1 ' start with first character "A"
- EnteringInitials = 1 ' intercept the control keys while entering initials
- InitialString = "" ' initials entered so far, initialize to empty
- SetHSLine 1, "PLAYER "+FormatNumber(PlayNum,0)
- SetHSLine 2, "ENTER NAME"
- SetHSLine 3, MID(AlphaString, AlphaStringPos, 1)
- HSNewHigh = NewScore
- For xx=1 to HighScoreReward
- AddSpecial
- next
- End if
- ScoreChecker=ScoreChecker-1
- if ScoreChecker=0 then
- CheckAllScores=0
- end if
- End Sub
- Sub CollectInitials(keycode)
- If keycode = LeftFlipperKey Then
- ' back up to previous character
- AlphaStringPos = AlphaStringPos - 1
- if AlphaStringPos < 1 then
- AlphaStringPos = len(AlphaString) ' handle wrap from beginning to end
- if InitialString = "" then
- ' Skip the backspace if there are no characters to backspace over
- AlphaStringPos = AlphaStringPos - 1
- End if
- end if
- SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
- PlaySound "DropTargetDropped"
- elseif keycode = RightFlipperKey Then
- ' advance to next character
- AlphaStringPos = AlphaStringPos + 1
- if AlphaStringPos > len(AlphaString) or (AlphaStringPos = len(AlphaString) and InitialString = "") then
- ' Skip the backspace if there are no characters to backspace over
- AlphaStringPos = 1
- end if
- SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
- PlaySound "DropTargetDropped"
- elseif keycode = StartGameKey or keycode = PlungerKey Then
- SelectedChar = MID(AlphaString, AlphaStringPos, 1)
- if SelectedChar = "_" then
- InitialString = InitialString & " "
- PlaySound("Ding10")
- elseif SelectedChar = "<" then
- InitialString = MID(InitialString, 1, len(InitialString) - 1)
- if len(InitialString) = 0 then
- ' If there are no more characters to back over, don't leave the < displayed
- AlphaStringPos = 1
- end if
- PlaySound("Ding100")
- else
- InitialString = InitialString & SelectedChar
- PlaySound("Ding10")
- end if
- if len(InitialString) < 3 then
- SetHSLine 3, InitialString & SelectedChar
- End If
- End If
- if len(InitialString) = 3 then
- ' save the score
- for i = 5 to 1 step -1
- if i = 1 or (HSNewHigh > HSScore(i) and HSNewHigh <= HSScore(i - 1)) then
- ' Replace the score at this location
- if i < 5 then
- ' MsgBox("Moving " & i & " to " & (i + 1))
- HSScore(i + 1) = HSScore(i)
- HSName(i + 1) = HSName(i)
- end if
- ' MsgBox("Saving initials " & InitialString & " to position " & i)
- EnteringInitials = 0
- HSScore(i) = HSNewHigh
- HSName(i) = InitialString
- HSTimerCount = 5
- HighScoreTimer_Timer
- HighScoreTimer.interval = 2000
- PlaySound("Ding1000")
- exit sub
- elseif i < 5 then
- ' move the score in this slot down by 1, it's been exceeded by the new score
- ' MsgBox("Moving " & i & " to " & (i + 1))
- HSScore(i + 1) = HSScore(i)
- HSName(i + 1) = HSName(i)
- end if
- next
- End If
- End Sub
- ' END GNMOD
- ' ============================================================================================
- ' GNMOD - New Options menu
- ' ============================================================================================
- Dim EnteringOptions
- Dim CurrentOption
- Dim OptionCHS
- Dim MaxOption
- Dim OptionHighScorePosition
- Dim XOpt
- Dim StartingArray
- Dim EndingArray
- StartingArray=Array(0,1,2,30,33,61,89,117,145,173,201,229)
- EndingArray=Array(0,1,29,32,60,88,116,144,172,200,228,256)
- EnteringOptions = 0
- MaxOption = 9
- OptionCHS = 0
- OptionHighScorePosition = 0
- Const OptionLinesToMark="111000011"
- Const OptionLine1="" 'do not use this line
- Const OptionLine2="" 'do not use this line
- Const OptionLine3="" 'do not use this line
- Const OptionLine4=""
- Const OptionLine5=""
- Const OptionLine6=""
- Const OptionLine7=""
- Const OptionLine8="" 'do not use this line
- Const OptionLine9="" 'do not use this line
- Sub OperatorMenuTimer_Timer
- EnteringOptions = 1
- OperatorMenuTimer.enabled=false
- ShowOperatorMenu
- end sub
- sub ShowOperatorMenu
- OperatorMenuBackdrop.image = "OperatorMenu"
- OptionCHS = 0
- CurrentOption = 1
- DisplayAllOptions
- OperatorOption1.image = "BluePlus"
- SetHighScoreOption
- End Sub
- Sub DisplayAllOptions
- dim linecounter
- dim tempstring
- For linecounter = 1 to MaxOption
- tempstring=Eval("OptionLine"&linecounter)
- Select Case linecounter
- Case 1:
- tempstring=tempstring + FormatNumber(BallsPerGame,0)
- SetOptLine 1,tempstring
- Case 2:
- if Replay3Table(ReplayLevel)=999000 then
- tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0)
- elseif Replay4Table(ReplayLevel)=999000 then
- tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0)
- else
- tempstring = FormatNumber(Replay1Table(ReplayLevel),0) + "/" + FormatNumber(Replay2Table(ReplayLevel),0) + "/" + FormatNumber(Replay3Table(ReplayLevel),0) + "/" + FormatNumber(Replay4Table(ReplayLevel),0)
- end if
- SetOptLine 2,tempstring
- Case 3:
- If OptionCHS=0 then
- tempstring = "NO"
- else
- tempstring = "YES"
- end if
- SetOptLine 3,tempstring
- Case 4:
- SetOptLine 4, tempstring
- SetOptLine 5, tempstring
- Case 5:
- SetOptLine 6, tempstring
- SetOptLine 7, tempstring
- Case 6:
- SetOptLine 8, tempstring
- SetOptLine 9, tempstring
- Case 7:
- SetOptLine 10, tempstring
- SetOptLine 11, tempstring
- Case 8:
- Case 9:
- End Select
- next
- end sub
- sub MoveArrow
- do
- CurrentOption = CurrentOption + 1
- If CurrentOption>Len(OptionLinesToMark) then
- CurrentOption=1
- end if
- loop until Mid(OptionLinesToMark,CurrentOption,1)="1"
- end sub
- sub CollectOptions(ByVal keycode)
- if Keycode = LeftFlipperKey then
- PlaySound "DropTargetDropped"
- For XOpt = 1 to MaxOption
- Eval("OperatorOption"&XOpt).image = "PostitBL"
- next
- MoveArrow
- if CurrentOption<8 then
- Eval("OperatorOption"&CurrentOption).image = "BluePlus"
- elseif CurrentOption=8 then
- Eval("OperatorOption"&CurrentOption).image = "GreenCheck"
- else
- Eval("OperatorOption"&CurrentOption).image = "RedX"
- end if
- elseif Keycode = RightFlipperKey then
- PlaySound "DropTargetDropped"
- if CurrentOption = 1 then
- If BallsPerGame = 3 then
- BallsPerGame = 5
- else
- BallsPerGame = 3
- end if
- DisplayAllOptions
- elseif CurrentOption = 2 then
- ReplayLevel=ReplayLevel+1
- If ReplayLevel>ReplayTableMax then
- ReplayLevel=1
- end if
- DisplayAllOptions
- elseif CurrentOption = 3 then
- if OptionCHS = 0 then
- OptionCHS = 1
- else
- OptionCHS = 0
- end if
- DisplayAllOptions
- elseif CurrentOption = 8 or CurrentOption = 9 then
- if OptionCHS=1 then
- HSScore(1) = 75000
- HSScore(2) = 70000
- HSScore(3) = 60000
- HSScore(4) = 55000
- HSScore(5) = 50000
- HSName(1) = "AAA"
- HSName(2) = "ZZZ"
- HSName(3) = "XXX"
- HSName(4) = "ABC"
- HSName(5) = "BBB"
- end if
- if CurrentOption = 8 then
- savehs
- else
- loadhs
- end if
- OperatorMenuBackdrop.image = "PostitBL"
- For XOpt = 1 to MaxOption
- Eval("OperatorOption"&XOpt).image = "PostitBL"
- next
- For XOpt = 1 to 256
- Eval("Option"&XOpt).image = "PostItBL"
- next
- RefreshReplayCard
- InstructCard.image="IC"
- EnteringOptions = 0
- end if
- end if
- End Sub
- Sub SetHighScoreOption
- End Sub
- Function GetOptChar(String, Index)
- dim ThisChar
- dim FileName
- ThisChar = Mid(String, Index, 1)
- FileName = "PostIt"
- if ThisChar = " " or ThisChar = "" then
- FileName = FileName & "BL"
- elseif ThisChar = "<" then
- FileName = FileName & "LT"
- elseif ThisChar = ">" then
- FileName = FileName & "GT"
- elseif ThisChar = "_" then
- FileName = FileName & "SP"
- elseif ThisChar = "/" then
- FileName = FileName & "SL"
- elseif ThisChar = "," then
- FileName = FileName & "CM"
- else
- FileName = FileName & ThisChar
- End If
- GetOptChar = FileName
- End Function
- dim LineLengths(22) ' maximum number of lines
- Sub SetOptLine(LineNo, String)
- Dim DispLen
- Dim StrLen
- dim xfor
- dim Letter
- dim ThisDigit
- dim ThisChar
- dim LetterLine
- dim Index
- dim LetterName
- StrLen = len(string)
- Index = 1
- StrLen = len(String)
- DispLen = StrLen
- if (DispLen < LineLengths(LineNo)) Then
- DispLen = LineLengths(LineNo)
- end If
- for xfor = StartingArray(LineNo) to StartingArray(LineNo) + DispLen
- Eval("Option"&xfor).image = GetOptChar(string, Index)
- Index = Index + 1
- next
- LineLengths(LineNo) = StrLen
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment