Example #1
0
        /// <summary>
        /// Writes the data-block to a stream.
        /// </summary>
        public override void Write(ResourceDataWriter writer, params object[] parameters)
        {
            // update structure data
            //this.NamePointer = (ulong)(this.Name != null ? this.Name.Position : 0); //TODO: fix

            // write structure data
            writer.Write(this.VFT);
            writer.Write(this.Unknown_4h);
            writer.Write(this.Unknown_8h);
            writer.Write(this.Unknown_Ch);
            writer.Write(this.Unknown_10h);
            writer.Write(this.Unknown_14h);
            writer.Write(this.Unknown_18h);
            writer.Write(this.Unknown_1Ch);
            writer.Write(this.Unknown_20h);
            writer.Write(this.Unknown_24h);
            writer.Write(this.NamePointer);
            writer.Write(this.Unknown_30h);
            writer.Write(this.Unknown_34h);
            writer.Write(this.Unknown_38h);
            writer.Write(this.Unknown_3Ch);
        }
Example #2
0
 public override void Write(ResourceDataWriter writer, params object[] parameters)
 {
     writer.Write(Value);
 }
Example #3
0
        public override void Write(ResourceDataWriter writer, params object[] parameters)
        {
            base.Write(writer, parameters);

            VerticesPointer    = (ulong)(Vertices != null ? Vertices.FilePosition : 0);
            IndicesPointer     = (ulong)(Indices != null ? Indices.FilePosition : 0);
            AdjPolysPointer    = (ulong)(AdjPolys != null ? AdjPolys.FilePosition : 0);
            PolysPointer       = (ulong)(Polys != null ? Polys.FilePosition : 0);
            SectorTreePointer  = (ulong)(SectorTree != null ? SectorTree.FilePosition : 0);
            PortalsPointer     = (ulong)(PortalsBlock?.FilePosition ?? 0);
            PortalLinksPointer = (ulong)(PortalLinksBlock?.FilePosition ?? 0);



            writer.Write((uint)ContentFlags);
            writer.Write(VersionUnk1);
            writer.Write(Unused_018h);
            writer.Write(Unused_01Ch);
            writer.Write(Transform);
            writer.Write(AABBSize);
            writer.Write(AABBUnk);
            writer.Write(VerticesPointer);
            writer.Write(Unused_078h);
            writer.Write(Unused_07Ch);
            writer.Write(IndicesPointer);
            writer.Write(AdjPolysPointer);
            writer.Write(AdjPolysIndicesCount);
            writer.WriteStruct(AdjAreaIDs);
            writer.Write(PolysPointer);
            writer.Write(SectorTreePointer);
            writer.Write(PortalsPointer);
            writer.Write(PortalLinksPointer);
            writer.Write(VerticesCount);
            writer.Write(PolysCount);
            writer.Write(AreaID);
            writer.Write(TotalBytes);
            writer.Write(SectorUnkCount);
            writer.Write(PortalsCount);
            writer.Write(PortalLinksCount);
            writer.Write(Unused_154h);
            writer.Write(Unused_158h);
            writer.Write(Unused_15Ch);
            writer.Write(VersionUnk2);
            writer.Write(Unused_164h);
            writer.Write(Unused_168h);
            writer.Write(Unused_16Ch);
        }
Example #4
0
        /// <summary>
        /// Writes the data-block to a stream.
        /// </summary>
        public override void Write(ResourceDataWriter writer, params object[] parameters)
        {
            // update structure data
            this.NamePointer = (ulong)(this.Name != null ? this.Name.FilePosition : 0);

            // write structure data
            writer.Write(this.VFT);
            writer.Write(this.Unknown_4h);
            writer.Write(this.Unknown_8h);
            writer.Write(this.Unknown_Ch);
            writer.Write(this.Unknown_10h);
            writer.Write(this.Unknown_14h);
            writer.Write(this.Unknown_18h);
            writer.Write(this.Unknown_1Ch);
            writer.WriteBlock(this.Unknown_20h);
            writer.WriteBlock(this.Unknown_30h);
            writer.WriteBlock(this.Unknown_40h);
            writer.WriteBlock(this.Unknown_50h);
            writer.Write(this.NamePointer);
            writer.Write(this.Unknown_68h);
            writer.Write(this.Unknown_6Ch);
            writer.Write(this.Unknown_70h);
            writer.Write(this.Unknown_74h);
            writer.Write(this.len);
            writer.Write(this.Unknown_7Ah);
            writer.Write(this.Unknown_7Ch);
            writer.Write(this.Unknown_80h);
            writer.Write(this.Unknown_84h);
            writer.Write(this.Unknown_88h);
            writer.Write(this.Unknown_8Ch);
        }
