Path: blob/main/Scripts/Special/TimeStone.txt
1319 views
//----------------Sonic CD Time Stone Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Sonic Aliases5#alias Object.State : SSSonic.State6#alias Object.Frame : SSSonic.Frame78// States9#alias 0 : TIMESTONE_FALLING10#alias 1 : TIMESTONE_HELD1112// Special Stage Sonic States13#alias 10 : SSSONIC_STONEGRABBED1415// SFX Aliases16#alias 21 : SFX_G_ACHIEVEMENT171819sub ObjectDraw20// Get the frame the Stone should draw21// (But note that it's not drawn till the end, see there)22TempValue0 = Object.Frame23TempValue0 /= 122425// Animate the Stone26Object.Frame++27if Object.Frame > 4728Object.Frame = 029end if3031if Object.State == TIMESTONE_FALLING32// Stone's still falling, so draw the sparkles that it's dropping3334// Smaller sparkle, to be 32 pixels above the Time Stone35TempValue1 = Object.YPos36TempValue1 -= 0x20000037DrawSpriteFX(5, FX_FLIP, Object.XPos, TempValue1)3839// Bigger sparkle, 12 pixels below the smaller sparkle (absolute difference of 20 pixels above the Time Stone)40TempValue1 += 0xC000041DrawSpriteFX(4, FX_FLIP, Object.XPos, TempValue1)4243// Flip the object when needed in order to make the rotating animation appear smoother44Object.Direction = Object.Frame45Object.Direction %= 2446Object.Direction /= 64748if Object.iYPos < 20049// Time Stone isn't at its target destination yet, keep it falling at a rate of 1.5 px per frame50Object.YPos += 0x1800051else5253// Snap to Sonic's hands54Object.iYPos = 2005556// Stop further movement of the Stone57Object.State = TIMESTONE_HELD58PlaySfx(SFX_G_ACHIEVEMENT, false)5960// Signal to the Sonic Object that he's grabbed the Stone, from here he'll handle the rest61SSSonic[2].State = SSSONIC_STONEGRABBED62SSSonic[2].Frame++6364#platform: Use_Origins65// Let the Engine know we've touched an... "emerald"?66EngineCallback(NOTIFY_TOUCH_EMERALD)67#endplatform6869end if70end if7172// Draw the actual Stone sprite73// It's drawn all the way at the end of the process so that it stays above the sparkles, drawn before74DrawSprite(TempValue0)7576end sub777879sub ObjectStartup8081LoadSpriteSheet("Special/Objects.gif")8283// 0-3 - Time Stone Frames84SpriteFrame(-10, -12, 20, 24, 1, 232)85SpriteFrame(-10, -12, 20, 24, 22, 232)86SpriteFrame(-10, -12, 20, 24, 43, 232)87SpriteFrame(-10, -12, 20, 24, 64, 232)8889// 4-5 - Sparkles90SpriteFrame(-12, -12, 24, 24, 83, 143)91SpriteFrame(-8, -8, 16, 16, 83, 126)9293// No extra sprites needed for alternate colors - they're handled via palettes stored in the StageConfig instead9495end sub969798// ========================99// Editor Subs100// ========================101102sub RSDKDraw103DrawSprite(0)104end sub105106107sub RSDKLoad108LoadSpriteSheet("Special/Objects.gif")109SpriteFrame(-10, -12, 20, 24, 1, 232)110111SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")112end sub113114115