mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
Added support for TEXTURES and DECORATE files that have different extensions (they will be loaded cumulatively)
This commit is contained in:
parent
5f63667a66
commit
012673554d
5 changed files with 63 additions and 15 deletions
|
@ -279,6 +279,12 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
return files.GetAllFiles(path, subfolders).ToArray();
|
return files.GetAllFiles(path, subfolders).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This returns all files in a given directory that have the given file title
|
||||||
|
protected override string[] GetAllFilesWithTitle(string path, string title, bool subfolders)
|
||||||
|
{
|
||||||
|
return files.GetAllFilesWithTitle(path, title, subfolders).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
// This returns all files in a given directory that match the given extension
|
// This returns all files in a given directory that match the given extension
|
||||||
protected override string[] GetFilesWithExt(string path, string extension, bool subfolders)
|
protected override string[] GetFilesWithExt(string path, string extension, bool subfolders)
|
||||||
{
|
{
|
||||||
|
|
|
@ -275,6 +275,12 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
return files.GetAllFiles(path, subfolders).ToArray();
|
return files.GetAllFiles(path, subfolders).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This returns all files in a given directory that have the given title
|
||||||
|
protected override string[] GetAllFilesWithTitle(string path, string title, bool subfolders)
|
||||||
|
{
|
||||||
|
return files.GetAllFilesWithTitle(path, title, subfolders).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
// This returns all files in a given directory that match the given extension
|
// This returns all files in a given directory that match the given extension
|
||||||
protected override string[] GetFilesWithExt(string path, string extension, bool subfolders)
|
protected override string[] GetFilesWithExt(string path, string extension, bool subfolders)
|
||||||
{
|
{
|
||||||
|
|
|
@ -208,8 +208,8 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
|
|
||||||
// Load TEXTURES lump file
|
// Load TEXTURES lump file
|
||||||
imgset.Clear();
|
imgset.Clear();
|
||||||
string texturesfile = FindFirstFile("TEXTURES", false);
|
string[] alltexturefiles = GetAllFilesWithTitle("", "TEXTURES", false);
|
||||||
if((texturesfile != null) && FileExists(texturesfile))
|
foreach(string texturesfile in alltexturefiles)
|
||||||
{
|
{
|
||||||
MemoryStream filedata = LoadFile(texturesfile);
|
MemoryStream filedata = LoadFile(texturesfile);
|
||||||
WADReader.LoadHighresTextures(filedata, texturesfile, ref imgset, images, null);
|
WADReader.LoadHighresTextures(filedata, texturesfile, ref imgset, images, null);
|
||||||
|
@ -342,8 +342,8 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
// Find in root directory
|
// Find in root directory
|
||||||
string filename = Path.GetFileName(pname);
|
string filename = Path.GetFileName(pname);
|
||||||
string pathname = Path.GetDirectoryName(pname);
|
string pathname = Path.GetDirectoryName(pname);
|
||||||
string foundfile = (filename.IndexOf('.') > -1) ? FindFirstFileWithExt(pathname, filename, false) : FindFirstFile(pathname, filename, false);
|
string[] allfilenames = GetAllFilesWithTitle(pathname, filename, false);
|
||||||
if((foundfile != null) && FileExists(foundfile))
|
foreach(string foundfile in allfilenames)
|
||||||
{
|
{
|
||||||
streams.Add(LoadFile(foundfile));
|
streams.Add(LoadFile(foundfile));
|
||||||
}
|
}
|
||||||
|
@ -410,6 +410,9 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
// This must return all files in a given directory
|
// This must return all files in a given directory
|
||||||
protected abstract string[] GetAllFiles(string path, bool subfolders);
|
protected abstract string[] GetAllFiles(string path, bool subfolders);
|
||||||
|
|
||||||
|
// This must return all files in a given directory that have the given file title
|
||||||
|
protected abstract string[] GetAllFilesWithTitle(string path, string title, bool subfolders);
|
||||||
|
|
||||||
// This must return all files in a given directory that match the given extension
|
// This must return all files in a given directory that match the given extension
|
||||||
protected abstract string[] GetFilesWithExt(string path, string extension, bool subfolders);
|
protected abstract string[] GetFilesWithExt(string path, string extension, bool subfolders);
|
||||||
|
|
||||||
|
|
|
@ -305,6 +305,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
{
|
{
|
||||||
List<ImageData> images = new List<ImageData>();
|
List<ImageData> images = new List<ImageData>();
|
||||||
string rangestart, rangeend;
|
string rangestart, rangeend;
|
||||||
|
int lumpindex;
|
||||||
Lump lump;
|
Lump lump;
|
||||||
|
|
||||||
// Error when suspended
|
// Error when suspended
|
||||||
|
@ -324,12 +325,15 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load TEXTURES lump file
|
// Load TEXTURES lump file
|
||||||
lump = file.FindLump("TEXTURES");
|
lumpindex = file.FindLumpIndex("TEXTURES");
|
||||||
if(lump != null)
|
while(lumpindex > -1)
|
||||||
{
|
{
|
||||||
MemoryStream filedata = new MemoryStream(lump.Stream.ReadAllBytes());
|
MemoryStream filedata = new MemoryStream(file.Lumps[lumpindex].Stream.ReadAllBytes());
|
||||||
WADReader.LoadHighresTextures(filedata, "TEXTURES", ref images, null, null);
|
WADReader.LoadHighresTextures(filedata, "TEXTURES", ref images, null, null);
|
||||||
filedata.Dispose();
|
filedata.Dispose();
|
||||||
|
|
||||||
|
// Find next
|
||||||
|
lumpindex = file.FindLumpIndex("TEXTURES", lumpindex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add images to the container-specific texture set
|
// Add images to the container-specific texture set
|
||||||
|
|
|
@ -138,6 +138,35 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This returns a list of all files that are in the given path and subdirectories and have the given title
|
||||||
|
public List<string> GetAllFilesWithTitle(string path, string title)
|
||||||
|
{
|
||||||
|
path = CorrectPath(path).ToLowerInvariant();
|
||||||
|
title = title.ToLowerInvariant();
|
||||||
|
List<string> files = new List<string>(entries.Length);
|
||||||
|
for(int i = 0; i < entries.Length; i++)
|
||||||
|
if(entries[i].path.StartsWith(path) && (entries[i].filetitle == title))
|
||||||
|
files.Add(entries[i].filepathname);
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This returns a list of all files that are in the given path (optionally in subdirectories) and have the given title
|
||||||
|
public List<string> GetAllFilesWithTitle(string path, string title, bool subdirectories)
|
||||||
|
{
|
||||||
|
if(subdirectories)
|
||||||
|
return GetAllFilesWithTitle(path, title);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path = CorrectPath(path).ToLowerInvariant();
|
||||||
|
title = title.ToLowerInvariant();
|
||||||
|
List<string> files = new List<string>(entries.Length);
|
||||||
|
for(int i = 0; i < entries.Length; i++)
|
||||||
|
if((entries[i].path == path) && (entries[i].filetitle == title))
|
||||||
|
files.Add(entries[i].filepathname);
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This returns a list of all files that are in the given path and subdirectories and have the given extension
|
// This returns a list of all files that are in the given path and subdirectories and have the given extension
|
||||||
public List<string> GetAllFiles(string path, string extension)
|
public List<string> GetAllFiles(string path, string extension)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue