From bf833fcfa376b19b01965a0e890baf8800105827 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 16 Nov 2022 13:55:07 +1100 Subject: [PATCH] - SW: Wrap calls to `PLAYER::PlayerPrevPosition.XY()`. --- source/games/sw/src/game.h | 5 +++++ source/games/sw/src/player.cpp | 6 +++--- source/games/sw/src/sprite.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 38f8b8b0e..86ca0fe01 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -745,6 +745,11 @@ struct PLAYER { return PlayerNowPosition; } + + DVector2& posprevXY() + { + return PlayerPrevPosition.XY(); + } }; extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 0923f5617..8b02dc172 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1328,7 +1328,7 @@ void DoPlayerTeleportToSprite(PLAYER* pp, DVector3& pos, DAngle ang) void DoPlayerTeleportToOffset(PLAYER* pp) { - pp->PlayerOldPosition.XY() = pp->PlayerPrevPosition.XY() = pp->posXY(); + pp->PlayerOldPosition.XY() = pp->posprevXY() = pp->posXY(); updatesector(pp->posGet(), &pp->cursector); pp->Flags2 |= (PF2_TELEPORTED); @@ -2167,7 +2167,7 @@ void DoPlayerMove(PLAYER* pp) auto sect = pp->cursector; if (interpolate_ride) { - pp->PlayerPrevPosition.XY() = pp->posXY(); + pp->posprevXY() = pp->posXY(); } pp->posAdd(pp->vect); updatesector(pp->posGet(), §); @@ -2192,7 +2192,7 @@ void DoPlayerMove(PLAYER* pp) if (interpolate_ride) { - pp->PlayerPrevPosition.XY() = pp->posXY(); + pp->posprevXY() = pp->posXY(); } auto save_cstat = actor->spr.cstat; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 5ad3aed8b..81831aaef 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1544,7 +1544,7 @@ void PreMapCombineFloors(void) if (itsect == dasect) { pp->posAdd(dv); - pp->PlayerPrevPosition.XY() = pp->PlayerOldPosition.XY() = pp->posXY(); + pp->posprevXY() = pp->PlayerOldPosition.XY() = pp->posXY(); break; } }