Path: blob/master/Sonic 2/Scripts/HPZ/WaterGeyser.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Water Geyser Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value1 : object.startPos.y12private alias object.value2 : object.maxHeight13private alias object.value3 : object.eggmanHeight14private alias object.value4 : object.parent1516// States17private alias 0 : WATERGEYSER_SETUP18private alias 1 : WATERGEYSER_RISE19private alias 2 : WATERGEYSER_FALL20private alias 3 : WATERGEYSER_RISE_BOSS21private alias 4 : WATERGEYSER_FALL_BOSS2223// EggmanAliases24private alias object.value13 : B08Eggman.flameAnimation2526// Eggman States27private alias 10 : HPZEGGMAN_GEYSERHIT28private alias 11 : HPZEGGMAN_GEYSERFALL29private alias 13 : HPZEGGMAN_EXPLODE303132// ========================33// Events34// ========================3536event ObjectUpdate37switch object.state38case WATERGEYSER_SETUP39object.startPos.y = object.ypos40object.maxHeight = object.ypos41object.maxHeight -= 0x100000042object.eggmanHeight = object.ypos43object.eggmanHeight -= 0x90000044if object.propertyValue == 045object.state++46else47object.parent = 0xFFFFFF48object.state = WATERGEYSER_RISE_BOSS49end if50object.yvel = -0x10000051break5253case WATERGEYSER_RISE54object.yvel += 0x380055object.ypos += object.yvel5657if object.ypos <= object.maxHeight58object.ypos = object.maxHeight59object.state++60end if61break6263case WATERGEYSER_FALL64object.yvel += 0x380065if object.yvel > 066object.ypos += object.yvel67end if6869if object.ypos >= object.startPos.y70object.type = TypeName[Blank Object]71end if72break7374case WATERGEYSER_RISE_BOSS75object.yvel += 0x380076object.ypos += object.yvel7778foreach (TypeName[B08 Eggman], arrayPos0, ACTIVE_ENTITIES)79BoxCollisionTest(C_TOUCH, object.entityPos, -14, -18, 14, 18, arrayPos0, -12, -24, 12, 24)80if checkResult == true81object.maxHeight = object.eggmanHeight82object.parent = arrayPos083// Bug Details:84// This check is faulty, it allows geysers to hit Eggman during his escape sequence85// The check should probably be `< HPZEGGMAN_EXPLODE`, rather than `!=`86if object[arrayPos0].state != HPZEGGMAN_EXPLODE87object[arrayPos0].state = HPZEGGMAN_GEYSERHIT88end if89end if90next9192if object.ypos <= object.maxHeight93object.ypos = object.maxHeight94object.state++95end if96break9798case WATERGEYSER_FALL_BOSS99object.yvel += 0x3800100101if object.yvel > 0102object.ypos += object.yvel103if object.parent != 0xFFFFFF104arrayPos0 = object.parent105if object[arrayPos0].state != HPZEGGMAN_EXPLODE106object[arrayPos0].state = HPZEGGMAN_GEYSERFALL107end if108object[arrayPos0].yvel = 0109B08Eggman[arrayPos0].flameAnimation = 0110object.parent = 0xFFFFFF111end if112else113if object.parent != 0xFFFFFF114foreach (TypeName[B08 Eggman], arrayPos0, ACTIVE_ENTITIES)115BoxCollisionTest(C_TOUCH, object.entityPos, -14, -18, 14, 18, arrayPos0, -12, -24, 12, 24)116if checkResult == true117object.maxHeight = object.eggmanHeight118object.parent = arrayPos0119// Bug Details: See above120if object[arrayPos0].state != HPZEGGMAN_EXPLODE121object[arrayPos0].state = HPZEGGMAN_GEYSERHIT122end if123end if124next125end if126end if127128if object.ypos >= object.startPos.y129object.type = TypeName[Blank Object]130end if131break132133end switch134end event135136137event ObjectDraw138temp0 = object.startPos.y139temp0 -= object.ypos140temp0 >>= 16141EditFrame(0, -14, 0, 28, temp0, 484, 0)142143DrawSprite(0)144DrawSprite(1)145end event146147148event ObjectStartup149LoadSpriteSheet("HPZ/Objects.gif")150SpriteFrame(-14, 0, 28, 256, 484, 256)151SpriteFrame(-24, -20, 48, 24, 174, 231)152end event153154155// ========================156// Editor Events157// ========================158159event RSDKDraw160object.maxHeight = object.ypos161object.maxHeight -= 0x1000000162163temp0 = object.ypos164temp0 -= object.maxHeight165temp0 >>= 16166EditFrame(0, -14, 0, 28, temp0, 484, 0)167168DrawSprite(0)169DrawSprite(1)170end event171172173event RSDKLoad174LoadSpriteSheet("HPZ/Objects.gif")175SpriteFrame(-14, 0, 28, 256, 484, 256)176SpriteFrame(-24, -20, 48, 24, 174, 231)177178// used for the boss, not in the editor179SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")180end event181182183