diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 10ca5135b..006ffc663 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -789,10 +789,17 @@ BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted) bool CBasePlayerWeapon::HasSecondaryAttack() { - if (m_pPlayer->HasShield()) + if (m_pPlayer && m_pPlayer->HasShield()) + { + return true; + } + +#ifdef REGAMEDLL_API + if (CSPlayerItem()->m_bHasSecondaryAttack) { return true; } +#endif switch (m_iId) { @@ -1084,6 +1091,8 @@ void CBasePlayerWeapon::Spawn() if (GetItemInfo(&info)) { CSPlayerItem()->SetItemInfo(&info); } + + CSPlayerItem()->m_bHasSecondaryAttack = HasSecondaryAttack(); } // CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal diff --git a/regamedll/public/regamedll/API/CSPlayerItem.h b/regamedll/public/regamedll/API/CSPlayerItem.h index 8c47d6e50..3cc56f0ab 100644 --- a/regamedll/public/regamedll/API/CSPlayerItem.h +++ b/regamedll/public/regamedll/API/CSPlayerItem.h @@ -32,7 +32,8 @@ class CBasePlayerItem; class CCSPlayerItem: public CCSAnimating { public: - CCSPlayerItem() + CCSPlayerItem() : + m_bHasSecondaryAttack(false) { Q_memset(&m_ItemInfo, 0, sizeof(m_ItemInfo)); } @@ -43,6 +44,7 @@ class CCSPlayerItem: public CCSAnimating public: ItemInfo m_ItemInfo; + bool m_bHasSecondaryAttack; }; // Inlines