From 06f046430defa219eae8c6c7b096276195056850 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 10 Feb 2021 20:30:01 +0300 Subject: [PATCH] Fix occasional double playing of reload animations --- cl_dll/hl/hl_weapons.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index f305f321..754fd594 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -325,9 +325,13 @@ void CBasePlayerWeapon::ItemPostFrame( void ) { if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= 0.0f ) ) { -#if 0 // FIXME, need ammo on client to make this work right +#if 1 // complete the reload. - int j = min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ); + ItemInfo itemInfo; + memset( &itemInfo, 0, sizeof( itemInfo ) ); + GetItemInfo( &itemInfo ); + + int j = Q_min( itemInfo.iMaxClip - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ); // Add them to the clip m_iClip += j;