From 18517b225743692a475b1609b0cf12f91223d7de Mon Sep 17 00:00:00 2001 From: MaxED Date: Sun, 19 Jun 2016 00:09:53 +0000 Subject: [PATCH] Changed, Visual mode: "Paste Selection" action (Ctrl-V) can now paste both copied textures and things, based on what was copied last. Changed, Map Analysis mode: the view is now much more zoomed after clocking on a "Check very short linedefs" error check result. Removed single testing engine launchable by the editor at once limitation (it worked properly only when using Test map actions anyway). Fixed: re-did the fix for invalid geometry created when drawing very large grids from R2653, because it caused other issues. --- Source/Core/Editing/ClassicMode.cs | 2 +- Source/Core/GZBuilder/Data/EngineInfo.cs | 2 +- Source/Core/Geometry/Tools.cs | 11 +++-------- Source/Core/Map/MapSet.cs | 2 +- .../ErrorChecks/ResultShortLinedef.cs | 16 +++++++++++++++- .../BuilderModes/VisualModes/BaseVisualMode.cs | 14 +++++++++----- 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index 73b96c7..a430fca 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -719,7 +719,7 @@ namespace CodeImp.DoomBuilder.Editing if(s == null) { - General.MainWindow.DisplayStatus(StatusType.Warning, "Can't test from current position: cursor is not inside sector!"); + General.MainWindow.DisplayStatus(StatusType.Warning, "Can't test from current position: mouse cursor must be inside a sector!"); return false; } diff --git a/Source/Core/GZBuilder/Data/EngineInfo.cs b/Source/Core/GZBuilder/Data/EngineInfo.cs index cef5437..f63ffa0 100644 --- a/Source/Core/GZBuilder/Data/EngineInfo.cs +++ b/Source/Core/GZBuilder/Data/EngineInfo.cs @@ -100,7 +100,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data if(File.Exists(testprogram)) { Icon i = Icon.ExtractAssociatedIcon(testprogram); - icon = (i != null ? i.ToBitmap() : new Bitmap(Properties.Resources.Question)); + icon = new Bitmap(i != null ? i.ToBitmap() : Properties.Resources.Question); } else { diff --git a/Source/Core/Geometry/Tools.cs b/Source/Core/Geometry/Tools.cs index 8f18753..7917e28 100644 --- a/Source/Core/Geometry/Tools.cs +++ b/Source/Core/Geometry/Tools.cs @@ -939,7 +939,6 @@ namespace CodeImp.DoomBuilder.Geometry if(points[0].stitch) mergeverts.Add(v1); else nonmergeverts.Add(v1); // Go for all other points - int roundprecision = (General.Map.FormatInterface.VertexDecimals > 0 ? General.Map.FormatInterface.VertexDecimals - 1 : 0); //mxd for(int i = 1; i < points.Count; i++) { // Create vertex for point @@ -965,7 +964,7 @@ namespace CodeImp.DoomBuilder.Geometry // Check if any other lines intersect this line List intersections = new List(); Line2D measureline = ld.Line; - Dictionary processed = new Dictionary(); //mxd + HashSet processed = new HashSet(); //mxd //mxd foreach(Sector s in map.Sectors) @@ -975,7 +974,7 @@ namespace CodeImp.DoomBuilder.Geometry { foreach(Sidedef side in s.Sidedefs) { - if(processed.ContainsKey(side.Line)) continue; + if(processed.Contains(side.Line)) continue; if(side.Line == ld) continue; float u; @@ -985,7 +984,7 @@ namespace CodeImp.DoomBuilder.Geometry intersections.Add(u); } - processed.Add(side.Line, false); + processed.Add(side.Line); } } } @@ -1002,10 +1001,6 @@ namespace CodeImp.DoomBuilder.Geometry // may already have changed in length due to a previous split Vector2D splitpoint = measureline.GetCoordinatesAt(u); - //mxd. Work around some imprecisions when splitting very long lines (like 19000 mu long) - splitpoint.x = (float)Math.Round(splitpoint.x, roundprecision); - splitpoint.y = (float)Math.Round(splitpoint.y, roundprecision); - // Make the vertex Vertex splitvertex = map.CreateVertex(splitpoint); if(splitvertex == null) return false; diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index aa548d7..717112c 100644 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -47,7 +47,7 @@ namespace CodeImp.DoomBuilder.Map /// Stiching distance. This is only to get around inaccuracies. Basically, /// geometry only stitches when exactly on top of each other. - public const float STITCH_DISTANCE = 0.001f; + public const float STITCH_DISTANCE = 0.005f; //mxd. 0.001f is not enough when drawing very long lines... // Virtual sector identification // This contains a character that is invalid in the UDMF standard, but valid diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultShortLinedef.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultShortLinedef.cs index 944792c..605b4d4 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/ResultShortLinedef.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultShortLinedef.cs @@ -1,6 +1,7 @@ #region ================== Namespaces using System; +using System.Drawing; using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Rendering; @@ -50,7 +51,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // This must return the string that is displayed in the listbox public override string ToString() { - return "Linedef " + line.Index + " is shorter than 1 m.u."; + return "Linedef " + line.Index + " is shorter than 1 mu."; } // Rendering @@ -60,6 +61,19 @@ namespace CodeImp.DoomBuilder.BuilderModes renderer.PlotVertex(line.Start, ColorCollection.VERTICES); renderer.PlotVertex(line.End, ColorCollection.VERTICES); } + + // We must zoom in way more than usual... + public override RectangleF GetZoomArea() + { + // Get Area + RectangleF area = base.GetZoomArea(); + + // Remove padding + area.Inflate(-97f, -97f); + + // Return area + return area; + } #endregion } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index 404d9c5..59d51d1 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -3001,7 +3001,9 @@ namespace CodeImp.DoomBuilder.BuilderModes public void TextureCopy() { PreActionNoChange(); - GetTargetEventReceiver(true).OnCopyTexture(); //mxd + IVisualEventReceiver i = GetTargetEventReceiver(true); + i.OnCopyTexture(); //mxd + if(!(i is VisualThing)) copybuffer.Clear(); //mxd. Not copying things any more... PostAction(); } @@ -3434,7 +3436,9 @@ namespace CodeImp.DoomBuilder.BuilderModes VisualThing vt = (VisualThing)i; if(vt != null) copybuffer.Add(new ThingCopyData(vt.Thing)); } - General.Interface.DisplayStatus(StatusType.Info, "Copied " + copybuffer.Count + " Things"); + + string rest = copybuffer.Count + (copybuffer.Count > 1 ? " things." : " thing."); + General.Interface.DisplayStatus(StatusType.Info, "Copied " + rest); } //mxd @@ -3444,7 +3448,7 @@ namespace CodeImp.DoomBuilder.BuilderModes CopySelection(); //Create undo - string rest = copybuffer.Count + " thing" + (copybuffer.Count > 1 ? "s." : "."); + string rest = copybuffer.Count + (copybuffer.Count > 1 ? " things." : " thing."); CreateUndo("Cut " + rest); General.Interface.DisplayStatus(StatusType.Info, "Cut " + rest); @@ -3470,7 +3474,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { if(copybuffer.Count == 0) { - General.Interface.DisplayStatus(StatusType.Warning, "Nothing to paste, cut or copy some Things first!"); + TexturePaste(); // I guess we may paste a texture or two instead return; } @@ -3482,7 +3486,7 @@ namespace CodeImp.DoomBuilder.BuilderModes return; } - string rest = copybuffer.Count + " thing" + (copybuffer.Count > 1 ? "s" : ""); + string rest = copybuffer.Count + (copybuffer.Count > 1 ? " things." : " thing."); General.Map.UndoRedo.CreateUndo("Paste " + rest); General.Interface.DisplayStatus(StatusType.Info, "Pasted " + rest);