- floatified DoActorPickClosePlayer

This commit is contained in:
Christoph Oelckers 2022-09-04 20:50:43 +02:00
parent b18bbf248d
commit fe14b5378b
3 changed files with 8 additions and 7 deletions

View file

@ -267,13 +267,15 @@ int CanHitPlayer(DSWActor* actor)
int DoActorPickClosePlayer(DSWActor* actor) int DoActorPickClosePlayer(DSWActor* actor)
{ {
int dist, near_dist = MAX_ACTIVE_RANGE, a,b,c;
int pnum; int pnum;
PLAYER* pp; PLAYER* pp;
// if actor can still see the player // if actor can still see the player
bool found = false; bool found = false;
int i; int i;
double near_dist = MAX_ACTIVE_RANGE;
double dist;
if (actor->user.ID == ZOMBIE_RUN_R0 && gNet.MultiGameType == MULTI_GAME_COOPERATIVE) if (actor->user.ID == ZOMBIE_RUN_R0 && gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
goto TARGETACTOR; goto TARGETACTOR;
@ -296,7 +298,6 @@ int DoActorPickClosePlayer(DSWActor* actor)
// Set initial target to the closest player // Set initial target to the closest player
near_dist = MAX_ACTIVE_RANGE;
TRAVERSE_CONNECT(pnum) TRAVERSE_CONNECT(pnum)
{ {
pp = &Player[pnum]; pp = &Player[pnum];
@ -315,7 +316,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
// continue; // continue;
} }
DISTANCE(actor->spr.pos, pp->pos, dist, a, b, c); dist = (actor->spr.pos - pp->pos).Length();
if (dist < near_dist) if (dist < near_dist)
{ {
@ -341,7 +342,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
continue; continue;
} }
DISTANCE(actor->spr.pos, pp->pos, dist, a, b, c); dist = (actor->spr.pos - pp->pos).Length();
DSWActor* plActor = pp->actor; DSWActor* plActor = pp->actor;
@ -369,7 +370,7 @@ TARGETACTOR:
if ((itActor->user.Flags & (SPR_SUICIDE | SPR_DEAD))) if ((itActor->user.Flags & (SPR_SUICIDE | SPR_DEAD)))
continue; continue;
DISTANCE(actor->spr.pos, itActor->spr.pos, dist, a, b, c); dist = (actor->spr.pos - itActor->spr.pos).Length();
if (dist < near_dist && FAFcansee(ActorVectOfTop(actor), actor->sector(), ActorUpperVect(itActor), itActor->sector())) if (dist < near_dist && FAFcansee(ActorVectOfTop(actor), actor->sector(), ActorUpperVect(itActor), itActor->sector()))
{ {

View file

@ -163,7 +163,7 @@ enum
{ {
CIRCLE_CAMERA_DIST_MIN = 12000, CIRCLE_CAMERA_DIST_MIN = 12000,
// dist at which actors will not move (unless shot?? to do) // dist at which actors will not move (unless shot?? to do)
MAX_ACTIVE_RANGE = 42000, MAX_ACTIVE_RANGE = 42000 / 16,
// dist at which actors roam about on their own // dist at which actors roam about on their own
MIN_ACTIVE_RANGE = 20000, MIN_ACTIVE_RANGE = 20000,
}; };

View file

@ -5845,7 +5845,7 @@ void AdjustActiveRange(PLAYER* pp, DSWActor* actor, int dist)
actor->user.wait_active_check = 0; actor->user.wait_active_check = 0;
// check aboslute max // check aboslute max
if (dist > MAX_ACTIVE_RANGE) if (dist > MAX_ACTIVE_RANGE * worldtoint)
return; return;
// do not do a FAFcansee if your already active // do not do a FAFcansee if your already active