- CanSeePlayer

This commit is contained in:
Christoph Oelckers 2021-10-30 12:52:38 +02:00
parent a2dee7681a
commit ceb3ac2e5b
4 changed files with 8 additions and 8 deletions

View file

@ -280,10 +280,10 @@ int DoActorNoise(ANIMATORp Action, DSWActor* actor)
return 0;
}
bool CanSeePlayer(short SpriteNum)
bool CanSeePlayer(DSWActor* actor)
{
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
USERp u = actor->u();
SPRITEp sp = &actor->s();
// if actor can still see the player
int look_height = SPRITEp_TOS(sp);
@ -642,7 +642,7 @@ DoActorActionDecide(short SpriteNum)
return action;
}
ICanSee = CanSeePlayer(SpriteNum); // Only need to call once
ICanSee = CanSeePlayer(actor); // Only need to call once
// But need the result multiple times
// !AIC KEY - If aware of player - var is changed in SpriteControl
@ -1153,7 +1153,7 @@ DoActorMoveCloser(DSWActor* actor)
u->DistCheck = 0;
// If player moved out of sight
if (!CanSeePlayer(SpriteNum))
if (!CanSeePlayer(actor))
{
// stay put and choose another option
InitActorDecide(actor);

View file

@ -73,7 +73,7 @@ extern ATTRIBUTE DefaultAttrib;
void DebugMoveHit(DSWActor* actor);
bool ActorMoveHitReact(DSWActor* actor);
short ChooseActionNumber(short decision[]);
bool CanSeePlayer(short SpriteNum);
bool CanSeePlayer(DSWActor* actor);
int CanHitPlayer(short SpriteNum);
int DoActorPickClosePlayer(short SpriteNum);
int CloseRangeDist(SPRITEp sp1,SPRITEp sp2);

View file

@ -2154,7 +2154,7 @@ int CheckFire(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (!CanSeePlayer(SpriteNum))
if (!CanSeePlayer(actor))
InitActorDuck(actor);
return 0;
}

View file

@ -12824,7 +12824,7 @@ DoSerpRing(DSWActor* actor)
updatesector(sp->x,sp->y,&sectnum);
// if (valid sector and can see target)
if (sectnum != -1 && CanSeePlayer(Weapon))
if (sectnum != -1 && CanSeePlayer(actor))
{
extern STATEp sg_SkullJump[];
u->ID = SKULL_R0;