diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index fc53e5c8..f36c4b28 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -84,6 +84,24 @@ namespace CodeImp.DoomBuilder.Editing #region ================== Properties + // Mouse status + public Vector2D MousePos { get { return mousepos; } } + public Vector2D MouseLastPos { get { return mouselastpos; } } + public Vector2D MouseMapPos { get { return mousemappos; } } + public Vector2D MouseDownPos { get { return mousedownpos; } } + public Vector2D MouseDownMapPos { get { return mousedownmappos; } } + public MouseButtons MouseButtons { get { return mousebuttons; } } + public bool IsMouseInside { get { return mouseinside; } } + public MouseButtons MouseDragging { get { return mousedragging; } } + + // Selection + public bool IsSelecting { get { return selecting; } } + public Vector2D SelectionStart { get { return selectstart; } } + public RectangleF SelectionRect { get { return selectionrect; } } + + // Panning + public bool IsPanning { get { return panning; } } + #endregion #region ================== Constructor / Disposer diff --git a/Source/Core/Editing/EditMode.cs b/Source/Core/Editing/EditMode.cs index 97e10275..0d508992 100644 --- a/Source/Core/Editing/EditMode.cs +++ b/Source/Core/Editing/EditMode.cs @@ -67,6 +67,9 @@ namespace CodeImp.DoomBuilder.Editing // for checking the appropriate button on the toolbar. public virtual string EditModeButtonName { get { return GetType().Name; } } + // Override this to provide a highlighted object, if applicable + public virtual object HighlightedObject { get { return null; } } + #endregion #region ================== Constructor / Disposer diff --git a/Source/Plugins/BuilderModes/ClassicModes/BrightnessMode.cs b/Source/Plugins/BuilderModes/ClassicModes/BrightnessMode.cs index f6856aec..ab495997 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/BrightnessMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/BrightnessMode.cs @@ -83,6 +83,8 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Properties + public override object HighlightedObject { get { return highlighted; } } + #endregion #region ================== Constructor / Disposer diff --git a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs index e188fb6d..57955e24 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs @@ -138,6 +138,8 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Properties + public override object HighlightedObject { get { return highlighted; } } + // Just keep the base mode button checked public override string EditModeButtonName { get { return General.Editing.PreviousStableMode.Name; } } diff --git a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs index d59a3f48..df0211fc 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs @@ -67,6 +67,8 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Properties + public override object HighlightedObject { get { return highlighted; } } + #endregion #region ================== Constructor / Disposer diff --git a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs index 973170e7..5bef100e 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs @@ -68,6 +68,8 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Properties + public override object HighlightedObject { get { return highlighted; } } + #endregion #region ================== Constructor / Disposer @@ -853,16 +855,13 @@ namespace CodeImp.DoomBuilder.BuilderModes public void MakeDoor() { // Highlighted item not selected? - if(!highlighted.Selected) + if((highlighted != null) && !highlighted.Selected) { - if(highlighted != null) - { - // Make this the only selection - General.Map.Map.ClearSelectedSectors(); - General.Map.Map.ClearSelectedLinedefs(); - SelectSector(highlighted, true, false); - General.Interface.RedrawDisplay(); - } + // Make this the only selection + General.Map.Map.ClearSelectedSectors(); + General.Map.Map.ClearSelectedLinedefs(); + SelectSector(highlighted, true, false); + General.Interface.RedrawDisplay(); } // Anything selected? diff --git a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs index f3bbf801..813d113d 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs @@ -68,6 +68,8 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Properties + public override object HighlightedObject { get { return highlighted; } } + #endregion #region ================== Constructor / Disposer diff --git a/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs b/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs index f03b4eef..e385230f 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs @@ -64,6 +64,8 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Properties + public override object HighlightedObject { get { return highlighted; } } + #endregion #region ================== Constructor / Disposer diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index e65334ee..65df0a20 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -88,6 +88,35 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Properties + public override object HighlightedObject + { + get + { + // Geometry picked? + if(target.picked is VisualGeometry) + { + VisualGeometry pickedgeo = (target.picked as VisualGeometry); + + if(pickedgeo.Sidedef != null) + return pickedgeo.Sidedef; + else if(pickedgeo.Sector != null) + return pickedgeo.Sector; + else + return null; + } + // Thing picked? + else if(target.picked is VisualThing) + { + VisualThing pickedthing = (target.picked as VisualThing); + return pickedthing.Thing; + } + else + { + return null; + } + } + } + public IRenderer3D Renderer { get { return renderer; } } public bool IsSingleSelection { get { return singleselection; } } diff --git a/Tests/ErrorChecking/sectornotclosed_a.dbs b/Tests/ErrorChecking/sectornotclosed_a.dbs new file mode 100644 index 00000000..78f0df99 --- /dev/null +++ b/Tests/ErrorChecking/sectornotclosed_a.dbs @@ -0,0 +1,30 @@ +type = "Doom Builder Map Settings Configuration"; +gameconfig = "ZDoom_Doom.cfg"; +strictpatches = 0; + +maps +{ + + MAP01 + { + + resources + { + } + + + grid + { + background = ""; + backsource = 0; + backoffsetx = 0; + backoffsety = 0; + backscalex = 100; + backscaley = 100; + gridsize = 32; + } + + } + +} + diff --git a/Tests/ErrorChecking/sectornotclosed_a.wad b/Tests/ErrorChecking/sectornotclosed_a.wad new file mode 100644 index 00000000..f3ae9923 Binary files /dev/null and b/Tests/ErrorChecking/sectornotclosed_a.wad differ