From e0fe8d2ed92430b4c5957b016845a152a61da11e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Mar 2021 09:25:26 +0200 Subject: [PATCH] - fixed interpolation issues with sector objects in SW. SO's vertex interpolation does not use the common framework so it got missed by the sector retriangulation checks. We need to check two wall positions as well to make sure that sector movement is properly detected. --- source/core/intvec.h | 1 + source/core/sectorgeometry.cpp | 5 +++++ source/core/sectorgeometry.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/source/core/intvec.h b/source/core/intvec.h index 5550b2a4d..7c89c389f 100644 --- a/source/core/intvec.h +++ b/source/core/intvec.h @@ -18,6 +18,7 @@ struct vec2_t vec2_t operator-(const vec2_t& other) const { return { x - other.x, y - other.y }; } vec2_t& operator+=(const vec2_t& other) { x += other.x; y += other.y; return *this; }; vec2_t& operator-=(const vec2_t& other) { x -= other.x; y -= other.y; return *this; }; + bool operator == (const vec2_t& other) const { return x == other.x && y == other.y; }; }; struct vec3_t diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index e6be922d4..695c464a8 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -304,6 +304,8 @@ void SectorGeometry::ValidateSector(unsigned int secnum, int plane) sec->floorxpan_ == compare->floorxpan_ && sec->floorypan_ == compare->floorypan_ && sec->floorz == compare->floorz && + wall[sec->wallptr].pos == data[secnum].poscompare && + wall[wall[sec->wallptr].point2].pos == data[secnum].poscompare && !(sec->dirty & 1) && data[secnum].planes[plane].vertices.Size() ) return; sec->dirty &= ~1; @@ -316,10 +318,13 @@ void SectorGeometry::ValidateSector(unsigned int secnum, int plane) sec->ceilingxpan_ == compare->ceilingxpan_ && sec->ceilingypan_ == compare->ceilingypan_ && sec->ceilingz == compare->ceilingz && + wall[wall[sec->wallptr].point2].pos == data[secnum].poscompare && !(sec->dirty & 2) && data[secnum].planes[plane].vertices.Size()) return; sec->dirty &= ~2; } *compare = *sec; + data[secnum].poscompare == wall[sec->wallptr].pos; + data[secnum].poscompare2 == wall[wall[sec->wallptr].point2].pos; MakeVertices(secnum, plane); } diff --git a/source/core/sectorgeometry.h b/source/core/sectorgeometry.h index 487fd6e32..caa5de6e0 100644 --- a/source/core/sectorgeometry.h +++ b/source/core/sectorgeometry.h @@ -15,6 +15,8 @@ struct SectorGeometryData { SectorGeometryPlane planes[2]; sectortype compare{}; + vec2_t poscompare{ }; + vec2_t poscompare2{ }; }; class SectorGeometry