// 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)); }
// This loads the textures public override ICollection <ImageData> LoadFlats() { List <ImageData> images = new List <ImageData>(); string rangestart, rangeend; int lumpindex; // Error when suspended if (issuspended) { throw new Exception("Data reader is suspended"); } // Read ranges from configuration foreach (DictionaryEntry r in General.Map.Config.FlatRanges) { // Read start and end rangestart = General.Map.Config.ReadSetting("flats." + r.Key + ".start", ""); rangeend = General.Map.Config.ReadSetting("flats." + r.Key + ".end", ""); if ((rangestart.Length > 0) && (rangeend.Length > 0)) { // Load texture range LoadFlatsRange(rangestart, rangeend, ref images); } } // Load TEXTURES lump file lumpindex = file.FindLumpIndex("TEXTURES"); while (lumpindex > -1) { MemoryStream filedata = new MemoryStream(file.Lumps[lumpindex].Stream.ReadAllBytes()); WADReader.LoadHighresFlats(filedata, "TEXTURES", ref images, null, null); filedata.Dispose(); // Find next lumpindex = file.FindLumpIndex("TEXTURES", lumpindex + 1); } // Add images to the container-specific texture set foreach (ImageData img in images) { textureset.AddFlat(img); } // Return result return(images); }