Path: blob/main/Scripts/FlowerPod/R7_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// Game Mode Aliases23#alias 2 : MODE_TIMEATTACK2425// Ink Effects26#alias 2 : INK_ALPHA2728// Player29#alias 0 : PLAYER_SONIC_A3031// Gravity32#alias 0 : GRAVITY_GROUND3334// Global SFX35#alias 22 : SFX_G_EXPLOSION3637// Priority38#alias 1 : PRIORITY_ACTIVE3940// Pod Seed Property Values41#alias 1 : TRIGGER_RESULTS424344sub ObjectMain45switch Object.State46case FLOWERPOD_IDLE47if Object.Timer < 6048Object.Frame = 149else50TempValue0 = Object.Timer51TempValue0 -= 6052TempValue0 >>= 153switch TempValue054case 055Object.Frame = 256break57case 158case 259Object.Frame = 160break61case 362Object.Frame = 263break64case 465case 566Object.Frame = 167break68case 669Object.Frame = 270break71end switch72end if7374Object.Timer++75if Object.Timer == 7476Object.Timer = 077end if78break7980case FLOWERPOD_EXPLOSION81if Object.Timer < 12082Object.Timer++8384TempValue0 = Object.Timer85TempValue0 &= 386if TempValue0 == 387Rand(TempValue0, 64)88TempValue0 -= 3289TempValue0 <<= 1690TempValue0 += Object.XPos9192Rand(TempValue1, 40)93TempValue1 -= 4094TempValue1 <<= 1695TempValue1 += Object.YPos9697CreateTempObject(TypeName[Explosion], 0, TempValue0, TempValue1)98PlaySfx(SFX_G_EXPLOSION, false)99end if100else101Object.State = FLOWERPOD_VANISH102Object.Timer = 256103Object.InkEffect = INK_ALPHA104Object.Alpha = 255105106107// Create all the Seeds that burst out of the Pod108109// Starting point is 3 pixels left and 24 pixels up from the Flower Pod's position110TempValue0 = Object.XPos111TempValue0 -= 0x30000112TempValue1 = Object.YPos113TempValue1 -= 0x180000114115// Create the leading seed, note its Property Value of 1 to signify that it should start level results upon landing116CreateTempObject(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 = false164Player.Up = false165Player.Down = false166Player.JumpHold = false167PlayMusic(1)168Object.State = FLOWERPOD_CONTROL_PLAYER169Object[30].Type = TypeName[ActFinish]170Object[30].DrawOrder = 6171Object[30].Priority = PRIORITY_ACTIVE172end if173break174175case FLOWERPOD_CONTROL_PLAYER176if Player.ControlMode == CONTROLMODE_NONE177Player.Right = false178end if179break180end switch181end sub182183184sub ObjectPlayerInteraction185if Object.State == FLOWERPOD_IDLE186// if Player.Animation == ANI_JUMPING // Standalone/Preplus check187188CheckResult = false189if Player.Animation == ANI_JUMPING190CheckResult = true191end if192#platform: Use_Origins193if Stage.PlayerListPos == PLAYER_KNUCKLES194if Player.Animation == ANI_GLIDING195CheckResult = true196end if197if Player.Animation == ANI_GLIDING_STOP198CheckResult = true199end if200end if201if Stage.PlayerListPos == PLAYER_AMY202if Player.Animation == ANI_HAMMER_DASH203CheckResult = true204end if205if Player.Animation == ANI_HAMMER_JUMP206CheckResult = true207end if208end if209#endplatform210if CheckResult == true211#platform: Use_Origins212PlayerObjectCollision(C_ENEMY, -28, -46, 28, 6)213#endplatform214#platform: Use_Standalone215PlayerObjectCollision(C_TOUCH, -28, -46, 28, 6)216#endplatform217if CheckResult == true218Stage.TimeEnabled = false219220Object.State = FLOWERPOD_EXPLOSION221Object.Frame = 3222Object.Timer = 0223224Player.YVelocity >>= 1225FlipSign(Player.YVelocity)226227#platform: Use_Haptics228HapticEffect(55, 0, 0, 0)229#endplatform230231#platform: Use_Origins232// Tell the engine that the boss fight has ended233game.callbackParam0 = true234EngineCallback(NOTIFY_BOSS_END)235#endplatform236end if237end if238end if239end sub240241242sub ObjectDraw243if Object.State < FLOWERPOD_VANISH244DrawSprite(0)245DrawSprite(Object.Frame)246else247DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)248DrawSpriteFX(Object.Frame, FX_INK, Object.XPos, Object.YPos)249end if250end sub251252253sub ObjectStartup254LoadSpriteSheet("R7/Objects2.gif")255256SpriteFrame(-32, 6, 64, 42, 1, 55) // #0 - FlowerPod Stem257SpriteFrame(-32, -48, 64, 54, 1, 1) // #1 - FlowerPod Bulb258SpriteFrame(-32, -48, 64, 54, 1, 98) // #2 - FlowerPod Bulb Flash259SpriteFrame(-32, -10, 64, 16, 1, 153) // #3 - FlowerPod Bulb Destroyed260261// Unload the Flowepod object if needed262ArrayPos0 = 32263while ArrayPos0 < 1056264if Object[ArrayPos0].Type == TypeName[Flower Pod]265if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins266if Options.GameMode != MODE_TIMEATTACK267// If Sonic's the main character and he's not in Time Attack, then unload268Object[ArrayPos0].Type = TypeName[Blank Object]269end if270end if271end if272ArrayPos0++273loop274end sub275276277// ========================278// Editor Subs279// ========================280281sub RSDKDraw282DrawSprite(0)283DrawSprite(1)284end sub285286287sub RSDKLoad288LoadSpriteSheet("R7/Objects2.gif")289SpriteFrame(-32, 6, 64, 42, 1, 55)290SpriteFrame(-32, -48, 64, 54, 1, 1)291292SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")293end sub294295296