- remove texture name length limits for udmf maps

This commit is contained in:
Shawn Walker 2014-05-18 15:38:46 -07:00
commit 59885b856d
12 changed files with 1383 additions and 1377 deletions

View file

@ -373,7 +373,7 @@ FTextureID FTextureManager::AddTexture (FTexture *texture)
// Later textures take precedence over earlier ones
// Textures without name can't be looked for
if (texture->Name[0] != 0)
if (texture->Name[0] != '\0')
{
bucket = int(MakeKey (texture->Name) % HASH_SIZE);
hash = HashFirst[bucket];
@ -429,7 +429,7 @@ void FTextureManager::ReplaceTexture (FTextureID picnum, FTexture *newtexture, b
FTexture *oldtexture = Textures[index].Texture;
strcpy (newtexture->Name, oldtexture->Name);
newtexture->Name = oldtexture->Name;
newtexture->UseType = oldtexture->UseType;
Textures[index].Texture = newtexture;
@ -488,9 +488,7 @@ void FTextureManager::AddGroup(int wadnum, int ns, int usetype)
{
int firsttx = Wads.GetFirstLump(wadnum);
int lasttx = Wads.GetLastLump(wadnum);
char name[9];
name[8] = 0;
FString Name;
// Go from first to last so that ANIMDEFS work as expected. However,
// to avoid duplicates (and to keep earlier entries from overriding
@ -501,9 +499,9 @@ void FTextureManager::AddGroup(int wadnum, int ns, int usetype)
{
if (Wads.GetLumpNamespace(firsttx) == ns)
{
Wads.GetLumpName (name, firsttx);
Wads.GetLumpName (Name, firsttx);
if (Wads.CheckNumForName (name, ns) == firsttx)
if (Wads.CheckNumForName (Name, ns) == firsttx)
{
CreateTexture (firsttx, usetype);
}
@ -511,7 +509,7 @@ void FTextureManager::AddGroup(int wadnum, int ns, int usetype)
}
else if (ns == ns_flats && Wads.GetLumpFlags(firsttx) & LUMPF_MAYBEFLAT)
{
if (Wads.CheckNumForName (name, ns) < firsttx)
if (Wads.CheckNumForName (Name, ns) < firsttx)
{
CreateTexture (firsttx, usetype);
}
@ -531,7 +529,7 @@ void FTextureManager::AddHiresTextures (int wadnum)
int firsttx = Wads.GetFirstLump(wadnum);
int lasttx = Wads.GetLastLump(wadnum);
char name[9];
FString Name;
TArray<FTextureID> tlist;
if (firsttx == -1 || lasttx == -1)
@ -539,18 +537,16 @@ void FTextureManager::AddHiresTextures (int wadnum)
return;
}
name[8] = 0;
for (;firsttx <= lasttx; ++firsttx)
{
if (Wads.GetLumpNamespace(firsttx) == ns_hires)
{
Wads.GetLumpName (name, firsttx);
Wads.GetLumpName (Name, firsttx);
if (Wads.CheckNumForName (name, ns_hires) == firsttx)
if (Wads.CheckNumForName (Name, ns_hires) == firsttx)
{
tlist.Clear();
int amount = ListTextures(name, tlist);
int amount = ListTextures(Name, tlist);
if (amount == 0)
{
// A texture with this name does not yet exist
@ -594,14 +590,13 @@ void FTextureManager::AddHiresTextures (int wadnum)
void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
{
int remapLump, lastLump;
char src[9];
FString src;
bool is32bit;
int width, height;
int type, mode;
TArray<FTextureID> tlist;
lastLump = 0;
src[8] = '\0';
while ((remapLump = Wads.FindLump(lumpname, &lastLump)) != -1)
{
@ -678,7 +673,7 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
FString base = ExtractFileBase(sc.String, false);
if (!base.IsEmpty())
{
strncpy(src, base, 8);
src = base.Left(8);
int lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_patches);
if (lumpnum == -1) lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_graphics);
@ -701,7 +696,7 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
// Replace the entire texture and adjust the scaling and offset factors.
newtex->bWorldPanning = true;
newtex->SetScaledSize(width, height);
memcpy(newtex->Name, src, sizeof(newtex->Name));
newtex->Name = src;
FTextureID oldtex = TexMan.CheckForTexture(src, FTexture::TEX_MiscPatch);
if (oldtex.isValid())
@ -757,7 +752,7 @@ void FTextureManager::AddPatches (int lumpnum)
char name[9];
*file >> numpatches;
name[8] = 0;
name[8] = '\0';
for (i = 0; i < numpatches; ++i)
{
@ -839,9 +834,8 @@ void FTextureManager::AddTexturesForWad(int wadnum)
for (int i= firsttx; i <= lasttx; i++)
{
bool skin = false;
char name[9];
Wads.GetLumpName(name, i);
name[8]=0;
FString Name;
Wads.GetLumpName(Name, i);
// Ignore anything not in the global namespace
int ns = Wads.GetLumpNamespace(i);
@ -867,20 +861,20 @@ void FTextureManager::AddTexturesForWad(int wadnum)
if (Wads.CheckLumpName(i, "BEHAVIOR")) continue;
// Don't bother looking at this lump if something later overrides it.
if (Wads.CheckNumForName(name, ns_graphics) != i) continue;
if (Wads.CheckNumForName(Name, ns_graphics) != i) continue;
// skip this if it has already been added as a wall patch.
if (CheckForTexture(name, FTexture::TEX_WallPatch, 0).Exists()) continue;
if (CheckForTexture(Name, FTexture::TEX_WallPatch, 0).Exists()) continue;
}
else if (ns == ns_graphics)
{
// Don't bother looking this lump if something later overrides it.
if (Wads.CheckNumForName(name, ns_graphics) != i) continue;
if (Wads.CheckNumForName(Name, ns_graphics) != i) continue;
}
else if (ns >= ns_firstskin)
{
// Don't bother looking this lump if something later overrides it.
if (Wads.CheckNumForName(name, ns) != i) continue;
if (Wads.CheckNumForName(Name, ns) != i) continue;
skin = true;
}
else continue;