From 1f807792afefc58ad4ad4bc37ac5566c5cab0ec4 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 14 May 2020 07:38:07 +1000 Subject: [PATCH] Duke3D: 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/duke3d/src/player.cpp | 4 ++-- source/duke3d/src/player.h | 5 ++--- source/duke3d/src/premap.cpp | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 4c473ff81..936dc8858 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -3135,9 +3135,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; diff --git a/source/duke3d/src/player.h b/source/duke3d/src/player.h index 5efc9266d..c431b2e2e 100644 --- a/source/duke3d/src/player.h +++ b/source/duke3d/src/player.h @@ -213,8 +213,6 @@ typedef struct { int8_t last_used_weapon; - double lastInputTicks; - #ifdef LUNATIC int8_t palsfadespeed, palsfadenext, palsfadeprio, padding2_; @@ -224,7 +222,7 @@ typedef struct { #endif int8_t crouch_toggle; - int8_t padding_[5]; + int8_t padding_[1]; } DukePlayer_t; // KEEPINSYNC lunatic/_defs_game.lua @@ -238,6 +236,7 @@ typedef struct int8_t horizSkew; bool lookLeft; bool lookRight; + double lastInputTicks; int32_t netsynctime; int16_t ping, filler; diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index edef023f0..d44583fe5 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -719,7 +719,6 @@ void P_ResetPlayer(int playerNum) p.jumping_toggle = 0; p.knee_incs = 0; p.knuckle_incs = 1; - p.lastInputTicks = 0; p.last_full_weapon = 0; p.last_pissed_time = 0; p.loogcnt = 0; @@ -781,6 +780,7 @@ void P_ResetPlayer(int playerNum) g_player[playerNum].horizRecenter = 0; g_player[playerNum].horizSkew = 0; g_player[playerNum].horizAngleAdjust = 0; + g_player[playerNum].lastInputTicks = 0; P_UpdateScreenPal(&p); VM_OnEvent(EVENT_RESETPLAYER, p.i, playerNum);