Path: blob/main/Scripts/Global/SpecialRing.txt
1319 views
//---------------Sonic CD Special Ring Script-----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Player.Value0 : Player.Rings67// Decomp usage only, to check which behaviour of the special ring animation should be used for 2011 data files8#alias Object.Value7 : Object.CheckVersion910// States11#alias 0 : SPECIALRING_IDLE12#alias 1 : SPECIALRING_BLANK1314// Game Mode Aliases15#alias 1 : MODE_SAVEGAME1617// Player18#alias 0 : PLAYER_SONIC_A19#alias 1 : PLAYER_TAILS_A2021// Control Mode22#alias -1 : CONTROLMODE_NONE2324// Global SFX25#alias 18 : SFX_G_SPECIALRING26#alias 24 : SFX_G_FLYING27#alias 25 : SFX_G_TIRED2829// Decomp Usage alias30#alias 0 : UPDATED_VERSION31#alias 1 : OLD_VERSION3233#alias 2 : TEXTINFO_ROWCOUNT // Menu Alias343536sub ObjectMain37if Object.State == SPECIALRING_IDLE38if Player.Rings > 4939PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)40if CheckResult == true41Object[0].Type = TypeName[Blank Object]42Object[1].Type = TypeName[Blank Object]4344Player.ControlMode = CONTROLMODE_NONE4546Player.Direction = FACING_RIGHT4748ResetObjectEntity(2, TypeName[Blank Object], 0, 0, 0)4950Object.DrawOrder = 45152Object.State = SPECIALRING_BLANK5354#platform: Use_Origins55Object.Frame = 3256#endplatform5758#platform: Use_Standalone59// reduce the frame amount for steam datafiles60if Object.CheckVersion != UPDATED_VERSION61Object.Frame = 1662else63Object.Frame = 3264end if65#endplatform6667StopSFX(SFX_G_FLYING)68StopSFX(SFX_G_TIRED)69PlaySfx(SFX_G_SPECIALRING, false)70Player.Left = false71Player.Right = false7273#platform: Use_Haptics74HapticEffect(40, 0, 0, 0)75#endplatform7677end if78end if79end if80end sub818283sub ObjectDraw84switch Object.State85case SPECIALRING_IDLE8687if Player.Rings > 4988TempValue0 = Object.Frame8990#platform: Use_Standalone // 2011 Scripts91if Object.CheckVersion != UPDATED_VERSION92// Old Steam Animation93TempValue0 >>= 394DrawSprite(TempValue0)95else96// Updated animation97TempValue0 >>= 298if TempValue0 > 399Object.Direction = FACING_LEFT100else101Object.Direction = FACING_RIGHT102end if103DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)104end if105106#endplatform107108#platform: Use_Origins // Origins animation, Same as 2011 mobile109TempValue0 = Object.Frame110TempValue0 >>= 2111112if TempValue0 > 3113Object.Direction = FACING_LEFT114else115Object.Direction = FACING_RIGHT116end if117118DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)119#endplatform120121Object.Frame++122if Object.Frame > 31123Object.Frame = 0124end if125end if126break127128case SPECIALRING_BLANK129TempValue0 = Object.Frame130TempValue0 >>= 2131132#platform: Use_Standalone // 2011 Scripts133if Object.CheckVersion != UPDATED_VERSION134// Old Steam vanish animation135TempValue0 = Object.Frame136TempValue0 >>= 2137DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)138139Object.Frame++140if Object.Frame > 31141Object.Direction = FACING_LEFT142end if143if Object.Frame > 47144ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)145end if146else147// Updated vanish animation148if TempValue0 > 11149Object.Direction = FACING_LEFT150else151Object.Direction = FACING_RIGHT152end if153154DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)155156CheckEqual(TempValue0, 11)157if CheckResult == true158Object.Direction = FACING_LEFT159DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)160else161if TempValue0 == 15162Object.Direction = FACING_LEFT163DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)164end if165end if166167Object.Frame++168if Object.Frame > 63169ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)170end if171end if172#endplatform173174#platform: Use_Origins // Origins animation, Same as 2011 mobile175if TempValue0 > 11176Object.Direction = FACING_LEFT177else178Object.Direction = FACING_RIGHT179end if180181DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)182if TempValue0 == 11183Object.Direction = FACING_LEFT184DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)185else186if TempValue0 == 15187Object.Direction = FACING_LEFT188DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)189end if190end if191192Object.Frame++193if Object.Frame > 63194ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)195end if196#endplatform197break198endswitch199end sub200201202sub ObjectStartup203if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins204LoadSpriteSheet("Global/Items2.gif")205end if206if Stage.PlayerListPos == PLAYER_TAILS_A // PLAYER_TAILS in origins207LoadSpriteSheet("Global/Items2_t.gif")208end if209#platform: Use_Origins210if Stage.PlayerListPos == PLAYER_KNUCKLES211LoadSpriteSheet("Global/Items2_k.gif")212end if213if Stage.PlayerListPos == PLAYER_AMY214LoadSpriteSheet("Global/Items2_a.gif")215end if216// Special Ring Frames217SpriteFrame(-32, -32, 64, 64, 83, 1) // #0 - Special Ring Frame 0218SpriteFrame(-28, -32, 56, 64, 199, 131) // #1 - Special Ring Frame 1219SpriteFrame(-24, -32, 48, 64, 148, 1) // #2 - Special Ring Frame 2220SpriteFrame(-16, -32, 32, 64, 223, 66) // #3 - Special Ring Frame 3221SpriteFrame(-12, -32, 24, 64, 197, 1) // #4 - Special Ring Frame 4222SpriteFrame(-16, -32, 32, 64, 223, 66) // #5 - Special Ring Frame 5223SpriteFrame(-24, -32, 48, 64, 148, 1) // #6 - Special Ring Frame 6224SpriteFrame(-28, -32, 56, 64, 199, 131) // #7 - Special Ring Frame 7225226// Vanishing Frames227SpriteFrame(0, -32, 32, 64, 222, 1) // #8 - Ring Vanishing Frame 0228SpriteFrame(-16, -32, 48, 64, 101, 66) // #9 - Ring Vanishing Frame 1229SpriteFrame(-24, -32, 56, 64, 150, 66) // #10 - Ring Vanishing Frame 2230SpriteFrame(0, -32, 32, 64, 156, 131) // #11 - Ring Vanishing Frame 3231SpriteFrame(-24, -32, 56, 64, 150, 66) // #12 - Ring Vanishing Frame 4232SpriteFrame(-16, -32, 48, 64, 101, 66) // #13 - Ring Vanishing Frame 5233SpriteFrame(0, -32, 32, 64, 222, 1) // #14 - Ring Vanishing Frame 6234SpriteFrame(-32, -32, 32, 64, 124, 131) // #15 - Ring Vanishing Frame 7235#endplatform236237#platform: Use_Decomp238// Custom decomp check of versions239// Checks the amount of rows Credits_Console has, a file that doesn't exist on mobile data files.240// if it's equal or less than 1 (depending of platform), means there's no such file in the game, therefore we're using a mobile data file, and the updated animation is needed241// otherwise, it means we are playing with a Steam/Blit datafile, and as such we need to use the old animation242SetupMenu(MENU_1, 0, 0, 0)243LoadTextFile(MENU_1, "Data/Game/Credits_Console.txt", false)244GetTextInfo(CheckResult, MENU_1, TEXTINFO_ROWCOUNT, 0, 0)245if CheckResult > 1246ArrayPos0 = 32247while ArrayPos0 < 1056248if Object[ArrayPos0].Type == TypeName[Special Ring]249Object[ArrayPos0].CheckVersion = OLD_VERSION250end if251ArrayPos0++252loop253end if254#endplatform255256#platform: Use_Standalone257if CheckResult > 1258// Special Ring Frames (Blit)259SpriteFrame(-32, -32, 64, 64, 83, 1) // #0 - Special Ring Frame 0260SpriteFrame(-24, -32, 48, 64, 148, 1) // #1 - Special Ring Frame 1261SpriteFrame(-12, -32, 24, 64, 197, 1) // #2 - Special Ring Frame 2262SpriteFrame(-24, -32, 48, 64, 101, 66) // #3 - Special Ring Frame 3263264// Vanishing Frames265SpriteFrame(0, -32, 32, 64, 222, 1) // #4 - Ring Vanishing Frame 0266SpriteFrame(-16, -32, 48, 64, 150, 66) // #5 - Ring Vanishing Frame 1267SpriteFrame(-24, -32, 56, 64, 199, 66) // #6 - Ring Vanishing Frame 2268SpriteFrame(-32, -32, 64, 64, 191, 131) // #7 - Ring Vanishing Frame 3269SpriteFrame(-24, -32, 56, 64, 199, 66) // #8 - Ring Vanishing Frame 4270SpriteFrame(-16, -32, 48, 64, 150, 66) // #9 - Ring Vanishing Frame 5271SpriteFrame(0, -32, 32, 64, 222, 1) // #10 - Ring Vanishing Frame 6272SpriteFrame(-32, -32, 64, 64, 126, 131) // #11 - Ring Vanishing Frame 7273else274// Special Ring Frames (Mobile)275SpriteFrame(-32, -32, 64, 64, 83, 1) // #0 - Special Ring Frame 0276SpriteFrame(-28, -32, 56, 64, 199, 131) // #1 - Special Ring Frame 1277SpriteFrame(-24, -32, 48, 64, 148, 1) // #2 - Special Ring Frame 2278SpriteFrame(-16, -32, 32, 64, 223, 66) // #3 - Special Ring Frame 3279SpriteFrame(-12, -32, 24, 64, 197, 1) // #4 - Special Ring Frame 4280SpriteFrame(-16, -32, 32, 64, 223, 66) // #5 - Special Ring Frame 5281SpriteFrame(-24, -32, 48, 64, 148, 1) // #6 - Special Ring Frame 6282SpriteFrame(-28, -32, 56, 64, 199, 131) // #7 - Special Ring Frame 7283284// Vanishing Frames285SpriteFrame(0, -32, 32, 64, 222, 1) // #8 - Ring Vanishing Frame 0286SpriteFrame(-16, -32, 48, 64, 101, 66) // #9 - Ring Vanishing Frame 1287SpriteFrame(-24, -32, 56, 64, 150, 66) // #10 - Ring Vanishing Frame 2288SpriteFrame(0, -32, 32, 64, 156, 131) // #11 - Ring Vanishing Frame 3289SpriteFrame(-24, -32, 56, 64, 150, 66) // #12 - Ring Vanishing Frame 4290SpriteFrame(-16, -32, 48, 64, 101, 66) // #13 - Ring Vanishing Frame 5291SpriteFrame(0, -32, 32, 64, 222, 1) // #14 - Ring Vanishing Frame 6292SpriteFrame(-32, -32, 32, 64, 124, 131) // #15 - Ring Vanishing Frame 7293end if294#endplatform295296// If all Time Stones are collected, we don't need any Special Stages anymore297if SpecialStage.TimeStones >= 0x7F298ArrayPos0 = 32299while ArrayPos0 < 1056300if Object[ArrayPos0].Type == TypeName[Special Ring]301ResetObjectEntity(ArrayPos0, TypeName[Blank Object], 0, 0, 0)302end if303ArrayPos0++304loop305end if306307// In Time Attack, we shouldn't enter any Special Stages308if Options.GameMode > MODE_SAVEGAME309ArrayPos0 = 32310while ArrayPos0 < 1056311if Object[ArrayPos0].Type == TypeName[Special Ring]312ResetObjectEntity(ArrayPos0, TypeName[BlankObject], 0, 0, 0)313end if314ArrayPos0++315loop316end if317318// That 'Lite!' on the banner wasn't joking, better remove all Special Rings!319if Engine.TrialMode == true320ArrayPos0 = 32321while ArrayPos0 < 1056322if Object[ArrayPos0].Type == TypeName[Special Ring]323ResetObjectEntity(ArrayPos0, TypeName[BlankObject], 0, 0, 0)324end if325ArrayPos0++326loop327end if328end sub329330331// ========================332// Editor Subs333// ========================334335sub RSDKDraw336DrawSprite(0)337end sub338339340sub RSDKLoad341LoadSpriteSheet("Global/Items2.gif")342SpriteFrame(-32, -32, 64, 64, 83, 1) // #0 - Special Ring Frame 0343344SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")345end sub346347348