Path: blob/main/Scripts/R1/Boss_Foot.txt
1319 views
//----------------Sonic CD Boss Foot Script-------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.LegsEntity6#alias Object.Value1 : Object.BodyEntity7#alias Object.Value2 : Object.XOffSet8#alias Object.Value4 : Object.LegSide9#alias Object.Value5 : Object.YOffSet10#alias Object.Value6 : Object.XVelocity11#alias Object.Value7 : Object.YVelocity1213// Leg Joint Aliases14#alias Object.XPos : LegJoint.XPos15#alias Object.YPos : LegJoint.YPos16#alias Object.Value0 : LegJoint.BodyEntity17#alias Object.Value4 : LegJoint.LegJointSide1819#alias Object.Value5 : LegJointR.YOffSet20#alias Object.Value1 : LegJointR.LegREntity2122// Legs Aliases23#alias Object.XPos : Legs.XPos24#alias Object.YPos : Legs.YPos25#alias Object.Value0 : Legs.LegJointEntity26#alias Object.Value4 : Legs.LegSide2728#alias Object.Value1 : LegR.FootREntity2930// Body Aliases31#alias Object.XPos : Body.XPos32#alias Object.YPos : Body.YPos33#alias Object.Value0 : Body.FaceEntity34#alias Object.Value1 : Body.LegJointREntity3536// Face Aliases37#alias Object.XPos : Face.XPos38#alias Object.YPos : Face.YPos39#alias Object.Animation : Face.Animation40#alias Object.Direction : Face.FaceTimer4142// Foot Aliases43#alias Object.XPos : FootR.XPos44#alias Object.YPos : FootR.YPos4546// Player Aliases47#alias Player.Value4 : Player.InvincibleTimer4849// States50#alias 0 : BOSSFOOT_SETUP51#alias 1 : BOSSFOOT_STEP52#alias 2 : BOSSFOOT_HANDLE_STEP53#alias 3 : BOSSFOOT_STEP_OPPOSITE54#alias 4 : BOSSFOOT_HANDLE_STEP_OPPOSITE55#alias 5 : BOSSFOOT_LANDING56#alias 6 : BOSSFOOT_DESTROYED5758// Eggman Animations59#alias 1 : EGGANI_LAUGH6061// Collision Sides62#alias 0 : CSIDE_FLOOR6364// Stage SFX65#alias 0 : SFX_S_MECHSTEP6667// Priority68#alias 0 : PRIORITY_BOUNDS6970#function BossFoot_HandleMovement71#function BossFoot_StepEarthQuake72#function BossFoot_SaveFootPosition73#function BossFoot_Unused7475function BossFoot_HandleMovement76ArrayPos0 = Object.LegsEntity7778Object.XPos = Legs[ArrayPos0].XPos79Object.XPos -= 0xB000080Object.XPos += Object.XVelocity8182Object.YPos = Legs[ArrayPos0].YPos83Object.YPos += 0xE000084Object.YPos += Object.YVelocity85end function868788function BossFoot_StepEarthQuake89SetBit(Object.LegSide, 4, 1)9091ArrayPos0 = Object.LegsEntity92SetBit(Legs[ArrayPos0].LegSide, 4, 1)9394ArrayPos1 = Legs[ArrayPos0].LegJointEntity95SetBit(LegJoint[ArrayPos1].LegJointSide, 4, 1)9697Screen.ShakeY = 49899ArrayPos0 = Object.BodyEntity100ArrayPos0++101if LegJointR[ArrayPos0].YOffSet > 2102ArrayPos0--103Body[ArrayPos0].YPos -= 0x18000104105ArrayPos0--106Face[ArrayPos0].YPos -= 0x18000107end if108109PlayStageSfx(SFX_S_MECHSTEP, false)110111#platform: Use_Haptics112HapticEffect(100, 0, 0, 0)113#endplatform114115end function116117118function BossFoot_SaveFootPosition119GetBit(TempValue0, Object.LegSide, 4)120if TempValue0 == false121CallFunction(BossFoot_HandleMovement)122else123GetBit(TempValue0, Object.LegSide, 5)124if TempValue0 == true125TempValue6 = Object.XOffSet126TempValue7 = Object.YOffSet127if Object.State != BOSSFOOT_STEP_OPPOSITE128FlipSign(TempValue6)129FlipSign(TempValue7)130end if131132ArrayPos0 = Object.LegsEntity133Legs[ArrayPos0].XPos -= TempValue6134Legs[ArrayPos0].YPos += TempValue7135136ArrayPos1 = Legs[ArrayPos0].LegJointEntity137LegJoint[ArrayPos1].XPos -= TempValue6138LegJoint[ArrayPos1].YPos += TempValue7139140ArrayPos0 = LegJoint[ArrayPos1].BodyEntity141Body[ArrayPos0].XPos -= TempValue6142Body[ArrayPos0].YPos += TempValue7143144ArrayPos1 = Body[ArrayPos0].FaceEntity145Face[ArrayPos1].XPos -= TempValue6146Face[ArrayPos1].YPos += TempValue7147end if148end if149end function150151152function BossFoot_Unused153TempValue0 = Object.YPos154ObjectTileCollision(CSIDE_FLOOR, 0, 20, 0)155if CheckResult == true156GetBit(TempValue0, Object.LegSide, 5)157if TempValue0 == true158TempValue0 -= Object.YPos159160ArrayPos0 = Object.LegsEntity161Legs[ArrayPos0].YPos -= TempValue0162163ArrayPos1 = Legs[ArrayPos0].LegJointEntity164LegJoint[ArrayPos1].YPos -= TempValue0165166ArrayPos0 = LegJoint[ArrayPos1].BodyEntity167Body[ArrayPos1].YPos -= TempValue0168169ArrayPos1 = Body[ArrayPos0].FaceEntity170Face[ArrayPos1].YPos -= TempValue0171end if172end if173end function174175176sub ObjectMain177switch Object.State178case BOSSFOOT_SETUP179Object.XOffSet = 0x4000180Object.YOffSet = 0x8000181182Object.XVelocity = -0x80000183Object.YVelocity = 0x100000184185SetBit(Object.LegSide, 0, 1)186CallFunction(BossFoot_HandleMovement)187Object.State = BOSSFOOT_HANDLE_STEP188break189190case BOSSFOOT_STEP191Object.XVelocity -= Object.XOffSet192Object.YVelocity += Object.YOffSet193194TempValue1 = true195GetBit(TempValue0, Object.LegSide, 4)196CheckResult = TempValue0197GetBit(TempValue0, Object.LegSide, 7)198CheckResult &= TempValue0199200if CheckResult == true201202if Object.YVelocity >= 0xC0000203SetBit(Object.LegSide, 0, 1)204Object.State = BOSSFOOT_HANDLE_STEP205TempValue1 = false206end if207208else209210if Object.YVelocity >= 0x100000211SetBit(Object.LegSide, 0, 1)212Object.State = BOSSFOOT_HANDLE_STEP213TempValue1 = false214end if215216end if217218if TempValue1 == true219CallFunction(BossFoot_SaveFootPosition)220221ObjectTileCollision(CSIDE_FLOOR, 0, 20, 0)222if CheckResult == true223CallFunction(BossFoot_StepEarthQuake)224end if225226end if227break228229case BOSSFOOT_HANDLE_STEP230GetBit(TempValue0, Object.LegSide, 4)231if TempValue0 == false232CallFunction(BossFoot_HandleMovement)233234ObjectTileCollision(CSIDE_FLOOR, 0, 20, 0)235if CheckResult == true236CallFunction(BossFoot_StepEarthQuake)237end if238end if239break240241case BOSSFOOT_STEP_OPPOSITE242Object.XVelocity += Object.XOffSet243Object.YVelocity -= Object.YOffSet244245if Object.YVelocity <= 0246Object.XVelocity = 0247Object.YVelocity = 0248SetBit(Object.LegSide, 0, 1)249Object.State = BOSSFOOT_HANDLE_STEP_OPPOSITE250end if251CallFunction(BossFoot_SaveFootPosition)252break253254case BOSSFOOT_HANDLE_STEP_OPPOSITE255CallFunction(BossFoot_HandleMovement)256break257258case BOSSFOOT_LANDING259ArrayPos0 = Object.BodyEntity260ArrayPos1 = Body[ArrayPos0].LegJointREntity261262ArrayPos0 = LegJointR[ArrayPos1].LegREntity263ArrayPos1 = LegR[ArrayPos0].FootREntity264265Object.XPos = FootR[ArrayPos1].XPos266Object.XPos -= 0xA0000267Object.YPos = FootR[ArrayPos1].YPos268break269270case BOSSFOOT_DESTROYED271GetBit(TempValue0, Object.LegSide, 4)272if TempValue0 == false273Object.XOffSet -= 0x660274else275Object.XOffSet += 0x660276end if277Object.XPos += Object.XOffSet278279Object.YOffSet += 0x1660280Object.YPos += Object.YOffSet281if Object.OutOfBounds == true282Object.Type = TypeName[Blank Object]283Object.Priority = PRIORITY_BOUNDS284end if285break286287end switch288end sub289290291sub ObjectPlayerInteraction292if Object.State < BOSSFOOT_DESTROYED293if Player.InvincibleTimer == 0294PlayerObjectCollision(C_TOUCH, -28, -20, 26, 20)295if CheckResult == true296297ArrayPos0 = Object.LegsEntity298ArrayPos1 = Legs[ArrayPos0].LegJointEntity299ArrayPos0 = LegJoint[ArrayPos1].BodyEntity300ArrayPos1 = Body[ArrayPos0].FaceEntity301302Face[ArrayPos1].Animation = EGGANI_LAUGH303Face[ArrayPos1].FaceTimer = 180304Player.State = Player_State_GotHit305if Player.XPos > Object.XPos306Player.Speed = 0x20000307else308Player.Speed = -0x20000309end if310311end if312313end if314315end if316end sub317318319sub ObjectDraw320DrawSprite(0)321end sub322323324sub ObjectStartup325LoadSpriteSheet("R1/Objects3.gif")326327SpriteFrame(-32, -20, 58, 40, 1, 66) // #0 - EGG-HVC-001 Foot328end sub329330331// ========================332// Editor Subs333// ========================334335sub RSDKDraw336DrawSprite(0)337end sub338339340sub RSDKLoad341LoadSpriteSheet("R1/Objects3.gif")342SpriteFrame(-32, -20, 58, 40, 1, 66) // #0 - EGG-HVC-001 Foot343344SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")345end sub346347348