From dca15d56c889f4a7bae2ad51d808d66161c51d41 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 27 Oct 2019 16:36:59 +0200 Subject: [PATCH] - extended level post-processing with thing IDs # Conflicts: # src/maploader/maploader.cpp --- src/compatibility.cpp | 23 ++++++++++++++++++++ wadsrc/static/zscript/level_postprocessor.zs | 3 +++ 2 files changed, 26 insertions(+) diff --git a/src/compatibility.cpp b/src/compatibility.cpp index e5e021e67..cfdc074da 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -669,6 +669,29 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingArgument) return 0; } +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingID) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + + const int id = thing < MapThingsConverted.Size() + ? MapThingsConverted[thing].thingid : 0; + ACTION_RETURN_INT(id); +} + +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingID) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + PARAM_INT(id); + + if (thing < MapThingsConverted.Size()) + { + MapThingsConverted[thing].thingid = id; + } + return 0; +} + DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetVertex) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); diff --git a/wadsrc/static/zscript/level_postprocessor.zs b/wadsrc/static/zscript/level_postprocessor.zs index ac8166da0..8a9162c77 100644 --- a/wadsrc/static/zscript/level_postprocessor.zs +++ b/wadsrc/static/zscript/level_postprocessor.zs @@ -33,6 +33,9 @@ class LevelPostProcessor native play protected native uint GetThingFlags(uint thing); protected native void SetThingFlags(uint thing, uint flags); + protected native int GetThingID(uint thing); + protected native void SetThingID(uint thing, int id); + protected native int GetThingSpecial(uint thing); protected native void SetThingSpecial(uint thing, int special);