From 3c21ca9cb18e240b2503cb255e02f452f71774e3 Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <coelckers@users.noreply.github.com>
Date: Wed, 1 Mar 2017 22:06:39 +0100
Subject: [PATCH] - added a compatibility option to move vertices and applied
 it to E1M6 of Masters of Chaos.

This map has a door/lift combination that could trap the player without any chance to get out because both elements are so close together that it was almost impossible to trigger the lift. Moved two vertices by one map unit to make enough room.
---
 src/compatibility.cpp           | 25 ++++++++++++++++++++++++-
 wadsrc/static/compatibility.txt |  6 ++++++
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/src/compatibility.cpp b/src/compatibility.cpp
index 0b27a1efa0..37531d40fa 100644
--- a/src/compatibility.cpp
+++ b/src/compatibility.cpp
@@ -86,6 +86,7 @@ enum
 	CP_SETTHINGZ,
 	CP_SETTAG,
 	CP_SETTHINGFLAGS,
+	CP_SETVERTEX,
 };
 
 // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
@@ -345,7 +346,19 @@ void ParseCompatibility()
 				sc.MustGetNumber();
 				CompatParams.Push(sc.Number);
 			}
-			else 
+			else if (sc.Compare("setvertex"))
+			{
+				if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
+				CompatParams.Push(CP_SETVERTEX);
+				sc.MustGetNumber();
+				CompatParams.Push(sc.Number);
+				sc.MustGetFloat();
+				CompatParams.Push(int(sc.Float * 256));	// do not use full fixed here so that it can eventually handle larger levels
+				sc.MustGetFloat();
+				CompatParams.Push(int(sc.Float * 256));	// do not use full fixed here so that it can eventually handle larger levels
+				flags.CompatFlags[SLOT_BCOMPAT] |= BCOMPATF_REBUILDNODES;
+			}
+			else
 			{
 				sc.UnGet();
 				break;
@@ -600,6 +613,16 @@ void SetCompatibilityParams()
 					i += 3;
 					break;
 				}
+				case CP_SETVERTEX:
+				{
+					if ((unsigned)CompatParams[i + 1] < level.vertexes.Size())
+					{
+						level.vertexes[CompatParams[i + 1]].p.X = CompatParams[i + 2] / 256.;
+						level.vertexes[CompatParams[i + 1]].p.Y = CompatParams[i + 3] / 256.;
+					}
+					i += 4;
+					break;
+				}
 			}
 		}
 	}
diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt
index 020d8477d6..9f7564b95f 100644
--- a/wadsrc/static/compatibility.txt
+++ b/wadsrc/static/compatibility.txt
@@ -497,6 +497,12 @@ ABC4EB5A1535ECCD0061AD14F3547908 // Plutonia Experiment, map26
 	setsectorspecial 156 0
 }
 
+B68EB7CFB4CC481796E2919B9C16DFBD // Moc11.wad e1m6
+{
+	setvertex 1650 -3072 2671
+	setvertex 1642 -2944 2671
+}
+
 712BB4CFBD0753178CA0C6814BE4C288 // map12 BTSX_E1 - patch some rendering glitches that are problematic to detect
 {
 	setsectortag 545 32000