picanm[]-cleanup pt1: hide code using animateoffs() behind macro DO_TILE_ANIM.

git-svn-id: https://svn.eduke32.com/eduke32@3186 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-11-15 21:09:53 +00:00
parent b5cead500a
commit 826be655db
4 changed files with 34 additions and 29 deletions

View file

@ -3406,7 +3406,7 @@ static int32_t setup_globals_cf1(const sectortype *sec, int32_t pal, int32_t zd,
if ((unsigned)globalpicnum >= MAXTILES) globalpicnum = 0; if ((unsigned)globalpicnum >= MAXTILES) globalpicnum = 0;
setgotpic(globalpicnum); setgotpic(globalpicnum);
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return 1; if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return 1;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum, 0); DO_TILE_ANIM(globalpicnum, 0);
if (waloff[globalpicnum] == 0) loadtile(globalpicnum); if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
globalbufplc = waloff[globalpicnum]; globalbufplc = waloff[globalpicnum];
@ -4220,7 +4220,7 @@ static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
daz = sec->floorz; daz = sec->floorz;
} }
if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs(globalpicnum,sectnum); DO_TILE_ANIM(globalpicnum, sectnum);
setgotpic(globalpicnum); setgotpic(globalpicnum);
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return; if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return;
if (waloff[globalpicnum] == 0) loadtile(globalpicnum); if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
@ -4397,7 +4397,7 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i
} }
if ((unsigned)globalpicnum >= MAXTILES) globalpicnum = 0; if ((unsigned)globalpicnum >= MAXTILES) globalpicnum = 0;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)sectnum); DO_TILE_ANIM(globalpicnum, sectnum);
globalshiftval = (picsiz[globalpicnum]>>4); globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++; if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval; globalshiftval = 32-globalshiftval;
@ -4537,7 +4537,7 @@ static void setup_globals_wall1(const walltype *wal, int32_t dapicnum)
globalpicnum = dapicnum; globalpicnum = dapicnum;
if ((unsigned)globalpicnum >= MAXTILES) globalpicnum = 0; if ((unsigned)globalpicnum >= MAXTILES) globalpicnum = 0;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum, 0); DO_TILE_ANIM(globalpicnum, 0);
globalxpanning = wal->xpanning; globalxpanning = wal->xpanning;
globalypanning = wal->ypanning; globalypanning = wal->ypanning;
@ -5514,9 +5514,9 @@ static void drawsprite(int32_t snum)
if ((cstat&48) != 48) if ((cstat&48) != 48)
{ {
if (picanm[tilenum]&192) tilenum += animateoffs(tilenum,spritenum+32768);
if ((tilesizx[tilenum] <= 0) || (tilesizy[tilenum] <= 0) || (spritenum < 0)) if ((tilesizx[tilenum] <= 0) || (tilesizy[tilenum] <= 0) || (spritenum < 0))
return; return;
DO_TILE_ANIM(tilenum, spritenum+32768);
} }
if ((tspr->xrepeat <= 0) || (tspr->yrepeat <= 0)) return; if ((tspr->xrepeat <= 0) || (tspr->yrepeat <= 0)) return;
@ -6190,7 +6190,7 @@ draw_as_face_sprite:
globalorientation = cstat; globalorientation = cstat;
globalpicnum = tilenum; globalpicnum = tilenum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
//if (picanm[globalpicnum]&192) globalpicnum += animateoffs((short)globalpicnum,spritenum+32768); //DO_TILE_ANIM(globalpicnum, spritenum+32768);
if (waloff[globalpicnum] == 0) loadtile(globalpicnum); if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
setgotpic(globalpicnum); setgotpic(globalpicnum);
@ -9136,7 +9136,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
setgotpic(globalpicnum); setgotpic(globalpicnum);
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue; if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue;
if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((int16_t)globalpicnum,s); DO_TILE_ANIM(globalpicnum, s);
if (waloff[globalpicnum] == 0) loadtile(globalpicnum); if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
globalbufplc = waloff[globalpicnum]; globalbufplc = waloff[globalpicnum];
globalshade = max(min(sec->floorshade,numshades-1),0); globalshade = max(min(sec->floorshade,numshades-1),0);
@ -9271,7 +9271,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
setgotpic(globalpicnum); setgotpic(globalpicnum);
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue; if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue;
if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((int16_t)globalpicnum,s); DO_TILE_ANIM(globalpicnum, s);
if (waloff[globalpicnum] == 0) loadtile(globalpicnum); if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
globalbufplc = waloff[globalpicnum]; globalbufplc = waloff[globalpicnum];
@ -13505,7 +13505,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 ((cx1 > cx2) || (cy1 > cy2)) return;
if (z <= 16) return; if (z <= 16) return;
if (picanm[picnum]&192) picnum += animateoffs(picnum,(int16_t)0xc000); DO_TILE_ANIM(picnum, 0xc000);
if ((tilesizx[picnum] <= 0) || (tilesizy[picnum] <= 0)) return; if ((tilesizx[picnum] <= 0) || (tilesizy[picnum] <= 0)) return;
// Experimental / development bits. ONLY FOR INTERNAL USE! // Experimental / development bits. ONLY FOR INTERNAL USE!

