From dab070a8a138e3fb0b04dbd3ff81a7f4b7794d9b Mon Sep 17 00:00:00 2001 From: Andrew Van Caem Date: Tue, 31 Oct 2023 02:55:02 +1100 Subject: [PATCH] Added 'Fix enemies not spawning near water' checkbox to Fixes (#3179) --- soh/soh/Enhancements/presets.h | 3 +++ soh/soh/SohMenuBar.cpp | 3 +++ soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index ddbee3871..b113c705a 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -216,6 +216,7 @@ const std::vector enhancementsCvars = { "gBowReticle", "gFixTexturesOOB", "gIvanCoopModeEnabled", + "gEnemySpawnsOverWaterboxes", }; const std::vector cheatCvars = { @@ -523,6 +524,8 @@ const std::vector enhancedPresetEntries = { PRESET_ENTRY_S32("gNaviTextFix", 1), // Extend Silver Rupee Jingle PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), + // Fix enemies not spawning on ground over water + PRESET_ENTRY_S32("gEnemySpawnsOverWaterboxes", 1), // Red Ganon blood PRESET_ENTRY_S32("gRedGanonBlood", 1), diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 0dd87bd82..2a52006a4 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1042,6 +1042,9 @@ void DrawEnhancementsMenu() { UIWidgets::PaddedEnhancementCheckbox("Fix Poacher's Saw Softlock", "gFixSawSoftlock", true, false, CVarGetInteger("gSkipText", 0), "This is disabled because it is forced on when Skip Text is enabled.", UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Prevents the Poacher's Saw softlock from mashing through the text, or with Skip Text enabled."); + UIWidgets::PaddedEnhancementCheckbox("Fix enemies not spawning near water", "gEnemySpawnsOverWaterboxes", true, false); + UIWidgets::Tooltip("Causes respawning enemies, like stalchildren, to appear on land near bodies of water. " + "Fixes an incorrect calculation that acted like water underneath ground was above it."); UIWidgets::PaddedEnhancementCheckbox("Fix Bush Item Drops", "gBushDropFix", true, false); UIWidgets::Tooltip("Fixes the bushes to drop items correctly rather than spawning undefined items."); diff --git a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 9cbd8b8ca..2d05c116c 100644 --- a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -278,7 +278,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) { break; } if ((player->actor.yDistToWater != BGCHECK_Y_MIN) && - (floorY < (player->actor.world.pos.y - player->actor.yDistToWater))) { + (floorY < (player->actor.world.pos.y + player->actor.yDistToWater*(CVarGetInteger("gEnemySpawnsOverWaterboxes", 0) ? 1 : -1)))) { break; } spawnPos.y = floorY;