mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Update 2D flat alignment on undo & redo.
This commit is contained in:
parent
a754bf447a
commit
597592b393
2 changed files with 55 additions and 22 deletions
|
@ -105,6 +105,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Disposing
|
||||
private bool isdisposed;
|
||||
|
||||
// Keep track of changed linedef tags for hacky flat alignment
|
||||
private static List<int> linedeftags = new List<int>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -713,7 +716,27 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
General.Map.Data.UpdateUsedTextures();
|
||||
General.MainWindow.RefreshInfo();
|
||||
//General.MainWindow.RedrawDisplay();
|
||||
|
||||
|
||||
// (Re)set hacky flat alignment
|
||||
bool alignmentupdate = false;
|
||||
foreach (Linedef l in General.Map.Map.Linedefs)
|
||||
if (l.Marked && (l.IsFlatAlignment || l.Action == 0))
|
||||
{
|
||||
l.Front.Sector.UpdateFloorSurface();
|
||||
l.Front.Sector.UpdateCeilingSurface();
|
||||
linedeftags.Add(l.Tag);
|
||||
alignmentupdate = true;
|
||||
}
|
||||
if (alignmentupdate)
|
||||
{
|
||||
foreach (Sector s in General.Map.Map.Sectors)
|
||||
if (linedeftags.Contains(s.Tag))
|
||||
{
|
||||
s.UpdateFloorSurface();
|
||||
s.UpdateCeilingSurface();
|
||||
}
|
||||
}
|
||||
|
||||
// Map changed!
|
||||
General.Map.IsChanged = true;
|
||||
|
||||
|
@ -857,7 +880,27 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
General.Map.Data.UpdateUsedTextures();
|
||||
General.MainWindow.RefreshInfo();
|
||||
//General.MainWindow.RedrawDisplay();
|
||||
|
||||
|
||||
// (Re)set hacky flat alignment
|
||||
bool alignmentupdate = false;
|
||||
foreach (Linedef l in General.Map.Map.Linedefs)
|
||||
if (l.Marked && (l.IsFlatAlignment || l.Action == 0))
|
||||
{
|
||||
l.Front.Sector.UpdateFloorSurface();
|
||||
l.Front.Sector.UpdateCeilingSurface();
|
||||
linedeftags.Add(l.Tag);
|
||||
alignmentupdate = true;
|
||||
}
|
||||
if (alignmentupdate)
|
||||
{
|
||||
foreach (Sector s in General.Map.Map.Sectors)
|
||||
if (linedeftags.Contains(s.Tag))
|
||||
{
|
||||
s.UpdateFloorSurface();
|
||||
s.UpdateCeilingSurface();
|
||||
}
|
||||
}
|
||||
|
||||
// Map changed!
|
||||
General.Map.IsChanged = true;
|
||||
|
||||
|
@ -1010,6 +1053,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
{
|
||||
int index; ds.rInt(out index);
|
||||
Linedef l = General.Map.Map.GetLinedefByIndex(index);
|
||||
linedeftags.Add(l.Tag);
|
||||
l.ReadWrite(ds);
|
||||
l.Marked = true;
|
||||
}
|
||||
|
|
|
@ -484,35 +484,24 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// (Re)set hacky flat alignment
|
||||
if (l.IsFlatAlignment || l.Action == 0)
|
||||
{
|
||||
if (l.Tag == 0)
|
||||
{
|
||||
l.Front.Sector.UpdateFloorSurface();
|
||||
l.Front.Sector.UpdateCeilingSurface();
|
||||
if (oldtag != 0 && sectortags.ContainsKey(oldtag))
|
||||
{
|
||||
foreach (Sector s in sectortags[oldtag])
|
||||
{
|
||||
s.UpdateFloorSurface();
|
||||
s.UpdateCeilingSurface();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sectortags.ContainsKey(l.Tag))
|
||||
if (sectortags.ContainsKey(l.Tag))
|
||||
{
|
||||
foreach (Sector s in sectortags[l.Tag])
|
||||
{
|
||||
s.UpdateFloorSurface();
|
||||
s.UpdateCeilingSurface();
|
||||
}
|
||||
if (oldtag != 0 && sectortags.ContainsKey(oldtag))
|
||||
}
|
||||
if (oldtag != 0 && sectortags.ContainsKey(oldtag))
|
||||
{
|
||||
foreach (Sector s in sectortags[oldtag])
|
||||
{
|
||||
foreach (Sector s in sectortags[oldtag])
|
||||
{
|
||||
s.UpdateFloorSurface();
|
||||
s.UpdateCeilingSurface();
|
||||
}
|
||||
s.UpdateFloorSurface();
|
||||
s.UpdateCeilingSurface();
|
||||
}
|
||||
}
|
||||
l.Front.Sector.UpdateFloorSurface();
|
||||
l.Front.Sector.UpdateCeilingSurface();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue