本文整理汇总了C++中CTFPlayer::GetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFPlayer::GetFlags方法的具体用法?C++ CTFPlayer::GetFlags怎么用?C++ CTFPlayer::GetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFPlayer
的用法示例。
在下文中一共展示了CTFPlayer::GetFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupMove
//-----------------------------------------------------------------------------
// Purpose: This is called pre player movement and copies all the data necessary
// from the player for movement. (Server-side, the client-side version
// of this code can be found in prediction.cpp.)
//-----------------------------------------------------------------------------
void CTFPlayerMove::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move )
{
CTFPlayer *pTFPlayer = ToTFPlayer( player );
if ( pTFPlayer )
{
// Check to see if we are a crouched, heavy, firing his weapons and zero out movement.
if ( pTFPlayer->GetPlayerClass()->IsClass( TF_CLASS_HEAVYWEAPONS ) )
{
if ( ( pTFPlayer->GetFlags() & FL_DUCKING ) && ( pTFPlayer->m_Shared.InCond( TF_COND_AIMING ) ) )
{
ucmd->forwardmove = 0.0f;
ucmd->sidemove = 0.0f;
}
}
}
BaseClass::SetupMove( player, ucmd, pHelper, move );
}
示例2: FindTarget
//-----------------------------------------------------------------------------
// Look for a target
//-----------------------------------------------------------------------------
bool CObjectSentrygun::FindTarget()
{
// Disable the sentry guns for ifm.
if ( tf_sentrygun_notarget.GetBool() )
return false;
if ( IsInCommentaryMode() )
return false;
// Sapper, etc.
if ( IsDisabled() )
return false;
// Loop through players within 1100 units (sentry range).
Vector vecSentryOrigin = EyePosition();
// Find the opposing team list.
CTFPlayer *pPlayer = ToTFPlayer( GetOwner() );
CUtlVector<CTFTeam *> pTeamList;
CTFTeam *pTeam = NULL;
//CTFTeam *pTeam = pPlayer->GetOpposingTFTeam();
//if ( !pTeam )
// return false;
if ( pPlayer )
{
// Try builder's team.
pTeam = pPlayer->GetTFTeam();
}
else
{
// If we have no builder use our own team number instead.
pTeam = GetTFTeam();
}
if ( pTeam )
pTeam->GetOpposingTFTeamList( &pTeamList );
else
return false;
// If we have an enemy get his minimum distance to check against.
Vector vecSegment;
Vector vecTargetCenter;
float flMinDist2 = 1100.0f * 1100.0f;
CBaseEntity *pTargetCurrent = NULL;
CBaseEntity *pTargetOld = m_hEnemy.Get();
float flOldTargetDist2 = FLT_MAX;
// Sentries will try to target players first, then objects. However, if the enemy held was an object it will continue
// to try and attack it first.
for (int i = 0; i < pTeamList.Size(); i++)
{
int nTeamCount = pTeamList[i]->GetNumPlayers();
for (int iPlayer = 0; iPlayer < nTeamCount; ++iPlayer)
{
CTFPlayer *pTargetPlayer = static_cast<CTFPlayer*>(pTeamList[i]->GetPlayer(iPlayer));
if (pTargetPlayer == NULL)
continue;
// Make sure the player is alive.
if (!pTargetPlayer->IsAlive())
continue;
if (pTargetPlayer->GetFlags() & FL_NOTARGET)
continue;
vecTargetCenter = pTargetPlayer->GetAbsOrigin();
vecTargetCenter += pTargetPlayer->GetViewOffset();
VectorSubtract(vecTargetCenter, vecSentryOrigin, vecSegment);
float flDist2 = vecSegment.LengthSqr();
// Store the current target distance if we come across it
if (pTargetPlayer == pTargetOld)
{
flOldTargetDist2 = flDist2;
}
// Check to see if the target is closer than the already validated target.
if (flDist2 > flMinDist2)
continue;
// It is closer, check to see if the target is valid.
if (ValidTargetPlayer(pTargetPlayer, vecSentryOrigin, vecTargetCenter))
{
flMinDist2 = flDist2;
pTargetCurrent = pTargetPlayer;
}
}
// If we already have a target, don't check objects.
if (pTargetCurrent == NULL)
{
int nTeamObjectCount = pTeamList[i]->GetNumObjects();
for (int iObject = 0; iObject < nTeamObjectCount; ++iObject)
{
//.........这里部分代码省略.........