diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 098f5f178..298e5c81f 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -3375,27 +3375,54 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, AddLineID) return 0; } +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingCount) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + ACTION_RETURN_INT(self->loader->MapThingsConverted.Size()); +} + +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_INT(thing); - PARAM_INT(skillmask); + PARAM_UINT(thing); + PARAM_UINT(skillmask); - if ((unsigned)thing < self->loader->MapThingsConverted.Size()) + 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() + ? self->loader->MapThingsConverted[thing].pos + : DVector3(0, 0, 0); + ACTION_RETURN_VEC3(result); +} + DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingXY) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); - PARAM_INT(thing); + PARAM_UINT(thing); PARAM_FLOAT(x); PARAM_FLOAT(y); - if ((unsigned)thing < self->loader->MapThingsConverted.Size()) + if (thing < self->loader->MapThingsConverted.Size()) { auto& pos = self->loader->MapThingsConverted[thing].pos; pos.X = x; @@ -3407,23 +3434,33 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingXY) DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingZ) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); - PARAM_INT(thing); + PARAM_UINT(thing); PARAM_FLOAT(z); - if ((unsigned)thing < self->loader->MapThingsConverted.Size()) + if (thing < self->loader->MapThingsConverted.Size()) { self->loader->MapThingsConverted[thing].pos.Z = z; } return 0; } +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingFlags) +{ + PARAM_SELF_PROLOGUE(DLevelPostProcessor); + PARAM_UINT(thing); + + const unsigned result = thing < self->loader->MapThingsConverted.Size() + ? self->loader->MapThingsConverted[thing].flags : 0; + ACTION_RETURN_INT(result); +} + DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingFlags) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); - PARAM_INT(thing); - PARAM_INT(flags); + PARAM_UINT(thing); + PARAM_UINT(flags); - if ((unsigned)thing < self->loader->MapThingsConverted.Size()) + if (thing < self->loader->MapThingsConverted.Size()) { self->loader->MapThingsConverted[thing].flags = flags; } diff --git a/wadsrc/static/zscript/level_postprocessor.zs b/wadsrc/static/zscript/level_postprocessor.zs index e967f93f0..57d5672ec 100644 --- a/wadsrc/static/zscript/level_postprocessor.zs +++ b/wadsrc/static/zscript/level_postprocessor.zs @@ -12,10 +12,19 @@ class LevelPostProcessor native play protected native void ClearLineIDs(int line); protected native void AddLineID(int line, int tag); protected native void OffsetSectorPlane(int sector, int plane, double offset); - protected native void SetThingSkills(int thing, int skills); - protected native void SetThingXY(int thing, double x, double y); - protected native void SetThingZ(int thing, double z); - protected native void SetThingFlags(int thing, int flags); + + protected native uint GetThingCount(); + + 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); + 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);