- final cleanup on hitradius.

Several dead code paths were also removed that are unable to be triggered by any event in the game - due to the spaghetti-style checks this hadn't been obvious before.
Also one more flag that handles the WT flamethrower's special case of not hurting any actors of the shooter's kind in a more generalized form
This commit is contained in:
Christoph Oelckers 2022-12-29 16:38:15 +01:00
parent ac430e6bc7
commit 927d014cea
6 changed files with 11 additions and 12 deletions

View file

@ -182,6 +182,7 @@ static FFlagDef DukeActorFlagDefs[] =
DEFINE_FLAG(SFLAG3, HITRADIUS_DONTHURTSHOOTER, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, HITRADIUS_NODAMAGE, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, HITRADIUS_NOEFFECT, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, HITRADIUS_DONTHURTSPECIES, DDukeActor, flags3),
};

View file

@ -165,14 +165,14 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
DukeStatIterator itj(statlist[x]);
while (auto act2 = itj.Next())
{
if (isWorldTour() && Owner)
if (Owner)
{
if (Owner->isPlayer() && act2->isPlayer() && ud.coop != 0 && ud.ffire == 0 && Owner != act2)
if (Owner->isPlayer() && act2->isPlayer() && ud.coop != 0 && ud.ffire == 0 && Owner != act2 /* && (dmflags & NOFRIENDLYRADIUSDMG)*/)
{
continue;
}
if (actor->spr.picnum == DTILE_FLAMETHROWERFLAME && ((Owner->spr.picnum == DTILE_FIREFLY && act2->spr.picnum == DTILE_FIREFLY) || (Owner->spr.picnum == DTILE_BOSS5 && act2->spr.picnum == DTILE_BOSS5)))
if (actor->flags3 & SFLAG3_HITRADIUS_DONTHURTSPECIES && !Owner->isPlayer() && Owner->GetClass() == act2->GetClass())
{
continue;
}
@ -180,7 +180,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (x == 0 || x >= 5 || (act2->flags1 & SFLAG_HITRADIUS_CHECKHITONLY))
{
if (actor->spr.picnum != DTILE_SHRINKSPARK || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))
if (!(actor->flags3 & SFLAG3_HITRADIUS_NODAMAGE) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))
if ((actor->spr.pos - act2->spr.pos).Length() < radius)
{
if (badguy(act2) && !cansee(act2->spr.pos.plusZ(q), act2->sector(), actor->spr.pos.plusZ(q), actor->sector()))
@ -190,10 +190,6 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
}
else if (act2->spr.extra >= 0 && act2 != actor && ((act2->flags1 & SFLAG_HITRADIUS_FORCEEFFECT) || badguy(act2) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)))
{
if (actor->spr.picnum == DTILE_SHRINKSPARK && act2->spr.picnum != DTILE_SHARK && (act2->spr.scale.X < 0.375))
{
continue;
}
if (actor->flags3 & SFLAG3_HITRADIUS_DONTHURTSHOOTER && act2 == Owner)
{
continue;
@ -235,11 +231,11 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
}
else if (actor->spr.extra == 0) act2->hitextra = 0;
if (act2->spr.picnum != DTILE_RADIUSEXPLOSION && Owner && Owner->spr.statnum < MAXSTATUS)
if (act2->GetClass() != DukeRadiusExplosionClass && Owner && Owner->spr.statnum < MAXSTATUS)
{
if (act2->isPlayer())
{
int p = act2->spr.yint;
int p = act2->PlayerIndex();
if (act2->attackertype == DukeFlamethrowerFlameClass && Owner->isPlayer())
{

View file

@ -218,8 +218,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if ((act2->flags1 & SFLAG_HITRADIUSCHECK))
checkhitsprite(act2, actor);
if (act2->spr.picnum != RTILE_RADIUSEXPLOSION &&
Owner && Owner->spr.statnum < MAXSTATUS)
if (act2->GetClass() != DukeRadiusExplosionClass && Owner && Owner->spr.statnum < MAXSTATUS)
{
if (act2->isPlayer())
{

View file

@ -111,3 +111,4 @@ xx(RedneckPorkRinds)
xx(RedneckMoonshine)
xx(RedneckTitgun)
xx(RedneckTitAmmo)
xx(DukeRadiusExplosion)

View file

@ -415,6 +415,7 @@ enum sflags3_t
SFLAG3_HITRADIUS_DONTHURTSHOOTER = 0x00002000,
SFLAG3_HITRADIUS_NODAMAGE = 0x00004000, // Hitradius inflicts no damage, only a damage type.
SFLAG3_HITRADIUS_NOEFFECT = 0x00008000, // Completely immune to hitradius
SFLAG3_HITRADIUS_DONTHURTSPECIES = 0x00010000, // don't hurt others of the shooter's species.
};

View file

@ -3,6 +3,7 @@ class DukeFlamethrowerFlame : DukeActor
default
{
pic "FLAMETHROWERFLAME";
+HITRADIUS_DONTHURTSPECIES;
}
override void Tick()