Maintenance, edits and addition to Lake Hylia water control (#6884)

This commit is contained in:
djevangelia
2026-07-11 17:18:55 +02:00
committed by GitHub
parent bd7191875a
commit 847e3cd323
3 changed files with 77 additions and 72 deletions
+5 -5
View File
@@ -392,22 +392,22 @@ void Map_InitData(PlayState* play, s16 room) {
extendedMapIndex = mapIndex;
if (play->sceneNum == SCENE_GRAVEYARD) {
if (CHECK_QUEST_ITEM(QUEST_SONG_NOCTURNE)) {
extendedMapIndex = 0x14;
extendedMapIndex = 0x14; // Entrance to Shadow Temple visible
}
} else if (play->sceneNum == SCENE_LAKE_HYLIA) {
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) &&
((!IS_RANDO && !CHECK_QUEST_ITEM(QUEST_MEDALLION_WATER)) ||
(IS_RANDO && !Flags_GetEventChkInf(EVENTCHKINF_USED_WATER_TEMPLE_BLUE_WARP)))) {
extendedMapIndex = 0x15;
(IS_RANDO && !Flags_GetEventChkInf(EVENTCHKINF_RAISED_LAKE_HYLIA_WATER)))) {
extendedMapIndex = 0x15; // Lowered water level
}
} else if (play->sceneNum == SCENE_GERUDO_VALLEY) {
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
extendedMapIndex = 0x16;
extendedMapIndex = 0x16; // Bridge not built
}
} else if (play->sceneNum == SCENE_GERUDOS_FORTRESS) {
if ((!IS_RANDO && GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) ||
(IS_RANDO && CHECK_QUEST_ITEM(QUEST_GERUDO_CARD))) {
extendedMapIndex = 0x17;
extendedMapIndex = 0x17; // Horseback archery visible
}
}
osSyncPrintf(VT_FGCOL(BLUE));
@@ -206,8 +206,11 @@ void BgSpot06Objects_Destroy(Actor* thisx, PlayState* play) {
break;
}
// Due to Ships resource caching, the water box collisions for the river have to be manually reset
// Due to Ships resource caching, the water boxes have to be manually reset
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_RAISED;
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin = WATER_LEVEL_RIVER_LOWER_Z;
play->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = WATER_LEVEL_RAISED;
play->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = WATER_LEVEL_RAISED;
}
/**
@@ -509,17 +512,8 @@ void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, PlayState* pl
if (this->lakeHyliaWaterLevel >= 0.0001f) {
this->dyna.actor.world.pos.y = WATER_LEVEL_RAISED;
this->actionFunc = BgSpot06Objects_DoNothing;
// On rando, this is used with the water control system switch to finalize raising the water
if (IS_RANDO) {
this->lakeHyliaWaterLevel = 0;
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_RAISED;
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin = WATER_LEVEL_RIVER_LOWER_Z;
Flags_SetEventChkInf(EVENTCHKINF_RAISED_LAKE_HYLIA_WATER); // Set the "raise lake hylia water" flag
play->roomCtx.unk_74[0] = 0; // Apply the moving under water texture to lake hylia ground
}
} else {
Math_SmoothStepToF(&this->lakeHyliaWaterLevel, 1.0f, 0.1f, IS_RANDO ? 10.0f : 1.0f, 0.001f);
Math_SmoothStepToF(&this->lakeHyliaWaterLevel, 1.0f, 0.1f, 1.0f, 0.001f);
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED;
play->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = this->dyna.actor.world.pos.y;
play->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = this->dyna.actor.world.pos.y;
@@ -529,32 +523,51 @@ void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, PlayState* pl
}
/**
* Custom action func to lower the Laker Hylia water plane from a switch.
* SoH: Randomizer, custom action function to raise the Laker Hylia water plane from a switch.
*/
void BgSpot06Objects_WaterPlaneCutsceneLower(BgSpot06Objects* this, PlayState* play) {
f32 yPos = this->dyna.actor.world.pos.y = this->lakeHyliaWaterLevel + WATER_LEVEL_RAISED;
void BgSpot06Objects_WaterControl_Raise(BgSpot06Objects* this, PlayState* play) {
this->dyna.actor.world.pos.y = this->lakeHyliaWaterLevel + WATER_LEVEL_RAISED;
// A slightly smaller number thatn -680 (which is when textures change)
if (this->lakeHyliaWaterLevel >= 0.0001f) {
this->dyna.actor.world.pos.y = WATER_LEVEL_RAISED;
this->actionFunc = BgSpot06Objects_DoNothing;
this->lakeHyliaWaterLevel = 0;
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_RAISED;
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin = WATER_LEVEL_RIVER_LOWER_Z;
play->roomCtx.unk_74[0] = 0; // Apply the moving under water texture to Lake Hylia ground
} else {
Math_SmoothStepToF(&this->lakeHyliaWaterLevel, 1.0f, 0.1f, 10.0f, 0.001f);
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED;
play->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = this->dyna.actor.world.pos.y;
play->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = this->dyna.actor.world.pos.y;
Actor_PlaySfx_FlaggedCentered2(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
}
}
/**
* SoH: Randomizer, custom action function to lower the Laker Hylia water plane from a switch.
*/
void BgSpot06Objects_WaterControl_Lower(BgSpot06Objects* this, PlayState* play) {
f32 yPos = this->dyna.actor.world.pos.y = this->lakeHyliaWaterLevel + WATER_LEVEL_RAISED;
play->roomCtx.unk_74[0] = 87; // Remove the moving under water texture from Lake Hylia ground
// A slightly smaller number than -680.0f (which is when surface textures change)
// Then we change the position since the "low water" texture has a different height
if (this->lakeHyliaWaterLevel <= -679.9f) {
this->dyna.actor.world.pos.y = (this->lakeHyliaWaterLevel + 680.0f) + WATER_LEVEL_RAISED;
}
Flags_UnsetEventChkInf(EVENTCHKINF_RAISED_LAKE_HYLIA_WATER); // Unset the "raised lake hylia water" flag
play->roomCtx.unk_74[0] = 87; // Remove the moving under water texture from lake hylia ground
if (this->lakeHyliaWaterLevel <= -681.0f) {
this->lakeHyliaWaterLevel = -681.0f;
this->dyna.actor.world.pos.y = WATER_LEVEL_RAISED;
this->actionFunc = BgSpot06Objects_DoNothing;
} else {
// Go slightly beyond -681 so the smoothing doesn't slow down too much (matches the reverse of water rise func)
// Go slightly beyond -681.0f so the smoothing doesn't slow down too much (matches the reverse of water rise
// func)
Math_SmoothStepToF(&this->lakeHyliaWaterLevel, -682.0f, 0.1f, 10.0f, 0.01f);
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED;
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].zMin = WATER_LEVEL_RIVER_LOWER_Z - 50;
play->colCtx.colHeader->waterBoxes[LHWB_MAIN_1].ySurface = yPos;
play->colCtx.colHeader->waterBoxes[LHWB_MAIN_2].ySurface = yPos;
Actor_PlaySfx_FlaggedCentered2(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
}
Actor_PlaySfx_FlaggedCentered2(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
}