mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
Some more changes regarding linedef properties and the removal of unneeded textures when drawing
This commit is contained in:
parent
42c2940ed1
commit
3750f3f8e2
2 changed files with 26 additions and 24 deletions
|
@ -559,7 +559,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
{
|
||||
// We may only remove a useless middle texture when
|
||||
// the line was previously singlesided
|
||||
bool removeuselessmiddle = (ls.Line.Back == null) || (ls.Line.Front == null);
|
||||
bool wassinglesided = (ls.Line.Back == null) || (ls.Line.Front == null);
|
||||
|
||||
if(ls.Front)
|
||||
{
|
||||
|
@ -577,9 +577,13 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
}
|
||||
|
||||
// Update line
|
||||
if(ls.Line.Front != null) ls.Line.Front.RemoveUnneededTextures(removeuselessmiddle);
|
||||
if(ls.Line.Back != null) ls.Line.Back.RemoveUnneededTextures(removeuselessmiddle);
|
||||
ls.Line.ApplySidedFlags();
|
||||
if(ls.Line.Front != null) ls.Line.Front.RemoveUnneededTextures(wassinglesided);
|
||||
if(ls.Line.Back != null) ls.Line.Back.RemoveUnneededTextures(wassinglesided);
|
||||
|
||||
// Apply single/double sided flags if the double-sided-ness changed
|
||||
if( (wassinglesided && ((ls.Line.Front != null) && (ls.Line.Back != null))) ||
|
||||
(!wassinglesided && ((ls.Line.Front == null) || (ls.Line.Back == null))))
|
||||
ls.Line.ApplySidedFlags();
|
||||
}
|
||||
|
||||
// Return the new sector
|
||||
|
@ -1266,19 +1270,6 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
// Make corrections for backward linedefs
|
||||
MapSet.FlipBackwardLinedefs(newlines);
|
||||
|
||||
// Remove all unneeded textures
|
||||
// Shouldn't this already be done by the
|
||||
// makesector/joinsector functions?
|
||||
foreach(Linedef ld in newlines)
|
||||
{
|
||||
if(ld.Front != null) ld.Front.RemoveUnneededTextures(true);
|
||||
if(ld.Back != null) ld.Back.RemoveUnneededTextures(true);
|
||||
}
|
||||
foreach(Sidedef sd in insidesides)
|
||||
{
|
||||
sd.RemoveUnneededTextures(true);
|
||||
}
|
||||
|
||||
// Check if any of our new lines have sides
|
||||
if(sidescreated)
|
||||
{
|
||||
|
|
|
@ -698,6 +698,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
nsd = map.CreateSidedef(nl, true, front.Sector);
|
||||
front.CopyPropertiesTo(nsd);
|
||||
nsd.Marked = front.Marked;
|
||||
|
||||
// Make texture offset adjustments
|
||||
nsd.OffsetX += (int)Vector2D.Distance(this.start.Position, this.end.Position);
|
||||
}
|
||||
|
||||
// Copy back sidedef if exists
|
||||
|
@ -706,6 +709,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
nsd = map.CreateSidedef(nl, false, back.Sector);
|
||||
back.CopyPropertiesTo(nsd);
|
||||
nsd.Marked = back.Marked;
|
||||
|
||||
// Make texture offset adjustments
|
||||
back.OffsetX += (int)Vector2D.Distance(nl.start.Position, nl.end.Position);
|
||||
}
|
||||
|
||||
// Return result
|
||||
|
@ -751,6 +757,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
JoinChangeSidedefs(other, false, front);
|
||||
JoinChangeSidedefs(other, true, back);
|
||||
}
|
||||
|
||||
// Copy my properties to the other
|
||||
this.CopyPropertiesTo(other);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -865,19 +874,21 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply single/double sided flags if the double-sided-ness changed
|
||||
if( (!l1was2s && ((other.Front != null) && (other.Back != null))) ||
|
||||
(l1was2s && ((other.Front == null) || (other.Back == null))) )
|
||||
other.ApplySidedFlags();
|
||||
|
||||
// Remove unneeded textures
|
||||
if(other.front != null) other.front.RemoveUnneededTextures(!(l1was2s && l2was2s));
|
||||
if(other.back != null) other.back.RemoveUnneededTextures(!(l1was2s && l2was2s));
|
||||
}
|
||||
|
||||
// If either of the two lines was selected, keep the other selected
|
||||
if(this.selected) other.selected = true;
|
||||
if(this.marked) other.marked = true;
|
||||
|
||||
// Apply single/double sided flags
|
||||
other.ApplySidedFlags();
|
||||
|
||||
// Remove unneeded textures
|
||||
if(other.front != null) other.front.RemoveUnneededTextures(!(l1was2s && l2was2s));
|
||||
if(other.back != null) other.back.RemoveUnneededTextures(!(l1was2s && l2was2s));
|
||||
|
||||
// I got killed by the other.
|
||||
this.Dispose();
|
||||
General.Map.IsChanged = true;
|
||||
|
|
Loading…
Reference in a new issue