summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Longstaff <JordanLongstaff@users.noreply.github.com>2026-04-10 19:51:38 -0400
committerGitHub <noreply@github.com>2026-04-10 23:51:38 +0000
commitb2f0cae9ecd5ce62e4c2bff42b69d04a9f7b4a68 (patch)
tree6b7d160ca36b48ffa21d4f4b2eb1c6da103c4056
parent06b512faa95f4b71ec57089c57331d7d796288dc (diff)
Added slider for Rupee Diving Game's time limit (#6476)
-rw-r--r--soh/soh/Enhancements/Difficulty/DivingGameTimer.cpp21
-rw-r--r--soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h8
-rw-r--r--soh/soh/SohGui/SohMenuEnhancements.cpp5
-rw-r--r--soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c10
4 files changed, 40 insertions, 4 deletions
diff --git a/soh/soh/Enhancements/Difficulty/DivingGameTimer.cpp b/soh/soh/Enhancements/Difficulty/DivingGameTimer.cpp
new file mode 100644
index 000000000..ff5e717aa
--- /dev/null
+++ b/soh/soh/Enhancements/Difficulty/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/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h
index aba9f1e68..06eff69cb 100644
--- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h
+++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h
@@ -2054,6 +2054,14 @@ typedef enum {
// #### `result`
// ```c
+ // true
+ // ```
+ // #### `args`
+ // - None
+ VB_SET_DIVING_GAME_TIME_LIMIT,
+
+ // #### `result`
+ // ```c
// SurfaceType_GetSlope(&play->colCtx, poly, bgId) == 2
// ```
// #### `args`
diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp
index c8e6c34d4..461d2ca23 100644
--- a/soh/soh/SohGui/SohMenuEnhancements.cpp
+++ b/soh/soh/SohGui/SohMenuEnhancements.cpp
@@ -1523,6 +1523,11 @@ void SohMenu::AddMenuEnhancements() {
.Options(CheckboxOptions().Tooltip("Amy's block pushing puzzle instantly solved."));
path.column = SECTION_COLUMN_3;
+ AddWidget(path, "Rupee Diving Game", WIDGET_SEPARATOR_TEXT);
+ AddWidget(path, "Time Limit: %d seconds", WIDGET_CVAR_SLIDER_INT)
+ .CVar(CVAR_ENHANCEMENT("DivingGame.TimeLimit"))
+ .Options(IntSliderOptions().Min(30).Max(120).DefaultValue(50).Format("%d seconds"));
+
AddWidget(path, "Fishing", WIDGET_SEPARATOR_TEXT);
AddWidget(path, "Customize Behavior##Fishing", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_ENHANCEMENT("CustomizeFishing"))
diff --git a/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c
index 194e09fd3..cd1a14f1f 100644
--- a/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c
+++ b/soh/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c
@@ -424,10 +424,12 @@ void func_809EE800(EnDivingGame* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
- if (!Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_SILVER_SCALE)) {
- Interface_SetTimer(BREG(2) + 50);
- } else {
- Interface_SetTimer(BREG(2) + 50);
+ if (GameInteractor_Should(VB_SET_DIVING_GAME_TIME_LIMIT, true)) {
+ if (!Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_SILVER_SCALE)) {
+ Interface_SetTimer(BREG(2) + 50);
+ } else {
+ Interface_SetTimer(BREG(2) + 50);
+ }
}
func_800F5ACC(NA_BGM_TIMED_MINI_GAME);
Player_SetCsActionWithHaltedActors(play, NULL, 7);