- Auto-aligning textures now produces more intuitive results and is consistent between UDMF and non-UDMF maps

This commit is contained in:
biwa 2019-10-19 00:29:14 +02:00 committed by spherallic
parent 1b552471e0
commit 330ab8d367

View file

@ -4473,6 +4473,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get the align job to do
SidedefAlignJob j = todo.Pop();
// Make sure to not align already aligned textures. This prevents unexpected
// results when aligning textures on circular shapes
if (j.sidedef.Marked)
continue;
DebugConsole.WriteLine("Aligning " + j.sidedef);
if(j.forward)
{
// Apply alignment
@ -4509,14 +4516,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
// Add sidedefs forward (connected to the right vertex)
Vertex v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
AddSidedefsForAlignment(todo, v, true, forwardoffset, 1.0f, texturehashes, false);
// Add sidedefs backward (connected to the left vertex)
v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
Vertex v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
AddSidedefsForAlignment(todo, v, false, backwardoffset, 1.0f, texturehashes, false);
}
// Add sidedefs forward (connected to the right vertex)
v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
AddSidedefsForAlignment(todo, v, true, forwardoffset, 1.0f, texturehashes, false);
}
else
{
// Apply alignment
@ -4549,13 +4556,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
// Add sidedefs backward (connected to the left vertex)
Vertex v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
AddSidedefsForAlignment(todo, v, false, backwardoffset, 1.0f, texturehashes, false);
// Add sidedefs forward (connected to the right vertex)
v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
Vertex v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
AddSidedefsForAlignment(todo, v, true, forwardoffset, 1.0f, texturehashes, false);
// Add sidedefs backward (connected to the left vertex)
v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
AddSidedefsForAlignment(todo, v, false, backwardoffset, 1.0f, texturehashes, false);
}
}
}
@ -4679,8 +4686,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get the align job to do
SidedefAlignJob j = todo.Pop();
// Make sure to not align already aligned textures. This prevents unexpected
// results when aligning textures on circular shapes
if (j.sidedef.Marked)
continue;
//mxd. Get visual parts
if(VisualSectorExists(j.sidedef.Sector))
if (VisualSectorExists(j.sidedef.Sector))
{
VisualSidedefParts parts = ((BaseVisualSector)GetVisualSector(j.sidedef.Sector)).GetSidedefParts(j.sidedef);
VisualSidedefParts controlparts = (j.sidedef != j.controlSide ? ((BaseVisualSector)GetVisualSector(j.controlSide.Sector)).GetSidedefParts(j.controlSide) : parts);