diff --git a/Build/Configurations/Includes/Boom_common.cfg b/Build/Configurations/Includes/Boom_common.cfg index 7f2e7d3f9b92603fb6d358bceff259ee1b862568..2f3151886caf46900359ea15786d1e2797a630cb 100644 --- a/Build/Configurations/Includes/Boom_common.cfg +++ b/Build/Configurations/Includes/Boom_common.cfg @@ -51,8 +51,8 @@ mapformat_doom include("Doom_sectors.cfg"); } - // LINEDEF FLAGS - linedefflags + // LINEDEF FLAGS + linedefflags { include("Doom_misc.cfg", "linedefflags"); include("Boom_misc.cfg", "linedefflags"); @@ -93,6 +93,11 @@ mapformat_doom { include("Doom_misc.cfg", "thingflagstranslation"); include("Boom_misc.cfg", "thingflagstranslation"); + } + // How to compare thing flags (for the stuck things error checker) + thingflagscompare + { + include("Doom_misc.cfg", "thingflagscompare"); } // Things flags masks diff --git a/Build/Configurations/Includes/Doom_common.cfg b/Build/Configurations/Includes/Doom_common.cfg index b4771e91c6ce80705fe5d7da7c1ba856b5110f1d..527c9d9c4d1d102234fb63fc03538b1daeceac7a 100644 --- a/Build/Configurations/Includes/Doom_common.cfg +++ b/Build/Configurations/Includes/Doom_common.cfg @@ -121,6 +121,12 @@ mapformat_doom { include("Doom_misc.cfg", "thingflagstranslation"); } + + // How to compare thing flags (for the stuck things error checker) + thingflagscompare + { + include("Doom_misc.cfg", "thingflagscompare"); + } // Things flags masks include("Doom_misc.cfg", "thingflagsmasks"); diff --git a/Build/Configurations/Includes/Game_Doom.cfg b/Build/Configurations/Includes/Game_Doom.cfg index 6eb4d3419669ebc47f1de7cf6976af41e92c8cb5..42861f752731a46d50956d96e5d463e2480feff1 100644 --- a/Build/Configurations/Includes/Game_Doom.cfg +++ b/Build/Configurations/Includes/Game_Doom.cfg @@ -21,12 +21,6 @@ { include("Doom_misc.cfg", "thingsfilters"); }*/ - - // How to compare thing flags (for the stuck things error checker) - thingflagscompare - { - include("Doom_misc.cfg", "thingflagscompare"); - } // Default texture sets // (these are not required, but useful for new users) diff --git a/Build/Configurations/Includes/Game_Heretic.cfg b/Build/Configurations/Includes/Game_Heretic.cfg index a099bdb2cff1fbcf595a68aa5c6235eecb0f3c8b..2d51cbac3c0a58888dbc6d267b5769d560008b94 100644 --- a/Build/Configurations/Includes/Game_Heretic.cfg +++ b/Build/Configurations/Includes/Game_Heretic.cfg @@ -21,12 +21,6 @@ include("Doom_misc.cfg", "thingsfilters"); }*/ - // How to compare thing flags (for the stuck things error checker) - thingflagscompare - { - include("Hexen_misc.cfg", "thingflagscompare"); - } - // Default texture sets // (these are not required, but useful for new users) texturesets diff --git a/Build/Configurations/Includes/Game_Hexen.cfg b/Build/Configurations/Includes/Game_Hexen.cfg index 15903f685837f282685b29da8f41516523c2cd90..768274424df142156652d0c0ea047c244c4f44e5 100644 --- a/Build/Configurations/Includes/Game_Hexen.cfg +++ b/Build/Configurations/Includes/Game_Hexen.cfg @@ -23,12 +23,6 @@ include("Hexen_misc.cfg", "thingsfilters"); } */ - // How to compare thing flags (for the stuck things error checker) - thingflagscompare - { - include("Hexen_misc.cfg", "thingflagscompare"); - } - // Default texture sets // (these are not required, but useful for new users) texturesets diff --git a/Build/Configurations/Includes/Game_Strife.cfg b/Build/Configurations/Includes/Game_Strife.cfg index c0d98a6ec3b39300749b3a366b2127dd085284e7..5fccb6740745ad86cd694a9ea2f6504b4e9e9506 100644 --- a/Build/Configurations/Includes/Game_Strife.cfg +++ b/Build/Configurations/Includes/Game_Strife.cfg @@ -21,12 +21,6 @@ { include("Strife_misc.cfg", "thingsfilters"); }*/ - - // How to compare thing flags (for the stuck things error checker) - thingflagscompare - { - include("Doom_misc.cfg", "thingflagscompare"); - } // Default texture sets // (these are not required, but useful for new users) diff --git a/Build/Configurations/Includes/ZDoom_common.cfg b/Build/Configurations/Includes/ZDoom_common.cfg index a01152232d59132dddecba71e91c9985de32bbbb..9c345b02a5e24323068351a79f73c798825ea9aa 100644 --- a/Build/Configurations/Includes/ZDoom_common.cfg +++ b/Build/Configurations/Includes/ZDoom_common.cfg @@ -170,6 +170,12 @@ mapformat_doom include("Doom_misc.cfg", "thingflagstranslation"); include("Boom_misc.cfg", "thingflagstranslation"); } + + // How to compare thing flags (for the stuck things error checker) + thingflagscompare + { + include("Doom_misc.cfg", "thingflagscompare"); + } // Things flags masks include("Doom_misc.cfg", "thingflagsmasks"); @@ -281,6 +287,12 @@ mapformat_hexen include("Hexen_misc.cfg", "thingflagstranslation"); include("ZDoom_misc.cfg", "thingflagstranslation"); } + + // How to compare thing flags (for the stuck things error checker) + thingflagscompare + { + include("Hexen_misc.cfg", "thingflagscompare"); + } // Things flags masks include("Hexen_misc.cfg", "thingflagsmasks"); diff --git a/Build/Configurations/Other Games/Action Doom/Includes/Game_Action2.cfg b/Build/Configurations/Other Games/Action Doom/Includes/Game_Action2.cfg index afafc874c804fbf5ad6a2db97a0204e7d3c1d88c..7f57b3f2abcc8d17232f3f109fd288a1e6002556 100644 --- a/Build/Configurations/Other Games/Action Doom/Includes/Game_Action2.cfg +++ b/Build/Configurations/Other Games/Action Doom/Includes/Game_Action2.cfg @@ -20,11 +20,6 @@ include("Doom_misc.cfg", "thingsfilters"); }*/ - // How to compare thing flags (for the stuck things error checker) - thingflagscompare - { - include("Doom_misc.cfg", "thingflagscompare"); - } // Default texture sets // (these are not required, but useful for new users) diff --git a/Build/Configurations/Other Games/Chex Quest 3/Includes/Game_Chex3.cfg b/Build/Configurations/Other Games/Chex Quest 3/Includes/Game_Chex3.cfg index a7a238d3104fa72627582bfa2edd21f598bfbb43..c3b3ccd10de856c486787ee1d3e0c6b8eb0089c8 100644 --- a/Build/Configurations/Other Games/Chex Quest 3/Includes/Game_Chex3.cfg +++ b/Build/Configurations/Other Games/Chex Quest 3/Includes/Game_Chex3.cfg @@ -19,12 +19,6 @@ { include("Doom_misc.cfg", "thingsfilters"); }*/ - - // How to compare thing flags (for the stuck things error checker) - thingflagscompare - { - include("Doom_misc.cfg", "thingflagscompare"); - } // Default texture sets // (these are not required, but useful for new users) diff --git a/Build/Configurations/Other Games/Chex Quest/Game_Chex.cfg b/Build/Configurations/Other Games/Chex Quest/Game_Chex.cfg index 2cf9ad094123e60baf3d69d0d91eeec7b492f594..23f3e285c70a30ed9bcb4a218c0bab895dd417ae 100644 --- a/Build/Configurations/Other Games/Chex Quest/Game_Chex.cfg +++ b/Build/Configurations/Other Games/Chex Quest/Game_Chex.cfg @@ -19,12 +19,6 @@ { include("Doom_misc.cfg", "thingsfilters"); }*/ - - // How to compare thing flags (for the stuck things error checker) - thingflagscompare - { - include("Doom_misc.cfg", "thingflagscompare"); - } // Default texture sets // (these are not required, but useful for new users) diff --git a/Build/Configurations/Other Games/Harmony/Includes/Game_Harmony.cfg b/Build/Configurations/Other Games/Harmony/Includes/Game_Harmony.cfg index 578eebbd0e19e9a8d41d7316642e155c5b2130cd..d6a38d2712250dd0996fe42f634082f210703bab 100644 --- a/Build/Configurations/Other Games/Harmony/Includes/Game_Harmony.cfg +++ b/Build/Configurations/Other Games/Harmony/Includes/Game_Harmony.cfg @@ -19,12 +19,6 @@ { include("Doom_misc.cfg", "thingsfilters"); }*/ - - // How to compare thing flags (for the stuck things error checker) - thingflagscompare - { - include("Doom_misc.cfg", "thingflagscompare"); - } // Default texture sets // (these are not required, but useful for new users) diff --git a/Source/Core/Config/GameConfiguration.cs b/Source/Core/Config/GameConfiguration.cs index d8785bdd5c55eee0f1256de4068def91fe936b76..ce324935d1da63f4de58929eb550270ae33691c4 100644 --- a/Source/Core/Config/GameConfiguration.cs +++ b/Source/Core/Config/GameConfiguration.cs @@ -100,7 +100,7 @@ namespace CodeImp.DoomBuilder.Config private readonly List<ThingCategory> thingcategories; private readonly Dictionary<int, ThingTypeInfo> things; private readonly List<FlagTranslation> thingflagstranslation; - private readonly List<ThingFlagsCompare> thingflagscompare; + private readonly Dictionary<string, Dictionary<string, ThingFlagsCompare>> thingflagscompare; //mxd private readonly Dictionary<string, string> thingrenderstyles; //mxd // Linedefs @@ -203,7 +203,7 @@ namespace CodeImp.DoomBuilder.Config public ICollection<string> DefaultThingFlags { get { return defaultthingflags; } } public IDictionary<string, string> ThingFlags { get { return thingflags; } } public List<FlagTranslation> ThingFlagsTranslation { get { return thingflagstranslation; } } - public List<ThingFlagsCompare> ThingFlagsCompare { get { return thingflagscompare; } } + public Dictionary<string, Dictionary<string, ThingFlagsCompare>> ThingFlagsCompare { get { return thingflagscompare; } } //mxd public Dictionary<string, string> ThingRenderStyles { get { return thingrenderstyles; } } //mxd // Linedefs @@ -278,7 +278,7 @@ namespace CodeImp.DoomBuilder.Config this.thingflagstranslation = new List<FlagTranslation>(); this.linedefflagstranslation = new List<FlagTranslation>(); this.thingfilters = new List<ThingsFilter>(); - this.thingflagscompare = new List<ThingFlagsCompare>(); + this.thingflagscompare = new Dictionary<string, Dictionary<string, ThingFlagsCompare>>(); //mxd this.brightnesslevels = new StepsList(); this.makedoorflags = new Dictionary<string, bool>(StringComparer.Ordinal); this.linedefrenderstyles = new Dictionary<string, string>(StringComparer.Ordinal); //mxd @@ -398,7 +398,6 @@ namespace CodeImp.DoomBuilder.Config { foreach(ThingCategory tc in thingcategories) tc.Dispose(); foreach(LinedefActionCategory ac in actioncategories) ac.Dispose(); - foreach (ThingFlagsCompare tfc in thingflagscompare) tfc.Dispose(); } #endregion @@ -717,11 +716,20 @@ namespace CodeImp.DoomBuilder.Config // Get thing compare flag info (for the stuck thing error checker dic = cfg.ReadSetting("thingflagscompare", new Hashtable()); - foreach(DictionaryEntry de in dic) { + foreach(DictionaryEntry de in dic) + { IDictionary gdic = cfg.ReadSetting("thingflagscompare." + de.Key, new Hashtable()); - foreach(DictionaryEntry gde in gdic) { - thingflagscompare.Add(new ThingFlagsCompare(cfg, de.Key.ToString(), gde.Key.ToString())); + foreach(DictionaryEntry gde in gdic) + { + string group = de.Key.ToString(); //mxd + string flag = gde.Key.ToString(); //mxd + + if(!thingflagscompare.ContainsKey(group)) //mxd + thingflagscompare.Add(group, new Dictionary<string, ThingFlagsCompare>()); + + if(!thingflagscompare[group].ContainsKey(flag)) //mxd + thingflagscompare[group].Add(flag, new ThingFlagsCompare(cfg, group, flag)); } } diff --git a/Source/Core/Config/ThingsFlagsCompare.cs b/Source/Core/Config/ThingsFlagsCompare.cs index 211d1c8cc86847e470e9d9317c99c6af7ed7ebff..417c50fba039d6992cd1de365c99ed690637b3be 100644 --- a/Source/Core/Config/ThingsFlagsCompare.cs +++ b/Source/Core/Config/ThingsFlagsCompare.cs @@ -38,13 +38,10 @@ namespace CodeImp.DoomBuilder.Config #region ================== Variables - private string flag; - private CompareMethod comparemethod; - private bool invert; - private string group; - - // Disposing - private bool isdisposed; + private readonly string flag; + private readonly CompareMethod comparemethod; + private readonly bool invert; + private readonly string group; #endregion @@ -52,7 +49,6 @@ namespace CodeImp.DoomBuilder.Config public string Flag { get { return flag; } } public string Group { get { return group; } } - public bool IsDisposed { get { return isdisposed; } } #endregion @@ -86,17 +82,6 @@ namespace CodeImp.DoomBuilder.Config GC.SuppressFinalize(this); } - // Disposer - internal void Dispose() - { - // Not already disposed? - if (!isdisposed) - { - // Done - isdisposed = true; - } - } - #endregion #region ================== Methods @@ -126,11 +111,8 @@ namespace CodeImp.DoomBuilder.Config t2flag = invert ? !t2.Flags[flag] : t2.Flags[flag]; } - if (comparemethod == CompareMethod.And && (t1flag && t2flag)) - return 1; - else if (comparemethod == CompareMethod.Equal && (t1flag == t2flag)) - return 1; - + if (comparemethod == CompareMethod.And && (t1flag && t2flag)) return 1; + if (comparemethod == CompareMethod.Equal && (t1flag == t2flag)) return 1; return 0; } diff --git a/Source/Core/General/General.cs b/Source/Core/General/General.cs index 573b78176f6c7a0963ee65314b43c99849e6edba..d6298da9ea8196897c19ac1ec7e1c5db074cf845 100644 --- a/Source/Core/General/General.cs +++ b/Source/Core/General/General.cs @@ -2026,31 +2026,46 @@ namespace CodeImp.DoomBuilder } } - private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e) { + private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e) + { string exceptionmsg = string.Empty; - try { - // Since we can't prevent the app from terminating, log this to the event log. - if(!EventLog.SourceExists("ThreadException")) - EventLog.CreateEventSource("ThreadException", "Application"); - + try + { Exception ex = (Exception)e.ExceptionObject; exceptionmsg = "An application error occurred: " + ex.Message + "\n\nStack Trace:\n" + ex.StackTrace; - // Create an EventLog instance and assign its source. - using (EventLog myLog = new EventLog()) { - myLog.Source = "ThreadException"; - myLog.WriteEntry(exceptionmsg); + // Since we can't prevent the app from terminating, log this to the event log. + try { + if (!EventLog.SourceExists("ThreadException")) + EventLog.CreateEventSource("ThreadException", "Application"); + + // Create an EventLog instance and assign its source. + using (EventLog myLog = new EventLog()) + { + myLog.Source = "ThreadException"; + myLog.WriteEntry(exceptionmsg); + } + } + catch (Exception exc) + { + MessageBox.Show("Could not write the error to the event log.\nReason: " + + exc.Message + "\n\nInitial exception:\n" + exceptionmsg, "Fatal Non-UI Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } GZBuilder.Windows.ExceptionDialog dlg = new GZBuilder.Windows.ExceptionDialog(e); dlg.Setup(); dlg.ShowDialog(); - } catch(Exception exc) { - try { - MessageBox.Show("Could not write the error to the event log.\nReason: " + } + catch(Exception exc) + { + try + { + MessageBox.Show("Failed to write the error to the event log or to show the Exception Dialog.\n\nReason: " + exc.Message + "\n\nInitial exception:\n" + exceptionmsg, "Fatal Non-UI Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); - } finally { + } + finally + { Application.Exit(); } } diff --git a/Source/Core/Windows/ThingEditForm.Designer.cs b/Source/Core/Windows/ThingEditForm.Designer.cs index 6d396663d6bfe868ab0ae91406097f539548dfe3..e21937520680cc4ca843a8d8f5b40c2e1e24de86 100644 --- a/Source/Core/Windows/ThingEditForm.Designer.cs +++ b/Source/Core/Windows/ThingEditForm.Designer.cs @@ -28,6 +28,7 @@ namespace CodeImp.DoomBuilder.Windows /// </summary> private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.Windows.Forms.GroupBox groupBox1; System.Windows.Forms.GroupBox groupBox2; System.Windows.Forms.Label label7; @@ -71,6 +72,8 @@ namespace CodeImp.DoomBuilder.Windows this.apply = new System.Windows.Forms.Button(); this.hint = new System.Windows.Forms.PictureBox(); this.hintlabel = new System.Windows.Forms.Label(); + this.missingflags = new System.Windows.Forms.PictureBox(); + this.tooltip = new System.Windows.Forms.ToolTip(this.components); groupBox1 = new System.Windows.Forms.GroupBox(); groupBox2 = new System.Windows.Forms.GroupBox(); label7 = new System.Windows.Forms.Label(); @@ -84,6 +87,7 @@ namespace CodeImp.DoomBuilder.Windows this.hexenpanel.SuspendLayout(); this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.hint)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.missingflags)).BeginInit(); this.SuspendLayout(); // // groupBox1 @@ -136,6 +140,7 @@ namespace CodeImp.DoomBuilder.Windows // anglecontrol // this.anglecontrol.Angle = 0; + this.anglecontrol.AngleOffset = 0; this.anglecontrol.Location = new System.Drawing.Point(152, 71); this.anglecontrol.Name = "anglecontrol"; this.anglecontrol.Size = new System.Drawing.Size(88, 88); @@ -189,6 +194,7 @@ namespace CodeImp.DoomBuilder.Windows this.posX.AllowRelative = true; this.posX.ButtonStep = 8; this.posX.ButtonStepFloat = 1F; + this.posX.ButtonStepsWrapAround = false; this.posX.Location = new System.Drawing.Point(61, 16); this.posX.Name = "posX"; this.posX.Size = new System.Drawing.Size(72, 24); @@ -203,6 +209,7 @@ namespace CodeImp.DoomBuilder.Windows this.posY.AllowRelative = true; this.posY.ButtonStep = 8; this.posY.ButtonStepFloat = 1F; + this.posY.ButtonStepsWrapAround = false; this.posY.Location = new System.Drawing.Point(61, 41); this.posY.Name = "posY"; this.posY.Size = new System.Drawing.Size(72, 24); @@ -217,6 +224,7 @@ namespace CodeImp.DoomBuilder.Windows this.posZ.AllowRelative = true; this.posZ.ButtonStep = 8; this.posZ.ButtonStepFloat = 1F; + this.posZ.ButtonStepsWrapAround = false; this.posZ.Location = new System.Drawing.Point(61, 66); this.posZ.Name = "posZ"; this.posZ.Size = new System.Drawing.Size(72, 24); @@ -231,6 +239,7 @@ namespace CodeImp.DoomBuilder.Windows this.angle.AllowRelative = true; this.angle.ButtonStep = 1; this.angle.ButtonStepFloat = 1F; + this.angle.ButtonStepsWrapAround = false; this.angle.Location = new System.Drawing.Point(186, 41); this.angle.Name = "angle"; this.angle.Size = new System.Drawing.Size(57, 24); @@ -312,6 +321,7 @@ namespace CodeImp.DoomBuilder.Windows this.settingsgroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.settingsgroup.Controls.Add(this.missingflags); this.settingsgroup.Controls.Add(this.flags); this.settingsgroup.Location = new System.Drawing.Point(284, 6); this.settingsgroup.Name = "settingsgroup"; @@ -332,6 +342,7 @@ namespace CodeImp.DoomBuilder.Windows this.flags.Size = new System.Drawing.Size(337, 178); this.flags.TabIndex = 0; this.flags.VerticalSpacing = 1; + this.flags.OnValueChanged += new System.EventHandler(this.flags_OnValueChanged); // // tabeffects // @@ -491,6 +502,7 @@ namespace CodeImp.DoomBuilder.Windows this.action.Cursor = System.Windows.Forms.Cursors.Default; this.action.Empty = false; this.action.GeneralizedCategories = null; + this.action.GeneralizedOptions = null; this.action.Location = new System.Drawing.Point(62, 27); this.action.Name = "action"; this.action.Size = new System.Drawing.Size(524, 21); @@ -579,6 +591,27 @@ namespace CodeImp.DoomBuilder.Windows this.hintlabel.TabIndex = 4; this.hintlabel.Text = "Select several thing types to randomly assign them to selection"; // + // missingflags + // + this.missingflags.BackColor = System.Drawing.SystemColors.Window; + this.missingflags.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning; + this.missingflags.Location = new System.Drawing.Point(55, -2); + this.missingflags.Name = "missingflags"; + this.missingflags.Size = new System.Drawing.Size(16, 16); + this.missingflags.TabIndex = 5; + this.missingflags.TabStop = false; + this.missingflags.Visible = false; + // + // tooltip + // + this.tooltip.AutomaticDelay = 10; + this.tooltip.AutoPopDelay = 3000; + this.tooltip.InitialDelay = 10; + this.tooltip.IsBalloon = true; + this.tooltip.ReshowDelay = 100; + this.tooltip.UseAnimation = false; + this.tooltip.UseFading = false; + // // ThingEditForm // this.AcceptButton = this.apply; @@ -615,6 +648,7 @@ namespace CodeImp.DoomBuilder.Windows this.hexenpanel.ResumeLayout(false); this.groupBox3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.hint)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.missingflags)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -662,5 +696,7 @@ namespace CodeImp.DoomBuilder.Windows private CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl anglecontrol; private System.Windows.Forms.PictureBox hint; private System.Windows.Forms.Label hintlabel; + private System.Windows.Forms.PictureBox missingflags; + private System.Windows.Forms.ToolTip tooltip; } } \ No newline at end of file diff --git a/Source/Core/Windows/ThingEditForm.cs b/Source/Core/Windows/ThingEditForm.cs index 1037f9e47a9bc8e02f738d78fdd762bad9fd2814..d69e629ac97674352167516365164704899d9bde 100644 --- a/Source/Core/Windows/ThingEditForm.cs +++ b/Source/Core/Windows/ThingEditForm.cs @@ -242,8 +242,9 @@ namespace CodeImp.DoomBuilder.Windows preventchanges = false; - //mxd. Trigger angle update manually... + //mxd. Trigger updates manually... angle_WhenTextChanged(angle, EventArgs.Empty); + flags_OnValueChanged(flags, EventArgs.Empty); updateScriptControls(); //mxd @@ -626,6 +627,55 @@ namespace CodeImp.DoomBuilder.Windows if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); } + //mxd + private void flags_OnValueChanged(object sender, EventArgs e) + { + if(preventchanges) return; + + foreach(KeyValuePair<string, Dictionary<string, ThingFlagsCompare>> group in General.Map.Config.ThingFlagsCompare) + { + if(group.Value.Count < 2) continue; + int enabledcount = 0; + + foreach(CheckBox cb in flags.Checkboxes) + { + if (group.Value.ContainsKey(cb.Tag.ToString()) && cb.CheckState != CheckState.Unchecked) + { + enabledcount++; + } + } + + if (enabledcount == 0) + { + switch(group.Key) + { + case "skills": + tooltip.SetToolTip(missingflags, "Thing is not used in any skill level."); + break; + + case "gamemodes": + tooltip.SetToolTip(missingflags, "Thing is not used in any game mode."); + break; + + case "classes": + tooltip.SetToolTip(missingflags, "Thing is not used by any class."); + break; + + default: + tooltip.SetToolTip(missingflags, "At least one '" + group.Key + "' flag should be set."); + break; + } + + missingflags.Visible = true; + settingsgroup.ForeColor = Color.DarkRed; + return; + } + } + + missingflags.Visible = false; + settingsgroup.ForeColor = SystemColors.ControlText; + } + #endregion } diff --git a/Source/Core/Windows/ThingEditForm.resx b/Source/Core/Windows/ThingEditForm.resx index 11c67fb83b0b24362aa6dfe105454c299ba3e1c1..80fceebaf1dcd9fa75102a6fdcff0d06f8f59800 100644 --- a/Source/Core/Windows/ThingEditForm.resx +++ b/Source/Core/Windows/ThingEditForm.resx @@ -138,6 +138,18 @@ <metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> + <metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="doompanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> <metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> @@ -150,10 +162,22 @@ <metadata name="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> + <metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="arg0label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> <metadata name="doompanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> <metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> + <metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> </root> \ No newline at end of file diff --git a/Source/Core/Windows/ThingEditFormUDMF.Designer.cs b/Source/Core/Windows/ThingEditFormUDMF.Designer.cs index 7c55db7685d59276f6cd01fda6a21ac44e006681..1e48db1f00878c107bdd23a14f474d0731eb1344 100644 --- a/Source/Core/Windows/ThingEditFormUDMF.Designer.cs +++ b/Source/Core/Windows/ThingEditFormUDMF.Designer.cs @@ -25,6 +25,7 @@ /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.thingtype = new CodeImp.DoomBuilder.Controls.ThingBrowserControl(); this.groupBox2 = new System.Windows.Forms.GroupBox(); @@ -70,6 +71,7 @@ this.zlabel = new System.Windows.Forms.Label(); this.tabeffects = new System.Windows.Forms.TabPage(); this.settingsgroup = new System.Windows.Forms.GroupBox(); + this.missingflags = new System.Windows.Forms.PictureBox(); this.flags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl(); this.actiongroup = new System.Windows.Forms.GroupBox(); this.hexenpanel = new System.Windows.Forms.Panel(); @@ -97,6 +99,7 @@ this.apply = new System.Windows.Forms.Button(); this.hint = new System.Windows.Forms.PictureBox(); this.hintlabel = new System.Windows.Forms.Label(); + this.tooltip = new System.Windows.Forms.ToolTip(this.components); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.tabs.SuspendLayout(); @@ -109,6 +112,7 @@ this.groupBox4.SuspendLayout(); this.tabeffects.SuspendLayout(); this.settingsgroup.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.missingflags)).BeginInit(); this.actiongroup.SuspendLayout(); this.hexenpanel.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -164,6 +168,7 @@ this.roll.AllowRelative = true; this.roll.ButtonStep = 1; this.roll.ButtonStepFloat = 1F; + this.roll.ButtonStepsWrapAround = false; this.roll.Location = new System.Drawing.Point(61, 66); this.roll.Name = "roll"; this.roll.Size = new System.Drawing.Size(57, 24); @@ -187,6 +192,7 @@ this.pitch.AllowRelative = true; this.pitch.ButtonStep = 1; this.pitch.ButtonStepFloat = 1F; + this.pitch.ButtonStepsWrapAround = false; this.pitch.Location = new System.Drawing.Point(61, 41); this.pitch.Name = "pitch"; this.pitch.Size = new System.Drawing.Size(57, 24); @@ -210,6 +216,7 @@ this.angle.AllowRelative = true; this.angle.ButtonStep = 1; this.angle.ButtonStepFloat = 1F; + this.angle.ButtonStepsWrapAround = false; this.angle.Location = new System.Drawing.Point(61, 16); this.angle.Name = "angle"; this.angle.Size = new System.Drawing.Size(57, 24); @@ -366,6 +373,7 @@ this.conversationID.AllowRelative = false; this.conversationID.ButtonStep = 1; this.conversationID.ButtonStepFloat = 1F; + this.conversationID.ButtonStepsWrapAround = false; this.conversationID.Location = new System.Drawing.Point(98, 106); this.conversationID.Name = "conversationID"; this.conversationID.Size = new System.Drawing.Size(72, 24); @@ -399,6 +407,7 @@ this.health.AllowRelative = false; this.health.ButtonStep = 8; this.health.ButtonStepFloat = 0.1F; + this.health.ButtonStepsWrapAround = false; this.health.Location = new System.Drawing.Point(98, 76); this.health.Name = "health"; this.health.Size = new System.Drawing.Size(72, 24); @@ -421,6 +430,7 @@ this.score.AllowRelative = false; this.score.ButtonStep = 8; this.score.ButtonStepFloat = 0.1F; + this.score.ButtonStepsWrapAround = false; this.score.Location = new System.Drawing.Point(98, 46); this.score.Name = "score"; this.score.Size = new System.Drawing.Size(72, 24); @@ -443,6 +453,7 @@ this.gravity.AllowRelative = false; this.gravity.ButtonStep = 8; this.gravity.ButtonStepFloat = 0.1F; + this.gravity.ButtonStepsWrapAround = false; this.gravity.Location = new System.Drawing.Point(98, 16); this.gravity.Name = "gravity"; this.gravity.Size = new System.Drawing.Size(72, 24); @@ -494,6 +505,7 @@ this.alpha.AllowRelative = false; this.alpha.ButtonStep = 8; this.alpha.ButtonStepFloat = 0.1F; + this.alpha.ButtonStepsWrapAround = false; this.alpha.Location = new System.Drawing.Point(89, 78); this.alpha.Name = "alpha"; this.alpha.Size = new System.Drawing.Size(72, 24); @@ -579,6 +591,7 @@ this.posX.AllowRelative = true; this.posX.ButtonStep = 8; this.posX.ButtonStepFloat = 1F; + this.posX.ButtonStepsWrapAround = false; this.posX.Location = new System.Drawing.Point(61, 16); this.posX.Name = "posX"; this.posX.Size = new System.Drawing.Size(72, 24); @@ -593,6 +606,7 @@ this.posY.AllowRelative = true; this.posY.ButtonStep = 8; this.posY.ButtonStepFloat = 1F; + this.posY.ButtonStepsWrapAround = false; this.posY.Location = new System.Drawing.Point(61, 41); this.posY.Name = "posY"; this.posY.Size = new System.Drawing.Size(72, 24); @@ -607,6 +621,7 @@ this.posZ.AllowRelative = true; this.posZ.ButtonStep = 8; this.posZ.ButtonStepFloat = 1F; + this.posZ.ButtonStepsWrapAround = false; this.posZ.Location = new System.Drawing.Point(61, 66); this.posZ.Name = "posZ"; this.posZ.Size = new System.Drawing.Size(72, 24); @@ -641,6 +656,7 @@ // this.settingsgroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); + this.settingsgroup.Controls.Add(this.missingflags); this.settingsgroup.Controls.Add(this.flags); this.settingsgroup.Location = new System.Drawing.Point(6, 238); this.settingsgroup.Name = "settingsgroup"; @@ -649,6 +665,17 @@ this.settingsgroup.TabStop = false; this.settingsgroup.Text = " Flags "; // + // missingflags + // + this.missingflags.BackColor = System.Drawing.SystemColors.Window; + this.missingflags.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning; + this.missingflags.Location = new System.Drawing.Point(42, -1); + this.missingflags.Name = "missingflags"; + this.missingflags.Size = new System.Drawing.Size(16, 16); + this.missingflags.TabIndex = 5; + this.missingflags.TabStop = false; + this.missingflags.Visible = false; + // // flags // this.flags.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -661,6 +688,7 @@ this.flags.Size = new System.Drawing.Size(603, 132); this.flags.TabIndex = 0; this.flags.VerticalSpacing = 1; + this.flags.OnValueChanged += new System.EventHandler(this.flags_OnValueChanged); // // actiongroup // @@ -830,6 +858,7 @@ this.action.Cursor = System.Windows.Forms.Cursors.Default; this.action.Empty = false; this.action.GeneralizedCategories = null; + this.action.GeneralizedOptions = null; this.action.Location = new System.Drawing.Point(62, 27); this.action.Name = "action"; this.action.Size = new System.Drawing.Size(513, 21); @@ -952,6 +981,16 @@ this.hintlabel.TabIndex = 4; this.hintlabel.Text = "Select several thing types to randomly assign them to selection"; // + // tooltip + // + this.tooltip.AutomaticDelay = 10; + this.tooltip.AutoPopDelay = 3000; + this.tooltip.InitialDelay = 10; + this.tooltip.IsBalloon = true; + this.tooltip.ReshowDelay = 100; + this.tooltip.UseAnimation = false; + this.tooltip.UseFading = false; + // // ThingEditFormUDMF // this.AcceptButton = this.apply; @@ -990,6 +1029,7 @@ this.groupBox4.PerformLayout(); this.tabeffects.ResumeLayout(false); this.settingsgroup.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.missingflags)).EndInit(); this.actiongroup.ResumeLayout(false); this.actiongroup.PerformLayout(); this.hexenpanel.ResumeLayout(false); @@ -1075,5 +1115,7 @@ private GZBuilder.Controls.AngleControl pitchControl; private System.Windows.Forms.GroupBox groupBox7; private GZBuilder.Controls.PairedFloatControl scale; + private System.Windows.Forms.PictureBox missingflags; + private System.Windows.Forms.ToolTip tooltip; } } \ No newline at end of file diff --git a/Source/Core/Windows/ThingEditFormUDMF.cs b/Source/Core/Windows/ThingEditFormUDMF.cs index 6b48746a12dd521ffdcb62bbd6bbbf6efc4da3c8..e395922a64ac76d1c81a222bbf49a07bb9159032 100644 --- a/Source/Core/Windows/ThingEditFormUDMF.cs +++ b/Source/Core/Windows/ThingEditFormUDMF.cs @@ -857,6 +857,53 @@ namespace CodeImp.DoomBuilder.Windows if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); } + private void flags_OnValueChanged(object sender, EventArgs e) + { + if(preventchanges) return; + + foreach(KeyValuePair<string, Dictionary<string, ThingFlagsCompare>> group in General.Map.Config.ThingFlagsCompare) + { + if(group.Value.Count < 2) continue; + int enabledcount = 0; + + foreach(CheckBox cb in flags.Checkboxes) + { + if(group.Value.ContainsKey(cb.Tag.ToString()) && cb.CheckState != CheckState.Unchecked) { + enabledcount++; + } + } + + if(enabledcount == 0) + { + switch(group.Key) + { + case "skills": + tooltip.SetToolTip(missingflags, "Thing is not used in any skill level."); + break; + + case "gamemodes": + tooltip.SetToolTip(missingflags, "Thing is not used in any game mode."); + break; + + case "classes": + tooltip.SetToolTip(missingflags, "Thing is not used by any class."); + break; + + default: + tooltip.SetToolTip(missingflags, "At least one '" + group.Key + "' flag should be set."); + break; + } + + missingflags.Visible = true; + settingsgroup.ForeColor = Color.DarkRed; + return; + } + } + + missingflags.Visible = false; + settingsgroup.ForeColor = SystemColors.ControlText; + } + #endregion } diff --git a/Source/Core/Windows/ThingEditFormUDMF.resx b/Source/Core/Windows/ThingEditFormUDMF.resx index 5ea0895e324fa7a86681adc56938bad2f2367ba0..90f1f8dc7d85d2e04c18fe1a9a0c6266ac4d320a 100644 --- a/Source/Core/Windows/ThingEditFormUDMF.resx +++ b/Source/Core/Windows/ThingEditFormUDMF.resx @@ -117,4 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> </root> \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/ErrorChecks/CheckStuckThings.cs b/Source/Plugins/BuilderModes/ErrorChecks/CheckStuckThings.cs index 321bdf7e2486c1ec474bc369084cd6f6ac4f1aaa..e3297b6513172cb35ef0c70f4480c48eb926ba47 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/CheckStuckThings.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/CheckStuckThings.cs @@ -36,13 +36,6 @@ namespace CodeImp.DoomBuilder.BuilderModes private const int PROGRESS_STEP = 10; private const float ALLOWED_STUCK_DISTANCE = 6.0f; - enum StuckType - { - None = 0, - Line, - Thing - } - #endregion #region ================== Constructor / Destructor @@ -65,7 +58,7 @@ namespace CodeImp.DoomBuilder.BuilderModes int progress = 0; int stepprogress = 0; float maxradius = 0; - Thing other = null; //mxd + Dictionary<int, Dictionary<int, bool>> processedthingpairs = new Dictionary<int, Dictionary<int, bool>>(); //mxd foreach (ThingTypeInfo tti in General.Map.Data.ThingTypes) { @@ -77,7 +70,6 @@ namespace CodeImp.DoomBuilder.BuilderModes { ThingTypeInfo info = General.Map.Data.GetThingInfo(t.Type); bool stuck = false; - StuckType stucktype = StuckType.None; // Check this thing for getting stuck? if( (info.ErrorCheck == ThingTypeInfo.THING_ERROR_INSIDE_STUCK) && @@ -102,11 +94,11 @@ namespace CodeImp.DoomBuilder.BuilderModes if(((l.Back == null) || l.IsFlagSet(General.Map.Config.ImpassableFlag)) && !doneblocklines.ContainsKey(l)) { // Test if line ends are inside the thing - if(PointInRect(lt, rb, l.Start.Position) || - PointInRect(lt, rb, l.End.Position)) + if(PointInRect(lt, rb, l.Start.Position) || PointInRect(lt, rb, l.End.Position)) { // Thing stuck in line! stuck = true; + SubmitResult(new ResultStuckThingInLine(t, l)); } // Test if the line intersects the square else if(Line2D.GetIntersection(l.Start.Position, l.End.Position, lt.x, lt.y, rb.x, lt.y) || @@ -116,7 +108,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { // Thing stuck in line! stuck = true; - stucktype = StuckType.Line; + SubmitResult(new ResultStuckThingInLine(t, l)); } // Checked @@ -125,70 +117,59 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Check if thing is stuck in other things - if(info.Blocking != ThingTypeInfo.THING_BLOCKING_NONE) { + if(info.Blocking != ThingTypeInfo.THING_BLOCKING_NONE) + { foreach (Thing ot in b.Things) { // Don't compare the thing with itself if (t.Index == ot.Index) continue; + // mxd. Don't compare already processed stuff + if (processedthingpairs.ContainsKey(t.Index) && processedthingpairs[t.Index].ContainsKey(ot.Index)) continue; + // Only check of items that can block if (General.Map.Data.GetThingInfo(ot.Type).Blocking == ThingTypeInfo.THING_BLOCKING_NONE) continue; // need to compare the flags - /* TODO: skill settings - Dictionary<string, bool> flags1 = t.GetFlags(); - Dictionary<string, bool> flags2 = ot.GetFlags(); - */ - if (FlagsOverlap(t, ot) && ThingsOverlap(t, ot)) { stuck = true; - other = ot; //mxd - stucktype = StuckType.Thing; + + //mxd. Prepare collection + if(!processedthingpairs.ContainsKey(t.Index)) processedthingpairs.Add(t.Index, new Dictionary<int, bool>()); + if(!processedthingpairs.ContainsKey(ot.Index)) processedthingpairs.Add(ot.Index, new Dictionary<int, bool>()); + + //mxd. Add both ways + processedthingpairs[t.Index].Add(ot.Index, false); + processedthingpairs[ot.Index].Add(t.Index, false); + + SubmitResult(new ResultStuckThingInThing(t, ot)); } } } } } - - // Stuck? - if(stuck) - { - // Make result - switch (stucktype) - { - case StuckType.Line: - SubmitResult(new ResultStuckThingInLine(t)); - break; - case StuckType.Thing: - SubmitResult(new ResultStuckThingInThing(t, other)); - break; - } - } - else + // Check this thing for being outside the map? + if(!stuck && info.ErrorCheck >= ThingTypeInfo.THING_ERROR_INSIDE) { - // Check this thing for being outside the map? - if(info.ErrorCheck >= ThingTypeInfo.THING_ERROR_INSIDE) + // Get the nearest line to see if the thing is outside the map + bool outside; + Linedef l = General.Map.Map.NearestLinedef(t.Position); + if(l.SideOfLine(t.Position) <= 0) { - // Get the nearest line to see if the thing is outside the map - bool outside; - Linedef l = General.Map.Map.NearestLinedef(t.Position); - if(l.SideOfLine(t.Position) <= 0) - { - outside = (l.Front == null); - } - else - { - outside = (l.Back == null); - } + outside = (l.Front == null); + } + else + { + outside = (l.Back == null); + } - // Outside the map? - if(outside) - { - // Make result - SubmitResult(new ResultThingOutside(t)); - } + // Outside the map? + if(outside) + { + // Make result + SubmitResult(new ResultThingOutside(t)); } } @@ -240,30 +221,24 @@ namespace CodeImp.DoomBuilder.BuilderModes // Checks if the flags of two things overlap (i.e. if they show up at the same time) private static bool FlagsOverlap(Thing t1, Thing t2) { - var groups = new Dictionary<string, List<ThingFlagsCompare>>(StringComparer.Ordinal); + if (General.Map.Config.ThingFlagsCompare.Count < 1) return false; //mxd. Bail out if no settings... int overlappinggroups = 0; - // Create a summary which flags belong to which groups - foreach (ThingFlagsCompare tfc in General.Map.Config.ThingFlagsCompare) { - if (!groups.ContainsKey(tfc.Group)) - groups[tfc.Group] = new List<ThingFlagsCompare>(); - - groups[tfc.Group].Add(tfc); - } - // Go through all flags in all groups and check if they overlap - foreach (string g in groups.Keys) { - foreach (ThingFlagsCompare tfc in groups[g]) { - if (tfc.Compare(t1, t2) > 0) { + foreach(KeyValuePair<string, Dictionary<string, ThingFlagsCompare>> group in General.Map.Config.ThingFlagsCompare) + { + foreach(ThingFlagsCompare tfc in group.Value.Values) + { + if(tfc.Compare(t1, t2) > 0) + { overlappinggroups++; break; } } } - // All groups have to overlap for the things to show up - // at the same time - return (overlappinggroups == groups.Count); + // All groups have to overlap for the things to show up at the same time + return (overlappinggroups == General.Map.Config.ThingFlagsCompare.Count); } #endregion diff --git a/Source/Plugins/BuilderModes/ErrorChecks/CheckTextureAlignment.cs b/Source/Plugins/BuilderModes/ErrorChecks/CheckTextureAlignment.cs index ebc674adbbab81f48ebd02d4fa82a76cc0524f5f..71a85d9e3539e9a64398c91af4e8d72b1f2a5d89 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/CheckTextureAlignment.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/CheckTextureAlignment.cs @@ -25,7 +25,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.ErrorChecks #region ================== Variables - private Dictionary<VisualGeometryType, Dictionary<int, Dictionary<int, bool>>> donesides; + // Now THAT'S what I call a collection! :) + private Dictionary<VisualGeometryType, Dictionary<int, Dictionary<VisualGeometryType, Dictionary<int, bool>>>> donesides; #endregion @@ -45,10 +46,10 @@ namespace CodeImp.DoomBuilder.BuilderModes.ErrorChecks // This runs the check public override void Run() { - donesides = new Dictionary<VisualGeometryType, Dictionary<int, Dictionary<int, bool>>>(3); - donesides.Add(VisualGeometryType.WALL_UPPER, new Dictionary<int, Dictionary<int, bool>>()); - donesides.Add(VisualGeometryType.WALL_MIDDLE, new Dictionary<int, Dictionary<int, bool>>()); - donesides.Add(VisualGeometryType.WALL_LOWER, new Dictionary<int, Dictionary<int, bool>>()); + donesides = new Dictionary<VisualGeometryType, Dictionary<int, Dictionary<VisualGeometryType, Dictionary<int, bool>>>>(3); + donesides.Add(VisualGeometryType.WALL_UPPER, new Dictionary<int, Dictionary<VisualGeometryType, Dictionary<int, bool>>>()); + donesides.Add(VisualGeometryType.WALL_MIDDLE, new Dictionary<int, Dictionary<VisualGeometryType, Dictionary<int, bool>>>()); + donesides.Add(VisualGeometryType.WALL_LOWER, new Dictionary<int, Dictionary<VisualGeometryType, Dictionary<int, bool>>>()); int progress = 0; int stepprogress = 0; @@ -176,18 +177,22 @@ namespace CodeImp.DoomBuilder.BuilderModes.ErrorChecks if(line.Front != null && line.End == v) target = line.Front; else if(line.Back != null && line.Start == v) target = line.Back; - // No target or laready processed? - if(target == null || (donesides[parttype].ContainsKey(sidedef.Index) && donesides[parttype][sidedef.Index].ContainsKey(target.Index))) - continue; + // No target? + if(target == null) continue; // Get expected texture offsets - VisualGeometryType targetparttype = VisualGeometryType.UNKNOWN; - int alignedY = GetExpectedOffsetY(sidedef, target, texturename, texture.Height, scaley, linescaley, partsize, ref targetparttype); + VisualGeometryType targetparttype; + int alignedY = GetExpectedOffsetY(sidedef, target, texturename, texture.Height, scaley, linescaley, partsize, out targetparttype); if(targetparttype == VisualGeometryType.UNKNOWN) continue; + // Already added? + if(donesides[parttype].ContainsKey(sidedef.Index) && donesides[parttype][sidedef.Index][targetparttype].ContainsKey(target.Index)) + continue; + // Not aligned if scaley is not equal float targetscaley = GetSidedefValue(target, targetparttype, "scaley", 1.0f); - if(targetscaley != linescaley) { + if(targetscaley != linescaley) + { #if DEBUG //TODO: remove this string msg = "Case 1: '" + texturename + "' source " + sidedef.Line.Index + " (" + (sidedef.IsFront ? "front" : "back") + "), target " + target.Line.Index + " (" + (target.IsFront ? "front" : "back") @@ -238,14 +243,17 @@ namespace CodeImp.DoomBuilder.BuilderModes.ErrorChecks else if(line.Back != null && line.End == v) target = line.Back; // No target or laready processed? - if(target == null || (donesides[parttype].ContainsKey(sidedef.Index) && donesides[parttype][sidedef.Index].ContainsKey(target.Index))) - continue; + if(target == null) continue; // Get expected texture offsets - VisualGeometryType targetparttype = VisualGeometryType.UNKNOWN; - int alignedY = GetExpectedOffsetY(sidedef, target, texturename, texture.Height, scaley, linescaley, partsize, ref targetparttype); + VisualGeometryType targetparttype; + int alignedY = GetExpectedOffsetY(sidedef, target, texturename, texture.Height, scaley, linescaley, partsize, out targetparttype); if(targetparttype == VisualGeometryType.UNKNOWN) continue; + // Already added? + if(donesides[parttype].ContainsKey(sidedef.Index) && donesides[parttype][sidedef.Index][targetparttype].ContainsKey(target.Index)) + continue; + // Not aligned if scaley is not equal float targetscaley = GetSidedefValue(target, targetparttype, "scaley", 1.0f); if (targetscaley != linescaley) @@ -307,14 +315,26 @@ namespace CodeImp.DoomBuilder.BuilderModes.ErrorChecks private void AddProcessedSides(Sidedef s1, VisualGeometryType type1, Sidedef s2, VisualGeometryType type2) { // Add them both ways - if(!donesides[type1].ContainsKey(s1.Index)) donesides[type1].Add(s1.Index, new Dictionary<int, bool>()); - donesides[type1][s1.Index].Add(s2.Index, false); + if (!donesides[type1].ContainsKey(s1.Index)) + { + donesides[type1].Add(s1.Index, new Dictionary<VisualGeometryType, Dictionary<int, bool>>()); + donesides[type1][s1.Index].Add(VisualGeometryType.WALL_UPPER, new Dictionary<int, bool>()); + donesides[type1][s1.Index].Add(VisualGeometryType.WALL_MIDDLE, new Dictionary<int, bool>()); + donesides[type1][s1.Index].Add(VisualGeometryType.WALL_LOWER, new Dictionary<int, bool>()); + } + donesides[type1][s1.Index][type2].Add(s2.Index, false); - if(!donesides[type2].ContainsKey(s2.Index)) donesides[type2].Add(s2.Index, new Dictionary<int, bool>()); - donesides[type2][s2.Index].Add(s1.Index, false); + if (!donesides[type2].ContainsKey(s2.Index)) + { + donesides[type2].Add(s2.Index, new Dictionary<VisualGeometryType, Dictionary<int, bool>>()); + donesides[type2][s2.Index].Add(VisualGeometryType.WALL_UPPER, new Dictionary<int, bool>()); + donesides[type2][s2.Index].Add(VisualGeometryType.WALL_MIDDLE, new Dictionary<int, bool>()); + donesides[type2][s2.Index].Add(VisualGeometryType.WALL_LOWER, new Dictionary<int, bool>()); + } + donesides[type2][s2.Index][type1].Add(s1.Index, false); } - private int GetExpectedOffsetY(Sidedef source, Sidedef target, string texturename, int textureheight, float texturescaley, float linescaley, Rectangle partsize, ref VisualGeometryType matchingparttype) + private int GetExpectedOffsetY(Sidedef source, Sidedef target, string texturename, int textureheight, float texturescaley, float linescaley, Rectangle partsize, out VisualGeometryType matchingparttype) { if(target.MiddleTexture == texturename && partsize.IntersectsWith(BuilderModesTools.GetSidedefPartSize(target, VisualGeometryType.WALL_MIDDLE))) diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultStuckThingInLine.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultStuckThingInLine.cs index 9089409b63832fcd350ffeb94e5fa535ecc3ef25..684e2e3e7ec8622e5fc0b9e45fedc780f98e5d84 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/ResultStuckThingInLine.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultStuckThingInLine.cs @@ -29,6 +29,7 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Variables private readonly Thing thing; + private readonly Linedef line; //mxd #endregion @@ -42,10 +43,11 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Constructor / Destructor // Constructor - public ResultStuckThingInLine(Thing t) + public ResultStuckThingInLine(Thing t, Linedef l) { // Initialize thing = t; + line = l; //mxd viewobjects.Add(t); hidden = t.IgnoredErrorChecks.Contains(this.GetType()); //mxd description = "This thing is stuck in a wall (single-sided line) and will likely not be able to move around."; @@ -67,13 +69,21 @@ namespace CodeImp.DoomBuilder.BuilderModes // This must return the string that is displayed in the listbox public override string ToString() { - return "Thing " + thing.Index + " (" + General.Map.Data.GetThingInfo(thing.Type).Title + ") is stuck in a wall at " + thing.Position.x + ", " + thing.Position.y; + return "Thing " + thing.Index + " (" + General.Map.Data.GetThingInfo(thing.Type).Title + ") is stuck in linedef " + line.Index + " at " + thing.Position.x + ", " + thing.Position.y; } // Rendering public override void RenderOverlaySelection(IRenderer2D renderer) { - renderer.RenderThing(thing, renderer.DetermineThingColor(thing), 1.0f); + renderer.RenderThing(thing, renderer.DetermineThingColor(thing), 0.8f); + } + + // mxd. More rencering + public override void PlotSelection(IRenderer2D renderer) + { + renderer.PlotLinedef(line, General.Colors.Selection); + renderer.PlotVertex(line.Start, ColorCollection.VERTICES); + renderer.PlotVertex(line.End, ColorCollection.VERTICES); } // This removes the thing diff --git a/Source/Plugins/BuilderModes/ErrorChecks/ResultStuckThingInThing.cs b/Source/Plugins/BuilderModes/ErrorChecks/ResultStuckThingInThing.cs index fb694ad328c9a6389cfb1dd2074a6717235a095d..a5a06389ccebca2be1c58992c1f77a610fbbaf2b 100644 --- a/Source/Plugins/BuilderModes/ErrorChecks/ResultStuckThingInThing.cs +++ b/Source/Plugins/BuilderModes/ErrorChecks/ResultStuckThingInThing.cs @@ -35,8 +35,9 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Properties - public override int Buttons { get { return 1; } } - public override string Button1Text { get { return "Delete Thing"; } } + public override int Buttons { get { return 2; } } + public override string Button1Text { get { return "Delete 1-st Thing"; } } + public override string Button2Text { get { return "Delete 2-nd Thing"; } } //mxd #endregion @@ -84,9 +85,10 @@ namespace CodeImp.DoomBuilder.BuilderModes public override void RenderOverlaySelection(IRenderer2D renderer) { renderer.RenderThing(thing1, renderer.DetermineThingColor(thing1), 1.0f); + renderer.RenderThing(thing2, renderer.DetermineThingColor(thing2), 1.0f); } - // This removes the thing + // This removes the first thing public override bool Button1Click(bool batchMode) { if(!batchMode) General.Map.UndoRedo.CreateUndo("Delete thing"); @@ -96,6 +98,16 @@ namespace CodeImp.DoomBuilder.BuilderModes return true; } + // This removes the thing + public override bool Button2Click(bool batchMode) + { + if(!batchMode) General.Map.UndoRedo.CreateUndo("Delete thing"); + thing2.Dispose(); + General.Map.IsChanged = true; + General.Map.ThingsFilter.Update(); + return true; + } + #endregion } }