summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorAetias <144526980+AetiasHax@users.noreply.github.com>2025-05-26 21:35:20 +0200
committerGitHub <noreply@github.com>2025-05-26 21:35:20 +0200
commit59a5cc5da29bd84680ceeaf2c2eeabe9effb6b6d (patch)
tree3b4316c804d44cd46bf12d27f3c76d89abe2c97d /libs
parent3f6a81d03dec2bd7c8394b508dbe4f017a5244b9 (diff)
parent8f6142e4fdd1195541e3f1ecc08ddf961f3b046c (diff)
Merge pull request #71 from AetiasHax/decomp-PlayerControl
Decomp `src/00_Core/Player/PlayerControl.cpp` (99%)
Diffstat (limited to 'libs')
-rw-r--r--libs/nds/include/nds/math.h9
-rw-r--r--libs/nds/src/itcm/math_1.c2
2 files changed, 7 insertions, 4 deletions
diff --git a/libs/nds/include/nds/math.h b/libs/nds/include/nds/math.h
index 517cbde2..18332db1 100644
--- a/libs/nds/include/nds/math.h
+++ b/libs/nds/include/nds/math.h
@@ -8,6 +8,8 @@
extern "C" {
#endif
+#define ABS(x) ((x) < 0 ? -(x) : (x))
+
// Q20.12 fixed point number
typedef s32 q20;
// Q4.12 fixed point number
@@ -19,6 +21,7 @@ typedef s16 q4;
#define FLOAT_TO_Q19(n) ((s32) (((n) * 8192 + 1)))
#define ROUND_Q20(n) (((s32) (n) + 0x800) >> 12)
#define MUL_Q20(a, b) (q20)((((s64) (a)) * ((s64) (b)) + 0x800) >> 12)
+#define DIV_Q20(a, b) (((a) << 12) / (b))
#define DEG_TO_ANG(n) ((n) * 0x10000 / 360)
#define SIN(n) (gSinCosTable[2 * ((n) >> 4)])
@@ -31,7 +34,7 @@ u32 SoftDivide(u32 a, u32 b);
u32 CoDivide64By32(u32 a, u32 b);
u32 func_01ff98f0(u32 a, u32 b);
u32 CoReciprocal(u32 x);
-u32 func_01ff992c(u32 x);
+u64 func_01ff992c(u32 x);
u32 CoSqrt(u32 x);
u32 CoInvSqrt(u32 x);
u32 AwaitDivisionResult();
@@ -49,8 +52,8 @@ bool Approach_thunk(unk32 *src, unk32 dest, unk32 step);
extern q4 gSinCosTable[];
typedef struct {
- /* 0 */ s8 x;
- /* 1 */ s8 y;
+ /* 0 */ u8 x;
+ /* 1 */ u8 y;
/* 2 */
} Vec2b;
diff --git a/libs/nds/src/itcm/math_1.c b/libs/nds/src/itcm/math_1.c
index ee452869..bbc5f740 100644
--- a/libs/nds/src/itcm/math_1.c
+++ b/libs/nds/src/itcm/math_1.c
@@ -37,7 +37,7 @@ void Mat4p_Multiply(Mat4p *a, Mat4p *b, Mat4p *out) {}
u32 CoDivide64By32(u32 a, u32 b) {}
u32 func_01ff98f0(u32 a, u32 b) {}
u32 CoReciprocal(u32 x) {}
-u32 func_01ff992c(u32 x) {}
+u64 func_01ff992c(u32 x) {}
u32 CoSqrt(u32 x) {}
u32 CoInvSqrt(u32 x) {}
u32 AwaitDivisionResult() {}