View file

@ -81,6 +81,10 @@ extern palette_t palookupfog[MAXPALOOKUPS];
int32_t wallfront(int32_t l1, int32_t l2); int32_t wallfront(int32_t l1, int32_t l2);
int32_t animateoffs(int16_t tilenum, int16_t fakevar); int32_t animateoffs(int16_t tilenum, int16_t fakevar);
#define DO_TILE_ANIM(Picnum, Fakevar) do { \
if (picanm[Picnum]&192) Picnum += animateoffs(Picnum, Fakevar); \
} while (0)
void dorotspr_handle_bit2(int32_t *sx, int32_t *sy, int32_t *z, int32_t dastat, void dorotspr_handle_bit2(int32_t *sx, int32_t *sy, int32_t *z, int32_t dastat,
int32_t cx1_plus_cx2, int32_t cy1_plus_cy2, int32_t cx1_plus_cx2, int32_t cy1_plus_cy2,
int32_t *ret_ouryxaspect, int32_t *ret_ourxyaspect); int32_t *ret_ouryxaspect, int32_t *ret_ourxyaspect);

View file

@ -1485,8 +1485,7 @@ int16_t polymer_addlight(_prlight* light)
int16_t picnum = light->tilenum; int16_t picnum = light->tilenum;
pthtyp* pth; pthtyp* pth;
if (picanm[picnum] & 192) DO_TILE_ANIM(picnum, 0);
picnum += animateoffs(picnum, 0);
if (!waloff[picnum]) if (!waloff[picnum])
loadtile(picnum); loadtile(picnum);
@ -2288,9 +2287,9 @@ static int32_t polymer_updatesector(int16_t sectnum)
} }
floorpicnum = sec->floorpicnum; floorpicnum = sec->floorpicnum;
if (picanm[floorpicnum]&192) floorpicnum += animateoffs(floorpicnum,sectnum); DO_TILE_ANIM(floorpicnum, sectnum);
ceilingpicnum = sec->ceilingpicnum; ceilingpicnum = sec->ceilingpicnum;
if (picanm[ceilingpicnum]&192) ceilingpicnum += animateoffs(ceilingpicnum,sectnum); DO_TILE_ANIM(ceilingpicnum, sectnum);
if ((!s->flags.empty) && (!needfloor) && if ((!s->flags.empty) && (!needfloor) &&
(sec->floorstat == s->floorstat) && (sec->floorstat == s->floorstat) &&
@ -2797,13 +2796,16 @@ static void polymer_updatewall(int16_t wallnum)
} }
wallpicnum = wal->picnum; wallpicnum = wal->picnum;
if (picanm[wallpicnum]&192) wallpicnum += animateoffs(wallpicnum,wallnum+16384); DO_TILE_ANIM(wallpicnum, wallnum+16384);
walloverpicnum = wal->overpicnum; walloverpicnum = wal->overpicnum;
if (walloverpicnum>=0 && picanm[walloverpicnum]&192) walloverpicnum += animateoffs(walloverpicnum,wallnum+16384); if (walloverpicnum>=0)
DO_TILE_ANIM(walloverpicnum, wallnum+16384);
if (nwallnum >= 0 && nwallnum < numwalls) if (nwallnum >= 0 && nwallnum < numwalls)
{ {
nwallpicnum = wall[nwallnum].picnum; nwallpicnum = wall[nwallnum].picnum;
if (picanm[nwallpicnum]&192) nwallpicnum += animateoffs(nwallpicnum,wallnum+16384); DO_TILE_ANIM(nwallpicnum, wallnum+16384);
} }
else else
nwallpicnum = 0; nwallpicnum = 0;
@ -3501,7 +3503,7 @@ void polymer_updatesprite(int32_t snum)
s = prsprites[tspr->owner]; s = prsprites[tspr->owner];
curpicnum = tspr->picnum; curpicnum = tspr->picnum;
if (picanm[curpicnum]&192) curpicnum += animateoffs(curpicnum,tspr->owner+32768); DO_TILE_ANIM(curpicnum, tspr->owner+32768);
if (tspr->cstat & 48 && searchit != 2) if (tspr->cstat & 48 && searchit != 2)
{ {
@ -3534,7 +3536,7 @@ void polymer_updatesprite(int32_t snum)
} }
curpicnum = tspr->picnum; curpicnum = tspr->picnum;
if (picanm[curpicnum]&192) curpicnum += animateoffs(curpicnum,tspr->owner+32768); DO_TILE_ANIM(curpicnum, tspr->owner+32768);
if (((tspr->cstat>>4) & 3) == 0) if (((tspr->cstat>>4) & 3) == 0)
xratio = (float)(tspr->xrepeat) * 0.20f; // 32 / 160 xratio = (float)(tspr->xrepeat) * 0.20f; // 32 / 160
@ -3773,7 +3775,7 @@ static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shad
while (i < 5) while (i < 5)
{ {
picnum = tilenum + i; picnum = tilenum + i;
if (picanm[picnum]&192) picnum += animateoffs(picnum,0); DO_TILE_ANIM(picnum, 0);
if (!waloff[picnum]) if (!waloff[picnum])
loadtile(picnum); loadtile(picnum);
pth = gltexcache(picnum, palnum, 0); pth = gltexcache(picnum, palnum, 0);
@ -3861,7 +3863,7 @@ static void polymer_drawskybox(int16_t tilenum, char palnum, int8_t shad
if (pr_vbos > 0) if (pr_vbos > 0)
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, skyboxdatavbo); bglBindBufferARB(GL_ARRAY_BUFFER_ARB, skyboxdatavbo);
if (picanm[tilenum]&192) tilenum += animateoffs(tilenum,0); DO_TILE_ANIM(tilenum, 0);
i = 0; i = 0;
while (i < 6) while (i < 6)
@ -5189,8 +5191,7 @@ static void polymer_updatelights(void)
int16_t picnum = light->tilenum; int16_t picnum = light->tilenum;
pthtyp* pth; pthtyp* pth;
if (picanm[picnum] & 192) DO_TILE_ANIM(picnum, 0);
picnum += animateoffs(picnum, 0);
if (!waloff[picnum]) if (!waloff[picnum])
loadtile(picnum); loadtile(picnum);

View file

@ -3452,7 +3452,7 @@ static void polymost_drawalls(int32_t bunch)
globalpicnum = sec->floorpicnum; globalshade = sec->floorshade; globalpal = (int32_t)((uint8_t)sec->floorpal); globalpicnum = sec->floorpicnum; globalshade = sec->floorshade; globalpal = (int32_t)((uint8_t)sec->floorpal);
globalorientation = sec->floorstat; globalorientation = sec->floorstat;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,sectnum); DO_TILE_ANIM(globalpicnum, sectnum);
// multi-psky stuff // multi-psky stuff
dapskyoff = zeropskyoff; dapskyoff = zeropskyoff;
@ -3744,7 +3744,7 @@ static void polymost_drawalls(int32_t bunch)
globalpicnum = sec->ceilingpicnum; globalshade = sec->ceilingshade; globalpal = (int32_t)((uint8_t)sec->ceilingpal); globalpicnum = sec->ceilingpicnum; globalshade = sec->ceilingshade; globalpal = (int32_t)((uint8_t)sec->ceilingpal);
globalorientation = sec->ceilingstat; globalorientation = sec->ceilingstat;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,sectnum); DO_TILE_ANIM(globalpicnum, sectnum);
// multi-psky stuff // multi-psky stuff
dapskyoff = zeropskyoff; dapskyoff = zeropskyoff;
@ -4089,7 +4089,7 @@ static void polymost_drawalls(int32_t bunch)
if (((cy0 < ocy0) || (cy1 < ocy1)) && (!((sec->ceilingstat&sector[nextsectnum].ceilingstat)&1))) if (((cy0 < ocy0) || (cy1 < ocy1)) && (!((sec->ceilingstat&sector[nextsectnum].ceilingstat)&1)))
{ {
globalpicnum = wal->picnum; globalshade = wal->shade; globalpal = (int32_t)((uint8_t)wal->pal); globalpicnum = wal->picnum; globalshade = wal->shade; globalpal = (int32_t)((uint8_t)wal->pal);
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,wallnum+16384); DO_TILE_ANIM(globalpicnum, wallnum+16384);
if (!(wal->cstat&4)) i = sector[nextsectnum].ceilingz; else i = sec->ceilingz; if (!(wal->cstat&4)) i = sector[nextsectnum].ceilingz; else i = sec->ceilingz;
@ -4126,7 +4126,7 @@ static void polymost_drawalls(int32_t bunch)
guy += (float)(nwal->xpanning-wal->xpanning)*gdy; guy += (float)(nwal->xpanning-wal->xpanning)*gdy;
} }
globalpicnum = nwal->picnum; globalshade = nwal->shade; globalpal = (int32_t)((uint8_t)nwal->pal); globalpicnum = nwal->picnum; globalshade = nwal->shade; globalpal = (int32_t)((uint8_t)nwal->pal);
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,wallnum+16384); DO_TILE_ANIM(globalpicnum, wallnum+16384);
if (!(nwal->cstat&4)) i = sector[nextsectnum].floorz; else i = sec->ceilingz; if (!(nwal->cstat&4)) i = sector[nextsectnum].floorz; else i = sec->ceilingz;
@ -4158,7 +4158,7 @@ static void polymost_drawalls(int32_t bunch)
{ {
if (nextsectnum < 0) globalpicnum = wal->picnum; else globalpicnum = wal->overpicnum; if (nextsectnum < 0) globalpicnum = wal->picnum; else globalpicnum = wal->overpicnum;
globalshade = wal->shade; globalpal = (int32_t)((uint8_t)wal->pal); globalshade = wal->shade; globalpal = (int32_t)((uint8_t)wal->pal);
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,wallnum+16384); DO_TILE_ANIM(globalpicnum, wallnum+16384);
if (nextsectnum >= 0) { if (!(wal->cstat&4)) i = nextsec->ceilingz; else i = sec->ceilingz; } if (nextsectnum >= 0) { if (!(wal->cstat&4)) i = nextsec->ceilingz; else i = sec->ceilingz; }
else { if (!(wal->cstat&4)) i = sec->ceilingz; else i = sec->floorz; } else { if (!(wal->cstat&4)) i = sec->ceilingz; else i = sec->floorz; }
@ -4679,7 +4679,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
z2 = min(nsec->floorz,sec->floorz); z2 = min(nsec->floorz,sec->floorz);
globalpicnum = wal->overpicnum; if ((uint32_t)globalpicnum >= MAXTILES) globalpicnum = 0; globalpicnum = wal->overpicnum; if ((uint32_t)globalpicnum >= MAXTILES) globalpicnum = 0;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)thewall[z]+16384); DO_TILE_ANIM(globalpicnum, (int16_t)thewall[z]+16384);
globalshade = (int32_t)wal->shade; globalshade = (int32_t)wal->shade;
globalpal = (int32_t)((uint8_t)wal->pal); globalpal = (int32_t)((uint8_t)wal->pal);
globalorientation = (int32_t)wal->cstat; globalorientation = (int32_t)wal->cstat;
@ -4898,7 +4898,7 @@ void polymost_drawsprite(int32_t snum)
if ((globalorientation&48) != 48) // only non-voxel sprites should do this if ((globalorientation&48) != 48) // only non-voxel sprites should do this
{ {
int32_t flag; int32_t flag;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,spritenum+32768); DO_TILE_ANIM(globalpicnum, spritenum+32768);
flag = usehightile && h_xsize[globalpicnum]; flag = usehightile && h_xsize[globalpicnum];
xoff = (int32_t)tspr->xoffset; xoff = (int32_t)tspr->xoffset;
yoff = (int32_t)tspr->yoffset; yoff = (int32_t)tspr->yoffset;