Add angle arrow setting for individual thing definitions

This commit is contained in:
spherallic 2022-12-19 20:55:10 +01:00
parent bed5298a3f
commit 515df9c1e9
6 changed files with 70 additions and 14 deletions

View File

@ -4230,6 +4230,7 @@ thingtypes
sprite = "internal:capsule";
angletext = "Tag";
fixedrotation = 1;
tagthing = true;
}
292
{
@ -4464,6 +4465,7 @@ thingtypes
flags8text = "[8] Random (Weak)";
angletext = "Tag";
fixedrotation = 1;
tagthing = true;
400
{
@ -4596,6 +4598,7 @@ thingtypes
flags1text = "[1] Run linedef executor on pop";
angletext = "Tag";
fixedrotation = 1;
tagthing = true;
431
{
@ -5090,6 +5093,7 @@ thingtypes
fixedrotation = 1;
parametertext = "Absolute?";
flagsvaluetext = "Absolute Z";
tagthing = true;
}
751
@ -5140,6 +5144,7 @@ thingtypes
height = 16;
angletext = "Tag";
fixedrotation = 1;
tagthing = true;
}
757
{
@ -5149,6 +5154,7 @@ thingtypes
height = 16;
angletext = "Tag";
fixedrotation = 1;
tagthing = true;
}
758
{
@ -5161,6 +5167,7 @@ thingtypes
sprite = "internal:polyanchor";
angletext = "Tag";
fixedrotation = 1;
tagthing = true;
}
761
@ -5169,6 +5176,7 @@ thingtypes
sprite = "internal:polycenter";
angletext = "Tag";
fixedrotation = 1;
tagthing = true;
}
762
@ -5177,6 +5185,7 @@ thingtypes
sprite = "internal:polycentercrush";
angletext = "Tag";
fixedrotation = 1;
tagthing = true;
}
780
{
@ -5523,6 +5532,7 @@ thingtypes
angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
tagthing = true;
}
1105
{
@ -5535,6 +5545,7 @@ thingtypes
angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
tagthing = true;
}
1106
{
@ -5547,6 +5558,7 @@ thingtypes
angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
tagthing = true;
}
1107
{
@ -5558,6 +5570,7 @@ thingtypes
angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
tagthing = true;
}
1108
{
@ -5579,6 +5592,7 @@ thingtypes
angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
tagthing = true;
}
1110
{
@ -5590,6 +5604,7 @@ thingtypes
angletext = "Tag";
parametertext = "Spokes";
fixedrotation = 1;
tagthing = true;
}
1111
{
@ -5771,6 +5786,7 @@ thingtypes
height = 16;
angletext = "Tag";
fixedrotation = 1;
tagthing = true;
}
1203
{

View File

@ -66,6 +66,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly string angletext;
private readonly string flagsvaluetext;
private readonly string parametertext;
private readonly bool tagthing;
// Disposing
private bool isdisposed;
@ -106,6 +107,7 @@ namespace CodeImp.DoomBuilder.Config
public string AngleText { get { return angletext; } }
public string FlagsValueText { get { return flagsvaluetext; } }
public string ParameterText { get { return parametertext; } }
public bool IsTagThing { get { return tagthing; } }
#endregion
#region ================== Constructor / Disposer
@ -144,6 +146,7 @@ namespace CodeImp.DoomBuilder.Config
this.angletext = parent.angletext;
this.flagsvaluetext = parent.flagsvaluetext;
this.parametertext = parent.parametertext;
this.tagthing = parent.tagthing;
this.flags = parent.flags;
}
// Set default properties
@ -171,6 +174,7 @@ namespace CodeImp.DoomBuilder.Config
this.angletext = "Angle";
this.flagsvaluetext = "Flags value";
this.parametertext = "Parameter";
this.tagthing = false;
this.flags = new Dictionary<string, string>();
}
@ -195,7 +199,7 @@ namespace CodeImp.DoomBuilder.Config
if(this.title == name)
{
string[] props = new[] { "sprite", "sort", "color", "alpha", "renderstyle", "arrow", "width",
"height", "hangs", "blocking", "error", "fixedsize", "fixedrotation", "absolutez", "spritescale" };
"height", "hangs", "blocking", "error", "fixedsize", "fixedrotation", "absolutez", "spritescale", "tagthing" };
isinvalid = true;
foreach(string prop in props)
@ -234,6 +238,7 @@ namespace CodeImp.DoomBuilder.Config
this.angletext = cfg.ReadSetting("thingtypes." + name + ".angletext", parent.angletext);
this.flagsvaluetext = cfg.ReadSetting("thingtypes." + name + ".flagsvaluetext", parent.flagsvaluetext);
this.parametertext = cfg.ReadSetting("thingtypes." + name + ".parametertext", parent.parametertext);
this.tagthing = cfg.ReadSetting("thingtypes." + name + ".tagthing", parent.tagthing);
}
else
{
@ -259,6 +264,7 @@ namespace CodeImp.DoomBuilder.Config
this.angletext = cfg.ReadSetting("thingtypes." + name + ".angletext", "Angle");
this.flagsvaluetext = cfg.ReadSetting("thingtypes." + name + ".flagsvaluetext", "Flags value");
this.parametertext = cfg.ReadSetting("thingtypes." + name + ".parametertext", "Parameter");
this.tagthing = cfg.ReadSetting("thingtypes." + name + ".tagthing", false);
}
// Safety

