コード例 #1
0
void CSDKPlayerShared::SetAimIn(bool bAimIn)
{
	// If we're aimed in and aimin is being turned off and we're aimed in enough to have noticed a change, train the aimin lesson.
	if (m_bAimedIn && !bAimIn && m_flAimIn > 0.5f)
	{
		CWeaponSDKBase* pWeapon = m_pOuter->GetActiveSDKWeapon();

		// Also must be holding an aimin weapon.
		if (pWeapon && (pWeapon->HasAimInFireRateBonus() || pWeapon->HasAimInRecoilBonus() || pWeapon->HasAimInSpeedPenalty()))
			m_pOuter->Instructor_LessonLearned("aimin");
	}

	m_bAimedIn = bAimIn;
}
コード例 #2
0
bool PlayerActiveWeaponHasAimInConditions( C_SDKPlayer *pPlayer, class CLesson *pLesson )
{
	if (!PlayerAliveConditions(pPlayer, pLesson))
		return false;

	CWeaponSDKBase* pWeapon = pPlayer->GetActiveSDKWeapon();

	if (!pWeapon)
		return false;

	if (pWeapon->HasAimInSpeedPenalty() || pWeapon->HasAimInFireRateBonus() || pWeapon->HasAimInRecoilBonus())
		return true;

	return false;
}
コード例 #3
0
void CDAHudCrosshair::CalculateCrosshair( void )
{
	C_SDKPlayer *pPlayer = C_SDKPlayer::GetLocalSDKPlayer();
	if ( !pPlayer )
		return;

	CWeaponSDKBase *pWeapon = pPlayer->GetActiveSDKWeapon();

	if (!pWeapon)
	{
		ResetCrosshair();
		return;
	}

	if ( !pWeapon->ShouldDrawCrosshair() )
	{
		ResetCrosshair();
		return;
	}

	Color clrHUD = Color( 200, 200, 200, 255 );
	clrHUD[3] = 255;
	Color white( 255, 255, 255, 255 );

	if ( pPlayer->m_Shared.GetAimIn() <= 0.5f || !pWeapon->HasAimInRecoilBonus() )
	{ 
		if ( pWeapon->GetWpnData().iconCrosshair )
			SetCrosshair( pWeapon->GetWpnData().iconCrosshair, clrHUD );
		else
			ResetCrosshair();
	}
	else
	{ 
		// zoomed crosshairs
		if ( pWeapon->GetWpnData().iconZoomedCrosshair )
			SetCrosshair( pWeapon->GetWpnData().iconZoomedCrosshair, white );
		else if ( pWeapon->GetWpnData().iconCrosshair )
			SetCrosshair( pWeapon->GetWpnData().iconCrosshair, clrHUD );
		else
			ResetCrosshair();
	}
}