From b443ac8f719e02050382efd1b7c097d6d75d6113 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 1 May 2016 19:30:51 +0200 Subject: [PATCH] - let Trace() be a bit smarter about checking 3D slopes. If one matches right up with the floor or ceiling at the line where the trace enters a sector, check a second point to see whether we deal with something inside valid sector bounds or not. --- src/p_trace.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/p_trace.cpp b/src/p_trace.cpp index 8a3664ac8..67a516f9c 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -494,6 +494,17 @@ bool FTraceInfo::LineCheck(intercept_t *in, double dist, DVector3 hit) // clip to the part of the sector we are in if (hit.Z > ff_top) { + // 3D floor height is the same as the floor height. We need to test a second spot to see if it is above or below + if (fabs(bf - ff_top) < EQUAL_EPSILON) + { + double cf = entersector->floorplane.ZatPoint(entersector->centerspot); + double ffc = rover->top.plane->ZatPoint(entersector->centerspot); + if (ffc > cf) + { + bf = ff_top - EQUAL_EPSILON; + } + } + // above if (bf < ff_top) { @@ -505,6 +516,17 @@ bool FTraceInfo::LineCheck(intercept_t *in, double dist, DVector3 hit) } else if (hit.Z < ff_bottom) { + // 3D floor height is the same as the ceiling height. We need to test a second spot to see if it is above or below + if (fabs(bc - ff_bottom) < EQUAL_EPSILON) + { + double cc = entersector->ceilingplane.ZatPoint(entersector->centerspot); + double fcc = rover->bottom.plane->ZatPoint(entersector->centerspot); + if (fcc < cc) + { + bc = ff_bottom + EQUAL_EPSILON; + } + } + //below if (bc > ff_bottom) {