Unflippable Thing types and Thing types where the Z position is ignored are now handled via the config

This commit is contained in:
MascaraSnake 2016-01-14 23:33:17 +01:00
parent 23f7be610a
commit e29f7af427
11 changed files with 55 additions and 27 deletions

View File

@ -3281,12 +3281,14 @@ thingtypes
sprite = "RINGA0";
width = 96;
height = 192;
unflippable = true;
}
605
{
title = "Circle of Rings (Big)";
sprite = "RINGA0";
width = 192;
unflippable = true;
}
606
{
@ -3294,12 +3296,14 @@ thingtypes
sprite = "NWNGA0";
width = 96;
height = 192;
unflippable = true;
}
607
{
title = "Circle of Wing Logos (Big)";
sprite = "NWNGA0";
width = 192;
unflippable = true;
}
608
{
@ -3307,12 +3311,14 @@ thingtypes
sprite = "NWNGA0";
width = 96;
height = 192;
unflippable = true;
}
609
{
title = "Circle of Rings and Wings (Big)";
sprite = "NWNGA0";
width = 192;
unflippable = true;
}
}
@ -3831,6 +3837,7 @@ thingtypes
sprite = "NBMPG3G7";
width = 32;
height = 64;
unflippable = true;
}
1705
{
@ -3839,6 +3846,7 @@ thingtypes
sprite = "HOOPA0";
width = 80;
height = 160;
unflippable = true;
}
1706
{
@ -3892,6 +3900,7 @@ thingtypes
sprite = "HOOPA0";
width = 80;
height = 160;
unflippable = true;
}
}
@ -3908,16 +3917,22 @@ thingtypes
title = "Axis";
sprite = "internal:axis1";
circle = 1;
unflippable = true;
ignoreZ = true;
}
1701
{
title = "Axis Transfer";
sprite = "internal:axis2";
unflippable = true;
ignoreZ = true;
}
1702
{
title = "Axis Transfer Line";
sprite = "internal:axis3";
unflippable = true;
ignoreZ = true;
}
1710
{

View File

@ -60,9 +60,11 @@ namespace CodeImp.DoomBuilder.Config
private readonly bool absolutez;
private readonly float spritescale;
private readonly int heightoffset;
// Disposing
private bool isdisposed;
private readonly bool isUnflippable;
private readonly bool ignoreZ;
// Disposing
private bool isdisposed;
//mxd. Validity
private bool isinvalid;
@ -94,7 +96,8 @@ namespace CodeImp.DoomBuilder.Config
public float SpriteScale { get { return spritescale; } }
public List<ThingTypeInfo> Things { get { return things; } }
public int HeightOffset { get { return heightoffset; } }
public bool IsUnflippable { get { return isUnflippable; } }
public bool IgnoreZ { get { return ignoreZ; } }
#endregion
#region ================== Constructor / Disposer
@ -127,7 +130,9 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = parent.absolutez;
this.spritescale = parent.spritescale;
this.heightoffset = parent.heightoffset;
}
this.isUnflippable = parent.isUnflippable;
this.ignoreZ = parent.ignoreZ;
}
// Set default properties
else
{
@ -147,6 +152,8 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = false;
this.spritescale = 1.0f;
this.heightoffset = 0;
this.isUnflippable = false;
this.ignoreZ = false;
}
// We have no destructor
@ -203,6 +210,8 @@ namespace CodeImp.DoomBuilder.Config
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);
this.isUnflippable = cfg.ReadSetting("thingtypes." + name + ".unflippable", parent.isUnflippable);
this.ignoreZ = cfg.ReadSetting("thingtypes." + name + ".ignoreZ", parent.ignoreZ);
}
else
{
@ -222,6 +231,8 @@ namespace CodeImp.DoomBuilder.Config
this.absolutez = cfg.ReadSetting("thingtypes." + name + ".absolutez", false);
this.spritescale = cfg.ReadSetting("thingtypes." + name + ".spritescale", 1.0f);
this.heightoffset = cfg.ReadSetting("thingtypes." + name + ".flags8height", 0);
this.isUnflippable = cfg.ReadSetting("thingtypes." + name + ".unflippable", false);
this.ignoreZ = cfg.ReadSetting("thingtypes." + name + ".ignoreZ", false);
}
// Safety

View File

