本文整理汇总了C++中CCSPlayer类的典型用法代码示例。如果您正苦于以下问题:C++ CCSPlayer类的具体用法?C++ CCSPlayer怎么用?C++ CCSPlayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCSPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPlayerOwner
bool CWeaponCSBaseGun::Reload()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
return false;
if (pPlayer->GetAmmoCount( GetPrimaryAmmoType() ) <= 0)
return false;
int iResult = DefaultReload( GetMaxClip1(), GetMaxClip2(), ACT_VM_RELOAD );
if ( !iResult )
return false;
pPlayer->SetAnimation( PLAYER_RELOAD );
#ifndef CLIENT_DLL
if ((iResult) && (pPlayer->GetFOV() != pPlayer->GetDefaultFOV()))
{
pPlayer->SetFOV( pPlayer, pPlayer->GetDefaultFOV() );
}
#endif
m_flAccuracy = 0.2;
pPlayer->m_iShotsFired = 0;
m_bDelayFire = false;
pPlayer->SetShieldDrawnState( false );
return true;
}
示例2: GetPlayerOwner
float CWeaponScout::GetMaxSpeed() const
{
CCSPlayer *pPlayer = GetPlayerOwner();
if (pPlayer == NULL)
{
Assert(pPlayer != NULL);
return BaseClass::GetMaxSpeed();
}
if ( pPlayer->GetFOV() == pPlayer->GetDefaultFOV() )
return BaseClass::GetMaxSpeed();
else
return 220; // zoomed in.
}
示例3: GetPlayerOwner
bool CDEagle::Reload()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( pPlayer->GetAmmoCount( GetPrimaryAmmoType() ) <= 0 )
return false;
if ( !DefaultReload( 7, DEAGLE_RELOAD, 2.2 ) )
return false;
//m_pPlayer->SetAnimation( PLAYER_RELOAD );
m_flAccuracy = 0.9;
return true;
}
示例4: GetPlayerOwner
void CWeaponM4A1::M4A1Fire( float flSpread, float flCycleTime )
{
if ( !CSBaseGunFire( flSpread, flCycleTime ) )
return;
CCSPlayer *pPlayer = GetPlayerOwner();
if (pPlayer->GetAbsVelocity().Length2D() > 0)
KickBack (1.0, 0.45, 0.28, 0.045, 3.75, 3, 7);
else if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
KickBack (1.2, 0.5, 0.23, 0.15, 5.5, 3.5, 6);
else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
KickBack (0.6, 0.3, 0.2, 0.0125, 3.25, 2, 7);
else
KickBack (0.65, 0.35, 0.25, 0.015, 3.5, 2.25, 7);
}
示例5: GetPlayerOwner
bool CWeaponCSBase::IsUseable()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( Clip1() <= 0 )
{
if ( pPlayer->GetAmmoCount( GetPrimaryAmmoType() ) <= 0 && GetMaxClip1() != -1 )
{
// clip is empty (or nonexistant) and the player has no more ammo of this type.
return false;
}
}
return true;
}
示例6: GetPlayerOwner
void CWeaponSG552::SG552Fire( float flSpread, float flCycleTime )
{
if ( !CSBaseGunFire( flSpread, flCycleTime ) )
return;
CCSPlayer *pPlayer = GetPlayerOwner();
if (pPlayer->GetAbsVelocity().Length2D() > 0)
KickBack (1, 0.45, 0.28, 0.04, 4.25, 2.5, 7);
else if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
KickBack (1.25, 0.45, 0.22, 0.18, 6, 4, 5);
else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
KickBack (0.6, 0.35, 0.2, 0.0125, 3.7, 2, 10);
else
KickBack (0.625, 0.375, 0.25, 0.0125, 4, 2.25, 9);
}
示例7: GetPlayerOwner
bool CWeaponUSP::Reload()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if (pPlayer->GetAmmoCount( GetPrimaryAmmoType() ) <= 0)
return true;
int iResult = DefaultReload( 12, 0, ACT_VM_RELOAD );
if (!iResult)
return true;
pPlayer->SetAnimation( PLAYER_RELOAD );
m_flAccuracy = 0.92;
return true;
}
示例8: GetCurrentMaxGroundSpeed
float CCSPlayerAnimState::GetCurrentMaxGroundSpeed()
{
Activity currentActivity = m_pOuter->GetSequenceActivity( m_pOuter->GetSequence() );
if ( currentActivity == ACT_WALK || currentActivity == ACT_IDLE )
return ANIM_TOPSPEED_WALK;
else if ( currentActivity == ACT_RUN )
{
if ( m_pPlayer )
{
CBaseCombatWeapon *activeWeapon = m_pPlayer->GetActiveWeapon();
if ( activeWeapon )
{
CWeaponCSBase *csWeapon = dynamic_cast< CWeaponCSBase * >( activeWeapon );
if ( csWeapon )
{
return csWeapon->GetMaxSpeed();
}
}
}
return ANIM_TOPSPEED_RUN;
}
else if ( currentActivity == ACT_RUN_CROUCH )
return ANIM_TOPSPEED_RUN_CROUCH;
else
return 0;
}
示例9: GetPlayerOwner
void CWeaponG3SG1::PrimaryAttack()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
G3SG1Fire( (0.45) * (1 - m_flAccuracy), 0.25, false );
else if (pPlayer->GetAbsVelocity().Length2D() > 0)
G3SG1Fire( 0.15, 0.25, false );
else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
G3SG1Fire( (0.035) * (1 - m_flAccuracy), 0.25, false );
else
G3SG1Fire( (0.055) * (1 - m_flAccuracy), 0.25, false );
}
示例10: if
void CC4::PlayArmingBeeps( void )
{
float flStartTime = m_fArmedTime - WEAPON_C4_ARM_TIME;
float flProgress = ( gpGlobals->curtime - flStartTime ) / ( WEAPON_C4_ARM_TIME - 0.75 );
int currentFrame = (int)( (float)iNumArmingAnimFrames * flProgress );
int i;
for( i=0;i<NUM_BEEPS;i++ )
{
if( currentFrame <= m_iBeepFrames[i] )
{
break;
}
else if( !m_bPlayedArmingBeeps[i] )
{
m_bPlayedArmingBeeps[i] = true;
CCSPlayer *owner = GetPlayerOwner();
Vector soundPosition = owner->GetAbsOrigin() + Vector( 0, 0, 5 );
CPASAttenuationFilter filter( soundPosition );
filter.RemoveRecipient( owner );
// remove anyone that is first person spec'ing the planter
int i;
CBasePlayer *pPlayer;
for( i=1;i<=gpGlobals->maxClients;i++ )
{
pPlayer = UTIL_PlayerByIndex( i );
if ( !pPlayer )
continue;
if( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE && pPlayer->GetObserverTarget() == GetOwner() )
{
filter.RemoveRecipient( pPlayer );
}
}
EmitSound(filter, entindex(), "c4.click");
break;
}
}
}
示例11: MyTouch
bool MyTouch( CBasePlayer *pBasePlayer )
{
CCSPlayer *pPlayer = dynamic_cast< CCSPlayer* >( pBasePlayer );
if ( !pPlayer )
{
Assert( false );
return false;
}
pPlayer->m_iKevlar = 2; // player now has kevlar AND helmet
pPlayer->SetArmorValue( 100 );
CPASAttenuationFilter filter( pBasePlayer );
EmitSound( filter, entindex(), "BaseCombatCharacter.ItemPickup2" );
return true;
}
示例12: ToCSPlayer
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::TripmineAttach( void )
{
CCSPlayer *pOwner = ToCSPlayer( GetOwner() );
if (!pOwner)
{
return;
}
m_bAttachTripmine = false;
Vector vecSrc, vecAiming;
// Take the eye position and direction
vecSrc = pOwner->EyePosition();
QAngle angles = pOwner->GetLocalAngles();
AngleVectors( angles, &vecAiming );
trace_t tr;
UTIL_TraceLine( vecSrc, vecSrc + (vecAiming * 128), MASK_SOLID, pOwner, COLLISION_GROUP_NONE, &tr );
if (tr.fraction < 1.0)
{
CBaseEntity *pEntity = tr.m_pEnt;
if (pEntity && !(pEntity->GetFlags() & FL_CONVEYOR))
{
#ifndef CLIENT_DLL
QAngle angles;
VectorAngles(tr.plane.normal, angles);
angles.x += 90;
CBaseEntity *pEnt = CBaseEntity::Create( "npc_tripmine", tr.endpos + tr.plane.normal * 3, angles, NULL );
CTripmineGrenade *pMine = (CTripmineGrenade *)pEnt;
pMine->m_hOwner = GetOwner();
#endif
pOwner->RemoveAmmo( 1, m_iSecondaryAmmoType );
}
}
}
示例13: GetPlayerOwner
void CWeaponUSP::PrimaryAttack()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
return;
if ( m_bSilencerOn )
{
if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
USPFire( 1.3f * (1 - m_flAccuracy) );
else if (pPlayer->GetAbsVelocity().Length2D() > 5)
USPFire( 0.25f * (1 - m_flAccuracy) );
else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
USPFire( 0.125f * (1 - m_flAccuracy) );
else
USPFire( 0.15f * (1 - m_flAccuracy) );
}
else
{
if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
USPFire( 1.2f * (1 - m_flAccuracy ) );
else if (pPlayer->GetAbsVelocity().Length2D() > 5)
USPFire( 0.225f * (1 - m_flAccuracy) );
else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
USPFire( 0.08f * (1 - m_flAccuracy) );
else
USPFire( 0.1f * (1 - m_flAccuracy) );
}
}
示例14: GetPlayerOwner
void CC4::ItemPostFrame()
{
CCSPlayer *pPlayer = GetPlayerOwner();
// Disable all the firing code.. the C4 grenade is all custom.
if ( pPlayer->m_nButtons & IN_ATTACK )
{
PrimaryAttack();
}
else
{
WeaponIdle();
#ifndef CLIENT_DLL
pPlayer->ResetMaxSpeed();
#endif
}
}
示例15: GetPlayerOwner
void CWeaponElite::PrimaryAttack()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
return;
if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
ELITEFire( 1.3f * (1 - m_flAccuracy) );
else if (pPlayer->GetAbsVelocity().Length2D() > 5)
ELITEFire( 0.175f * (1 - m_flAccuracy) );
else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
ELITEFire( 0.08f * (1 - m_flAccuracy) );
else
ELITEFire( 0.1f * (1 - m_flAccuracy));
}