diff --git a/src/w_wad.c b/src/w_wad.c index 0525de105..22c0a271d 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -827,8 +827,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 // @@ -1816,16 +1815,16 @@ 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 = Z_Calloc(sizeof(rotsprite_t), PU_STATIC, &rotcache[lumpnum]); + rspr->angles = ROTANGLES; + rspr->patches = Z_Calloc(rspr->angles * 2 * sizeof(void *), PU_STATIC, NULL); } - return (void *)rspr; + return (void *)(rotcache[lumpnum]); } #endif // ROTSPRITE diff --git a/src/w_wad.h b/src/w_wad.h index dc1680a08..67e28a290 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -107,8 +107,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 { @@ -128,7 +126,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;