From 35e5d673e08485e685a0f7660397348f81e2982d Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Tue, 19 May 2020 18:43:33 +0100
Subject: [PATCH] do tx checking after tz clamping, not before

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

diff --git a/src/r_things.c b/src/r_things.c
index a4bd19627c..6bdb7cae8c 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -1582,9 +1582,6 @@ static void R_ProjectSprite(mobj_t *thing)
 		if (max(tz, tz2) < FixedMul(MINZ, this_scale)) // non-papersprite clipping is handled earlier
 			return;
 
-		if (tx2 < -(tz2<<2) || tx > tz<<2) // too far off the side?
-			return;
-
 		// Needs partially clipped
 		if (tz < FixedMul(MINZ, this_scale))
 		{
@@ -1603,6 +1600,9 @@ static void R_ProjectSprite(mobj_t *thing)
 			xscale2 = FixedDiv(projection, tz2);
 		}
 
+		if (tx2 < -(tz2<<2) || tx > tz<<2) // too far off the side?
+			return;
+
 		// TODO: tx clamping
 
 		x1 = (centerxfrac + FixedMul(tx,xscale))>>FRACBITS;
-- 
GitLab