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

View file

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

View file

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

View file

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

View file

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

View file

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