mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
Fixed, DECORATE parser: "scale", "xscale" and "yscale" properties are now parsed the same way as in ZDoom.
Fixed, DECORATE parser: parser was unable to parse negative numeric properties.
This commit is contained in:
parent
844ad7db79
commit
aca13330a8
2 changed files with 28 additions and 18 deletions
|
@ -301,20 +301,12 @@ namespace CodeImp.DoomBuilder.Config
|
|||
else
|
||||
this.spritelongname = long.MaxValue;
|
||||
|
||||
// Set sprite scale
|
||||
if(actor.HasPropertyWithValue("scale"))
|
||||
{
|
||||
float scale = actor.GetPropertyValueFloat("scale", 0);
|
||||
this.spritescale = new SizeF(scale, scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(actor.HasPropertyWithValue("xscale"))
|
||||
this.spritescale.Width = actor.GetPropertyValueFloat("xscale", 0);
|
||||
|
||||
if(actor.HasPropertyWithValue("yscale"))
|
||||
this.spritescale.Height = actor.GetPropertyValueFloat("yscale", 0);
|
||||
}
|
||||
// Set sprite scale (mxd. Scale is translated to xscale and yscale in ActorStructure)
|
||||
if(actor.HasPropertyWithValue("xscale"))
|
||||
this.spritescale.Width = actor.GetPropertyValueFloat("xscale", 0);
|
||||
|
||||
if(actor.HasPropertyWithValue("yscale"))
|
||||
this.spritescale.Height = actor.GetPropertyValueFloat("yscale", 0);
|
||||
|
||||
// Size
|
||||
if(actor.HasPropertyWithValue("radius")) radius = actor.GetPropertyValueInt("radius", 0);
|
||||
|
@ -322,8 +314,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
|
||||
// Safety
|
||||
if(this.radius < 4f) this.radius = 8f;
|
||||
if(this.spritescale.Width <= 0.0f) this.spritescale.Width = 1.0f;
|
||||
if(this.spritescale.Height <= 0.0f) this.spritescale.Height = 1.0f;
|
||||
if(this.spritescale.Width == 0.0f) this.spritescale.Width = 1.0f;
|
||||
if(this.spritescale.Height == 0.0f) this.spritescale.Height = 1.0f;
|
||||
|
||||
// Options
|
||||
hangs = actor.GetFlagValue("spawnceiling", hangs);
|
||||
|
|
|
@ -360,7 +360,17 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
if (v == "}") return; //mxd
|
||||
if (v != ",") values.Add(v);
|
||||
}
|
||||
props[token] = values;
|
||||
|
||||
//mxd. Translate scale to xscale and yscale
|
||||
if(token == "scale")
|
||||
{
|
||||
props["xscale"] = values;
|
||||
props["yscale"] = values;
|
||||
}
|
||||
else
|
||||
{
|
||||
props[token] = values;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -479,6 +489,10 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
public int GetPropertyValueInt(string propname, int valueindex)
|
||||
{
|
||||
string str = GetPropertyValueString(propname, valueindex);
|
||||
|
||||
//mxd. It can be negative...
|
||||
if(str == "-" && props.Count > valueindex + 1)
|
||||
str += GetPropertyValueString(propname, valueindex + 1);
|
||||
|
||||
int intvalue;
|
||||
if(int.TryParse(str, NumberStyles.Integer, CultureInfo.InvariantCulture, out intvalue))
|
||||
|
@ -492,7 +506,11 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
public float GetPropertyValueFloat(string propname, int valueindex)
|
||||
{
|
||||
string str = GetPropertyValueString(propname, valueindex);
|
||||
|
||||
|
||||
//mxd. It can be negative...
|
||||
if(str == "-" && props.Count > valueindex + 1)
|
||||
str += GetPropertyValueString(propname, valueindex + 1);
|
||||
|
||||
float fvalue;
|
||||
if(float.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out fvalue))
|
||||
return fvalue;
|
||||
|
|
Loading…
Reference in a new issue