From af8cac9e6bfd39e92abc8dd3637fc64bda32193b Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Thu, 23 Jul 2026 17:55:37 -0400 Subject: Move minigame hooks into Minigames folder (#6973) --- .../Enhancements/Difficulty/DivingGameTimer.cpp | 21 ---------- .../Enhancements/Difficulty/HorsebackArchery.cpp | 45 ---------------------- soh/soh/Enhancements/Minigames/DivingGameTimer.cpp | 21 ++++++++++ .../Enhancements/Minigames/HorsebackArchery.cpp | 45 ++++++++++++++++++++++ soh/soh/Enhancements/Minigames/SkipAmyPuzzle.cpp | 15 ++++++++ soh/soh/Enhancements/TimeSavers/SkipAmyPuzzle.cpp | 15 -------- 6 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 soh/soh/Enhancements/Difficulty/DivingGameTimer.cpp delete mode 100644 soh/soh/Enhancements/Difficulty/HorsebackArchery.cpp create mode 100644 soh/soh/Enhancements/Minigames/DivingGameTimer.cpp create mode 100644 soh/soh/Enhancements/Minigames/HorsebackArchery.cpp create mode 100644 soh/soh/Enhancements/Minigames/SkipAmyPuzzle.cpp delete mode 100644 soh/soh/Enhancements/TimeSavers/SkipAmyPuzzle.cpp diff --git a/soh/soh/Enhancements/Difficulty/DivingGameTimer.cpp b/soh/soh/Enhancements/Difficulty/DivingGameTimer.cpp deleted file mode 100644 index ff5e717aa..000000000 --- a/soh/soh/Enhancements/Difficulty/DivingGameTimer.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" -#include "soh/ShipInit.hpp" - -extern "C" { -#include "functions.h" -extern GameInfo* gGameInfo; -} - -static constexpr int32_t CVAR_DIVING_GAME_TIME_DEFAULT = 50; -#define CVAR_DIVING_GAME_TIME_NAME CVAR_ENHANCEMENT("DivingGame.TimeLimit") -#define CVAR_DIVING_GAME_TIME_VALUE CVarGetInteger(CVAR_DIVING_GAME_TIME_NAME, CVAR_DIVING_GAME_TIME_DEFAULT) -#define CVAR_DIVING_GAME_TIME_SET (CVAR_DIVING_GAME_TIME_VALUE != CVAR_DIVING_GAME_TIME_DEFAULT) - -static void RegisterDIvingGameTimeLimit() { - COND_VB_SHOULD(VB_SET_DIVING_GAME_TIME_LIMIT, CVAR_DIVING_GAME_TIME_SET, { - Interface_SetTimer(BREG(2) + CVAR_DIVING_GAME_TIME_VALUE); - *should = false; - }); -} - -static RegisterShipInitFunc initFunc(RegisterDIvingGameTimeLimit, { CVAR_DIVING_GAME_TIME_NAME }); diff --git a/soh/soh/Enhancements/Difficulty/HorsebackArchery.cpp b/soh/soh/Enhancements/Difficulty/HorsebackArchery.cpp deleted file mode 100644 index f268a5b17..000000000 --- a/soh/soh/Enhancements/Difficulty/HorsebackArchery.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" -#include "soh/ShipInit.hpp" - -extern "C" { -#include "functions.h" -#include "src/overlays/actors/ovl_En_Ge1/z_en_ge1.h" -extern SaveContext gSaveContext; - -extern void EnGe1_TalkAfterGame_Archery(EnGe1* enGe1, PlayState* play); -} - -static void RegisterHorsebackArcheryEnhancements() { - COND_VB_SHOULD(VB_PLAY_HORSEBACK_ARCHERY, - CVarGetInteger(CVAR_ENHANCEMENT("CustomizeHorsebackArchery"), 0) && - CVarGetInteger(CVAR_ENHANCEMENT("InstantHorsebackArcheryWin"), 0), - { - EnGe1* enGe1 = va_arg(args, EnGe1*); - PlayState* play = va_arg(args, PlayState*); - Rupees_ChangeBy(-20); - Flags_SetEventChkInf(EVENTCHKINF_PLAYED_HORSEBACK_ARCHERY); - gSaveContext.minigameScore = 1500; - Message_CloseTextbox(play); - enGe1->actionFunc = EnGe1_TalkAfterGame_Archery; - *should = false; - }); - - COND_VB_SHOULD(VB_SCORE_HORSEBACK_ARCHERY_TARGET, - CVarGetInteger(CVAR_ENHANCEMENT("CustomizeHorsebackArchery"), 0) && - CVarGetInteger(CVAR_ENHANCEMENT("HorsebackArcheryAlwaysScore"), 0), - { - s32* scoreIndex = va_arg(args, s32*); - *scoreIndex = 2; // inner ring = 100 points - }); - - COND_VB_SHOULD(VB_SET_HORSEBACK_ARCHERY_AMMO, CVarGetInteger(CVAR_ENHANCEMENT("CustomizeHorsebackArchery"), 0), { - InterfaceContext* interfaceCtx = va_arg(args, InterfaceContext*); - interfaceCtx->hbaAmmo = CVarGetInteger(CVAR_ENHANCEMENT("HorsebackArcheryAmmo"), 20); - *should = false; - }); -} - -static RegisterShipInitFunc - initFunc(RegisterHorsebackArcheryEnhancements, - { CVAR_ENHANCEMENT("CustomizeHorsebackArchery"), CVAR_ENHANCEMENT("InstantHorsebackArcheryWin"), - CVAR_ENHANCEMENT("HorsebackArcheryAlwaysScore"), CVAR_ENHANCEMENT("HorsebackArcheryAmmo") }); diff --git a/soh/soh/Enhancements/Minigames/DivingGameTimer.cpp b/soh/soh/Enhancements/Minigames/DivingGameTimer.cpp new file mode 100644 index 000000000..ff5e717aa --- /dev/null +++ b/soh/soh/Enhancements/Minigames/DivingGameTimer.cpp @@ -0,0 +1,21 @@ +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "functions.h" +extern GameInfo* gGameInfo; +} + +static constexpr int32_t CVAR_DIVING_GAME_TIME_DEFAULT = 50; +#define CVAR_DIVING_GAME_TIME_NAME CVAR_ENHANCEMENT("DivingGame.TimeLimit") +#define CVAR_DIVING_GAME_TIME_VALUE CVarGetInteger(CVAR_DIVING_GAME_TIME_NAME, CVAR_DIVING_GAME_TIME_DEFAULT) +#define CVAR_DIVING_GAME_TIME_SET (CVAR_DIVING_GAME_TIME_VALUE != CVAR_DIVING_GAME_TIME_DEFAULT) + +static void RegisterDIvingGameTimeLimit() { + COND_VB_SHOULD(VB_SET_DIVING_GAME_TIME_LIMIT, CVAR_DIVING_GAME_TIME_SET, { + Interface_SetTimer(BREG(2) + CVAR_DIVING_GAME_TIME_VALUE); + *should = false; + }); +} + +static RegisterShipInitFunc initFunc(RegisterDIvingGameTimeLimit, { CVAR_DIVING_GAME_TIME_NAME }); diff --git a/soh/soh/Enhancements/Minigames/HorsebackArchery.cpp b/soh/soh/Enhancements/Minigames/HorsebackArchery.cpp new file mode 100644 index 000000000..f268a5b17 --- /dev/null +++ b/soh/soh/Enhancements/Minigames/HorsebackArchery.cpp @@ -0,0 +1,45 @@ +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "functions.h" +#include "src/overlays/actors/ovl_En_Ge1/z_en_ge1.h" +extern SaveContext gSaveContext; + +extern void EnGe1_TalkAfterGame_Archery(EnGe1* enGe1, PlayState* play); +} + +static void RegisterHorsebackArcheryEnhancements() { + COND_VB_SHOULD(VB_PLAY_HORSEBACK_ARCHERY, + CVarGetInteger(CVAR_ENHANCEMENT("CustomizeHorsebackArchery"), 0) && + CVarGetInteger(CVAR_ENHANCEMENT("InstantHorsebackArcheryWin"), 0), + { + EnGe1* enGe1 = va_arg(args, EnGe1*); + PlayState* play = va_arg(args, PlayState*); + Rupees_ChangeBy(-20); + Flags_SetEventChkInf(EVENTCHKINF_PLAYED_HORSEBACK_ARCHERY); + gSaveContext.minigameScore = 1500; + Message_CloseTextbox(play); + enGe1->actionFunc = EnGe1_TalkAfterGame_Archery; + *should = false; + }); + + COND_VB_SHOULD(VB_SCORE_HORSEBACK_ARCHERY_TARGET, + CVarGetInteger(CVAR_ENHANCEMENT("CustomizeHorsebackArchery"), 0) && + CVarGetInteger(CVAR_ENHANCEMENT("HorsebackArcheryAlwaysScore"), 0), + { + s32* scoreIndex = va_arg(args, s32*); + *scoreIndex = 2; // inner ring = 100 points + }); + + COND_VB_SHOULD(VB_SET_HORSEBACK_ARCHERY_AMMO, CVarGetInteger(CVAR_ENHANCEMENT("CustomizeHorsebackArchery"), 0), { + InterfaceContext* interfaceCtx = va_arg(args, InterfaceContext*); + interfaceCtx->hbaAmmo = CVarGetInteger(CVAR_ENHANCEMENT("HorsebackArcheryAmmo"), 20); + *should = false; + }); +} + +static RegisterShipInitFunc + initFunc(RegisterHorsebackArcheryEnhancements, + { CVAR_ENHANCEMENT("CustomizeHorsebackArchery"), CVAR_ENHANCEMENT("InstantHorsebackArcheryWin"), + CVAR_ENHANCEMENT("HorsebackArcheryAlwaysScore"), CVAR_ENHANCEMENT("HorsebackArcheryAmmo") }); diff --git a/soh/soh/Enhancements/Minigames/SkipAmyPuzzle.cpp b/soh/soh/Enhancements/Minigames/SkipAmyPuzzle.cpp new file mode 100644 index 000000000..72110c3f4 --- /dev/null +++ b/soh/soh/Enhancements/Minigames/SkipAmyPuzzle.cpp @@ -0,0 +1,15 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "functions.h" +#include "z64save.h" +extern SaveContext gSaveContext; +} + +void RegisterSkipAmyPuzzle() { + COND_VB_SHOULD(VB_AMY_SOLVE, CVarGetInteger(CVAR_ENHANCEMENT("SkipAmyPuzzle"), 0), + { *should = !IS_RANDO || Flags_GetRandomizerInf(RAND_INF_CAN_GRAB); }); +} + +static RegisterShipInitFunc initFunc(RegisterSkipAmyPuzzle, { CVAR_ENHANCEMENT("SkipAmyPuzzle") }); \ No newline at end of file diff --git a/soh/soh/Enhancements/TimeSavers/SkipAmyPuzzle.cpp b/soh/soh/Enhancements/TimeSavers/SkipAmyPuzzle.cpp deleted file mode 100644 index 72110c3f4..000000000 --- a/soh/soh/Enhancements/TimeSavers/SkipAmyPuzzle.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "soh/Enhancements/game-interactor/GameInteractor.h" -#include "soh/ShipInit.hpp" - -extern "C" { -#include "functions.h" -#include "z64save.h" -extern SaveContext gSaveContext; -} - -void RegisterSkipAmyPuzzle() { - COND_VB_SHOULD(VB_AMY_SOLVE, CVarGetInteger(CVAR_ENHANCEMENT("SkipAmyPuzzle"), 0), - { *should = !IS_RANDO || Flags_GetRandomizerInf(RAND_INF_CAN_GRAB); }); -} - -static RegisterShipInitFunc initFunc(RegisterSkipAmyPuzzle, { CVAR_ENHANCEMENT("SkipAmyPuzzle") }); \ No newline at end of file -- cgit v1.2.3