mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 14:23:44 -07:00
Difficulty: FireTimerMultiplier
Introduces slider to adjust timer on fire walls resetting switches
This commit is contained in:
parent
52debea44b
commit
8f671375f7
5 changed files with 47 additions and 3 deletions
24
soh/soh/Enhancements/FireTimerMultiplier.cpp
Normal file
24
soh/soh/Enhancements/FireTimerMultiplier.cpp
Normal 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") });
|
|
@ -527,6 +527,14 @@ typedef enum {
|
|||
// - `*EnElf`
|
||||
VB_FAIRY_HEAL,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
// ```
|
||||
// #### `args`
|
||||
// - `*s16`
|
||||
VB_FIRE_TIMER_TICK,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// false
|
||||
|
|
|
@ -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."));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue