Polymer: factor out polymer_invalidatesprite(), use when viewscreen tex changed.

Also, rewrite invalidatetile() for clarity.

git-svn-id: https://svn.eduke32.com/eduke32@4303 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-02-08 14:37:52 +00:00
parent a37c31cab7
commit e379cd3655
4 changed files with 28 additions and 31 deletions

View File

@ -332,6 +332,14 @@ void polymer_texinvalidate(void);
void polymer_definehighpalookup(char basepalnum, char palnum, char *fn);
int32_t polymer_havehighpalookup(int32_t basepalnum, int32_t palnum);
static inline void polymer_invalidatesprite(int32_t i)
{
extern _prsprite *prsprites[MAXSPRITES];
if (prsprites[i])
prsprites[i]->crc = 0xDEADBEEF;
}
# ifdef POLYMER_C
// CORE

View File

@ -17363,36 +17363,26 @@ void setrollangle(int32_t rolla)
//
void invalidatetile(int16_t tilenume, int32_t pal, int32_t how)
{
#ifdef USE_OPENGL
int32_t numpal, firstpal, np;
int32_t hp;
if (getrendermode() < REND_POLYMOST) return;
if (pal < 0)
{
numpal = MAXPALOOKUPS;
firstpal = 0;
}
else
{
numpal = 1;
firstpal = pal % MAXPALOOKUPS;
}
for (hp = 0; hp < 8; hp+=4)
{
if (!(how & pow2long[hp])) continue;
for (np = firstpal; np < firstpal+numpal; np++)
{
gltexinvalidate(tilenume, np, hp);
}
}
#endif
#if !defined USE_OPENGL
UNREFERENCED_PARAMETER(tilenume);
UNREFERENCED_PARAMETER(pal);
UNREFERENCED_PARAMETER(how);
#else
if (getrendermode() >= REND_POLYMOST)
{
int32_t hp, np;
const int32_t firstpal = (pal < 0) ? 0 : pal;
const int32_t numpals = (pal < 0) ? MAXPALOOKUPS : 1;
for (hp = 0; hp <= 4; hp+=4)
{
if (how & pow2long[hp])
for (np = firstpal; np < firstpal+numpals; np++)
gltexinvalidate(tilenume, np, hp);
}
}
#endif
}

View File

@ -1622,8 +1622,7 @@ void polymer_texinvalidate(void)
i = 0;
while (i < MAXSPRITES) {
if (prsprites[i])
prsprites[i]->crc = 0xDEADBEEF;
polymer_invalidatesprite(i);
i++;
}

View File

@ -373,9 +373,9 @@ void G_AnimateCamSprite(void)
G_SetupCamTile(OW, TILE_VIEWSCR);
#ifdef POLYMER
// HACK: force texture update on viewscreen sprite in Polymer!
// Force texture update on viewscreen sprite in Polymer!
if (getrendermode() == REND_POLYMER)
sprite[i].filler ^= (1<<1);
polymer_invalidatesprite(i);
#endif
}
}