From 10142eee6bbf84fd6657ddaa5dc195b8af97d49d Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 14 May 2020 07:38:15 +1000 Subject: [PATCH] RR: Move lastInputTicks from DukePlayer_t struct to PlayerData_t struct. Better location for it since it never needs to be sent across the wire in a multiplayer situation. It's now also located where the other properties to do with input being tied to frame-rate are located. --- source/rr/src/player.cpp | 16 ++++++++-------- source/rr/src/player.h | 3 ++- source/rr/src/premap.cpp | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source/rr/src/player.cpp b/source/rr/src/player.cpp index e12a3854e..6194e7989 100644 --- a/source/rr/src/player.cpp +++ b/source/rr/src/player.cpp @@ -3273,9 +3273,9 @@ void P_GetInput(int const playerNum) input.fvel -= info.dz * keyMove / analogExtent; auto const currentHiTicks = timerGetHiTicks(); - double const elapsedInputTicks = currentHiTicks - pPlayer->lastInputTicks; + double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks; - pPlayer->lastInputTicks = currentHiTicks; + thisPlayer.lastInputTicks = currentHiTicks; if (elapsedInputTicks == currentHiTicks) return; @@ -3671,9 +3671,9 @@ void P_GetInputMotorcycle(int playerNum) input.fvel -= info.dz * keyMove / analogExtent; auto const currentHiTicks = timerGetHiTicks(); - double const elapsedInputTicks = currentHiTicks - pPlayer->lastInputTicks; + double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks; - pPlayer->lastInputTicks = currentHiTicks; + thisPlayer.lastInputTicks = currentHiTicks; if (elapsedInputTicks == currentHiTicks) return; @@ -3925,9 +3925,9 @@ void P_GetInputBoat(int playerNum) input.fvel -= info.dz * keyMove / analogExtent; auto const currentHiTicks = timerGetHiTicks(); - double const elapsedInputTicks = currentHiTicks - pPlayer->lastInputTicks; + double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks; - pPlayer->lastInputTicks = currentHiTicks; + thisPlayer.lastInputTicks = currentHiTicks; if (elapsedInputTicks == currentHiTicks) return; @@ -4190,9 +4190,9 @@ void P_DHGetInput(int const playerNum) input.fvel -= info.dz * keyMove / analogExtent; auto const currentHiTicks = timerGetHiTicks(); - double const elapsedInputTicks = currentHiTicks - pPlayer->lastInputTicks; + double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks; - pPlayer->lastInputTicks = currentHiTicks; + thisPlayer.lastInputTicks = currentHiTicks; if (elapsedInputTicks == currentHiTicks) return; diff --git a/source/rr/src/player.h b/source/rr/src/player.h index cd6d357c8..d89515423 100644 --- a/source/rr/src/player.h +++ b/source/rr/src/player.h @@ -223,7 +223,7 @@ typedef struct { int32_t drug_timer; int32_t sea_sick; uint8_t hurt_delay2, nocheat; - double tilt_status, lastInputTicks; + double tilt_status; int32_t dhat60f, dhat613, dhat617, dhat61b, dhat61f; @@ -242,6 +242,7 @@ typedef struct int8_t horizSkew; bool lookLeft; bool lookRight; + double lastInputTicks; int32_t movefifoend, syncvalhead, myminlag; int32_t pcolor, pteam; diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index 467935c20..f75828b44 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -2471,7 +2471,7 @@ int G_EnterLevel(int gameMode) renderFlushPerms(); // reset lastInputTicks. - g_player[myconnectindex].ps->lastInputTicks = 0; + g_player[myconnectindex].lastInputTicks = 0; everyothertime = 0; g_globalRandom = 0;