From 009d3fbcf7e1e3ea94656b5233e0bc96fa7b5a5b Mon Sep 17 00:00:00 2001 From: Made Date: Fri, 1 May 2020 18:59:48 +0200 Subject: decompile FX.s, FX_atan.s and partially decompile FX_ves.s --- arm9/lib/src/FX_vec_c.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 arm9/lib/src/FX_vec_c.c (limited to 'arm9/lib/src/FX_vec_c.c') diff --git a/arm9/lib/src/FX_vec_c.c b/arm9/lib/src/FX_vec_c.c new file mode 100644 index 00000000..a2e0ffe4 --- /dev/null +++ b/arm9/lib/src/FX_vec_c.c @@ -0,0 +1,34 @@ +#include "global.h" +#include "main.h" +#include "fx.h" + +void VEC_Add(struct Vecx32 *x, struct Vecx32 *y, struct Vecx32 *dst){ + dst->x = x->x + y->x; + dst->y = x->y + y->y; + dst->z = x->z + y->z; +} + +void VEC_Subtract(struct Vecx32 *x, struct Vecx32 *y, struct Vecx32 *dst){ + dst->x = x->x - y->x; + dst->y = x->y - y->y; + dst->z = x->z - y->z; +} + +void VEC_Fx16Add(struct Vecx16 *x, struct Vecx16 *y, struct Vecx16 *dst){ + dst->x = x->x + y->x; + dst->y = x->y + y->y; + dst->z = x->z + y->z; +} + +s32 VEC_DotProduct(struct Vecx32 *x, struct Vecx32 *y){ + return ((s64)x->x * y->x + (s64)x->y * y->y + (s64)x->z * y->z + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT; +} + +s32 VEC_Fx16DotProduct(struct Vecx16 *x, struct Vecx16 *y){ + s32 temp1, temp2; + temp1 = (x->x * y->x) + (x->y * y->y); + temp2 = (x->z * y->z) + (1 << (FX64_INT_SHIFT - 1)); + return (s32)(((s64)temp1 + temp2) >> FX64_INT_SHIFT); +} + +void VEC_CrossProduct(struct Vecx32 *x, struct Vecx32 *y, struct Vecx32 *); -- cgit v1.2.3