- Duke: Wrap calls to player_struct::PlayerOldPosition.Y.

This commit is contained in:
Mitchell Richters 2022-11-15 18:35:06 +11:00 committed by Christoph Oelckers
parent 823c5a7a47
commit 4027f7256d
5 changed files with 11 additions and 7 deletions

View file

@ -375,7 +375,7 @@ void movedummyplayers(void)
}
act->spr.pos.X += (ps[p].posX() - ps[p].posoldX());
act->spr.pos.Y += (ps[p].posY() - ps[p].PlayerOldPosition.Y);
act->spr.pos.Y += (ps[p].posY() - ps[p].posoldY());
SetActor(act, act->spr.pos);
}
}
@ -4420,7 +4420,7 @@ void movefta(void)
{
auto xyrand = []() -> double { return (64 - (krand() & 127)) * maptoworld; };
double px = ps[p].posoldX() - xyrand();
double py = ps[p].PlayerOldPosition.Y - xyrand();
double py = ps[p].posoldY() - xyrand();
updatesector(DVector3(px, py, 0), &psect);
if (psect == nullptr)
{

View file

@ -1335,7 +1335,7 @@ void movetransports_r(void)
else if (isRRRA() && k == 2)
{
ps[p].posoldX() = ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X;
ps[p].PlayerOldPosition.Y = ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].posoldY() = ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].backupxy();
if (Owner->GetOwner() != Owner)

View file

@ -383,8 +383,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_OPOSY:
if (bSet) ps[iPlayer].PlayerOldPosition.Y = lValue * maptoworld;
else SetGameVarID(lVar2, int(ps[iPlayer].PlayerOldPosition.Y * (1 / maptoworld)), sActor, sPlayer);
if (bSet) ps[iPlayer].posoldY() = lValue * maptoworld;
else SetGameVarID(lVar2, int(ps[iPlayer].posoldY() * (1 / maptoworld)), sActor, sPlayer);
break;
case PLAYER_OPOSZ:

View file

@ -766,12 +766,12 @@ void player_struct::backuppos(bool noclipping)
if (!noclipping)
{
posoldX() = posX();
PlayerOldPosition.Y = posY();
posoldY() = posY();
}
else
{
posX() = posoldX();
posY() = PlayerOldPosition.Y;
posY() = posoldY();
}
PlayerOldPosition.Z = posZget();

View file

@ -405,6 +405,10 @@ struct player_struct
{
return PlayerOldPosition.X;
}
double& posoldY()
{
return PlayerOldPosition.Y;
}
DVector2& posoldXY()
{
return PlayerOldPosition.XY();