mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 12:22:35 +00:00
Visual mode: (hopefully) fixed a crash during Ctrl- and Shift-selecting wall surfaces.
Visual mode: "Select adjacent walls with the same height" (Ctrl-Select) logic was not working properly in some cases.
This commit is contained in:
parent
76dba9cd87
commit
5c19a12ab7
1 changed files with 57 additions and 24 deletions
|
@ -395,8 +395,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
protected void selectNeighbours(string texture, bool select, bool withSameTexture, bool withSameHeight) {
|
protected void selectNeighbours(string texture, bool select, bool withSameTexture, bool withSameHeight) {
|
||||||
if(!withSameTexture && !withSameHeight)
|
if(Sidedef.Sector == null || (!withSameTexture && !withSameHeight)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if(select && !selected) {
|
if(select && !selected) {
|
||||||
selected = true;
|
selected = true;
|
||||||
|
@ -410,15 +409,39 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
List<Linedef> connectedLines = new List<Linedef>();
|
List<Linedef> connectedLines = new List<Linedef>();
|
||||||
|
|
||||||
foreach(Linedef line in Sidedef.Line.Start.Linedefs) {
|
foreach(Linedef line in Sidedef.Line.Start.Linedefs) {
|
||||||
if(line.Index == Sidedef.Line.Index)
|
if(line.Index == Sidedef.Line.Index) continue;
|
||||||
continue;
|
|
||||||
connectedLines.Add(line);
|
connectedLines.Add(line);
|
||||||
}
|
}
|
||||||
foreach(Linedef line in Sidedef.Line.End.Linedefs) {
|
foreach(Linedef line in Sidedef.Line.End.Linedefs) {
|
||||||
if(line.Index == Sidedef.Line.Index)
|
if(line.Index == Sidedef.Line.Index) continue;
|
||||||
continue;
|
if(!connectedLines.Contains(line)) connectedLines.Add(line);
|
||||||
if(!connectedLines.Contains(line))
|
}
|
||||||
connectedLines.Add(line);
|
|
||||||
|
int floorHeight = 0;
|
||||||
|
int ceilingHeight = 0;
|
||||||
|
|
||||||
|
if (withSameHeight) {
|
||||||
|
bool haveBackSector = Sidedef.Other != null && Sidedef.Other.Sector != null;
|
||||||
|
|
||||||
|
if(geoType == VisualGeometryType.WALL_LOWER) {
|
||||||
|
floorHeight = Sidedef.Sector.FloorHeight;
|
||||||
|
ceilingHeight = (haveBackSector ? Sidedef.Other.Sector.FloorHeight : Sidedef.Sector.CeilHeight);
|
||||||
|
} else if(geoType == VisualGeometryType.WALL_UPPER) {
|
||||||
|
floorHeight = (haveBackSector ? Sidedef.Other.Sector.CeilHeight : Sidedef.Sector.FloorHeight);
|
||||||
|
ceilingHeight = Sidedef.Sector.CeilHeight;
|
||||||
|
} else if(geoType == VisualGeometryType.WALL_MIDDLE) {
|
||||||
|
floorHeight = Sidedef.Sector.FloorHeight;
|
||||||
|
ceilingHeight = Sidedef.Sector.CeilHeight;
|
||||||
|
} else { //should be WALL_MIDDLE_3D
|
||||||
|
Linedef cl = GetControlLinedef();
|
||||||
|
if(cl.Front != null && cl.Front.Sector != null) {
|
||||||
|
floorHeight = cl.Front.Sector.FloorHeight;
|
||||||
|
ceilingHeight = cl.Front.Sector.CeilHeight;
|
||||||
|
} else {
|
||||||
|
floorHeight = Sidedef.Sector.FloorHeight;
|
||||||
|
ceilingHeight = Sidedef.Sector.CeilHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Linedef line in connectedLines) {
|
foreach(Linedef line in connectedLines) {
|
||||||
|
@ -454,24 +477,34 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
if(withSameHeight) {
|
if(withSameHeight) {
|
||||||
if(line.Front != null && line.Front.Sector.FloorHeight == Sidedef.Sector.FloorHeight && line.Front.Sector.CeilHeight == Sidedef.Sector.CeilHeight) {
|
bool lineHasFrontSector = line.Front != null && line.Front.Sector != null;
|
||||||
addFrontTop = withSameTexture ? addFrontTop : true;
|
bool lineHasBackSector = line.Back != null && line.Back.Sector != null;
|
||||||
addFrontMiddle = withSameTexture ? addFrontMiddle : true;
|
|
||||||
addFrontBottom = withSameTexture ? addFrontBottom : true;
|
//upper parts match?
|
||||||
} else {
|
if((!withSameTexture || addFrontTop) && lineHasFrontSector && line.Front.HighRequired()) {
|
||||||
addFrontTop = false;
|
addFrontTop = (line.Front.Sector.CeilHeight == ceilingHeight && line.Back.Sector.CeilHeight == floorHeight);
|
||||||
addFrontMiddle = false;
|
|
||||||
addFrontBottom = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(line.Back != null && line.Back.Sector.FloorHeight == Sidedef.Sector.FloorHeight && line.Back.Sector.CeilHeight == Sidedef.Sector.CeilHeight) {
|
if((!withSameTexture || addBackTop) && lineHasBackSector && line.Back.HighRequired()) {
|
||||||
addBackTop = withSameTexture ? addBackTop : true;
|
addBackTop = (line.Back.Sector.CeilHeight == ceilingHeight && line.Front.Sector.CeilHeight == floorHeight);
|
||||||
addBackMiddle = withSameTexture ? addBackMiddle : true;
|
}
|
||||||
addBackBottom = withSameTexture ? addBackBottom : true;
|
|
||||||
} else {
|
//middle parts match?
|
||||||
addBackTop = false;
|
if((!withSameTexture || addFrontMiddle) && lineHasFrontSector && line.Front.MiddleRequired()) {
|
||||||
addBackMiddle = false;
|
addFrontMiddle = (line.Front.Sector.CeilHeight == ceilingHeight && line.Front.Sector.FloorHeight == floorHeight);
|
||||||
addBackBottom = false;
|
}
|
||||||
|
|
||||||
|
if((!withSameTexture || addBackMiddle) && lineHasBackSector && line.Back.MiddleRequired()) {
|
||||||
|
addBackMiddle = (line.Back.Sector.CeilHeight == ceilingHeight && line.Back.Sector.FloorHeight == floorHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
//lower parts match?
|
||||||
|
if((!withSameTexture || addFrontBottom) && lineHasFrontSector && line.Front.LowRequired()) {
|
||||||
|
addFrontBottom = (line.Back.Sector.FloorHeight == ceilingHeight && line.Front.Sector.FloorHeight == floorHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((!withSameTexture || addBackBottom) && lineHasBackSector && line.Back.LowRequired()) {
|
||||||
|
addBackBottom = (line.Front.Sector.FloorHeight == ceilingHeight && line.Back.Sector.FloorHeight == floorHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue