Path: blob/main/Scripts/R5/Eggman.txt
1319 views
//-------------------Sonic CD Eggman Script-------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// States8#alias 0 : EGGMAN_IDLE9#alias 1 : EGGMAN_CONTROL10#alias 2 : EGGMAN_DAMAGED11#alias 3 : EGGMAN_PANICK_JUMP12#alias 4 : EGGMAN_PANICK_IDLE13#alias 5 : EGGMAN_PANICK_CONTROL14#alias 6 : EGGMAN_FLEE151617sub ObjectDraw1819// This Object is managed entirely by other Objects, the only thing this Object does is draw (and flee at the end)2021switch Object.State22case EGGMAN_IDLE23// Draw his Idle Frame24DrawSprite(0)2526// Nope, no animation needed here!27break2829case EGGMAN_CONTROL30// Similarly to above, just draw his Controlling Frame here31DrawSprite(1)3233// No animation needed here, either!34break3536case EGGMAN_DAMAGED3738// Get the Sprite to use39TempValue0 = Object.Frame40TempValue0 >>= 341TempValue0 += 24243DrawSprite(TempValue0)4445// Animate Robotnik46Object.Frame++47Object.Frame &= 154849// Draw his floating Sweat Frame if needed50if Object.Timer < 451TempValue0 += 852DrawSprite(TempValue0)53end if5455Object.Timer++56Object.Timer &= 757break5859case EGGMAN_PANICK_JUMP6061// Get the Frame Robotnik should use62TempValue0 = Object.Frame63TempValue0 &= 1564TempValue0 >>= 36566// Sprite Frame ID Offset of 467TempValue0 += 46869DrawSprite(TempValue0)7071// Animate the Object72Object.Frame++7374// And then draw the Sweat Frame, but onlly if needed75if Object.Timer < 476TempValue0 += 677DrawSprite(TempValue0)78end if7980// Animate Robotnik, along with his Sweat81Object.Timer++82Object.Timer &= 78384if Object.Frame == 4885// Stop jumping for a moment and go back to looking normal8687Object.Timer = 088Object.Frame = 089Object.State = EGGMAN_PANICK_IDLE90end if91break9293case EGGMAN_PANICK_IDLE94// Draw the normal Idle Frame95DrawSprite(0)9697if Object.Timer < 2098Object.Timer++99else100// Go back to jumping around101102Object.Timer = 0103Object.State = EGGMAN_PANICK_JUMP104end if105break106107case EGGMAN_PANICK_CONTROL108// Due to an oversight, this state isn't seen very much109// (Once this state goes to EGGMAN_PANICK_JUMP, it goes back to EGGMAN_PANICK_IDLE afterwards instead of here)110// (And that is, this state is only entered in the first place if Robotnik's doing his Control pose when he enters his damage dance)111112// Draw his normal Control Frame113DrawSprite(1)114115// Update animation116if Object.Timer < 20117Object.Timer++118else119Object.Timer = 0120Object.Frame = 0121Object.State = EGGMAN_PANICK_JUMP122end if123break124125case EGGMAN_FLEE126127// Draw the main Robotnik Running Sprite128TempValue0 = Object.Frame129TempValue0 /= 6130TempValue0 += 6131DrawSprite(TempValue0)132133// Robotnik should be continuously animating here, his legs gotta keep moving!134Object.Frame++135Object.Frame %= 24136137// Get the Sweat Frame Sprite ID to use138TempValue0 = Object.Timer139TempValue0 /= 6140TempValue0 += 12141142// And then see if the Frame should even be drawn at all143TempValue1 = Object.Timer144TempValue1 %= 6145if TempValue1 < 3146// Flip the sprite around, so that it appears behind Robotnik147Object.Direction = FACING_LEFT148149DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)150151// And then restore normal Object Direction152// -> This doesn't matter anyway though, as no other parts of this Object use Object.Direction in any way153Object.Direction = FACING_RIGHT154end if155156Object.Timer++157Object.Timer %= 12158159// Object movement in the ObjectDraw sub... I can't say I'm in support of this...160// Regardless, move at a rate of 1px per frame161Object.XPos += 0x10000162163// Unload when no longer needed164if Object.OutOfBounds == true165ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)166end if167break168169end switch170171end sub172173174sub ObjectStartup175LoadSpriteSheet("R5/Objects2.gif")176177// Idle Frame178SpriteFrame(-24, -24, 40, 56, 174, 181)179180// Controlling Frame181SpriteFrame(-24, -24, 40, 56, 215, 181)182183// Shock Frames184// (Used when the machine is initially falling to start the fight)185SpriteFrame(-24, -24, 48, 48, 158, 18)186SpriteFrame(-24, -24, 48, 48, 207, 18)187188// Panick Frames189// (Used whenever Robotnik's fumbling around on hot ground)190SpriteFrame(-24, -24, 48, 56, 158, 67)191SpriteFrame(-24, -24, 48, 56, 207, 67)192193// Run Frames194SpriteFrame(-32, -25, 64, 48, 66, 138)195SpriteFrame(-32, -23, 48, 56, 150, 124)196SpriteFrame(-32, -21, 56, 56, 199, 124) // huh? what happened to his mustache here..?197SpriteFrame(-32, -23, 48, 56, 150, 124)198199// Damage - Sweat Frames200SpriteFrame(-24, -40, 48, 16, 158, 1)201SpriteFrame(-24, -40, 48, 16, 207, 1)202203// Panick - Sweat frames204SpriteFrame(-20, -40, 0, 0, 158, 1)205SpriteFrame(-20, -40, 48, 16, 158, 1)206SpriteFrame(-20, -40, 48, 16, 207, 1)207208end sub209210211// ========================212// Editor Subs213// ========================214215sub RSDKDraw216DrawSprite(0)217end sub218219220sub RSDKLoad221LoadSpriteSheet("R5/Objects2.gif")222SpriteFrame(-24, -24, 40, 56, 215, 181)223224SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")225end sub226227228