diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index abbb32d25..b920a5c59 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -2510,6 +2510,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
 // e6y: Check whether the player can look beyond this line
 //
 #ifdef NEWCLIP
+boolean checkforemptylines = true;
 // Don't modify anything here, just check
 // Kalaron: Modified for sloped linedefs
 static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacksector)
@@ -2552,6 +2553,7 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
 	// now check for closed sectors!
 	if (backc1 <= frontf1 && backc2 <= frontf2)
 	{
+		checkforemptylines = false;
 		if (!seg->sidedef->toptexture)
 			return false;
 
@@ -2563,6 +2565,7 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
 
 	if (backf1 >= frontc1 && backf2 >= frontc2)
 	{
+		checkforemptylines = false;
 		if (!seg->sidedef->bottomtexture)
 			return false;
 
@@ -2575,6 +2578,7 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
 
 	if (backc1 <= backf1 && backc2 <= backf2)
 	{
+		checkforemptylines = false;
 		// preserve a kind of transparent door/lift special effect:
 		if (backc1 < frontc1 || backc2 < frontc2)
 		{
@@ -2595,41 +2599,12 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
 		return true;
 	}
 
-
-	// Reject empty lines used for triggers and special events.
-	// Identical floor and ceiling on both sides,
-	//  identical light levels on both sides,
-	//  and no middle texture.
-	if (
-#ifdef POLYOBJECTS
-		!seg->polyseg &&
-#endif
-		gr_backsector->ceilingpic == gr_frontsector->ceilingpic
-		&& gr_backsector->floorpic == gr_frontsector->floorpic
-#ifdef ESLOPE
-		&& gr_backsector->f_slope == gr_frontsector->f_slope
-		&& gr_backsector->c_slope == gr_frontsector->c_slope
-#endif
-	    && gr_backsector->lightlevel == gr_frontsector->lightlevel
-		&& !gr_curline->sidedef->midtexture
-		// Check offsets too!
-		&& gr_backsector->floor_xoffs == gr_frontsector->floor_xoffs
-		&& gr_backsector->floor_yoffs == gr_frontsector->floor_yoffs
-		&& gr_backsector->floorpic_angle == gr_frontsector->floorpic_angle
-		&& gr_backsector->ceiling_xoffs == gr_frontsector->ceiling_xoffs
-		&& gr_backsector->ceiling_yoffs == gr_frontsector->ceiling_yoffs
-		&& gr_backsector->ceilingpic_angle == gr_frontsector->ceilingpic_angle
-		// Consider altered lighting.
-		&& gr_backsector->floorlightsec == gr_frontsector->floorlightsec
-		&& gr_backsector->ceilinglightsec == gr_frontsector->ceilinglightsec
-		// Consider colormaps
-		&& gr_backsector->extra_colormap == gr_frontsector->extra_colormap
-		&& ((!gr_frontsector->ffloors && !gr_backsector->ffloors)
-		|| gr_frontsector->tag == gr_backsector->tag))
-	{
-		return false;
-	}
-
+	if (backc1 != frontc1 || backc2 != frontc2
+		|| backf1 != frontf1 || backf2 != frontf2)
+		{
+			checkforemptylines = false;
+			return false;
+		}
 
 	return false;
 }
@@ -2965,6 +2940,8 @@ static void HWR_AddLine(seg_t * line)
     {
 		return;
     }
+
+	checkforemptylines = true;
 #else
 	// Clip to view edges.
 	span = angle1 - angle2;
@@ -3056,18 +3033,17 @@ static void HWR_AddLine(seg_t * line)
     else
     {
 		gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true);
-		if (line->frontsector == line->backsector)
-		{
-			if (!line->sidedef->midtexture)
-			{
-				//e6y: nothing to do here!
-				//return;
-			}
-		}
 		if (CheckClip(line, gr_frontsector, gr_backsector))
 		{
 			gld_clipper_SafeAddClipRange(angle2, angle1);
+			checkforemptylines = false;
 		}
+		// Reject empty lines used for triggers and special events.
+		// Identical floor and ceiling on both sides,
+		//  identical light levels on both sides,
+		//  and no middle texture.
+		if (checkforemptylines && R_IsEmptyLine(line, gr_frontsector, gr_backsector))
+			return;
     }
 
 	HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D
@@ -3144,38 +3120,8 @@ static void HWR_AddLine(seg_t * line)
 	// Identical floor and ceiling on both sides,
 	//  identical light levels on both sides,
 	//  and no middle texture.
-	if (
-#ifdef POLYOBJECTS
-		!line->polyseg &&
-#endif
-		gr_backsector->ceilingpic == gr_frontsector->ceilingpic
-		&& gr_backsector->floorpic == gr_frontsector->floorpic
-#ifdef ESLOPE
-		&& gr_backsector->f_slope == gr_frontsector->f_slope
-		&& gr_backsector->c_slope == gr_frontsector->c_slope
-#endif
-	    && gr_backsector->lightlevel == gr_frontsector->lightlevel
-		&& !gr_curline->sidedef->midtexture
-		// Check offsets too!
-		&& gr_backsector->floor_xoffs == gr_frontsector->floor_xoffs
-		&& gr_backsector->floor_yoffs == gr_frontsector->floor_yoffs
-		&& gr_backsector->floorpic_angle == gr_frontsector->floorpic_angle
-		&& gr_backsector->ceiling_xoffs == gr_frontsector->ceiling_xoffs
-		&& gr_backsector->ceiling_yoffs == gr_frontsector->ceiling_yoffs
-		&& gr_backsector->ceilingpic_angle == gr_frontsector->ceilingpic_angle
-		// Consider altered lighting.
-		&& gr_backsector->floorlightsec == gr_frontsector->floorlightsec
-		&& gr_backsector->ceilinglightsec == gr_frontsector->ceilinglightsec
-		// Consider colormaps
-		&& gr_backsector->extra_colormap == gr_frontsector->extra_colormap
-		&& ((!gr_frontsector->ffloors && !gr_backsector->ffloors)
-		|| gr_frontsector->tag == gr_backsector->tag))
-		// SoM: For 3D sides... Boris, would you like to take a
-		// crack at rendering 3D sides? You would need to add the
-		// above check and add code to HWR_StoreWallRange...
-	{
+	if (R_IsEmptyLine(curline, frontsector, backsector))
 		return;
-	}
 
 clippass:
 	if (x1 == x2)
diff --git a/src/r_bsp.c b/src/r_bsp.c
index 2562cff66..f63707ea2 100644
--- a/src/r_bsp.c
+++ b/src/r_bsp.c
@@ -210,7 +210,7 @@ void R_PortalClearClipSegs(INT32 start, INT32 end)
 //
 // It assumes that Doom has already ruled out a door being closed because
 // of front-back closure (e.g. front floor is taller than back ceiling).
-static inline INT32 R_DoorClosed(void)
+static INT32 R_DoorClosed(void)
 {
 	return
 
@@ -365,6 +365,36 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
 	return sec;
 }
 
+boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
+{
+	return (
+#ifdef POLYOBJECTS
+		!line->polyseg &&
+#endif
+		back->ceilingpic == front->ceilingpic
+		&& back->floorpic == front->floorpic
+#ifdef ESLOPE
+		&& back->f_slope == front->f_slope
+		&& back->c_slope == front->c_slope
+#endif
+		&& back->lightlevel == front->lightlevel
+		&& !line->sidedef->midtexture
+		// Check offsets too!
+		&& back->floor_xoffs == front->floor_xoffs
+		&& back->floor_yoffs == front->floor_yoffs
+		&& back->floorpic_angle == front->floorpic_angle
+		&& back->ceiling_xoffs == front->ceiling_xoffs
+		&& back->ceiling_yoffs == front->ceiling_yoffs
+		&& back->ceilingpic_angle == front->ceilingpic_angle
+		// Consider altered lighting.
+		&& back->floorlightsec == front->floorlightsec
+		&& back->ceilinglightsec == front->ceilinglightsec
+		// Consider colormaps
+		&& back->extra_colormap == front->extra_colormap
+		&& ((!front->ffloors && !back->ffloors)
+		|| front->tag == back->tag));
+}
+
 //
 // R_AddLine
 // Clips the given segment and adds any visible pieces to the line list.
@@ -526,36 +556,8 @@ static void R_AddLine(seg_t *line)
 	// Identical floor and ceiling on both sides, identical light levels on both sides,
 	// and no middle texture.
 
-	if (
-#ifdef POLYOBJECTS
-		!line->polyseg &&
-#endif
-		backsector->ceilingpic == frontsector->ceilingpic
-		&& backsector->floorpic == frontsector->floorpic
-#ifdef ESLOPE
-		&& backsector->f_slope == frontsector->f_slope
-		&& backsector->c_slope == frontsector->c_slope
-#endif
-		&& backsector->lightlevel == frontsector->lightlevel
-		&& !curline->sidedef->midtexture
-		// Check offsets too!
-		&& backsector->floor_xoffs == frontsector->floor_xoffs
-		&& backsector->floor_yoffs == frontsector->floor_yoffs
-		&& backsector->floorpic_angle == frontsector->floorpic_angle
-		&& backsector->ceiling_xoffs == frontsector->ceiling_xoffs
-		&& backsector->ceiling_yoffs == frontsector->ceiling_yoffs
-		&& backsector->ceilingpic_angle == frontsector->ceilingpic_angle
-		// Consider altered lighting.
-		&& backsector->floorlightsec == frontsector->floorlightsec
-		&& backsector->ceilinglightsec == frontsector->ceilinglightsec
-		// Consider colormaps
-		&& backsector->extra_colormap == frontsector->extra_colormap
-		&& ((!frontsector->ffloors && !backsector->ffloors)
-		|| frontsector->tag == backsector->tag))
-	{
+	if (R_IsEmptyLine(line, frontsector, backsector))
 		return;
-	}
-
 
 clippass:
 	R_ClipPassWallSegment(x1, x2 - 1);
diff --git a/src/r_bsp.h b/src/r_bsp.h
index e871b5dde..80824831b 100644
--- a/src/r_bsp.h
+++ b/src/r_bsp.h
@@ -50,6 +50,7 @@ extern polyobj_t **po_ptrs; // temp ptr array to sort polyobject pointers
 
 sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
 	INT32 *ceilinglightlevel, boolean back);
+boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back);
 
 INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
 void R_Prep3DFloors(sector_t *sector);