Example #1
0
	void SpriteAnimation::Stop(std::string &name)
	{
		CurrentAnim = GetAni(name);
		if (CurrentAnim) {
			CurrentAnim->isPlaying = false;
		}
	}
void CAnimatorPlayer::UpdateDims()
{
	HMODELANIM hAni = GetAni(m_eAniTrackerLower);
	
	if ( INVALID_MODEL_ANIM != hAni )
	{
		LTVector vDims;
		LTRESULT dResult = g_pLTServer->GetModelAnimUserDims(m_hObject, &vDims, hAni);
		_ASSERT(dResult == LT_OK);

		CPlayerObj* pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject(m_hObject);

		pPlayer->ForceDuck(LTFALSE);

		// If we could update the dims, or we're forcing the animation, set it

		if ( pPlayer->SetDims(&vDims, LTFALSE) /*|| IS DEATH ANI*/)
		{
		}
		else
		{
			// If we were ducking, and we tried to stand but couldn't, make us continue to duck

			if ((m_eLastMovement == eCrouching) && !(m_eMovement == eCrouching))
			{
				m_eMovement = eCrouching;
				pPlayer->ForceDuck(LTTRUE);
			}
			else
			{
			}
		}
	}
}
Example #3
0
	void SpriteAnimation::Play(std::string &name)
	{
		CurrentAnim = GetAni(name);
		if (CurrentAnim) {
			CurrentAnim->isPlaying = true;
		}
	}
Example #4
0
void CAnimator::SetAni(Ani eAni, AniTracker eAniTracker)
{
//	LTASSERT(eAni != eAniInvalid && eAniTracker != eAniTrackerInvalid, "Invalid tracker specified");
	if ( eAni == eAniInvalid || eAniTracker == eAniTrackerInvalid ) return;

	// Get the animation that's currently playing on the tracker

	HMODELANIM hCurAni = GetAni(eAniTracker);
	HMODELANIM hNewAni = m_ahAnis[eAni];

	if ( hCurAni != hNewAni )
	{
		// If they're different, play the new one

		if ( eAniTracker == eAniTrackerMain || eAniTracker == m_eAniTrackerDims )
		{
			if ( SetDims(hNewAni) )
			{
                LTRESULT dwResult = g_pModelLT->SetCurAnim(m_hObject, m_aAniTrackers[eAniTracker].m_AnimTracker, hNewAni, true);
				LTASSERT(LT_OK == dwResult, "Error when changing animations");
			}
		}
		else
		{
            LTRESULT dwResult = g_pModelLT->SetCurAnim(m_hObject, m_aAniTrackers[eAniTracker].m_AnimTracker, hNewAni, true);
			LTASSERT(LT_OK == dwResult, "Error when changing animations");
		}
	}
	else if ( hCurAni == hNewAni )
	{
		// If they're the same, reset it if it's done

		if ( IsAniTrackerDone(eAniTracker) )
		{
			ResetAniTracker(eAniTracker);
		}
	}
}