mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 12:50:52 +00:00
linedefs will now be correctly flipped when the selection is mirrored
This commit is contained in:
parent
750507e8ad
commit
a0fa6601ce
1 changed files with 19 additions and 0 deletions
|
@ -96,6 +96,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
// Selection
|
// Selection
|
||||||
private ICollection<Vertex> selectedvertices;
|
private ICollection<Vertex> selectedvertices;
|
||||||
private ICollection<Thing> selectedthings;
|
private ICollection<Thing> selectedthings;
|
||||||
|
private ICollection<Linedef> selectedlines;
|
||||||
private List<Vector2D> vertexpos;
|
private List<Vector2D> vertexpos;
|
||||||
private List<Vector2D> thingpos;
|
private List<Vector2D> thingpos;
|
||||||
private ICollection<Vertex> unselectedvertices;
|
private ICollection<Vertex> unselectedvertices;
|
||||||
|
@ -107,6 +108,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
private Vector2D size;
|
private Vector2D size;
|
||||||
private Vector2D baseoffset;
|
private Vector2D baseoffset;
|
||||||
private Vector2D basesize;
|
private Vector2D basesize;
|
||||||
|
private bool linesflipped;
|
||||||
|
|
||||||
// Modifying Modes
|
// Modifying Modes
|
||||||
private ModifyMode mode;
|
private ModifyMode mode;
|
||||||
|
@ -495,6 +497,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
t.Move(TransformedPoint(thingpos[index++]));
|
t.Move(TransformedPoint(thingpos[index++]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This checks if the lines should be flipped
|
||||||
|
bool shouldbeflipped = (size.x < 0.0f) ^ (size.y < 0.0f);
|
||||||
|
if(shouldbeflipped != linesflipped) FlipLinedefs();
|
||||||
|
|
||||||
General.Map.Map.Update(true, false);
|
General.Map.Map.Update(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,6 +580,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
gripsize, gripsize);
|
gripsize, gripsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This flips all linedefs in the selection (used for mirroring)
|
||||||
|
private void FlipLinedefs()
|
||||||
|
{
|
||||||
|
// Flip linedefs
|
||||||
|
foreach(Linedef ld in selectedlines)
|
||||||
|
ld.FlipVertices();
|
||||||
|
|
||||||
|
// Done
|
||||||
|
linesflipped = !linesflipped;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Events
|
#region ================== Events
|
||||||
|
@ -598,6 +615,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
foreach(Vertex v in selectedvertices) v.Selected = true;
|
foreach(Vertex v in selectedvertices) v.Selected = true;
|
||||||
ICollection<Linedef> markedlines = General.Map.Map.LinedefsFromMarkedVertices(false, true, false);
|
ICollection<Linedef> markedlines = General.Map.Map.LinedefsFromMarkedVertices(false, true, false);
|
||||||
foreach(Linedef l in markedlines) l.Selected = true;
|
foreach(Linedef l in markedlines) l.Selected = true;
|
||||||
|
selectedlines = General.Map.Map.LinedefsFromMarkedVertices(false, true, false);
|
||||||
unselectedlines = General.Map.Map.LinedefsFromMarkedVertices(true, false, false);
|
unselectedlines = General.Map.Map.LinedefsFromMarkedVertices(true, false, false);
|
||||||
|
|
||||||
// Array to keep original coordinates
|
// Array to keep original coordinates
|
||||||
|
@ -727,6 +745,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
Cursor.Current = Cursors.AppStarting;
|
Cursor.Current = Cursors.AppStarting;
|
||||||
|
|
||||||
// Reset geometry in original position
|
// Reset geometry in original position
|
||||||
|
if(linesflipped) FlipLinedefs(); // Flip linedefs back if they were flipped
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach(Vertex v in selectedvertices)
|
foreach(Vertex v in selectedvertices)
|
||||||
v.Move(vertexpos[index++]);
|
v.Move(vertexpos[index++]);
|
||||||
|
|
Loading…
Reference in a new issue