From 7ab7fc9a57f8d329f53e9643586eb1ed958afb51 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 3 Oct 2016 16:21:50 +0200 Subject: [PATCH] - seems I missed this part... --- src/gl/dynlights/a_dynlight.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gl/dynlights/a_dynlight.cpp b/src/gl/dynlights/a_dynlight.cpp index 20d0d6078..0e52eedd8 100644 --- a/src/gl/dynlights/a_dynlight.cpp +++ b/src/gl/dynlights/a_dynlight.cpp @@ -391,6 +391,16 @@ void ADynamicLight::UpdateLocation() Prev = target->Pos(); subsector = R_PointInSubsector(Prev); Sector = subsector->sector; + + // Some z-coordinate fudging to prevent the light from getting too close to the floor or ceiling planes. With proper attenuation this would render them invisible. + // A distance of 5 is needed so that the light's effect doesn't become too small. + if (Z() < target->floorz + 5.) SetZ(target->floorz + 5.); + else if (Z() > target->ceilingz - 5.) SetZ(target->ceilingz - 5.); + } + else + { + if (Z() < floorz + 5.) SetZ(floorz + 5.); + else if (Z() > ceilingz - 5.) SetZ(ceilingz - 5.); }