diff --git a/game/shared/takedamageinfo.cpp b/game/shared/takedamageinfo.cpp index 70037f84..10eb8c9f 100644 --- a/game/shared/takedamageinfo.cpp +++ b/game/shared/takedamageinfo.cpp @@ -61,6 +61,7 @@ void CTakeDamageInfo::Init( CBaseEntity *pInflictor, CBaseEntity *pAttacker, CBa m_iPlayerPenetrationCount = 0; m_flDamageBonus = 0.f; m_bForceFriendlyFire = false; + m_flDamageForForce = 0.f; } CTakeDamageInfo::CTakeDamageInfo() diff --git a/game/shared/takedamageinfo.h b/game/shared/takedamageinfo.h index 0ba29108..6e0efa23 100644 --- a/game/shared/takedamageinfo.h +++ b/game/shared/takedamageinfo.h @@ -55,7 +55,8 @@ public: void AddDamage( float flAddAmount ); void SubtractDamage( float flSubtractAmount ); float GetDamageBonus() const; - void SetDamageBonus( float flBonus ); + CBaseEntity *GetDamageBonusProvider() const; + void SetDamageBonus( float flBonus, CBaseEntity *pProvider = NULL ); float GetBaseDamage() const; bool BaseDamageIsValid() const; @@ -63,6 +64,8 @@ public: Vector GetDamageForce() const; void SetDamageForce( const Vector &damageForce ); void ScaleDamageForce( float flScaleAmount ); + float GetDamageForForceCalc() const; + void SetDamageForForceCalc( const float flScaleAmount ); Vector GetDamagePosition() const; void SetDamagePosition( const Vector &damagePosition ); @@ -125,8 +128,11 @@ protected: int m_iDamagedOtherPlayers; int m_iPlayerPenetrationCount; float m_flDamageBonus; // Anything that increases damage (crit) - store the delta + EHANDLE m_hDamageBonusProvider; // Who gave us the ability to do extra damage? bool m_bForceFriendlyFire; // Ideally this would be a dmg type, but we can't add more + float m_flDamageForForce; + DECLARE_SIMPLE_DATADESC(); }; @@ -247,9 +253,15 @@ inline float CTakeDamageInfo::GetDamageBonus() const return m_flDamageBonus; } -inline void CTakeDamageInfo::SetDamageBonus( float flBonus ) +inline CBaseEntity *CTakeDamageInfo::GetDamageBonusProvider() const +{ + return m_hDamageBonusProvider; +} + +inline void CTakeDamageInfo::SetDamageBonus( float flBonus, CBaseEntity *pProvider /*= NULL*/ ) { m_flDamageBonus = flBonus; + m_hDamageBonusProvider = pProvider; } inline float CTakeDamageInfo::GetBaseDamage() const @@ -281,6 +293,16 @@ inline void CTakeDamageInfo::ScaleDamageForce( float flScaleAmount ) m_vecDamageForce *= flScaleAmount; } +inline float CTakeDamageInfo::GetDamageForForceCalc() const +{ + return m_flDamageForForce; +} + +inline void CTakeDamageInfo::SetDamageForForceCalc( float flDamage ) +{ + m_flDamageForForce = flDamage; +} + inline Vector CTakeDamageInfo::GetDamagePosition() const { return m_vecDamagePosition;