diff --git a/Source/Core/Actions/Action.cs b/Source/Core/Actions/Action.cs index 1807f096..00cd2439 100644 --- a/Source/Core/Actions/Action.cs +++ b/Source/Core/Actions/Action.cs @@ -29,29 +29,29 @@ namespace CodeImp.DoomBuilder.Actions #region ================== Variables // Description - private string name; - private string shortname; - private string title; - private string description; - private string category; + private readonly string name; + private readonly string shortname; + private readonly string title; + private readonly string description; + private readonly string category; // Shortcut key private int key; - private int keymask; - private int defaultkey; + private readonly int keymask; + private readonly int defaultkey; // Shortcut options - private bool allowkeys; - private bool allowmouse; - private bool allowscroll; - private bool disregardshift; - private bool disregardcontrol; - private bool disregardalt; //mxd - private bool repeat; + private readonly bool allowkeys; + private readonly bool allowmouse; + private readonly bool allowscroll; + private readonly bool disregardshift; + private readonly bool disregardcontrol; + private readonly bool disregardalt; //mxd + private readonly bool repeat; // Delegate - private List begindelegates; - private List enddelegates; + private readonly List begindelegates; + private readonly List enddelegates; #endregion @@ -114,12 +114,6 @@ namespace CodeImp.DoomBuilder.Actions this.key = key & keymask; } } - - // Destructor - ~Action() - { - // Moo. - } #endregion diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index 2bcb5002..3e2ee9bd 100644 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -376,6 +376,9 @@ namespace CodeImp.DoomBuilder.Data if(!textures.ContainsKey(t.Key)) { textures.Add(t.Key, t.Value); + + //mxd. Add both short and long names? + if(t.Value.HasLongName) texturenames.Add(t.Value.ShortName); texturenames.Add(t.Value.Name); } } @@ -384,11 +387,14 @@ namespace CodeImp.DoomBuilder.Data foreach(KeyValuePair f in flatsonly) { flats.Add(f.Key, f.Value); + + //mxd. Add both short and long names? + if(f.Value.HasLongName) flatnames.Add(f.Value.ShortName); flatnames.Add(f.Value.Name); } // Mixed textures and flats? - if (General.Map.Config.MixTexturesFlats) + if(General.Map.Config.MixTexturesFlats) { // Add textures to flats foreach(KeyValuePair t in texturesonly) @@ -396,6 +402,9 @@ namespace CodeImp.DoomBuilder.Data if(!flats.ContainsKey(t.Key)) { flats.Add(t.Key, t.Value); + + //mxd. Add both short and long names? + if(t.Value.HasLongName) flatnames.Add(t.Value.ShortName); flatnames.Add(t.Value.Name); } else if(t.Value is HighResImage || t.Value is SimpleTextureImage) //mxd. Textures defined in TEXTURES or placed between TX_START and TX_END markers override "regular" flats in ZDoom @@ -406,13 +415,8 @@ namespace CodeImp.DoomBuilder.Data } //mxd - foreach (KeyValuePair t in texturenamesshorttofull) - { - if (!flatnamesshorttofull.ContainsKey(t.Key)) - { - flatnamesshorttofull.Add(t.Key, t.Value); - } - } + foreach(KeyValuePair t in texturenamesshorttofull) + if(!flatnamesshorttofull.ContainsKey(t.Key)) flatnamesshorttofull.Add(t.Key, t.Value); // Add flats to textures foreach(KeyValuePair f in flatsonly) @@ -420,21 +424,19 @@ namespace CodeImp.DoomBuilder.Data if(!textures.ContainsKey(f.Key)) { textures.Add(f.Key, f.Value); + + //mxd. Add both short and long names? + if(f.Value.HasLongName) texturenames.Add(f.Value.ShortName); texturenames.Add(f.Value.Name); } } //mxd - foreach (KeyValuePair t in flatnamesshorttofull) - { - if (!texturenamesshorttofull.ContainsKey(t.Key)) - { - texturenamesshorttofull.Add(t.Key, t.Value); - } - } + foreach(KeyValuePair t in flatnamesshorttofull) + if(!texturenamesshorttofull.ContainsKey(t.Key)) texturenamesshorttofull.Add(t.Key, t.Value); // Do the same on the data readers - foreach (DataReader dr in containers) + foreach(DataReader dr in containers) dr.TextureSet.MixTexturesAndFlats(); } diff --git a/Source/Core/Data/FileImage.cs b/Source/Core/Data/FileImage.cs index 21cef949..1c551fc8 100644 --- a/Source/Core/Data/FileImage.cs +++ b/Source/Core/Data/FileImage.cs @@ -78,7 +78,7 @@ namespace CodeImp.DoomBuilder.Data internal FileImage(string name, string filepathname) { // Initialize - SetName(name, filepathname, true); + SetName(name, filepathname, true, true); probableformat = ImageDataFormat.DOOMPICTURE; @@ -93,16 +93,17 @@ namespace CodeImp.DoomBuilder.Data //mxd: name is relative path to the image ("\Textures\sometexture.png") //mxd: filepathname is absolute path to the image ("D:\Doom\MyCoolProject\Textures\sometexture.png") //mxd: also, zdoom uses '/' as directory separator char. + //mxd: and doesn't recognize long texture names in a root folder / pk3/7 root private void SetName(string name, string filepathname) { - SetName(name, filepathname, General.Map.Config.UseLongTextureNames); + SetName(name, filepathname, General.Map.Config.UseLongTextureNames, false); } - private void SetName(string name, string filepathname, bool uselongtexturenames) + private void SetName(string name, string filepathname, bool uselongtexturenames, bool forcelongtexturename) { name = name.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); - if(!uselongtexturenames) + if(!uselongtexturenames || (!forcelongtexturename && string.IsNullOrEmpty(Path.GetDirectoryName(name)))) { this.name = Path.GetFileNameWithoutExtension(name.ToUpperInvariant()); if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH) diff --git a/Source/Core/Data/PK3FileImage.cs b/Source/Core/Data/PK3FileImage.cs index d1d60f06..33718df3 100644 --- a/Source/Core/Data/PK3FileImage.cs +++ b/Source/Core/Data/PK3FileImage.cs @@ -68,7 +68,7 @@ namespace CodeImp.DoomBuilder.Data //mxd: filepathname is relative path to the image ("Textures\sometexture.png") protected override void SetName(string filepathname) { - if(!General.Map.Config.UseLongTextureNames) + if(!General.Map.Config.UseLongTextureNames || string.IsNullOrEmpty(Path.GetDirectoryName(filepathname))) { this.name = Path.GetFileNameWithoutExtension(filepathname.ToUpperInvariant()); if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH) diff --git a/Source/Core/Resources/Actions.cfg b/Source/Core/Resources/Actions.cfg index 69e52a1c..08bb9c97 100644 --- a/Source/Core/Resources/Actions.cfg +++ b/Source/Core/Resources/Actions.cfg @@ -421,9 +421,9 @@ griddec // Note, these were incorrectly swapped before, hence the wrong action title = "Grid Increase"; category = "edit"; description = "Increases the grid size, decreasing the grid density."; - unbind = 1; - mousebuttons = 0; - mousescroll = 1; + allowkeys = true; + allowmouse = true; + allowscroll = true; } @@ -432,9 +432,9 @@ gridinc // Note, these were incorrectly swapped before, hence the wrong action title = "Grid Decrease"; category = "edit"; description = "Decreases the grid size, increasing the grid density."; - unbind = 1; - mousebuttons = 0; - mousescroll = 1; + allowkeys = true; + allowmouse = true; + allowscroll = true; } undo diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs index 6cb9fc90..54c55e6c 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs @@ -315,7 +315,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Get correct offset to texture space... float zoffset; - int ox = (int)Math.Floor((u * Sidedef.Line.Length * UDMFTools.GetFloat(Sidedef.Fields, "scalex_mid", 1.0f) + Sidedef.OffsetX + UDMFTools.GetFloat(Sidedef.Fields, "offsetx_mid")) % Texture.Width); + int ox = (int)Math.Floor((u * Sidedef.Line.Length * UDMFTools.GetFloat(Sidedef.Fields, "scalex_mid", 1.0f) / Texture.Scale.x + Sidedef.OffsetX + UDMFTools.GetFloat(Sidedef.Fields, "offsetx_mid")) % Texture.Width); int oy; if(repeatmidtex) @@ -325,20 +325,20 @@ namespace CodeImp.DoomBuilder.BuilderModes else zoffset = Sidedef.Sector.CeilHeight; - oy = (int)Math.Floor(((pickintersect.z - zoffset) * UDMFTools.GetFloat(Sidedef.Fields, "scaley_mid", 1.0f) - Sidedef.OffsetY - UDMFTools.GetFloat(Sidedef.Fields, "offsety_mid")) % Texture.Height); + oy = (int)Math.Floor(((pickintersect.z - zoffset) * UDMFTools.GetFloat(Sidedef.Fields, "scaley_mid", 1.0f) / Texture.Scale.y - Sidedef.OffsetY - UDMFTools.GetFloat(Sidedef.Fields, "offsety_mid")) % Texture.Height); } else { zoffset = bottomclipplane.GetZ(pickintersect); - oy = (int)Math.Floor(((pickintersect.z - zoffset) * UDMFTools.GetFloat(Sidedef.Fields, "scaley_mid", 1.0f)) % Texture.Height); + oy = (int)Math.Ceiling(((pickintersect.z - zoffset) * UDMFTools.GetFloat(Sidedef.Fields, "scaley_mid", 1.0f) / Texture.Scale.y) % Texture.Height); } // Make sure offsets are inside of texture dimensions... - if(ox < 0) ox = Texture.Width + ox; - if(oy < 0) oy = Texture.Height + oy; + while(ox < 0) ox += Texture.Width; + while(oy < 0) oy += Texture.Height; // Check pixel alpha - if(Texture.GetBitmap().GetPixel(General.Clamp(ox, 0, Texture.Width - 1), General.Clamp(Texture.Height - oy - 1, 0, Texture.Height - 1)).A > 0) + if(Texture.GetBitmap().GetPixel(General.Clamp(ox, 0, Texture.Width - 1), General.Clamp(Texture.Height - oy, 0, Texture.Height - 1)).A > 0) { return base.PickAccurate(from, to, dir, ref u_ray); }