From ba5d09eb2eb5f833bb9dccde832f8ded64071c8c Mon Sep 17 00:00:00 2001
From: Nev3r <apophycens@gmail.com>
Date: Fri, 31 Jul 2020 22:38:37 +0200
Subject: [PATCH] Fix smooth brain bruhments.

---
 src/hardware/hw_main.c | 16 ++++++++++++++--
 src/r_segs.c           |  5 ++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 777fd6f1c4..a1d7797eab 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -1621,11 +1621,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
 		{
 			for (rover = gl_backsector->ffloors; rover; rover = rover->next)
 			{
+				boolean bothsides = false;
 				// Skip if it exists on both sectors.
 				ffloor_t * r2;
 				for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
 					if (rover->master == r2->master)
-						continue;
+					{
+						bothsides = true;
+						break;
+					}
+
+				if (bothsides) continue;
 
 				if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES))
 					continue;
@@ -1761,11 +1767,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
 		{
 			for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
 			{
+				boolean bothsides = false;
 				// Skip if it exists on both sectors.
 				ffloor_t * r2;
 				for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
 					if (rover->master == r2->master)
-						continue;
+					{
+						bothsides = true;
+						break;
+					}
+
+				if (bothsides) continue;
 
 				if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES))
 					continue;
diff --git a/src/r_segs.c b/src/r_segs.c
index 52c19d96e0..92b6051807 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -2142,7 +2142,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
 					for (r2 = frontsector->ffloors; r2; r2 = r2->next)
 					{
 						if (r2->master == rover->master) // Skip if same control line.
-							continue;
+							break;
 
 						if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES))
 							continue;
@@ -2199,6 +2199,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
 
 					for (r2 = backsector->ffloors; r2; r2 = r2->next)
 					{
+						if (r2->master == rover->master) // Skip if same control line.
+							break;
+
 						if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES))
 							continue;
 
-- 
GitLab