- Duke: Remove player_struct::posoldAdd() and player_struct::posoldGet().

This commit is contained in:
Mitchell Richters 2022-11-21 15:24:01 +11:00 committed by Christoph Oelckers
parent f10f1b9154
commit d1c5f9516f
7 changed files with 16 additions and 21 deletions

View file

@ -171,6 +171,11 @@ public:
return spr.pos.plusZ(viewzoffset);
}
DVector3 getPrevPosWithOffsetZ()
{
return opos.plusZ(oviewzoffset);
}
sectortype* sector() const
{
return spr.sectp;

View file

@ -3037,10 +3037,10 @@ void handle_se17(DDukeActor* actor)
{
int p = act3->PlayerIndex();
ps[p].posoldAdd(-ps[p].GetActor()->getPosWithOffsetZ());
ps[p].GetActor()->spr.pos.XY() += act2->spr.pos.XY() - actor->spr.pos.XY();
ps[p].GetActor()->spr.pos.Z += act2->sector()->floorz - sc->floorz;
ps[p].posoldAdd(ps[p].GetActor()->getPosWithOffsetZ());
act3->opos -= act3->spr.pos;
act3->spr.pos.XY() += act2->spr.pos.XY() - actor->spr.pos.XY();
act3->spr.pos.Z += act2->sector()->floorz - sc->floorz;
act3->opos += act3->spr.pos;
if (q > 0) ps[p].GetActor()->backupz();
@ -4417,7 +4417,7 @@ void movefta(void)
{
int r1 = krand();
int r2 = krand();
canseeme = cansee(act->spr.pos.plusZ(-(r2 & 31)), act->sector(), ps[p].posoldGet().plusZ(-(r1 & 31)), ps[p].cursector);
canseeme = cansee(act->spr.pos.plusZ(-(r2 & 31)), act->sector(), ps[p].GetActor()->getPrevPosWithOffsetZ().plusZ(-(r1 & 31)), ps[p].cursector);
}

View file

@ -273,7 +273,7 @@ void drawoverlays(double interpfrac)
}
else
{
cposxy = interpolatedvalue(pp->posoldGet(), pp->GetActor()->getPosWithOffsetZ(), interpfrac).XY();
cposxy = interpolatedvalue(pp->GetActor()->getPrevPosWithOffsetZ(), pp->GetActor()->getPosWithOffsetZ(), interpfrac).XY();
cang = !SyncInput() ? pp->angle.ang : interpolatedvalue(pp->angle.oang, pp->angle.ang, interpfrac);
}
}

View file

@ -226,7 +226,7 @@ int findplayer(const DDukeActor* actor, double* d)
if (ud.multimode < 2)
{
if (d) *d = (ps[myconnectindex].posoldGet() - s).plusZ(28).Sum();
if (d) *d = (ps[myconnectindex].GetActor()->getPrevPosWithOffsetZ() - s).plusZ(28).Sum();
return myconnectindex;
}
@ -235,7 +235,7 @@ int findplayer(const DDukeActor* actor, double* d)
for (j = connecthead; j >= 0; j = connectpoint2[j])
{
double x = (ps[j].posoldGet() - s).plusZ(28).Sum();
double x = (ps[j].GetActor()->getPrevPosWithOffsetZ() - s).plusZ(28).Sum();
if (x < closest && ps[j].GetActor()->spr.extra > 0)
{
closest_player = j;
@ -263,7 +263,7 @@ int findotherplayer(int p, double* d)
for (j = connecthead; j >= 0; j = connectpoint2[j])
if (p != j && ps[j].GetActor()->spr.extra > 0)
{
double x = (ps[j].posoldGet() - ps[p].GetActor()->getPosWithOffsetZ()).Sum();
double x = (ps[j].GetActor()->getPrevPosWithOffsetZ() - ps[p].GetActor()->getPosWithOffsetZ()).Sum();
if (x < closest)
{

View file

@ -1516,7 +1516,7 @@ void checksectors_d(int snum)
return;
}
if (p->newOwner != nullptr)
neartag(p->posoldGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->GetActor()->getPrevPosWithOffsetZ(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
else
{
neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);

View file

@ -2466,7 +2466,7 @@ void checksectors_r(int snum)
}
if (p->newOwner != nullptr)
neartag(p->posoldGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->GetActor()->getPrevPosWithOffsetZ(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
else
{
neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);

View file

@ -334,16 +334,6 @@ struct player_struct
{
bobpos = GetActor()->spr.pos.XY();
}
void posoldAdd(const DVector3& val)
{
GetActor()->opos += val;
}
DVector3 posoldGet()
{
return GetActor()->opos.plusZ(GetActor()->viewzoffset);
}
};
struct Cycler