summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Dubé <159546+serprex@users.noreply.github.com>2026-10-12 20:47:51 +0000
committerGitHub <noreply@github.com>2026-10-12 20:47:51 +0000
commita93fec263473b2b08ebb18590a8ef1a3fc25a775 (patch)
treeff47bdcaa1dbe06426ece6f755f1b47994489281
parent12d8fad5a1bbf5d66cde2265a420e9c49c54c284 (diff)
Add setting to limit minimum heat/water timer (#7373)
Useful with rando settings where player never gets more than 3 hearts
-rw-r--r--soh/soh/Enhancements/Difficulty/HazardTimerMin.cpp21
-rw-r--r--soh/soh/SohGui/SohMenuEnhancements.cpp8
2 files changed, 29 insertions, 0 deletions
diff --git a/soh/soh/Enhancements/Difficulty/HazardTimerMin.cpp b/soh/soh/Enhancements/Difficulty/HazardTimerMin.cpp
new file mode 100644
index 000000000..9613e7a95
--- /dev/null
+++ b/soh/soh/Enhancements/Difficulty/HazardTimerMin.cpp
@@ -0,0 +1,21 @@
+#include <libultraship/bridge/consolevariablebridge.h>
+
+#include "soh/Enhancements/game-interactor/GameInteractor.h"
+#include "soh/ShipInit.hpp"
+
+extern "C" {
+#include "variables.h"
+}
+
+#define CVAR_HAZARD_TIMER_MIN_NAME CVAR_ENHANCEMENT("HazardTimerMin")
+#define CVAR_HAZARD_TIMER_MIN_VALUE CVarGetInteger(CVAR_HAZARD_TIMER_MIN_NAME, 0)
+
+static void RegisterHazardTimerMin() {
+ COND_HOOK(OnGameFrameUpdate, CVAR_HAZARD_TIMER_MIN_VALUE, []() {
+ if (GameInteractor::IsSaveLoaded() && gSaveContext.timerState == TIMER_STATE_ENV_HAZARD_PREVIEW) {
+ gSaveContext.timerSeconds = std::max<int16_t>(gSaveContext.timerSeconds, CVAR_HAZARD_TIMER_MIN_VALUE);
+ }
+ });
+}
+
+static RegisterShipInitFunc initFunc(RegisterHazardTimerMin, { CVAR_HAZARD_TIMER_MIN_NAME });
diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp
index 759e0605a..acdfd6ebd 100644
--- a/soh/soh/SohGui/SohMenuEnhancements.cpp
+++ b/soh/soh/SohGui/SohMenuEnhancements.cpp
@@ -1516,6 +1516,14 @@ void SohMenu::AddMenuEnhancements() {
.Options(IntSliderOptions().Min(-5).Max(5).DefaultValue(0).Format("%+d").Tooltip(
"-5 will be half as much time, +5 will be 6x as much time. Affects timed switches, torches, GTG statue "
"eyes, & doors in race with Dampe."));
+ AddWidget(path, "Minimum Heat/Water Timer: %d seconds", WIDGET_CVAR_SLIDER_INT)
+ .CVar(CVAR_ENHANCEMENT("HazardTimerMin"))
+ .Options(IntSliderOptions()
+ .Min(0)
+ .Max(150)
+ .DefaultValue(0)
+ .Format("%d seconds")
+ .Tooltip("Limits how low heat timer or underwater timer can start."));
AddWidget(path, "Always Win Goron Pot", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_ENHANCEMENT("GoronPot"))
.Options(CheckboxOptions().Tooltip("Always get the Heart Piece/Purple Rupee from the Spinning Goron Pot."));