Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/game/client/c_baseanimating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/game/client/c_baseanimating.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
5 changes: 5 additions & 0 deletions src/game/shared/Multiplayer/multiplayer_animstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 30 additions & 0 deletions src/game/shared/hl2mp/hl2mp_playeranimstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -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, ...)
{
Expand Down
4 changes: 4 additions & 0 deletions src/game/shared/hl2mp/hl2mp_playeranimstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading