Clean up A_MoveSprite(), no functional changes.

git-svn-id: https://svn.eduke32.com/eduke32@3075 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-10-14 20:41:25 +00:00
parent 8adb9d27af
commit abd8753e66

View file

@ -309,90 +309,86 @@ BOLT:
int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
{ {
spritetype *spr = &sprite[spritenum]; spritetype *const spr = &sprite[spritenum];
int32_t retval, daz; int32_t retval, daz;
int16_t dasectnum, cd; int16_t dasectnum;
int32_t bg = A_CheckEnemySprite(spr); const int32_t bg = A_CheckEnemySprite(spr);
int32_t oldx = spr->x, oldy = spr->y; const int32_t oldx = spr->x, oldy = spr->y;
/*int32_t osectnum = spr->sectnum;*/ // const int32_t osectnum = spr->sectnum;
if (spr->statnum == STAT_MISC || (bg && spr->xrepeat < 4)) if (spr->statnum == STAT_MISC || (bg && spr->xrepeat < 4))
{ {
spr->x += (change->x*TICSPERFRAME)>>2; spr->x += (change->x*TICSPERFRAME)>>2;
spr->y += (change->y*TICSPERFRAME)>>2; spr->y += (change->y*TICSPERFRAME)>>2;
spr->z += (change->z*TICSPERFRAME)>>2; spr->z += (change->z*TICSPERFRAME)>>2;
if (bg) if (bg)
setsprite(spritenum,(vec3_t *)spr); setsprite(spritenum, (vec3_t *)spr);
return 0; return 0;
} }
dasectnum = spr->sectnum; dasectnum = spr->sectnum;
daz = spr->z - ((tilesizy[spr->picnum]*spr->yrepeat)<<1); daz = spr->z - ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
{
const int32_t oldz=spr->z;
int32_t clipdist;
if (bg)
{
if (spr->xrepeat > 60)
clipdist = 1024;
else if (spr->picnum == LIZMAN)
clipdist = 292;
else if (ActorType[spr->picnum]&3)
clipdist = spr->clipdist<<2;
else
clipdist = 192;
}
else
{
if (spr->statnum == STAT_PROJECTILE && (SpriteProjectile[spritenum].workslike & PROJECTILE_REALCLIPDIST) == 0)
clipdist = 8;
else
clipdist = spr->clipdist<<2;
}
spr->z = daz;
retval = clipmove((vec3_t *)spr, &dasectnum,
(change->x*TICSPERFRAME)<<11, (change->y*TICSPERFRAME)<<11,
clipdist, 4<<8, 4<<8, cliptype);
spr->z = oldz;
}
if (bg) if (bg)
{ {
if (spr->xrepeat > 60) if (dasectnum < 0 ||
{ ((actor[spritenum].actorstayput >= 0 && actor[spritenum].actorstayput != dasectnum) ||
int32_t oz = spr->z; (spr->picnum == BOSS2 && spr->pal == 0 && sector[dasectnum].lotag != ST_3) ||
spr->z = daz; ((spr->picnum == BOSS1 || spr->picnum == BOSS2) && sector[dasectnum].lotag == ST_1_ABOVE_WATER)
retval = clipmove((vec3_t *)spr,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype); // || (sector[dasectnum].lotag == ST_1_ABOVE_WATER && (spr->picnum == LIZMAN || (spr->picnum == LIZTROOP && spr->zvel == 0)))
daz = spr->z; )
spr->z = oz; )
}
else
{
int32_t oz = spr->z;
if (spr->picnum == LIZMAN)
cd = 292L;
else if ((ActorType[spr->picnum]&3))
cd = spr->clipdist<<2;
else
cd = 192L;
spr->z = daz;
retval = clipmove((vec3_t *)spr,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype);
daz = spr->z;
spr->z = oz;
}
if (dasectnum < 0 || (dasectnum >= 0 &&
((actor[spritenum].actorstayput >= 0 && actor[spritenum].actorstayput != dasectnum) ||
((spr->picnum == BOSS2) && spr->pal == 0 && sector[dasectnum].lotag != ST_3) ||
((spr->picnum == BOSS1 || spr->picnum == BOSS2) && sector[dasectnum].lotag == ST_1_ABOVE_WATER) /*||
(sector[dasectnum].lotag == ST_1_ABOVE_WATER && (spr->picnum == LIZMAN || (spr->picnum == LIZTROOP && spr->zvel == 0)))*/
))
)
{ {
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) if (dasectnum >= 0 && sector[dasectnum].lotag == ST_1_ABOVE_WATER && spr->picnum == LIZMAN)
spr->ang = (krand()&2047); spr->ang = (krand()&2047);
else if ((Actor[spritenum].t_data[0]&3) == 1 && spr->picnum != COMMANDER) else if ((Actor[spritenum].t_data[0]&3) == 1 && spr->picnum != COMMANDER)
spr->ang = (krand()&2047); spr->ang = (krand()&2047);
*/ */
setsprite(spritenum,(vec3_t *)spr); setsprite(spritenum, (vec3_t *)spr);
if (dasectnum < 0) dasectnum = 0;
if (dasectnum < 0)
dasectnum = 0;
return (16384+dasectnum); return (16384+dasectnum);
} }
if ((retval&49152) >= 32768 && (actor[spritenum].cgg==0)) spr->ang += 768;
}
else
{
int32_t oz = spr->z;
spr->z = daz;
if (spr->statnum == STAT_PROJECTILE && (SpriteProjectile[spritenum].workslike & PROJECTILE_REALCLIPDIST) == 0) if ((retval&49152) >= 32768 && actor[spritenum].cgg==0)
retval = spr->ang += 768;
clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype);
else
retval =
clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),(int32_t)(spr->clipdist<<2),(4<<8),(4<<8),cliptype);
daz = spr->z;
spr->z = oz;
} }
if (dasectnum == -1) if (dasectnum == -1)
@ -400,33 +396,34 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
dasectnum = spr->sectnum; dasectnum = spr->sectnum;
// OSD_Printf("%s:%d wtf\n",__FILE__,__LINE__); // OSD_Printf("%s:%d wtf\n",__FILE__,__LINE__);
} }
else if (dasectnum != spr->sectnum)
if ((dasectnum != spr->sectnum))
{ {
changespritesect(spritenum,dasectnum); changespritesect(spritenum, dasectnum);
A_GetZLimits(spritenum); A_GetZLimits(spritenum);
} }
Bassert(dasectnum == spr->sectnum);
daz = spr->z + ((change->z*TICSPERFRAME)>>3); daz = spr->z + ((change->z*TICSPERFRAME)>>3);
bg = (tilesizy[spr->picnum]*spr->yrepeat)>>1; // bg = (tilesizy[spr->picnum]*spr->yrepeat)>>1;
if ((daz > actor[spritenum].ceilingz) && (daz <= actor[spritenum].floorz)/* if (daz > actor[spritenum].ceilingz && daz <= actor[spritenum].floorz
&& // && (osectnum == dasectnum || cansee(oldx, oldy, spr->z - bg, osectnum, spr->x, spr->y, daz - bg, dasectnum))
(osectnum == dasectnum || cansee(oldx, oldy, spr->z - bg, osectnum, spr->x, spr->y, daz - bg, dasectnum))*/
) )
{ {
spr->z = daz; spr->z = daz;
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
if (change->z && yax_getbunch(spr->sectnum, (change->z>0))>=0) if (change->z && yax_getbunch(dasectnum, (change->z>0))>=0)
if ((SECTORFLD(spr->sectnum,stat, (change->z>0))&yax_waltosecmask(cliptype))==0) if ((SECTORFLD(dasectnum,stat, (change->z>0))&yax_waltosecmask(cliptype))==0)
{ {
// initprintf("spr %d, sect %d: chz=%d, cfz=[%d,%d]\n", spritenum, spr->sectnum, change->z, // initprintf("spr %d, sect %d: chz=%d, cfz=[%d,%d]\n", spritenum, dasectnum, change->z,
// actor[spritenum].ceilingz, actor[spritenum].floorz); // actor[spritenum].ceilingz, actor[spritenum].floorz);
setspritez(spritenum, (vec3_t *)spr); setspritez(spritenum, (vec3_t *)spr);
} }
#endif #endif
} }
else if (retval == 0) retval = 16384+dasectnum; else if (retval == 0)
retval = 16384+dasectnum;
if (retval == (16384+dasectnum)) if (retval == (16384+dasectnum))
if (spr->statnum == STAT_PROJECTILE) if (spr->statnum == STAT_PROJECTILE)
@ -461,6 +458,7 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
if (totalclock > actor[spritenum].lasttransport) if (totalclock > actor[spritenum].lasttransport)
{ {
actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2); actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2);
spr->x += (sprite[OW].x-SX); spr->x += (sprite[OW].x-SX);
spr->y += (sprite[OW].y-SY); spr->y += (sprite[OW].y-SY);
spr->z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz; spr->z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz;
@ -1049,10 +1047,9 @@ void A_MoveDummyPlayers(void)
SX += (ps->pos.x-ps->opos.x); SX += (ps->pos.x-ps->opos.x);
SY += (ps->pos.y-ps->opos.y); SY += (ps->pos.y-ps->opos.y);
setsprite(i,(vec3_t *)&sprite[i]); setsprite(i, (vec3_t *)&sprite[i]);
BOLT: BOLT:
i = nexti; i = nexti;
} }
} }
@ -6890,6 +6887,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
actor[k].ceilingz = sector[sprite[j].sectnum].ceilingz; actor[k].ceilingz = sector[sprite[j].sectnum].ceilingz;
} }
k = nextk; k = nextk;
} }
} }