From 916f831edbeba5f1ec9cd26714342cf2ffd471b4 Mon Sep 17 00:00:00 2001
From: MascaraSnake <jonassauer27@gmail.com>
Date: Tue, 14 Apr 2020 09:14:10 +0200
Subject: [PATCH] Implement linedef type 250

---
 extras/conf/udb/Includes/SRB222_linedefs.cfg | 21 ++++++++++++++++++++
 src/p_setup.c                                |  7 +++++++
 src/p_spec.c                                 |  4 ++--
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg
index 1bd5055e2a..528690dc4f 100644
--- a/extras/conf/udb/Includes/SRB222_linedefs.cfg
+++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg
@@ -1623,6 +1623,27 @@ udmf
 		}
 	}
 
+	250
+	{
+		title = "Mario Block";
+		prefix = "(250);
+		arg0
+		{
+			title = "Target sector tag";
+			type = 13;
+		}
+		arg1
+		{
+			title = "Block type";
+			type = 12;
+			enum
+			{
+				1 = "Brick";
+				2 = "Invisible";
+			}
+		}
+	}
+
 	linedefexecmisc
 	{
 		title = "Linedef Executor (misc.)";
diff --git a/src/p_setup.c b/src/p_setup.c
index cf5dbcbc79..92eaff4b58 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -2931,6 +2931,13 @@ static void P_ConvertBinaryMap(void)
 		case 223: //FOF: Intangible, invisible
 			lines[i].args[0] = lines[i].tag;
 			break;
+		case 250: //FOF: Mario block
+			lines[i].args[0] = lines[i].tag;
+			if (lines[i].flags & ML_NOCLIMB) //Brick block
+				lines[i].args[1] |= 1;
+			if (lines[i].flags & ML_EFFECT1) //Invisible
+				lines[i].args[1] |= 2;
+			break;
 		case 443: //Call Lua function
 			if (lines[i].text)
 			{
diff --git a/src/p_spec.c b/src/p_spec.c
index d10d72a0f0..94e6aa936b 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -6987,9 +6987,9 @@ void P_SpawnSpecials(boolean fromnetsave)
 
 			case 250: // Mario Block
 				ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_MARIO;
-				if (lines[i].flags & ML_NOCLIMB)
+				if (lines[i].args[1] & 1) //Brick block
 					ffloorflags |= FF_SHATTERBOTTOM;
-				if (lines[i].flags & ML_EFFECT1)
+				if (lines[i].args[1] & 2) // Invisible
 					ffloorflags &= ~(FF_SOLID|FF_RENDERALL|FF_CUTLEVEL);
 
 				P_AddFakeFloorsByLine(i, ffloorflags, secthinkers);
-- 
GitLab