本文整理汇总了C++中CCSPlayer::GetPunchAngle方法的典型用法代码示例。如果您正苦于以下问题:C++ CCSPlayer::GetPunchAngle方法的具体用法?C++ CCSPlayer::GetPunchAngle怎么用?C++ CCSPlayer::GetPunchAngle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCSPlayer
的用法示例。
在下文中一共展示了CCSPlayer::GetPunchAngle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SCOUTFire
void CWeaponScout::SCOUTFire( float flSpread )
{
CCSPlayer *pPlayer = GetPlayerOwner();
if (pPlayer == NULL)
{
Assert(pPlayer != NULL);
return;
}
// If we are not zoomed in, or we have very recently zoomed and are still transitioning, the bullet diverts more.
if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV() || (gpGlobals->curtime < m_zoomFullyActiveTime))
{
flSpread += 0.025;
}
if (pPlayer->GetFOV() != pPlayer->GetDefaultFOV())
{
pPlayer->m_bResumeZoom = true;
pPlayer->m_iLastZoom = pPlayer->GetFOV();
#ifndef CLIENT_DLL
pPlayer->SetFOV( pPlayer, pPlayer->GetDefaultFOV(), 0.05f );
#endif
}
if ( !CSBaseGunFire( flSpread, GetCSWpnData().m_flCycleTime, true ) )
return;
QAngle angle = pPlayer->GetPunchAngle();
angle.x -= 2;
pPlayer->SetPunchAngle( angle );
}
示例2: GetPlayerOwner
void CWeaponG3SG1::G3SG1Fire( float flSpread, float flCycleTime, bool fUseAutoAim )
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( pPlayer->GetFOV() == 90 )
flSpread += 0.025;
// Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
if (m_flLastFire == 0)
{
m_flLastFire = gpGlobals->curtime;
}
else
{
m_flAccuracy = 0.55 + (0.3) * (gpGlobals->curtime - m_flLastFire);
if (m_flAccuracy > 0.98)
m_flAccuracy = 0.98;
m_flLastFire = gpGlobals->curtime;
}
if ( !CSBaseGunFire( flSpread, flCycleTime ) )
return;
// Adjust the punch angle.
QAngle angle = pPlayer->GetPunchAngle();
angle.x -= SHARED_RANDOMFLOAT( 2.75, 3.25) + ( angle.x / 4 );
angle.y += SHARED_RANDOMFLOAT( -1.25, 1.5);
pPlayer->SetPunchAngle( angle );
}
示例3: KickBack
// GOOSEMAN : Kick the view..
void CWeaponCSBase::KickBack( float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change )
{
CCSPlayer *pPlayer = GetPlayerOwner();
float flKickUp;
float flKickLateral;
if (m_iShotsFired == 1) // This is the first round fired
{
flKickUp = up_base;
flKickLateral = lateral_base;
}
else
{
flKickUp = up_base + m_iShotsFired*up_modifier;
flKickLateral = lateral_base + m_iShotsFired*lateral_modifier;
}
QAngle angle = pPlayer->GetPunchAngle();
angle.x -= flKickUp;
if ( angle.x < -1 * up_max )
angle.x = -1 * up_max;
if ( m_iDirection == 1 )
{
angle.y += flKickLateral;
if (angle.y > lateral_max)
angle.y = lateral_max;
}
else
{
angle.y -= flKickLateral;
if ( angle.y < -1 * lateral_max )
angle.y = -1 * lateral_max;
}
if ( !SHARED_RANDOMINT( 0, direction_change ) )
m_iDirection = 1 - m_iDirection;
pPlayer->SetPunchAngle( angle );
}
示例4: ELITEFire
void CWeaponElite::ELITEFire( float flSpread )
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
return;
pPlayer->m_iShotsFired++;
if (pPlayer->m_iShotsFired > 1)
return;
// Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
m_flAccuracy -= (0.275)*(0.325 - (gpGlobals->curtime - m_flLastFire));
if (m_flAccuracy > 0.88)
m_flAccuracy = 0.88;
else if (m_flAccuracy < 0.55)
m_flAccuracy = 0.55;
m_flLastFire = gpGlobals->curtime;
if (m_iClip1 <= 0)
{
if (m_bFireOnEmpty)
{
PlayEmptySound();
m_flNextPrimaryAttack = gpGlobals->curtime + 0.2;
}
return;
}
m_iClip1--;
m_bFireRight = !m_bFireRight; // flip side
pPlayer->DoMuzzleFlash();
//SetPlayerShieldAnim();
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
FX_FireBullets(
pPlayer->entindex(),
pPlayer->Weapon_ShootPosition(),
pPlayer->EyeAngles() + 2.0f * pPlayer->GetPunchAngle(),
GetWeaponID(),
m_bFireRight?Primary_Mode:Secondary_Mode,
CBaseEntity::GetPredictionRandomSeed() & 255,
flSpread );
m_flNextPrimaryAttack = m_flNextSecondaryAttack = gpGlobals->curtime + GetCSWpnData().m_flCycleTime;
if (!m_iClip1 && pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) <= 0)
{
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", false, 0);
}
SetWeaponIdleTime( gpGlobals->curtime + 2.5 );
if ( m_bFireRight ) //even number
{
if ( m_iClip1 > 1 )
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
else
SendWeaponAnim( ACT_VM_DRYFIRE_LEFT );
}
else
{
if ( m_iClip1 > 0 )
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
else
SendWeaponAnim( ACT_VM_DRYFIRE );
}
QAngle punchAngle = pPlayer->GetPunchAngle();
punchAngle.x -= 2;
pPlayer->SetPunchAngle( punchAngle );
//ResetPlayerShieldAnim();
}
示例5: DEAGLEFire
void CDEagle::DEAGLEFire( float flSpread, float flCycleTime, bool fUseSemi )
{
CCSPlayer *pPlayer = GetPlayerOwner();
flCycleTime -= 0.075;
m_iShotsFired++;
if (m_iShotsFired > 1)
return;
// Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
if ( m_flLastFire == 0 )
{
m_flLastFire = gpGlobals->curtime;
}
else
{
m_flAccuracy -= (0.35)*(0.4 - ( gpGlobals->curtime - m_flLastFire ) );
if (m_flAccuracy > 0.9)
m_flAccuracy = 0.9;
else if (m_flAccuracy < 0.55)
m_flAccuracy = 0.55;
m_flLastFire = gpGlobals->curtime;
}
if (m_iClip1 <= 0)
{
if (m_bFireOnEmpty)
{
PlayEmptySound();
m_flNextPrimaryAttack = gpGlobals->curtime + 0.2;
}
return;
}
m_iClip1--;
pPlayer->m_fEffects |= EF_MUZZLEFLASH;
//SetPlayerShieldAnim();
// player "shoot" animation
//m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
//pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
//pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
Vector vecSrc = pPlayer->Weapon_ShootPosition();
Vector vecDir = pPlayer->FireBullets3(
vecSrc,
pPlayer->EyeAngles() + pPlayer->GetPunchAngle(),
flSpread,
4096,
2,
GetPrimaryAmmoType(),
54,
0.81,
pPlayer );
WeaponSound( SINGLE );
/*
#if defined( CLIENT_WEAPONS )
int flag = FEV_NOTHOST;
#else
int flag = 0;
#endif
PLAYBACK_EVENT_FULL( flag, m_pPlayer->edict(), m_usFireDeagle,
0.0, (float *)&g_vecZero, (float *)&g_vecZero,
vecDir.x,
vecDir.y,
m_pPlayer->pev->punchangle.x * 100,
m_pPlayer->pev->punchangle.y * 100,
m_iClip1 ? 0 : 1, 0 );
*/
m_flNextPrimaryAttack = gpGlobals->curtime + flCycleTime;
if ( !m_iClip1 && pPlayer->GetAmmoCount( GetPrimaryAmmoType() ) <= 0 )
{
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", false, 0);
}
m_flTimeWeaponIdle = gpGlobals->curtime + 1.8;
QAngle punchAngle = pPlayer->GetPunchAngle();
punchAngle.x -= 2;
pPlayer->SetPunchAngle( punchAngle );
//ResetPlayerShieldAnim();
}
示例6: USPFire
void CWeaponUSP::USPFire( float flSpread, float flCycleTime, bool fUseSemi )
{
CCSPlayer *pPlayer = GetPlayerOwner();
flCycleTime -= 0.075;
m_iShotsFired++;
if (m_iShotsFired > 1)
return;
// Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
if (m_flLastFire == 0)
m_flLastFire = gpGlobals->curtime;
else
{
m_flAccuracy -= (0.275)*(0.3 - (gpGlobals->curtime - m_flLastFire));
if (m_flAccuracy > 0.92)
m_flAccuracy = 0.92;
else if (m_flAccuracy < 0.6)
m_flAccuracy = 0.6;
m_flLastFire = gpGlobals->curtime;
}
if (m_iClip1 <= 0)
{
if (m_bFireOnEmpty)
{
PlayEmptySound();
m_flNextPrimaryAttack = gpGlobals->curtime + 0.2;
}
return;
}
m_flNextPrimaryAttack = m_flNextSecondaryAttack = gpGlobals->curtime + flCycleTime;
m_iClip1--;
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
int damageAmt;
if ( m_bSilencerOn )
{
WeaponSound( SPECIAL1 );
damageAmt = 30;
}
else
{
WeaponSound( SINGLE );
damageAmt = 34;
pPlayer->m_fEffects |= EF_MUZZLEFLASH;
}
Vector vecDir = pPlayer->FireBullets3(
pPlayer->Weapon_ShootPosition(),
pPlayer->EyeAngles() + pPlayer->GetPunchAngle(),
flSpread,
4096,
1,
GetPrimaryAmmoType(),
damageAmt,
0.79,
pPlayer );
/*
pPlayer->m_iWeaponVolume = BIG_EXPLOSION_VOLUME;
pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
int flag;
#if defined( CLIENT_WEAPONS )
flag = FEV_NOTHOST;
#else
flag = 0;
#endif
PLAYBACK_EVENT_FULL( flag, pPlayer->edict(), m_usFireUSP,
0.0, (float *)&g_vecZero, (float *)&g_vecZero,
vecDir.x,
vecDir.y,
pPlayer->pev->punchangle.x * 100, 0, m_iClip1 ? 0 : 1, (m_iWeaponState & WPNSTATE_USP_SILENCER_ON) ? 1 : 0 );
*/
if (!m_iClip1 && pPlayer->GetAmmoCount( GetPrimaryAmmoType() ) <= 0)
{
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", false, 0);
}
m_flTimeWeaponIdle = gpGlobals->curtime + 2;
QAngle angle = pPlayer->GetPunchAngle();
angle.x -= 2;
pPlayer->SetPunchAngle( angle );
}
示例7: CSBaseGunFire
bool CWeaponCSBaseGun::CSBaseGunFire( float flSpread, float flCycleTime, bool bPrimaryMode )
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
return false;
const CCSWeaponInfo &pCSInfo = GetCSWpnData();
m_bDelayFire = true;
pPlayer->m_iShotsFired++;
// These modifications feed back into flSpread eventually.
if ( pCSInfo.m_flAccuracyDivisor != -1 )
{
int iShotsFired = pPlayer->m_iShotsFired;
if ( pCSInfo.m_bAccuracyQuadratic )
iShotsFired = iShotsFired * iShotsFired;
else
iShotsFired = iShotsFired * iShotsFired * iShotsFired;
m_flAccuracy = ( iShotsFired / pCSInfo.m_flAccuracyDivisor) + pCSInfo.m_flAccuracyOffset;
if (m_flAccuracy > pCSInfo.m_flMaxInaccuracy)
m_flAccuracy = pCSInfo.m_flMaxInaccuracy;
}
// Out of ammo?
if ( m_iClip1 <= 0 )
{
if (m_bFireOnEmpty)
{
PlayEmptySound();
m_flNextPrimaryAttack = gpGlobals->curtime + 0.2;
}
return false;
}
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
m_iClip1--;
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
FX_FireBullets(
pPlayer->entindex(),
pPlayer->Weapon_ShootPosition(),
pPlayer->EyeAngles() + 2.0f * pPlayer->GetPunchAngle(),
GetWeaponID(),
bPrimaryMode?Primary_Mode:Secondary_Mode,
CBaseEntity::GetPredictionRandomSeed() & 255,
flSpread );
DoFireEffects();
m_flNextPrimaryAttack = m_flNextSecondaryAttack = gpGlobals->curtime + flCycleTime;
if (!m_iClip1 && pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) <= 0)
{
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", false, 0);
}
SetWeaponIdleTime( gpGlobals->curtime + pCSInfo.m_flTimeToIdleAfterFire );
return true;
}
示例8: USPFire
void CWeaponUSP::USPFire( float flSpread )
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
return;
float flCycleTime = GetCSWpnData().m_flCycleTime;
pPlayer->m_iShotsFired++;
if (pPlayer->m_iShotsFired > 1)
return;
// Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
m_flAccuracy -= (0.275)*(0.3 - (gpGlobals->curtime - m_flLastFire));
if (m_flAccuracy > 0.92)
m_flAccuracy = 0.92;
else if (m_flAccuracy < 0.6)
m_flAccuracy = 0.6;
m_flLastFire = gpGlobals->curtime;
if (m_iClip1 <= 0)
{
if (m_bFireOnEmpty)
{
PlayEmptySound();
m_flNextPrimaryAttack = gpGlobals->curtime + 0.2;
}
return;
}
m_flNextPrimaryAttack = m_flNextSecondaryAttack = gpGlobals->curtime + flCycleTime;
m_iClip1--;
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
if ( !m_bSilencerOn )
{
pPlayer->DoMuzzleFlash();
}
FX_FireBullets(
pPlayer->entindex(),
pPlayer->Weapon_ShootPosition(),
pPlayer->EyeAngles() + 2.0f * pPlayer->GetPunchAngle(),
GetWeaponID(),
m_bSilencerOn?Secondary_Mode:Primary_Mode,
CBaseEntity::GetPredictionRandomSeed() & 255,
flSpread );
if (!m_iClip1 && pPlayer->GetAmmoCount( GetPrimaryAmmoType() ) <= 0)
{
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", false, 0);
}
SetWeaponIdleTime( gpGlobals->curtime + 2 );
QAngle angle = pPlayer->GetPunchAngle();
angle.x -= 2;
pPlayer->SetPunchAngle( angle );
}