rename, add more timers

This commit is contained in:
Demur Rumed 2025-06-03 02:39:22 +00:00
commit 2f5cb2261e
8 changed files with 32 additions and 23 deletions

View file

@ -5,20 +5,18 @@ 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);
void RegisterSwitchTimerMultiplier() {
COND_VB_SHOULD(VB_SWITCH_TIMER_TICK, CVarGetInteger(CVAR_ENHANCEMENT("SwitchTimerMultiplier"), 0) != 0, {
int factor = CVarGetInteger(CVAR_ENHANCEMENT("SwitchTimerMultiplier"), 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--;
}
*timer -= *timer > 0;
}
}
});
}
static RegisterShipInitFunc initFunc(RegisterFireTimerMultiplier, { CVAR_ENHANCEMENT("FireTimerMultiplier") });
static RegisterShipInitFunc initFunc(RegisterSwitchTimerMultiplier, { CVAR_ENHANCEMENT("SwitchTimerMultiplier") });

View file

@ -527,14 +527,6 @@ typedef enum {
// - `*EnElf`
VB_FAIRY_HEAL,
// #### `result`
// ```c
// true
// ```
// #### `args`
// - `*s16`
VB_FIRE_TIMER_TICK,
// #### `result`
// ```c
// false
@ -2000,6 +1992,14 @@ typedef enum {
// - `*ShotSun`
VB_SPAWN_SONG_FAIRY,
// #### `result`
// ```c
// true
// ```
// #### `args`
// - `*s16`
VB_SWITCH_TIMER_TICK,
// #### `result`
// ```c
// (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->heldActor != NULL) &&

View file

@ -1123,8 +1123,8 @@ 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"))
AddWidget(path, "Switch Timer Multiplier", WIDGET_CVAR_SLIDER_INT)
.CVar(CVAR_ENHANCEMENT("SwitchTimerMultiplier"))
.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)

View file

@ -192,7 +192,7 @@ void BgHidanCurtain_TurnOff(BgHidanCurtain* this, PlayState* play) {
}
void BgHidanCurtain_WaitForTimer(BgHidanCurtain* this, PlayState* play) {
if (GameInteractor_Should(VB_FIRE_TIMER_TICK, true, &this->timer)) {
if (GameInteractor_Should(VB_SWITCH_TIMER_TICK, true, &this->timer)) {
DECR(this->timer);
}

View file

@ -166,7 +166,7 @@ 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 (GameInteractor_Should(VB_SWITCH_TIMER_TICK, true, &this->timer)) {
if (this->timer != 0) {
this->timer--;
}

View file

@ -1,5 +1,6 @@
#include "z_bg_mizu_shutter.h"
#include "objects/object_mizu_objects/object_mizu_objects.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED
@ -137,7 +138,9 @@ void BgMizuShutter_Move(BgMizuShutter* this, PlayState* play) {
void BgMizuShutter_WaitForTimer(BgMizuShutter* this, PlayState* play) {
if (this->timerMax != 0x3F * 20) {
this->timer--;
if (GameInteractor_Should(VB_SWITCH_TIMER_TICK, true, &this->timer)) {
this->timer--;
}
func_8002F994(&this->dyna.actor, this->timer);
if (this->timer == 0) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_CLOSE);

View file

@ -6,6 +6,7 @@
#include "z_bg_ydan_hasi.h"
#include "objects/object_ydan_objects/object_ydan_objects.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED)
@ -145,9 +146,12 @@ void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, PlayState* play) {
}
void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
if (GameInteractor_Should(VB_SWITCH_TIMER_TICK, true, &this->timer)) {
if (this->timer != 0) {
this->timer--;
}
}
if (this->timer == 0) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 3.0f) != 0) {
Flags_UnsetSwitch(play, this->type);

View file

@ -6,6 +6,7 @@
#include "z_en_siofuki.h"
#include "objects/object_siofuki/object_siofuki.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED)
@ -188,7 +189,10 @@ void func_80AFC218(EnSiofuki* this, PlayState* play) {
func_80AFBE8C(this, play);
func_80AFC1D0(this, play);
this->timer--;
if (GameInteractor_Should(VB_SWITCH_TIMER_TICK, true, &this->timer)) {
this->timer--;
}
if (this->timer < 0) {
Flags_UnsetSwitch(play, ((u16)this->dyna.actor.params >> 6) & 0x3F);
switch (((u16)this->dyna.actor.params >> 0xC) & 0xF) {