mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-04 18:09:53 +03:00
add source-sdk-2013
This commit is contained in:
@@ -269,7 +269,7 @@ void CBasePlayerAnimState::ComputeMainSequence()
|
||||
int animDesired = SelectWeightedSequence( TranslateActivity(idealActivity) );
|
||||
|
||||
#if !defined( HL1_CLIENT_DLL ) && !defined ( HL1_DLL )
|
||||
if ( !ShouldResetMainSequence( pPlayer->GetSequence(), animDesired ) )
|
||||
if ( pPlayer->GetSequenceActivity( pPlayer->GetSequence() ) == pPlayer->GetSequenceActivity( animDesired ) )
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -289,13 +289,8 @@ void CBasePlayerAnimState::ComputeMainSequence()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CBasePlayerAnimState::ShouldResetMainSequence( int iCurrentSequence, int iNewSequence )
|
||||
{
|
||||
if ( !GetOuter() )
|
||||
return false;
|
||||
|
||||
return GetOuter()->GetSequenceActivity( iCurrentSequence ) != GetOuter()->GetSequenceActivity( iNewSequence );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CBasePlayerAnimState::UpdateAimSequenceLayers(
|
||||
@@ -378,9 +373,11 @@ void CBasePlayerAnimState::UpdateAimSequenceLayers(
|
||||
|
||||
void CBasePlayerAnimState::OptimizeLayerWeights( int iFirstLayer, int nLayers )
|
||||
{
|
||||
int i;
|
||||
|
||||
// Find the total weight of the blended layers, not including the idle layer (iFirstLayer)
|
||||
float totalWeight = 0.0f;
|
||||
for ( int i=1; i < nLayers; i++ )
|
||||
for ( i=1; i < nLayers; i++ )
|
||||
{
|
||||
CAnimationLayer *pLayer = m_pOuter->GetAnimOverlay( iFirstLayer+i );
|
||||
if ( pLayer->IsActive() && pLayer->m_flWeight > 0.0f )
|
||||
@@ -390,11 +387,11 @@ void CBasePlayerAnimState::OptimizeLayerWeights( int iFirstLayer, int nLayers )
|
||||
}
|
||||
|
||||
// Set the idle layer's weight to be 1 minus the sum of other layer weights
|
||||
CAnimationLayer *pLayerFirst = m_pOuter->GetAnimOverlay( iFirstLayer );
|
||||
if ( pLayerFirst->IsActive() && pLayerFirst->m_flWeight > 0.0f )
|
||||
CAnimationLayer *pLayer = m_pOuter->GetAnimOverlay( iFirstLayer );
|
||||
if ( pLayer->IsActive() && pLayer->m_flWeight > 0.0f )
|
||||
{
|
||||
pLayerFirst->m_flWeight = 1.0f - totalWeight;
|
||||
pLayerFirst->m_flWeight = MAX( (float)pLayerFirst->m_flWeight, 0.0f);
|
||||
pLayer->m_flWeight = 1.0f - totalWeight;
|
||||
pLayer->m_flWeight = MAX( (float)pLayer->m_flWeight, 0.0f);
|
||||
}
|
||||
|
||||
// This part is just an optimization. Since we have the walk/run animations weighted on top of
|
||||
@@ -403,7 +400,7 @@ void CBasePlayerAnimState::OptimizeLayerWeights( int iFirstLayer, int nLayers )
|
||||
//
|
||||
// So it saves us blending a couple animation layers whenever a guy is walking or running full speed.
|
||||
int iLastOne = -1;
|
||||
for ( int i=0; i < nLayers; i++ )
|
||||
for ( i=0; i < nLayers; i++ )
|
||||
{
|
||||
CAnimationLayer *pLayer = m_pOuter->GetAnimOverlay( iFirstLayer+i );
|
||||
if ( pLayer->IsActive() && pLayer->m_flWeight > 0.99 )
|
||||
@@ -1047,23 +1044,21 @@ void CBasePlayerAnimState::DebugShowAnimState( int iStartLine )
|
||||
m_angRender[YAW], g_flLastBodyYaw, g_flLastBodyPitch, m_vLastMovePose.x, m_vLastMovePose.y );
|
||||
}
|
||||
|
||||
if ( debugoverlay)
|
||||
{
|
||||
// Draw a red triangle on the ground for the eye yaw.
|
||||
float flBaseSize = 10;
|
||||
float flHeight = 80;
|
||||
Vector vBasePos = GetOuter()->GetAbsOrigin() + Vector( 0, 0, 3 );
|
||||
QAngle angles( 0, 0, 0 );
|
||||
angles[YAW] = m_flEyeYaw;
|
||||
Vector vForward, vRight, vUp;
|
||||
AngleVectors( angles, &vForward, &vRight, &vUp );
|
||||
debugoverlay->AddTriangleOverlay( vBasePos+vRight*flBaseSize/2, vBasePos-vRight*flBaseSize/2, vBasePos+vForward*flHeight, 255, 0, 0, 255, false, 0.01 );
|
||||
// Draw a red triangle on the ground for the eye yaw.
|
||||
float flBaseSize = 10;
|
||||
float flHeight = 80;
|
||||
Vector vBasePos = GetOuter()->GetAbsOrigin() + Vector( 0, 0, 3 );
|
||||
QAngle angles( 0, 0, 0 );
|
||||
angles[YAW] = m_flEyeYaw;
|
||||
Vector vForward, vRight, vUp;
|
||||
AngleVectors( angles, &vForward, &vRight, &vUp );
|
||||
debugoverlay->AddTriangleOverlay( vBasePos+vRight*flBaseSize/2, vBasePos-vRight*flBaseSize/2, vBasePos+vForward*flHeight, 255, 0, 0, 255, false, 0.01 );
|
||||
|
||||
// Draw a blue triangle on the ground for the body yaw.
|
||||
angles[YAW] = m_angRender[YAW];
|
||||
AngleVectors( angles, &vForward, &vRight, &vUp );
|
||||
debugoverlay->AddTriangleOverlay( vBasePos+vRight*flBaseSize/2, vBasePos-vRight*flBaseSize/2, vBasePos+vForward*flHeight, 0, 0, 255, 255, false, 0.01 );
|
||||
|
||||
// Draw a blue triangle on the ground for the body yaw.
|
||||
angles[YAW] = m_angRender[YAW];
|
||||
AngleVectors( angles, &vForward, &vRight, &vUp );
|
||||
debugoverlay->AddTriangleOverlay( vBasePos+vRight*flBaseSize/2, vBasePos-vRight*flBaseSize/2, vBasePos+vForward*flHeight, 0, 0, 255, 255, false, 0.01 );
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user