View File

@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.Config
private string renderstyle; //mxd
private bool bright; //mxd
private bool arrow;
private bool tagthing;
private float radius;
private float height;
private bool hangs;
@ -104,6 +105,7 @@ namespace CodeImp.DoomBuilder.Config
public string RenderStyle { get { return renderstyle; } } //mxd
public bool Bright { get { return bright; } } //mxd
public bool Arrow { get { return arrow; } }
public bool IsTagThing { get { return tagthing; } }
public float Radius { get { return radius; } }
public float Height { get { return height; } }
public bool Hangs { get { return hangs; } }
@ -154,6 +156,7 @@ namespace CodeImp.DoomBuilder.Config
this.renderstyle = "normal"; //mxd
this.bright = false; //mxd
this.arrow = true;
this.tagthing = false;
this.radius = 10f;
this.height = 20f;
this.hangs = false;
@ -260,6 +263,7 @@ namespace CodeImp.DoomBuilder.Config
this.sprite = cat.Sprite;
this.color = cat.Color;
this.arrow = (cat.Arrow != 0);
this.tagthing = (cat.IsTagThing);
this.alpha = cat.Alpha; //mxd
this.alphabyte = (byte)(this.alpha * 255); //mxd
this.renderstyle = cat.RenderStyle; //mxd
@ -318,6 +322,7 @@ namespace CodeImp.DoomBuilder.Config
this.alphabyte = (byte)(this.alpha * 255); //mxd
this.renderstyle = cat.RenderStyle; //mxd
this.arrow = (cat.Arrow != 0);
this.tagthing = cat.IsTagThing;
this.radius = cat.Radius;
this.height = cat.Height;
this.hangs = (cat.Hangs != 0);
@ -368,6 +373,7 @@ namespace CodeImp.DoomBuilder.Config
this.alphabyte = (byte)(this.alpha * 255); //mxd
this.renderstyle = cat.RenderStyle; //mxd
this.arrow = (cat.Arrow != 0);
this.tagthing = cat.IsTagThing;
this.radius = cat.Radius;
this.height = cat.Height;
this.hangs = (cat.Hangs != 0);
@ -417,7 +423,8 @@ namespace CodeImp.DoomBuilder.Config
this.alpha = cat.Alpha; //mxd
this.alphabyte = (byte)(this.alpha * 255); //mxd
this.renderstyle = cat.RenderStyle; //mxd
this.arrow = (cat.Arrow != 0);
this.arrow = (cat.Arrow != 0) || o.arrow;
this.tagthing = o.tagthing;
this.radius = o.radius;
this.height = o.height;
this.hangs = o.Hangs();
@ -483,6 +490,7 @@ namespace CodeImp.DoomBuilder.Config
this.renderstyle = other.renderstyle; //mxd
this.bright = other.bright; //mxd
this.arrow = other.arrow;
this.tagthing = other.tagthing;
this.radius = other.radius;
this.height = other.height;
this.hangs = other.hangs;

