From 46e10f67b2353c5043eb8680ac6583ad07be438d Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 16 Apr 2025 16:21:13 +0200 Subject: [PATCH] more smol fixes --- src/hardware/hw_cache.c | 8 ++++---- src/p_setup.c | 4 ++-- src/r_data.c | 20 ++++++++++++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 545be088d..ae9436ac0 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -991,7 +991,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap) if (!glMipmap->downloaded && !glMipmap->data) HWR_CacheFlat(glMipmap, flatlumpnum); - // If hardware does not have the texture, then call pfnSetTexture to upload it + // If hardware does not have the texture, then call GL_SetTexture to upload it if (!glMipmap->downloaded) GL_SetTexture(glMipmap); HWR_SetCurrentTexture(glMipmap); @@ -1010,7 +1010,7 @@ static void HWR_LoadPatchMipmap(patch_t *patch, GLMipmap_t *glMipmap) if (!glMipmap->downloaded && !glMipmap->data) HWR_MakePatch(patch, glPatch, glMipmap, true); - // If hardware does not have the texture, then call pfnSetTexture to upload it + // If hardware does not have the texture, then call GL_SetTexture to upload it if (!glMipmap->downloaded) GL_SetTexture(glMipmap); HWR_SetCurrentTexture(glMipmap); @@ -1027,8 +1027,8 @@ static void HWR_UpdatePatchMipmap(patch_t *patch, GLMipmap_t *glMipmap) GLPatch_t *grPatch = patch->hardware; HWR_MakePatch(patch, grPatch, glMipmap, true); - // If hardware does not have the texture, then call pfnSetTexture to upload it - // If it does have the texture, then call pfnUpdateTexture to update it + // If hardware does not have the texture, then call GL_SetTexture to upload it + // If it does have the texture, then call GL_UpdateTexture to update it if (!glMipmap->downloaded) GL_SetTexture(glMipmap); else diff --git a/src/p_setup.c b/src/p_setup.c index a984121aa..d1657a153 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3350,13 +3350,13 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local) // search for sprite replacements // Patch_FreeTag(PU_SPRITE); - Patch_FreeTag(PU_PATCH_ROTATED); + //Patch_FreeTag(PU_PATCH_ROTATED); R_AddSpriteDefs(wadnum); // Reload it all anyway, just in case they // added some textures but didn't insert a // TEXTURES/etc. list. - R_LoadTexturesPwad(wadnum); + //R_LoadTexturesPwad(wadnum); // everything from MultiSetupWadFile until ST_Start was here originally diff --git a/src/r_data.c b/src/r_data.c index 2a2a0bd1d..b01b12ba5 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -541,7 +541,7 @@ void R_LoadTextures(void) // but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures. for (w = 0, numtextures = 0; w < numwadfiles; w++) { - if (wadfiles[w]->type == RET_PK3) + if (W_FileHasFolders(wadfiles[w])) { texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0); texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart); @@ -605,7 +605,7 @@ void R_LoadTextures(void) for (i = 0, w = 0; w < numwadfiles; w++) { // Get the lump numbers for the markers in the WAD, if they exist. - if (wadfiles[w]->type == RET_PK3) + if (W_FileHasFolders(wadfiles[w])) { texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0); texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart); @@ -618,7 +618,7 @@ void R_LoadTextures(void) } else { - texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1; + texstart = W_CheckNumForMarkerStartPwad(TX_START, (UINT16)w, 0); texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0); texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0); if (texturesLumpPos != INT16_MAX) @@ -631,20 +631,22 @@ void R_LoadTextures(void) // Work through each lump between the markers in the WAD. for (j = 0; j < (texend - texstart); j++) { + UINT16 wadnum = (UINT16)w; + lumpnum_t lumpnum = texstart + j; + if (W_FileHasFolders(wadfiles[w])) { - if (W_IsLumpFolder(w, texstart + j)) // Check if lump is a folder + if (W_IsLumpFolder(wadnum, lumpnum)) // Check if lump is a folder continue; // If it is then SKIP IT } - patchlump = W_CacheLumpNumPwad((UINT16)w, texstart + j, PU_CACHE); patchlump = (softwarepatch_t *)W_CacheLumpNumPwad(wadnum, lumpnum, PU_STATIC); - //CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height); + //CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad(wadnum, lumpnum), patchlump->width, patchlump->height); texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL); // Set texture properties. - M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name)); + M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name)); texture->width = SHORT(patchlump->width); texture->height = SHORT(patchlump->height); texture->patchcount = 1; @@ -654,9 +656,11 @@ void R_LoadTextures(void) patch = &texture->patches[0]; patch->originx = patch->originy = 0; - patch->wad = (UINT16)w; + patch->wad = wadnum; patch->lump = texstart + j; + Z_Free(patchlump); + k = 1; while (k << 1 <= texture->width) k <<= 1;