Read only header bytes when creating textures list

This commit is contained in:
Alug committed 2024-03-27 21:31:45 +01:00
1 parent 7b1be2e34f
commit ab6b716e78
1 file changed
+4 -7
+4 -7
View File
@@ -384,7 +384,7 @@ Rloadtextures (INT32 i, INT32 w)
UINT16 j;
INT32 k;
UINT16 texstart, texend, texturesLumpPos;
patch_t *patchlump;
patch_t patchlump;
texpatch_t *patch;
texture_t *texture;
@@ -422,8 +422,7 @@ Rloadtextures (INT32 i, INT32 w)
if (W_IsLumpFolder(wadnum, lumpnum)) // Check if lump is a folder
continue; // If it is then SKIP IT
}
patchlump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
W_ReadLumpHeaderPwad(wadnum, lumpnum, &patchlump, 8, 0); // #define PNG_HEADER_SIZE (8)
//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);
@@ -431,8 +430,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 = SHORT(patchlump->width);
texture->height = SHORT(patchlump->height);
texture->width = SHORT(patchlump.width);
texture->height = SHORT(patchlump.height);
texture->patchcount = 1;
texture->holes = false;
@@ -443,8 +442,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;