Path: blob/main/Scripts/Mission/Boss_Arm2.txt
1319 views
//----------------Sonic CD Boss Arm 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.ArmJointEntity7#alias Object.Value2 : Object.XOffSet8#alias Object.Value3 : Object.Timer9#alias Object.Value4 : Object.Charging10#alias Object.Value5 : Object.YOffSet11#alias Object.Value6 : Object.XVelocity12#alias Object.Value7 : Object.YVelocity1314// Arm Joint Aliases15#alias Object.Xpos : ArmJoint.XPos16#alias Object.YPos : ArmJoint.YPos1718// States19#alias 0 : BOSSARM2_SETUP20#alias 1 : BOSSARM2_IDLE21#alias 2 : BOSSARM2_DESTROYED22#alias 3 : BOSSARM2_MOVE_TO_FRONT23#alias 4 : BOSSARM2_MOVE_TO_BACK24#alias 5 : BOSSARM2_START_CHARGE2526// Global SFX27#alias 22 : SFX_G_EXPLOSION2829// Priority30#alias 0 : PRIORITY_BOUNDS313233// Function declarations34#function BossArm2_HandleArmMovement353637function BossArm2_HandleArmMovement38ArrayPos0 = Object.ArmJointEntity3940Object.XPos = ArmJoint[ArrayPos0].XPos41Object.XPos -= 0x24000042Object.XPos += Object.XVelocity4344Object.YPos = ArmJoint[ArrayPos0].YPos4546TempValue1 = true47GetBit(TempValue0, Object.Charging, 7)4849if TempValue0 == false50if Player.YPos < Object.YPos51if Object.YVelocity > -0x8000052Object.YVelocity -= 0x1000053end if54TempValue1 = false55end if56end if5758if TempValue1 == true59if Object.YVelocity < 0x8000060Object.YVelocity += 0x1000061end if62end if63Object.YPos += Object.YVelocity64end function656667sub ObjectMain68switch Object.State69case BOSSARM2_SETUP70Object.State=BOSSARM2_IDLE71// Fall Through72case BOSSARM2_IDLE73CallFunction(BossArm2_HandleArmMovement)74break7576case BOSSARM2_DESTROYED77Object.XOffSet -= 0x62078Object.YOffSet += 0x12207980Object.XPos += Object.XOffSet81Object.YPos += Object.YOffSet8283Object.Timer++84if Object.Timer == 785Object.Timer = 086CreateTempObject(TypeName[Explosion], 0, Object.XPos, Object.YPos)87PlaySfx(SFX_G_EXPLOSION, false)88end if8990if Object.OutOfBounds == true91Object.Type = TypeName[Blank Object]92Object.Priority = PRIORITY_BOUNDS93end if94break9596case BOSSARM2_MOVE_TO_FRONT97if Object.XVelocity > 098TempValue0 = 0x800099TempValue0 *= Object.PropertyValue // Set the XVelocity decrease value based on it's property value100TempValue0 /= 10101Object.XVelocity -= TempValue0102end if103CallFunction(BossArm2_HandleArmMovement)104break105106case BOSSARM2_MOVE_TO_BACK107if Object.XVelocity < 0x100000108TempValue0 = 0x8000109TempValue0 *= Object.PropertyValue110TempValue0 /= 10111Object.XVelocity += TempValue0112end if113CallFunction(BossArm2_HandleArmMovement)114break115116case BOSSARM2_START_CHARGE117if Object.XVelocity < 0x80000118TempValue0 = 0x8000119TempValue0 *= Object.PropertyValue // Set the XVelocity increase value based on it's property value120TempValue0 /= 10121Object.XVelocity += TempValue0122else123// Set the arm to its retracted frame124// -> However, because of an oversight when drawing, this change can't be seen anyway so it's unused125Object.Frame = 1126end if127128ArrayPos0 = Object.ArmJointEntity129130Object.XPos = ArmJoint[ArrayPos0].XPos131Object.XPos -= 0x240000132Object.XPos += Object.XVelocity133134if Object.YVelocity < 0x80000135TempValue0 = 0x10000136TempValue0 *= Object.PropertyValue137TempValue0 /= 10138Object.YVelocity += TempValue0139end if140141Object.YPos = ArmJoint[ArrayPos0].YPos142Object.YPos += Object.YVelocity143break144end switch145end sub146147148sub ObjectDraw149DrawSprite(3)150151// This should actually be Object.Frame152// Since it isn't, the arm just shows as extended all the time153DrawSprite(0)154end sub155156157sub ObjectStartup158LoadSpriteSheet("R1/Objects3.gif")159160SpriteFrame(-15, -8, 32, 16, 141, 34) // #0 - Arm Extend161SpriteFrame(-6, -8, 24, 16, 174, 34) // #1 - Arm Retract Frame 0 (Unused by code mistake)162SpriteFrame(2, -8, 16, 16, 124, 51) // #2 - Arm Retract Frame 1 (Unused)163SpriteFrame(9, -8, 24, 16, 141, 51) // #3 - Arm Elbow164end sub165166167// ========================168// Editor Subs169// ========================170171sub RSDKDraw172DrawSprite(1)173DrawSprite(0)174end sub175176177sub RSDKLoad178LoadSpriteSheet("R1/Objects3.gif")179SpriteFrame(-15, -8, 32, 16, 141, 34) // Arm Extend180SpriteFrame(9, -8, 24, 16, 141, 51) // Elbow181182183SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")184end sub185186187188189