From 87e3cc963ac09d099cd4bf119e0108e4f74d5ab2 Mon Sep 17 00:00:00 2001 From: jeefo Date: Sat, 25 Nov 2023 23:40:43 +0300 Subject: [PATCH] bot: added support for 25th anniversary hl-update structures --- ext/linkage | 2 +- inc/engine.h | 3 +++ src/combat.cpp | 2 ++ src/engine.cpp | 9 +++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ext/linkage b/ext/linkage index 2cee19a..c91a51d 160000 --- a/ext/linkage +++ b/ext/linkage @@ -1 +1 @@ -Subproject commit 2cee19a0433fb71aa96b93151ceb1850b6106b5d +Subproject commit c91a51d769f10a38637af7ee9f03ed76d1fc206c diff --git a/inc/engine.h b/inc/engine.h index ecc1a4b..497ea2f 100644 --- a/inc/engine.h +++ b/inc/engine.h @@ -196,6 +196,9 @@ public: // checks whether software rendering is enabled bool isSoftwareRenderer (); + // checks if this is 25th anniversary half-life update + bool is25thAnniversaryUpdate (); + // load the cs binary in non metamod mode bool loadCSBinary (); diff --git a/src/combat.cpp b/src/combat.cpp index e7a5ee5..e81c21a 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -1871,6 +1871,7 @@ void Bot::checkGrenadesThrow () { || m_isReloading || (isKnifeMode() && !bots.isBombPlanted()) || m_grenadeCheckTime >= game.time()); + if (throwingCondition) { clearThrowStates (m_states); return; @@ -1925,6 +1926,7 @@ void Bot::checkGrenadesThrow () { auto grenadeToThrowCondition = game.mapIs(MapFlags::GrenadeWar) ? 100.0f : grenadeToThrow == Weapon::Smoke ? 200.0f : 400.0f; + if (!m_lastEnemyOrigin.empty () && distanceSq > cr::sqrf (grenadeToThrowCondition) && distanceSq < cr::sqrf (1200.0f)) { bool allowThrowing = true; diff --git a/src/engine.cpp b/src/engine.cpp index 4f67d08..0d3fadb 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -552,6 +552,12 @@ bool Game::isSoftwareRenderer () { return false; } +bool Game::is25thAnniversaryUpdate () { + static ConVarRef sv_use_steam_networking ("sv_use_steam_networking"); + + return sv_use_steam_networking.exists (); +} + void Game::addNewCvar (const char *name, const char *value, const char *info, bool bounded, float min, float max, int32_t varType, bool missingAction, const char *regval, ConVar *self) { // this function adds globally defined variable to registration stack @@ -1227,6 +1233,9 @@ float LightMeasure::getLightLevel (const Vector &point) { // it's depends if we're are on dedicated or on listenserver auto recursiveCheck = [&] () -> bool { if (!game.isSoftwareRenderer ()) { + if (game.is25thAnniversaryUpdate ()) { + return recursiveLightPoint (reinterpret_cast (m_worldModel->nodes), point, endPoint); + } return recursiveLightPoint (reinterpret_cast (m_worldModel->nodes), point, endPoint); } return recursiveLightPoint (m_worldModel->nodes, point, endPoint);