Exemplo n.º 1
0
        public static Formats.Skel ParseSkel(this SsbhParser parser)
        {
            var result = new Formats.Skel();

            result.Magic        = parser.ReadUInt32();
            result.MajorVersion = parser.ReadUInt16();
            result.MinorVersion = parser.ReadUInt16();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.BoneEntries = new Formats.SkelBoneEntry[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.BoneEntries[i] = parser.ParseSkelBoneEntry();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.WorldTransform = new Formats.Matrix4x4[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.WorldTransform[i] = parser.ReadMatrix4x4();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.InvWorldTransform = new Formats.Matrix4x4[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.InvWorldTransform[i] = parser.ReadMatrix4x4();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.Transform = new Formats.Matrix4x4[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.Transform[i] = parser.ReadMatrix4x4();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.InvTransform = new Formats.Matrix4x4[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.InvTransform[i] = parser.ReadMatrix4x4();
                }

                parser.Seek(previousPosition);
            }
            return(result);
        }