mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Avoid blockmap use when moving mouse in some classic modes
This commit is contained in:
parent
56b2423887
commit
6576ed7408
4 changed files with 25 additions and 8 deletions
|
@ -2122,6 +2122,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
BeginAddRemove();
|
||||
|
||||
// Split moving lines with unselected vertices
|
||||
General.WriteLogLine("Splitting moving lines with unselected vertices...");
|
||||
ICollection<Vertex> nearbyfixedverts = FilterByArea(fixedverts, ref editarea);
|
||||
if (!SplitLinesByVertices(movinglines, nearbyfixedverts, STITCH_DISTANCE, movinglines, mergemode))
|
||||
{
|
||||
|
@ -2130,6 +2131,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
// Split non-moving lines with selected vertices
|
||||
General.WriteLogLine("Splitting non-moving lines with selected vertices...");
|
||||
fixedlines = FilterByArea(fixedlines, ref editarea);
|
||||
fixedlines = new HashSet<Linedef>(fixedlines.Where(fixedline => !fixedline.IsDisposed));
|
||||
if (!SplitLinesByVertices(fixedlines, movingverts, STITCH_DISTANCE, movinglines, mergemode))
|
||||
|
@ -2139,6 +2141,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
//mxd. Split moving lines with fixed lines
|
||||
General.WriteLogLine("Splitting moving lines with fixed lines...");
|
||||
if (!SplitLinesByLines(fixedlines, movinglines, mergemode))
|
||||
{
|
||||
EndAddRemove(); // Unfreeze arrays before returning
|
||||
|
@ -2146,6 +2149,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
// Remove looped linedefs
|
||||
General.WriteLogLine("Removing looped lines...");
|
||||
RemoveLoopedLinedefs(movinglines);
|
||||
|
||||
// Join overlapping lines
|
||||
|
|
|
@ -545,9 +545,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
/// </summary>
|
||||
private void CreateBlockmap()
|
||||
{
|
||||
General.WriteLogLine("Creating blockmap...");
|
||||
RectangleF area = MapSet.CreateArea(General.Map.Map.Vertices);
|
||||
blockmap = new BlockMap<BlockEntry>(area);
|
||||
blockmap.AddLinedefsSet(General.Map.Map.Linedefs);
|
||||
General.WriteLogLine("Blockmap done.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1000,9 +1002,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
else if(paintselectpressed && !editpressed && !selecting) //mxd. Drag-select
|
||||
{
|
||||
// Find the nearest thing within highlight range
|
||||
Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
|
||||
//Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
|
||||
Linedef l = General.Map.Map.NearestLinedefRange(mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
|
||||
|
||||
if(l != null)
|
||||
if (l != null)
|
||||
{
|
||||
if(l != highlighted)
|
||||
{
|
||||
|
@ -1032,10 +1035,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
else if(e.Button == MouseButtons.None) // Not holding any buttons?
|
||||
{
|
||||
// Find the nearest linedef within highlight range
|
||||
Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
|
||||
//Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
|
||||
Linedef l = General.Map.Map.NearestLinedefRange(mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
|
||||
|
||||
//mxd. Render insert vertex preview
|
||||
Linedef sl = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.StitchRange / renderer.Scale);
|
||||
//Linedef sl = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.StitchRange / renderer.Scale);
|
||||
Linedef sl = General.Map.Map.NearestLinedefRange(mousemappos, BuilderPlug.Me.StitchRange / renderer.Scale);
|
||||
if (sl != null)
|
||||
{
|
||||
bool snaptogrid = General.Interface.ShiftState ^ General.Interface.SnapToGrid;
|
||||
|
|
|
@ -749,6 +749,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
/// </summary>
|
||||
private void CreateBlockmap()
|
||||
{
|
||||
General.WriteLogLine("Creating blockmap...");
|
||||
RectangleF area = MapSet.CreateArea(General.Map.Map.Vertices);
|
||||
area = MapSet.IncreaseArea(area, General.Map.Map.Things);
|
||||
blockmap = new BlockMap<BlockEntry>(area);
|
||||
|
@ -758,6 +759,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Don't add linedefs here. They are only needed for paint select, so let's save some
|
||||
// time (and add them when paint select is used t he first time)
|
||||
addedlinedefstoblockmap = false;
|
||||
General.WriteLogLine("Blockmap done.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1155,7 +1157,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Find the nearest linedef within highlight range
|
||||
Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
|
||||
//Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
|
||||
Linedef l = General.Map.Map.NearestLinedefRange(mousemappos, BuilderPlug.Me.HighlightRange / renderer.Scale);
|
||||
Sector s = null;
|
||||
|
||||
if(l != null)
|
||||
|
|
|
@ -81,9 +81,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
/// </summary>
|
||||
private void CreateBlockmap()
|
||||
{
|
||||
General.WriteLogLine("Creating blockmap...");
|
||||
RectangleF area = MapSet.CreateArea(General.Map.Map.Vertices);
|
||||
blockmap = new BlockMap<BlockEntry>(area);
|
||||
blockmap.AddLinedefsSet(General.Map.Map.Linedefs);
|
||||
General.WriteLogLine("Blockmap done.");
|
||||
}
|
||||
|
||||
public override void OnHelp()
|
||||
|
@ -331,7 +333,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
else if(!selecting) //mxd. We don't want to do this stuff while multiselecting
|
||||
{
|
||||
// Find the nearest linedef within highlight range
|
||||
Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
|
||||
//Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
|
||||
Linedef l = General.Map.Map.NearestLinedefRange(mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
|
||||
if(l != null)
|
||||
{
|
||||
// Create undo
|
||||
|
@ -498,7 +501,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
else if(e.Button == MouseButtons.None) // Not holding any buttons?
|
||||
{
|
||||
//mxd. Render insert vertex preview
|
||||
Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
|
||||
//Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
|
||||
Linedef l = General.Map.Map.NearestLinedefRange(mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
|
||||
|
||||
if(l != null)
|
||||
{
|
||||
|
@ -901,7 +905,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Map.UndoRedo.CreateUndo("Insert vertex");
|
||||
|
||||
// Snap to geometry?
|
||||
Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
|
||||
//Linedef l = MapSet.NearestLinedefRange(blockmap, mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
|
||||
Linedef l = General.Map.Map.NearestLinedefRange(mousemappos, BuilderPlug.Me.SplitLinedefsRange / renderer.Scale);
|
||||
if(snaptonearest && (l != null))
|
||||
{
|
||||
// Snip to grid also?
|
||||
|
|
Loading…
Reference in a new issue