Added slider for Rupee Diving Game's time limit (#6476)

This commit is contained in:
Jordan Longstaff 2026-04-10 19:51:38 -04:00 committed by GitHub
parent 06b512faa9
commit b2f0cae9ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 4 deletions

View 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 });

View file

@ -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

View file

@ -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"))

View file

@ -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;