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

@ -862,11 +862,18 @@ wind/current
create
{
title = "Create";
242
{
title = "Create Fake Ceiling and Floor";
prefix = "";
errorchecker
{
ignoreuppertexture = true;
ignoremiddletexture = true;
ignorelowertexture = true;
}
}
}

View file

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

View file

@ -26,10 +26,23 @@ using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Config
{
public struct ErrorCheckerExemptions
{
public bool IgnoreUpperTexture;
public bool IgnoreMiddleTexture;
public bool IgnoreLowerTexture;
}
public class LinedefActionInfo : INumberedTitle, IComparable<LinedefActionInfo>
{
#region ================== Constants
#endregion
#region ================== Constants
#endregion
#region ================== Variables
@ -45,6 +58,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly bool isgeneralized;
private readonly bool isknown;
private readonly bool requiresactivation; //mxd
private readonly ErrorCheckerExemptions errorcheckerexemptions;
#endregion
@ -61,6 +75,7 @@ namespace CodeImp.DoomBuilder.Config
public bool IsNull { get { return (index == 0); } }
public bool RequiresActivation { get { return requiresactivation; } } //mxd
public ArgumentInfo[] Args { get { return args; } }
public ErrorCheckerExemptions ErrorCheckerExemptions { get { return errorcheckerexemptions; } }
#endregion
@ -77,6 +92,7 @@ namespace CodeImp.DoomBuilder.Config
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
this.isgeneralized = false;
this.isknown = true;
this.errorcheckerexemptions = new ErrorCheckerExemptions();
// Read settings
this.name = cfg.ReadSetting(actionsetting + ".title", "Unnamed");
@ -86,8 +102,13 @@ namespace CodeImp.DoomBuilder.Config
this.title = this.prefix + " " + this.name;
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
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);
// We have no destructor

View file

@ -16,6 +16,7 @@
#region ================== Namespaces
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map;
using System.Threading;
@ -54,20 +55,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Go for all the 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
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));
}
// 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));
}
// 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));
}