Skip to content

Commit

Permalink
Ensure HasPrimary flag assignation on successful weapon removal
Browse files Browse the repository at this point in the history
  • Loading branch information
dystopm committed Sep 28, 2023
1 parent 108db28 commit ca99e7d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8051,8 +8051,10 @@ CBaseEntity *EXT_FUNC CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszIte
g_pGameRules->GetNextBestWeapon(this, pWeapon);
UTIL_MakeVectors(pev->angles);

#ifndef REGAMEDLL_FIXES
if (pWeapon->iItemSlot() == PRIMARY_WEAPON_SLOT)
m_bHasPrimary = false;
m_bHasPrimary = false; // I may have more than just 1 primary weapon :)
#endif

if (FClassnameIs(pWeapon->pev, "weapon_c4"))
{
Expand Down Expand Up @@ -8122,6 +8124,12 @@ CBaseEntity *EXT_FUNC CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszIte
return nullptr;
}

#ifdef REGAMEDLL_FIXES
if (!m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]) {
m_bHasPrimary = false; // ensure value assignation on successful weapon removal
}
#endif

if (FClassnameIs(pWeapon->pev, "weapon_c4"))
{
pWeaponBox->m_bIsBomb = true;
Expand Down

0 comments on commit ca99e7d

Please sign in to comment.