From ca99e7d583944f9cc68c85378574e3d06419dbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mu=C3=B1oz?= Date: Thu, 28 Sep 2023 14:35:03 -0300 Subject: [PATCH] Ensure HasPrimary flag assignation on successful weapon removal --- regamedll/dlls/player.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index a0b0d744b..37b45ace3 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -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")) { @@ -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;