Path: blob/main/Scripts/R5/BombCarrier.txt
1319 views
//----------------Sonic CD Bomb Carrier Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// ========================5// Aliases6// ========================78#alias Object.Value0 : Object.Timer9#alias Object.Value1 : Object.Angle1011// States12#alias 0 : BOMBCARRIER_IDLE13#alias 1 : BOMBCARRIER_WAITFORBOSSFIGHT14#alias 2 : BOMBCARRIER_GRABBOMB15#alias 3 : BOMBCARRIER_SLIDERIGHT16#alias 4 : BOMBCARRIER_SLIDELEFT17#alias 5 : BOMBCARRIER_RELEASEBOMB18#alias 6 : BOMBCARRIER_HOVER1920// Boss Platform Aliases21#alias Object.Value5 : Object.Grind2223#alias 8 : BOSSPLATFORM_FALL_424#alias 9 : BOSSPLATFORM_FIGHT_42526// Eggman Aliases27#alias 0 : EGGMAN_IDLE28#alias 1 : EGGMAN_CONTROL29#alias 5 : EGGMAN_PANICK_CONTROL30#alias 6 : EGGMAN_FLEE3132// Boss Bomb Aliases33#alias 1 : BOSSBOMB_ACTIVE3435// Stage SFX Aliases36#alias 5 : SFX_S_BOMBCARRIER3738// Fade Music Aliases39#alias 0 : FADEMUSIC_TO_BOSS404142// ========================43// Events44// ========================4546sub ObjectMain47switch Object.State48case BOMBCARRIER_IDLE49TempValue0 = Object.XPos50TempValue0 += 0x2000005152// See if the Player's past 32 pixels away from this Bomb Carrier Object53if Player.XPos > TempValue054CreateTempObject(TypeName[Fade Music], FADEMUSIC_TO_BOSS, 0, 0)55Object.State = BOMBCARRIER_WAITFORBOSSFIGHT56end if57break5859case BOMBCARRIER_GRABBOMB60if Object[+3].State < EGGMAN_FLEE61if Object.Timer < 18062Object.Timer++63else64Object.State = BOMBCARRIER_SLIDELEFT65PlayStageSfx(SFX_S_BOMBCARRIER, false)6667if Object[+4].State < BOSSPLATFORM_FALL_468// If the Boss Platform is still in its main phase, then make Robotnik resume his control animation6970Object[+3].State = EGGMAN_CONTROL71else72// If the Boss Platform is just about to die, then make Robotnik worried for himself too7374Object[+3].State = EGGMAN_PANICK_CONTROL75Object[+3].Timer = 076Object[+3].Frame = 077end if78end if79else80// Robotnik's Fleeing, so Unload this Object as well8182ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)83end if84break8586case BOMBCARRIER_SLIDERIGHT87if Object.XPos < Object[+1].XPos88// If we haven't reached the Boss Top yet, then keep on moving8990Object.XPos += 0x1E00091else92Object.State = BOMBCARRIER_GRABBOMB93Object.XPos = Object[+1].XPos94Object.Timer = 09596if Object[+4].State > BOSSPLATFORM_FALL_49798// If the Boss Platform is XXX99if Object[+4].State > BOSSPLATFORM_FIGHT_4100ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)101end if102103// If the Boss Platform is past a specific Grind point, then also unload104if Object[+4].Grind > 640105ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)106end if107108end if109end if110break111112case BOMBCARRIER_SLIDELEFT113// If this Object is further to the right than the Player, then...114if Object.XPos > Player.XPos115116// Move the Carrier left by 0.75 pixels117Object.XPos -= 0xC000118119// Has this Object past the Player now?120if Object.XPos <= Player.XPos121// If it did, then start releasig the Bomb122123Object.State = BOMBCARRIER_RELEASEBOMB124125// Match the Player's Position126Object.XPos = Player.XPos127128// if the Boss Platform XXX, then make Robotnik go back to his Idle State129if Object[+4].State < BOSSPLATFORM_FALL_4130Object[+3].State = EGGMAN_IDLE131end if132133Object.Timer = 0134end if135else136// No need to move left anymore, start relasing the Bomb137Object.State = BOMBCARRIER_RELEASEBOMB138Object.XPos = Player.XPos139140// Put Robotnik in his normal pose, he doesn't need to be pushing the lever anymore either141Object[+3].State = EGGMAN_IDLE142143Object.Timer = 0144end if145146TempValue0 = Object[+1].XPos147TempValue0 -= 0x300000148149if Object.XPos > TempValue0150151// If the Bomb Carrier is still within 48 pixels left of the Boss Top's Position,152// then keep the Bomb steady153Object.Angle = 384154155else156// Increase the Bomb's Angle157158Object.Angle += 8159Object.Angle &= 511160end if161162// Make the Bomb move with the Bomb Carrier163Object[-1].XPos = Object.XPos164165// Make the Bomb bounce a bit166Sin(Object[-1].YPos, Object.Angle)167Object[-1].YPos <<= 9168169// Bump it to 28 pixels beyond this Object's Y Position170Object[-1].YPos += Object.YPos171Object[-1].YPos += 0x1C0000172break173174case BOMBCARRIER_RELEASEBOMB175if Object.Timer < 30176// Hold for half a second177Object.Timer++178else179// Go to the post-bomb-release pause state180Object.State = BOMBCARRIER_HOVER181Object.Timer = 0182183// And actually release the Bomb184Object[-1].State = BOSSBOMB_ACTIVE185end if186187// Increase the Bomb's hover angle188Object.Angle += 8189Object.Angle &= 511190191// And then actually make the Bomb hover192Sin(Object[-1].YPos, Object.Angle)193Object[-1].YPos <<= 9194195// Make it 28 pixels below this Bomb Carrier Object196Object[-1].YPos += Object.YPos197Object[-1].YPos += 0x1C0000198break199200case BOMBCARRIER_HOVER201if Object.Timer < 90202// Pause for a second and a half203Object.Timer++204else205// Job complete, returning to HQ!206Object.State = BOMBCARRIER_SLIDERIGHT207end if208break209210end switch211end sub212213214sub ObjectDraw215switch Object.State216case BOMBCARRIER_IDLE217case BOMBCARRIER_WAITFORBOSSFIGHT218case BOMBCARRIER_GRABBOMB219case BOMBCARRIER_SLIDERIGHT220case BOMBCARRIER_HOVER221// The Carrier isn't holding a Bomb, so draw the inactive Frame222DrawSprite(0)223break224225case BOMBCARRIER_SLIDELEFT226case BOMBCARRIER_RELEASEBOMB227// The Carrier is holding a Bomb, so draw the active version of the Frame228DrawSprite(1)229230// And then draw the Gravitional Force Pull thing231TempValue0 = Object.Frame232TempValue0 >>= 2233TempValue0 += 2234235DrawSprite(TempValue0)236237Object.Frame++238Object.Frame &= 7239break240241end switch242end sub243244245sub ObjectStartup246LoadSpriteSheet("R5/Objects2.gif")247248// Main Carrier Frame249SpriteFrame(-16, -12, 32, 24, 33, 215)250251// Active Carrier Frame252SpriteFrame(-16, -12, 32, 24, 100, 113)253254// Levitation Effect Frames255SpriteFrame(-16, 12, 32, 16, 33, 239)256SpriteFrame(-16, 12, 32, 16, 1, 239)257end sub258259260// ========================261// Editor Subs262// ========================263264sub RSDKDraw265DrawSprite(0)266end sub267268269sub RSDKLoad270LoadSpriteSheet("R5/Objects2.gif")271SpriteFrame(-16, -12, 32, 24, 33, 215)272273SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")274end sub275276277