From badbb4324eb3f0b29ba0462753de45f5a9743dd3 Mon Sep 17 00:00:00 2001
From: Sryder <sryder13@gmail.com>
Date: Wed, 16 May 2018 21:04:57 +0100
Subject: [PATCH] Fix FF_FULLBRIGHT not working in sectors with multiple light
 levels in OpenGL

---
 src/hardware/hw_main.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 81021ef7f..b758c828e 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -4228,6 +4228,9 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
 	i = 0;
 	temp = FLOAT_TO_FIXED(realtop);
 
+	if (spr->mobj->frame & FF_FULLBRIGHT)
+		lightlevel = 255;
+
 #ifdef ESLOPE
 	for (i = 1; i < sector->numlights; i++)
 	{
@@ -4235,14 +4238,16 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
 					: sector->lightlist[i].height;
 		if (h <= temp)
 		{
-			lightlevel = *list[i-1].lightlevel;
+			if (!(spr->mobj->frame & FF_FULLBRIGHT))
+				lightlevel = *list[i-1].lightlevel;
 			colormap = list[i-1].extra_colormap;
 			break;
 		}
 	}
 #else
 	i = R_GetPlaneLight(sector, temp, false);
-	lightlevel = *list[i].lightlevel;
+	if (!(spr->mobj->frame & FF_FULLBRIGHT))
+		lightlevel = *list[i].lightlevel;
 	colormap = list[i].extra_colormap;
 #endif
 
@@ -4257,7 +4262,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
 		// even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite
 		if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES))
 		{
-			lightlevel = *list[i].lightlevel;
+			if (!(spr->mobj->frame & FF_FULLBRIGHT))
+				lightlevel = *list[i].lightlevel;
 			colormap = list[i].extra_colormap;
 		}
 
-- 
GitLab