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

View file

@ -47,36 +47,31 @@ static int32_t g_precacheCount;
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)
{
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++;
gotpic[tilenume>>3] |= pow2char[tilenume&7];
precachehightile[(uint8_t)type][tilenume>>3] |= pow2char[tilenume&7];
return;
i = tilenume - picanm[tilenume].num;
j = tilenume;
}
else
{
i = tilenume;
j = tilenume + picanm[tilenume].num;
}
{
int32_t i,j;
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];
}
}
for (; i<=j; i++)
flag_precache(i, type);
}
static void G_CacheSpriteNum(int32_t i)