From Valve Developer Community
Jump to: navigation, search

FireBulletsInfo_t is a struct that describes a batch of hitscan bullets. An object of this type is normally created by a weapon before being passed, as a required parameter, to CBaseEntity::FireBullets().

Tip:For full implementation details, examine CBaseCombatWeapon::PrimaryAttack().


int m_iShots
Number of bullets in this batch. Rapid-fire weapons should be able to queue up several bullets at once if the framerate is low, like this:
while (NextPrimaryAttack <= curtime) { mybullets.m_iShots++; NextPrimaryAttack += fireRate; }
Vector m_vecSrc
Vector m_vecDirShooting
Location to shoot from and direction to shoot in. Normally assigned CBasePlayer::Weapon_ShootPosition() and CBasePlayer::GetAutoaimVector(AUTOAIM_SCALE_DEFAULT) respectively.
Vector m_vecSpread
A "cone of fire" within which bullets will be spread at random (but see m_nFlags). You can use the various VECTOR_CONE_ #defines to avoid maths.
float m_flDistance
Maximum trace length. Bullets travel this far then disappear.
int m_iAmmoType
AmmoDef index for the type of bullet being fired.
int m_iTracerFreq
How often visible tracers should be created.
Confirm:1 = 100%, 2 = 50%, etc.
int m_iDamage
int m_iPlayerDamage
Amount of damage to do. PlayerDamage is a special override that determines how much damage should be done if a player is hit.
int m_nFlags
Generic flag bitstring - see FireBulletsFlags_t. Stock choices are:
Fire the first shot with perfect accuracy.
If the shot hits its target underwater, don't damage it.
If the shot hits water surface, still call DoImpactEffect().
Danger sounds added from this impact can be stomped immediately if another is queued.
float m_flDamageForceScale
Multiplier for VPhysics forces created by the bullets.
CBaseEntity* m_pAttacker
The entity which is attacking. Defaults to the one which FireBullets().
CBaseEntity* m_pAdditionalIgnoreEnt
The gun and its owner are ignored when tracing the path of the bullets. This allows another entity to be ignored also.
bool m_bPrimaryAttack
Whether the attack is primary fire or not. Only checked by the game stats system.

See also