mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-12 23:54:10 +00:00
Fixed a problem where dragging or drawing geometry sometimes broke sectors. Fixes #556
This commit is contained in:
parent
4b0dce43ed
commit
b7d92fb704
1 changed files with 10 additions and 2 deletions
|
@ -302,8 +302,9 @@ namespace CodeImp.DoomBuilder.Geometry
|
||||||
|
|
||||||
float px = foundv.Position.x; //mxd
|
float px = foundv.Position.x; //mxd
|
||||||
float py = foundv.Position.y; //mxd
|
float py = foundv.Position.y; //mxd
|
||||||
|
float scanlinefoundvdistance = float.MaxValue;
|
||||||
|
|
||||||
foreach(Linedef ld in General.Map.Map.Linedefs)
|
foreach(Linedef ld in General.Map.Map.Linedefs)
|
||||||
{
|
{
|
||||||
// Line to the right of start point?
|
// Line to the right of start point?
|
||||||
if((ld.Start.Position.x > px) || (ld.End.Position.x > px))
|
if((ld.Start.Position.x > px) || (ld.End.Position.x > px))
|
||||||
|
@ -321,6 +322,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
||||||
{
|
{
|
||||||
scanline = ld;
|
scanline = ld;
|
||||||
foundu = thisu;
|
foundu = thisu;
|
||||||
|
scanlinefoundvdistance = scanline.DistanceTo(foundv.Position, true);
|
||||||
}
|
}
|
||||||
//mxd. Special cases: when foundv.y matches ld's start or end y,
|
//mxd. Special cases: when foundv.y matches ld's start or end y,
|
||||||
// prefer the line, which is clser to being parallel to the x axis
|
// prefer the line, which is clser to being parallel to the x axis
|
||||||
|
@ -331,7 +333,13 @@ namespace CodeImp.DoomBuilder.Geometry
|
||||||
&& GetRelativeAngle(scanline, foundv.Position, out scanlineanglerel)
|
&& GetRelativeAngle(scanline, foundv.Position, out scanlineanglerel)
|
||||||
&& (ldanglerel < scanlineanglerel))
|
&& (ldanglerel < scanlineanglerel))
|
||||||
{
|
{
|
||||||
scanline = ld; // foundu already matches
|
// biwa. This fixes a problem with breaking geometry. It's unknown if this breaks the original fix
|
||||||
|
// See https://github.com/jewalky/UltimateDoomBuilder/issues/556 for an explanation
|
||||||
|
if (ld.DistanceTo(foundv.Position, true) < scanlinefoundvdistance)
|
||||||
|
{
|
||||||
|
scanline = ld; // foundu already matches
|
||||||
|
scanlinefoundvdistance = scanline.DistanceTo(foundv.Position, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue