Sign in to follow this  
Followers 0

HOM in sky in ZDoom SVN >= r4225 [patch]

Recently, ZDoom has begun to show large HOM effects in places above sky floors, e.g. outside in E1M1 (shown below, shot taken in r4244)



This misbehaviour can be traced to r4225, which made the following change:

r4225 | rheit | 2013-04-23 04:51:51 +0100 (Tue, 23 Apr 2013) | 2 lines

- Fixed: r4220 broke 3D floor rendering, because 3D floors have the floor and ceiling orientations
  reversed compared to normal conventions.

Index: src/r_segs.cpp
===================================================================
--- src/r_segs.cpp	(revision 4224)
+++ src/r_segs.cpp	(revision 4225)
@@ -2242,10 +2242,18 @@
 	// killough 3/7/98: add deep water check
 	if (frontsector->GetHeightSec() == NULL)
 	{
-		if (frontsector->floorplane.PointOnSide(viewx, viewy, viewz) <= 0)	// above view plane
+		int planeside;
+
+		planeside = frontsector->floorplane.PointOnSide(viewx, viewy, viewz);
+		if (frontsector->floorplane.c < 0)	// 3D floors have the floor backwards
+			planeside = -planeside;
+		if (planeside <= 0)		// above view plane
 			markfloor = false;
-		if (frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz) <= 0 &&
-			frontsector->GetTexture(sector_t::ceiling) != skyflatnum)		// below view plane
+
+		planeside = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz);
+		if (frontsector->ceilingplane.c > 0)	// 3D floors have the ceiling backwards
+			planeside = -planeside;
+		if (planeside <= 0)		// below view plane
 			markceiling = false;
 	}
 
in which we see a check for sky ceilings removed in the deleted lines, and not restored in their replacements.

Restoring the check for skyflatnum fixes the bug, for example by the following patch
diff --git a/src/r_segs.cpp b/src/r_segs.cpp
index 9d9f197..ce47921 100644
--- a/src/r_segs.cpp
+++ b/src/r_segs.cpp
@@ -2253,7 +2253,8 @@ void R_NewWall (bool needlights)
 		planeside = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz);
 		if (frontsector->ceilingplane.c > 0)	// 3D floors have the ceiling backwards
 			planeside = -planeside;
-		if (planeside <= 0)		// below view plane
+		if (planeside <= 0 &&	// below view plane
+			frontsector->GetTexture(sector_t::ceiling) != skyflatnum)
 			markceiling = false;
 	}
 
I don't have an account on zdoom.org, but I believe several of its developers read this forum so I hope the message can be passed along.

Thanks!

Share this post


Link to post

Hey, thanks! :)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0