From 34dcfbccc6c64a9394b54e6968791da92fcd18f5 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 19 Sep 2024 04:49:56 +0200 Subject: [PATCH] Add rand.h for non-qrand.c rand functions (#1684) * sync rand.h with related oot PR * fix * yeet comment --- include/rand.h | 9 +++++++++ include/z64.h | 1 + include/z64math.h | 2 -- src/code/sys_math.c | 1 + src/code/z_lib.c | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 include/rand.h diff --git a/include/rand.h b/include/rand.h new file mode 100644 index 0000000000..4c927889b9 --- /dev/null +++ b/include/rand.h @@ -0,0 +1,9 @@ +#ifndef RAND_H +#define RAND_H + +#include "libc64/qrand.h" + +f32 Rand_ZeroFloat(f32 scale); +f32 Rand_CenteredFloat(f32 scale); + +#endif diff --git a/include/z64.h b/include/z64.h index 7c2aec722b..3de06128a2 100644 --- a/include/z64.h +++ b/include/z64.h @@ -22,6 +22,7 @@ #include "message_data_static.h" #include "padmgr.h" #include "padutils.h" +#include "rand.h" #include "regs.h" #include "scheduler.h" #include "segmented_address.h" diff --git a/include/z64math.h b/include/z64math.h index d0c50f3f1e..5d31396b1d 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -244,8 +244,6 @@ f32 Math_Factorial(s32 n); f32 Math_PowF(f32 base, s32 exp); f32 Math_SinF(f32 rad); f32 Math_CosF(f32 rad); -f32 Rand_ZeroFloat(f32 scale); -f32 Rand_CenteredFloat(f32 scale); s16 Math_Atan2S(f32 y, f32 x); f32 Math_Atan2F(f32 y, f32 x); diff --git a/src/code/sys_math.c b/src/code/sys_math.c index 81d54d86aa..5418f8021d 100644 --- a/src/code/sys_math.c +++ b/src/code/sys_math.c @@ -4,6 +4,7 @@ */ #include "global.h" +#include "rand.h" static f32 sFactorialTbl[] = { 1.0f, 1.0f, 2.0f, 6.0f, 24.0f, 120.0f, 720.0f, 5040.0f, 40320.0f, 362880.0f, 3628800.0f, 39916800.0f, 479001600.0f, diff --git a/src/code/z_lib.c b/src/code/z_lib.c index e8d95584a7..9f93783b50 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -3,6 +3,7 @@ #include "libc64/qrand.h" +#include "rand.h" #include "segmented_address.h" #include "sfx.h" #include "z64game.h"