Skip to content
Merged
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
18 changes: 1 addition & 17 deletions src/game/client/c_baseanimating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3283,7 +3283,7 @@ int C_BaseAnimating::DrawModel( int flags )
Vector vel;
if (IsRagdoll())
{
vel = rootMoveParent->GetOldVelocity();
vel = m_pRagdoll->m_vecLastVelocity;
}
else
{
Expand Down Expand Up @@ -4753,22 +4753,6 @@ void C_BaseAnimating::RagdollMoved( void )
m_pRagdoll->GetRagdollBounds( mins, maxs );
SetCollisionBounds( mins, maxs );

#ifdef NEO
if (GetOldOrigin() != vec3_origin)
{
if (m_flLastOriginChangeTime != gpGlobals->curtime)
{
SetOldVelocity((GetAbsOrigin() - GetOldOrigin()) / (gpGlobals->curtime - m_flLastOriginChangeTime));
SetOldOrigin(GetAbsOrigin());
}
}
else
{ // First time
auto ragdoll = static_cast<C_HL2MPRagdoll*>(GetBaseAnimating());
SetOldVelocity(ragdoll->GetRagdollVelocity());
SetOldOrigin(GetAbsOrigin());
}
#endif // NEO
// If the ragdoll moves, its render-to-texture shadow is dirty
InvalidatePhysicsRecursive( ANIMATION_CHANGED );
}
Expand Down
7 changes: 0 additions & 7 deletions src/game/client/c_baseentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -1388,10 +1388,6 @@ class C_BaseEntity : public IClientEntity
void SetWaterType( int nType );

float GetElasticity( void ) const;
#ifdef NEO
inline void SetOldVelocity( const Vector& oldVelocity ) { m_vecOldVelocity = oldVelocity; }
inline const Vector& GetOldVelocity() const { return m_vecOldVelocity; };
#endif // NEO

int GetTextureFrameIndex( void );
void SetTextureFrameIndex( int iIndex );
Expand Down Expand Up @@ -1625,9 +1621,6 @@ class C_BaseEntity : public IClientEntity

Vector m_vecOldOrigin;
QAngle m_vecOldAngRotation;
#ifdef NEO
Vector m_vecOldVelocity;
#endif // NEO

Vector m_vecOrigin;
CInterpolatedVar< Vector > m_iv_vecOrigin;
Expand Down
7 changes: 7 additions & 0 deletions src/game/client/hl2mp/c_hl2mp_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,13 @@ void C_HL2MPRagdoll::CreateHL2MPRagdoll( void )
}

InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt );
#ifdef NEO
if (m_pRagdoll)
{
m_pRagdoll->SetInitialVelocity(GetInitialRagdollVelocity());
m_pRagdoll->SetLastOrigin(GetInitialRagdollOrigin());
}
#endif // NEO
}


Expand Down
3 changes: 2 additions & 1 deletion src/game/client/hl2mp/c_hl2mp_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ class C_HL2MPRagdoll : public C_BaseAnimatingOverlay
void UpdateOnRemove( void );
virtual void SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightCount, float *pFlexWeights, float *pFlexDelayedWeights );
#ifdef NEO
inline const Vector& GetRagdollVelocity(void) const { return m_vecRagdollVelocity.Get(); }
inline const Vector& GetInitialRagdollOrigin(void) const { return m_vecRagdollOrigin.Get(); }
inline const Vector& GetInitialRagdollVelocity(void) const { return m_vecRagdollVelocity.Get(); }
#ifdef CLIENT_DLL
virtual int DrawModel(int flags) override;
#endif // CLIENT_DLL
Expand Down
21 changes: 9 additions & 12 deletions src/game/client/proxyplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,19 +272,16 @@ void CEntitySpeedProxy::OnBind( void *pC_BaseEntity )

Assert( m_pResult );
#ifdef NEO
auto rootMoveParent = pEntity->GetRootMoveParent();
auto velocity = rootMoveParent->GetAbsVelocity();
if (velocity == vec3_origin)
C_BaseAnimating *baseAnimating = pEntity->GetBaseAnimating();
C_BaseEntity *rootMoveParent = pEntity->GetRootMoveParent();
Vector velocity = vec3_origin;
if (baseAnimating && baseAnimating->IsRagdoll())
{
C_BaseAnimating* baseAnimating = pEntity->GetBaseAnimating();
if (baseAnimating && baseAnimating->IsRagdoll())
{
velocity = pEntity->GetOldVelocity();
}
else
{
rootMoveParent->EstimateAbsVelocity(velocity);
}
velocity = baseAnimating->m_pRagdoll->m_vecLastVelocity;
}
else
{
rootMoveParent->EstimateAbsVelocity(velocity);
}
m_pResult->SetFloatValue(velocity.Length());
#else
Expand Down
11 changes: 10 additions & 1 deletion src/game/client/ragdoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ bool CRagdoll::TransformVectorToWorld(int iBoneIndex, const Vector *vPosition, V
//-----------------------------------------------------------------------------
void CRagdoll::PhysForceRagdollToSleep()
{
#ifdef NEO
m_vecLastVelocity = vec3_origin;
#endif // NEO
for ( int i = 0; i < m_ragdoll.listCount; i++ )
{
if ( m_ragdoll.list[i].pObject )
Expand All @@ -273,6 +276,12 @@ static ConVar ragdoll_sleepaftertime( "ragdoll_sleepaftertime", "5.0f", 0, "Afte
void CRagdoll::CheckSettleStationaryRagdoll()
{
Vector delta = GetRagdollOrigin() - m_vecLastOrigin;
#ifdef NEO
if (gpGlobals->frametime > 0)
{
m_vecLastVelocity = delta / (gpGlobals->frametime);
}
#endif // NEO
m_vecLastOrigin = GetRagdollOrigin();
for ( int i = 0; i < 3; ++i )
{
Expand All @@ -290,7 +299,7 @@ void CRagdoll::CheckSettleStationaryRagdoll()
return;

// Msg( "%d [%p] Settling\n", gpGlobals->tickcount, this );

// It has stopped moving, see if it
float dt = gpGlobals->curtime - m_flLastOriginChangeTime;
if ( dt < ragdoll_sleepaftertime.GetFloat() )
Expand Down
11 changes: 11 additions & 0 deletions src/game/client/ragdoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ class CRagdoll : public IRagdoll
void ResetRagdollSleepAfterTime( void );
float GetLastVPhysicsUpdateTime() const { return m_lastUpdate; }

#ifdef NEO
void SetInitialVelocity(const Vector& velocity) { m_vecInitialVelocity = velocity; }
void SetLastOrigin(const Vector& velocity) { m_vecLastOrigin = velocity; }

#endif // NEO
private:

void CheckSettleStationaryRagdoll();
Expand All @@ -101,6 +106,12 @@ class CRagdoll : public IRagdoll
bool m_allAsleep;
Vector m_vecLastOrigin;
float m_flLastOriginChangeTime;
#ifdef NEO
public:
Vector m_vecLastVelocity;
private:
Vector m_vecInitialVelocity;
#endif // NEO

#if RAGDOLL_VISUALIZE
matrix3x4_t m_savedBone1[MAXSTUDIOBONES];
Expand Down
Loading