From 08739756787caec5e97d24ce8d5309fb34e2e040 Mon Sep 17 00:00:00 2001 From: jeefo Date: Mon, 11 Mar 2024 08:06:39 +0300 Subject: [PATCH] bot: fix think fps limiter when running on xash3d aim: simplify enemy origin compensation when moving --- src/combat.cpp | 2 +- src/manager.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/combat.cpp b/src/combat.cpp index d3bd3a1..a0a8b39 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -544,7 +544,7 @@ Vector Bot::getEnemyBodyOffset () { Vector compensation = nullptr; if (!usesSniper () && !usesKnife () && distance > kSprayDistance) { - compensation = 1.0f * m_frameInterval * m_enemy->v.velocity - 1.0f * m_frameInterval * pev->velocity; + compensation = (m_enemy->v.velocity - pev->velocity) * m_frameInterval * 2.8f; compensation.z = 0.0f; } else { diff --git a/src/manager.cpp b/src/manager.cpp index 852c35e..9624b64 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -1620,13 +1620,14 @@ void Bot::newRound () { if (rg.chance (50)) { pushChatterMessage (Chatter::NewRound); } - auto updateInterval = 1.0f / cr::clamp (cv_think_fps.float_ (), 24.0f, 90.0f); + auto thinkFps = cr::clamp (cv_think_fps.float_ (), 24.0f, 90.0f); + auto updateInterval = 1.0f / thinkFps; if (game.is (GameFlags::Xash3D)) { if (cv_think_fps_disable.bool_ ()) { updateInterval = 0.0f; } - else if (updateInterval < 50.0f) { + else if (thinkFps < 50) { updateInterval = 1.0f / 50.0f; // xash3d works acceptable at 50fps } }