From a7f20dc2e8e7cf9effb6a9e45091a8f666944a96 Mon Sep 17 00:00:00 2001 From: s1lent Date: Mon, 26 Aug 2019 04:26:55 +0700 Subject: [PATCH] Implemented command param -beta to enables latest things from official. --- README.md | 8 +++-- dist/game.cfg | 2 ++ regamedll/dlls/client.cpp | 7 ++-- regamedll/dlls/game.cpp | 7 ++-- regamedll/dlls/globals.cpp | 1 + regamedll/dlls/globals.h | 1 + regamedll/dlls/multiplay_gamerules.cpp | 19 +++++----- regamedll/dlls/player.cpp | 49 ++++++++++++++------------ regamedll/dlls/util.cpp | 22 ++++++++++++ regamedll/dlls/util.h | 1 + regamedll/regamedll/regamedll.cpp | 5 +-- regamedll/regamedll/regamedll.h | 5 +++ 12 files changed, 88 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index c264b9d0..12842096 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,10 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' Warning! ReGameDLL_CS is not binary compatible with original hlds since it's compiled with compilers other than ones used for original mod CS. This means that plugins that do binary code analysis (Orpheu for example) probably will not work with ReGameDLL_CS. +## How can use beta? +ReGameDLL_CS also have beta version with latest changes from official version of Counter-Strike, +therefore for this enter `-beta` option at the command line HLDS. + ## Configuration (cvars) | CVar | Default | Min | Max | Description | | :--------------------------------- | :-----: | :-: | :----------: | :--------------------------------------------- | @@ -56,8 +60,8 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' | mp_kill_filled_spawn | 1 | 0 | 1 | Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).
Only disable this if you have semiclip or other plugins that prevents stucking.
`0` disabled
`1` enabled | | mp_allow_point_servercommand | 0 | 0 | 1 | Allow use of point_servercommand entities in map.
`0` disallow
`1` allow
`NOTE`: Potentially dangerous for untrusted maps.| | mp_hullbounds_sets | 1 | 0 | 1 | Sets mins/maxs hull bounds for the player.
`0` disabled
`1` enabled | -| mp_scoreboard_showhealth | 3 | 0 | 5 | Show `HP` field into a scoreboard.
`0` don't send any update for `HP` field to any clients
`1` show only Terrorist `HP` field to all clients
`2` show only CT `HP` field to all clients
`3` show `HP` field to teammates
`4` show `HP` field to all clients
`5` show `HP` field to teammates and spectators | -| mp_scoreboard_showmoney | 3 | 0 | 5 | Show `Money` field into a scoreboard.
`0` don't send any update for `Money` field to any clients
`1` show only Terrorist `Money` field to all clients
`2` show only CT `Money` field to all clients
`3` show `Money` field to teammates
`4` show `Money` field to all clients
`5` show `Money` field to teammates and spectators | +| mp_scoreboard_showhealth | 3 | 0 | 5 | Show `HP` field into a scoreboard.
`0` don't send any update for `HP` field to any clients
`1` show only Terrorist `HP` field to all clients
`2` show only CT `HP` field to all clients
`3` show `HP` field to teammates
`4` show `HP` field to all clients
`5` show `HP` field to teammates and spectators

`Note this CVar are work in beta only.` | +| mp_scoreboard_showmoney | 3 | 0 | 5 | Show `Money` field into a scoreboard.
`0` don't send any update for `Money` field to any clients
`1` show only Terrorist `Money` field to all clients
`2` show only CT `Money` field to all clients
`3` show `Money` field to teammates
`4` show `Money` field to all clients
`5` show `Money` field to teammates and spectators

