Difference between revisions of "FireBulletsInfo t"

From Valve Developer Community
Jump to: navigation, search
(See also: Traceline link fix)
 
Line 46: Line 46:
 
* [[AmmoDef]]
 
* [[AmmoDef]]
  
[[Category:Weapons programming]]
+
[[Category:Weapons programming]][[Category:Structures]]{{DISPLAYTITLE:FireBulletsInfo_t}}

Latest revision as of 07:41, 11 April 2011

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().

Members

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_BULLETS_FIRST_SHOT_ACCURATE
Fire the first shot with perfect accuracy.
FIRE_BULLETS_DONT_HIT_UNDERWATER
If the shot hits its target underwater, don't damage it.
FIRE_BULLETS_ALLOW_WATER_SURFACE_IMPACTS
If the shot hits water surface, still call DoImpactEffect().
FIRE_BULLETS_TEMPORARY_DANGER_SOUND
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