diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj index 49840a23..997c286f 100644 --- a/Source/Core/Builder.csproj +++ b/Source/Core/Builder.csproj @@ -949,6 +949,7 @@ + diff --git a/Source/Core/Controls/FlatSelectorControl.cs b/Source/Core/Controls/FlatSelectorControl.cs index 929a394c..1f07de17 100644 --- a/Source/Core/Controls/FlatSelectorControl.cs +++ b/Source/Core/Controls/FlatSelectorControl.cs @@ -41,10 +41,17 @@ namespace CodeImp.DoomBuilder.Controls timer.Stop(); //mxd // Check if name is a "none" texture - if((imagename.Length < 1) || (imagename == "-")) + if(string.IsNullOrEmpty(imagename)) { DisplayImageSize(0, 0); //mxd + //mxd. Flat required? + return multipletextures ? Properties.Resources.ImageStack : Properties.Resources.MissingTexture; + } + else if(imagename == "-") //mxd + { + DisplayImageSize(0, 0); + // Flat required! return Properties.Resources.MissingTexture; } diff --git a/Source/Core/Controls/ImageBrowserControl.cs b/Source/Core/Controls/ImageBrowserControl.cs index ec5d2da3..9d87ccf8 100644 --- a/Source/Core/Controls/ImageBrowserControl.cs +++ b/Source/Core/Controls/ImageBrowserControl.cs @@ -519,7 +519,7 @@ namespace CodeImp.DoomBuilder.Controls } //mxd. This validates an item's texture size - private bool ValidateItemSize(ImageBrowserItem i, int w, int h) { + private static bool ValidateItemSize(ImageBrowserItem i, int w, int h) { if (!i.icon.IsPreviewLoaded) return true; if (w > 0 && i.icon.Width != w) return false; if (h > 0 && i.icon.Height != h) return false; diff --git a/Source/Core/Controls/ImageBrowserItem.cs b/Source/Core/Controls/ImageBrowserItem.cs index a6b02c59..73c17a75 100644 --- a/Source/Core/Controls/ImageBrowserItem.cs +++ b/Source/Core/Controls/ImageBrowserItem.cs @@ -138,7 +138,7 @@ namespace CodeImp.DoomBuilder.Controls } // This clamps a value between 0 and 1 - private float Saturate(float v) + private static float Saturate(float v) { if(v < 0f) return 0f; else if(v > 1f) return 1f; else return v; } diff --git a/Source/Core/Controls/ImageSelectorControl.cs b/Source/Core/Controls/ImageSelectorControl.cs index 9dd5e6c3..45d964eb 100644 --- a/Source/Core/Controls/ImageSelectorControl.cs +++ b/Source/Core/Controls/ImageSelectorControl.cs @@ -38,12 +38,14 @@ namespace CodeImp.DoomBuilder.Controls private bool ismouseinside; private MouseButtons button; private string previousImageName; //mxd + protected bool multipletextures; //mxd #endregion #region ================== Properties public string TextureName { get { return name.Text; } set { name.Text = value; } } + public bool MultipleTextures { get { return multipletextures; } set { multipletextures = value; } } #endregion @@ -241,7 +243,7 @@ namespace CodeImp.DoomBuilder.Controls } // This clamps a value between 0 and 1 - private float Saturate(float v) + private static float Saturate(float v) { if(v < 0f) return 0f; if(v > 1f) return 1f; diff --git a/Source/Core/Controls/SectorInfoPanel.cs b/Source/Core/Controls/SectorInfoPanel.cs index 841cf0a1..6e7b67f7 100644 --- a/Source/Core/Controls/SectorInfoPanel.cs +++ b/Source/Core/Controls/SectorInfoPanel.cs @@ -66,7 +66,7 @@ namespace CodeImp.DoomBuilder.Controls ceilingname.Text = s.CeilTexture; //mxd. Texture info - if ((s.FloorTexture.Length < 1) || (s.FloorTexture == "-")){ + if (s.LongFloorTexture == MapSet.EmptyLongName){ labelFloorTextureSize.Visible = false; General.DisplayZoomedImage(floortex, Properties.Resources.MissingTexture); } else { @@ -75,7 +75,7 @@ namespace CodeImp.DoomBuilder.Controls General.DisplayZoomedImage(floortex, floorImage.GetPreview()); } - if((s.CeilTexture.Length < 1) || (s.CeilTexture == "-")) { + if (s.LongCeilTexture == MapSet.EmptyLongName) { labelCeilTextureSize.Visible = false; General.DisplayZoomedImage(ceilingtex, Properties.Resources.MissingTexture); } else { diff --git a/Source/Core/Controls/TextureSelectorControl.cs b/Source/Core/Controls/TextureSelectorControl.cs index 9a252123..ae4a0ed1 100644 --- a/Source/Core/Controls/TextureSelectorControl.cs +++ b/Source/Core/Controls/TextureSelectorControl.cs @@ -47,9 +47,17 @@ namespace CodeImp.DoomBuilder.Controls timer.Stop(); //mxd // Check if name is a "none" texture - if((imagename.Length < 1) || (imagename == "-")) { + if(string.IsNullOrEmpty(imagename)) { DisplayImageSize(0, 0); //mxd + //mxd. Determine image to show + if (multipletextures) return Properties.Resources.ImageStack; + return (required ? Properties.Resources.MissingTexture : null); + } + else if(imagename == "-") //mxd + { + DisplayImageSize(0, 0); + // Determine image to show return (required ? Properties.Resources.MissingTexture : null); } diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index 869968d3..cad19e15 100644 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -1690,9 +1690,9 @@ namespace CodeImp.DoomBuilder.Data foreach(Sidedef sd in General.Map.Map.Sidedefs) { // Add used textures to dictionary - if(sd.HighTexture.Length > 0) usedimages[sd.LongHighTexture] = 0; - if(sd.LowTexture.Length > 0) usedimages[sd.LongMiddleTexture] = 0; - if(sd.MiddleTexture.Length > 0) usedimages[sd.LongLowTexture] = 0; + if(sd.LongHighTexture != MapSet.EmptyLongName) usedimages[sd.LongHighTexture] = 0; + if(sd.LongMiddleTexture != MapSet.EmptyLongName) usedimages[sd.LongMiddleTexture] = 0; + if(sd.LongLowTexture != MapSet.EmptyLongName) usedimages[sd.LongLowTexture] = 0; } // Go through the map to find the used flats diff --git a/Source/Core/Data/HighResImage.cs b/Source/Core/Data/HighResImage.cs index 6e3e13cf..4083fde8 100644 --- a/Source/Core/Data/HighResImage.cs +++ b/Source/Core/Data/HighResImage.cs @@ -34,13 +34,14 @@ namespace CodeImp.DoomBuilder.Data private List patches; private bool gotFullName;//mxd + private string type; #endregion #region ================== Constructor / Disposer // Constructor - public HighResImage(string name, int width, int height, float scalex, float scaley, bool worldpanning) + public HighResImage(string name, string type, int width, int height, float scalex, float scaley, bool worldpanning) { // Initialize this.width = width; @@ -49,6 +50,7 @@ namespace CodeImp.DoomBuilder.Data this.scale.y = scaley; this.worldpanning = worldpanning; this.patches = new List(); + this.type = type; SetName(name); // We have no destructor @@ -112,7 +114,15 @@ namespace CodeImp.DoomBuilder.Data foreach(TexturePatch p in patches) { // Get the patch data stream - Stream patchdata = General.Map.Data.GetPatchData(p.lumpname); + Stream patchdata; + + //mxd + if (type == "sprite") { + patchdata = General.Map.Data.GetSpriteData(p.lumpname); + } else { + patchdata = General.Map.Data.GetPatchData(p.lumpname); + } + if(patchdata != null) { // Copy patch data to memory diff --git a/Source/Core/Data/PK3StructuredReader.cs b/Source/Core/Data/PK3StructuredReader.cs index 26cba059..4979476a 100644 --- a/Source/Core/Data/PK3StructuredReader.cs +++ b/Source/Core/Data/PK3StructuredReader.cs @@ -624,7 +624,7 @@ namespace CodeImp.DoomBuilder.Data } // This copies images from a collection unless they already exist in the list - private void AddImagesToList(Dictionary targetlist, ICollection sourcelist) + private static void AddImagesToList(Dictionary targetlist, ICollection sourcelist) { // Go for all source images foreach(ImageData src in sourcelist) diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index 91278534..ca0a0ff7 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -575,7 +575,7 @@ namespace CodeImp.DoomBuilder.Editing } // This sets the view mode - private void SetViewMode(ViewMode mode) + private static void SetViewMode(ViewMode mode) { General.Map.CRenderer2D.SetViewMode(mode); General.MainWindow.UpdateInterface(); diff --git a/Source/Core/GZBuilder/Controls/AngleControl.cs b/Source/Core/GZBuilder/Controls/AngleControl.cs index 771b5a8f..533d20ef 100644 --- a/Source/Core/GZBuilder/Controls/AngleControl.cs +++ b/Source/Core/GZBuilder/Controls/AngleControl.cs @@ -66,7 +66,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls public delegate void AngleChangedDelegate(); public event AngleChangedDelegate AngleChanged; - private PointF DegreesToXY(float degrees, float radius, Point origin) + private static PointF DegreesToXY(float degrees, float radius, Point origin) { PointF xy = new PointF(); double radians = degrees * Math.PI / 180.0; @@ -77,7 +77,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls return xy; } - private int XYToDegrees(Point xy, Point origin) + private static int XYToDegrees(Point xy, Point origin) { float xDiff = xy.X - origin.X; float yDiff = xy.Y - origin.Y; diff --git a/Source/Core/General/BinaryHeap.cs b/Source/Core/General/BinaryHeap.cs index 5908503c..457cd2ba 100644 --- a/Source/Core/General/BinaryHeap.cs +++ b/Source/Core/General/BinaryHeap.cs @@ -71,9 +71,9 @@ namespace CodeImp.DoomBuilder #region ================== Methods // Methods to find our way through the heap - private int ParentOf(int index) { return (index - 1) >> 1; } - private int LeftOf(int index) { return (index << 1) + 1; } - private int RightOf(int index) { return (index << 1) + 2; } + private static int ParentOf(int index) { return (index - 1) >> 1; } + private static int LeftOf(int index) { return (index << 1) + 1; } + private static int RightOf(int index) { return (index << 1) + 2; } // This swaps two items in place protected virtual void SwapItems(int index1, int index2) diff --git a/Source/Core/Geometry/Tools.cs b/Source/Core/Geometry/Tools.cs index c5ca5314..99c6d963 100644 --- a/Source/Core/Geometry/Tools.cs +++ b/Source/Core/Geometry/Tools.cs @@ -695,9 +695,9 @@ namespace CodeImp.DoomBuilder.Geometry // This applies defaults to a sidedef private static void ApplyDefaultsToSidedef(Sidedef sd, SidedefSettings defaults) { - if(sd.HighRequired() && sd.HighTexture.StartsWith("-")) sd.SetTextureHigh(defaults.newtexhigh); - if(sd.MiddleRequired() && sd.MiddleTexture.StartsWith("-")) sd.SetTextureMid(defaults.newtexmid); - if(sd.LowRequired() && sd.LowTexture.StartsWith("-")) sd.SetTextureLow(defaults.newtexlow); + if(sd.HighRequired() && sd.LongHighTexture == MapSet.EmptyLongName) sd.SetTextureHigh(defaults.newtexhigh); //mxd + if(sd.MiddleRequired() && sd.LongMiddleTexture == MapSet.EmptyLongName) sd.SetTextureMid(defaults.newtexmid); //mxd + if(sd.LowRequired() && sd.LongLowTexture == MapSet.EmptyLongName) sd.SetTextureLow(defaults.newtexlow); //mxd } // This applies defaults to a sector @@ -1470,12 +1470,12 @@ namespace CodeImp.DoomBuilder.Geometry if(l.Front != null) { ImageData texture = null; - if(l.Front.MiddleRequired() && l.Front.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.MiddleTexture)) { - texture = General.Map.Data.GetFlatImage(l.Front.MiddleTexture); - } else if(l.Front.HighRequired() && l.Front.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.HighTexture)) { - texture = General.Map.Data.GetFlatImage(l.Front.HighTexture); - } else if(l.Front.LowRequired() && l.Front.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.LowTexture)) { - texture = General.Map.Data.GetFlatImage(l.Front.LowTexture); + if(l.Front.MiddleRequired() && l.Front.LongMiddleTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Front.LongMiddleTexture)) { + texture = General.Map.Data.GetTextureImage(l.Front.LongMiddleTexture); + } else if(l.Front.HighRequired() && l.Front.LongHighTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Front.LongHighTexture)) { + texture = General.Map.Data.GetTextureImage(l.Front.LongHighTexture); + } else if(l.Front.LowRequired() && l.Front.LongLowTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Front.LongLowTexture)) { + texture = General.Map.Data.GetTextureImage(l.Front.LongLowTexture); } if(texture != null) @@ -1485,12 +1485,12 @@ namespace CodeImp.DoomBuilder.Geometry if(l.Back != null) { ImageData texture = null; - if(l.Back.MiddleRequired() && l.Back.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.MiddleTexture)) { - texture = General.Map.Data.GetFlatImage(l.Back.MiddleTexture); - } else if(l.Back.HighRequired() && l.Back.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.HighTexture)) { - texture = General.Map.Data.GetFlatImage(l.Back.HighTexture); - } else if(l.Back.LowRequired() && l.Back.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.LowTexture)) { - texture = General.Map.Data.GetFlatImage(l.Back.LowTexture); + if(l.Back.MiddleRequired() && l.Back.LongMiddleTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Back.LongMiddleTexture)) { + texture = General.Map.Data.GetTextureImage(l.Back.LongMiddleTexture); + } else if(l.Back.HighRequired() && l.Back.LongHighTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Back.LongHighTexture)) { + texture = General.Map.Data.GetTextureImage(l.Back.LongHighTexture); + } else if(l.Back.LowRequired() && l.Back.LongLowTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Back.LongLowTexture)) { + texture = General.Map.Data.GetTextureImage(l.Back.LongLowTexture); } if(texture != null) @@ -1507,22 +1507,22 @@ namespace CodeImp.DoomBuilder.Geometry foreach(Linedef l in lines) { if(l.Front != null) { - if(l.Front.MiddleRequired() && l.Front.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.MiddleTexture)) { - ImageData texture = General.Map.Data.GetFlatImage(l.Front.MiddleTexture); + if(l.Front.MiddleRequired() && l.Front.LongMiddleTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Front.LongMiddleTexture)) { + ImageData texture = General.Map.Data.GetTextureImage(l.Front.LongMiddleTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; if(offset > 0) UDMFTools.SetFloat(l.Front.Fields, "offsetx_mid", offset); } - if(l.Front.HighRequired() && l.Front.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.HighTexture)) { - ImageData texture = General.Map.Data.GetFlatImage(l.Front.HighTexture); + if(l.Front.HighRequired() && l.Front.LongHighTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Front.LongHighTexture)) { + ImageData texture = General.Map.Data.GetTextureImage(l.Front.LongHighTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; if(offset > 0) UDMFTools.SetFloat(l.Front.Fields, "offsetx_top", offset); } - if(l.Front.LowRequired() && l.Front.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.LowTexture)) { - ImageData texture = General.Map.Data.GetFlatImage(l.Front.LowTexture); + if(l.Front.LowRequired() && l.Front.LongLowTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Front.LongLowTexture)) { + ImageData texture = General.Map.Data.GetTextureImage(l.Front.LongLowTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; if(offset > 0) UDMFTools.SetFloat(l.Front.Fields, "offsetx_bottom", offset); @@ -1530,22 +1530,22 @@ namespace CodeImp.DoomBuilder.Geometry } if(l.Back != null) { - if(l.Back.MiddleRequired() && l.Back.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.MiddleTexture)) { - ImageData texture = General.Map.Data.GetFlatImage(l.Back.MiddleTexture); + if(l.Back.MiddleRequired() && l.Back.LongMiddleTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Back.LongMiddleTexture)) { + ImageData texture = General.Map.Data.GetTextureImage(l.Back.LongMiddleTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; if(offset > 0) UDMFTools.SetFloat(l.Back.Fields, "offsetx_mid", offset); } - if(l.Back.HighRequired() && l.Back.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.HighTexture)) { - ImageData texture = General.Map.Data.GetFlatImage(l.Back.HighTexture); + if(l.Back.HighRequired() && l.Back.LongHighTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Back.LongHighTexture)) { + ImageData texture = General.Map.Data.GetTextureImage(l.Back.LongHighTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; if(offset > 0) UDMFTools.SetFloat(l.Back.Fields, "offsetx_top", offset); } - if(l.Back.LowRequired() && l.Back.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.LowTexture)) { - ImageData texture = General.Map.Data.GetFlatImage(l.Back.LowTexture); + if(l.Back.LowRequired() && l.Back.LongLowTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(l.Back.LongLowTexture)) { + ImageData texture = General.Map.Data.GetTextureImage(l.Back.LongLowTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; if(offset > 0) UDMFTools.SetFloat(l.Back.Fields, "offsetx_bottom", offset); @@ -1644,7 +1644,7 @@ namespace CodeImp.DoomBuilder.Geometry // Apply texturing if(j.sidedef.HighRequired() && j.sidedef.LongHighTexture == originaltexture) j.sidedef.SetTextureHigh(filltexture.Name); - if((((j.sidedef.MiddleTexture.Length > 0) && (j.sidedef.MiddleTexture != "-")) || j.sidedef.MiddleRequired()) && + if((j.sidedef.LongMiddleTexture != MapSet.EmptyLongName || j.sidedef.MiddleRequired()) && (j.sidedef.LongMiddleTexture == originaltexture)) j.sidedef.SetTextureMid(filltexture.Name); if(j.sidedef.LowRequired() && j.sidedef.LongLowTexture == originaltexture) j.sidedef.SetTextureLow(filltexture.Name); j.sidedef.Marked = true; @@ -1715,7 +1715,7 @@ namespace CodeImp.DoomBuilder.Geometry { return ((sd.LongHighTexture == texturelongname) && sd.HighRequired()) || ((sd.LongLowTexture == texturelongname) && sd.LowRequired()) || - ((sd.LongMiddleTexture == texturelongname) && (sd.MiddleRequired() || ((sd.MiddleTexture.Length > 0) && (sd.MiddleTexture != "-")))) ; + ((sd.LongMiddleTexture == texturelongname) && (sd.MiddleRequired() || sd.LongMiddleTexture != MapSet.EmptyLongName)) ; } #endregion diff --git a/Source/Core/Geometry/Triangulation.cs b/Source/Core/Geometry/Triangulation.cs index c9707e5a..886dcad3 100644 --- a/Source/Core/Geometry/Triangulation.cs +++ b/Source/Core/Geometry/Triangulation.cs @@ -289,7 +289,7 @@ namespace CodeImp.DoomBuilder.Geometry // This recursively traces a path // Returns the resulting TracePath when the search is complete // or returns null when no path found. - private SidedefsTracePath DoTracePath(SidedefsTracePath history, Vertex fromhere, Vertex findme, Sector sector, Dictionary sides) + private static SidedefsTracePath DoTracePath(SidedefsTracePath history, Vertex fromhere, Vertex findme, Sector sector, Dictionary sides) { SidedefsTracePath nextpath; SidedefsTracePath result; @@ -359,7 +359,7 @@ namespace CodeImp.DoomBuilder.Geometry // This removes all sidedefs which has a sidedefs on the other side // of the same line that refers to the same sector. These are removed // because they are useless and make the triangulation inefficient. - private void RemoveDoubleSidedefReferences(Dictionary todosides, ICollection sides) + private static void RemoveDoubleSidedefReferences(Dictionary todosides, ICollection sides) { // Go for all sides foreach(Sidedef sd in sides) @@ -378,7 +378,7 @@ namespace CodeImp.DoomBuilder.Geometry } // This finds the right-most vertex to start tracing with - private Vertex FindRightMostVertex(Dictionary sides, Dictionary ignores) + private static Vertex FindRightMostVertex(Dictionary sides, Dictionary ignores) { Vertex found = null; @@ -480,7 +480,7 @@ namespace CodeImp.DoomBuilder.Geometry } // This finds the right-most vertex in an inner polygon to use for cut startpoint. - private LinkedListNode FindRightMostVertex(EarClipPolygon p) + private static LinkedListNode FindRightMostVertex(EarClipPolygon p) { LinkedListNode found = p.First; LinkedListNode v = found.Next; @@ -813,7 +813,7 @@ namespace CodeImp.DoomBuilder.Geometry } // This returns the 3-vertex array triangle for an ear - private EarClipVertex[] GetTriangle(EarClipVertex v) + private static EarClipVertex[] GetTriangle(EarClipVertex v) { EarClipVertex[] t = new EarClipVertex[3]; t[0] = (v.MainListNode.Previous == null) ? v.MainListNode.List.Last.Value : v.MainListNode.Previous.Value; @@ -823,7 +823,7 @@ namespace CodeImp.DoomBuilder.Geometry } // This checks if a vertex is reflex (corner > 180 deg) or convex (corner < 180 deg) - private bool IsReflex(EarClipVertex[] t) + private static bool IsReflex(EarClipVertex[] t) { // Return true when corner is > 180 deg return (Line2D.GetSideOfLine(t[0].Position, t[2].Position, t[1].Position) < 0.0f); @@ -881,7 +881,7 @@ namespace CodeImp.DoomBuilder.Geometry // This checks if a line is inside a triangle (touching the triangle is allowed) // NOTE: We already know p1 is on an edge segment of the triangle - private bool LineInsideTriangle(EarClipVertex[] t, Vector2D p1, Vector2D p2) + private static bool LineInsideTriangle(EarClipVertex[] t, Vector2D p1, Vector2D p2) { float s01 = Line2D.GetSideOfLine(t[0].Position, t[1].Position, p2); float s12 = Line2D.GetSideOfLine(t[1].Position, t[2].Position, p2); @@ -942,7 +942,7 @@ namespace CodeImp.DoomBuilder.Geometry } // This checks if the triangle has an area greater than 0 - private bool TriangleHasArea(EarClipVertex[] t) + private static bool TriangleHasArea(EarClipVertex[] t) { return ((t[0].Position.x * (t[1].Position.y - t[2].Position.y) + t[1].Position.x * (t[2].Position.y - t[0].Position.y) + @@ -950,7 +950,7 @@ namespace CodeImp.DoomBuilder.Geometry } // This adds an array of vertices - private void AddTriangleToList(EarClipVertex[] triangle, List verticeslist, List sidedefslist, bool last) + private static void AddTriangleToList(EarClipVertex[] triangle, List verticeslist, List sidedefslist, bool last) { // Create triangle verticeslist.Add(triangle[0].Position); diff --git a/Source/Core/IO/Configuration.cs b/Source/Core/IO/Configuration.cs index 0ebe0a82..b3e77b25 100644 --- a/Source/Core/IO/Configuration.cs +++ b/Source/Core/IO/Configuration.cs @@ -414,7 +414,7 @@ namespace CodeImp.DoomBuilder.IO // This returns a string added with escape characters - private string EscapedString(string str) + private static string EscapedString(string str) { // Replace the \ with \\ first! str = str.Replace("\\", "\\\\"); diff --git a/Source/Core/IO/DirectoryFilesList.cs b/Source/Core/IO/DirectoryFilesList.cs index 667c321d..bf1895bb 100644 --- a/Source/Core/IO/DirectoryFilesList.cs +++ b/Source/Core/IO/DirectoryFilesList.cs @@ -289,7 +289,7 @@ namespace CodeImp.DoomBuilder.IO } // This fixes a path so that it doesn't have the \ at the end - private string CorrectPath(string path) + private static string CorrectPath(string path) { if(path.Length > 0) { diff --git a/Source/Core/Map/MapOptions.cs b/Source/Core/Map/MapOptions.cs index 6f87d962..991cbd1f 100644 --- a/Source/Core/Map/MapOptions.cs +++ b/Source/Core/Map/MapOptions.cs @@ -242,7 +242,7 @@ namespace CodeImp.DoomBuilder.Map #region ================== Methods // This makes the path prefix for the given assembly - private string GetPluginPathPrefix(Assembly asm) + private static string GetPluginPathPrefix(Assembly asm) { Plugin p = General.Plugins.FindPluginByAssembly(asm); return "plugins." + p.Name.ToLowerInvariant() + "."; diff --git a/Source/Core/Map/Sector.cs b/Source/Core/Map/Sector.cs index 358d651c..71353a59 100644 --- a/Source/Core/Map/Sector.cs +++ b/Source/Core/Map/Sector.cs @@ -578,6 +578,7 @@ namespace CodeImp.DoomBuilder.Map { BeforePropsChange(); + if(string.IsNullOrEmpty(name)) name = "-"; //mxd floortexname = name; longfloortexname = Lump.MakeLongName(name); updateneeded = true; @@ -589,6 +590,7 @@ namespace CodeImp.DoomBuilder.Map { BeforePropsChange(); + if(string.IsNullOrEmpty(name)) name = "-"; //mxd ceiltexname = name; longceiltexname = Lump.MakeLongName(name); updateneeded = true; diff --git a/Source/Core/Map/Sidedef.cs b/Source/Core/Map/Sidedef.cs index a466ba27..dfc70657 100644 --- a/Source/Core/Map/Sidedef.cs +++ b/Source/Core/Map/Sidedef.cs @@ -535,6 +535,7 @@ namespace CodeImp.DoomBuilder.Map { BeforePropsChange(); + if(string.IsNullOrEmpty(name)) name = "-"; //mxd texnamehigh = name; longtexnamehigh = Lump.MakeLongName(name); General.Map.IsChanged = true; @@ -545,6 +546,7 @@ namespace CodeImp.DoomBuilder.Map { BeforePropsChange(); + if (string.IsNullOrEmpty(name)) name = "-"; //mxd texnamemid = name; longtexnamemid = Lump.MakeLongName(name); General.Map.IsChanged = true; @@ -555,6 +557,7 @@ namespace CodeImp.DoomBuilder.Map { BeforePropsChange(); + if(string.IsNullOrEmpty(name)) name = "-"; //mxd texnamelow = name; longtexnamelow = Lump.MakeLongName(name); General.Map.IsChanged = true; @@ -565,7 +568,7 @@ namespace CodeImp.DoomBuilder.Map this.Fields.BeforeFieldsChange(); //top - if(HighTexture.Length > 1 && General.Map.Data.GetFlatExists(HighTexture)) { + if(LongHighTexture != MapSet.EmptyLongName && General.Map.Data.GetFlatExists(HighTexture)) { ImageData texture = General.Map.Data.GetFlatImage(HighTexture); float scaleTop = Fields.GetValue("scalex_top", 1.0f); @@ -575,7 +578,7 @@ namespace CodeImp.DoomBuilder.Map } //middle - if(MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(MiddleTexture)) { + if(LongMiddleTexture != MapSet.EmptyLongName && General.Map.Data.GetFlatExists(MiddleTexture)) { ImageData texture = General.Map.Data.GetFlatImage(MiddleTexture); float scaleMid = Fields.GetValue("scalex_mid", 1.0f); @@ -585,7 +588,7 @@ namespace CodeImp.DoomBuilder.Map } //bottom - if(LowTexture.Length > 1 && General.Map.Data.GetFlatExists(LowTexture)) { + if(LongLowTexture != MapSet.EmptyLongName && General.Map.Data.GetFlatExists(LowTexture)) { ImageData texture = General.Map.Data.GetFlatImage(LowTexture); float scaleLow = Fields.GetValue("scalex_bottom", 1.0f); diff --git a/Source/Core/Properties/Resources.Designer.cs b/Source/Core/Properties/Resources.Designer.cs index 1bde0163..bab45f80 100644 --- a/Source/Core/Properties/Resources.Designer.cs +++ b/Source/Core/Properties/Resources.Designer.cs @@ -249,6 +249,13 @@ namespace CodeImp.DoomBuilder.Properties { } } + internal static System.Drawing.Bitmap ImageStack { + get { + object obj = ResourceManager.GetObject("ImageStack", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap InfoLine { get { object obj = ResourceManager.GetObject("InfoLine", resourceCulture); diff --git a/Source/Core/Properties/Resources.resx b/Source/Core/Properties/Resources.resx index d205cb25..ca48abcd 100644 --- a/Source/Core/Properties/Resources.resx +++ b/Source/Core/Properties/Resources.resx @@ -418,4 +418,7 @@ ..\Resources\Search.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ImageStack.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Source/Core/Resources/ImageStack.png b/Source/Core/Resources/ImageStack.png new file mode 100644 index 00000000..8fe96237 Binary files /dev/null and b/Source/Core/Resources/ImageStack.png differ diff --git a/Source/Core/VisualModes/VisualBlockMap.cs b/Source/Core/VisualModes/VisualBlockMap.cs index edabf57f..18291d2e 100644 --- a/Source/Core/VisualModes/VisualBlockMap.cs +++ b/Source/Core/VisualModes/VisualBlockMap.cs @@ -95,7 +95,7 @@ namespace CodeImp.DoomBuilder.VisualModes // This returns the key for a block at the given coordinates // TODO: Could we just use the Point struct as key? - private ulong GetBlockKey(Point p) + private static ulong GetBlockKey(Point p) { return unchecked( ((ulong)(uint)p.X << 32) + (uint)p.Y ); } diff --git a/Source/Core/Windows/ConfigForm.Designer.cs b/Source/Core/Windows/ConfigForm.Designer.cs index 52a47506..e17b21c3 100644 --- a/Source/Core/Windows/ConfigForm.Designer.cs +++ b/Source/Core/Windows/ConfigForm.Designer.cs @@ -754,6 +754,7 @@ namespace CodeImp.DoomBuilder.Windows this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Game Configurations"; + this.Shown += new System.EventHandler(this.ConfigForm_Shown); this.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.ConfigForm_HelpRequested); this.tabs.ResumeLayout(false); this.tabresources.ResumeLayout(false); diff --git a/Source/Core/Windows/ConfigForm.cs b/Source/Core/Windows/ConfigForm.cs index 9643f41d..e480eb70 100644 --- a/Source/Core/Windows/ConfigForm.cs +++ b/Source/Core/Windows/ConfigForm.cs @@ -713,5 +713,12 @@ namespace CodeImp.DoomBuilder.Windows configinfo.LinedefColorPresets = colorsControl.GetPresets(); configinfo.Changed = true; //mxd } + + //mxd + private void ConfigForm_Shown(object sender, EventArgs e) { + if (listconfigs.SelectedItems.Count > 0) { + listconfigs.SelectedItems[0].EnsureVisible(); + } + } } } diff --git a/Source/Core/Windows/ConfigForm.resx b/Source/Core/Windows/ConfigForm.resx index 3efe96de..1846c01a 100644 --- a/Source/Core/Windows/ConfigForm.resx +++ b/Source/Core/Windows/ConfigForm.resx @@ -212,7 +212,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA4 - CAAAAk1TRnQBSQFMAwEBAAH0AQAB9AEAARMBAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA + CAAAAk1TRnQBSQFMAwEBAAH8AQAB/AEAARMBAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA AUwDAAEQAwABAQEAAQgFAAHAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/Source/Core/Windows/ErrorsForm.cs b/Source/Core/Windows/ErrorsForm.cs index 85ae6e09..ad0f337e 100644 --- a/Source/Core/Windows/ErrorsForm.cs +++ b/Source/Core/Windows/ErrorsForm.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; @@ -119,7 +120,13 @@ namespace CodeImp.DoomBuilder.Windows str.Append(c.Value); } } - Clipboard.SetText(str.ToString()); + + //mxd + try { + Clipboard.SetDataObject(str.ToString(), true); + } catch(ExternalException) { + General.Interface.DisplayStatus(StatusType.Warning, "Failed to perform a Clipboard operation..."); + } } } diff --git a/Source/Core/Windows/LinedefEditForm.cs b/Source/Core/Windows/LinedefEditForm.cs index 9416d7d8..0da92aa3 100644 --- a/Source/Core/Windows/LinedefEditForm.cs +++ b/Source/Core/Windows/LinedefEditForm.cs @@ -506,12 +506,22 @@ namespace CodeImp.DoomBuilder.Windows // Front settings if(l.Front != null) { - if(fronthigh.TextureName != l.Front.HighTexture) fronthigh.TextureName = string.Empty; - if(frontmid.TextureName != l.Front.MiddleTexture) frontmid.TextureName = string.Empty; - if(frontlow.TextureName != l.Front.LowTexture) frontlow.TextureName = string.Empty; - if(fronthigh.Required != l.Front.HighRequired()) fronthigh.Required = false; - if(frontmid.Required != l.Front.MiddleRequired()) frontmid.Required = false; - if(frontlow.Required != l.Front.LowRequired()) frontlow.Required = false; + //mxd + if (fronthigh.TextureName != l.Front.HighTexture) { + if(!fronthigh.Required && l.Front.HighRequired()) fronthigh.Required = true; + fronthigh.MultipleTextures = true; //mxd + fronthigh.TextureName = string.Empty; + } + if (frontmid.TextureName != l.Front.MiddleTexture) { + if(!frontmid.Required && l.Front.MiddleRequired()) frontmid.Required = true; + frontmid.MultipleTextures = true; //mxd + frontmid.TextureName = string.Empty; + } + if (frontlow.TextureName != l.Front.LowTexture) { + if(!frontlow.Required && l.Front.LowRequired()) frontlow.Required = true; + frontlow.MultipleTextures = true; //mxd + frontlow.TextureName = string.Empty; + } if(frontsector.Text != l.Front.Sector.Index.ToString()) frontsector.Text = string.Empty; //mxd @@ -549,12 +559,22 @@ namespace CodeImp.DoomBuilder.Windows // Back settings if(l.Back != null) { - if(backhigh.TextureName != l.Back.HighTexture) backhigh.TextureName = string.Empty; - if(backmid.TextureName != l.Back.MiddleTexture) backmid.TextureName = string.Empty; - if(backlow.TextureName != l.Back.LowTexture) backlow.TextureName = string.Empty; - if(backhigh.Required != l.Back.HighRequired()) backhigh.Required = false; - if(backmid.Required != l.Back.MiddleRequired()) backmid.Required = false; - if(backlow.Required != l.Back.LowRequired()) backlow.Required = false; + //mxd + if (backhigh.TextureName != l.Back.HighTexture) { + if(!backhigh.Required && l.Back.HighRequired()) backhigh.Required = true; + backhigh.MultipleTextures = true; //mxd + backhigh.TextureName = string.Empty; + } + if (backmid.TextureName != l.Back.MiddleTexture) { + if(!backmid.Required && l.Back.MiddleRequired()) backmid.Required = true; + backmid.MultipleTextures = true; //mxd + backmid.TextureName = string.Empty; + } + if (backlow.TextureName != l.Back.LowTexture) { + if(!backlow.Required && l.Back.LowRequired()) backlow.Required = true; + backlow.MultipleTextures = true; //mxd + backlow.TextureName = string.Empty; + } if(backsector.Text != l.Back.Sector.Index.ToString()) backsector.Text = string.Empty; //mxd diff --git a/Source/Core/Windows/SectorEditForm.cs b/Source/Core/Windows/SectorEditForm.cs index 71afcb88..26502954 100644 --- a/Source/Core/Windows/SectorEditForm.cs +++ b/Source/Core/Windows/SectorEditForm.cs @@ -144,8 +144,14 @@ namespace CodeImp.DoomBuilder.Windows // Floor/Ceiling if(s.FloorHeight.ToString() != floorheight.Text) floorheight.Text = ""; if(s.CeilHeight.ToString() != ceilingheight.Text) ceilingheight.Text = ""; - if(s.FloorTexture != floortex.TextureName) floortex.TextureName = ""; - if(s.CeilTexture != ceilingtex.TextureName) ceilingtex.TextureName = ""; + if (s.FloorTexture != floortex.TextureName) { + floortex.MultipleTextures = true; //mxd + floortex.TextureName = ""; + } + if (s.CeilTexture != ceilingtex.TextureName) { + ceilingtex.MultipleTextures = true; //mxd + ceilingtex.TextureName = ""; + } // Action if(s.Tag != sc.Tag) tagSelector.ClearTag(); //mxd diff --git a/Source/Core/Windows/SectorEditFormUDMF.cs b/Source/Core/Windows/SectorEditFormUDMF.cs index 0714979f..37cae809 100644 --- a/Source/Core/Windows/SectorEditFormUDMF.cs +++ b/Source/Core/Windows/SectorEditFormUDMF.cs @@ -254,8 +254,14 @@ namespace CodeImp.DoomBuilder.Windows // Floor/Ceiling if(s.FloorHeight.ToString() != floorheight.Text) floorheight.Text = ""; if(s.CeilHeight.ToString() != ceilingheight.Text) ceilingheight.Text = ""; - if(s.FloorTexture != floortex.TextureName) floortex.TextureName = ""; - if(s.CeilTexture != ceilingtex.TextureName) ceilingtex.TextureName = ""; + if (s.FloorTexture != floortex.TextureName) { + floortex.MultipleTextures = true; //mxd + floortex.TextureName = ""; + } + if (s.CeilTexture != ceilingtex.TextureName) { + ceilingtex.MultipleTextures = true; //mxd + ceilingtex.TextureName = ""; + } //mxd. UDMF stuff //Texture offsets diff --git a/Source/Core/ZDoom/PatchStructure.cs b/Source/Core/ZDoom/PatchStructure.cs index 44c1da3d..5c9d66b2 100644 --- a/Source/Core/ZDoom/PatchStructure.cs +++ b/Source/Core/ZDoom/PatchStructure.cs @@ -210,7 +210,7 @@ namespace CodeImp.DoomBuilder.ZDoom #region ================== Methods // This reads the next token and sets a floating point value, returns false when failed - private bool ReadTokenFloat(TexturesParser parser, string propertyname, out float value) + private static bool ReadTokenFloat(TexturesParser parser, string propertyname, out float value) { // Next token is the property value to set parser.SkipWhitespace(true); @@ -234,7 +234,7 @@ namespace CodeImp.DoomBuilder.ZDoom } // This reads the next token and sets an integral value, returns false when failed - private bool ReadTokenInt(TexturesParser parser, string propertyname, out int value) + private static bool ReadTokenInt(TexturesParser parser, string propertyname, out int value) { // Next token is the property value to set parser.SkipWhitespace(true); @@ -259,7 +259,7 @@ namespace CodeImp.DoomBuilder.ZDoom } //mxd. This reads the next token and sets a string value, returns false when failed - private bool ReadTokenString(TexturesParser parser, string propertyname, out string value) { + private static bool ReadTokenString(TexturesParser parser, string propertyname, out string value) { parser.SkipWhitespace(true); value = parser.StripTokenQuotes(parser.ReadToken()); @@ -272,7 +272,7 @@ namespace CodeImp.DoomBuilder.ZDoom } //mxd. This reads the next token and sets a PixelColor value, returns false when failed - private bool ReadTokenColor(TexturesParser parser, string propertyname, out int value) { + private static bool ReadTokenColor(TexturesParser parser, string propertyname, out int value) { parser.SkipWhitespace(true); string strvalue = parser.StripTokenQuotes(parser.ReadToken()); value = 0; diff --git a/Source/Core/ZDoom/TextureStructure.cs b/Source/Core/ZDoom/TextureStructure.cs index ba31ac63..e4369ce3 100644 --- a/Source/Core/ZDoom/TextureStructure.cs +++ b/Source/Core/ZDoom/TextureStructure.cs @@ -194,7 +194,7 @@ namespace CodeImp.DoomBuilder.ZDoom #region ================== Methods // This reads the next token and sets a floating point value, returns false when failed - private bool ReadTokenFloat(TexturesParser parser, string propertyname, out float value) + private static bool ReadTokenFloat(TexturesParser parser, string propertyname, out float value) { // Next token is the property value to set parser.SkipWhitespace(true); @@ -223,7 +223,7 @@ namespace CodeImp.DoomBuilder.ZDoom } // This reads the next token and sets an integral value, returns false when failed - private bool ReadTokenInt(TexturesParser parser, string propertyname, out int value) + private static bool ReadTokenInt(TexturesParser parser, string propertyname, out int value) { // Next token is the property value to set parser.SkipWhitespace(true); @@ -264,7 +264,7 @@ namespace CodeImp.DoomBuilder.ZDoom if(yscale == 0.0f) scaley = defaultscale; else scaley = 1f / yscale; // Make texture - HighResImage tex = new HighResImage(name, width, height, scalex, scaley, worldpanning); + HighResImage tex = new HighResImage(name, typename, width, height, scalex, scaley, worldpanning); // Add patches foreach(PatchStructure p in patches) diff --git a/Source/Plugins/BuilderModes/BuilderModes.csproj b/Source/Plugins/BuilderModes/BuilderModes.csproj index 91a4b5be..40b40094 100644 --- a/Source/Plugins/BuilderModes/BuilderModes.csproj +++ b/Source/Plugins/BuilderModes/BuilderModes.csproj @@ -228,6 +228,7 @@ + @@ -235,11 +236,12 @@ + - + diff --git a/Source/Plugins/BuilderModes/ClassicModes/DragGeometryMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DragGeometryMode.cs index b6b88367..22e9a538 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DragGeometryMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DragGeometryMode.cs @@ -409,7 +409,7 @@ namespace CodeImp.DoomBuilder.BuilderModes s.Fields.BeforeFieldsChange(); //update ceiling offset - if(s.CeilTexture.Length > 1) { + if(s.LongCeilTexture != MapSet.EmptyLongName) { ImageData texture = General.Map.Data.GetFlatImage(s.CeilTexture); if(texture != null) { @@ -438,7 +438,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } //update floor offset - if(s.FloorTexture.Length > 1) { + if(s.LongFloorTexture != MapSet.EmptyLongName) { ImageData texture = General.Map.Data.GetFlatImage(s.FloorTexture); if(texture != null) { diff --git a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs index b95bdb9e..214e186f 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs @@ -1487,10 +1487,10 @@ namespace CodeImp.DoomBuilder.BuilderModes } //mxd. Check textures. - if(lines[i].Front.MiddleRequired() && (lines[i].Front.MiddleTexture.Length == 0 || lines[i].Front.MiddleTexture == "-")) { - if(lines[i].Front.HighTexture.Length > 0 && lines[i].Front.HighTexture != "-") { + if(lines[i].Front.MiddleRequired() && lines[i].Front.LongMiddleTexture == MapSet.EmptyLongName) { + if(lines[i].Front.LongHighTexture != MapSet.EmptyLongName) { lines[i].Front.SetTextureMid(lines[i].Front.HighTexture); - } else if(lines[i].Front.LowTexture.Length > 0 && lines[i].Front.LowTexture != "-") { + } else if(lines[i].Front.LongLowTexture != MapSet.EmptyLongName) { lines[i].Front.SetTextureMid(lines[i].Front.LowTexture); } } diff --git a/Source/Plugins/BuilderModes/ErrorChecks/CheckMissingFlats.cs b/Source/Plugins/BuilderModes/ErrorChecks/CheckMissingFlats.cs new file mode 100644 index 00000000..2db0ca7a --- /dev/null +++ b/Source/Plugins/BuilderModes/ErrorChecks/CheckMissingFlats.cs @@ -0,0 +1,57 @@ +#region ================== Namespaces + +using CodeImp.DoomBuilder.Map; +using System.Threading; + +#endregion + +namespace CodeImp.DoomBuilder.BuilderModes +{ + [ErrorChecker("Check missing flats", true, 40)] + public class CheckMissingFlats : ErrorChecker + { + #region ================== Constants + + private int PROGRESS_STEP = 1000; + + #endregion + + #region ================== Constructor / Destructor + + // Constructor + public CheckMissingFlats() { + // Total progress is done when all sectors are checked + SetTotalProgress(General.Map.Map.Sectors.Count / PROGRESS_STEP); + } + + #endregion + + #region ================== Methods + + // This runs the check + public override void Run() { + int progress = 0; + int stepprogress = 0; + + // Go for all the sectors + foreach(Sector s in General.Map.Map.Sectors) { + // Check floor texture + if(s.LongFloorTexture == MapSet.EmptyLongName) SubmitResult(new ResultMissingFlat(s, false)); + + // Check ceiling texture + if(s.LongCeilTexture == MapSet.EmptyLongName) SubmitResult(new ResultMissingFlat(s, true)); + + // Handle thread interruption + try { Thread.Sleep(0); } catch(ThreadInterruptedException) { return; } + + // We are making progress! + if((++progress / PROGRESS_STEP) > stepprogress) { + stepprogress = (progress / PROGRESS_STEP); + AddProgress(1); + } + } + } + + #endregion + } +} diff --git a/Source/Plugins/BuilderModes/ErrorChecks/CheckUnknownFlats.cs b/Source/Plugins/BuilderModes/ErrorChecks/CheckUnknownFlats.cs index b54ba00a..c0a27099 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/CheckUnknownFlats.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/CheckUnknownFlats.cs @@ -55,11 +55,11 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sector s in General.Map.Map.Sectors) { // Check floor texture - if(!General.Map.Data.GetFlatExists(s.FloorTexture)) + if(s.LongFloorTexture != MapSet.EmptyLongName && !General.Map.Data.GetFlatExists(s.FloorTexture)) SubmitResult(new ResultUnknownFlat(s, false)); // Check ceiling texture - if(!General.Map.Data.GetFlatExists(s.CeilTexture)) + if(s.LongCeilTexture != MapSet.EmptyLongName && !General.Map.Data.GetFlatExists(s.CeilTexture)) SubmitResult(new ResultUnknownFlat(s, true)); // Handle thread interruption diff --git a/Source/Plugins/BuilderModes/ErrorChecks/CheckUnknownTextures.cs b/Source/Plugins/BuilderModes/ErrorChecks/CheckUnknownTextures.cs index 9f3f2f0c..fb3a1db7 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/CheckUnknownTextures.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/CheckUnknownTextures.cs @@ -55,24 +55,21 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sidedef sd in General.Map.Map.Sidedefs) { // Check upper texture - if(sd.HighRequired() && ((sd.HighTexture.Length < 1) || (sd.HighTexture != "-"))) + if(sd.HighRequired() && sd.LongHighTexture != MapSet.EmptyLongName && !General.Map.Data.GetTextureExists(sd.LongHighTexture)) { - if(!General.Map.Data.GetTextureExists(sd.LongHighTexture)) - SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Upper)); + SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Upper)); } // Check middle texture - if(sd.MiddleRequired() && ((sd.MiddleTexture.Length < 1) || (sd.MiddleTexture != "-"))) + if(sd.MiddleRequired() && sd.LongMiddleTexture != MapSet.EmptyLongName && !General.Map.Data.GetTextureExists(sd.LongMiddleTexture)) { - if(!General.Map.Data.GetTextureExists(sd.LongMiddleTexture)) - SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Middle)); + SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Middle)); } // Check lower texture - if(sd.LowRequired() && ((sd.LowTexture.Length < 1) || (sd.LowTexture != "-"))) + if(sd.LowRequired() && sd.LongLowTexture != MapSet.EmptyLongName && !General.Map.Data.GetTextureExists(sd.LongLowTexture)) { - if(!General.Map.Data.GetTextureExists(sd.LongLowTexture)) - SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Lower)); + SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Lower)); } // Handle thread interruption diff --git a/Source/Plugins/BuilderModes/ErrorChecks/CheckUnusedTextures.cs b/Source/Plugins/BuilderModes/ErrorChecks/CheckUnusedTextures.cs index 479a3c59..73ceda03 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/CheckUnusedTextures.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/CheckUnusedTextures.cs @@ -39,13 +39,13 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sidedef sd in General.Map.Map.Sidedefs) { // Check upper texture - if(!sd.HighRequired() && ((sd.HighTexture.Length > 1) || (sd.HighTexture != "-"))) + if(!sd.HighRequired() && sd.LongHighTexture != MapSet.EmptyLongName) { SubmitResult(new ResultUnusedTexture(sd, SidedefPart.Upper)); } // Check lower texture - if(!sd.LowRequired() && ((sd.LowTexture.Length > 1) || (sd.LowTexture != "-"))) + if(!sd.LowRequired() && sd.LongLowTexture != MapSet.EmptyLongName) { SubmitResult(new ResultUnusedTexture(sd, SidedefPart.Lower)); } diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultLineMissingFront.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultLineMissingFront.cs index be5e9699..7502d582 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/ResultLineMissingFront.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultLineMissingFront.cs @@ -53,7 +53,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.viewobjects.Add(l); this.description = "This linedef has a back sidedef, but is missing a front sidedef. " + "A line must have at least a front side and optionally a back side! " + - "Click Flip Linedef if the line is supposed to be single-sided."; + "Click 'Flip Linedef' button if the line is supposed to be single-sided."; // One solution is to flip the sidedefs buttons = 1; diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultLineNotDoubleSided.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultLineNotDoubleSided.cs index aa770cad..1c019fb8 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/ResultLineNotDoubleSided.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultLineNotDoubleSided.cs @@ -51,7 +51,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Initialize this.line = l; this.viewobjects.Add(l); - this.description = "This linedef is marked as double-sided, but is missing the back sidedef. Click Make Single-Sided to remove the double-sided flag from the line."; + this.description = "This linedef is marked as double-sided, but is missing the back sidedef. Click 'Make Single-Sided' button to remove the double-sided flag from the line."; // One solution is to remove the double-sided flag buttons = 1; diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultLineNotSingleSided.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultLineNotSingleSided.cs index 9bc1cf23..49da4f5c 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/ResultLineNotSingleSided.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultLineNotSingleSided.cs @@ -47,8 +47,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // Initialize this.line = l; this.viewobjects.Add(l); - this.description = "This linedef is marked as single-sided, but has both a front and a back sidedef. Click Make Double-Sided to flag the line as double-sided." + - " Or click Remove Sidedef to remove the sidedef on the back side (making the line really single-sided)."; + this.description = "This linedef is marked as single-sided, but has both a front and a back sidedef. Click 'Make Double-Sided' button to flag the line as double-sided." + + " Or click 'Remove Sidedef' button to remove the sidedef on the back side (making the line really single-sided)."; } #endregion diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultMissingFlat.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultMissingFlat.cs new file mode 100644 index 00000000..7bbaabac --- /dev/null +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultMissingFlat.cs @@ -0,0 +1,79 @@ +#region ================== Namespaces + +using CodeImp.DoomBuilder.Map; +using CodeImp.DoomBuilder.Rendering; + +#endregion + +namespace CodeImp.DoomBuilder.BuilderModes +{ + public class ResultMissingFlat : ErrorResult + { + #region ================== Variables + + private Sector sector; + private bool ceiling; + + #endregion + + #region ================== Properties + + public override int Buttons { get { return 1; } } + public override string Button1Text { get { return "Add Default Flat"; } } + + #endregion + + #region ================== Constructor / Destructor + + // Constructor + public ResultMissingFlat(Sector s, bool ceiling) + { + // Initialize + this.sector = s; + this.ceiling = ceiling; + this.viewobjects.Add(s); + + string objname = ceiling ? "ceiling" : "floor"; + this.description = "This sector's " + objname + " is missing a flat where it is required and could cause a 'Hall Of Mirrors' visual problem in the map. Click the 'Add Default Flat' button to add a flat to the sector."; + } + + #endregion + + #region ================== Methods + + // This must return the string that is displayed in the listbox + public override string ToString() + { + return "Sector " + sector.Index + " has no " + (ceiling ? "ceiling" : "floor") + " flat."; + } + + // Rendering + public override void PlotSelection(IRenderer2D renderer) + { + renderer.PlotSector(sector, General.Colors.Selection); + } + + //mxd. More rendering + public override void RenderOverlaySelection(IRenderer2D renderer) { + if(!BuilderPlug.Me.UseHighlight) return; + renderer.RenderHighlight(sector.FlatVertices, General.Colors.Selection.WithAlpha(64).ToInt()); + } + + // Fix by setting default flat + public override bool Button1Click(bool batchMode) + { + if(!batchMode) General.Map.UndoRedo.CreateUndo("Missing flat correction"); + General.Settings.FindDefaultDrawSettings(); + + if(ceiling) + sector.SetCeilTexture(General.Map.Options.DefaultCeilingTexture); + else + sector.SetFloorTexture(General.Map.Options.DefaultFloorTexture); + + General.Map.Map.Update(); + return true; + } + + #endregion + } +} diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultTextureMissing.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultMissingTexture.cs similarity index 93% rename from Source/Plugins/BuilderModes/ErrorChecks/ResultTextureMissing.cs rename to Source/Plugins/BuilderModes/ErrorChecks/ResultMissingTexture.cs index fed8f8fb..28841ea0 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/ResultTextureMissing.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultMissingTexture.cs @@ -48,7 +48,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.side = sd; this.part = part; this.viewobjects.Add(sd); - this.description = "This sidedef is missing a texture where it is required and could cause a 'Hall Of Mirrors' visual problem in the map. Click the Add Default Texture button to add a texture to the line."; + this.description = "This sidedef is missing a texture where it is required and could cause a 'Hall Of Mirrors' visual problem in the map. Click the 'Add Default Texture' button to add a texture to the line."; } #endregion diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultUnknownFlat.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultUnknownFlat.cs index 4e7afbb3..5dd03a68 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/ResultUnknownFlat.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultUnknownFlat.cs @@ -50,7 +50,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.viewobjects.Add(s); string objname = ceiling ? "ceiling" : "floor"; - this.description = "This sector " + objname + " uses an unknown flat. This could be the result of missing resources, or a mistyped flat name. Click the Add Default Flat button to use a known flat instead."; + this.description = "This sector's " + objname + " uses an unknown flat. This could be the result of missing resources, or a mistyped flat name. Click the 'Add Default Flat' button to use a known flat instead."; } #endregion diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultUnknownTexture.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultUnknownTexture.cs index f8511b65..3c4d9b26 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/ResultUnknownTexture.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultUnknownTexture.cs @@ -49,7 +49,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.side = sd; this.part = part; this.viewobjects.Add(sd); - this.description = "This sidedef uses an unknown texture. This could be the result of missing resources, or a mistyped texture name. Click the Remove Texture button to remove the texture or click on Add Default Texture to use a known texture instead."; + this.description = "This sidedef uses an unknown texture. This could be the result of missing resources, or a mistyped texture name. Click the 'Remove Texture' button to remove the texture or click on 'Add Default Texture' to use a known texture instead."; } #endregion diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs index a818ba1e..a2fd4bdf 100644 --- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs +++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs @@ -124,9 +124,9 @@ namespace CodeImp.DoomBuilder.BuilderModes public override int MinimumRevision { get { return Assembly.GetExecutingAssembly().GetName().Version.Revision; } } public MenusForm MenusForm { get { return menusform; } } - public CurveLinedefsForm CurveLinedefsForm { get { return curvelinedefsform; } } - public FindReplaceForm FindReplaceForm { get { return findreplaceform; } } - public ErrorCheckForm ErrorCheckForm { get { return errorcheckform; } } + public CurveLinedefsForm CurveLinedefsForm { get { return curvelinedefsform ?? (curvelinedefsform = new CurveLinedefsForm()); } } + public FindReplaceForm FindReplaceForm { get { return findreplaceform ?? (findreplaceform = new FindReplaceForm()); } } + public ErrorCheckForm ErrorCheckForm { get { return errorcheckform ?? (errorcheckform = new ErrorCheckForm()); } } public PreferencesForm PreferencesForm { get { return preferencesform; } } // Settings @@ -192,15 +192,6 @@ namespace CodeImp.DoomBuilder.BuilderModes menusform.Register(); menusform.TextureOffsetLock.Checked = lockSectorTextureOffsetsWhileDragging; //mxd - // Load curve linedefs form - curvelinedefsform = new CurveLinedefsForm(); - - // Load find/replace form - findreplaceform = new FindReplaceForm(); - - // Load error checking form - errorcheckform = new ErrorCheckForm(); - // Load Undo\Redo docker undoredopanel = new UndoRedoPanel(); undoredodocker = new Docker("undoredo", "Undo / Redo", undoredopanel); @@ -490,12 +481,12 @@ namespace CodeImp.DoomBuilder.BuilderModes //get texture ImageData texture = null; - if(newline.Front.MiddleRequired() && newline.Front.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(newline.Front.MiddleTexture)) { - texture = General.Map.Data.GetFlatImage(newline.Front.MiddleTexture); - } else if(newline.Front.HighRequired() && newline.Front.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(newline.Front.HighTexture)) { - texture = General.Map.Data.GetFlatImage(newline.Front.HighTexture); - } else if(newline.Front.LowRequired() && newline.Front.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(newline.Front.LowTexture)) { - texture = General.Map.Data.GetFlatImage(newline.Front.LowTexture); + if(newline.Front.MiddleRequired() && newline.Front.LongMiddleTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(newline.Front.LongMiddleTexture)) { + texture = General.Map.Data.GetTextureImage(newline.Front.MiddleTexture); + } else if(newline.Front.HighRequired() && newline.Front.LongHighTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(newline.Front.LongHighTexture)) { + texture = General.Map.Data.GetTextureImage(newline.Front.HighTexture); + } else if(newline.Front.LowRequired() && newline.Front.LongLowTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(newline.Front.LongLowTexture)) { + texture = General.Map.Data.GetTextureImage(newline.Front.LowTexture); } //clamp offsetX @@ -506,12 +497,12 @@ namespace CodeImp.DoomBuilder.BuilderModes //get texture ImageData texture = null; - if(newline.Back.MiddleRequired() && newline.Back.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(newline.Back.MiddleTexture)) { - texture = General.Map.Data.GetFlatImage(newline.Back.MiddleTexture); - } else if(newline.Back.HighRequired() && newline.Back.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(newline.Back.HighTexture)) { - texture = General.Map.Data.GetFlatImage(newline.Back.HighTexture); - } else if(newline.Back.LowRequired() && newline.Back.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(newline.Back.LowTexture)) { - texture = General.Map.Data.GetFlatImage(newline.Back.LowTexture); + if(newline.Back.MiddleRequired() && newline.Back.LongMiddleTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(newline.Back.LongMiddleTexture)) { + texture = General.Map.Data.GetTextureImage(newline.Back.MiddleTexture); + } else if(newline.Back.HighRequired() && newline.Back.LongHighTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(newline.Back.LongHighTexture)) { + texture = General.Map.Data.GetTextureImage(newline.Back.HighTexture); + } else if(newline.Back.LowRequired() && newline.Back.LongLowTexture != MapSet.EmptyLongName && General.Map.Data.GetTextureExists(newline.Back.LongLowTexture)) { + texture = General.Map.Data.GetTextureImage(newline.Back.LowTexture); } //clamp offsetX diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index 51e17418..e14f2c3c 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -3299,7 +3299,7 @@ namespace CodeImp.DoomBuilder.BuilderModes bool matchtop = (!j.sidedef.Marked && (j.sidedef.LongHighTexture == texture.LongName) && j.sidedef.HighRequired()); bool matchbottom = (!j.sidedef.Marked && (j.sidedef.LongLowTexture == texture.LongName) && j.sidedef.LowRequired()); - bool matchmid = ((j.controlSide.LongMiddleTexture == texture.LongName) && (j.controlSide.MiddleRequired() || ((j.controlSide.MiddleTexture.Length > 0) && (j.controlSide.MiddleTexture != "-")))); //mxd + bool matchmid = ((j.controlSide.LongMiddleTexture == texture.LongName) && (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) { diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs index 737b55c5..15cb001b 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs @@ -363,7 +363,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } //mxd - private bool checkFloorVertices(WorldVertex[] verts, Plane plane) { + private static bool checkFloorVertices(WorldVertex[] verts, Plane plane) { for(int c = 0; c < verts.Length; c++) { if(plane.GetZ(new Vector2D(verts[c].x, verts[c].y)) > verts[c].z) return true; @@ -371,7 +371,7 @@ namespace CodeImp.DoomBuilder.BuilderModes return false; } //mxd - private bool checkCeilingVertices(WorldVertex[] verts, Plane plane) { + private static bool checkCeilingVertices(WorldVertex[] verts, Plane plane) { for(int c = 0; c < verts.Length; c++) { if(plane.GetZ(new Vector2D(verts[c].x, verts[c].y)) < verts[c].z) return true; diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs b/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs index 6d6bb19c..0b8cacc1 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs @@ -89,7 +89,7 @@ namespace CodeImp.DoomBuilder.BuilderModes s.Fields.GetValue("yscaleceiling", 1.0f)); //Load ceiling texture - if((s.CeilTexture.Length > 0) && (s.CeilTexture != "-")) { + if(s.LongCeilTexture != MapSet.EmptyLongName) { base.Texture = General.Map.Data.GetFlatImage(s.LongCeilTexture); if(base.Texture == null || base.Texture is UnknownImage) { base.Texture = General.Map.Data.UnknownTexture3D; diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs b/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs index 09138469..6abf3337 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs @@ -89,7 +89,7 @@ namespace CodeImp.DoomBuilder.BuilderModes s.Fields.GetValue("yscalefloor", 1.0f)); //Load floor texture - if ((s.FloorTexture.Length > 0) && (s.FloorTexture != "-")) + if (s.LongFloorTexture != MapSet.EmptyLongName) { base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture); if(base.Texture == null || base.Texture is UnknownImage) diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs index 33576411..85ef5724 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs @@ -91,7 +91,7 @@ namespace CodeImp.DoomBuilder.BuilderModes if(!osd.Updated) osd.Update(); // Texture given? - if((Sidedef.LowTexture.Length > 0) && (Sidedef.LowTexture != "-")) + if(Sidedef.LongLowTexture != MapSet.EmptyLongName) { // Load texture base.Texture = General.Map.Data.GetTextureImage(Sidedef.LongLowTexture); diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs index 70a7b067..26417543 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs @@ -97,12 +97,12 @@ namespace CodeImp.DoomBuilder.BuilderModes //mxd. which texture we must use? long textureLong = 0; if((sourceside.Line.Args[2] & (int)Effect3DFloor.Flags.UseUpperTexture) != 0) { - if(Sidedef.HighTexture.Length > 0 && Sidedef.HighTexture != "-") + if(Sidedef.LongHighTexture != MapSet.EmptyLongName) textureLong = Sidedef.LongHighTexture; } else if((sourceside.Line.Args[2] & (int)Effect3DFloor.Flags.UseLowerTexture) != 0) { - if(Sidedef.LowTexture.Length > 0 && Sidedef.LowTexture != "-") + if(Sidedef.LongLowTexture != MapSet.EmptyLongName) textureLong = Sidedef.LongLowTexture; - } else if((sourceside.MiddleTexture.Length > 0) && (sourceside.MiddleTexture != "-")) { + } else if(sourceside.LongMiddleTexture != MapSet.EmptyLongName) { textureLong = sourceside.LongMiddleTexture; } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleBack.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleBack.cs index 413e76b4..52933fc1 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleBack.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleBack.cs @@ -75,12 +75,12 @@ namespace CodeImp.DoomBuilder.BuilderModes { //mxd. which texture we must use? long textureLong = 0; if ((sourceside.Line.Args[2] & (int)Effect3DFloor.Flags.UseUpperTexture) != 0) { - if (Sidedef.Other.HighTexture.Length > 0 && Sidedef.Other.HighTexture != "-") + if (Sidedef.Other.LongHighTexture != MapSet.EmptyLongName) textureLong = Sidedef.Other.LongHighTexture; } else if ((sourceside.Line.Args[2] & (int)Effect3DFloor.Flags.UseLowerTexture) != 0) { - if(Sidedef.Other.LowTexture.Length > 0 && Sidedef.Other.LowTexture != "-") + if(Sidedef.Other.LongLowTexture != MapSet.EmptyLongName) textureLong = Sidedef.Other.LongLowTexture; - } else if ((sourceside.MiddleTexture.Length > 0) && (sourceside.MiddleTexture != "-")) { + } else if ((sourceside.LongMiddleTexture != MapSet.EmptyLongName)) { textureLong = sourceside.LongMiddleTexture; } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs index ef203a49..f1d627a8 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs @@ -68,7 +68,7 @@ namespace CodeImp.DoomBuilder.BuilderModes public override bool Setup() { //mxd - if(Sidedef.MiddleTexture.Length == 0 || Sidedef.MiddleTexture == "-") return false; + if(Sidedef.LongMiddleTexture == MapSet.EmptyLongName) return false; Vector2D vl, vr; @@ -98,7 +98,7 @@ namespace CodeImp.DoomBuilder.BuilderModes if(!osd.Updated) osd.Update(); // Load texture - if ((Sidedef.MiddleTexture.Length > 0) && (Sidedef.MiddleTexture != "-")){ + if(Sidedef.LongMiddleTexture != MapSet.EmptyLongName) { base.Texture = General.Map.Data.GetTextureImage(Sidedef.LongMiddleTexture); if(base.Texture == null || base.Texture is UnknownImage) { base.Texture = General.Map.Data.UnknownTexture3D; diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs index 8ce0c87e..976ff571 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs @@ -89,7 +89,7 @@ namespace CodeImp.DoomBuilder.BuilderModes SectorData sd = mode.GetSectorData(Sidedef.Sector); // Texture given? - if((Sidedef.MiddleTexture.Length > 0) && (Sidedef.MiddleTexture != "-")) + if(Sidedef.LongMiddleTexture != MapSet.EmptyLongName) { // Load texture base.Texture = General.Map.Data.GetTextureImage(Sidedef.LongMiddleTexture); diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs index 5ab3cca6..39ee4bea 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs @@ -91,7 +91,7 @@ namespace CodeImp.DoomBuilder.BuilderModes if(!osd.Updated) osd.Update(); // Texture given? - if((Sidedef.HighTexture.Length > 0) && (Sidedef.HighTexture != "-")) + if((Sidedef.LongHighTexture != MapSet.EmptyLongName)) { // Load texture base.Texture = General.Map.Data.GetTextureImage(Sidedef.LongHighTexture); diff --git a/Source/Plugins/TagExplorer/NodeInfo.cs b/Source/Plugins/TagExplorer/NodeInfo.cs index fdea74fa..3b805795 100644 --- a/Source/Plugins/TagExplorer/NodeInfo.cs +++ b/Source/Plugins/TagExplorer/NodeInfo.cs @@ -141,7 +141,7 @@ namespace CodeImp.DoomBuilder.TagExplorer return combineName(comment.Length == 0 ? NodeInfoDefaultName.LINEDEF : comment, l.Tag, l.Action, l.Index, sortMode, isDefaultName); } - private string combineName(string name, int tag, int action, int index, string sortMode, bool isDefaultName) { + private static string combineName(string name, int tag, int action, int index, string sortMode, bool isDefaultName) { switch (sortMode) { case SortMode.SORT_BY_ACTION: return (tag > 0 ? "Tag:" + tag + "; " : "") + name + (isDefaultName ? " " + index : ""); diff --git a/Source/Plugins/VisplaneExplorer/Tile.cs b/Source/Plugins/VisplaneExplorer/Tile.cs index 162a72f6..12cdd78a 100644 --- a/Source/Plugins/VisplaneExplorer/Tile.cs +++ b/Source/Plugins/VisplaneExplorer/Tile.cs @@ -85,7 +85,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer } // This composes point values - private uint MakePointValue(uint vp, uint ds, uint ss, uint op) + private static uint MakePointValue(uint vp, uint ds, uint ss, uint op) { unchecked {