From 02a7d8e0a2ec70f71e0a0ac5fd22c4faeece433a Mon Sep 17 00:00:00 2001
From: Jaime Passos <lazymyuutsu@gmail.com>
Date: Fri, 6 Sep 2019 19:37:07 -0300
Subject: [PATCH] Fix tilted spans.

---
 src/r_draw8.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/r_draw8.c b/src/r_draw8.c
index 1c4527a8e6..77406f83c6 100644
--- a/src/r_draw8.c
+++ b/src/r_draw8.c
@@ -726,8 +726,8 @@ void R_DrawTiltedSpan_8(void)
 
 		if (!ds_powersoftwo)
 		{
-			fixed_t x = ((u-viewx) >> FRACBITS);
-			fixed_t y = ((v-viewy) >> FRACBITS);
+			fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+			fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 			// Carefully align all of my Friends.
 			if (x < 0)
@@ -780,8 +780,8 @@ void R_DrawTiltedSpan_8(void)
 			colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
 			if (!ds_powersoftwo)
 			{
-				fixed_t x = ((u-viewx) >> FRACBITS);
-				fixed_t y = ((v-viewy) >> FRACBITS);
+				fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+				fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 				// Carefully align all of my Friends.
 				if (x < 0)
@@ -813,8 +813,8 @@ void R_DrawTiltedSpan_8(void)
 			colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
 			if (!ds_powersoftwo)
 			{
-				fixed_t x = ((u-viewx) >> FRACBITS);
-				fixed_t y = ((v-viewy) >> FRACBITS);
+				fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+				fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 				// Carefully align all of my Friends.
 				if (x < 0)
@@ -851,8 +851,8 @@ void R_DrawTiltedSpan_8(void)
 				colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
 				if (!ds_powersoftwo)
 				{
-					fixed_t x = ((u-viewx) >> FRACBITS);
-					fixed_t y = ((v-viewy) >> FRACBITS);
+					fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+					fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 					// Carefully align all of my Friends.
 					if (x < 0)
@@ -929,8 +929,8 @@ void R_DrawTiltedTranslucentSpan_8(void)
 		colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
 		if (!ds_powersoftwo)
 		{
-			fixed_t x = ((u-viewx) >> FRACBITS);
-			fixed_t y = ((v-viewy) >> FRACBITS);
+			fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+			fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 			// Carefully align all of my Friends.
 			if (x < 0)
@@ -983,8 +983,8 @@ void R_DrawTiltedTranslucentSpan_8(void)
 			colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
 			if (!ds_powersoftwo)
 			{
-				fixed_t x = ((u-viewx) >> FRACBITS);
-				fixed_t y = ((v-viewy) >> FRACBITS);
+				fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+				fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 				// Carefully align all of my Friends.
 				if (x < 0)
@@ -1016,8 +1016,8 @@ void R_DrawTiltedTranslucentSpan_8(void)
 			colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
 			if (!ds_powersoftwo)
 			{
-				fixed_t x = ((u-viewx) >> FRACBITS);
-				fixed_t y = ((v-viewy) >> FRACBITS);
+				fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+				fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 				// Carefully align all of my Friends.
 				if (x < 0)
@@ -1054,8 +1054,8 @@ void R_DrawTiltedTranslucentSpan_8(void)
 				colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
 				if (!ds_powersoftwo)
 				{
-					fixed_t x = ((u-viewx) >> FRACBITS);
-					fixed_t y = ((v-viewy) >> FRACBITS);
+					fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+					fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 					// Carefully align all of my Friends.
 					if (x < 0)
@@ -1132,8 +1132,8 @@ void R_DrawTiltedSplat_8(void)
 
 		if (!ds_powersoftwo)
 		{
-			fixed_t x = ((u-viewx) >> FRACBITS);
-			fixed_t y = ((v-viewy) >> FRACBITS);
+			fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+			fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 			// Carefully align all of my Friends.
 			if (x < 0)
@@ -1190,8 +1190,8 @@ void R_DrawTiltedSplat_8(void)
 			colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
 			if (!ds_powersoftwo)
 			{
-				fixed_t x = ((u-viewx) >> FRACBITS);
-				fixed_t y = ((v-viewy) >> FRACBITS);
+				fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+				fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 				// Carefully align all of my Friends.
 				if (x < 0)
@@ -1225,8 +1225,8 @@ void R_DrawTiltedSplat_8(void)
 			colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
 			if (!ds_powersoftwo)
 			{
-				fixed_t x = ((u-viewx) >> FRACBITS);
-				fixed_t y = ((v-viewy) >> FRACBITS);
+				fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+				fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 				// Carefully align all of my Friends.
 				if (x < 0)
@@ -1266,8 +1266,8 @@ void R_DrawTiltedSplat_8(void)
 				val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
 				if (!ds_powersoftwo)
 				{
-					fixed_t x = ((u-viewx) >> FRACBITS);
-					fixed_t y = ((v-viewy) >> FRACBITS);
+					fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
+					fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
 
 					// Carefully align all of my Friends.
 					if (x < 0)
-- 
GitLab