From 6ebc6412e49fbb11812df6d44e08c1568ee6447f Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 15 Apr 2025 15:11:52 +0200 Subject: [PATCH] idk anymore lel --- src/hardware/hw_cache.c | 14 +++----------- src/r_data.c | 23 +++++++++-------------- src/st_stuff.c | 4 ++-- 3 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 83a3a2d6b..7393caa47 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -314,6 +314,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe texture_t *texture; texpatch_t *patch; softwarepatch_t *realpatch; + UINT8 *pdata; INT32 blockwidth, blockheight, blocksize; UINT8 *colormap = colormaps; @@ -377,12 +378,8 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe // Composite the columns together. for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) { - // If this patch has already been loaded, we just use it from the cache. - realpatch = (softwarepatch_t *)W_GetCachedPatchNumPwad(patch->wad, patch->lump); - - // Otherwise, we load it here. - if (realpatch == NULL) - realpatch = (softwarepatch_t *)W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); + pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); + realpatch = (softwarepatch_t *)pdata; if (realpatch != NULL) { @@ -516,10 +513,6 @@ void HWR_FreeTextureColormaps(patch_t *patch) // Set the first colormap to the one that comes after it. next = pat->mipmap->nextcolormap; - - if (!next) - break; - pat->mipmap->nextcolormap = next->nextcolormap; // Free image data from memory. @@ -1233,7 +1226,6 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum) patch = HWR_GetCachedGLPatch(fademasklumpnum); glMipmap = ((GLPatch_t *)Patch_AllocateHardwarePatch(patch))->mipmap; - if (!glMipmap->downloaded && !glMipmap->data) HWR_CacheFadeMask(glMipmap, fademasklumpnum); diff --git a/src/r_data.c b/src/r_data.c index 5a5f19219..531bf7e21 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -304,6 +304,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) texture_t *texture; texpatch_t *patch; softwarepatch_t *realpatch; + UINT8 *pdata; int x, x1, x2, i, width, height; size_t blocksize; column_t *patchcol; @@ -323,8 +324,8 @@ static UINT8 *R_GenerateTexture(size_t texnum) { boolean holey = false; patch = texture->patches; - - realpatch = (softwarepatch_t *)W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); + pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); + realpatch = (softwarepatch_t *)pdata; // Check the patch for holes. if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height)) @@ -394,12 +395,8 @@ static UINT8 *R_GenerateTexture(size_t texnum) // Composite the columns together. for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) { - // If this patch has already been loaded, we just use it from the cache. - realpatch = (softwarepatch_t *)W_GetCachedPatchNumPwad(patch->wad, patch->lump); - - // Otherwise, we load it here. - if (realpatch == NULL) - realpatch = (softwarepatch_t *)W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); + pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); + realpatch = (softwarepatch_t *)pdata; // Well, it's not valid... if (realpatch == NULL) @@ -519,7 +516,7 @@ Rloadtextures (INT32 i, INT32 w) UINT16 j; INT32 k; UINT16 texstart, texend, texturesLumpPos; - patch_t *patchlump; + softwarepatch_t patchlump; texpatch_t *patch; texture_t *texture; @@ -558,7 +555,7 @@ Rloadtextures (INT32 i, INT32 w) continue; // If it is then SKIP IT } - patchlump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_STATIC); + W_ReadLumpHeaderPwad(wadnum, lumpnum, &patchlump, 8, 0); //CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height); texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL); @@ -566,8 +563,8 @@ Rloadtextures (INT32 i, INT32 w) // Set texture properties. M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name)); texture->hash = quickncasehash(texture->name, 8); - texture->width = patchlump->width; - texture->height = patchlump->height; + texture->width = SHORT(patchlump.width); + texture->height = SHORT(patchlump.height); texture->patchcount = 1; texture->holes = false; @@ -578,8 +575,6 @@ Rloadtextures (INT32 i, INT32 w) patch->wad = (UINT16)w; patch->lump = texstart + j; - Z_Free(patchlump); - k = 1; while (k << 1 <= texture->width) k <<= 1; diff --git a/src/st_stuff.c b/src/st_stuff.c index 7660fbd3b..5a09f61e8 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -217,8 +217,8 @@ void ST_UnloadGraphics(void) void ST_LoadGraphics(void) { // SRB2 border patch - st_borderpatchnum = W_GetNumForName("GFZFLR01"); - scr_borderpatch = W_CacheLumpNum(st_borderpatchnum, PU_HUDGFX); + //st_borderpatchnum = W_GetNumForName("GFZFLR01"); + //scr_borderpatch = W_CacheLumpNum(st_borderpatchnum, PU_HUDGFX); // the original Doom uses 'STF' as base name for all face graphics // Graue 04-08-2004: face/name graphics are now indexed by skins