From e0fb272e6566662de5ea0566bd71d143d8276c4c Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Wed, 26 Apr 2023 01:30:21 +0000 Subject: [PATCH] Fixed monsters seeing players during intermissions --- src/g_ai.c | 72 ++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 40 deletions(-) diff --git a/src/g_ai.c b/src/g_ai.c index 78e87e3..ae69e1b 100644 --- a/src/g_ai.c +++ b/src/g_ai.c @@ -516,15 +516,11 @@ FindTarget(edict_t *self) else { client = level.sight_client; - - if (!client) - { - return false; /* no clients to get mad at */ - } } /* if the entity went away, forget it */ - if (!client->inuse) + if (!client || !client->inuse || + (client->client && level.intermissiontime)) { return false; } @@ -902,11 +898,38 @@ ai_run_slide(edict_t *self, float distance) * Decides if we're going to * attack or do something else */ +static qboolean +hesDeadJim(const edict_t *self) +{ + const edict_t *enemy = self->enemy; + + if (!enemy || !enemy->inuse) + { + return true; + } + + if (self->monsterinfo.aiflags & AI_MEDIC) + { + return (enemy->health > 0); + } + + if (enemy->client && level.intermissiontime) + { + return true; + } + + if (self->monsterinfo.aiflags & AI_BRUTAL) + { + return (enemy->health <= -80); + } + + return (enemy->health <= 0); +} + qboolean ai_checkattack(edict_t *self, float dist) { vec3_t temp; - qboolean hesDeadJim; if (!self) { @@ -958,41 +981,10 @@ ai_checkattack(edict_t *self, float dist) enemy_vis = false; /* see if the enemy is dead */ - hesDeadJim = false; - - if ((!self->enemy) || (!self->enemy->inuse)) - { - hesDeadJim = true; - } - else if (self->monsterinfo.aiflags & AI_MEDIC) - { - if (self->enemy->health > 0) - { - hesDeadJim = true; - self->monsterinfo.aiflags &= ~AI_MEDIC; - } - } - else - { - if (self->monsterinfo.aiflags & AI_BRUTAL) - { - if (self->enemy->health <= -80) - { - hesDeadJim = true; - } - } - else - { - if (self->enemy->health <= 0) - { - hesDeadJim = true; - } - } - } - - if (hesDeadJim) + if (hesDeadJim(self)) { self->enemy = NULL; + self->monsterinfo.aiflags &= ~AI_MEDIC; if (self->oldenemy && (self->oldenemy->health > 0)) {