A couple of meaning-preserving rewrites of picanm[]-touching code.

git-svn-id: https://svn.eduke32.com/eduke32@3204 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-11-17 19:46:37 +00:00
parent dd424fac70
commit 6abb63670c
2 changed files with 56 additions and 58 deletions

View file

@ -10893,6 +10893,7 @@ int32_t krecip(int32_t num)
void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs, int32_t alsotileyofs) void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs, int32_t alsotileyofs)
{ {
int32_t hei, flooraligned=((sprite[i].cstat&48)==32); int32_t hei, flooraligned=((sprite[i].cstat&48)==32);
int32_t picnum = sprite[i].picnum;
if (zofs) if (zofs)
*zofs = 0; *zofs = 0;
@ -10904,16 +10905,17 @@ void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs, int32_t alsotile
return; return;
} }
hei = (tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2; hei = (tilesizy[picnum]*sprite[i].yrepeat)<<2;
if (zofs) if (zofs)
{ {
if (sprite[i].cstat&128) if (sprite[i].cstat&128)
*zofs = hei>>1; *zofs = hei>>1;
if (alsotileyofs && (unsigned)sprite[i].picnum < MAXTILES) if (alsotileyofs)
if (picanm[sprite[i].picnum].yofs) if (picanm[picnum].yofs)
*zofs -= picanm[sprite[i].picnum].yofs*sprite[i].yrepeat<<2; *zofs -= picanm[picnum].yofs*sprite[i].yrepeat<<2;
} }
*height = hei; *height = hei;
} }
@ -12558,40 +12560,41 @@ int32_t pushmove(vec3_t *vect, int16_t *sectnum,
clipsectcnt = 0; clipsectnum = 1; clipsectcnt = 0; clipsectnum = 1;
do do
{ {
/*Push FACE sprites #if 0
// Push FACE sprites
for(i=headspritesect[clipsectorlist[clipsectcnt]];i>=0;i=nextspritesect[i]) for(i=headspritesect[clipsectorlist[clipsectcnt]];i>=0;i=nextspritesect[i])
{ {
spr = &sprite[i]; spr = &sprite[i];
if (((spr->cstat&48) != 0) && ((spr->cstat&48) != 48)) continue; if (((spr->cstat&48) != 0) && ((spr->cstat&48) != 48)) continue;
if ((spr->cstat&dasprclipmask) == 0) continue; if ((spr->cstat&dasprclipmask) == 0) continue;
dax = (vect->x)-spr->x; day = (vect->y)-spr->y; dax = (vect->x)-spr->x; day = (vect->y)-spr->y;
t = (spr->clipdist<<2)+walldist; t = (spr->clipdist<<2)+walldist;
if ((klabs(dax) < t) && (klabs(day) < t)) if ((klabs(dax) < t) && (klabs(day) < t))
{ {
t = ((tilesizy[spr->picnum]*spr->yrepeat)<<2); t = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
if (spr->cstat&128) daz = spr->z+(t>>1); else daz = spr->z; if (spr->cstat&128) daz = spr->z+(t>>1); else daz = spr->z;
if (picanm[spr->picnum].yofs) daz -= ((int32_t)picanm[spr->picnum].yofs*spr->yrepeat<<2); if (picanm[spr->picnum].yofs) daz -= ((int32_t)picanm[spr->picnum].yofs*spr->yrepeat<<2);
if (((vect->z) < daz+ceildist) && ((vect->z) > daz-t-flordist)) if (((vect->z) < daz+ceildist) && ((vect->z) > daz-t-flordist))
{ {
t = (spr->clipdist<<2)+walldist; t = (spr->clipdist<<2)+walldist;
j = getangle(dax,day); j = getangle(dax,day);
dx = (sintable[(j+512)&2047]>>11); dx = (sintable[(j+512)&2047]>>11);
dy = (sintable[(j)&2047]>>11); dy = (sintable[(j)&2047]>>11);
bad2 = 16; bad2 = 16;
do do
{ {
vect->x = (vect->x) + dx; vect->y = (vect->y) + dy; vect->x = (vect->x) + dx; vect->y = (vect->y) + dy;
bad2--; if (bad2 == 0) break; bad2--; if (bad2 == 0) break;
} while ((klabs((vect->x)-spr->x) < t) && (klabs((vect->y)-spr->y) < t)); } while ((klabs((vect->x)-spr->x) < t) && (klabs((vect->y)-spr->y) < t));
bad = -1; bad = -1;
k--; if (k <= 0) return(bad); k--; if (k <= 0) return(bad);
updatesector(vect->x,vect->y,sectnum); updatesector(vect->x,vect->y,sectnum);
}
}
} }
} #endif
}*/
sec = &sector[clipsectorlist[clipsectcnt]]; sec = &sector[clipsectorlist[clipsectcnt]];
if (dir > 0) if (dir > 0)
startwall = sec->wallptr, endwall = startwall + sec->wallnum; startwall = sec->wallptr, endwall = startwall + sec->wallnum;

View file

@ -47,36 +47,31 @@ static int32_t g_precacheCount;
extern int32_t g_levelTextTime; extern int32_t g_levelTextTime;
static void flag_precache(int32_t tile, int32_t type)
{
if (!(gotpic[tile>>3] & pow2char[tile&7]))
g_precacheCount++;
gotpic[tile>>3] |= pow2char[tile&7];
precachehightile[type][tile>>3] |= pow2char[tile&7];
}
static void tloadtile(int32_t tilenume, int32_t type) static void tloadtile(int32_t tilenume, int32_t type)
{ {
if (picanm[tilenume].num < 1) int32_t i,j;
if ((picanm[tilenume].sf&PICANM_ANIMTYPE_MASK)==PICANM_ANIMTYPE_BACK)
{ {
if (!(gotpic[tilenume>>3] & pow2char[tilenume&7])) g_precacheCount++; i = tilenume - picanm[tilenume].num;
gotpic[tilenume>>3] |= pow2char[tilenume&7]; j = tilenume;
precachehightile[(uint8_t)type][tilenume>>3] |= pow2char[tilenume&7]; }
return; else
{
i = tilenume;
j = tilenume + picanm[tilenume].num;
} }
{ for (; i<=j; i++)
int32_t i,j; flag_precache(i, type);
if ((picanm[tilenume].sf&PICANM_ANIMTYPE_MASK)==PICANM_ANIMTYPE_BACK)
{
i = tilenume - picanm[tilenume].num;
j = tilenume;
}
else
{
i = tilenume;
j = tilenume + picanm[tilenume].num;
}
for (; i<=j; i++)
{
if (!(gotpic[i>>3] & pow2char[i&7])) g_precacheCount++;
gotpic[i>>3] |= pow2char[i&7];
precachehightile[(uint8_t)type][i>>3] |= pow2char[i&7];
}
}
} }
static void G_CacheSpriteNum(int32_t i) static void G_CacheSpriteNum(int32_t i)