diff --git a/src/p_maputl.c b/src/p_maputl.c
index 373679122ac943f1c1fb0dbd672e1813d54e7e2d..fea8530a125bf3a5d001d87507f5513a85bb1e06 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 {