Path: blob/main/Scripts/FlowerPod/R3_FlowerPod.txt
1319 views
//---------------Sonic CD Flower Pod Script-------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// PodSeed Aliases8#alias Object.Value1 : Object.ParentPod9#alias Object.Value2 : Object.XVelocity10#alias Object.Value3 : Object.YVelocity1112// States13#alias 0 : FLOWERPOD_IDLE14#alias 1 : FLOWERPOD_EXPLOSION15#alias 2 : FLOWERPOD_VANISH16#alias 3 : FLOWERPOD_TRIGGER_ACTFINISH17#alias 4 : FLOWERPOD_CONTROL_PLAYER1819// Control Mode20#alias -1 : CONTROLMODE_NONE2122// Ink Effects23#alias 2 : INK_ALPHA2425// Gravity26#alias 0 : GRAVITY_GROUND2728// Global SFX29#alias 22 : SFX_G_EXPLOSION3031// Priority32#alias 1 : PRIORITY_ACTIVE3334// Pod Seed Property Values35#alias 1 : TRIGGER_RESULTS363738sub ObjectMain39switch Object.State40case FLOWERPOD_IDLE41TempValue0 = Object.YPos42TempValue0 += 0x40005A43if Player.YPos < TempValue044Stage.NewXBoundary1 = Object.XPos45Stage.NewXBoundary1 >>= 1646Stage.NewXBoundary1 -= Screen.CenterX4748Stage.NewXBoundary2 = Object.XPos49Stage.NewXBoundary2 >>= 1650Stage.NewXBoundary2 += Screen.CenterX51end if5253if Object.Timer < 6054Object.Frame = 155else56TempValue0 = Object.Timer57TempValue0 -= 6058TempValue0 >>= 159switch TempValue060case 061Object.Frame = 262break63case 164case 265Object.Frame = 166break67case 368Object.Frame = 269break70case 471case 572Object.Frame = 173break74case 675Object.Frame = 276break77end switch78end if7980Object.Timer++81if Object.Timer == 7482Object.Timer = 083end if84break8586case FLOWERPOD_EXPLOSION87if Object.Timer < 12088Object.Timer++8990TempValue0 = Object.Timer91TempValue0 &= 392if TempValue0 == 393Rand(TempValue0, 64)94TempValue0 -= 3295TempValue0 <<= 1696TempValue0 += Object.XPos9798Rand(TempValue1, 40)99TempValue1 -= 40100TempValue1 <<= 16101TempValue1 += Object.YPos102103CreateTempObject(TypeName[Explosion], 0, TempValue0, TempValue1)104PlaySfx(SFX_G_EXPLOSION, false)105end if106else107Object.State = FLOWERPOD_VANISH108Object.Timer = 256109Object.InkEffect = INK_ALPHA110Object.Alpha = 255111112TempValue0 = Object.XPos113TempValue0 -= 0x30000114TempValue1 = Object.YPos115TempValue1 -= 0x180000116CreateTempObject(TypeName[Pod Seed], TRIGGER_RESULTS, TempValue0, TempValue1)117Object[TempObjectPos].XVelocity = -0x20000118Object[TempObjectPos].YVelocity = -0x60000119Object[TempObjectPos].ParentPod = Object.EntityNo120121TempValue0 += 0x10000122CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)123Object[TempObjectPos].XVelocity = -0x15554124Object[TempObjectPos].YVelocity = -0x60000125126TempValue0 += 0x10000127CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)128Object[TempObjectPos].XVelocity = -0xAAAA129Object[TempObjectPos].YVelocity = -0x60000130131TempValue0 += 0x10000132CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)133Object[TempObjectPos].XVelocity = 0134Object[TempObjectPos].YVelocity = -0x60000135136TempValue0 += 0x10000137CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)138Object[TempObjectPos].XVelocity = 0xAAAA139Object[TempObjectPos].YVelocity = -0x60000140141TempValue0 += 0x10000142CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)143Object[TempObjectPos].XVelocity = 0x15554144Object[TempObjectPos].YVelocity = -0x60000145146TempValue0 += 0x10000147CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)148Object[TempObjectPos].XVelocity = 0x20000149Object[TempObjectPos].YVelocity = -0x60000150end if151break152153case FLOWERPOD_VANISH154if Object.Timer > 0155Object.Timer -= 16156Object.Alpha = Object.Timer157end if158break159160case FLOWERPOD_TRIGGER_ACTFINISH161if Player.ControlMode == CONTROLMODE_NONE162Player.Left = false163Player.Right = true164Player.Up = false165Player.Down = false166Player.JumpHold = false167end if168169TempValue0 = Object.XPos170TempValue0 += 0xA00000171172if Player.XPos > TempValue0173PlayMusic(1)174Object.State = FLOWERPOD_CONTROL_PLAYER175Object[30].Type = TypeName[ActFinish]176Object[30].DrawOrder = 6177Object[30].Priority = PRIORITY_ACTIVE178end if179break180181case FLOWERPOD_CONTROL_PLAYER182if Player.ControlMode == CONTROLMODE_NONE183Player.Right = true184end if185break186end switch187end sub188189190sub ObjectPlayerInteraction191if Object.State == FLOWERPOD_IDLE192// if Player.Animation == ANI_JUMPING // Standalone/Preplus check193194CheckResult = false195if Player.Animation == ANI_JUMPING196CheckResult = true197end if198#platform: Use_Origins199if Stage.PlayerListPos == PLAYER_KNUCKLES200if Player.Animation == ANI_GLIDING201CheckResult = true202end if203if Player.Animation == ANI_GLIDING_STOP204CheckResult = true205end if206end if207if Stage.PlayerListPos == PLAYER_AMY208if Player.Animation == ANI_HAMMER_DASH209CheckResult = true210end if211if Player.Animation == ANI_HAMMER_JUMP212CheckResult = true213end if214end if215#endplatform216if CheckResult == true217#platform: Use_Origins218PlayerObjectCollision(C_ENEMY, -28, -46, 28, 6)219#endplatform220#platform: Use_Standalone221PlayerObjectCollision(C_TOUCH, -28, -46, 28, 6)222#endplatform223if CheckResult == true224Stage.TimeEnabled = false225226Object.State = FLOWERPOD_EXPLOSION227Object.Frame = 3228Object.Timer = 0229230Player.YVelocity >>= 1231FlipSign(Player.YVelocity)232233#platform: Use_Haptics234HapticEffect(55, 0, 0, 0)235#endplatform236237#platform: Use_Origins238// Tell HE2 that the boss fight ended239game.callbackParam0 = true240EngineCallback(NOTIFY_BOSS_END)241#endplatform242end if243end if244end if245TempValue0 = Screen.CenterX246TempValue0 += 40247TempValue0 <<= 16248249TempValue1 = Object.XPos250TempValue1 += TempValue0251252if Player.XPos > TempValue1253Player.XPos = TempValue1254Player.Speed = 0255Player.XVelocity = 0256if Player.Gravity == GRAVITY_GROUND257Player.YVelocity = 0258end if259end if260end sub261262263sub ObjectDraw264if Object.State < FLOWERPOD_VANISH265DrawSprite(0)266DrawSprite(Object.Frame)267else268DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)269DrawSpriteFX(Object.Frame, FX_INK, Object.XPos, Object.YPos)270end if271end sub272273274sub ObjectStartup275LoadSpriteSheet("R3/Objects3.gif")276277SpriteFrame(-32, 6, 64, 42, 1, 55) // #0 - FlowerPod Stem278SpriteFrame(-32, -48, 64, 54, 1, 1) // #1 - FlowerPod Bulb279SpriteFrame(-32, -48, 64, 54, 1, 98) // #2 - FlowerPod Bulb Flash280SpriteFrame(-32, -10, 64, 16, 1, 153) // #3 - FlowerPod Bulb Destroyed281282ArrayPos0 = 32283while ArrayPos0 < 1056284if Object[ArrayPos0].Type == TypeName[Flower Pod]285TempValue0 = Screen.CenterX286TempValue0 -= 160287TempValue0 <<= 16288Object[ArrayPos0].XPos -= TempValue0289end if290ArrayPos0++291loop292end sub293294295// ========================296// Editor Subs297// ========================298299sub RSDKDraw300DrawSprite(0)301DrawSprite(1)302end sub303304305sub RSDKLoad306LoadSpriteSheet("R3/Objects3.gif")307308SpriteFrame(-32, 6, 64, 42, 1, 55) // #0 - FlowerPod Stem309SpriteFrame(-32, -48, 64, 54, 1, 1) // #1 - FlowerPod Bulb310311SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")312end sub313314315