bot: added support for 25th anniversary hl-update structures

This commit is contained in:
jeefo 2023-11-25 23:40:43 +03:00
commit 87e3cc963a
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
4 changed files with 15 additions and 1 deletions

@ -1 +1 @@
Subproject commit 2cee19a0433fb71aa96b93151ceb1850b6106b5d
Subproject commit c91a51d769f10a38637af7ee9f03ed76d1fc206c

View file

@ -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 ();

View file

@ -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;

View file

@ -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 <msurface_hw_25anniversary_t, mnode_hw_t> (reinterpret_cast <mnode_hw_t *> (m_worldModel->nodes), point, endPoint);
}
return recursiveLightPoint <msurface_hw_t, mnode_hw_t> (reinterpret_cast <mnode_hw_t *> (m_worldModel->nodes), point, endPoint);
}
return recursiveLightPoint <msurface_t, mnode_t> (m_worldModel->nodes, point, endPoint);