From 3f5e7ff0d06b2a0aa7fdb1c42e9ebdc34b13129c Mon Sep 17 00:00:00 2001
From: Zwip-Zwap Zapony <ZwipZwapZapony@gmail.com>
Date: Mon, 22 May 2023 20:53:17 +0200
Subject: [PATCH] Interpolate shadows when scaling mobjs

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

diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 343fa43bf8..6e72145713 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -3606,6 +3606,8 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale)
 
 	scalemul = FixedMul(FRACUNIT - floordiff/640, scale);
 	scalemul = FixedMul(scalemul, (thing->radius*2) / gpatch->height);
+	if ((thing->scale != thing->old_scale) && (thing->scale >= FRACUNIT/1024)) // Interpolate shadows when scaling mobjs
+		scalemul = FixedMul(scalemul, FixedDiv(interp.scale, thing->scale));
 
 	fscale = FIXED_TO_FLOAT(scalemul);
 	fx = FIXED_TO_FLOAT(interp.x);
diff --git a/src/r_things.c b/src/r_things.c
index 2916482fb2..62d97ff330 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -1324,6 +1324,8 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
 	if (trans >= 9) return;
 
 	scalemul = FixedMul(FRACUNIT - floordiff/640, scale);
+	if ((thing->scale != thing->old_scale) && (thing->scale >= FRACUNIT/1024)) // Interpolate shadows when scaling mobjs
+		scalemul = FixedMul(scalemul, FixedDiv(interp.scale, thing->scale));
 
 	patch = W_CachePatchName("DSHADOW", PU_SPRITE);
 	xscale = FixedDiv(projection, tz);
-- 
GitLab