From c122aa217818aa710076724850a39831eb0938a1 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 25 Jun 2019 11:30:22 +0000 Subject: [PATCH] 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 --- source/build/src/clip.cpp | 2 +- source/build/src/engine.cpp | 16 ++++++------ source/build/src/engine_priv.h | 46 +++++++++++++++++----------------- source/build/src/polymost.cpp | 14 +++++------ 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 79dce02a8..36b5cd975 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -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); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 31d7f0870..c680fc310 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -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! diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index f427bba41..0e537f285 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -272,26 +272,6 @@ void set_globalang(fix16_t const ang); int32_t animateoffs(int tilenum, int fakevar); -extern bool playing_blood; - -} - -template -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 @@ -415,13 +395,33 @@ static FORCE_INLINE const int8_t *getpsky(int32_t picnum, int32_t *dapyscale, in static FORCE_INLINE void set_globalpos(int32_t const x, int32_t const y, int32_t const z) { - globalposx = x, fglobalposx = (float)x; - globalposy = y, fglobalposy = (float)y; - globalposz = z, fglobalposz = (float)z; + globalposx = x, fglobalposx = (float)x; + globalposy = y, fglobalposy = (float)y; + globalposz = z, fglobalposz = (float)z; } +extern bool playing_blood; + #ifdef __cplusplus } #endif + +template 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 */ diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 28176afd5..72a9bdec9 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -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;