Files
Diddy-Kong-Racing/include/math_util.h
T
FazanaandGitHub 519ff3c09c Further matches + bit of labelling (#228)
* match func_80058D5C

* minor cosmetic tweak

* what is to crush the spirit of somebody but to discover more unions

* dont mind me just switching computers

* remove a tempstruct

* temp thing

* match func_80054110

* Delete func_80054110.s

* racer.c cleanup

* Update math_util.h

* Update racer.c

* added CLAMP and WRAP macros

* Update math_util.h

* match func_80055A84

* he

* match func_80057A40

* we do a little labelling

* match update_camera_loop

* match update_camera_hovercraft

* Update structs.h

* pain.

* Update README.md

* Update racer.c

* like this?
2022-05-20 15:37:55 -04:00

30 lines
751 B
C

#ifndef MATH_UTIL_H
#define MATH_UTIL_H
#include "types.h"
#include "structs.h"
/**
* Keeps the value within the range.
*/
#define CLAMP(x, low, high) { \
if ((x) > (high)) (x) = (high); \
if ((x) < (low)) (x) = (low); \
}
/**
* Allows an arbitrary range the number can wrap around.
* Often used for angles, to keep them within s16 bounds while stored in an s32.
*/
#define WRAP(x, low, high) { \
if ((x) > (high)) (x) -= ((high) * 2) - 1; \
if ((x) < (low)) (x) += ((high) * 2) - 1; \
}
s16 arctan2_f(f32 y, f32 x);
f32 sine_s(s16 angle);
f32 cosine_s(s16 angle);
void func_80031130(s32, f32*, f32*, s32);
s32 func_80031600(f32*, f32*, s32*, s8*, s32, s32*);
#endif // MATH_UTIL_H