diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 10ca5135..006ffc66 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -789,11 +789,18 @@ 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) { case WEAPON_AK47: @@ -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 8c47d6e5..3cc56f0a 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 @@ public: public: ItemInfo m_ItemInfo; + bool m_bHasSecondaryAttack; }; // Inlines