本文整理汇总了C++中CTFPlayer::GetCurrentCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFPlayer::GetCurrentCommand方法的具体用法?C++ CTFPlayer::GetCurrentCommand怎么用?C++ CTFPlayer::GetCurrentCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFPlayer
的用法示例。
在下文中一共展示了CTFPlayer::GetCurrentCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrimaryAttack
//-----------------------------------------------------------------------------
// Purpose: Attempt to heal any player within range of the medikit
//-----------------------------------------------------------------------------
void CWeaponMedigun::PrimaryAttack( void )
{
CTFPlayer *pOwner = ToTFPlayer( GetOwnerEntity() );
if ( !pOwner )
return;
if ( !CanAttack() )
return;
#ifdef GAME_DLL
/*
// Start boosting ourself if we're not
if ( m_bChargeRelease && !m_bHealingSelf )
{
pOwner->m_Shared.Heal( pOwner, GetHealRate() * 2 );
m_bHealingSelf = true;
}
*/
#endif
#if !defined (CLIENT_DLL)
if ( tf_medigun_lagcomp.GetBool() )
lagcompensation->StartLagCompensation( pOwner, pOwner->GetCurrentCommand() );
#endif
if ( FindAndHealTargets() )
{
// Start the animation
if ( !m_bHealing )
{
#ifdef GAME_DLL
pOwner->SpeakWeaponFire();
#endif
SendWeaponAnim( ACT_MP_ATTACK_STAND_PREFIRE );
pOwner->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRE );
}
m_bHealing = true;
}
else
{
RemoveHealingTarget();
}
#if !defined (CLIENT_DLL)
if ( tf_medigun_lagcomp.GetBool() )
lagcompensation->FinishLagCompensation( pOwner );
#endif
}
示例2: SecondaryAttack
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFFlameThrower::SecondaryAttack()
{
if ( !tf2c_airblast.GetBool() )
return;
int iNoAirblast = 0;
CALL_ATTRIB_HOOK_FLOAT( iNoAirblast, set_flamethrower_push_disabled );
if ( iNoAirblast )
return;
// Get the player owning the weapon.
CTFPlayer *pOwner = ToTFPlayer( GetPlayerOwner() );
if ( !pOwner )
return;
if ( !CanAttack() )
{
m_iWeaponState = FT_STATE_IDLE;
return;
}
#ifdef CLIENT_DLL
StopFlame();
#endif
m_iWeaponState = FT_STATE_AIRBLASTING;
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
WeaponSound( WPN_DOUBLE );
#ifdef CLIENT_DLL
if ( prediction->IsFirstTimePredicted() )
{
StartFlame();
}
#else
// Let the player remember the usercmd he fired a weapon on. Assists in making decisions about lag compensation.
pOwner->NoteWeaponFired();
pOwner->SpeakWeaponFire();
CTF_GameStats.Event_PlayerFiredWeapon( pOwner, false );
// Move other players back to history positions based on local player's lag
lagcompensation->StartLagCompensation( pOwner, pOwner->GetCurrentCommand() );
Vector vecDir;
QAngle angDir = pOwner->EyeAngles();
AngleVectors( angDir, &vecDir );
const Vector vecBlastSize = Vector( 128, 128, 64 );
// Picking max out of length, width, height for airblast distance.
float flBlastDist = max( max( vecBlastSize.x, vecBlastSize.y ), vecBlastSize.z );
Vector vecOrigin = pOwner->Weapon_ShootPosition() + vecDir * flBlastDist;
CBaseEntity *pList[64];
int count = UTIL_EntitiesInBox( pList, 64, vecOrigin - vecBlastSize, vecOrigin + vecBlastSize, 0 );
if ( tf2c_debug_airblast.GetBool() )
{
NDebugOverlay::Box( vecOrigin, -vecBlastSize, vecBlastSize, 0, 0, 255, 100, 2.0 );
}
for ( int i = 0; i < count; i++ )
{
CBaseEntity *pEntity = pList[i];
if ( !pEntity )
continue;
if ( pEntity == pOwner )
continue;
if ( !pEntity->IsDeflectable() )
continue;
// Make sure we can actually see this entity so we don't hit anything through walls.
trace_t tr;
UTIL_TraceLine( pOwner->Weapon_ShootPosition(), pEntity->WorldSpaceCenter(), MASK_SOLID, this, COLLISION_GROUP_DEBRIS, &tr );
if ( tr.fraction != 1.0f )
continue;
if ( pEntity->IsPlayer() )
{
if ( !pEntity->IsAlive() )
continue;
CTFPlayer *pTFPlayer = ToTFPlayer( pEntity );
Vector vecPushDir;
QAngle angPushDir = angDir;
// Push them at least 45 degrees up.
angPushDir[PITCH] = min( -45, angPushDir[PITCH] );
//.........这里部分代码省略.........
示例3: PrimaryAttack
//.........这里部分代码省略.........
if ( m_iParticleWaterLevel != -1 && pOwner->GetWaterLevel() != m_iParticleWaterLevel )
{
if ( m_iParticleWaterLevel == WL_Eyes || pOwner->GetWaterLevel() == WL_Eyes )
{
RestartParticleEffect();
}
}
#endif
#ifdef CLIENT_DLL
// Handle the flamethrower light
if (tf2c_muzzlelight.GetBool())
{
dlight_t *dl = effects->CL_AllocDlight(LIGHT_INDEX_MUZZLEFLASH + index);
dl->origin = vecMuzzlePos;
dl->color.r = 255;
dl->color.g = 100;
dl->color.b = 10;
dl->die = gpGlobals->curtime + 0.01f;
dl->radius = 240.f;
dl->decay = 512.0f;
dl->style = 5;
}
#endif
#if !defined (CLIENT_DLL)
// Let the player remember the usercmd he fired a weapon on. Assists in making decisions about lag compensation.
pOwner->NoteWeaponFired();
pOwner->SpeakWeaponFire();
CTF_GameStats.Event_PlayerFiredWeapon( pOwner, m_bCritFire );
// Move other players back to history positions based on local player's lag
lagcompensation->StartLagCompensation( pOwner, pOwner->GetCurrentCommand() );
#endif
float flFiringInterval = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
CALL_ATTRIB_HOOK_FLOAT( flFiringInterval, mult_postfiredelay );
// Don't attack if we're underwater
if ( pOwner->GetWaterLevel() != WL_Eyes )
{
// Find eligible entities in a cone in front of us.
Vector vOrigin = pOwner->Weapon_ShootPosition();
Vector vForward, vRight, vUp;
QAngle vAngles = pOwner->EyeAngles() + pOwner->GetPunchAngle();
AngleVectors( vAngles, &vForward, &vRight, &vUp );
#define NUM_TEST_VECTORS 30
#ifdef CLIENT_DLL
bool bWasCritical = m_bCritFire;
#endif
// Burn & Ignite 'em
int iDmgType = g_aWeaponDamageTypes[ GetWeaponID() ];
m_bCritFire = IsCurrentAttackACrit();
if ( m_bCritFire )
{
iDmgType |= DMG_CRITICAL;
}
#ifdef CLIENT_DLL
if ( bWasCritical != m_bCritFire )
{
RestartParticleEffect();