//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *idealActivity - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CSDKPlayerAnimState::HandleMoving( Activity &idealActivity )
{	
	if (!(m_pSDKPlayer->GetFlags() & FL_ONGROUND) &&
		 m_pSDKPlayer->GetAbsVelocity ().z < -270)
	{
		idealActivity = ACT_DA_JUMP_FLOAT;
		return true;
	}

	float flSpeed = GetOuterXYSpeed();

	if ( flSpeed > 150 )
	{
		if (ShouldUseAimInAnims())
			idealActivity = ACT_DA_RUN_AIM;
		else if (m_pSDKPlayer->IsWeaponReady())
			idealActivity = ACT_DA_RUN_READY;
		else
			idealActivity = ACT_DA_RUN_IDLE;
	}
	else if ( flSpeed > MOVING_MINIMUM_SPEED )
	{
		if (ShouldUseAimInAnims())
			idealActivity = ACT_DA_WALK_AIM;
		else if (m_pSDKPlayer->IsWeaponReady())
			idealActivity = ACT_DA_WALK_READY;
		else
			idealActivity = ACT_DA_WALK_IDLE;
	}

	return true;
}
Example #2
0
Activity CSDKPlayerAnimState::CalcMainActivity()
{
	float flOuterSpeed = GetOuterXYSpeed();

	CSDKPlayer	*pPlayer = dynamic_cast<CSDKPlayer*>(GetBasePlayer());

	Activity idealActivity = ACT_IDLE;

	if (pPlayer->m_Shared.m_bIsShotCharging && mp_charging_animation_enabled.GetBool())
		return ACT_IOS_RUNCELEB;

	if ( HandleJumping(idealActivity) )
	{
		if (pPlayer->GetFlags() & FL_CELEB)
			return ACT_IOS_JUMPCELEB;							//cartwheel celeb
		//else if (pPlayer->m_nBody > 0)
		else if (pPlayer->m_Shared.GetAnimEvent() == PLAYERANIMEVENT_KEEPER_JUMP)
			return ACT_IDLE;//FIXME: Buggy jump animation: ACT_LEAP;									//keepers jump
		else
			return ACT_IDLE;//FIXME: Buggy jump animation: ACT_HOP;										//normal jump
	}
	else
	{
		if ( flOuterSpeed > MOVING_MINIMUM_SPEED )
		{
			if ( flOuterSpeed > (mp_runspeed.GetInt() + mp_sprintspeed.GetInt()) / 2.0f )
			{
				idealActivity = ACT_SPRINT;
			}
			else if ( flOuterSpeed > (mp_walkspeed.GetInt() + mp_runspeed.GetInt()) / 2.0f )
			{
				if (pPlayer->GetFlags() & FL_CELEB)		//now on layer
					idealActivity = ACT_IOS_RUNCELEB;
				else
					idealActivity = ACT_RUN;
			}
			else
			{
				idealActivity = ACT_WALK;
			}
		}
		else
		{
			idealActivity = ACT_IDLE;
		}

		return idealActivity;
	}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input  : *idealActivity -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPortalPlayerAnimState::HandleDucking( Activity &idealActivity )
{
    if ( GetBasePlayer()->m_Local.m_bDucking || GetBasePlayer()->m_Local.m_bDucked )
    {
        if ( GetOuterXYSpeed() < MOVING_MINIMUM_SPEED )
        {
            idealActivity = ACT_MP_CROUCH_IDLE;
        }
        else
        {
            idealActivity = ACT_MP_CROUCHWALK;
        }

        return true;
    }

    return false;
}
Example #4
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *idealActivity - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CHL2MPPlayerAnimState::HandleDucking( Activity &idealActivity )
{
	if ( m_pHL2MPPlayer->GetFlags() & FL_DUCKING )
	{
		if ( GetOuterXYSpeed() < MOVING_MINIMUM_SPEED )
		{
			idealActivity = ACT_MP_CROUCH_IDLE;		
		}
		else
		{
			idealActivity = ACT_MP_CROUCHWALK;		
		}

		return true;
	}
	
	return false;
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *idealActivity - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CSDKPlayerAnimState::HandleProne( Activity &idealActivity )
{
	if ( m_pSDKPlayer->m_Shared.IsProne() )
	{
		if ( GetOuterXYSpeed() < MOVING_MINIMUM_SPEED )
		{
			idealActivity = ACT_MP_PRONE_IDLE;		
		}
		else
		{
			idealActivity = ACT_MP_PRONE_CRAWL;		
		}

		return true;
	}
	
	return false;
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *idealActivity - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CTFPlayerAnimState::HandleDucking( Activity &idealActivity )
{
	if (GetBasePlayer()->GetFlags() & FL_DUCKING)
	{
		if ( GetOuterXYSpeed() < MOVING_MINIMUM_SPEED || m_pTFPlayer->m_Shared.IsLoser() )
		{
			idealActivity = ACT_MP_CROUCH_IDLE;		
			if ( m_pTFPlayer->m_Shared.InCond( TF_COND_AIMING ) || m_flHoldDeployedPoseUntilTime > gpGlobals->curtime )
			{
				idealActivity = ACT_MP_CROUCH_DEPLOYED_IDLE;
			}
		}
		else
		{
			idealActivity = ACT_MP_CROUCHWALK;		

			if ( m_pTFPlayer->m_Shared.InCond( TF_COND_AIMING ) )
			{
				// Don't do this for the heavy! we don't usually let him deployed crouch walk
				bool bIsMinigun = false;

				CTFPlayer *pPlayer = GetTFPlayer();
				if ( pPlayer && pPlayer->GetActiveTFWeapon() )
				{
					bIsMinigun = ( pPlayer->GetActiveTFWeapon()->GetWeaponID() == TF_WEAPON_MINIGUN );
				}

				if ( !bIsMinigun )
				{
					idealActivity = ACT_MP_CROUCH_DEPLOYED;
				}
			}
		}

		return true;
	}
	
	return false;
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *idealActivity - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CSDKPlayerAnimState::HandleDucking( Activity &idealActivity )
{
	if ( m_pSDKPlayer->GetFlags() & FL_DUCKING )
	{
		// falling crouch anims go here
		if ( !(m_pSDKPlayer->GetFlags() & FL_ONGROUND) )
		{
			if (ShouldUseAimInAnims())
				idealActivity = ACT_DA_CROUCH_AIM;
			else if (m_pSDKPlayer->IsWeaponReady())
				idealActivity = ACT_DA_CROUCH_READY;
			else
				idealActivity = ACT_DA_CROUCH_IDLE;		
		}
		else if ( GetOuterXYSpeed() < MOVING_MINIMUM_SPEED )
		{
			if (ShouldUseAimInAnims())
				idealActivity = ACT_DA_CROUCH_AIM;
			else if (m_pSDKPlayer->IsWeaponReady())
				idealActivity = ACT_DA_CROUCH_READY;
			else
				idealActivity = ACT_DA_CROUCH_IDLE;		
		}
		else
		{
			if (ShouldUseAimInAnims())
				idealActivity = ACT_DA_CROUCHWALK_AIM;
			else if (m_pSDKPlayer->IsWeaponReady())
				idealActivity = ACT_DA_CROUCHWALK_READY;
			else
				idealActivity = ACT_DA_CROUCHWALK_IDLE;		
		}

		return true;
	}

	return false;
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *idealActivity - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CTFPlayerAnimState::HandleMoving( Activity &idealActivity )
{
	float flSpeed = GetOuterXYSpeed();

	// If we move, cancel the deployed anim hold
	if ( flSpeed > MOVING_MINIMUM_SPEED )
	{
		m_flHoldDeployedPoseUntilTime = 0.0;
	}

	if ( m_pTFPlayer->m_Shared.IsLoser() )
	{
		return BaseClass::HandleMoving( idealActivity );
	}

	if ( m_pTFPlayer->m_Shared.InCond( TF_COND_AIMING ) ) 
	{
		if ( flSpeed > MOVING_MINIMUM_SPEED )
		{
			idealActivity = ACT_MP_DEPLOYED;
		}
		else
		{
			idealActivity = ACT_MP_DEPLOYED_IDLE;
		}
	}
	else if ( m_flHoldDeployedPoseUntilTime > gpGlobals->curtime )
	{
		// Unless we move, hold the deployed pose for a number of seconds after being deployed
		idealActivity = ACT_MP_DEPLOYED_IDLE;
	}
	else 
	{
		return BaseClass::HandleMoving( idealActivity );
	}

	return true;
}
Example #9
0
Activity CCSPlayerAnimState::CalcMainActivity()
{
	float flOuterSpeed = GetOuterXYSpeed();

	if ( HandleJumping() )
	{
		return ACT_HOP;
	}
	else
	{
		Activity idealActivity = ACT_IDLE;

		if ( m_pOuter->GetFlags() & FL_DUCKING )
		{
			if ( flOuterSpeed > MOVING_MINIMUM_SPEED )
				idealActivity = ACT_RUN_CROUCH;
			else
				idealActivity = ACT_CROUCHIDLE;
		}
		else
		{
			if ( flOuterSpeed > MOVING_MINIMUM_SPEED )
			{
				if ( flOuterSpeed > ARBITRARY_RUN_SPEED )
					idealActivity = ACT_RUN;
				else
					idealActivity = ACT_WALK;
			}
			else
			{
				idealActivity = ACT_IDLE;
			}
		}

		return idealActivity;
	}
}