From f0494218313370d8f6da7d7b46af026e61cec899 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Sun, 4 Sep 2022 11:25:00 +0300 Subject: [PATCH] Modify to have one GetVertexZ rather than IsVertexZSet / GetVertexZ --- src/maploader/postprocessor.cpp | 36 +++++++++----------- wadsrc/static/zscript/level_postprocessor.zs | 5 ++- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/maploader/postprocessor.cpp b/src/maploader/postprocessor.cpp index 4c0875dbb0..727fa053d9 100644 --- a/src/maploader/postprocessor.cpp +++ b/src/maploader/postprocessor.cpp @@ -443,30 +443,28 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetVertexZ) PARAM_UINT(vertex); PARAM_INT(planeval); - if (vertex < self->Level->vertexes.Size() && vertex < self->loader->vertexdatas.Size()) - { - vertexdata_t& data = self->loader->vertexdatas[vertex]; - double value = planeval ? data.zFloor : data.zCeiling; - ACTION_RETURN_FLOAT(value); - } - - ACTION_RETURN_FLOAT(0); -} - -DEFINE_ACTION_FUNCTION(DLevelPostProcessor, IsVertexZSet) -{ - PARAM_SELF_PROLOGUE(DLevelPostProcessor); - PARAM_UINT(vertex); - PARAM_INT(planeval); + double value = 0; + bool isset = false; if (vertex < self->Level->vertexes.Size() && vertex < self->loader->vertexdatas.Size()) { vertexdata_t& data = self->loader->vertexdatas[vertex]; - bool value = data.flags & (planeval ? VERTEXFLAG_ZFloorEnabled : VERTEXFLAG_ZCeilingEnabled); - ACTION_RETURN_BOOL(value); + value = planeval ? data.zFloor : data.zCeiling; + isset = data.flags & (planeval ? VERTEXFLAG_ZFloorEnabled : VERTEXFLAG_ZCeilingEnabled); } - ACTION_RETURN_BOOL(false); + if (numret > 1) + { + numret = 2; + ret[1].SetInt(isset); + } + + if (numret > 0) + { + ret[0].SetFloat(value); + } + + return numret; } DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetVertexZ) @@ -493,7 +491,7 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetVertexZ) return 0; } -DEFINE_ACTION_FUNCTION(DLevelPostProcessor, UnsetVertexZ) +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, RemoveVertexZ) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); PARAM_UINT(vertex); diff --git a/wadsrc/static/zscript/level_postprocessor.zs b/wadsrc/static/zscript/level_postprocessor.zs index 266ad6404c..be9507da96 100644 --- a/wadsrc/static/zscript/level_postprocessor.zs +++ b/wadsrc/static/zscript/level_postprocessor.zs @@ -47,10 +47,9 @@ class LevelPostProcessor native play protected native void SetThingStringArgument(uint thing, Name value); protected native void SetVertex(uint vertex, double x, double y); - protected native double GetVertexZ(uint vertex, int plane); - protected native bool IsVertexZSet(uint vertex, int plane); + protected native double, bool GetVertexZ(uint vertex, int plane); protected native void SetVertexZ(uint vertex, int plane, double z); - protected native void UnsetVertexZ(uint vertex, int plane); + protected native void RemoveVertexZ(uint vertex, int plane); protected native void SetLineVertexes(uint Line, uint v1, uint v2); protected native void FlipLineSideRefs(uint Line); protected native void SetLineSectorRef(uint line, uint side, uint sector);