//------------------------------------------------------------------------------ // Purpose : // Input : // Output : //------------------------------------------------------------------------------ int CBaseAnimatingOverlay::AddGesture( Activity activity, bool autokill /*= true*/ ) { if ( IsPlayingGesture( activity ) ) { return FindGestureLayer( activity ); } MDLCACHE_CRITICAL_SECTION(); int seq = SelectWeightedSequence( activity ); if ( seq <= 0 ) { const char *actname = CAI_BaseNPC::GetActivityName( activity ); DevMsg( "CBaseAnimatingOverlay::AddGesture: model %s missing activity %s\n", STRING(GetModelName()), actname ); return -1; } int i = AddGestureSequence( seq, autokill ); Assert( i != -1 ); if ( i != -1 ) { m_AnimOverlay[ i ].m_nActivity = activity; } return i; }
//----------------------------------------------------------------------------- // Purpose: // Input : activity - //----------------------------------------------------------------------------- void CBaseAnimatingOverlay::RemoveGesture( Activity activity ) { int iLayer = FindGestureLayer( activity ); if ( iLayer == -1 ) return; RemoveLayer( iLayer ); }
//----------------------------------------------------------------------------- // Purpose: // Input : activity - //----------------------------------------------------------------------------- void CBaseAnimatingOverlay::RestartGesture( Activity activity, bool addifmissing /*=true*/, bool autokill /*=true*/ ) { int idx = FindGestureLayer( activity ); if ( idx == -1 ) { if ( addifmissing ) { AddGesture( activity, autokill ); } return; } m_AnimOverlay[ idx ].m_flCycle = 0.0f; m_AnimOverlay[ idx ].m_flPrevCycle = 0; }
//----------------------------------------------------------------------------- // Purpose: // Input : activity - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CBaseAnimatingOverlay::IsPlayingGesture( Activity activity ) { return FindGestureLayer( activity ) != -1 ? true : false; }