[HL25] Backport "reload current weapon before dropping it" code
This commit is contained in:
parent
e0ba8cebc7
commit
9d4ce15069
1 changed files with 13 additions and 1 deletions
|
@ -625,8 +625,20 @@ void CBasePlayer::PackDeadPlayerItems()
|
|||
case GR_PLR_DROP_GUN_ACTIVE:
|
||||
if (m_pActiveItem && pPlayerItem == m_pActiveItem)
|
||||
{
|
||||
CBasePlayerWeapon* pWeapon = (CBasePlayerWeapon*)pPlayerItem;
|
||||
int nIndex = iPW++;
|
||||
|
||||
// this is the active item. Pack it.
|
||||
rgpPackWeapons[iPW++] = (CBasePlayerWeapon*)pPlayerItem;
|
||||
rgpPackWeapons[nIndex] = pWeapon;
|
||||
|
||||
// Reload the weapon before dropping it if we have ammo
|
||||
int j = V_min(pWeapon->iMaxClip() - pWeapon->m_iClip, m_rgAmmo[pWeapon->m_iPrimaryAmmoType]);
|
||||
|
||||
// Add them to the clip
|
||||
pWeapon->m_iClip += j;
|
||||
m_rgAmmo[pWeapon->m_iPrimaryAmmoType] -= j;
|
||||
|
||||
TabulateAmmo();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue