Fix actor[].dispicnum becoming negative.

Since the original source code release of Duke3D, there was a potentially
dangerous hack where actor[].dispicnum was set to -4 to signal "this actor
should not have a floor shadow for this moment" (it doesn't really work,
if you ask me).
Now, use another bit of actor[].flags for that purpose because setting
any picnum members to negative values asks for trouble.

git-svn-id: https://svn.eduke32.com/eduke32@2249 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-01-12 20:48:00 +00:00
parent 7e6f712ad1
commit 7a5a19a874
3 changed files with 13 additions and 2 deletions

View file

@ -149,6 +149,7 @@ enum sflags_t {
SPRITE_USEACTIVATOR = 0x00000200,
SPRITE_NULL = 0x00000400, // null sprite in multiplayer
SPRITE_NOCLIP = 0x00000800, // clipmove it with cliptype 0
SPRITE_NOFLOORSHADOW= 0x00001000, // for temp. internal use, per-tile flag not checked
};
// custom projectiles

View file

@ -6513,10 +6513,17 @@ skip:
{
if (actor[i].dispicnum < 0)
{
// a negative actor[i].dispicnum used to mean 'no floor shadow please' but
// that was a bad hack since the value could propagate to sprite[].picnum
OSD_Printf(OSD_ERROR "actor[%d].dispicnum = %d\n", i, actor[i].dispicnum);
actor[i].dispicnum++;
continue;
}
else if (ud.shadows && spritesortcnt < (MAXSPRITESONSCREEN-2) && getrendermode() != 4)
if (actor[i].flags & SPRITE_NOFLOORSHADOW)
continue;
if (ud.shadows && spritesortcnt < (MAXSPRITESONSCREEN-2) && getrendermode() != 4)
{
int32_t daz,xrep,yrep;

View file

@ -302,6 +302,8 @@ void A_GetZLimits(int32_t iActor)
s->cstat = cstat;
actor[iActor].flags &= ~SPRITE_NOFLOORSHADOW;
if ((lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0)
{
const spritetype *hitspr = &sprite[lz&(MAXSPRITES-1)];
@ -311,7 +313,8 @@ void A_GetZLimits(int32_t iActor)
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
actor[iActor].flags |= SPRITE_NOFLOORSHADOW; // No shadows on actors
// actor[iActor].dispicnum = -4; // No shadows on actors
s->xvel = -256;
A_SetSprite(iActor,CLIPMASK0);
}