- Duke: Wrap calls that get player_struct::PlayerOldPosition.

This commit is contained in:
Mitchell Richters 2022-11-15 18:45:47 +11:00 committed by Christoph Oelckers
parent 1962d85f99
commit b0c95f69c5
11 changed files with 17 additions and 13 deletions

View file

@ -400,7 +400,7 @@ void moveplayers(void)
{
if (p->newOwner != nullptr) //Looking thru the camera
{
act->spr.pos = p->PlayerOldPosition.plusZ(gs.playerheight);
act->spr.pos = p->posoldGet().plusZ(gs.playerheight);
act->backupz();
act->spr.angle = p->angle.oang;
SetActor(act, act->spr.pos);
@ -4444,7 +4444,7 @@ void movefta(void)
{
int r1 = krand();
int r2 = krand();
canseeme = cansee(act->spr.pos.plusZ(-(r2 & 31)), act->sector(), ps[p].PlayerOldPosition.plusZ(-(r1 & 31)), ps[p].cursector);
canseeme = cansee(act->spr.pos.plusZ(-(r2 & 31)), act->sector(), ps[p].posoldGet().plusZ(-(r1 & 31)), ps[p].cursector);
}

View file

@ -165,7 +165,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
auto pp = &ps[h->PlayerIndex()];
if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner())
{
t->pos = interpolatedvalue(pp->PlayerOldPosition, pp->posGet(), interpfrac).plusZ(gs.playerheight);
t->pos = interpolatedvalue(pp->posoldGet(), pp->posGet(), interpfrac).plusZ(gs.playerheight);
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{

View file

@ -144,7 +144,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
auto pp = &ps[h->PlayerIndex()];
if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner())
{
t->pos = interpolatedvalue(pp->PlayerOldPosition, pp->posGet(), interpfrac).plusZ(gs.playerheight);
t->pos = interpolatedvalue(pp->posoldGet(), pp->posGet(), interpfrac).plusZ(gs.playerheight);
h->spr.scale = DVector2(0.375, 0.265625);
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))

View file

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

View file

@ -2860,7 +2860,7 @@ void processinput_d(int snum)
checklook(snum,actions);
double iif = 2.5;
auto oldpos = p->PlayerOldPosition;
auto oldpos = p->posoldGet();
if (p->on_crane != nullptr)
goto HORIZONLY;

View file

@ -3525,7 +3525,7 @@ void processinput_r(int snum)
checklook(snum, actions);
p->apply_seasick(1);
auto oldpos = p->PlayerOldPosition;
auto oldpos = p->posoldGet();
if (p->on_crane != nullptr)
goto HORIZONLY;

View file

@ -290,7 +290,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
}
else
{
cpos = interpolatedvalue(p->PlayerOldPosition, p->posGet(), interpfrac);
cpos = interpolatedvalue(p->posoldGet(), p->posGet(), interpfrac);
if (SyncInput())
{

View file

@ -226,7 +226,7 @@ int findplayer(const DDukeActor* actor, double* d)
if (ud.multimode < 2)
{
if (d) *d = (ps[myconnectindex].PlayerOldPosition - s).plusZ(28).Sum();
if (d) *d = (ps[myconnectindex].posoldGet() - 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].PlayerOldPosition - s).plusZ(28).Sum();
double x = (ps[j].posoldGet() - 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].PlayerOldPosition - ps[p].posGet()).Sum();
double x = (ps[j].posoldGet() - ps[p].posGet()).Sum();
if (x < closest)
{

View file

@ -1516,7 +1516,7 @@ void checksectors_d(int snum)
return;
}
if (p->newOwner != nullptr)
neartag(p->PlayerOldPosition, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->posoldGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
else
{
neartag(p->posGet(), 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->PlayerOldPosition, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->posoldGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
else
{
neartag(p->posGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);

View file

@ -427,6 +427,10 @@ struct player_struct
{
PlayerOldPosition += val;
}
DVector3 posoldGet()
{
return PlayerOldPosition;
}
};
struct Cycler