Fix deploy animations on fast weapon switching (#289)

This commit is contained in:
Roman Chistokhodov 2022-07-21 17:40:51 +03:00 committed by GitHub
parent 25ba2b4e5f
commit ed676a5413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View File

@ -3095,7 +3095,15 @@ void CBasePlayer::SelectItem( const char *pstr )
if( m_pActiveItem )
{
CBasePlayerWeapon* weapon = (CBasePlayerWeapon*)(m_pActiveItem->GetWeaponPtr());
if (weapon)
weapon->m_ForceSendAnimations = true;
m_pActiveItem->Deploy();
if (weapon)
weapon->m_ForceSendAnimations = false;
m_pActiveItem->UpdateItemInfo();
}
}
@ -3121,7 +3129,16 @@ void CBasePlayer::SelectLastItem( void )
CBasePlayerItem *pTemp = m_pActiveItem;
m_pActiveItem = m_pLastItem;
m_pLastItem = pTemp;
CBasePlayerWeapon* weapon = (CBasePlayerWeapon*)(m_pActiveItem->GetWeaponPtr());
if (weapon)
weapon->m_ForceSendAnimations = true;
m_pActiveItem->Deploy();
if (weapon)
weapon->m_ForceSendAnimations = false;
m_pActiveItem->UpdateItemInfo();
}

View File

@ -820,7 +820,7 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer )
void CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal, int body )
{
if( UseDecrement() )
skiplocal = 1;
skiplocal = !m_ForceSendAnimations;
else
skiplocal = 0;

View File

@ -351,6 +351,9 @@ public:
// hle time creep vars
float m_flPrevPrimaryAttack;
float m_flLastFireTime;
//Hack so deploy animations work when weapon prediction is enabled.
bool m_ForceSendAnimations;
};
class CBasePlayerAmmo : public CBaseEntity