2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Globalization;
|
|
|
|
using CodeImp.DoomBuilder.IO;
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Config
|
|
|
|
{
|
2021-02-20 14:04:47 +00:00
|
|
|
public struct ErrorCheckerExemptions
|
|
|
|
{
|
|
|
|
public bool IgnoreUpperTexture;
|
|
|
|
public bool IgnoreMiddleTexture;
|
|
|
|
public bool IgnoreLowerTexture;
|
2021-09-03 16:31:36 +00:00
|
|
|
public bool FloorLowerToLowest;
|
|
|
|
public bool FloorRaiseToNextHigher;
|
|
|
|
public bool FloorRaiseToHighest;
|
2021-02-20 14:04:47 +00:00
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
public class LinedefActionInfo : INumberedTitle, IComparable<LinedefActionInfo>
|
|
|
|
{
|
|
|
|
#region ================== Constants
|
|
|
|
|
2021-02-20 14:04:47 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constants
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
// Properties
|
2014-09-15 23:37:55 +00:00
|
|
|
private readonly int index;
|
|
|
|
private readonly string prefix;
|
|
|
|
private readonly string category;
|
|
|
|
private readonly string name;
|
|
|
|
private readonly string title;
|
2014-12-05 14:33:31 +00:00
|
|
|
private readonly string id; //mxd. wiki-compatible name
|
2014-09-15 23:37:55 +00:00
|
|
|
private readonly ArgumentInfo[] args;
|
2022-12-30 17:37:26 +00:00
|
|
|
private readonly ArgumentInfo[] stringargs;
|
2014-09-15 23:37:55 +00:00
|
|
|
private readonly bool isgeneralized;
|
|
|
|
private readonly bool isknown;
|
|
|
|
private readonly bool requiresactivation; //mxd
|
2021-08-25 18:31:28 +00:00
|
|
|
private readonly bool linetolinetag;
|
|
|
|
private readonly bool linetolinesameaction;
|
2021-02-20 14:04:47 +00:00
|
|
|
private readonly ErrorCheckerExemptions errorcheckerexemptions;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
public int Index { get { return index; } }
|
|
|
|
public string Prefix { get { return prefix; } }
|
|
|
|
public string Category { get { return category; } }
|
|
|
|
public string Name { get { return name; } }
|
|
|
|
public string Title { get { return title; } }
|
2014-12-05 14:33:31 +00:00
|
|
|
public string Id { get { return id; } } //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
public bool IsGeneralized { get { return isgeneralized; } }
|
|
|
|
public bool IsKnown { get { return isknown; } }
|
|
|
|
public bool IsNull { get { return (index == 0); } }
|
2014-09-15 23:37:55 +00:00
|
|
|
public bool RequiresActivation { get { return requiresactivation; } } //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
public ArgumentInfo[] Args { get { return args; } }
|
2022-12-30 17:37:26 +00:00
|
|
|
public ArgumentInfo[] StringArgs { get { return stringargs; } }
|
2021-08-25 18:31:28 +00:00
|
|
|
public bool LineToLineTag { get { return linetolinetag; } }
|
|
|
|
public bool LineToLineSameAction { get { return linetolinesameaction; } }
|
2021-02-20 14:04:47 +00:00
|
|
|
public ErrorCheckerExemptions ErrorCheckerExemptions { get { return errorcheckerexemptions; } }
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
internal LinedefActionInfo(int index, Configuration cfg, string categoryname, IDictionary<string, EnumList> enums)
|
|
|
|
{
|
|
|
|
string actionsetting = "linedeftypes." + categoryname + "." + index.ToString(CultureInfo.InvariantCulture);
|
|
|
|
|
|
|
|
// Initialize
|
|
|
|
this.index = index;
|
|
|
|
this.category = categoryname;
|
|
|
|
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
|
2022-12-30 17:37:26 +00:00
|
|
|
this.stringargs = new ArgumentInfo[Linedef.NUM_STRING_ARGS];
|
2009-04-19 18:07:22 +00:00
|
|
|
this.isgeneralized = false;
|
|
|
|
this.isknown = true;
|
2021-02-20 14:04:47 +00:00
|
|
|
this.errorcheckerexemptions = new ErrorCheckerExemptions();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Read settings
|
|
|
|
this.name = cfg.ReadSetting(actionsetting + ".title", "Unnamed");
|
2014-12-05 14:33:31 +00:00
|
|
|
this.id = cfg.ReadSetting(actionsetting + ".id", string.Empty); //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
this.prefix = cfg.ReadSetting(actionsetting + ".prefix", "");
|
2014-09-15 23:37:55 +00:00
|
|
|
this.requiresactivation = cfg.ReadSetting(actionsetting + ".requiresactivation", true); //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
this.title = this.prefix + " " + this.name;
|
|
|
|
this.title = this.title.Trim();
|
|
|
|
|
2021-08-25 18:31:28 +00:00
|
|
|
// Read line-to-line associations
|
|
|
|
this.linetolinetag = cfg.ReadSetting(actionsetting + ".linetolinetag", false);
|
|
|
|
this.linetolinesameaction = cfg.ReadSetting(actionsetting + ".linetolinesameaction", false);
|
|
|
|
|
2021-02-20 14:04:47 +00:00
|
|
|
// 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);
|
2021-09-03 16:31:36 +00:00
|
|
|
this.errorcheckerexemptions.FloorLowerToLowest = cfg.ReadSetting(actionsetting + ".errorchecker.floorlowertolowest", false);
|
|
|
|
this.errorcheckerexemptions.FloorRaiseToNextHigher = cfg.ReadSetting(actionsetting + ".errorchecker.floorraisetonexthigher", false);
|
|
|
|
this.errorcheckerexemptions.FloorRaiseToHighest = cfg.ReadSetting(actionsetting + ".errorchecker.floorraisetohighest", false);
|
2021-02-20 14:04:47 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Read the args
|
2022-12-28 22:04:32 +00:00
|
|
|
for (int i = 0; i < this.args.Length; i++)
|
2022-12-30 17:37:26 +00:00
|
|
|
this.args[i] = new ArgumentInfo(cfg, actionsetting, i, false, enums);
|
|
|
|
for (int i = 0; i < this.stringargs.Length; i++)
|
|
|
|
this.stringargs[i] = new ArgumentInfo(cfg, actionsetting, i, true, enums);
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// We have no destructor
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Constructor for generalized type display
|
|
|
|
internal LinedefActionInfo(int index, string title, bool isknown, bool isgeneralized)
|
|
|
|
{
|
|
|
|
this.index = index;
|
|
|
|
this.isgeneralized = isgeneralized;
|
|
|
|
this.isknown = isknown;
|
2014-09-15 23:37:55 +00:00
|
|
|
this.requiresactivation = true; //mxd. Unused, set for consistency sake.
|
2009-04-19 18:07:22 +00:00
|
|
|
this.title = title;
|
|
|
|
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
|
2022-12-30 17:37:26 +00:00
|
|
|
this.stringargs = new ArgumentInfo[Linedef.NUM_STRING_ARGS];
|
|
|
|
for (int i = 0; i < this.args.Length; i++)
|
|
|
|
this.args[i] = new ArgumentInfo(i, false);
|
|
|
|
for (int i = 0; i < this.stringargs.Length; i++)
|
|
|
|
this.stringargs[i] = new ArgumentInfo(i, true);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
// This presents the item as string
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return index + " - " + title;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This compares against another action info
|
|
|
|
public int CompareTo(LinedefActionInfo other)
|
|
|
|
{
|
|
|
|
if(this.index < other.index) return -1;
|
|
|
|
else if(this.index > other.index) return 1;
|
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|