From 1e2944415286b506881dc7dad0f0cec4861ff098 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 27 Oct 2019 15:30:48 +0200 Subject: [PATCH] - extended level post-processing with specials and arguments --- src/maploader/maploader.cpp | 48 ++++++++++++++++++++ wadsrc/static/zscript/level_postprocessor.zs | 6 +++ 2 files changed, 54 insertions(+) diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index c23697b532..efc873475a 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -3515,6 +3515,54 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingFlags) return 0; } +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingSpecial) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + + const int result = thing < self->loader->MapThingsConverted.Size() + ? self->loader->MapThingsConverted[thing].special : 0; + ACTION_RETURN_INT(result); +} + +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingSpecial) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + PARAM_INT(special); + + if (thing < self->loader->MapThingsConverted.Size()) + { + self->loader->MapThingsConverted[thing].special = special; + } + return 0; +} + +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingArgument) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + PARAM_UINT(index); + + const int result = index < 5 && thing < self->loader->MapThingsConverted.Size() + ? self->loader->MapThingsConverted[thing].args[index] : 0; + ACTION_RETURN_INT(result); +} + +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingArgument) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + PARAM_UINT(index); + PARAM_INT(value); + + if (index < 5 && thing < self->loader->MapThingsConverted.Size()) + { + self->loader->MapThingsConverted[thing].args[index] = value; + } + 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 9e76c1a319..3c38da6b0f 100644 --- a/wadsrc/static/zscript/level_postprocessor.zs +++ b/wadsrc/static/zscript/level_postprocessor.zs @@ -31,6 +31,12 @@ class LevelPostProcessor native play protected native uint GetThingFlags(uint thing); protected native void SetThingFlags(uint thing, uint flags); + protected native int GetThingSpecial(uint thing); + protected native void SetThingSpecial(uint thing, int special); + + protected native int GetThingArgument(uint thing, uint index); + protected native void SetThingArgument(uint thing, uint index, int value); + protected native void SetVertex(uint vertex, double x, double y); protected native void SetLineSectorRef(uint line, uint side, uint sector); protected native Actor GetDefaultActor(Name actorclass);