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_atan.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_atan.c')
| -rw-r--r-- | src/code/sys_math_atan.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/code/sys_math_atan.c b/src/code/sys_math_atan.c index b468818c8..d2f1b3467 100644 --- a/src/code/sys_math_atan.c +++ b/src/code/sys_math_atan.c @@ -1,6 +1,6 @@ #include "global.h" -u16 sATan2Tbl[] = { +static u16 sATan2Tbl[] = { 0x0000, 0x000A, 0x0014, 0x001F, 0x0029, 0x0033, 0x003D, 0x0047, 0x0051, 0x005C, 0x0066, 0x0070, 0x007A, 0x0084, 0x008F, 0x0099, 0x00A3, 0x00AD, 0x00B7, 0x00C2, 0x00CC, 0x00D6, 0x00E0, 0x00EA, 0x00F4, 0x00FF, 0x0109, 0x0113, 0x011D, 0x0127, 0x0131, 0x013C, 0x0146, 0x0150, 0x015A, 0x0164, 0x016F, 0x0179, 0x0183, 0x018D, 0x0197, 0x01A1, @@ -77,7 +77,7 @@ u16 sATan2Tbl[] = { 0x1FF6, 0x1FFB, 0x2000, }; -u16 GetAtan2Tbl(f32 x, f32 y) { +u16 Math_GetAtan2Tbl(f32 x, f32 y) { s32 tblIdx; u16 ret; @@ -93,41 +93,41 @@ u16 GetAtan2Tbl(f32 x, f32 y) { return ret; } -s16 atan2s(f32 x, f32 y) { +s16 Math_Atan2S(f32 x, f32 y) { s32 ret; if (y >= 0.0f) { if (x >= 0.0f) { if (y <= x) { - ret = GetAtan2Tbl(y, x); + ret = Math_GetAtan2Tbl(y, x); } else { - ret = 0x4000 - GetAtan2Tbl(x, y); + ret = 0x4000 - Math_GetAtan2Tbl(x, y); } } else { if (-x < y) { - ret = GetAtan2Tbl(-x, y) + 0x4000; + ret = Math_GetAtan2Tbl(-x, y) + 0x4000; } else { - ret = 0x8000 - GetAtan2Tbl(y, -x); + ret = 0x8000 - Math_GetAtan2Tbl(y, -x); } } } else { if (x < 0.0f) { if (-y <= -x) { - ret = GetAtan2Tbl(-y, -x) + 0x8000; + ret = Math_GetAtan2Tbl(-y, -x) + 0x8000; } else { - ret = 0xC000 - GetAtan2Tbl(-x, -y); + ret = 0xC000 - Math_GetAtan2Tbl(-x, -y); } } else { if (x < -y) { - ret = GetAtan2Tbl(x, -y) + 0xC000; + ret = Math_GetAtan2Tbl(x, -y) + 0xC000; } else { - ret = -GetAtan2Tbl(-y, x); + ret = -Math_GetAtan2Tbl(-y, x); } } } return ret; } -f32 atan2f(f32 x, f32 y) { - return atan2s(x, y) * (M_PI / 32768.0f); +f32 Math_Atan2F(f32 x, f32 y) { + return Math_Atan2S(x, y) * (M_PI / 32768.0f); } |
