diff options
| author | Aetias <aetias@outlook.com> | 2025-01-18 15:50:03 +0100 |
|---|---|---|
| committer | Aetias <aetias@outlook.com> | 2025-01-18 15:50:03 +0100 |
| commit | fe4c283ba249c5c676b75542c83dfbb829c768b3 (patch) | |
| tree | 40aa253e419330dc3bbfb5300f95dbf97cbe7b81 /include | |
| parent | 311b9243e1fa2ee7ff4992bb7465ef3292f85a7d (diff) | |
Document math functions
Diffstat (limited to 'include')
| -rw-r--r-- | include/Actor/Actor.hpp | 2 | ||||
| -rw-r--r-- | include/Actor/ActorRupee.hpp | 2 | ||||
| -rw-r--r-- | include/Item/ItemManager.hpp | 2 | ||||
| -rw-r--r-- | include/Map/CameraViewpoint.hpp | 2 | ||||
| -rw-r--r-- | include/Map/Entrance.hpp | 2 | ||||
| -rw-r--r-- | include/Map/MapBase.hpp | 2 | ||||
| -rw-r--r-- | include/Map/MapData.hpp | 2 | ||||
| -rw-r--r-- | include/Map/MapManager.hpp | 2 | ||||
| -rw-r--r-- | include/Physics/AABB.hpp | 2 | ||||
| -rw-r--r-- | include/Physics/Cylinder.hpp | 2 | ||||
| -rw-r--r-- | include/Physics/Sphere.hpp | 2 | ||||
| -rw-r--r-- | include/Physics/Transform.hpp | 2 | ||||
| -rw-r--r-- | include/Player/EquipRope.hpp | 2 | ||||
| -rw-r--r-- | include/Player/LinkStateBase.hpp | 2 | ||||
| -rw-r--r-- | include/Player/LinkStateCutscene.hpp | 2 | ||||
| -rw-r--r-- | include/Player/LinkStateDamage.hpp | 2 | ||||
| -rw-r--r-- | include/Player/LinkStateFollow.hpp | 2 | ||||
| -rw-r--r-- | include/Player/LinkStateInteract.hpp | 2 | ||||
| -rw-r--r-- | include/Player/PlayerControl.hpp | 2 | ||||
| -rw-r--r-- | include/Player/PlayerControlData.hpp | 2 | ||||
| -rw-r--r-- | include/Player/PlayerLinkBase.hpp | 2 | ||||
| -rw-r--r-- | include/Player/TouchControl.hpp | 2 | ||||
| -rw-r--r-- | include/lib/math.h | 95 | ||||
| -rw-r--r-- | include/types.h | 4 |
24 files changed, 26 insertions, 117 deletions
diff --git a/include/Actor/Actor.hpp b/include/Actor/Actor.hpp index 64402237..2a30a7c1 100644 --- a/include/Actor/Actor.hpp +++ b/include/Actor/Actor.hpp @@ -3,7 +3,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" #include "Actor/ActorRef.hpp" #include "Actor/ActorType.hpp" diff --git a/include/Actor/ActorRupee.hpp b/include/Actor/ActorRupee.hpp index 56519394..a5fcbea3 100644 --- a/include/Actor/ActorRupee.hpp +++ b/include/Actor/ActorRupee.hpp @@ -1,7 +1,7 @@ #pragma once #include "global.h" -#include "lib/math.h" +#include "nds/math.h" #include "types.h" #include "Actor/Actor.hpp" diff --git a/include/Item/ItemManager.hpp b/include/Item/ItemManager.hpp index ae5e8cad..1fcabe31 100644 --- a/include/Item/ItemManager.hpp +++ b/include/Item/ItemManager.hpp @@ -5,7 +5,7 @@ extern "C" { }
#include "global.h"
-#include "lib/math.h"
+#include "nds/math.h"
#include "types.h"
#include "Actor/ActorNavi.hpp"
diff --git a/include/Map/CameraViewpoint.hpp b/include/Map/CameraViewpoint.hpp index c952078b..924ef379 100644 --- a/include/Map/CameraViewpoint.hpp +++ b/include/Map/CameraViewpoint.hpp @@ -3,7 +3,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" #include "System/SysNew.hpp" diff --git a/include/Map/Entrance.hpp b/include/Map/Entrance.hpp index d9bea6ef..8d7d6a29 100644 --- a/include/Map/Entrance.hpp +++ b/include/Map/Entrance.hpp @@ -3,7 +3,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" #include "System/SysNew.hpp" diff --git a/include/Map/MapBase.hpp b/include/Map/MapBase.hpp index f9d08cac..f85c782e 100644 --- a/include/Map/MapBase.hpp +++ b/include/Map/MapBase.hpp @@ -5,7 +5,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" #include "Map/CameraViewpoint.hpp" #include "Map/Course.hpp" diff --git a/include/Map/MapData.hpp b/include/Map/MapData.hpp index be4b691f..295e2309 100644 --- a/include/Map/MapData.hpp +++ b/include/Map/MapData.hpp @@ -3,7 +3,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" #include "System/SysNew.hpp" diff --git a/include/Map/MapManager.hpp b/include/Map/MapManager.hpp index ff3397b9..b346a4d0 100644 --- a/include/Map/MapManager.hpp +++ b/include/Map/MapManager.hpp @@ -3,7 +3,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" #include "Map/Course.hpp" #include "Map/MapBase.hpp" diff --git a/include/Physics/AABB.hpp b/include/Physics/AABB.hpp index ef90ffcd..19ce9f38 100644 --- a/include/Physics/AABB.hpp +++ b/include/Physics/AABB.hpp @@ -3,7 +3,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" struct AABB { Vec3p min; diff --git a/include/Physics/Cylinder.hpp b/include/Physics/Cylinder.hpp index 59c03c46..353635dd 100644 --- a/include/Physics/Cylinder.hpp +++ b/include/Physics/Cylinder.hpp @@ -3,7 +3,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" struct Cylinder { Vec3p pos; diff --git a/include/Physics/Sphere.hpp b/include/Physics/Sphere.hpp index eb88f74d..ba42ddf2 100644 --- a/include/Physics/Sphere.hpp +++ b/include/Physics/Sphere.hpp @@ -3,7 +3,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" struct Sphere { Vec3p pos; diff --git a/include/Physics/Transform.hpp b/include/Physics/Transform.hpp index 6b72af57..140e574d 100644 --- a/include/Physics/Transform.hpp +++ b/include/Physics/Transform.hpp @@ -3,7 +3,7 @@ #include "global.h" #include "types.h" -#include "lib/math.h" +#include "nds/math.h" struct Transform { Vec3p pos; diff --git a/include/Player/EquipRope.hpp b/include/Player/EquipRope.hpp index 127eb974..906f813b 100644 --- a/include/Player/EquipRope.hpp +++ b/include/Player/EquipRope.hpp @@ -1,7 +1,7 @@ #pragma once
#include "global.h"
-#include "lib/math.h"
+#include "nds/math.h"
#include "types.h"
#include "Actor/ActorRef.hpp"
diff --git a/include/Player/LinkStateBase.hpp b/include/Player/LinkStateBase.hpp index 3371b937..f3ac5087 100644 --- a/include/Player/LinkStateBase.hpp +++ b/include/Player/LinkStateBase.hpp @@ -1,7 +1,7 @@ #pragma once #include "global.h" -#include "lib/math.h" +#include "nds/math.h" #include "types.h" #include "Actor/Actor.hpp" diff --git a/include/Player/LinkStateCutscene.hpp b/include/Player/LinkStateCutscene.hpp index f39c7430..514f2b32 100644 --- a/include/Player/LinkStateCutscene.hpp +++ b/include/Player/LinkStateCutscene.hpp @@ -1,7 +1,7 @@ #pragma once #include "global.h" -#include "lib/math.h" +#include "nds/math.h" #include "types.h" #include "Item/Item.hpp" diff --git a/include/Player/LinkStateDamage.hpp b/include/Player/LinkStateDamage.hpp index 2c5e6e00..1c59d90e 100644 --- a/include/Player/LinkStateDamage.hpp +++ b/include/Player/LinkStateDamage.hpp @@ -1,7 +1,7 @@ #pragma once #include "global.h" -#include "lib/math.h" +#include "nds/math.h" #include "types.h" #include "Player/LinkStateBase.hpp" diff --git a/include/Player/LinkStateFollow.hpp b/include/Player/LinkStateFollow.hpp index c422faa1..09de008e 100644 --- a/include/Player/LinkStateFollow.hpp +++ b/include/Player/LinkStateFollow.hpp @@ -1,7 +1,7 @@ #pragma once #include "global.h" -#include "lib/math.h" +#include "nds/math.h" #include "types.h" #include "Actor/Actor.hpp" diff --git a/include/Player/LinkStateInteract.hpp b/include/Player/LinkStateInteract.hpp index 150983b8..55081c8a 100644 --- a/include/Player/LinkStateInteract.hpp +++ b/include/Player/LinkStateInteract.hpp @@ -1,7 +1,7 @@ #pragma once #include "global.h" -#include "lib/math.h" +#include "nds/math.h" #include "types.h" #include "Actor/Actor.hpp" diff --git a/include/Player/PlayerControl.hpp b/include/Player/PlayerControl.hpp index 0e0da8ae..de0da848 100644 --- a/include/Player/PlayerControl.hpp +++ b/include/Player/PlayerControl.hpp @@ -1,7 +1,7 @@ #pragma once #include "global.h" -#include "lib/math.h" +#include "nds/math.h" #include "types.h" #include "Actor/Actor.hpp" diff --git a/include/Player/PlayerControlData.hpp b/include/Player/PlayerControlData.hpp index 3f998186..c44a00c5 100644 --- a/include/Player/PlayerControlData.hpp +++ b/include/Player/PlayerControlData.hpp @@ -1,7 +1,7 @@ #pragma once #include "global.h" -#include "lib/math.h" +#include "nds/math.h" #include "types.h" #include "System/SysNew.hpp" diff --git a/include/Player/PlayerLinkBase.hpp b/include/Player/PlayerLinkBase.hpp index 02cf3219..8c12b911 100644 --- a/include/Player/PlayerLinkBase.hpp +++ b/include/Player/PlayerLinkBase.hpp @@ -1,7 +1,7 @@ #pragma once #include "global.h" -#include "lib/math.h" +#include "nds/math.h" #include "types.h" #include "Actor/ActorManager.hpp" diff --git a/include/Player/TouchControl.hpp b/include/Player/TouchControl.hpp index 47349d28..1301e144 100644 --- a/include/Player/TouchControl.hpp +++ b/include/Player/TouchControl.hpp @@ -1,8 +1,8 @@ #pragma once #include "global.h" -#include "lib/math.h" #include "lib/touch.h" +#include "nds/math.h" #include "types.h" typedef u16 TouchFlags; diff --git a/include/lib/math.h b/include/lib/math.h deleted file mode 100644 index f3e0d3d6..00000000 --- a/include/lib/math.h +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include "global.h" -#include "types.h" - -// Q20.12 fixed point number -typedef s32 q20; -// Q4.12 fixed point number -typedef s16 q4; - -#define INT_TO_Q20(n) ((s32) ((n) << 12)) -#define FLOAT_TO_Q21(n) ((s32) (((n) * 8192 + 1) / 4)) -#define FLOAT_TO_Q20(n) ((s32) (((n) * 8192 + 1) / 2)) -#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 DEG_TO_ANG(n) ((n) * 0x10000 / 360) -#define SIN(n) (gSinCosTable[2 * ((n) >> 4)]) -#define COS(n) (gSinCosTable[2 * ((n) >> 4) + 1]) - -extern "C" s32 Atan2(s32 x, s32 y); -extern q4 gSinCosTable[]; - -typedef struct { - /* 0 */ s8 x; - /* 1 */ s8 y; - /* 2 */ -} Vec2b; - -typedef struct { - /* 0 */ s16 x; - /* 1 */ s16 y; - /* 2 */ -} Vec2s; - -typedef struct { - /* 0 */ q20 x; - /* 4 */ q20 y; - /* 8 */ q20 z; - /* c */ -} Vec3p; - -extern const Vec3p gVec3p_ZERO; - -extern "C" void Vec3p_Add(Vec3p *a, Vec3p *b, Vec3p *out); -extern "C" void Vec3p_Sub(Vec3p *a, Vec3p *b, Vec3p *out); -extern "C" q20 Vec3p_Dot(Vec3p *a, Vec3p *b); -extern "C" void Vec3p_Cross(Vec3p *a, Vec3p *b, Vec3p *out); -extern "C" q20 Vec3p_Length(Vec3p *a); -extern "C" void Vec3p_Normalize(Vec3p *vec, Vec3p *out); -extern "C" void Vec3p_Axpy(q20 a, Vec3p *x, Vec3p *y, Vec3p *out); -extern "C" q20 Vec3p_Distance(Vec3p *a, Vec3p *b); - -inline void Vec3p_Rotate(Vec3p *vec, q20 sin, q20 cos, Vec3p *out) { - out->x += MUL_Q20(vec->z, sin); - out->z += MUL_Q20(vec->z, cos); - out->x += MUL_Q20(vec->x, cos); - out->z += MUL_Q20(vec->x, -sin); -} - -inline void Vec3p_CopyXZ(Vec3p *vec, Vec3p *out) { - q20 z = vec->z; - q20 x = vec->x; - - out->x = x; - out->y = 0; - out->z = z; -} - -inline void Vec3p_Copy(Vec3p *vec, Vec3p *out) { - out->x = vec->x; - out->y = vec->y; - out->z = vec->z; -} - -typedef struct { - /* 00 */ q20 x; - /* 04 */ q20 y; - /* 08 */ q20 z; - /* 0c */ q20 w; - /* 10 */ -} Vec4p; - -typedef struct { - /* 00 */ Vec3p xColumn; - /* 0c */ Vec3p yColumn; - /* 18 */ Vec3p zColumn; - /* 24 */ -} Mat3p; - -extern "C" u32 SoftDivide(u32 a, u32 b); -extern "C" u32 Divide(u32 a, u32 b); -extern "C" bool Approach(unk32 *src, unk32 dest, unk32 step); -extern "C" bool Approach_thunk(unk32 *src, unk32 dest, unk32 step); diff --git a/include/types.h b/include/types.h index a0952eff..0dd5ecf5 100644 --- a/include/types.h +++ b/include/types.h @@ -15,6 +15,10 @@ typedef s8 unk8; typedef s16 unk16;
typedef s32 unk32;
+#ifndef __cplusplus
+typedef s32 bool;
+#endif
+
#define CEIL_DIV(a, b) (((a) + (b) - 1) / (b))
#endif
|
