From bd08568b90f9227055761f893565d4c886710b7c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 5 Nov 2017 13:28:56 +0100 Subject: [PATCH] - Fix wrong math for model/light distance check --- src/gl/scene/gl_spritelight.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gl/scene/gl_spritelight.cpp b/src/gl/scene/gl_spritelight.cpp index 8853f0c19f..e348956bf7 100644 --- a/src/gl/scene/gl_spritelight.cpp +++ b/src/gl/scene/gl_spritelight.cpp @@ -209,12 +209,12 @@ void gl_SetDynModelLight(AActor *self, bool hudmodel) { int group = subsector->sector->PortalGroup; DVector3 pos = light->PosRelative(group); - float radius = light->GetRadius(); + float radius = light->GetRadius() + self->renderradius; double dx = pos.X - x; double dy = pos.Y - y; double dz = pos.Z - z; double distSquared = dx * dx + dy * dy + dz * dz; - if (distSquared < radiusSquared + radius * radius) // Light and actor touches + if (distSquared < radius * radius) // Light and actor touches { if (std::find(addedLights.begin(), addedLights.end(), light) == addedLights.end()) // Check if we already added this light from a different subsector {