From 57a880a286e53ccbdd8ee0f9df59522afd733cbc Mon Sep 17 00:00:00 2001
From: Lactozilla <jp6781615@gmail.com>
Date: Sun, 3 Sep 2023 19:35:58 -0300
Subject: [PATCH] Fix a bug

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

diff --git a/src/r_things.c b/src/r_things.c
index f8456fa11..385cbaaa5 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -3194,9 +3194,11 @@ static boolean R_CheckSpriteVisible(vissprite_t *spr, INT32 x1, INT32 x2)
 	INT16 szt = spr->szt;
 
 	fixed_t texturemid, yscale, scalestep = spr->scalestep;
+	INT32 height;
 
 	if (scalestep)
 	{
+		height = spr->patch->height;
 		yscale = spr->scale;
 		scalestep = FixedMul(scalestep, spr->spriteyscale);
 
@@ -3210,8 +3212,10 @@ static boolean R_CheckSpriteVisible(vissprite_t *spr, INT32 x1, INT32 x2)
 	{
 		if (scalestep)
 		{
-			szt = (INT16)((centeryfrac - FixedMul(texturemid, yscale))>>FRACBITS);
-			sz = (INT16)((centeryfrac - FixedMul(texturemid, yscale))>>FRACBITS);
+			fixed_t top = centeryfrac - FixedMul(texturemid, yscale);
+			fixed_t bottom = top + (height * yscale);
+			szt = (INT16)(top >> FRACBITS);
+			sz = (INT16)(bottom >> FRACBITS);
 			yscale += scalestep;
 		}
 
-- 
GitLab