From 651e7ca827017d574a960c1a4e08b7112e451bb4 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 11 Feb 2016 23:30:21 -0700 Subject: [PATCH] CalcPoints: if NearWall() fails, first try fudging by 0.25 units in each direction --- light/ltface.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/light/ltface.c b/light/ltface.c index f4d3d842..05bfe9dc 100644 --- a/light/ltface.c +++ b/light/ltface.c @@ -523,6 +523,21 @@ CalcPoints(const dmodel_t *model, const vec3_t offset, const texorg_t *texorg, l if (!NearWall(point)) continue; // all good + // First try fudging by 0.25 + bool good = false; + for (i = 0; i < 6; i++) { + vec3_t testpoint; + VectorCopy(point, testpoint); + testpoint[i/2] += (i%2) ? 0.25 : -0.25; + if (!NearWall(testpoint)) { + VectorCopy(testpoint, point); + good = true; + } + } + if (good) + continue; + + // Next try a trace for (i = 0; i < 6; i++) { const int flags = TRACE_HIT_SOLID; tracepoint_t hit;