From 88018348041dc0784167f99509d91ec584818fda Mon Sep 17 00:00:00 2001 From: smallmodel <15067410+smallmodel@users.noreply.github.com> Date: Sun, 5 Jan 2025 02:20:43 +0100 Subject: [PATCH] Don't restart the legs animation from the beginning in the same state This prevent walking silently by switching weapons indefinitely --- code/fgame/player.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/code/fgame/player.cpp b/code/fgame/player.cpp index 6d82bcc1..437018a1 100644 --- a/code/fgame/player.cpp +++ b/code/fgame/player.cpp @@ -5530,7 +5530,23 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs) StopPartAnimating(legs); animdone_Legs = true; } else if (legsAnim != "") { - SetPartAnim(legsAnim, legs); + float oldTime; + + if (currentState_Legs == laststate_Legs) { + // + // Added in OPM + // This allows different animations in the same state + // to be continued at the same moment. + // This is used to avoid "ghost walking" where the player + // would switch weapons indefinitely to avoid footstep sounds + // + + oldTime = GetTime(m_iPartSlot[legs]); + SetPartAnim(legsAnim, legs); + SetTime(m_iPartSlot[legs], oldTime); + } else { + SetPartAnim(legsAnim, legs); + } } } else { currentState_Legs = laststate_Legs;