Skip to content
Snippets Groups Projects
Commit d1d917da authored by codeimp's avatar codeimp
Browse files

Added support for DECORATE 'scale' property in actors (sprites in Visual Mode...

Added support for DECORATE 'scale' property in actors (sprites in Visual Mode now scale accordingly)
parent 72d688f8
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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);
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment