Files
Diddy-Kong-Racing/include/math_util.h
T
FazanaandGitHub 8468119587 Few extra racer.c matches (#238)
* Squashed commit of the following:

commit 3ab4716110
Author: Fazana <52551480+FazanaJ@users.noreply.github.com>
Date:   Mon May 23 23:11:46 2022 +0100

    Mostly misc labelling, but also weather too (#232)

    * bit more labelling

    * identify some weather stuff

    * Update sound_ids.h

    * yum

    * more random identification

    * last weather stuff for now

    * Update README.md

    * Update README.md

    * Fix non equivalent

* I found the 60fps button

* match func_80052B64

* match racer_attack_handler

* match func_80048C7C

* buncha function declaring

* e

* tweak

* match func_8004DE38

oh man oh man

* Small bit of labelling

* Merge remote-tracking branch 'upstream/master' into the-many-against-the-few

* Update README.md

* Fix monumentally poor bout of misinformation in the readme

we wouldn't want to mislead the readers, would we?

* github please

* Update README.md

* requested changes

kinda funny because I knew this struct existed, and knew it was used for this, but never made the connection lol

* Update objects.c

* match racer_enter_door

A nice easy one after the pure hellscape of the last few days :)

* names

* renames

* match func_8005250C

* heehee

* Update racer.c

* identify some misc asset calls

* identify some surface types

* match func_8005492C

* Delete func_8005492C.s

* match func_80052D7C

* move some enums

* label all existing misc asset calls

granted I know what almost none of them are lmao, buut will make things slightly easier in the long run

* Update README.md

* requested changes

pain

* Update README.md
2022-08-08 11:08:08 -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*, s32*, s8* surface, s32, s32*);
#endif // MATH_UTIL_H