From 2a6a21a4a28bfcce0c16fa83090386ac4ecbd467 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Sat, 27 Aug 2016 17:14:21 +0100
Subject: [PATCH] Solid midtextures now account for "infinite" repeats

---
 src/p_maputl.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/p_maputl.c b/src/p_maputl.c
index 373679122..fea8530a1 100644
--- a/src/p_maputl.c
+++ b/src/p_maputl.c
@@ -581,7 +581,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
 			// don't remove this code unless solid midtextures
 			// on non-solid polyobjects should NEVER happen in the future
 			if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) {
-				if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) {
+				if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat
+					texbottom = back->floorheight + side->rowoffset;
+					textop = back->ceilingheight + side->rowoffset;
+				} else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) {
 					texbottom = back->floorheight + side->rowoffset;
 					textop = texbottom + texheight*(side->repeatcnt+1);
 				} else {
@@ -591,7 +594,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
 			} else
 #endif
 			{
-				if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) {
+				if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat
+					texbottom = openbottom + side->rowoffset;
+					textop = opentop + side->rowoffset;
+				} else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) {
 					texbottom = openbottom + side->rowoffset;
 					textop = texbottom + texheight*(side->repeatcnt+1);
 				} else {
-- 
GitLab