summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/alignment.h6
-rw-r--r--include/color.h4
-rw-r--r--include/functions.h9
-rw-r--r--include/rand.h23
-rw-r--r--include/variables.h1
-rw-r--r--include/z64.h1
6 files changed, 32 insertions, 12 deletions
diff --git a/include/alignment.h b/include/alignment.h
index f2fd65750..9e6fe11e6 100644
--- a/include/alignment.h
+++ b/include/alignment.h
@@ -14,6 +14,12 @@
#endif
#ifdef __sgi /* IDO compiler */
+#define UNALIGNED __unaligned
+#else
+#define UNALIGNED
+#endif
+
+#ifdef __sgi /* IDO compiler */
#define ALIGNOF(x) __builtin_alignof(x)
#elif (__STDC_VERSION__ >= 201112L) /* C11 */
#define ALIGNOF(x) _Alignof(x)
diff --git a/include/color.h b/include/color.h
index def50caa8..7c0cd7d9f 100644
--- a/include/color.h
+++ b/include/color.h
@@ -1,5 +1,5 @@
-#ifndef _COLOR_H_
-#define _COLOR_H_
+#ifndef COLOR_H
+#define COLOR_H
#include "PR/ultratypes.h"
diff --git a/include/functions.h b/include/functions.h
index 63a34368e..8ad230a60 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -98,15 +98,6 @@ f64 func_80086D6C(f64 param_1);
s32 func_80086D8C(f32 param_1);
s32 func_80086DAC(f64 param_1);
-u32 Rand_Next(void);
-void Rand_Seed(u32 seed);
-f32 Rand_ZeroOne(void);
-f32 Rand_Centered(void);
-void Rand_Seed_Variable(u32* rndNum, u32 seed);
-u32 Rand_Next_Variable(u32* rndNum);
-f32 Rand_ZeroOne_Variable(u32* rndNum);
-f32 Rand_Centered_Variable(u32* rndNum);
-
s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args);
s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...);
void Sleep_Cycles(OSTime time);
diff --git a/include/rand.h b/include/rand.h
new file mode 100644
index 000000000..01e6efe2e
--- /dev/null
+++ b/include/rand.h
@@ -0,0 +1,23 @@
+#ifndef RAND_H
+#define RAND_H
+
+#include "PR/ultratypes.h"
+
+//! These values are recommended by the algorithms book *Numerical Recipes in C. The Art of Scientific Computing*, 2nd
+//! Edition, 1992, ISBN 0-521-43108-5. (p. 284):
+//! > This is about as good as any 32-bit linear congruential generator, entirely adequate for many uses.
+#define RAND_MULTIPLIER 1664525
+#define RAND_INCREMENT 1013904223
+
+u32 Rand_Next(void);
+void Rand_Seed(u32 seed);
+f32 Rand_ZeroOne(void);
+f32 Rand_Centered(void);
+void Rand_Seed_Variable(u32* rndNum, u32 seed);
+u32 Rand_Next_Variable(u32* rndNum);
+f32 Rand_ZeroOne_Variable(u32* rndNum);
+f32 Rand_Centered_Variable(u32* rndNum);
+
+extern u32 gRandFloat;
+
+#endif \ No newline at end of file
diff --git a/include/variables.h b/include/variables.h
index 6314aed37..d07d11672 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -32,7 +32,6 @@ extern u8* sYaz0MaxPtr;
extern void* gYaz0DecompressDstEnd;
// extern UNK_TYPE4 D_8009CD10;
-extern u32 gRandFloat;
// extern UNK_TYPE4 sArenaLockMsg;
extern DmaEntry dmadata[1568];
diff --git a/include/z64.h b/include/z64.h
index fec70b3e6..147ddac99 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -24,6 +24,7 @@
#include "gfx.h"
#include "gfxprint.h"
#include "padutils.h"
+#include "rand.h"
#include "sys_matrix.h"
#include "tha.h"
#include "thga.h"