misc. beautifying some game code...

git-svn-id: https://svn.eduke32.com/eduke32@2192 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-12-21 18:42:49 +00:00
parent 6b913a39aa
commit f12bd9f13d
4 changed files with 62 additions and 69 deletions

View file

@ -8061,7 +8061,7 @@ int32_t A_CheckEnemyTile(int32_t pn)
return 0;
}
inline int32_t A_CheckEnemySprite(spritetype *s)
inline int32_t A_CheckEnemySprite(const spritetype *s)
{
return(A_CheckEnemyTile(s->picnum));
}

View file

@ -190,7 +190,7 @@ extern projectile_t ProjectileData[MAXTILES];
extern projectile_t SpriteProjectile[MAXSPRITES];
void A_AddToDeleteQueue(int32_t i);
int32_t A_CheckEnemySprite(spritetype *s);
int32_t A_CheckEnemySprite(const spritetype *s);
int32_t A_CheckEnemyTile(int32_t pn);
int32_t A_CheckSwitchTile(int32_t i);
void A_DeleteSprite(int32_t s);

View file

@ -6510,67 +6510,66 @@ skip:
}
if (s->statnum == STAT_DUMMYPLAYER || A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_SHADOW) || (s->picnum == APLAYER && s->owner >= 0))
if (t->statnum != TSPR_TEMP && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE)
if (s->picnum != HOTMEAT)
if (t->statnum != TSPR_TEMP && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE && s->picnum != HOTMEAT)
{
if (actor[i].dispicnum < 0)
{
if (actor[i].dispicnum < 0)
{
actor[i].dispicnum++;
continue;
}
else if (ud.shadows && spritesortcnt < (MAXSPRITESONSCREEN-2) && getrendermode() != 4)
{
int32_t daz,xrep,yrep;
actor[i].dispicnum++;
continue;
}
else if (ud.shadows && spritesortcnt < (MAXSPRITESONSCREEN-2) && getrendermode() != 4)
{
int32_t daz,xrep,yrep;
if ((sector[sect].lotag&0xff) > 2 || s->statnum == STAT_PROJECTILE || s->statnum == 5 || s->picnum == DRONE || s->picnum == COMMANDER)
daz = sector[sect].floorz;
else
daz = actor[i].floorz;
if ((sector[sect].lotag&0xff) > 2 || s->statnum == STAT_PROJECTILE || s->statnum == 5 || s->picnum == DRONE || s->picnum == COMMANDER)
daz = sector[sect].floorz;
else
daz = actor[i].floorz;
if ((s->z-daz) < (8<<8))
if (g_player[screenpeek].ps->pos.z < daz)
{
Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype));
if ((s->z-daz) < (8<<8))
if (g_player[screenpeek].ps->pos.z < daz)
{
Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype));
tsprite[spritesortcnt].statnum = TSPR_TEMP;
tsprite[spritesortcnt].statnum = TSPR_TEMP;
tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3);
if (t->yrepeat < 4) t->yrepeat = 4;
tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3);
if (t->yrepeat < 4) t->yrepeat = 4;
tsprite[spritesortcnt].shade = 127;
tsprite[spritesortcnt].cstat |= 2;
tsprite[spritesortcnt].shade = 127;
tsprite[spritesortcnt].cstat |= 2;
tsprite[spritesortcnt].z = daz;
xrep = tsprite[spritesortcnt].xrepeat;// - (klabs(daz-t->z)>>11);
tsprite[spritesortcnt].xrepeat = xrep;
tsprite[spritesortcnt].pal = 4;
tsprite[spritesortcnt].z = daz;
xrep = tsprite[spritesortcnt].xrepeat;// - (klabs(daz-t->z)>>11);
tsprite[spritesortcnt].xrepeat = xrep;
tsprite[spritesortcnt].pal = 4;
yrep = tsprite[spritesortcnt].yrepeat;// - (klabs(daz-t->z)>>11);
tsprite[spritesortcnt].yrepeat = yrep;
yrep = tsprite[spritesortcnt].yrepeat;// - (klabs(daz-t->z)>>11);
tsprite[spritesortcnt].yrepeat = yrep;
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0)
{
tsprite[spritesortcnt].yrepeat = 0;
// 512:trans reverse
//1024:tell MD2SPRITE.C to use Z-buffer hacks to hide overdraw issues
tsprite[spritesortcnt].cstat |= (512+1024);
}
else if (getrendermode() >= 3)
{
int32_t ii;
ii = getangle(tsprite[spritesortcnt].x-g_player[screenpeek].ps->pos.x,
tsprite[spritesortcnt].y-g_player[screenpeek].ps->pos.y);
tsprite[spritesortcnt].x += sintable[(ii+2560)&2047]>>9;
tsprite[spritesortcnt].y += sintable[(ii+2048)&2047]>>9;
}
#endif
spritesortcnt++;
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0)
{
tsprite[spritesortcnt].yrepeat = 0;
// 512:trans reverse
//1024:tell MD2SPRITE.C to use Z-buffer hacks to hide overdraw issues
tsprite[spritesortcnt].cstat |= (512+1024);
}
}
else if (getrendermode() >= 3)
{
int32_t ii;
ii = getangle(tsprite[spritesortcnt].x-g_player[screenpeek].ps->pos.x,
tsprite[spritesortcnt].y-g_player[screenpeek].ps->pos.y);
tsprite[spritesortcnt].x += sintable[(ii+2560)&2047]>>9;
tsprite[spritesortcnt].y += sintable[(ii+2048)&2047]>>9;
}
#endif
spritesortcnt++;
}
}
}
switch (DynamicTileMap[s->picnum])
{

View file

@ -282,13 +282,13 @@ void A_GetZLimits(int32_t iActor)
// if (s->statnum == STAT_PLAYER || s->statnum == STAT_STANDABLE || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_ACTOR || s->statnum == STAT_PROJECTILE)
{
int32_t hz,lz,zr = 127L;
int32_t hz,lz,zr = 127;
int32_t cstat = s->cstat;
s->cstat = 0;
if (s->statnum == STAT_PROJECTILE)
zr = 4L;
zr = 4;
s->z -= ZOFFSET;
getzrange((vec3_t *)s,s->sectnum,&actor[iActor].ceilingz,&hz,&actor[iActor].floorz,&lz,zr,CLIPMASK0);
@ -298,28 +298,22 @@ void A_GetZLimits(int32_t iActor)
if ((lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0)
{
const spritetype *hitspr = &sprite[lz&(MAXSPRITES-1)];
lz &= (MAXSPRITES-1);
if (A_CheckEnemySprite(&sprite[lz]) && sprite[lz].pal != 1)
{
if (s->statnum != 4)
{
actor[iActor].dispicnum = -4; // No shadows on actors
s->xvel = -256;
A_SetSprite(iActor,CLIPMASK0);
}
}
else if (sprite[lz].picnum == APLAYER && A_CheckEnemySprite(s))
if ((A_CheckEnemySprite(hitspr) && hitspr->pal != 1 && s->statnum != STAT_PROJECTILE)
|| (hitspr->picnum == APLAYER && A_CheckEnemySprite(s)))
{
actor[iActor].dispicnum = -4; // No shadows on actors
s->xvel = -256;
A_SetSprite(iActor,CLIPMASK0);
}
else if (s->statnum == STAT_PROJECTILE && sprite[lz].picnum == APLAYER)
if (s->owner == lz)
{
actor[iActor].ceilingz = sector[s->sectnum].ceilingz;
actor[iActor].floorz = sector[s->sectnum].floorz;
}
else if (s->statnum == STAT_PROJECTILE && hitspr->picnum == APLAYER && s->owner==lz)
{
actor[iActor].ceilingz = sector[s->sectnum].ceilingz;
actor[iActor].floorz = sector[s->sectnum].floorz;
}
}
}
/*