- disable texture name truncation for textures/ directory.

Unlike Doom, a similar limit does not exist here and must not be enforced. Any texture from this folder needs to be usable by its full name without extension to be able to replace named tiles.
This commit is contained in:
Christoph Oelckers 2021-07-05 22:39:24 +02:00
parent 1dbf34fe56
commit e5cb1976d3
3 changed files with 42 additions and 20 deletions

View file

@ -448,7 +448,13 @@ FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
if (lumpnum != -1)
{
FString str;
fileSystem.GetFileShortName(str, lumpnum);
if (!usefullnames)
fileSystem.GetFileShortName(str, lumpnum);
else
{
auto fn = fileSystem.GetFileFullName(lumpnum);
str = ExtractFileBase(fn);
}
auto out = MakeGameTexture(CreateTextureFromLump(lumpnum, usetype == ETextureType::Flat), str, usetype);
if (out != NULL)
@ -557,30 +563,44 @@ void FTextureManager::AddGroup(int wadnum, int ns, ETextureType usetype)
int lasttx = fileSystem.GetLastEntry(wadnum);
FString Name;
// Go from first to last so that ANIMDEFS work as expected. However,
// to avoid duplicates (and to keep earlier entries from overriding
// later ones), the texture is only inserted if it is the one returned
// by doing a check by name in the list of wads.
for (; firsttx <= lasttx; ++firsttx)
if (!usefullnames)
{
if (fileSystem.GetFileNamespace(firsttx) == ns)
{
fileSystem.GetFileShortName (Name, firsttx);
// Go from first to last so that ANIMDEFS work as expected. However,
// to avoid duplicates (and to keep earlier entries from overriding
// later ones), the texture is only inserted if it is the one returned
// by doing a check by name in the list of wads.
if (fileSystem.CheckNumForName (Name, ns) == firsttx)
{
CreateTexture (firsttx, usetype);
}
progressFunc();
}
else if (ns == ns_flats && fileSystem.GetFileFlags(firsttx) & LUMPF_MAYBEFLAT)
for (; firsttx <= lasttx; ++firsttx)
{
if (fileSystem.CheckNumForName (Name, ns) < firsttx)
if (fileSystem.GetFileNamespace(firsttx) == ns)
{
CreateTexture (firsttx, usetype);
fileSystem.GetFileShortName(Name, firsttx);
if (fileSystem.CheckNumForName(Name, ns) == firsttx)
{
CreateTexture(firsttx, usetype);
}
progressFunc();
}
else if (ns == ns_flats && fileSystem.GetFileFlags(firsttx) & LUMPF_MAYBEFLAT)
{
if (fileSystem.CheckNumForName(Name, ns) < firsttx)
{
CreateTexture(firsttx, usetype);
}
progressFunc();
}
}
}
else
{
// The duplicate check does not work with this (yet.)
for (; firsttx <= lasttx; ++firsttx)
{
if (fileSystem.GetFileNamespace(firsttx) == ns)
{
CreateTexture(firsttx, usetype);
}
progressFunc();
}
}
}

View file

@ -206,6 +206,7 @@ public:
FTextureID glPart2;
FTextureID glPart;
FTextureID mirrorTexture;
bool usefullnames;
};

View file

@ -886,6 +886,7 @@ void GetGames()
static void InitTextures()
{
TexMan.usefullnames = true;
TexMan.Init([]() {}, [](BuildInfo&) {});
StartScreen->Progress();
mdinit();