Things that float when the Ambush flag is checked are now handled via the config

This commit is contained in:
MascaraSnake 2016-01-14 23:13:34 +01:00
parent b498b0123a
commit 23f7be610a
11 changed files with 38 additions and 33 deletions

View file

@ -2761,7 +2761,7 @@ thingtypes
title = "Rings and Weapon Panels";
width = 24;
height = 24;
deafheight = 32;
flags8height = 24;
flags8text = "[8] Float";
sprite = "RINGA0";
@ -2879,7 +2879,7 @@ thingtypes
sprite = "internal:token";
width = 8;
height = 16;
deafheight = 32;
flags8height = 24;
flags4text = "[4] Mario Block version";
flags8text = "[8] Float";
}
@ -2929,7 +2929,7 @@ thingtypes
sprite = "CEMGA0";
width = 8;
height = 16;
deafheight = 32;
flags8height = 24;
flags8text = "[8] Float";
}
}
@ -3464,7 +3464,7 @@ thingtypes
sprite = "SPIKA0";
width = 12;
height = 24;
deafheight = 32;
flags8height = 24;
flags8text = "[8] Float";
}
523
@ -4172,7 +4172,7 @@ thingtypes
title = "Coin";
sprite = "COINA0";
height = 24;
deafheight = 32;
flags8height = 24;
flags8text = "[8] Float";
}
1801

View file

@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly bool fixedrotation; //mxd
private readonly bool absolutez;
private readonly float spritescale;
private readonly int heightoffset;
// Disposing
private bool isdisposed;
@ -92,13 +93,14 @@ namespace CodeImp.DoomBuilder.Config
public bool AbsoluteZ { get { return absolutez; } }
public float SpriteScale { get { return spritescale; } }
public List<ThingTypeInfo> Things { get { return things; } }
public int HeightOffset { get { return heightoffset; } }
#endregion
#endregion
#region ================== Constructor / Disposer
// Constructor
internal ThingCategory(ThingCategory parent, string name, string title)
#region ================== Constructor / Disposer
// Constructor
internal ThingCategory(ThingCategory parent, string name, string title)
{
// Initialize
this.name = name;
@ -124,6 +126,7 @@ namespace CodeImp.DoomBuilder.Config
this.fixedrotation = parent.fixedrotation;
this.absolutez = parent.absolutez;
this.spritescale = parent.spritescale;
this.heightoffset = parent.heightoffset;
}
// Set default properties
else
@ -143,7 +146,8 @@ namespace CodeImp.DoomBuilder.Config
this.fixedrotation = false; //mxd
this.absolutez = false;
this.spritescale = 1.0f;
}
this.heightoffset = 0;
}
// We have no destructor
GC.SuppressFinalize(this);
@ -198,7 +202,8 @@ namespace CodeImp.DoomBuilder.Config
this.fixedrotation = cfg.ReadSetting("thingtypes." + name + ".fixedrotation", parent.fixedrotation);
this.absolutez = cfg.ReadSetting("thingtypes." + name + ".absolutez", parent.absolutez);
this.spritescale = cfg.ReadSetting("thingtypes." + name + ".spritescale", parent.spritescale);
}
this.heightoffset = cfg.ReadSetting("thingtypes." + name + ".flags8height", parent.heightoffset);
}
else
{
this.sprite = cfg.ReadSetting("thingtypes." + name + ".sprite", "");
@ -216,10 +221,11 @@ namespace CodeImp.DoomBuilder.Config
this.fixedrotation = cfg.ReadSetting("thingtypes." + name + ".fixedrotation", false); //mxd
this.absolutez = cfg.ReadSetting("thingtypes." + name + ".absolutez", false);
this.spritescale = cfg.ReadSetting("thingtypes." + name + ".spritescale", 1.0f);
}
// Safety
if(this.radius < 4f) this.radius = 8f;
this.heightoffset = cfg.ReadSetting("thingtypes." + name + ".flags8height", 0);
}
// Safety
if (this.radius < 4f) this.radius = 8f;
// Go for all items in category
IDictionary dic = cfg.ReadSetting("thingtypes." + name, new Hashtable());

View file

