Exemple #1
0
        /// <summary>
        /// Loads a new graphics from a wad
        /// </summary>
        /// <param name="lumpName"></param>
        /// <param name="file"></param>
        public Graphic(WadFile file, string lumpName)
        {
            lump = file[lumpName];

            using (MemoryStream stream = lump.RawStream())
            {
                // Move to png marker
                stream.ReadByte();

                bool png  = IsPng(stream);
                bool jfif = false;

                if (!png)
                {
                    stream.Position = 4;
                    for (int i = 0; i < 2; i++)
                    {
                        stream.ReadByte();
                    }
                    jfif = IsJfif(stream);
                }

                if (png)
                {
                    Type = GraphicType.Png;
                }
                else if (jfif)
                {
                    Type = GraphicType.Jpeg;
                }
                else
                {
                    Type      = GraphicType.DoomPatch;
                    doomImage = new DoomGraphic(lump, file.Pallete(0));
                }
            }
        }
Exemple #2
0
 public LumpPtr(Lump lump)
 {
     this.Lump = lump;
     file      = lump.File;
 }
Exemple #3
0
 /// <summary>
 /// Creates a new empty texture pool
 /// </summary>
 /// <param name="wad"></param>
 public WadTexturePool(WadFile wad)
 {
     this.wad    = wad;
     textures    = new Dictionary <string, Graphic>();
     mapTextures = new Dictionary <string, MapTexture>();
 }