From 0ccc55e70faa4003278eb9930529c0b50da548bb Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Sat, 13 Apr 2024 19:32:50 -0500 Subject: [PATCH] Move abs to stdlib.h --- include/math.h | 2 -- include/stdlib.h | 6 ++++++ src/REL/m407dll/camera.c | 5 +---- src/REL/m407dll/player.c | 4 ++-- src/REL/w04Dll/boo_event.c | 3 --- src/game/board/basic_space.c | 1 + src/game/board/lottery.c | 1 + src/game/board/player.c | 2 ++ 8 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 include/stdlib.h diff --git a/include/math.h b/include/math.h index 3a508d50..540b5f3d 100644 --- a/include/math.h +++ b/include/math.h @@ -43,8 +43,6 @@ float cosf(float x); float atan2f(float y, float x); float acosf(float x); -#define abs(x) __abs(x) - extern inline double fabs(double x) { return __fabs(x); diff --git a/include/stdlib.h b/include/stdlib.h new file mode 100644 index 00000000..c6e1d71d --- /dev/null +++ b/include/stdlib.h @@ -0,0 +1,6 @@ +#ifndef _STDLIB_H +#define _STDLIB_H + +#define abs(x) __abs(x) + +#endif diff --git a/src/REL/m407dll/camera.c b/src/REL/m407dll/camera.c index a9f09888..20d3d4db 100644 --- a/src/REL/m407dll/camera.c +++ b/src/REL/m407dll/camera.c @@ -1,8 +1,7 @@ #include "game/process.h" #include "game/object.h" #include "game/hsfdraw.h" - -#define M_PI 3.141592653589793 +#include "math.h" typedef struct unkDominationData2 { /* 0x00 */ s32 unk_00; @@ -23,8 +22,6 @@ void fn_1_1CAC(f32, f32, f32); void fn_1_1D08(f32, f32, f32); void fn_1_1D64(f32); void fn_1_2024(omObjData*); -double cos(double x); -double sin(double x); //bss Process* lbl_1_bss_34; diff --git a/src/REL/m407dll/player.c b/src/REL/m407dll/player.c index 48338112..5e1883c0 100644 --- a/src/REL/m407dll/player.c +++ b/src/REL/m407dll/player.c @@ -5,6 +5,8 @@ #include "game/objsub.h" #include "game/chrman.h" #include "game/hsfman.h" +#include "math.h" + #include "rel_sqrt_consts.h" #define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0])) @@ -51,8 +53,6 @@ void fn_1_1074(omObjData* arg0); void fn_1_11CC(omObjData* arg0); void fn_1_13E4(omObjData* arg0); void fn_1_1460(omObjData* arg0); -double cos(double x); -double sin(double x); //bss Process* lbl_1_bss_18; diff --git a/src/REL/w04Dll/boo_event.c b/src/REL/w04Dll/boo_event.c index 95145384..9167167c 100755 --- a/src/REL/w04Dll/boo_event.c +++ b/src/REL/w04Dll/boo_event.c @@ -22,9 +22,6 @@ #include "dolphin.h" #include "math.h" -// TODO: required to match fn_1_3C9C. Can be removed once abs is removed from math.h. -#undef abs - typedef struct { /* 0x00 */ char unk00[0x50]; /* 0x50 */ u32 unk50; // pointer? diff --git a/src/game/board/basic_space.c b/src/game/board/basic_space.c index 270f55b0..95bc962e 100644 --- a/src/game/board/basic_space.c +++ b/src/game/board/basic_space.c @@ -9,6 +9,7 @@ #include "game/objsub.h" #include "game/gamework_data.h" #include "math.h" +#include "stdlib.h" typedef struct bit_copy { struct { diff --git a/src/game/board/lottery.c b/src/game/board/lottery.c index f5689a87..40e6b57b 100755 --- a/src/game/board/lottery.c +++ b/src/game/board/lottery.c @@ -22,6 +22,7 @@ #include "game/board/window.h" #include "math.h" +#include "stdlib.h" #define ABS(x) (((x) < 0) ? -(x) : (x)) diff --git a/src/game/board/player.c b/src/game/board/player.c index 9be100ed..e10c8820 100644 --- a/src/game/board/player.c +++ b/src/game/board/player.c @@ -15,6 +15,8 @@ #include "game/board/basic_space.h" #include "game/board/audio.h" #include "game/pad.h" +#include "stdlib.h" +#include "math.h" static void InitJunction(s32, s32, f32); static void UpdateJunctionGfx(omObjData*);