diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index 19141022..7e1deaa9 100644 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -2359,7 +2359,7 @@ namespace CodeImp.DoomBuilder.Data #region ================== mxd. Skybox Making - private void SetupSkybox() + internal void SetupSkybox() { // Get rid of old texture if(skybox != null) skybox.Dispose(); skybox = null; @@ -2526,6 +2526,9 @@ namespace CodeImp.DoomBuilder.Data else if(img.Height < 241) yscale = 1.0f + ((img.Height - 200.0f) / 200.0f) * 1.17f; else yscale = 1.2f * 1.17f; + // I guess my sky model doesn't exactly match the one GZDoom generates... + yscale *= 1.65f; + // Make cubemap texture CubeTexture cubemap = new CubeTexture(device, cubemaptexsize, 1, Usage.None, Format.A8R8G8B8, Pool.Managed); Surface sysmemsurf = Surface.CreateOffscreenPlain(device, cubemaptexsize, cubemaptexsize, Format.A8R8G8B8, Pool.SystemMemory); diff --git a/Source/Core/General/General.cs b/Source/Core/General/General.cs index 9599e32f..87ca2afd 100644 --- a/Source/Core/General/General.cs +++ b/Source/Core/General/General.cs @@ -595,12 +595,10 @@ namespace CodeImp.DoomBuilder // Remove the previous log file and start logging if(File.Exists(logfile)) File.Delete(logfile); General.WriteLogLine("GZDoom Builder R" + thisasm.GetName().Version.Revision + " startup"); //mxd - General.WriteLogLine("Application path: " + apppath); - General.WriteLogLine("Temporary path: " + temppath); - General.WriteLogLine("Local settings path: " + settingspath); - General.WriteLogLine("Command-line arguments: " + args.Length); - for(int i = 0; i < args.Length; i++) - General.WriteLogLine("Argument " + i + ": \"" + args[i] + "\""); + General.WriteLogLine("Application path: \"" + apppath + "\""); + General.WriteLogLine("Temporary path: \"" + temppath + "\""); + General.WriteLogLine("Local settings path: \"" + settingspath + "\""); + General.WriteLogLine("Command-line arguments: \"" + string.Join(" ", args) + "\""); //mxd // Load configuration General.WriteLogLine("Loading program configuration..."); diff --git a/Source/Core/General/MapManager.cs b/Source/Core/General/MapManager.cs index 5eedbd40..994019f9 100644 --- a/Source/Core/General/MapManager.cs +++ b/Source/Core/General/MapManager.cs @@ -470,7 +470,7 @@ namespace CodeImp.DoomBuilder #endif this.changed = false; - this.maploading = true; //mxd + this.maploading = true; this.options = options; // Create map data @@ -512,27 +512,30 @@ namespace CodeImp.DoomBuilder // Close the map file mapwad.Dispose(); - //mxd. Create MapSet + // Create MapSet bool maprestored; if(!CreateMapSet(newmap, filepathname, options, out maprestored)) return false; - //mxd. And switch to it + // And switch to it ChangeMapSet(newmap); - //mxd. Translate texture names + // Translate texture names map.TranslateTextureNames(config.UseLongTextureNames, false); grid.TranslateBackgroundName(config.UseLongTextureNames); - //mxd. Sector textures may've been changed + // Sector textures may've been changed data.UpdateUsedTextures(); - //mxd. Update includes list and script names + // Skybox may've been changed + data.SetupSkybox(); + + // Update includes list and script names UpdateScriptNames(true); - //mxd. Restore selection groups + // Restore selection groups options.ReadSelectionGroups(); - //mxd. Center map in screen or on stored coordinates + // Center map in screen or on stored coordinates if(General.Editing.Mode is ClassicMode) { ClassicMode mode = General.Editing.Mode as ClassicMode; @@ -546,9 +549,9 @@ namespace CodeImp.DoomBuilder // Success this.changed = maprestored; - this.maploading = false; //mxd + this.maploading = false; General.WriteLogLine("Map switching done"); - General.MainWindow.UpdateMapChangedStatus(); //mxd + General.MainWindow.UpdateMapChangedStatus(); return true; } diff --git a/Source/Core/IO/ClipboardStreamReader.cs b/Source/Core/IO/ClipboardStreamReader.cs index 2583a8ee..b507f7ff 100644 --- a/Source/Core/IO/ClipboardStreamReader.cs +++ b/Source/Core/IO/ClipboardStreamReader.cs @@ -333,7 +333,7 @@ namespace CodeImp.DoomBuilder.IO //flags Dictionary stringflags = new Dictionary(StringComparer.Ordinal); int numFlags = reader.ReadInt32(); - for(int f = 0; f < numFlags; f++) stringflags.Add(ReadString(reader), true); + for(int f = 0; f < numFlags; f++) stringflags.Add(ReadString(reader), reader.ReadBoolean()); //add missing flags foreach(KeyValuePair flag in General.Map.Config.ThingFlags) diff --git a/Source/Core/IO/ClipboardStreamWriter.cs b/Source/Core/IO/ClipboardStreamWriter.cs index d050639b..fce1e538 100644 --- a/Source/Core/IO/ClipboardStreamWriter.cs +++ b/Source/Core/IO/ClipboardStreamWriter.cs @@ -298,22 +298,15 @@ namespace CodeImp.DoomBuilder.IO } } - private static void AddFlags(Dictionary elementFlags, BinaryWriter writer) + private static void AddFlags(Dictionary flags, BinaryWriter writer) { - List flags = new List(); - - foreach(KeyValuePair f in elementFlags) - { - if(!f.Value) continue; - flags.Add(f.Key); - } - writer.Write(flags.Count); - foreach(string s in flags) + foreach(KeyValuePair group in flags) { - writer.Write(s.Length); - writer.Write(s.ToCharArray()); + writer.Write(group.Key.Length); + writer.Write(group.Key.ToCharArray()); + writer.Write(group.Value); } } diff --git a/Source/Core/Resources/SkySphere.md3 b/Source/Core/Resources/SkySphere.md3 index 753932b1..b0ad8cff 100644 Binary files a/Source/Core/Resources/SkySphere.md3 and b/Source/Core/Resources/SkySphere.md3 differ diff --git a/Source/Core/VisualModes/VisualMode.cs b/Source/Core/VisualModes/VisualMode.cs index 40fa7711..731aa1a2 100644 --- a/Source/Core/VisualModes/VisualMode.cs +++ b/Source/Core/VisualModes/VisualMode.cs @@ -188,20 +188,12 @@ namespace CodeImp.DoomBuilder.VisualModes if(nearestsector != null) { int sectorheight = nearestsector.CeilHeight - nearestsector.FloorHeight; - if(General.Map.VisualCamera.Position.z < nearestsector.FloorHeight + 41) - { - if(sectorheight < 41) - posz = nearestsector.FloorHeight + sectorheight / 2; - else - posz = nearestsector.FloorHeight + 41; // same as in doom - } + if(sectorheight < 41) + posz = nearestsector.FloorHeight + Math.Max(16, sectorheight / 2); + else if(General.Map.VisualCamera.Position.z < nearestsector.FloorHeight + 41) + posz = nearestsector.FloorHeight + 41; // same as in doom else if(General.Map.VisualCamera.Position.z > nearestsector.CeilHeight) - { - if(sectorheight < 41) - posz = nearestsector.FloorHeight + sectorheight / 2; - else - posz = nearestsector.CeilHeight - 4; - } + posz = nearestsector.CeilHeight - 4; } General.Map.VisualCamera.Position = new Vector3D(initialcameraposition.x, initialcameraposition.y, posz); diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index 355b4b91..e94e3286 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -495,7 +495,7 @@ namespace CodeImp.DoomBuilder.Windows // Window is first shown private void MainForm_Shown(object sender, EventArgs e) { - // Perform auto mapo loading action when the window is not delayed + // Perform auto map loading action when the window is not delayed if(!General.DelayMainWindow) PerformAutoMapLoading(); } @@ -532,9 +532,9 @@ namespace CodeImp.DoomBuilder.Windows } else { - //TODO: test this! - Configuration gamecfg = new Configuration(configfile); - longtexturenamessupported = gamecfg.ReadSetting("longtexturenames", false); + // Get if long texture names are supported from the game configuration + ConfigurationInfo configinfo = General.GetConfigurationInfo(configfile); + longtexturenamessupported = configinfo.Configuration.ReadSetting("longtexturenames", false); } // Set map name and other options diff --git a/Source/Plugins/BuilderModes/BuilderModes.csproj b/Source/Plugins/BuilderModes/BuilderModes.csproj index 44598956..47bb113b 100644 --- a/Source/Plugins/BuilderModes/BuilderModes.csproj +++ b/Source/Plugins/BuilderModes/BuilderModes.csproj @@ -280,8 +280,10 @@ + + diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingFlat.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingFlat.cs new file mode 100644 index 00000000..dc2e5ca4 --- /dev/null +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingFlat.cs @@ -0,0 +1,64 @@ +#region ================== Namespaces + +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Windows.Forms; +using CodeImp.DoomBuilder.Config; +using CodeImp.DoomBuilder.Map; + +#endregion + +namespace CodeImp.DoomBuilder.BuilderModes +{ + [FindReplace("Sector Ceiling Flat", BrowseButton = true)] + internal class FindSectorCeilingFlat : FindSectorFlat + { + #region ================== Methods + + // This is called to perform a search (and replace) + // Returns a list of items to show in the results list + // replacewith is null when not replacing + public override FindReplaceObject[] Find(string value, bool withinselection, bool replace, string replacewith, bool keepselection) + { + List objs = new List(); + + // Interpret the replacement + if(replace && (string.IsNullOrEmpty(replacewith) || replacewith.Length > General.Map.Config.MaxTextureNameLength)) + { + MessageBox.Show("Invalid replace value for this search type!", "Find and Replace", MessageBoxButtons.OK, MessageBoxIcon.Error); + return objs.ToArray(); + } + + // Interpret the find + bool isregex = (value.IndexOf('*') != -1 || value.IndexOf('?') != -1); //mxd + MatchingTextureSet set = new MatchingTextureSet(new Collection { value.Trim() }); //mxd + + // Where to search? + ICollection list = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors; + + // Go for all sectors + foreach(Sector s in list) + { + // Ceiling flat matches? + if(set.IsMatch(s.CeilTexture)) + { + // Replace and add to list + if(replace) s.SetCeilTexture(replacewith); + objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (ceiling)" + (isregex ? " - " + s.CeilTexture : null))); + } + } + + // When replacing, make sure we keep track of used textures + if(replace) + { + General.Map.Data.UpdateUsedTextures(); + General.Map.Map.Update(); //mxd. And don't forget to update the view itself + General.Map.IsChanged = true; + } + + return objs.ToArray(); + } + + #endregion + } +} diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorFlat.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorFlat.cs new file mode 100644 index 00000000..07817d04 --- /dev/null +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorFlat.cs @@ -0,0 +1,64 @@ +#region ================== Namespaces + +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Windows.Forms; +using CodeImp.DoomBuilder.Config; +using CodeImp.DoomBuilder.Map; + +#endregion + +namespace CodeImp.DoomBuilder.BuilderModes +{ + [FindReplace("Sector Floor Flat", BrowseButton = true)] + internal class FindSectorFloorFlat : FindSectorFlat + { + #region ================== Methods + + // This is called to perform a search (and replace) + // Returns a list of items to show in the results list + // replacewith is null when not replacing + public override FindReplaceObject[] Find(string value, bool withinselection, bool replace, string replacewith, bool keepselection) + { + List objs = new List(); + + // Interpret the replacement + if(replace && (string.IsNullOrEmpty(replacewith) || replacewith.Length > General.Map.Config.MaxTextureNameLength)) + { + MessageBox.Show("Invalid replace value for this search type!", "Find and Replace", MessageBoxButtons.OK, MessageBoxIcon.Error); + return objs.ToArray(); + } + + // Interpret the find + bool isregex = (value.IndexOf('*') != -1 || value.IndexOf('?') != -1); //mxd + MatchingTextureSet set = new MatchingTextureSet(new Collection { value.Trim() }); //mxd + + // Where to search? + ICollection list = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors; + + // Go for all sectors + foreach(Sector s in list) + { + // Floor flat matches? + if(set.IsMatch(s.FloorTexture)) + { + // Replace and add to list + if(replace) s.SetFloorTexture(replacewith); + objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (floor)" + (isregex ? " - " + s.FloorTexture : null))); + } + } + + // When replacing, make sure we keep track of used textures + if(replace) + { + General.Map.Data.UpdateUsedTextures(); + General.Map.Map.Update(); //mxd. And don't forget to update the view itself + General.Map.IsChanged = true; + } + + return objs.ToArray(); + } + + #endregion + } +} diff --git a/Source/Plugins/BuilderModes/General/BuilderModesTools.cs b/Source/Plugins/BuilderModes/General/BuilderModesTools.cs index 600c11f4..c6f370aa 100644 --- a/Source/Plugins/BuilderModes/General/BuilderModesTools.cs +++ b/Source/Plugins/BuilderModes/General/BuilderModesTools.cs @@ -6,6 +6,7 @@ using System.Drawing; using CodeImp.DoomBuilder.Config; using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Map; +using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.VisualModes; using CodeImp.DoomBuilder.Windows; @@ -113,37 +114,19 @@ namespace CodeImp.DoomBuilder.BuilderModes { #region ================== Sidedef - internal static Rectangle GetSidedefPartSize(BaseVisualGeometrySidedef side) + internal static Rectangle GetSidedefPartSize(BaseVisualGeometrySidedef side) { - if(side.GeometryType == VisualGeometryType.WALL_MIDDLE_3D) - { - Rectangle rect = new Rectangle(0, 0, Math.Max(1, (int)Math.Round(side.Sidedef.Line.Length)), 0); - Linedef cl = side.GetControlLinedef(); - - if(cl.Front != null && cl.Front.Sector != null) - { - // Use floor height for vavoom-type 3d floors, because FloorHeight should be > CeilHeight for this type of 3d floor. - if(cl.Args[1] == 0) - { - rect.Y = -cl.Front.Sector.FloorHeight; - rect.Height = cl.Front.Sector.FloorHeight - cl.Front.Sector.CeilHeight; - } - else - { - rect.Y = -cl.Front.Sector.CeilHeight; - rect.Height = cl.Front.GetMiddleHeight(); - } - } - else - { - rect.Y = -side.Sidedef.Sector.CeilHeight; - rect.Height = side.Sidedef.GetMiddleHeight(); - } + // We are interested in width, height and vertical position only + float miny = float.MaxValue; + float maxy = float.MinValue; - return rect; + foreach(WorldVertex v in side.Vertices) + { + if(v.z < miny) miny = v.z; + else if(v.z > maxy) maxy = v.z; } - return GetSidedefPartSize(side.Sidedef, side.GeometryType); + return new Rectangle(0, (int)Math.Round(-maxy), Math.Max(1, (int)Math.Round(side.Sidedef.Line.Length)), (int)Math.Round(maxy - miny)); } public static Rectangle GetSidedefPartSize(Sidedef side, VisualGeometryType type) diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index a913a359..96b453e8 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -526,9 +526,9 @@ namespace CodeImp.DoomBuilder.BuilderModes } //mxd - protected void SelectNeighbours(long longtexture, bool select, bool withSameTexture, bool withSameHeight) + public void SelectNeighbours(bool select, bool matchtexture, bool matchheight) { - if(Sidedef.Sector == null || Triangles < 1 || (!withSameTexture && !withSameHeight)) return; + if(Sidedef.Sector == null || Triangles < 1 || (!matchtexture && !matchheight)) return; Rectangle rect = BuilderModesTools.GetSidedefPartSize(this); if(rect.Height == 0) return; @@ -544,169 +544,57 @@ namespace CodeImp.DoomBuilder.BuilderModes mode.RemoveSelectedObject(this); } - //select - List connectedLines = new List(); + // Select + SelectNeighbourLines(Sidedef.Line.Start.Linedefs, rect, select, matchtexture, matchheight); + SelectNeighbourLines(Sidedef.Line.End.Linedefs, rect, select, matchtexture, matchheight); + } - foreach(Linedef line in Sidedef.Line.Start.Linedefs) + //mxd + private void SelectNeighbourLines(IEnumerable lines, Rectangle sourcerect, bool select, bool matchtexture, bool matchheight) + { + foreach(Linedef line in lines) { if(line.Index == Sidedef.Line.Index) continue; - connectedLines.Add(line); + + if(line.Front != null && line.Front.Sector != null) + SelectNeighbourSideParts(line.Front, sourcerect, select, matchtexture, matchheight); + + if(line.Back != null && line.Back.Sector != null) + SelectNeighbourSideParts(line.Back, sourcerect, select, matchtexture, matchheight); } - foreach(Linedef line in Sidedef.Line.End.Linedefs) + } + + //mxd + private void SelectNeighbourSideParts(Sidedef side, Rectangle sourcerect, bool select, bool matchtexture, bool matchheight) + { + BaseVisualSector s = mode.GetVisualSector(side.Sector) as BaseVisualSector; + if(s != null) { - if(line.Index == Sidedef.Line.Index) continue; - if(!connectedLines.Contains(line)) connectedLines.Add(line); + VisualSidedefParts parts = s.GetSidedefParts(side); + SelectNeighbourSidePart(parts.lower, sourcerect, select, matchtexture, matchheight); + SelectNeighbourSidePart(parts.middlesingle, sourcerect, select, matchtexture, matchheight); + SelectNeighbourSidePart(parts.middledouble, sourcerect, select, matchtexture, matchheight); + SelectNeighbourSidePart(parts.upper, sourcerect, select, matchtexture, matchheight); + + if(parts.middle3d != null) + { + foreach(VisualMiddle3D middle3D in parts.middle3d) + SelectNeighbourSidePart(middle3D, sourcerect, select, matchtexture, matchheight); + } } + } - // Check connected lines - foreach(Linedef line in connectedLines) + //mxd + private void SelectNeighbourSidePart(BaseVisualGeometrySidedef visualside, Rectangle sourcerect, bool select, bool matchtexture, bool matchheight) + { + if(visualside != null && visualside.Triangles > 0 && visualside.Selected != select) { - bool addFrontTop = false; - bool addFrontMiddle = false; - bool addFrontBottom = false; - bool addBackTop = false; - bool addBackMiddle = false; - bool addBackBottom = false; - - bool lineHasFrontSector = (line.Front != null && line.Front.Sector != null); - bool lineHasBackSector = (line.Back != null && line.Back.Sector != null); - bool doublesided = (lineHasFrontSector && lineHasBackSector); - - List extrasides = new List(); - - // Gather 3d floor sides - if(doublesided) + 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)) { - BaseVisualSector s = mode.GetVisualSector(line.Front.Sector) as BaseVisualSector; - 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()); - } - - // Add regular sides - if(withSameTexture) - { - if(line.Front != null) - { - addFrontTop = (line.Front.LongHighTexture == longtexture - && line.Front.HighRequired() - && BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_UPPER).IntersectsWith(rect)); - - 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.LongLowTexture == longtexture - && line.Front.LowRequired() - && BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_LOWER).IntersectsWith(rect)); - - } - - if(line.Back != null) - { - addBackTop = (line.Back.LongHighTexture == longtexture - && line.Back.HighRequired() - && BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_UPPER).IntersectsWith(rect)); - - 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.LongLowTexture == longtexture - && line.Back.LowRequired() - && BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_LOWER).IntersectsWith(rect)); - } - - // Add 3d floor sides - List filtered = new List(); - foreach(VisualMiddle3D side3d in extrasides) - { - Sidedef controlside = side3d.GetControlLinedef().Front; - if(controlside.LongMiddleTexture == longtexture && BuilderModesTools.GetSidedefPartSize(controlside, VisualGeometryType.WALL_MIDDLE).IntersectsWith(rect)) - { - filtered.Add(side3d); - } - } - - extrasides = filtered; - } - - if(withSameHeight && rect.Height > 0) - { - // Upper parts match? - if((!withSameTexture || addFrontTop) && doublesided && line.Front.HighRequired()) - { - Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_UPPER); - addFrontTop = (rect.Height == r.Height && rect.Y == r.Y); - } - - if((!withSameTexture || addBackTop) && doublesided && line.Back.HighRequired()) - { - Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_UPPER); - addBackTop = (rect.Height == r.Height && rect.Y == r.Y); - } - - // Middle parts match? - if((!withSameTexture || addFrontMiddle) - && lineHasFrontSector - && (line.Front.MiddleRequired() || line.Front.LongMiddleTexture != MapSet.EmptyLongName) ) - { - Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_MIDDLE); - addFrontMiddle = (rect.Height == r.Height && rect.Y == r.Y); - } - - if((!withSameTexture || addBackMiddle) - && lineHasBackSector - && (line.Back.MiddleRequired() || line.Back.LongMiddleTexture != MapSet.EmptyLongName)) - { - Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_MIDDLE); - addBackMiddle = (rect.Height == r.Height && rect.Y == r.Y); - } - - // Lower parts match? - if((!withSameTexture || addFrontBottom) && doublesided && line.Front.LowRequired()) - { - Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_LOWER); - addFrontBottom = (rect.Height == r.Height && rect.Y == r.Y); - } - - if((!withSameTexture || addBackBottom) && doublesided && line.Back.LowRequired()) - { - Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_LOWER); - addBackBottom = (rect.Height == r.Height && rect.Y == r.Y); - } - - // 3d floor parts match? - List filtered = new List(); - foreach(VisualMiddle3D side3d in extrasides) - { - Sidedef controlside = side3d.GetControlLinedef().Front; - Rectangle r = BuilderModesTools.GetSidedefPartSize(controlside, VisualGeometryType.WALL_MIDDLE); - if(rect.Height == r.Height && rect.Y == r.Y) - { - filtered.Add(side3d); - } - } - - extrasides = filtered; - } - - // Select front? - if(addFrontTop || addFrontMiddle || addFrontBottom) - mode.SelectSideParts(line.Front, addFrontTop, addFrontMiddle, addFrontBottom, select, withSameTexture, withSameHeight); - - // Select back? - if(addBackTop || addBackMiddle || addBackBottom) - mode.SelectSideParts(line.Back, addBackTop, addBackMiddle, addBackBottom, select, withSameTexture, withSameHeight); - - // Select 3d floor sides? - foreach(VisualMiddle3D side3d in extrasides) - { - if( (select && !side3d.Selected) || (!select && side3d.Selected) ) - side3d.SelectNeighbours(select, withSameTexture, withSameHeight); + visualside.SelectNeighbours(select, matchtexture, matchheight); } } } @@ -839,7 +727,6 @@ namespace CodeImp.DoomBuilder.BuilderModes protected virtual void ResetTextureScale() { } //mxd protected abstract void MoveTextureOffset(Point xy); protected abstract Point GetTextureOffset(); - public virtual void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) { } //mxd public virtual void OnTextureFit(FitTextureOptions options) { } //mxd // Insert middle texture diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index 4e020853..e6ebb9d5 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -608,36 +608,6 @@ namespace CodeImp.DoomBuilder.BuilderModes return translatedCoords; } - //mxd - internal void SelectSideParts(Sidedef side, bool toggleTop, bool toggleMid, bool toggleBottom, bool select, bool withSameTexture, bool withSameHeight) - { - BaseVisualSector vs = GetVisualSector(side.Sector) as BaseVisualSector; - - if(toggleTop && vs.Sides[side].upper != null && - ((select && !vs.Sides[side].upper.Selected) || (!select && vs.Sides[side].upper.Selected))) - { - vs.Sides[side].upper.SelectNeighbours(select, withSameTexture, withSameHeight); - } - - if(toggleMid && vs.Sides[side].middlesingle != null && - ((select && !vs.Sides[side].middlesingle.Selected) || (!select && vs.Sides[side].middlesingle.Selected))) - { - vs.Sides[side].middlesingle.SelectNeighbours(select, withSameTexture, withSameHeight); - } - - if(toggleMid && vs.Sides[side].middledouble != null && - ((select && !vs.Sides[side].middledouble.Selected) || (!select && vs.Sides[side].middledouble.Selected))) - { - vs.Sides[side].middledouble.SelectNeighbours(select, withSameTexture, withSameHeight); - } - - if(toggleBottom && vs.Sides[side].lower != null && - ((select && !vs.Sides[side].lower.Selected) || (!select && vs.Sides[side].lower.Selected))) - { - vs.Sides[side].lower.SelectNeighbours(select, withSameTexture, withSameHeight); - } - } - //mxd public override void UpdateSelectionInfo() { diff --git a/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs b/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs index 59b3559f..c7e4467e 100644 --- a/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs +++ b/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs @@ -59,7 +59,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Other methods string GetTextureName(); - void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight); //mxd + void SelectNeighbours(bool select, bool matchtexture, bool matchheight); //mxd bool IsSelected(); //mxd } } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs index ddbab1b8..36fb079c 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs @@ -275,12 +275,6 @@ namespace CodeImp.DoomBuilder.BuilderModes FitTexture(options); Setup(); } - - //mxd - public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) - { - SelectNeighbours(Sidedef.LongLowTexture, select, withSameTexture, withSameHeight); - } #endregion } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs index 5114abae..46644ec1 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs @@ -387,12 +387,6 @@ namespace CodeImp.DoomBuilder.BuilderModes return extrafloor.Linedef; } - //mxd - public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) - { - SelectNeighbours(extrafloor.Linedef.Front.LongMiddleTexture, select, withSameTexture, withSameHeight); - } - //mxd public override void OnTextureFit(FitTextureOptions options) { diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs index 48c4066d..02ff611f 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs @@ -375,12 +375,6 @@ namespace CodeImp.DoomBuilder.BuilderModes FitTexture(options); Setup(); } - - //mxd - public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) - { - SelectNeighbours(Sidedef.LongMiddleTexture, select, withSameTexture, withSameHeight); - } #endregion } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs index bf974713..e0d8c9b2 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs @@ -275,12 +275,6 @@ namespace CodeImp.DoomBuilder.BuilderModes FitTexture(options); Setup(); } - - //mxd - public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) - { - SelectNeighbours(Sidedef.LongMiddleTexture, select, withSameTexture, withSameHeight); - } #endregion } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs index a131dc5c..cf665df4 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs @@ -277,12 +277,6 @@ namespace CodeImp.DoomBuilder.BuilderModes FitTexture(options); Setup(); } - - //mxd - public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) - { - SelectNeighbours(Sidedef.LongHighTexture, select, withSameTexture, withSameHeight); - } #endregion }