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

View file

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

View file

@ -56,7 +56,11 @@ linedefflags_udmf
linedefactivations_udmf
{
repeatspecial = "Repeatable action";
repeatspecial
{
name = "Repeatable action";
istrigger = false;
}
playeruse = "When player presses use";
playercross = "When player walks over";
playerpush = "When player bumps";
@ -66,10 +70,26 @@ linedefactivations_udmf
anycross = "Any crossing non-missile activates";
missilecross = "When projectile crosses";
impact = "On projectile impact";
checkswitchrange = "Switch height check";
passuse = "Pass use on";
firstsideonly = "Front side only";
playeruseback = "Player can use from back side";
checkswitchrange
{
name = "Switch height check";
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.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Reflection;
@ -745,8 +746,18 @@ namespace CodeImp.DoomBuilder.Config
IDictionary dic = cfg.ReadSetting("linedefactivations", new Hashtable());
foreach(DictionaryEntry de in dic)
{
// Add to the list
linedefactivates.Add(new LinedefActivateInfo(de.Key.ToString(), de.Value.ToString()));
// If the value is a dictionary read the values from that
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

View file

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

View file

@ -99,7 +99,7 @@ namespace CodeImp.DoomBuilder.Windows
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)
{

View file

@ -617,7 +617,8 @@ namespace CodeImp.DoomBuilder.Windows
bool haveactivationflag = false;
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;
break;
@ -625,7 +626,13 @@ namespace CodeImp.DoomBuilder.Windows
}
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
{

View file

@ -31,7 +31,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
return;
}
// Go for all vertices
// Go for all linedefs
foreach (Linedef l in General.Map.Map.Linedefs)
{
int action = l.Action;
@ -43,7 +43,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
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;
break;