本文整理汇总了C++中CBasePlayerWeapon::UseDecrement方法的典型用法代码示例。如果您正苦于以下问题:C++ CBasePlayerWeapon::UseDecrement方法的具体用法?C++ CBasePlayerWeapon::UseDecrement怎么用?C++ CBasePlayerWeapon::UseDecrement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBasePlayerWeapon
的用法示例。
在下文中一共展示了CBasePlayerWeapon::UseDecrement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateClientData
/*
=================
UpdateClientData
Data sent to current client only
engine sets cd to 0 before calling.
=================
*/
void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd )
{
cd->flags = ent->v.flags;
cd->health = ent->v.health;
cd->viewmodel = MODEL_INDEX( STRING( ent->v.viewmodel ) );
cd->waterlevel = ent->v.waterlevel;
cd->watertype = ent->v.watertype;
cd->weapons = ent->v.weapons;
// Vectors
cd->origin = ent->v.origin;
cd->velocity = ent->v.velocity;
cd->view_ofs = ent->v.view_ofs;
cd->punchangle = ent->v.punchangle;
cd->bInDuck = ent->v.bInDuck;
cd->flTimeStepSound = ent->v.flTimeStepSound;
cd->flDuckTime = ent->v.flDuckTime;
cd->flSwimTime = ent->v.flSwimTime;
cd->waterjumptime = ent->v.teleport_time;
strcpy( cd->physinfo, ENGINE_GETPHYSINFO( ent ) );
cd->maxspeed = ent->v.maxspeed;
cd->fov = ent->v.fov;
cd->weaponanim = ent->v.weaponanim;
cd->pushmsec = ent->v.pushmsec;
// Spectator
cd->iuser1 = ent->v.iuser1;
cd->iuser2 = ent->v.iuser2;
if ( sendweapons )
{
entvars_t *pev = (entvars_t *)&ent->v;
CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev );
if ( pl )
{
cd->m_flNextAttack = pl->m_flNextAttack;
if ( pl->m_pActiveItem )
{
CBasePlayerWeapon *gun;
gun = (CBasePlayerWeapon *)pl->m_pActiveItem->GetWeaponPtr();
if ( gun && gun->UseDecrement() )
{
ItemInfo II;
memset( &II, 0, sizeof( II ) );
gun->GetItemInfo( &II );
cd->m_iId = II.iId;
}
}
}
}
}
示例2: GetWeaponData
int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
{
#if defined( CLIENT_WEAPONS )
int i;
weapon_data_t *item;
entvars_t *pev = &player->v;
CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev );
CBasePlayerWeapon *gun;
ItemInfo II;
memset( info, 0, 32 * sizeof( weapon_data_t ) );
if ( !pl )
return 1;
// go through all of the weapons and make a list of the ones to pack
for ( i = 0 ; i < MAX_ITEM_TYPES ; i++ )
{
if ( pl->m_rgpPlayerItems[ i ] )
{
// there's a weapon here. Should I pack it?
CBasePlayerItem *pPlayerItem = pl->m_rgpPlayerItems[ i ];
while ( pPlayerItem )
{
gun = (CBasePlayerWeapon *)pPlayerItem->GetWeaponPtr();
if ( gun && gun->UseDecrement() )
{
// Get The ID.
memset( &II, 0, sizeof( II ) );
gun->GetItemInfo( &II );
if ( II.iId >= 0 && II.iId < 32 )
{
item = &info[ II.iId ];
item->m_iId = II.iId;
item->m_iClip = gun->m_iClip;
item->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle, -0.001 );
item->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack, -0.001 );
item->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack, -0.001 );
item->m_fInReload = gun->m_fInReload;
}
}
pPlayerItem = pPlayerItem->m_pNext;
}
}
}
#else
memset( info, 0, 32 * sizeof( weapon_data_t ) );
#endif
return 1;
}
示例3: UpdateClientData
/*
=================
UpdateClientData
Data sent to current client only
engine sets cd to 0 before calling.
=================
*/
void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd )
{
cd->flags = ent->v.flags;
cd->health = ent->v.health;
cd->viewmodel = MODEL_INDEX( STRING( ent->v.viewmodel ) );
cd->waterlevel = ent->v.waterlevel;
cd->watertype = ent->v.watertype;
cd->weapons = ent->v.weapons;
// Vectors
cd->origin = ent->v.origin;
cd->velocity = ent->v.velocity;
cd->view_ofs = ent->v.view_ofs;
cd->punchangle = ent->v.punchangle;
cd->bInDuck = ent->v.bInDuck;
cd->flTimeStepSound = ent->v.flTimeStepSound;
cd->flDuckTime = ent->v.flDuckTime;
cd->flSwimTime = ent->v.flSwimTime;
cd->waterjumptime = ent->v.teleport_time;
strcpy( cd->physinfo, ENGINE_GETPHYSINFO( ent ) );
cd->maxspeed = ent->v.maxspeed;
cd->fov = ent->v.fov;
cd->weaponanim = ent->v.weaponanim;
cd->pushmsec = ent->v.pushmsec;
#if defined( CLIENT_WEAPONS )
if ( sendweapons )
{
entvars_t *pev = (entvars_t *)&ent->v;
CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev );
if ( pl )
{
cd->m_flNextAttack = pl->m_flNextAttack;
cd->fuser2 = pl->m_flNextAmmoBurn;
cd->fuser3 = pl->m_flAmmoStartCharge;
cd->vuser1.x = pl->ammo_9mm;
cd->vuser1.y = pl->ammo_357;
cd->vuser1.z = pl->ammo_argrens;
cd->ammo_nails = pl->ammo_bolts;
cd->ammo_shells = pl->ammo_buckshot;
cd->ammo_rockets = pl->ammo_rockets;
cd->ammo_cells = pl->ammo_uranium;
cd->vuser2.x = pl->ammo_hornets;
if ( pl->m_pActiveItem )
{
CBasePlayerWeapon *gun;
gun = (CBasePlayerWeapon *)pl->m_pActiveItem->GetWeaponPtr();
if ( gun && gun->UseDecrement() )
{
ItemInfo II;
memset( &II, 0, sizeof( II ) );
gun->GetItemInfo( &II );
cd->m_iId = II.iId;
cd->vuser3.z = gun->m_iSecondaryAmmoType;
cd->vuser4.x = gun->m_iPrimaryAmmoType;
cd->vuser4.y = pl->m_rgAmmo[gun->m_iPrimaryAmmoType];
cd->vuser4.z = pl->m_rgAmmo[gun->m_iSecondaryAmmoType];
if ( pl->m_pActiveItem->m_iId == WEAPON_RPG )
{
cd->vuser2.y = ( ( CRpg * )pl->m_pActiveItem)->m_fSpotActive;
cd->vuser2.z = ( ( CRpg * )pl->m_pActiveItem)->m_cActiveRockets;
}
}
}
}
}
#endif
}