Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '*
- '* Williams' Space Mission (1976)
- '* Table scripted by Loserman76
- '*
- '*
- '*
- 'Some DOF Config by Outhere
- '101, Left Flipper
- '102, Right Flipper
- '103, Left Slingshot
- '104, Right Slingshot
- '105, Bumper Right
- '106, Bumper Left
- '107,
- '108,
- '109,
- '110,
- '111, kicker Right
- '112, kicker Left
- '113,
- '114, LeftSpinner = Shaker
- '115,
- '116
- '117
- '118,
- '119,
- '120, Ball Release
- '121,
- '122
- '123
- '124
- '128, Knocker
- option explicit
- Randomize
- ExecuteGlobal GetTextFile("core.vbs")
- On Error Resume Next
- ExecuteGlobal GetTextFile("Controller.vbs")
- If Err Then MsgBox "Unable to open Controller.vbs. Ensure that it is in the scripts folder."
- On Error Goto 0
- Const cGameName = "SpaceMission_1976"
- Const ShadowFlippersOn = true
- Const ShadowBallOn = true
- Const ShadowConfigFile = false
- Dim Controller ' B2S
- Dim B2SScore ' B2S Score Displayed
- Const HSFileName="SpaceMission_76VPX.txt"
- Const B2STableName="SpaceMission_1976"
- 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,CheckAllPoints
- dim sortscores(4)
- dim sortpoints(4)
- dim sortplayerpoints(4)
- dim sortplayers(4)
- Dim B2SOn 'True/False if want backglass
- dim ChimesOn
- Dim TextStr,TextStr2
- Dim i,xx, LStep, RStep
- Dim obj
- Dim bgpos
- Dim kgpos
- Dim dooralreadyopen
- Dim kgdooralreadyopen
- Dim TargetSpecialLit
- Dim Points210counter
- Dim Points500counter
- Dim Points1000counter
- Dim Points2000counter
- 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 BallReplay1
- Dim BallReplay2
- Dim BallReplay3
- Dim ReplayBalls1Paid(4)
- Dim ReplayBalls2Paid(4)
- Dim ReplayBalls3Paid(4)
- Dim TableTilted
- Dim TiltCount
- Dim debugscore
- Dim AltRelayValue
- 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 GreenTargetsDownCounter
- dim BlueTargetsDownCounter
- dim YellowTargetsDownCounter
- Dim bump1
- Dim bump2
- Dim bump3
- Dim bump4
- Dim LastChime10
- Dim LastChime100
- Dim LastChime1000
- Dim Score10
- Dim Score100
- dim tempbumper
- Dim MotorRunning
- Dim Replay1Table(35)
- Dim Replay2Table(35)
- Dim Replay3Table(35)
- Dim Replay4Table(35)
- Dim ReplayBallsTable1(16)
- Dim ReplayBallsTable2(16)
- Dim ReplayBallsTable3(16)
- Dim ReplayTableSet
- Dim ReplayLevel
- Dim ReplayBalls
- Dim ReplayTableMax
- Dim ReplayBallsTableMax
- Dim BaseHit,BaseHitCounter, x
- Dim LeftTargetFlag,RightTargetFlag
- Dim FootballPosition,FootballResetFlag,FootballScore
- Dim ImpulseReelCount,ScoreMotorPosition
- Dim TempScore, TempAdvance, KickoffFlag, MatchCount
- Dim StartGameState, ExtraBallFlag, DoodleBugFlag, AdvanceFlag, SuperAdvanceFlag
- Dim KickerCounter, DoodleTargetCount, YellowBumperFlag, GreenBumperFlag, DoodleBGLight, SpecialFlag, SpecialSetting, ScoreMotorStepper, SlingHoldCounter
- Dim RightBonusCounter, BonusSide, LeftSpinnerCounter, RightSpinnerCounter, TopTargetCounter, BottomTargetCounter, movetarget, movedirection, movetargetup, movetargetupcount
- Sub Table1_Init()
- If Table1.ShowDT = false then
- For each obj in DesktopCrap
- obj.visible=False
- next
- 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
- LoadEM
- LoadLMEMConfig2
- HideOptions
- SetupReplayTables
- PlasticsOff
- BumpersOff
- OperatorMenu=0
- StartGameState=0
- ChimesOn=1
- ReplayLevel=1
- ReplayBalls=1
- BallsPerGame=5
- ExtraBallFlag=0
- EMReel1.ResetToZero
- EMReel2.ResetToZero
- HighScore=0
- MotorRunning=0
- BaseHit=0
- BaseHitCounter=0
- AdvanceFlag=1000
- SuperAdvanceFlag=5
- DoodleBGLight=1
- HighScoreReward=1
- BallTextBox.text=""
- MatchTextBox.text=""
- SpecialSetting=1
- Credits=0
- loadhs
- if HighScore=0 then HighScore=5000
- TableTilted=false
- TiltReel.SetValue(1)
- Match=int(Rnd*10)
- MatchReel.SetValue((Match)+1)
- CanPlayReel.SetValue(0)
- BaseRunner1.SetValue(1)
- BaseRunner2.SetValue(1)
- BaseRunner3.SetValue(1)
- OverTheTopReel.SetValue(0)
- RolloverReel1.SetValue(0)
- For each obj in PlayerHuds
- obj.SetValue(0)
- next
- For each obj in PlayerHUDScores
- obj.state=0
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- obj.visible=1
- Next
- For each obj in PlayerScoresOn
- obj.visible=0
- Next
- end If
- For each obj in PlayerScores
- obj.ResetToZero
- next
- KickerCounter=0
- DoodleTargetCount=1
- DoodleBugFlag=false
- YellowBumperFlag=false
- GreenBumperFlag=false
- Replay1=Replay1Table(ReplayLevel)
- Replay2=Replay2Table(ReplayLevel)
- Replay3=Replay3Table(ReplayLevel)
- Replay4=Replay4Table(ReplayLevel)
- BallReplay1=ReplayBallsTable1(ReplayBalls)
- BallReplay2=ReplayBallsTable2(ReplayBalls)
- BallReplay3=ReplayBallsTable3(ReplayBalls)
- BonusCounter=0
- HoleCounter=0
- bgpos=6
- kgpos=0
- FootballPosition=int(Rnd*12)+3
- If B2SOn then
- For i = 60 to 81
- Controller.B2SSetData i,0
- next
- Controller.B2SSetData 60+FootballPosition+1,1
- end if
- FootballReel.setvalue(FootballPosition+1)
- ImpulseReelCount=int(Rnd*4)+1
- dooralreadyopen=0
- kgdooralreadyopen=0
- for i = 0 to 49
- Collection2(i).Visible=0
- Collection2(i).collidable=false
- Collection2(i).hashitevent=False
- Next
- ' CenterT50.Visible=1
- CenterT50.Collidable=True
- CenterT50.Hashitevent=True
- movetarget=0
- movetargetup=0
- movetargetupcount=0
- movedirection=1
- MovingTargetTimer.enabled=true
- PtargetC.objroty=((movetarget*.8)-20.5)*-1
- RightBonusCounter=1
- RightBonus(RightBonusCounter).state=1
- InstructCard.image="IC"
- ReplayCard.image="BC"+FormatNumber(BallsPerGame,0)
- RefreshReplayCard
- ' ResetBalls
- ' PlaySound "Plunger"
- TargetSpecialLit = 0
- Points210counter=0
- Points500counter=0
- Points1000counter=0
- Points2000counter=0
- BonusBooster=3
- BonusBoosterCounter=0
- Players=0
- RotatorTemp=1
- InProgress=false
- ScoreText.text=HighScore
- If B2SOn Then
- if Match=0 then
- Controller.B2SSetMatch 10
- else
- Controller.B2SSetMatch Match
- end if
- Controller.B2SSetScoreRolloverPlayer1 0
- 'Controller.B2SSetScore 4,HighScore
- Controller.B2SSetTilt 1
- Controller.B2SSetCredits Credits
- Controller.B2SSetGameOver 1
- End If
- GameOverReel.setvalue(1)
- CreditsReel.SetValue(Credits)
- If Credits > 0 Then DOF 127, 1:CreditLight.state=1
- for i=1 to 2
- player=i
- If B2SOn Then
- Controller.B2SSetScorePlayer player, 0
- End If
- next
- bump1=1
- bump2=1
- bump3=1
- bump4=1
- InitPauser5.enabled=true
- End Sub
- Sub Table1_exit()
- savehs
- SaveLMEMConfig
- SaveLMEMConfig2
- If B2SOn Then Controller.Stop
- 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
- LeftFlipper.RotateToEnd
- PlaySound SoundFXDOF("FlipperUp",101,DOFOn,DOFContactors)
- PlaySound "buzzL",-1
- End If
- If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
- RightFlipper.RotateToEnd
- PlaySound "buzz",-1
- PlaySound SoundFXDOF("FlipperUp",102,DOFOn,DOFContactors)
- 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
- CreditLight.state=1
- end if
- if keycode = 5 then
- playsound "coinin"
- AddSpecial2
- keycode= StartGameKey
- CreditLight.state=1
- 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 127, DOFOff:CreditLight.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 GNMODthen
- Credits=Credits-1
- If Credits < 1 Then DOF 127, 0:CreditLight.state=0
- CreditsReel.SetValue(Credits)
- Players=1
- CanPlay1.state=1
- MatchReel.SetValue(0)
- Player=1
- playsound "startup_norm"
- TempPlayerUp=Player
- ' PlayerUpRotator.enabled=true
- rst=0
- BallInPlay=1
- InProgress=true
- GameOverReel.setvalue(0)
- resettimer.enabled=true
- RolloverReel1.SetValue(0)
- RolloverReel2.SetValue(0)
- RolloverReel3.SetValue(0)
- RolloverReel4.SetValue(0)
- OverTheTopReel.SetValue(0)
- BonusMultiplier=1
- If B2SOn Then
- Controller.B2SSetTilt 0
- Controller.B2SSetGameOver 0
- Controller.B2SSetMatch 0
- Controller.B2SSetCredits Credits
- 'Controller.B2SSetScore 4,HighScore
- Controller.B2SSetCanPlay 1
- Controller.B2SSetPlayerUp 1
- ' Controller.B2SSetBallInPlay BallInPlay
- Controller.B2SSetScoreRolloverPlayer1 0
- Controller.B2SSetScoreRolloverPlayer2 0
- Controller.B2SSetScoreRolloverPlayer3 0
- Controller.B2SSetScoreRolloverPlayer4 0
- Controller.B2SSetData 81,1
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- End If
- For each obj in PlayerScores
- ' obj.ResetToZero
- next
- For each obj in PlayerHuds
- obj.SetValue(0)
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- ' obj.ResetToZero
- obj.Visible=true
- next
- For each obj in PlayerScoresOn
- ' obj.ResetToZero
- obj.Visible=false
- next
- For each obj in PlayerHuds
- obj.SetValue(0)
- next
- For each obj in PlayerHUDScores
- obj.state=0
- next
- PlayerHuds(Player-1).SetValue(1)
- PlayerHUDScores(Player-1).state=1
- PlayerHUDScores(Player+3).state=1
- PlayerScores(Player-1).Visible=0
- PlayerScoresOn(Player-1).Visible=1
- 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
- LeftFlipper.RotateToStart
- PlaySound SoundFXDOF("FlipperDown",101,DOFOff,DOFContactors)
- StopSound "buzzL"
- End If
- If keycode = RightFlipperKey and InProgress=true and TableTilted=false Then
- RightFlipper.RotateToStart
- StopSound "buzz"
- PlaySound SoundFXDOF("FlipperDown",102,DOFOff,DOFContactors)
- End If
- End Sub
- Sub Drain_Hit()
- Drain.DestroyBall
- PlaySound "fx_drain"
- DOF 130,2
- Pause4Bonustimer.enabled=true
- End Sub
- Sub Pause4Bonustimer_timer
- Pause4Bonustimer.enabled=0
- AddBonus
- 'NextBallDelay.enabled=true
- End Sub
- Sub CloseGateTrigger_hit
- DOF 121, DOFPulse
- End Sub
- '***********************
- ' Flipper Logos
- '***********************
- dim angle
- Function PI()
- PI = 4*Atn(1)
- End Function
- Sub UpdateFlipperLogos_Timer
- ' LFlip.ObjRotZ = LeftFlipper.CurrentAngle-90
- ' RFlip.ObjRotZ = RightFlipper.CurrentAngle+90
- ' LFlip1.RotZ = LeftFlipper.CurrentAngle
- ' RFlip1.RotZ = RightFlipper.CurrentAngle
- PGate.Rotz = (Gate.CurrentAngle*.75) + 25
- PGate1.Rotz = (Gate3.CurrentAngle*.75) + 25
- FlipperLSh.RotZ = LeftFlipper.currentangle
- FlipperRSh.RotZ = RightFlipper.currentangle
- Dim SpinnerRadius: SpinnerRadius=7
- SpinnerRod.TransZ = (cos((leftspinner.CurrentAngle + 180) * (PI/180))+1) * SpinnerRadius
- SpinnerRod.TransY = sin((leftspinner.CurrentAngle) * (PI/180)) * -SpinnerRadius
- End Sub
- '***********************
- ' Moving Target
- '***********************
- sub MovingTargetTimer_timer
- if movedirection=1 Then
- Collection2(movetarget).visible=0
- Collection2(movetarget).collidable=False
- Collection2(movetarget).hashitevent=False
- movetarget=movetarget+1
- ' Collection2(movetarget).visible=1
- Collection2(movetarget).collidable=True
- Collection2(movetarget).hashitevent=True
- if movetarget>48 then
- movedirection=0
- end If
- PtargetC.objroty=((movetarget*.8)-20.5)*-1
- exit sub
- Else
- Collection2(movetarget).Visible=0
- Collection2(movetarget).collidable=False
- Collection2(movetarget).hashitevent=False
- movetarget=movetarget-1
- ' Collection2(movetarget).visible=1
- Collection2(movetarget).collidable=True
- Collection2(movetarget).hashitevent=True
- if movetarget<1 then
- movedirection=1
- end If
- end If
- PtargetC.objroty=((movetarget*.8)-20.5)*-1
- Select case ExtraBallFlag
- case 0:
- if RightBonusCounter=1 or RightBonusCounter=4 or RightBonusCounter=7 or RightBonusCounter=10 then
- LeftSpinnerLight.state=1
- if DoubleBonus002.state=1 or DoubleBonus003.state=1 or DoubleBonus004.state=1 then
- UpperLightCenter.state=1
- else
- UpperLightCenter.state=0
- end if
- else
- LeftSpinnerLight.state=0
- UpperLightCenter.state=0
- end if
- case 1:
- if RightBonusCounter=4 or RightBonusCounter=7 or RightBonusCounter=10 then
- LeftSpinnerLight.state=1
- if DoubleBonus002.state=1 or DoubleBonus003.state=1 or DoubleBonus004.state=1 then
- UpperLightCenter.state=1
- else
- UpperLightCenter.state=0
- end if
- else
- LeftSpinnerLight.state=0
- UpperLightCenter.state=0
- end if
- case 2:
- if RightBonusCounter=4 or RightBonusCounter=10 then
- LeftSpinnerLight.state=1
- if DoubleBonus002.state=1 or DoubleBonus003.state=1 or DoubleBonus004.state=1 then
- UpperLightCenter.state=1
- else
- UpperLightCenter.state=0
- end if
- else
- LeftSpinnerLight.state=0
- UpperLightCenter.state=0
- end if
- end select
- end sub
- '***********************
- ' slingshots
- '
- Sub RightSlingShot_Timer
- Select Case RStep
- Case 3:sling2.rotx = 10:sling1.rotx = 10
- Case 4:sling2.rotx=0:sling1.rotx=0:RightSlingShot.TimerEnabled = 0
- End Select
- RStep = RStep + 1
- DOF 103, DOFPulse
- End Sub
- Sub LeftSlingShot_Timer
- Select Case LStep
- Case 3:sling2.rotx = 10:sling1.rotx = 10
- Case 4:sling2.rotx=0:sling1.rotx=0:LeftSlingShot.TimerEnabled = 0
- End Select
- LStep = LStep + 1
- DOF 104, DOFPulse
- End Sub
- '***********************************
- ' Walls
- '***********************************
- Sub RubberWallSwitches_Hit(idx)
- if TableTilted=false then
- If idx<3 then
- SetMotor(50)
- else
- AddScore(10)
- end if
- end if
- end Sub
- '***********************************
- ' Spinners
- '***********************************
- Sub LeftSpinner_Spin
- if TableTilted=false then
- DOF 114, DOFPulse
- If LeftSpinnerLight.state=1 then
- AddScore(1000)
- else
- AddScore(100)
- end if
- end if
- end sub
- '***********************************
- Sub Collection2_hit(idx)
- If TableTilted=false then
- IncreaseBonus
- Select case RightBonusCounter
- case 1,4,7,10:
- SetMotor(5000)
- case 2,3:
- AddScore(1000)
- DoubleBonus002.state=1
- LeftKickerLight.state=1
- RightKickerLight.state=1
- DisplayAltRelay
- case 5,6:
- AddScore(1000)
- LeftSlingLight.state=1
- RightSlingLight.state=1
- DoubleBonus003.state=1
- LeftKickerLight.state=1
- RightKickerLight.state=1
- DisplayAltRelay
- case 8,9:
- AddScore(1000)
- DoubleBonus004.state=1
- LeftKickerLight.state=1
- RightKickerLight.state=1
- DisplayAltRelay
- end select
- IncreaseRightBonus
- end if
- end sub
- Sub AllTargets_Hit(idx)
- if TableTilted=false then
- DOF 107+idx,DOFPulse
- IncreaseBonus
- AddScore(AdvanceFlag)
- end if
- end sub
- 'target001_hit
- ' target1.transy-5
- '***********************************
- Sub Bumper1_Hit
- If TableTilted=false then
- PlaySound SoundFXDOF("bump",105,DOFPulse,DOFContactors)
- bump1 = 1
- AddScore(100)
- end if
- End Sub
- Sub Bumper2_Hit
- If TableTilted=false then
- PlaySound SoundFXDOF("bump",106,DOFPulse,DOFContactors)
- bump2 = 1
- AddScore(100)
- end if
- End Sub
- '***********************************
- Sub TriggerCollection_Hit(idx)
- If TableTilted=false then
- PlaySound "sensor"
- DOF 116+idx,DOFPulse
- Select case idx
- case 0:
- AddScore(1000)
- If LeftOutlaneLight.state=1 then AddSpecial
- case 1:
- if UpperLightLeft.state=1 then
- Collection2_hit(0)
- else
- AddScore(100)
- end if
- case 2:
- if UpperLightRight.state=1 then
- Collection2_hit(0)
- else
- AddScore(100)
- end if
- case 3:
- AddScore(1000)
- If RightOutlaneLight.state=1 then AddSpecial
- case 4:
- IncreaseBonus
- AddScore(AdvanceFlag)
- if UpperLightCenter.state=1 then
- ShootAgainLight.state=1
- ShootAgainReel.Setvalue(1)
- If B2SOn then
- Controller.B2SSetShootAgain 1
- end if
- end if
- case 5:
- IncreaseBonus
- AddScore(AdvanceFlag)
- case 6:
- BonusBoosterCounter=SuperAdvanceFlag
- BonusBoost.enabled=true
- end select
- end if
- end sub
- '*********************************** KICKERS
- Dim rkickstep, lkickstep, ktimer, kickFill
- Dim kickBalls
- Dim kickerBall1
- Sub kickBall(kball, kangle, kvel, kvelz, kzlift)
- dim rangle
- rangle = 3.14 * (kangle - 90) / 180
- kball.z = kball.z + kzlift
- kball.velz = kvelz
- kball.velx = cos(rangle)*kvel
- kball.vely = sin(rangle)*kvel
- End Sub
- sub Kicker001_Hit()
- set kickerBall1 = activeball
- if TableTilted=true then
- Kicker001.Timerenabled=1
- exit sub
- end if
- KickerHold2.enabled=1
- end sub
- Sub KickerHold2_timer
- if MotorRunning=0 then
- SetMotor(500)
- If LeftKickerLight.state=1 then
- DoubleBonus001.state=1
- end if
- KickerHold2.enabled=false
- Kicker001.timerenabled=true
- end if
- end sub
- Sub Kicker001_Timer()
- if MotorRunning<>0 then exit sub
- Kicker001.timerenabled=0
- if kicker001.ballcntover > 0 Then
- Pkickarm2.rotz=15
- kickBall KickerBall1, 150, 15, 5, 30
- PlaySound SoundFXDOF("scoopexit",111,DOFPulse,DOFContactors)
- DOF 126, DOFPulse
- Pkickarm2.rotz=15
- Pkickarm3.rotz=15
- KickerArm2.enabled=true
- end if
- end sub
- sub KickerArm2_timer
- Pkickarm2.rotz=0
- Pkickarm3.rotz=0
- KickerArm2.enabled=false
- end sub
- sub kicker002_Hit()
- set kickerBall1 = activeball
- if TableTilted=true then
- kicker002.Timerenabled=1
- exit sub
- end if
- KickerHold3.enabled=1
- end sub
- Sub KickerHold3_timer
- if MotorRunning=0 then
- SetMotor(500)
- If RightKickerLight.state=1 then
- DoubleBonus001.state=1
- end if
- KickerHold3.enabled=false
- kicker002.timerenabled=true
- end if
- end sub
- Sub kicker002_Timer()
- if MotorRunning<>0 then exit sub
- kicker002.timerenabled=0
- if kicker002.ballcntover > 0 Then
- PlaySound SoundFXDOF("scoopexit",112,DOFPulse,DOFContactors)
- DOF 126, DOFPulse
- kickBall KickerBall1, 210, 15, 5, 30
- Pkickarm2.rotz=15
- Pkickarm3.rotz=15
- KickerArm2.enabled=true
- end if
- end sub
- Sub LeftSlingKicker_hit
- set kickerBall1 = activeball
- if TableTilted=true then
- kickBall KickerBall1, 20, 20, 2, 5
- exit sub
- else
- SlingHoldCounter=0
- LeftSlingKicker.timerenabled=true
- end if
- end sub
- sub LeftSlingKicker_timer
- if MotorRunning<>0 then exit sub
- SlingHoldCounter=SlingHoldCounter+1
- select case SlingHoldCounter
- case 1,2,3,4,5:
- If LeftSlingLight.state=1 then
- AddScore(100)
- else
- AddScore(10)
- end if
- case 7:
- if leftslingkicker.ballcntover > 0 Then
- kickBall KickerBall1, 20, 25, 2, 5
- LeftSlingKicker.timerenabled=false
- sling1.rotx = 20
- sling2.rotx = 20
- LStep = 0
- LeftSlingShot.TimerEnabled = 1
- end if
- end select
- end sub
- Sub RightSlingKicker_hit
- set kickerBall1 = activeball
- if TableTilted=true then
- kickBall KickerBall1, 340, 20, 2, 5
- exit sub
- else
- SlingHoldCounter=0
- RightSlingKicker.timerenabled=true
- end if
- end sub
- sub RightSlingKicker_timer
- if MotorRunning<>0 then exit sub
- SlingHoldCounter=SlingHoldCounter+1
- select case SlingHoldCounter
- case 1,2,3,4,5:
- If RightSlingLight.state=1 then
- AddScore(100)
- else
- AddScore(10)
- end if
- case 7:
- if rightslingkicker.ballcntover > 0 Then
- kickBall KickerBall1, 340, 25, 2, 5
- RightSlingKicker.timerenabled=false
- sling1.rotx = 20
- sling2.rotx = 20
- rStep = 0
- RightSlingShot.TimerEnabled = 1
- end if
- end select
- end sub
- '****************************************************
- Sub AddSpecial()
- If ExtraBallFlag=1 then AddExtraBall:Exit Sub
- if ExtraBallFlag=2 then AddExtraBall:exit sub
- PlaySound SoundFXDOF("knocker",128,DOFPulse,DOFContactors)
- DOF 126,2
- Credits=Credits+1
- DOF 127,1
- 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
- DOF 127,1
- if Credits>15 then Credits=15
- If B2SOn Then
- Controller.B2SSetCredits Credits
- End If
- CreditsReel.SetValue(Credits)
- End Sub
- Sub AddExtraBall
- PlaySound SoundFXDOF("knocker",128,DOFPulse,DOFContactors)
- DOF 126,2
- If ExtraBallFlag=2 then AddScore(100000):Exit Sub
- BallInPlay=BallInPlay+1
- If BallInPlay>10 then BallInPlay=10
- BallInPlayReel.SetValue(BallInPlay)
- If B2SOn then
- Controller.B2SSetBallInPlay BallInPlay
- end if
- end sub
- sub openg_timer
- openg.enabled=false
- end sub
- sub closeg_timer
- closeg.enabled=false
- end sub
- Sub AddBonus()
- BonusSide=1
- bonuscountdown=bonuscounter
- ScoreMotorStepper=0
- ScoreBonus.enabled=true
- End Sub
- Sub ToggleOutlane
- end sub
- Sub ToggleBumper
- end sub
- sub ToggleAltRelay
- if AltRelayValue=1 then
- AltRelayValue=0
- else
- AltRelayValue=1
- end if
- DisplayAltRelay
- end sub
- Sub DisplayAltRelay
- If AltRelayValue=0 then
- UpperLightRight.state=0
- UpperLightLeft.state=0
- LeftOutlaneLight.state=0
- RightOutlaneLight.state=0
- If DoubleBonus002.state=1 AND DoubleBonus003.state=1 AND DoubleBonus004.state=1 then
- RightOutlaneLight.state=1
- end if
- else
- UpperLightRight.state=1
- UpperLightLeft.state=1
- LeftOutlaneLight.state=0
- RightOutlaneLight.state=0
- If DoubleBonus002.state=1 AND DoubleBonus003.state=1 AND DoubleBonus004.state=1 then
- LeftOutlaneLight.state=1
- end if
- end if
- end sub
- Sub ResetBallDrops()
- BonusCounter=0
- HoleCounter=0
- End Sub
- Sub LightsOut
- BonusCounter=0
- HoleCounter=0
- end sub
- Sub ResetDrops()
- End Sub
- Sub LightsOff
- end sub
- Sub LightsOn
- end sub
- Sub FireAlternatingRelay
- end sub
- Sub ToggleArrowRelay
- Select Case BallInPlay
- case 1,3,5:
- case 2,4:
- end select
- end sub
- Sub ResetBalls()
- TempMultiCounter=BallsPerGame-BallInPlay
- RightTargetFlag=false
- LeftTargetFlag=false
- BonusMultiplier=1
- YellowBumperFlag=false
- GreenBumperFlag=false
- for each obj in StarLights
- obj.state=0
- next
- for x = 1 to 10
- LeftBonus(x).state=0
- next
- BonusCounter=1
- LeftSpinnerLight.state=0
- LeftSlingLight.state=0
- RightSlingLight.state=0
- LeftKickerLight.state=0
- RightKickerLight.state=0
- LeftBonus(BonusCounter).state=1
- ResetDrops
- TableTilted=false
- TiltReel.SetValue(0)
- BumpersOn
- PlasticsOn
- DisplayAltRelay
- 'CreateBallID BallRelease
- Ballrelease.CreateSizedBall 25
- Ballrelease.Kick 40,7
- DOF 120,2
- 'InstructCard.image="IC"+FormatNumber(BallsPerGame,0)+FormatNumber(BallInPlay,0)
- BallInPlayReel.SetValue(BallInPlay)
- End Sub
- sub delaykgclose_timer
- delaykgclose.enabled=false
- end sub
- sub resettimer_timer
- rst=rst+1
- if rst>1 and rst<20 then
- ResetReelsToZero(1)
- ResetReelsToZero(2)
- end if
- if rst=22 then
- 'playsound "KickerKick"
- end if
- if rst=24 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 ScoreBonus_timer
- if MotorRunning=1 then
- exit sub
- end if
- if bonuscountdown<1 then
- ScoreBonus.enabled=0
- NextBallDelay.enabled=true
- else
- If DoubleBonus001.state=1 then
- Select case ScoreMotorStepper
- case 0,1,3,4:
- AddScore(1000)
- case 2,5:
- PlaySound"MotorPause"
- If bonuscountdown=20 then
- LeftBonus(11).state=0
- elseif bonuscountdown>10 and bonuscountdown<20 then
- LeftBonus(bonuscountdown-10).state=0
- else
- LeftBonus(bonuscountdown).state=0
- end if
- bonuscountdown=bonuscountdown-1
- if bonuscountdown>0 then
- if bonuscountdown<=10 then
- LeftBonus(bonuscountdown).state=1
- elseif bonuscountdown>10 AND bonuscountdown<20 then
- LeftBonus(10).state=1
- LeftBonus(bonuscountdown-10).state=1
- else
- LeftBonus(11).state=1
- end if
- end if
- case 6:
- end select
- ScoreMotorStepper=ScoreMotorStepper+1
- If ScoreMotorStepper>6 then
- ScoreMotorStepper=0
- end if
- else
- Select Case ScoreMotorStepper
- case 0,1,2,3,4:
- AddScore(1000)
- If bonuscountdown=20 then
- LeftBonus(11).state=0
- elseif bonuscountdown>10 and bonuscountdown<20 then
- LeftBonus(bonuscountdown-10).state=0
- else
- LeftBonus(bonuscountdown).state=0
- end if
- bonuscountdown=bonuscountdown-1
- if bonuscountdown>0 then
- if bonuscountdown<=10 then
- LeftBonus(bonuscountdown).state=1
- elseif bonuscountdown>10 AND bonuscountdown<20 then
- LeftBonus(10).state=1
- LeftBonus(bonuscountdown-10).state=1
- else
- LeftBonus(11).state=1
- end if
- end if
- case 5:
- PlaySound"MotorPause"
- end select
- ScoreMotorStepper=ScoreMotorStepper+1
- If ScoreMotorStepper>5 then
- ScoreMotorStepper=0
- end if
- end if
- end if
- end sub
- Sub AddBonusInGame()
- If BonusSide=1 then
- bonuscountdown=bonuscounter
- else
- bonuscountdown=rightbonuscounter
- end if
- ScoreMotorStepper=0
- ScoreBonusInGame.enabled=true
- End Sub
- sub ScoreBonusInGame_timer
- if MotorRunning=1 then
- exit sub
- end if
- if bonuscountdown<1 then
- ScoreBonusInGame.enabled=0
- else
- If DoubleBonus001.state=0 then
- Select case ScoreMotorStepper
- case 0,1,2,3,4:
- AddScore(1000)
- case 5:
- PlaySound"MotorPause"
- If BonusSide=1 then
- LeftBonus(bonuscountdown).state=0
- LeftSpinnerLight.state=0
- else
- RightBonus(bonuscountdown).state=0
- RightSpinnerLight.state=0
- end if
- bonuscountdown=bonuscountdown-1
- if bonuscountdown>0 then
- if BonusSide=1 then
- LeftBonus(bonuscountdown).state=1
- else
- RightBonus(bonuscountdown).state=1
- end if
- end if
- case 6:
- end select
- ScoreMotorStepper=ScoreMotorStepper+1
- If ScoreMotorStepper>6 then
- ScoreMotorStepper=0
- end if
- else
- Select Case ScoreMotorStepper
- case 0,1,2,3,4:
- AddScore(10000)
- if BonusSide=1 then
- LeftBonus(bonuscountdown).state=0
- LeftSpinnerLight.state=0
- else
- RightBonus(bonuscountdown).state=0
- RightSpinnerLight.state=0
- end if
- bonuscountdown=bonuscountdown-1
- if bonuscountdown>0 then
- if BonusSide=1 then
- LeftBonus(bonuscountdown).state=1
- else
- RightBonus(bonuscountdown).state=1
- end if
- end if
- case 5:
- PlaySound"MotorPause"
- end select
- ScoreMotorStepper=ScoreMotorStepper+1
- If ScoreMotorStepper>5 then
- ScoreMotorStepper=0
- end if
- end if
- end if
- end sub
- sub NextBallDelay_timer()
- If KickoffFlag=true then exit sub
- NextBallDelay.enabled=false
- nextball
- end sub
- Sub NewGameHoldTimer_timer
- if KickoffFlag=true then exit sub
- NewGameHoldTimer.enabled=false
- newgame
- end sub
- sub newgame
- InProgress=true
- debugscore=0
- EMReel1.ResetToZero
- EMReel2.ResetToZero
- MatchTextBox.text=""
- 'BallTextBox.text=FormatNumber(BallInPlay,0)
- for i = 1 to 2
- Score(i)=0
- Score100K(1)=0
- HighScorePaid(i)=false
- Replay1Paid(i)=false
- Replay2Paid(i)=false
- Replay3Paid(i)=false
- Replay4Paid(i)=false
- ReplayBalls1Paid(i)=false
- ReplayBalls2Paid(i)=false
- ReplayBalls3Paid(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
- End if
- AltRelayValue=0
- BaseHit=0
- BaseHitCounter=0
- BonusCounter=0
- For each obj in LeftBonus
- obj.state=0
- next
- For each obj in LeftSpinnerLights
- obj.state=0
- next
- For each obj in RightSpinnerLights
- obj.state=0
- next
- For each obj in StarLights
- obj.state=0
- next
- For each obj in TargetAdvanceLights
- obj.state=0
- next
- LeftOutlaneLight.state=0
- RightOutlaneLight.state=0
- LeftSpinnerLight.state=0
- ToggleArrowRelay
- ResetBalls
- playsound "StartBall1"
- End sub
- sub nextball
- ' If B2SOn Then
- ' Controller.B2SSetTilt 0
- ' End If
- If ShootAgainLight.state=1 then
- ShootAgainLight.state=0
- ShootAgainReel.Setvalue(0)
- If B2SOn then Controller.B2SSetShootAgain 0
- 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 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- End If
- For each obj in PlayerHuds
- obj.SetValue(0)
- next
- For each obj in PlayerHUDScores
- obj.state=0
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- obj.visible=1
- Next
- For each obj in PlayerScoresOn
- obj.visible=0
- Next
- end If
- 'InstructCard.image="IC"
- BallInPlayReel.SetValue(0)
- CanPlayReel.SetValue(0)
- GameOverReel.setvalue(1)
- LeftFlipper.RotateToStart
- RightFlipper.RotateToStart
- LightsOut
- PlasticsOff
- BallTextBox.text=""
- if TableTilted=false then
- checkmatch
- end if
- CheckHighScore
- Players=0
- HighScoreTimer.interval=100
- HighScoreTimer.enabled=True
- Else
- Player=1
- If B2SOn Then
- Controller.B2SSetPlayerUp Player
- Controller.B2SSetData 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- Controller.B2SSetData 80+Player,1
- Controller.B2SSetBallInPlay BallInPlay
- End If
- ' PlaySound("RotateThruPlayers")
- TempPlayerUp=Player
- PlayerUpRotator.enabled=true
- PlayStartBall.enabled=true
- For each obj in PlayerHuds
- obj.SetValue(0)
- next
- For each obj in PlayerHUDScores
- obj.state=0
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- obj.visible=1
- Next
- For each obj in PlayerScoresOn
- obj.visible=0
- Next
- PlayerHuds(Player-1).SetValue(1)
- PlayerHUDScores(Player-1).state=1
- PlayerHUDScores(Player+3).state=1
- PlayerScores(Player-1).visible=0
- PlayerScoresOn(Player-1).visible=1
- ' PlayerHuds(Player).SetValue(1)
- ' PlayerHUDScores(Player).state=1
- ' PlayerScores(Player).visible=0
- ' PlayerScoresOn(Player).visible=1
- end If
- ToggleArrowRelay
- ResetBalls
- End If
- Else
- If B2SOn Then
- Controller.B2SSetPlayerUp Player
- Controller.B2SSetData 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- Controller.B2SSetData 80+Player,1
- Controller.B2SSetBallInPlay BallInPlay
- End If
- ' PlaySound("RotateThruPlayers")
- TempPlayerUp=Player
- ' PlayerUpRotator.enabled=true
- PlayStartBall.enabled=true
- For each obj in PlayerHuds
- obj.SetValue(0)
- next
- For each obj in PlayerHUDScores
- obj.state=0
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- obj.visible=1
- Next
- For each obj in PlayerScoresOn
- obj.visible=0
- Next
- PlayerHuds(Player-1).SetValue(1)
- PlayerHUDScores(Player-1).state=1
- PlayerHUDScores(Player+3).state=1
- PlayerScores(Player-1).visible=0
- PlayerScoresOn(Player-1).visible=1
- ' PlayerHuds(Player).SetValue(1)
- ' PlayerHUDScores(Player).state=1
- ' PlayerScores(Player).visible=0
- ' PlayerScoresOn(Player).visible=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
- sortpoints(i)=0
- sortplayerpoints(i)=0
- next
- playertops=0
- for i = 1 to Players
- sortscores(i)=Score(i)
- sortplayers(i)=i
- next
- ScoreChecker=5
- CheckAllScores=1
- CheckAllPoints=0
- NewHighScore sortscores(ScoreChecker-1),sortplayers(ScoreChecker-1)
- savehs
- end sub
- sub checkmatch
- Dim tempmatch
- If ExtraBallFlag>0 then Exit Sub
- tempmatch=Int(Rnd*10)
- Match=tempmatch
- MatchReel.SetValue(tempmatch+1)
- if Match=0 then
- MatchTextBox.text="Match: 0"
- else
- MatchTextBox.text="Match: " + FormatNumber(Match,0)
- end if
- If B2SOn Then
- If Match = 0 Then
- Controller.B2SSetMatch 100
- Else
- Controller.B2SSetMatch Match*10
- End If
- End if
- Match=Match*10
- 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
- PlasticsOff
- BumpersOff
- LeftFlipper.RotateToStart
- RightFlipper.RotateToStart
- TiltReel.SetValue(1)
- If B2Son then
- Controller.B2SSetTilt 1
- end if
- else
- TiltTimer.Interval = 500
- TiltTimer.Enabled = True
- end if
- end sub
- Sub IncreaseBonus()
- If BonusCounter>=10 and BonusCounter<20 then
- LeftBonus(BonusCounter-10).state=0
- BonusCounter=BonusCounter+1
- If BonusCounter<20 then
- LeftBonus(10).state=1
- LeftBonus(BonusCounter-10).state=1
- else
- LeftBonus(10).state=0
- LeftBonus(11).state=1
- end if
- elseif BonusCounter=20 then
- exit sub
- else
- If BonusCounter>0 then
- LeftBonus(BonusCounter).state=0
- end if
- BonusCounter=BonusCounter+1
- LeftBonus(BonusCounter).State=1
- ' PlaySound("Score100")
- end if
- End Sub
- Sub IncreaseRightBonus()
- If RightBonusCounter=10 then
- RightBonusCounter=1
- RightBonus(RightBonusCounter).state=1
- RightBonus(10).state=0
- else
- If RightBonusCounter>0 then
- RightBonus(RightBonusCounter).state=0
- end if
- RightBonusCounter=RightBonusCounter+1
- RightBonus(RightBonusCounter).State=1
- 'PlaySound("Score100")
- end if
- End Sub
- Sub BonusBoost_Timer()
- IncreaseBonus
- AddScore(AdvanceFlag)
- BonusBoosterCounter=BonusBoosterCounter-1
- if BonusBoosterCounter<1 then
- BonusBoost.enabled=false
- end if
- end sub
- Sub CheckForLightSpecial()
- end sub
- Sub PlayStartBall_timer()
- PlayStartBall.enabled=false
- PlaySound("StartBall2-5")
- end sub
- Sub PlayerUpRotator_timer()
- Exit Sub
- If RotatorTemp<5 then
- TempPlayerUp=TempPlayerUp+1
- If TempPlayerUp>4 then
- TempPlayerUp=1
- end if
- For each obj in PlayerHuds
- obj.SetValue(0)
- next
- For each obj in PlayerHUDScores
- obj.state=0
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- obj.visible=1
- Next
- For each obj in PlayerScoresOn
- obj.visible=0
- Next
- PlayerHuds(TempPlayerUp-1).SetValue(1)
- PlayerScores(TempPlayerUp-1).visible=0
- PlayerScoresOn(TempPlayerUp-1).visible=1
- end If
- If B2SOn Then
- Controller.B2SSetPlayerUp TempPlayerUp
- Controller.B2SSetData 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- Controller.B2SSetData 80+TempPlayerUp,1
- End If
- else
- if B2SOn then
- Controller.B2SSetPlayerUp Player
- Controller.B2SSetData 81,0
- Controller.B2SSetData 82,0
- Controller.B2SSetData 83,0
- Controller.B2SSetData 84,0
- Controller.B2SSetData 80+Player,1
- end if
- PlayerUpRotator.enabled=false
- RotatorTemp=1
- For each obj in PlayerHuds
- obj.SetValue(0)
- next
- For each obj in PlayerHUDScores
- obj.state=0
- next
- If Table1.ShowDT = True then
- For each obj in PlayerScores
- obj.visible=1
- Next
- For each obj in PlayerScoresOn
- obj.visible=0
- Next
- PlayerHuds(Player-1).SetValue(1)
- PlayerScores(Player-1).visible=0
- PlayerScoresOn(Player-1).visible=1
- end If
- 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 2
- ScoreFile.WriteLine Credits
- scorefile.writeline BallsPerGame
- ScoreFile.WriteLine ReplayLevel
- ScoreFile.WriteLine SuperAdvanceFlag
- ScoreFile.WriteLine ExtraBallFlag
- ScoreFile.WriteLine AdvanceFlag
- for xx=1 to 5
- scorefile.writeline HSScore(xx)
- next
- for xx=1 to 5
- scorefile.writeline HSName(xx)
- next
- for xx=6 to 10
- scorefile.writeline HSScore(xx)
- next
- for xx=6 to 10
- scorefile.writeline HSName(xx)
- next
- ScoreFile.Close
- Set ScoreFile=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
- dim temp18
- dim temp19
- dim temp20
- dim temp21
- dim temp22
- dim temp23
- dim temp24
- dim temp25
- dim temp26
- dim temp27
- 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
- temp6=textstr.readline
- temp7=textstr.readline
- HighScore=cdbl(temp1)
- if HighScore=2 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
- temp18=textstr.readline
- temp19=textstr.readline
- temp20=textstr.readline
- temp21=textstr.readline
- temp22=textstr.readline
- temp23=textstr.readline
- temp24=textstr.readline
- temp25=textstr.readline
- temp26=textstr.readline
- temp27=textstr.readline
- end if
- TextStr.Close
- if HighScore=2 then
- Credits=cdbl(temp2)
- BallsPerGame=cdbl(temp3)
- ReplayLevel=cdbl(temp4)
- SuperAdvanceFlag=int(temp5)
- ExtraBallFlag=cdbl(temp6)
- AdvanceFlag= int(temp7)
- 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
- HSScore(6) = int(temp18)
- HSScore(7) = int(temp19)
- HSScore(8) = int(temp20)
- HSScore(9) = int(temp21)
- HSScore(10) = int(temp22)
- HSName(6) = temp23
- HSName(7) = temp24
- HSName(8) = temp25
- HSName(9) = temp26
- HSName(10) = temp27
- end if
- 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 SaveLMEMConfig2
- If ShadowConfigFile=false then exit sub
- Dim FileObj
- Dim LMConfig2
- dim temp1
- dim temp2
- dim tempBS
- dim tempFS
- if EnableBallShadow=true then
- tempBS=1
- else
- tempBS=0
- end if
- if EnableFlipperShadow=true then
- tempFS=1
- else
- tempFS=0
- end if
- Set FileObj=CreateObject("Scripting.FileSystemObject")
- If Not FileObj.FolderExists(UserDirectory) then
- Exit Sub
- End if
- Set LMConfig2=FileObj.CreateTextFile(UserDirectory & LMEMShadowConfig,True)
- LMConfig2.WriteLine tempBS
- LMConfig2.WriteLine tempFS
- LMConfig2.Close
- Set LMConfig2=Nothing
- Set FileObj=Nothing
- end Sub
- sub LoadLMEMConfig2
- If ShadowConfigFile=false then
- EnableBallShadow = ShadowBallOn
- BallShadowUpdate.enabled = ShadowBallOn
- EnableFlipperShadow = ShadowFlippersOn
- FlipperLSh.visible = ShadowFlippersOn
- FlipperRSh.visible = ShadowFlippersOn
- exit sub
- end if
- Dim FileObj
- Dim LMConfig2
- dim tempC
- dim tempD
- dim tempFS
- dim tempBS
- Set FileObj=CreateObject("Scripting.FileSystemObject")
- If Not FileObj.FolderExists(UserDirectory) then
- Exit Sub
- End if
- If Not FileObj.FileExists(UserDirectory & LMEMShadowConfig) then
- Exit Sub
- End if
- Set LMConfig2=FileObj.GetFile(UserDirectory & LMEMShadowConfig)
- Set TextStr2=LMConfig2.OpenAsTextStream(1,0)
- If (TextStr2.AtEndOfStream=True) then
- Exit Sub
- End if
- tempC=TextStr2.ReadLine
- tempD=TextStr2.Readline
- TextStr2.Close
- tempBS=cdbl(tempC)
- tempFS=cdbl(tempD)
- if tempBS=0 then
- EnableBallShadow=false
- BallShadowUpdate.enabled=false
- else
- EnableBallShadow=true
- end if
- if tempFS=0 then
- EnableFlipperShadow=false
- FlipperLSh.visible=false
- FLipperRSh.visible=false
- else
- EnableFlipperShadow=true
- end if
- Set LMConfig2=Nothing
- Set FileObj=Nothing
- end sub
- Sub DisplayHighScore
- end sub
- sub InitPauser5_timer
- If B2SOn Then
- 'Controller.B2SSetScore 4,HighScore
- End If
- DisplayHighScore
- InitPauser5.enabled=false
- end sub
- sub target001_hit
- target1.transy=-4
- target001.timerenabled=1
- end sub
- sub target002_hit
- target2.transy=-4
- target001.timerenabled=1
- end sub
- sub target001_timer
- target1.transy=0
- target2.transy=0
- target001.timerenabled=0
- end sub
- sub BumpersOff
- ' Bumper1Light.visible=0
- ' Bumper2Light.visible=0
- end sub
- sub BumpersOn
- ' Bumper1Light.visible=1
- ' Bumper2Light.visible=1
- end sub
- Sub PlasticsOn
- For each xx in flashers:xx.State = 1: Next
- playfield_off.visible=0
- For each xx in layercol1: xx.image = "layer1": Next
- For each xx in layercol2: xx.image = "layer2": Next
- For each xx in layercol3: xx.image = "layer3": Next
- For each xx in layercol4: xx.image = "layer4": Next
- backmetal.image="backmetal"
- toparch.image="archmission"
- ' toparch.image="archodyssey" 'for odyssey
- bumpcaps.image="bumpcapsmission"
- ' bumpcaps.image="bumpcapsodyssey" 'for odyssey
- end sub
- Sub PlasticsOff
- dim xx
- For each xx in flashers:xx.State = 0: Next
- StopSound "buzz"
- StopSound "buzzL"
- playfield_off.visible=1
- For each xx in layercol1: xx.image = "layer1off": Next
- For each xx in layercol2: xx.image = "layer2off": Next
- For each xx in layercol3: xx.image = "layer3off": Next
- For each xx in layercol4: xx.image = "layer4off": Next
- backmetal.image="backmetaloff"
- toparch.image="archmissionoff"
- ' toparch.image="archodysseyoff" 'for odyssey
- bumpcaps.image="bumpcapsmissionoff"
- ' bumpcaps.image="bumpcapsodysseyoff" 'for odyssey
- end sub
- Sub SetupReplayTables
- Replay1Table(1)=114000
- Replay1Table(2)=116000
- Replay1Table(3)=118000
- Replay1Table(4)=120000
- Replay1Table(5)=122000
- Replay1Table(6)=124000
- Replay1Table(7)=126000
- Replay1Table(8)=128000
- Replay1Table(9)=130000
- Replay1Table(10)=132000
- Replay1Table(11)=134000
- Replay1Table(12)=136000
- Replay1Table(13)=138000
- Replay1Table(14)=140000
- Replay1Table(15)=142000
- Replay1Table(16)=130000
- Replay1Table(17)=132000
- Replay1Table(18)=134000
- Replay1Table(19)=136000
- Replay1Table(20)=138000
- Replay1Table(21)=140000
- Replay1Table(22)=142000
- Replay1Table(23)=144000
- Replay1Table(24)=146000
- Replay1Table(25)=148000
- Replay1Table(26)=150000
- Replay1Table(27)=152000
- Replay1Table(28)=154000
- Replay1Table(29)=156000
- Replay1Table(30)=158000
- Replay1Table(31)=160000
- Replay1Table(32)=162000
- Replay1Table(33)=164000
- Replay1Table(34)=166000
- Replay1Table(35)=168000
- Replay2Table(1)=145000
- Replay2Table(2)=147000
- Replay2Table(3)=149000
- Replay2Table(4)=151000
- Replay2Table(5)=153000
- Replay2Table(6)=155000
- Replay2Table(7)=157000
- Replay2Table(8)=159000
- Replay2Table(9)=161000
- Replay2Table(10)=163000
- Replay2Table(11)=165000
- Replay2Table(12)=167000
- Replay2Table(13)=169000
- Replay2Table(14)=171000
- Replay2Table(15)=173000
- Replay2Table(16)=174000
- Replay2Table(17)=176000
- Replay2Table(18)=178000
- Replay2Table(19)=180000
- Replay2Table(20)=182000
- Replay2Table(21)=184000
- Replay2Table(22)=186000
- Replay2Table(23)=188000
- Replay2Table(24)=190000
- Replay2Table(25)=192000
- Replay2Table(26)=194000
- Replay2Table(27)=196000
- Replay2Table(28)=198000
- Replay2Table(29)=198000
- Replay2Table(30)=197000
- Replay2Table(31)=198000
- Replay2Table(32)=198000
- Replay2Table(33)=198000
- Replay2Table(34)=198000
- Replay2Table(35)=197000
- Replay3Table(1)=176000
- Replay3Table(2)=178000
- Replay3Table(3)=180000
- Replay3Table(4)=182000
- Replay3Table(5)=184000
- Replay3Table(6)=186000
- Replay3Table(7)=188000
- Replay3Table(8)=190000
- Replay3Table(9)=192000
- Replay3Table(10)=194000
- Replay3Table(11)=196000
- Replay3Table(12)=198000
- Replay3Table(13)=197000
- Replay3Table(14)=198000
- Replay3Table(15)=198000
- Replay3Table(16)=999000
- Replay3Table(17)=999000
- Replay3Table(18)=999000
- Replay3Table(19)=999000
- Replay3Table(20)=999000
- Replay3Table(21)=999000
- Replay3Table(22)=999000
- Replay3Table(23)=999000
- Replay3Table(24)=999000
- Replay3Table(25)=999000
- Replay3Table(26)=999000
- Replay3Table(27)=999000
- Replay3Table(28)=999000
- Replay3Table(29)=999000
- Replay3Table(30)=999000
- Replay3Table(31)=999000
- Replay3Table(32)=999000
- Replay3Table(33)=999000
- Replay3Table(34)=999000
- Replay3Table(35)=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
- Replay4Table(16)=999000
- Replay4Table(17)=999000
- Replay4Table(18)=999000
- Replay4Table(19)=999000
- Replay4Table(20)=999000
- Replay4Table(21)=999000
- Replay4Table(22)=999000
- Replay4Table(23)=999000
- Replay4Table(24)=999000
- Replay4Table(25)=999000
- Replay4Table(26)=999000
- Replay4Table(27)=999000
- Replay4Table(28)=999000
- Replay4Table(29)=999000
- Replay4Table(30)=999000
- Replay4Table(31)=999000
- Replay4Table(32)=999000
- Replay4Table(33)=999000
- Replay4Table(34)=999000
- Replay4Table(35)=999000
- ReplayTableMax=35
- ReplayBallsTable1(1)=99
- ReplayBallsTable1(2)=99
- ReplayBallsTable1(3)=11
- ReplayBallsTable1(4)=11
- ReplayBallsTable1(5)=12
- ReplayBallsTable1(6)=16
- ReplayBallsTable1(7)=17
- ReplayBallsTable1(8)=18
- ReplayBallsTable1(9)=19
- ReplayBallsTable1(10)=19
- ReplayBallsTable1(11)=99
- ReplayBallsTable1(12)=99
- ReplayBallsTable1(13)=99
- ReplayBallsTable1(14)=99
- ReplayBallsTable1(15)=99
- ReplayBallsTable1(16)=99
- ReplayBallsTable2(1)=99
- ReplayBallsTable2(2)=99
- ReplayBallsTable2(3)=15
- ReplayBallsTable2(4)=16
- ReplayBallsTable2(5)=15
- ReplayBallsTable2(6)=22
- ReplayBallsTable2(7)=22
- ReplayBallsTable2(8)=23
- ReplayBallsTable2(9)=23
- ReplayBallsTable2(10)=24
- ReplayBallsTable2(11)=99
- ReplayBallsTable2(12)=99
- ReplayBallsTable2(13)=99
- ReplayBallsTable2(14)=99
- ReplayBallsTable2(15)=99
- ReplayBallsTable2(16)=99
- ReplayBallsTable3(1)=99
- ReplayBallsTable3(2)=99
- ReplayBallsTable3(3)=17
- ReplayBallsTable3(4)=18
- ReplayBallsTable3(5)=17
- ReplayBallsTable3(6)=28
- ReplayBallsTable3(7)=28
- ReplayBallsTable3(8)=29
- ReplayBallsTable3(9)=28
- ReplayBallsTable3(10)=30
- ReplayBallsTable3(11)=99
- ReplayBallsTable3(12)=99
- ReplayBallsTable3(13)=99
- ReplayBallsTable3(14)=99
- ReplayBallsTable3(15)=99
- ReplayBallsTable3(16)=99
- ReplayBallsTableMax=2
- end sub
- Sub RefreshReplayCard
- Dim tempst1
- Dim tempst2
- Dim tempst3
- tempst1=FormatNumber(BallsPerGame,0)
- tempst2=FormatNumber(ReplayLevel,0)
- tempst3=FormatNumber(ReplayBalls,0)
- ReplayCard.image="BC" + tempst1
- ReplayCard1.image = "SC" + tempst2
- ReplayCard2.image = "PR"
- Replay1=Replay1Table(ReplayLevel)
- Replay2=Replay2Table(ReplayLevel)
- Replay3=Replay3Table(ReplayLevel)
- Replay4=Replay4Table(ReplayLevel)
- BallReplay1=ReplayBallsTable1(ReplayBalls)
- BallReplay2=ReplayBallsTable2(ReplayBalls)
- BallReplay3=ReplayBallsTable3(ReplayBalls)
- 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
- BaseHitCounter=BaseHit
- LightsOff
- Select Case x
- Case 10:
- AddScore(10)
- MotorRunning=0
- LightsOn
- Case 20:
- MotorMode=10
- MotorPosition=2
- Case 30:
- MotorMode=10
- MotorPosition=3
- Case 40:
- MotorMode=10
- MotorPosition=4
- Case 50:
- MotorMode=10
- ToggleAltRelay
- MotorPosition=5
- Case 100:
- MotorMode=100
- MotorPosition=1
- Case 200:
- MotorMode=100
- MotorPosition=2
- Case 300:
- MotorMode=100
- MotorPosition=3
- Case 400:
- MotorMode=100
- MotorPosition=4
- Case 500:
- MotorMode=100
- ToggleAltRelay
- MotorPosition=5
- Case 1000:
- AddScore(1000)
- MotorRunning=0
- LightsOn
- Case 2000:
- MotorMode=1000
- MotorPosition=2
- Case 3000:
- MotorMode=1000
- MotorPosition=3
- Case 4000:
- MotorMode=1000
- MotorPosition=4
- Case 5000:
- MotorMode=1000
- ToggleAltRelay
- MotorPosition=5
- case 10000:
- AddScore(10000)
- MotorRunning=0
- LightsOn
- Case 50000:
- MotorMode=10000
- MotorPosition=5
- End Select
- End If
- End Sub
- Sub AddScoreTimer_Timer
- Dim tempscore
- If MotorRunning<>1 And InProgress=true then
- if queuedscore>=50000 then
- tempscore=50000
- queuedscore=queuedscore-50000
- SetMotor2(50000)
- exit sub
- end if
- if queuedscore>=10000 then
- tempscore=10000
- queuedscore=queuedscore-10000
- SetMotor2(10000)
- exit sub
- end if
- 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>=400 then
- tempscore=400
- queuedscore=queuedscore-400
- SetMotor2(400)
- exit sub
- end if
- if queuedscore>=300 then
- tempscore=300
- queuedscore=queuedscore-300
- SetMotor2(300)
- exit sub
- end if
- if queuedscore>=200 then
- tempscore=200
- queuedscore=queuedscore-200
- SetMotor2(200)
- 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
- if queuedscore>=40 then
- tempscore=40
- queuedscore=queuedscore-40
- SetMotor2(40)
- exit sub
- end if
- if queuedscore>=30 then
- tempscore=30
- queuedscore=queuedscore-30
- SetMotor2(30)
- exit sub
- end if
- if queuedscore>=20 then
- tempscore=20
- queuedscore=queuedscore-20
- SetMotor2(20)
- exit sub
- end if
- if queuedscore>=10 then
- tempscore=10
- queuedscore=queuedscore-10
- SetMotor2(10)
- exit sub
- end if
- End If
- end Sub
- Sub ScoreMotorTimer_Timer
- If MotorPosition > 0 Then
- Select Case MotorPosition
- Case 5,4,3,2:
- If BaseHitCounter>0 then
- MoveRunners
- BaseHitCounter=BaseHitCounter-1
- end if
- If MotorMode=10000 Then
- AddScore(10000)
- End if
- 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=10000 Then
- AddScore(10000)
- End if
- 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:LightsOn: BaseHit=0: BaseHitCounter=0
- End Select
- End If
- End Sub
- Sub AddScore(x)
- If TableTilted=true then exit sub
- ImpulseReelCount=ImpulseReelCount+1
- if ImpulseReelCount>4 then
- ImpulseReelCount=0
- end if
- 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(100)
- Score(Player)=Score(Player)+10
- ' debugscore=debugscore+10
- Case 100:
- PlayChime(1000)
- Score(Player)=Score(Player)+100
- ' debugscore=debugscore+100
- Case 1000:
- PlayChime(1000)
- Score(Player)=Score(Player)+1000
- ' debugscore=debugscore+1000
- End Select
- PlayerScores(Player-1).AddValue(x)
- PlayerScoresOn(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)=>1000000 then
- 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
- ' 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
- Case 10000:
- Score(Player)=Score(Player)+10000
- Case 100000:
- Score(Player)=Score(Player)+100000
- End Select
- NewScore = Score(Player)
- If NewScore>=100000 then
- EVAL("RolloverReel"&Player).SetValue(1)
- If B2SOn then
- If Player=1 Then
- Controller.B2SSetScoreRolloverPlayer1 1
- End If
- If Player=2 Then
- Controller.B2SSetScoreRolloverPlayer2 1
- End If
- If Player=3 Then
- Controller.B2SSetScoreRolloverPlayer3 1
- End If
- If Player=4 Then
- Controller.B2SSetScoreRolloverPlayer4 1
- End If
- 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 - 1000000
- OldTestScore = OldTestScore - 1000000
- 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(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
- 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
- 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)
- PlayerScoresOn(Player-1).AddValue(x)
- End Sub
- Sub PlayChime(x)
- If DoodleBugFlag=true then
- exit sub
- end if
- 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,1000
- 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("SJ_Chime_10a",141,DOFPulse,DOFChimes)
- LastChime10=0
- Else
- PlaySound SoundFXDOF("SJ_Chime_10b",141,DOFPulse,DOFChimes)
- LastChime10=1
- End If
- Case 100
- If LastChime100=1 Then
- PlaySound SoundFXDOF("SJ_Chime_100a",142,DOFPulse,DOFChimes)
- LastChime100=0
- Else
- PlaySound SoundFXDOF("SJ_Chime_100b",142,DOFPulse,DOFChimes)
- LastChime100=1
- End If
- Case 1000,10000
- If LastChime1000=1 Then
- PlaySound SoundFXDOF("SJ_Chime_1000a",143,DOFPulse,DOFChimes)
- LastChime1000=0
- Else
- PlaySound SoundFXDOF("SJ_Chime_1000b",143,DOFPulse,DOFChimes)
- LastChime1000=1
- End If
- End Select
- end if
- End Sub
- Sub HideOptions()
- end sub
- '*********************************************************************
- ' Positional Sound Playback Functions
- '*********************************************************************
- ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
- ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
- ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
- Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
- PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
- End Sub
- ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
- Sub PlaySoundAt(soundname, tableobj)
- PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBall(soundname)
- PlaySoundAt soundname, ActiveBall
- End Sub
- '*********************************************************************
- ' Supporting Ball & Sound Functions
- '*********************************************************************
- 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 / table1.height-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 / table1.width-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 / 2000)
- 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
- '*****************************************
- ' JP's VP10 Rolling Sounds
- '*****************************************
- Const tnob = 5 ' total number of balls
- ReDim rolling(tnob)
- InitRolling
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingSoundTimer_Timer()
- Dim BOT, b
- BOT = GetBalls
- ' stop the sound of deleted balls
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & 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("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- Else
- If rolling(b) = True Then
- StopSound("fx_ballrolling" & b)
- rolling(b) = False
- End If
- End If
- Next
- End Sub
- '**********************
- ' Ball Collision Sound
- '**********************
- Sub OnBallBallCollision(ball1, ball2, velocity)
- PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
- 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))/7)) + 6
- Else
- BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
- End If
- ballShadow(b).Y = BOT(b).Y + 12
- If BOT(b).Z > 20 Then
- BallShadow(b).visible = 1
- Else
- BallShadow(b).visible = 0
- End If
- Next
- End Sub
- '*****************************************
- ' Object sounds
- '*****************************************
- Sub Plastics_Hit (idx)
- PlaySound "woodhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Pins_Hit (idx)
- PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Targets_Hit (idx)
- PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Thin_Hit (idx)
- PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Medium_Hit (idx)
- PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals2_Hit (idx)
- PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Spinner_Spin
- PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
- End Sub
- Sub Rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 20 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 20 then
- RandomSoundRubber()
- End If
- End Sub
- Sub Posts_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- RandomSoundRubber()
- End If
- End Sub
- Sub RandomSoundRubber()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- Sub LeftFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RightFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RandomSoundFlipper()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- 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(10) ' High Scores read in from config file
- Dim HSName(10) ' 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"
- HSScore(6) = 750000
- HSScore(7) = 700000
- HSScore(8) = 600000
- HSScore(9) = 550000
- HSScore(10) = 500000
- HSName(6) = "AAA"
- HSName(7) = "ZZZ"
- HSName(8) = "XXX"
- HSName(9) = "ABC"
- HSName(10) = "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="111111011"
- Const OptionLine1="" 'do not use this line
- Const OptionLine2="" 'do not use this line
- Const OptionLine3="" 'do not use this line
- Const OptionLine4="Add Bonus Score"
- Const OptionLine5="Super Bonus Adds"
- Const OptionLine6="Spinner and Ex. Ball Option"
- 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
- dim TempText1
- dim TempText2
- dim TempText3
- 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
- tempstring = AdvanceFlag
- SetOptLine 5, tempstring
- Case 5:
- SetOptLine 6, tempstring
- tempstring = SuperAdvanceFlag
- SetOptLine 7, tempstring
- Case 6:
- SetOptLine 8, tempstring
- Select case ExtraBallFlag
- case 0:
- tempstring="Liberal"
- case 1:
- tempstring="Medium"
- case 2:
- tempstring="Conservative"
- end select
- 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 = 4 then
- if AdvanceFlag = 100 then
- AdvanceFlag = 1000
- else
- AdvanceFlag = 100
- end if
- DisplayAllOptions
- elseif CurrentOption = 5 then
- if SuperAdvanceFlag = 5 then
- SuperAdvanceFlag = 3
- else
- SuperAdvanceFlag = 5
- end if
- DisplayAllOptions
- elseif CurrentOption = 6 then
- ExtraBallFlag=ExtraBallFlag+1
- If ExtraBallFlag>2 then ExtraBallFlag=0
- 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"
- HSScore(6) = 35
- HSScore(7) = 30
- HSScore(8) = 25
- HSScore(9) = 20
- HSScore(10) = 15
- HSName(6) = "AAA"
- HSName(7) = "ZZZ"
- HSName(8) = "XXX"
- HSName(9) = "ABC"
- HSName(10) = "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 & "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
- '******************************************************
- ' FLIPPER AND RUBBER CORRECTION
- '******************************************************
- dim LFPress, RFPress, EOST, EOSA, EOSTnew, EOSaNew
- dim FStrength, FRampUp, fElasticity, EOSRampUp, SOSRampUp
- dim RFEndAngle, LFEndAngle, LF1EndAngle, RF1EndAngle, LFCount, RFCount, LiveCatch
- LFEndAngle = Leftflipper.EndAngle
- RFEndAngle = RightFlipper.EndAngle
- EOST = leftflipper.eosTorque 'End of Swing Torque
- EOSA = leftflipper.eosTorqueAngle 'End of Swing Torque Angle
- fStrength = LeftFlipper.strength 'Flipper Strength
- fRampUp = LeftFlipper.RampUp 'Flipper Ramp Up
- fElasticity = LeftFlipper.elasticity 'Flipper Elasticity
- EOStNew = 1.0 'new Flipper Torque
- EOSaNew = 0.2 'new FLipper Tprque Angle
- EOSRampUp = 1.5 'new EOS Ramp Up weaker at EOS because of the weaker holding coil
- SOSRampUp = 8.5 'new SOS Ramp Up strong at start because of the stronger starting coil
- LiveCatch = 8 'variable to check elapsed time from
- '********Need to have a flipper timer to check for these values
- Sub flipperTimer_Timer
- ' lFlip.rotz = leftflipper.currentangle -121
- ' rFlip.rotz = rightflipper.currentangle +121
- ' FlipperLSh.RotZ = LeftFlipper.currentangle
- ' FlipperRSh.RotZ = RightFlipper.currentangle
- '
- ' lFlip.rotz = leftflipper.CurrentAngle -121 'silver metal flipper obj
- ' lFlipR.rotz = leftflipper.CurrentAngle -121
- ' rFlip.rotz = RightFlipper.CurrentAngle +121
- ' rFlipR.rotz = RightFlipper.CurrentAngle +121
- ' lFlip001.roty = leftflipper001.CurrentAngle
- ' rFlip001.roty = RightFlipper001.CurrentAngle
- '
- '' FlipperLShadow1.RotZ = LeftFlipper1.CurrentAngle
- '' FlipperRShadow1.RotZ = RightFlipper1.CurrentAngle
- '--------------Flipper Tricks Section
- 'What this code does is swing the flipper fast and make the flipper soft near its EOS to enable live catches. It resets back to the base Table
- 'settings once the flipper reaches the end of swing. The code also makes the flipper starting ramp up high to simulate the stronger starting
- 'coil strength and weaker at its EOS to simulate the weaker hold coil.
- If LeftFlipper.CurrentAngle = LeftFlipper.EndAngle and LFPress = 1 Then 'If the flipper is fully swung and the flipper button is pressed then...
- LeftFlipper.eosTorqueAngle = EOSaNew 'sets flipper EOS Torque Angle to .2
- LeftFlipper.eosTorque = EOStNew 'sets flipper EOS Torque to 1
- LeftFlipper.RampUp = EOSRampUp 'sets flipper ramp up to 1.5
- If LFCount = 0 Then LFCount = GameTime 'sets the variable LFCount = to the elapsed game time
- If GameTime - LFCount < LiveCatch Then 'if less than 8ms have elasped then we are in a "Live Catch" scenario
- LeftFlipper.Elasticity = 0.1 'sets flipper elasticity WAY DOWN to allow Live Catches
- If LeftFlipper.EndAngle <> LFEndAngle Then LeftFlipper.EndAngle = LFEndAngle 'Keep the flipper at its EOS and don't let it deflect
- Else
- LeftFlipper.Elasticity = fElasticity 'reset flipper elasticity to the base table setting
- End If
- Elseif LeftFlipper.CurrentAngle > LeftFlipper.startangle - 0.05 Then 'If the flipper has started its swing, make it swing fast to nearly the end...
- LeftFlipper.RampUp = SOSRampUp 'set flipper Ramp Up high
- LeftFlipper.EndAngle = LFEndAngle - 3 'swing to within 3 degrees of EOS
- LeftFlipper.Elasticity = fElasticity 'Set the elasticity to the base table elasticity
- LFCount = 0
- Elseif LeftFlipper.CurrentAngle > LeftFlipper.EndAngle + 0.01 Then 'If the flipper has swung past it's end of swing then...
- LeftFlipper.eosTorque = EOST 'set the flipper EOS Torque back to the base table setting
- LeftFlipper.eosTorqueAngle = EOSA 'set the flipper EOS Torque Angle back to the base table setting
- LeftFlipper.RampUp = fRampUp 'set the flipper Ramp Up back to the base table setting
- LeftFlipper.Elasticity = fElasticity 'set the flipper Elasticity back to the base table setting
- End If
- If RightFlipper.CurrentAngle = RightFlipper.EndAngle and RFPress = 1 Then
- RightFlipper.eosTorqueAngle = EOSaNew
- RightFlipper.eosTorque = EOStNew
- RightFlipper.RampUp = EOSRampUp
- If RFCount = 0 Then RFCount = GameTime
- If GameTime - RFCount < LiveCatch Then
- RightFlipper.Elasticity = 0.1
- If RightFlipper.EndAngle <> RFEndAngle Then RightFlipper.EndAngle = RFEndAngle
- Else
- RightFlipper.Elasticity = fElasticity
- End If
- Elseif RightFlipper.CurrentAngle < RightFlipper.StartAngle + 0.05 Then
- RightFlipper.RampUp = SOSRampUp
- RightFlipper.EndAngle = RFEndAngle + 3
- RightFlipper.Elasticity = fElasticity
- RFCount = 0
- Elseif RightFlipper.CurrentAngle < RightFlipper.EndAngle - 0.01 Then
- RightFlipper.eosTorque = EOST
- RightFlipper.eosTorqueAngle = EOSA
- RightFlipper.RampUp = fRampUp
- RightFlipper.Elasticity = fElasticity
- End If
- End Sub
- dim LF : Set LF = New FlipperPolarity
- dim RF : Set RF = New FlipperPolarity
- dim LF1 : Set LF1 = New FlipperPolarity
- dim RF1 : Set RF1 = New FlipperPolarity
- InitPolarity
- Sub InitPolarity()
- dim x, a : a = Array(LF, RF, LF1, RF1)
- for each x in a
- 'safety coefficient (diminishes polarity correction only)
- x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
- x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
- x.enabled = True
- x.TimeDelay = 69 '*****Important, this variable is an offset for the speed that the ball travels down the table to determine if the flippers have been fired
- 'This is needed because the corrections to ball trajectory should only applied if the flippers have been fired and the ball is in the trigger zones.
- 'FlipAT is set to GameTime when the ball enters the flipper trigger zones and if GameTime is less than FlipAT + this time delay then changes to velocity
- 'and trajectory are applied. If the flipper is fired before the ball enters the trigger zone then with this delay added to FlipAT the changes
- 'to tragectory and velocity will not be applied. Also if the flipper is in the final 20 degrees changes to ball values will also not be applied.
- '"Faster" tables will need a smaller value while "slower" tables will need a larger value to give the ball more time to get to the flipper.
- 'If this value is not set high enough the Flipper Velocity and Polarity corrections will NEVER be applied.
- Next
- 'rf.report "Polarity"
- AddPt "Polarity", 0, 0, -2.7
- AddPt "Polarity", 1, 0.16, -2.7
- AddPt "Polarity", 2, 0.33, -2.7
- AddPt "Polarity", 3, 0.37, -2.7 '4.2
- AddPt "Polarity", 4, 0.41, -2.7
- AddPt "Polarity", 5, 0.45, -2.7 '4.2
- AddPt "Polarity", 6, 0.576,-2.7
- AddPt "Polarity", 7, 0.66, -1.8'-2.1896
- AddPt "Polarity", 8, 0.743, -0.5
- AddPt "Polarity", 9, 0.81, -0.5
- AddPt "Polarity", 10, 0.88, 0
- '"Velocity" Profile
- 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
- ' LF1.Object = LeftFlipper001
- LF.EndPoint = EndPointLp 'you can use just a coordinate, or an object with a .x property. Using a couple of simple primitive objects
- ' LF1.EndPoint = EndPointLp001
- RF.Object = RightFlipper
- ' RF1.Object = RightFlipper001
- ' RF1.EndPoint = EndPointRp001
- RF.EndPoint = EndPointRp
- End Sub
- Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
- dim a : a = Array(LF, RF, LF1, RF1)
- dim x : for each x in a
- x.addpoint aStr, idx, aX, aY
- Next
- 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
- Sub TriggerLF1_Hit() : LF.Addball activeball : End Sub
- Sub TriggerLF1_UnHit() : LF.PolarityCorrect activeball : End Sub
- Sub TriggerRF1_Hit() : RF.Addball activeball : End Sub
- Sub TriggerRF1_UnHit() : RF.PolarityCorrect activeball : End Sub
- 'Methods:
- '.TimeDelay - Delay before trigger shuts off automatically. Default = 80 (ms)
- '.AddPoint - "Polarity", "Velocity", "Ycoef" coordinate points. Use one of these 3 strings, keep coordinates sequential. x = %position on the flipper, y = output
- '.Object - set to flipper reference. Optional.
- '.StartPoint - set start point coord. Unnecessary, if .object is used.
- 'Called with flipper -
- 'ProcessBalls - catches ball data.
- ' - OR -
- '.Fire - fires flipper.rotatetoend automatically + processballs. Requires .Object to be set to the flipper.
- '***************This is flipperPolarity's addPoint Sub
- Class FlipperPolarity
- Public 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, 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) : if IsObject(aInput) then FlipperEnd = aInput.x else FlipperEnd = aInput : end if : End Property
- Public Property Get EndPoint : EndPoint = FlipperEnd : 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
- End Sub
- '********Triggered by a ball hitting the flipper trigger area
- 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
- '*********Used to rotate flipper since this is removed from the key down for the flippers
- Public Sub Fire()
- Flipper.RotateToEnd
- processballs
- End Sub
- 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)
- Next
- PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle)) '% of flipper swing
- PartialFlipCoef = abs(PartialFlipCoef-1)
- if abs(Flipper.currentAngle - Flipper.EndAngle) < 20 Then 'last 20 degrees of swing is not dealt with
- PartialFlipCoef = 0
- End If
- End Sub
- '***********gameTime is a global variable of how long the game has progressed in ms
- '***********This function lets the table know if the flipper has been fired
- Private Function FlipperOn()
- ' TB.text = gameTime & ":" & (FlipAT + TimeDelay) ' ******MOVE TB into view WHEN THIS FLIPPER FUNCTIONALITY IS ADDED TO A NEW TABLE TO CHECK IF THE TIME DELAY IS LONG ENOUGH*****
- if gameTime < FlipAt + TimeDelay then FlipperOn = True
- End Function 'Timer shutoff for polaritycorrect
- '***********This is turned on when a ball leaves the flipper trigger area
- Public Sub PolarityCorrect(aBall)
- if FlipperOn() then 'don't run this if the flippers are at rest
- ' tb.text = "In"
- dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
- dim teststr : teststr = "Cutoff"
- tmp = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
- if tmp < 0.1 then 'if real ball position is behind flipper, exit Sub to prevent stucks 'Disabled 1.03, I think it's the Mesh that's causing stucks, not this
- end if
- 'y safety Exit
- if aBall.VelY > -8 then 'if ball going down then remove the ball
- 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
- 'Velocity correction
- if not IsEmpty(VelocityIn(0) ) then
- ' tb.text = "Vel corr"
- Dim VelCoef
- if IsEmpty(BallData(idx).id) and aBall.VelY < -12 then 'if tip hit with no collected data, do vel correction anyway
- if PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1) > 1.1 then 'adjust plz
- VelCoef = LinearEnvelope(5, VelocityIn, VelocityOut)
- if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
- if Enabled then aBall.Velx = aBall.Velx*VelCoef'VelCoef
- if Enabled then aBall.Vely = aBall.Vely*VelCoef'VelCoef
- end if
- Else
- : VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
- if Enabled then aBall.Velx = aBall.Velx*VelCoef
- if Enabled then aBall.Vely = aBall.Vely*VelCoef
- end if
- 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)
- End If
- End If
- RemoveBall aBall
- End Sub
- End Class
- '================================
- 'Helper Functions
- 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) 'Set creates an object in VB
- 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
- '**********Takes in more than one array and passes them to ShuffleArray
- Sub ShuffleArrays(aArray1, aArray2, offset)
- ShuffleArray aArray1, offset
- ShuffleArray aArray2, offset
- End Sub
- '**********Calculate ball speed as hypotenuse of velX/velY triangle
- Function BallSpeed(ball) 'Calculates the ball speed
- BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
- End Function
- '**********Calculates the value of Y for an input x using the slope intercept equation
- 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
- 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
- '****************************************************************************
- '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
- '*********This sets up the rubbers:
- dim RubbersD
- Set RubbersD = new Dampener 'Makes a Dampener Class Object
- RubbersD.name = "Rubbers"
- '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 '0.96 'point# (keep sequential), ballspeed, CoR (elasticity)
- RubbersD.addpoint 1, 3.77, 0.935 '0.96
- RubbersD.addpoint 2, 5.76, 0.942 '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.CopyCoef RubbersD, 0.85
- '**********Class for dampener section of nfozzy's code
- 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
- 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
- ' Uses the LinearEnvelope function to calculate the correction based upon where it's value sits in relation
- ' to the addpoint parameters set above. Basically interpolates values between set points in a linear fashion
- DesiredCor = LinearEnvelope(cor.ballvel(aBall.id), ModIn, ModOut )
- ' Uses the function BallSpeed's value at the point of impact/the active ball's velocity which is constantly being updated
- ' RealCor is always less than 1
- RealCOR = BallSpeed(aBall) / cor.ballvel(aBall.id)
- ' Divides the desired CoR by the real COR to make a multiplier to correct velocity in x and y
- coef = desiredcor / realcor
- ' tb.text = "Coef = " & coef
- ' Applies the coef to x and y velocities
- aBall.velx = aBall.velx * coef : aBall.vely = aBall.vely * coef
- End Sub
- '***********This Sub sets the values for Sleeves (or any other future objects) to 85% (or whatever is passed in) of Posts
- 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
- End Class
- '*****************************Generates cor.ballVel for dampener
- Sub RDampen_Timer() ' 1 ms timer always on
- CoR.Update
- End Sub
- '*********CoR is Coefficient of Restitution defined as "how much of the kinetic energy remains for the objects
- 'to rebound from one another vs. how much is lost as heat, or work done deforming the objects
- dim cor : set cor = New CoRTracker
- Class CoRTracker
- public ballvel
- Private Sub Class_Initialize : redim ballvel(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
- for each b in allballs
- ballvel(b.id) = BallSpeed(b)
- Next
- End Sub
- End Class
- '********Interpolates the value for areas between the low and upper bounds sent to it
- 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) )
- 'clamp 2.0
- 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
Advertisement
Add Comment
Please, Sign In to add comment