Пример #1
0
 private void SkipChunk(Stormlib.MPQFile file)
 {
     uint size = file.Read<uint>();
     file.Position += size;
 }
Пример #2
0
        public M2BoneAnimator(Stormlib.MPQFile file, M2Info parent)
        {
            string AnimPath = parent.FileDirectory + parent.ModelName;

            M2Animation[] anims = new M2Animation[parent.Header.nAnimations];
            file.Position = parent.Header.ofsAnimations;
            file.Read(anims);

            Stormlib.MPQFile[] AnimFiles = new Stormlib.MPQFile[parent.Header.nAnimations];
            for (int i = 0; i < parent.Header.nAnimations; ++i)
            {
                string full = AnimPath + anims[i].AnimationID.ToString("D4") + "-" + anims[i].SubAnimationID.ToString("D2") + ".anim";
                if (Stormlib.MPQFile.Exists(full))
                {
                    Console.WriteLine(full);
                    AnimFiles[i] = new Stormlib.MPQFile(full);
                }
            }

            Animations.AddRange(anims);

            this.file = file;
            var bones = new M2Bone[parent.Header.nBones];
            file.Position = parent.Header.ofsBones;
            file.Read(bones);

            foreach (var bone in bones)
            {
                M2AnimationBone ab = new M2AnimationBone(bone, this, file, parent.GlobalSequences, AnimFiles);
                Bones.Add(ab);
                ab.BoneIndex = Bones.Count - 1;
            }
            foreach (var bone in Bones)
            {
                bone.Init();
            }
        }
Пример #3
0
 private string ReadSignature(Stormlib.MPQFile file)
 {
     byte[] bytes = file.Read(4);
     bytes = bytes.Reverse().ToArray();
     return Encoding.UTF8.GetString(bytes);
 }