actors.c: style-cleanup A_MoveSpriteClipdist(). DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4974 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-02-08 18:48:31 +00:00
parent d915c49935
commit 7cc1067a3d

View file

@ -411,35 +411,30 @@ static int32_t A_CheckNeedZUpdate(int32_t spritenum, int32_t changez, int32_t *d
int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist) int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist)
{ {
spritetype *const spr = &sprite[spritenum]; spritetype *const spr = &sprite[spritenum];
int32_t retval, daz, dozupdate; const int32_t badguy = A_CheckEnemySprite(spr);
int16_t dasectnum;
const int32_t bg = A_CheckEnemySprite(spr);
const int32_t oldx = spr->x, oldy = spr->y; const int32_t oldx = spr->x, oldy = spr->y;
// const int32_t osectnum = spr->sectnum;
if (spr->statnum == STAT_MISC || (bg && spr->xrepeat < 4)) if (spr->statnum == STAT_MISC || (badguy && spr->xrepeat < 4))
{ {
spr->x += change->x; spr->x += change->x;
spr->y += change->y; spr->y += change->y;
spr->z += change->z; spr->z += change->z;
if (bg) if (badguy)
setsprite(spritenum, (vec3_t *)spr); setsprite(spritenum, (vec3_t *)spr);
return 0; return 0;
} }
dasectnum = spr->sectnum; int16_t dasectnum = spr->sectnum;
daz = spr->z - 2*tilesiz[spr->picnum].y*spr->yrepeat; int32_t daz = spr->z - 2*tilesiz[spr->picnum].y*spr->yrepeat;
{
const int32_t oldz = spr->z; const int32_t oldz = spr->z;
if (clipdist >= 0) if (clipdist >= 0)
{ {
// use that value // use that value
} }
else if (bg) else if (badguy)
{ {
if (spr->xrepeat > 60) if (spr->xrepeat > 60)
clipdist = 1024; clipdist = 1024;
@ -458,15 +453,16 @@ int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t c
clipdist = spr->clipdist<<2; clipdist = spr->clipdist<<2;
} }
// Handle horizontal movement first.
spr->z = daz; spr->z = daz;
retval = clipmove((vec3_t *)spr, &dasectnum, int32_t retval = clipmove((vec3_t *)spr, &dasectnum,
change->x<<13, change->y<<13, change->x<<13, change->y<<13,
clipdist, 4<<8, 4<<8, cliptype); clipdist, 4<<8, 4<<8, cliptype);
spr->z = oldz; spr->z = oldz;
}
if (bg) if (badguy)
{ {
// Handle potential stayput condition (map-provided or hard-coded).
if (dasectnum < 0 || if (dasectnum < 0 ||
((actor[spritenum].actorstayput >= 0 && actor[spritenum].actorstayput != dasectnum) || ((actor[spritenum].actorstayput >= 0 && actor[spritenum].actorstayput != dasectnum) ||
(spr->picnum == BOSS2 && spr->pal == 0 && sector[dasectnum].lotag != ST_3) || (spr->picnum == BOSS2 && spr->pal == 0 && sector[dasectnum].lotag != ST_3) ||
@ -477,12 +473,9 @@ int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t c
{ {
spr->x = oldx; spr->x = oldx;
spr->y = oldy; spr->y = oldy;
/*
if (dasectnum >= 0 && sector[dasectnum].lotag == ST_1_ABOVE_WATER && spr->picnum == LIZMAN) // NOTE: in Duke3D, LIZMAN on water takes on random angle here.
spr->ang = (krand()&2047);
else if ((Actor[spritenum].t_data[0]&3) == 1 && spr->picnum != COMMANDER)
spr->ang = (krand()&2047);
*/
setsprite(spritenum, (vec3_t *)spr); setsprite(spritenum, (vec3_t *)spr);
if (dasectnum < 0) if (dasectnum < 0)
@ -508,7 +501,7 @@ int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t c
Bassert(dasectnum == spr->sectnum); Bassert(dasectnum == spr->sectnum);
dozupdate = A_CheckNeedZUpdate(spritenum, change->z, &daz); int dozupdate = A_CheckNeedZUpdate(spritenum, change->z, &daz);
// Update sprite's z positions and (for TROR) maybe the sector number. // Update sprite's z positions and (for TROR) maybe the sector number.
if (dozupdate) if (dozupdate)