Difficulty: FireTimerMultiplier

Introduces slider to adjust timer on fire walls resetting switches
This commit is contained in:
Demur Rumed 2025-06-02 05:20:18 +00:00
commit 8f671375f7
5 changed files with 47 additions and 3 deletions

View file

@ -0,0 +1,24 @@
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"
extern "C" {
extern PlayState* gPlayState;
}
void RegisterFireTimerMultiplier() {
COND_VB_SHOULD(VB_FIRE_TIMER_TICK, CVarGetInteger(CVAR_ENHANCEMENT("FireTimerMultiplier"), 0) != 0, {
int factor = CVarGetInteger(CVAR_ENHANCEMENT("FireTimerMultiplier"), 0);
if (factor != 0) {
if (factor > 0 && gPlayState->gameplayFrames % (factor + 1) != 0) {
*should = false;
} else if (gPlayState->gameplayFrames % (6 + factor) == 0) {
s16* timer = va_arg(args, s16*);
if (*timer != 0) {
*timer--;
}
}
}
});
}
static RegisterShipInitFunc initFunc(RegisterFireTimerMultiplier, { CVAR_ENHANCEMENT("FireTimerMultiplier") });

View file

@ -527,6 +527,14 @@ typedef enum {
// - `*EnElf`
VB_FAIRY_HEAL,
// #### `result`
// ```c
// true
// ```
// #### `args`
// - `*s16`
VB_FIRE_TIMER_TICK,
// #### `result`
// ```c
// false

View file

@ -1123,6 +1123,10 @@ void SohMenu::AddMenuEnhancements() {
.Options(CheckboxOptions().Tooltip("Dying will delete your file.\n\n" ICON_FA_EXCLAMATION_TRIANGLE
" WARNING " ICON_FA_EXCLAMATION_TRIANGLE
"\nTHIS IS NOT REVERSIBLE!\nUSE AT YOUR OWN RISK!"));
AddWidget(path, "Fire Timer Multiplier", WIDGET_CVAR_SLIDER_INT)
.CVar(CVAR_ENHANCEMENT("FireTimerMultiplier"))
.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"));
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."));

View file

@ -6,6 +6,7 @@
#include "z_bg_hidan_curtain.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED
@ -191,7 +192,10 @@ void BgHidanCurtain_TurnOff(BgHidanCurtain* this, PlayState* play) {
}
void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, PlayState* play) {
if (GameInteractor_Should(VB_FIRE_TIMER_TICK, true, &this->timer)) {
DECR(this->timer);
}
if (this->timer == 0) {
this->actionFunc = BgHidanCurtain_TurnOn;
}

View file

@ -8,6 +8,7 @@
#include "z_bg_hidan_fwbig.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_hidan_objects/object_hidan_objects.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED
@ -165,9 +166,12 @@ void BgHidanFwbig_Lower(BgHidanFwbig* this, PlayState* play) {
}
void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, PlayState* play) {
if (GameInteractor_Should(VB_FIRE_TIMER_TICK, true, &this->timer)) {
if (this->timer != 0) {
this->timer--;
}
}
if (this->timer == 0) {
this->actionFunc = BgHidanFwbig_Rise;
}