@ Refactored code to use the term "radius" for thing widths instead of "width"

- Thing properties dialog now shows the actual width of a Thing (not the radius)
This commit is contained in:
codeimp 2009-02-16 10:06:58 +00:00
parent 2047756694
commit ef79592200
5 changed files with 23 additions and 23 deletions

View file

@ -84,7 +84,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
PixelColor sectorcolor = new PixelColor(255, 255, 255, 255);
// Must have a width and height!
if((info.Width < 0.1f) || (info.Height < 0.1f)) return false;
if((info.Radius < 0.1f) || (info.Height < 0.1f)) return false;
if(sprite != null)
{
@ -123,8 +123,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.Texture = General.Map.Data.Hourglass3D;
// Determine sprite size
float radius = Math.Min(info.Width, info.Height / 2f);
float height = Math.Min(info.Width * 2f, info.Height);
float radius = Math.Min(info.Radius, info.Height / 2f);
float height = Math.Min(info.Radius * 2f, info.Height);
// Make vertices
WorldVertex[] verts = new WorldVertex[6];
@ -169,15 +169,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply settings
SetPosition(pos);
SetCageSize(info.Width, info.Height);
SetCageSize(info.Radius, info.Height);
SetCageColor(Thing.Color);
// Keep info for object picking
cageradius2 = info.Width * Angle2D.SQRT2;
cageradius2 = info.Radius * Angle2D.SQRT2;
cageradius2 = cageradius2 * cageradius2;
pos2d = pos;
boxp1 = new Vector3D(pos.x - info.Width, pos.y - info.Width, pos.z);
boxp2 = new Vector3D(pos.x + info.Width, pos.y + info.Width, pos.z + info.Height);
boxp1 = new Vector3D(pos.x - info.Radius, pos.y - info.Radius, pos.z);
boxp2 = new Vector3D(pos.x + info.Radius, pos.y + info.Radius, pos.z + info.Height);
// Done
return true;

View file

@ -52,7 +52,7 @@ namespace CodeImp.DoomBuilder.Config
private string sprite;
private int color;
private int arrow;
private float width;
private float radius;
private float height;
private int hangs;
private int blocking;
@ -72,7 +72,7 @@ namespace CodeImp.DoomBuilder.Config
public bool Sorted { get { return sorted; } }
public int Color { get { return color; } }
public int Arrow { get { return arrow; } }
public float Width { get { return width; } }
public float Radius { get { return radius; } }
public float Height { get { return height; } }
public int Hangs { get { return hangs; } }
public int Blocking { get { return blocking; } }
@ -98,7 +98,7 @@ namespace CodeImp.DoomBuilder.Config
this.sorted = true;
this.color = 18;
this.arrow = 1;
this.width = 10;
this.radius = 10;
this.height = 20;
this.hangs = 0;
this.blocking = 0;
@ -125,7 +125,7 @@ namespace CodeImp.DoomBuilder.Config
this.sorted = (cfg.ReadSetting("thingtypes." + name + ".sort", 0) != 0);
this.color = cfg.ReadSetting("thingtypes." + name + ".color", 0);
this.arrow = cfg.ReadSetting("thingtypes." + name + ".arrow", 0);
this.width = cfg.ReadSetting("thingtypes." + name + ".width", 10);
this.radius = cfg.ReadSetting("thingtypes." + name + ".width", 10);
this.height = cfg.ReadSetting("thingtypes." + name + ".height", 20);
this.hangs = cfg.ReadSetting("thingtypes." + name + ".hangs", 0);
this.blocking = cfg.ReadSetting("thingtypes." + name + ".blocking", 0);
@ -133,7 +133,7 @@ namespace CodeImp.DoomBuilder.Config
this.fixedsize = cfg.ReadSetting("thingtypes." + name + ".fixedsize", false);
// Safety
if(this.width < 8f) this.width = 8f;
if(this.radius < 8f) this.radius = 8f;
// Go for all items in category
dic = cfg.ReadSetting("thingtypes." + name, new Hashtable());

View file

@ -54,7 +54,7 @@ namespace CodeImp.DoomBuilder.Config
private long spritelongname;
private int color;
private bool arrow;
private float width;
private float radius;
private float height;
private bool hangs;
private int blocking;
@ -72,7 +72,7 @@ namespace CodeImp.DoomBuilder.Config
public long SpriteLongName { get { return spritelongname; } }
public int Color { get { return color; } }
public bool Arrow { get { return arrow; } }
public float Width { get { return width; } }
public float Radius { get { return radius; } }
public float Height { get { return height; } }
public bool Hangs { get { return hangs; } }
public int Blocking { get { return blocking; } }
@ -94,7 +94,7 @@ namespace CodeImp.DoomBuilder.Config
this.sprite = DataManager.INTERNAL_PREFIX + "unknownthing";
this.color = 0;
this.arrow = true;
this.width = 10f;
this.radius = 10f;
this.height = 20f;
this.hangs = false;
this.blocking = 0;
@ -120,7 +120,7 @@ namespace CodeImp.DoomBuilder.Config
this.sprite = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".sprite", cat.Sprite);
this.color = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".color", cat.Color);
this.arrow = (cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".arrow", cat.Arrow) != 0);
this.width = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".width", cat.Width);
this.radius = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".width", cat.Radius);
this.height = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".height", cat.Height);
this.hangs = (cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".hangs", cat.Hangs) != 0);
this.blocking = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".blocking", cat.Blocking);
@ -128,7 +128,7 @@ namespace CodeImp.DoomBuilder.Config
this.fixedsize = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".fixedsize", cat.FixedSize);
// Safety
if(this.width < 8f) this.width = 8f;
if(this.radius < 8f) this.radius = 8f;
// Make long name for sprite lookup
if(this.sprite.Length <= 8)
@ -154,7 +154,7 @@ namespace CodeImp.DoomBuilder.Config
this.sprite = cat.Sprite;
this.color = cat.Color;
this.arrow = (cat.Arrow != 0);
this.width = cat.Width;
this.radius = cat.Radius;
this.height = cat.Height;
this.hangs = (cat.Hangs != 0);
this.blocking = cat.Blocking;
@ -183,7 +183,7 @@ namespace CodeImp.DoomBuilder.Config
this.sprite = cat.Sprite;
this.color = cat.Color;
this.arrow = (cat.Arrow != 0);
this.width = cat.Width;
this.radius = cat.Radius;
this.height = cat.Height;
this.hangs = (cat.Hangs != 0);
this.blocking = cat.Blocking;
@ -220,11 +220,11 @@ namespace CodeImp.DoomBuilder.Config
this.spritelongname = long.MaxValue;
// Size
if(actor.RadiusFound) width = actor.Radius;
if(actor.RadiusFound) radius = actor.Radius;
if(actor.HeightFound) height = actor.Height;
// Safety
if(this.width < 8f) this.width = 8f;
if(this.radius < 8f) this.radius = 8f;
// Options
hangs = actor.GetFlagValue("spawnceiling", hangs);

View file

@ -367,7 +367,7 @@ namespace CodeImp.DoomBuilder.Map
ti = General.Map.Data.GetThingInfo(type);
// Apply size
size = ti.Width;
size = ti.Radius;
fixedsize = ti.FixedSize;
// Color valid?

View file

@ -289,7 +289,7 @@ namespace CodeImp.DoomBuilder.Windows
knownthing = true;
// Size
sizelabel.Text = ti.Width + " x " + ti.Height;
sizelabel.Text = (ti.Radius * 2) + " x " + ti.Height;
// Hangs from ceiling
if(ti.Hangs) positionlabel.Text = "Ceiling"; else positionlabel.Text = "Floor";