From f711355f2fa017bed1a24de432b141a6b5c9de44 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 16 Nov 2022 14:07:57 +1100 Subject: [PATCH] - SW: Wrap calls that get `PLAYER::PlayerPrevPosition`. --- source/games/sw/src/draw.cpp | 4 ++-- source/games/sw/src/game.h | 4 ++++ source/games/sw/src/jsector.cpp | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 15c90b99b..77466afd2 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -811,7 +811,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub else // Otherwise just interpolate the player sprite { pp = tActor->user.PlayerP; - tsp->pos = interpolatedvalue(pp->PlayerPrevPosition, pp->posGet(), interpfrac); + tsp->pos = interpolatedvalue(pp->posprevGet(), pp->posGet(), interpfrac); tsp->angle = pp->angle.interpolatedang(interpfrac); } } @@ -1240,7 +1240,7 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly) } // Get initial player position, interpolating if required. - DVector3 tpos = interpolatedvalue(camerapp->PlayerPrevPosition, camerapp->posGet(), interpfrac); + DVector3 tpos = interpolatedvalue(camerapp->posprevGet(), camerapp->posGet(), interpfrac); if (SyncInput() || pp != Player+myconnectindex) { tang = camerapp->angle.interpolatedsum(interpfrac); diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 5492902c6..b303a97dc 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -760,6 +760,10 @@ struct PLAYER { PlayerPrevPosition = val; } + DVector3 posprevGet() + { + return PlayerPrevPosition; + } }; extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index cacfea541..5547b6d8a 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -598,7 +598,7 @@ void JS_DrawCameras(PLAYER* pp, const DVector3& campos, double smoothratio) // If player is dead still then update at MoveSkip4 // rate. - if (pp->posGet() == pp->PlayerPrevPosition) + if (pp->posGet() == pp->posprevGet()) DoCam = true;