From 5eff939caff3c61eff0785df3e5f1127d95110ee Mon Sep 17 00:00:00 2001 From: LightCat Date: Sat, 6 Apr 2019 19:00:46 +0200 Subject: [PATCH] fix NavBot being drunk --- src/helpers.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/helpers.cpp b/src/helpers.cpp index 24438305..5537db28 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -431,7 +431,7 @@ std::string GetLevelName() std::pair ComputeMove(const Vector &a, const Vector &b) { Vector diff = (b - a); - if (diff.Length() == 0) + if (diff.Length() == 0.0f) return { 0, 0 }; const float x = diff.x; const float y = diff.y; @@ -440,7 +440,9 @@ std::pair ComputeMove(const Vector &a, const Vector &b) Vector ang; VectorAngles(vsilent, ang); float yaw = DEG2RAD(ang.y - current_user_cmd->viewangles.y); - return { cos(yaw) * 450, -sin(yaw) * 450 }; + if (g_pLocalPlayer->bUseSilentAngles) + yaw = DEG2RAD(ang.y - g_pLocalPlayer->v_OrigViewangles.y); + return { cos(yaw) * 450.0f, -sin(yaw) * 450.0f }; } ConCommand *CreateConCommand(const char *name, FnCommandCallback_t callback, const char *help)