fix merge conflicts texturehashing
This commit is contained in:
1 parent
3e99f4d142
commit
44ecb677ad
5 files changed
+30
-54
No files matched your search
+4
-3
@@ -2345,9 +2345,7 @@ static void P_RunLevelScript(const char *scriptname)
|
||||
lumpnum_t lumpnum;
|
||||
char newname[9];
|
||||
|
||||
strncpy(newname, scriptname, 8);
|
||||
|
||||
newname[8] = '\0';
|
||||
strlcpy(newname, scriptname, sizeof(newname));
|
||||
|
||||
lumpnum = W_CheckNumForName(newname);
|
||||
|
||||
@@ -3311,6 +3309,9 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
if (!devparm && digmreplaces)
|
||||
CONS_Printf(M_GetText("%s digital musics replaced\n"), sizeu1(digmreplaces));
|
||||
|
||||
if (!mapsadded)
|
||||
CONS_Printf(M_GetText("No maps added\n"));
|
||||
|
||||
#ifdef HWRENDER
|
||||
// Free GPU textures before freeing patches.
|
||||
if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED))
|
||||
|
||||
@@ -580,6 +580,7 @@ Rloadtextures (INT32 i, INT32 w)
|
||||
texture->hash = quickncasehash(texture->name, 8);
|
||||
texture->width = SHORT(patchlump->width);
|
||||
texture->height = SHORT(patchlump->height);
|
||||
texture->type = TEXTURETYPE_SINGLEPATCH;
|
||||
texture->patchcount = 1;
|
||||
texture->holes = false;
|
||||
|
||||
@@ -592,9 +593,23 @@ Rloadtextures (INT32 i, INT32 w)
|
||||
|
||||
Z_Free(patchlump);
|
||||
|
||||
// determine width power of 2
|
||||
#if 1
|
||||
// [WDJ] only need to determine if exact power of 2.
|
||||
k = 1;
|
||||
while (k < texture->width)
|
||||
k<<=1;
|
||||
#else
|
||||
// Largest power of 2 that fits within width.
|
||||
k = 1;
|
||||
while (k << 1 <= texture->width)
|
||||
k <<= 1;
|
||||
#endif
|
||||
if (k != texture->width)
|
||||
{
|
||||
// Odd width
|
||||
k = 1; // make texturewidthmask = 0
|
||||
}
|
||||
|
||||
texturewidthmask[i] = k - 1;
|
||||
textureheight[i] = texture->height << FRACBITS;
|
||||
|
||||
@@ -52,6 +52,7 @@ typedef struct
|
||||
{
|
||||
// Keep name for switch changing, etc.
|
||||
char name[8];
|
||||
UINT8 type; // TEXTURETYPE_
|
||||
UINT32 hash;
|
||||
INT16 width, height;
|
||||
boolean holes;
|
||||
|
||||
+10
-50
@@ -371,8 +371,6 @@ static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const
|
||||
fseek(handle, 0, SEEK_END);
|
||||
lumpinfo->size = ftell(handle);
|
||||
fseek(handle, 0, SEEK_SET);
|
||||
strlcpy(lumpinfo->name, lumpname, 9);
|
||||
lumpinfo->hash = quickncasehash(lumpname, 8);
|
||||
|
||||
strlcpy(lumpinfo->name, lumpname, sizeof(lumpinfo->name));
|
||||
lumpinfo->namelength = strlen(lumpinfo->name);
|
||||
@@ -478,7 +476,8 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
|
||||
lump_p->compression = CM_NOCOMPRESSION;
|
||||
memset(lump_p->name, 0x00, 9);
|
||||
strncpy(lump_p->name, fileinfo->name, 8);
|
||||
lump_p->hash = quickncasehash(lump_p->name, 8);
|
||||
lump_p->namelength = strlen(lump_p->name);
|
||||
lump_p->hash.name = W_HashLumpName(lump_p->name);
|
||||
|
||||
// Allocate the lump's long name.
|
||||
lump_p->longname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
||||
@@ -685,7 +684,8 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
||||
|
||||
memset(lump_p->name, '\0', 9); // Making sure they're initialized to 0. Is it necessary?
|
||||
strncpy(lump_p->name, trimname, min(8, dotpos - trimname));
|
||||
lump_p->hash = quickncasehash(lump_p->name, 8);
|
||||
lump_p->namelength = strlen(lump_p->name);
|
||||
lump_p->hash.name = W_HashLumpName(lump_p->name);
|
||||
|
||||
lump_p->longname = Z_Calloc(dotpos - trimname + 1, PU_STATIC, NULL);
|
||||
strlcpy(lump_p->longname, trimname, dotpos - trimname + 1);
|
||||
@@ -1012,6 +1012,7 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
UINT16 i;
|
||||
static char uname[9];
|
||||
UINT32 hash;
|
||||
size_t namelen;
|
||||
|
||||
if (!TestValidLump(wad,0))
|
||||
return INT16_MAX;
|
||||
@@ -1019,7 +1020,8 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
memset(uname, 0, sizeof uname);
|
||||
strncpy(uname, name, sizeof(uname)-1);
|
||||
strupr(uname);
|
||||
hash = quickncasehash(uname, 8);
|
||||
namelen = strlen(uname);
|
||||
hash = W_HashLumpName(uname);
|
||||
|
||||
//
|
||||
// scan forward
|
||||
@@ -1030,7 +1032,9 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
{
|
||||
lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
|
||||
for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
|
||||
if (lump_p->hash == hash && memcmp(lump_p->name, uname, sizeof(uname) - 1) == 0)
|
||||
if (lump_p->namelength == namelen
|
||||
&& lump_p->hash.name == hash
|
||||
&& !memcmp(lump_p->name, uname, sizeof(uname) - 1))
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -1260,50 +1264,6 @@ lumpnum_t W_CheckNumForLongName(const char *name)
|
||||
}
|
||||
}
|
||||
|
||||
// Look for valid map data through all added files in descendant order.
|
||||
// Get a map marker for WADs, and a standalone WAD file lump inside PK3s.
|
||||
// TODO: Make it search through cache first, maybe...?
|
||||
lumpnum_t W_CheckNumForMap(const char *name)
|
||||
{
|
||||
UINT32 hash = name ? quickncasehash(name, 8) : 0;
|
||||
UINT16 lumpNum, end;
|
||||
UINT32 i;
|
||||
lumpinfo_t *p;
|
||||
for (i = numwadfiles - 1; i < numwadfiles; i--)
|
||||
{
|
||||
if (wadfiles[i]->type == RET_WAD)
|
||||
{
|
||||
for (lumpNum = 0; lumpNum < wadfiles[i]->numlumps; lumpNum++)
|
||||
{
|
||||
p = wadfiles[i]->lumpinfo + lumpNum;
|
||||
if (p->hash == hash && !strncmp(name, p->name, 8))
|
||||
return (i<<16) + lumpNum;
|
||||
}
|
||||
}
|
||||
else if (wadfiles[i]->type == RET_PK3)
|
||||
{
|
||||
lumpNum = W_CheckNumForFolderStartPK3("maps/", i, 0);
|
||||
if (lumpNum != INT16_MAX)
|
||||
end = W_CheckNumForFolderEndPK3("maps/", i, lumpNum);
|
||||
else
|
||||
continue;
|
||||
// Now look for the specified map.
|
||||
for (; lumpNum < end; lumpNum++)
|
||||
{
|
||||
p = wadfiles[i]->lumpinfo + lumpNum;
|
||||
|
||||
if (p->hash == hash && !strnicmp(name, p->name, 8))
|
||||
{
|
||||
const char *extension = strrchr(p->fullname, '.');
|
||||
if (!(extension && stricmp(extension, ".wad")))
|
||||
return (i<<16) + lumpNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return LUMPERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// W_GetNumForName
|
||||
//
|
||||
|
||||
@@ -75,7 +75,6 @@ typedef struct
|
||||
unsigned long position; // filelump_t filepos
|
||||
unsigned long disksize; // filelump_t size
|
||||
char name[9]; // filelump_t name[] e.g. "LongEntr"
|
||||
UINT32 hash;
|
||||
char *longname; // e.g. "LongEntryName"
|
||||
char *fullname; // e.g. "Folder/Subfolder/LongEntryName.extension"
|
||||
|
||||
|
||||
Reference in new issue
Block a user