mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Allow custom flag, angle and parameter labels for custom objects.
This commit is contained in:
parent
f63047400d
commit
ae256ac8cb
4 changed files with 81 additions and 5 deletions
|
@ -446,6 +446,17 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
else
|
else
|
||||||
this.spritelongname = long.MaxValue;
|
this.spritelongname = long.MaxValue;
|
||||||
|
|
||||||
|
// 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
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,10 @@ namespace CodeImp.DoomBuilder.SRB2
|
||||||
int radius = 0;
|
int radius = 0;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
Dictionary<string, string> newflags = new Dictionary<string, string>();
|
||||||
|
string angletext = "";
|
||||||
|
string parametertext = "";
|
||||||
|
string flagsvaluetext = "";
|
||||||
|
|
||||||
SkipWhitespace(true);
|
SkipWhitespace(true);
|
||||||
token = ReadToken();
|
token = ReadToken();
|
||||||
|
@ -175,6 +179,30 @@ namespace CodeImp.DoomBuilder.SRB2
|
||||||
token = ReadLine();
|
token = ReadLine();
|
||||||
category = token;
|
category = token;
|
||||||
break;
|
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":
|
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))
|
||||||
|
@ -266,7 +294,8 @@ 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);
|
||||||
if (objects.ContainsKey(objname))
|
if (objects.ContainsKey(objname))
|
||||||
objects[objname] = o;
|
objects[objname] = o;
|
||||||
else
|
else
|
||||||
|
|
|
@ -179,6 +179,10 @@ namespace CodeImp.DoomBuilder.SRB2
|
||||||
int radius = 0;
|
int radius = 0;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
Dictionary<string, string> newflags = new Dictionary<string, string>();
|
||||||
|
string angletext = "";
|
||||||
|
string parametertext = "";
|
||||||
|
string flagsvaluetext = "";
|
||||||
while (!streamreader.EndOfStream)
|
while (!streamreader.EndOfStream)
|
||||||
{
|
{
|
||||||
string line = streamreader.ReadLine();
|
string line = streamreader.ReadLine();
|
||||||
|
@ -207,6 +211,28 @@ namespace CodeImp.DoomBuilder.SRB2
|
||||||
category = line.Substring(11);
|
category = line.Substring(11);
|
||||||
continue;
|
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;
|
if (line.StartsWith("#")) continue;
|
||||||
line = RemoveComments(line);
|
line = RemoveComments(line);
|
||||||
string[] tokens = line.Split(new char[] { '=' });
|
string[] tokens = line.Split(new char[] { '=' });
|
||||||
|
@ -266,7 +292,8 @@ 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);
|
||||||
if (objects.ContainsKey(objname))
|
if (objects.ContainsKey(objname))
|
||||||
objects[objname] = o;
|
objects[objname] = o;
|
||||||
else
|
else
|
||||||
|
|
|
@ -43,13 +43,18 @@ namespace CodeImp.DoomBuilder.SRB2
|
||||||
public readonly int radius;
|
public readonly int radius;
|
||||||
public readonly int height;
|
public readonly int height;
|
||||||
public readonly int flags;
|
public readonly int flags;
|
||||||
|
public readonly Dictionary<string, string> flagstext;
|
||||||
|
public readonly string angletext;
|
||||||
|
public readonly string parametertext;
|
||||||
|
public readonly string flagsvaluetext;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Constructor / Disposer
|
#region ================== Constructor / Disposer
|
||||||
|
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.sprite = sprite;
|
this.sprite = sprite;
|
||||||
|
@ -59,6 +64,10 @@ namespace CodeImp.DoomBuilder.SRB2
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
|
this.flagstext = flagstext;
|
||||||
|
this.angletext = angletext;
|
||||||
|
this.parametertext = parametertext;
|
||||||
|
this.flagsvaluetext = flagsvaluetext;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue