Path: blob/master/Sonic 1/Scripts/MZ/FallingLava.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Falling Lava Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value1 : object.splashAnimTimer13private alias object.value2 : object.splashFrame14private alias object.value3 : object.splashPos.y1516private alias 0 : FALLINGLAVA_FALLING17private alias 1 : FALLINGLAVA_SPLASHING1819// ========================20// Function Declarations21// ========================2223reserve function FallingLava_DebugDraw24reserve function FallingLava_DebugSpawn2526private function FallingLava_DebugDraw27DrawSprite(0)28end function293031private function FallingLava_DebugSpawn32CreateTempObject(TypeName[Falling Lava], 0, object.xpos, object.ypos)33end function343536// ========================37// Events38// ========================3940event ObjectUpdate41if object.propertyValue == 042BoxCollisionTest(C_TOUCH, object.entityPos, -256, -256, 256, 128, 0, C_BOX, C_BOX, C_BOX, C_BOX)43if checkResult == true44object.timer--4546if object.timer <= 047object.timer = 2404849CreateTempObject(TypeName[Falling Lava], 1, object.xpos, object.ypos)50object[tempObjectPos].drawOrder = 451object[tempObjectPos].ypos -= 0x160000052object[tempObjectPos].splashPos.y = object.ypos5354PlaySfx(SfxName[Fire Burn], false)55end if56end if57else58switch object.state59case FALLINGLAVA_FALLING60object.yvel += 0x180061object.ypos += object.yvel6263foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)64BoxCollisionTest(C_TOUCH, object.entityPos, -32, -128, 32, 128, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)6566if checkResult == true67CallFunction(Player_FireHit)68end if69next7071if object.ypos >= object.splashPos.y72CreateTempObject(TypeName[Lava Splash], 0, object.xpos, object.ypos)73object[tempObjectPos].ypos += 0x80000074object[tempObjectPos].drawOrder = 575object.state++76end if77break7879case FALLINGLAVA_SPLASHING80object.yvel += 0x180081object.ypos += object.yvel8283foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)84BoxCollisionTest(C_TOUCH, object.entityPos, -32, -128, 32, 128, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)85if checkResult == true86CallFunction(Player_FireHit)87end if88next8990object.timer++91if object.timer == 6092object.type = TypeName[Blank Object]93end if94break9596end switch9798object.splashFrame = object.splashAnimTimer99object.splashFrame /= 3100object.splashFrame += 2101object.splashAnimTimer++102object.splashAnimTimer %= 6103104object.frame = object.animationTimer105object.frame >>= 3106object.animationTimer++107object.animationTimer &= 15108end if109end event110111112event ObjectDraw113if object.propertyValue > 0114DrawSprite(object.frame)115DrawSprite(object.splashFrame)116117object.direction = FLIP_Y118DrawSpriteFX(object.splashFrame, FX_FLIP, object.xpos, object.ypos)119end if120end event121122123event ObjectStartup124LoadSpriteSheet("MZ/Objects.gif")125126// Lava frames127SpriteFrame(-32, -128, 64, 256, 317, 1) // Falling Lava - #0128SpriteFrame(-32, -128, 64, 256, 382, 1) // Falling Lava - #1129SpriteFrame(-32, -144, 64, 32, 382, 363) // Lava Splash - #2130SpriteFrame(-32, -144, 64, 32, 447, 363) // Lava Splash - #3131132// Add Lava to the debug mode item list133SetTableValue(TypeName[Falling Lava], DebugMode_ObjCount, DebugMode_TypesTable)134SetTableValue(FallingLava_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)135SetTableValue(FallingLava_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)136DebugMode_ObjCount++137end event138139140// ========================141// Editor Events142// ========================143144event RSDKDraw145DrawSprite(0)146end event147148149event RSDKLoad150151LoadSpriteSheet("MZ/Objects.gif")152153// Lava frames154SpriteFrame(-32, -128, 64, 256, 317, 1) // Falling Lava - #0155SpriteFrame(-32, -128, 64, 256, 382, 1) // Falling Lava - #1156SpriteFrame(-32, -144, 64, 32, 382, 363) // Lava Splash - #2157SpriteFrame(-32, -144, 64, 32, 447, 363) // Lava Splash - #3158159SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")160end event161162163