This commit is contained in:
s1lent 2017-11-01 23:32:07 +07:00
parent 875189fa24
commit 026a55eba0
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
2 changed files with 13 additions and 2 deletions

View File

@ -789,11 +789,18 @@ BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted)
bool CBasePlayerWeapon::HasSecondaryAttack() bool CBasePlayerWeapon::HasSecondaryAttack()
{ {
if (m_pPlayer->HasShield()) if (m_pPlayer && m_pPlayer->HasShield())
{ {
return true; return true;
} }
#ifdef REGAMEDLL_API
if (CSPlayerItem()->m_bHasSecondaryAttack)
{
return true;
}
#endif
switch (m_iId) switch (m_iId)
{ {
case WEAPON_AK47: case WEAPON_AK47:
@ -1084,6 +1091,8 @@ void CBasePlayerWeapon::Spawn()
if (GetItemInfo(&info)) { if (GetItemInfo(&info)) {
CSPlayerItem()->SetItemInfo(&info); CSPlayerItem()->SetItemInfo(&info);
} }
CSPlayerItem()->m_bHasSecondaryAttack = HasSecondaryAttack();
} }
// CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal // CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal

View File

@ -32,7 +32,8 @@ class CBasePlayerItem;
class CCSPlayerItem: public CCSAnimating class CCSPlayerItem: public CCSAnimating
{ {
public: public:
CCSPlayerItem() CCSPlayerItem() :
m_bHasSecondaryAttack(false)
{ {
Q_memset(&m_ItemInfo, 0, sizeof(m_ItemInfo)); Q_memset(&m_ItemInfo, 0, sizeof(m_ItemInfo));
} }
@ -43,6 +44,7 @@ public:
public: public:
ItemInfo m_ItemInfo; ItemInfo m_ItemInfo;
bool m_bHasSecondaryAttack;
}; };
// Inlines // Inlines