Пример #1
0
 public void Deserialize(BSReader reader)
 {
     this.IsEnabled    = reader.ReadInt32() != 0;
     this.Path         = reader.ReadString();
     this.BoneRelative = reader.ReadString();
     this.Position     = reader.ReadVector3();
     this.BirthTime    = reader.ReadUInt32();
     this.UnkByte01    = reader.ReadByte();
     this.UnkByte02    = reader.ReadByte();
     this.UnkByte03    = reader.ReadByte();
     this.UnkByte04    = reader.ReadByte();
     if (this.UnkByte04 == 1)
     {
         this.UnkVector01 = reader.ReadVector3();
     }
 }
Пример #2
0
 public void Deserialize(BSReader reader)
 {
     this.Type     = (ObjectGeneralType)reader.ReadInt16();
     this.Category = (ObjectGeneralCategory)reader.ReadInt16();
     this.Name     = reader.ReadString();
     this.Int01    = reader.ReadInt32();
     this.Int02    = reader.ReadInt32();
 }
Пример #3
0
        public override void Deserialize(BSReader reader)
        {
            base.Deserialize(reader);

            this.UnkUInt06 = reader.ReadUInt32();
            this.Path      = reader.ReadString();
            this.UnkUInt07 = reader.ReadUInt32();
        }
Пример #4
0
        public void Deserialize(BSReader reader)
        {
            this.Name = reader.ReadString();
            var aniTypeDataCount = reader.ReadInt32();

            for (int i = 0; i < aniTypeDataCount; i++)
            {
                this.AniTypeDataList.Add(reader.Deserialize <PrimAniTypeData>());
            }
        }
Пример #5
0
        public void Deserialize(BSReader reader)
        {
            this.Name = reader.ReadString();
            var meshCount = reader.ReadInt32();

            for (int i = 0; i < meshCount; i++)
            {
                this.MeshIndices.Add(reader.ReadInt32());
            }
        }
Пример #6
0
        public void Deserialize(BSReader reader, params object[] param)
        {
            var flag = (int)param[0];

            this.Path = reader.ReadString();
            if ((flag & 1) != 0)
            {
                this.Int01 = reader.ReadInt32();
            }
        }
Пример #7
0
 public void Deserialize(BSReader reader)
 {
     this.Name           = reader.ReadString();
     this.Diffuse        = reader.ReadColor4();
     this.Ambient        = reader.ReadColor4();
     this.Specular       = reader.ReadColor4();
     this.Emissive       = reader.ReadColor4();
     this.UnkFloat01     = reader.ReadSingle();
     this.Flags          = reader.ReadUInt32(); // MaterialEntryFlags (64 is default often used with 256 and/or 512 only a few exceptions have 1 2 4 8...)
     this.DiffuseMapPath = reader.ReadString();
     this.UnkFloat02     = reader.ReadSingle();
     this.UnkByte01      = reader.ReadByte();
     this.UnkByte02      = reader.ReadByte();
     this.IsAbsolutePath = reader.ReadBoolean();
     if ((this.Flags & (uint)PrimMtrlFlag.Bit14) != 0)
     {
         this.NormalMapPath = reader.ReadString();
         this.UnkUInt01     = reader.ReadUInt32();
     }
 }
Пример #8
0
        public void Deserialize(BSReader reader)
        {
            this.Name = reader.ReadString();
            var trackCount = reader.ReadInt32();

            for (int i = 0; i < trackCount; i++)
            {
                if (reader.ReadUInt32() == 0)
                {
                    continue;
                }
                this.Tracks.Add(reader.Deserialize <ModDataSoundTrack>());
            }
        }
Пример #9
0
        public void Load(Stream stream)
        {
            // Read file structure
            using (var reader = new BSReader(stream))
            {
                var signature = reader.ReadString(12);
                if (signature != LatestSignature)
                {
                    // TODO: Migrate old version to current if possible.
                    throw new NotSupportedException($"Migration from '{signature}' not supported.");
                }

                // File offsets (Collision, Resources)
                reader.SkipRead(8);

                // Unknown
                Int01 = reader.ReadUInt32();
                Int02 = reader.ReadUInt32();
                Int03 = reader.ReadUInt32();
                Int04 = reader.ReadUInt32();
                Int05 = reader.ReadUInt32();

                // Object info
                this.ObjectInfo = reader.Deserialize <ObjectGeneralInfo>();

                // FileOffset.Collision
                CollisionResourcePath = reader.ReadString();

                // FileOffset.Resources
                var count = reader.ReadInt32();
                ResourceSet = new List <string>(count);
                for (int i = 0; i < count; i++)
                {
                    ResourceSet.Add(reader.ReadString());
                }
            }
        }
Пример #10
0
        public void Deserialize(BSReader reader)
        {
            this.Type          = reader.ReadInt32();
            this.AnimationType = (PrimAnimationType)reader.ReadInt32();
            this.Name          = reader.ReadString();

            var dataCount = reader.ReadInt32();

            this.ModData.Capacity = dataCount;
            for (int i = 0; i < dataCount; i++)
            {
                var data = ModDataFactory.Create((ModDataType)reader.ReadInt32());
                data.Deserialize(reader);
                this.ModData.Add(data);
            }
        }
