diff --git a/src/p_maputl.c b/src/p_maputl.c
index 242bc559e8d31ba398bb5dd563b5da909e31fc28..f00534d6398a1de9287fe6b993107231848b2f0e 100644
--- a/src/p_maputl.c
+++ b/src/p_maputl.c
@@ -501,7 +501,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
 
 			if (texnum) {
 				// Get the midtexture's height
-				texheight = textures[texnum]->height << FRACBITS;
+				texheight = FixedDiv(textureheight[texnum], abs(side->scaley_mid));
 
 				// Set texbottom and textop to the Z coordinates of the texture's boundaries
 #if 0