Skip to content

Commit a2678a1

Browse files
authored
Ensure HasPrimary flag assignation on successful weapon removal (#866)
1 parent e422a37 commit a2678a1

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

regamedll/dlls/player.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8056,8 +8056,10 @@ CBaseEntity *EXT_FUNC CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszIte
80568056
g_pGameRules->GetNextBestWeapon(this, pWeapon);
80578057
UTIL_MakeVectors(pev->angles);
80588058

8059+
#ifndef REGAMEDLL_FIXES
80598060
if (pWeapon->iItemSlot() == PRIMARY_WEAPON_SLOT)
8060-
m_bHasPrimary = false;
8061+
m_bHasPrimary = false; // I may have more than just 1 primary weapon :)
8062+
#endif
80618063

80628064
if (FClassnameIs(pWeapon->pev, "weapon_c4"))
80638065
{
@@ -8127,6 +8129,12 @@ CBaseEntity *EXT_FUNC CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszIte
81278129
return nullptr;
81288130
}
81298131

8132+
#ifdef REGAMEDLL_FIXES
8133+
if (!m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]) {
8134+
m_bHasPrimary = false; // ensure value assignation on successful weapon removal
8135+
}
8136+
#endif
8137+
81308138
if (FClassnameIs(pWeapon->pev, "weapon_c4"))
81318139
{
81328140
pWeaponBox->m_bIsBomb = true;

0 commit comments

Comments
 (0)