From 07c2b3a82643c893f67a7da7ab76085b95c63e2e Mon Sep 17 00:00:00 2001
From: MaxED <j.maxed@gmail.com>
Date: Wed, 15 Jun 2016 14:48:21 +0000
Subject: [PATCH] Added "WorldPanning" TEXTUREx flag support.

---
 Source/Core/Data/TextureImage.cs | 3 ++-
 Source/Core/Data/WADReader.cs    | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Source/Core/Data/TextureImage.cs b/Source/Core/Data/TextureImage.cs
index cd110dc30..e5c3a43f3 100644
--- a/Source/Core/Data/TextureImage.cs
+++ b/Source/Core/Data/TextureImage.cs
@@ -39,13 +39,14 @@ namespace CodeImp.DoomBuilder.Data
 		#region ================== Constructor / Disposer
 
 		// Constructor
-		public TextureImage(string group, string name, int width, int height, float scalex, float scaley)
+		public TextureImage(string group, string name, int width, int height, float scalex, float scaley, bool worldpanning)
 		{
 			// Initialize
 			this.width = width;
 			this.height = height;
 			this.scale.x = scalex;
 			this.scale.y = scaley;
+			this.worldpanning = worldpanning; //mxd
 			this.patches = new List<TexturePatch>();
 			SetName(name);
 			virtualname = "[" + group + "]/" + this.name; //mxd
diff --git a/Source/Core/Data/WADReader.cs b/Source/Core/Data/WADReader.cs
index 8941588ce..f7569bada 100644
--- a/Source/Core/Data/WADReader.cs
+++ b/Source/Core/Data/WADReader.cs
@@ -35,6 +35,9 @@ namespace CodeImp.DoomBuilder.Data
 	{
 		#region ================== Constants
 
+		//mxd. TEXTUREx flags
+		private const int TX_WORLDPANNING = 0x8000;
+
 		#endregion
 
 		#region ================== Structures
@@ -531,6 +534,7 @@ namespace CodeImp.DoomBuilder.Data
 				// Read texture properties
 				byte[] namebytes = reader.ReadBytes(8);
 				int flags = reader.ReadUInt16();
+				bool worldpanning = (flags & TX_WORLDPANNING) != 0; //mxd
 				byte scalebytex = reader.ReadByte();
 				byte scalebytey = reader.ReadByte();
 				int width = reader.ReadInt16();
@@ -565,7 +569,7 @@ namespace CodeImp.DoomBuilder.Data
 					{
 						// Make the image object
 						image = new TextureImage(sourcename, Lump.MakeNormalName(namebytes, WAD.ENCODING),
-												 width, height, scalex, scaley);
+												 width, height, scalex, scaley, worldpanning);
 					}
 					else
 					{
-- 
GitLab