Replace DO_TILE_ANIM() macro with tileUpdatePicnum() function

git-svn-id: https://svn.eduke32.com/eduke32@7722 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/src/engine_priv.h
#	source/build/src/polymer.cpp
#	source/build/src/polymost.cpp
This commit is contained in:
terminx 2019-06-25 11:30:22 +00:00 committed by Christoph Oelckers
parent a7d4df8072
commit c122aa2178
4 changed files with 39 additions and 39 deletions

View file

@ -2297,7 +2297,7 @@ restart_grand:
{
if (picanm[tilenum].sf&PICANM_TEXHITSCAN_BIT)
{
DO_TILE_ANIM(tilenum, 0);
tileUpdatePicnum(&tilenum, 0);
if (!waloff[tilenum])
tileLoad(tilenum);

View file

@ -2653,7 +2653,7 @@ static int32_t setup_globals_cf1(usectorptr_t sec, int32_t pal, int32_t zd,
globalpicnum = picnum;
if ((unsigned)globalpicnum >= MAXTILES) globalpicnum = 0;
DO_TILE_ANIM(globalpicnum, 0);
tileUpdatePicnum(&globalpicnum, 0);
setgotpic(globalpicnum);
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return 1;
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
@ -3476,7 +3476,7 @@ static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
daz = sec->floorz;
}
DO_TILE_ANIM(globalpicnum, sectnum);
tileUpdatePicnum(&globalpicnum, sectnum);
setgotpic(globalpicnum);
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return;
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
@ -3665,7 +3665,7 @@ static void parascan(char dastat, int32_t bunch)
}
if ((unsigned)globalpicnum >= MAXTILES) globalpicnum = 0;
DO_TILE_ANIM(globalpicnum, sectnum);
tileUpdatePicnum(&globalpicnum, sectnum);
setgotpic(globalpicnum);
logtilesizy = (picsiz[globalpicnum]>>4);
@ -3820,7 +3820,7 @@ static void setup_globals_wall1(uwallptr_t wal, int32_t dapicnum)
globalpicnum = dapicnum;
if ((unsigned)globalpicnum >= MAXTILES) globalpicnum = 0;
DO_TILE_ANIM(globalpicnum, 16384);
tileUpdatePicnum(&globalpicnum, 16384);
globalxpanning = wal->xpanning;
globalypanning = wal->ypanning;
@ -4833,7 +4833,7 @@ static void classicDrawSprite(int32_t snum)
int32_t cstat=tspr->cstat, tilenum;
DO_TILE_ANIM(tspr->picnum, spritenum+32768);
tileUpdatePicnum(&tspr->picnum, spritenum+32768);
if (!(cstat&2) && alpha > 0.0f)
{
@ -8879,7 +8879,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
}
globalpicnum = sec->floorpicnum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
DO_TILE_ANIM(globalpicnum, s);
tileUpdatePicnum(&globalpicnum, s);
setgotpic(globalpicnum);
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) continue;
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
@ -9004,7 +9004,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
globalpicnum = spr->picnum;
globalpal = spr->pal; // GL needs this, software doesn't
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
DO_TILE_ANIM(globalpicnum, s);
tileUpdatePicnum(&globalpicnum, s);
setgotpic(globalpicnum);
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) continue;
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
@ -11388,7 +11388,7 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
if ((cx1 > cx2) || (cy1 > cy2)) return;
if (z <= 16) return;
DO_TILE_ANIM(picnum, (int16_t)0xc000);
tileUpdatePicnum(&picnum, (int16_t)0xc000);
if ((tilesiz[picnum].x <= 0) || (tilesiz[picnum].y <= 0)) return;
// Experimental / development bits. ONLY FOR INTERNAL USE!

View file

