summaryrefslogtreecommitdiff
path: root/src/SSystem/SComponent/c_math.cpp
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2025-11-30 14:23:42 -0800
committerGitHub <noreply@github.com>2025-11-30 15:23:42 -0700
commita6e76c0841cae03cae0c0e6ac75c32f979043093 (patch)
tree76b5f590c59c6abdf2c80d0a3d5c0ccb31ebd0fe /src/SSystem/SComponent/c_math.cpp
parent434415337d268e405b09f6b72935a7e918e4cfe7 (diff)
project cleanup (#2895)
* some wii OS fixes * remove old dol2asm comments * remove dol2asm.h * remove function address comments * normalize ATTRIBUTE_ALIGN usage * DECL_WEAK macro * fix gcc attribute weak macro * wrap more mwcc specific things in ifdefs * fixes * fix revo sdk version flags * fixes
Diffstat (limited to 'src/SSystem/SComponent/c_math.cpp')
-rw-r--r--src/SSystem/SComponent/c_math.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/SSystem/SComponent/c_math.cpp b/src/SSystem/SComponent/c_math.cpp
index 983b47d705..38d6cbdff1 100644
--- a/src/SSystem/SComponent/c_math.cpp
+++ b/src/SSystem/SComponent/c_math.cpp
@@ -7,7 +7,6 @@
#include "SSystem/SComponent/c_m3d.h"
#include <cmath.h>
-/* 802675E4-80267640 261F24 005C+00 0/0 23/23 11/11 .text cM_rad2s__Ff */
s16 cM_rad2s(f32 rad) {
s32 s = (std::fmod(rad, 2 * M_PI) * (0x8000 / M_PI));
if (s < -0x8000) {
@@ -18,7 +17,6 @@ s16 cM_rad2s(f32 rad) {
return s;
}
-/* 803C3778-803C3F80 020898 0802+06 1/1 0/0 0/0 .data atntable */
static u16 atntable[1025] = {
0x0000, 0x000A, 0x0014, 0x001F, 0x0029, 0x0033, 0x003D, 0x0047, 0x0051, 0x005C, 0x0066, 0x0070,
0x007A, 0x0084, 0x008F, 0x0099, 0x00A3, 0x00AD, 0x00B7, 0x00C2, 0x00CC, 0x00D6, 0x00E0, 0x00EA,
@@ -108,13 +106,11 @@ static u16 atntable[1025] = {
0x1FEC, 0x1FF1, 0x1FF6, 0x1FFB, 0x2000,
};
-/* 80267640-80267674 261F80 0034+00 1/1 0/0 0/0 .text U_GetAtanTable__Fff */
u16 U_GetAtanTable(f32 f0, f32 f1) {
int idx = f0 / f1 * 0x400;
return atntable[idx];
}
-/* 80267674-80267814 261FB4 01A0+00 1/1 82/82 822/822 .text cM_atan2s__Fff */
s16 cM_atan2s(f32 y, f32 x) {
u32 ret;
if (cM3d_IsZero(y)) {
@@ -159,30 +155,24 @@ s16 cM_atan2s(f32 y, f32 x) {
return ret;
}
-/* 80267814-8026785C 262154 0048+00 0/0 4/4 5/5 .text cM_atan2f__Fff */
f32 cM_atan2f(f32 y, f32 x) {
f32 atanS = cM_atan2s(y, x);
f32 ret = ((2 * M_PI) / 0x10000) * atanS;
return ret;
}
-/* 80451168-8045116C 000668 0004+00 2/2 0/0 0/0 .sbss r0 */
static s32 r0;
-/* 8045116C-80451170 00066C 0004+00 2/2 0/0 0/0 .sbss r1 */
static s32 r1;
-/* 80451170-80451174 000670 0004+00 2/2 0/0 0/0 .sbss r2 */
static s32 r2;
-/* 8026785C-8026786C 26219C 0010+00 0/0 1/1 0/0 .text cM_initRnd__Fiii */
void cM_initRnd(int s0, int s1, int s2) {
r0 = s0;
r1 = s1;
r2 = s2;
}
-/* 8026786C-80267954 2621AC 00E8+00 2/2 15/15 113/113 .text cM_rnd__Fv */
/**
* Gets a random value
* @return a random value
@@ -196,7 +186,6 @@ f32 cM_rnd() {
return fabsf(fmodf(var_f31, 1.0));
}
-/* 80267954-8026798C 262294 0038+00 0/0 34/34 951/951 .text cM_rndF__Ff */
/**
* Gets a random value between 0 and a given upper bound
* @param max The upper bound the random value can be
@@ -206,7 +195,6 @@ f32 cM_rndF(f32 max) {
return cM_rnd() * max;
}
-/* 8026798C-802679D4 2622CC 0048+00 0/0 24/24 450/450 .text cM_rndFX__Ff */
/**
* Gets a random value between given bounds
* @param max The upper and lower bound the random value can be
@@ -216,24 +204,18 @@ f32 cM_rndFX(f32 max) {
return max * (cM_rnd() - 0.5f) * 2.0f;
}
-/* ############################################################################################## */
-/* 80451174-80451178 000674 0004+00 2/2 0/0 0/0 .sbss r02 */
static s32 r02;
-/* 80451178-8045117C 000678 0004+00 2/2 0/0 0/0 .sbss r12 */
static s32 r12;
-/* 8045117C-80451180 00067C 0004+00 2/2 0/0 0/0 .sbss r22 */
static s32 r22;
-/* 802679D4-802679E4 262314 0010+00 0/0 0/0 8/8 .text cM_initRnd2__Fiii */
void cM_initRnd2(int s0, int s1, int s2) {
r02 = s0;
r12 = s1;
r22 = s2;
}
-/* 802679E4-80267ACC 262324 00E8+00 2/2 0/0 0/0 .text cM_rnd2__Fv */
f32 cM_rnd2() {
r02 = (r02 * 171) % 30269;
r12 = (r12 * 172) % 30307;
@@ -243,12 +225,10 @@ f32 cM_rnd2() {
return fabsf(fmodf(var_f31, 1.0));
}
-/* 80267ACC-80267B04 26240C 0038+00 0/0 0/0 14/14 .text cM_rndF2__Ff */
f32 cM_rndF2(f32 max) {
return cM_rnd2() * max;
}
-/* 80267B04-80267B4C 262444 0048+00 0/0 0/0 7/7 .text cM_rndFX2__Ff */
f32 cM_rndFX2(f32 max) {
return max * (cM_rnd2() - 0.5f) * 2.0f;
}