Path: blob/main/Scripts/FlowerPod/R1_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_IDLE41Stage.NewXBoundary1 = Object.XPos42Stage.NewXBoundary1 >>= 1643Stage.NewXBoundary1 -= Screen.CenterX4445Stage.NewXBoundary2 = Object.XPos46Stage.NewXBoundary2 >>= 1647Stage.NewXBoundary2 += Screen.CenterX4849if Object.Timer < 6050Object.Frame = 151else52TempValue0 = Object.Timer53TempValue0 -= 6054TempValue0 >>= 155switch TempValue056case 057Object.Frame = 258break59case 160case 261Object.Frame = 162break63case 364Object.Frame = 265break66case 467case 568Object.Frame = 169break70case 671Object.Frame = 272break73end switch74end if7576Object.Timer++77if Object.Timer == 7478Object.Timer = 079end if80break8182case FLOWERPOD_EXPLOSION83if Object.Timer < 12084Object.Timer++85TempValue0 = Object.Timer86TempValue0 &= 387if TempValue0 == 388Rand(TempValue0, 64)89TempValue0 -= 3290TempValue0 <<= 1691TempValue0 += Object.XPos9293Rand(TempValue1, 40)94TempValue1 -= 4095TempValue1 <<= 1696TempValue1 += Object.YPos9798CreateTempObject(TypeName[Explosion], 0, TempValue0, TempValue1)99PlaySfx(SFX_G_EXPLOSION, false)100end if101else102Object.State = FLOWERPOD_VANISH103Object.Timer = 256104Object.InkEffect = INK_ALPHA105Object.Alpha = 255106107TempValue0 = Object.XPos108TempValue0 -= 0x30000109TempValue1 = Object.YPos110TempValue1 -= 0x180000111CreateTempObject(TypeName[Pod Seed], TRIGGER_RESULTS, TempValue0, TempValue1)112Object[TempObjectPos].XVelocity = -0x20000113Object[TempObjectPos].YVelocity = -0x60000114Object[TempObjectPos].ParentPod = Object.EntityNo115116TempValue0 += 0x10000117CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)118Object[TempObjectPos].XVelocity = -0x15554119Object[TempObjectPos].YVelocity = -0x60000120121TempValue0 += 0x10000122CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)123Object[TempObjectPos].XVelocity = -0xAAAA124Object[TempObjectPos].YVelocity = -0x60000125126TempValue0 += 0x10000127CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)128Object[TempObjectPos].XVelocity = 0129Object[TempObjectPos].YVelocity = -0x60000130131TempValue0 += 0x10000132CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)133Object[TempObjectPos].XVelocity = 0xAAAA134Object[TempObjectPos].YVelocity = -0x60000135136TempValue0 += 0x10000137CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)138Object[TempObjectPos].XVelocity = 0x15554139Object[TempObjectPos].YVelocity = -0x60000140141TempValue0 += 0x10000142CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)143Object[TempObjectPos].XVelocity = 0x20000144Object[TempObjectPos].YVelocity = -0x60000145end if146break147148case FLOWERPOD_VANISH149if Object.Timer > 0150Object.Timer -= 16151Object.Alpha = Object.Timer152end if153break154155case FLOWERPOD_TRIGGER_ACTFINISH156#platform: Use_Origins157// Palmtree Panic is the only zone where you can climb in the same area where the flower pod is158if Player.State == Player_State_Climb159CallFunction(Player_Unstick)160Player.ControlMode = CONTROLMODE_NONE161end if162#endplatform163if Player.ControlMode == CONTROLMODE_NONE164Player.Left = false165Player.Right = true166Player.Up = false167Player.Down = false168Player.JumpHold = false169end if170171TempValue0 = Object.XPos172TempValue0 += 0xA00000173174if Player.XPos > TempValue0175PlayMusic(1)176Object.State = FLOWERPOD_CONTROL_PLAYER177Object[30].Type = TypeName[ActFinish]178Object[30].DrawOrder = 6179Object[30].Priority = PRIORITY_ACTIVE180end if181break182183case FLOWERPOD_CONTROL_PLAYER184if Player.ControlMode == CONTROLMODE_NONE185Player.Right = true186end if187break188end switch189end sub190191192sub ObjectPlayerInteraction193if Object.State == FLOWERPOD_IDLE194// if Player.Animation == ANI_JUMPING // Standalone/Preplus check195196CheckResult = false197if Player.Animation == ANI_JUMPING198CheckResult = true199end if200#platform: Use_Origins201if Stage.PlayerListPos == PLAYER_KNUCKLES202if Player.Animation == ANI_GLIDING203CheckResult = true204end if205if Player.Animation == ANI_GLIDING_STOP206CheckResult = true207end if208end if209if Stage.PlayerListPos == PLAYER_AMY210if Player.Animation == ANI_HAMMER_DASH211CheckResult = true212end if213if Player.Animation == ANI_HAMMER_JUMP214CheckResult = true215end if216end if217#endplatform218if CheckResult == true219#platform: Use_Origins220PlayerObjectCollision(C_ENEMY, -28, -46, 28, 6)221#endplatform222#platform: Use_Standalone223PlayerObjectCollision(C_TOUCH, -28, -46, 28, 6)224#endplatform225if CheckResult == true226Stage.TimeEnabled = false227228Object.State = FLOWERPOD_EXPLOSION229Object.Frame = 3230Object.Timer = 0231232Player.YVelocity >>= 1233FlipSign(Player.YVelocity)234235#platform: Use_Haptics // Not present in Origins236HapticEffect(55, 0, 0, 0)237#endplatform238239#platform: Use_Origins240// Tell HE2 that the boss fight ended241game.callbackParam0 = true242EngineCallback(NOTIFY_BOSS_END)243#endplatform244end if245end if246end if247TempValue0 = Screen.CenterX248TempValue0 += 40249TempValue0 <<= 16250251TempValue1 = Object.XPos252TempValue1 += TempValue0253254if Player.XPos > TempValue1255Player.XPos = TempValue1256Player.Speed = 0257Player.XVelocity = 0258if Player.Gravity == GRAVITY_GROUND259Player.YVelocity = 0260end if261end if262end sub263264265sub ObjectDraw266if Object.State < FLOWERPOD_EXPLOSION267DrawSprite(0)268DrawSprite(Object.Frame)269else270DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)271DrawSpriteFX(Object.Frame, FX_INK, Object.XPos, Object.YPos)272end if273end sub274275276sub ObjectStartup277LoadSpriteSheet("R1/Objects3.gif")278279SpriteFrame(-32, 6, 64, 42, 191, 140) // #0 - FlowerPod Stem280SpriteFrame(-32, -48, 64, 54, 191, 86) // #1 - FlowerPod Bulb281SpriteFrame(-32, -48, 64, 54, 191, 183) // #2 - FlowerPod Bulb Flash282SpriteFrame(-32, -10, 64, 16, 191, 238) // #3 - FlowerPod Bulb Destroyed283284ArrayPos0 = 32285while ArrayPos0 < 1056286if Object[ArrayPos0].Type == TypeName[Flower Pod]287TempValue0 = Screen.CenterX288TempValue0 -= 160289TempValue0 <<= 16290Object[ArrayPos0].XPos -= TempValue0291end if292ArrayPos0++293loop294end sub295296297// ========================298// Editor Subs299// ========================300301sub RSDKDraw302DrawSprite(0)303DrawSprite(1)304end sub305306307sub RSDKLoad308LoadSpriteSheet("R1/Objects3.gif")309SpriteFrame(-32, 6, 64, 42, 191, 140)310SpriteFrame(-32, -48, 64, 54, 191, 86)311312SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")313end sub314315316