bot: fix think fps limiter when running on xash3d

aim: simplify enemy origin compensation when moving
This commit is contained in:
jeefo 2024-03-11 08:06:39 +03:00
commit 0873975678
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
2 changed files with 4 additions and 3 deletions

View file

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

View file

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