diff --git a/soh/soh/Enhancements/Fixes/GoronCityDoorFix.cpp b/soh/soh/Enhancements/Fixes/GoronCityDoorFix.cpp new file mode 100644 index 00000000000..3e10a74e7a9 --- /dev/null +++ b/soh/soh/Enhancements/Fixes/GoronCityDoorFix.cpp @@ -0,0 +1,28 @@ +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "functions.h" +#include "macros.h" +#include "variables.h" +#include "z64save.h" +} + +static constexpr int32_t CVAR_GC_DOOR_FIX_DEFAULT = 0; +#define CVAR_GC_DOOR_FIX_NAME CVAR_ENHANCEMENT("GCDoorsAfterFireFix") +#define CVAR_GC_DOOR_FIX_VALUE CVarGetInteger(CVAR_GC_DOOR_FIX_NAME, CVAR_GC_DOOR_FIX_DEFAULT) + +static void OnInitGCDoor(void* refActor) { + // In the off chance that Fire Temple is completed before stopping Goron Link and getting + // Goron Tunic / opening the city doors, open them the next time Link goes to Goron City. + if (GameInteractor_Should(VB_GORONS_CONSIDER_FIRE_TEMPLE_FINISHED, CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) && + !Flags_GetInfTable(INFTABLE_GORON_CITY_DOORS_UNLOCKED)) { + Flags_SetInfTable(INFTABLE_GORON_CITY_DOORS_UNLOCKED); + } +} + +void RegisterGoronTunicFix() { + COND_ID_HOOK(OnActorInit, ACTOR_BG_SPOT18_SHUTTER, !IS_RANDO && CVAR_GC_DOOR_FIX_VALUE, OnInitGCDoor); +} + +static RegisterShipInitFunc initFunc(RegisterGoronTunicFix, { CVAR_GC_DOOR_FIX_NAME, "IS_RANDO" }); \ No newline at end of file diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 359cac3dc91..017676b7ca9 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -1006,6 +1006,11 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("AnubisFix")) .Options(CheckboxOptions().Tooltip( "Make Anubis Fireballs do Fire damage when reflected back at them with the Mirror Shield.")); + AddWidget(path, "Fix Goron City Doors After Fire Temple", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("GCDoorsAfterFireFix")) + .Options(CheckboxOptions().Tooltip( + "Forces Goron City doors open if you somehow complete Fire Temple without talking to Goron Link " + " and receiving the Goron Tunic.")); AddWidget(path, "Item-related Fixes", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Fix Deku Nut Upgrade", WIDGET_CVAR_CHECKBOX)