From 3a60c3f6513a0bd68015e7bd282cda6039a8d061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Thu, 5 Jun 2025 00:08:36 +0000 Subject: [PATCH] SkipAmyPuzzle (#5550) --- soh/soh/Enhancements/SkipAmyPuzzle.cpp | 8 ++++++++ .../game-interactor/vanilla-behavior/GIVanillaBehavior.h | 8 ++++++++ soh/soh/SohGui/SohMenuEnhancements.cpp | 5 +++++ soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c | 4 +++- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 soh/soh/Enhancements/SkipAmyPuzzle.cpp diff --git a/soh/soh/Enhancements/SkipAmyPuzzle.cpp b/soh/soh/Enhancements/SkipAmyPuzzle.cpp new file mode 100644 index 000000000..27486e04c --- /dev/null +++ b/soh/soh/Enhancements/SkipAmyPuzzle.cpp @@ -0,0 +1,8 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +void RegisterSkipAmyPuzzle() { + COND_VB_SHOULD(VB_AMY_SOLVE, CVarGetInteger(CVAR_ENHANCEMENT("SkipAmyPuzzle"), 0), { *should = true; }); +} + +static RegisterShipInitFunc initFunc(RegisterSkipAmyPuzzle, { CVAR_ENHANCEMENT("SkipAmyPuzzle") }); \ No newline at end of file diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index c2b8c1756..fea114198 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -20,6 +20,14 @@ typedef enum { // - `int32_t` (entrance index) (promoted from `uint16_t` by va_arg) VB_ALLOW_ENTRANCE_CS_FOR_EITHER_AGE, + // #### `result` + // ```c + // sBgPoEventPuzzleState == 0xF + // ``` + // #### `args` + // - None + VB_AMY_SOLVE, + // #### `result` // ```c // this->actor.textId == 0x401A diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index de3bb6be8..3ffa9cfed 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -1312,6 +1312,11 @@ void SohMenu::AddMenuEnhancements() { .Format("%d notes") .Tooltip("Adjust the number of notes you need to play to end the third round.")); + AddWidget(path, "Forest Temple", WIDGET_SEPARATOR_TEXT); + AddWidget(path, "Solve Amy's Puzzle", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("SkipAmyPuzzle")) + .Options(CheckboxOptions().Tooltip("Amy's block pushing puzzle instantly solved.")); + path.column = SECTION_COLUMN_3; AddWidget(path, "Fishing", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Customize Behavior##Fishing", WIDGET_CVAR_CHECKBOX) diff --git a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index 88f4c7c12..ae9c9ab21 100644 --- a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -6,6 +6,8 @@ #include "z_bg_po_event.h" #include "objects/object_po_sisters/object_po_sisters.h" +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS 0 @@ -333,7 +335,7 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) { Player* player = GET_PLAYER(play); Actor* amy; - if (sBgPoEventPuzzleState == 0xF) { + if (GameInteractor_Should(VB_AMY_SOLVE, sBgPoEventPuzzleState == 0xF)) { this->actionFunc = BgPoEvent_BlockSolved; if ((this->type == 0) && (this->index == 0)) { amy = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->dyna.actor.world.pos.x + 30.0f,