Changed, Sound Environment mode: on second thought, we don't need to scan all map things to find one to highlight...

This commit is contained in:
MaxED 2015-01-25 23:44:10 +00:00
parent 1c769eec3f
commit 637cd69cbb
3 changed files with 5 additions and 10 deletions

View file

@ -2739,7 +2739,7 @@ namespace CodeImp.DoomBuilder.Map
}
/// <summary>This finds the thing closest to the specified position.</summary>
public static Thing NearestThingSquareRange(ICollection<Thing> selection, Vector2D pos, float maxrange, int type)
public static Thing NearestThingSquareRange(ICollection<Thing> selection, Vector2D pos, float maxrange)
{
RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange);
Thing closest = null;
@ -2749,9 +2749,6 @@ namespace CodeImp.DoomBuilder.Map
// Go for all things in selection
foreach(Thing t in selection)
{
//mxd. Required type?
if(type != 0 && t.Type != type) continue;
px = t.Position.x;
py = t.Position.y;
@ -3082,10 +3079,7 @@ namespace CodeImp.DoomBuilder.Map
public Vertex NearestVertexSquareRange(Vector2D pos, float maxrange) { return MapSet.NearestVertexSquareRange(vertices, pos, maxrange); }
/// <summary>This finds the thing closest to the specified position.</summary>
public Thing NearestThingSquareRange(Vector2D pos, float maxrange) { return MapSet.NearestThingSquareRange(things, pos, maxrange, 0); }
/// <summary>This finds the thing closest to the specified position.</summary>
public static Thing NearestThingSquareRange(ICollection<Thing> selection, Vector2D pos, float maxrange) { return MapSet.NearestThingSquareRange(selection, pos, maxrange, 0); }
public Thing NearestThingSquareRange(Vector2D pos, float maxrange) { return MapSet.NearestThingSquareRange(things, pos, maxrange); }
/// <summary>This finds the closest unselected linedef that is not connected to the given vertex.</summary>
public Linedef NearestUnselectedUnreferencedLinedef(Vector2D pos, float maxrange, Vertex v, out float distance)

View file

@ -394,9 +394,9 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
}
//mxd. Find the nearest thing within default highlight range
if(highlightedline == null)
if(highlightedline == null && highlightedsoundenvironment != null)
{
Thing t = MapSet.NearestThingSquareRange(General.Map.ThingsFilter.VisibleThings, mousemappos, 10 / renderer.Scale, 9048);
Thing t = MapSet.NearestThingSquareRange(highlightedsoundenvironment.Things, mousemappos, 10 / renderer.Scale);
if(highlightedthing != t)
{
highlightedthing = t;

View file

@ -106,6 +106,7 @@
this.Name = "ReverbsPickerForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Choose a Sound Environment";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);