Esempio n. 1
0
//-----------------------------------------------------------------------------
// Purpose: Clear all pose parameters
//-----------------------------------------------------------------------------
void C_HL2MP_Player::InitializePoseParams( void )
{
	m_headYawPoseParam = LookupPoseParameter( "head_yaw" );
	GetPoseParameterRange( m_headYawPoseParam, m_headYawMin, m_headYawMax );

	m_headPitchPoseParam = LookupPoseParameter( "head_pitch" );
	GetPoseParameterRange( m_headPitchPoseParam, m_headPitchMin, m_headPitchMax );

	CStudioHdr *hdr = GetModelPtr();
	for ( int i = 0; i < hdr->GetNumPoseParameters() ; i++ )
	{
		SetPoseParameter( hdr, i, 0.0 );
	}
}
/** 
 * Set up attachment and pose param indices.
 * We can't do this in the constructor or Spawn() because the data isn't 
 * there yet.
 */
void C_CHostage::Initialize( )
{
	m_eyeAttachment = LookupAttachment( "eyes" );
	m_chestAttachment = LookupAttachment( "chest" );

	m_headYawPoseParam = LookupPoseParameter( "head_yaw" );
	GetPoseParameterRange( m_headYawPoseParam, m_headYawMin, m_headYawMax );

	m_headPitchPoseParam = LookupPoseParameter( "head_pitch" );
	GetPoseParameterRange( m_headPitchPoseParam, m_headPitchMin, m_headPitchMax );

	m_bodyYawPoseParam = LookupPoseParameter( "body_yaw" );
	GetPoseParameterRange( m_bodyYawPoseParam, m_bodyYawMin, m_bodyYawMax );

	Vector pos;
	QAngle angles;

	if (!GetAttachment( m_eyeAttachment, pos, angles ))
	{
		m_vecViewOffset = Vector( 0, 0, 50.0f );
	}
	else
	{
		m_vecViewOffset = pos - GetAbsOrigin();
	}


	if (!GetAttachment( m_chestAttachment, pos, angles ))
	{
		m_lookAt = Vector( 0, 0, 0 );
	}
	else
	{
		Vector forward;
		AngleVectors( angles, &forward );
		m_lookAt = EyePosition() + 100.0f * forward;
	}
}