Path: blob/main/Scripts/Special/Dust.txt
1319 views
//------------------Sonic CD DustPuff Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// Property Values8#alias 0 : DUSTPUFF_SPAWNER9#alias 1 : DUSTPUFF_CHILD1011// Player aliases12#alias Player.XPos : SSSonic.XPos13#alias Player.YPos : SSSonic.YPos14#alias Object.Value0 : SSSonic.ZPos1516// Stage SFX17#alias 0 : SFX_S_GRITTYGROUND1819// Tile Info20#alias 6 : TILEINFO_ANGLEA212223sub ObjectMain24if Object.PropertyValue == DUSTPUFF_SPAWNER25// The Spawner is, well, spawned by the [Sonic] object in order to spawn more Dust Puffs26// Sure is a lot of spawning, huh?2728if SSSonic.YPos > 029// If the player is in the air, then unload30ResetObjectEntity(3, TypeName[Blank Object], 0, 0, 0)31else3233// Get Sonic's truncated X and Z Positions34TempValue0 = SSSonic.XPos35TempValue0 >>= 163637TempValue1 = SSSonic[-1].ZPos38TempValue1 >>= 163940// Get what type of tile it is41Get16x16TileInfo(CheckResult, TempValue0, TempValue1, TILEINFO_ANGLEA)4243// Is it a non-standard tile?44if CheckResult > 045Object.Timer++4647if Object.Timer > 248Object.Timer = 04950PlayStageSfx(SFX_S_GRITTYGROUND, false)5152// Randomise the dust position a little53Rand(TempValue0, 40)54TempValue0 -= 2055Rand(TempValue1, 8)56TempValue1 -= 85758TempValue0 += Screen.CenterX59TempValue1 += 2246061TempValue0 <<= 1662TempValue1 <<= 166364// Create the Dust Puff child object, no need to setup any ZPos stuff since it's a purely 2d object65CreateTempObject(TypeName[Dust Puff], DUSTPUFF_CHILD, TempValue0, TempValue1)66Object[TempObjectPos].DrawOrder = 467end if68else69Object.Type = TypeName[Blank Object]70Object.Timer = 071end if72end if73else74// Child Dust Puff object7576Object.Timer++77if Object.Timer == 978Object.Type = TypeName[Blank Object]79end if8081// If the Player's moving, then we gotta follow along too!8283if Player.Left == true84Object.XPos += 0x1000085end if8687if Player.Right == true88Object.XPos -= 0x1000089end if90end if9192end sub939495sub ObjectDraw96if Object.PropertyValue == DUSTPUFF_CHILD97// Find the Frame to display based on how much time the object has left98Object.Frame = Object.Timer99Object.Frame /= 3100101// Draw the Sprite, note the use of standard DrawSprite rather than anything fancy like the other SS objects102// This is because the object should only ever exist on a 2d plane anyway103DrawSprite(Object.Frame)104end if105106// DUSTPUFF_SPAWNER doesn't draw, it spawns other Dust Puff objects to draw instead107108end sub109110111sub ObjectStartup112113LoadSpriteSheet("Special/Objects.gif")114115// Dust Puff Frames116SpriteFrame(-5, -4, 10, 8, 27, 58)117SpriteFrame(-5, -4, 11, 8, 10, 58)118SpriteFrame(-4, -4, 8, 8, 1, 58)119120end sub121122123// ========================124// Editor Subs125// ========================126127sub RSDKDraw128DrawSprite(0)129end sub130131132sub RSDKLoad133LoadSpriteSheet("Special/Objects.gif")134SpriteFrame(-5, -4, 10, 8, 27, 58)135136// Although it's used by the Object, it's not to be set from the editor137// (This Object shouldn't be placed into a scene directly at all, really...)138SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")139end sub140141142