From 06e06a1cb652e0df572067b4c54d82ec2f4214f6 Mon Sep 17 00:00:00 2001
From: MascaraSnake <jonassauer27@gmail.com>
Date: Sun, 27 Jun 2021 18:45:56 +0200
Subject: [PATCH] Replicate old hack in binary maps: Translucent FOFs set to
 full opacity cut cyan pixels

---
 src/p_setup.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
 src/p_spec.c  |  2 +-
 2 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/src/p_setup.c b/src/p_setup.c
index b0488dbbb..c88aa02f5 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -3104,17 +3104,21 @@ static void P_ConvertBinaryMap(void)
 					lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture;
 				else
 					lines[i].args[1] = 128;
+
+				//Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels
+				if (lines[i].args[1] == 256)
+					lines[i].args[2] |= TMFA_SPLAT;
 			}
 			else
 				lines[i].args[1] = 255;
 
 			//Appearance
 			if (lines[i].special == 105)
-				lines[i].args[2] = TMFA_NOPLANES|TMFA_NOSIDES;
+				lines[i].args[2] |= TMFA_NOPLANES|TMFA_NOSIDES;
 			else if (lines[i].special == 104)
-				lines[i].args[2] = TMFA_NOSIDES;
+				lines[i].args[2] |= TMFA_NOSIDES;
 			else if (lines[i].special == 103)
-				lines[i].args[2] = TMFA_NOPLANES;
+				lines[i].args[2] |= TMFA_NOPLANES;
 			if (lines[i].special != 100 && (lines[i].special != 104 || !(lines[i].flags & ML_NOCLIMB)))
 				lines[i].args[2] |= TMFA_NOSHADE;
 			if (lines[i].flags & ML_EFFECT6)
@@ -3145,6 +3149,10 @@ static void P_ConvertBinaryMap(void)
 					lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture;
 				else
 					lines[i].args[1] = 128;
+
+				//Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels
+				if (lines[i].args[1] == 256)
+					lines[i].args[2] |= TMFW_SPLAT;
 			}
 
 			//No sides?
@@ -3187,15 +3195,19 @@ static void P_ConvertBinaryMap(void)
 					lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture;
 				else
 					lines[i].args[1] = 128;
+
+				//Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels
+				if (lines[i].args[1] == 256)
+					lines[i].args[2] |= TMFA_SPLAT;
 			}
 			else
 				lines[i].args[1] = 255;
 
 			//Appearance
 			if (lines[i].special == 142 || lines[i].special == 145)
-				lines[i].args[2] = TMFA_NOSIDES;
+				lines[i].args[2] |= TMFA_NOSIDES;
 			else if (lines[i].special == 146)
-				lines[i].args[2] = TMFA_NOPLANES;
+				lines[i].args[2] |= TMFA_NOPLANES;
 			if (lines[i].special != 146 && (lines[i].flags & ML_NOCLIMB))
 				lines[i].args[2] |= TMFA_NOSHADE;
 			if (lines[i].flags & ML_EFFECT6)
@@ -3256,6 +3268,10 @@ static void P_ConvertBinaryMap(void)
 					lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture;
 				else
 					lines[i].args[1] = 128;
+
+				//Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels
+				if (lines[i].args[1] == 256)
+					lines[i].args[3] |= TMFC_SPLAT;
 			}
 			else
 				lines[i].args[1] = 255;
@@ -3298,15 +3314,19 @@ static void P_ConvertBinaryMap(void)
 					lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture;
 				else
 					lines[i].args[1] = 128;
+
+				//Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels
+				if (lines[i].args[1] == 256)
+					lines[i].args[2] |= TMFA_SPLAT;
 			}
 			else
 				lines[i].args[1] = 255;
 
 			//Appearance
 			if (lines[i].special == 193)
-				lines[i].args[2] = TMFA_NOPLANES|TMFA_NOSIDES;
+				lines[i].args[2] |= TMFA_NOPLANES|TMFA_NOSIDES;
 			if (lines[i].special >= 194)
-				lines[i].args[2] = TMFA_INSIDES;
+				lines[i].args[2] |= TMFA_INSIDES;
 			if (lines[i].special != 190 && (lines[i].special <= 193 || lines[i].flags & ML_NOCLIMB))
 				lines[i].args[2] |= TMFA_NOSHADE;
 			if (lines[i].flags & ML_EFFECT6)
@@ -3354,6 +3374,10 @@ static void P_ConvertBinaryMap(void)
 					lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture;
 				else
 					lines[i].args[1] = 128;
+
+				//Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels
+				if (lines[i].args[1] == 256)
+					lines[i].args[2] |= TMFA_SPLAT;
 			}
 			else
 				lines[i].args[1] = 255;
@@ -3411,6 +3435,10 @@ static void P_ConvertBinaryMap(void)
 					lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture;
 				else
 					lines[i].args[1] = 128;
+
+				//Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels
+				if (lines[i].args[1] == 256)
+					lines[i].args[3] |= TMFB_SPLAT;
 			}
 			else
 				lines[i].args[1] = 255;
@@ -3459,7 +3487,8 @@ static void P_ConvertBinaryMap(void)
 			//Flags
 			if (lines[i].flags & ML_EFFECT1)
 				lines[i].args[2] = TMFL_NOBOSSES;
-			if (lines[i].flags & ML_EFFECT6)
+			//Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels
+			if (lines[i].flags & ML_EFFECT6 || lines[i].args[1] == 256)
 				lines[i].args[2] = TMFL_SPLAT;
 
 			break;
@@ -3478,6 +3507,10 @@ static void P_ConvertBinaryMap(void)
 					lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture;
 				else
 					lines[i].args[1] = 128;
+
+				//Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels
+				if (lines[i].args[1] == 256)
+					lines[i].args[2] |= FF_SPLAT;
 			}
 			else
 				lines[i].args[1] = 255;
diff --git a/src/p_spec.c b/src/p_spec.c
index 0b1b8e90f..ae144307e 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -5635,7 +5635,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, I
 	}
 
 	fflr->alpha = max(0, min(0xff, alpha));
-	if (fflr->alpha < 0xff)
+	if (fflr->alpha < 0xff || flags & FF_SPLAT)
 	{
 		fflr->flags |= FF_TRANSLUCENT;
 		fflr->spawnflags = fflr->flags;
-- 
GitLab