diff --git a/Source/Core/Geometry/Tools.cs b/Source/Core/Geometry/Tools.cs index 8547532a742669f724dfbf600c787be3eb0f003b..9ed03cc8e9ea6d2b1a45cbfb6dfd4433dbbca1ba 100644 --- a/Source/Core/Geometry/Tools.cs +++ b/Source/Core/Geometry/Tools.cs @@ -46,7 +46,7 @@ namespace CodeImp.DoomBuilder.Geometry public string newtexlow; } - private struct SidedefFillJob + public struct SidedefFillJob { public Sidedef sidedef; diff --git a/Source/Plugins/BuilderModes/General/BuilderModesTools.cs b/Source/Plugins/BuilderModes/General/BuilderModesTools.cs index 5cfa8c6e9305f76608f5ab83ead5fa984ed0241a..a8c37e4b3fcd5d65c4d9f234c67ad639c640d1f5 100644 --- a/Source/Plugins/BuilderModes/General/BuilderModesTools.cs +++ b/Source/Plugins/BuilderModes/General/BuilderModesTools.cs @@ -692,5 +692,106 @@ namespace CodeImp.DoomBuilder.BuilderModes } #endregion + + #region ================== Texture Floodfill + + // This performs texture floodfill along all walls that match with the same texture + // NOTE: This method uses the sidedefs marking to indicate which sides have been filled + // When resetsidemarks is set to true, all sidedefs will first be marked false (not aligned). + // Setting resetsidemarks to false is usefull to fill only within a specific selection + // (set the marked property to true for the sidedefs outside the selection) + public static void FloodfillTextures(BaseVisualMode mode, Sidedef start, HashSet<long> originaltextures, string filltexture, bool resetsidemarks) + { + Stack<Tools.SidedefFillJob> todo = new Stack<Tools.SidedefFillJob>(50); + + // Mark all sidedefs false (they will be marked true when the texture is aligned) + if(resetsidemarks) General.Map.Map.ClearMarkedSidedefs(false); + + // Begin with first sidedef + if(SidedefTextureMatch(mode, start, originaltextures)) + todo.Push(new Tools.SidedefFillJob { sidedef = start, forward = true }); + + // Continue until nothing more to align + while(todo.Count > 0) + { + // Get the align job to do + Tools.SidedefFillJob j = todo.Pop(); + + //mxd. Get visual parts + if(mode.VisualSectorExists(j.sidedef.Sector)) + { + VisualSidedefParts parts = ((BaseVisualSector)mode.GetVisualSector(j.sidedef.Sector)).GetSidedefParts(j.sidedef); + + // Apply texturing + if((parts.upper != null && parts.upper.Triangles > 0) && originaltextures.Contains(j.sidedef.LongHighTexture)) + j.sidedef.SetTextureHigh(filltexture); + if(((parts.middledouble != null && parts.middledouble.Triangles > 0) || (parts.middlesingle != null && parts.middlesingle.Triangles > 0)) && originaltextures.Contains(j.sidedef.LongMiddleTexture)) + j.sidedef.SetTextureMid(filltexture); + if((parts.lower != null && parts.lower.Triangles > 0) && originaltextures.Contains(j.sidedef.LongLowTexture)) + j.sidedef.SetTextureLow(filltexture); + } + + j.sidedef.Marked = true; + + if(j.forward) + { + // Add sidedefs forward (connected to the right vertex) + Vertex v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start; + AddSidedefsForFloodfill(mode, todo, v, true, originaltextures); + + // Add sidedefs backward (connected to the left vertex) + v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End; + AddSidedefsForFloodfill(mode, todo, v, false, originaltextures); + } + else + { + // Add sidedefs backward (connected to the left vertex) + Vertex v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End; + AddSidedefsForFloodfill(mode, todo, v, false, originaltextures); + + // Add sidedefs forward (connected to the right vertex) + v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start; + AddSidedefsForFloodfill(mode, todo, v, true, originaltextures); + } + } + } + + // This adds the matching, unmarked sidedefs from a vertex for texture alignment + private static void AddSidedefsForFloodfill(BaseVisualMode mode, Stack<Tools.SidedefFillJob> stack, Vertex v, bool forward, HashSet<long> texturelongnames) + { + foreach(Linedef ld in v.Linedefs) + { + Sidedef side1 = (forward ? ld.Front : ld.Back); + Sidedef side2 = (forward ? ld.Back : ld.Front); + if((ld.Start == v) && (side1 != null) && !side1.Marked) + { + if(SidedefTextureMatch(mode, side1, texturelongnames)) + stack.Push(new Tools.SidedefFillJob { forward = forward, sidedef = side1 }); + } + else if((ld.End == v) && (side2 != null) && !side2.Marked) + { + if(SidedefTextureMatch(mode, side2, texturelongnames)) + stack.Push(new Tools.SidedefFillJob { forward = forward, sidedef = side2 }); + } + } + } + + #endregion + + #region ================== Texture Alignment + + //mxd. This checks if any of the sidedef texture match the given textures + public static bool SidedefTextureMatch(BaseVisualMode mode, Sidedef sd, HashSet<long> texturelongnames) + { + if(!mode.VisualSectorExists(sd.Sector)) return false; + VisualSidedefParts parts = ((BaseVisualSector)mode.GetVisualSector(sd.Sector)).GetSidedefParts(sd); + + return (texturelongnames.Contains(sd.LongHighTexture) && (parts.upper != null && parts.upper.Triangles > 0)) || + (texturelongnames.Contains(sd.LongLowTexture) && (parts.lower != null && parts.lower.Triangles > 0)) || + (texturelongnames.Contains(sd.LongMiddleTexture) + && ((parts.middledouble != null && parts.middledouble.Triangles > 0) || (parts.middlesingle != null && parts.middlesingle.Triangles > 0))); + } + + #endregion } } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index caade543cd313496e86156e6d4edcaff596d55eb..75897609e12078916c09b0f2be03c7f283f0a39e 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -597,20 +597,14 @@ namespace CodeImp.DoomBuilder.BuilderModes { Rectangle r = BuilderModesTools.GetSidedefPartSize(visualside); if(r.Width == 0 || r.Height == 0) return; - if((matchtexture && visualside.Texture == Texture && r.IntersectsWith(sourcerect)) || - (matchheight && sourcerect.Height == r.Height && sourcerect.Y == r.Y)) + if((!matchtexture || (visualside.Texture == Texture && r.IntersectsWith(sourcerect))) && + (!matchheight || (sourcerect.Height == r.Height && sourcerect.Y == r.Y))) { visualside.SelectNeighbours(select, matchtexture, matchheight); } } } - //mxd - public virtual bool IsSelected() - { - return selected; - } - //mxd protected void FitTexture(FitTextureOptions options) { @@ -1022,7 +1016,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Do the alignment - Tools.FloodfillTextures(Sidedef, texturehashes, newtexture, false); + BuilderModesTools.FloodfillTextures(mode, Sidedef, texturehashes, newtexture, false); // Get the changed sidedefs List<Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true); diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index 762ebf8fdd9e6536f85eed90e8700983b1cdb202..6a1837a01b38fd4008d6af15c153b923d5bd7d0d 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -618,7 +618,7 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(IVisualEventReceiver obj in selectedobjects) { - if(!obj.IsSelected()) continue; + if(!obj.Selected) continue; if(obj is BaseVisualThing) numThings++; else if(obj is BaseVisualVertex) numVerts++; @@ -1922,7 +1922,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { if(General.Interface.AltState) { - target.SelectNeighbours(target.IsSelected(), General.Interface.ShiftState, General.Interface.CtrlState); + target.SelectNeighbours(target.Selected, General.Interface.ShiftState, General.Interface.CtrlState); } else { @@ -1930,7 +1930,7 @@ namespace CodeImp.DoomBuilder.BuilderModes selectedobjects.CopyTo(selection); foreach(IVisualEventReceiver obj in selection) - obj.SelectNeighbours(target.IsSelected(), General.Interface.ShiftState, General.Interface.CtrlState); + obj.SelectNeighbours(target.Selected, General.Interface.ShiftState, General.Interface.CtrlState); } } @@ -3711,7 +3711,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Wrap the value within the width of the texture (to prevent ridiculous values) // NOTE: We don't use ScaledWidth here because the texture offset is in pixels, not mappixels - if(texture.IsImageLoaded && Tools.SidedefTextureMatch(j.sidedef, texturehashes)) + if(texture.IsImageLoaded && BuilderModesTools.SidedefTextureMatch(this, j.sidedef, texturehashes)) { if(alignx) j.sidedef.OffsetX %= texture.Width; if(aligny) j.sidedef.OffsetY %= texture.Height; @@ -3737,7 +3737,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Wrap the value within the width of the texture (to prevent ridiculous values) // NOTE: We don't use ScaledWidth here because the texture offset is in pixels, not mappixels - if(texture.IsImageLoaded && Tools.SidedefTextureMatch(j.sidedef, texturehashes)) + if(texture.IsImageLoaded && BuilderModesTools.SidedefTextureMatch(this, j.sidedef, texturehashes)) { if(alignx) j.sidedef.OffsetX %= texture.Width; if(aligny) j.sidedef.OffsetY %= texture.Height; @@ -3760,7 +3760,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // When resetsidemarks is set to true, all sidedefs will first be marked false (not aligned). // Setting resetsidemarks to false is usefull to align only within a specific selection // (set the marked property to true for the sidedefs outside the selection) - private void AutoAlignTexturesUDMF(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks, bool checkSelectedSidedefParts) + private void AutoAlignTexturesUDMF(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks, bool checkselectedsidedefparts) { // Mark all sidedefs false (they will be marked true when the texture is aligned) if(resetsidemarks) General.Map.Map.ClearMarkedSidedefs(false); @@ -3770,14 +3770,8 @@ namespace CodeImp.DoomBuilder.BuilderModes float scalex = (General.Map.Config.ScaledTextureOffsets && !texture.WorldPanning) ? texture.Scale.x : 1.0f; float scaley = (General.Map.Config.ScaledTextureOffsets && !texture.WorldPanning) ? texture.Scale.y : 1.0f; - SidedefAlignJob first = new SidedefAlignJob(); - first.sidedef = start.Sidedef; - first.offsetx = start.Sidedef.OffsetX; - - if(start.GeometryType == VisualGeometryType.WALL_MIDDLE_3D) - first.controlSide = start.GetControlLinedef().Front; - else - first.controlSide = start.Sidedef; + SidedefAlignJob first = new SidedefAlignJob { sidedef = start.Sidedef, offsetx = start.Sidedef.OffsetX }; + first.controlSide = (start.GeometryType == VisualGeometryType.WALL_MIDDLE_3D ? start.GetControlLinedef().Front : start.Sidedef); //mxd. We potentially need to deal with 2 textures (because of long and short texture names)... HashSet<long> texturehashes = new HashSet<long> { texture.LongName }; @@ -3799,7 +3793,7 @@ namespace CodeImp.DoomBuilder.BuilderModes //mxd List<BaseVisualGeometrySidedef> selectedVisualSides = new List<BaseVisualGeometrySidedef>(); - if(checkSelectedSidedefParts && !singleselection) + if(checkselectedsidedefparts && !singleselection) { foreach(IVisualEventReceiver i in selectedobjects) { @@ -3871,23 +3865,34 @@ namespace CodeImp.DoomBuilder.BuilderModes while(todo.Count > 0) { Vertex v; - float forwardoffset; - float backwardoffset; + float forwardoffset, backwardoffset; + bool matchtop = false; + bool matchmid = false; + bool matchbottom = false; // Get the align job to do SidedefAlignJob j = todo.Pop(); - bool matchtop = (!j.sidedef.Marked && (!singleselection || texturehashes.Contains(j.sidedef.LongHighTexture)) && j.sidedef.HighRequired()); - bool matchbottom = (!j.sidedef.Marked && (!singleselection || texturehashes.Contains(j.sidedef.LongLowTexture)) && j.sidedef.LowRequired()); - bool matchmid = ((!singleselection || texturehashes.Contains(j.controlSide.LongMiddleTexture)) && (j.controlSide.MiddleRequired() || j.controlSide.LongMiddleTexture != MapSet.EmptyLongName)); //mxd - - //mxd. If there's a selection, check if matched part is actually selected - if(checkSelectedSidedefParts && !singleselection) + //mxd. Get visual parts + if(VisualSectorExists(j.sidedef.Sector)) { - if(matchtop) matchtop = SidePartIsSelected(selectedVisualSides, j.sidedef, VisualGeometryType.WALL_UPPER); - if(matchbottom) matchbottom = SidePartIsSelected(selectedVisualSides, j.sidedef, VisualGeometryType.WALL_LOWER); - if(matchmid) matchmid = SidePartIsSelected(selectedVisualSides, j.sidedef, VisualGeometryType.WALL_MIDDLE) || - SidePartIsSelected(selectedVisualSides, j.sidedef, VisualGeometryType.WALL_MIDDLE_3D); + 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); + + matchtop = (!j.sidedef.Marked && (!singleselection || texturehashes.Contains(j.sidedef.LongHighTexture)) && (parts.upper != null && parts.upper.Triangles > 0)); + matchbottom = (!j.sidedef.Marked && (!singleselection || texturehashes.Contains(j.sidedef.LongLowTexture)) && (parts.lower != null && parts.lower.Triangles > 0)); + matchmid = ((!singleselection || texturehashes.Contains(j.controlSide.LongMiddleTexture)) + && ((controlparts.middledouble != null && controlparts.middledouble.Triangles > 0) || (controlparts.middlesingle != null && controlparts.middlesingle.Triangles > 0))); //mxd + + //mxd. If there's a selection, check if matched part is actually selected + if(checkselectedsidedefparts && !singleselection) + { + if(matchtop) matchtop = parts.upper.Selected; + if(matchbottom) matchbottom = parts.lower.Selected; + if(matchmid) matchmid = ((parts.middledouble != null && parts.middledouble.Selected) + || (parts.middlesingle != null && parts.middlesingle.Selected) + || SidePartIsSelected(selectedVisualSides, j.sidedef, VisualGeometryType.WALL_MIDDLE_3D)); + } } if(!matchbottom && !matchtop && !matchmid) continue; //mxd @@ -4129,7 +4134,7 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sidedef s in controlSides) { - if(!singleselection || Tools.SidedefTextureMatch(s, texturelongnames)) + if(!singleselection || BuilderModesTools.SidedefTextureMatch(this, s, texturelongnames)) { SidedefAlignJob nj = new SidedefAlignJob(); nj.forward = forward; @@ -4147,7 +4152,7 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sidedef s in controlSides) { - if(!singleselection || Tools.SidedefTextureMatch(s, texturelongnames)) + if(!singleselection || BuilderModesTools.SidedefTextureMatch(this, s, texturelongnames)) { SidedefAlignJob nj = new SidedefAlignJob(); nj.forward = forward; diff --git a/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs b/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs index 4582d5915910b1b5aa18a35258ae5c4a4ae64355..5fd6f8e121aca651c22b752b33144123a2d046c4 100644 --- a/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs +++ b/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs @@ -24,6 +24,9 @@ namespace CodeImp.DoomBuilder.BuilderModes { internal interface IVisualEventReceiver { + //mxd. Properties + bool Selected { get; } + // The events that must be handled void OnSelectBegin(); void OnSelectEnd(); @@ -60,6 +63,5 @@ namespace CodeImp.DoomBuilder.BuilderModes // Other methods string GetTextureName(); void SelectNeighbours(bool select, bool matchtexture, bool matchheight); //mxd - bool IsSelected(); //mxd } } diff --git a/Source/Plugins/BuilderModes/VisualModes/NullVisualEventReceiver.cs b/Source/Plugins/BuilderModes/VisualModes/NullVisualEventReceiver.cs index 32f8f54694c3c70ed2ed50a85f3e7d1763cf5c26..9778db71915267cfe74dc556d82a525238ae4dd0 100644 --- a/Source/Plugins/BuilderModes/VisualModes/NullVisualEventReceiver.cs +++ b/Source/Plugins/BuilderModes/VisualModes/NullVisualEventReceiver.cs @@ -25,6 +25,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // This doesn't do jack shit. internal class NullVisualEventReceiver : IVisualEventReceiver { + public bool Selected { get { return false; } } //mxd + public void OnSelectBegin() { } public void OnSelectEnd() { } public void OnEditBegin() { } @@ -56,6 +58,5 @@ namespace CodeImp.DoomBuilder.BuilderModes public void ApplyLowerUnpegged(bool set) { } public string GetTextureName() { return ""; } public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) { } //mxd - public bool IsSelected() { return false; } //mxd } } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs b/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs index 8d0bc95be91ad414cbbf1377f96066bdd98f5737..fc0135ff26fd1dee17315d6b802799fc3c320ef6 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs @@ -571,8 +571,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // 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) { - if((withSameTexture && side.Other.Sector.LongFloorTexture == level.sector.LongCeilTexture) || - (withSameHeight && side.Other.Sector.FloorHeight == level.sector.CeilHeight)) + if((!withSameTexture || side.Other.Sector.LongFloorTexture == level.sector.LongCeilTexture) && + (!withSameHeight || side.Other.Sector.FloorHeight == level.sector.CeilHeight)) { neighbours.Add(side.Other.Sector); @@ -584,8 +584,8 @@ namespace CodeImp.DoomBuilder.BuilderModes else // Regular ceiling or vavoom-type extra ceiling { // (De)select adjacent ceilings - if((withSameTexture && side.Other.Sector.LongCeilTexture == level.sector.LongCeilTexture) || - (withSameHeight && side.Other.Sector.CeilHeight == level.sector.CeilHeight)) + if((!withSameTexture || side.Other.Sector.LongCeilTexture == level.sector.LongCeilTexture) && + (!withSameHeight || side.Other.Sector.CeilHeight == level.sector.CeilHeight)) { neighbours.Add(side.Other.Sector); @@ -599,8 +599,8 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(VisualCeiling ec in vs.ExtraCeilings) { if(select == ec.Selected || ec.extrafloor.VavoomType != regularorvavoom) continue; - if((withSameTexture && level.sector.LongCeilTexture == ec.level.sector.LongCeilTexture) || - (withSameHeight && level.sector.CeilHeight == ec.level.sector.CeilHeight)) + if((!withSameTexture || level.sector.LongCeilTexture == ec.level.sector.LongCeilTexture) && + (!withSameHeight || level.sector.CeilHeight == ec.level.sector.CeilHeight)) { ec.SelectNeighbours(select, withSameTexture, withSameHeight); } @@ -610,8 +610,8 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(VisualFloor ef in vs.ExtraFloors) { if(select == ef.Selected || ef.ExtraFloor.VavoomType == regularorvavoom) continue; - if((withSameTexture && level.sector.LongCeilTexture == ef.Level.sector.LongFloorTexture) || - (withSameHeight && level.sector.CeilHeight == ef.Level.sector.FloorHeight)) + if((!withSameTexture || level.sector.LongCeilTexture == ef.Level.sector.LongFloorTexture) && + (!withSameHeight || level.sector.CeilHeight == ef.Level.sector.FloorHeight)) { ef.SelectNeighbours(select, withSameTexture, withSameHeight); } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs b/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs index 0f29b87d9813d13184dde4d81b13c27ada7b6c3e..8693c5f36c30cd5865eb211bb4f23bdd51330e04 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs @@ -514,8 +514,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // 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((withSameTexture && side.Other.Sector.LongCeilTexture == level.sector.LongFloorTexture) || - (withSameHeight && side.Other.Sector.CeilHeight == level.sector.FloorHeight)) + if((!withSameTexture || side.Other.Sector.LongCeilTexture == level.sector.LongFloorTexture) && + (!withSameHeight || side.Other.Sector.CeilHeight == level.sector.FloorHeight)) { neighbours.Add(side.Other.Sector); @@ -527,8 +527,8 @@ namespace CodeImp.DoomBuilder.BuilderModes else // Regular floor or vavoom-type extrafloor { // (De)select adjacent floor - if((withSameTexture && side.Other.Sector.LongFloorTexture == level.sector.LongFloorTexture) || - (withSameHeight && side.Other.Sector.FloorHeight == level.sector.FloorHeight)) + if((!withSameTexture || side.Other.Sector.LongFloorTexture == level.sector.LongFloorTexture) && + (!withSameHeight || side.Other.Sector.FloorHeight == level.sector.FloorHeight)) { neighbours.Add(side.Other.Sector); @@ -542,8 +542,8 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(VisualFloor ef in vs.ExtraFloors) { 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)) + if((!withSameTexture || level.sector.LongFloorTexture == ef.level.sector.LongFloorTexture) && + (!withSameHeight || level.sector.FloorHeight == ef.level.sector.FloorHeight)) { ef.SelectNeighbours(select, withSameTexture, withSameHeight); } @@ -553,8 +553,8 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(VisualCeiling ec in vs.ExtraCeilings) { if(select == ec.Selected || ec.ExtraFloor.VavoomType == regularorvavoom) continue; - if((withSameTexture && level.sector.LongFloorTexture == ec.Level.sector.LongCeilTexture) || - (withSameHeight && level.sector.FloorHeight == ec.Level.sector.CeilHeight)) + if((!withSameTexture || level.sector.LongFloorTexture == ec.Level.sector.LongCeilTexture) && + (!withSameHeight || level.sector.FloorHeight == ec.Level.sector.CeilHeight)) { ec.SelectNeighbours(select, withSameTexture, withSameHeight); } @@ -589,8 +589,9 @@ namespace CodeImp.DoomBuilder.BuilderModes slopeSource = side.Line; isFront = true; break; - } - else if(side.Line.Args[0] == 2 && side.Line.Back != null && side.Line.Back == side) + } + + if(side.Line.Args[0] == 2 && side.Line.Back != null && side.Line.Back == side) { slopeSource = side.Line; break;