P_CheckSight should ideally be called AFTER most other things in things like P_LookForPlayers at least

git-svn-id: https://code.orospakr.ca/svn/srb2/trunk@9043 6de4a73c-47e2-0310-b8c1-93d6ecd3f8cd
This commit is contained in:
MonsterIestyn 2015-02-18 18:59:52 +00:00 committed by Alam Ed Arias
parent d915a8142d
commit 076719e6a4

View file

@ -363,12 +363,12 @@ boolean P_CheckMissileRange(mobj_t *actor)
if (!actor->target)
return false;
if (!P_CheckSight(actor, actor->target))
return false;
if (actor->reactiontime)
return false; // do not attack yet
if (!P_CheckSight(actor, actor->target))
return false;
// OPTIMIZE: get this from a global checksight
dist = P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) - FixedMul(64*FRACUNIT, actor->scale);
@ -652,6 +652,9 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
player = &players[actor->lastlook];
if ((netgame || multiplayer) && player->spectator)
continue;
if (player->health <= 0)
continue; // dead
@ -661,12 +664,6 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
if (!player->mo || P_MobjWasRemoved(player->mo))
continue;
if (!P_CheckSight(actor, player->mo))
continue; // out of sight
if ((netgame || multiplayer) && player->spectator)
continue;
if (dist > 0
&& P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist)
continue; // Too far away
@ -683,6 +680,9 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
}
}
if (!P_CheckSight(actor, player->mo))
continue; // out of sight
if (tracer)
P_SetTarget(&actor->tracer, player->mo);
else