From 698886e5dbc2a4942d797cc4373ee0b532f4a8cd Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 10 Oct 2020 15:32:27 +0300 Subject: [PATCH] - converted level global variable into real pointer # Conflicts: # src/g_levellocals.h --- src/g_level.cpp | 1 + src/g_levellocals.h | 1 + src/scripting/vmthunks.cpp | 2 +- wadsrc/static/zscript/base.zs | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 093451be0..d46be2d6b 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -143,6 +143,7 @@ extern bool sendpause, sendsave, sendturn180, SendLand; void *statcopy; // for statistics driver FLevelLocals level; // info about current level +FLevelLocals *currentVMLevel = &level; // level which currently ticks. Used as global input to the VM and some functions called by it. //========================================================================== diff --git a/src/g_levellocals.h b/src/g_levellocals.h index a1efb9a78..17e983a50 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -212,6 +212,7 @@ struct FLevelLocals : public FLevelData #ifndef NO_DEFINE_LEVEL extern FLevelLocals level; +extern FLevelLocals *currentVMLevel; inline int vertex_t::Index() const { diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index f8b3441a6..7cd4afa6d 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -2961,7 +2961,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_AltHUD, GetLatency, Net_GetLatency) // // //========================================================================== -DEFINE_GLOBAL(level); +DEFINE_GLOBAL_NAMED(currentVMLevel, level) DEFINE_FIELD(FLevelLocals, sectors) DEFINE_FIELD(FLevelLocals, lines) DEFINE_FIELD(FLevelLocals, sides) diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index b8c7c757a..59933076a 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -7,7 +7,7 @@ struct _ native // These are the global variables, the struct is only here to av native readonly Array<@Team> Teams; native int validcount; native readonly bool multiplayer; - native play @LevelLocals level; + native play LevelLocals level; native @KeyBindings Bindings; native @KeyBindings AutomapBindings; native play @DehInfo deh;