From fa410358ef5dd681c2e229adfd8fc144642c5ddd Mon Sep 17 00:00:00 2001 From: Skull <86374920+skkuull@users.noreply.github.com> Date: Sun, 26 Jun 2022 02:07:55 +0300 Subject: [PATCH] vector add also removes a dummy duplicate, nice catch Diamante --- src/client/game/scripting/lua/context.cpp | 5 ----- src/common/utils/vector.cpp | 7 +++++++ src/common/utils/vector.hpp | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/client/game/scripting/lua/context.cpp b/src/client/game/scripting/lua/context.cpp index 396b3837..42140a86 100644 --- a/src/client/game/scripting/lua/context.cpp +++ b/src/client/game/scripting/lua/context.cpp @@ -156,11 +156,6 @@ namespace scripting::lua return normalize_vector(a); }; - vector_type["normalize"] = [](const vector& a) - { - return normalize_vector(a); - }; - vector_type["toangles"] = [](const vector& a) { return call("vectortoangles", {a}).as(); diff --git a/src/common/utils/vector.cpp b/src/common/utils/vector.cpp index aa0357ef..81f4eff2 100644 --- a/src/common/utils/vector.cpp +++ b/src/common/utils/vector.cpp @@ -46,6 +46,13 @@ namespace utils::vector out[1] = veca[1] - vecb[1]; out[2] = veca[2] - vecb[2]; } + + void add(const float* veca, const float* vecb, float* out) + { + out[0] = veca[0] + vecb[0]; + out[1] = veca[1] + vecb[1]; + out[2] = veca[2] + vecb[2]; + } float length(float* v) { diff --git a/src/common/utils/vector.hpp b/src/common/utils/vector.hpp index 6bf74ae1..5700c5a3 100644 --- a/src/common/utils/vector.hpp +++ b/src/common/utils/vector.hpp @@ -7,6 +7,7 @@ namespace utils::vector void scale(const float* in, float scale, float* out); void ma(const float* v1, float scale, const float* v2, float* out); void subtract(const float* veca, const float* vecb, float* out); + void add(const float* veca, const float* vecb, float* out); float length(float* v); float product(const float* v1, const float* v2); }