@ -75,6 +75,7 @@ namespace CodeImp.DoomBuilder.Config
private bool obsolete; //mxd
private string obsoletemessage; //mxd
private IDictionary<string, string> flags;
private int heightoffset;
//mxd. GLOOME rendering settings
private Thing.SpriteRenderMode rendermode;
@ -119,13 +120,14 @@ namespace CodeImp.DoomBuilder.Config
public Thing.SpriteRenderMode RenderMode { get { return rendermode; } }
public bool RollSprite { get { return rollsprite; } }
public bool StickToPlane { get { return sticktoplane; } }
public int HeightOffset { get { return heightoffset; } }
#endregion
#endregion
#region ================== Constructor / Disposer
#region ================== Constructor / Disposer
// Constructor
internal ThingTypeInfo(int index)
// Constructor
internal ThingTypeInfo(int index)
{
// Initialize
this.index = index;
@ -155,6 +157,7 @@ namespace CodeImp.DoomBuilder.Config
this.xybillboard = false;
this.locksprite = false; //mxd
this.flags = new Dictionary<string, string>();
this.heightoffset = 0;
// We have no destructor
GC.SuppressFinalize(this);
@ -195,9 +198,10 @@ namespace CodeImp.DoomBuilder.Config
this.classname = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".class", String.Empty); //mxd
this.flags = new Dictionary<string,string>(cat.Flags);
ReadThingSpecificFlags(cfg);
// Read the args
for(int i = 0; i < Linedef.NUM_ARGS; i++)
this.heightoffset = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".flags8height", cat.HeightOffset);
// Read the args
for (int i = 0; i < Linedef.NUM_ARGS; i++)
this.args[i] = new ArgumentInfo(cfg, "thingtypes." + cat.Name + "." + key, i, enums);
// Safety
@ -247,6 +251,7 @@ namespace CodeImp.DoomBuilder.Config
this.locksprite = false;
this.flags = new Dictionary<string, string>(cat.Flags);
ReadThingSpecificFlags(cfg);
this.heightoffset = cat.HeightOffset;
// Safety
if (this.radius < 4f) this.radius = 8f;
@ -293,6 +298,7 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.flags = new Dictionary<string, string>(cat.Flags);
this.heightoffset = cat.HeightOffset;
// Safety
if (this.radius < 4f) this.radius = 8f;
@ -336,6 +342,7 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.flags = new Dictionary<string, string>(cat.Flags);
this.heightoffset = cat.HeightOffset;
// Safety
if (this.radius < 4f) this.radius = 8f;
@ -381,6 +388,7 @@ namespace CodeImp.DoomBuilder.Config
this.xybillboard = other.xybillboard; //mxd
this.spritescale = new SizeF(other.spritescale.Width, other.spritescale.Height);
this.flags = new Dictionary<string, string>(other.flags);
this.heightoffset = other.heightoffset;
//mxd. Copy GLOOME properties
this.rendermode = other.rendermode;

View file

@ -49,7 +49,6 @@ namespace CodeImp.DoomBuilder.IO
translucentLineTypes = new Dictionary<int, float>() { { 208, -1.0f } };
unflippableTypes = new List<int>();
startTypes = new List<int>();
floatableTypes = new List<int>();
centerHitboxTypes = new List<int>();
}

View file

@ -49,7 +49,6 @@ namespace CodeImp.DoomBuilder.IO
translucentLineTypes = new Dictionary<int, float>() { { 208, -1.0f } };
unflippableTypes = new List<int>();
startTypes = new List<int>();
floatableTypes = new List<int>();
centerHitboxTypes = new List<int>();
}

View file

@ -84,7 +84,6 @@ namespace CodeImp.DoomBuilder.IO
int AxisTransferLineType { get; }
List<int> UnflippableTypes { get; }
List<int> StartTypes { get; }
List<int> FloatableTypes { get; }
List<int> CenterHitboxTypes { get; }
}
}

View file

@ -52,7 +52,6 @@ namespace CodeImp.DoomBuilder.IO
protected Dictionary<int, float> translucentLineTypes;
protected List<int> unflippableTypes;
protected List<int> startTypes;
protected List<int> floatableTypes;
protected List<int> centerHitboxTypes;
#endregion
@ -114,7 +113,6 @@ namespace CodeImp.DoomBuilder.IO
public abstract int AxisTransferLineType { get; }
public List<int> UnflippableTypes { get { return unflippableTypes; } }
public List<int> StartTypes { get { return startTypes; } }
public List<int> FloatableTypes { get { return floatableTypes; } }
public List<int> CenterHitboxTypes { get { return centerHitboxTypes; } }
#endregion

View file

@ -147,8 +147,6 @@ namespace CodeImp.DoomBuilder.IO
startTypes = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 };
floatableTypes = new List<int>() { 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 312, 323, 330, 331, 332, 333, 334, 335, 521, 1800 };
centerHitboxTypes = new List<int>() { 604, 605, 606, 607, 608, 609, 1705, 1713 };
}

View file

@ -54,7 +54,6 @@ namespace CodeImp.DoomBuilder.IO
translucentLineTypes = new Dictionary<int, float>() { { 208, -1.0f } };
unflippableTypes = new List<int>();
startTypes = new List<int>();
floatableTypes = new List<int>();
centerHitboxTypes = new List<int>();
// Make configuration

View file

@ -130,7 +130,6 @@ namespace CodeImp.DoomBuilder.Map
}
public bool IsReverse { get { return General.Map.SRB2 && !Unflippable && IsFlagSet("2"); } }
public bool Unflippable { get { return General.Map.FormatInterface.UnflippableTypes.Contains(Type); } }
public bool IsFloatable { get { return General.Map.FormatInterface.FloatableTypes.Contains(Type); } }
public bool CenterHitbox { get { return General.Map.FormatInterface.CenterHitboxTypes.Contains(Type); } }
public bool IsNiGHTSPathItem { get { return General.Map.FormatInterface.AxisType == Type
|| General.Map.FormatInterface.AxisTransferType == Type

View file

@ -493,7 +493,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
if (Thing.IsFloatable && Thing.IsFlagSet("8")) pos.z += Thing.IsFlipped ? -24 : 24;
if (Thing.IsFlagSet("8")) pos.z += Thing.IsFlipped ? -info.HeightOffset : info.HeightOffset;
// Apply settings
SetPosition(pos);