Path: blob/master/Sonic 1/Scripts/MZ/LavaGeyser.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Lava Geyser 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.drawPos.y13private alias object.value2 : object.eruptAnimTimer14private alias object.value3 : object.plumeFrame15private alias object.value4 : object.eruptFrame1617private alias 0 : LAVAGEYSER_AWAITBLOCK18private alias 1 : LAVAGEYSER_STARTERUPT19private alias 2 : LAVAGEYSER_SHOWPLUME20private alias 3 : LAVAGEYSER_ERUPTING21private alias 4 : LAVAGEYSER_ERUPTED22private alias 5 : LAVAGEYSER_HANDLEFINISH232425// ========================26// Function Declarations27// ========================2829reserve function LavaGeyser_DebugDraw30reserve function LavaGeyser_DebugSpawn313233// ========================34// Function Definitions35// ========================3637private function LavaGeyser_DebugDraw38DrawSprite(2)39end function404142private function LavaGeyser_DebugSpawn43CreateTempObject(TypeName[Lava Geyser], 0, object.xpos, object.ypos)44object[tempObjectPos].drawPos.y = object.ypos45object[tempObjectPos].drawOrder = 546end function474849// ========================50// Events51// ========================5253event ObjectUpdate54switch object.state55case LAVAGEYSER_AWAITBLOCK56foreach (TypeName[Push Block], arrayPos0, ACTIVE_ENTITIES)57BoxCollisionTest(C_TOUCH, arrayPos0, -16, -16, 16, 16, object.entityPos, -16, -32, 16, 16)58if checkResult == true59object.state = LAVAGEYSER_STARTERUPT60object.animationTimer = 061object.eruptAnimTimer = 062object.eruptFrame = 463end if64next65break6667case LAVAGEYSER_STARTERUPT68object.eruptFrame = object.eruptAnimTimer69object.eruptFrame /= 370object.eruptFrame += 471object.eruptAnimTimer++72object.eruptAnimTimer %= 67374object.timer++75if object.timer == 1276object.timer = 077object.state++78end if79break8081case LAVAGEYSER_SHOWPLUME82object.eruptFrame = object.eruptAnimTimer83object.eruptFrame /= 384object.eruptFrame += 685object.eruptAnimTimer++86object.eruptAnimTimer %= 68788object.timer++89if object.timer == 1290object.timer = 091object.frame = 092object.plumeFrame = 893object.yvel = -0x5400094object.state++95PlaySfx(SfxName[Fire Burn], false)96foreach (TypeName[Push Block], arrayPos0, ACTIVE_ENTITIES)97BoxCollisionTest(C_TOUCH, arrayPos0, -16, -16, 16, 16, object.entityPos, -32, -32, 32, 16)98if checkResult == true99object[arrayPos0].yvel = -0x59000100object[arrayPos0].gravity = GRAVITY_AIR101end if102next103end if104break105106case LAVAGEYSER_ERUPTING107object.yvel += 0x1800108object.ypos += object.yvel109if object.ypos >= object.drawPos.y110object.ypos = object.drawPos.y111object.state++112end if113114object.eruptFrame = object.eruptAnimTimer115object.eruptFrame /= 3116object.plumeFrame = object.eruptFrame117object.eruptFrame += 2118object.plumeFrame += 8119object.eruptAnimTimer++120object.eruptAnimTimer %= 6121object.frame = object.animationTimer122object.frame >>= 3123object.animationTimer++124object.animationTimer &= 15125126temp0 = object.drawPos.y127temp0 -= object.ypos128temp0 >>= 16129foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)130BoxCollisionTest(C_TOUCH, object.entityPos, -32, 0, 32, temp0, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)131if checkResult == true132CallFunction(Player_FireHit)133end if134next135break136137case LAVAGEYSER_ERUPTED138object.eruptFrame = object.eruptAnimTimer139object.eruptFrame /= 3140object.eruptFrame += 2141object.eruptAnimTimer++142object.eruptAnimTimer %= 6143144object.timer++145if object.timer == 12146object.timer = 0147object.state++148end if149break150151case LAVAGEYSER_HANDLEFINISH152object.eruptFrame = object.eruptAnimTimer153object.eruptFrame /= 3154object.eruptFrame += 4155object.eruptAnimTimer++156object.eruptAnimTimer %= 6157object.timer++158if object.timer == 12159object.timer = 0160object.state = LAVAGEYSER_AWAITBLOCK161end if162break163164end switch165end event166167168event ObjectDraw169switch object.state170case LAVAGEYSER_STARTERUPT171case LAVAGEYSER_SHOWPLUME172case LAVAGEYSER_ERUPTED173case LAVAGEYSER_HANDLEFINISH174DrawSpriteXY(object.eruptFrame, object.xpos, object.drawPos.y)175break176177case LAVAGEYSER_ERUPTING178temp0 = object.drawPos.y179temp0 -= object.ypos180temp0 >>= 16181temp1 = temp0182FlipSign(temp1)183if object.frame == 0184EditFrame(0, -32, temp1, 64, temp0, 317, 1)185else186EditFrame(1, -32, temp1, 64, temp0, 382, 1)187end if188DrawSpriteXY(object.frame, object.xpos, object.drawPos.y)189DrawSprite(object.plumeFrame)190DrawSpriteXY(object.eruptFrame, object.xpos, object.drawPos.y)191break192193end switch194end event195196197event ObjectStartup198LoadSpriteSheet("MZ/Objects.gif")199SpriteFrame(-32, -128, 64, 256, 317, 1)200SpriteFrame(-32, -128, 64, 256, 382, 1)201202SpriteFrame(-56, -18, 112, 30, 288, 332)203SpriteFrame(-55, -18, 110, 30, 401, 332)204205SpriteFrame(-24, -18, 48, 30, 268, 1)206SpriteFrame(-23, -18, 46, 30, 270, 32)207208SpriteFrame(-56, -22, 112, 34, 288, 297)209SpriteFrame(-55, -22, 110, 34, 401, 297)210SpriteFrame(-56, -26, 112, 38, 288, 258)211SpriteFrame(-55, -26, 110, 38, 401, 258)212213foreach (TypeName[Lava Geyser], arrayPos0, ALL_ENTITIES)214object[arrayPos0].drawPos.y = object[arrayPos0].ypos215object[arrayPos0].drawOrder = 5216next217218SetTableValue(TypeName[Lava Geyser], DebugMode_ObjCount, DebugMode_TypesTable)219SetTableValue(LavaGeyser_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)220SetTableValue(LavaGeyser_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)221DebugMode_ObjCount++222end event223224225// ========================226// Editor Events227// ========================228229event RSDKDraw230DrawSprite(4)231end event232233234event RSDKLoad235LoadSpriteSheet("MZ/Objects.gif")236SpriteFrame(-32, -128, 64, 256, 317, 1)237SpriteFrame(-32, -128, 64, 256, 382, 1)238SpriteFrame(-56, -18, 112, 30, 288, 332)239SpriteFrame(-55, -18, 110, 30, 401, 332)240SpriteFrame(-24, -18, 48, 30, 268, 1)241SpriteFrame(-23, -18, 46, 30, 270, 32)242SpriteFrame(-56, -22, 112, 34, 288, 297)243SpriteFrame(-55, -22, 110, 34, 401, 297)244SpriteFrame(-56, -26, 112, 38, 288, 258)245SpriteFrame(-55, -26, 110, 38, 401, 258)246247SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")248end event249250251