Update 2D flat alignment when dragging geometry or changing a sector tag. Also tweak some undo/redo behavior.

This commit is contained in:
sphere 2021-03-13 18:16:38 +01:00
parent 3856a65588
commit cba0e2a5d4
3 changed files with 40 additions and 22 deletions

View file

@ -718,24 +718,19 @@ namespace CodeImp.DoomBuilder.Editing
//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))
if (linedeftags.Contains(s.Tag) || s.Marked)
{
s.UpdateFloorSurface();
s.UpdateCeilingSurface();
}
}
// Map changed!
General.Map.IsChanged = true;
@ -882,24 +877,19 @@ namespace CodeImp.DoomBuilder.Editing
//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))
if (linedeftags.Contains(s.Tag) || s.Marked)
{
s.UpdateFloorSurface();
s.UpdateCeilingSurface();
}
}
// Map changed!
General.Map.IsChanged = true;

View file

@ -324,6 +324,10 @@ namespace CodeImp.DoomBuilder.Windows
// Action
s.Tag = General.Clamp(tagSelector.GetSmartTag(s.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
// Update hacky flat alignment
s.UpdateFloorSurface();
s.UpdateCeilingSurface();
}
// Done

View file

@ -517,6 +517,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
}
else
{
// Update hacky flat alignment
foreach (Linedef l in General.Map.Map.LinedefsFromMarkedVertices(true, true, true))
{
if (l.IsFlatAlignment)
{
if (l.Tag == 0)
{
l.Front.Sector.UpdateFloorSurface();
l.Front.Sector.UpdateCeilingSurface();
}
else
{
foreach (Sector s in General.Map.Map.Sectors)
if (s.Tag == l.Tag)
{
s.UpdateFloorSurface();
s.UpdateCeilingSurface();
}
}
}
}
}
// Update cached values
General.Map.Map.Update();