diff --git a/regamedll/dlls/API/CSPlayer.cpp b/regamedll/dlls/API/CSPlayer.cpp index 2f3afa49..4fd70c23 100644 --- a/regamedll/dlls/API/CSPlayer.cpp +++ b/regamedll/dlls/API/CSPlayer.cpp @@ -229,6 +229,11 @@ EXT_FUNC bool CCSPlayer::RemovePlayerItemEx(const char* pszItemName, bool bRemov if (pPlayer->RemovePlayerItem(pItem)) { pPlayer->pev->weapons &= ~(1 << pItem->m_iId); + // No more weapon + if ((pPlayer->pev->weapons & ~(1 << WEAPON_SUIT)) == 0) { + pPlayer->m_iHideHUD |= HIDEHUD_WEAPONS; + } + pItem->Kill(); if (!pPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]) { diff --git a/regamedll/dlls/ammo.cpp b/regamedll/dlls/ammo.cpp index b6df2d2c..bfef8749 100644 --- a/regamedll/dlls/ammo.cpp +++ b/regamedll/dlls/ammo.cpp @@ -81,13 +81,6 @@ void CBasePlayerAmmo::DefaultTouch(CBaseEntity *pOther) #endif } } - else if (gEvilImpulse101) - { - // evil impulse 101 hack, kill always - SetTouch(nullptr); - SetThink(&CBaseEntity::SUB_Remove); - pev->nextthink = gpGlobals->time + 0.1f; - } } void C9MMAmmo::Spawn() diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 6c00f1b5..61e47105 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -int giPrecacheGrunt = 0; int gmsgWeapPickup = 0; int gmsgHudText = 0; int gmsgHudTextPro = 0; @@ -1843,7 +1842,11 @@ BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *pPlayer, int slot) } pPlayer->RemoveAllItems(TRUE); + +#ifndef REGAMEDLL_FIXES + // NOTE: It is already does reset inside RemoveAllItems pPlayer->m_bHasC4 = false; +#endif #ifdef REGAMEDLL_FIXES if (pPlayer->m_iTeam != SPECTATOR) @@ -3151,7 +3154,11 @@ void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *pa } else if (FStrEq(pcmd, "become_vip")) { - if (pPlayer->m_iJoiningState != JOINED || pPlayer->m_iTeam != CT) + if (pPlayer->m_iJoiningState != JOINED || pPlayer->m_iTeam != CT +#ifdef REGAMEDLL_FIXES + || !CSGameRules()->m_bMapHasVIPSafetyZone +#endif + ) { ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Command_Not_Available"); return; @@ -4168,9 +4175,6 @@ void ClientPrecache() PRECACHE_SOUND("player/geiger2.wav"); PRECACHE_SOUND("player/geiger1.wav"); - if (giPrecacheGrunt) - UTIL_PrecacheOther("enemy_terrorist"); - g_iShadowSprite = PRECACHE_MODEL("sprites/shadow_circle.spr"); PRECACHE_MODEL("sprites/wall_puff1.spr"); diff --git a/regamedll/dlls/client.h b/regamedll/dlls/client.h index 07cf8ff4..c709a1f3 100644 --- a/regamedll/dlls/client.h +++ b/regamedll/dlls/client.h @@ -207,7 +207,6 @@ inline const char *GetTeamName(int team) } } -extern int giPrecacheGrunt; extern int gmsgWeapPickup; extern int gmsgHudText; extern int gmsgHudTextPro; diff --git a/regamedll/dlls/items.cpp b/regamedll/dlls/items.cpp index 774e47eb..38f226ab 100644 --- a/regamedll/dlls/items.cpp +++ b/regamedll/dlls/items.cpp @@ -127,10 +127,6 @@ void CItem::ItemTouch(CBaseEntity *pOther) else UTIL_Remove(this); } - else if (gEvilImpulse101) - { - UTIL_Remove(this); - } } CBaseEntity *CItem::Respawn() diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 77e52cdd..7ac7e341 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -606,9 +606,23 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CleanUpMap)() const int grenadesRemoveCount = 20; UTIL_RemoveOther("grenade", grenadesRemoveCount); +#ifndef REGAMEDLL_FIXES // Remove defuse kit // Old code only removed 4 kits and stopped. UTIL_RemoveOther("item_thighpack"); +#else + // Don't remove level items + CItemThighPack *pDefuser = nullptr; + + while ((pDefuser = UTIL_FindEntityByClassname(pDefuser, "item_thighpack"))) + { + if (pDefuser->pev->spawnflags & SF_NORESPAWN) + { + pDefuser->SetThink(&CBaseEntity::SUB_Remove); + pDefuser->pev->nextthink = gpGlobals->time + 0.1; + } + } +#endif #ifdef REGAMEDLL_FIXES UTIL_RemoveOther("gib"); diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 5c64245a..aa231dd9 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -82,7 +82,6 @@ const char *CDeadHEV::m_szPoses[] = "deadtable" }; -int gEvilImpulse101; entvars_t *g_pevLastInflictor; LINK_ENTITY_TO_CLASS(player, CBasePlayer, CCSPlayer) @@ -1302,6 +1301,10 @@ void PackPlayerNade(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) if (!pItem) return; + if (pItem->m_flStartThrow != 0.0f || pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()] <= 0) { + return; + } + const char *modelName = GetCSModelName(pItem->m_iId); if (modelName) { @@ -1319,10 +1322,6 @@ void PackPlayerNade(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) break; } - if (pItem->m_flStartThrow && pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()] <= 0) { - return; - } - Vector vecAngles = pPlayer->pev->angles; Vector dir(Q_cos(vecAngles.y) * flOffset, Q_sin(vecAngles.y) * flOffset, 0.0f); @@ -1397,7 +1396,15 @@ void CBasePlayer::PackDeadPlayerItems() else if (pPlayerItem->iItemSlot() == GRENADE_SLOT) { if (AreRunningCZero()) - PackPlayerItem(this, pPlayerItem, true); + { + +#ifdef REGAMEDLL_FIXES + if (pPlayerItem->m_flStartThrow == 0.0f && m_rgAmmo[pPlayerItem->PrimaryAmmoIndex()] > 0) +#endif + { + PackPlayerItem(this, pPlayerItem, true); + } + } #ifdef REGAMEDLL_ADD else { @@ -1577,6 +1584,9 @@ void CBasePlayer::RemoveAllItems(BOOL removeSuit) #ifdef REGAMEDLL_FIXES m_iHideHUD |= HIDEHUD_WEAPONS; + + m_bHasNightVision = false; + SendItemStatus(); #endif // send Selected Weapon Message to our client @@ -1709,6 +1719,16 @@ void BuyZoneIcon_Clear(CBasePlayer *pPlayer) { if (pPlayer->m_iMenu <= Menu_BuyItem) { + +#ifdef REGAMEDLL_FIXES + // NOTE: is client-side bug + if (pPlayer->m_bVGUIMenus) + { + MESSAGE_BEGIN(MSG_ONE, gmsgBuyClose, nullptr, pPlayer->pev); + MESSAGE_END(); + } +#endif + CLIENT_COMMAND(ENT(pPlayer->pev), "slot10\n"); } else if (pPlayer->m_iMenu == Menu_ClientBuy) @@ -1990,6 +2010,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) #ifdef REGAMEDLL_FIXES m_rgAmmo[m_pActiveItem->PrimaryAmmoIndex()]--; + pHEGrenade->m_flStartThrow = 0; #endif } break; @@ -2003,6 +2024,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) #ifdef REGAMEDLL_FIXES m_rgAmmo[m_pActiveItem->PrimaryAmmoIndex()]--; + pFlashbang->m_flStartThrow = 0; #endif } break; @@ -2016,6 +2038,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) #ifdef REGAMEDLL_FIXES m_rgAmmo[m_pActiveItem->PrimaryAmmoIndex()]--; + pSmoke->m_flStartThrow = 0; #endif } break; @@ -2035,6 +2058,11 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) pev->flags &= ~FL_ONGROUND; +#ifdef REGAMEDLL_FIXES + // FlashlightTurnOff() + pev->effects &= ~EF_DIMLIGHT; +#endif + if (fadetoblack.value == 0.0) { pev->iuser1 = OBS_CHASE_FREE; @@ -2135,7 +2163,11 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) if (m_bHasC4) { DropPlayerItem("weapon_c4"); + +#ifndef REGAMEDLL_FIXES + // NOTE: It is already does reset inside DropPlayerItem SetProgressBarTime(0); +#endif } else if (m_bHasDefuser) { @@ -2183,10 +2215,16 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib) if ((pev->health < -9000 && iGib != GIB_NEVER) || iGib == GIB_ALWAYS) { + +#ifndef REGAMEDLL_FIXES pev->solid = SOLID_NOT; +#endif GibMonster(); pev->effects |= EF_NODRAW; + +#ifndef REGAMEDLL_FIXES CSGameRules()->CheckWinConditions(); +#endif return; } @@ -3443,6 +3481,11 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Disappear)() pev->solid = SOLID_NOT; pev->flags &= ~FL_ONGROUND; +#ifdef REGAMEDLL_FIXES + // FlashlightTurnOff() + pev->effects &= ~EF_DIMLIGHT; +#endif + SetSuitUpdate(nullptr, SUIT_SENTENCE, SUIT_REPEAT_OK); m_iClientHealth = 0; @@ -3464,12 +3507,19 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Disappear)() if (m_bHasC4) { DropPlayerItem("weapon_c4"); + +#ifndef REGAMEDLL_FIXES + // NOTE: It is already does reset inside DropPlayerItem SetProgressBarTime(0); +#endif } else if (m_bHasDefuser) { RemoveDefuser(); + +#ifndef REGAMEDLL_FIXES GiveNamedItem("item_thighpack"); +#endif MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pev); WRITE_BYTE(STATUSICON_HIDE); @@ -3835,7 +3885,7 @@ void CBasePlayer::PlayerUse() } } - bool useNewHostages = !TheNavAreaList.empty(); + bool useNewHostages = !TheNavAreaList.empty() && AreImprovAllowed(); CBaseEntity *pObject = nullptr; CBaseEntity *pClosest = nullptr; Vector vecLOS; @@ -4727,7 +4777,7 @@ void CBasePlayer::UpdatePlayerSound() // weapon recoil, or anything shoves the player abnormally fast. // NOTE: 512 units is a pretty large radius for a sound made by the player's body. // then again, I think some materials are pretty loud. - if (iBodyVolume> 512) + if (iBodyVolume > 512) { iBodyVolume = 512; } @@ -5211,6 +5261,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Spawn)() #ifdef REGAMEDLL_FIXES pev->watertype = CONTENTS_EMPTY; pev->waterlevel = 0; + pev->basevelocity = g_vecZero; // pushed by trigger_push #endif m_bitsHUDDamage = -1; @@ -5431,6 +5482,10 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Spawn)() m_bHasPrimary = false; m_bHasNightVision = false; +#ifdef REGAMEDLL_FIXES + m_iHideHUD |= HIDEHUD_WEAPONS; +#endif + SendItemStatus(); } else @@ -5653,7 +5708,13 @@ void CBasePlayer::Reset() m_bNotKilled = false; +#ifdef REGAMEDLL_FIXES + // RemoveShield() included + RemoveAllItems(TRUE); +#else RemoveShield(); +#endif + CheckStartMoney(); AddAccount(startmoney.value, RT_PLAYER_RESET); @@ -6133,23 +6194,7 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse) switch (iImpulse) { - case 76: - { - if (!giPrecacheGrunt) - { - giPrecacheGrunt = 1; - ALERT(at_console, "You must now restart to use Grunt-o-matic.\n"); - } - else - { - UTIL_MakeVectors(Vector(0, pev->v_angle.y, 0)); - CBaseEntity::Create("monster_human_grunt", pev->origin + gpGlobals->v_forward * 128, pev->angles); - } - break; - } case 101: - gEvilImpulse101 = TRUE; - #ifdef REGAMEDLL_ADD AddAccount(int(maxmoney.value)); ALERT(at_console, "Crediting %s with $%i\n", STRING(pev->netname), int(maxmoney.value)); @@ -6161,6 +6206,7 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse) case 102: CGib::SpawnRandomGibs(pev, 1, 1); break; +#ifndef REGAMEDLL_FIXES case 103: { // What the hell are you doing? @@ -6175,10 +6221,12 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse) } break; } +#endif case 104: // Dump all of the global state varaibles (and global entity names) gGlobalState.DumpGlobals(); break; +#ifndef REGAMEDLL_FIXES case 105: { // player makes no sound for monsters to hear. @@ -6194,6 +6242,7 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse) } break; } +#endif case 106: { // Give me the classname and targetname of this entity. @@ -6234,18 +6283,6 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse) break; } - case 195: - // show shortest paths for entire level to nearest node - CBaseEntity::Create("node_viewer_fly", pev->origin, pev->angles); - break; - case 196: - // show shortest paths for entire level to nearest node - CBaseEntity::Create("node_viewer_large", pev->origin, pev->angles); - break; - case 197: - // show shortest paths for entire level to nearest node - CBaseEntity::Create("node_viewer_human", pev->origin, pev->angles); - break; case 202: { // Random blood splatter @@ -6390,7 +6427,7 @@ void OLD_CheckRescueZone(CBasePlayer *pPlayer) CBaseEntity *pSpot = nullptr; while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_hostage_rescue"))) { - if ((pSpot->pev->origin - pPlayer->pev->origin).Length() <= 256.0f) + if ((pSpot->pev->origin - pPlayer->pev->origin).Length() <= MAX_HOSTAGES_RESCUE_RADIUS) { pPlayer->m_signals.Signal(SIGNAL_RESCUE); #ifdef REGAMEDLL_FIXES @@ -6507,8 +6544,6 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(AddPlayerItem)(CBasePlayerItem *pItem) pItem->Kill(); } - else if (gEvilImpulse101) - pItem->Kill(); return FALSE; } @@ -6544,10 +6579,6 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(AddPlayerItem)(CBasePlayerItem *pItem) return TRUE; } - else if (gEvilImpulse101) - { - pItem->Kill(); - } return FALSE; } @@ -6630,7 +6661,7 @@ int EXT_FUNC CBasePlayer::__API_HOOK(GiveAmmo)(int iCount, const char *szName, i { // Send the message that ammo has been picked up MESSAGE_BEGIN(MSG_ONE, gmsgAmmoPickup, nullptr, pev); - WRITE_BYTE(GetAmmoIndex(szName)); // ammo ID + WRITE_BYTE(i); // ammo ID WRITE_BYTE(iAdd); // amount MESSAGE_END(); } @@ -6721,12 +6752,12 @@ void CBasePlayer::SendAmmoUpdate() m_rgAmmoLast[i] = m_rgAmmo[i]; assert(m_rgAmmo[i] >= 0); - assert(m_rgAmmo[i] < 255); + assert(m_rgAmmo[i] <= 255); // send "Ammo" update message MESSAGE_BEGIN(MSG_ONE, gmsgAmmoX, nullptr, pev); WRITE_BYTE(i); - WRITE_BYTE(clamp(m_rgAmmo[i], 0, 254)); // clamp the value to one byte + WRITE_BYTE(clamp(m_rgAmmo[i], 0, 255)); // clamp the value to one byte MESSAGE_END(); } } @@ -6734,12 +6765,13 @@ void CBasePlayer::SendAmmoUpdate() void CBasePlayer::SendHostagePos() { - CBaseEntity *pHostage = nullptr; + CHostage *pHostage = nullptr; + while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity"))) { MESSAGE_BEGIN(MSG_ONE, gmsgHostagePos, nullptr, pev); WRITE_BYTE(1); - WRITE_BYTE(((CHostage *)pHostage)->m_iHostageIndex); + WRITE_BYTE(pHostage->m_iHostageIndex); WRITE_COORD(pHostage->pev->origin.x); WRITE_COORD(pHostage->pev->origin.y); WRITE_COORD(pHostage->pev->origin.z); @@ -6761,7 +6793,7 @@ void CBasePlayer::SendHostageIcons() } int hostagesCount = 0; - CBaseEntity *pHostage = nullptr; + CHostage *pHostage = nullptr; while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity"))) { @@ -6793,8 +6825,6 @@ void CBasePlayer::SendHostageIcons() void CBasePlayer::SendWeatherInfo() { - CBaseEntity *pEnt; - auto SendReceiveW = [&](BYTE byte) { MESSAGE_BEGIN(MSG_ONE, gmsgReceiveW, nullptr, pev); @@ -6803,17 +6833,17 @@ void CBasePlayer::SendWeatherInfo() }; /* Rain */ - if ((pEnt = UTIL_FindEntityByClassname(nullptr, "env_rain"))) + if (UTIL_FindEntityByClassname(nullptr, "env_rain")) return SendReceiveW(1); - if ((pEnt = UTIL_FindEntityByClassname(nullptr, "func_rain"))) + if (UTIL_FindEntityByClassname(nullptr, "func_rain")) return SendReceiveW(1); /* Snow */ - if ((pEnt = UTIL_FindEntityByClassname(nullptr, "env_snow"))) + if (UTIL_FindEntityByClassname(nullptr, "env_snow")) return SendReceiveW(2); - if ((pEnt = UTIL_FindEntityByClassname(nullptr, "func_snow"))) + if (UTIL_FindEntityByClassname(nullptr, "func_snow")) return SendReceiveW(2); } @@ -7682,6 +7712,14 @@ CBaseEntity *EXT_FUNC CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszIte // take item off hud pev->weapons &= ~(1 << pWeapon->m_iId); + +#ifdef REGAMEDLL_FIXES + // No more weapon + if ((pev->weapons & ~(1 << WEAPON_SUIT)) == 0) { + m_iHideHUD |= HIDEHUD_WEAPONS; + } +#endif + g_pGameRules->GetNextBestWeapon(this, pWeapon); UTIL_MakeVectors(pev->angles); @@ -7937,6 +7975,8 @@ void CBasePlayer::__API_HOOK(SwitchTeam)() SendItemStatus(); SetProgressBarTime(0); +#ifndef REGAMEDLL_FIXES + // NOTE: unreachable code - Vaqtincha for (int i = 0; i < MAX_ITEM_TYPES; i++) { m_pActiveItem = m_rgpPlayerItems[i]; @@ -7947,6 +7987,8 @@ void CBasePlayer::__API_HOOK(SwitchTeam)() m_rgpPlayerItems[i] = nullptr; } } +#endif + } szOldTeam = GetTeam(oldTeam); @@ -9626,6 +9668,14 @@ void CBasePlayer::RemoveBomb() if (RemovePlayerItem(pBomb)) { pev->weapons &= ~(1 << pBomb->m_iId); + +#ifdef REGAMEDLL_FIXES + // No more weapon + if ((pev->weapons & ~(1 << WEAPON_SUIT)) == 0) { + m_iHideHUD |= HIDEHUD_WEAPONS; + } +#endif + pBomb->Kill(); } } diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index e6a4576c..20c31a78 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -940,7 +940,6 @@ inline CBasePlayer *UTIL_PlayerByIndexSafe(int playerIndex) return pPlayer; } -extern int gEvilImpulse101; extern entvars_t *g_pevLastInflictor; extern CBaseEntity *g_pLastSpawn; extern CBaseEntity *g_pLastCTSpawn; diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 6a05d1ce..d800cee2 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -576,11 +576,6 @@ void CBasePlayerItem::DefaultTouch(CBaseEntity *pOther) // can I have this? if (!g_pGameRules->CanHavePlayerItem(pPlayer, this)) { - if (gEvilImpulse101) - { - UTIL_Remove(this); - } - return; } @@ -1055,7 +1050,19 @@ void CBasePlayerItem::DestroyItem() if (m_pPlayer) { // if attached to a player, remove. - m_pPlayer->RemovePlayerItem(this); + if (m_pPlayer->RemovePlayerItem(this)) + { + +#ifdef REGAMEDLL_FIXES + m_pPlayer->pev->weapons &= ~(1 << m_iId); + + // No more weapon + if ((m_pPlayer->pev->weapons & ~(1 << WEAPON_SUIT)) == 0) { + m_pPlayer->m_iHideHUD |= HIDEHUD_WEAPONS; + } +#endif + + } } Kill(); @@ -1227,7 +1234,7 @@ BOOL CBasePlayerWeapon::AddPrimaryAmmo(int iCount, char *szName, int iMaxClip, i if (iMaxClip < 1) { - m_iClip = -1; + m_iClip = WEAPON_NOCLIP; iIdAmmo = m_pPlayer->GiveAmmo(iCount, szName, iMaxCarry); } else if (m_iClip == 0) @@ -1450,7 +1457,7 @@ int CBasePlayerWeapon::ExtractClipAmmo(CBasePlayerWeapon *pWeapon) iAmmo = m_iClip; } - return pWeapon->m_pPlayer->GiveAmmo(iAmmo, (char *)pszAmmo1(), iMaxAmmo1()); + return pWeapon->m_pPlayer->GiveAmmo(iAmmo, pszAmmo1(), iMaxAmmo1()); } // RetireWeapon - no more ammo for this gun, put it away. diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 9f8e85ae..859d7ec2 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -808,7 +808,6 @@ private: #define BOMB_FLAG_DROPPED 0 // if the bomb was dropped due to voluntary dropping or death/disconnect #define BOMB_FLAG_PLANTED 1 // if the bomb has been planted will also trigger the round timer to hide will also show where the dropped bomb on the Terrorist team's radar. -const float C4_MAX_AMMO = 1.0f; const float C4_MAX_SPEED = 250.0f; const float C4_ARMING_ON_TIME = 3.0f; diff --git a/regamedll/dlls/weapontype.cpp b/regamedll/dlls/weapontype.cpp index 07d67c60..cc08aed7 100644 --- a/regamedll/dlls/weapontype.cpp +++ b/regamedll/dlls/weapontype.cpp @@ -255,7 +255,7 @@ WeaponInfoStruct g_weaponInfo_default[] = { WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm", "57mm" }, #ifdef REGAMEDLL_FIXES - { WEAPON_C4, 0, 0, 0, 0, 0, AMMO_C4, "weapon_c4", nullptr, "C4" }, + { WEAPON_C4, 0, 0, 0, 0, MAX_AMMO_C4, AMMO_C4, "weapon_c4", nullptr, "C4" }, { WEAPON_KNIFE, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_knife", nullptr, nullptr }, { WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, AMMO_HEGRENADE_PRICE, AMMO_HEGRENADE_BUY, 0, MAX_AMMO_HEGRENADE, AMMO_HEGRENADE, "weapon_hegrenade", nullptr, "HEGrenade" }, { WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, AMMO_SMOKEGRENADE_PRICE, AMMO_SMOKEGRENADE_BUY, 0, MAX_AMMO_SMOKEGRENADE, AMMO_SMOKEGRENADE, "weapon_smokegrenade", nullptr, "SmokeGrenade" }, @@ -285,7 +285,7 @@ AmmoInfoStruct g_ammoInfo_default[] = { AMMO_FLASHBANG, AMMO_FLASHBANG_PRICE, AMMO_FLASHBANG_BUY, MAX_AMMO_FLASHBANG, nullptr, "Flashbang" }, { AMMO_HEGRENADE, AMMO_HEGRENADE_PRICE, AMMO_HEGRENADE_BUY, MAX_AMMO_HEGRENADE, nullptr, "HEGrenade" }, { AMMO_SMOKEGRENADE, AMMO_SMOKEGRENADE_PRICE, AMMO_SMOKEGRENADE_BUY, MAX_AMMO_SMOKEGRENADE, nullptr, "SmokeGrenade" }, - { AMMO_C4, 0, 0, 0, nullptr, "C4" }, + { AMMO_C4, 0, 0, MAX_AMMO_C4, nullptr, "C4" }, }; AmmoInfoStruct g_ammoInfo[ARRAYSIZE(g_ammoInfo_default)]; diff --git a/regamedll/dlls/weapontype.h b/regamedll/dlls/weapontype.h index 7b842c0c..e3527e5f 100644 --- a/regamedll/dlls/weapontype.h +++ b/regamedll/dlls/weapontype.h @@ -263,6 +263,7 @@ enum MaxAmmoType MAX_AMMO_SMOKEGRENADE = 1, MAX_AMMO_HEGRENADE = 1, MAX_AMMO_FLASHBANG = 2, + MAX_AMMO_C4 = 1, }; enum AmmoType diff --git a/regamedll/dlls/wpn_shared/wpn_c4.cpp b/regamedll/dlls/wpn_shared/wpn_c4.cpp index e1a0c0a0..dbe0c7e3 100644 --- a/regamedll/dlls/wpn_shared/wpn_c4.cpp +++ b/regamedll/dlls/wpn_shared/wpn_c4.cpp @@ -44,7 +44,7 @@ int CC4::GetItemInfo(ItemInfo *p) { p->pszName = STRING(pev->classname); p->pszAmmo1 = "C4"; - p->iMaxAmmo1 = C4_MAX_AMMO; + p->iMaxAmmo1 = MAX_AMMO_C4; p->pszAmmo2 = nullptr; p->iMaxAmmo2 = -1; p->iMaxClip = WEAPON_NOCLIP; @@ -88,7 +88,11 @@ void CC4::Holster(int skiplocal) if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]) { +#ifndef REGAMEDLL_FIXES + // Moved to DestroyItem() m_pPlayer->pev->weapons &= ~(1 << WEAPON_C4); +#endif + DestroyItem(); } diff --git a/regamedll/dlls/wpn_shared/wpn_flashbang.cpp b/regamedll/dlls/wpn_shared/wpn_flashbang.cpp index bf8e4f30..f749fc4b 100644 --- a/regamedll/dlls/wpn_shared/wpn_flashbang.cpp +++ b/regamedll/dlls/wpn_shared/wpn_flashbang.cpp @@ -74,7 +74,10 @@ void CFlashbang::Holster(int skiplocal) if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]) { +#ifndef REGAMEDLL_FIXES + // Moved to DestroyItem() m_pPlayer->pev->weapons &= ~(1 << WEAPON_FLASHBANG); +#endif DestroyItem(); } diff --git a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp index 338ae217..864e36cd 100644 --- a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp +++ b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp @@ -77,7 +77,11 @@ void CHEGrenade::Holster(int skiplocal) if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]) { +#ifndef REGAMEDLL_FIXES + // Moved to DestroyItem() m_pPlayer->pev->weapons &= ~(1 << WEAPON_HEGRENADE); +#endif + DestroyItem(); } diff --git a/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp b/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp index 306b508f..6496c498 100644 --- a/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp +++ b/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp @@ -78,7 +78,11 @@ void CSmokeGrenade::Holster(int skiplocal) { // no more smokegrenades! // clear the smokegrenade of bits for HUD +#ifndef REGAMEDLL_FIXES + // Moved to DestroyItem() m_pPlayer->pev->weapons &= ~(1 << WEAPON_SMOKEGRENADE); +#endif + DestroyItem(); }