Map Analysis Mode: checking for missing activation flags (UDMF) now finds linedef that are missing an actual activation flag, not only lines without any flags in that group. Fixes #288

Linedef Editing Form (UDMF): now only missing required activation flags are marked red
This commit is contained in:
biwa 2021-03-22 10:41:21 +01:00
parent 6c003f1cb1
commit 85b8b41580
8 changed files with 79 additions and 18 deletions

View file

@ -393,7 +393,11 @@ linedefflags_udmf
linedefactivations_udmf linedefactivations_udmf
{ {
repeatspecial = "Repeatable action"; repeatspecial
{
name = "Repeatable action";
istrigger = false;
}
playeruse = "When player presses use"; playeruse = "When player presses use";
playercross = "When player walks over"; playercross = "When player walks over";
playerpush = "When player bumps"; playerpush = "When player bumps";
@ -405,8 +409,16 @@ linedefactivations_udmf
polycross = "When polyobject moves over"; polycross = "When polyobject moves over";
impact = "On projectile impact"; impact = "On projectile impact";
// checkswitchrange = "Switch height check"; // checkswitchrange = "Switch height check";
passuse = "Pass use on"; passuse
firstsideonly = "Front side only"; {
name = "Pass use on";
istrigger = false;
}
firstsideonly
{
name = "Front side only";
istrigger = false;
}
// playeruseback = "Player can use from back side"; // playeruseback = "Player can use from back side";
} }

View file

@ -110,8 +110,16 @@ linedefactivations
playerpush = "When player bumps"; playerpush = "When player bumps";
monsterpush = "When monsters bumps"; monsterpush = "When monsters bumps";
missilecross = "When projectile crosses"; missilecross = "When projectile crosses";
repeatspecial = "Repeatable action"; repeatspecial
passuse = "Pass use on"; {
name = "Repeatable action";
istrigger = false;
}
passuse
{
name = "Pass use on";
istrigger = false;
}
} }
sidedefflags sidedefflags

View file

@ -56,7 +56,11 @@ linedefflags_udmf
linedefactivations_udmf linedefactivations_udmf
{ {
repeatspecial = "Repeatable action"; repeatspecial
{
name = "Repeatable action";
istrigger = false;
}
playeruse = "When player presses use"; playeruse = "When player presses use";
playercross = "When player walks over"; playercross = "When player walks over";
playerpush = "When player bumps"; playerpush = "When player bumps";
@ -66,10 +70,26 @@ linedefactivations_udmf
anycross = "Any crossing non-missile activates"; anycross = "Any crossing non-missile activates";
missilecross = "When projectile crosses"; missilecross = "When projectile crosses";
impact = "On projectile impact"; impact = "On projectile impact";
checkswitchrange = "Switch height check"; checkswitchrange
passuse = "Pass use on"; {
firstsideonly = "Front side only"; name = "Switch height check";
playeruseback = "Player can use from back side"; istrigger = false;
}
passuse
{
name = "Pass use on";
istrigger = false;
}
firstsideonly
{
name = "Front side only";
istrigger = false;
}
playeruseback
{
name = "Player can use from back side";
istrigger = false;
}
} }

View file

@ -19,6 +19,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -745,8 +746,18 @@ namespace CodeImp.DoomBuilder.Config
IDictionary dic = cfg.ReadSetting("linedefactivations", new Hashtable()); IDictionary dic = cfg.ReadSetting("linedefactivations", new Hashtable());
foreach(DictionaryEntry de in dic) foreach(DictionaryEntry de in dic)
{ {
// Add to the list // If the value is a dictionary read the values from that
linedefactivates.Add(new LinedefActivateInfo(de.Key.ToString(), de.Value.ToString())); if (de.Value is ICollection)
{
string name = cfg.ReadSetting("linedefactivations." + de.Key.ToString() + ".name", de.Key.ToString());
bool istrigger = cfg.ReadSetting("linedefactivations." + de.Key.ToString() + ".istrigger", true);
linedefactivates.Add(new LinedefActivateInfo(de.Key.ToString(), name, istrigger));
}
else
{
// Add to the list
linedefactivates.Add(new LinedefActivateInfo(de.Key.ToString(), de.Value.ToString(), true));
}
} }
//mxd. Sort only when activations are numeric //mxd. Sort only when activations are numeric

View file

@ -34,6 +34,7 @@ namespace CodeImp.DoomBuilder.Config
private int intkey; private int intkey;
private string key; private string key;
private string title; private string title;
private bool istrigger;
#endregion #endregion
@ -42,17 +43,19 @@ namespace CodeImp.DoomBuilder.Config
public int Index { get { return intkey; } } public int Index { get { return intkey; } }
public string Key { get { return key; } } public string Key { get { return key; } }
public string Title { get { return title; } } public string Title { get { return title; } }
public bool IsTrigger { get { return istrigger; } }
#endregion #endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // Constructor
internal LinedefActivateInfo(string key, string title) internal LinedefActivateInfo(string key, string title, bool istrigger)
{ {
// Initialize // Initialize
this.key = key; this.key = key;
this.title = title; this.title = title;
this.istrigger = istrigger;
// Try parsing key as int for comparison // Try parsing key as int for comparison
if(!int.TryParse(key, out intkey)) intkey = 0; if(!int.TryParse(key, out intkey)) intkey = 0;

View file

@ -99,7 +99,7 @@ namespace CodeImp.DoomBuilder.Windows
if(activations.Count > 0) if(activations.Count > 0)
{ {
activations.Insert(0, new LinedefActivateInfo("-1", "Any activation")); activations.Insert(0, new LinedefActivateInfo("-1", "Any activation", true));
if(General.Map.UDMF) if(General.Map.UDMF)
{ {

View file

@ -617,7 +617,8 @@ namespace CodeImp.DoomBuilder.Windows
bool haveactivationflag = false; bool haveactivationflag = false;
foreach(CheckBox c in udmfactivates.Checkboxes) foreach(CheckBox c in udmfactivates.Checkboxes)
{ {
if(c.CheckState != CheckState.Unchecked) LinedefActivateInfo ai = (c.Tag as LinedefActivateInfo);
if(ai.IsTrigger && c.CheckState != CheckState.Unchecked)
{ {
haveactivationflag = true; haveactivationflag = true;
break; break;
@ -625,7 +626,13 @@ namespace CodeImp.DoomBuilder.Windows
} }
missingactivation.Visible = !haveactivationflag; missingactivation.Visible = !haveactivationflag;
activationGroup.ForeColor = (!haveactivationflag ? Color.DarkRed : SystemColors.ControlText);
foreach (CheckBox c in udmfactivates.Checkboxes)
{
LinedefActivateInfo ai = (c.Tag as LinedefActivateInfo);
if (ai.IsTrigger)
c.ForeColor = (!haveactivationflag ? Color.DarkRed : SystemColors.ControlText);
}
} }
else else
{ {

View file

@ -31,7 +31,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
return; return;
} }
// Go for all vertices // Go for all linedefs
foreach (Linedef l in General.Map.Map.Linedefs) foreach (Linedef l in General.Map.Map.Linedefs)
{ {
int action = l.Action; int action = l.Action;
@ -43,7 +43,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
foreach (LinedefActivateInfo ai in General.Map.Config.LinedefActivates) foreach (LinedefActivateInfo ai in General.Map.Config.LinedefActivates)
{ {
if (flags.ContainsKey(ai.Key) && flags[ai.Key] == true) if (flags.ContainsKey(ai.Key) && flags[ai.Key] == true && ai.IsTrigger)
{ {
hasActivation = true; hasActivation = true;
break; break;