diff --git a/src/game/client/c_baseanimating.cpp b/src/game/client/c_baseanimating.cpp index 0c7cb8a9c1..96bc29128b 100644 --- a/src/game/client/c_baseanimating.cpp +++ b/src/game/client/c_baseanimating.cpp @@ -1421,6 +1421,15 @@ void C_BaseAnimating::GetBoneControllers(float controllers[MAXSTUDIOBONECTRLS]) } } +#ifdef NEO +float C_BaseAnimating::GetBoneController(int iController) const +{ + if (IN_BETWEEN_AR(0, iController, MAXSTUDIOBONECTRLS)) + return m_flEncodedController[ iController ]; + return 0.f; +} +#endif // NEO + float C_BaseAnimating::GetPoseParameter( int iPoseParameter ) { CStudioHdr *pStudioHdr = GetModelPtr(); diff --git a/src/game/client/c_baseanimating.h b/src/game/client/c_baseanimating.h index 9550456046..4dbb769e75 100644 --- a/src/game/client/c_baseanimating.h +++ b/src/game/client/c_baseanimating.h @@ -119,6 +119,9 @@ class C_BaseAnimating : public C_BaseEntity, private IModelLoadCallback // Get bone controller values. virtual void GetBoneControllers(float controllers[MAXSTUDIOBONECTRLS]); +#ifdef NEO + float GetBoneController(int iController) const; +#endif // NEO virtual float SetBoneController ( int iController, float flValue ); LocalFlexController_t GetNumFlexControllers( void ); diff --git a/src/game/shared/Multiplayer/multiplayer_animstate.cpp b/src/game/shared/Multiplayer/multiplayer_animstate.cpp index f0fd3da2a3..b3d511d49e 100644 --- a/src/game/shared/Multiplayer/multiplayer_animstate.cpp +++ b/src/game/shared/Multiplayer/multiplayer_animstate.cpp @@ -2247,8 +2247,13 @@ void CMultiPlayerAnimState::ConvergeYawAngles( float flGoalYaw, float flYawRate, // Find the yaw delta. float flDeltaYaw = flGoalYaw - flCurrentYaw; +#ifdef NEO + flDeltaYaw = AngleNormalize( flDeltaYaw ); + float flDeltaYawAbs = fabs( flDeltaYaw ); +#else float flDeltaYawAbs = fabs( flDeltaYaw ); flDeltaYaw = AngleNormalize( flDeltaYaw ); +#endif // NEO // Always do at least a bit of the turn (1%). float flScale = 1.0f; diff --git a/src/game/shared/hl2mp/hl2mp_playeranimstate.cpp b/src/game/shared/hl2mp/hl2mp_playeranimstate.cpp index fdf0b80d8e..e34d4efd25 100644 --- a/src/game/shared/hl2mp/hl2mp_playeranimstate.cpp +++ b/src/game/shared/hl2mp/hl2mp_playeranimstate.cpp @@ -752,8 +752,13 @@ void CHL2MPPlayerAnimState::ComputePoseParam_AimYaw( CStudioHdr *pStudioHdr ) // Check to see if we are moving. bool bMoving = ( vecVelocity.Length() > 1.0f ) ? true : false; +#ifdef NEO + // If we are moving or leaning or are prone and undeployed. + if ( bMoving || m_bForceAimYaw || IsLeaning(pStudioHdr) ) +#else // If we are moving or are prone and undeployed. if ( bMoving || m_bForceAimYaw ) +#endif // NEO { // The feet match the eye direction when moving - the move yaw takes care of the rest. m_flGoalFeetYaw = m_flEyeYaw; @@ -819,13 +824,21 @@ void CHL2MPPlayerAnimState::ComputePoseParam_AimYaw( CStudioHdr *pStudioHdr ) // Turn off a force aim yaw - either we have already updated or we don't need to. m_bForceAimYaw = false; +#ifdef NEO + // NEO JANK (Adam) this fixes the stuttering animation when players turn their camera while their feet are planted in one spot. Probably not the right way to do it + // NEO TODO (Adam) I'm sure this is done server side only for a reason, also this doesn't work great if the local player is in third person, find correct fix for this? + QAngle angle = GetBasePlayer()->GetAbsAngles(); + angle[YAW] = m_flCurrentFeetYaw; + GetBasePlayer()->SetAbsAngles( angle ); +#else #ifndef CLIENT_DLL QAngle angle = GetBasePlayer()->GetAbsAngles(); angle[YAW] = m_flCurrentFeetYaw; GetBasePlayer()->SetAbsAngles( angle ); #endif +#endif // NEO } //----------------------------------------------------------------------------- @@ -870,6 +883,23 @@ float CHL2MPPlayerAnimState::GetCurrentMaxGroundSpeed() return speed; } +#ifdef NEO +bool CHL2MPPlayerAnimState::IsLeaning(CStudioHdr *pStudioHdr) +{ + if (CBaseAnimating* pBaseAnimating = GetBasePlayer()->GetBaseAnimating()) + { + constexpr int LEAN_BONE_CONTROLLER = 0; +#ifdef CLIENT_DLL + constexpr float BONE_CONTROLLER_VALUE_NOT_LEANING = 0.5f; +#else + constexpr int BONE_CONTROLLER_VALUE_NOT_LEANING = 0; +#endif // CLIENT_DLL + return pBaseAnimating->GetBoneController(LEAN_BONE_CONTROLLER) != BONE_CONTROLLER_VALUE_NOT_LEANING; + } + return false; +} +#endif // NEO + // ----------------------------------------------------------------------------- void CHL2MPPlayerAnimState::AnimStateLog(const char* pMsg, ...) { diff --git a/src/game/shared/hl2mp/hl2mp_playeranimstate.h b/src/game/shared/hl2mp/hl2mp_playeranimstate.h index f288dc067b..9a05125539 100644 --- a/src/game/shared/hl2mp/hl2mp_playeranimstate.h +++ b/src/game/shared/hl2mp/hl2mp_playeranimstate.h @@ -62,6 +62,10 @@ class CHL2MPPlayerAnimState : public CMultiPlayerAnimState virtual void ComputePoseParam_AimPitch( CStudioHdr *pStudioHdr ); virtual void ComputePoseParam_AimYaw( CStudioHdr *pStudioHdr ); +#ifdef NEO + bool IsLeaning(CStudioHdr *pStudioHdr); +#endif // NEO + CHL2MP_Player *m_pHL2MPPlayer; #ifndef NEO bool m_bInAirWalk;