Brightmap loading uses hashes

# Conflicts:
#	src/k_brightmap.c
#	src/k_brightmap.h
This commit is contained in:
Sally Coolatta 2022-01-22 08:00:09 -05:00 committed by toaster
parent c145d12db3
commit abeec10d32
2 changed files with 9 additions and 9 deletions

View file

@ -75,7 +75,7 @@ static brightmapStorage_t *K_GetBrightmapStorageByTextureName(const char *checkN
{
brightmapStorage_t *bms = &brightmapStorage[i];
if (checkHash == bms->textureHash)
if (checkHash == bms->textureHash && !strncmp(checkName, bms->textureName, 8))
{
// Name matches.
return bms;
@ -119,8 +119,8 @@ static boolean K_BRIGHTLumpParser(UINT8 *data, size_t size)
if (bms == NULL)
{
bms = K_NewBrightmap();
strncpy(bms->textureName, tkn, 9);
bms->textureHash = quickncasehash(bms->textureName, 8);
strncpy(bms->textureName, tkn, 8);
bms->textureHash = quickncasehash(tkn, 8);
}
Z_Free(tkn);
@ -129,8 +129,8 @@ static boolean K_BRIGHTLumpParser(UINT8 *data, size_t size)
if (tkn && pos < size)
{
strncpy(bms->brightmapName, tkn, 9);
bms->brightmapHash = quickncasehash(bms->brightmapName, 8);
strncpy(bms->brightmapName, tkn, 8);
bms->brightmapHash = quickncasehash(tkn, 8);
}
else
{

View file

@ -23,10 +23,10 @@ typedef struct brightmapStorage_s
// Stores data for brightmap definitions,
// before putting them into texturebrightmaps.
char textureName[9]; // The texture's name.
char textureName[8]; // The texture's name.
UINT32 textureHash; // The texture name's hash.
char brightmapName[9]; // The brightmap's name.
char brightmapName[8]; // The brightmap's name.
UINT32 brightmapHash; // The brightmap name's hash.
} brightmapStorage_t;