Converted "Passage of Time on File Select" to ShipInit Hook (#5595)

This commit is contained in:
nclok1405 2025-06-20 10:59:46 +09:00 committed by GitHub
commit 7ecefa8f90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 4 deletions

View file

@ -0,0 +1,20 @@
#include <libultraship/bridge.h>
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"
#include "z64save.h"
extern "C" SaveContext gSaveContext;
static constexpr int32_t CVAR_TIMEFLOWFILESELECT_DEFAULT = 0;
#define CVAR_TIMEFLOWFILESELECT_NAME CVAR_ENHANCEMENT("TimeFlowFileSelect")
#define CVAR_TIMEFLOWFILESELECT_VALUE CVarGetInteger(CVAR_TIMEFLOWFILESELECT_NAME, CVAR_TIMEFLOWFILESELECT_DEFAULT)
void OnFileChooseMainTimeFlowFileSelect(void* gameState) {
gSaveContext.skyboxTime += 0x10;
}
void RegisterTimeFlowFileSelect() {
COND_HOOK(OnFileChooseMain, CVAR_TIMEFLOWFILESELECT_VALUE, OnFileChooseMainTimeFlowFileSelect);
}
static RegisterShipInitFunc initFunc_TimeFlowFileSelect(RegisterTimeFlowFileSelect, { CVAR_TIMEFLOWFILESELECT_NAME });

View file

@ -3597,10 +3597,6 @@ void FileChoose_Main(GameState* thisx) {
sWindowContentColors[0][2] = 255;
}
if (CVarGetInteger(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 0) != 0) {
gSaveContext.skyboxTime += 0x10;
}
OPEN_DISPS(this->state.gfxCtx);
this->n64ddFlag = 0;