diff --git a/Builder.sln b/Builder.sln
index 4f719e97..4aa67ef0 100644
--- a/Builder.sln
+++ b/Builder.sln
@@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "USDF", "Source\Plugins\USDF
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagRange", "Source\Plugins\TagRange\TagRange.csproj", "{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GZDoomEditing", "Source\Plugins\GZDoomEditing\GZDoomEditing.csproj", "{760A9BC7-CB73-4C36-858B-994C14996FCD}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -116,6 +118,16 @@ Global
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release|Mixed Platforms.Build.0 = Release|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release|x86.ActiveCfg = Release|x86
{F49EFF6D-51CB-4E49-8223-AAE653C5B62F}.Release|x86.Build.0 = Release|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|x86.ActiveCfg = Debug|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Debug|x86.Build.0 = Debug|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Any CPU.ActiveCfg = Release|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Mixed Platforms.Build.0 = Release|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.ActiveCfg = Release|x86
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Resources/Icons/VisualModeZ.png b/Resources/Icons/VisualModeZ.png
new file mode 100644
index 00000000..110541d8
Binary files /dev/null and b/Resources/Icons/VisualModeZ.png differ
diff --git a/Source/Plugins/GZDoomEditing/GZDoomEditing.csproj b/Source/Plugins/GZDoomEditing/GZDoomEditing.csproj
new file mode 100644
index 00000000..a1656821
--- /dev/null
+++ b/Source/Plugins/GZDoomEditing/GZDoomEditing.csproj
@@ -0,0 +1,73 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {760A9BC7-CB73-4C36-858B-994C14996FCD}
+ Library
+ Properties
+ CodeImp.DoomBuilder.GZDoomEditing
+ GZDoomEditing
+ v3.5
+ 512
+
+
+ true
+ ..\..\..\Build\Plugins\
+ DEBUG;TRACE
+ full
+ x86
+ prompt
+
+
+ ..\..\..\Build\Plugins\
+
+
+ true
+ pdbonly
+ x86
+ prompt
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+ {818B3D10-F791-4C3F-9AF5-BB2D0079B63C}
+ Builder
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs b/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs
new file mode 100644
index 00000000..ae77bdda
--- /dev/null
+++ b/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs
@@ -0,0 +1,171 @@
+
+#region ================== Copyright (c) 2010 Pascal vd Heiden
+
+/*
+ * Copyright (c) 2010 Pascal vd Heiden
+ * This program is released under GNU General Public License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#endregion
+
+#region ================== Namespaces
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using System.Text;
+using System.Windows.Forms;
+using System.IO;
+using System.Reflection;
+using CodeImp.DoomBuilder.Controls;
+using CodeImp.DoomBuilder.Windows;
+using CodeImp.DoomBuilder.IO;
+using CodeImp.DoomBuilder.Map;
+using CodeImp.DoomBuilder.Rendering;
+using CodeImp.DoomBuilder.Geometry;
+using System.Drawing;
+using CodeImp.DoomBuilder.Editing;
+using CodeImp.DoomBuilder.Plugins;
+using CodeImp.DoomBuilder.Actions;
+using CodeImp.DoomBuilder.Types;
+using CodeImp.DoomBuilder.Config;
+using CodeImp.DoomBuilder.Data;
+
+#endregion
+
+namespace CodeImp.DoomBuilder.GZDoomEditing
+{
+ public class BuilderPlug : Plug
+ {
+ #region ================== Variables
+
+ // Static instance
+ private static BuilderPlug me;
+
+ #endregion
+
+ #region ================== Properties
+
+ // Static property to access the BuilderPlug
+ public static BuilderPlug Me { get { return me; } }
+
+ #endregion
+
+ #region ================== Initialize / Dispose
+
+ // This event is called when the plugin is initialized
+ public override void OnInitialize()
+ {
+ base.OnInitialize();
+
+ // Keep a static reference
+ me = this;
+ }
+
+ // This is called when the plugin is terminated
+ public override void Dispose()
+ {
+ base.Dispose();
+ }
+
+ #endregion
+
+ #region ================== Classic Mode Surfaces
+
+ // This is called when the vertices are created for the classic mode surfaces
+ public override void OnSectorFloorSurfaceUpdate(Sector s, ref FlatVertex[] vertices)
+ {
+ ImageData img = General.Map.Data.GetFlatImage(s.LongFloorTexture);
+ if((img != null) && img.IsImageLoaded)
+ {
+ float xpan, ypan, xscale, yscale, rotate;
+ int color, light;
+ bool absolute;
+
+ try
+ {
+ // Fetch ZDoom fields
+ xpan = s.Fields.ContainsKey("xpanningfloor") ? (float)s.Fields["xpanningfloor"].Value : 0.0f;
+ ypan = s.Fields.ContainsKey("ypanningfloor") ? (float)s.Fields["ypanningfloor"].Value : 0.0f;
+ xscale = s.Fields.ContainsKey("xscalefloor") ? (float)s.Fields["xscalefloor"].Value : 1.0f;
+ yscale = s.Fields.ContainsKey("yscalefloor") ? (float)s.Fields["yscalefloor"].Value : 1.0f;
+ rotate = s.Fields.ContainsKey("rotationfloor") ? (float)s.Fields["rotationfloor"].Value : 0.0f;
+ color = s.Fields.ContainsKey("lightcolor") ? (int)s.Fields["lightcolor"].Value : -1;
+ light = s.Fields.ContainsKey("lightfloor") ? (int)s.Fields["lightfloor"].Value : 0;
+ absolute = s.Fields.ContainsKey("lightfloorabsolute") ? (bool)s.Fields["lightfloorabsolute"].Value : false;
+ }
+ catch(Exception) { return; }
+
+ // Setup the vertices with the given settings
+ SetupSurfaceVertices(vertices, s, img, xpan, ypan, xscale, yscale, rotate, color, light, absolute);
+ }
+ }
+
+ // This is called when the vertices are created for the classic mode surfaces
+ public override void OnSectorCeilingSurfaceUpdate(Sector s, ref FlatVertex[] vertices)
+ {
+ ImageData img = General.Map.Data.GetFlatImage(s.LongFloorTexture);
+ if((img != null) && img.IsImageLoaded)
+ {
+ float xpan, ypan, xscale, yscale, rotate;
+ int color, light;
+ bool absolute;
+
+ try
+ {
+ // Fetch ZDoom fields
+ xpan = s.Fields.ContainsKey("xpanningceiling") ? (float)s.Fields["xpanningceiling"].Value : 0.0f;
+ ypan = s.Fields.ContainsKey("ypanningceiling") ? (float)s.Fields["ypanningceiling"].Value : 0.0f;
+ xscale = s.Fields.ContainsKey("xscaleceiling") ? (float)s.Fields["xscaleceiling"].Value : 1.0f;
+ yscale = s.Fields.ContainsKey("yscaleceiling") ? (float)s.Fields["yscaleceiling"].Value : 1.0f;
+ rotate = s.Fields.ContainsKey("rotationceiling") ? (float)s.Fields["rotationceiling"].Value : 0.0f;
+ color = s.Fields.ContainsKey("lightcolor") ? (int)s.Fields["lightcolor"].Value : -1;
+ light = s.Fields.ContainsKey("lightceiling") ? (int)s.Fields["lightceiling"].Value : 0;
+ absolute = s.Fields.ContainsKey("lightceilingabsolute") ? (bool)s.Fields["lightceilingabsolute"].Value : false;
+ }
+ catch(Exception) { return; }
+
+ // Setup the vertices with the given settings
+ SetupSurfaceVertices(vertices, s, img, xpan, ypan, xscale, yscale, rotate, color, light, absolute);
+ }
+ }
+
+ // This applies the given values on the vertices
+ private void SetupSurfaceVertices(FlatVertex[] vertices, Sector s, ImageData img, float xpan, float ypan,
+ float xscale, float yscale, float rotate, int color, int light, bool absolute)
+ {
+ // Prepare for math!
+ rotate = Angle2D.DegToRad(rotate);
+ Vector2D scale = new Vector2D(xscale, yscale);
+ Vector2D texscale = new Vector2D(1.0f / img.ScaledWidth, 1.0f / img.ScaledHeight);
+ Vector2D offset = new Vector2D(xpan, ypan);
+ if(!absolute) light = s.Brightness + light;
+ PixelColor lightcolor = PixelColor.FromInt(color);
+ PixelColor brightness = PixelColor.FromInt(General.Map.Renderer2D.CalculateBrightness(light));
+ PixelColor finalcolor = PixelColor.Modulate(lightcolor, brightness);
+ color = finalcolor.WithAlpha(255).ToInt();
+
+ // Do the math for all vertices
+ for(int i = 0; i < vertices.Length; i++)
+ {
+ Vector2D pos = new Vector2D(vertices[i].x, vertices[i].y);
+ pos = pos.GetRotated(rotate);
+ pos.y = -pos.y;
+ pos = (pos + offset) * scale * texscale;
+ vertices[i].u = pos.x;
+ vertices[i].v = pos.y;
+ vertices[i].c = color;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Source/Plugins/GZDoomEditing/Properties/AssemblyInfo.cs b/Source/Plugins/GZDoomEditing/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..7d87e92f
--- /dev/null
+++ b/Source/Plugins/GZDoomEditing/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("GZDoomEditing")]
+[assembly: AssemblyDescription("(G)ZDoom Editing Plugin")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Doom Builder")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[assembly: AssemblyTrademark("CodeImp")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("954411b0-01e9-416f-9254-432cc1a02e3c")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Source/Plugins/GZDoomEditing/Properties/Resources.Designer.cs b/Source/Plugins/GZDoomEditing/Properties/Resources.Designer.cs
new file mode 100644
index 00000000..289169a5
--- /dev/null
+++ b/Source/Plugins/GZDoomEditing/Properties/Resources.Designer.cs
@@ -0,0 +1,70 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3615
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace CodeImp.DoomBuilder.GZDoomEditing.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodeImp.DoomBuilder.GZDoomEditing.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ internal static System.Drawing.Bitmap VisualModeZ {
+ get {
+ object obj = ResourceManager.GetObject("VisualModeZ", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/Source/Plugins/GZDoomEditing/Properties/Resources.resx b/Source/Plugins/GZDoomEditing/Properties/Resources.resx
new file mode 100644
index 00000000..e80940d6
--- /dev/null
+++ b/Source/Plugins/GZDoomEditing/Properties/Resources.resx
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\Resources\VisualModeZ.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/Source/Plugins/GZDoomEditing/Resources/VisualModeZ.png b/Source/Plugins/GZDoomEditing/Resources/VisualModeZ.png
new file mode 100644
index 00000000..110541d8
Binary files /dev/null and b/Source/Plugins/GZDoomEditing/Resources/VisualModeZ.png differ
diff --git a/Tests/UDMF/udmfexample.wad b/Tests/UDMF/udmfexample.wad
index 5c8c6002..83172f3b 100644
Binary files a/Tests/UDMF/udmfexample.wad and b/Tests/UDMF/udmfexample.wad differ