Path: blob/main/Scripts/Mission/SignPostM094.txt
1319 views
//---------------Sonic CD SignPost M094 Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//3//-----------Used on Mission "M094 - Tough Bluff"-------------//45// Aliases6#alias Object.Value0 : Object.Timer7#alias Object.Value1 : Object.FrameTimer89// Player Aliases10#alias Player.Value4 : Player.InvincibleTimer1112// ActFinish Aliases13#alias Object[30].DrawOrder : ActFinish.DrawOrder14#alias Object[30].Priority : ActFinish.Priority1516// States17#alias 0 : SIGNPOSTM094_IDLE18#alias 1 : SIGNPOSTM094_FLIP19#alias 2 : SIGNPOSTM094_MOVE_PLAYER20#alias 3 : SIGNPOSTM094_STOP_PLAYER21#alias 4 : SIGNPOSTM094_BLANK2223// Control Mode24#alias -1 : CONTROLMODE_NONE2526// Global SFX27#alias 15 : SFX_G_SIGNPOST2829// Priority30#alias 1 : PRIORITY_ACTIVE31#alias 3 : PRIORITY_XBOUNDS323334sub ObjectMain35switch Object.State36case SIGNPOSTM094_IDLE37Object.Frame = 13839TempValue0 = Object.YPos40TempValue0 += 0x60000041if Player.YPos < TempValue0 // Makes sure the player triggers the signpost no matter the height42if Player.XPos > Object.XPos43Stage.NewXBoundary1 = Object.XPos44Stage.NewXBoundary1 >>= 1645Stage.NewXBoundary1 -= Screen.CenterX46Stage.NewXBoundary2 = Object.XPos47Stage.NewXBoundary2 >>= 1648Stage.NewXBoundary2 += Screen.CenterX4950EngineCallback(NOTIFY_TOUCH_SIGNPOST)5152Stage.TimeEnabled = false53Object.State = SIGNPOSTM094_FLIP54Object.Timer = 85556PlaySfx(SFX_G_SIGNPOST, false)57end if58end if59break6061case SIGNPOSTM094_FLIP62Music.Volume--63Object.FrameTimer++64if Object.FrameTimer == 26566Object.FrameTimer = 067Object.Frame++68if Object.Frame == 569// Spawn a ring sparkle at random location close to the sign post70Rand(TempValue0, 48)71TempValue0 <<= 1672TempValue0 += Object.XPos73TempValue0 -= 0x1800007475Rand(TempValue1, 32)76TempValue1 <<= 1677TempValue1 += Object.YPos78TempValue1 -= 0x1C000079CreateTempObject(TypeName[Ring Sparkle], 0, TempValue0, TempValue1)8081Object.Timer--82if Object.Timer == 08384if Object[0].Type == TypeName[Blank Object] // Check if the player already leave by itself8586Object.State = SIGNPOSTM094_BLANK8788PlayMusic(1)8990Object[30].Type = TypeName[ActFinish]91ActFinish.DrawOrder = 692ActFinish.Priority = PRIORITY_ACTIVE93else // Otherwise the signpost will do it itself.94Player.ControlMode = CONTROLMODE_NONE95Player.Up = false96Player.Down = false97Player.Left = false98Player.JumpPress = false99Player.JumpHold = false100Object.State = SIGNPOSTM094_MOVE_PLAYER101end if102103end if104105end if106107if Object.Frame == 9108// Spawn a ring sparkle at random location close to the sign post109Rand(TempValue0, 48)110TempValue0 <<= 16111TempValue0 += Object.XPos112TempValue0 -= 0x180000113114Rand(TempValue1, 32)115TempValue1 <<= 16116TempValue1 += Object.YPos117TempValue1 -= 0x1C0000118CreateTempObject(TypeName[Ring Sparkle], 0, TempValue0, TempValue1)119// Resets the animation cycle120Object.Frame = 1121end if122123end if124// Freezes the player after leaving the screen125TempValue0 = 40126TempValue0 += Screen.CenterX127TempValue0 <<= 16128TempValue0 += Object.XPos129if Player.XPos > TempValue0130Player.XPos = TempValue0131Player.Speed = 0132Player.XVelocity = 0133end if134break135136case SIGNPOSTM094_MOVE_PLAYER137if Object[0].Type == TypeName[Blank Object]138Object.State = SIGNPOSTM094_BLANK139if Object.OutOfBounds == false140PlayMusic(1)141end if142Object[30].Type = TypeName[ActFinish]143ActFinish.DrawOrder = 6144ActFinish.Priority = PRIORITY_ACTIVE145end if146147if Player.ControlMode == CONTROLMODE_NONE148Player.Right = true149end if150151TempValue0 = Screen.CenterX152TempValue0 <<= 16153TempValue0 += Object.XPos154155if Player.XPos > TempValue0156if Object.OutOfBounds == false157PlayMusic(1)158end if159Object.State = SIGNPOSTM094_STOP_PLAYER160Object[30].Type = TypeName[ActFinish]161ActFinish.DrawOrder = 6162ActFinish.Priority = PRIORITY_ACTIVE163end if164break165166case SIGNPOSTM094_STOP_PLAYER167if Player.ControlMode == CONTROLMODE_NONE168Player.Right = true169end if170TempValue0 = 40171TempValue0 += Screen.CenterX172TempValue0 <<= 16173TempValue0 += Object.XPos174if Player.XPos > TempValue0175Player.XPos = TempValue0176Player.Speed = 0177Player.XVelocity = 0178end if179break180end switch181182if Object.State > SIGNPOSTM094_IDLE183Player.InvincibleTimer = 80184end if185end sub186187188sub ObjectDraw189DrawSprite(0)190DrawSprite(Object.Frame)191end sub192193194sub ObjectStartup195if Stage.PlayerListPos == PLAYER_SONIC196LoadSpriteSheet("Global/Items2.gif")197end if198if Stage.PlayerListPos == PLAYER_TAILS199LoadSpriteSheet("Global/Items2_t.gif")200end if201if Stage.PlayerListPos == PLAYER_KNUCKLES202LoadSpriteSheet("Global/Items2_K.gif")203end if204if Stage.PlayerListPos == PLAYER_AMY205LoadSpriteSheet("Global/Items2_A.gif")206end if207208SpriteFrame(-12, -12, 24, 24, 0, 150) // #0 - Sign Post209SpriteFrame(-24, -44, 48, 32, 34, 99) // #1 - Sign Post Head (Eggman)210SpriteFrame(-16, -44, 32, 32, 1, 183) // #2 - Sign Post Head (Flip 1)211SpriteFrame(-4, -44, 8, 32, 25, 150) // #3 - Sign Post Head (Flip 2)212SpriteFrame(-16, -44, 32, 32, 1, 216) // #4 - Sign Post Head (Flip 3)213SpriteFrame(-24, -44, 48, 32, 34, 132) // #5 - Sign Post Head (Player)214SpriteFrame(-16, -44, 32, 32, 1, 183) // #6 - Sign Post Head (Flip 1)215SpriteFrame(-4, -44, 8, 32, 25, 150) // #7 - Sign Post Head (Flip 2)216SpriteFrame(-16, -44, 32, 32, 1, 216) // #8 - Sign Post Head (Flip 3)217218ArrayPos0 = 32219while ArrayPos0 < 1056220if Object[ArrayPos0].Type == TypeName[SignPostM094]221Object[ArrayPos0].Priority = PRIORITY_XBOUNDS222end if223ArrayPos0++224loop225end sub226227228// ========================229// Editor Subs230// ========================231232233sub RSDKDraw234DrawSprite(0)235DrawSprite(1)236end sub237238239sub RSDKLoad240LoadSpriteSheet("Global/Items2.gif")241SpriteFrame(-12, -12, 24, 24, 0, 150) // #0 - Sign Post242SpriteFrame(-24, -44, 48, 32, 34, 99) // #1 - Sign Post Head (Eggman)243244// TODO: prob val is differnt every time it's used though, does that mean anything?245// (254 in extreme ssz, 255 in m094)246SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")247end sub248249250251252253254