Fixed, Visual mode: "Same texture" check for "Select" action is now case-insensitive.

This commit is contained in:
MaxED 2015-12-09 19:55:30 +00:00
parent fd9b86281f
commit dd869a2324
8 changed files with 46 additions and 114 deletions

View file

@ -526,7 +526,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd
protected void SelectNeighbours(string texture, bool select, bool withSameTexture, bool withSameHeight)
protected void SelectNeighbours(long longtexture, bool select, bool withSameTexture, bool withSameHeight)
{
if(Sidedef.Sector == null || (!withSameTexture && !withSameHeight)) return;
@ -575,19 +575,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
List<VisualMiddle3D> extrasides = new List<VisualMiddle3D>();
// Gather 3d floor sides
if (doublesided)
if(doublesided)
{
BaseVisualSector s = mode.GetVisualSector(line.Front.Sector) as BaseVisualSector;
if (s != null)
{
extrasides.AddRange(s.GetSidedefParts(line.Front).middle3d.ToArray());
}
if(s != null) extrasides.AddRange(s.GetSidedefParts(line.Front).middle3d.ToArray());
s = mode.GetVisualSector(line.Back.Sector) as BaseVisualSector;
if(s != null)
{
extrasides.AddRange(s.GetSidedefParts(line.Back).middle3d.ToArray());
}
if(s != null) extrasides.AddRange(s.GetSidedefParts(line.Back).middle3d.ToArray());
}
// Add regular sides
@ -595,16 +589,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
if(line.Front != null)
{
addFrontTop = (line.Front.HighTexture == texture
addFrontTop = (line.Front.LongHighTexture == longtexture
&& line.Front.HighRequired()
&& BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_UPPER).IntersectsWith(rect));
addFrontMiddle = (line.Front.MiddleTexture == texture
&& (line.Front.MiddleRequired() || (line.Back != null && texture != "-"))
addFrontMiddle = (line.Front.LongMiddleTexture == longtexture
&& (line.Front.MiddleRequired() || (line.Back != null && longtexture != MapSet.EmptyLongName))
&& line.Front.GetMiddleHeight() > 0
&& BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_MIDDLE).IntersectsWith(rect));
addFrontBottom = (line.Front.LowTexture == texture
addFrontBottom = (line.Front.LongLowTexture == longtexture
&& line.Front.LowRequired()
&& BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_LOWER).IntersectsWith(rect));
@ -612,16 +606,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(line.Back != null)
{
addBackTop = (line.Back.HighTexture == texture
addBackTop = (line.Back.LongHighTexture == longtexture
&& line.Back.HighRequired()
&& BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_UPPER).IntersectsWith(rect));
addBackMiddle = (line.Back.MiddleTexture == texture
&& (line.Back.MiddleRequired() || (line.Front != null && texture != "-"))
addBackMiddle = (line.Back.LongMiddleTexture == longtexture
&& (line.Back.MiddleRequired() || (line.Front != null && longtexture != MapSet.EmptyLongName))
&& line.Back.GetMiddleHeight() > 0
&& BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_MIDDLE).IntersectsWith(rect));
addBackBottom = (line.Back.LowTexture == texture
addBackBottom = (line.Back.LongLowTexture == longtexture
&& line.Back.LowRequired()
&& BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_LOWER).IntersectsWith(rect));
}
@ -631,7 +625,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(VisualMiddle3D side3d in extrasides)
{
Sidedef controlside = side3d.GetControlLinedef().Front;
if (controlside.MiddleTexture == texture && BuilderModesTools.GetSidedefPartSize(controlside, VisualGeometryType.WALL_MIDDLE).IntersectsWith(rect))
if(controlside.LongMiddleTexture == longtexture && BuilderModesTools.GetSidedefPartSize(controlside, VisualGeometryType.WALL_MIDDLE).IntersectsWith(rect))
{
filtered.Add(side3d);
}

View file

@ -504,48 +504,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
BaseVisualSector vs = mode.GetVisualSector(side.Other.Sector) as BaseVisualSector;
if(vs == null) continue;
bool add;
// When current ceiling is part of a 3d floor, it looks like a floor, so we need to select adjacent floors
if(level.sector != Sector.Sector && !regularorvavoom)
{
add = (withSameTexture && side.Other.Sector.FloorTexture == level.sector.CeilTexture);
if(withSameHeight)
{
add = ((withSameTexture && add) || !withSameTexture) && side.Other.Sector.FloorHeight == level.sector.CeilHeight;
}
if(add)
if((withSameTexture && side.Other.Sector.LongFloorTexture == level.sector.LongCeilTexture) ||
(withSameHeight && side.Other.Sector.FloorHeight == level.sector.CeilHeight))
{
neighbours.Add(side.Other.Sector);
//(de)select regular visual floor?
if(select != vs.Floor.Selected)
{
vs.Floor.SelectNeighbours(select, withSameTexture, withSameHeight);
}
}
}
else // Regular ceiling or vavoom-type extra ceiling
{
// (De)select adjacent ceilings
add = (withSameTexture && side.Other.Sector.CeilTexture == level.sector.CeilTexture);
if(withSameHeight)
{
add = ((withSameTexture && add) || !withSameTexture) && side.Other.Sector.CeilHeight == level.sector.CeilHeight;
}
if(add)
if((withSameTexture && side.Other.Sector.LongCeilTexture == level.sector.LongCeilTexture) ||
(withSameHeight && side.Other.Sector.CeilHeight == level.sector.CeilHeight))
{
neighbours.Add(side.Other.Sector);
//(de)select regular visual ceiling?
if(select != vs.Ceiling.Selected)
{
vs.Ceiling.SelectNeighbours(select, withSameTexture, withSameHeight);
}
}
}
@ -553,15 +536,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(VisualCeiling ec in vs.ExtraCeilings)
{
if(select == ec.Selected || ec.extrafloor.VavoomType != regularorvavoom) continue;
add = (withSameTexture && level.sector.CeilTexture == ec.level.sector.CeilTexture);
if(withSameHeight)
{
add = ((withSameTexture && add) || !withSameTexture) && level.sector.CeilHeight == ec.level.sector.CeilHeight;
}
if(add)
if((withSameTexture && level.sector.LongCeilTexture == ec.level.sector.LongCeilTexture) ||
(withSameHeight && level.sector.CeilHeight == ec.level.sector.CeilHeight))
{
ec.SelectNeighbours(select, withSameTexture, withSameHeight);
}
@ -571,15 +547,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(VisualFloor ef in vs.ExtraFloors)
{
if(select == ef.Selected || ef.ExtraFloor.VavoomType == regularorvavoom) continue;
add = (withSameTexture && level.sector.CeilTexture == ef.Level.sector.FloorTexture);
if(withSameHeight)
{
add = ((withSameTexture && add) || !withSameTexture) && level.sector.CeilHeight == ef.Level.sector.FloorHeight;
}
if(add)
if((withSameTexture && level.sector.LongCeilTexture == ef.Level.sector.LongFloorTexture) ||
(withSameHeight && level.sector.CeilHeight == ef.Level.sector.FloorHeight))
{
ef.SelectNeighbours(select, withSameTexture, withSameHeight);
}

View file

@ -447,14 +447,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
{
if (!withSameTexture && !withSameHeight) return;
if(!withSameTexture && !withSameHeight) return;
if (select && !selected)
if(select && !selected)
{
selected = true;
mode.AddSelectedObject(this);
}
else if (!select && selected)
else if(!select && selected)
{
selected = false;
mode.RemoveSelectedObject(this);
@ -466,68 +466,44 @@ namespace CodeImp.DoomBuilder.BuilderModes
//collect neighbour sectors
foreach(Sidedef side in Sector.Sector.Sidedefs)
{
if (side.Other != null && side.Other.Sector != Sector.Sector && !neighbours.Contains(side.Other.Sector))
if(side.Other != null && side.Other.Sector != Sector.Sector && !neighbours.Contains(side.Other.Sector))
{
BaseVisualSector vs = mode.GetVisualSector(side.Other.Sector) as BaseVisualSector;
if (vs == null) continue;
bool add;
if(vs == null) continue;
// When current floor is part of a 3d floor, it looks like a ceiling, so we need to select adjacent ceilings
if (level.sector != Sector.Sector && !regularorvavoom)
if(level.sector != Sector.Sector && !regularorvavoom)
{
add = (withSameTexture && side.Other.Sector.CeilTexture == level.sector.FloorTexture);
if (withSameHeight)
{
add = ((withSameTexture && add) || !withSameTexture) && side.Other.Sector.CeilHeight == level.sector.FloorHeight;
}
if (add)
if((withSameTexture && side.Other.Sector.LongCeilTexture == level.sector.LongFloorTexture) ||
(withSameHeight && side.Other.Sector.CeilHeight == level.sector.FloorHeight))
{
neighbours.Add(side.Other.Sector);
//(de)select regular visual ceiling?
if (select != vs.Ceiling.Selected)
{
if(select != vs.Ceiling.Selected)
vs.Ceiling.SelectNeighbours(select, withSameTexture, withSameHeight);
}
}
}
else // Regular floor or vavoom-type extrafloor
{
// (De)select adjacent floor
add = (withSameTexture && side.Other.Sector.FloorTexture == level.sector.FloorTexture);
if (withSameHeight)
{
add = ((withSameTexture && add) || !withSameTexture) && side.Other.Sector.FloorHeight == level.sector.FloorHeight;
}
if (add)
if((withSameTexture && side.Other.Sector.LongFloorTexture == level.sector.LongFloorTexture) ||
(withSameHeight && side.Other.Sector.FloorHeight == level.sector.FloorHeight))
{
neighbours.Add(side.Other.Sector);
//(de)select regular visual floor?
if (select != vs.Floor.Selected)
{
if(select != vs.Floor.Selected)
vs.Floor.SelectNeighbours(select, withSameTexture, withSameHeight);
}
}
}
// (De)select adjacent extra floors
foreach(VisualFloor ef in vs.ExtraFloors)
{
if (select == ef.Selected || ef.extrafloor.VavoomType != regularorvavoom) continue;
add = (withSameTexture && level.sector.FloorTexture == ef.level.sector.FloorTexture);
if (withSameHeight)
{
add = ((withSameTexture && add) || !withSameTexture) && level.sector.FloorHeight == ef.level.sector.FloorHeight;
}
if (add)
if(select == ef.Selected || ef.extrafloor.VavoomType != regularorvavoom) continue;
if((withSameTexture && level.sector.LongFloorTexture == ef.level.sector.LongFloorTexture) ||
(withSameHeight && level.sector.FloorHeight == ef.level.sector.FloorHeight))
{
ef.SelectNeighbours(select, withSameTexture, withSameHeight);
}
@ -537,15 +513,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(VisualCeiling ec in vs.ExtraCeilings)
{
if(select == ec.Selected || ec.ExtraFloor.VavoomType == regularorvavoom) continue;
add = (withSameTexture && level.sector.FloorTexture == ec.Level.sector.CeilTexture);
if (withSameHeight)
{
add = ((withSameTexture && add) || !withSameTexture) && level.sector.FloorHeight == ec.Level.sector.CeilHeight;
}
if (add)
if((withSameTexture && level.sector.LongFloorTexture == ec.Level.sector.LongCeilTexture) ||
(withSameHeight && level.sector.FloorHeight == ec.Level.sector.CeilHeight))
{
ec.SelectNeighbours(select, withSameTexture, withSameHeight);
}

View file

@ -279,7 +279,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
{
SelectNeighbours(Sidedef.LowTexture, select, withSameTexture, withSameHeight);
SelectNeighbours(Sidedef.LongLowTexture, select, withSameTexture, withSameHeight);
}
#endregion

View file

@ -390,7 +390,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
{
SelectNeighbours(extrafloor.Linedef.Front.MiddleTexture, select, withSameTexture, withSameHeight);
SelectNeighbours(extrafloor.Linedef.Front.LongMiddleTexture, select, withSameTexture, withSameHeight);
}
//mxd

View file

@ -379,7 +379,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
{
SelectNeighbours(Sidedef.MiddleTexture, select, withSameTexture, withSameHeight);
SelectNeighbours(Sidedef.LongMiddleTexture, select, withSameTexture, withSameHeight);
}
#endregion

View file

@ -270,7 +270,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
{
SelectNeighbours(Sidedef.MiddleTexture, select, withSameTexture, withSameHeight);
SelectNeighbours(Sidedef.LongMiddleTexture, select, withSameTexture, withSameHeight);
}
#endregion

View file

@ -270,7 +270,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
{
SelectNeighbours(Sidedef.HighTexture, select, withSameTexture, withSameHeight);
SelectNeighbours(Sidedef.LongHighTexture, select, withSameTexture, withSameHeight);
}
#endregion