From 82c248854d3cfd49c7c5597790c3722053847139 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 29 Oct 2019 16:14:23 +0200 Subject: [PATCH] - extended level post-processing with special string arguments --- src/maploader/maploader.cpp | 23 ++++++++++++++++++++ wadsrc/static/zscript/level_postprocessor.zs | 2 ++ 2 files changed, 25 insertions(+) diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index c7524f43f..3159fa7b7 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -3585,6 +3585,16 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingArgument) ACTION_RETURN_INT(argument); } +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingStringArgument) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + + const FName argument = thing < self->loader->MapThingsConverted.Size() + ? self->loader->MapThingsConverted[thing].arg0str : NAME_None; + ACTION_RETURN_INT(argument); +} + DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingArgument) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); @@ -3599,6 +3609,19 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingArgument) return 0; } +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingStringArgument) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + PARAM_INT(value); + + if (thing < self->loader->MapThingsConverted.Size()) + { + self->loader->MapThingsConverted[thing].arg0str = ENamedName(value); + } + return 0; +} + DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingID) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); diff --git a/wadsrc/static/zscript/level_postprocessor.zs b/wadsrc/static/zscript/level_postprocessor.zs index e1f05bec7..afef058d5 100644 --- a/wadsrc/static/zscript/level_postprocessor.zs +++ b/wadsrc/static/zscript/level_postprocessor.zs @@ -42,7 +42,9 @@ class LevelPostProcessor native play protected native void SetThingSpecial(uint thing, int special); protected native int GetThingArgument(uint thing, uint index); + protected native Name GetThingStringArgument(uint thing); protected native void SetThingArgument(uint thing, uint index, int value); + protected native void SetThingStringArgument(uint thing, Name value); protected native void SetVertex(uint vertex, double x, double y); protected native void SetLineSectorRef(uint line, uint side, uint sector);