diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index 844394fde..67191431c 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -82,13 +82,12 @@ bool scaletozero(DAngle& angle, const double scale, const double push) //--------------------------------------------------------------------------- // -// Clears entire game input state. +// Clears crouch toggle state for new games. // //--------------------------------------------------------------------------- -void GameInput::Clear() +void GameInput::resetCrouchToggle() { - memset(this, 0, sizeof(*this)); crouch_toggle = false; } diff --git a/source/core/gameinput.h b/source/core/gameinput.h index 1cc8fa716..0dbb161be 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -60,6 +60,12 @@ 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) { @@ -71,7 +77,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(); + void resetCrouchToggle(); }; struct PlayerAngles diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index dc92475a4..21c86e5ad 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -156,6 +156,7 @@ void NewGame(MapRecord* map, int skill, bool ns = false) gi->NewGame(map, skill, ns); gameaction = ga_level; ResetStatusBar(); + gameInput.resetCrouchToggle(); }); }