From 3212ee0b0fc1fd7734be56a9ccdc2b84ddb6f01d Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Mon, 30 Jan 2017 21:08:13 +0000
Subject: [PATCH] Fix endless loop of R_DrawRepeatMaskedColumn if both
 sprtopscreen and sprbotscreen are CLAMPMAX (INT32_MAX)

This fixes the grid floors in TD's Lava Mountain freezing the game if they go off the bottom of the screen far enough (they have ACWRFL1A as the wall texture, which is a single patch texture with holes)
---
 src/r_segs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/r_segs.c b/src/r_segs.c
index 8f271bfe3d..3059860cfc 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -706,10 +706,10 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
 // Loop through R_DrawMaskedColumn calls
 static void R_DrawRepeatMaskedColumn(column_t *col)
 {
-	do {
+	while (sprtopscreen < sprbotscreen) {
 		R_DrawMaskedColumn(col);
 		sprtopscreen += dc_texheight*spryscale;
-	} while (sprtopscreen < sprbotscreen);
+	}
 }
 
 //
-- 
GitLab