FireBulletsInfo t: Difference between revisions
Jump to navigation
Jump to search
Tip:For full implementation details, examine
TomEdwards (talk | contribs) m (displaytitle) |
Stoopdapoop (talk | contribs) No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 14: | Line 14: | ||
: A "cone of fire" within which bullets will be spread at random (but see <code>m_nFlags</code>). You can use the various <code>VECTOR_CONE_</code> #defines to avoid maths. | : A "cone of fire" within which bullets will be spread at random (but see <code>m_nFlags</code>). You can use the various <code>VECTOR_CONE_</code> #defines to avoid maths. | ||
; <code>[[float]] m_flDistance</code> | ; <code>[[float]] m_flDistance</code> | ||
: Maximum [[ | : Maximum [[UTIL_TraceLine|trace]] length. Bullets travel this far then disappear. | ||
; <code>int m_iAmmoType</code> | ; <code>int m_iAmmoType</code> | ||
: [[AmmoDef]] index for the type of bullet being fired. | : [[AmmoDef]] index for the type of bullet being fired. | ||
Line 43: | Line 43: | ||
== See also == | == See also == | ||
* <code>[[TraceLine]]</code> | * <code>[[UTIL_TraceLine|TraceLine]]</code> | ||
* [[AmmoDef]] | * [[AmmoDef]] | ||
[[Category:Weapons programming]] | [[Category:Weapons programming]][[Category:Structures]]{{DISPLAYTITLE:FireBulletsInfo_t}} |
Latest revision as of 00: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()
.

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()
andCBasePlayer::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 variousVECTOR_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.