mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-10-13 07:25:54 -04:00
Add setting to limit minimum heat/water timer (#7373)
Useful with rando settings where player never gets more than 3 hearts
This commit is contained in:
@@ -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 });
|
||||
@@ -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."));
|
||||
|
||||
Reference in New Issue
Block a user