From 21a74dfb1370e86d32b438d69286bccb549f880b Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 12 Nov 2019 08:08:35 -0500 Subject: [PATCH] - new zscript function 'SetLineVertexes(line, v1, v2)' - scriptify 'FlipLine' completely using new function, remove native version --- src/maploader/postprocessor.cpp | 17 ++++++++++------- wadsrc/static/zscript/level_postprocessor.zs | 9 ++++++++- 2 files changed, 18 insertions(+), 8 deletions(-) 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));