本文整理汇总了C++中pszAmmo1函数的典型用法代码示例。如果您正苦于以下问题:C++ pszAmmo1函数的具体用法?C++ pszAmmo1怎么用?C++ pszAmmo1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pszAmmo1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanDeploy
/*
=====================
CBasePlayerWeapon :: CanDeploy
=====================
*/
bool CBasePlayerWeapon::CanDeploy() const
{
bool bHasAmmo = false;
if ( !pszAmmo1() )
{
// this weapon doesn't use ammo, can always deploy.
return true;
}
if ( pszAmmo1() )
{
bHasAmmo |= (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] != 0);
}
if ( pszAmmo2() )
{
bHasAmmo |= (m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] != 0);
}
if (m_iClip > 0)
{
bHasAmmo |= 1;
}
if (!bHasAmmo)
{
return false;
}
return true;
}
示例2: CanDeploy
BOOL CBasePlayerWeapon :: CanDeploy( void )
{
BOOL bHasAmmo = 0;
if ( !pszAmmo1() )
{
// this weapon doesn't use ammo, can always deploy.
return TRUE;
}
if ( pszAmmo1() )
{
bHasAmmo |= (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] != 0);
}
if ( pszAmmo2() )
{
bHasAmmo |= (m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] != 0);
}
if (m_iClip > 0)
{
bHasAmmo |= 1;
}
if (!bHasAmmo)
{
return FALSE;
}
return TRUE;
}
示例3: iMaxClip
//=========================================================
// called by the new item with the existing item as parameter
//
// if we call ExtractAmmo(), it's because the player is picking up this type of weapon for
// the first time. If it is spawned by the world, m_iDefaultAmmo will have a default ammo amount in it.
// if this is a weapon dropped by a dying player, has 0 m_iDefaultAmmo, which means only the ammo in
// the weapon clip comes along.
//=========================================================
int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon )
{
int iReturn;
if ( pszAmmo1() != NULL )
{
// blindly call with m_iDefaultAmmo. It's either going to be a value or zero. If it is zero,
// we only get the ammo in the weapon's clip, which is what we want.
iReturn = pWeapon->AddPrimaryAmmo( m_iDefaultAmmo, (char *)pszAmmo1(), iMaxClip(), iMaxAmmo1() );
m_iDefaultAmmo = 0;
}
if ( pszAmmo2() != NULL )
{
iReturn = pWeapon->AddSecondaryAmmo( 0, (char *)pszAmmo2(), iMaxAmmo2() );
}
return iReturn;
}
示例4: iMaxAmmo1
//=========================================================
// called by the new item's class with the existing item as parameter
//=========================================================
int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon )
{
int iAmmo;
if ( m_iClip == WEAPON_NOCLIP )
{
iAmmo = 0;// guns with no clips always come empty if they are second-hand
}
else
{
iAmmo = m_iClip;
}
return pWeapon->m_pPlayer->GiveAmmo( iAmmo, (char *)pszAmmo1(), iMaxAmmo1() ); // , &m_iPrimaryAmmoType
}
示例5: pszAmmo1
int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer )
{
int bResult = CBasePlayerItem::AddToPlayer( pPlayer );
pPlayer->pev->weapons |= (1<<m_iId);
if ( !m_iPrimaryAmmoType )
{
m_iPrimaryAmmoType = pPlayer->GetAmmoIndex( pszAmmo1() );
m_iSecondaryAmmoType = pPlayer->GetAmmoIndex( pszAmmo2() );
}
if (bResult)
return AddWeapon( );
return FALSE;
}
示例6: pszAmmo1
int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer )
{
if (!UTIL_IsMasterTriggered(m_sMaster, pPlayer)) //
return FALSE; // AJH allows for locked weapons
int bResult = CBasePlayerItem::AddToPlayer( pPlayer );
pPlayer->pev->weapons |= (1<<m_iId);
if ( !m_iPrimaryAmmoType )
{
m_iPrimaryAmmoType = pPlayer->GetAmmoIndex( pszAmmo1() );
m_iSecondaryAmmoType = pPlayer->GetAmmoIndex( pszAmmo2() );
}
if (bResult)
{
return AddWeapon( );
}
return FALSE;
}
示例7: BuyAmmo
void CShotgun::BuyPrimaryAmmo( void )
{
BuyAmmo(8, (char*)pszAmmo1(), COST_ASSAULT_AMMO);
}
示例8: WeaponTick
/*
=====================
CBasePlayerWeapon::ItemPostFrame
Handles weapon firing, reloading, etc.
=====================
*/
void CBasePlayerWeapon::ItemPostFrame( void )
{
WeaponTick();
if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase() ) )
{
#ifdef SERVER_DLL // FIXME, need ammo on client to make this work right
// complete the reload.
int j = min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[ PrimaryAmmoIndex() ] );
// Add them to the clip
m_iClip += j;
m_pPlayer->m_rgAmmo[ PrimaryAmmoIndex() ] -= j;
#else
m_iClip += 10;
#endif
m_fInReload = false;
}
#ifdef SERVER_DLL
if( !m_pPlayer->GetButtons().Any( IN_ATTACK ) )
{
m_flLastFireTime = 0.0f;
}
#endif
if( m_pPlayer->GetButtons().Any( IN_ATTACK2 ) && CanAttack( m_flNextSecondaryAttack, gpGlobals->time, IsPredicted() ) )
{
if( pszAmmo2() && !m_pPlayer->m_rgAmmo[ SecondaryAmmoIndex() ] )
{
m_bFireOnEmpty = true;
}
SecondaryAttack();
m_pPlayer->GetButtons().ClearFlags( IN_ATTACK2 );
}
else if( m_pPlayer->GetButtons().Any( IN_ATTACK ) && CanAttack( m_flNextPrimaryAttack, gpGlobals->time, IsPredicted() ) )
{
if( ( m_iClip == 0 && pszAmmo1() ) || ( iMaxClip() == -1 && !m_pPlayer->m_rgAmmo[ PrimaryAmmoIndex() ] ) )
{
m_bFireOnEmpty = true;
}
PrimaryAttack();
}
else if( m_pPlayer->GetButtons().Any( IN_RELOAD ) && iMaxClip() != WEAPON_NOCLIP && !m_fInReload )
{
// reload when reload is pressed, or if no buttons are down and weapon is empty.
Reload();
}
else if( !m_pPlayer->GetButtons().Any( IN_ATTACK | IN_ATTACK2 ) )
{
// no fire buttons down
m_bFireOnEmpty = false;
//Only the server checks for weapon switching. - Solokiller
#ifdef SERVER_DLL
if( !IsUseable() && m_flNextPrimaryAttack < ( IsPredicted() ? 0.0 : gpGlobals->time ) )
{
// weapon isn't useable, switch.
if( !( iFlags() & ITEM_FLAG_NOAUTOSWITCHEMPTY ) && g_pGameRules->GetNextBestWeapon( m_pPlayer, this ) )
{
m_flNextPrimaryAttack = ( IsPredicted() ? 0.0 : gpGlobals->time ) + 0.3;
return;
}
}
else
#endif
{
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && CanReload( m_flNextPrimaryAttack, gpGlobals->time, IsPredicted() ) )
{
Reload();
return;
}
}
WeaponIdle();
return;
}
// catch all
if( ShouldWeaponIdle() )
{
WeaponIdle();
}
}
示例9: min
void CBasePlayerWeapon::ItemPostFrame( void )
{
if ((m_fInReload) && ( m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase() ) )
{
// complete the reload.
int j = min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]);
// Add them to the clip
m_iClip += j;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j;
m_pPlayer->TabulateAmmo();
m_fInReload = FALSE;
}
if ( !(m_pPlayer->pev->button & IN_ATTACK ) )
{
m_flLastFireTime = 0.0f;
}
if ((m_pPlayer->pev->button & IN_ATTACK2) && CanAttack( m_flNextSecondaryAttack, gpGlobals->time, UseDecrement() ) )
{
if ( pszAmmo2() && !m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] )
{
m_fFireOnEmpty = TRUE;
}
m_pPlayer->TabulateAmmo();
SecondaryAttack();
m_pPlayer->pev->button &= ~IN_ATTACK2;
}
else if ((m_pPlayer->pev->button & IN_ATTACK) && CanAttack( m_flNextPrimaryAttack, gpGlobals->time, UseDecrement() ) )
{
if ( (m_iClip == 0 && pszAmmo1()) || (iMaxClip() == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) )
{
m_fFireOnEmpty = TRUE;
}
m_pPlayer->TabulateAmmo();
PrimaryAttack();
}
else if ( m_pPlayer->pev->button & IN_RELOAD && iMaxClip() != WEAPON_NOCLIP && !m_fInReload )
{
// reload when reload is pressed, or if no buttons are down and weapon is empty.
Reload();
}
else if ( !(m_pPlayer->pev->button & (IN_ATTACK|IN_ATTACK2) ) )
{
// no fire buttons down
m_fFireOnEmpty = FALSE;
if ( !IsUseable() && m_flNextPrimaryAttack < ( UseDecrement() ? 0.0 : gpGlobals->time ) )
{
// weapon isn't useable, switch.
if ( !(iFlags() & ITEM_FLAG_NOAUTOSWITCHEMPTY) && g_pGameRules->GetNextBestWeapon( m_pPlayer, this ) )
{
m_flNextPrimaryAttack = ( UseDecrement() ? 0.0 : gpGlobals->time ) + 0.3;
return;
}
}
else
{
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
if ( m_iClip == 0 && !(iFlags() & ITEM_FLAG_NOAUTORELOAD) && m_flNextPrimaryAttack < ( UseDecrement() ? 0.0 : gpGlobals->time ) )
{
Reload();
return;
}
}
WeaponIdle( );
return;
}
// catch all
if ( ShouldWeaponIdle() )
{
WeaponIdle();
}
}
示例10: BuyAmmo
void CGauss::BuyPrimaryAmmo( void )
{
BuyAmmo(40, (char*)pszAmmo1(), COST_ENERGY_AMMO);
}
示例11: BuyAmmo
void CFroster::BuyPrimaryAmmo( void )
{
BuyAmmo(50, (char*)pszAmmo1(), COST_HEAVY_AMMO);
}
示例12: BuyAmmo
void CFLAMETHROWER::BuyPrimaryAmmo( void )
{
BuyAmmo(100, (char*)pszAmmo1(), COST_HEAVY_AMMO);
}
示例13: min
/*
=====================
CBasePlayerWeapon::ItemPostFrame
Handles weapon firing, reloading, etc.
=====================
*/
void CBasePlayerWeapon::ItemPostFrame( void )
{
if ((m_fInReload) && (m_pPlayer->m_flNextAttack <= 0.0))
{
#if 0 // FIXME, need ammo on client to make this work right
// complete the reload.
int j = min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]);
// Add them to the clip
m_iClip += j;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j;
#else
m_iClip += 10;
#endif
m_fInReload = FALSE;
}
if ((m_pPlayer->pev->button & IN_ATTACK2) && (m_flNextSecondaryAttack <= 0.0))
{
if ( pszAmmo2() && !m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] )
{
m_fFireOnEmpty = TRUE;
}
SecondaryAttack();
m_pPlayer->pev->button &= ~IN_ATTACK2;
}
else if ((m_pPlayer->pev->button & IN_ATTACK) && (m_flNextPrimaryAttack <= 0.0))
{
if ( (m_iClip == 0 && pszAmmo1()) || (iMaxClip() == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) )
{
m_fFireOnEmpty = TRUE;
}
PrimaryAttack();
}
else if ( m_pPlayer->pev->button & IN_RELOAD && iMaxClip() != WEAPON_NOCLIP && !m_fInReload )
{
// reload when reload is pressed, or if no buttons are down and weapon is empty.
Reload();
}
else if ( !(m_pPlayer->pev->button & (IN_ATTACK|IN_ATTACK2) ) )
{
// no fire buttons down
m_fFireOnEmpty = FALSE;
if ( !m_bPlayedIdleAnim )
{
m_bPlayedIdleAnim = TRUE;
if ( m_pPlayer->m_iQuakeWeapon == IT_LIGHTNING )
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_pPlayer->m_usLightning, 0, (float *)&m_pPlayer->pev->origin, (float *)&m_pPlayer->pev->angles, 0.0, 0.0, 0, 1, 0, 0 );
}
WeaponIdle( );
return;
}
// catch all
if ( ShouldWeaponIdle() )
{
WeaponIdle();
}
}
示例14: BuyAmmo
void CBiorifle::BuyPrimaryAmmo( void )
{
BuyAmmo(18, (char*)pszAmmo1(), COST_HEAVY_AMMO);
}
示例15: BuyAmmo
void CWHL::BuyPrimaryAmmo( void )
{
BuyAmmo(1, (char*)pszAmmo1(), COST_ASSAULT_AMMO_SEC);
}