Path: blob/main/Scripts/Mission/Boss_Foot2.txt
1319 views
//-----------------Sonic CD Boss Foot 2 Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//3//---------Used on Mission "M099 - Eggman: Speed Up"----------//45// Aliases6#alias Object.Value0 : Object.LegsEntity7#alias Object.Value1 : Object.BodyEntity8#alias Object.Value2 : Object.XOffSet9#alias Object.Value4 : Object.LegSide10#alias Object.Value5 : Object.YOffSet11#alias Object.Value6 : Object.XVelocity12#alias Object.Value7 : Object.YVelocity1314// Leg Joint Aliases15#alias Object.XPos : LegJoint.XPos16#alias Object.YPos : LegJoint.YPos17#alias Object.Value0 : LegJoint.BodyEntity18#alias Object.Value4 : LegJoint.LegJointSide1920#alias Object.Value5 : LegJointR.YOffSet21#alias Object.Value1 : LegJointR.LegREntity2223// Legs Aliases24#alias Object.XPos : Legs.XPos25#alias Object.YPos : Legs.YPos26#alias Object.Value0 : Legs.LegJointEntity27#alias Object.Value4 : Legs.LegSide2829#alias Object.Value1 : LegR.FootREntity3031// Body Aliases32#alias Object.XPos : Body.XPos33#alias Object.YPos : Body.YPos34#alias Object.Value0 : Body.FaceEntity35#alias Object.Value1 : Body.LegJointREntity3637// Face Aliases38#alias Object.XPos : Face.XPos39#alias Object.YPos : Face.YPos40#alias Object.Animation : Face.Animation41#alias Object.Direction : Face.FaceTimer4243// Foot Aliases44#alias Object.XPos : FootR.XPos45#alias Object.YPos : FootR.YPos4647// Player Aliases48#alias Player.Value4 : Player.InvincibleTimer4950// States51#alias 0 : BOSSFOOT2_SETUP52#alias 1 : BOSSFOOT2_STEP53#alias 2 : BOSSFOOT2_HANDLE_STEP54#alias 3 : BOSSFOOT2_STEP_OPPOSITE55#alias 4 : BOSSFOOT2_HANDLE_STEP_OPPOSITE56#alias 5 : BOSSFOOT2_LANDING57#alias 6 : BOSSFOOT2_DESTROYED5859// Eggman Animations60#alias 1 : EGGANI_LAUGH6162// Collision Sides63#alias 0 : CSIDE_FLOOR6465// Priority66#alias 0 : PRIORITY_BOUNDS6768// Stage SFX69#alias 0 : SFX_S_MECHSTEP7071// Function declarations72#function BossFoot2_HandleMovement73#function BossFoot2_StepEarthQuake74#function BossFoot2_SaveFootPosition75#function BossFoot2_CheckStepHeight76#function BossFoot2_Unused7778function BossFoot2_HandleMovement79ArrayPos0 = Object.LegsEntity8081Object.XPos = Legs[ArrayPos0].XPos82Object.XPos -= 0xB000083Object.XPos += Object.XVelocity8485Object.YPos = Legs[ArrayPos0].YPos86Object.YPos += 0xE000087Object.YPos += Object.YVelocity88end function899091function BossFoot2_StepEarthQuake92SetBit(Object.LegSide, 4, 1)9394ArrayPos0 = Object.LegsEntity95SetBit(Legs[ArrayPos0].LegSide, 4, 1)9697ArrayPos1 = Legs[ArrayPos0].LegJointEntity98SetBit(LegJoint[ArrayPos1].LegJointSide, 4, 1)99100Screen.ShakeY = 4101102ArrayPos0 = Object.BodyEntity103ArrayPos0++104if LegJointR[ArrayPos0].YOffSet > 2105ArrayPos0--106Body[ArrayPos0].YPos -= 0x18000107108ArrayPos0--109Face[ArrayPos0].YPos -= 0x18000110end if111112PlayStageSfx(SFX_S_MECHSTEP, false)113end function114115116function BossFoot2_SaveFootPosition117GetBit(TempValue0, Object.LegSide, 4)118if TempValue0 == false119CallFunction(BossFoot2_HandleMovement)120else121GetBit(TempValue0, Object.LegSide, 5)122if TempValue0 == true123TempValue6 = Object.XOffSet124TempValue7 = Object.YOffSet125if Object.State != BOSSFOOT2_STEP_OPPOSITE126FlipSign(TempValue6)127FlipSign(TempValue7)128end if129130ArrayPos0 = Object.LegsEntity131Legs[ArrayPos0].XPos -= TempValue6132Legs[ArrayPos0].YPos += TempValue7133134ArrayPos1 = Legs[ArrayPos0].LegJointEntity135LegJoint[ArrayPos1].XPos -= TempValue6136LegJoint[ArrayPos1].YPos += TempValue7137138ArrayPos0 = LegJoint[ArrayPos1].BodyEntity139Body[ArrayPos0].XPos -= TempValue6140Body[ArrayPos0].YPos += TempValue7141142ArrayPos1 = Body[ArrayPos0].FaceEntity143Face[ArrayPos1].XPos -= TempValue6144Face[ArrayPos1].YPos += TempValue7145end if146end if147end function148149150function BossFoot2_Unused151TempValue0 = Object.YPos152ObjectTileCollision(CSIDE_FLOOR, 0, 20, 0)153if CheckResult == true154GetBit(TempValue0, Object.LegSide, 5)155if TempValue0 == true156TempValue0 -= Object.YPos157158ArrayPos0 = Object.LegsEntity159Legs[ArrayPos0].YPos -= TempValue0160161ArrayPos1 = Legs[ArrayPos0].LegJointEntity162LegJoint[ArrayPos1].YPos -= TempValue0163164ArrayPos0 = LegJoint[ArrayPos1].BodyEntity165Body[ArrayPos1].YPos -= TempValue0166167ArrayPos1 = Body[ArrayPos0].FaceEntity168Face[ArrayPos1].YPos -= TempValue0169end if170end if171end function172173// Probably made to be make sure the boss doesn't glitch with the extended walking area174function BossFoot2_CheckStepHeight175CheckEqual(Object.iYPos, 436)176TempValue0 = CheckResult177CheckGreater(Object.iYPos, 436)178CheckResult |= TempValue0179if CheckResult == true180Object.iYPos = 436181ArrayPos0 = Object.LegsEntity182Object.YVelocity = Object.YPos183Object.YVelocity -= Legs[ArrayPos0].YPos184Object.YVelocity -= 0xE0000185end if186end function187188189sub ObjectMain190switch Object.State191case BOSSFOOT2_SETUP192TempValue0 = 0x4000193TempValue0 *= Object.PropertyValue // Set off194TempValue0 /= 10195196Object.XOffSet = TempValue0197Object.YOffSet = TempValue0198Object.YOffSet <<= 1199200Object.XVelocity = -0x80000201Object.YVelocity = 0x100000202203SetBit(Object.LegSide, 0, 1)204CallFunction(BossFoot2_HandleMovement)205Object.State=BOSSFOOT2_HANDLE_STEP206break207208case BOSSFOOT2_STEP209Object.XVelocity -= Object.XOffSet210Object.YVelocity += Object.YOffSet211212TempValue1 = true213GetBit(TempValue0, Object.LegSide, 4)214CheckResult = TempValue0215GetBit(TempValue0, Object.LegSide, 7)216CheckResult &= TempValue0217218if CheckResult == true219220if Object.YVelocity >= 0xC0000221SetBit(Object.LegSide, 0, 1)222Object.State = BOSSFOOT2_HANDLE_STEP223TempValue1 = false224end if225226else227228if Object.YVelocity >= 0x100000229SetBit(Object.LegSide, 0, 1)230Object.State = BOSSFOOT2_HANDLE_STEP231TempValue1 = false232end if233234end if235236if TempValue1 == true237CallFunction(BossFoot2_SaveFootPosition)238ObjectTileCollision(CSIDE_FLOOR, 0, 20, 0)239TempValue2 = CheckResult240CallFunction(BossFoot2_CheckStepHeight)241TempValue2 |= CheckResult242if TempValue2 == true243CallFunction(BossFoot2_StepEarthQuake)244end if245end if246break247248case BOSSFOOT2_HANDLE_STEP249GetBit(TempValue0, Object.LegSide, 4)250if TempValue0 == false251CallFunction(BossFoot2_HandleMovement)252253ObjectTileCollision(CSIDE_FLOOR, 0, 20, 0)254TempValue2 = CheckResult255CallFunction(BossFoot2_CheckStepHeight)256TempValue2 |= CheckResult257if TempValue2 == true258CallFunction(BossFoot2_StepEarthQuake)259end if260end if261break262263case BOSSFOOT2_STEP_OPPOSITE264Object.XVelocity += Object.XOffSet265Object.YVelocity -= Object.YOffSet266267if Object.YVelocity <= 0268Object.XVelocity = 0269Object.YVelocity = 0270SetBit(Object.LegSide, 0, 1)271Object.State = BOSSFOOT2_HANDLE_STEP_OPPOSITE272end if273CallFunction(BossFoot2_SaveFootPosition)274break275276case BOSSFOOT2_HANDLE_STEP_OPPOSITE277CallFunction(BossFoot2_HandleMovement)278break279280case BOSSFOOT2_LANDING281ArrayPos0 = Object.BodyEntity282ArrayPos1 = Body[ArrayPos0].LegJointREntity283284ArrayPos0 = LegJointR[ArrayPos1].LegREntity285ArrayPos1 = LegR[ArrayPos0].FootREntity286287Object.XPos = FootR[ArrayPos1].XPos288Object.XPos -= 0xA0000289Object.YPos = FootR[ArrayPos1].YPos290break291case BOSSFOOT2_DESTROYED292GetBit(TempValue0, Object.LegSide, 4)293if TempValue0 == false294Object.XOffSet -= 0x660295else296Object.XOffSet += 0x660297end if298Object.YOffSet += 0x1660299300Object.XPos += Object.XOffSet301Object.YPos += Object.YOffSet302if Object.OutOfBounds == true303Object.Type = TypeName[Blank Object]304Object.Priority = PRIORITY_BOUNDS305end if306break307308end switch309end sub310311312sub ObjectPlayerInteraction313if Object.State < BOSSFOOT2_DESTROYED314if Player.InvincibleTimer == 0315PlayerObjectCollision(C_TOUCH, -28, -20, 26, 20)316if CheckResult == true317318ArrayPos0 = Object.LegsEntity319ArrayPos1 = Legs[ArrayPos0].LegJointEntity320ArrayPos0 = LegJoint[ArrayPos1].BodyEntity321ArrayPos1 = Body[ArrayPos0].FaceEntity322323Face[ArrayPos1].Animation = EGGANI_LAUGH324Face[ArrayPos1].FaceTimer = 180325326Player.State = Player_State_GotHit327if Player.XPos > Object.XPos328Player.Speed = 0x20000329else330Player.Speed = -0x20000331end if332end if333end if334end if335end sub336337338sub ObjectDraw339DrawSprite(0)340end sub341342343sub ObjectStartup344LoadSpriteSheet("R1/Objects3.gif")345346SpriteFrame(-32, -20, 58, 40, 1, 66) // #0 - EGG-HVC-001 Foot347end sub348349350// ========================351// Editor Subs352// ========================353354sub RSDKDraw355DrawSprite(0)356end sub357358359sub RSDKLoad360LoadSpriteSheet("R1/Objects3.gif")361SpriteFrame(-32, -20, 58, 40, 1, 66) // #0 - EGG-HVC-001 Foot362363SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")364end sub365366367