mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Thing Edit Form: a warning is now displayed when a thing doesn't have any skill or class or game mode flags.
Game Configurations: moved "thingflagscompare" from Game to Map format blocks. "Check stuck things" check now works properly in Doom/Boom game configurations. Map Analysis: fixed a possible crash during "Check texture alignment" check. Map Analysis: ResultStuckThingInLine now highlights both thing and line. Map Analysis: ResultStuckThingInThing now highlights both things and allows to delete any of them. Internal, Map Analysis: rewritten parts of "Check stuck things" class. Internal, Map Analysis: changed the way processed stuff is stored in "Check texture alignment" class. Internal: changed CurrentDomainOnUnhandledException, so ExceptionDialog with proper info shows up even if adding exception to the Event Log failed. Internal: changed format, in which thingflagscompare info is stored.
This commit is contained in:
parent
adc2a4af78
commit
b90b7b8a79
24 changed files with 392 additions and 192 deletions
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
36
Source/Core/Windows/ThingEditForm.Designer.cs
generated
36
Source/Core/Windows/ThingEditForm.Designer.cs
generated
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
||||
}
|
||||
|
|
|
@ -138,9 +138,30 @@
|
|||
<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>
|
||||
<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="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
@ -156,4 +177,7 @@
|
|||
<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>
|
42
Source/Core/Windows/ThingEditFormUDMF.Designer.cs
generated
42
Source/Core/Windows/ThingEditFormUDMF.Designer.cs
generated
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -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;
|
||||
// Check this thing for being outside the map?
|
||||
if(!stuck && 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)
|
||||
{
|
||||
outside = (l.Front == null);
|
||||
}
|
||||
else
|
||||
{
|
||||
outside = (l.Back == null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
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
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue