turn rotcache into a lumpcache_t

gu hope this is correct lel
This commit is contained in:
Alug committed 2025-04-16 19:06:46 +02:00
1 parent 4587f6391a
commit 0ef5a80d84
2 files changed
+8 -11

No files matched your search

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