Error Checker: added config options to ignore unknown textures on sidedefs for certain actions. Resolves #518

This commit is contained in:
biwa 2021-02-20 15:04:47 +01:00
parent f8c3768f33
commit 93cc15640f
4 changed files with 54 additions and 5 deletions

View file

@ -867,6 +867,13 @@ create
{ {
title = "Create Fake Ceiling and Floor"; title = "Create Fake Ceiling and Floor";
prefix = ""; prefix = "";
errorchecker
{
ignoreuppertexture = true;
ignoremiddletexture = true;
ignorelowertexture = true;
}
} }
} }

View file

@ -1902,6 +1902,13 @@ zdoom
id = "Transfer_Heights"; id = "Transfer_Heights";
requiresactivation = false; requiresactivation = false;
errorchecker
{
ignoreuppertexture = true;
ignoremiddletexture = true;
ignorelowertexture = true;
}
arg0 arg0
{ {
title = "Sector Tag"; title = "Sector Tag";

View file

@ -26,10 +26,23 @@ using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Config namespace CodeImp.DoomBuilder.Config
{ {
public struct ErrorCheckerExemptions
{
public bool IgnoreUpperTexture;
public bool IgnoreMiddleTexture;
public bool IgnoreLowerTexture;
}
public class LinedefActionInfo : INumberedTitle, IComparable<LinedefActionInfo> public class LinedefActionInfo : INumberedTitle, IComparable<LinedefActionInfo>
{ {
#region ================== Constants #region ================== Constants
#endregion
#region ================== Constants
#endregion #endregion
#region ================== Variables #region ================== Variables
@ -45,6 +58,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly bool isgeneralized; private readonly bool isgeneralized;
private readonly bool isknown; private readonly bool isknown;
private readonly bool requiresactivation; //mxd private readonly bool requiresactivation; //mxd
private readonly ErrorCheckerExemptions errorcheckerexemptions;
#endregion #endregion
@ -61,6 +75,7 @@ namespace CodeImp.DoomBuilder.Config
public bool IsNull { get { return (index == 0); } } public bool IsNull { get { return (index == 0); } }
public bool RequiresActivation { get { return requiresactivation; } } //mxd public bool RequiresActivation { get { return requiresactivation; } } //mxd
public ArgumentInfo[] Args { get { return args; } } public ArgumentInfo[] Args { get { return args; } }
public ErrorCheckerExemptions ErrorCheckerExemptions { get { return errorcheckerexemptions; } }
#endregion #endregion
@ -77,6 +92,7 @@ namespace CodeImp.DoomBuilder.Config
this.args = new ArgumentInfo[Linedef.NUM_ARGS]; this.args = new ArgumentInfo[Linedef.NUM_ARGS];
this.isgeneralized = false; this.isgeneralized = false;
this.isknown = true; this.isknown = true;
this.errorcheckerexemptions = new ErrorCheckerExemptions();
// Read settings // Read settings
this.name = cfg.ReadSetting(actionsetting + ".title", "Unnamed"); this.name = cfg.ReadSetting(actionsetting + ".title", "Unnamed");
@ -86,6 +102,11 @@ namespace CodeImp.DoomBuilder.Config
this.title = this.prefix + " " + this.name; this.title = this.prefix + " " + this.name;
this.title = this.title.Trim(); this.title = this.title.Trim();
// Error checker exemptions
this.errorcheckerexemptions.IgnoreUpperTexture = cfg.ReadSetting(actionsetting + ".errorchecker.ignoreuppertexture", false);
this.errorcheckerexemptions.IgnoreMiddleTexture = cfg.ReadSetting(actionsetting + ".errorchecker.ignoremiddletexture", false);
this.errorcheckerexemptions.IgnoreLowerTexture = cfg.ReadSetting(actionsetting + ".errorchecker.ignorelowertexture", false);
// Read the args // Read the args
for (int i = 0; i < Linedef.NUM_ARGS; i++) for (int i = 0; i < Linedef.NUM_ARGS; i++)
this.args[i] = new ArgumentInfo(cfg, actionsetting, i, enums); this.args[i] = new ArgumentInfo(cfg, actionsetting, i, enums);

View file

@ -16,6 +16,7 @@
#region ================== Namespaces #region ================== Namespaces
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using System.Threading; using System.Threading;
@ -54,20 +55,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Go for all the sidedefs // Go for all the sidedefs
foreach(Sidedef sd in General.Map.Map.Sidedefs) foreach(Sidedef sd in General.Map.Map.Sidedefs)
{ {
bool ignoreuppertexture = false;
bool ignoremiddletexture = false;
bool ignorelowertexture = false;
// Some actions, like transfer heights, use special non-existing texture names for effects. Allow those to be ignored
if(sd.Line.Action != 0)
{
LinedefActionInfo info = General.Map.Config.GetLinedefActionInfo(sd.Line.Action);
ignoreuppertexture = info.ErrorCheckerExemptions.IgnoreUpperTexture;
ignoremiddletexture = info.ErrorCheckerExemptions.IgnoreMiddleTexture;
ignorelowertexture = info.ErrorCheckerExemptions.IgnoreLowerTexture;
}
// Check upper texture // Check upper texture
if(sd.LongHighTexture != MapSet.EmptyLongName && !General.Map.Data.GetTextureExists(sd.LongHighTexture)) if(!ignoreuppertexture && sd.LongHighTexture != MapSet.EmptyLongName && !General.Map.Data.GetTextureExists(sd.LongHighTexture))
{ {
SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Upper)); SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Upper));
} }
// Check middle texture // Check middle texture
if(sd.LongMiddleTexture != MapSet.EmptyLongName && !General.Map.Data.GetTextureExists(sd.LongMiddleTexture)) if(!ignoremiddletexture && sd.LongMiddleTexture != MapSet.EmptyLongName && !General.Map.Data.GetTextureExists(sd.LongMiddleTexture))
{ {
SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Middle)); SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Middle));
} }
// Check lower texture // Check lower texture
if(sd.LongLowTexture != MapSet.EmptyLongName && !General.Map.Data.GetTextureExists(sd.LongLowTexture)) if(!ignorelowertexture && sd.LongLowTexture != MapSet.EmptyLongName && !General.Map.Data.GetTextureExists(sd.LongLowTexture))
{ {
SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Lower)); SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Lower));
} }