- SW: Wrap calls that set PLAYER::PlayerPrevPosition.

This commit is contained in:
Mitchell Richters 2022-11-16 14:02:48 +11:00 committed by Christoph Oelckers
parent 2d351b2c28
commit ad7a626b92
4 changed files with 14 additions and 9 deletions

View file

@ -755,6 +755,11 @@ struct PLAYER
{
PlayerPrevPosition.Z = val;
}
void posprevSet(const DVector3& val)
{
PlayerPrevPosition = val;
}
};
extern PLAYER Player[MAX_SW_PLAYERS_REG+1];

View file

@ -58,7 +58,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang)
{
Player->posSet(DVector3(x,y,z));
Player->PlayerPrevPosition = Player->posGet();
Player->posprevSet(Player->posGet());
if (ang != DAngle::fromDeg(INT_MIN))
{

View file

@ -1313,7 +1313,7 @@ void DoPlayerTeleportToSprite(PLAYER* pp, DVector3& pos, DAngle ang)
{
pp->angle.ang = pp->angle.oang = ang;
pp->posSet(pos.plusZ(-PLAYER_HEIGHTF));
pp->PlayerPrevPosition = pos.plusZ(-PLAYER_HEIGHTF);
pp->posprevSet(pos.plusZ(-PLAYER_HEIGHTF));
pp->PlayerOldPosition.XY() = pp->posXY();
updatesector(pp->posGet(), &pp->cursector);
@ -3765,7 +3765,7 @@ void PlayerWarpUpdatePos(PLAYER* pp)
if (Prediction)
return;
pp->PlayerPrevPosition = pp->posGet();
pp->posprevSet(pp->posGet());
DoPlayerZrange(pp);
UpdatePlayerSprite(pp);
}
@ -4295,7 +4295,7 @@ void DoPlayerWarpToUnderwater(PLAYER* pp)
pp->posZset(under_act->sector()->ceilingz + 6);
pp->PlayerPrevPosition = pp->posGet();
pp->posprevSet(pp->posGet());
DoPlayerZrange(pp);
return;
@ -4371,7 +4371,7 @@ void DoPlayerWarpToSurface(PLAYER* pp)
pp->posZadd(-pp->WadeDepth);
pp->PlayerPrevPosition = pp->posGet();
pp->posprevSet(pp->posGet());
return;
}
@ -6830,7 +6830,7 @@ void MoveSkipSavePos(void)
{
pp = Player + pnum;
pp->PlayerPrevPosition = pp->posGet();
pp->posprevSet(pp->posGet());
pp->obob_z = pp->bob_z;
pp->angle.backup();
pp->horizon.backup();
@ -7187,7 +7187,7 @@ void InitAllPlayers(void)
for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++)
{
pp->posSet(pfirst->posGet());
pp->PlayerPrevPosition = pfirst->posGet();
pp->posprevSet(pfirst->posGet());
pp->angle.ang = pp->angle.oang = pfirst->angle.ang;
pp->horizon.horiz = pp->horizon.ohoriz = pfirst->horizon.horiz;
pp->cursector = pfirst->cursector;
@ -7348,7 +7348,7 @@ void PlayerSpawnPosition(PLAYER* pp)
ASSERT(spawn_sprite != nullptr);
pp->posSet(spawn_sprite->spr.pos);
pp->PlayerPrevPosition = pp->posGet();
pp->posprevSet(pp->posGet());
pp->angle.ang = pp->angle.oang = spawn_sprite->spr.angle;
pp->setcursector(spawn_sprite->sector());

View file

@ -574,7 +574,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER*
}
if (arc.isReading())
{
w.PlayerPrevPosition = w.posGet();
w.posprevSet(w.posGet());
w.ovect = w.vect;
w.obob_z = w.bob_z;
w.input = {};