diff --git a/src/maploader/postprocessor.cpp b/src/maploader/postprocessor.cpp index 74e838f5fa..be339cb077 100644 --- a/src/maploader/postprocessor.cpp +++ b/src/maploader/postprocessor.cpp @@ -437,20 +437,23 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetVertex) return 0; } -DEFINE_ACTION_FUNCTION(DLevelPostProcessor, FlipLine) +DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetLineVertexes) { PARAM_SELF_PROLOGUE(DLevelPostProcessor); PARAM_UINT(lineidx); + PARAM_UINT(vertexidx1); + PARAM_UINT(vertexidx2); - if (lineidx < self->Level->lines.Size()) + if (lineidx < self->Level->lines.Size() && + vertexidx1 < self->Level->vertexes.Size() && + vertexidx2 < self->Level->vertexes.Size()) { line_t *line = &self->Level->lines[lineidx]; - vertex_t *v1 = line->v1; - vertex_t *v2 = line->v2; - - line->v1 = v2; - line->v2 = v1; + vertex_t *vertex1 = &self->Level->vertexes[vertexidx1]; + vertex_t *vertex2 = &self->Level->vertexes[vertexidx2]; + line->v1 = vertex1; + line->v2 = vertex2; } self->loader->ForceNodeBuild = true; return 0; diff --git a/wadsrc/static/zscript/level_postprocessor.zs b/wadsrc/static/zscript/level_postprocessor.zs index fb2ac6d957..3e3441d729 100644 --- a/wadsrc/static/zscript/level_postprocessor.zs +++ b/wadsrc/static/zscript/level_postprocessor.zs @@ -47,10 +47,17 @@ class LevelPostProcessor native play protected native void SetThingStringArgument(uint thing, Name value); protected native void SetVertex(uint vertex, double x, double y); - protected native void FlipLine(uint Line); + protected native void SetLineVertexes(uint Line, uint v1, uint v2); protected native void SetLineSectorRef(uint line, uint side, uint sector); protected native Actor GetDefaultActor(Name actorclass); + protected void FlipLine(uint Line) + { + uint v1 = level.lines[Line].v1.Index(); + uint v2 = level.lines[Line].v2.Index(); + SetLineVertexes(Line, v2, v1); + } + protected void SetWallTexture(int line, int side, int texpart, String texture) { SetWallTextureID(line, side, texpart, TexMan.CheckForTexture(texture, TexMan.Type_Wall));