Path: blob/main/Scripts/R1/Boss_Leg.txt
1319 views
//------------------Sonic CD Boss Leg Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.LegJointEntity6#alias Object.Value1 : Object.FootEntity7#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// Foot Aliases14#alias Object.Value4 : Foot.LegSide1516// Leg Joint Aliases17#alias Object.XPos : LegJoint.XPos18#alias Object.YPos : LegJoint.YPos19#alias Object.Value0 : LegJoint.BodyEntity2021#alias Object.Value1 : LegJointR.LegREntity2223// Leg Aliases24#alias Object.XPos : LegR.XPos25#alias Object.YPos : LegR.YPos2627// Body Aliases28#alias Object.Value0 : Body.FaceEntity29#alias Object.Value1 : Body.LegJointREntity30#alias Object.XPos : Body.XPos31#alias Object.YPos : Body.YPos3233// Face Aliases34#alias Object.XPos : Face.XPos35#alias Object.YPos : Face.YPos36#alias Object.Animation : Face.Animation37#alias Object.Direction : Face.FaceTimer3839// Player Aliases40#alias Player.Value4 : Player.InvincibleTimer4142// States43#alias 0 : BOSSLEG_SETUP44#alias 1 : BOSSLEG_LANDING45#alias 2 : BOSSLEG_L_MIMIC_R46#alias 3 : BOSSLEG_MOVE47#alias 4 : BOSSLEG_MOVE_OPPOSITE48#alias 5 : BOSSLEG_MOVE_C // Charged version49#alias 6 : BOSSLEG_MOVE_OPPOSITE_C // Charged version50#alias 7 : BOSSLEG_DESTROYED5152// Eggman Animations53#alias 1 : EGGANI_LAUGH5455// Priority56#alias 0 : PRIORITY_BOUNDS5758// Function declarations59#function BossLeg_SaveLegPosition60#function BossLeg_HandleMovement6162function BossLeg_SaveLegPosition63GetBit(TempValue0, Object.LegSide, 5)64if TempValue0 == true65ArrayPos0 = Object.LegJointEntity66LegJoint[ArrayPos0].XPos += TempValue167LegJoint[ArrayPos0].YPos += TempValue26869ArrayPos1 = LegJoint[ArrayPos0].BodyEntity70Body[ArrayPos1].XPos += TempValue171Body[ArrayPos1].YPos += TempValue27273ArrayPos0 = Body[ArrayPos1].FaceEntity74Face[ArrayPos0].XPos += TempValue175Face[ArrayPos0].YPos += TempValue276end if77end function787980function BossLeg_HandleMovement81ArrayPos0 = Object.LegJointEntity82Object.XPos = LegJoint[ArrayPos0].XPos83Object.XPos += 0x4000084Object.XPos += Object.XVelocity8586Object.YPos = LegJoint[ArrayPos0].YPos87Object.YPos += 0x10000088Object.YPos += Object.YVelocity89end function909192sub ObjectMain93switch Object.State94case BOSSLEG_SETUP95Object.XOffSet = 0x800096Object.YOffSet = 0x40009798Object.State = BOSSLEG_LANDING99break100101case BOSSLEG_LANDING102ArrayPos0 = Object.LegJointEntity103104Object.XPos = LegJoint[ArrayPos0].XPos105Object.XPos += 0x40000106107Object.YPos = LegJoint[ArrayPos0].YPos108Object.YPos += 0x100000109break110111case BOSSLEG_L_MIMIC_R112// No matter the leg, it will end up picking the right leg here113ArrayPos0 = Object.LegJointEntity114ArrayPos1 = LegJoint[ArrayPos0].BodyEntity115ArrayPos0 = Body[ArrayPos1].LegJointREntity116ArrayPos1 = LegJointR[ArrayPos0].LegREntity117118Object.XPos = LegR[ArrayPos1].XPos119Object.XPos -= 0xA0000120Object.YPos = LegR[ArrayPos1].YPos121break122123case BOSSLEG_MOVE // whatever leg this is, it will move124ArrayPos0 = Object.FootEntity125if Object.XVelocity < 0x80000126TempValue1 = Object.XOffSet127Object.XVelocity += TempValue1128129GetBit(TempValue0, Object.LegSide, 4)130if TempValue0 == true131FlipSign(TempValue1)132TempValue2 = false133CallFunction(BossLeg_SaveLegPosition)134else135CallFunction(BossLeg_HandleMovement)136end if137138else139CallFunction(BossLeg_HandleMovement)140end if141142break143144case BOSSLEG_MOVE_OPPOSITE // whatever leg this is, it will wait for the opposite to move145ArrayPos0 = Object.FootEntity146if Object.XVelocity > -0x80000147TempValue1 = Object.XOffSet148Object.XVelocity -= TempValue1149150GetBit(TempValue0, Object.LegSide, 4)151if TempValue0 == true152TempValue2 = false153CallFunction(BossLeg_SaveLegPosition)154else155CallFunction(BossLeg_HandleMovement)156end if157158else159CallFunction(BossLeg_HandleMovement)160end if161162break163164case BOSSLEG_MOVE_C // whatever leg this is, it will move165if Object.XVelocity > -0x80000166TempValue1 = Object.XOffSet167Object.XVelocity -= TempValue1168else169TempValue1 = false170end if171172if Object.YVelocity > -0x40000173TempValue2 = Object.YOffSet174Object.YVelocity -= TempValue2175else176TempValue2 = false177end if178179GetBit(TempValue0, Object.LegSide, 4)180if TempValue0 == true181CallFunction(BossLeg_SaveLegPosition)182else183CallFunction(BossLeg_HandleMovement)184end if185break186187case BOSSLEG_MOVE_OPPOSITE_C // whatever leg this is, it will wait for it's opposite to move188if Object.XVelocity > -0x80000189TempValue1 = Object.XOffSet190Object.XVelocity -= TempValue1191else192TempValue1 = 0193end if194if Object.YVelocity < 0x40000195TempValue2 = Object.YOffSet196Object.YVelocity += TempValue2197else198TempValue2 = 0199end if200201GetBit(TempValue0, Object.LegSide, 4)202if TempValue0 == true203FlipSign(TempValue2)204CallFunction(BossLeg_SaveLegPosition)205else206CallFunction(BossLeg_HandleMovement)207end if208break209210case BOSSLEG_DESTROYED211GetBit(TempValue0, Object.LegSide, 4)212if TempValue0 == false213Object.XOffSet -= 0x600214else215Object.XOffSet += 0x600216end if217Object.XPos += Object.XOffSet218219Object.YOffSet += 0x1A60220Object.YPos += Object.YOffSet221222if Object.OutOfBounds == true223Object.Type = TypeName[Blank Object]224Object.Priority = PRIORITY_BOUNDS225end if226break227end switch228end sub229230231sub ObjectPlayerInteraction232if Object.State < BOSSLEG_DESTROYED233if Player.InvincibleTimer == 0234PlayerObjectCollision(C_TOUCH, -12, -20, 12, -20)235if CheckResult == true236237Player.State = Player_State_GotHit238239ArrayPos0 = Object.LegJointEntity240ArrayPos1 = LegJoint[ArrayPos0].BodyEntity241ArrayPos0 = Body[ArrayPos1].FaceEntity242243Face[ArrayPos0].Animation = EGGANI_LAUGH244Face[ArrayPos0].FaceTimer = 180245if Player.XPos > Object.XPos246Player.Speed = 0x20000247else248Player.Speed = -0x20000249end if250end if251end if252end if253end sub254255256sub ObjectDraw257DrawSprite(0)258end sub259260261sub ObjectStartup262LoadSpriteSheet("R1/Objects3.gif")263264SpriteFrame(-12, -20, 24, 40, 74, 1) // #0 - EGG-HVC-001 Leg265end sub266267268// ========================269// Editor Subs270// ========================271272sub RSDKDraw273DrawSprite(0)274end sub275276277sub RSDKLoad278LoadSpriteSheet("R1/Objects3.gif")279SpriteFrame(-12, -20, 24, 40, 74, 1) // #0 - EGG-HVC-001 Leg280281SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")282end sub283284