Example #5
0
 /// <summary>
 /// Writes the data-block to a stream.
 /// </summary>
 public override void Write(ResourceDataWriter writer, params object[] parameters)
 {
     // write structure data
     writer.Write(this.Unknown_0h);
     writer.Write(this.Unknown_4h);
     writer.Write(this.Unknown_8h);
     writer.Write(this.Unknown_Ch);
     writer.Write(this.Unknown_10h);
     writer.Write(this.Unknown_14h);
     writer.Write(this.Unknown_18h);
     writer.Write(this.Unknown_1Ch);
     writer.Write(this.Unknown_20h);
     writer.Write(this.Unknown_24h);
     writer.Write(this.Unknown_28h);
     writer.Write(this.Unknown_2Ch);
     writer.Write(this.Unknown_30h);
     writer.Write(this.Unknown_34h);
     writer.Write(this.Unknown_38h);
     writer.Write(this.Unknown_3Ch);
     writer.Write(this.Unknown_40h);
     writer.Write(this.Unknown_44h);
     writer.Write(this.Unknown_48h);
     writer.Write(this.Unknown_4Ch);
     writer.Write(this.Unknown_50h);
     writer.Write(this.Unknown_54h);
     writer.Write(this.Unknown_58h);
     writer.Write(this.Unknown_5Ch);
     writer.Write(this.Unknown_60h);
     writer.Write(this.Unknown_64h);
     writer.Write(this.Unknown_68h);
     writer.Write(this.Unknown_6Ch);
     writer.Write(this.Unknown_70h);
     writer.Write(this.Unknown_74h);
     writer.Write(this.Unknown_78h);
     writer.Write(this.Unknown_7Ch);
     writer.Write(this.Unknown_80h);
     writer.Write(this.Unknown_84h);
     writer.Write(this.Unknown_88h);
     writer.Write(this.Unknown_8Ch);
     writer.Write(this.Unknown_90h);
     writer.Write(this.Unknown_94h);
     writer.Write(this.Unknown_98h);
     writer.Write(this.Unknown_9Ch);
 }
Example #6
0
        public override void Write(ResourceDataWriter writer, params object[] parameters)
        {
            base.Write(writer, parameters);

            this.DataPointer = (ulong)this.Data.FilePosition;

            // write structure data
            writer.Write(this.Width);
            writer.Write(this.Height);
            writer.Write(this.Depth);
            writer.Write(this.Stride);
            writer.Write((uint)this.Format);
            writer.Write(this.Unknown_5Ch);
            writer.Write(this.Levels);
            writer.Write(this.Unknown_5Eh);
            writer.Write(this.Unknown_60h);
            writer.Write(this.Unknown_64h);
            writer.Write(this.Unknown_68h);
            writer.Write(this.Unknown_6Ch);
            writer.Write(this.DataPointer);
            writer.Write(this.Unknown_78h);
            writer.Write(this.Unknown_7Ch);
            writer.Write(this.Unknown_80h);
            writer.Write(this.Unknown_84h);
            writer.Write(this.Unknown_88h);
            writer.Write(this.Unknown_8Ch);
        }
Example #7
0
        /// <summary>
        /// Writes the data-block to a stream.
        /// </summary>
        public override void Write(ResourceDataWriter writer, params object[] parameters)
        {
            base.Write(writer, parameters);

            // update structure data
            this.StructureInfosPointer = this.StructureInfos?.FilePosition ?? 0;
            this.EnumInfosPointer      = this.EnumInfos?.FilePosition ?? 0;
            this.DataBlocksPointer     = this.DataBlocks?.FilePosition ?? 0;
            this.NamePointer           = this.NameBlock?.FilePosition ?? 0;
            this.UselessPointer        = 0;
            this.StructureInfosCount   = (short)(this.StructureInfos?.Count ?? 0);
            this.EnumInfosCount        = (short)(this.EnumInfos?.Count ?? 0);
            this.DataBlocksCount       = (short)(this.DataBlocks?.Count ?? 0);

            // write structure data
            writer.Write(this.Unknown_10h);
            writer.Write(this.Unknown_14h);
            writer.Write(this.HasUselessData);
            writer.Write(this.Unknown_17h);
            writer.Write(this.Unknown_18h);
            writer.Write(this.RootBlockIndex);
            writer.Write(this.StructureInfosPointer);
            writer.Write(this.EnumInfosPointer);
            writer.Write(this.DataBlocksPointer);
            writer.Write(this.NamePointer);
            writer.Write(this.UselessPointer);
            writer.Write(this.StructureInfosCount);
            writer.Write(this.EnumInfosCount);
            writer.Write(this.DataBlocksCount);
            writer.Write(this.Unknown_4Eh);
            writer.Write(this.Unknown_50h);
            writer.Write(this.Unknown_54h);
            writer.Write(this.Unknown_58h);
            writer.Write(this.Unknown_5Ch);
            writer.Write(this.Unknown_60h);
            writer.Write(this.Unknown_64h);
            writer.Write(this.Unknown_68h);
            writer.Write(this.Unknown_6Ch);
        }
