NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
c_math.hpp
Go to the documentation of this file.
1#pragma once
2#include <types.h>
4
7namespace cM {
8
9 // Conversion utilities
10 s16 rad2s(float rad);
11 s16 atan2s(float sin, float cos);
12
13 // RNG utilities
14 void initRnd(ulong seed);
15 float rnd();
16 int rndInt(int max);
17 float rndF(float max);
18
19 // Float utilities
21 inline float fmin(float x, float y) {
22 if (x > y) {
23 return y;
24 } else {
25 return x;
26 }
27 }
28
30 inline float fmax(float x, float y) {
31 if (x < y) {
32 return y;
33 } else {
34 return x;
35 }
36 }
37
38} // namespace cM
C Math library.
Definition c_math.cpp:94
float rnd()
Generates a floating point number between 0 and 1.
Definition c_math.cpp:176
float fmin(float x, float y)
Gets the minimum float between x and y .
Definition c_math.hpp:21
float rndF(float max)
Generates a floating point number between 0 and the given max.
Definition c_math.cpp:184
int rndInt(int max)
Generates an integer between 0 and the given max.
Definition c_math.cpp:180
s16 atan2s(float sin, float cos)
Converts a sine and a cosine to an angle in units.
Definition c_math.cpp:168
float fmax(float x, float y)
Gets the maximum float between x and y .
Definition c_math.hpp:30
s16 rad2s(float rad)
Converts an angle from radians to units.
Definition c_math.cpp:104
void initRnd(ulong seed)
Initializes s_rnd with the given seed.
Definition c_math.cpp:172