This commit is contained in:
codeimp 2008-10-23 22:01:07 +00:00
parent cc292c9c40
commit 27e05b7f1b
8 changed files with 116 additions and 49 deletions

View file

@ -76,6 +76,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnEngage();
renderer.SetPresentation(Presentation.Standard);
// Save selection as marks
General.Map.Map.ClearAllMarks(false);
General.Map.Map.MarkAllSelectedGeometry(true, false);
General.Map.Map.ClearAllSelected();
// Show toolbox window
BuilderPlug.Me.ErrorCheckForm.Show((Form)General.Interface);
}
@ -88,8 +93,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Hide object info
General.Interface.HideInfo();
// Restore selection
General.Map.Map.SelectMarkedGeometry(true, true);
General.Map.Map.ClearAllMarks(false);
// Hide toolbox window
BuilderPlug.Me.ErrorCheckForm.Hide();
BuilderPlug.Me.ErrorCheckForm.CloseWindow();
}
// This applies the curves and returns to the base mode
@ -118,7 +127,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(renderer.StartPlotter(true))
{
renderer.PlotLinedefSet(General.Map.Map.Linedefs);
//if(selection != null) selection.PlotSelection(renderer);
if(selection != null) selection.PlotSelection(renderer);
renderer.PlotVerticesSet(General.Map.Map.Vertices);
renderer.Finish();
}
@ -127,14 +136,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(renderer.StartThings(true))
{
renderer.RenderThingSet(General.Map.Map.Things, 1.0f);
//if(selection != null) selection.RenderThingsSelection(renderer);
if(selection != null) selection.RenderThingsSelection(renderer);
renderer.Finish();
}
// Render overlay
if(renderer.StartOverlay(true))
{
//if(selection != null) selection.RenderOverlaySelection(renderer);
if(selection != null) selection.RenderOverlaySelection(renderer);
renderer.Finish();
}

View file

@ -60,13 +60,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Go for all the things
foreach(Thing t in General.Map.Map.Things)
{
ThingTypeInfo info = General.Map.Config.GetThingInfo(t.Type);
bool stucked = false;
// Check this thing for getting stucked?
if( (info.ErrorCheck == ThingTypeInfo.THING_ERROR_INSIDE_STUCKED) &&
(info.Blocking > ThingTypeInfo.THING_BLOCKING_NONE))
{
// Make square coordinates from thing
Vector2D lt = new Vector2D(t.Position.x - t.Size, t.Position.y - t.Size);
Vector2D rb = new Vector2D(t.Position.x + t.Size, t.Position.y + t.Size);
// Go for all the lines to see if this thing is stucked
bool stucked = false;
foreach(Linedef l in General.Map.Map.Linedefs)
{
// Test only single-sided lines
@ -90,6 +96,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
}
}
// Stucked?
if(stucked)
@ -98,6 +105,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
SubmitResult(new ResultStuckedThing(t));
}
else
{
// Check this thing for being outside the map?
if(info.ErrorCheck >= ThingTypeInfo.THING_ERROR_INSIDE)
{
// Get the nearest line to see if the thing is outside the map
bool outside = false;
@ -118,6 +128,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
SubmitResult(new ResultThingOutside(t));
}
}
}
// Handle thread interruption
try { Thread.Sleep(0); }

View file

@ -96,6 +96,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
return "Unknown result";
}
// This is called for rendering
public virtual void PlotSelection(IRenderer2D renderer)
{
}
// This is called for rendering
public virtual void RenderThingsSelection(IRenderer2D renderer)
{
}
// This is called for rendering
public virtual void RenderOverlaySelection(IRenderer2D renderer)
{
}
#endregion
}
}

View file

@ -67,7 +67,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This must return the string that is displayed in the listbox
public override string ToString()
{
return "Stucked thing '" + General.Map.Config.GetThingInfo(thing.Type).Title + "' at " + thing.Position.x + ", " + thing.Position.y;
return General.Map.Config.GetThingInfo(thing.Type).Title + " is stucked in a wall at " + thing.Position.x + ", " + thing.Position.y;
}
// Rendering
public override void RenderOverlaySelection(IRenderer2D renderer)
{
renderer.RenderThing(thing, renderer.DetermineThingColor(thing), 1.0f);
}
#endregion

View file

@ -70,7 +70,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This must return the string that is displayed in the listbox
public override string ToString()
{
return "Thing '" + General.Map.Config.GetThingInfo(thing.Type).Title + "' is outside the map at " + thing.Position.x + ", " + thing.Position.y;
return General.Map.Config.GetThingInfo(thing.Type).Title + " is outside the map at " + thing.Position.x + ", " + thing.Position.y;
}
// Rendering
public override void RenderOverlaySelection(IRenderer2D renderer)
{
renderer.RenderThing(thing, renderer.DetermineThingColor(thing), 1.0f);
}
#endregion

View file

@ -56,7 +56,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Variables
private bool running = false;
private volatile bool running = false;
private Thread checksthread;
#endregion
@ -166,10 +166,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
else
{
checksthread = null;
running = false;
progress.Value = 0;
buttoncheck.Text = "Start Analysis";
Cursor.Current = Cursors.Default;
running = false;
}
}
@ -187,6 +187,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
ClearSelectedResult();
resultspanel.Visible = true;
buttoncheck.Text = "Abort Analysis";
General.Interface.RedrawDisplay();
// Start checking
running = true;
@ -202,6 +203,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// This stops the checking
public void CloseWindow()
{
// Currently running?
if(running)
{
Cursor.Current = Cursors.WaitCursor;
checksthread.Interrupt();
}
ClearSelectedResult();
this.Hide();
}
// This clears the selected result
private void ClearSelectedResult()
{
@ -351,6 +366,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
ClearSelectedResult();
}
General.Interface.RedrawDisplay();
}
// First button

View file

@ -103,7 +103,7 @@ namespace CodeImp.DoomBuilder.Config
this.height = cfg.ReadSetting("thingtypes." + name + ".height", 16);
this.hangs = cfg.ReadSetting("thingtypes." + name + ".hangs", 0);
this.blocking = cfg.ReadSetting("thingtypes." + name + ".blocking", 0);
this.errorcheck = cfg.ReadSetting("thingtypes." + name + ".errorcheck", 0);
this.errorcheck = cfg.ReadSetting("thingtypes." + name + ".error", 1);
// Safety
if(this.width < 8f) this.width = 8f;

View file

@ -38,6 +38,9 @@ namespace CodeImp.DoomBuilder.Config
public const int THING_BLOCKING_NONE = 0;
public const int THING_BLOCKING_FULL = 1;
public const int THING_BLOCKING_HEIGHT = 2;
public const int THING_ERROR_NONE = 0;
public const int THING_ERROR_INSIDE = 1;
public const int THING_ERROR_INSIDE_STUCKED = 2;
#endregion
@ -119,7 +122,7 @@ namespace CodeImp.DoomBuilder.Config
this.height = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".height", cat.Height);
this.hangs = (cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".hangs", cat.Hangs) != 0);
this.blocking = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".blocking", cat.Blocking);
this.errorcheck = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".errorcheck", cat.ErrorCheck);
this.errorcheck = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".error", cat.ErrorCheck);
// Safety
if(this.width < 8f) this.width = 8f;