diff --git a/src/p_maputl.c b/src/p_maputl.c
index 733adc6ad3dd3595f88fdd0a8f6395864a549280..ee1fb5a42112fb5c3b49e69a045e324dc12929ae 100644
--- a/src/p_maputl.c
+++ b/src/p_maputl.c
@@ -437,8 +437,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
 	fixed_t topedge[2] = {0};
 	fixed_t botedge[2] = {0};
 
-	int hi;
-	int lo;
+	int hi = 0;
+	int lo = 0;
 
 	if (linedef->sidenum[1] == 0xffff)
 	{
@@ -580,12 +580,20 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
 				if (delta1 > delta2) { // Below
 					if (opentop > texbottom)
 					{
+						topedge[lo] -= ( opentop - texbottom );
+
 						opentop = texbottom;
+						openceilingstep = ( thingtop    - topedge[lo] );
+						openceilingdrop = ( topedge[hi] - topedge[lo] );
 					}
 				} else { // Above
 					if (openbottom < textop)
 					{
+						botedge[hi] += ( textop - openbottom );
+
 						openbottom = textop;
+						openfloorstep = ( botedge[hi] - mobj->z );
+						openfloordrop = ( botedge[hi] - botedge[lo] );
 					}
 				}
 			}