- Duke: Clean up player/actor accesses in footprints().

This commit is contained in:
Mitchell Richters 2023-10-03 22:31:08 +11:00 committed by Christoph Oelckers
parent d44d14a770
commit 4865fc7d8e
4 changed files with 7 additions and 8 deletions

View file

@ -101,7 +101,7 @@ int timedexit(int snum);
void dokneeattack(DDukePlayer* const p);
int endoflevel(int snum);
void playerisdead(int snum, int psectlotag, double fz, double cz);
void footprints(int snum);
void footprints(DDukePlayer* const p);
int makepainsounds(DDukePlayer* const p, int type);
void playerCrouch(int snum);
void playerJump(int snum, double fz, double cz);

View file

@ -484,9 +484,8 @@ int makepainsounds(DDukePlayer* const p, int type)
//
//---------------------------------------------------------------------------
void footprints(int snum)
void footprints(DDukePlayer* const p)
{
auto p = getPlayer(snum);
auto actor = p->GetActor();
if (p->footprintcount > 0 && p->on_ground)
@ -497,8 +496,8 @@ void footprints(int snum)
while (auto act = it.Next())
{
if (act->IsKindOf(DukeFootprintsClass))
if (abs(act->spr.pos.X - p->GetActor()->spr.pos.X) < 24)
if (abs(act->spr.pos.Y - p->GetActor()->spr.pos.Y) < 24)
if (abs(act->spr.pos.X - actor->spr.pos.X) < 24)
if (abs(act->spr.pos.Y - actor->spr.pos.Y) < 24)
{
j = 1;
break;
@ -512,7 +511,7 @@ void footprints(int snum)
DDukeActor* fprint = spawn(actor, DukeFootprintsClass);
if (fprint)
{
fprint->spr.Angles.Yaw = p->GetActor()->spr.Angles.Yaw;
fprint->spr.Angles.Yaw = actor->spr.Angles.Yaw;
fprint->spr.pal = p->footprintpal;
fprint->spr.shade = (int8_t)p->footprintshade;
}

View file

@ -683,7 +683,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
}
else
{
footprints(snum);
footprints(p);
}
if (pact->getOffsetZ() < floorz - i) //falling

View file

@ -1163,7 +1163,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
}
else if (!p->OnMotorcycle)
{
footprints(snum);
footprints(p);
}
if (pact->getOffsetZ() < floorz - i) //falling