- add native FlipLineSideRefs(line)

- FlipLineSideRefs should only work on single-sided lines
(patch by Rachael)
This commit is contained in:
drfrag 2019-11-16 12:06:03 +01:00
parent 74aa1763e6
commit 4977e6af1f
2 changed files with 26 additions and 0 deletions

View file

@ -752,6 +752,31 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetLineVertexes)
return 0;
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, FlipLineSideRefs)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_UINT(lineidx);
if (lineidx < level.lines.Size())
{
line_t *line = &level.lines[lineidx];
side_t *side1 = line->sidedef[1];
side_t *side2 = line->sidedef[0];
if (!!side1 && !!side2) // don't flip single-sided lines
{
sector_t *frontsector = line->sidedef[1]->sector;
sector_t *backsector = line->sidedef[0]->sector;
line->sidedef[0] = side1;
line->sidedef[1] = side2;
line->frontsector = frontsector;
line->backsector = backsector;
}
}
ForceNodeBuild = true;
return 0;
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetLineSectorRef)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);

View file

@ -46,6 +46,7 @@ class LevelPostProcessor native play
protected native void SetVertex(uint vertex, double x, double y);
protected native void SetLineVertexes(uint Line, uint v1, uint v2);
protected native void FlipLineSideRefs(uint Line);
protected native void SetLineSectorRef(uint line, uint side, uint sector);
protected native Actor GetDefaultActor(Name actorclass);