From c4b1b9648473d22253343a3ed031fcc59ce1fc47 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 5 Feb 2016 13:47:07 +0100 Subject: [PATCH] - handle one particular edge case when checking if a line is completely behind a mirror. This is not really sufficient to detect all cases where something gets incorrectly flagged as ok, but it's the easiest one to detect. --- src/gl/scene/gl_portal.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 48b630586..0775b3652 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -937,9 +937,12 @@ void GLMirrorPortal::DrawContents() int GLMirrorPortal::ClipSeg(seg_t *seg) { + we cannot use P_PointOnLineSide here because it loses the special meaning of 0 == 'on the line'. + int side1 = DMulScale32(seg->v1->y - linedef->v1->y, linedef->dx, linedef->v1->x - seg->v1->x, linedef->dy); + int side2 = DMulScale32(seg->v2->y - linedef->v1->y, linedef->dx, linedef->v1->x - seg->v2->x, linedef->dy); + + if (side1 >= 0 && side2 >= 0) // this seg is completely behind the mirror. - if (P_PointOnLineSide(seg->v1->x, seg->v1->y, linedef) && - P_PointOnLineSide(seg->v2->x, seg->v2->y, linedef)) { return PClip_InFront; }