summaryrefslogtreecommitdiff
path: root/arm9/lib/src/FX_vec_c.c
diff options
context:
space:
mode:
authorMade <made111@gmx.de>2020-05-01 18:59:48 +0200
committerMade <made111@gmx.de>2020-05-01 18:59:48 +0200
commit009d3fbcf7e1e3ea94656b5233e0bc96fa7b5a5b (patch)
tree1b7bc878715cc3d2f95c74fd3768c8596bcfff97 /arm9/lib/src/FX_vec_c.c
parent10b569f131fc58959d7c50dd4b07f01a52b5e162 (diff)
decompile FX.s, FX_atan.s and partially decompile FX_ves.s
Diffstat (limited to 'arm9/lib/src/FX_vec_c.c')
-rw-r--r--arm9/lib/src/FX_vec_c.c34
1 files changed, 34 insertions, 0 deletions
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 *);