turn rotcache into a lumpcache_t aswell

no need for slow aatrees
This commit is contained in:
Alug committed 2025-04-16 19:22:28 +02:00
1 parent 88dc5f25ad
commit b28593dba7
2 files changed
+7 -11

No files matched your search

+6 -8
View File
@@ -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
+1 -3
View File
@@ -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;