Exemple #1
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	GunMount::StartFiring
//
//	PURPOSE:	Starts the firing state.
//
// ----------------------------------------------------------------------- //
bool GunMount::StartFiring( )
{
	CWeapon* pWeapon = m_Arsenal.GetCurWeapon( );
	if( !pWeapon )
		return false;

	// Play the fire animation if they have it.
	HMODELANIM hAnim = pWeapon->GetFireAni( );
	if( hAnim != INVALID_ANI )
	{
		pWeapon->PlayAnimation( hAnim, true, false );
	}

	// Fire the weapon.
	if( !FireWeapon( ))
	{
		return StartNotFiring( );
	}

	m_eFiringState = eFiring;

	SetNextUpdate( UPDATE_NEXT_FRAME );

	return true;
}
Exemple #2
0
void GunMount::UpdateFiring( )
{
	SetNextUpdate( UPDATE_NEXT_FRAME );

	// If we're done, then go to post fire.
	if( m_nRoundsToFire == 0 )
	{
		StartPostFiring( );
		return;
	}

	CWeapon* pWeapon = m_Arsenal.GetCurWeapon( );
	if( !pWeapon )
	{
		StartPostFiring( );
		return;
	}

	// Check if we had a fire anim to go off of.
	HMODELANIM hAnim = pWeapon->GetFireAni( );
	if( hAnim != INVALID_ANI )
	{
		// Check if we're still finishing the fire animation.
		if( !IsAnimationComplete( ))
			return;

		// Start it up for the next fire.
		pWeapon->PlayAnimation( hAnim, true, false );
	}

	// Continue to fire weapon.
	if( !FireWeapon( ))
	{
		StartPostFiring( );
		return;
	}
}
Exemple #3
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	GunMount::StartPostFiring
//
//	PURPOSE:	Starts the postfiring state.
//
// ----------------------------------------------------------------------- //
bool GunMount::StartPostFiring( )
{
	CWeapon* pWeapon = m_Arsenal.GetCurWeapon( );
	if( !pWeapon )
		return false;

	// Get the prefire animation.
	HMODELANIM hAnim = pWeapon->GetPostFireAni( );

	// If they don't have a postfire, just go to notfiring.
	if( hAnim == INVALID_ANI )
	{
		return StartNotFiring( );
	}

	// Begin prefire animation.
	pWeapon->PlayAnimation( hAnim, true, false );

	m_eFiringState = ePostFiring;

	SetNextUpdate( UPDATE_NEXT_FRAME );

	return true;
}