mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +00:00
- remove texture name length limits for udmf maps
This commit is contained in:
parent
ae8995e65b
commit
59885b856d
12 changed files with 1383 additions and 1377 deletions
|
@ -297,7 +297,7 @@ void DDoor::DoorSound(bool raise, DSeqNode *curseq) const
|
|||
continue;
|
||||
|
||||
FTexture *tex = TexMan[line->sidedef[0]->GetTexture(side_t::top)];
|
||||
texname = tex? tex->Name : NULL;
|
||||
texname = tex ? tex->Name.GetChars() : NULL;
|
||||
if (texname != NULL && texname[0] == 'D' && texname[1] == 'O' && texname[2] == 'R')
|
||||
{
|
||||
switch (texname[3])
|
||||
|
|
|
@ -249,6 +249,8 @@ static void R_InstallSprite (int num)
|
|||
// letter/number appended.
|
||||
// The rotation character can be 0 to signify no rotations.
|
||||
//
|
||||
#define TEX_DWNAME(tex) MAKE_ID(tex->Name[0], tex->Name[1], tex->Name[2], tex->Name[3])
|
||||
|
||||
void R_InitSpriteDefs ()
|
||||
{
|
||||
struct Hasher
|
||||
|
@ -272,7 +274,7 @@ void R_InitSpriteDefs ()
|
|||
FTexture *tex = TexMan.ByIndex(i);
|
||||
if (tex->UseType == FTexture::TEX_Sprite && strlen(tex->Name) >= 6)
|
||||
{
|
||||
size_t bucket = tex->dwName % smax;
|
||||
size_t bucket = TEX_DWNAME(tex) % smax;
|
||||
hashes[i].Next = hashes[bucket].Head;
|
||||
hashes[bucket].Head = i;
|
||||
}
|
||||
|
@ -352,7 +354,7 @@ void R_InitSpriteDefs ()
|
|||
while (hash != -1)
|
||||
{
|
||||
FTexture *tex = TexMan[hash];
|
||||
if (tex->dwName == intname)
|
||||
if (TEX_DWNAME(tex) == intname)
|
||||
{
|
||||
bool res = R_InstallSpriteLump (FTextureID(hash), tex->Name[4] - 'A', tex->Name[5], false);
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ FBuildTexture::FBuildTexture (int tilenum, const BYTE *pixels, int width, int he
|
|||
LeftOffset = left;
|
||||
TopOffset = top;
|
||||
CalcBitSize ();
|
||||
mysnprintf (Name, countof(Name), "BTIL%04d", tilenum);
|
||||
Name.Format("BTIL%04d", tilenum);
|
||||
UseType = TEX_Build;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@
|
|||
|
||||
FCanvasTexture::FCanvasTexture (const char *name, int width, int height)
|
||||
{
|
||||
strncpy (Name, name, 8);
|
||||
Name[8] = 0;
|
||||
Name = name;
|
||||
Width = width;
|
||||
Height = height;
|
||||
LeftOffset = TopOffset = 0;
|
||||
|
|
|
@ -106,7 +106,6 @@ FIMGZTexture::FIMGZTexture (int lumpnum, WORD w, WORD h, SWORD l, SWORD t)
|
|||
: FTexture(NULL, lumpnum), Pixels(0), Spans(0)
|
||||
{
|
||||
Wads.GetLumpName (Name, lumpnum);
|
||||
Name[8] = 0;
|
||||
Width = w;
|
||||
Height = h;
|
||||
LeftOffset = l;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -137,7 +137,10 @@ FTexture * FTexture::CreateTexture (int lumpnum, int usetype)
|
|||
FTexture * FTexture::CreateTexture (const char *name, int lumpnum, int usetype)
|
||||
{
|
||||
FTexture *tex = CreateTexture(lumpnum, usetype);
|
||||
if (tex != NULL && name != NULL) uppercopy(tex->Name, name);
|
||||
if (tex != NULL && name != NULL) {
|
||||
tex->Name = name;
|
||||
tex->Name.ToUpper();
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
@ -152,16 +155,16 @@ FTexture::FTexture (const char *name, int lumpnum)
|
|||
id.SetInvalid();
|
||||
if (name != NULL)
|
||||
{
|
||||
uppercopy(Name, name);
|
||||
Name = name;
|
||||
Name.ToUpper();
|
||||
}
|
||||
else if (lumpnum < 0)
|
||||
{
|
||||
*Name = 0;
|
||||
Name = FString();
|
||||
}
|
||||
else
|
||||
{
|
||||
Wads.GetLumpName (Name, lumpnum);
|
||||
Name[8] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,7 +577,6 @@ FDummyTexture::FDummyTexture ()
|
|||
HeightBits = 6;
|
||||
WidthBits = 6;
|
||||
WidthMask = 63;
|
||||
Name[0] = 0;
|
||||
UseType = TEX_Null;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -157,11 +157,7 @@ public:
|
|||
int SourceLump;
|
||||
FTextureID id;
|
||||
|
||||
union
|
||||
{
|
||||
char Name[9];
|
||||
DWORD dwName; // Used with sprites
|
||||
};
|
||||
FString Name;
|
||||
BYTE UseType; // This texture's primary purpose
|
||||
|
||||
BYTE bNoDecals:1; // Decals should not stick to texture
|
||||
|
|
|
@ -145,7 +145,6 @@ FTGATexture::FTGATexture (int lumpnum, TGAHeader * hdr)
|
|||
: FTexture(NULL, lumpnum), Pixels(0), Spans(0)
|
||||
{
|
||||
Wads.GetLumpName (Name, lumpnum);
|
||||
Name[8] = 0;
|
||||
Width = hdr->width;
|
||||
Height = hdr->height;
|
||||
// Alpha channel is used only for 32 bit RGBA and paletted images with RGBA palettes.
|
||||
|
|
|
@ -492,7 +492,7 @@ int FWadCollection::CheckNumForFullName (const char *name, bool trynormal, int n
|
|||
return -1;
|
||||
}
|
||||
|
||||
i = FirstLumpIndex_FullName[MakeKey (name) % NumLumps];
|
||||
i = FirstLumpIndex_FullName[MakeKey(name) % NumLumps];
|
||||
|
||||
while (i != NULL_INDEX && stricmp(name, LumpInfo[i].lump->FullName))
|
||||
{
|
||||
|
@ -1015,6 +1015,16 @@ void FWadCollection::GetLumpName (char *to, int lump) const
|
|||
uppercopy (to, LumpInfo[lump].lump->Name);
|
||||
}
|
||||
|
||||
void FWadCollection::GetLumpName(FString &to, int lump) const
|
||||
{
|
||||
if ((size_t)lump >= NumLumps)
|
||||
to = FString();
|
||||
else {
|
||||
to = LumpInfo[lump].lump->Name;
|
||||
to.ToUpper();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FWadCollection :: GetLumpFullName
|
||||
|
|
|
@ -196,7 +196,8 @@ public:
|
|||
int GetLumpOffset (int lump); // [RH] Returns offset of lump in the wadfile
|
||||
int GetLumpFlags (int lump); // Return the flags for this lump
|
||||
void GetLumpName (char *to, int lump) const; // [RH] Copies the lump name to to using uppercopy
|
||||
const char *GetLumpFullName (int lump) const; // [RH] Returns the lump's full name
|
||||
void FWadCollection::GetLumpName(FString &to, int lump) const;
|
||||
const char *GetLumpFullName(int lump) const; // [RH] Returns the lump's full name
|
||||
FString GetLumpFullPath (int lump) const; // [RH] Returns wad's name + lump's full name
|
||||
int GetLumpFile (int lump) const; // [RH] Returns wadnum for a specified lump
|
||||
int GetLumpNamespace (int lump) const; // [RH] Returns the namespace a lump belongs to
|
||||
|
|
Loading…
Reference in a new issue