From b731571a92425cbc2ca1b2f1e1597e755e55e74f Mon Sep 17 00:00:00 2001 From: inspectredc Date: Sat, 7 Oct 2023 00:39:43 +0100 Subject: [PATCH] pause state helper example --- .../game-interactor/GameInteractor.cpp | 16 ++++++++++------ .../game-interactor/GameInteractor.h | 7 ++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/port/Enhancements/game-interactor/GameInteractor.cpp b/src/port/Enhancements/game-interactor/GameInteractor.cpp index 92a24a69..93854f3b 100644 --- a/src/port/Enhancements/game-interactor/GameInteractor.cpp +++ b/src/port/Enhancements/game-interactor/GameInteractor.cpp @@ -1,12 +1,16 @@ #include "GameInteractor.h" -bool GameInteractor::IsSaveLoaded() { - // todo - return false; -} +#include "game/level_update.h" +extern int16_t sCurrPlayMode; + +// Taken from game/level_update.c +#define PLAY_MODE_NORMAL 0 +#define PLAY_MODE_PAUSED 2 +#define PLAY_MODE_CHANGE_AREA 3 +#define PLAY_MODE_CHANGE_LEVEL 4 +#define PLAY_MODE_FRAME_ADVANCE 5 bool GameInteractor::IsGameplayPaused() { - // todo - return false; + return sCurrPlayMode == PLAY_MODE_PAUSED; } diff --git a/src/port/Enhancements/game-interactor/GameInteractor.h b/src/port/Enhancements/game-interactor/GameInteractor.h index 72e7da14..0124557a 100644 --- a/src/port/Enhancements/game-interactor/GameInteractor.h +++ b/src/port/Enhancements/game-interactor/GameInteractor.h @@ -1,3 +1,6 @@ +#ifndef GameInteractor_h +#define GameInteractor_h + #ifdef __cplusplus extern "C" { #endif @@ -38,9 +41,9 @@ public: DEFINE_HOOK(OnHealthChange, void(int16_t health)); // Helpers - static bool IsSaveLoaded(); static bool IsGameplayPaused(); + // Game Actions class RawAction { }; @@ -48,3 +51,5 @@ public: }; #endif // __cplusplus + +#endif // GameInteractor_h