From 01008f0daa3c147f0d08c0b9d06021f7f7cfb779 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 2 Dec 2016 13:06:16 +0100 Subject: [PATCH] Fix sprite bsp clipping bug and wall sorting bug --- src/r_poly_portal.cpp | 2 +- src/r_poly_portal.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/r_poly_portal.cpp b/src/r_poly_portal.cpp index 9637d739c..7d8c385dd 100644 --- a/src/r_poly_portal.cpp +++ b/src/r_poly_portal.cpp @@ -158,7 +158,7 @@ void RenderPolyPortal::RenderSprite(AActor *thing, double sortDistance, DVector2 } else { - RenderSprite(thing, sortDistance, left, mid, t1, tmid, bsp->children[sideLeft]); + RenderSprite(thing, sortDistance, left, mid, t1, tmid, bsp->children[sideRight]); left = mid; t1 = tmid; } diff --git a/src/r_poly_portal.h b/src/r_poly_portal.h index 8623f8686..e983ebd46 100644 --- a/src/r_poly_portal.h +++ b/src/r_poly_portal.h @@ -46,7 +46,7 @@ class PolyTranslucentObject public: PolyTranslucentObject(particle_t *particle, subsector_t *sub, uint32_t subsectorDepth) : particle(particle), sub(sub), subsectorDepth(subsectorDepth) { } PolyTranslucentObject(AActor *thing, subsector_t *sub, uint32_t subsectorDepth, double dist, float t1, float t2) : thing(thing), sub(sub), subsectorDepth(subsectorDepth), DistanceSquared(dist), SpriteLeft(t1), SpriteRight(t2) { } - PolyTranslucentObject(RenderPolyWall wall) : wall(wall) { } + PolyTranslucentObject(RenderPolyWall wall) : wall(wall), subsectorDepth(wall.SubsectorDepth), DistanceSquared(1.e6) { } bool operator<(const PolyTranslucentObject &other) const { @@ -60,7 +60,7 @@ public: RenderPolyWall wall; uint32_t subsectorDepth = 0; - double DistanceSquared = 1.e6; + double DistanceSquared = 0.0; float SpriteLeft = 0.0f, SpriteRight = 1.0f; };