diff --git a/Source/Core/Config/ThingTypeInfo.cs b/Source/Core/Config/ThingTypeInfo.cs index 1e110f1..a15f4bd 100644 --- a/Source/Core/Config/ThingTypeInfo.cs +++ b/Source/Core/Config/ThingTypeInfo.cs @@ -446,8 +446,19 @@ namespace CodeImp.DoomBuilder.Config else this.spritelongname = long.MaxValue; - // We have no destructor - GC.SuppressFinalize(this); + // Custom flag, parameter and angle labels + for (int i = 1; i <= 8; i *= 2) + if (o.flagstext.ContainsKey(i.ToString())) + this.flags[i.ToString()] = o.flagstext[i.ToString()]; + else + this.flags[i.ToString()] = General.Map.Config.ThingFlags[i.ToString()]; + + if (o.angletext != "") this.angletext = o.angletext; + if (o.parametertext != "") this.parametertext = o.parametertext; + if (o.flagsvaluetext != "") this.flagsvaluetext = o.flagsvaluetext; + + // We have no destructor + GC.SuppressFinalize(this); } // Constructor diff --git a/Source/Core/SRB2/LuaObjectParser.cs b/Source/Core/SRB2/LuaObjectParser.cs index 7535e23..ab73c0a 100644 --- a/Source/Core/SRB2/LuaObjectParser.cs +++ b/Source/Core/SRB2/LuaObjectParser.cs @@ -127,6 +127,10 @@ namespace CodeImp.DoomBuilder.SRB2 int radius = 0; int height = 0; int flags = 0; + Dictionary newflags = new Dictionary(); + string angletext = ""; + string parametertext = ""; + string flagsvaluetext = ""; SkipWhitespace(true); token = ReadToken(); @@ -175,6 +179,30 @@ namespace CodeImp.DoomBuilder.SRB2 token = ReadLine(); category = token; break; + case "$Flags1Text": + case "$Flags2Text": + case "$Flags4Text": + case "$Flags8Text": + string index = token.Substring(6,1); + SkipWhitespace(true); + token = ReadLine(); + newflags[index] = "[" + index + "] " + ZDTextParser.StripQuotes(token); + break; + case "$AngleText": + SkipWhitespace(true); + token = ReadLine(); + angletext = ZDTextParser.StripQuotes(token); + break; + case "$ParameterText": + SkipWhitespace(true); + token = ReadLine(); + parametertext = ZDTextParser.StripQuotes(token); + break; + case "$FlagsValueText": + SkipWhitespace(true); + token = ReadLine(); + flagsvaluetext = ZDTextParser.StripQuotes(token); + break; case "doomednum": if (!ReadParameter(out token, out finished)) return false; if (!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out mapThingNum)) @@ -266,7 +294,8 @@ namespace CodeImp.DoomBuilder.SRB2 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); if (objects.ContainsKey(objname)) objects[objname] = o; else diff --git a/Source/Core/SRB2/SOCObjectParser.cs b/Source/Core/SRB2/SOCObjectParser.cs index 837bab8..66fa928 100644 --- a/Source/Core/SRB2/SOCObjectParser.cs +++ b/Source/Core/SRB2/SOCObjectParser.cs @@ -179,6 +179,10 @@ namespace CodeImp.DoomBuilder.SRB2 int radius = 0; int height = 0; int flags = 0; + Dictionary newflags = new Dictionary(); + string angletext = ""; + string parametertext = ""; + string flagsvaluetext = ""; while (!streamreader.EndOfStream) { string line = streamreader.ReadLine(); @@ -207,6 +211,28 @@ namespace CodeImp.DoomBuilder.SRB2 category = line.Substring(11); continue; } + if (line.StartsWith("#$Flags")) + { + string index = line.Substring(7, 1); + if (line.Substring(8, 5) == "Text ") + newflags[index] = "[" + index + "] " + ZDTextParser.StripQuotes(line.Substring(13)); + continue; + } + if (line.StartsWith("#$AngleText ")) + { + angletext = ZDTextParser.StripQuotes(line.Substring(12)); + continue; + } + if (line.StartsWith("#$ParameterText ")) + { + parametertext = ZDTextParser.StripQuotes(line.Substring(16)); + continue; + } + if (line.StartsWith("#$FlagsValueText ")) + { + flagsvaluetext = ZDTextParser.StripQuotes(line.Substring(17)); + continue; + } if (line.StartsWith("#")) continue; line = RemoveComments(line); string[] tokens = line.Split(new char[] { '=' }); @@ -266,7 +292,8 @@ namespace CodeImp.DoomBuilder.SRB2 } 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); if (objects.ContainsKey(objname)) objects[objname] = o; else diff --git a/Source/Core/SRB2/SRB2Object.cs b/Source/Core/SRB2/SRB2Object.cs index 6010c3c..d4f9e08 100644 --- a/Source/Core/SRB2/SRB2Object.cs +++ b/Source/Core/SRB2/SRB2Object.cs @@ -43,13 +43,18 @@ namespace CodeImp.DoomBuilder.SRB2 public readonly int radius; public readonly int height; public readonly int flags; + public readonly Dictionary flagstext; + public readonly string angletext; + public readonly string parametertext; + public readonly string flagsvaluetext; #endregion #region ================== Constructor / Disposer // 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 flagstext, string angletext, string parametertext, string flagsvaluetext) { this.name = name; this.sprite = sprite; @@ -59,6 +64,10 @@ namespace CodeImp.DoomBuilder.SRB2 this.radius = radius; this.height = height; this.flags = flags; + this.flagstext = flagstext; + this.angletext = angletext; + this.parametertext = parametertext; + this.flagsvaluetext = flagsvaluetext; } #endregion