From 04855a85dc1085f067ce1f1f64197d45dff821f8 Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Mon, 31 Oct 2022 19:03:09 -0700
Subject: [PATCH] Use angle between viewz and mobj z to determine splat sprite
 angle

---
 src/hardware/hw_main.c | 13 ++++++++++---
 src/r_things.c         |  6 +++++-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 1b1a26b239..be45c95d1e 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -5195,9 +5195,16 @@ static void HWR_ProjectSprite(mobj_t *thing)
 		I_Error("sprframes NULL for sprite %d\n", thing->sprite);
 #endif
 
-	ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
-	if (mirrored)
-		ang = InvAngle(ang);
+	if (splat)
+	{
+		ang = R_PointToAngle2(0, viewz, 0, interp.z);
+	}
+	else
+	{
+		ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
+		if (mirrored)
+			ang = InvAngle(ang);
+	}
 
 	if (sprframe->rotate == SRF_SINGLE)
 	{
diff --git a/src/r_things.c b/src/r_things.c
index 081c2b2115..9fbdf24aa7 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -1586,7 +1586,11 @@ static void R_ProjectSprite(mobj_t *thing)
 		I_Error("R_ProjectSprite: sprframes NULL for sprite %d\n", thing->sprite);
 #endif
 
-	if (sprframe->rotate != SRF_SINGLE || papersprite)
+	if (splat)
+	{
+		ang = R_PointToAngle2(0, viewz, 0, interp.z);
+	}
+	else if (sprframe->rotate != SRF_SINGLE || papersprite)
 	{
 		ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
 		if (mirrored)
-- 
GitLab