Пример #11
0
        public void Load(Stream stream)
        {
            // Read file structure
            using (var reader = new BSReader(stream))
            {
                var signature = reader.ReadString(12);
                if (signature != LatestSignature)
                {
                    // TODO: Migrate old version to current if possible.
                    throw new NotSupportedException($"Migration from '{signature}' not supported.");
                }

                // Materials
                var mtrlCount = reader.ReadInt32();
                Materials = new List <PrimMtrl>(mtrlCount);
                for (int i = 0; i < mtrlCount; i++)
                {
                    this.Materials.Add(reader.Deserialize <PrimMtrl>());
                }
            }
        }
Пример #12
0
        public override void Deserialize(BSReader reader)
        {
            base.Deserialize(reader);

            this.UnkFloat02 = reader.ReadSingle();
            this.UnkFloat03 = reader.ReadSingle();
            this.UnkFloat04 = reader.ReadSingle();
            this.UnkFloat05 = reader.ReadSingle();
            this.UnkFloat06 = reader.ReadSingle();
            this.UnkFloat07 = reader.ReadSingle();

            var textureCount = reader.ReadInt32();

            for (int i = 0; i < textureCount; i++)
            {
                // Check if entry is not enabled
                if (reader.ReadByte() == 0)
                {
                    continue;
                }

                this.Textures.Add(reader.ReadString());
            }
        }
Пример #13
0
 public void Deserialize(BSReader reader)
 {
     this.Path = reader.ReadString();
 }
Пример #14
0
 public void Deserialize(BSReader reader)
 {
     this.Index = reader.ReadInt32();
     this.Path  = reader.ReadString();
 }
Пример #15
0
 public void Deserialize(BSReader reader)
 {
     this.Path  = reader.ReadString();
     this.Time  = reader.ReadInt32();
     this.Event = reader.ReadString();
 }
Пример #16
0
        public void Load(Stream stream)
        {
            // Read file structure
            using (var reader = new BSReader(stream))
            {
                // Signature
                var signature = reader.ReadString(12);
                if (signature != LatestSignature)
                {
                    // TODO: Migrate old version to current if possible.
                    throw new NotSupportedException($"Migration from '{signature}' not supported.");
                }

                // File offsets (Material, Mesh, Animation, Skeleton, MeshGroup, AnimationGroup, ModPalette, Collision)
                reader.SkipRead(32);

                // Unknown Flags
                Flag01 = reader.ReadInt32();
                Flag02 = reader.ReadInt32();
                Flag03 = reader.ReadInt32();
                Flag04 = reader.ReadInt32();
                Flag05 = reader.ReadInt32();

                // Object info
                this.ObjectInfo = reader.Deserialize <ObjectGeneralInfo>();

                // Reserved
                UnkBuffer = reader.ReadBytes(40);

                // FileOffset.Collision
                CollisionMesh      = reader.ReadString();
                CollisionBox01     = reader.ReadBoundingBoxF();
                CollisionBox02     = reader.ReadBoundingBoxF();
                UseCollisionMatrix = reader.ReadUInt32() != 0;
                if (UseCollisionMatrix)
                {
                    CollisionMatrix = reader.ReadMatrix4x4();
                }

                // FileOffset.Material
                var count = reader.ReadInt32();
                MaterialSet = new List <PrimMtrlSet>(count);
                for (int i = 0; i < count; i++)
                {
                    MaterialSet.Add(reader.Deserialize <PrimMtrlSet>());
                }

                // FileOffset.Mesh
                count   = reader.ReadInt32();
                MeshSet = new List <PrimMesh>(count);
                for (int i = 0; i < count; i++)
                {
                    MeshSet.Add(reader.DeserializeParameterized <PrimMesh>(this.Flag01));
                }

                // FileOffset.Animation
                AnimationTypeVersion    = reader.ReadUInt32();
                AnimationTypeUserDefine = reader.ReadUInt32();
                count        = reader.ReadInt32();
                AnimationSet = new List <PrimAnimation>(count);
                for (int i = 0; i < count; i++)
                {
                    AnimationSet.Add(reader.Deserialize <PrimAnimation>());
                }

                // FileOffset.Skeleton
                HasSkeleton = reader.ReadUInt32() != 0;
                if (HasSkeleton)
                {
                    SkeletonPath   = reader.ReadString();
                    AttachmentBone = reader.ReadString();
                }

                // FileOffset.MeshGroup
                count      = reader.ReadInt32();
                MeshGroups = new List <PrimMeshGroup>(count);
                for (int i = 0; i < count; i++)
                {
                    this.MeshGroups.Add(reader.Deserialize <PrimMeshGroup>());
                }

                // FileOffset.AnimationGroup
                count           = reader.ReadInt32();
                AnimationGroups = new List <PrimAniGroup>(count);
                for (int i = 0; i < count; i++)
                {
                    this.AnimationGroups.Add(reader.Deserialize <PrimAniGroup>());
                }

                // FileOffset.ModPalette
                count         = reader.ReadInt32();
                SystemModSets = new List <ModDataSet>();
                for (int i = 0; i < count; i++)
                {
                    SystemModSets.Add(reader.Deserialize <ModDataSet>());
                }
                count      = reader.ReadInt32();
                AniModSets = new List <ModDataSet>();
                for (int i = 0; i < count; i++)
                {
                    AniModSets.Add(reader.Deserialize <ModDataSet>());
                }

                // ResAttachable
                ResourceAttachable = reader.DeserializeParameterized <ResAttachable>(ObjectInfo.Type);
            }
        }