From 649c96261a8ad72996b19ff84c39d074ef46cd5b Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <c.oelckers@users.noreply.github.com>
Date: Wed, 23 Nov 2016 10:13:17 +0100
Subject: [PATCH 1/6] - clarified error messages for bogus conversation
 scripts.

---
 src/p_conversation.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp
index 0bc2b98a8..41c873375 100644
--- a/src/p_conversation.cpp
+++ b/src/p_conversation.cpp
@@ -252,7 +252,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc
 
 	if ((type == 1 && !isbinary) || (type == 2 && isbinary))
 	{
-		DPrintf(DMSG_ERROR, "Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum));
+		DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum));
 		return false;
 	}
 
@@ -272,7 +272,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc
 			// is exactly 1516 bytes long.
 			if (numnodes % 1516 != 0)
 			{
-				DPrintf(DMSG_ERROR, "Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum));
+				DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum));
 				return false;
 			}
 			numnodes /= 1516;
@@ -282,7 +282,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc
 			// And the teaser version has 1488-byte entries.
 			if (numnodes % 1488 != 0)
 			{
-				DPrintf(DMSG_ERROR, "Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum));
+				DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum));
 				return false;
 			}
 			numnodes /= 1488;

From 0489b6e7c5075bad5c83b9b2961c9f629ec11197 Mon Sep 17 00:00:00 2001
From: Edoardo Prezioso <edward.san.dev@gmail.com>
Date: Wed, 23 Nov 2016 10:19:52 +0100
Subject: [PATCH 2/6] - Fixed missing newlines to the conversation error
 message.

---
 src/p_conversation.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp
index 41c873375..0208e6477 100644
--- a/src/p_conversation.cpp
+++ b/src/p_conversation.cpp
@@ -252,7 +252,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc
 
 	if ((type == 1 && !isbinary) || (type == 2 && isbinary))
 	{
-		DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum));
+		DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", Wads.GetLumpFullName(lumpnum));
 		return false;
 	}
 
@@ -272,7 +272,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc
 			// is exactly 1516 bytes long.
 			if (numnodes % 1516 != 0)
 			{
-				DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum));
+				DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", Wads.GetLumpFullName(lumpnum));
 				return false;
 			}
 			numnodes /= 1516;
@@ -282,7 +282,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc
 			// And the teaser version has 1488-byte entries.
 			if (numnodes % 1488 != 0)
 			{
-				DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum));
+				DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", Wads.GetLumpFullName(lumpnum));
 				return false;
 			}
 			numnodes /= 1488;

From 6ae266c76eb191f5a607b721cccc7a1b3567f1a0 Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <c.oelckers@users.noreply.github.com>
Date: Wed, 23 Nov 2016 14:27:08 +0100
Subject: [PATCH 3/6] - fixed: The check for identical floor planes on an
 opening should never allow it to be narrowed down.

This can cause problems in rare situations where a sloped plane is checked outside its sector boundaries.
---
 src/p_map.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/p_map.cpp b/src/p_map.cpp
index 5cc9bdf72..d102307bc 100644
--- a/src/p_map.cpp
+++ b/src/p_map.cpp
@@ -839,9 +839,11 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
 
 	// If the floor planes on both sides match we should recalculate open.bottom at the actual position we are checking
 	// This is to avoid bumpy movement when crossing a linedef with the same slope on both sides.
+	// This should never narrow down the opening, though, only widen it.
 	if (open.frontfloorplane == open.backfloorplane && open.bottom > LINEOPEN_MIN)
 	{
-		open.bottom = open.frontfloorplane.ZatPoint(cres.Position);
+		auto newopen = open.frontfloorplane.ZatPoint(cres.Position);
+		if (newopen < open.bottom) open.bottom = newopen;
 	}
 
 	if (rail &&

From 5b059971f0eceb38f9883d19b37b0adcd4360e67 Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <c.oelckers@users.noreply.github.com>
Date: Wed, 23 Nov 2016 14:32:18 +0100
Subject: [PATCH 4/6] - fixed: P_SpawnMapThing forced gravity instead of
 disabling it when being given Gravity = 0 from UDMF.

---
 src/p_mobj.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp
index 2183f8cb9..62da26049 100644
--- a/src/p_mobj.cpp
+++ b/src/p_mobj.cpp
@@ -5063,7 +5063,11 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
 	if (mthing->FloatbobPhase >= 0 && mthing->FloatbobPhase < 64) mobj->FloatBobPhase = mthing->FloatbobPhase;
 	if (mthing->Gravity < 0) mobj->Gravity = -mthing->Gravity;
 	else if (mthing->Gravity > 0) mobj->Gravity *= mthing->Gravity;
-	else mobj->flags &= ~MF_NOGRAVITY;
+	else 
+	{
+		mobj->flags |= MF_NOGRAVITY;
+		mobj->Gravity = 0;
+	}
 
 	// For Hexen floatbob 'compatibility' we do not really want to alter the floorz.
 	if (mobj->specialf1 == 0 || !(mobj->flags2 & MF2_FLOATBOB) || !(ib_compatflags & BCOMPATF_FLOATBOB))

From e138a3ffbc916ac2c9390c4f339e9154e07222a7 Mon Sep 17 00:00:00 2001
From: "alexey.lysiuk" <alexey.lysiuk@gmail.com>
Date: Wed, 23 Nov 2016 12:15:58 +0200
Subject: [PATCH 5/6] Fixed infinite recursion with self-referencing multipatch
 textures

See http://forum.zdoom.org/viewtopic.php?t=54355
---
 src/textures/multipatchtexture.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp
index 88d8815a6..de3dd2f13 100644
--- a/src/textures/multipatchtexture.cpp
+++ b/src/textures/multipatchtexture.cpp
@@ -1334,6 +1334,7 @@ void FMultiPatchTexture::ResolvePatches()
 				{
 					if (Inits[i].HasLine) Inits[i].sc.Message(MSG_WARNING, "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars());
 					else Printf(TEXTCOLOR_YELLOW  "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars());
+					continue;
 				}
 				else
 				{

From 9bd19c2d2e48556018458348fe07d2a4ea4f557e Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <c.oelckers@users.noreply.github.com>
Date: Wed, 23 Nov 2016 14:38:45 +0100
Subject: [PATCH 6/6] - ensure that the MAPINFO parser never mixes HexenHack
 parsing with the new format.

---
 src/g_mapinfo.cpp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp
index bc0470474..7bfb690e7 100644
--- a/src/g_mapinfo.cpp
+++ b/src/g_mapinfo.cpp
@@ -1508,10 +1508,18 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
 
 	if (sc.CheckNumber())
 	{	// MAPNAME is a number; assume a Hexen wad
-		char maptemp[8];
-		mysnprintf (maptemp, countof(maptemp), "MAP%02d", sc.Number);
-		mapname = maptemp;
-		HexenHack = true;
+		if (format_type == FMT_New)
+		{
+			mapname = sc.String;
+		}
+		else
+		{
+			char maptemp[8];
+			mysnprintf(maptemp, countof(maptemp), "MAP%02d", sc.Number);
+			mapname = maptemp;
+			HexenHack = true;
+			format_type = FMT_Old;
+		}
 	}
 	else 
 	{