Fixed potential crash in game DLLs from a monster accidentally shooting a corpse in coop mode.

See here:
4132eed597
This commit is contained in:
Knightmare66 2021-01-21 18:30:55 -05:00
parent 2cac9ab01c
commit 53340c1158
3 changed files with 19 additions and 3 deletions

View file

@ -670,6 +670,11 @@ void M_ReactToDamage (edict_t *targ, edict_t *attacker)
if (attacker == targ || attacker == targ->enemy)
return;
// apanteleev- dead monsters, like misc_deadsoldier, don't have AI
// functions, but M_ReactToDamage might still be called on them
if (targ->svflags & SVF_DEADMONSTER)
return;
// if we are a good guy monster and our attacker is a player
// or another good guy, do not get mad at them
if (targ->monsterinfo.aiflags & AI_GOOD_GUY)

View file

@ -748,6 +748,11 @@ void M_ReactToDamage (edict_t *targ, edict_t *attacker, edict_t *inflictor)
if (attacker == targ || attacker == targ->enemy)
return;
// apanteleev- dead monsters, like misc_deadsoldier, don't have AI
// functions, but M_ReactToDamage might still be called on them
if (targ->svflags & SVF_DEADMONSTER)
return;
// if we are a good guy monster and our attacker is a player
// or another good guy, do not get mad at them
if (targ->monsterinfo.aiflags & AI_GOOD_GUY)

View file

@ -308,13 +308,19 @@ static int CheckArmor (edict_t *ent, vec3_t point, vec3_t normal, int damage, in
void M_ReactToDamage (edict_t *targ, edict_t *attacker)
{
if (!(attacker->client) && !(attacker->svflags & SVF_MONSTER) &&
(strcmp (attacker->classname, "monster_autocannon") != 0))
// if (!(attacker->client) && !(attacker->svflags & SVF_MONSTER) &&
// (strcmp (attacker->classname, "monster_autocannon") != 0))
if ( attacker->classname && !strncmp(attacker->classname, "monster_autocannon", 18) )
return;
if (attacker == targ || attacker == targ->enemy)
return;
// apanteleev- dead monsters, like misc_deadsoldier, don't have AI
// functions, but M_ReactToDamage might still be called on them
if (targ->svflags & SVF_DEADMONSTER)
return;
// if we are a good guy monster and our attacker is a player
// or another good guy, do not get mad at them
if (targ->monsterinfo.aiflags & AI_GOOD_GUY)