From c9bfbf84244c8aa4e26ece994ef6b93386c708e3 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 17:43:33 +0200 Subject: tons of junk I'll clean up eventually --- NW4RTools/BrresReader.cs | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'NW4RTools/BrresReader.cs') diff --git a/NW4RTools/BrresReader.cs b/NW4RTools/BrresReader.cs index 9616b5b..fbf2e2a 100755 --- a/NW4RTools/BrresReader.cs +++ b/NW4RTools/BrresReader.cs @@ -354,7 +354,7 @@ namespace NW4RTools { UInt16 kfCount = ins.ReadUInt16(); ins.Skip(2); - OffsetMap[kfPos] = String.Format("Element Keyframe Data for {0:X} [{1} frames]", savePos, kfCount); + OffsetMap[kfPos] = String.Format("Element Keyframe Data for {0:X} [{1} frames] format: {2}", savePos, kfCount, format); float invKeyFrameRange = ins.ReadFloat(); elem.Keyframes = new Keyframe[kfCount]; @@ -390,8 +390,8 @@ namespace NW4RTools { ins.Seek(savePos + 4); } else if ( - format == CharacterAnim.RotateFormatType.DataUnk4 || - format == CharacterAnim.RotateFormatType.DataUnk5) { + format == CharacterAnim.RotateFormatType.DataFrm8 || + format == CharacterAnim.RotateFormatType.DataFrm16) { // SOMETHING ELSE int savePos = ins.Position; ins.Seek(startPos + ins.ReadInt32()); @@ -401,14 +401,14 @@ namespace NW4RTools { elem.Multiplier = ins.ReadFloat(); elem.BaseValue = ins.ReadFloat(); - elem.Values = new int[CHR_ANIM_HACK.FrameCount]; + elem.Values = new int[CHR_ANIM_HACK.FrameCount + 1]; - for (int i = 0; i < CHR_ANIM_HACK.FrameCount; i++) { + for (int i = 0; i < (CHR_ANIM_HACK.FrameCount + 1); i++) { switch (format) { - case CharacterAnim.RotateFormatType.DataUnk4: + case CharacterAnim.RotateFormatType.DataFrm8: elem.Values[i] = ins.ReadByte(); break; - case CharacterAnim.RotateFormatType.DataUnk5: + case CharacterAnim.RotateFormatType.DataFrm16: elem.Values[i] = ins.ReadUInt16(); break; } @@ -417,18 +417,17 @@ namespace NW4RTools { ins.Seek(savePos + 4); } else if ( - format == CharacterAnim.RotateFormatType.DataUnk6) { + format == CharacterAnim.RotateFormatType.DataFrm32) { // WHAT THE FUCK int savePos = ins.Position; ins.Seek(startPos + ins.ReadInt32()); int kfPos = ins.Position; - OffsetMap[kfPos] = String.Format("Element Type 6 Frame Data for {0:X}", savePos); + OffsetMap[kfPos] = String.Format("Element Constant Frame Data for {0:X}", savePos); - elem.BaseValue = ins.ReadFloat(); - elem.FloatValues = new float[CHR_ANIM_HACK.FrameCount]; + elem.FloatValues = new float[CHR_ANIM_HACK.FrameCount + 1]; - for (int i = 0; i < CHR_ANIM_HACK.FrameCount; i++) { + for (int i = 0; i < (CHR_ANIM_HACK.FrameCount + 1); i++) { elem.FloatValues[i] = ins.ReadFloat(); } @@ -516,7 +515,7 @@ namespace NW4RTools { if (elem.IsConstant) { elem.ConstValue = ins.ReadColor(); - } else { + } else { int savePos = ins.Position; ins.Seek(savePos + ins.ReadInt32()); @@ -608,8 +607,8 @@ namespace NW4RTools { var elem = new TextureSRTAnim.Element(); int savePos = ins.Position; - ins.Seek(startPos + ins.ReadInt32()); - + ins.Seek(startPos + ins.ReadInt32()); + elem.Exists = true; OffsetMap.Add(ins.Position, String.Format("Element")); @@ -876,8 +875,8 @@ namespace NW4RTools { var insn4 = new ByteCode.DrawShapeInstruction(); insn4.MaterialID = ins.ReadUInt16(); insn4.ShapeID = ins.ReadUInt16(); - insn4.NodeID = ins.ReadUInt16(); - insn4.Unk = ins.ReadByte(); + insn4.NodeID = ins.ReadUInt16(); + insn4.Unk = ins.ReadByte(); bc.Instructions.Add(insn4); break; -- cgit v1.2.3