Example #8
0
        public override void Write(ResourceDataWriter writer, params object[] parameters)
        {
            // update structure data
            this.NamePointer = (ulong)(this.NameBlock != null ? this.NameBlock.FilePosition : 0);

            // write structure data
            writer.Write(this.VFT);
            writer.Write(this.Unknown_4h);
            writer.Write(this.Unknown_8h);
            writer.Write(this.Unknown_Ch);
            writer.Write(this.Unknown_10h);
            writer.Write(this.Unknown_14h);
            writer.Write(this.Unknown_18h);
            writer.Write(this.Unknown_1Ch);
            writer.Write(this.Unknown_20h);
            writer.Write(this.Unknown_24h);
            writer.Write(this.NamePointer);
            writer.Write(this.Unknown_30h);
            writer.Write(this.Unknown_32h);
            writer.Write(this.Unknown_34h);
            writer.Write(this.Unknown_38h);
            writer.Write(this.Unknown_3Ch);
            writer.Write(this.UsageData);
            writer.Write(this.Unknown_44h);
            writer.Write(this.ExtraFlags);
            writer.Write(this.Unknown_4Ch);
        }
Example #9
0
        public override void Write(ResourceDataWriter writer, params object[] parameters)
        {
            base.Write(writer, parameters);

            VerticesPointer    = (ulong)(Vertices != null ? Vertices.FilePosition : 0);
            IndicesPointer     = (ulong)(Indices != null ? Indices.FilePosition : 0);
            EdgesPointer       = (ulong)(Edges != null ? Edges.FilePosition : 0);
            PolysPointer       = (ulong)(Polys != null ? Polys.FilePosition : 0);
            SectorTreePointer  = (ulong)(SectorTree != null ? SectorTree.FilePosition : 0);
            PortalsPointer     = (ulong)(PortalsBlock?.FilePosition ?? 0);
            PortalLinksPointer = (ulong)(PortalLinksBlock?.FilePosition ?? 0);



            //uint totbytes = 0;
            //Stack<NavMeshSector> sectorstack = new Stack<NavMeshSector>();
            //if (SectorTree != null) sectorstack.Push(SectorTree);
            //while (sectorstack.Count > 0)
            //{
            //    var sector = sectorstack.Pop();
            //    if (sector.SubTree1 != null) sectorstack.Push(sector.SubTree1);
            //    if (sector.SubTree2 != null) sectorstack.Push(sector.SubTree2);
            //    if (sector.SubTree3 != null) sectorstack.Push(sector.SubTree3);
            //    if (sector.SubTree4 != null) sectorstack.Push(sector.SubTree4);
            //    if (sector.Data != null)
            //    {
            //        var sdata = sector.Data;
            //        totbytes += (uint)(sdata.PolyIDsBlock?.BlockLength ?? 0);
            //        totbytes += (uint)(sdata.PointsBlock?.BlockLength ?? 0);
            //    }
            //}
            //totbytes += PadSize(VerticesCount * (uint)Vertices.ItemSize);
            //totbytes += PadSize(EdgesIndicesCount * (uint)Indices.ItemSize);
            //totbytes += PadSize(EdgesIndicesCount * (uint)Edges.ItemSize);
            //totbytes += PadSize(PolysCount * (uint)Polys.ItemSize);
            ////totbytes += (uint)BlockLength;
            //totbytes += (uint)Vertices.ListParts.BlockLength;//Vertices.ListPartsCount * 16;
            //totbytes += (uint)Indices.ListParts.BlockLength;//Indices.ListPartsCount * 16;
            //totbytes += (uint)Edges.ListParts.BlockLength;//Edges.ListPartsCount * 16;
            //totbytes += (uint)Polys.ListParts.BlockLength;//Polys.ListPartsCount * 16;
            //totbytes += (uint)(PortalsBlock?.BlockLength ?? 0);//PortalsCount * 28;
            //totbytes += (uint)(PortalLinksBlock?.BlockLength ?? 0);//PortalLinksCount * 2;
            //int remaining = ((int)TotalBytes) - ((int)totbytes);
            //if (totbytes != TotalBytes)
            //{ }


            writer.Write((uint)ContentFlags);
            writer.Write(VersionUnk1);
            writer.Write(Unused_018h);
            writer.Write(Unused_01Ch);
            writer.Write(Transform);
            writer.Write(AABBSize);
            writer.Write(AABBUnk);
            writer.Write(VerticesPointer);
            writer.Write(Unused_078h);
            writer.Write(Unused_07Ch);
            writer.Write(IndicesPointer);
            writer.Write(EdgesPointer);
            writer.Write(EdgesIndicesCount);
            writer.WriteStruct(AdjAreaIDs);
            writer.Write(PolysPointer);
            writer.Write(SectorTreePointer);
            writer.Write(PortalsPointer);
            writer.Write(PortalLinksPointer);
            writer.Write(VerticesCount);
            writer.Write(PolysCount);
            writer.Write(AreaID);
            writer.Write(TotalBytes);
            writer.Write(PointsCount);
            writer.Write(PortalsCount);
            writer.Write(PortalLinksCount);
            writer.Write(Unused_154h);
            writer.Write(Unused_158h);
            writer.Write(Unused_15Ch);
            writer.Write(VersionUnk2);
            writer.Write(Unused_164h);
            writer.Write(Unused_168h);
            writer.Write(Unused_16Ch);
        }
