- use PlayerIndex where appropriate.

This commit is contained in:
Christoph Oelckers 2022-09-01 16:42:23 +02:00
parent f495650922
commit 0740ccbef1
6 changed files with 16 additions and 16 deletions

View file

@ -210,7 +210,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
case BURNING:
if (OwnerAc && OwnerAc->spr.statnum == STAT_PLAYER)
{
if (display_mirror == 0 && OwnerAc->spr.yvel == screenpeek && ps[OwnerAc->spr.yvel].over_shoulder_on == 0)
if (display_mirror == 0 && OwnerAc->PlayerIndex() == screenpeek && ps[OwnerAc->PlayerIndex()].over_shoulder_on == 0)
t->xrepeat = 0;
else
{

View file

@ -1685,7 +1685,7 @@ int ParseState::parse(void)
case concmd_getlastpal:
insptr++;
if (g_ac->isPlayer())
g_ac->spr.pal = ps[g_ac->spr.yvel].palookup;
g_ac->spr.pal = ps[g_ac->PlayerIndex()].palookup;
else
{
// Copied from DukeGDX.
@ -1700,7 +1700,7 @@ int ParseState::parse(void)
break;
case concmd_tossweapon:
insptr++;
fi.checkweapons(&ps[g_ac->spr.yvel]);
fi.checkweapons(&ps[g_ac->PlayerIndex()]);
break;
case concmd_nullop:
insptr++;

View file

@ -241,7 +241,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
// Autoaim from DukeGDX.
if (actor->isPlayer())
{
auto* plr = &ps[actor->spr.yvel];
auto* plr = &ps[actor->PlayerIndex()];
int autoaim = Autoaim(actor->spr.yvel);
if (!autoaim)
{
@ -273,7 +273,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
}
else
{
weap = aplWeaponWorksLike(plr->curr_weapon, actor->spr.yvel);
weap = aplWeaponWorksLike(plr->curr_weapon, actor->PlayerIndex());
}
// The chickens in RRRA are homing and must always autoaim.
if (!isRRRA() || plr->curr_weapon != CHICKEN_WEAPON)
@ -287,7 +287,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
}
}
DDukeActor* aimed = nullptr;
// if(actor->isPlayer() && ps[actor->spr.yvel].aim_mode) return -1;
// if(actor->isPlayer() && ps[actor->PlayerIndex()].aim_mode) return -1;
if (isRR())
{
@ -296,13 +296,13 @@ DDukeActor* aim(DDukeActor* actor, int aang)
}
else if (isWW2GI())
{
gotshrinker = actor->isPlayer() && aplWeaponWorksLike(ps[actor->spr.yvel].curr_weapon, actor->spr.yvel) == SHRINKER_WEAPON;
gotfreezer = actor->isPlayer() && aplWeaponWorksLike(ps[actor->spr.yvel].curr_weapon, actor->spr.yvel) == FREEZE_WEAPON;
gotshrinker = actor->isPlayer() && aplWeaponWorksLike(ps[actor->PlayerIndex()].curr_weapon, actor->PlayerIndex()) == SHRINKER_WEAPON;
gotfreezer = actor->isPlayer() && aplWeaponWorksLike(ps[actor->PlayerIndex()].curr_weapon, actor->PlayerIndex()) == FREEZE_WEAPON;
}
else
{
gotshrinker = actor->isPlayer() && ps[actor->spr.yvel].curr_weapon == SHRINKER_WEAPON;
gotfreezer = actor->isPlayer() && ps[actor->spr.yvel].curr_weapon == FREEZE_WEAPON;
gotshrinker = actor->isPlayer() && ps[actor->PlayerIndex()].curr_weapon == SHRINKER_WEAPON;
gotfreezer = actor->isPlayer() && ps[actor->PlayerIndex()].curr_weapon == FREEZE_WEAPON;
}
smax = 0x7fffffff;
@ -349,7 +349,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
if (sdist > 512 && sdist < smax)
{
if (actor->isPlayer())
a = (abs(Scale(act->int_pos().Z - actor->int_pos().Z, 10, sdist) - ps[actor->spr.yvel].horizon.sum().asbuild()) < 100);
a = (abs(Scale(act->int_pos().Z - actor->int_pos().Z, 10, sdist) - ps[actor->PlayerIndex()].horizon.sum().asbuild()) < 100);
else a = 1;
cans = cansee(act->spr.pos.plusZ(-32 + gs.actorinfo[act->spr.picnum].aimoffset), act->sector(), actor->spr.pos.plusZ(-32), actor->sector());
@ -403,8 +403,8 @@ void dokneeattack(int snum, const std::initializer_list<int> & respawnlist)
if (p->actorsqu->isPlayer())
{
quickkill(&ps[p->actorsqu->spr.yvel]);
ps[p->actorsqu->spr.yvel].frag_ps = snum;
quickkill(&ps[p->actorsqu->PlayerIndex()]);
ps[p->actorsqu->PlayerIndex()].frag_ps = snum;
}
else if (badguy(p->actorsqu))
{

View file

@ -408,7 +408,7 @@ void initfootprint(DDukeActor* actj, DDukeActor* act)
else { act->spr.xrepeat = act->spr.yrepeat = 0; return; }
act->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR;
if ((ps[actj->spr.yvel].footprintcount & 1)) act->spr.cstat |= CSTAT_SPRITE_XFLIP;
if ((ps[actj->PlayerIndex()].footprintcount & 1)) act->spr.cstat |= CSTAT_SPRITE_XFLIP;
act->spr.angle = actj->spr.angle;
}

View file

@ -510,7 +510,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.xrepeat = actj->spr.xrepeat;
act->spr.yrepeat = actj->spr.yrepeat;
act->spr.shade = actj->spr.shade;
act->spr.pal = ps[actj->spr.yvel].palookup;
act->spr.pal = ps[actj->PlayerIndex()].palookup;
}
[[fallthrough]];
case DUKECAR:

View file

@ -543,7 +543,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.xrepeat = actj->spr.xrepeat;
act->spr.yrepeat = actj->spr.yrepeat;
act->spr.shade = actj->spr.shade;
act->spr.pal = ps[actj->spr.yvel].palookup;
act->spr.pal = ps[actj->PlayerIndex()].palookup;
}
act->spr.cstat = 0;
act->spr.extra = 1;