mirror of
https://github.com/yquake2/rogue.git
synced 2024-11-22 12:21:44 +00:00
Fixed monsters seeing players during intermissions
This commit is contained in:
parent
f762ee6116
commit
004ff57649
1 changed files with 32 additions and 40 deletions
72
src/g_ai.c
72
src/g_ai.c
|
@ -616,15 +616,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;
|
||||
}
|
||||
|
@ -1151,11 +1147,38 @@ ai_run_slide(edict_t *self, float distance)
|
|||
* or do something else used by
|
||||
* ai_run and ai_stand
|
||||
*/
|
||||
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;
|
||||
qboolean retval;
|
||||
|
||||
if (!self)
|
||||
|
@ -1208,41 +1231,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))
|
||||
if (hesDeadJim(self))
|
||||
{
|
||||
hesDeadJim = true;
|
||||
}
|
||||
else if (self->monsterinfo.aiflags & AI_MEDIC)
|
||||
{
|
||||
if (self->enemy->health > 0)
|
||||
{
|
||||
hesDeadJim = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self->monsterinfo.aiflags & AI_BRUTAL)
|
||||
{
|
||||
if (self->enemy->health <= -80)
|
||||
{
|
||||
hesDeadJim = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self->enemy->health <= 0)
|
||||
{
|
||||
hesDeadJim = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hesDeadJim)
|
||||
{
|
||||
self->monsterinfo.aiflags &= ~AI_MEDIC;
|
||||
self->enemy = NULL;
|
||||
self->monsterinfo.aiflags &= ~AI_MEDIC;
|
||||
|
||||
if (self->oldenemy && (self->oldenemy->health > 0))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue