From e636cbc8f582508c0233b23de616e96998560b77 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 12 Jan 2024 09:16:20 +0700 Subject: [PATCH 01/21] PlayerRelationship: GR_TEAMMATE on checking itself --- regamedll/dlls/multiplay_gamerules.cpp | 3 +++ regamedll/dlls/player.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 90d47582d..c8ce28961 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -4341,6 +4341,9 @@ edict_t *EXT_FUNC CHalfLifeMultiplay::__API_HOOK(GetPlayerSpawnSpot)(CBasePlayer int CHalfLifeMultiplay::PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) { + if (pPlayer == pTarget) + return GR_TEAMMATE; + #ifdef REGAMEDLL_ADD if (IsFreeForAll()) { diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 82c9b984d..e2770a036 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -3663,7 +3663,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(JoiningThink)() } if (m_pIntroCamera && gpGlobals->time >= m_fIntroCamTime -#ifdef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES && m_fIntroCamTime > 0.0 // update only if cameras are available #endif ) From c0f47949ec8893f0f41c7d647fcdbde4d6279c99 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 12 Jan 2024 09:27:40 +0700 Subject: [PATCH 02/21] PM_CategorizePosition: Do not stick to the ground of an OBSERVER or NOCLIP mode --- regamedll/pm_shared/pm_shared.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index b41a23927..e0a57eb22 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -1436,6 +1436,13 @@ void PM_CategorizePosition() // water on each call, and the converse case will correct itself if called twice. PM_CheckWater(); + // Do not stick to the ground of an OBSERVER or NOCLIP mode + if (pmove->movetype == MOVETYPE_NOCLIP || pmove->movetype == MOVETYPE_NONE) + { + pmove->onground = -1; + return; + } + point[0] = pmove->origin[0]; point[1] = pmove->origin[1]; point[2] = pmove->origin[2] - 2; @@ -3275,7 +3282,7 @@ void EXT_FUNC __API_HOOK(PM_Move)(struct playermove_s *ppmove, int server) DbgAssert(pm_shared_initialized); pmove = ppmove; - + #ifdef REGAMEDLL_API pmoveplayer = UTIL_PlayerByIndex(pmove->player_index + 1)->CSPlayer(); #endif From 02a0516c2f257fc3e1b1bcd6408e37143944cc14 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 12 Jan 2024 13:19:01 +0700 Subject: [PATCH 03/21] Reset damage stats on Putin Server --- regamedll/dlls/API/CSPlayer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/regamedll/dlls/API/CSPlayer.cpp b/regamedll/dlls/API/CSPlayer.cpp index 09941134e..8ebf79306 100644 --- a/regamedll/dlls/API/CSPlayer.cpp +++ b/regamedll/dlls/API/CSPlayer.cpp @@ -225,7 +225,7 @@ EXT_FUNC bool CCSPlayer::RemovePlayerItemEx(const char* pszItemName, bool bRemov if (pItem == pPlayer->m_pActiveItem) { ((CBasePlayerWeapon *)pItem)->RetireWeapon(); - + if (pItem->CanHolster() && pItem != pPlayer->m_pActiveItem && !(pPlayer->pev->weapons &(1 << pItem->m_iId))) { return true; } @@ -561,6 +561,8 @@ void CCSPlayer::ResetAllStats() m_iNumKilledByUnanswered[i] = 0; m_bPlayerDominated[i] = false; } + + m_DamageList.Clear(); } void CCSPlayer::OnSpawn() @@ -589,6 +591,7 @@ void CCSPlayer::OnKilled() void CCSPlayer::OnConnect() { ResetVars(); + ResetAllStats(); m_iUserID = GETPLAYERUSERID(BasePlayer()->edict()); } From 89dda43b216bb771a6a1dd6960dbfa0aea603e25 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 12 Jan 2024 13:30:01 +0700 Subject: [PATCH 04/21] fix test demo --- regamedll/pm_shared/pm_shared.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index e0a57eb22..9aac42546 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -1437,11 +1437,13 @@ void PM_CategorizePosition() PM_CheckWater(); // Do not stick to the ground of an OBSERVER or NOCLIP mode +#ifdef REGAMEDLL_FIXES if (pmove->movetype == MOVETYPE_NOCLIP || pmove->movetype == MOVETYPE_NONE) { pmove->onground = -1; return; } +#endif point[0] = pmove->origin[0]; point[1] = pmove->origin[1]; From 051dc0751afdf86d79660bc85c6d7ecbe1e25587 Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Fri, 12 Jan 2024 11:55:00 +0300 Subject: [PATCH 05/21] New ConVar: `mp_defuser_allocation` (#908) --- README.md | 1 + dist/game.cfg | 8 ++++ regamedll/dlls/game.cpp | 2 + regamedll/dlls/game.h | 1 + regamedll/dlls/gamerules.h | 9 ++++ regamedll/dlls/multiplay_gamerules.cpp | 60 ++++++++++++++++++++++++++ regamedll/dlls/player.cpp | 3 ++ 7 files changed, 84 insertions(+) diff --git a/README.md b/README.md index 3150af51a..93cd795d2 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | mp_assist_damage_threshold | 40 | 0 | 100 | Sets the percentage of damage needed to score an assist. | | mp_freezetime_duck | 1 | 0 | 1 | Allow players to duck during freezetime.
`0` disabled
`1` enabled | | mp_freezetime_jump | 1 | 0 | 1 | Allow players to jump during freezetime.
`0` disabled
`1` enabled | +| mp_defuser_allocation | 0 | 0 | 2 | Give defuser on player spawn.
`0` disabled
`1` Random players.
`2` All players. | ## How to install zBot for CS 1.6? diff --git a/dist/game.cfg b/dist/game.cfg index 7d0775713..91009dd00 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -567,3 +567,11 @@ mp_freezetime_duck "1" // // Default value: "1" mp_freezetime_jump "1" + +// Give defuser on player spawn +// 0 - No free defusers (default behavior) +// 1 - Random players +// 2 - All players +// +// Default value: "0" +mp_defuser_allocation "0" diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 423250ce6..4ab375d8b 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -177,6 +177,7 @@ cvar_t hostages_rescued_ratio = { "mp_hostages_rescued_ratio", "1.0", 0, 1.0f, n cvar_t legacy_vehicle_block = { "mp_legacy_vehicle_block", "1", 0, 0.0f, nullptr }; cvar_t dying_time = { "mp_dying_time", "3.0", 0, 3.0f, nullptr }; +cvar_t defuser_allocation = { "mp_defuser_allocation", "0", 0, 0.0f, nullptr }; void GameDLL_Version_f() { @@ -439,6 +440,7 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&freezetime_duck); CVAR_REGISTER(&freezetime_jump); + CVAR_REGISTER(&defuser_allocation); // print version CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n"); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index cff031fbb..706e1c2af 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -200,6 +200,7 @@ extern cvar_t deathmsg_flags; extern cvar_t assist_damage_threshold; extern cvar_t freezetime_duck; extern cvar_t freezetime_jump; +extern cvar_t defuser_allocation; #endif diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index e29aaba88..e7dc35085 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -255,6 +255,13 @@ enum KillRarity KILLRARITY_REVENGE = 0x100 // Revenge by the killer }; +enum +{ + DEFUSERALLOCATION_NONE = 0, + DEFUSERALLOCATION_RANDOM = 1, + DEFUSERALLOCATION_ALL = 2, +}; + class CItem; class CGameRules @@ -738,6 +745,8 @@ class CHalfLifeMultiplay: public CGameRules int GetRarityOfKill(CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, const char *killerWeaponName, bool bFlashAssist); CBasePlayer *CheckAssistsToKill(CBaseEntity *pKiller, CBasePlayer *pVictim, bool &bFlashAssist); + void GiveDefuserToRandomPlayer(); + private: void MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(int iTeam); diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index c8ce28961..229da7c18 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -2063,6 +2063,11 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(RestartRound)() GiveC4(); } +#ifdef REGAMEDLL_ADD + if (m_bMapHasBombTarget && (int)defuser_allocation.value == DEFUSERALLOCATION_RANDOM) + GiveDefuserToRandomPlayer(); +#endif + if (TheBots) { TheBots->OnEvent(EVENT_BUY_TIME_START); @@ -3837,6 +3842,10 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(PlayerSpawn)(CBasePlayer *pPlayer) #ifdef REGAMEDLL_ADD if (respawn_immunitytime.value > 0) pPlayer->SetSpawnProtection(respawn_immunitytime.value); + + // remove any defusers left over from previous random if there is just one random one + if (m_bMapHasBombTarget && (int)defuser_allocation.value == DEFUSERALLOCATION_RANDOM) + pPlayer->RemoveDefuser(); #endif } @@ -5376,3 +5385,54 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(SendDeathMessage)(CBaseEntity *pKil MESSAGE_END(); } + +void CHalfLifeMultiplay::GiveDefuserToRandomPlayer() +{ + int iDefusersToGive = 2; + CUtlVector candidates; + candidates.EnsureCapacity(MAX_CLIENTS); + + // add all CT candidates to a list + for (int i = 1; i <= gpGlobals->maxClients; i++) + { + CBasePlayer *pPlayer = UTIL_PlayerByIndex(i); + if (!pPlayer || FNullEnt(pPlayer->edict())) + continue; + + if (!pPlayer->IsAlive() || pPlayer->m_iTeam != CT) + continue; + + candidates.AddToTail(pPlayer); + } + + // randomly shuffle the list; this will keep the selection random in case of ties + for (int i = 0; i < candidates.Count(); i++) { + SWAP(candidates[i], candidates[RANDOM_LONG(0, candidates.Count() - 1)]); + } + + // now sort the shuffled list into subgroups + candidates.Sort([](CBasePlayer *const *left, CBasePlayer *const *right) -> int { + // should we prioritize humans over bots? + if (cv_bot_defer_to_human.value != 0.0f) + { + if ((*left)->IsBot() && !(*right)->IsBot()) + return 1; + + if (!(*left)->IsBot() && (*right)->IsBot()) + return -1; + } + + return 0; + } + ); + + // give defusers to the first N candidates + for (int i = 0; i < iDefusersToGive && i < candidates.Count(); ++i) + { + CBasePlayer *pPlayer = candidates[i]; + assert(pPlayer && pPlayer->m_iTeam == CT && pPlayer->IsAlive()); + + pPlayer->GiveDefuser(); + ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Got_defuser"); + } +} diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index e2770a036..0bc4e4fc0 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -10314,6 +10314,9 @@ void EXT_FUNC CBasePlayer::__API_HOOK(OnSpawnEquip)(bool addDefault, bool equipG case ARMOR_VESTHELM: GiveNamedItemEx("item_assaultsuit"); break; } } + + if (NeedsDefuseKit() && (int)defuser_allocation.value == DEFUSERALLOCATION_ALL) + GiveNamedItemEx("item_thighpack"); #endif } From 4b49f630da970cc62bb3cd7ecd65710dd7d87122 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 19 Jan 2024 20:33:01 +0700 Subject: [PATCH 06/21] Fix mismatched damage glock18 in burst mode 18 against 25 (GLOCK18_DAMAGE) --- regamedll/dlls/weapons.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index ee35153f2..811b901cd 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -767,9 +767,15 @@ void CBasePlayerWeapon::FireRemaining(int &shotsFired, float &shootTime, BOOL bI flag = 0; #endif +#ifdef REGAMEDLL_API + float flBaseDamage = CSPlayerWeapon()->m_flBaseDamage; +#else + float flBaseDamage = bIsGlock ? GLOCK18_DAMAGE : FAMAS_DAMAGE; +#endif + if (bIsGlock) { - vecDir = m_pPlayer->FireBullets3(vecSrc, gpGlobals->v_forward, 0.05, 8192, 1, BULLET_PLAYER_9MM, 18, 0.9, m_pPlayer->pev, true, m_pPlayer->random_seed); + vecDir = m_pPlayer->FireBullets3(vecSrc, gpGlobals->v_forward, 0.05, 8192, 1, BULLET_PLAYER_9MM, flBaseDamage, 0.9, m_pPlayer->pev, true, m_pPlayer->random_seed); #ifndef REGAMEDLL_FIXES --m_pPlayer->ammo_9mm; #endif @@ -778,8 +784,7 @@ void CBasePlayerWeapon::FireRemaining(int &shotsFired, float &shootTime, BOOL bI } else { - - vecDir = m_pPlayer->FireBullets3(vecSrc, gpGlobals->v_forward, m_fBurstSpread, 8192, 2, BULLET_PLAYER_556MM, 30, 0.96, m_pPlayer->pev, false, m_pPlayer->random_seed); + vecDir = m_pPlayer->FireBullets3(vecSrc, gpGlobals->v_forward, m_fBurstSpread, 8192, 2, BULLET_PLAYER_556MM, flBaseDamage, 0.96, m_pPlayer->pev, false, m_pPlayer->random_seed); #ifndef REGAMEDLL_FIXES --m_pPlayer->ammo_556nato; #endif @@ -1856,11 +1861,11 @@ void CWeaponBox::Touch(CBaseEntity *pOther) bool bRemove = true; -#ifdef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES CBasePlayerItem *givenItem = nullptr; #else bool givenItem = false; -#endif +#endif // go through my weapons and try to give the usable ones to the player. // it's important the the player be given ammo first, so the weapons code doesn't refuse @@ -2055,7 +2060,7 @@ void CWeaponBox::Touch(CBaseEntity *pOther) pItem->AttachToPlayer(pPlayer); #ifdef REGAMEDLL_FIXES givenItem = pItem; -#else +#else givenItem = true; #endif } @@ -2095,13 +2100,13 @@ void CWeaponBox::Touch(CBaseEntity *pOther) { EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM); -#ifdef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES // BUGBUG: weaponbox links gun to player, then ammo is given // so FShouldSwitchWeapon's CanHolster (which checks ammo) check inside AddPlayerItem // return FALSE, causing an unarmed player to not deploy any weaponbox grenade if (pPlayer->m_pActiveItem != givenItem && CSGameRules()->FShouldSwitchWeapon(pPlayer, givenItem)) { - // This re-check is done after ammo is given + // This re-check is done after ammo is given // so it ensures player properly deploys grenade from floor pPlayer->SwitchWeapon(givenItem); } From 2d957a79152eda0ed85ee7f5e725d093ac2f8836 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 31 Jan 2024 15:10:08 +0700 Subject: [PATCH 07/21] utlvector.h fix assert --- regamedll/public/utlvector.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/regamedll/public/utlvector.h b/regamedll/public/utlvector.h index e3f34e585..8c0b20d3e 100644 --- a/regamedll/public/utlvector.h +++ b/regamedll/public/utlvector.h @@ -43,13 +43,6 @@ class CUtlVector CUtlVector(T *pMemory, int numElements); ~CUtlVector(); - // features C++11 ranged based for - T *begin() { return &m_Memory[0]; } - T *end() { return &m_Memory[m_Size]; } - - T const *begin() const { return &m_Memory[0]; } - T const *end() const { return &m_Memory[m_Size]; } - // Copy the array. CUtlVector &operator=(const CUtlVector &other); @@ -59,6 +52,13 @@ class CUtlVector T &Element(int i); T const &Element(int i) const; + // STL compatible member functions. These allow easier use of std::sort + // and they are forward compatible with the C++ 11 range-based for loops + T *begin() { return Base(); } + const T *begin() const { return Base(); } + T *end() { return Base() + Count(); } + const T *end() const { return Base() + Count(); } + // Gets the base address (can change when adding elements!) T *Base(); T const *Base() const; @@ -583,13 +583,13 @@ void CUtlVector::SetGrowSize(int size) template void CUtlVector::Sort() { - std::sort(Base(), Base() + Count()); + std::sort(begin(), end()); } template void CUtlVector::Sort(bool (*pfnLessFunc)(const T &src1, const T &src2)) { - std::sort(Base(), Base() + Count(), + std::sort(begin(), end(), [pfnLessFunc](const T &a, const T &b) -> bool { if (&a == &b) @@ -628,5 +628,5 @@ template template void CUtlVector::SortPredicate(F &&predicate) { - std::sort(Base(), Base() + Count(), predicate); + std::sort(begin(), end(), predicate); } From bde6aa07bcd1c359e38eaf5e908886d4d8762b20 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 31 Jan 2024 15:51:44 +0700 Subject: [PATCH 08/21] Disable door asserts (Resolves #926) --- regamedll/dlls/buttons.cpp | 7 +++++++ regamedll/dlls/doors.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/regamedll/dlls/buttons.cpp b/regamedll/dlls/buttons.cpp index 8e38b369f..8ad08fe71 100644 --- a/regamedll/dlls/buttons.cpp +++ b/regamedll/dlls/buttons.cpp @@ -1,5 +1,12 @@ #include "precompiled.h" +#if !defined(DOOR_ASSERT) +#undef DbgAssert +#undef DbgAssertMsg +#define DbgAssert(_exp) ((void)0) +#define DbgAssertMsg(_exp, _msg) ((void)0) +#endif + TYPEDESCRIPTION CEnvGlobal::m_SaveData[] = { DEFINE_FIELD(CEnvGlobal, m_globalstate, FIELD_STRING), diff --git a/regamedll/dlls/doors.cpp b/regamedll/dlls/doors.cpp index ada7e6a82..a6b252bc0 100644 --- a/regamedll/dlls/doors.cpp +++ b/regamedll/dlls/doors.cpp @@ -1,5 +1,12 @@ #include "precompiled.h" +#if !defined(DOOR_ASSERT) +#undef DbgAssert +#undef DbgAssertMsg +#define DbgAssert(_exp) ((void)0) +#define DbgAssertMsg(_exp, _msg) ((void)0) +#endif + TYPEDESCRIPTION CBaseDoor::m_SaveData[] = { DEFINE_FIELD(CBaseDoor, m_bHealthValue, FIELD_CHARACTER), @@ -695,10 +702,7 @@ void CBaseDoor::DoorGoDown() } } -#ifdef DOOR_ASSERT DbgAssert(m_toggle_state == TS_AT_TOP); -#endif - m_toggle_state = TS_GOING_DOWN; SetMoveDone(&CBaseDoor::DoorHitBottom); From a1af7ca4260f6f6f5a8d795d654efe91d7603ff5 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 31 Jan 2024 17:40:47 +0700 Subject: [PATCH 09/21] CBasePlayer::WaterMove: No water sound playback occurs when clients emerge from network lag or was using noclip --- regamedll/dlls/player.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 0bc4e4fc0..fd8b507ea 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -3082,11 +3082,16 @@ void CBasePlayer::WaterMove() // not underwater // play 'up for air' sound - if (pev->air_finished < gpGlobals->time) - EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/pl_wade1.wav", VOL_NORM, ATTN_NORM); +#ifdef REGAMEDLL_FIXES + if (pev->flags & FL_INWATER) +#endif + { + if (pev->air_finished < gpGlobals->time) + EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/pl_wade1.wav", VOL_NORM, ATTN_NORM); - else if (pev->air_finished < gpGlobals->time + 9) - EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/pl_wade2.wav", VOL_NORM, ATTN_NORM); + else if (pev->air_finished < gpGlobals->time + 9) + EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/pl_wade2.wav", VOL_NORM, ATTN_NORM); + } pev->air_finished = gpGlobals->time + AIRTIME; pev->dmg = 2; From b34d564e3cd9a4283de6c59ea36783714f2f18e3 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 31 Jan 2024 17:52:38 +0700 Subject: [PATCH 10/21] PM_CheckWater: Fix for uninitialized waterlevel value for dead players (incorrect waterlevel values from another player movements persisting) --- regamedll/pm_shared/pm_shared.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index 9aac42546..ed6819769 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -1345,27 +1345,27 @@ qboolean PM_InWater() // Sets pmove->waterlevel and pmove->watertype values. qboolean PM_CheckWater() { -#ifdef REGAMEDLL_FIXES - // do not check for dead - if (pmove->dead || pmove->deadflag != DEAD_NO) - return FALSE; -#endif - vec3_t point; int cont; int truecont; float height; float heightover2; + // Assume that we are not in water at all. + pmove->waterlevel = 0; + pmove->watertype = CONTENTS_EMPTY; + +#ifdef REGAMEDLL_FIXES + // do not check for dead + if (pmove->dead || pmove->deadflag != DEAD_NO) + return FALSE; +#endif + // Pick a spot just above the players feet. point[0] = pmove->origin[0] + (pmove->player_mins[pmove->usehull][0] + pmove->player_maxs[pmove->usehull][0]) * 0.5f; point[1] = pmove->origin[1] + (pmove->player_mins[pmove->usehull][1] + pmove->player_maxs[pmove->usehull][1]) * 0.5f; point[2] = pmove->origin[2] + pmove->player_mins[pmove->usehull][2] + 1; - // Assume that we are not in water at all. - pmove->waterlevel = 0; - pmove->watertype = CONTENTS_EMPTY; - // Grab point contents. cont = pmove->PM_PointContents(point, &truecont); From aec3ba2579b0ef50157b9f4a2bf6643b3f8a80b0 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 31 Jan 2024 18:33:34 +0700 Subject: [PATCH 11/21] Fixed m_looseBombArea assertion --- regamedll/dlls/bot/cs_bot_manager.cpp | 2 +- regamedll/game_shared/bot/nav_area.cpp | 5 +++++ regamedll/game_shared/bot/nav_area.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index 6324ceeb7..345ae31f1 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -1452,7 +1452,7 @@ void CCSBotManager::SetLooseBomb(CBaseEntity *bomb) if (bomb) { m_looseBombArea = TheNavAreaGrid.GetNearestNavArea(&bomb->pev->origin); - DbgAssert(m_looseBombArea); // TODO: Need investigation and find out why it cannot find nearest area for a lost bomb, just catch it + DbgAssert(!TheNavAreaGrid.IsValid() || m_looseBombArea); // TODO: Need investigation and find out why it cannot find nearest area for a lost bomb, just catch it } else { diff --git a/regamedll/game_shared/bot/nav_area.cpp b/regamedll/game_shared/bot/nav_area.cpp index 4e4bb309d..1ff3ef8c5 100644 --- a/regamedll/game_shared/bot/nav_area.cpp +++ b/regamedll/game_shared/bot/nav_area.cpp @@ -4674,6 +4674,11 @@ void CNavAreaGrid::RemoveNavArea(CNavArea *area) m_areaCount--; } +bool CNavAreaGrid::IsValid() const +{ + return m_grid && m_areaCount > 0; +} + // Given a position, return the nav area that IsOverlapping and is *immediately* beneath it CNavArea *CNavAreaGrid::GetNavArea(const Vector *pos, float beneathLimit) const { diff --git a/regamedll/game_shared/bot/nav_area.h b/regamedll/game_shared/bot/nav_area.h index 434424a1c..d1ed024ec 100644 --- a/regamedll/game_shared/bot/nav_area.h +++ b/regamedll/game_shared/bot/nav_area.h @@ -503,6 +503,7 @@ class CNavAreaGrid CNavArea *GetNavAreaByID(unsigned int id) const; CNavArea *GetNearestNavArea(const Vector *pos, bool anyZ = false) const; + bool IsValid() const; Place GetPlace(const Vector *pos) const; // return radio chatter place for given coordinate private: From 0bbc4bd55d437a7097ba969b0922b1bd14a4380c Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 31 Jan 2024 18:38:47 +0700 Subject: [PATCH 12/21] Do not reduce points for suicide due to a fatal fall --- regamedll/dlls/multiplay_gamerules.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 229da7c18..e0d27dfb2 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -3960,11 +3960,20 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(PlayerKilled)(CBasePlayer *pVictim, } FireTargets("game_playerdie", pVictim, pVictim, USE_TOGGLE, 0); + +#ifdef REGAMEDLL_FIXES + // Did the player die from a fall? + if (pVictim->m_bitsDamageType & DMG_FALL) + { + // do nothing + } + else +#endif // Did the player kill himself? if (pVictim->pev == pKiller) { // Players lose a frag for killing themselves - pKiller->frags -= 1; + pVictim->pev->frags -= 1; } else if (peKiller && peKiller->IsPlayer()) { @@ -5404,7 +5413,7 @@ void CHalfLifeMultiplay::GiveDefuserToRandomPlayer() candidates.AddToTail(pPlayer); } - + // randomly shuffle the list; this will keep the selection random in case of ties for (int i = 0; i < candidates.Count(); i++) { SWAP(candidates[i], candidates[RANDOM_LONG(0, candidates.Count() - 1)]); From 5287f2a4150ed128e7951fc02ba32a184ed6684b Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 31 Jan 2024 19:16:37 +0700 Subject: [PATCH 13/21] Do not reduce points for bot suicide due bot_kill command --- regamedll/dlls/bot/cs_bot.cpp | 14 ++++++++++++++ regamedll/dlls/bot/cs_bot.h | 4 ++++ regamedll/dlls/bot/cs_bot_manager.cpp | 5 ++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/regamedll/dlls/bot/cs_bot.cpp b/regamedll/dlls/bot/cs_bot.cpp index b0a484724..838387a95 100644 --- a/regamedll/dlls/bot/cs_bot.cpp +++ b/regamedll/dlls/bot/cs_bot.cpp @@ -429,6 +429,20 @@ bool CCSBot::StayOnNavMesh() return false; } +#ifdef REGAMEDLL_FIXES +void CCSBot::Kill() +{ + m_LastHitGroup = HITGROUP_GENERIC; + + // have the player kill himself + pev->health = 0.0f; + Killed(VARS(eoNullEntity), GIB_NEVER); + + if (CSGameRules()->m_pVIP == this) + CSGameRules()->m_iConsecutiveVIP = 10; +} +#endif + void CCSBot::Panic(CBasePlayer *pEnemy) { if (IsSurprised()) diff --git a/regamedll/dlls/bot/cs_bot.h b/regamedll/dlls/bot/cs_bot.h index 345e11fbd..9670744f9 100644 --- a/regamedll/dlls/bot/cs_bot.h +++ b/regamedll/dlls/bot/cs_bot.h @@ -375,6 +375,10 @@ class CCSBot: public CBot bool IsBuying() const; +#ifdef REGAMEDLL_FIXES + void Kill(); +#endif + void Panic(CBasePlayer *pEnemy); // look around in panic void Follow(CBasePlayer *pPlayer); // begin following given Player void ContinueFollowing(); // continue following our leader after finishing what we were doing diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index 345ae31f1..78ce0cf5d 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -408,10 +408,9 @@ void CCSBotManager::ServerCommand(const char *pcmd) if (pPlayer->IsBot()) { + CCSBot *pBot = static_cast(pPlayer); if (killThemAll || FStrEq(name, msg)) - { - pPlayer->Kill(); - } + pBot->Kill(); } } } From 0bc4ff1d405000d8bebb5141bbc1f748f69c0d1e Mon Sep 17 00:00:00 2001 From: Rafflesian <56321479+Rafflesian@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:35:26 -0300 Subject: [PATCH 14/21] Support for secondary ammo and extra EF_ flags (#934) Support for secondary ammo and extra EF_ flags --- regamedll/common/const.h | 5 ++++ regamedll/dlls/client.cpp | 28 ++++++++++++++++++---- regamedll/dlls/player.cpp | 48 +++++++++++++++++++++++++++++--------- regamedll/dlls/weapons.cpp | 14 +++++++++++ regamedll/dlls/weapons.h | 16 ++++++++----- 5 files changed, 90 insertions(+), 21 deletions(-) diff --git a/regamedll/common/const.h b/regamedll/common/const.h index 024a2a3d5..f6ec01c48 100644 --- a/regamedll/common/const.h +++ b/regamedll/common/const.h @@ -158,6 +158,11 @@ #define EF_FORCEVISIBILITY BIT(11) // force visibility #define EF_OWNER_VISIBILITY BIT(12) // visibility for owner #define EF_OWNER_NO_VISIBILITY BIT(13) // no visibility for owner +#define EF_NOSLERP BIT(14) // no slerp flag for this entity (addtofullpack) +#define EF_FOLLOWKEEPRENDER BIT(15) // the entity following will not copy the render (like it follows nothing) + +// Custom flags that aren't handled by the client +#define EF_CUSTOM_BITS (EF_FORCEVISIBILITY | EF_OWNER_VISIBILITY | EF_OWNER_NO_VISIBILITY | EF_NOSLERP | EF_FOLLOWKEEPRENDER) // state->eflags values #define EFLAG_SLERP 1 // do studio interpolation of this entity diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 4d42cbe34..2a58443d7 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -249,7 +249,7 @@ void WriteSigonMessages() #ifdef PLAY_GAMEDLL // TODO: fix test demo - iFlags &= ~ITEM_FLAG_NOFIREUNDERWATER; + iFlags &= ~ITEM_FLAG_CUSTOM; #endif MESSAGE_BEGIN(MSG_INIT, gmsgWeaponList); @@ -4479,7 +4479,7 @@ BOOL EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, e #ifdef REGAMEDLL_ADD // don't send unhandled custom bits to client - state->effects &= ~(EF_FORCEVISIBILITY | EF_OWNER_VISIBILITY | EF_OWNER_NO_VISIBILITY); + state->effects &= ~EF_CUSTOM_BITS; if (ent->v.skin == CONTENTS_LADDER && (host->v.iuser3 & PLAYER_PREVENT_CLIMB) == PLAYER_PREVENT_CLIMB) { @@ -4487,7 +4487,13 @@ BOOL EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, e } #endif - if (!player && ent->v.animtime && !ent->v.velocity.x && !ent->v.velocity.y && !ent->v.velocity.z) + // add studio interpolation if non-player entity is moving (why?) + if (!player && +#ifdef REGAMEDLL_ADD + // adds slerp (studio interpolation) if not set + !(ent->v.effects & EF_NOSLERP) && +#endif + ent->v.animtime && !ent->v.velocity.x && !ent->v.velocity.y && !ent->v.velocity.z) state->eflags |= EFLAG_SLERP; state->scale = ent->v.scale; @@ -4513,8 +4519,22 @@ BOOL EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, e state->aiment = 0; + // following something if (ent->v.aiment) - state->aiment = ENTINDEX(ent->v.aiment); + { +#ifdef REGAMEDLL_ADD + // if set, it will still follow the player with a bit of "delay", still looks fine (experimental) + if (ent->v.effects & EF_FOLLOWKEEPRENDER) + { + // will keep the current render entity values if it's set + state->movetype = MOVETYPE_NONE; + } + else +#endif + { + state->aiment = ENTINDEX(ent->v.aiment); + } + } state->owner = 0; if (ent->v.owner) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index fd8b507ea..d12768c16 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -1303,26 +1303,52 @@ CWeaponBox *EXT_FUNC __API_HOOK(CreateWeaponBox)(CBasePlayerItem *pItem, CBasePl pWeaponBox->pev->nextthink = gpGlobals->time + lifeTime; pWeaponBox->PackWeapon(pItem); // now pack all of the items in the lists - // pack the ammo - bool exhaustibleAmmo = (pItem->iFlags() & ITEM_FLAG_EXHAUSTIBLE) == ITEM_FLAG_EXHAUSTIBLE; - if ((exhaustibleAmmo || packAmmo) && pPlayerOwner) + // player is the ammo source + if (pPlayerOwner) { -#ifndef REGAMEDLL_ADD - pWeaponBox->PackAmmo(MAKE_STRING(pItem->pszAmmo1()), pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()]); -#else - pWeaponBox->GiveAmmo(pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()], (char *)pItem->pszAmmo1(), pItem->iMaxAmmo1()); -#endif -#ifndef REGAMEDLL_FIXES // by removing ammo ONLY on exhaustible weapons (slot 4 and 5) // you are allowing to duplicate ammo whenever: // (1) you have 2 weapons sharing the same ammo type (e.g. mp5navy and glock) // (2) you are dropping a weapon alive and pickup another (with same ammo type) without ammo // and, logically, you throw your ammo with your gun with packing enabled - if (exhaustibleAmmo) + bool exhaustibleAmmo = (pItem->iFlags() & ITEM_FLAG_EXHAUSTIBLE) == ITEM_FLAG_EXHAUSTIBLE; + + // pack the primary ammo + if (exhaustibleAmmo || packAmmo) + { +#ifndef REGAMEDLL_ADD + pWeaponBox->PackAmmo(MAKE_STRING(pItem->pszAmmo1()), pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()]); +#else + pWeaponBox->GiveAmmo(pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()], (char *)pItem->pszAmmo1(), pItem->iMaxAmmo1()); +#endif + +#ifndef REGAMEDLL_FIXES + if (exhaustibleAmmo) #endif + { + pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()] = 0; + } + } + + // (3rd party support) now that reapi can register custom ammo +#ifdef REGAMEDLL_ADD + // use this flag if you don't want the player harvesting this kind of ammo from dropped weapons + bool exhaustSecondaryAmmo = (pItem->iFlags() & ITEM_FLAG_EXHAUST_SECONDARYAMMO) == ITEM_FLAG_EXHAUST_SECONDARYAMMO; + int iSecondaryAmmoIndex = pItem->SecondaryAmmoIndex(); + + // pack secondary ammo now (must be valid too) + if ((exhaustibleAmmo || exhaustSecondaryAmmo || packAmmo) && iSecondaryAmmoIndex != -1) { - pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()] = 0; + pWeaponBox->GiveAmmo(pPlayerOwner->m_rgAmmo[iSecondaryAmmoIndex], (char *)pItem->pszAmmo2(), pItem->iMaxAmmo2()); + +#ifndef REGAMEDLL_FIXES + if (exhaustibleAmmo) +#endif + { + pPlayerOwner->m_rgAmmo[iSecondaryAmmoIndex] = 0; + } } +#endif } pWeaponBox->SetModel(modelName); diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 811b901cd..acb3936cf 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -1259,9 +1259,19 @@ int CBasePlayerWeapon::AddToPlayer(CBasePlayer *pPlayer) if (!m_iPrimaryAmmoType) { m_iPrimaryAmmoType = pPlayer->GetAmmoIndex(pszAmmo1()); +#ifndef REGAMEDLL_FIXES m_iSecondaryAmmoType = pPlayer->GetAmmoIndex(pszAmmo2()); +#endif } +#ifdef REGAMEDLL_FIXES + // (3rd party support) if someone updates (or screws) the secondary ammo type later + if (!m_iSecondaryAmmoType) + { + m_iSecondaryAmmoType = pPlayer->GetAmmoIndex(pszAmmo2()); + } +#endif + if (AddWeapon()) { return CBasePlayerItem::AddToPlayer(pPlayer); @@ -1587,7 +1597,11 @@ int CBasePlayerWeapon::PrimaryAmmoIndex() int CBasePlayerWeapon::SecondaryAmmoIndex() { +#ifdef REGAMEDLL_ADD + return m_iSecondaryAmmoType; +#else return -1; +#endif } void CBasePlayerWeapon::Holster(int skiplocal) diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 431284fb9..82e1356d2 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -35,12 +35,16 @@ const float MAX_DIST_RELOAD_SOUND = 512.0f; #define MAX_WEAPONS 32 -#define ITEM_FLAG_SELECTONEMPTY BIT(0) -#define ITEM_FLAG_NOAUTORELOAD BIT(1) -#define ITEM_FLAG_NOAUTOSWITCHEMPTY BIT(2) -#define ITEM_FLAG_LIMITINWORLD BIT(3) -#define ITEM_FLAG_EXHAUSTIBLE BIT(4) // A player can totally exhaust their ammo supply and lose this weapon -#define ITEM_FLAG_NOFIREUNDERWATER BIT(5) +#define ITEM_FLAG_SELECTONEMPTY BIT(0) +#define ITEM_FLAG_NOAUTORELOAD BIT(1) +#define ITEM_FLAG_NOAUTOSWITCHEMPTY BIT(2) +#define ITEM_FLAG_LIMITINWORLD BIT(3) +#define ITEM_FLAG_EXHAUSTIBLE BIT(4) // A player can totally exhaust their ammo supply and lose this weapon +#define ITEM_FLAG_NOFIREUNDERWATER BIT(5) +#define ITEM_FLAG_EXHAUST_SECONDARYAMMO BIT(6) // A player will exhaust weapon's secondary ammo supply if dropped (ITEM_FLAG_EXHAUSTIBLE does both) + +// if someone has an idea for another flag pack it here, so client prediction will not be screwed (or something) if PLAY_GAMEDLL is defined +#define ITEM_FLAG_CUSTOM (ITEM_FLAG_NOFIREUNDERWATER | ITEM_FLAG_EXHAUST_SECONDARYAMMO) #define WEAPON_IS_ONTARGET 0x40 From fb9eb0db55f6c24a333569eda1640360bdc8b0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mu=C3=B1oz?= Date: Wed, 31 Jan 2024 09:38:35 -0300 Subject: [PATCH 15/21] Fix excessive punchangle when getting shield shot (#919) --- regamedll/dlls/cbase.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/regamedll/dlls/cbase.cpp b/regamedll/dlls/cbase.cpp index 1d706299b..ebfd2fdc2 100644 --- a/regamedll/dlls/cbase.cpp +++ b/regamedll/dlls/cbase.cpp @@ -1449,7 +1449,11 @@ VectorRef CBaseEntity::__API_HOOK(FireBullets3)(VectorRef vecSrc, VectorRef vecD pEntity->pev->punchangle.x = iCurrentDamage * RANDOM_FLOAT(-0.15, 0.15); pEntity->pev->punchangle.z = iCurrentDamage * RANDOM_FLOAT(-0.15, 0.15); +#ifndef REGAMEDLL_FIXES if (pEntity->pev->punchangle.x < 4) +#else + if (pEntity->pev->punchangle.x < -4) +#endif { pEntity->pev->punchangle.x = -4; } From 2489213127db3b73cb2946ce8fe076053dbb9880 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 1 Feb 2024 12:21:23 +0700 Subject: [PATCH 16/21] Resetable g_weaponSlotInfo --- regamedll/dlls/weapontype.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/regamedll/dlls/weapontype.cpp b/regamedll/dlls/weapontype.cpp index 2b8ae4458..dd7dc0f82 100644 --- a/regamedll/dlls/weapontype.cpp +++ b/regamedll/dlls/weapontype.cpp @@ -290,7 +290,7 @@ AmmoInfoStruct g_ammoInfo_default[] = AmmoInfoStruct g_ammoInfo[ARRAYSIZE(g_ammoInfo_default)]; -WeaponSlotInfo g_weaponSlotInfo[] = { +WeaponSlotInfo g_weaponSlotInfo_default[] = { { WEAPON_C4, C4_SLOT, "weapon_c4" }, { WEAPON_KNIFE, KNIFE_SLOT, "weapon_knife" }, { WEAPON_P228, PISTOL_SLOT, "weapon_p228" }, @@ -324,6 +324,8 @@ WeaponSlotInfo g_weaponSlotInfo[] = { { WEAPON_SHIELDGUN, NONE_SLOT, "weapon_shield" }, }; +WeaponSlotInfo g_weaponSlotInfo[ARRAYSIZE(g_weaponSlotInfo_default)]; + // Given an alias, return the associated weapon ID WeaponIdType AliasToWeaponID(const char *alias) { @@ -566,6 +568,7 @@ void WeaponInfoReset() { Q_memcpy(g_weaponInfo, g_weaponInfo_default, sizeof(g_weaponInfo)); Q_memcpy(g_ammoInfo, g_ammoInfo_default, sizeof(g_ammoInfo)); + Q_memcpy(g_weaponSlotInfo, g_weaponSlotInfo_default, sizeof(g_weaponSlotInfo)); } WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID) From f4c4e891ac094937cc56c26a17d0b2416d92b0c2 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 1 Feb 2024 16:38:16 +0700 Subject: [PATCH 17/21] CBasePlayerWeapon::ExtractAmmo: Fixed reverse-engineering mistake --- regamedll/dlls/weapons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index acb3936cf..d14a83ba5 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -1631,7 +1631,7 @@ int CBasePlayerWeapon::ExtractAmmo(CBasePlayerWeapon *pWeapon) if (pszAmmo2()) { - res = AddSecondaryAmmo(0, (char *)pszAmmo2(), iMaxAmmo2()); + res = pWeapon->AddSecondaryAmmo(0, (char *)pszAmmo2(), iMaxAmmo2()); } return res; From 4d90a5f4faabd1d220f7bbd0bfc7c246c3896717 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 1 Feb 2024 18:20:11 +0700 Subject: [PATCH 18/21] CWeaponBox::Touch: Fix grenade pickup (Resolves #923, Closes #931) --- regamedll/dlls/weapons.cpp | 118 +++++++++++++++++++++++++++---------- regamedll/dlls/weapons.h | 5 +- 2 files changed, 90 insertions(+), 33 deletions(-) diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index d14a83ba5..e6524a96c 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -1846,6 +1846,58 @@ void CWeaponBox::Kill() UTIL_Remove(this); } +bool CWeaponBox::GiveAmmoToPlayer(CBasePlayer *pPlayer, CBasePlayerWeapon *pWeapon, int iCurrentAmmo, const char *pszAmmo, int iMaxAmmo, CBasePlayerItem **pGivenItem) +{ + if (iCurrentAmmo >= iMaxAmmo) + return false; // can't pickup more, these ammo are full in backpack + + // If already have a weapon in backpack, just refill ammo for it + if (iCurrentAmmo > 0) + { + int iAmmoIndex = GetAmmoIndex(pszAmmo); + if (iAmmoIndex > 0) + { + // how many gren ammo can pick up? + int iAmmoPickup = min(m_rgAmmo[iAmmoIndex], iMaxAmmo - iCurrentAmmo); + if (iAmmoPickup > 0) + { + if (!FStringNull(m_rgiszAmmo[iAmmoIndex]) && + pPlayer->GiveAmmo(iAmmoPickup, STRING(m_rgiszAmmo[iAmmoIndex]), iMaxAmmo) != -1) + { + m_rgAmmo[iAmmoIndex] -= iAmmoPickup; + + if (m_rgAmmo[iAmmoIndex] < 0) + m_rgAmmo[iAmmoIndex] = 0; + + EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "items/9mmclip1.wav", VOL_NORM, ATTN_NORM); + } + } + + // ammo exhausted, remove this weapon + if (m_rgAmmo[iAmmoIndex] <= 0) + { + pWeapon->Kill(); + + // unlink this weapon from the box + return true; + } + + // ammo has not been exhausted yet, keep this weapon in weaponbox + return false; + } + } + + // If no weapon in backpack, then issue weapon + if (pPlayer->AddPlayerItem(pWeapon)) + { + pWeapon->AttachToPlayer(pPlayer); + if (pGivenItem) *pGivenItem = pWeapon; + } + + // unlink this weapon from the box + return true; +} + // Try to add my contents to the toucher if the toucher is a player. void CWeaponBox::Touch(CBaseEntity *pOther) { @@ -1991,38 +2043,17 @@ void CWeaponBox::Touch(CBaseEntity *pOther) int playerGrenades = pPlayer->m_rgAmmo[pGrenade->m_iPrimaryAmmoType]; #ifdef REGAMEDLL_FIXES - // sorry for hardcode :( - const int boxAmmoSlot = 1; + CBasePlayerItem *pNext = m_rgpPlayerItems[i]->m_pNext; - if (playerGrenades < pGrenade->iMaxAmmo1()) + // Pickup grenade item or refill ammo + if (GiveAmmoToPlayer(pPlayer, pGrenade, + playerGrenades, pGrenade->pszAmmo1(), pGrenade->iMaxAmmo1(), &givenItem)) { - if (m_rgAmmo[boxAmmoSlot] > 1 && playerGrenades > 0) - { - if (!FStringNull(m_rgiszAmmo[boxAmmoSlot]) - && pPlayer->GiveAmmo(1, STRING(m_rgiszAmmo[boxAmmoSlot]), pGrenade->iMaxAmmo1()) != -1) - { - m_rgAmmo[boxAmmoSlot]--; - - EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "items/9mmclip1.wav", VOL_NORM, ATTN_NORM); - } - } - else - { - auto pNext = m_rgpPlayerItems[i]->m_pNext; - - if (pPlayer->AddPlayerItem(pItem)) - { - pItem->AttachToPlayer(pPlayer); - givenItem = pItem; - } - - // unlink this weapon from the box - m_rgpPlayerItems[i] = pItem = pNext; - continue; - } + // unlink this weapon from the box + m_rgpPlayerItems[i] = pItem = pNext; + continue; } #else - int maxGrenades = 0; const char *grenadeName = nullptr; @@ -2096,13 +2127,18 @@ void CWeaponBox::Touch(CBaseEntity *pOther) { if (!FStringNull(m_rgiszAmmo[n])) { - // there's some ammo of this type. -#ifndef REGAMEDLL_ADD - pPlayer->GiveAmmo(m_rgAmmo[n], (char *)STRING(m_rgiszAmmo[n]), MaxAmmoCarry(m_rgiszAmmo[n])); + // there's some ammo of this type + if (m_rgAmmo[n] > 0) + { +#ifdef REGAMEDLL_ADD + int iMaxAmmo = m_rgAmmo[n]; #else - pPlayer->GiveAmmo(m_rgAmmo[n], STRING(m_rgiszAmmo[n]), m_rgAmmo[n]); + int iMaxAmmo = MaxAmmoCarry(m_rgiszAmmo[n]); #endif + pPlayer->GiveAmmo(m_rgAmmo[n], STRING(m_rgiszAmmo[n]), iMaxAmmo); + } + // now empty the ammo from the weaponbox since we just gave it to the player m_rgiszAmmo[n] = iStringNull; m_rgAmmo[n] = 0; @@ -2242,6 +2278,24 @@ int CWeaponBox::GiveAmmo(int iCount, char *szName, int iMax, int *pIndex) return i; } +int CWeaponBox::GetAmmoIndex(const char *psz) const +{ + if (!psz) + return -1; + + int i; + for (i = 1; i < MAX_AMMO_SLOTS; i++) + { + if (FStringNull(m_rgiszAmmo[i])) + continue; + + if (!Q_stricmp(STRING(m_rgiszAmmo[i]), psz)) + return i; + } + + return -1; +} + // Is a weapon of this type already packed in this box? BOOL CWeaponBox::HasWeapon(CBasePlayerItem *pCheckItem) { diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 82e1356d2..c9cd58c36 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -477,6 +477,9 @@ class CWeaponBox: public CBaseEntity public: BOOL IsEmpty(); int GiveAmmo(int iCount, char *szName, int iMax, int *pIndex = nullptr); + int GetAmmoIndex(const char *psz) const; + bool GiveAmmoToPlayer(CBasePlayer *pPlayer, CBasePlayerWeapon *pWeapon, + int iCurrentAmmo, const char *pszAmmo, int iMaxAmmo, CBasePlayerItem **pGivenItem = NULL); void EXPORT Kill(); void EXPORT BombThink(); @@ -1269,7 +1272,7 @@ inline float CKnife::KnifeSwingDamage(bool fast) const { return fast ? m_flSwing inline float CKnife::KnifeStabDistance() const { return m_flStabDistance; } inline float CKnife::KnifeSwingDistance() const { return m_flSwingDistance; } inline float CKnife::KnifeBackStabMultiplier() const { return m_flBackStabMultiplier; } -#else +#else inline float CKnife::KnifeStabDamage() const { return KNIFE_STAB_DAMAGE; } inline float CKnife::KnifeSwingDamage(bool fast) const { return fast ? KNIFE_SWING_DAMAGE_FAST : KNIFE_SWING_DAMAGE; } inline float CKnife::KnifeStabDistance() const { return KNIFE_STAB_DISTANCE; } From 5d2174fbbf546f033118bc6d65d55d2166f66980 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 5 Feb 2024 02:21:49 +0700 Subject: [PATCH 19/21] CWeaponBox::Touch: Reworked dropped grenade pickup --- regamedll/dlls/player.cpp | 38 +++++++++++++++++ regamedll/dlls/player.h | 1 + regamedll/dlls/weapons.cpp | 86 ++++++++++++++++++++++++++++---------- 3 files changed, 104 insertions(+), 21 deletions(-) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index d12768c16..06c550890 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -6351,6 +6351,44 @@ CBaseEntity *CBasePlayer::GiveNamedItemEx(const char *pszName) return pEntity; } +// Creates a copy of the specified entity (pEntitySource) and gives it to the player +// The cloned entity inherits base properties (entvars) of the original entity +// Returns Pointer to the cloned entity, or NULL if the entity cannot be created +CBaseEntity *CBasePlayer::GiveCopyItem(CBaseEntity *pEntitySource) +{ + edict_t *pEdict = CREATE_NAMED_ENTITY(pEntitySource->pev->classname); + if (FNullEnt(pEdict)) + { + ALERT(at_console, "NULL Ent in GiveCloneItem classname `%s`!\n", STRING(pEntitySource->pev->classname)); + return nullptr; + } + + // copy entity properties + Q_memcpy(&pEdict->v, pEntitySource->pev, sizeof(pEdict->v)); + + pEdict->v.pContainingEntity = pEdict; + pEdict->v.origin = pev->origin; + pEdict->v.spawnflags |= SF_NORESPAWN; + pEdict->v.owner = NULL; // will re-link owner after touching + pEdict->v.chain = ENT(pEntitySource->pev); // refer to source copy entity + + DispatchSpawn(pEdict); + DispatchTouch(pEdict, ENT(pev)); + pEdict->v.chain = NULL; + + CBaseEntity *pEntity = GET_PRIVATE(pEdict); + + // not allow the item to fall to the ground. + if (FNullEnt(pEdict->v.owner) || pEdict->v.owner != edict()) + { + pEdict->v.flags |= FL_KILLME; + UTIL_Remove(pEntity); + return nullptr; + } + + return pEntity; +} + CBaseEntity *FindEntityForward(CBaseEntity *pEntity) { TraceResult tr; diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index 4595bf226..8908e44c9 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -536,6 +536,7 @@ class CBasePlayer: public CBaseMonster { void ItemPostFrame(); CBaseEntity *GiveNamedItem(const char *pszName); CBaseEntity *GiveNamedItemEx(const char *pszName); + CBaseEntity *GiveCopyItem(CBaseEntity *pEntityBase); void EnableControl(BOOL fControl); bool HintMessage(const char *pMessage, BOOL bDisplayIfPlayerDead = FALSE, BOOL bOverride = FALSE); bool HintMessageEx(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false); diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index e6524a96c..2c035c746 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -1852,39 +1852,72 @@ bool CWeaponBox::GiveAmmoToPlayer(CBasePlayer *pPlayer, CBasePlayerWeapon *pWeap return false; // can't pickup more, these ammo are full in backpack // If already have a weapon in backpack, just refill ammo for it - if (iCurrentAmmo > 0) + int iAmmoIndex = GetAmmoIndex(pszAmmo); + if (iAmmoIndex > 0) { - int iAmmoIndex = GetAmmoIndex(pszAmmo); - if (iAmmoIndex > 0) + // How many weapon ammo can pick up? + int iAmmoPickup = min(m_rgAmmo[iAmmoIndex], iMaxAmmo - iCurrentAmmo); + if (iAmmoPickup > 0) { - // how many gren ammo can pick up? - int iAmmoPickup = min(m_rgAmmo[iAmmoIndex], iMaxAmmo - iCurrentAmmo); - if (iAmmoPickup > 0) + if (iCurrentAmmo == 0 && !(pPlayer->pev->weapons & (1<m_iId)) && (pWeapon->iFlags() & ITEM_FLAG_EXHAUSTIBLE)) { - if (!FStringNull(m_rgiszAmmo[iAmmoIndex]) && - pPlayer->GiveAmmo(iAmmoPickup, STRING(m_rgiszAmmo[iAmmoIndex]), iMaxAmmo) != -1) + if (m_rgAmmo[iAmmoIndex] > iMaxAmmo) { - m_rgAmmo[iAmmoIndex] -= iAmmoPickup; - - if (m_rgAmmo[iAmmoIndex] < 0) - m_rgAmmo[iAmmoIndex] = 0; + // If ammo capacity of the dropped weapon exceeds the player's backpack capacity, + // make a copy of dropped weapon and give it to the player + CBasePlayerItem *copyItem = (CBasePlayerItem *)pPlayer->GiveCopyItem(pWeapon); + if (copyItem) + { + // The cloned weapon must inherit properties from a dropped weapon, such as Item Info +#ifdef REGAMEDLL_API + ItemInfo info; + if (pWeapon->CSPlayerItem()->GetItemInfo(&info)) + copyItem->CSPlayerItem()->SetItemInfo(&info); +#endif + m_rgAmmo[iAmmoIndex]--; + iAmmoPickup--; + } + } + else + { + // If no weapon in backpack, then issue weapon + if (pPlayer->AddPlayerItem(pWeapon)) + { + pWeapon->AttachToPlayer(pPlayer); + if (pGivenItem) *pGivenItem = pWeapon; + } - EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "items/9mmclip1.wav", VOL_NORM, ATTN_NORM); + // unlink this weapon from the box + return true; } } - // ammo exhausted, remove this weapon - if (m_rgAmmo[iAmmoIndex] <= 0) + Assert(iAmmoPickup != 0); + Assert(m_rgAmmo[iAmmoIndex] != 0); + + if (!FStringNull(m_rgiszAmmo[iAmmoIndex]) && + pPlayer->GiveAmmo(iAmmoPickup, STRING(m_rgiszAmmo[iAmmoIndex]), iMaxAmmo) != -1) { - pWeapon->Kill(); + m_rgAmmo[iAmmoIndex] -= iAmmoPickup; - // unlink this weapon from the box - return true; + if (m_rgAmmo[iAmmoIndex] < 0) + m_rgAmmo[iAmmoIndex] = 0; + + EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "items/9mmclip1.wav", VOL_NORM, ATTN_NORM); } + } - // ammo has not been exhausted yet, keep this weapon in weaponbox - return false; + // ammo exhausted, remove this weapon + if (m_rgAmmo[iAmmoIndex] <= 0) + { + pWeapon->Kill(); + + // unlink this weapon from the box + return true; } + + // ammo has not been exhausted yet, keep this weapon in weaponbox + return false; } // If no weapon in backpack, then issue weapon @@ -2045,9 +2078,20 @@ void CWeaponBox::Touch(CBaseEntity *pOther) #ifdef REGAMEDLL_FIXES CBasePlayerItem *pNext = m_rgpPlayerItems[i]->m_pNext; + // Determine the max ammo capacity for the picked-up grenade + int iMaxPickupAmmo = pGrenade->iMaxAmmo1(); + + // If the player already has the same weapon in inventory, + // prioritize the max ammo capacity value over the one from the dropped weapon + // When the pickup occurs, ammo will be granted up to + // the max ammo capacity of the weapon currently held by the player + CBasePlayerItem *pInventoryItem = (CBasePlayerItem *)pPlayer->GetItemById((WeaponIdType)pGrenade->m_iId); + if (pInventoryItem && !Q_stricmp(pInventoryItem->pszAmmo1(), pGrenade->pszAmmo1())) + iMaxPickupAmmo = pInventoryItem->iMaxAmmo1(); + // Pickup grenade item or refill ammo if (GiveAmmoToPlayer(pPlayer, pGrenade, - playerGrenades, pGrenade->pszAmmo1(), pGrenade->iMaxAmmo1(), &givenItem)) + playerGrenades, pGrenade->pszAmmo1(), iMaxPickupAmmo, &givenItem)) { // unlink this weapon from the box m_rgpPlayerItems[i] = pItem = pNext; From 92775824e63f5887e373b0f14fd1b36336612f47 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 29 Feb 2024 06:52:48 +0700 Subject: [PATCH 20/21] IsWalkableTraceLineClear: Fixed deadlock (mutual collisions in traces leading to hang) --- regamedll/game_shared/bot/nav.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/regamedll/game_shared/bot/nav.h b/regamedll/game_shared/bot/nav.h index 6f994dd74..a917aa993 100644 --- a/regamedll/game_shared/bot/nav.h +++ b/regamedll/game_shared/bot/nav.h @@ -388,15 +388,21 @@ inline bool IsWalkableTraceLineClear(Vector &from, Vector &to, unsigned int flag { TraceResult result; edict_t *pEntIgnore = nullptr; + edict_t *pEntPrev = nullptr; Vector useFrom = from; - while (true) + const int maxTries = 50; + for (int t = 0; t < maxTries; ++t) { UTIL_TraceLine(useFrom, to, ignore_monsters, pEntIgnore, &result); // if we hit a walkable entity, try again if (result.flFraction != 1.0f && (result.pHit && IsEntityWalkable(VARS(result.pHit), flags))) { + if (result.pHit == pEntPrev) + return false; // deadlock, give up + + pEntPrev = pEntIgnore; pEntIgnore = result.pHit; // start from just beyond where we hit to avoid infinite loops From c99de03d7cad3f69f42cef77e50fb462a9e7d4d2 Mon Sep 17 00:00:00 2001 From: Alejo Date: Sat, 16 Mar 2024 14:30:27 -0300 Subject: [PATCH 21/21] Revert "Merge branch 'nostalgia' into master" This reverts commit af9a707c6619af618a8fafe1eb6e1f3b3e241786, reversing changes made to a4cd9a5ca0d5fcdb1fccfac7321ea064d32defa6. --- .github/workflows/build.yml | 2 +- README.md | 3 -- dist/game.cfg | 21 -------- regamedll/dlls/API/CAPI_Impl.cpp | 1 - regamedll/dlls/API/CSPlayer.cpp | 2 - regamedll/dlls/client.cpp | 12 +---- regamedll/dlls/client.h | 7 --- regamedll/dlls/game.cpp | 11 ++--- regamedll/dlls/game.h | 4 -- regamedll/dlls/multiplay_gamerules.cpp | 51 +++++++------------ regamedll/dlls/player.cpp | 18 +------ regamedll/dlls/weapons.cpp | 54 ++------------------- regamedll/dlls/weapons.h | 1 - regamedll/dlls/wpn_shared/wpn_ak47.cpp | 2 +- regamedll/dlls/wpn_shared/wpn_aug.cpp | 2 - regamedll/dlls/wpn_shared/wpn_awp.cpp | 2 - regamedll/dlls/wpn_shared/wpn_deagle.cpp | 2 - regamedll/dlls/wpn_shared/wpn_elite.cpp | 2 - regamedll/dlls/wpn_shared/wpn_famas.cpp | 2 - regamedll/dlls/wpn_shared/wpn_fiveseven.cpp | 2 - regamedll/dlls/wpn_shared/wpn_g3sg1.cpp | 2 - regamedll/dlls/wpn_shared/wpn_galil.cpp | 2 +- regamedll/dlls/wpn_shared/wpn_glock18.cpp | 2 - regamedll/dlls/wpn_shared/wpn_m249.cpp | 2 +- regamedll/dlls/wpn_shared/wpn_m4a1.cpp | 2 - regamedll/dlls/wpn_shared/wpn_mac10.cpp | 2 - regamedll/dlls/wpn_shared/wpn_mp5navy.cpp | 2 - regamedll/dlls/wpn_shared/wpn_p228.cpp | 2 - regamedll/dlls/wpn_shared/wpn_p90.cpp | 2 - regamedll/dlls/wpn_shared/wpn_scout.cpp | 2 +- regamedll/dlls/wpn_shared/wpn_sg550.cpp | 2 - regamedll/dlls/wpn_shared/wpn_sg552.cpp | 2 - regamedll/dlls/wpn_shared/wpn_tmp.cpp | 2 +- regamedll/dlls/wpn_shared/wpn_ump45.cpp | 2 - regamedll/dlls/wpn_shared/wpn_usp.cpp | 2 - regamedll/public/regamedll/API/CSPlayer.h | 2 - regamedll/public/regamedll/regamedll_api.h | 1 - 37 files changed, 33 insertions(+), 201 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64cd3d3d3..f8547b3b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: C/C++ CI on: push: - branches: [master, nostalgia] + branches: [master] paths-ignore: - '**.md' diff --git a/README.md b/README.md index fb9088f09..93cd795d2 100644 --- a/README.md +++ b/README.md @@ -110,9 +110,6 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | mp_give_c4_frags | 3 | - | - | How many bonuses (frags) will get the player who defused or exploded the bomb. | | mp_hostages_rescued_ratio | 1.0 | 0.0 | 1.0 | Ratio of hostages rescued to win the round. | | mp_legacy_vehicle_block | 1 | 0 | 1 | Legacy func_vehicle behavior when blocked by another entity.
`0` New behavior
`1` Legacy behavior | -| mp_max_alive_name_changes | -1 | -1 | - | Maximum amount of nickname changes when alive
`-1` unlimited
`0` Blocks name changes
`>0` Allow to change arbitrary amount of nicks | -| sv_legacy_restart_entities | 0 | 0 | 1 | Legacy restart of entities on new round
`0` disabled
`1` enabled | -| sv_block_vote_commands | 0 | 0 | 1 | When set, blocks `vote` and `votemap` commands.
`0` disabled
`1` enabled | | mp_dying_time | 3.0 | 0.0 | - | Time for switch to free observing after death.
`0` - disable spectating around death.
`>0.00001` - time delay to start spectate.
`NOTE`: The countdown starts when the player’s death animation is finished. | | mp_deathmsg_flags | abc | 0 | - | Sets a flags for extra information in the player's death message.
`0` disabled
`a` position where the victim died
`b` index of the assistant who helped the attacker kill the victim
`c` rarity classification bits, e.g., `blinkill`, `noscope`, `penetrated`, etc. | | mp_assist_damage_threshold | 40 | 0 | 100 | Sets the percentage of damage needed to score an assist. | diff --git a/dist/game.cfg b/dist/game.cfg index d41e685b2..91009dd00 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -529,27 +529,6 @@ mp_hostages_rescued_ratio "1.0" // // Default value: "1" mp_legacy_vehicle_block "1" -// Maximum amount of nickname changes before next respawn. -// -1 - unlimited (default behaviour) -// 0 - Blocks name changes -// >0 - Allow to change arbitrary amount of nicks -// -// Default value: "-1" -mp_max_alive_name_changes -1 - -// Legacy restart of entities on new round. -// 0 - disabled (default behaviour) -// 1 - enabled -// -// Default value: "0" -sv_legacy_restart_entities 0 - -// When set, blocks "vote" and "votemap" commands. -// 0 - disabled (default behaviour) -// 1 - enabled -// -// Default value: "0" -sv_block_vote_commands 0 // Time for switch to free observing after death. // NOTE: The countdown starts when the player’s death animation is finished. diff --git a/regamedll/dlls/API/CAPI_Impl.cpp b/regamedll/dlls/API/CAPI_Impl.cpp index e3edbafcc..5bb6b3940 100644 --- a/regamedll/dlls/API/CAPI_Impl.cpp +++ b/regamedll/dlls/API/CAPI_Impl.cpp @@ -173,7 +173,6 @@ ReGameFuncs_t g_ReGameApiFuncs = { UTIL_Remove_api, AddAmmoNameToAmmoRegistry_api, - RemoveAmmoNameFromAmmoRegistry, TextureTypePlaySound_api, CreateWeaponBox_api, SpawnGrenade_api, diff --git a/regamedll/dlls/API/CSPlayer.cpp b/regamedll/dlls/API/CSPlayer.cpp index 23c94ec21..57bf10d1c 100644 --- a/regamedll/dlls/API/CSPlayer.cpp +++ b/regamedll/dlls/API/CSPlayer.cpp @@ -544,7 +544,6 @@ void CCSPlayer::ResetVars() m_bGameForcingRespawn = false; m_bAutoBunnyHopping = false; m_bMegaBunnyJumping = false; - m_iAliveNameChanges = 0; m_bSpawnProtectionEffects = false; } @@ -565,7 +564,6 @@ void CCSPlayer::OnSpawn() { m_bGameForcingRespawn = false; m_flRespawnPending = 0.0f; - m_iAliveNameChanges = 0; m_DamageList.Clear(); } diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 7aa20ebee..70c8a426c 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -2590,11 +2590,7 @@ void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *pa pPlayer->ForceClientDllUpdate(); } } - else if (FStrEq(pcmd, "vote") -#ifdef REGAMEDLL_ADD - && sv_block_vote_commands.value <= 0 -#endif - ) + else if (FStrEq(pcmd, "vote")) { if (gpGlobals->time >= pPlayer->m_flLastCommandTime[CMD_VOTE]) { @@ -2675,11 +2671,7 @@ void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *pa CSGameRules()->DisplayMaps(pPlayer, 0); } } - else if (FStrEq(pcmd, "votemap") -#ifdef REGAMEDLL_ADD - && sv_block_vote_commands.value <= 0 -#endif - ) + else if (FStrEq(pcmd, "votemap")) { if (gpGlobals->time >= pPlayer->m_flLastCommandTime[CMD_VOTEMAP]) { diff --git a/regamedll/dlls/client.h b/regamedll/dlls/client.h index 68586b2a4..d873bd202 100644 --- a/regamedll/dlls/client.h +++ b/regamedll/dlls/client.h @@ -54,13 +54,6 @@ enum BuyItemMenuSlot MENU_SLOT_ITEM_SHIELD, }; -// custom enum -enum -{ - BLOCK_VOTE = BIT(0), - BLOCK_VOTEMAP = BIT(1), -}; - #define CS_NUM_SKIN 4 #define CZ_NUM_SKIN 5 diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 22dbfb715..4ab375d8b 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -171,11 +171,8 @@ cvar_t deathmsg_flags = { "mp_deathmsg_flags", "abc", 0, 0.0f cvar_t assist_damage_threshold = { "mp_assist_damage_threshold", "40", 0, 40.0f, nullptr }; cvar_t freezetime_duck = { "mp_freezetime_duck", "1", 0, 1.0f, nullptr }; cvar_t freezetime_jump = { "mp_freezetime_jump", "1", 0, 1.0f, nullptr }; -cvar_t hostages_rescued_ratio = { "mp_hostages_rescued_ratio", "1.0", 0, 1.0f, nullptr }; -cvar_t max_alive_name_changes = { "mp_max_alive_name_changes", "-1", 0, -1.0f, nullptr }; -cvar_t legacy_restart_entities = { "sv_legacy_restart_entities", "0", 0, 0.0f, nullptr }; -cvar_t sv_block_vote_commands = { "sv_block_vote_commands", "0", 0, 0.0f, nullptr }; +cvar_t hostages_rescued_ratio = { "mp_hostages_rescued_ratio", "1.0", 0, 1.0f, nullptr }; cvar_t legacy_vehicle_block = { "mp_legacy_vehicle_block", "1", 0, 0.0f, nullptr }; @@ -432,7 +429,9 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&sv_enablebunnyhopping); CVAR_REGISTER(&plant_c4_anywhere); CVAR_REGISTER(&give_c4_frags); + CVAR_REGISTER(&hostages_rescued_ratio); + CVAR_REGISTER(&legacy_vehicle_block); CVAR_REGISTER(&dying_time); @@ -443,10 +442,6 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&freezetime_jump); CVAR_REGISTER(&defuser_allocation); - CVAR_REGISTER(&max_alive_name_changes); - CVAR_REGISTER(&legacy_restart_entities); - CVAR_REGISTER(&sv_block_vote_commands); - // print version CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n"); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index d48850108..706e1c2af 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -202,10 +202,6 @@ extern cvar_t freezetime_duck; extern cvar_t freezetime_jump; extern cvar_t defuser_allocation; -extern cvar_t max_alive_name_changes; -extern cvar_t legacy_restart_entities; -extern cvar_t sv_block_vote_commands; - #endif extern cvar_t scoreboard_showmoney; diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 398b4b1b0..ec3acdb4e 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -607,16 +607,11 @@ LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, CleanUpMap) void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CleanUpMap)() { #ifdef REGAMEDLL_FIXES -#ifdef REGAMEDLL_ADD - if (!(bool)legacy_restart_entities.value) -#endif - { - UTIL_RestartOther("multi_manager"); + UTIL_RestartOther("multi_manager"); - // Release or reset everything entities in depending of flags ObjectCaps - // (FCAP_MUST_RESET / FCAP_MUST_RELEASE) - UTIL_ResetEntities(); - } + // Release or reset everything entities in depending of flags ObjectCaps + // (FCAP_MUST_RESET / FCAP_MUST_RELEASE) + UTIL_ResetEntities(); #endif // Recreate all the map entities from the map data (preserving their indices), @@ -627,16 +622,11 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CleanUpMap)() UTIL_RestartOther("func_door"); #ifdef REGAMEDLL_FIXES -#ifdef REGAMEDLL_ADD - if (!(bool)legacy_restart_entities.value) -#endif - { - UTIL_RestartOther("func_button"); - UTIL_RestartOther("func_rot_button"); - UTIL_RestartOther("env_render"); - UTIL_RestartOther("env_spark"); - UTIL_RestartOther("trigger_push"); - } + UTIL_RestartOther("func_button"); + UTIL_RestartOther("func_rot_button"); + UTIL_RestartOther("env_render"); + UTIL_RestartOther("env_spark"); + UTIL_RestartOther("trigger_push"); #endif UTIL_RestartOther("func_water"); @@ -649,20 +639,15 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CleanUpMap)() UTIL_RestartOther("env_sprite"); #ifdef REGAMEDLL_FIXES -#ifdef REGAMEDLL_ADD - if (!(bool)legacy_restart_entities.value) -#endif - { - UTIL_RestartOther("trigger_once"); - UTIL_RestartOther("func_wall_toggle"); - UTIL_RestartOther("func_healthcharger"); - UTIL_RestartOther("func_recharge"); - UTIL_RestartOther("trigger_hurt"); - UTIL_RestartOther("multisource"); - UTIL_RestartOther("env_beam"); - UTIL_RestartOther("env_laser"); - UTIL_RestartOther("trigger_auto"); - } + UTIL_RestartOther("trigger_once"); + UTIL_RestartOther("func_wall_toggle"); + UTIL_RestartOther("func_healthcharger"); + UTIL_RestartOther("func_recharge"); + UTIL_RestartOther("trigger_hurt"); + UTIL_RestartOther("multisource"); + UTIL_RestartOther("env_beam"); + UTIL_RestartOther("env_laser"); + UTIL_RestartOther("trigger_auto"); #endif // Remove grenades and C4 diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 5df67f700..06c550890 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -171,19 +171,7 @@ bool EXT_FUNC CBasePlayer::__API_HOOK(SetClientUserInfoName)(char *infobuffer, c } #endif -#ifdef REGAMEDLL_ADD - if (max_alive_name_changes.value <= 0) - { - ClientPrint(pev, HUD_PRINTCENTER, "#Command_Not_Available"); - return false; - } -#endif - - if (pev->deadflag != DEAD_NO -#if defined REGAMEDLL_API && REGAMEDLL_ADD - || CSPlayer()->m_iAliveNameChanges >= max_alive_name_changes.value -#endif - ) + if (pev->deadflag != DEAD_NO) { m_bHasChangedName = true; Q_snprintf(m_szNewName, sizeof(m_szNewName), "%s", szNewName); @@ -201,10 +189,6 @@ bool EXT_FUNC CBasePlayer::__API_HOOK(SetClientUserInfoName)(char *infobuffer, c WRITE_STRING(szNewName); MESSAGE_END(); -#ifdef REGAMEDLL_API - CSPlayer()->m_iAliveNameChanges++; -#endif - UTIL_LogPrintf("\"%s<%i><%s><%s>\" changed name to \"%s\"\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()), GetTeam(m_iTeam), szNewName); return true; } diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 3f441975e..2c035c746 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -212,28 +212,6 @@ struct { { AMMO_C4, "C4" }, }; #endif -#ifdef REGAMEDLL_API -BOOL EXT_FUNC RemoveAmmoNameFromAmmoRegistry(const char *szAmmoname) -{ - if (!szAmmoname || !szAmmoname[0]) - { - return FALSE; - } - - for (int i = 1; i < MAX_AMMO_SLOTS; i++) - { - AmmoInfo& ammoinfo = CBasePlayerItem::m_AmmoInfoArray[i]; - - if (ammoinfo.iId && !Q_stricmp(ammoinfo.pszName, szAmmoname)) - { - Q_memset(&CBasePlayerItem::m_AmmoInfoArray[i], 0, sizeof(CBasePlayerItem::m_AmmoInfoArray[i])); - return TRUE; - } - } - - return FALSE; -} -#endif // Precaches the ammo and queues the ammo info for sending to clients int AddAmmoNameToAmmoRegistry(const char *szAmmoname) @@ -244,32 +222,6 @@ int AddAmmoNameToAmmoRegistry(const char *szAmmoname) return -1; } -#ifdef REGAMEDLL_ADD - int newIndex = -1; - for (int i = 1; i < MAX_AMMO_SLOTS; i++) - { - AmmoInfo& ammoinfo = CBasePlayerItem::m_AmmoInfoArray[i]; - - if (ammoinfo.iId && !Q_stricmp(ammoinfo.pszName, szAmmoname)) - { - return i; - } - - // New slot for the ammo it's the first one clear. - if (!ammoinfo.iId && newIndex == -1) - { - newIndex = i; - } - } - - if (newIndex != -1) - { - CBasePlayerItem::m_AmmoInfoArray[newIndex].pszName = szAmmoname; - CBasePlayerItem::m_AmmoInfoArray[newIndex].iId = newIndex; - } - - return newIndex; -#else // make sure it's not already in the registry for (int i = 1; i < MAX_AMMO_SLOTS; i++) { @@ -308,7 +260,6 @@ int AddAmmoNameToAmmoRegistry(const char *szAmmoname) CBasePlayerItem::m_AmmoInfoArray[giAmmoIndex].iId = giAmmoIndex; return giAmmoIndex; -#endif } // Precaches the weapon and queues the weapon info for sending to clients @@ -1277,9 +1228,10 @@ void CBasePlayerItem::AttachToPlayer(CBasePlayer *pPlayer) void CBasePlayerWeapon::Spawn() { #ifdef REGAMEDLL_API - ItemInfo &info = m_ItemInfoArray[m_iId]; + ItemInfo info; + Q_memset(&info, 0, sizeof(info)); - if (info.iId) { + if (GetItemInfo(&info)) { CSPlayerItem()->SetItemInfo(&info); } #endif diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index a52a1c1b7..c9cd58c36 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -2181,5 +2181,4 @@ float GetBaseAccuracy(WeaponIdType id); void ClearMultiDamage_OrigFunc(); void ApplyMultiDamage_OrigFunc(entvars_t *pevInflictor, entvars_t *pevAttacker); void AddMultiDamage_OrigFunc(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType); -BOOL RemoveAmmoNameFromAmmoRegistry(const char* szAmmoname); #endif diff --git a/regamedll/dlls/wpn_shared/wpn_ak47.cpp b/regamedll/dlls/wpn_shared/wpn_ak47.cpp index 1cc9efcaa..1a27a3f92 100644 --- a/regamedll/dlls/wpn_shared/wpn_ak47.cpp +++ b/regamedll/dlls/wpn_shared/wpn_ak47.cpp @@ -173,7 +173,7 @@ void CAK47::AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CAK47::Reload() { -#ifndef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_762nato <= 0) return; diff --git a/regamedll/dlls/wpn_shared/wpn_aug.cpp b/regamedll/dlls/wpn_shared/wpn_aug.cpp index 6150ff4a4..988c74808 100644 --- a/regamedll/dlls/wpn_shared/wpn_aug.cpp +++ b/regamedll/dlls/wpn_shared/wpn_aug.cpp @@ -181,10 +181,8 @@ void CAUG::AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CAUG::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_556nato <= 0) return; -#endif if (DefaultReload(iMaxClip(), AUG_RELOAD, AUG_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_awp.cpp b/regamedll/dlls/wpn_shared/wpn_awp.cpp index e86eebb13..0e31bd548 100644 --- a/regamedll/dlls/wpn_shared/wpn_awp.cpp +++ b/regamedll/dlls/wpn_shared/wpn_awp.cpp @@ -194,10 +194,8 @@ void CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CAWP::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_338mag <= 0) return; -#endif if (DefaultReload(iMaxClip(), AWP_RELOAD, AWP_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_deagle.cpp b/regamedll/dlls/wpn_shared/wpn_deagle.cpp index 001039e97..7dbed0c6b 100644 --- a/regamedll/dlls/wpn_shared/wpn_deagle.cpp +++ b/regamedll/dlls/wpn_shared/wpn_deagle.cpp @@ -183,10 +183,8 @@ void CDEAGLE::DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi) void CDEAGLE::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_50ae <= 0) return; -#endif if (DefaultReload(iMaxClip(), DEAGLE_RELOAD, DEAGLE_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_elite.cpp b/regamedll/dlls/wpn_shared/wpn_elite.cpp index 1a0f8a9d5..05428d8ed 100644 --- a/regamedll/dlls/wpn_shared/wpn_elite.cpp +++ b/regamedll/dlls/wpn_shared/wpn_elite.cpp @@ -205,10 +205,8 @@ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi) void CELITE::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_9mm <= 0) return; -#endif if (DefaultReload(iMaxClip(), ELITE_RELOAD, ELITE_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_famas.cpp b/regamedll/dlls/wpn_shared/wpn_famas.cpp index 0c0355165..eb7bcc892 100644 --- a/regamedll/dlls/wpn_shared/wpn_famas.cpp +++ b/regamedll/dlls/wpn_shared/wpn_famas.cpp @@ -216,10 +216,8 @@ void CFamas::FamasFire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL void CFamas::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_556nato <= 0) return; -#endif if (DefaultReload(iMaxClip(), FAMAS_RELOAD, FAMAS_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp b/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp index c57bd003a..31f211f08 100644 --- a/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp +++ b/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp @@ -182,10 +182,8 @@ void CFiveSeven::FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseSemi) void CFiveSeven::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_57mm <= 0) return; -#endif if (DefaultReload(iMaxClip(), FIVESEVEN_RELOAD, FIVESEVEN_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp b/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp index d15b3b20c..5351d0f78 100644 --- a/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp +++ b/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp @@ -191,10 +191,8 @@ void CG3SG1::G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CG3SG1::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_762nato <= 0) return; -#endif if (DefaultReload(iMaxClip(), G3SG1_RELOAD, G3SG1_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_galil.cpp b/regamedll/dlls/wpn_shared/wpn_galil.cpp index e6f5a96cf..69326075e 100644 --- a/regamedll/dlls/wpn_shared/wpn_galil.cpp +++ b/regamedll/dlls/wpn_shared/wpn_galil.cpp @@ -176,7 +176,7 @@ void CGalil::GalilFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CGalil::Reload() { -#ifndef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_556nato <= 0) return; diff --git a/regamedll/dlls/wpn_shared/wpn_glock18.cpp b/regamedll/dlls/wpn_shared/wpn_glock18.cpp index f505b6fa6..c2f5399d5 100644 --- a/regamedll/dlls/wpn_shared/wpn_glock18.cpp +++ b/regamedll/dlls/wpn_shared/wpn_glock18.cpp @@ -259,10 +259,8 @@ void CGLOCK18::GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst) void CGLOCK18::Reload() { int iResult; -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_9mm <= 0) return; -#endif if (m_pPlayer->HasShield()) iResult = GLOCK18_SHIELD_RELOAD; diff --git a/regamedll/dlls/wpn_shared/wpn_m249.cpp b/regamedll/dlls/wpn_shared/wpn_m249.cpp index e08435cdd..45d7290be 100644 --- a/regamedll/dlls/wpn_shared/wpn_m249.cpp +++ b/regamedll/dlls/wpn_shared/wpn_m249.cpp @@ -170,7 +170,7 @@ void CM249::M249Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CM249::Reload() { -#ifndef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_556natobox <= 0) return; diff --git a/regamedll/dlls/wpn_shared/wpn_m4a1.cpp b/regamedll/dlls/wpn_shared/wpn_m4a1.cpp index e8a686878..89ea81b5b 100644 --- a/regamedll/dlls/wpn_shared/wpn_m4a1.cpp +++ b/regamedll/dlls/wpn_shared/wpn_m4a1.cpp @@ -229,10 +229,8 @@ void CM4A1::M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CM4A1::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_556nato <= 0) return; -#endif if (DefaultReload(iMaxClip(), ((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED) ? M4A1_RELOAD : M4A1_UNSIL_RELOAD, M4A1_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_mac10.cpp b/regamedll/dlls/wpn_shared/wpn_mac10.cpp index 4304931eb..b05170882 100644 --- a/regamedll/dlls/wpn_shared/wpn_mac10.cpp +++ b/regamedll/dlls/wpn_shared/wpn_mac10.cpp @@ -163,10 +163,8 @@ void CMAC10::MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CMAC10::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_45acp <= 0) return; -#endif if (DefaultReload(iMaxClip(), MAC10_RELOAD, MAC10_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp b/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp index cefed60bb..3a1b679a6 100644 --- a/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp +++ b/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp @@ -164,10 +164,8 @@ void CMP5N::MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CMP5N::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_9mm <= 0) return; -#endif if (DefaultReload(iMaxClip(), MP5N_RELOAD, MP5N_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_p228.cpp b/regamedll/dlls/wpn_shared/wpn_p228.cpp index 108d76d72..b64f5fcf3 100644 --- a/regamedll/dlls/wpn_shared/wpn_p228.cpp +++ b/regamedll/dlls/wpn_shared/wpn_p228.cpp @@ -182,10 +182,8 @@ void CP228::P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi) void CP228::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_357sig <= 0) return; -#endif if (DefaultReload(iMaxClip(), m_pPlayer->HasShield() ? P228_SHIELD_RELOAD : P228_RELOAD, P228_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_p90.cpp b/regamedll/dlls/wpn_shared/wpn_p90.cpp index c4c0fa656..7f3cc606f 100644 --- a/regamedll/dlls/wpn_shared/wpn_p90.cpp +++ b/regamedll/dlls/wpn_shared/wpn_p90.cpp @@ -170,10 +170,8 @@ void CP90::P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CP90::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_57mm <= 0) return; -#endif if (DefaultReload(iMaxClip(), P90_RELOAD, P90_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_scout.cpp b/regamedll/dlls/wpn_shared/wpn_scout.cpp index 8d07bfcdc..fd9456624 100644 --- a/regamedll/dlls/wpn_shared/wpn_scout.cpp +++ b/regamedll/dlls/wpn_shared/wpn_scout.cpp @@ -186,7 +186,7 @@ void CSCOUT::SCOUTFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CSCOUT::Reload() { -#ifndef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_762nato <= 0) return; diff --git a/regamedll/dlls/wpn_shared/wpn_sg550.cpp b/regamedll/dlls/wpn_shared/wpn_sg550.cpp index 0ae73b607..8263e98a8 100644 --- a/regamedll/dlls/wpn_shared/wpn_sg550.cpp +++ b/regamedll/dlls/wpn_shared/wpn_sg550.cpp @@ -194,10 +194,8 @@ void CSG550::SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CSG550::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_556nato <= 0) return; -#endif if (DefaultReload(iMaxClip(), SG550_RELOAD, SG550_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_sg552.cpp b/regamedll/dlls/wpn_shared/wpn_sg552.cpp index fe9b31dcc..e86eec412 100644 --- a/regamedll/dlls/wpn_shared/wpn_sg552.cpp +++ b/regamedll/dlls/wpn_shared/wpn_sg552.cpp @@ -180,10 +180,8 @@ void CSG552::SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CSG552::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_556nato <= 0) return; -#endif if (DefaultReload(iMaxClip(), SG552_RELOAD, SG552_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_tmp.cpp b/regamedll/dlls/wpn_shared/wpn_tmp.cpp index eca575413..10378abc2 100644 --- a/regamedll/dlls/wpn_shared/wpn_tmp.cpp +++ b/regamedll/dlls/wpn_shared/wpn_tmp.cpp @@ -161,7 +161,7 @@ void CTMP::TMPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CTMP::Reload() { -#ifndef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_9mm <= 0) return; diff --git a/regamedll/dlls/wpn_shared/wpn_ump45.cpp b/regamedll/dlls/wpn_shared/wpn_ump45.cpp index 5d9deff18..73ada761e 100644 --- a/regamedll/dlls/wpn_shared/wpn_ump45.cpp +++ b/regamedll/dlls/wpn_shared/wpn_ump45.cpp @@ -167,10 +167,8 @@ void CUMP45::UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) void CUMP45::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_45acp <= 0) return; -#endif if (DefaultReload(iMaxClip(), UMP45_RELOAD, UMP45_RELOAD_TIME)) { diff --git a/regamedll/dlls/wpn_shared/wpn_usp.cpp b/regamedll/dlls/wpn_shared/wpn_usp.cpp index 43ec605dd..0d830d690 100644 --- a/regamedll/dlls/wpn_shared/wpn_usp.cpp +++ b/regamedll/dlls/wpn_shared/wpn_usp.cpp @@ -245,10 +245,8 @@ void CUSP::USPFire(float flSpread, float flCycleTime, BOOL fUseSemi) void CUSP::Reload() { -#ifndef REGAMEDLL_FIXES if (m_pPlayer->ammo_45acp <= 0) return; -#endif int iAnim; if (m_pPlayer->HasShield()) diff --git a/regamedll/public/regamedll/API/CSPlayer.h b/regamedll/public/regamedll/API/CSPlayer.h index 18558a433..0b8672332 100644 --- a/regamedll/public/regamedll/API/CSPlayer.h +++ b/regamedll/public/regamedll/API/CSPlayer.h @@ -51,7 +51,6 @@ class CCSPlayer: public CCSMonster { m_bAutoBunnyHopping(false), m_bMegaBunnyJumping(false), m_bPlantC4Anywhere(false), - m_iAliveNameChanges(0), m_bSpawnProtectionEffects(false), m_flJumpHeight(0), m_flLongJumpHeight(0), @@ -155,7 +154,6 @@ class CCSPlayer: public CCSMonster { bool m_bAutoBunnyHopping; bool m_bMegaBunnyJumping; bool m_bPlantC4Anywhere; - int m_iAliveNameChanges; bool m_bSpawnProtectionEffects; double m_flJumpHeight; double m_flLongJumpHeight; diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index 453f973a7..4aeb12545 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -808,7 +808,6 @@ struct ReGameFuncs_t { void (*UTIL_DecalTrace)(TraceResult *pTrace, int decalNumber); void (*UTIL_Remove)(CBaseEntity *pEntity); int (*AddAmmoNameToAmmoRegistry)(const char *szAmmoname); - BOOL(*RemoveAmmoNameFromAmmoRegistry)(const char* szAmmoname); void (*TextureTypePlaySound)(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType); class CWeaponBox *(*CreateWeaponBox)(CBasePlayerItem *pItem, CBasePlayer *pPlayerOwner, const char *modelName, Vector &origin, Vector &angles, Vector &velocity, float lifeTime, bool packAmmo); class CGrenade *(*SpawnGrenade)(WeaponIdType weaponId, entvars_t *pevOwner, Vector &vecSrc, Vector &vecThrow, float time, int iTeam, unsigned short usEvent);