View File

@ -9,6 +9,7 @@ using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.ZDoom;
using CodeImp.DoomBuilder.GZBuilder.Data;
using System.Windows.Forms;
#endregion
@ -131,6 +132,8 @@ namespace CodeImp.DoomBuilder.SRB2
string angletext = "";
string parametertext = "";
string flagsvaluetext = "";
bool arrow = false;
bool tagthing = false;
SkipWhitespace(true);
token = ReadToken();
@ -203,6 +206,12 @@ namespace CodeImp.DoomBuilder.SRB2
token = ReadLine();
flagsvaluetext = ZDTextParser.StripQuotes(token);
break;
case "$Arrow":
arrow = true;
break;
case "$TagThing":
tagthing = true;
break;
case "doomednum":
if (!ReadParameter(out token, out finished)) return false;
if (!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out mapThingNum))
@ -295,7 +304,7 @@ namespace CodeImp.DoomBuilder.SRB2
if (mapThingNum > 0)
{
SRB2Object o = new SRB2Object(name, sprite, category, states, mapThingNum, radius, height, flags,
newflags, angletext, parametertext, flagsvaluetext);
newflags, angletext, parametertext, flagsvaluetext, arrow, tagthing);
if (objects.ContainsKey(objname))
objects[objname] = o;
else

View File

@ -9,6 +9,7 @@ using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.ZDoom;
using CodeImp.DoomBuilder.GZBuilder.Data;
using System.Windows.Forms;
#endregion
@ -183,6 +184,8 @@ namespace CodeImp.DoomBuilder.SRB2
string angletext = "";
string parametertext = "";
string flagsvaluetext = "";
bool arrow = false;
bool tagthing = false;
while (!streamreader.EndOfStream)
{
string line = streamreader.ReadLine();
@ -233,6 +236,16 @@ namespace CodeImp.DoomBuilder.SRB2
flagsvaluetext = ZDTextParser.StripQuotes(line.Substring(17));
continue;
}
if (line.StartsWith("#$Arrow"))
{
arrow = true;
continue;
}
if (line.StartsWith("#$TagThing"))
{
tagthing = true;
continue;
}
if (line.StartsWith("#")) continue;
line = RemoveComments(line);
string[] tokens = line.Split(new char[] { '=' });
@ -293,7 +306,7 @@ namespace CodeImp.DoomBuilder.SRB2
if (mapThingNum > 0)
{
SRB2Object o = new SRB2Object(name, sprite, category, states, mapThingNum, radius, height, flags,
newflags, angletext, parametertext, flagsvaluetext);
newflags, angletext, parametertext, flagsvaluetext, arrow, tagthing);
if (objects.ContainsKey(objname))
objects[objname] = o;
else

View File

@ -47,6 +47,8 @@ namespace CodeImp.DoomBuilder.SRB2
public readonly string angletext;
public readonly string parametertext;
public readonly string flagsvaluetext;
public readonly bool arrow;
public readonly bool tagthing;
#endregion
@ -54,7 +56,7 @@ namespace CodeImp.DoomBuilder.SRB2
// Constructor
internal SRB2Object(string name, string sprite, string category, string[] states, int mapThingNum, int radius, int height, int flags,
Dictionary<string, string> flagstext, string angletext, string parametertext, string flagsvaluetext)
Dictionary<string, string> flagstext, string angletext, string parametertext, string flagsvaluetext, bool arrow, bool tagthing)
{
this.name = name;
this.sprite = sprite;
@ -68,6 +70,8 @@ namespace CodeImp.DoomBuilder.SRB2
this.angletext = angletext;
this.parametertext = parametertext;
this.flagsvaluetext = flagsvaluetext;
this.arrow = arrow;
this.tagthing = tagthing;
}
#endregion