mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-04-23 08:14:31 +00:00
Added slider for Rupee Diving Game's time limit (#6476)
This commit is contained in:
parent
06b512faa9
commit
b2f0cae9ec
21
soh/soh/Enhancements/Difficulty/DivingGameTimer.cpp
Normal file
21
soh/soh/Enhancements/Difficulty/DivingGameTimer.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "functions.h"
|
||||
extern GameInfo* gGameInfo;
|
||||
}
|
||||
|
||||
static constexpr int32_t CVAR_DIVING_GAME_TIME_DEFAULT = 50;
|
||||
#define CVAR_DIVING_GAME_TIME_NAME CVAR_ENHANCEMENT("DivingGame.TimeLimit")
|
||||
#define CVAR_DIVING_GAME_TIME_VALUE CVarGetInteger(CVAR_DIVING_GAME_TIME_NAME, CVAR_DIVING_GAME_TIME_DEFAULT)
|
||||
#define CVAR_DIVING_GAME_TIME_SET (CVAR_DIVING_GAME_TIME_VALUE != CVAR_DIVING_GAME_TIME_DEFAULT)
|
||||
|
||||
static void RegisterDIvingGameTimeLimit() {
|
||||
COND_VB_SHOULD(VB_SET_DIVING_GAME_TIME_LIMIT, CVAR_DIVING_GAME_TIME_SET, {
|
||||
Interface_SetTimer(BREG(2) + CVAR_DIVING_GAME_TIME_VALUE);
|
||||
*should = false;
|
||||
});
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterDIvingGameTimeLimit, { CVAR_DIVING_GAME_TIME_NAME });
|
||||
|
|
@ -2052,6 +2052,14 @@ typedef enum {
|
|||
// - `*EnNiwLady`
|
||||
VB_SET_CUCCO_COUNT,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
// ```
|
||||
// #### `args`
|
||||
// - None
|
||||
VB_SET_DIVING_GAME_TIME_LIMIT,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// SurfaceType_GetSlope(&play->colCtx, poly, bgId) == 2
|
||||
|
|
|
|||
|
|
@ -1523,6 +1523,11 @@ void SohMenu::AddMenuEnhancements() {
|
|||
.Options(CheckboxOptions().Tooltip("Amy's block pushing puzzle instantly solved."));
|
||||
|
||||
path.column = SECTION_COLUMN_3;
|
||||
AddWidget(path, "Rupee Diving Game", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Time Limit: %d seconds", WIDGET_CVAR_SLIDER_INT)
|
||||
.CVar(CVAR_ENHANCEMENT("DivingGame.TimeLimit"))
|
||||
.Options(IntSliderOptions().Min(30).Max(120).DefaultValue(50).Format("%d seconds"));
|
||||
|
||||
AddWidget(path, "Fishing", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Customize Behavior##Fishing", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("CustomizeFishing"))
|
||||
|
|
|
|||
|
|
@ -424,11 +424,13 @@ void func_809EE800(EnDivingGame* this, PlayState* play) {
|
|||
SkelAnime_Update(&this->skelAnime);
|
||||
if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) {
|
||||
Message_CloseTextbox(play);
|
||||
if (GameInteractor_Should(VB_SET_DIVING_GAME_TIME_LIMIT, true)) {
|
||||
if (!Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_SILVER_SCALE)) {
|
||||
Interface_SetTimer(BREG(2) + 50);
|
||||
} else {
|
||||
Interface_SetTimer(BREG(2) + 50);
|
||||
}
|
||||
}
|
||||
func_800F5ACC(NA_BGM_TIMED_MINI_GAME);
|
||||
Player_SetCsActionWithHaltedActors(play, NULL, 7);
|
||||
this->actor.textId = 0x405B;
|
||||
|
|
|
|||
Loading…
Reference in a new issue