Exemple #1
0
        public static MotData Deserialize(Stream stream, int flagCount, bool FMode)
        {
            var data = new MotData();

            data.GetFlags(stream, flagCount);
            data.FrameCount = DataStream.ReadUInt16(stream);
            if (data.FrameCount % 2 == 0 & !FMode)
            {
                DataStream.ReadUInt16(stream);
            }
            data.Frames = new List <ushort>();
            for (var i = 0; i < data.FrameCount; ++i)
            {
                data.Frames.Add(DataStream.ReadUInt16(stream));
            }
            var serializer = new BinarySerializer();

            data.Values = new List <FrameValue>();
            for (var i = 0; i < data.FrameCount; ++i)
            {
                data.Values.Add(serializer.Deserialize <FrameValue>(stream));
            }
            if (data.FrameCount % 2 == 0 & FMode)
            {
                DataStream.ReadUInt16(stream);
            }
            //Data.GetFlags(stream, flagCount);
            data.FMode = FMode;
            return(data);
        }
Exemple #2
0
        public void Deserialize(Stream stream, MotHeader header, int boneEnd, bool bFMode)
        {
            stream.Position = header.InfoOffset;
            var serializer = new BinarySerializer();

            Info            = serializer.Deserialize <MotInfo>(stream);
            stream.Position = header.UnkDataOffset;
            while (stream.Position < header.DataOffset)
            {
                Settings.Add(DataStream.ReadUInt32(stream));
            }

            for (var i = 0; i < MotFile.MaxData; ++i)
            {
                var flagCount = MotFile.FrameValueOffset.ContainsKey(i) ? MotFile.FrameValueOffset[i] : 0;

                var motion = MotData.Deserialize(stream, flagCount, bFMode);

                Data.Add(motion);
            }

            Skeleton = new MotSkeleton(Data);

            stream.Position = header.BoneOffset;
            Bones           = new MotBones();
            Bones.GetIds(stream, boneEnd);
        }