From f7bb80794017d1f8a21e93be3f8f4c155f037ebf Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Sun, 26 Feb 2023 23:04:57 -0500 Subject: [Game Interactor] Add LoadGame and ExitGame hooks (#2542) * add loadgame/exitgame GI hooks * implement loadgame/exitgame hooks in game code * move entrance tracker data lifecycle to hooks * update cosmetic editor to update onloadgame hook --- soh/src/code/z_play.c | 3 +++ soh/src/code/z_sram.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 08f3cb432..bc5b4a42a 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -7,6 +7,7 @@ #include #include "soh/frame_interpolation.h" #include "soh/Enhancements/debugconsole.h" +#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" #include @@ -427,10 +428,12 @@ void Play_Init(GameState* thisx) { } } + // Invalid entrance, so immediately exit the game to opening title if (gSaveContext.entranceIndex == -1) { gSaveContext.entranceIndex = 0; play->state.running = false; SET_NEXT_GAMESTATE(&play->state, Opening_Init, OpeningContext); + GameInteractor_ExecuteOnExitGame(gSaveContext.fileNum); return; } diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index ad78df64e..7e6486734 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -611,6 +611,4 @@ void Sram_InitSram(GameState* gameState) { // When going from a rando save to a vanilla save within the same game instance // we need to reset the entrance table back to its vanilla state Entrance_ResetEntranceTable(); - // Clear out the entrance tracker - Entrance_ClearEntranceTrackingData(); } -- cgit v1.2.3