Files
Shipwright/soh/soh/Enhancements/SwitchTimerMultiplier.cpp
T
Philip Dubé 330e64180c Difficulty: SwitchTimerMultiplier (#5555)
* Difficulty: FireTimerMultiplier

Introduces slider to adjust timer on fire walls resetting switches

* rename, add more timers

* also shadow trial, dampe race, deku water

* avoid decrementing timer to 0, which with BgMizu can cause timer to go below 0 & break

* gtg eye statue

* also scale torches

* tooltip

* Limit difficulty: torches stop at -3 & shadow temple torch puzzle stops at -4

* put timer condition as should when convenient
2025-06-15 10:19:58 -07:00

30 lines
1.1 KiB
C++

#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"
extern "C" {
extern PlayState* gPlayState;
}
void RegisterSwitchTimerMultiplier() {
COND_VB_SHOULD(VB_SWITCH_TIMER_TICK, CVarGetInteger(CVAR_ENHANCEMENT("SwitchTimerMultiplier"), 0) != 0, {
int multiplier = CVarGetInteger(CVAR_ENHANCEMENT("SwitchTimerMultiplier"), 0);
if (multiplier != 0) {
Actor* actor = va_arg(args, Actor*);
if (multiplier < -3 && actor->id == ACTOR_OBJ_SYOKUDAI) {
multiplier = -3;
} else if (multiplier < -4 && actor->id == ACTOR_BG_GND_DARKMEIRO) {
multiplier = -4;
}
if (multiplier > 0 && gPlayState->gameplayFrames % (multiplier + 1) != 0) {
*should = false;
} else if (gPlayState->gameplayFrames % (6 + multiplier) == 0) {
s16* timer = va_arg(args, s16*);
*timer -= *timer > 1;
}
}
});
}
static RegisterShipInitFunc initFunc(RegisterSwitchTimerMultiplier, { CVAR_ENHANCEMENT("SwitchTimerMultiplier") });