From dcbbaf3e41574d89be0433ddecd8469db784d192 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Sun, 3 Nov 2024 13:47:36 +0000 Subject: [PATCH] lean reset on death, do Lean even when dead --- mp/src/game/client/in_main.cpp | 6 ++++++ mp/src/game/client/in_main.h | 2 ++ mp/src/game/client/neo/c_neo_player.cpp | 9 +++++++-- mp/src/game/server/neo/neo_player.cpp | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/mp/src/game/client/in_main.cpp b/mp/src/game/client/in_main.cpp index 19ff2bdd4..efb962598 100644 --- a/mp/src/game/client/in_main.cpp +++ b/mp/src/game/client/in_main.cpp @@ -552,6 +552,12 @@ void IN_LeanRightToggle(const CCommand& args) KeyUp(&in_lean_left, args[1]); } } + +void LeanReset() +{ + KeyUp(&in_lean_right, nullptr); + KeyUp(&in_lean_left, nullptr); +} #endif void IN_DuckToggle( const CCommand &args ) diff --git a/mp/src/game/client/in_main.h b/mp/src/game/client/in_main.h index 2e8fb9a51..f376bc90c 100644 --- a/mp/src/game/client/in_main.h +++ b/mp/src/game/client/in_main.h @@ -18,4 +18,6 @@ extern kbutton_t in_commandermousemove; extern kbutton_t in_ducktoggle; +void LeanReset(); + #endif // IN_MAIN_H diff --git a/mp/src/game/client/neo/c_neo_player.cpp b/mp/src/game/client/neo/c_neo_player.cpp index 1edc56326..4cea6c778 100644 --- a/mp/src/game/client/neo/c_neo_player.cpp +++ b/mp/src/game/client/neo/c_neo_player.cpp @@ -10,6 +10,7 @@ #include "dlight.h" #include "iinput.h" +#include "in_main.h" #include "clientmode_hl2mpnormal.h" #include @@ -914,7 +915,6 @@ void C_NEO_Player::PreThink( void ) } #endif // GLOWS_ENABLE } - Lean(); } else { @@ -924,6 +924,11 @@ void C_NEO_Player::PreThink( void ) } } + if (IsAlive() || m_vecLean != vec3_origin) + { + Lean(); + } + // Eek. See rationale for this thing in CNEO_Player::PreThink if (IsAirborne()) { @@ -1048,7 +1053,7 @@ void C_NEO_Player::PostThink(void) Weapon_SetZoom(false); m_bInVision = false; - m_bInLean = NEO_LEAN_NONE; + LeanReset(); if (IsLocalPlayer() && (GetTeamNumber() == TEAM_JINRAI || GetTeamNumber() == TEAM_NSF)) { diff --git a/mp/src/game/server/neo/neo_player.cpp b/mp/src/game/server/neo/neo_player.cpp index 72f56d177..f857deed1 100644 --- a/mp/src/game/server/neo/neo_player.cpp +++ b/mp/src/game/server/neo/neo_player.cpp @@ -727,7 +727,7 @@ void CNEO_Player::PreThink(void) m_flCamoAuxLastTime = 0; } - if (IsAlive()) + if (IsAlive() || m_vecLean != vec3_origin) { Lean(); }