@ -76,9 +76,11 @@ namespace CodeImp.DoomBuilder.Config
private string obsoletemessage; //mxd
private IDictionary<string, string> flags;
private int heightoffset;
private bool isUnflippable;
private bool ignoreZ;
//mxd. GLOOME rendering settings
private Thing.SpriteRenderMode rendermode;
//mxd. GLOOME rendering settings
private Thing.SpriteRenderMode rendermode;
private bool rollsprite;
private bool sticktoplane;
@ -121,7 +123,8 @@ namespace CodeImp.DoomBuilder.Config
public bool RollSprite { get { return rollsprite; } }
public bool StickToPlane { get { return sticktoplane; } }
public int HeightOffset { get { return heightoffset; } }
public bool IsUnflippable { get { return isUnflippable; } }
public bool IgnoreZ { get { return ignoreZ; } }
#endregion
#region ================== Constructor / Disposer
@ -158,9 +161,11 @@ namespace CodeImp.DoomBuilder.Config
this.locksprite = false; //mxd
this.flags = new Dictionary<string, string>();
this.heightoffset = 0;
// We have no destructor
GC.SuppressFinalize(this);
this.isUnflippable = false;
this.ignoreZ = false;
// We have no destructor
GC.SuppressFinalize(this);
}
// Constructor
@ -199,6 +204,8 @@ namespace CodeImp.DoomBuilder.Config
this.flags = new Dictionary<string,string>(cat.Flags);
ReadThingSpecificFlags(cfg);
this.heightoffset = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".flags8height", cat.HeightOffset);
this.isUnflippable = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".unflippable", cat.IsUnflippable);
this.ignoreZ = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".ignoreZ", cat.IgnoreZ);
// Read the args
for (int i = 0; i < Linedef.NUM_ARGS; i++)
@ -252,6 +259,8 @@ namespace CodeImp.DoomBuilder.Config
this.flags = new Dictionary<string, string>(cat.Flags);
ReadThingSpecificFlags(cfg);
this.heightoffset = cat.HeightOffset;
this.isUnflippable = cat.IsUnflippable;
this.ignoreZ = cat.IgnoreZ;
// Safety
if (this.radius < 4f) this.radius = 8f;
@ -299,6 +308,8 @@ namespace CodeImp.DoomBuilder.Config
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.flags = new Dictionary<string, string>(cat.Flags);
this.heightoffset = cat.HeightOffset;
this.isUnflippable = cat.IsUnflippable;
this.ignoreZ = cat.IgnoreZ;
// Safety
if (this.radius < 4f) this.radius = 8f;
@ -343,6 +354,8 @@ namespace CodeImp.DoomBuilder.Config
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
this.flags = new Dictionary<string, string>(cat.Flags);
this.heightoffset = cat.HeightOffset;
this.isUnflippable = cat.IsUnflippable;
this.ignoreZ = cat.IgnoreZ;
// Safety
if (this.radius < 4f) this.radius = 8f;
@ -389,6 +402,8 @@ namespace CodeImp.DoomBuilder.Config
this.spritescale = new SizeF(other.spritescale.Width, other.spritescale.Height);
this.flags = new Dictionary<string, string>(other.flags);
this.heightoffset = other.heightoffset;
this.isUnflippable = other.isUnflippable;
this.ignoreZ = other.ignoreZ;
//mxd. Copy GLOOME properties
this.rendermode = other.rendermode;

View File

@ -47,7 +47,6 @@ namespace CodeImp.DoomBuilder.IO
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
vertexSlopeTypes = new Dictionary<int, int[]>() { };
translucentLineTypes = new Dictionary<int, float>() { { 208, -1.0f } };
unflippableTypes = new List<int>();
startTypes = new List<int>();
centerHitboxTypes = new List<int>();
}

View File

@ -47,7 +47,6 @@ namespace CodeImp.DoomBuilder.IO
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
vertexSlopeTypes = new Dictionary<int, int[]>() { };
translucentLineTypes = new Dictionary<int, float>() { { 208, -1.0f } };
unflippableTypes = new List<int>();
startTypes = new List<int>();
centerHitboxTypes = new List<int>();
}

View File

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

View File

@ -50,7 +50,6 @@ namespace CodeImp.DoomBuilder.IO
protected Dictionary<int, int[]> slopeCopyTypes;
protected Dictionary<int, int[]> vertexSlopeTypes;
protected Dictionary<int, float> translucentLineTypes;
protected List<int> unflippableTypes;
protected List<int> startTypes;
protected List<int> centerHitboxTypes;
#endregion
@ -111,7 +110,6 @@ namespace CodeImp.DoomBuilder.IO
public abstract int AxisType { get; }
public abstract int AxisTransferType { get; }
public abstract int AxisTransferLineType { get; }
public List<int> UnflippableTypes { get { return unflippableTypes; } }
public List<int> StartTypes { get { return startTypes; } }
public List<int> CenterHitboxTypes { get { return centerHitboxTypes; } }
#endregion

View File

@ -143,8 +143,6 @@ namespace CodeImp.DoomBuilder.IO
{ 908, 0.1f },
};
unflippableTypes = new List<int>() { 604, 605, 606, 607, 608, 609, 1700, 1701, 1702, 1704, 1705, 1713 };
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 };
centerHitboxTypes = new List<int>() { 604, 605, 606, 607, 608, 609, 1705, 1713 };

View File

@ -52,7 +52,6 @@ namespace CodeImp.DoomBuilder.IO
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
vertexSlopeTypes = new Dictionary<int, int[]>() { };
translucentLineTypes = new Dictionary<int, float>() { { 208, -1.0f } };
unflippableTypes = new List<int>();
startTypes = new List<int>();
centerHitboxTypes = new List<int>();

View File

@ -129,13 +129,8 @@ 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 Unflippable { get { return General.Map.Data.GetThingInfo(Type).IsUnflippable; } }
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
|| General.Map.FormatInterface.AxisTransferLineType == Type;
}
}
#endregion
#region ================== Constructor / Disposer

View File

@ -428,7 +428,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
pos.z = sd.Floor.sector.FloorHeight + Thing.Position.z - Thing.Height/2;
}
}
else if (Thing.IsNiGHTSPathItem)
else if (info.IgnoreZ)
{
//Z position is always 0.
if (Thing.Sector != null)
@ -828,7 +828,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Raise/lower thing
public void OnChangeTargetHeight(int amount)
{
if (Thing.IsNiGHTSPathItem) return; //NiGHTS path items have no height.
if (info.IgnoreZ) return;
if(General.Map.FormatInterface.HasThingHeight)
{