diff --git a/Source/Plugins/GZDoomEditing/GZDoomEditing.csproj b/Source/Plugins/GZDoomEditing/GZDoomEditing.csproj
index 82b8bc1d..b4a7b610 100644
--- a/Source/Plugins/GZDoomEditing/GZDoomEditing.csproj
+++ b/Source/Plugins/GZDoomEditing/GZDoomEditing.csproj
@@ -55,6 +55,9 @@
+
+
+
diff --git a/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs b/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs
index 3d1ca5c5..25cdcad7 100644
--- a/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs
+++ b/Source/Plugins/GZDoomEditing/General/BuilderPlug.cs
@@ -103,6 +103,10 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// Keep a static reference
me = this;
+ // Settings
+ showvisualthings = 2;
+ usegravity = false;
+ usehighlight = true;
LoadSettings();
}
diff --git a/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs b/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs
index 87c48f8f..9ea5ff56 100644
--- a/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs
+++ b/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs
@@ -68,6 +68,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
private VisualPickResult target;
private double lastpicktime;
private bool locktarget;
+
+ // This keeps extra sector info
+ private Dictionary sectordata;
// This is true when a selection was made because the action is performed
// on an object that was not selected. In this case the previous selection
@@ -132,6 +135,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// Initialize
this.gravity = new Vector3D(0.0f, 0.0f, 0.0f);
this.selectedobjects = new List();
+ this.sectordata = new Dictionary(General.Map.Map.Sectors.Count);
// We have no destructor
GC.SuppressFinalize(this);
@@ -153,6 +157,20 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
#endregion
#region ================== Methods
+
+ // This requests a sector's extra data
+ internal SectorData GetSectorData(Sector s)
+ {
+ if(sectordata.ContainsKey(s))
+ {
+ return sectordata[s];
+ }
+ else
+ {
+ // TODO: Build the sector data now?
+ return new SectorData(this, s);
+ }
+ }
// This calculates brightness level
internal int CalculateBrightness(int level)
@@ -544,6 +562,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
protected override void ResourcesReloaded()
{
base.ResourcesReloaded();
+ sectordata = new Dictionary(General.Map.Map.Sectors.Count);
PickTarget();
}
diff --git a/Source/Plugins/GZDoomEditing/VisualModes/SectorData.cs b/Source/Plugins/GZDoomEditing/VisualModes/SectorData.cs
new file mode 100644
index 00000000..81d8c399
--- /dev/null
+++ b/Source/Plugins/GZDoomEditing/VisualModes/SectorData.cs
@@ -0,0 +1,81 @@
+#region === Copyright (c) 2010 Pascal van der Heiden ===
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using CodeImp.DoomBuilder.Geometry;
+using CodeImp.DoomBuilder.Map;
+using CodeImp.DoomBuilder.Rendering;
+
+#endregion
+
+namespace CodeImp.DoomBuilder.GZDoomEditing
+{
+ internal class SectorData
+ {
+ #region ================== Variables
+
+ // Sector for which this data is
+ private Sector sector;
+
+ // First level is the sector's absolute ceiling
+ // Last level is the sector's absolute floor
+ private List levels;
+
+ #endregion
+
+ #region ================== Properties
+
+ public Sector Sector { get { return sector; } }
+ public List Levels { get { return levels; } }
+
+ #endregion
+
+ #region ================== Constructor / Destructor
+
+ // Constructor
+ public SectorData(BaseVisualMode mode, Sector s)
+ {
+ int color = -1, light = s.Brightness;
+ bool absolute = true;
+
+ // Initialize
+ this.sector = s;
+ this.levels = new List(2);
+
+ // Create floor
+ SectorLevel fl = new SectorLevel();
+ fl.type = SectorLevelType.Floor;
+ fl.plane = new Plane(new Vector3D(0, 0, 1), s.FloorHeight);
+ fl.color = -1;
+ this.levels.Add(fl);
+
+ // Create ceiling
+ SectorLevel cl = new SectorLevel();
+ cl.type = SectorLevelType.Ceiling;
+ cl.plane = new Plane(new Vector3D(0, 0, -1), s.CeilHeight);
+ try
+ {
+ // Fetch ZDoom fields
+ 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) { }
+ if(!absolute) light = s.Brightness + light;
+ PixelColor lightcolor = PixelColor.FromInt(color);
+ PixelColor brightness = PixelColor.FromInt(mode.CalculateBrightness(light));
+ PixelColor finalcolor = PixelColor.Modulate(lightcolor, brightness);
+ cl.color = finalcolor.WithAlpha(255).ToInt();
+ this.levels.Add(cl);
+ }
+
+ #endregion
+
+ #region ================== Public Methods
+
+ #endregion
+ }
+}
diff --git a/Source/Plugins/GZDoomEditing/VisualModes/SectorLevel.cs b/Source/Plugins/GZDoomEditing/VisualModes/SectorLevel.cs
new file mode 100644
index 00000000..617dc008
--- /dev/null
+++ b/Source/Plugins/GZDoomEditing/VisualModes/SectorLevel.cs
@@ -0,0 +1,25 @@
+#region === Copyright (c) 2010 Pascal van der Heiden ===
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using CodeImp.DoomBuilder.Geometry;
+
+#endregion
+
+namespace CodeImp.DoomBuilder.GZDoomEditing
+{
+ internal struct SectorLevel
+ {
+ // Type of level
+ public SectorLevelType type;
+
+ // Plane in the sector
+ public Plane plane;
+
+ // Color below the plane (includes brightness)
+ public int color;
+ }
+}
diff --git a/Source/Plugins/GZDoomEditing/VisualModes/SectorLevelType.cs b/Source/Plugins/GZDoomEditing/VisualModes/SectorLevelType.cs
new file mode 100644
index 00000000..f85db2a3
--- /dev/null
+++ b/Source/Plugins/GZDoomEditing/VisualModes/SectorLevelType.cs
@@ -0,0 +1,19 @@
+#region === Copyright (c) 2010 Pascal van der Heiden ===
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+
+#endregion
+
+namespace CodeImp.DoomBuilder.GZDoomEditing
+{
+ internal enum SectorLevelType
+ {
+ Light,
+ Floor,
+ Ceiling
+ }
+}
diff --git a/Tests/UDMF/udmfexample.wad b/Tests/UDMF/udmfexample.wad
index 41a1100b..b1ad6a87 100644
Binary files a/Tests/UDMF/udmfexample.wad and b/Tests/UDMF/udmfexample.wad differ