From b28593dba7457ea34bba1958e57b042ed86ce40b Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 16 Apr 2025 19:22:28 +0200 Subject: [PATCH] turn rotcache into a lumpcache_t aswell no need for slow aatrees --- src/w_wad.c | 14 ++++++-------- src/w_wad.h | 4 +--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 98ab1488a..5e2e2e94b 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -824,8 +824,7 @@ UINT16 W_InitFile(const char *filename, boolean local) Z_Calloc(numlumps * sizeof (*wadfile->patchcache), PU_STATIC, &wadfile->patchcache); #ifdef ROTSPRITE - // allocates rotsprite structures and store them in a tree - wadfile->rotcache = M_AATreeAlloc(AATREE_ZUSER); + Z_Calloc(numlumps * sizeof (*wadfile->rotcache), PU_STATIC, &wadfile->rotcache); #endif // @@ -1807,16 +1806,15 @@ void *W_GetCachedPatchNumPwad(UINT16 wad, UINT16 lump) // Caches a rotsprite for patch rotation. void *W_GetCachedRotPatchPwad(UINT16 wadnum, UINT16 lumpnum) { - aatree_t *rotcache = wadfiles[wadnum]->rotcache; - rotsprite_t *rspr; + lumpcache_t *rotcache = wadfiles[wadnum]->rotcache; - if (!(rspr = M_AATreeGet(rotcache, lumpnum))) + if (!rotcache[lumpnum]) { - rspr = RotatedPatch_Create(ROTANGLES); - M_AATreeSet(rotcache, lumpnum, rspr); + rotsprite_t *rspr = RotatedPatch_Create(ROTANGLES); + Z_SetUser(rspr, (void **)(&rotcache[lumpnum])); } - return (void *)rspr; + return (void *)(rotcache[lumpnum]); } #endif // ROTSPRITE diff --git a/src/w_wad.h b/src/w_wad.h index 79cad44e9..12ad8cea7 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -106,8 +106,6 @@ virtlump_t* vres_Find(const virtres_t*, const char*); #define lumpcache_t void * -#include "m_aatree.h" - // Resource type of the WAD. Yeah, I know this sounds dumb, but I'll leave it like this until I clean up the code further. typedef enum restype { @@ -127,7 +125,7 @@ typedef struct wadfile_s lumpcache_t *lumpcache; lumpcache_t *patchcache; #ifdef ROTSPRITE - aatree_t *rotcache; // Cache rotsprites for rotating patches. + lumpcache_t *rotcache; // Cache rotsprites for rotating patches. #endif UINT16 numlumps; // this wad's number of resources FILE *handle;