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

This commit is contained in:
Mitchell Richters 2023-10-03 22:33:54 +11:00
parent 7186c3e9f7
commit 497d2d26dd
4 changed files with 11 additions and 11 deletions

View file

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

View file

@ -526,13 +526,12 @@ void footprints(DDukePlayer* const p)
//
//---------------------------------------------------------------------------
void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
void playerisdead(DDukePlayer* const p, int psectlotag, double floorz, double ceilingz)
{
auto p = getPlayer(snum);
auto actor = p->GetActor();
// lock input when dead.
setForcedSyncInput(snum);
setForcedSyncInput(p->pnum);
if (p->dead_flag == 0)
{
@ -560,13 +559,14 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
if (ud.multimode > 1 && (actor->spr.pal != 1 || (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)))
{
if (p->frag_ps != snum)
if (p->frag_ps != p->pnum)
{
getPlayer(p->frag_ps)->frag++;
getPlayer(p->frag_ps)->frags[snum]++;
const auto fragp = getPlayer(p->frag_ps);
fragp->frag++;
fragp->frags[p->pnum]++;
auto pname = PlayerName(p->frag_ps);
if (snum == screenpeek)
if (p->pnum == screenpeek)
{
Printf(PRINT_NOTIFY, "Killed by %s", pname);
}
@ -578,7 +578,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
}
else p->fraggedself++;
p->frag_ps = snum;
p->frag_ps = p->pnum;
}
}

View file

@ -1637,7 +1637,7 @@ void processinput_d(int snum)
if (pact->spr.extra <= 0 && !ud.god)
{
playerisdead(snum, psectlotag, floorz, ceilingz);
playerisdead(p, psectlotag, floorz, ceilingz);
return;
}

View file

@ -2449,7 +2449,7 @@ void processinput_r(int snum)
if (pact->spr.extra <= 0 && !ud.god)
{
playerisdead(snum, psectlotag, floorz, ceilingz);
playerisdead(p, psectlotag, floorz, ceilingz);
return;
}