Example #10
0
        public override void Write(ResourceDataWriter writer, params object[] parameters)
        {
            base.Write(writer, parameters);

            // update structure data
            NodesPointer = (ulong)(NodesBlock?.FilePosition ?? 0);
            NodesCount   = (uint)(Nodes?.Length ?? 0); //assume NodesCountVehicle and Ped already updated..
            LinksPtr     = (ulong)(LinksBlock?.FilePosition ?? 0);
            LinksCount   = (uint)(Links?.Length ?? 0);
            JunctionsPtr = (ulong)(JunctionsBlock?.FilePosition ?? 0);
            JunctionHeightmapBytesPtr   = (ulong)(JunctionHeightmapBytesBlock?.FilePosition ?? 0);
            JunctionRefsPtr             = (ulong)(JunctionRefsBlock?.FilePosition ?? 0);
            JunctionRefsCount0          = (ushort)(JunctionRefs?.Length ?? 0);
            JunctionRefsCount1          = JunctionRefsCount1;
            JunctionsCount              = (uint)(Junctions?.Length ?? 0);
            JunctionHeightmapBytesCount = (uint)(JunctionHeightmapBytes?.Length ?? 0);


            // write structure data
            writer.Write(this.NodesPointer);
            writer.Write(this.NodesCount);
            writer.Write(this.NodesCountVehicle);
            writer.Write(this.NodesCountPed);
            writer.Write(this.Unk24);
            writer.Write(this.LinksPtr);
            writer.Write(this.LinksCount);
            writer.Write(this.Unk34);
            writer.Write(this.JunctionsPtr);
            writer.Write(this.JunctionHeightmapBytesPtr);
            writer.Write(this.Unk48);
            writer.Write(this.Unk4C);
            writer.Write(this.JunctionRefsPtr);
            writer.Write(this.JunctionRefsCount0);
            writer.Write(this.JunctionRefsCount1);
            writer.Write(this.Unk5C);
            writer.Write(this.JunctionsCount);
            writer.Write(this.JunctionHeightmapBytesCount);
            writer.Write(this.Unk68);
            writer.Write(this.Unk6C);
        }
Example #11
0
 public override void Write(ResourceDataWriter writer, params object[] parameters)
 {
     byte[] data = MetaTypes.ConvertArrayToBytes(Items);
     writer.Write(data);
 }
Example #12
0
 public override void Write(ResourceDataWriter writer, params object[] parameters)
 {
     // write structure data
     writer.Write(this.Time);
     writer.Write(this.VelocityX);
     writer.Write(this.VelocityY);
     writer.Write(this.VelocityZ);
     writer.Write(this.RightX);
     writer.Write(this.RightY);
     writer.Write(this.RightZ);
     writer.Write(this.TopX);
     writer.Write(this.TopY);
     writer.Write(this.TopZ);
     writer.Write(this.SteeringAngle);
     writer.Write(this.GasPedalPower);
     writer.Write(this.BrakePedalPower);
     writer.Write(this.HandbrakeUsed);
     writer.Write(this.PositionX);
     writer.Write(this.PositionY);
     writer.Write(this.PositionZ);
 }