コード例 #1
0
        private void ParseSkeleton(int offset)
        {
            //Init
            int unk1Offset = BitConverter.ToInt32(rawBytes, offset + 20) + offset;
            int unk2Offset = BitConverter.ToInt32(rawBytes, offset + 24) + offset;

            //Skeleton init
            eskFile.Skeleton = new ESK_Skeleton()
            {
                I_02     = BitConverter.ToInt16(rawBytes, offset + 2),
                I_28     = BitConverter_Ex.ToInt32Array(rawBytes, offset + 28, 2),
                Unk1     = ESK_Unk1.Read(rawBytes, unk1Offset),
                UseUnk2  = (unk2Offset != 0) ? true : false,
                ESKBones = new ObservableCollection <ESK_Bone>()
            };

            //Setting the offsets for the initial loop to use
            int[] offsets               = GetBoneOffset(0, offset);
            int   boneIndexOffset       = offsets[0];
            int   nameOffset            = offsets[1];
            int   skinningMatrixOffset  = offsets[2];
            int   transformMatrixOffset = offsets[3];

            while (true)
            {
                int      idx    = eskFile.Skeleton.ESKBones.Count;
                ESK_Bone parent = ESK_Bone.Read(bytes, rawBytes, offsets, _index, null);
                eskFile.Skeleton.ESKBones.Add(parent);
                _index += 1;
                if (BitConverter.ToInt16(rawBytes, boneIndexOffset + 2) != -1)
                {
                    eskFile.Skeleton.ESKBones[idx].ESK_Bones = ParseChildrenBones(BitConverter.ToInt16(rawBytes, boneIndexOffset + 2), offset, parent);
                }
                //Loop management
                if (BitConverter.ToInt16(rawBytes, boneIndexOffset + 4) != -1)
                {
                    //There is a sibling
                    offsets               = GetBoneOffset(BitConverter.ToInt16(rawBytes, boneIndexOffset + 4), offset);
                    boneIndexOffset       = offsets[0];
                    nameOffset            = offsets[1];
                    skinningMatrixOffset  = offsets[2];
                    transformMatrixOffset = offsets[3];
                }
                else
                {
                    //There is no sibling. End loop.
                    break;
                }
            }
        }
コード例 #2
0
        public static ESK_Unk1 Read(byte[] bytes, int offset)
        {
            var unk1 = new ESK_Unk1();

            try
            {
                unk1.I_00  = BitConverter.ToInt32(bytes, offset + 0);
                unk1.I_04  = BitConverter.ToInt32(bytes, offset + 4);
                unk1.I_08  = BitConverter.ToInt32(bytes, offset + 8);
                unk1.I_12  = BitConverter.ToInt32(bytes, offset + 12);
                unk1.I_16  = BitConverter.ToInt32(bytes, offset + 16);
                unk1.I_20  = BitConverter.ToInt32(bytes, offset + 20);
                unk1.I_24  = BitConverter.ToInt32(bytes, offset + 24);
                unk1.I_28  = BitConverter.ToInt32(bytes, offset + 28);
                unk1.I_32  = BitConverter.ToInt32(bytes, offset + 32);
                unk1.I_36  = BitConverter.ToInt32(bytes, offset + 36);
                unk1.I_40  = BitConverter.ToInt32(bytes, offset + 40);
                unk1.I_44  = BitConverter.ToInt32(bytes, offset + 44);
                unk1.I_48  = BitConverter.ToInt32(bytes, offset + 48);
                unk1.I_52  = BitConverter.ToInt32(bytes, offset + 52);
                unk1.I_56  = BitConverter.ToInt32(bytes, offset + 56);
                unk1.I_60  = BitConverter.ToInt32(bytes, offset + 60);
                unk1.I_64  = BitConverter.ToInt32(bytes, offset + 64);
                unk1.I_68  = BitConverter.ToInt32(bytes, offset + 68);
                unk1.I_72  = BitConverter.ToInt32(bytes, offset + 72);
                unk1.I_76  = BitConverter.ToInt32(bytes, offset + 76);
                unk1.I_80  = BitConverter.ToInt32(bytes, offset + 80);
                unk1.I_84  = BitConverter.ToInt32(bytes, offset + 84);
                unk1.I_88  = BitConverter.ToInt32(bytes, offset + 88);
                unk1.I_92  = BitConverter.ToInt32(bytes, offset + 92);
                unk1.I_96  = BitConverter.ToInt32(bytes, offset + 96);
                unk1.I_100 = BitConverter.ToInt32(bytes, offset + 100);
                unk1.I_104 = BitConverter.ToInt32(bytes, offset + 104);
                unk1.I_108 = BitConverter.ToInt32(bytes, offset + 108);
                unk1.I_112 = BitConverter.ToInt32(bytes, offset + 112);
                unk1.I_116 = BitConverter.ToInt32(bytes, offset + 116);
                unk1.I_120 = BitConverter.ToInt32(bytes, offset + 120);
                return(unk1);
            }
            catch
            {
                return(unk1);
            }
        }