Example #1
0
        public LumpPtr(uint start, uint size, byte[] nameBuffer, WadFile file)
        {
            this.file = file;
            string name = DoomUtils.ToName(nameBuffer);

            Lump = file.AllocateLump(name, start, size);
        }
Example #2
0
        /// <summary>
        /// Creates a new map texture from a memeory stream
        /// </summary>
        /// <param name="texturePool"></param>
        /// <param name="stream"></param>
        public MapTexture(WadFile.WadTexturePool texturePool, MemoryStream stream)
        {
            pool = texturePool;
            byte[] buffer = new byte[8];
            stream.Read(buffer, 0, 8);
            Name = DoomUtils.ToName(buffer, 0, 8);
            stream.Read(buffer, 0, 4);
            Masked = BitConverter.ToInt32(buffer, 0);
            stream.Read(buffer, 0, 2);
            Width = BitConverter.ToInt16(buffer, 0);
            stream.Read(buffer, 0, 2);
            Height = BitConverter.ToInt16(buffer, 0);

            stream.Read(buffer, 0, 4);

            this.patches = new List <PatchData>();
            stream.Read(buffer, 0, 2);
            short patches = BitConverter.ToInt16(buffer, 0);

            for (int i = 0; i < patches; i++)
            {
                this.patches.Add(new PatchData(stream));
            }
        }