From 964557ab6bfd29c3d6521e3075c090cf942f3252 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 16 Nov 2022 13:35:26 +1100 Subject: [PATCH] - SW: Wrap calls that add to `PLAYER::PlayerNowPosition`. --- source/games/sw/src/game.h | 4 ++++ source/games/sw/src/mclip.cpp | 2 +- source/games/sw/src/player.cpp | 2 +- source/games/sw/src/sprite.cpp | 2 +- source/games/sw/src/track.cpp | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index cccf151c0..6d9a5bb5a 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -737,6 +737,10 @@ struct PLAYER { PlayerNowPosition = val; } + void posAdd(const DVector2& val) + { + PlayerNowPosition += val; + } }; extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index 6c0641b06..6ee915433 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -207,7 +207,7 @@ int RectClipMove(PLAYER* pp, DVector2* qpos) //Given the 4 points: x[4], y[4] if (testquadinsect(&point_num, xy, pp->cursector)) { - pp->PlayerNowPosition += pvect; + pp->posAdd(pvect); return true; } diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 2fc8aff88..a64a80845 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -2165,7 +2165,7 @@ void DoPlayerMove(PLAYER* pp) { pp->PlayerPrevPosition.XY() = pp->posXY(); } - pp->PlayerNowPosition += pp->vect; + pp->posAdd(pp->vect); updatesector(pp->PlayerNowPosition, §); if (sect != nullptr) pp->cursector = sect; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 0187cfcd6..48393f2e1 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1543,7 +1543,7 @@ void PreMapCombineFloors(void) { if (itsect == dasect) { - pp->PlayerNowPosition += dv; + pp->posAdd(dv); pp->PlayerPrevPosition.XY() = pp->PlayerOldPosition.XY() = pp->posXY(); break; } diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index f5bd97f24..3bedd63ad 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -1487,7 +1487,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, const DVector2& move) pp->RevolveDeltaAng = nullAngle; } - pp->PlayerNowPosition += move; + pp->posAdd(move); if ((sop->flags & SOBJ_DONT_ROTATE)) {