diff options
| author | petrie911 <69443847+petrie911@users.noreply.github.com> | 2020-12-26 04:44:53 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-26 05:44:53 -0500 |
| commit | 8fa6cb6ff927496403f950fc86146d6aabe9773f (patch) | |
| tree | 6b302cf5354f3ef31304a77cd42a6a8782ac363f /src/code/sys_math.c | |
| parent | 81c269b417ad31954b4d7efdd114e02201c02334 (diff) | |
Consistent naming for Math_ functions (#542)
* Darkmeiro decompilation
Bg_Gnd_Darkmeiro decompiled, matched, and documented.
* give this a shot
* fix conflict
* one more try
* could be useful
* whoops
* ZAP2 stuff
* ZAP why
* ZAP again
* maths
* Factoriali -> Factorial
* soon, soon
* renames
* rand
* docs
* merged
* formatting
* little more cleanup
* asm crept back in
* changes to MathF
* smooth criminal
* functions.h
Diffstat (limited to 'src/code/sys_math.c')
| -rw-r--r-- | src/code/sys_math.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/code/sys_math.c b/src/code/sys_math.c index 87a1eacd8..c72d8cbee 100644 --- a/src/code/sys_math.c +++ b/src/code/sys_math.c @@ -3,42 +3,45 @@ f32 sFactorialTbl[] = { 1.0f, 1.0f, 2.0f, 6.0f, 24.0f, 120.0f, 720.0f, 5040.0f, 40320.0f, 362880.0f, 3628800.0f, 39916800.0f, 479001600.0f }; -f32 func_800CA540(f32 arg0) { +f32 Math_FactorialF(f32 n) { f32 ret = 1.0f; s32 i; - for (i = arg0; i > 1; i--) { + + for (i = n; i > 1; i--) { ret *= i; } return ret; } -f32 func_800CA63C(u32 arg0) { +f32 Math_Factorial(s32 n) { f32 ret; s32 i; - if (arg0 > 12) { + + if (n > 12U) { ret = sFactorialTbl[12]; - for (i = 13; i <= (s32)arg0; i++) { + for (i = 13; i <= n; i++) { ret *= i; } } else { - ret = sFactorialTbl[arg0]; + ret = sFactorialTbl[n]; } return ret; } -f32 func_800CA6FC(f32 arg0, s32 arg1) { +f32 Math_PowF(f32 base, s32 exp) { f32 ret = 1.0f; - while (arg1 > 0) { - arg1--; - ret *= arg0; + + while (exp > 0) { + exp--; + ret *= base; } return ret; } -f32 func_800CA720(f32 arg0) { - return sins((s16)(arg0 * (32767.0f / M_PI))) * SHT_MINV; +f32 Math_SinF(f32 angle) { + return sins((s16)(angle * (32767.0f / M_PI))) * SHT_MINV; } -f32 func_800CA774(f32 arg0) { - return coss((s16)(arg0 * (32767.0f / M_PI))) * SHT_MINV; +f32 Math_CosF(f32 angle) { + return coss((s16)(angle * (32767.0f / M_PI))) * SHT_MINV; } |
