- ActorFindTrack

This commit is contained in:
Christoph Oelckers 2021-10-31 11:47:52 +01:00
parent b3558d8925
commit a48b45143e
3 changed files with 8 additions and 12 deletions

View file

@ -186,7 +186,6 @@ short ChooseActionNumber(short decision[])
int DoActorNoise(ANIMATORp Action, DSWActor* actor)
{
USERp u = actor->u();
int SpriteNum = actor->GetSpriteIndex();
if (Action == InitActorAmbientNoise)
{
@ -320,7 +319,6 @@ int DoActorPickClosePlayer(DSWActor* actor)
{
USERp u = actor->u();
SPRITEp sp = &actor->s();
int SpriteNum = actor->GetSpriteIndex();
int dist, near_dist = MAX_ACTIVE_RANGE, a,b,c;
short pnum;
PLAYERp pp;
@ -562,7 +560,6 @@ ANIMATORp DoActorActionDecide(DSWActor* actor)
{
USERp u = actor->u();
SPRITEp sp = &actor->s();
int SpriteNum = u->SpriteNum;
int dist;
ANIMATORp action;
bool ICanSee=false;
@ -757,7 +754,6 @@ int InitActorDecide(DSWActor* actor)
int DoActorDecide(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &actor->s();
ANIMATORp actor_action;
@ -1092,7 +1088,7 @@ short FindTrackToPlayer(DSWActor* actor)
for (i = 0; i < size; i++)
{
track = ActorFindTrack(u->SpriteNum, 1, type[i], &point, &track_dir);
track = ActorFindTrack(actor, 1, type[i], &point, &track_dir);
if (track >= 0)
{
@ -1137,7 +1133,7 @@ short FindTrackAwayFromPlayer(DSWActor* actor)
for (i = 0; i < SIZ(RunAwayTracks); i++)
{
track = ActorFindTrack(u->SpriteNum, -1, RunAwayTracks[i], &point, &track_dir);
track = ActorFindTrack(actor, -1, RunAwayTracks[i], &point, &track_dir);
if (track >= 0)
{
@ -1182,7 +1178,7 @@ short FindWanderTrack(DSWActor* actor)
for (i = 0; i < SIZ(WanderTracks); i++)
{
track = ActorFindTrack(u->SpriteNum, -1, WanderTracks[i], &point, &track_dir);
track = ActorFindTrack(actor, -1, WanderTracks[i], &point, &track_dir);
if (track >= 0)
{
@ -1253,7 +1249,6 @@ int InitActorRunToward(DSWActor* actor)
int InitActorAttack(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &actor->s();
// zombie is attacking a player

View file

@ -1892,7 +1892,7 @@ void SectorMidPoint(short sectnum, int *xmid, int *ymid, int *zmid);
USERp SpawnUser(short SpriteNum, short id, STATEp state);
USERp SpawnUser(DSWActor* actor, short id, STATEp state);
short ActorFindTrack(short SpriteNum, int8_t player_dir, int track_type, short *track_point_num, short *track_dir);
short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, short *track_point_num, short *track_dir);
SECT_USERp GetSectUser(short sectnum);

View file

@ -118,10 +118,11 @@ point to the sprite.
*/
short
ActorFindTrack(short SpriteNum, int8_t player_dir, int track_type, short *track_point_num, short *track_dir)
ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, short *track_point_num, short *track_dir)
{
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
USERp u = actor->u();
SPRITEp sp = &actor->s();
int SpriteNum = actor->GetSpriteIndex();
int dist, near_dist = 999999, zdiff;
int track_sect=0;