From 0ed1077f2992aa2d0d509f091e905684dcdae75d Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <coelckers@users.noreply.github.com>
Date: Tue, 26 Jun 2018 08:51:21 +0200
Subject: [PATCH] - correct checks for HasDynamicLights

---
 src/d_main.cpp            | 2 +-
 src/g_shared/a_dynlight.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/d_main.cpp b/src/d_main.cpp
index 4172909bc..ea727b6fb 100644
--- a/src/d_main.cpp
+++ b/src/d_main.cpp
@@ -786,7 +786,7 @@ void D_Display ()
 			//
 
 			// Check for the presence of dynamic lights at the start of the frame once.
-			if (gl_lights)
+			if ((gl_lights && vid_rendermode == 4) || (r_dynlights && vid_rendermode != 4))
 			{
 				TThinkerIterator<ADynamicLight> it(STAT_DLIGHT);
 				level.HasDynamicLights = !!it.Next();
diff --git a/src/g_shared/a_dynlight.h b/src/g_shared/a_dynlight.h
index ae2493ca2..fa9d5840e 100644
--- a/src/g_shared/a_dynlight.h
+++ b/src/g_shared/a_dynlight.h
@@ -3,6 +3,7 @@
 #include "actor.h"
 #include "cycler.h"
 
+EXTERN_CVAR(Bool, r_dynlights)
 EXTERN_CVAR(Bool, gl_lights)
 EXTERN_CVAR(Bool, gl_attachedlights)