- Fixed Make Door crash when no sector is highlighted or selected

- Added HighlightedObject property to the EditMode class, the object returned depends on the editing mode and the current highlight
- Exposed several properties in the ClassicMode class
This commit is contained in:
codeimp 2009-05-17 14:00:36 +00:00
parent ef67891c15
commit 622ff71056
11 changed files with 98 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -83,6 +83,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Properties
public override object HighlightedObject { get { return highlighted; } }
#endregion
#region ================== Constructor / Disposer

View file

@ -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; } }

View file

@ -67,6 +67,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Properties
public override object HighlightedObject { get { return highlighted; } }
#endregion
#region ================== Constructor / Disposer

View file

@ -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?

View file

@ -68,6 +68,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Properties
public override object HighlightedObject { get { return highlighted; } }
#endregion
#region ================== Constructor / Disposer

View file

@ -64,6 +64,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Properties
public override object HighlightedObject { get { return highlighted; } }
#endregion
#region ================== Constructor / Disposer

View file

@ -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; } }

View file

@ -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;
}
}
}

Binary file not shown.