@ -272,26 +272,6 @@ void set_globalang(fix16_t const ang);
int32_t animateoffs(int tilenum, int fakevar);
extern bool playing_blood;
}
template <class inttype>
inline void DO_TILE_ANIM(inttype &Picnum, int Fakevar)
{
if (!playing_blood)
{
if (picanm[Picnum].sf & PICANM_ANIMTYPE_MASK) Picnum += animateoffs(Picnum, Fakevar);
}
else
{
Picnum += animateoffs(Picnum, Fakevar);
}
if (((Fakevar & 16384) == 16384) && (globalorientation & CSTAT_WALL_ROTATE_90) && rottile[Picnum].newtile != -1) Picnum = rottile[Picnum].newtile;
}
extern "C" {
static FORCE_INLINE int32_t bad_tspr(tspriteptr_t tspr)
{
// NOTE: tspr->owner >= MAXSPRITES (could be model) has to be handled by
@ -420,8 +400,28 @@ static FORCE_INLINE void set_globalpos(int32_t const x, int32_t const y, int32_t
globalposz = z, fglobalposz = (float)z;
}
extern bool playing_blood;
#ifdef __cplusplus
}
#endif
template <typename T> static FORCE_INLINE void tileUpdatePicnum(T * const tileptr, int const obj)
{
auto &tile = *tileptr;
if (!playing_blood)
{
if (picanm[tile].sf & PICANM_ANIMTYPE_MASK) tile += animateoffs(tile, Fakevar);
}
else
{
tile += animateoffs(tile, Fakevar);
}
if (((obj & 16384) == 16384) && (globalorientation & CSTAT_WALL_ROTATE_90) && rottile[tile].newtile != -1)
tile = rottile[tile].newtile;
}
#endif /* ENGINE_PRIV_H */

View file

@ -4272,7 +4272,7 @@ static void polymost_drawalls(int32_t const bunch)
globalcisibility2;
polymost_setVisibility(globvis2);
DO_TILE_ANIM(globalpicnum, sectnum);
tileUpdatePicnum(&globalpicnum, sectnum);
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
int8_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
@ -4616,7 +4616,7 @@ static void polymost_drawalls(int32_t const bunch)
globalcisibility2;
polymost_setVisibility(globvis2);
DO_TILE_ANIM(globalpicnum, sectnum);
tileUpdatePicnum(&globalpicnum, sectnum);
dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
@ -5034,7 +5034,7 @@ static void polymost_drawalls(int32_t const bunch)
if (sector[sectnum].visibility != 0) globvis2 = mulscale4(globvis2, (uint8_t)(sector[sectnum].visibility+16));
polymost_setVisibility(globvis2);
globalorientation = wal->cstat;
DO_TILE_ANIM(globalpicnum, wallnum+16384);
tileUpdatePicnum(&globalpicnum, wallnum+16384);
int i = (!(wal->cstat&4)) ? sector[nextsectnum].ceilingz : sec->ceilingz;
@ -5079,7 +5079,7 @@ static void polymost_drawalls(int32_t const bunch)
if (sector[sectnum].visibility != 0) globvis2 = mulscale4(globvis2, (uint8_t)(sector[sectnum].visibility+16));
polymost_setVisibility(globvis2);
globalorientation = nwal->cstat;
DO_TILE_ANIM(globalpicnum, wallnum+16384);
tileUpdatePicnum(&globalpicnum, wallnum+16384);
int i = (!(nwal->cstat&4)) ? sector[nextsectnum].floorz : sec->ceilingz;
@ -5132,7 +5132,7 @@ static void polymost_drawalls(int32_t const bunch)
globalvisibility2;
polymost_setVisibility(globvis2);
globalorientation = wal->cstat;
DO_TILE_ANIM(globalpicnum, wallnum+16384);
tileUpdatePicnum(&globalpicnum, wallnum+16384);
int i;
int const nwcs4 = !(wal->cstat & 4);
@ -5681,7 +5681,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
globalpicnum = 0;
globalorientation = (int32_t)wal->cstat;
DO_TILE_ANIM(globalpicnum, (int16_t)thewall[z]+16384);
tileUpdatePicnum(&globalpicnum, (int16_t)thewall[z]+16384);
globvis = globalvisibility;
globvis = (sector[sectnum].visibility != 0) ? mulscale4(globvis, (uint8_t)(sector[sectnum].visibility + 16)) : globalvisibility;
@ -5971,7 +5971,7 @@ void polymost_drawsprite(int32_t snum)
polymost_outputGLDebugMessage(3, "polymost_drawsprite(snum:%d)", snum);
DO_TILE_ANIM(tspr->picnum, spritenum + 32768);
tileUpdatePicnum(&tspr->picnum, spritenum + 32768);
globalpicnum = tspr->picnum;
globalshade = tspr->shade;