From 9ec237509d7524ec5d6e9e65d1ea61cac202f60c Mon Sep 17 00:00:00 2001 From: 8dcc <8dcc.git@gmail.com> Date: Sun, 23 Jul 2023 00:27:16 +0200 Subject: [PATCH] Add vec3() function for creating 3d vecs --- src/include/util.h | 1 + src/util.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/include/util.h b/src/include/util.h index 69856c9..9c58cc1 100644 --- a/src/include/util.h +++ b/src/include/util.h @@ -12,6 +12,7 @@ typedef float vec2_t[2]; bool is_alive(cl_entity_t* ent); bool valid_client(cl_entity_t* ent); char* get_name(int ent_idx); +vec3_t vec3(float x, float y, float z); bool vec_is_zero(vec3_t v); bool world_to_screen(vec3_t vec, vec2_t screen); diff --git a/src/util.c b/src/util.c index ffbe598..6cae693 100644 --- a/src/util.c +++ b/src/util.c @@ -18,6 +18,16 @@ char* get_name(int ent_idx) { return info.name; } +vec3_t vec3(float x, float y, float z) { + vec3_t ret; + + ret[0] = x; + ret[1] = y; + ret[2] = z; + + return ret; +} + bool vec_is_zero(vec3_t v) { return v[0] == 0.0f && v[1] == 0.0f && v[2] == 0.0f; }