Path: blob/main/Scripts/R6/EggmanMobile.txt
1319 views
//----------------Sonic CD Eggman Mobile Script---------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.TargetYPos7#alias Object.Value2 : Object.YVelocity8#alias Object.Value3 : Object.ThrusterAnimation9#alias Object.Value4 : Object.FrameTimer10#alias Object.Value5 : Object.SpikesAnimation11#alias Object.Value6 : Object.EggmanAnimation12#alias Object.Value7 : Object.FaceFrame // Indirectly atleast13#alias Object.PropertyValue : Object.FaceTimer14#alias Object.Scale : Object.TriggerElecArc1516// FloorControl aliases17#alias Object[+1].State : FloorControl.State18#alias Object[+1].Value0 : FloorControl.Timer19#alias Object[+1].Type : FloorControl.Type2021// Boss Barrier 2 alias22#alias Object[-1].State : BossBarrier2.State2324// Fade Screen aliases25#alias Object.Value1 : FadeScreen.EggMobileEntityNo2627// Steam Cloud aliases28#alias Object.YPos : SteamCloud.YPos29#alias Object.Value1 : SteamCloud.XVelocity30#alias Object.Value2 : SteamCloud.YVelocity3132// States33#alias 0 : R6_EGG_IDLE34#alias 1 : R6_EGG_START35#alias 2 : R6_EGG_INTRO36#alias 3 : R6_EGG_SET_ROUTE_137#alias 4 : R6_EGG_ASCEND_138#alias 5 : R6_EGG_SET_ROUTE_239#alias 6 : R6_EGG_ASCEND_240#alias 7 : R6_EGG_SET_ROUTE_341#alias 8 : R6_EGG_ASCEND_342#alias 9 : R6_EGG_ROOF_DRILL43#alias 10 : R6_EGG_DESTROYED44#alias 11 : R6_EGG_PANICKING45#alias 12 : R6_EGG_ESCAPE4647// FloorControl States48#alias 0 : FLOORCONTROL_INACTIVE49#alias 1 : FLOORCONTROL_SETUP_CRUMBLE50#alias 3 : FLOORCONTROL_ELEC_ARC51#alias 4 : FLOORCONTROL_TILE_SWAP5253// Boss Barrier States54#alias 2 : BOSSBARRIER2_OPEN5556// Eggman Animations57#alias 0 : EGGANI_IDLE58#alias 1 : EGGANI_HURT59#alias 2 : EGGANI_DEFEAT60#alias 3 : EGGANI_PANIC6162// Global SFX63#alias 22 : SFX_G_EXPLOSION6465// Stage SFX66#alias 10 : SFX_S_BUZZSAW67#alias 11 : SFX_S_BOSSHIT6869// Function declarations70#function R6_EGG_DESCEND71#function R6_EGG_MOVE72#function R6_EGG_ROUTE_1ST_FLOOR73#function R6_EGG_ROUTE_2ST_FLOOR74#function R6_EGG_STEAM757677function R6_EGG_DESCEND78Object.YPos += Object.YVelocity79Object.YVelocity -= 25680if Object.YPos >= Object.TargetYPos81Object.YPos = Object.TargetYPos82Object.YVelocity = 08384Object.ThrusterAnimation = 085Object.FrameTimer = 08687Object.State++88end if89end function909192function R6_EGG_MOVE93Object.YPos += Object.YVelocity94Object.YVelocity -= 0x100095if Object.YPos <= Object.TargetYPos96Object.YPos = Object.TargetYPos97Object.YVelocity = 09899Object.ThrusterAnimation = 0100Object.FrameTimer = 0101Object.SpikesAnimation = 0102103Object.AnimationTimer = 0104Object.AnimationSpeed = 0105106Object.State++107end if108end function109110111function R6_EGG_ROUTE_1ST_FLOOR112TempValue0 = Object.YPos113TempValue0 += 0x780000114115if Player.YPos < TempValue0116if FloorControl.State < FLOORCONTROL_TILE_SWAP117FloorControl.State = FLOORCONTROL_INACTIVE118FloorControl.Timer = 0119if Object.FaceTimer > 0120Object.Timer = 1200121end if122else123if FloorControl.Timer > 270124FloorControl.State = FLOORCONTROL_INACTIVE125FloorControl.Timer = 0126else127Object.Timer &= 511128end if129end if130131if Object.Timer < 1200132if Object.Timer == 0133Object.SpikesAnimation = 1134PlayStageSfx(SFX_S_BUZZSAW, false)135end if136137Object.Timer += 4138TempValue0 = Object.Timer139TempValue0 &= 511140Sin(Object.YPos, TempValue0)141Object.YPos <<= 9142Object.YPos += Object.TargetYPos143else144Object.Timer = 0145Object.YVelocity = -0x10000146147Object.ThrusterAnimation = 1148Object.FrameTimer = 0149150FloorControl.State = FLOORCONTROL_SETUP_CRUMBLE151Object.State++152end if153end if154end function155156157function R6_EGG_ROUTE_2ST_FLOOR158TempValue0 = Object.YPos159TempValue0 += 0x780000160161if Player.YPos < TempValue0162Object.TriggerElecArc = true163if FloorControl.State < FLOORCONTROL_TILE_SWAP164FloorControl.State = FLOORCONTROL_INACTIVE165FloorControl.Timer = 0166if Object.FaceTimer > 0167Object.Timer = 1200168end if169else170if FloorControl.Timer > 270171FloorControl.State = FLOORCONTROL_INACTIVE172FloorControl.Timer = 0173else174Object.Timer &= 511175end if176end if177178if Object.Timer < 1200179if Object.Timer == 0180Object.SpikesAnimation = 1181PlayStageSfx(SFX_S_BUZZSAW, false)182end if183184Object.Timer += 4185TempValue0 = Object.Timer186TempValue0 &= 511187Sin(Object.YPos, TempValue0)188Object.YPos <<= 9189Object.YPos += Object.TargetYPos190else191Object.Timer = 0192Object.YVelocity = -0x10000193194Object.ThrusterAnimation = 1195Object.FrameTimer = 0196197FloorControl.State = FLOORCONTROL_SETUP_CRUMBLE198199Object.TriggerElecArc = false200Object.State++201end if202else203204if Object.OutOfBounds == true205Object.SpikesAnimation = 0206Object.AnimationTimer = 0207Object.AnimationSpeed = 0208end if209210if FloorControl.State < FLOORCONTROL_ELEC_ARC211if Object.TriggerElecArc == true212FloorControl.State = FLOORCONTROL_ELEC_ARC213FloorControl.Timer = 0214end if215end if216end if217end function218219220function R6_EGG_STEAM221if Object.AnimationTimer == 0222PlaySfx(SFX_G_EXPLOSION, false)223end if224225if Object.AnimationTimer < 12226CreateTempObject(TypeName[Steam Cloud], 0, Object.XPos, Object.YPos)227228SteamCloud[TempObjectPos].YPos -= 0x480000229230Rand(SteamCloud[TempObjectPos].XVelocity, 0x200)231SteamCloud[TempObjectPos].XVelocity -= 0x100232SteamCloud[TempObjectPos].XVelocity <<= 10233234Rand(SteamCloud[TempObjectPos].YVelocity, 0x100)235SteamCloud[TempObjectPos].YVelocity *= -0x400236end if237end function238239240sub ObjectMain241switch Object.State242case R6_EGG_IDLE243if Player.XPos > Object.XPos244Object.State++245Object.TriggerElecArc = false246end if247break248249case R6_EGG_START250Object.Timer++251if Object.Timer == 120252Object.Timer = 0253254Object.YVelocity = 0x30000255Object.TargetYPos = 0x6200000256257Object.ThrusterAnimation = 1258Object.FrameTimer = 0259260Object.State++261end if262break263264case R6_EGG_INTRO265CallFunction(R6_EGG_DESCEND)266break267268case R6_EGG_SET_ROUTE_1269CallFunction(R6_EGG_ROUTE_1ST_FLOOR)270if Object.State > R6_EGG_SET_ROUTE_1271Object.TargetYPos = 0x4280000272end if273break274275case R6_EGG_ASCEND_1276CallFunction(R6_EGG_MOVE)277break278279case R6_EGG_SET_ROUTE_2280CallFunction(R6_EGG_ROUTE_2ST_FLOOR)281if Object.State > R6_EGG_SET_ROUTE_2282Object.TargetYPos = 0x2280000283end if284break285286case R6_EGG_ASCEND_2287CallFunction(R6_EGG_MOVE)288break289290case R6_EGG_SET_ROUTE_3291CallFunction(R6_EGG_ROUTE_2ST_FLOOR)292if Object.State > R6_EGG_SET_ROUTE_3293Object.TargetYPos = 0x1300000294end if295break296297case R6_EGG_ASCEND_3298CallFunction(R6_EGG_MOVE)299break300301case R6_EGG_ROOF_DRILL302if Object.Timer == 0303Object.XPos += 0x20000304else305Object.XPos -= 0x20000306end if307Object.Timer++308Object.Timer &= 1309break310311case R6_EGG_DESTROYED312Object.YPos += Object.YVelocity313Object.YVelocity += 0x1000314315Player.Speed = 0316317if Object.Timer == 0318Object.XPos += 0x20000319else320Object.XPos -= 0x20000321end if322Object.Timer++323Object.Timer &= 1324325if Object.YPos >= 0x2A00000326Object.YPos = 0x2A00000327Object.Timer = 0328Object.YVelocity = 0329330Object.EggmanAnimation = EGGANI_PANIC331332SetTileLayerEntry(500, 0, 20, 5)333SetTileLayerEntry(501, 0, 21, 5)334SetTileLayerEntry(506, 0, 22, 5)335336Object.State++337end if338339if Player.XPos > Object.TargetYPos340Player.XPos = Object.TargetYPos341Player.XPos += 0x500000342else343Player.XPos = Object.TargetYPos344Player.XPos -= 0x500000345end if346347CallFunction(R6_EGG_STEAM)348break349350case R6_EGG_PANICKING351Player.Speed = 0352if Player.XPos > Object.XPos353Player.XPos = Object.XPos354Player.XPos += 0x500000355else356Player.XPos = Object.XPos357Player.XPos -= 0x500000358end if359360CallFunction(R6_EGG_STEAM)361Object.Timer++362363if Object.Timer == 180364BossBarrier2.State = BOSSBARRIER2_OPEN365end if366367if Object.Timer == 240368Object.State++369Object.SpikesAnimation = 3370CreateTempObject(TypeName[Fade Screen], 0, Object.XPos, Object.YPos)371FadeScreen[TempObjectPos].EggMobileEntityNo = Object.EntityNo372end if373break374375case R6_EGG_ESCAPE376Player.Speed = 0377if Player.XPos > Object.XPos378Player.XPos = Object.XPos379Player.XPos += 0x500000380else381Player.XPos = Object.XPos382Player.XPos -= 0x500000383end if384break385386end switch387end sub388389390sub ObjectPlayerInteraction391PlayerObjectCollision(C_TOUCH, -22, 40, 22, 64)392if CheckResult == true393CallFunction(Player_Hit)394end if395396if Player.Animation != ANI_HURT397if Object.FaceTimer == 0398#platform: Use_Standalone399PlayerObjectCollision(C_TOUCH, -64, -48, 64, 16)400TempValue0 = CheckResult401PlayerObjectCollision(C_TOUCH, -32, 16, 32, 32)402TempValue0 |= CheckResult403#endplatform404#platform: Use_Origins405PlayerObjectCollision(C_ENEMY, -64, -48, 64, 16)406TempValue0 = CheckResult407PlayerObjectCollision(C_ENEMY, -32, 16, 32, 32)408TempValue0 |= CheckResult409#endplatform410if TempValue0 == true411TempValue0 = false412if Player.Animation == ANI_JUMPING413TempValue0 = true414end if415#platform: Use_Origins416if Stage.PlayerListPos == PLAYER_AMY417if Player.Animation == ANI_HAMMER_JUMP418TempValue0 = true419end if420if Player.Animation == ANI_HAMMER_DASH421TempValue0 = true422end if423end if424if Stage.PlayerListPos == PLAYER_KNUCKLES425if Player.Animation == ANI_GLIDING426TempValue0 = true427end if428if Player.Animation == ANI_GLIDING_STOP429TempValue0 = true430end if431end if432#endplatform433434if TempValue0 == true435#platform: Use_Haptics436HapticEffect(75, 0, 0, 0)437#endplatform438Object.FaceTimer = 120439440FlipSign(Player.Speed)441Player.Speed >>= 1442443FlipSign(Player.YVelocity)444Player.YVelocity >>= 1445Player.XVelocity = Player.Speed446447if Object.State < R6_EGG_ROOF_DRILL448PlayStageSfx(SFX_S_BOSSHIT, false)449Object.EggmanAnimation = EGGANI_HURT450Object.Frame = 0451else452453#platform: Use_Origins454EngineCallback(NOTIFY_KILL_BOSS)455// Tell HE2 that the boss fight ended456game.callbackParam0 = true457EngineCallback(NOTIFY_BOSS_END)458if game.playMode == BOOT_PLAYMODE_BOSSRUSH459StopMusic()460end if461#endplatform462463Object.State = R6_EGG_DESTROYED464465Object.SpikesAnimation = 2466Object.AnimationTimer = 0467Object.EggmanAnimation = EGGANI_DEFEAT468Object.FaceFrame = 0469Object.Frame = 0470471Object.TargetYPos = Object.XPos472473FloorControl.Type = TypeName[Blank Object]474475Copy16x16Tile(810, 863)476477PlaySfx(SFX_G_EXPLOSION, false)478end if479else480CallFunction(Player_Hit)481end if482end if483end if484end if485end sub486487488sub ObjectDraw489DrawSprite(0)490491switch Object.EggmanAnimation492case EGGANI_IDLE493TempValue0 = Object.FaceFrame494TempValue0 /= 10495TempValue0 += 2496497Object.FaceFrame++498Object.FaceFrame %= 20499500Object.Direction = Object.Frame501Object.Direction /= 25502503Object.Frame++504Object.Frame %= 50505DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)506break507508case EGGANI_HURT509Object.Direction = Object.Frame510Object.Direction /= 10511Object.Frame++512Object.Frame %= 20513DrawSpriteFX(4, FX_FLIP, Object.XPos, Object.YPos)514if Object.FaceTimer > 0515Object.FaceTimer--516else517Object.EggmanAnimation = EGGANI_IDLE518Object.FaceFrame = 0519Object.Frame = 0520end if521break522523case EGGANI_DEFEAT524DrawSprite(5)525break526527case EGGANI_PANIC528Object.Direction = Object.Frame529Object.Direction /= 25530531Object.Frame++532Object.Frame %= 50533DrawSpriteFX(6, FX_FLIP, Object.XPos, Object.YPos)534break535536end switch537538switch Object.SpikesAnimation539case 0540DrawSprite(7)541break542543case 1544TempValue0 = Object.AnimationTimer545TempValue0 >>= 7546TempValue0 += 7547DrawSprite(TempValue0)548549Object.AnimationTimer += Object.AnimationSpeed550Object.AnimationTimer &= 511551552if Object.AnimationSpeed < 128553Object.AnimationSpeed++554end if555break556557case 2558TempValue0 = Object.AnimationTimer559TempValue0 /= 3560if TempValue0 < 4561TempValue0 += 11562DrawSprite(TempValue0)563end if564Object.AnimationTimer++565Object.AnimationTimer %= 30566break567568end switch569570switch Object.ThrusterAnimation571case 0572TempValue0 = Object.FrameTimer573TempValue0 >>= 1574TempValue0 += 19575DrawSprite(TempValue0)576Object.FrameTimer++577Object.FrameTimer &= 3578break579580case 1581TempValue0 = Object.FrameTimer582TempValue0 /= 3583TempValue0 += 15584DrawSprite(TempValue0)585Object.FrameTimer++586Object.FrameTimer %= 12587break588589end switch590end sub591592593sub ObjectStartup594LoadSpriteSheet("R6/Objects2.gif")595// Egg Razor596SpriteFrame(-64, -48, 128, 96, 66, 1) // #0 - Egg Razor Machine597SpriteFrame(-64, -16, 128, 32, 66, 98) // #1 - Egg Razor Destroyed598599// Eggman600SpriteFrame(-24, -21, 48, 24, 116, 131) // #2 - Eggman Idle Frame 0601SpriteFrame(-24, -21, 48, 24, 116, 156) // #3 - Eggman Idle Frame 1602SpriteFrame(-24, -21, 48, 24, 116, 181) // #4 - Eggman Hurt603SpriteFrame(-28, -37, 48, 40, 124, 215) // #5 - Eggman Defeat604SpriteFrame(-24, -29, 48, 32, 1, 219) // #6 - Eggman Worry605606// Egg Razor Spikes607SpriteFrame(-16, -80, 32, 32, 195, 1) // #7 - Spikes Frame 0608SpriteFrame(-16, -80, 32, 32, 195, 34) // #8 - Spikes Frame 1609SpriteFrame(-16, -80, 32, 32, 195, 67) // #9 - Spikes Frame 2610SpriteFrame(-16, -80, 32, 32, 195, 100) // #10 - Spikes Frame 3611612// Egg Razor Steam613SpriteFrame(-12, -80, 24, 32, 228, 51) // #11 - Steam Frame 0614SpriteFrame(-12, -80, 24, 32, 228, 84) // #12 - Steam Frame 1615SpriteFrame(-12, -80, 24, 32, 231, 117) // #13 - Steam Frame 2616SpriteFrame(-12, -80, 24, 32, 231, 150) // #14 - Steam Frame 3617618// Egg Razor Thruster619SpriteFrame(-16, 48, 32, 32, 198, 133) // #15 - Thruster Frame 0620SpriteFrame(-16, 48, 32, 24, 206, 199) // #16 - Thruster Frame 1621SpriteFrame(-16, 48, 32, 32, 198, 166) // #17 - Thruster Frame 2622SpriteFrame(-16, 48, 32, 24, 206, 224) // #18 - Thruster Frame 3623SpriteFrame(-16, 48, 32, 24, 206, 199) // #19 - Thruster Frame 4624SpriteFrame(-16, 48, 32, 24, 206, 224) // #20 - Thruster Frame 5625end sub626627628// ========================629// Editor Subs630// ========================631632sub RSDKDraw633DrawSprite(0)634DrawSprite(1)635DrawSprite(2)636end sub637638639sub RSDKLoad640LoadSpriteSheet("R6/Objects2.gif")641// Egg Razor642SpriteFrame(-64, -48, 128, 96, 66, 1) // #0 - Egg Razor Machine643// Eggman644SpriteFrame(-24, -21, 48, 24, 116, 131) // #2 - Eggman Idle Frame 0645// Egg Razor Spikes646SpriteFrame(-16, -80, 32, 32, 195, 1) // #7 - Spikes Frame 0647648SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")649end sub650651652