Feedback Update

-A new hook was created 'OnPauseMenu' so now PauseWarp_Main is only called when the pause menu is open
-Moved pauswarp.c to the Enhancements folder
-Removed from graph.c

PR Change:
Changing to the main branch instead of sulu
This commit is contained in:
mckinlee 2023-09-19 17:33:40 -04:00
parent a5b851cfe6
commit b1e621b375
6 changed files with 25 additions and 1 deletions

View File

@ -184,6 +184,8 @@ public:
DEFINE_HOOK(OnSetGameLanguage, void());
DEFINE_HOOK(OnPauseMenu, void());
// Helpers
static bool IsSaveLoaded();
static bool IsGameplayPaused();

View File

@ -161,3 +161,8 @@ void GameInteractor_ExecuteOnUpdateFileNameSelection(int16_t charCode) {
void GameInteractor_ExecuteOnSetGameLanguage() {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSetGameLanguage>();
}
// MARK: - Pause Menu
void GameInteractor_ExecuteOnPauseMenu() {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnPauseMenu>();
}

View File

@ -51,6 +51,10 @@ void GameInteractor_ExecuteOnUpdateFileNameSelection(int16_t charCode);
// MARK: - Game
void GameInteractor_ExecuteOnSetGameLanguage();
//MARK: - Pause Menu
void GameInteractor_ExecuteOnPauseMenu();
#ifdef __cplusplus
}
#endif

View File

@ -32,6 +32,7 @@ extern SaveContext gSaveContext;
extern PlayState* gPlayState;
extern void Overlay_DisplayText(float duration, const char* text);
uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
void PauseWarp_Main();
}
bool performDelayedSave = false;
bool performSave = false;
@ -974,6 +975,12 @@ void RegisterRandomizerSheikSpawn() {
});
}
void RegisterPauseWarp() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPauseMenu>([]() {
PauseWarp_Main();
});
}
void InitMods() {
RegisterTTS();
RegisterInfiniteMoney();
@ -1000,4 +1007,5 @@ void InitMods() {
RegisterAltTrapTypes();
RegisterRandomizerSheikSpawn();
NameTag_RegisterHooks();
RegisterPauseWarp();
}

View File

@ -3,7 +3,9 @@
#include <stdint.h>
#include "soh/Enhancements/gameconsole.h"
#include "global.h"
#include "../custom-message/CustomMessageTypes.h"
#include <soh/Enhancements/custom-message/CustomMessageTypes.h>
#include "luslog.h"
// Defining the structure for the pause warp state, which holds different flags and cooldowns
typedef struct {
@ -67,6 +69,7 @@ void HandleCooldowns(PauseWarpState* state) {
// The main function that gets called every frame
void PauseWarp_Main() {
LUSLOG_CRITICAL("PauseWarp_Main Called");
static PauseWarpState state; // The state is static so it retains its value between function calls
// Checking if the pause warp feature is enabled

View File

@ -56,6 +56,8 @@ void KaleidoScopeCall_Update(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
PauseContext* pauseCtx = &play->pauseCtx;
GameInteractor_ExecuteOnPauseMenu();
if (!gSaveContext.sohStats.gameComplete &&
(!gSaveContext.isBossRush || !gSaveContext.isBossRushPaused)) {
gSaveContext.sohStats.pauseTimer++;