More fixes to PK3/Directory patch and texture search/creation logic.

This commit is contained in:
MaxED 2014-10-07 09:56:36 +00:00
parent 7c048ece38
commit d8df65b2c1
2 changed files with 21 additions and 9 deletions

View file

@ -72,15 +72,15 @@ namespace CodeImp.DoomBuilder.Data
// This loads the image // This loads the image
protected override void LocalLoadImage() protected override void LocalLoadImage()
{ {
// Checks
if(this.IsImageLoaded) return;
if((width == 0) || (height == 0)) return;
IImageReader reader; IImageReader reader;
MemoryStream mem; MemoryStream mem;
byte[] membytes; byte[] membytes;
Graphics g = null; Graphics g = null;
// Checks
if(this.IsImageLoaded) return;
if((width == 0) || (height == 0)) return;
lock(this) lock(this)
{ {
// Create texture bitmap // Create texture bitmap

View file

@ -54,7 +54,7 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Properties #region ================== Properties
protected readonly string[] PatchLocations = { TEXTURES_DIR, PATCHES_DIR, FLATS_DIR, SPRITES_DIR, GRAPHICS_DIR }; //mxd. Because ZDoom looks for patches and sprites in this order protected readonly string[] PatchLocations = { PATCHES_DIR, TEXTURES_DIR, FLATS_DIR, SPRITES_DIR, GRAPHICS_DIR }; //mxd. Because ZDoom looks for patches and sprites in this order
protected readonly string[] TextureLocations = { TEXTURES_DIR, FLATS_DIR, SPRITES_DIR, PATCHES_DIR, GRAPHICS_DIR }; //mxd. Because ZDoom looks for textures in this order protected readonly string[] TextureLocations = { TEXTURES_DIR, FLATS_DIR, SPRITES_DIR, PATCHES_DIR, GRAPHICS_DIR }; //mxd. Because ZDoom looks for textures in this order
#endregion #endregion
@ -319,10 +319,22 @@ namespace CodeImp.DoomBuilder.Data
collection = LoadDirectoryImages("", ImageDataFormat.DOOMFLAT, false); collection = LoadDirectoryImages("", ImageDataFormat.DOOMFLAT, false);
AddImagesToList(images, collection); AddImagesToList(images, collection);
} }
// Add images from flats directory if (General.Map.Config.MixTexturesFlats)
collection = LoadDirectoryImages(FLATS_DIR, ImageDataFormat.DOOMFLAT, true); {
AddImagesToList(images, collection); //mxd. Load from directories ZDoom expects them to be
foreach(string loc in TextureLocations)
{
collection = LoadDirectoryImages(loc, ImageDataFormat.DOOMFLAT, true);
AddImagesToList(images, collection);
}
}
else
{
// Add images from flats directory
collection = LoadDirectoryImages(FLATS_DIR, ImageDataFormat.DOOMFLAT, true);
AddImagesToList(images, collection);
}
// Load TEXTURES lump file // Load TEXTURES lump file
string[] alltexturefiles = GetAllFilesWhichTitleStartsWith("", "TEXTURES"); //mxd string[] alltexturefiles = GetAllFilesWhichTitleStartsWith("", "TEXTURES"); //mxd