From 485f671f23a27526e4ad89ff559ec1e842dcd12d Mon Sep 17 00:00:00 2001
From: RedEnchilada <redenchilada@derpymail.com>
Date: Sat, 23 May 2015 02:18:32 -0500
Subject: [PATCH] Sloped planes now respect flat offsets

---
 src/r_plane.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/r_plane.c b/src/r_plane.c
index 1c4abc8c53..aad98364d4 100644
--- a/src/r_plane.c
+++ b/src/r_plane.c
@@ -437,6 +437,9 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
 	visplane_t *check;
 	unsigned hash;
 
+#ifdef ESLOPE
+	if (slope); else // Don't mess with this right now if a slope is involved
+#endif
 	if (plangle != 0)
 	{
 		// Add the view offset, rotated by the plane angle.
@@ -946,8 +949,8 @@ void R_DrawSinglePlane(visplane_t *pl)
 		//double zeroheight;
 		float fudge;
 
-		float vx = FIXED_TO_FLOAT(viewx);
-		float vy = FIXED_TO_FLOAT(viewy);
+		float vx = FIXED_TO_FLOAT(viewx+xoffs);
+		float vy = FIXED_TO_FLOAT(viewy-yoffs);
 		float vz = FIXED_TO_FLOAT(viewz);
 
 		zeroheight = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx, viewy));
@@ -960,7 +963,7 @@ void R_DrawSinglePlane(visplane_t *pl)
 		ang = ANG2RAD(ANGLE_270 - viewangle);
 		p.x = vx * cos(ang) - vy * sin(ang);
 		p.z = vx * sin(ang) + vy * cos(ang);
-		p.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, 0, 0)) - vz;
+		p.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, -xoffs, yoffs)) - vz;
 
 		// m is the v direction vector in view space
 		ang = ANG2RAD(ANGLE_180 - viewangle - pl->plangle);
-- 
GitLab