Path: blob/main/Scripts/R1/Boss_Arm.txt
1319 views
//----------------Sonic CD Boss Arm Script--------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// ========================5// Aliases6// ========================78#alias Object.Value0 : Object.ArmJointEntity // Set by [Boss Face]9#alias Object.Value2 : Object.XOffSet10#alias Object.Value3 : Object.Timer11#alias Object.Value4 : Object.Charging12#alias Object.Value5 : Object.YOffSet13#alias Object.Value6 : Object.XVelocity14#alias Object.Value7 : Object.YVelocity1516// States17#alias 0 : BOSSARM_SETUP18#alias 1 : BOSSARM_IDLE19#alias 2 : BOSSARM_DESTROYED20#alias 3 : BOSSARM_MOVE_TO_FRONT21#alias 4 : BOSSARM_MOVE_TO_BACK22#alias 5 : BOSSARM_START_CHARGE2324// Arm Joint Aliases25#alias Object.XPos : ArmJoint.XPos26#alias Object.YPos : ArmJoint.YPos2728// Priority Aliases29#alias 0 : PRIORITY_BOUNDS3031// Global SFX Aliases32#alias 22 : SFX_G_EXPLOSION333435// ========================36// Fuction Declarations37// ========================3839#function BossArm_HandleArmMovement404142// ========================43// Fucntion Definitions44// ========================4546function BossArm_HandleArmMovement47ArrayPos0 = Object.ArmJointEntity4849Object.XPos = ArmJoint[ArrayPos0].XPos50Object.XPos -= 0x24000051Object.XPos += Object.XVelocity5253Object.YPos = ArmJoint[ArrayPos0].YPos5455TempValue1 = true56GetBit(TempValue0, Object.Charging, 7) // Check if the HVC is charging agaisnt Sonic57if TempValue0 == false // If not, adjust the arms height to defend from the player58if Player.YPos < Object.YPos59if Object.YVelocity > -0x8000060Object.YVelocity -= 0x1000061end if6263TempValue1 = false64end if65end if6667if TempValue1 == true // If it's charging, then the arm's height is set in stone68if Object.YVelocity < 0x8000069Object.YVelocity += 0x1000070end if71end if72Object.YPos += Object.YVelocity73end function747576// ========================77// Events78// ========================7980sub ObjectMain81switch Object.State82case BOSSARM_SETUP83Object.State = BOSSARM_IDLE84// [Fallthrough]85case BOSSARM_IDLE86CallFunction(BossArm_HandleArmMovement)87break8889case BOSSARM_DESTROYED90Object.XOffSet -= 0x62091Object.XPos += Object.XOffSet9293Object.YOffSet += 0x122094Object.YPos += Object.YOffSet9596Object.Timer++97if Object.Timer == 798Object.Timer = 099CreateTempObject(TypeName[Explosion], 0, Object.XPos, Object.YPos)100PlaySfx(SFX_G_EXPLOSION, false)101end if102103if Object.OutOfBounds == true104Object.Type = TypeName[Blank Object]105Object.Priority = PRIORITY_BOUNDS106end if107break108109case BOSSARM_MOVE_TO_FRONT110if Object.XVelocity > 0111Object.XVelocity -= 0x8000112end if113CallFunction(BossArm_HandleArmMovement)114break115116case BOSSARM_MOVE_TO_BACK117if Object.XVelocity < 0x100000118Object.XVelocity += 0x8000119end if120CallFunction(BossArm_HandleArmMovement)121break122123case BOSSARM_START_CHARGE124if Object.XVelocity < 0x80000125Object.XVelocity += 0x8000126else127// Set the arm to its retracted frame128// -> However, because of an oversight when drawing, this change can't be seen anyway so this has no effect129Object.Frame = 1130end if131132ArrayPos0 = Object.ArmJointEntity133134Object.XPos = ArmJoint[ArrayPos0].XPos135Object.XPos -= 0x240000136Object.XPos += Object.XVelocity137138if Object.YVelocity <0x80000139Object.YVelocity += 0x10000140end if141Object.YPos = ArmJoint[ArrayPos0].YPos142Object.YPos += Object.YVelocity143break144145end switch146end sub147148149sub ObjectDraw150DrawSprite(3)151152// See above - this should actually be Object.Frame153// However, since it isn't, the arm just shows as extended all the time154DrawSprite(0)155end sub156157158sub ObjectStartup159LoadSpriteSheet("R1/Objects3.gif")160161SpriteFrame(-15, -8, 32, 16, 141, 34) // #0 - Arm Extend162SpriteFrame(-6, -8, 24, 16, 174, 34) // #1 - Arm Retract Frame 0 (Unused, though meant to be used)163SpriteFrame(2, -8, 16, 16, 124, 51) // #2 - Arm Retract Frame 1 (Unused)164SpriteFrame(9, -8, 24, 16, 141, 51) // #3 - Arm Elbow165end sub166167168// ========================169// Editor Subs170// ========================171172sub RSDKDraw173DrawSprite(1)174DrawSprite(0)175end sub176177178sub RSDKLoad179LoadSpriteSheet("R1/Objects3.gif")180SpriteFrame(-15, -8, 32, 16, 141, 34) // Arm Extend181SpriteFrame(9, -8, 24, 16, 141, 51) // Elbow182183SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")184end sub185186187