Added support for DECORATE 'scale' property in actors (sprites in Visual Mode now scale accordingly)

This commit is contained in:
codeimp 2010-07-31 21:17:49 +00:00
parent 72d688f8d0
commit d1d917da96
3 changed files with 16 additions and 0 deletions

View file

@ -57,6 +57,7 @@ namespace CodeImp.DoomBuilder.Config
private bool arrow;
private float radius;
private float height;
private float spritescale;
private bool hangs;
private int blocking;
private int errorcheck;
@ -87,6 +88,7 @@ namespace CodeImp.DoomBuilder.Config
public bool IsKnown { get { return isknown; } }
public bool IsNull { get { return (index == 0); } }
public bool AbsoluteZ { get { return absolutez; } }
public float SpriteScale { get { return spritescale; } }
#endregion
@ -112,6 +114,7 @@ namespace CodeImp.DoomBuilder.Config
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
this.isknown = false;
this.absolutez = false;
this.spritescale = 1.0f;
// We have no destructor
GC.SuppressFinalize(this);
@ -127,6 +130,7 @@ namespace CodeImp.DoomBuilder.Config
this.category = cat;
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
this.isknown = true;
this.spritescale = 1.0f;
// Read properties
this.title = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".title", "<" + key + ">");
@ -168,6 +172,7 @@ namespace CodeImp.DoomBuilder.Config
this.category = cat;
this.title = title;
this.isknown = true;
this.spritescale = 1.0f;
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
for(int i = 0; i < Linedef.NUM_ARGS; i++) this.args[i] = new ArgumentInfo(i);
@ -204,6 +209,7 @@ namespace CodeImp.DoomBuilder.Config
this.category = cat;
this.title = "";
this.isknown = true;
this.spritescale = 1.0f;
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
for(int i = 0; i < Linedef.NUM_ARGS; i++) this.args[i] = new ArgumentInfo(i);
@ -254,6 +260,9 @@ namespace CodeImp.DoomBuilder.Config
// Size
if(actor.HasPropertyWithValue("radius")) radius = actor.GetPropertyValueInt("radius", 0);
if(actor.HasPropertyWithValue("height")) height = actor.GetPropertyValueInt("height", 0);
// Scale
if(actor.HasPropertyWithValue("scale")) spritescale = actor.GetPropertyValueFloat("scale", 0);
// Safety
if(this.radius < 4f) this.radius = 8f;

View file

@ -122,6 +122,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
offsety = (sprite as SpriteImage).OffsetY - height;
}
// Scale by thing type/actor scale
// We do this after the offset x/y determination above, because that is entirely in sprite pixels space
radius *= info.SpriteScale;
height *= info.SpriteScale;
offsetx *= info.SpriteScale;
offsety *= info.SpriteScale;
// Make vertices
WorldVertex[] verts = new WorldVertex[6];
verts[0] = new WorldVertex(-radius + offsetx, 0.0f, 0.0f + offsety, sectorcolor.ToInt(), 0.0f, 1.0f);

Binary file not shown.