`Note this CVar are work in beta only.` | | ff_damage_reduction_bullets | 0.35 | 0.0 | 1.0 | How much to reduce damage done to teammates when shot.
Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) | | ff_damage_reduction_grenade | 0.25 | 0.0 | 1.0 | How much to reduce damage done to teammates by a thrown grenade.
Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) | | ff_damage_reduction_grenade_self | 1.0 | 0.0 | 1.0 | How much to damage a player does to himself with his own grenade.
Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) | diff --git a/dist/game.cfg b/dist/game.cfg index fb8f3e4e..f3a08b20 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -245,6 +245,7 @@ mp_allow_point_servercommand 0 // 3 - show 'HP' field to teammates // 4 - show 'HP' field to all clients // 5 - show 'HP' field to teammates and spectators +// Note this CVar are work in beta only. // // Default value: "3" mp_scoreboard_showhealth 3 @@ -256,6 +257,7 @@ mp_scoreboard_showhealth 3 // 3 - show 'Money' field to teammates // 4 - show 'Money' field to all clients // 5 - show 'Money' field to teammates and spectators +// Note this CVar are work in beta only. // // Default value: "3" mp_scoreboard_showmoney 3 diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 6b3e42b7..204e6081 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -226,8 +226,11 @@ void LinkUserMessages() gmsgHudTextArgs = REG_USER_MSG("HudTextArgs", -1); #ifdef BUILD_LATEST - gmsgAccount = REG_USER_MSG("Account", 5); - gmsgHealthInfo = REG_USER_MSG("HealthInfo", 5); + if (AreRunningBeta()) + { + gmsgAccount = REG_USER_MSG("Account", 5); + gmsgHealthInfo = REG_USER_MSG("HealthInfo", 5); + } #endif } diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index f2c5e8ec..1ffbd8ff 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -235,8 +235,11 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&humans_join_team); #ifdef BUILD_LATEST - CVAR_REGISTER(&scoreboard_showhealth); - CVAR_REGISTER(&scoreboard_showmoney); + if (AreRunningBeta()) + { + CVAR_REGISTER(&scoreboard_showhealth); + CVAR_REGISTER(&scoreboard_showmoney); + } #endif // Remove unused cvars diff --git a/regamedll/dlls/globals.cpp b/regamedll/dlls/globals.cpp index 69efe532..70d9a8c5 100644 --- a/regamedll/dlls/globals.cpp +++ b/regamedll/dlls/globals.cpp @@ -8,6 +8,7 @@ int g_iSkillLevel; Vector g_vecAttackDir; BOOL gDisplayTitle; +bool g_bIsBeta = false; bool g_bIsCzeroGame = false; bool g_bAllowedCSBot = false; bool g_bHostageImprov = false; diff --git a/regamedll/dlls/globals.h b/regamedll/dlls/globals.h index 20e0cc33..d6a47023 100644 --- a/regamedll/dlls/globals.h +++ b/regamedll/dlls/globals.h @@ -35,6 +35,7 @@ extern int g_iSkillLevel; extern Vector g_vecAttackDir; extern BOOL gDisplayTitle; +extern bool g_bIsBeta; extern bool g_bIsCzeroGame; extern bool g_bAllowedCSBot; extern bool g_bHostageImprov; diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 45ffcb2d..3737c41d 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -3362,15 +3362,18 @@ void CHalfLifeMultiplay::InitHUD(CBasePlayer *pl) } #ifdef BUILD_LATEST - MESSAGE_BEGIN(MSG_ONE, gmsgHealthInfo, nullptr, pl->edict()); - WRITE_BYTE(plr->entindex()); - WRITE_LONG(plr->ShouldToShowHealthInfo(pl) ? plr->m_iClientHealth : -1 /* means that 'HP' field will be hidden */); - MESSAGE_END(); + if (AreRunningBeta()) + { + MESSAGE_BEGIN(MSG_ONE, gmsgHealthInfo, nullptr, pl->edict()); + WRITE_BYTE(plr->entindex()); + WRITE_LONG(plr->ShouldToShowHealthInfo(pl) ? plr->m_iClientHealth : -1 /* means that 'HP' field will be hidden */); + MESSAGE_END(); - MESSAGE_BEGIN(MSG_ONE, gmsgAccount, nullptr, pl->edict()); - WRITE_BYTE(plr->entindex()); - WRITE_LONG(plr->ShouldToShowAccount(pl) ? plr->m_iAccount : -1 /* means that this 'Money' will be hidden */); - MESSAGE_END(); + MESSAGE_BEGIN(MSG_ONE, gmsgAccount, nullptr, pl->edict()); + WRITE_BYTE(plr->entindex()); + WRITE_LONG(plr->ShouldToShowAccount(pl) ? plr->m_iAccount : -1 /* means that this 'Money' will be hidden */); + MESSAGE_END(); + } #endif // BUILD_LATEST } diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 651b695e..7f522316 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -5123,7 +5123,7 @@ void CBasePlayer::SetScoreAttrib(CBasePlayer *dest) state |= SCORE_STATUS_VIP; #ifdef BUILD_LATEST - if (m_bHasDefuser) + if (AreRunningBeta() && m_bHasDefuser) state |= SCORE_STATUS_DEFKIT; #endif @@ -7132,38 +7132,41 @@ void EXT_FUNC CBasePlayer::__API_HOOK(UpdateClientData)() } #ifdef BUILD_LATEST - if ((m_iTeam == CT || m_iTeam == TERRORIST) && - (m_iLastAccount != m_iAccount || m_iLastClientHealth != m_iClientHealth || m_tmNextAccountHealthUpdate < gpGlobals->time)) + if (AreRunningBeta()) { - m_tmNextAccountHealthUpdate = gpGlobals->time + 5.0f; - - for (int playerIndex = 1; playerIndex <= gpGlobals->maxClients; playerIndex++) + if ((m_iTeam == CT || m_iTeam == TERRORIST) && + (m_iLastAccount != m_iAccount || m_iLastClientHealth != m_iClientHealth || m_tmNextAccountHealthUpdate < gpGlobals->time)) { - CBaseEntity *pEntity = UTIL_PlayerByIndex(playerIndex); + m_tmNextAccountHealthUpdate = gpGlobals->time + 5.0f; - if (!pEntity) - continue; + for (int playerIndex = 1; playerIndex <= gpGlobals->maxClients; playerIndex++) + { + CBaseEntity *pEntity = UTIL_PlayerByIndex(playerIndex); - CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pEntity->pev); + if (!pEntity) + continue; + + CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pEntity->pev); #ifdef REGAMEDLL_FIXES - if (pPlayer->IsDormant()) - continue; + if (pPlayer->IsDormant()) + continue; #endif // REGAMEDLL_FIXES - MESSAGE_BEGIN(MSG_ONE, gmsgHealthInfo, nullptr, pPlayer->edict()); - WRITE_BYTE(entindex()); - WRITE_LONG(ShouldToShowHealthInfo(pPlayer) ? m_iClientHealth : -1 /* means that 'HP' field will be hidden */); - MESSAGE_END(); + MESSAGE_BEGIN(MSG_ONE, gmsgHealthInfo, nullptr, pPlayer->edict()); + WRITE_BYTE(entindex()); + WRITE_LONG(ShouldToShowHealthInfo(pPlayer) ? m_iClientHealth : -1 /* means that 'HP' field will be hidden */); + MESSAGE_END(); - MESSAGE_BEGIN(MSG_ONE, gmsgAccount, nullptr, pPlayer->edict()); - WRITE_BYTE(entindex()); - WRITE_LONG(ShouldToShowAccount(pPlayer) ? m_iAccount : -1 /* means that this 'Money' will be hidden */); - MESSAGE_END(); + MESSAGE_BEGIN(MSG_ONE, gmsgAccount, nullptr, pPlayer->edict()); + WRITE_BYTE(entindex()); + WRITE_LONG(ShouldToShowAccount(pPlayer) ? m_iAccount : -1 /* means that this 'Money' will be hidden */); + MESSAGE_END(); + } + + m_iLastAccount = m_iAccount; + m_iLastClientHealth = m_iClientHealth; } - - m_iLastAccount = m_iAccount; - m_iLastClientHealth = m_iClientHealth; } #endif // #ifdef BUILD_LATEST } diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index c38a85a1..3038b223 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -1691,6 +1691,28 @@ bool UTIL_AreBotsAllowed() return false; } +bool UTIL_IsBeta() +{ +#ifdef BUILD_LATEST + if (g_engfuncs.pfnEngCheckParm == nullptr) + return false; + + // always beta from listen server + if (!IS_DEDICATED_SERVER()) + { + return true; + } + + int beta = ENG_CHECK_PARM("-beta", nullptr); + if (beta) + { + return true; + } +#endif // #ifdef BUILD_LATEST + + return false; +} + bool UTIL_AreHostagesImprov() { if (AreRunningCZero()) diff --git a/regamedll/dlls/util.h b/regamedll/dlls/util.h index e45b8112..af7a0a65 100644 --- a/regamedll/dlls/util.h +++ b/regamedll/dlls/util.h @@ -294,6 +294,7 @@ bool UTIL_IsGame(const char *pszGameName); real_t UTIL_GetPlayerGaitYaw(int playerIndex); int UTIL_ReadFlags(const char *c); bool UTIL_AreBotsAllowed(); +bool UTIL_IsBeta(); bool UTIL_AreHostagesImprov(); int UTIL_GetNumPlayers(); bool UTIL_IsSpawnPointOccupied(CBaseEntity *pSpot); diff --git a/regamedll/regamedll/regamedll.cpp b/regamedll/regamedll/regamedll.cpp index 897653b4..5e6190d1 100644 --- a/regamedll/regamedll/regamedll.cpp +++ b/regamedll/regamedll/regamedll.cpp @@ -30,8 +30,9 @@ void Regamedll_Game_Init() { - g_bIsCzeroGame = UTIL_IsGame("czero"); - g_bAllowedCSBot = UTIL_AreBotsAllowed(); // determine whether bots can be used or not + g_bIsBeta = UTIL_IsBeta(); + g_bIsCzeroGame = UTIL_IsGame("czero"); + g_bAllowedCSBot = UTIL_AreBotsAllowed(); // determine whether bots can be used or not g_bHostageImprov = UTIL_AreHostagesImprov(); // determine whether hostage improv can be used or not WeaponInfoReset(); diff --git a/regamedll/regamedll/regamedll.h b/regamedll/regamedll/regamedll.h index fedf81f8..54c08d67 100644 --- a/regamedll/regamedll/regamedll.h +++ b/regamedll/regamedll/regamedll.h @@ -34,3 +34,8 @@ inline bool AreRunningCZero() { return g_bIsCzeroGame; } + +inline bool AreRunningBeta() +{ + return g_bIsBeta; +}