From 35e9e5b33ca75bb35eb76998008286bf76ef9fce Mon Sep 17 00:00:00 2001
From: MascaraSnake <jonassauer27@gmail.com>
Date: Sun, 3 May 2020 09:13:14 +0200
Subject: [PATCH] Rearrange FOF flags and improve custom FOF backwards
 compatibility

---
 extras/conf/udb/Includes/SRB222_linedefs.cfg |  4 ++--
 src/p_setup.c                                |  1 +
 src/p_spec.c                                 | 25 +++++++++++++-------
 src/r_defs.h                                 | 10 ++------
 4 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg
index 2b70e9a7d4..a6682cd07c 100644
--- a/extras/conf/udb/Includes/SRB222_linedefs.cfg
+++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg
@@ -2112,8 +2112,8 @@ udmf
 					4194304 = "Mario block";
 					33554432 = "Intangible from below";
 					67108864 = "Intangible from above";
-					1073741824 = "Ripple effect";
-					2147483648 = "Don't copy light level";
+					134217728 = "Ripple effect";
+					268435456 = "Don't copy light level";
 				}
 			}
 		}
diff --git a/src/p_setup.c b/src/p_setup.c
index 6551f3b4a7..e21cc150c3 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -3163,6 +3163,7 @@ static void P_ConvertBinaryMap(void)
 
 			lines[i].args[0] = lines[i].tag;
 			lines[i].args[1] = sides[lines[i].sidenum[1]].toptexture;
+			lines[i].args[2] = sides[lines[i].sidenum[1]].midtexture;
 			if (lines[i].args[1] & FF_TRANSLUCENT)
 			{
 				if (sides[lines[i].sidenum[0]].toptexture > 0)
diff --git a/src/p_spec.c b/src/p_spec.c
index a7d773e20a..77bc2407fe 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -7023,16 +7023,23 @@ void P_SpawnSpecials(boolean fromnetsave)
 						}
 						if (lines[i].args[1] & FF_BUSTUP)
 						{
-							if (lines[i].args[1] & BFF_SHATTER)
-								fflr->busttype = BT_TOUCH;
-							else if (lines[i].args[1] & BFF_SPINBUST)
-								fflr->busttype = BT_SPIN;
-							else if (lines[i].args[1] & BFF_STRONGBUST)
-								fflr->busttype = BT_STRONG;
-							else
-								fflr->busttype = BT_REGULAR;
+							switch (lines[i].args[2] % TMFB_ONLYBOTTOM)
+							{
+								case TMFB_TOUCH:
+									fflr->busttype = BT_TOUCH;
+									break;
+								case TMFB_SPIN:
+									fflr->busttype = BT_SPIN;
+									break;
+								case TMFB_REGULAR:
+									fflr->busttype = BT_REGULAR;
+									break;
+								case TMFB_STRONG:
+									fflr->busttype = BT_STRONG;
+									break;
+							}
 
-							if (lines[i].args[1] & BFF_SHATTERBOTTOM)
+							if (lines[i].args[2] & TMFB_ONLYBOTTOM)
 								fflr->bustflags |= BF_ONLYBOTTOM;
 							if (lines[i].flags & ML_EFFECT4)
 								fflr->bustflags |= BF_PUSHABLES;
diff --git a/src/r_defs.h b/src/r_defs.h
index c791117ba6..2f7b5622c0 100644
--- a/src/r_defs.h
+++ b/src/r_defs.h
@@ -144,16 +144,10 @@ typedef enum
 	FF_PLATFORM          = 0x2000000,  ///< You can jump up through this to the top.
 	FF_REVERSEPLATFORM   = 0x4000000,  ///< A fall-through floor in normal gravity, a platform in reverse gravity.
 	FF_INTANGIBLEFLATS   = 0x6000000,  ///< Both flats are intangible, but the sides are still solid.
-	FF_RIPPLE            = 0x40000000, ///< Ripple the flats
-	FF_COLORMAPONLY      = 0x80000000, ///< Only copy the colormap, not the lightlevel
+	FF_RIPPLE            = 0x8000000,  ///< Ripple the flats
+	FF_COLORMAPONLY      = 0x10000000, ///< Only copy the colormap, not the lightlevel
 } ffloortype_e;
 
-//Binary map format ffloor flags, for backwards compatibility only
-#define BFF_SHATTERBOTTOM 0x200000
-#define BFF_SHATTER       0x8000000
-#define BFF_SPINBUST      0x10000000
-#define BFF_STRONGBUST    0x20000000
-
 typedef enum
 {
 	BT_TOUCH,
-- 
GitLab