From 31380b4bb93d1fb65faff8f71753de80fb0a8c9d Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 20 Feb 2012 05:30:01 +0100 Subject: AnmChr/Clr/TexSrt writing done for now. Not 100% perfect but it works! --- NW4RTools/Models/Animation/Shared.cs | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'NW4RTools/Models/Animation/Shared.cs') diff --git a/NW4RTools/Models/Animation/Shared.cs b/NW4RTools/Models/Animation/Shared.cs index f87bea6..62cca94 100644 --- a/NW4RTools/Models/Animation/Shared.cs +++ b/NW4RTools/Models/Animation/Shared.cs @@ -28,5 +28,45 @@ namespace NW4RTools.Models.Animation { Values = null; FloatValues = null; } + + + public bool IsConstWith(float cv) { + return (IsConstant && (ConstValue == cv)); + } + + + public override bool Equals(object obj) { + return obj is KeyframeAnim && this == (KeyframeAnim)obj; + } + + public override int GetHashCode() { + return + IsConstant.GetHashCode() ^ + ConstValue.GetHashCode() ^ + BaseValue.GetHashCode() ^ + Multiplier.GetHashCode() ^ + Misc.ArrayHash(Keyframes) ^ + Misc.ArrayHash(Values) ^ + Misc.ArrayHash(FloatValues); + } + + public static bool operator ==(KeyframeAnim x, KeyframeAnim y) { + return + (x.IsConstant == y.IsConstant) && + (x.ConstValue == y.ConstValue) && + (x.BaseValue == y.BaseValue) && + (x.Multiplier == y.Multiplier) && + Misc.ArrayCompare(x.Keyframes, y.Keyframes) && + Misc.ArrayCompare(x.Values, y.Values) && + Misc.ArrayCompare(x.FloatValues, y.FloatValues); + } + + public static bool operator !=(KeyframeAnim x, KeyframeAnim y) { + return !(x == y); + } + + public void Dump() { + Console.WriteLine("IsC:{0} CV:{1} KF:{2} BV:{3} M:{4} V:{5} FV:{6}", IsConstant, ConstValue, Keyframes, BaseValue, Multiplier, Values, FloatValues); + } } } -- cgit v1.2.3