From db9de0d349417a1ef5d434cea76ef692645ce620 Mon Sep 17 00:00:00 2001 From: MaxED Date: Wed, 23 Mar 2016 14:52:33 +0000 Subject: [PATCH] Fixed: HiRes images should not be used on surfaces with long texture names. Changed, Draw Lines and Draw Curve modes: "Auto-finish drawing" option now works regardless of "Continuous drawing" option (previously it worked only when the latter was enabled). Changed: position and size of the "Errors and Warnings" window is now stored while the editor is running. Internal: rewritten parts of long texture names support code. It now involves much less special handling. Updated ZDoom_DECORATE.cfg (A_QuakeEx, A_CheckBlock). Updated ZDoom_ACS.cfg (QuakeEx). Updated ZDoom ACC (QuakeEx). --- Build/Compilers/ZDoom/zspecial.acs | 2 +- Build/Scripting/ZDoom_ACS.cfg | 2 +- Build/Scripting/ZDoom_DECORATE.cfg | 6 +- Source/Core/Data/DataManager.cs | 83 +++++++++- Source/Core/Data/HiResImage.cs | 4 +- Source/Core/Editing/CopyPasteManager.cs | 3 - Source/Core/Editing/GridSetup.cs | 22 +-- Source/Core/General/MapManager.cs | 18 --- Source/Core/Map/MapOptions.cs | 2 +- Source/Core/Map/MapSet.cs | 145 ------------------ Source/Core/Map/Sector.cs | 26 +--- Source/Core/Map/Sidedef.cs | 33 +--- Source/Core/Windows/ErrorsForm.cs | 22 ++- Source/Core/Windows/MainForm.cs | 6 +- .../ClassicModes/DrawGeometryMode.cs | 2 +- .../VisualModes/BaseVisualGeometrySector.cs | 9 +- .../VisualModes/BaseVisualGeometrySidedef.cs | 9 +- 17 files changed, 127 insertions(+), 267 deletions(-) diff --git a/Build/Compilers/ZDoom/zspecial.acs b/Build/Compilers/ZDoom/zspecial.acs index e9eaed55..2e0f1fad 100644 --- a/Build/Compilers/ZDoom/zspecial.acs +++ b/Build/Compilers/ZDoom/zspecial.acs @@ -358,7 +358,7 @@ special -88:SetActorRoll(2), -89:ChangeActorRoll(2,3), -90:GetActorRoll(1), - -91:QuakeEx(8,12), + -91:QuakeEx(8,14), -92:Warp(6,11), -93:GetMaxInventory(2), -94:SetSectorDamage(2,5), diff --git a/Build/Scripting/ZDoom_ACS.cfg b/Build/Scripting/ZDoom_ACS.cfg index 34292e7e..1eb032ab 100644 --- a/Build/Scripting/ZDoom_ACS.cfg +++ b/Build/Scripting/ZDoom_ACS.cfg @@ -309,7 +309,7 @@ keywords PolyWait = "void PolyWait(int polyid)"; Print = "void Print(type:expression)\nPrint will print something to the screen.\nPrint will only display for the activator of the script\nFor printing to all players, use PrintBold."; PrintBold = "void PrintBold(type:expression)\nThis is exactly the same as Print, except all players will see the printed text\non the screen instead of just the activator of the script."; - QuakeEx = "bool QuakeEx(int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, str sound[, int flags = 0[, float mulwavex = 1.0[, float mulwavey = 1.0[, float mulwavez = 1.0]]]])"; + QuakeEx = "bool QuakeEx(int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, str sound[, int flags = 0[, float mulwavex = 1.0[, float mulwavey = 1.0[, float mulwavez = 1.0[, int falloff = 0[, int highpoint = 0]]]]]])"; Radius_Quake = "Radius_Quake(intensity, duration, damrad, tremrad, tid)"; Radius_Quake2 = "void Radius_Quake2(int tid, int intensity, int duration, int damrad, int tremrad, str sound)"; Random = "int Random(int min, int max)"; diff --git a/Build/Scripting/ZDoom_DECORATE.cfg b/Build/Scripting/ZDoom_DECORATE.cfg index 6a71a471..9676ae92 100644 --- a/Build/Scripting/ZDoom_DECORATE.cfg +++ b/Build/Scripting/ZDoom_DECORATE.cfg @@ -162,7 +162,7 @@ keywords A_PlayerSkinCheck = "state A_PlayerSkinCheck(str state)"; A_SkullPop = "A_SkullPop[(str type = \"BloodySkull\")]"; A_Quake = "A_Quake(int intensity, int duration, int damageradius, int tremorradius[, str sound = \"world/quake\"])"; - A_QuakeEx = "A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad[, str sound = \"world/quake\"[, int flags = 0[, float mulwavex = 1.0[, float mulwavey = 1.0[, float mulwavez = 1.0]]]]])"; + A_QuakeEx = "A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad[, str sound = \"world/quake\"[, int flags = 0[, float mulwavex = 1.0[, float mulwavey = 1.0[, float mulwavez = 1.0[, int falloff = 0[, int highpoint = 0]]]]]]])"; //Spawn functions A_TossGib = "A_TossGib"; A_SpawnDebris = "A_SpawnDebris(str type[, bool translation = false[, float horizontal_vel = 1.0[, float vertical_vel = 1.0]]])"; @@ -170,7 +170,7 @@ keywords A_SpawnItemEx = "bool A_SpawnItemEx(str type[, float xoffset = 0.0[, float yoffset = 0.0[, float zoffset = 0.0[, float xvelocity = 0.0[, float yvelocity = 0.0[, float zvelocity = 0.0[, float angle = 0.0[, int flags = 0[, int skipchance = 0[, int tid = 0]]]]]]]]]])"; A_SpawnParticle = "A_SpawnParticle(color color[, int flags = 0[, int lifetime = 35[, int size = 1[, float angle = 0.0[, float xoff = 0.0[, float yoff = 0.0[, float zoff = 0.0[, float velx = 0.0[, float vely = 0.0[, float velz = 0.0[, float accelx = 0.0[, float accely = 0.0[, float accelz = 0.0[, float startalpha = 1.0[, float fadestep = -1.0]]]]]]]]]]]]]]])"; //State jumps - A_CheckBlock = "state A_CheckBlock(str block[, int flags = 0[, int pointer = AAPTR_TARGET]])"; + A_CheckBlock = "state A_CheckBlock(str block[, int flags = 0[, int pointer = AAPTR_TARGET[, float xoff = 0.0[, float yoff = 0.0[, float zoff = 0.0[, float angle = 0.0]]]]]])"; A_CheckCeiling = "state A_CheckCeiling(str state)\nstate A_CheckCeiling(int offset)"; A_CheckFloor = "state A_CheckFloor(str state)\nstate A_CheckFloor(int offset)"; A_CheckFlag = "state A_CheckFlag(str flagname, state label[, int check_pointer = AAPTR_DEFAULT])"; @@ -1084,6 +1084,8 @@ constants CBF_SETONPTR; CBF_DROPOFF; CBF_NOACTORS; + CBF_ABSOLUTEPOS; + CBF_ABSOLUTEANGLE; CHF_DONTMOVE; CHF_FASTCHASE; CHF_NIGHTMAREFAST; diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index 78b055a6..64dba501 100644 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -22,6 +22,7 @@ using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; +using System.Linq; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -49,6 +50,7 @@ namespace CodeImp.DoomBuilder.Data public int LumpIndex; // Text lump index if Resource is wad internal DataReader Resource; public HashSet Entries; // Actors/models/sounds etc. + public ScriptType ScriptType; public override string ToString() { @@ -81,6 +83,7 @@ namespace CodeImp.DoomBuilder.Data private List texturenames; private Dictionary flats; private Dictionary flatnamesshorttofull; //mxd + private Dictionary flatnamesfulltoshort; //mxd private List flatnames; private Dictionary sprites; private List texturesets; @@ -310,6 +313,7 @@ namespace CodeImp.DoomBuilder.Data flatnames = new List(); texturenamesshorttofull = new Dictionary(); //mxd flatnamesshorttofull = new Dictionary(); //mxd + flatnamesfulltoshort = new Dictionary(); //mxd imageque = new Queue(); previews = new PreviewManager(); texturesets = new List(); @@ -479,6 +483,9 @@ namespace CodeImp.DoomBuilder.Data foreach(KeyValuePair t in texturenamesshorttofull) if(!flatnamesshorttofull.ContainsKey(t.Key)) flatnamesshorttofull.Add(t.Key, t.Value); + //mxd + flatnamesfulltoshort = flatnamesshorttofull.ToDictionary(t => t.Value, t => t.Key); //flatnamesshorttofull.ToDictionary(kp => kp.Value, kp => kp.Key); + // Add flats to textures foreach(KeyValuePair f in flatsonly) { @@ -1336,6 +1343,12 @@ namespace CodeImp.DoomBuilder.Data return hash; //TEXTURES and HiRes flats should still override regular ones... return (General.Map.Config.UseLongTextureNames && flatnamesshorttofull.ContainsKey(hash) ? flatnamesshorttofull[hash] : hash); } + + //mxd + internal long GetShortLongFlatName(long hash) + { + return (flatnamesfulltoshort.ContainsKey(hash) ? flatnamesfulltoshort[hash] : hash); + } #endregion @@ -1366,7 +1379,7 @@ namespace CodeImp.DoomBuilder.Data { HiResImage replacer = new HiResImage(img); replacer.ApplySettings(textures[hash]); - textures[hash] = replacer; + textures[img.LongName] = replacer; //replaced = true; // Add to preview manager @@ -1380,7 +1393,7 @@ namespace CodeImp.DoomBuilder.Data { HiResImage replacer = new HiResImage(img); replacer.ApplySettings(flats[hash]); - flats[hash] = replacer; + flats[img.LongName] = replacer; //replaced = true; // Add to preview manager @@ -2594,9 +2607,30 @@ namespace CodeImp.DoomBuilder.Data foreach(Sidedef sd in General.Map.Map.Sidedefs) { // Add used textures to dictionary - if(sd.LongHighTexture != MapSet.EmptyLongName) usedtextures[sd.LongHighTexture] = true; - if(sd.LongMiddleTexture != MapSet.EmptyLongName) usedtextures[sd.LongMiddleTexture] = true; - if(sd.LongLowTexture != MapSet.EmptyLongName) usedtextures[sd.LongLowTexture] = true; + if(sd.LongHighTexture != MapSet.EmptyLongName) + { + usedtextures[sd.LongHighTexture] = true; + + //mxd. Part of long name support shennanigans + if(texturenamesshorttofull.ContainsKey(sd.LongHighTexture)) + usedtextures[texturenamesshorttofull[sd.LongHighTexture]] = true; + } + if(sd.LongMiddleTexture != MapSet.EmptyLongName) + { + usedtextures[sd.LongMiddleTexture] = true; + + //mxd. Part of long name support shennanigans + if(texturenamesshorttofull.ContainsKey(sd.LongMiddleTexture)) + usedtextures[texturenamesshorttofull[sd.LongMiddleTexture]] = true; + } + if(sd.LongLowTexture != MapSet.EmptyLongName) + { + usedtextures[sd.LongLowTexture] = true; + + //mxd. Part of long name support shennanigans + if(texturenamesshorttofull.ContainsKey(sd.LongLowTexture)) + usedtextures[texturenamesshorttofull[sd.LongLowTexture]] = true; + } } // Go through the map to find the used flats @@ -2605,6 +2639,12 @@ namespace CodeImp.DoomBuilder.Data // Add used flats to dictionary usedtextures[s.LongFloorTexture] = false; usedtextures[s.LongCeilTexture] = false; + + //mxd. Part of long name support shennanigans + if(flatnamesshorttofull.ContainsKey(s.LongFloorTexture)) + usedtextures[flatnamesshorttofull[s.LongFloorTexture]] = false; + if(flatnamesshorttofull.ContainsKey(s.LongCeilTexture)) + usedtextures[flatnamesshorttofull[s.LongCeilTexture]] = false; } } } @@ -2619,9 +2659,30 @@ namespace CodeImp.DoomBuilder.Data foreach(Sidedef sd in General.Map.Map.Sidedefs) { // Add used textures to dictionary - if(sd.LongHighTexture != MapSet.EmptyLongName) usedtextures[sd.LongHighTexture] = true; - if(sd.LongMiddleTexture != MapSet.EmptyLongName) usedtextures[sd.LongMiddleTexture] = true; - if(sd.LongLowTexture != MapSet.EmptyLongName) usedtextures[sd.LongLowTexture] = true; + if(sd.LongHighTexture != MapSet.EmptyLongName) + { + usedtextures[sd.LongHighTexture] = true; + + //mxd. Part of long name support shennanigans + if(texturenamesshorttofull.ContainsKey(sd.LongHighTexture)) + usedtextures[texturenamesshorttofull[sd.LongHighTexture]] = true; + } + if(sd.LongMiddleTexture != MapSet.EmptyLongName) + { + usedtextures[sd.LongMiddleTexture] = true; + + //mxd. Part of long name support shennanigans + if(texturenamesshorttofull.ContainsKey(sd.LongMiddleTexture)) + usedtextures[texturenamesshorttofull[sd.LongMiddleTexture]] = true; + } + if(sd.LongLowTexture != MapSet.EmptyLongName) + { + usedtextures[sd.LongLowTexture] = true; + + //mxd. Part of long name support shennanigans + if(texturenamesshorttofull.ContainsKey(sd.LongLowTexture)) + usedtextures[texturenamesshorttofull[sd.LongLowTexture]] = true; + } } } @@ -2635,6 +2696,12 @@ namespace CodeImp.DoomBuilder.Data // Add used flats to dictionary usedflats[s.LongFloorTexture] = false; usedflats[s.LongCeilTexture] = false; + + //mxd. Part of long name support shennanigans + if(flatnamesshorttofull.ContainsKey(s.LongFloorTexture)) + usedflats[flatnamesshorttofull[s.LongFloorTexture]] = false; + if(flatnamesshorttofull.ContainsKey(s.LongCeilTexture)) + usedflats[flatnamesshorttofull[s.LongCeilTexture]] = false; } } } diff --git a/Source/Core/Data/HiResImage.cs b/Source/Core/Data/HiResImage.cs index c3c3d75e..5f960b59 100644 --- a/Source/Core/Data/HiResImage.cs +++ b/Source/Core/Data/HiResImage.cs @@ -87,13 +87,13 @@ namespace CodeImp.DoomBuilder.Data internal void ApplySettings(ImageData overridden) { - // Copy all the names... + // Copy relevant names... name = overridden.Name; virtualname = overridden.VirtualName; displayname = overridden.DisplayName; - longname = overridden.LongName; isFlat = overridden.IsFlat; + hasLongName = overridden.HasLongName; overridesettingsapplied = true; if(!overridden.IsImageLoaded) overridden.LoadImage(); diff --git a/Source/Core/Editing/CopyPasteManager.cs b/Source/Core/Editing/CopyPasteManager.cs index e044b286..af5a1665 100644 --- a/Source/Core/Editing/CopyPasteManager.cs +++ b/Source/Core/Editing/CopyPasteManager.cs @@ -328,9 +328,6 @@ namespace CodeImp.DoomBuilder.Editing // Convert UDMF fields back to flags and activations, if needed if(!(General.Map.FormatInterface is UniversalMapSetIO)) General.Map.Map.TranslateFromUDMF(); - //mxd. Translate texture names - General.Map.Map.TranslateTextureNames(General.Map.Config.UseLongTextureNames, true); - // Modify tags and actions if preferred if(options.ChangeTags == PasteOptions.TAGS_REMOVE) Tools.RemoveMarkedTags(); if(options.ChangeTags == PasteOptions.TAGS_RENUMBER) Tools.RenumberMarkedTags(); diff --git a/Source/Core/Editing/GridSetup.cs b/Source/Core/Editing/GridSetup.cs index b152acf2..977b55ab 100644 --- a/Source/Core/Editing/GridSetup.cs +++ b/Source/Core/Editing/GridSetup.cs @@ -131,7 +131,7 @@ namespace CodeImp.DoomBuilder.Editing } // Read settings from configuration - internal void ReadFromConfig(Configuration cfg, string path, bool uselongtexturenames) + internal void ReadFromConfig(Configuration cfg, string path) { // Read settings background = cfg.ReadSetting(path + ".background", ""); @@ -142,9 +142,6 @@ namespace CodeImp.DoomBuilder.Editing backscaley = cfg.ReadSetting(path + ".backscaley", 100) / 100.0f; gridsize = cfg.ReadSetting(path + ".gridsize", DEFAULT_GRID_SIZE); - //mxd. Translate background name? - TranslateBackgroundName(uselongtexturenames); - // Setup SetGridSize(gridsize); LinkBackground(); @@ -177,23 +174,6 @@ namespace CodeImp.DoomBuilder.Editing LinkBackground(); } - //mxd - internal void TranslateBackgroundName(bool uselongtexturenames) - { - if(string.IsNullOrEmpty(background)) return; - - switch(backsource) - { - case SOURCE_TEXTURES: - background = (uselongtexturenames ? General.Map.Data.GetFullTextureName(background) : MapSet.GetShortTextureName(background)); - break; - - case SOURCE_FLATS: - background = (uselongtexturenames ? General.Map.Data.GetFullFlatName(background) : MapSet.GetShortTextureName(background)); - break; - } - } - // This sets the background view internal void SetBackgroundView(int offsetx, int offsety, float scalex, float scaley) { diff --git a/Source/Core/General/MapManager.cs b/Source/Core/General/MapManager.cs index 28b93b5e..19649ebe 100644 --- a/Source/Core/General/MapManager.cs +++ b/Source/Core/General/MapManager.cs @@ -417,13 +417,6 @@ namespace CodeImp.DoomBuilder // Remove unused sectors map.RemoveUnusedSectors(true); - //mxd. Translate to long or short texture names. - bool nameschanged = map.TranslateTextureNames(config.UseLongTextureNames, false); - grid.TranslateBackgroundName(config.UseLongTextureNames); - - //mxd. Sector textures may've been changed - if(nameschanged) data.UpdateUsedTextures(); - // Update structures options.ApplyGridSettings(); map.UpdateConfiguration(); @@ -514,10 +507,6 @@ namespace CodeImp.DoomBuilder // And switch to it ChangeMapSet(newmap); - // Translate texture names - map.TranslateTextureNames(config.UseLongTextureNames, false); - grid.TranslateBackgroundName(config.UseLongTextureNames); - // Sector textures may've been changed data.UpdateUsedTextures(); @@ -2501,13 +2490,6 @@ namespace CodeImp.DoomBuilder General.MainWindow.UpdateLinedefColorPresets(); //mxd General.MainWindow.UpdateInterface(); - //mxd. Translate texture names - bool nameschanged = map.TranslateTextureNames(config.UseLongTextureNames, false); - grid.TranslateBackgroundName(config.UseLongTextureNames); - - //mxd. Sector textures may've been changed - if(nameschanged) data.UpdateUsedTextures(); - // Done General.MainWindow.DisplayReady(); General.MainWindow.RedrawDisplay(); //mxd diff --git a/Source/Core/Map/MapOptions.cs b/Source/Core/Map/MapOptions.cs index 0ae376f8..51294b24 100644 --- a/Source/Core/Map/MapOptions.cs +++ b/Source/Core/Map/MapOptions.cs @@ -569,7 +569,7 @@ namespace CodeImp.DoomBuilder.Map // This loads the grid settings internal void ApplyGridSettings() { - General.Map.Grid.ReadFromConfig(mapconfig, "grid", General.Map.Config.UseLongTextureNames); + General.Map.Grid.ReadFromConfig(mapconfig, "grid"); } //mxd. This reads stored selection groups from the map configuration diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index 69afdbac..2916ef2d 100644 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -3265,151 +3265,6 @@ namespace CodeImp.DoomBuilder.Map foreach(Thing t in things) if(t.Marked) t.TranslateFromUDMF(); } - //mxd - internal bool TranslateTextureNames(bool uselongnames, bool markedonly) - { - if(markedonly) - { - List markedsectors = GetMarkedSectors(true); - List markedsides = GetMarkedSidedefs(true); - if(uselongnames) return TranslateToLongTextureNames(markedsectors, markedsides); - return TranslateToShortTextureNames(markedsectors, markedsides); - } - else - { - if(uselongnames) return TranslateToLongTextureNames(sectors, sidedefs); - return TranslateToShortTextureNames(sectors, sidedefs); - } - } - - //mxd - private static bool TranslateToLongTextureNames(IEnumerable sectors, IEnumerable sidedefs) - { - bool changed = false; - - foreach(Sector s in sectors) - { - if(s.FloorTexture != "-") - { - string ft = General.Map.Data.GetFullFlatName(s.FloorTexture); - if(ft != s.FloorTexture) - { - s.SetFloorTexture(Lump.MakeLongName(ft)); - changed = true; - } - } - if(s.CeilTexture != "-") - { - string ct = General.Map.Data.GetFullFlatName(s.CeilTexture); - if(ct != s.CeilTexture) - { - s.SetCeilTexture(Lump.MakeLongName(ct)); - changed = true; - } - } - } - - foreach(Sidedef s in sidedefs) - { - if(s.HighTexture != "-") - { - string ht = General.Map.Data.GetFullTextureName(s.HighTexture); - if(ht != s.HighTexture) - { - s.SetTextureHigh(Lump.MakeLongName(ht)); - changed = true; - } - } - if(s.MiddleTexture != "-") - { - string mt = General.Map.Data.GetFullTextureName(s.MiddleTexture); - if(mt != s.MiddleTexture) - { - s.SetTextureMid(Lump.MakeLongName(mt)); - changed = true; - } - } - if(s.LowTexture != "-") - { - string lt = General.Map.Data.GetFullTextureName(s.LowTexture); - if(lt != s.LowTexture) - { - s.SetTextureLow(Lump.MakeLongName(lt)); - changed = true; - } - } - } - - return changed; - } - - private static bool TranslateToShortTextureNames(IEnumerable sectors, IEnumerable sidedefs) - { - bool changed = false; - - foreach(Sector s in sectors) - { - if(s.FloorTexture != "-") - { - string ft = GetShortTextureName(s.FloorTexture); - if(ft != s.FloorTexture) - { - s.SetFloorTexture(ft); - changed = true; - } - } - if(s.CeilTexture != "-") - { - string ct = GetShortTextureName(s.CeilTexture); - if(ct != s.CeilTexture) - { - s.SetCeilTexture(ct); - changed = true; - } - } - } - - foreach(Sidedef s in sidedefs) - { - if(s.HighTexture != "-") - { - string ht = GetShortTextureName(s.HighTexture); - if(ht != s.HighTexture) - { - s.SetTextureHigh(ht); - changed = true; - } - } - if(s.MiddleTexture != "-") - { - string mt = GetShortTextureName(s.MiddleTexture); - if(mt != s.MiddleTexture) - { - s.SetTextureMid(mt); - changed = true; - } - } - if(s.LowTexture != "-") - { - string lt = GetShortTextureName(s.LowTexture); - if(lt != s.LowTexture) - { - s.SetTextureLow(lt); - changed = true; - } - } - } - - return changed; - } - - internal static string GetShortTextureName(string name) - { - string shortname = Path.GetFileNameWithoutExtension(name).ToUpperInvariant(); - if(shortname.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH) shortname = shortname.Substring(0, DataManager.CLASIC_IMAGE_NAME_LENGTH); - return shortname; - } - /// This removes unused vertices. public void RemoveUnusedVertices() { diff --git a/Source/Core/Map/Sector.cs b/Source/Core/Map/Sector.cs index 512b6e11..f11c7eec 100644 --- a/Source/Core/Map/Sector.cs +++ b/Source/Core/Map/Sector.cs @@ -812,8 +812,6 @@ namespace CodeImp.DoomBuilder.Map // Apply changes this.floorheight = hfloor; this.ceilheight = hceil; - //SetFloorTexture(tfloor); - //SetCeilTexture(tceil); this.effect = effect; this.tags = new List(tags); //mxd this.flags = new Dictionary(flags); //mxd @@ -845,7 +843,7 @@ namespace CodeImp.DoomBuilder.Map if(string.IsNullOrEmpty(name)) name = "-"; //mxd floortexname = name; - longfloortexname = General.Map.Data.GetFullLongFlatName(Lump.MakeLongName(name)); //mxd + longfloortexname = Lump.MakeLongName(name); updateneeded = true; General.Map.IsChanged = true; } @@ -857,27 +855,7 @@ namespace CodeImp.DoomBuilder.Map if(string.IsNullOrEmpty(name)) name = "-"; //mxd ceiltexname = name; - longceiltexname = General.Map.Data.GetFullLongFlatName(Lump.MakeLongName(name)); //mxd - updateneeded = true; - General.Map.IsChanged = true; - } - - //mxd. This sets texture lookup - internal void SetFloorTexture(long hash) - { - BeforePropsChange(); - - longfloortexname = hash; - updateneeded = true; - General.Map.IsChanged = true; - } - - //mxd. This sets texture lookup - internal void SetCeilTexture(long hash) - { - BeforePropsChange(); - - longceiltexname = hash; + longceiltexname = Lump.MakeLongName(name); updateneeded = true; General.Map.IsChanged = true; } diff --git a/Source/Core/Map/Sidedef.cs b/Source/Core/Map/Sidedef.cs index aafb98ee..cc24717a 100644 --- a/Source/Core/Map/Sidedef.cs +++ b/Source/Core/Map/Sidedef.cs @@ -679,7 +679,7 @@ namespace CodeImp.DoomBuilder.Map BeforePropsChange(); texnamehigh = string.IsNullOrEmpty(name) ? "-" : name; //mxd - longtexnamehigh = General.Map.Data.GetFullLongTextureName(Lump.MakeLongName(name)); //mxd + longtexnamehigh = Lump.MakeLongName(name); General.Map.IsChanged = true; } @@ -689,7 +689,7 @@ namespace CodeImp.DoomBuilder.Map BeforePropsChange(); texnamemid = string.IsNullOrEmpty(name) ? "-" : name; //mxd; - longtexnamemid = General.Map.Data.GetFullLongTextureName(Lump.MakeLongName(name)); //mxd + longtexnamemid = Lump.MakeLongName(name); General.Map.IsChanged = true; } @@ -699,34 +699,7 @@ namespace CodeImp.DoomBuilder.Map BeforePropsChange(); texnamelow = string.IsNullOrEmpty(name) ? "-" : name; //mxd; - longtexnamelow = General.Map.Data.GetFullLongTextureName(Lump.MakeLongName(name)); //mxd - General.Map.IsChanged = true; - } - - //mxd. This sets texture lookup - public void SetTextureHigh(long hash) - { - BeforePropsChange(); - - longtexnamehigh = hash; - General.Map.IsChanged = true; - } - - //mxd. This sets texture lookup - public void SetTextureMid(long hash) - { - BeforePropsChange(); - - longtexnamemid = hash; - General.Map.IsChanged = true; - } - - //mxd. This sets texture lookup - public void SetTextureLow(long hash) - { - BeforePropsChange(); - - longtexnamelow = hash; + longtexnamelow = Lump.MakeLongName(name); General.Map.IsChanged = true; } diff --git a/Source/Core/Windows/ErrorsForm.cs b/Source/Core/Windows/ErrorsForm.cs index 2114729c..c2e88402 100644 --- a/Source/Core/Windows/ErrorsForm.cs +++ b/Source/Core/Windows/ErrorsForm.cs @@ -31,6 +31,10 @@ namespace CodeImp.DoomBuilder.Windows { #region ================== Variables + //mxd. Window setup stuff + private static Point location = Point.Empty; + private static Size size = Size.Empty; + #endregion #region ================== Constructor / Disposer @@ -39,6 +43,15 @@ namespace CodeImp.DoomBuilder.Windows public ErrorsForm() { InitializeComponent(); + + //mxd. Apply window settings + if(location != Point.Empty) + { + this.StartPosition = FormStartPosition.Manual; + this.Location = location; + } + if(size != Size.Empty) this.Size = size; + FillList(); checkerrors.Start(); checkshow.Checked = General.Settings.ShowErrorsWindow; @@ -86,16 +99,17 @@ namespace CodeImp.DoomBuilder.Windows { checkerrors.Stop(); General.Settings.ShowErrorsWindow = checkshow.Checked; + + //mxd. Save window settings + location = this.Location; + size = this.Size; } // Checking for more errors private void checkerrors_Tick(object sender, EventArgs e) { // If errors have been added, update the list - if(General.ErrorLogger.HasChanged) - { - FillList(); - } + if(General.ErrorLogger.HasChanged) FillList(); } // This clears all errors diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index f759e070..b7f03088 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -4015,17 +4015,19 @@ namespace CodeImp.DoomBuilder.Windows { // Go for all setors bool updated = false; + long imgshorthash = General.Map.Data.GetShortLongFlatName(img.LongName); //mxd. Part of long name support shennanigans + foreach(Sector s in General.Map.Map.Sectors) { // Update floor buffer if needed - if(s.LongFloorTexture == img.LongName) + if(s.LongFloorTexture == img.LongName || s.LongFloorTexture == imgshorthash) { s.UpdateFloorSurface(); updated = true; } // Update ceiling buffer if needed - if(s.LongCeilTexture == img.LongName) + if(s.LongCeilTexture == img.LongName || s.LongCeilTexture == imgshorthash) { s.UpdateCeilingSurface(); updated = true; diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs index a4f81918..e42128c8 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs @@ -454,7 +454,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } //mxd. Points and existing geometry form a closed shape? - if(continuousdrawing && autoclosedrawing) + if(autoclosedrawing) { // Determive center point float minx = float.MaxValue; diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs index 7be0dd6b..279d748a 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.IO; using System.Windows.Forms; using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.IO; @@ -769,8 +770,12 @@ namespace CodeImp.DoomBuilder.BuilderModes // Copy texture public virtual void OnCopyTexture() { - //mxd. When UseLongTextureNames is disabled, use texture name as stored in Sidedef, otherwise use full name. - string texturename = ((General.Map.Options.UseLongTextureNames && Texture != null && Texture.UsedInMap) ? Texture.Name : GetTextureName()); + //mxd. When UseLongTextureNames is enabled and the image filename is longer than 8 chars, use full name, + // otherwise use texture name as stored in Sector + string texturename = ((General.Map.Options.UseLongTextureNames && Texture != null && Texture.UsedInMap + && Path.GetFileNameWithoutExtension(Texture.Name).Length > DataManager.CLASIC_IMAGE_NAME_LENGTH) + ? Texture.Name : GetTextureName()); + BuilderPlug.Me.CopiedFlat = texturename; if(General.Map.Config.MixTexturesFlats) BuilderPlug.Me.CopiedTexture = texturename; mode.SetActionResult("Copied flat \"" + texturename + "\"."); diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index 8af4ca05..706ec0e5 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Globalization; +using System.IO; using System.Windows.Forms; using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Geometry; @@ -1133,8 +1134,12 @@ namespace CodeImp.DoomBuilder.BuilderModes // Copy texture public virtual void OnCopyTexture() { - //mxd. When UseLongTextureNames is disabled, use texture name as stored in Sidedef, otherwise use full name. - string texturename = ((General.Map.Options.UseLongTextureNames && Texture != null && Texture.UsedInMap) ? Texture.Name : GetTextureName()); + //mxd. When UseLongTextureNames is enabled and the image filename is longer than 8 chars, use full name, + // otherwise use texture name as stored in Sidedef + string texturename = ((General.Map.Options.UseLongTextureNames && Texture != null && Texture.UsedInMap + && Path.GetFileNameWithoutExtension(Texture.Name).Length > DataManager.CLASIC_IMAGE_NAME_LENGTH) + ? Texture.Name : GetTextureName()); + BuilderPlug.Me.CopiedTexture = texturename; if(General.Map.Config.MixTexturesFlats) BuilderPlug.Me.CopiedFlat = texturename; mode.SetActionResult("Copied texture \"" + texturename + "\".");