diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 65d7201b76..279f331e1e 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -3422,9 +3422,9 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingEdNum) PARAM_SELF_PROLOGUE(DLevelPostProcessor); PARAM_UINT(thing); - const int result = thing < self->loader->MapThingsConverted.Size() + const int ednum = thing < self->loader->MapThingsConverted.Size() ? self->loader->MapThingsConverted[thing].EdNum : 0; - ACTION_RETURN_INT(result); + ACTION_RETURN_INT(ednum); } DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingEdNum) @@ -3442,61 +3442,15 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingEdNum) return 0; } -DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingAngle) -{ - PARAM_SELF_PROLOGUE(DLevelPostProcessor); - PARAM_UINT(thing); - - const int result = thing < self->loader->MapThingsConverted.Size() - ? self->loader->MapThingsConverted[thing].angle : 0; - ACTION_RETURN_INT(result); -} - -DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingAngle) -{ - PARAM_SELF_PROLOGUE(DLevelPostProcessor); - PARAM_UINT(thing); - PARAM_UINT(angle); - - if (thing < self->loader->MapThingsConverted.Size()) - { - self->loader->MapThingsConverted[thing].angle = angle; - } - return 0; -} - -DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingSkills) -{ - PARAM_SELF_PROLOGUE(DLevelPostProcessor); - PARAM_UINT(thing); - - const int result = thing < self->loader->MapThingsConverted.Size() - ? self->loader->MapThingsConverted[thing].SkillFilter : 0; - ACTION_RETURN_INT(result); -} - -DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingSkills) -{ - PARAM_SELF_PROLOGUE(DLevelPostProcessor); - PARAM_UINT(thing); - PARAM_UINT(skillmask); - - if (thing < self->loader->MapThingsConverted.Size()) - { - self->loader->MapThingsConverted[thing].SkillFilter = skillmask; - } - return 0; -} - DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingPos) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); PARAM_UINT(thing); - const DVector3 result = thing < self->loader->MapThingsConverted.Size() + const DVector3 pos = thing < self->loader->MapThingsConverted.Size() ? self->loader->MapThingsConverted[thing].pos : DVector3(0, 0, 0); - ACTION_RETURN_VEC3(result); + ACTION_RETURN_VEC3(pos); } DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingXY) @@ -3528,14 +3482,60 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingZ) return 0; } +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingAngle) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + + const int angle = thing < self->loader->MapThingsConverted.Size() + ? self->loader->MapThingsConverted[thing].angle : 0; + ACTION_RETURN_INT(angle); +} + +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingAngle) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + PARAM_INT(angle); + + if (thing < self->loader->MapThingsConverted.Size()) + { + self->loader->MapThingsConverted[thing].angle = angle; + } + return 0; +} + +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingSkills) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + + const int skills = thing < self->loader->MapThingsConverted.Size() + ? self->loader->MapThingsConverted[thing].SkillFilter : 0; + ACTION_RETURN_INT(skills); +} + +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingSkills) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + PARAM_UINT(skillmask); + + if (thing < self->loader->MapThingsConverted.Size()) + { + self->loader->MapThingsConverted[thing].SkillFilter = skillmask; + } + return 0; +} + DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingFlags) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); PARAM_UINT(thing); - const unsigned result = thing < self->loader->MapThingsConverted.Size() + const unsigned flags = thing < self->loader->MapThingsConverted.Size() ? self->loader->MapThingsConverted[thing].flags : 0; - ACTION_RETURN_INT(result); + ACTION_RETURN_INT(flags); } DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingFlags) @@ -3556,9 +3556,9 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingSpecial) PARAM_SELF_PROLOGUE(DLevelPostProcessor); PARAM_UINT(thing); - const int result = thing < self->loader->MapThingsConverted.Size() + const int special = thing < self->loader->MapThingsConverted.Size() ? self->loader->MapThingsConverted[thing].special : 0; - ACTION_RETURN_INT(result); + ACTION_RETURN_INT(special); } DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingSpecial) @@ -3580,9 +3580,9 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingArgument) PARAM_UINT(thing); PARAM_UINT(index); - const int result = index < 5 && thing < self->loader->MapThingsConverted.Size() + const int argument = index < 5 && thing < self->loader->MapThingsConverted.Size() ? self->loader->MapThingsConverted[thing].args[index] : 0; - ACTION_RETURN_INT(result); + ACTION_RETURN_INT(argument); } DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingArgument) diff --git a/wadsrc/static/zscript/level_postprocessor.zs b/wadsrc/static/zscript/level_postprocessor.zs index cbea8504dd..29a7473104 100644 --- a/wadsrc/static/zscript/level_postprocessor.zs +++ b/wadsrc/static/zscript/level_postprocessor.zs @@ -22,16 +22,16 @@ class LevelPostProcessor native play protected native int GetThingEdNum(uint thing); protected native void SetThingEdNum(uint thing, int ednum); + protected native vector3 GetThingPos(uint thing); + protected native void SetThingXY(uint thing, double x, double y); + protected native void SetThingZ(uint thing, double z); + protected native int GetThingAngle(uint thing); protected native void SetThingAngle(uint thing, int angle); protected native uint GetThingSkills(uint thing); protected native void SetThingSkills(uint thing, uint skills); - protected native vector3 GetThingPos(uint thing); - protected native void SetThingXY(uint thing, double x, double y); - protected native void SetThingZ(uint thing, double z); - protected native uint GetThingFlags(uint thing); protected native void SetThingFlags(uint thing, uint flags);