diff options
| author | Kiloku <mateus.sateles@protonmail.com> | 2025-02-10 18:46:43 -0300 |
|---|---|---|
| committer | Lywx <kiritodev01@gmail.com> | 2025-02-10 18:06:47 -0600 |
| commit | 3f028c979e3634bdc63d349d7afd30e219d7786f (patch) | |
| tree | fd76a552951207cef85722ccd45d7dd4f5b00d2b | |
| parent | dd9c8107143650a311e389d85c2f9824c9caca61 (diff) | |
Move Debug Pause to Hooks!
| -rw-r--r-- | src/engine/fox_play.c | 2 | ||||
| -rw-r--r-- | src/port/hooks/list/EngineEvent.h | 2 | ||||
| -rw-r--r-- | src/port/mods/PortEnhancements.c | 7 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/engine/fox_play.c b/src/engine/fox_play.c index e080d479..9d501d66 100644 --- a/src/engine/fox_play.c +++ b/src/engine/fox_play.c @@ -7167,7 +7167,7 @@ void Play_Main(void) { } gDrawMode = DRAW_PLAY; - if (CVarGetInteger("gDebugPause", 0) == 0){ + CALL_CANCELLABLE_EVENT(PlayUpdateEvent){ Play_Update(); } diff --git a/src/port/hooks/list/EngineEvent.h b/src/port/hooks/list/EngineEvent.h index 50db9c83..e968e8a0 100644 --- a/src/port/hooks/list/EngineEvent.h +++ b/src/port/hooks/list/EngineEvent.h @@ -9,6 +9,8 @@ DEFINE_EVENT(DisplayPostUpdateEvent); DEFINE_EVENT(GamePreUpdateEvent); DEFINE_EVENT(GamePostUpdateEvent); +DEFINE_EVENT(PlayUpdateEvent); + DEFINE_EVENT(PlayerPreUpdateEvent, Player* player;); DEFINE_EVENT(PlayerPostUpdateEvent, Player* player;); diff --git a/src/port/mods/PortEnhancements.c b/src/port/mods/PortEnhancements.c index bae0e695..042da8e8 100644 --- a/src/port/mods/PortEnhancements.c +++ b/src/port/mods/PortEnhancements.c @@ -163,6 +163,10 @@ void OnGameUpdatePost(IEvent* event) { } } +void OnPlayUpdateEvent(IEvent* event){ + event->cancelled = CVarGetInteger("gDebugPause", 0); +} + void RefillBoostMeter(Player* player) { if (player->boostMeter > 1.0f) { player->boostMeter = 1.0f; @@ -318,6 +322,7 @@ void PortEnhancements_Init() { // Register event listeners REGISTER_LISTENER(DisplayPostUpdateEvent, OnDisplayUpdatePost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(GamePostUpdateEvent, OnGameUpdatePost, EVENT_PRIORITY_NORMAL); + REGISTER_LISTENER(PlayUpdateEvent, OnPlayUpdateEvent, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(PlayerPostUpdateEvent, OnPlayerUpdatePost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(DrawBoostGaugeHUDEvent, OnBoostGaugeDraw, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(DrawLivesCounterHUDEvent, OnLivesCounterDraw, EVENT_PRIORITY_NORMAL); @@ -344,6 +349,8 @@ void PortEnhancements_Register() { REGISTER_EVENT(GamePreUpdateEvent); REGISTER_EVENT(GamePostUpdateEvent); + REGISTER_EVENT(PlayUpdateEvent); + REGISTER_EVENT(PlayerPreUpdateEvent); REGISTER_EVENT(PlayerPostUpdateEvent); |
