Beispiel #1
0
 private WDTChunk[,] ReadWdtChunks(IBinaryReader reader)
 {
     WDTChunk[,] chunks = new WDTChunk[64, 64];
     for (uint y = 0; y < 64; ++y)
     {
         for (uint x = 0; x < 64; ++x)
         {
             chunks[y, x] = new WDTChunk(reader, x, y);
         }
     }
     return(chunks);
 }
Beispiel #2
0
        public WDT(IBinaryReader reader)
        {
            int chunkId = 0;
            Dictionary <int, string>?mwmosNameOffsets = null;

            while (!reader.IsFinished())
            {
                var chunkName = reader.ReadChunkName();
                var size      = reader.ReadInt32();

                var offset = reader.Offset;

                var partialReader = new LimitedReader(reader, size);

                if (chunkName == "MVER")
                {
                    Version = reader.ReadUInt32();
                }
                else if (chunkName == "MPHD")
                {
                    Header = WDTHeader.Read(partialReader);
                }
                else if (chunkName == "MAIN")
                {
                    Chunks[chunkId++] = new WDTChunk(partialReader);
                }
                else if (chunkName == "MWMO")
                {
                    Mwmo = ChunkedUtils.ReadZeroTerminatedStringArrays(partialReader, true, out mwmosNameOffsets)[0];
                }
                else if (chunkName == "MODF")
                {
                    WorldMapObject = MODF.Read(partialReader);
                }
                reader.Offset = offset + size;
            }
        }