- do proper handling of the 'no shadow' case for Duke's bad guys.

Using a flag like RedNukem instead of hacking dispicnum, which occasionally does reach the renderer and causes problems.
This commit is contained in:
Christoph Oelckers 2022-01-13 00:42:34 +01:00
parent a13612ab9b
commit 85cce1128a
5 changed files with 18 additions and 18 deletions

View file

@ -166,8 +166,9 @@ DEFINE_TFLAGS_OPERATORS(ESpriteFlags)
enum ESpriteBits2
{
CSTAT2_SPRITE_NOFIND = 1, // Invisible to neartag and hitscan
CSTAT2_SPRITE_MAPPED = 2, // sprite was mapped for automap
CSTAT2_SPRITE_NOFIND = 1, // Invisible to neartag and hitscan
CSTAT2_SPRITE_MAPPED = 2, // sprite was mapped for automap
CSTAT2_SPRITE_NOSHADOW = 4, // cast no shadow.
};
// tsprite flags use the otherwise unused clipdist field.

View file

@ -279,7 +279,7 @@ void HWDrawInfo::DispatchSprites()
int tilenum = tspr->picnum;
auto actor = tspr->ownerActor;
if (actor == nullptr || tspr->xrepeat == 0 || tspr->yrepeat == 0 || tilenum >= MAXTILES)
if (actor == nullptr || tspr->xrepeat == 0 || tspr->yrepeat == 0 || (unsigned)tilenum >= MAXTILES)
continue;
actor->spr.cstat2 |= CSTAT2_SPRITE_MAPPED;

View file

@ -4832,20 +4832,21 @@ void getglobalz(DDukeActor* actor)
getzrange({ actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (FOURSLEIGHT) }, actor->sector(), &actor->ceilingz, hz, &actor->floorz, lz, zr, CLIPMASK0);
actor->spr.cstat2 = cc;
actor->spr.cstat2 &= ~CSTAT2_SPRITE_NOSHADOW;
if( lz.type == kHitSprite && (lz.actor()->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0 )
{
if( badguy(lz.actor()) && lz.actor()->spr.pal != 1)
{
if( actor->spr.statnum != STAT_PROJECTILE)
{
actor->dispicnum = -4; // No shadows on actors
actor->spr.cstat2 |= CSTAT2_SPRITE_NOSHADOW; // No shadows on actors
actor->spr.xvel = -256;
ssp(actor, CLIPMASK0);
}
}
else if(lz.actor()->isPlayer() && badguy(actor) )
{
actor->dispicnum = -4; // No shadows on actors
actor->spr.cstat2 |= CSTAT2_SPRITE_NOSHADOW; // No shadows on actors
actor->spr.xvel = -256;
ssp(actor, CLIPMASK0);
}

View file

@ -566,15 +566,12 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
}
if (h->spr.statnum == STAT_DUMMYPLAYER || badguy(h) || (h->spr.picnum == APLAYER && h->GetOwner()))
{
if (t->statnum != 99 && h->spr.picnum != EXPLOSION2 && h->spr.picnum != HANGLIGHT && h->spr.picnum != DOMELITE)
{
if (h->spr.picnum != HOTMEAT)
{
if (h->dispicnum < 0)
{
h->dispicnum++;
continue;
}
else if (r_shadows && spritesortcnt < (MAXSPRITESONSCREEN - 2))
if (r_shadows && spritesortcnt < (MAXSPRITESONSCREEN - 2) && !(h->spr.cstat2 & CSTAT2_SPRITE_NOSHADOW))
{
int daz;
@ -623,7 +620,8 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
t->shade = 0;
}
}
}
}
switch (h->spr.picnum)
{

View file

@ -720,15 +720,12 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
t->shade = -127;
if (h->spr.statnum == STAT_DUMMYPLAYER || badguy(h) || (h->spr.picnum == APLAYER && h->GetOwner()))
{
if ((h->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0 && t->statnum != 99)
{
if (h->spr.picnum != EXPLOSION2 && h->spr.picnum != DOMELITE && h->spr.picnum != TORNADO && h->spr.picnum != EXPLOSION3 && (h->spr.picnum != SBMOVE || isRRRA()))
{
if (h->dispicnum < 0)
{
h->dispicnum++;
continue;
}
else if (r_shadows && spritesortcnt < (MAXSPRITESONSCREEN - 2))
if (r_shadows && spritesortcnt < (MAXSPRITESONSCREEN - 2) && !(h->spr.cstat2 & CSTAT2_SPRITE_NOSHADOW))
{
int daz;
@ -772,6 +769,9 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
}
}
}
}
}
switch (h->spr.picnum)