Files
Diddy-Kong-Racing/include/math_util.h
T
37e2fecf7e Split out functions in unknown_070110, and do some documenting on the… (#243)
* Split out functions in unknown_070110, and do some documenting on them. Also fixes the scoring script to include UNUSED funcs

* Match func_80021400

* Match unused func_800B3678

* Commit suggestions

* Match func_80009AB4

* Fix breaking NON_EQUIVALENT builds when I changed the LevelHeader struct

* I swear I fixed this before the last push, but oh well. Here's the proper fix

* Match func_80007FA4

* Add suggestions for PR, and do a NON_EQUIVALENT but near match of func_8005F310

* Add offsets to the sound_ids, and set them up in some arrays that are a list of sounds to play.

* Update a few variables to floats to match func_800699E4

* Fix NON_EQUIVALENT

* Nearly match func_80011134

* Match func_8001B668 and do some more documenting

* Match func_80069A40

* Do a NON_EQUIVALENT, possible NON_MATHCING match of func_8005CB680

* Do NON_MATCHING of func_8005C364 +  update diff.py

* WIP func_8005A6F0

* Remove unk8004F77C struct as it's just Object_Racer

* Match func_8005A6F0

* Match func_8002263C

* WIP func_8005B818

* WIP func_80011570 and match catmull_rom_interpolation

* Match func_80011570

* Remove some extra function declarations from C files, and used the .h files instead.

* Better matches for the catmull math funcs

* Get obj_loop_effectbox a little closer to matching

* Match obj_loop_goldenballoon

* Fix some minor whitespace issues.

Co-authored-by: Ryan Myers <foldor@gmail.com>
2022-09-20 09:42:30 -04:00

30 lines
759 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*, f32*, s8* surface, s32, s32*);
#endif // MATH_UTIL_H