void CMountedGunController::ReplayStopThirdPersonAnimations( ICharacterInstance* pCharacter )
{
    assert(pCharacter);
    ISkeletonAnim *pSkeletonAnim = pCharacter->GetISkeletonAnim();
    assert(pSkeletonAnim);

    pSkeletonAnim->StopAnimationInLayer(REPLAY_PLAYER_ANIMATION_LAYER_AIM_UP, 0.1f);
    pSkeletonAnim->StopAnimationInLayer(REPLAY_PLAYER_ANIMATION_LAYER_AIM_DOWN, 0.1f);
}
Example #2
0
void CActionScope::StopAnimationOnLayer(uint32 layer, float blendTime)
{
    CRY_ASSERT_MESSAGE(layer < m_numLayers, "Overrunning scope!");

    ISkeletonAnim *pSkelAnim = m_scopeContext.charInst->GetISkeletonAnim();
    const uint32 actualLayer = layer + m_layer;
    pSkelAnim->StopAnimationInLayer(actualLayer, blendTime);
}
bool CAnimationProxyDualCharacterUpper::StopAnimationInLayer(IEntity *entity, int32 nLayer, f32 BlendOutTime)
{
    ICharacterInstance* pICharacter = entity->GetCharacter(m_characterMain);
    if (pICharacter)
        {
            ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
            ICharacterInstance* pIShadowCharacter = m_firstPersonMode ? entity->GetCharacter(m_characterShadow) : NULL;

            if (pIShadowCharacter)
                {
                    ISkeletonAnim* pIShadowSkeletonAnim = pIShadowCharacter->GetISkeletonAnim();

                    pIShadowSkeletonAnim->StopAnimationInLayer(nLayer, BlendOutTime);
                }

            return pISkeletonAnim->StopAnimationInLayer(nLayer, BlendOutTime);
        }

    return false;
}
Example #4
0
void CScriptbind_Entity::StopAnimationInLayer(IEntity *pEntity, int slot, int layer, float blendOutTime)
{
	ICharacterInstance *pCharacter = pEntity->GetCharacter(slot);
	if(!pCharacter)
		return;

	ISkeletonAnim *pSkeletonAnim = pCharacter->GetISkeletonAnim();
	if(!pSkeletonAnim)
		return;

	pSkeletonAnim->StopAnimationInLayer(layer, blendOutTime);
}
void CLipSyncProvider_TransitionQueue::StopLipSync(IEntityAudioProxy* pProxy, const AudioControlId audioTriggerId, const ELipSyncMethod lipSyncMethod)
{
	CRY_ASSERT(pProxy);
	CRY_ASSERT(audioTriggerId != INVALID_AUDIO_CONTROL_ID);
	CRY_ASSERT((m_state == eS_Started) || (m_state == eS_Requested) || (m_state == eS_Unpaused) || (m_state == eS_Paused));

	if (lipSyncMethod != eLSM_None)
	{
		if (m_state == eS_Requested)
		{
			CRY_ASSERT(m_soundId == INVALID_AUDIO_CONTROL_ID);
		}
		else
		{
			CRY_ASSERT(audioTriggerId == m_soundId);

			if (ICharacterInstance* pChar = GetCharacterInstance())
			{
				if (m_requestedAnimId >= 0)
				{
					ISkeletonAnim* skeletonAnimation = pChar->GetISkeletonAnim();

					// NOTE: there is no simple way to just stop the exact animation we started, but this should do too:
					bool success = skeletonAnimation->StopAnimationInLayer(m_nAnimLayer, LIPSYNC_STOP_TRANSITION_TIME);
					CRY_ASSERT(success);
				}
			}

			m_soundId        = INVALID_AUDIO_CONTROL_ID;
			m_isSynchronized = false;
		}

		m_cachedAnim = CAutoResourceCache_CAF();
	}
	m_state = eS_Stopped;
}
Example #6
0
void CActionScope::Resume(float forcedBlendTime, uint32 resumeFlags)
{
    if (!m_scopeContext.charInst)
    {
        return;
    }

    IAnimationSet *pAnimSet = m_scopeContext.charInst->GetIAnimationSet();
    if (!pAnimSet)
    {
        return;
    }

    ISkeletonAnim *pSkeletonAnim = m_scopeContext.charInst->GetISkeletonAnim();
    if (!pSkeletonAnim)
    {
        return;
    }

    const bool useDefaultBlendTime = (forcedBlendTime < 0);

    for (int i = 0; i < m_numLayers; ++i)
    {
        SSequencer &sequencer = m_layerSequencers[i];

        const int animationLayer = m_layer + i;
        const float blendTime = useDefaultBlendTime ? sequencer.blend.duration : forcedBlendTime;

        if (sequencer.savedAnimNormalisedTime < 0)
        {
            pSkeletonAnim->StopAnimationInLayer(animationLayer, blendTime);
        }
        else
        {
            const uint32 pos = sequencer.pos - 1;
            if (pos < sequencer.sequence.size())
            {
                SAnimClip& clip = sequencer.sequence[pos];
                const int animID = pAnimSet->GetAnimIDByCRC(clip.animation.animRef.crc);
                if (0 <= animID)
                {
                    CryCharAnimationParams params;
                    InitAnimationParams(clip.animation, i, clip.blend, params);
                    const bool installAnimationSuccess = InstallAnimation(animID, params);
                    if (installAnimationSuccess)
                    {
                        const int animationsInLayer = pSkeletonAnim->GetNumAnimsInFIFO(animationLayer);
                        CRY_ASSERT(1 <= animationsInLayer);

                        const bool loopingAnimation = ((clip.animation.flags & CA_LOOP_ANIMATION) != 0);
                        const uint32 restoreAnimationTimeFlagToCheck = loopingAnimation ? IActionController::ERF_RestoreLoopingAnimationTime : IActionController::ERF_RestoreNonLoopingAnimationTime;
                        const bool restoreAnimationTime = ((restoreAnimationTimeFlagToCheck & resumeFlags) != 0);
                        if (restoreAnimationTime)
                        {
                            const int lastAnimationIndex = animationsInLayer - 1;
                            CAnimation &animation = pSkeletonAnim->GetAnimFromFIFO(animationLayer, lastAnimationIndex);
                            pSkeletonAnim->SetAnimationNormalizedTime(&animation, sequencer.savedAnimNormalisedTime);
                        }
                    }
                }
            }
        }
    }
}