From abeec10d3243414c89755782d9f2776c3624d079 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 22 Jan 2022 08:00:09 -0500 Subject: [PATCH] Brightmap loading uses hashes # Conflicts: # src/k_brightmap.c # src/k_brightmap.h --- src/k_brightmap.c | 10 +++++----- src/k_brightmap.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/k_brightmap.c b/src/k_brightmap.c index c62d645e6..a70d7a955 100644 --- a/src/k_brightmap.c +++ b/src/k_brightmap.c @@ -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 { diff --git a/src/k_brightmap.h b/src/k_brightmap.h index 72bc7e9df..33a1faec2 100644 --- a/src/k_brightmap.h +++ b/src/k_brightmap.h @@ -23,11 +23,11 @@ typedef struct brightmapStorage_s // Stores data for brightmap definitions, // before putting them into texturebrightmaps. - char textureName[9]; // The texture's name. - UINT32 textureHash; // The texture name's hash. + char textureName[8]; // The texture's name. + UINT32 textureHash; // The texture name's hash. - char brightmapName[9]; // The brightmap's name. - UINT32 brightmapHash; // The brightmap name's hash. + char brightmapName[8]; // The brightmap's name. + UINT32 brightmapHash; // The brightmap name's hash. } brightmapStorage_t; /*--------------------------------------------------