本文整理汇总了C++中CCSPlayer::GetFOV方法的典型用法代码示例。如果您正苦于以下问题:C++ CCSPlayer::GetFOV方法的具体用法?C++ CCSPlayer::GetFOV怎么用?C++ CCSPlayer::GetFOV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCSPlayer
的用法示例。
在下文中一共展示了CCSPlayer::GetFOV方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ItemPostFrame
void CWeaponCSBaseGun::ItemPostFrame()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
return;
//GOOSEMAN : Return zoom level back to previous zoom level before we fired a shot. This is used only for the AWP.
// And Scout.
if ( (m_flNextPrimaryAttack <= gpGlobals->curtime) && (pPlayer->m_bResumeZoom == TRUE) )
{
#ifndef CLIENT_DLL
pPlayer->SetFOV( pPlayer, pPlayer->m_iLastZoom, 0.05f );
m_zoomFullyActiveTime = gpGlobals->curtime + 0.05f;// Make sure we think that we are zooming on the server so we don't get instant acc bonus
if ( pPlayer->GetFOV() == pPlayer->m_iLastZoom )
{
// return the fade level in zoom.
pPlayer->m_bResumeZoom = false;
}
#endif
}
BaseClass::ItemPostFrame();
}
示例3: Reload
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;
}
示例4: 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 );
}
示例5: GetMaxSpeed
float CWeaponSG552::GetMaxSpeed() const
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( pPlayer->GetFOV() == 90 )
return BaseClass::GetMaxSpeed();
else
return 200; // zoomed in.
}
示例6: SecondaryAttack
void CWeaponScout::SecondaryAttack()
{
#ifndef CLIENT_DLL
CCSPlayer *pPlayer = GetPlayerOwner();
if (pPlayer == NULL)
{
Assert(pPlayer != NULL);
return;
}
if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV())
{
pPlayer->SetFOV( pPlayer, 40, 0.15f );
}
else if (pPlayer->GetFOV() == 40)
{
pPlayer->SetFOV( pPlayer, 15, 0.05 );
}
else if (pPlayer->GetFOV() == 15)
{
pPlayer->SetFOV( pPlayer, pPlayer->GetDefaultFOV(), 0.05f );
}
pPlayer->ResetMaxSpeed();
#endif
m_flNextSecondaryAttack = gpGlobals->curtime + 0.3;
m_zoomFullyActiveTime = gpGlobals->curtime + 0.15; // The worst zoom time from above.
#ifndef CLIENT_DLL
// If this isn't guarded, the sound will be emitted twice, once by the server and once by the client.
// Let the server play it since if only the client plays it, it's liable to get played twice cause of
// a prediction error. joy.
EmitSound( "Default.Zoom" ); // zoom sound
// let the bots hear the rifle zoom
IGameEvent * event = gameeventmanager->CreateEvent( "weapon_zoom" );
if( event )
{
event->SetInt( "userid", pPlayer->GetUserID() );
gameeventmanager->FireEvent( event );
}
#endif
}
示例7: if
void CWeaponSG552::SecondaryAttack()
{
#ifndef CLIENT_DLL
CCSPlayer *pPlayer = GetPlayerOwner();
if (pPlayer->GetFOV() == 90)
{
pPlayer->SetFOV( 55 );
}
else if (pPlayer->GetFOV() == 55)
{
pPlayer->SetFOV( 90 );
}
else
{
pPlayer->SetFOV( 90 );
}
#endif
m_flNextSecondaryAttack = gpGlobals->curtime + 0.3;
}
示例8: GetMaxSpeed
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.
}
示例9: if
void CWeaponG3SG1::SecondaryAttack()
{
#ifndef CLIENT_DLL
CCSPlayer *pPlayer = GetPlayerOwner();
if ( pPlayer->GetFOV() == 90 )
{
pPlayer->SetFOV( 40 );
}
else if (pPlayer->GetFOV() == 40)
{
pPlayer->SetFOV( 15 );
}
else if (pPlayer->GetFOV() == 15)
{
pPlayer->SetFOV( 90 );
}
pPlayer->ResetMaxSpeed();
WeaponSound( SPECIAL3 ); // zoom sound
#endif
m_flNextSecondaryAttack = gpGlobals->curtime + 0.3;
}
示例10: ItemPostFrame
void CWeaponCSBase::ItemPostFrame()
{
CCSPlayer *pPlayer = GetPlayerOwner();
//GOOSEMAN : Return zoom level back to previous zoom level before we fired a shot. This is used only for the AWP.
if ( (m_flNextPrimaryAttack <= gpGlobals->curtime) && (pPlayer->m_bResumeZoom == TRUE) )
{
#ifndef CLIENT_DLL
pPlayer->SetFOV( pPlayer->m_iLastZoom );
if ( pPlayer->GetFOV() == pPlayer->m_iLastZoom )
{
// return the fade level in zoom.
pPlayer->m_bResumeZoom = false;
}
#endif
}
//GOOSEMAN : Delayed shell ejection code..
if ( (pPlayer->m_flEjectBrass != 0.0) && (pPlayer->m_flEjectBrass <= gpGlobals->curtime ) )
{
pPlayer->m_flEjectBrass = 0.0;
EjectBrassLate();
}
if ((m_bInReload) && (pPlayer->m_flNextAttack <= gpGlobals->curtime))
{
// complete the reload.
int j = min( GetMaxClip1() - m_iClip1, pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) );
// Add them to the clip
m_iClip1 += j;
pPlayer->RemoveAmmo( j, m_iPrimaryAmmoType );
m_bInReload = false;
}
if ((pPlayer->m_nButtons & IN_ATTACK2) && (m_flNextSecondaryAttack <= gpGlobals->curtime))
{
if ( m_iClip2 != -1 && !pPlayer->GetAmmoCount( GetSecondaryAmmoType() ) )
{
m_bFireOnEmpty = TRUE;
}
SecondaryAttack();
pPlayer->m_nButtons &= ~IN_ATTACK2;
}
else if ((pPlayer->m_nButtons & IN_ATTACK) && (m_flNextPrimaryAttack <= gpGlobals->curtime ))
{
if ( (m_iClip1 == 0/* && pszAmmo1()*/) || (GetMaxClip1() == -1 && !pPlayer->GetAmmoCount( GetPrimaryAmmoType() ) ) )
{
m_bFireOnEmpty = TRUE;
}
// Can't shoot during the freeze period
// Ken: Always allow firing in single player
//---
if ( !CSGameRules()->IsFreezePeriod() &&
!pPlayer->m_bIsDefusing &&
pPlayer->State_Get() == STATE_JOINED
)
{
PrimaryAttack();
}
//---
}
else if ( pPlayer->m_nButtons & IN_RELOAD && GetMaxClip1() != WEAPON_NOCLIP && !m_bInReload && m_flNextPrimaryAttack < gpGlobals->curtime)
{
// reload when reload is pressed, or if no buttons are down and weapon is empty.
//MIKETODO: add code for shields...
//if ( !FBitSet( m_iWeaponState, WPNSTATE_SHIELD_DRAWN ) )
Reload();
}
else if ( !(pPlayer->m_nButtons & (IN_ATTACK|IN_ATTACK2) ) )
{
// no fire buttons down
// The following code prevents the player from tapping the firebutton repeatedly
// to simulate full auto and retaining the single shot accuracy of single fire
if (m_bDelayFire == TRUE)
{
m_bDelayFire = FALSE;
if (m_iShotsFired > 15)
m_iShotsFired = 15;
m_flDecreaseShotsFired = gpGlobals->curtime + 0.4;
}
m_bFireOnEmpty = FALSE;
// if it's a pistol then set the shots fired to 0 after the player releases a button
if ( IsPistol() )
{
m_iShotsFired = 0;
}
else
{
if ( (m_iShotsFired > 0) && (m_flDecreaseShotsFired < gpGlobals->curtime) )
{
//.........这里部分代码省略.........