2022-05-01 18:33:37 +01:00
|
|
|
#ifndef MATH_UTIL_H
|
|
|
|
|
#define MATH_UTIL_H
|
|
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
#include "structs.h"
|
|
|
|
|
|
2022-05-20 20:37:55 +01:00
|
|
|
/**
|
|
|
|
|
* Keeps the value within the range.
|
|
|
|
|
*/
|
2022-10-24 15:37:47 +01:00
|
|
|
#define CLAMP(x, low, high) { \
|
|
|
|
|
if ((x) > (high)) (x) = (high); \
|
|
|
|
|
if ((x) < (low)) (x) = (low); \
|
2022-05-20 20:37:55 +01:00
|
|
|
}
|
2022-10-24 15:37:47 +01:00
|
|
|
|
2022-05-20 20:37:55 +01:00
|
|
|
/**
|
|
|
|
|
* Allows an arbitrary range the number can wrap around.
|
|
|
|
|
* Often used for angles, to keep them within s16 bounds while stored in an s32.
|
|
|
|
|
*/
|
2022-10-24 15:37:47 +01:00
|
|
|
#define WRAP(x, low, high) { \
|
|
|
|
|
if ((x) > (high)) (x) -= ((high) * 2) - 1; \
|
|
|
|
|
if ((x) < (low)) (x) += ((high) * 2) - 1; \
|
2022-05-20 20:37:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s16 arctan2_f(f32 y, f32 x);
|
|
|
|
|
f32 sine_s(s16 angle);
|
|
|
|
|
f32 cosine_s(s16 angle);
|
|
|
|
|
void func_80031130(s32, f32*, f32*, s32);
|
2022-09-20 09:42:30 -04:00
|
|
|
s32 func_80031600(f32*, f32*, f32*, s8* surface, s32, s32*);
|
2022-10-24 15:37:47 +01:00
|
|
|
void func_80070130(Matrix, s32, f32, f32);
|
|
|
|
|
void func_80070638(Matrix, f32, f32, f32);
|
|
|
|
|
void func_8006FE04(Matrix*, f32);
|
|
|
|
|
void func_8006FE30(Matrix*, f32);
|
2022-05-01 18:33:37 +01:00
|
|
|
|
|
|
|
|
#endif // MATH_UTIL_H
|