From e86f10ec9fb8b6f67c4a722dfb398ac25476a5ec Mon Sep 17 00:00:00 2001 From: 8dcc <8dcc.git@gmail.com> Date: Fri, 21 Jul 2023 07:02:26 +0200 Subject: [PATCH] Add functions for storing and restoring globals --- src/globals.c | 14 ++++++++++++++ src/include/globals.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/globals.c b/src/globals.c index e7cb219..7d85944 100644 --- a/src/globals.c +++ b/src/globals.c @@ -37,5 +37,19 @@ bool globals_init(void) { return false; } + globals_store(); + return true; } + +void globals_store(void) { + o_engine = *i_engine; + o_client = *i_client; + o_pmove = *i_pmove; +} + +void globals_restore(void) { + *i_engine = o_engine; + *i_client = o_client; + *i_pmove = o_pmove; +} diff --git a/src/include/globals.h b/src/include/globals.h index 1b01967..5ae6985 100644 --- a/src/include/globals.h +++ b/src/include/globals.h @@ -34,5 +34,7 @@ extern cl_entity_t* localplayer; /*----------------------------------------------------------------------------*/ bool globals_init(void); +void globals_store(void); +void globals_restore(void); #endif /* _GLOBALS_H */