mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 12:30:40 +00:00
- Duke: Clean up player/actor accesses in findplayer utilities.
This commit is contained in:
parent
60228e10c6
commit
5f132f5cda
2 changed files with 13 additions and 6 deletions
|
@ -468,11 +468,12 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
ud.m_monsters_off = ud.monsters_off;
|
||||
ud.m_coop = ud.coop;
|
||||
ud.m_ffire = ud.ffire;
|
||||
if (getPlayer(myconnectindex)->over_shoulder_on != 0)
|
||||
const auto p = getPlayer(myconnectindex);
|
||||
if (p->over_shoulder_on != 0)
|
||||
{
|
||||
cameradist = 0;
|
||||
cameraclock = 0;
|
||||
getPlayer(myconnectindex)->over_shoulder_on = 1;
|
||||
p->over_shoulder_on = 1;
|
||||
}
|
||||
|
||||
cacheit();
|
||||
|
|
|
@ -259,8 +259,9 @@ int findplayer(const DDukeActor* actor, double* d)
|
|||
|
||||
for (j = connecthead; j >= 0; j = connectpoint2[j])
|
||||
{
|
||||
double x = (getPlayer(j)->GetActor()->getPrevPosWithOffsetZ() - s).plusZ(28).Sum();
|
||||
if (x < closest && getPlayer(j)->GetActor()->spr.extra > 0)
|
||||
const auto jact = getPlayer(j)->GetActor();
|
||||
double x = (jact->getPrevPosWithOffsetZ() - s).plusZ(28).Sum();
|
||||
if (x < closest && jact->spr.extra > 0)
|
||||
{
|
||||
closest_player = j;
|
||||
closest = x;
|
||||
|
@ -279,15 +280,19 @@ int findplayer(const DDukeActor* actor, double* d)
|
|||
|
||||
int findotherplayer(int p, double* d)
|
||||
{
|
||||
const auto ppos = getPlayer(p)->GetActor()->getPosWithOffsetZ();
|
||||
int j, closest_player;
|
||||
|
||||
double closest = 0x7fffffff;
|
||||
closest_player = p;
|
||||
|
||||
for (j = connecthead; j >= 0; j = connectpoint2[j])
|
||||
if (p != j && getPlayer(j)->GetActor()->spr.extra > 0)
|
||||
{
|
||||
const auto jact = getPlayer(j)->GetActor();
|
||||
|
||||
if (p != j && jact->spr.extra > 0)
|
||||
{
|
||||
double x = (getPlayer(j)->GetActor()->getPrevPosWithOffsetZ() - getPlayer(p)->GetActor()->getPosWithOffsetZ()).Sum();
|
||||
double x = (jact->getPrevPosWithOffsetZ() - ppos).Sum();
|
||||
|
||||
if (x < closest)
|
||||
{
|
||||
|
@ -295,6 +300,7 @@ int findotherplayer(int p, double* d)
|
|||
closest = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*d = closest;
|
||||
return closest_player;
|
||||
|
|
Loading…
Reference in a new issue