Ejemplo n.º 1
0
        // This loads the textures
        public override ICollection <ImageData> LoadFlats()
        {
            Dictionary <long, ImageData> images = new Dictionary <long, ImageData>();
            ICollection <ImageData>      collection;
            List <ImageData>             imgset = new List <ImageData>();

            // Error when suspended
            if (issuspended)
            {
                throw new Exception("Data reader is suspended");
            }

            // Load from wad files
            // Note the backward order, because the last wad's images have priority
            for (int i = wads.Count - 1; i >= 0; i--)
            {
                collection = wads[i].LoadFlats();
                AddImagesToList(images, collection);
            }

            // Should we load the images in this directory as flats?
            if (rootflats)
            {
                collection = LoadDirectoryImages("", ImageDataFormat.DOOMFLAT, false);
                AddImagesToList(images, collection);
            }

            // Add images from flats directory
            collection = LoadDirectoryImages(FLATS_DIR, ImageDataFormat.DOOMFLAT, true);
            AddImagesToList(images, collection);

            // Add images to the container-specific texture set
            foreach (ImageData img in images.Values)
            {
                textureset.AddFlat(img);
            }

            // Load TEXTURES lump file
            imgset.Clear();
            string[] alltexturefiles = GetAllFilesWithTitle("", "TEXTURES", false);
            foreach (string texturesfile in alltexturefiles)
            {
                MemoryStream filedata = LoadFile(texturesfile);
                WADReader.LoadHighresFlats(filedata, texturesfile, ref imgset, null, images);
                filedata.Dispose();
            }

            // Add images from TEXTURES lump file
            AddImagesToList(images, imgset);

            return(new List <ImageData>(images.Values));
        }