diff --git a/soh/soh/Enhancements/Fixes/FixDekuScrubFlowerFlash.cpp b/soh/soh/Enhancements/Fixes/FixDekuScrubFlowerFlash.cpp new file mode 100644 index 00000000000..9f8a4614bd6 --- /dev/null +++ b/soh/soh/Enhancements/Fixes/FixDekuScrubFlowerFlash.cpp @@ -0,0 +1,28 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h" +} + +#define CVAR_DEKU_SCRUB_FLOWER_FLASH_FIX_NAME CVAR_ENHANCEMENT("FixDekuScrubFlowerFlash") +#define CVAR_DEKU_SCRUB_FLOWER_FLASH_FIX_VALUE CVarGetInteger(CVAR_DEKU_SCRUB_FLOWER_FLASH_FIX_NAME, 0) + +// https://github.com/HarbourMasters/Shipwright/issues/2796 +// +// En_Dnt_Nomal enables its draw function in WaitForObject but doesn't set flowerPos until SetFlower (which waits for +// ground contact). Both draw functions use flowerPos with MTXMODE_NEW, so the flower renders at the zero-initialized +// origin for the intervening frames. +// +// Defaulting flowerPos to the actor's spawn position closes the gap. + +static void FixDekuScrubFlowerFlash(void* actorRef) { + const auto enDntNomal = static_cast(actorRef); + enDntNomal->flowerPos = enDntNomal->actor.world.pos; +} + +static void RegisterFixDekuScrubFlowerFlash() { + COND_ID_HOOK(OnActorInit, ACTOR_EN_DNT_NOMAL, CVAR_DEKU_SCRUB_FLOWER_FLASH_FIX_VALUE, FixDekuScrubFlowerFlash); +} + +static RegisterShipInitFunc initFunc(RegisterFixDekuScrubFlowerFlash, { CVAR_DEKU_SCRUB_FLOWER_FLASH_FIX_NAME }); \ No newline at end of file diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index fc4f9f95c80..b9a54547840 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -1136,6 +1136,10 @@ void SohMenu::AddMenuEnhancements() { .RaceDisable(false) .Options(CheckboxOptions().Tooltip( "Fixes Adult Link having a backwards Left hand when holding the Megaton Hammer.")); + AddWidget(path, "Fix Deku Scrub Flower Flash", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("FixDekuScrubFlowerFlash")) + .Options(CheckboxOptions().Tooltip( + "Fixes the Deku Scrub flower flashing briefly at the Lost Woods entrance.")); AddWidget(path, "Fix Vanishing Paths", WIDGET_CVAR_COMBOBOX) .CVar(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix")) .RaceDisable(false)