Example #1
0
        /// <summary>
        /// Loads all the offsets of the MCNK-chunks in the main file and in the tex stream and stores them in mChunkOffsets
        /// </summary>
        private void InitChunkOffsets()
        {
            SeekChunk(mpqFile, "KNCM");
            for (int i = 0; i < 256; ++i)
            {
                var ofs = new ChunkOffset()
                {
                    Offset = (uint)mpqFile.Position,
                };

                mpqFile.Position += 4;
                ofs.Size = mpqFile.Read<uint>();

                mChunkOffsets.Add(ofs);
                mpqFile.Position += ofs.Size;
            }

            SeekChunk(TexStream, "KNCM");
            for (int i = 0; i < 256; ++i)
            {
                var offset = (uint)TexStream.Position;
                TexStream.Position += 4;
                uint size = TexStream.Read<uint>();

                mChunkOffsets[i].OffsetTexStream = offset;
                TexStream.Position = offset + 8 + size;
            }
        }
Example #2
0
 /// <summary>
 /// Initializes all parameters of the chunk without performing any load operation.
 /// </summary>
 /// <param name="parent">The parent large terrain file of this chunk</param>
 /// <param name="baseFile">The MPQ-file which contains the general information about placement and doodads</param>
 /// <param name="texFile">The MPQ-stream which contains all the texture related information (MCLY, MCAL, ...)</param>
 /// <param name="offset">The offset inside baseFile and texFile where this chunks MCNK is located</param>
 public ADTChunk(ADTFile parent, Stormlib.MPQFile baseFile, Utils.StreamedMpq texFile, ChunkOffset offset)
 {
     mFile = baseFile;
     mTexFile = texFile;
     mOffset = offset;
     mParent = parent;
 }
Example #3
0
 /// <summary>
 /// Initializes all parameters of the chunk without performing any load operation.
 /// </summary>
 /// <param name="parent">The parent large terrain file of this chunk</param>
 /// <param name="baseFile">The MPQ-file which contains the general information about placement and doodads</param>
 /// <param name="texFile">The MPQ-stream which contains all the texture related information (MCLY, MCAL, ...)</param>
 /// <param name="offset">The offset inside baseFile and texFile where this chunks MCNK is located</param>
 public ADTChunk(ADTFile parent, Stormlib.MPQFile baseFile, Utils.StreamedMpq texFile, ChunkOffset offset)
 {
     mFile    = baseFile;
     mTexFile = texFile;
     mOffset  = offset;
     mParent  = parent;
 }