//----------------------------------------------------------------------------- // Purpose: zero's out all non-restore safe fields // Output : //----------------------------------------------------------------------------- void CBaseAnimatingOverlay::OnRestore( ) { int i; // force order of unused layers to current MAX_OVERLAYS // and Tracker 48843 (Alyx skating after restore) restore the owner entity ptr (otherwise the network layer won't get NetworkStateChanged signals until the layer is re-Init()'ed for (i = 0; i < m_AnimOverlay.Count(); i++) { m_AnimOverlay[i].m_pOwnerEntity = this; if ( !m_AnimOverlay[i].IsActive()) { m_AnimOverlay[i].m_nOrder.Set( MAX_OVERLAYS ); } } // get rid of all layers that shouldn't be restored for (i = 0; i < m_AnimOverlay.Count(); i++) { if ( ( m_AnimOverlay[i].IsActive() && (m_AnimOverlay[i].m_fFlags & ANIM_LAYER_DONTRESTORE) ) || ( GetModelPtr() && !IsValidSequence(m_AnimOverlay[i].m_nSequence) ) ) { FastRemoveLayer( i ); } } BaseClass::OnRestore(); }
//----------------------------------------------------------------------------- // Purpose: Changes sequences when hurt. //----------------------------------------------------------------------------- int CCycler::OnTakeDamage( const CTakeDamageInfo &info ) { if (m_animate) { int nSequence = GetSequence() + 1; if ( !IsValidSequence(nSequence) ) { nSequence = 0; } ResetSequence( nSequence ); m_flCycle = 0; } else { m_flPlaybackRate = 1.0; StudioFrameAdvance (); m_flPlaybackRate = 0; Msg( "sequence: %d, frame %.0f\n", GetSequence(), m_flCycle ); } return 0; }