From 736c7a2fff5d7d1935dcb04cec1201f8b33d397a Mon Sep 17 00:00:00 2001 From: Colton Rushton Date: Tue, 19 May 2020 10:14:44 -0300 Subject: [PATCH] Refactor PR #151 --- include/libc/stdlib.h | 8 ++++++++ src/engine/math_util.h | 4 ++++ src/game/mario_actions_cutscene.c | 1 - src/game/options_menu.c | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/libc/stdlib.h b/include/libc/stdlib.h index c23b4542..783ccf52 100644 --- a/include/libc/stdlib.h +++ b/include/libc/stdlib.h @@ -1,6 +1,8 @@ #ifndef STDLIB_H #define STDLIB_H +#ifndef TARGET_WEB + typedef struct lldiv_t { long long quot; @@ -16,4 +18,10 @@ typedef struct ldiv_t lldiv_t lldiv(long long num, long long denom); ldiv_t ldiv(long num, long denom); +#else + +#include + +#endif + #endif diff --git a/src/engine/math_util.h b/src/engine/math_util.h index b8b7f1b8..99727a73 100644 --- a/src/engine/math_util.h +++ b/src/engine/math_util.h @@ -29,7 +29,11 @@ extern f32 gCosineTable[]; #define sqr(x) ((x) * (x)) +#ifndef TARGET_WEB #define abs(x) ((x) < 0 ? -(x) : (x)) +#else +#include "../../include/libc/stdlib.h" +#endif void *vec3f_copy(Vec3f dest, Vec3f src); void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z); diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 6c3a8b0a..ef413cd9 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -3,7 +3,6 @@ #include "prevent_bss_reordering.h" #include "sm64.h" #include "gfx_dimensions.h" -//#include "game.h" #include "game_init.h" #include "sound_init.h" #include "level_update.h" diff --git a/src/game/options_menu.c b/src/game/options_menu.c index ab7da294..b5dbfedb 100644 --- a/src/game/options_menu.c +++ b/src/game/options_menu.c @@ -23,6 +23,7 @@ #include "pc/controller/controller_api.h" #include +#include "../../include/libc/stdlib.h" u8 optmenu_open = 0;