Esempio n. 1
0
            public UnknownIntArrayTable(ByteChunk data)
            {
                var count = data.ReadInt32();

                Data = new List <int>(count);
                for (int i = 0; i < count; i++)
                {
                    Data.Add(data.ReadInt32());
                }
            }
 public AnimationBin(string filename, ByteChunk data)
 {
     FileName              = filename;
     TableVersion          = data.ReadInt32();
     RowCount              = data.ReadInt32();
     AnimationTableEntries = new List <AnimationBinEntry>(RowCount);
     for (int i = 0; i < RowCount; i++)
     {
         AnimationTableEntries.Add(new AnimationBinEntry(data));
     }
 }
 public AnimationFragment(string fileName, ByteChunk data = null)
 {
     FileName = fileName;
     if (data != null)
     {
         Skeletons = new StringArrayTable(data);
         MinSlotId = data.ReadInt32();
         MaxSlotId = data.ReadInt32();
         var numFragItems = data.ReadInt32();
         for (int i = 0; i < numFragItems; i++)
         {
             Fragments.Add(new AnimationFragmentEntry(data));
         }
     }
 }
Esempio n. 4
0
        public AnimationFragmentEntry(ByteChunk data)
        {
            _id   = data.ReadInt32();
            _slot = data.ReadInt32();

            Slot = AnimationSlotTypeHelper.GetFromId(_slot);

            AnimationFile     = data.ReadString();
            MetaDataFile      = data.ReadString();
            SoundMetaDataFile = data.ReadString();
            Skeleton          = data.ReadString();
            Blend             = data.ReadSingle();
            Weight            = data.ReadSingle();
            Unknown0          = data.ReadInt32();
            Unknown1          = data.ReadInt32();
            Unknown3          = data.ReadString();
            Unknown4          = data.ReadBool();
        }
            public StringArrayTable(ByteChunk data)
            {
                var count = data.ReadInt32();

                Values = new List <string>(count);
                for (int i = 0; i < count; i++)
                {
                    Values.Add(data.ReadString());
                }
            }
        List <AnimationDataFile> FindAllSubFiles(ByteChunk data)
        {
            var toalFileCount = data.ReadInt32();
            var fileList      = new List <AnimationDataFile>(toalFileCount);

            for (int i = 0; i < toalFileCount; i++)
            {
                var file = new AnimationDataFile(data);
                fileList.Add(file);
                data.Index += file.Size;
            }
            return(fileList);
        }
        public AnimationBinEntry(ByteChunk data)
        {
            Name         = data.ReadString();
            SkeletonName = data.ReadString();
            MountName    = data.ReadString();
            var count = data.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                FragmentReferences.Add(new FragmentReference(data));
            }
            Unknown = data.ReadShort();
        }
Esempio n. 8
0
 public MatchedAnimationTableEntry(ByteChunk data)
 {
     AttackTable         = new UnknownIntArrayTable(data);
     AttackUnknown0      = data.ReadInt32();
     AttackUnknown1      = data.ReadInt32();
     AttackUnknown2      = data.ReadInt32();
     AttackAnimation     = data.ReadString();
     MountAnimation      = data.ReadString();
     DefenceTable        = new UnknownIntArrayTable(data);
     DefenceUnknown0     = data.ReadInt32();
     DefenceUnknown1     = data.ReadInt32();
     DefenceUnknown2     = data.ReadInt32();
     DefenceAnimation    = data.ReadString();
     Unknown_alwaysEmpty = data.ReadString();
 }
        public static AnimationFile Create(ByteChunk chunk)
        {
            if (chunk.BytesLeft == 0)
            {
                throw new Exception("Trying to load animation with no data, chunk size = 0");
            }
            var output = new AnimationFile();

            chunk.Reset();
            output.Header = GetAnimationHeader(chunk);

            var boneCount = chunk.ReadUInt32();

            output.Bones = new BoneInfo[boneCount];
            for (int i = 0; i < boneCount; i++)
            {
                var boneNameSize = chunk.ReadShort();
                output.Bones[i] = new BoneInfo()
                {
                    Name     = chunk.ReadFixedLength(boneNameSize),
                    ParentId = chunk.ReadInt32(),
                    Id       = i
                };
            }

            // Remapping tables, not sure how they really should be used, but this works.
            for (int i = 0; i < boneCount; i++)
            {
                int mappingValue = chunk.ReadInt32();
                output.TranslationMappings.Add(new AnimationBoneMapping(mappingValue));
            }

            for (int i = 0; i < boneCount; i++)
            {
                int mappingValue = chunk.ReadInt32();
                output.RotationMappings.Add(new AnimationBoneMapping(mappingValue));
            }

            // A single static frame - Can be inverse, a pose or empty. Not sure? Hand animations are stored here
            if (output.Header.AnimationType == 7)
            {
                var staticPosCount = chunk.ReadUInt32();
                var staticRotCount = chunk.ReadUInt32();
                if (staticPosCount != 0 || staticRotCount != 0)
                {
                    output.StaticFrame = ReadFrame(chunk, staticPosCount, staticRotCount);
                }
            }

            // Animation Data
            var animPosCount = chunk.ReadInt32();
            var animRotCount = chunk.ReadInt32();
            var frameCount   = chunk.ReadInt32();  // Always 3 when there is no data? Why?

            if (animPosCount != 0 || animRotCount != 0)
            {
                for (int i = 0; i < frameCount; i++)
                {
                    var frame = ReadFrame(chunk, (uint)animPosCount, (uint)animRotCount);
                    output.DynamicFrames.Add(frame);
                }
            }
            // ----------------------

            return(output);
        }
 public AnimationDataFile(ByteChunk data)
 {
     Name        = data.ReadString();
     Size        = data.ReadInt32();
     StartOffset = data.Index;
 }
 public FragmentReference(ByteChunk data)
 {
     Name    = data.ReadString();
     Unknown = data.ReadInt32();
 }