better handling of sprite angles in precache

only cache stuff that we need
This commit is contained in:
Alug committed 2025-02-16 16:38:56 +01:00
1 parent 5b0a662b40
commit fcd8cfc4d5
2 files changed
+50 -17

No files matched your search

+22 -9
View File
@@ -760,16 +760,29 @@ static void HWR_PrecacheLevelSprites(void)
{
sf = &sprites[i].spriteframes[j];
for (k = 0; k < 8; k++)
{
// see R_InitSprites for more about lumppat,lumpid
lump = sf->lumppat[k];
spritepatch = (GLPatch_t *)W_CachePatchNum(lump, PU_CACHE);
// yes this may be NULL
if (spritepatch != NULL)
HWR_GetPatch(spritepatch); // no colormapped sprites for us
#define cacheang(a) {\
lump = sf->lumppat[a];\
spritepatch = (GLPatch_t *)W_CachePatchNum(lump, PU_CACHE);\
if (spritepatch != NULL)\
HWR_GetPatch(spritepatch);\
}
// see R_InitSprites for more about lumppat,lumpid
switch (sf->rotate)
{
case SRF_SINGLE:
cacheang(0);
break;
case SRF_2D:
cacheang(2);
cacheang(6);
break;
default:
k = 8;
while (k--)
cacheang(k);
break;
}
#undef cacheang
}
}
free(spritepresent);
+28 -8
View File
@@ -1694,8 +1694,12 @@ void R_PrecacheLevel(void)
if (spritepresent == NULL) I_Error("%s: Out of memory looking up sprites", "R_PrecacheLevel");
for (th = thinkercap.next; th != &thinkercap; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
spritepresent[((mobj_t *)th)->sprite] = 1;
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
spritepresent[((mobj_t *)th)->sprite] = 1;
}
spritememory = 0;
for (i = 0; i < numsprites; i++)
@@ -1706,16 +1710,32 @@ void R_PrecacheLevel(void)
for (j = 0; j < sprites[i].numframes; j++)
{
sf = &sprites[i].spriteframes[j];
for (k = 0; k < 8; k++)
#define cacheang(a) {\
lump = sf->lumppat[a];\
if (devparm)\
spritememory += W_LumpLength(lump);\
W_CachePatchNum(lump, PU_CACHE);\
}
// see R_InitSprites for more about lumppat,lumpid
switch (sf->rotate)
{
// see R_InitSprites for more about lumppat,lumpid
lump = sf->lumppat[k];
if (devparm)
spritememory += W_LumpLength(lump);
W_CachePatchNum(lump, PU_CACHE);
case SRF_SINGLE:
cacheang(0);
break;
case SRF_2D:
cacheang(2);
cacheang(6);
break;
default:
k = 8;
while (k--)
cacheang(k);
break;
}
#undef cacheang
}
}
free(spritepresent);
// FIXME: this is no longer correct with OpenGL render mode