diff --git a/Source/Builder.csproj b/Source/Builder.csproj
index 36e56856..57d7fa02 100644
--- a/Source/Builder.csproj
+++ b/Source/Builder.csproj
@@ -124,7 +124,6 @@
-
diff --git a/Source/BuilderModes/ClassicModes/BrightnessMode.cs b/Source/BuilderModes/ClassicModes/BrightnessMode.cs
index bee83790..7e4b51a8 100644
--- a/Source/BuilderModes/ClassicModes/BrightnessMode.cs
+++ b/Source/BuilderModes/ClassicModes/BrightnessMode.cs
@@ -38,20 +38,27 @@ using CodeImp.DoomBuilder.Data;
namespace CodeImp.DoomBuilder.BuilderModes
{
- [EditMode(DisplayName = "Sector Brightness",
+ [EditMode(DisplayName = "Brightness Mode",
SwitchAction = "brightnessmode",
ButtonDesc = "Brightness Mode",
ButtonImage = "BrightnessMode.png",
- ButtonOrder = int.MinValue + 201)]
-
- public class BrightnessMode : SectorsMode
+ ButtonOrder = int.MinValue + 201,
+ AllowCopyPaste = false)]
+
+ public sealed class BrightnessMode : BaseClassicMode
{
#region ================== Constants
#endregion
#region ================== Variables
+
+ // Highlighted item
+ private Sector highlighted;
+ // Interface
+ private bool editpressed;
+
#endregion
#region ================== Properties
@@ -80,48 +87,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
- // Mode engages
- public override void OnEngage()
- {
- base.OnEngage();
-
- // Make customized presentation
- CustomPresentation p = new CustomPresentation();
- p.AddLayer(new PresentLayer(RendererLayer.Background, BlendingMode.Mask));
- p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
- p.AddLayer(new PresentLayer(RendererLayer.Overlay, BlendingMode.Alpha, 1f, true));
- p.AddLayer(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, Presentation.THINGS_BACK_ALPHA, false));
- p.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
- renderer.SetPresentation(p);
- }
-
- // This redraws the display
- public override void OnRedrawDisplay()
- {
- // Render lines and vertices
- if(renderer.StartPlotter(true))
- {
- renderer.PlotLinedefSet(General.Map.Map.Linedefs);
- renderer.PlotVerticesSet(General.Map.Map.Vertices);
- if((highlighted != null) && !highlighted.IsDisposed)
- renderer.PlotSector(highlighted, General.Colors.Highlight);
- renderer.Finish();
- }
-
- // Render things
- if(renderer.StartThings(true))
- {
- renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
- renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
- renderer.Finish();
- }
-
- // Render overlay
- UpdateOverlay();
-
- renderer.Present();
- }
-
// This updates the overlay
private void UpdateOverlay()
{
@@ -133,7 +98,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Determine color by brightness
PixelColor brightnesscolor = new PixelColor(255, (byte)s.Brightness, (byte)s.Brightness, (byte)s.Brightness);
int brightnessint = brightnesscolor.ToInt();
-
+
+
+ // This was only to test if it would work
+ // It works, but it is very slow
/*
// Load texture image
ImageData texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
@@ -162,10 +130,136 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
+ // This highlights a new item
+ protected void Highlight(Sector s)
+ {
+ // Update display
+ if(renderer.StartPlotter(false))
+ {
+ // Undraw previous highlight
+ if((highlighted != null) && !highlighted.IsDisposed)
+ renderer.PlotSector(highlighted);
+
+ // Set new highlight
+ highlighted = s;
+
+ // Render highlighted item
+ if((highlighted != null) && !highlighted.IsDisposed)
+ renderer.PlotSector(highlighted, General.Colors.Highlight);
+
+ // Done
+ renderer.Finish();
+ renderer.Present();
+ }
+
+ // Show highlight info
+ if((highlighted != null) && !highlighted.IsDisposed)
+ General.Interface.ShowSectorInfo(highlighted);
+ else
+ General.Interface.HideInfo();
+ }
+
#endregion
+
+ #region ================== Events
+
+ // Mode engages
+ public override void OnEngage()
+ {
+ base.OnEngage();
+
+ // No selection
+ General.Map.Map.ClearAllMarks(false);
+ General.Map.Map.ClearAllSelected();
+
+ // Make custom presentation
+ CustomPresentation p = new CustomPresentation();
+ p.AddLayer(new PresentLayer(RendererLayer.Background, BlendingMode.Mask));
+ p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
+ p.AddLayer(new PresentLayer(RendererLayer.Overlay, BlendingMode.Alpha, 1f, true));
+ p.AddLayer(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, Presentation.THINGS_BACK_ALPHA, false));
+ p.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
+ renderer.SetPresentation(p);
+ }
+
+ // This redraws the display
+ public override void OnRedrawDisplay()
+ {
+ // Render lines and vertices
+ if(renderer.StartPlotter(true))
+ {
+ renderer.PlotLinedefSet(General.Map.Map.Linedefs);
+ renderer.PlotVerticesSet(General.Map.Map.Vertices);
+ if((highlighted != null) && !highlighted.IsDisposed)
+ renderer.PlotSector(highlighted, General.Colors.Highlight);
+ renderer.Finish();
+ }
- #region ================== Actions
+ // Render things
+ if(renderer.StartThings(true))
+ {
+ renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
+ renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
+ renderer.Finish();
+ }
+ // Render overlay
+ UpdateOverlay();
+
+ renderer.Present();
+ }
+
+ // Mouse moves
+ public override void OnMouseMove(MouseEventArgs e)
+ {
+ base.OnMouseMove(e);
+
+ // Not holding any buttons?
+ if(e.Button == MouseButtons.None)
+ {
+ // Find the nearest linedef within highlight range
+ Linedef l = General.Map.Map.NearestLinedef(mousemappos);
+ if(l != null)
+ {
+ // Check on which side of the linedef the mouse is
+ float side = l.SideOfLine(mousemappos);
+ if(side > 0)
+ {
+ // Is there a sidedef here?
+ if(l.Back != null)
+ {
+ // Highlight if not the same
+ if(l.Back.Sector != highlighted) Highlight(l.Back.Sector);
+ }
+ else
+ {
+ // Highlight nothing
+ if(highlighted != null) Highlight(null);
+ }
+ }
+ else
+ {
+ // Is there a sidedef here?
+ if(l.Front != null)
+ {
+ // Highlight if not the same
+ if(l.Front.Sector != highlighted) Highlight(l.Front.Sector);
+ }
+ else
+ {
+ // Highlight nothing
+ if(highlighted != null) Highlight(null);
+ }
+ }
+ }
+ else
+ {
+ // Highlight nothing
+ if(highlighted != null) Highlight(null);
+ }
+ }
+ }
+
#endregion
}
}
diff --git a/Source/BuilderModes/ClassicModes/SectorsMode.cs b/Source/BuilderModes/ClassicModes/SectorsMode.cs
index 09c56335..8aa56e49 100644
--- a/Source/BuilderModes/ClassicModes/SectorsMode.cs
+++ b/Source/BuilderModes/ClassicModes/SectorsMode.cs
@@ -262,7 +262,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnEngage();
renderer.SetPresentation(Presentation.Standard);
-
+
// Convert geometry selection to sectors only
General.Map.Map.ClearAllMarks(false);
General.Map.Map.MarkSelectedVertices(true, true);
diff --git a/Source/Geometry/EarClipPolygon.cs b/Source/Geometry/EarClipPolygon.cs
index 05f7d363..6cd45c5b 100644
--- a/Source/Geometry/EarClipPolygon.cs
+++ b/Source/Geometry/EarClipPolygon.cs
@@ -31,7 +31,7 @@ using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Geometry
{
- public class EarClipPolygon : LinkedList
+ public sealed class EarClipPolygon : LinkedList
{
#region ================== Variables
diff --git a/Source/Geometry/EarClipVertex.cs b/Source/Geometry/EarClipVertex.cs
index 36c9cb6c..3d718fae 100644
--- a/Source/Geometry/EarClipVertex.cs
+++ b/Source/Geometry/EarClipVertex.cs
@@ -31,7 +31,7 @@ using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Geometry
{
- public class EarClipVertex
+ public sealed class EarClipVertex
{
#region ================== Variables
diff --git a/Source/Geometry/LinedefAngleSorter.cs b/Source/Geometry/LinedefAngleSorter.cs
index 52ae8b48..d4c0b477 100644
--- a/Source/Geometry/LinedefAngleSorter.cs
+++ b/Source/Geometry/LinedefAngleSorter.cs
@@ -27,7 +27,7 @@ using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Geometry
{
- internal class LinedefAngleSorter : IComparer
+ internal sealed class LinedefAngleSorter : IComparer
{
// Variables
private Linedef baseline;
diff --git a/Source/Geometry/LinedefSide.cs b/Source/Geometry/LinedefSide.cs
index a4fb4b94..1ed257a8 100644
--- a/Source/Geometry/LinedefSide.cs
+++ b/Source/Geometry/LinedefSide.cs
@@ -34,7 +34,7 @@ namespace CodeImp.DoomBuilder.Geometry
///
/// This is used to indicate a side of a line without the need for a sidedef.
///
- public class LinedefSide
+ public sealed class LinedefSide
{
#region ================== Constants
diff --git a/Source/Geometry/LinedefsTracePath.cs b/Source/Geometry/LinedefsTracePath.cs
index e44a25f9..8d419a11 100644
--- a/Source/Geometry/LinedefsTracePath.cs
+++ b/Source/Geometry/LinedefsTracePath.cs
@@ -31,7 +31,7 @@ using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Geometry
{
- public class LinedefTracePath : List
+ public sealed class LinedefTracePath : List
{
#region ================== Constants
diff --git a/Source/Geometry/SidedefAngleSorter.cs b/Source/Geometry/SidedefAngleSorter.cs
index 919b5001..bb5b8cf0 100644
--- a/Source/Geometry/SidedefAngleSorter.cs
+++ b/Source/Geometry/SidedefAngleSorter.cs
@@ -27,7 +27,7 @@ using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Geometry
{
- internal class SidedefAngleSorter : IComparer
+ internal sealed class SidedefAngleSorter : IComparer
{
// Variables
private Sidedef baseside;
diff --git a/Source/Geometry/SidedefsTracePath.cs b/Source/Geometry/SidedefsTracePath.cs
index eb7199ba..c05f6d1a 100644
--- a/Source/Geometry/SidedefsTracePath.cs
+++ b/Source/Geometry/SidedefsTracePath.cs
@@ -31,7 +31,7 @@ using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Geometry
{
- public class SidedefsTracePath : List
+ public sealed class SidedefsTracePath : List
{
#region ================== Constants
diff --git a/Source/Geometry/TriangleList.cs b/Source/Geometry/TriangleList.cs
deleted file mode 100644
index 202ef95a..00000000
--- a/Source/Geometry/TriangleList.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-
-#region ================== Copyright (c) 2007 Pascal vd Heiden
-
-/*
- * Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
- * 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.Globalization;
-using System.Text;
-using CodeImp.DoomBuilder.Geometry;
-using CodeImp.DoomBuilder.Rendering;
-using SlimDX.Direct3D9;
-using System.Drawing;
-using CodeImp.DoomBuilder.Map;
-
-#endregion
-
-namespace CodeImp.DoomBuilder.Geometry
-{
- public class TriangleList : List
- {
- // This adds a triangle
- internal void Add(EarClipVertex[] t)
- {
- base.Add(t[0].Position);
- base.Add(t[1].Position);
- base.Add(t[2].Position);
- }
- }
-}
diff --git a/Source/Geometry/Triangulation.cs b/Source/Geometry/Triangulation.cs
index cdfa9553..2b0d9525 100644
--- a/Source/Geometry/Triangulation.cs
+++ b/Source/Geometry/Triangulation.cs
@@ -94,7 +94,6 @@ namespace CodeImp.DoomBuilder.Geometry
private Triangulation(Sector s)
{
// Initialize
- TriangleList triangles = new TriangleList();
List polys;
List islandslist = new List();
List verticeslist = new List();