- little bit of cleanup on Duke's bullet hole code.

This commit is contained in:
Christoph Oelckers 2022-01-13 20:53:36 +01:00
parent 8d84bc2599
commit ecb2732629
3 changed files with 10 additions and 7 deletions

View file

@ -169,6 +169,7 @@ enum ESpriteBits2
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.
CSTAT2_SPRITE_DECAL = 8, // always attached to a wall.
};
// tsprite flags use the otherwise unused clipdist field.

View file

@ -499,7 +499,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
DukeSectIterator it(hit.hitWall->nextSector());
while (auto l = it.Next())
{
if (l->spr.statnum == 3 && l->spr.lotag == 13)
if (l->spr.statnum == STAT_EFFECTOR && l->spr.lotag == SE_13_EXPLOSIVE)
goto SKIPBULLETHOLE;
}
}
@ -518,6 +518,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
auto delta = hit.hitWall->delta();
hole->spr.ang = getangle(-delta.X, -delta.Y) + 512;
ssp(hole, CLIPMASK0);
hole->spr.cstat2 |= CSTAT2_SPRITE_DECAL;
}
}

View file

@ -395,7 +395,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
DukeSectIterator it(hit.hitWall->nextSector());
while (auto l = it.Next())
{
if (l->spr.statnum == 3 && l->spr.lotag == 13)
if (l->spr.statnum == STAT_EFFECTOR && l->spr.lotag == SE_13_EXPLOSIVE)
goto SKIPBULLETHOLE;
}
}
@ -407,13 +407,14 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
if (dist(l, spark) < (12 + (krand() & 7)))
goto SKIPBULLETHOLE;
}
auto l = spawn(spark, BULLETHOLE);
if (l)
auto hole = spawn(spark, BULLETHOLE);
if (hole)
{
l->spr.xvel = -1;
hole->spr.xvel = -1;
auto delta = hit.hitWall->delta();
l->spr.ang = getangle(-delta.X, -delta.Y) + 512;
ssp(l, CLIPMASK0);
hole->spr.ang = getangle(-delta.X, -delta.Y) + 512;
ssp(hole, CLIPMASK0);
hole->spr.cstat2 |= CSTAT2_SPRITE_DECAL;
}
}