Restore classic pasting mode quirks & undo some optimizations for it to fix bugs

This commit is contained in:
spherallic 2024-07-17 15:08:33 +02:00
parent 3c176d2178
commit 1415309079
3 changed files with 26 additions and 14 deletions

View file

@ -1095,11 +1095,16 @@ namespace CodeImp.DoomBuilder.Geometry
map.EndAddRemove();
// Filter old lines and vertices by edited area
List<Linedef> oldlines = alllines;
if (General.Settings.MergeGeometryMode != MergeGeometryMode.CLASSIC)
{
RectangleF editarea = MapSet.CreateArea(newlines);
editarea = MapSet.IncreaseArea(editarea, mergeverts);
editarea.Inflate(1.0f, 1.0f);
List<Linedef> oldlines = new List<Linedef>(MapSet.FilterByArea(alllines, ref editarea));
oldlines = new List<Linedef>(MapSet.FilterByArea(alllines, ref editarea));
nonmergeverts = new List<Vertex>(MapSet.FilterByArea(nonmergeverts, ref editarea));
}
/***************************************************\
Find a way to close the drawing

View file

@ -2182,9 +2182,8 @@ namespace CodeImp.DoomBuilder.Map
/// <summary>
/// Stitches marked geometry with non-marked geometry. Returns false when the operation failed.
/// </summary>
public bool StitchGeometry() { return StitchGeometry(MergeGeometryMode.CLASSIC, false); } //mxd. Compatibility TODO: figure out why this is needed and kill it
public bool StitchGeometry(MergeGeometryMode mergemode) { return StitchGeometry(mergemode, true); } //sphere: Compatibility
public bool StitchGeometry(MergeGeometryMode mergemode, bool fixsectors)
public bool StitchGeometry() { return StitchGeometry(MergeGeometryMode.CLASSIC); } //mxd. Compatibility
public bool StitchGeometry(MergeGeometryMode mergemode)
{
// Find vertices
HashSet<Vertex> movingverts = new HashSet<Vertex>(General.Map.Map.GetMarkedVertices(true));
@ -2200,6 +2199,8 @@ namespace CodeImp.DoomBuilder.Map
RectangleF editarea = CreateArea(movinglines);
editarea = IncreaseArea(editarea, movingverts);
editarea.Inflate(1.0f, 1.0f);
if (mergemode != MergeGeometryMode.CLASSIC)
fixedverts = FilterByArea(fixedverts, ref editarea);
// Join nearby vertices
@ -2293,7 +2294,7 @@ namespace CodeImp.DoomBuilder.Map
}
//mxd. Correct sector references
if (fixsectors)
if (mergemode != MergeGeometryMode.CLASSIC)
{
// Linedefs cache needs to be up to date...
Update(true, false);
@ -2310,6 +2311,7 @@ namespace CodeImp.DoomBuilder.Map
else
{
FlipBackwardLinedefs(changedlines);
CorrectOuterSides(new HashSet<Linedef>(changedlines));
}
return true;

View file

@ -1815,11 +1815,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
HashSet<Sidedef> newsides = new HashSet<Sidedef>(General.Map.Map.GetMarkedSidedefs(true));
HashSet<Linedef> oldlines = new HashSet<Linedef>(General.Map.Map.GetMarkedLinedefs(false));
RectangleF editarea = MapSet.CreateArea(oldlines);
// Determine area in which we are editing
RectangleF editarea = MapSet.CreateArea(General.Map.Map.GetMarkedLinedefs(true));
if (General.Settings.MergeGeometryMode != MergeGeometryMode.CLASSIC)
{
editarea = MapSet.CreateArea(General.Map.Map.GetMarkedLinedefs(true));
editarea = MapSet.IncreaseArea(editarea, General.Map.Map.GetMarkedVertices(true));
editarea.Inflate(1.0f, 1.0f);
//oldlines = MapSet.FilterByArea(oldlines, ref editarea);
}
//mxd. Let's use a blockmap...
BlockMap<BlockEntry> blockmap = new BlockMap<BlockEntry>(editarea);