Path: blob/main/Scripts/Mission/SignPost2.txt
1319 views
//----------------Sonic CD SignPost 2 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.FrameTimer7#alias Object.Value2 : Object.SignPostBound89// Player Aliases10#alias Player.Value4 : Player.InvincibleTimer1112// ActFinish Aliases13#alias Object[30].DrawOrder : ActFinish.DrawOrder14#alias Object[30].Priority : ActFinish.Priority1516// States17#alias 0 : SIGNPOST2_CHECK_BOUNDS18#alias 1 : SIGNPOST2_FLIP19#alias 2 : SIGNPOST2_MOVE_PLAYER20#alias 3 : SIGNPOST2_STOP_PLAYER21#alias 4 : SIGNPOST2_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 SIGNPOST2_CHECK_BOUNDS37Object.Frame = 13839TempValue0 = Object.YPos40TempValue0 += 0x6000004142if Player.YPos < TempValue043if Object.SignPostBound > 044TempValue0 = Object.XPos45TempValue0 -= Player.XPos46TempValue0 >>= 1647CheckGreater(TempValue0, 0)48TempValue1 = CheckResult49CheckLower(TempValue0, Object.SignPostBound)50CheckResult &= TempValue151if CheckResult == true52Stage.NewXBoundary1 = Object.iXPos53Stage.NewXBoundary1 -= Object.SignPostBound54Stage.NewXBoundary2 = Object.XPos55Stage.NewXBoundary2 >>= 1656Stage.NewXBoundary2 += Screen.CenterX57end if58else59Stage.NewXBoundary1 = Object.XPos60Stage.NewXBoundary1 >>= 1661Stage.NewXBoundary1 -= Screen.CenterX62Stage.NewXBoundary1 -= Screen.CenterX6364Stage.NewXBoundary2 = Object.XPos65Stage.NewXBoundary2 >>= 1666Stage.NewXBoundary2 += Screen.CenterX67end if6869if Player.XPos > Object.XPos70Stage.NewXBoundary1 = Object.XPos71Stage.NewXBoundary1 >>= 1672Stage.NewXBoundary1 -= Screen.CenterX7374EngineCallback(NOTIFY_TOUCH_SIGNPOST)7576Stage.TimeEnabled = false77Object.State = SIGNPOST2_FLIP78Object.Timer = 87980PlaySfx(SFX_G_SIGNPOST, false)8182end if83end if84break8586case SIGNPOST2_FLIP87Music.Volume--88Object.FrameTimer++89if Object.FrameTimer == 29091Object.FrameTimer = 092Object.Frame++93if Object.Frame == 594// Spawn a ring sparkle at random location close to the sign post95Rand(TempValue0, 48)96TempValue0 <<= 1697TempValue0 += Object.XPos98TempValue0 -= 0x18000099100Rand(TempValue1, 32)101TempValue1 <<= 16102TempValue1 += Object.YPos103TempValue1 -= 0x1C0000104CreateTempObject(TypeName[Ring Sparkle], 0, TempValue0, TempValue1)105106Object.Timer--107if Object.Timer == 0108if Object[0].Type == TypeName[Blank Object] // Check if the player already leave by itself109Object.State = SIGNPOST2_BLANK110111if Object.OutOfBounds == false112PlayMusic(1)113end if114115Object[30].Type = TypeName[ActFinish]116ActFinish.DrawOrder = 6117ActFinish.Priority = PRIORITY_ACTIVE118else // Otherwise the signpost will do it itself.119Player.ControlMode = CONTROLMODE_NONE120Player.Up = false121Player.Down = false122Player.Left = false123Player.JumpPress = false124Player.JumpHold = false125Object.State = SIGNPOST2_MOVE_PLAYER126end if127end if128end if129130if Object.Frame == 9131// Spawn a ring sparkle at random location close to the sign post132Rand(TempValue0, 48)133TempValue0 <<= 16134TempValue0 += Object.XPos135TempValue0 -= 0x180000136137Rand(TempValue1, 32)138TempValue1 <<= 16139TempValue1 += Object.YPos140TempValue1 -= 0x1C0000141CreateTempObject(TypeName[Ring Sparkle], 0, TempValue0, TempValue1)142// Resets the animation cycle143Object.Frame = 1144end if145146end if147// Freezes the player after leaving the screen148TempValue0 = 40149TempValue0 += Screen.CenterX150TempValue0 <<= 16151TempValue0 += Object.XPos152if Player.XPos > TempValue0153Player.XPos = TempValue0154Player.Speed = 0155Player.XVelocity = 0156end if157break158159case SIGNPOST2_MOVE_PLAYER160if Object[0].Type == TypeName[Blank Object]161Object.State = SIGNPOST2_BLANK162163if Object.OutOfBounds == false164PlayMusic(1)165end if166167Object[30].Type = TypeName[ActFinish]168ActFinish.DrawOrder = 6169ActFinish.Priority = PRIORITY_ACTIVE170end if171172if Object.PropertyValue > 127173if Player.ControlMode == CONTROLMODE_NONE174Player.Right = true175end if176end if177178TempValue0 = Screen.CenterX179TempValue0 <<= 16180TempValue0 += Object.XPos181CheckGreater(Player.XPos, TempValue0)182TempValue1 = CheckResult183CheckLower(Object.PropertyValue, 128)184CheckResult |= TempValue1185if CheckResult == true186if Object.OutOfBounds == false187PlayMusic(1)188end if189190Object.State = SIGNPOST2_STOP_PLAYER191Object[30].Type = TypeName[ActFinish]192ActFinish.DrawOrder = 6193ActFinish.Priority = PRIORITY_ACTIVE194else195if Player.Animation == ANI_PUSHING196PlayMusic(1)197Object.State = SIGNPOST2_BLANK198Object[30].Type = TypeName[ActFinish]199ActFinish.DrawOrder = 6200ActFinish.Priority = PRIORITY_ACTIVE201end if202end if203break204205case SIGNPOST2_STOP_PLAYER206if Object.PropertyValue > 127207if Player.ControlMode == CONTROLMODE_NONE208Player.Right = true209end if210end if211212TempValue0 = 40213TempValue0 += Screen.CenterX214TempValue0 <<= 16215TempValue0 += Object.XPos216217if Player.XPos > TempValue0218Player.XPos = TempValue0219Player.Speed = 0220Player.XVelocity = 0221end if222break223end switch224225if Object.State > SIGNPOST2_FLIP226if Object.PropertyValue < 128227CheckEqual(Player.State, Player_State_Ground)228TempValue0 = CheckResult229CheckEqual(Player.OutOfBounds, true)230TempValue0 |= CheckResult231232TempValue1 = Screen.XOffset233TempValue1 += Screen.XSize234TempValue1 += 32235CheckGreater(Player.iXPos, TempValue1)236TempValue0 |= CheckResult237if TempValue0 == true238Player.ControlMode = CONTROLMODE_NONE239Player.JumpHold = false240Player.Right = false241Player.Left = false242Player.Up = false243Player.Down = false244245if Player.State == Player_State_Ground246Player.XVelocity = 0247Player.YVelocity = 0248end if249250Player.Speed = 0251Screen.CameraEnabled = false252end if253end if254end if255256if Object.State > SIGNPOST2_CHECK_BOUNDS257Player.InvincibleTimer = 80258end if259end sub260261262sub ObjectDraw263DrawSprite(0)264DrawSprite(Object.Frame)265end sub266267268sub ObjectStartup269if Stage.PlayerListPos == PLAYER_SONIC270LoadSpriteSheet("Global/Items2.gif")271end if272if Stage.PlayerListPos == PLAYER_TAILS273LoadSpriteSheet("Global/Items2_t.gif")274end if275if Stage.PlayerListPos == PLAYER_KNUCKLES276LoadSpriteSheet("Global/Items2_K.gif")277end if278if Stage.PlayerListPos == PLAYER_AMY279LoadSpriteSheet("Global/Items2_A.gif")280end if281282SpriteFrame(-12, -12, 24, 24, 0, 150) // #0 - Sign Post283SpriteFrame(-24, -44, 48, 32, 34, 99) // #1 - Sign Post Head (Eggman)284SpriteFrame(-16, -44, 32, 32, 1, 183) // #2 - Sign Post Head (Flip 1)285SpriteFrame(-4, -44, 8, 32, 25, 150) // #3 - Sign Post Head (Flip 2)286SpriteFrame(-16, -44, 32, 32, 1, 216) // #4 - Sign Post Head (Flip 3)287SpriteFrame(-24, -44, 48, 32, 34, 132) // #5 - Sign Post Head (Player)288SpriteFrame(-16, -44, 32, 32, 1, 183) // #6 - Sign Post Head (Flip 1)289SpriteFrame(-4, -44, 8, 32, 25, 150) // #7 - Sign Post Head (Flip 2)290SpriteFrame(-16, -44, 32, 32, 1, 216) // #8 - Sign Post Head (Flip 3)291292ArrayPos0 = 32293while ArrayPos0 < 1056294if Object[ArrayPos0].Type == TypeName[SignPost2]295Object[ArrayPos0].Priority = PRIORITY_XBOUNDS296if Object[ArrayPos0].PropertyValue < 128297Object[ArrayPos0].SignPostBound = Object[ArrayPos0].PropertyValue298else299Object[ArrayPos0].SignPostBound = 256300Object[ArrayPos0].SignPostBound -= Object[ArrayPos0].PropertyValue301end if302Object[ArrayPos0].SignPostBound <<= 4303end if304ArrayPos0++305loop306end sub307308309// ========================310// Editor Subs311// ========================312313sub RSDKDraw314DrawSprite(0)315DrawSprite(1)316end sub317318319sub RSDKLoad320LoadSpriteSheet("Global/Items2.gif")321SpriteFrame(-12, -12, 24, 24, 0, 150) // #0 - Sign Post322SpriteFrame(-24, -44, 48, 32, 34, 99) // #1 - Sign Post Head (Eggman)323324SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")325end sub326327328329330