Path: blob/main/Scripts/FlowerPod/R4_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 Modes20#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_ACTIVE33#alias 3 : PRIORITY_XBOUNDS3435// Pod Seed Property Values36#alias 1 : TRIGGER_RESULTS373839sub ObjectMain40switch Object.State41case FLOWERPOD_IDLE42TempValue0 = Object.YPos43TempValue0 += 0x40005A44if Player.YPos < TempValue045Stage.NewXBoundary1 = Object.XPos46Stage.NewXBoundary1 >>= 1647Stage.NewXBoundary1 -= Screen.CenterX4849Stage.NewXBoundary2 = Object.XPos50Stage.NewXBoundary2 >>= 1651Stage.NewXBoundary2 += Screen.CenterX52end if5354if Object.Timer < 6055Object.Frame = 156else57TempValue0 = Object.Timer58TempValue0 -= 6059TempValue0 >>= 160switch TempValue061case 062Object.Frame = 263break64case 165case 266Object.Frame = 167break68case 369Object.Frame = 270break71case 472case 573Object.Frame = 174break75case 676Object.Frame = 277break78end switch79end if8081Object.Timer++82if Object.Timer == 7483Object.Timer = 084end if85break8687case FLOWERPOD_EXPLOSION88if Object.Timer < 12089Object.Timer++9091TempValue0 = Object.Timer92TempValue0 &= 393if TempValue0 == 394Rand(TempValue0, 64)95TempValue0 -= 3296TempValue0 <<= 1697TempValue0 += Object.XPos9899Rand(TempValue1, 40)100TempValue1 -= 40101TempValue1 <<= 16102TempValue1 += Object.YPos103104CreateTempObject(TypeName[Explosion], 0, TempValue0, TempValue1)105PlaySfx(SFX_G_EXPLOSION, false)106end if107else108Object.State = FLOWERPOD_VANISH109Object.Timer = 256110Object.InkEffect = INK_ALPHA111Object.Alpha = 255112113TempValue0 = Object.XPos114TempValue0 -= 0x30000115TempValue1 = Object.YPos116TempValue1 -= 0x180000117CreateTempObject(TypeName[Pod Seed], TRIGGER_RESULTS, TempValue0, TempValue1)118Object[TempObjectPos].XVelocity = -0x20000119Object[TempObjectPos].YVelocity = -0x60000120Object[TempObjectPos].ParentPod = Object.EntityNo121122TempValue0 += 0x10000123CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)124Object[TempObjectPos].XVelocity = -0x15554125Object[TempObjectPos].YVelocity = -0x60000126127TempValue0 += 0x10000128CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)129Object[TempObjectPos].XVelocity = -0xAAAA130Object[TempObjectPos].YVelocity = -0x60000131132TempValue0 += 0x10000133CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)134Object[TempObjectPos].XVelocity = 0135Object[TempObjectPos].YVelocity = -0x60000136137TempValue0 += 0x10000138CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)139Object[TempObjectPos].XVelocity = 0xAAAA140Object[TempObjectPos].YVelocity = -0x60000141142TempValue0 += 0x10000143CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)144Object[TempObjectPos].XVelocity = 0x15554145Object[TempObjectPos].YVelocity = -0x60000146147TempValue0 += 0x10000148CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)149Object[TempObjectPos].XVelocity = 0x20000150Object[TempObjectPos].YVelocity = -0x60000151end if152break153154case FLOWERPOD_VANISH155if Object.Timer > 0156Object.Timer -= 16157Object.Alpha = Object.Timer158end if159break160161case FLOWERPOD_TRIGGER_ACTFINISH162if Player.ControlMode == CONTROLMODE_NONE163Player.Left = false164Player.Right = true165Player.Up = false166Player.Down = false167Player.JumpHold = false168end if169170TempValue0 = Object.XPos171TempValue0 += 0xA00000172173if Player.XPos > TempValue0174PlayMusic(1)175Object.State = FLOWERPOD_CONTROL_PLAYER176Object[30].Type = TypeName[ActFinish]177Object[30].DrawOrder = 6178Object[30].Priority = PRIORITY_ACTIVE179end if180break181182case FLOWERPOD_CONTROL_PLAYER183if Player.ControlMode == CONTROLMODE_NONE184Player.Right = true185end if186break187end switch188end sub189190191sub ObjectPlayerInteraction192if Object.State == FLOWERPOD_IDLE193// if Player.Animation == ANI_JUMPING // Standalone/Preplus check194195CheckResult = false196if Player.Animation == ANI_JUMPING197CheckResult = true198end if199#platform: Use_Origins200if Stage.PlayerListPos == PLAYER_KNUCKLES201if Player.Animation == ANI_GLIDING202CheckResult = true203end if204if Player.Animation == ANI_GLIDING_STOP205CheckResult = true206end if207end if208if Stage.PlayerListPos == PLAYER_AMY209if Player.Animation == ANI_HAMMER_DASH210CheckResult = true211end if212if Player.Animation == ANI_HAMMER_JUMP213CheckResult = true214end if215end if216#endplatform217if CheckResult == true218#platform: Use_Origins219PlayerObjectCollision(C_ENEMY, -28, -46, 28, 6)220#endplatform221#platform: Use_Standalone222PlayerObjectCollision(C_TOUCH, -28, -46, 28, 6)223#endplatform224if CheckResult == true225Stage.TimeEnabled = false226227Object.State = FLOWERPOD_EXPLOSION228Object.Frame = 3229Object.Timer = 0230231Player.YVelocity >>= 1232FlipSign(Player.YVelocity)233234#platform: Use_Haptics235HapticEffect(55, 0, 0, 0)236#endplatform237238#platform: Use_Origins239// Tell HE2 that the boss fight ended240game.callbackParam0 = true241EngineCallback(NOTIFY_BOSS_END)242#endplatform243end if244end if245end if246TempValue0 = Screen.CenterX247TempValue0 += 40248TempValue0 <<= 16249250TempValue1 = Object.XPos251TempValue1 += TempValue0252253if Player.XPos > TempValue1254Player.XPos = TempValue1255Player.Speed = 0256Player.XVelocity = 0257if Player.Gravity == GRAVITY_GROUND258Player.YVelocity = 0259end if260end if261end sub262263264sub ObjectDraw265if Object.State < FLOWERPOD_VANISH266DrawSprite(0)267DrawSprite(Object.Frame)268else269DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)270DrawSpriteFX(Object.Frame, FX_INK, Object.XPos, Object.YPos)271end if272end sub273274275sub ObjectStartup276LoadSpriteSheet("R4/Objects2.gif")277278SpriteFrame(-32, 6, 64, 42, 191, 213) // #0 - FlowerPod Stem279SpriteFrame(-32, -48, 64, 54, 191, 159) // #1 - FlowerPod Bulb280SpriteFrame(-32, -48, 64, 54, 126, 184) // #2 - FlowerPod Bulb Flash281SpriteFrame(-32, -10, 64, 16, 126, 239) // #3 - FlowerPod Bulb Destroyed282283ArrayPos0 = 32284while ArrayPos0 < 1056285if Object[ArrayPos0].Type == TypeName[Flower Pod]286Object[ArrayPos0].Priority = PRIORITY_XBOUNDS287TempValue0 = Screen.CenterX288TempValue0 -= 160289TempValue0 <<= 16290Object[ArrayPos0].XPos -= TempValue0291end if292ArrayPos0++293loop294end sub295296297// ========================298// Editor Subs299// ========================300301sub RSDKDraw302DrawSprite(0)303DrawSprite(1)304end sub305306307sub RSDKLoad308LoadSpriteSheet("R4/Objects2.gif")309310SpriteFrame(-32, 6, 64, 42, 191, 213) // #0 - FlowerPod Stem311SpriteFrame(-32, -48, 64, 54, 191, 159) // #1 - FlowerPod Bulb312313SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")314end sub315316317