working on map analysis mode

This commit is contained in:
codeimp 2008-10-24 05:50:37 +00:00
parent 27e05b7f1b
commit 46434b8b7c
7 changed files with 59 additions and 31 deletions

View file

@ -561,7 +561,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update cache values
General.Map.IsChanged = true;
General.Map.Map.Update();
General.Map.ThingsFilter.Update();
// Invoke a new mousemove so that the highlighted item updates
MouseEventArgs e = new MouseEventArgs(MouseButtons.None, 0, (int)mousepos.x, (int)mousepos.y, 0);

View file

@ -42,8 +42,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
[ErrorChecker("Check for stucked things", true)]
public class CheckStuckedThings : ErrorChecker
{
#region ================== Constants
private const float ALLOWED_STUCK_DISTANCE = 3.0f;
#endregion
#region ================== Constructor / Destructor
// Constructor
public CheckStuckedThings()
{
@ -69,8 +75,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
(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);
float blockingsize = t.Size - ALLOWED_STUCK_DISTANCE;
Vector2D lt = new Vector2D(t.Position.x - blockingsize, t.Position.y - blockingsize);
Vector2D rb = new Vector2D(t.Position.x + blockingsize, t.Position.y + blockingsize);
// Go for all the lines to see if this thing is stucked
foreach(Linedef l in General.Map.Map.Linedefs)

View file

@ -70,24 +70,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// When this result is selected
public virtual void Selected()
{
}
// When the first button is clicked
public virtual void Button1Click()
// Return true when map geometry or things have been added/removed so that the checker can restart
public virtual bool Button1Click()
{
return false;
}
// When the second button is clicked
public virtual void Button2Click()
// Return true when map geometry or things have been added/removed so that the checker can restart
public virtual bool Button2Click()
{
return false;
}
// When the third button is clicked
public virtual void Button3Click()
// Return true when map geometry or things have been added/removed so that the checker can restart
public virtual bool Button3Click()
{
return false;
}
// This must return the string that is displayed in the listbox

View file

@ -47,7 +47,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
#endregion
#region ================== Properties
public override int Buttons { get { return 1; } }
public override string Button1Text { get { return "Delete Thing"; } }
#endregion
#region ================== Constructor / Destructor
@ -75,6 +78,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
renderer.RenderThing(thing, renderer.DetermineThingColor(thing), 1.0f);
}
// This removes the thing
public override bool Button1Click()
{
General.Map.UndoRedo.CreateUndo("Delete thing", UndoGroup.None, 0);
thing.Dispose();
General.Map.IsChanged = true;
General.Map.ThingsFilter.Update();
return true;
}
#endregion
}

View file

@ -79,6 +79,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.RenderThing(thing, renderer.DetermineThingColor(thing), 1.0f);
}
// This removes the thing
public override bool Button1Click()
{
General.Map.UndoRedo.CreateUndo("Delete thing", UndoGroup.None, 0);
thing.Dispose();
General.Map.IsChanged = true;
General.Map.ThingsFilter.Update();
return true;
}
#endregion
}
}

View file

@ -46,16 +46,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
| System.Windows.Forms.AnchorStyles.Right)));
this.checks.AutoScroll = true;
this.checks.Columns = 2;
this.checks.Location = new System.Drawing.Point(10, 10);
this.checks.Location = new System.Drawing.Point(10, 15);
this.checks.Margin = new System.Windows.Forms.Padding(1);
this.checks.Name = "checks";
this.checks.Size = new System.Drawing.Size(360, 148);
this.checks.Size = new System.Drawing.Size(360, 108);
this.checks.TabIndex = 0;
//
// buttoncheck
//
this.buttoncheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttoncheck.Location = new System.Drawing.Point(254, 169);
this.buttoncheck.Location = new System.Drawing.Point(254, 134);
this.buttoncheck.Margin = new System.Windows.Forms.Padding(1);
this.buttoncheck.Name = "buttoncheck";
this.buttoncheck.Size = new System.Drawing.Size(116, 25);
@ -87,7 +87,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.resultspanel.Controls.Add(this.fix1);
this.resultspanel.Controls.Add(this.progress);
this.resultspanel.Controls.Add(this.results);
this.resultspanel.Location = new System.Drawing.Point(0, 205);
this.resultspanel.Location = new System.Drawing.Point(0, 170);
this.resultspanel.Name = "resultspanel";
this.resultspanel.Size = new System.Drawing.Size(383, 306);
this.resultspanel.TabIndex = 3;
@ -153,7 +153,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// ErrorCheckForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(380, 511);
this.ClientSize = new System.Drawing.Size(380, 475);
this.Controls.Add(this.resultspanel);
this.Controls.Add(this.buttoncheck);
this.Controls.Add(this.checks);

View file

@ -39,6 +39,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
public partial class ErrorCheckForm : DelayedForm
{
#region ================== Constants
// Constants
private const int RESULTS_WINDOW_HEIGHT = 500;
#endregion
#region ================== Delegates
private delegate void CallVoidMethodDeletage();
@ -47,13 +54,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
#endregion
#region ================== Constants
// Constants
private const int RESULTS_WINDOW_HEIGHT = 536;
#endregion
#region ================== Variables
private volatile bool running = false;
@ -383,8 +383,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
else
{
ErrorResult r = (results.SelectedItem as ErrorResult);
r.Button1Click();
StartChecking();
if(r.Button1Click()) StartChecking(); else General.Interface.RedrawDisplay();
}
}
}
@ -402,8 +401,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
else
{
ErrorResult r = (results.SelectedItem as ErrorResult);
r.Button2Click();
StartChecking();
if(r.Button2Click()) StartChecking(); else General.Interface.RedrawDisplay();
}
}
}
@ -421,8 +419,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
else
{
ErrorResult r = (results.SelectedItem as ErrorResult);
r.Button3Click();
StartChecking();
if(r.Button3Click()) StartChecking(); else General.Interface.RedrawDisplay();
}
}
}