From 22077c5b50e36c4781c5679b460e56b952e9b82a Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 24 Sep 2023 15:53:39 +1000 Subject: [PATCH] - Ensure `crouch_toggle` is cleared when clearing all input. --- source/core/gameinput.cpp | 13 +++++++++++++ source/core/gameinput.h | 7 +------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index c52a79c75..844394fde 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -80,6 +80,19 @@ bool scaletozero(DAngle& angle, const double scale, const double push) } +//--------------------------------------------------------------------------- +// +// Clears entire game input state. +// +//--------------------------------------------------------------------------- + +void GameInput::Clear() +{ + memset(this, 0, sizeof(*this)); + crouch_toggle = false; +} + + //--------------------------------------------------------------------------- // // Player's movement function, called from game's ticker or from gi->doPlayerMovement() as required. diff --git a/source/core/gameinput.h b/source/core/gameinput.h index a86d64047..1cc8fa716 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -60,12 +60,6 @@ public: ActionsToSend |= action; } - // Clear all values within this object. - void Clear() - { - memset(this, 0, sizeof(*this)); - } - // Receives mouse input from OS for processing. void MouseAddToPos(float x, float y) { @@ -77,6 +71,7 @@ public: void processMovement(PlayerAngles* const plrAngles, const float scaleAdjust, const int drink_amt = 0, const bool allowstrafe = true, const float turnscale = 1.f); void processVehicle(PlayerAngles* const plrAngles, const float scaleAdjust, const float baseVel, const float velScale, const bool canMove, const bool canTurn, const bool attenuate); void getInput(const double scaleAdjust, InputPacket* packet = nullptr); + void Clear(); }; struct PlayerAngles