Пример #1
0
void CCinematicInput::OnAction( const EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	const CGameActions& gameActions = g_pGame->Actions();

	if (actionId == gameActions.attack1_cine)
	{
		CWeapon* pPrimaryWeapon = GetWeapon( eWeapon_Primary );
		if (pPrimaryWeapon != NULL)
		{
			pPrimaryWeapon->OnAction( actorId, actionId, activationMode, value );
		}
	}
	else if (actionId == gameActions.attack2_cine)
	{
		CWeapon* pSecondaryWeapon = GetWeapon( eWeapon_Secondary );
		if (pSecondaryWeapon != NULL)
		{
			pSecondaryWeapon->OnAction( actorId, actionId, activationMode, value );
		}
	}
	else if (actionId == gameActions.skip_cutscene)
	{
		const int playingSequences = gEnv->pMovieSystem->GetNumPlayingSequences();
		for (int i = 0; i < playingSequences; ++i)
		{
			IAnimSequence* pSeq = gEnv->pMovieSystem->GetPlayingSequence(i);
			if (pSeq && pSeq->GetFlags() & IAnimSequence::eSeqFlags_CutScene)
			{
				if (!(pSeq->GetFlags() & IAnimSequence::eSeqFlags_NoAbort))
				{
					gEnv->pMovieSystem->SetPlayingTime(pSeq, pSeq->GetTimeRange().end);
				}
			}
		}
	}
}
void CMPTrackViewManager::Server_SynchAnimationTimes(CGameRules::STrackViewParameters& params)
{
	IMovieSystem *pMovieSystem = gEnv->pMovieSystem;
	
	int count = 0;

	IAnimSequence* pSequence = NULL; 

	CryLog("CMPTrackViewManager::Server_SynchAnimationTimes()");

	for(int i = 0; i < CGameRules::STrackViewParameters::sMaxTrackViews; ++i)
	{
		if(i < pMovieSystem->GetNumPlayingSequences())
			pSequence = pMovieSystem->GetPlayingSequence(i);
		else
			pSequence = NULL;

		if( pSequence )
		{
			if (pSequence->GetFlags() & IAnimSequence::NO_MP_SYNCING_NEEDED)
			{
				CryLog("CMPTrackViewManager::Server_SynchAnimationTimes() skipping syncing of playing anim sequence %s (%s) as it has NO_MP_SYNCING_NEEDED flag set", pSequence->GetName(), pSequence->GetFullName());
				continue;
			}

			CryHashStringId id(pSequence->GetName());
			params.m_Ids[i] = id.id;

			float timeValue = pMovieSystem->GetPlayingTime(pSequence);
			params.m_Times[i] = timeValue;

			CryLog("CMPTrackViewManager::Server_SynchAnimationTimes() adding playing sequence %d %s at time %f", i, pSequence->GetName(), timeValue);

			++count;
		}
		else
		{
#ifndef _RELEASE
			if(count + m_FinishedTrackViewCount > CGameRules::STrackViewParameters::sMaxTrackViews)
			{
				CryWarning(VALIDATOR_MODULE_NETWORK, VALIDATOR_WARNING, "Trying to synch %i animations but system set to %i in GameRules.h",
					count + m_FinishedTrackViewCount, CGameRules::STrackViewParameters::sMaxTrackViews);
			}
#endif

			params.m_NumberOfFinishedTrackViews = m_FinishedTrackViewCount;
			for(int j = 0; j < m_FinishedTrackViewCount && i < CGameRules::STrackViewParameters::sMaxTrackViews; ++j, ++i)
			{
				params.m_Ids[i] = m_FinishedTrackViews[j];
				params.m_Times[i] = m_FinishedTrackViewTimes[j];
			
#ifndef _RELEASE
				IAnimSequence *pTrackviewSequence = FindTrackviewSequence(m_FinishedTrackViews[j]);
				CryLog("CMPTrackViewManager::Server_SynchAnimationTimes() adding finished sequence %d %s at time %f", i, pTrackviewSequence ? pTrackviewSequence->GetName() : "NULL", m_FinishedTrackViewTimes[j]);
#endif
			}

			break;
		}
	}

	params.m_NumberOfTrackViews = count;
	params.m_bInitialData = true;
}