import random_u16 to sm64, match random_s32, and match actor func (#203)

* import random_u16 and atans from sm64

* rand math decomp

* Match func_80298AC0
This commit is contained in:
MegaMech
2022-05-19 02:39:18 -06:00
committed by GitHub
parent 63c4f48340
commit bcf65f3883
112 changed files with 6847 additions and 7413 deletions
+30 -30
View File
@@ -10183,7 +10183,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80015314.s")
? func_8001D794(Player *, void *, f32 *, f32 *, f32 *, f32 *, s32); // extern
? func_800224F0(void *, s16, s16); // extern
? func_802ADDC8(void *, ?, f32, f32, f32); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
void func_80015390(void *arg0, ? arg1, ? arg2) {
f32 sp94;
@@ -10226,8 +10226,8 @@ void func_80015390(void *arg0, ? arg1, ? arg2) {
sp94 = temp_f12;
temp_f14 = arg0->unk14 - arg0->unk8;
sp8C = temp_f14;
arg0->unk26 = func_802B7830(temp_f12, temp_f14);
arg0->unk24 = func_802B7830(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
arg0->unk26 = atan2s(temp_f12, temp_f14);
arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
arg0->unk28 = 0;
}
#else
@@ -10313,7 +10313,7 @@ s32 func_80007BF8(s32, s32, ?, ?, s32); // extern
s16 func_8000D33C(f32, f32, u16, f32, s16, s32); // extern
? func_80014D30(s32, s32); // extern
? func_8001A348(s32, s32, s16); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
extern f64 D_800ED220;
extern f64 D_800ED228;
extern ? D_80163068;
@@ -10408,8 +10408,8 @@ block_10:
sp84 = temp_f12;
temp_f14 = arg0->unk14 - arg0->unk8;
sp7C = temp_f14;
arg0->unk26 = func_802B7830(temp_f12, temp_f14);
arg0->unk24 = func_802B7830(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
arg0->unk26 = atan2s(temp_f12, temp_f14);
arg0->unk24 = atan2s(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
arg0->unk28 = 0;
}
#else
@@ -10486,7 +10486,7 @@ s32 func_80007BF8(s32, s32, ?, ?, s32); // extern
s16 func_8000D33C(f32, f32, s16 *, f32, s16, s32); // extern
? func_80014D30(s32, s32); // extern
? func_8001A348(s32, s32, s16, s32 *, s32 *); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
extern f64 D_800ED230;
extern ? D_80162FA0;
extern ? D_80163068;
@@ -10669,8 +10669,8 @@ block_8:
spA8 = arg0->unk10 - arg0->unk4;
temp_f14_2 = arg0->unk14 - arg0->unk8;
spA4 = temp_f14_2;
arg0->unk26 = func_802B7830(temp_f20_2, temp_f14_2);
arg0->unk24 = func_802B7830(sqrtf((temp_f20_2 * temp_f20_2) + (temp_f14_2 * temp_f14_2)), spA8);
arg0->unk26 = atan2s(temp_f20_2, temp_f14_2);
arg0->unk24 = atan2s(sqrtf((temp_f20_2 * temp_f20_2) + (temp_f14_2 * temp_f14_2)), spA8);
arg0->unk28 = 0;
}
#else
@@ -10745,7 +10745,7 @@ s16 func_8000D33C(f32, f32, s32, f32, s16, s32); /* extern */
? func_80014D30(s32, s32); /* extern */
? func_8001A348(s32, f32, s16, ?, ?); /* extern */
f32 func_802AE1C0(f32, f32, f32, f32 *); /* extern */
s16 func_802B7830(f32, f32); /* extern */
s16 atan2s(f32, f32); /* extern */
f32 sqrtf(f32, f32, s32); /* extern */
extern ? D_80162FA0;
extern ? D_80163068;
@@ -10976,8 +10976,8 @@ void func_80016494(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
spAC = temp_f12_2;
temp_f14_2 = arg0->unk14 - arg0->unk8;
spA4 = temp_f14_2;
arg0->unk26 = func_802B7830(temp_f12_2, temp_f14_2);
arg0->unk24 = func_802B7830(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2), temp_f14_2), spA8);
arg0->unk26 = atan2s(temp_f12_2, temp_f14_2);
arg0->unk24 = atan2s(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2), temp_f14_2), spA8);
arg0->unk28 = 0;
}
#else
@@ -11095,7 +11095,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80016C3C.s")
? func_8000BBD8(u16, s32, s16, s16); // extern
s16 func_8000D33C(f32, f32, s32 *, s32 *, s16, s32); // extern
? func_80014D30(s32, s32, f32 *); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
extern f64 D_800ED270;
extern f64 D_800ED278;
extern ? D_80162FA0;
@@ -11263,8 +11263,8 @@ void func_80017054(void *arg0, ? arg1, ? arg2, s32 arg3) {
spAC = temp_f12;
temp_f14_2 = arg0->unk14 - (bitwise f32) arg0->unk8;
spA4 = temp_f14_2;
arg0->unk26 = func_802B7830(temp_f12, temp_f14_2);
arg0->unk24 = func_802B7830(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2)), spA8);
arg0->unk26 = atan2s(temp_f12, temp_f14_2);
arg0->unk24 = atan2s(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2)), spA8);
arg0->unk28 = 0;
}
#else
@@ -11341,7 +11341,7 @@ s32 func_80007BF8(s32, s32, ?, ?, s32); /* extern */
s16 func_8000D33C(f32, f32, f32 *, f32, s16, s32); /* extern */
? func_80014D30(s32, s32, f32 *, f32 *); /* extern */
? func_8001A348(s32, f32, s16); /* extern */
s16 func_802B7830(f32, f32); /* extern */
s16 atan2s(f32, f32); /* extern */
f32 sqrtf(f32, f32, f32 *, f32 *); /* extern */
extern ? D_80162FA0;
extern ? D_80163068;
@@ -11517,8 +11517,8 @@ void func_800178F4(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
sp94 = temp_f12;
temp_f14_3 = arg0->unk14 - arg0->unk8;
sp8C = temp_f14_3;
arg0->unk26 = func_802B7830(temp_f12, temp_f14_3);
arg0->unk24 = func_802B7830(sqrtf((sp94 * sp94) + (temp_f14_3 * temp_f14_3), temp_f14_3), sp90);
arg0->unk26 = atan2s(temp_f12, temp_f14_3);
arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14_3 * temp_f14_3), temp_f14_3), sp90);
arg0->unk28 = 0;
}
#else
@@ -11597,7 +11597,7 @@ s32 func_80007BF8(s32, s32, ?, ?, s32); /* extern */
s16 func_8000D33C(f32, f32, f32 *, f32, s16, s32); /* extern */
? func_80014D30(s32, s32, f32 *, f32 *); /* extern */
? func_8001A348(s32, f32, s16); /* extern */
s16 func_802B7830(f32, f32); /* extern */
s16 atan2s(f32, f32); /* extern */
f32 sqrtf(f32, f32, f32 *, f32 *); /* extern */
extern ? D_80162FA0;
extern ? D_80163068;
@@ -11778,8 +11778,8 @@ void func_800180F0(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
sp94 = temp_f12;
temp_f14_3 = arg0->unk14 - arg0->unk8;
sp8C = temp_f14_3;
arg0->unk26 = func_802B7830(temp_f12, temp_f14_3);
arg0->unk24 = func_802B7830(sqrtf((sp94 * sp94) + (temp_f14_3 * temp_f14_3), temp_f14_3), sp90);
arg0->unk26 = atan2s(temp_f12, temp_f14_3);
arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14_3 * temp_f14_3), temp_f14_3), sp90);
arg0->unk28 = 0;
}
#else
@@ -11857,7 +11857,7 @@ s32 func_80007BF8(s32, s32, ?, ?, s32); // extern
s16 func_8000D33C(f32, f32, s16, f32, s32, s32); // extern
? func_80014D30(s32, s32); // extern
? func_8001A348(s32, f32, s16); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
extern f64 D_800ED2A8;
extern f64 D_800ED2B0;
extern f64 D_800ED2B8;
@@ -12111,8 +12111,8 @@ void func_800188F4(void *arg0, ? arg1, ? arg2, s32 arg3) {
spAC = temp_f12_2;
temp_f14_2 = arg0->unk14 - arg0->unk8;
spA4 = temp_f14_2;
arg0->unk26 = func_802B7830(temp_f12_2, temp_f14_2);
arg0->unk24 = func_802B7830(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2)), spA8);
arg0->unk26 = atan2s(temp_f12_2, temp_f14_2);
arg0->unk24 = atan2s(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2)), spA8);
arg0->unk28 = 0;
}
#else
@@ -12199,7 +12199,7 @@ s32 func_80007BF8(s32, s32, ?, ?, s32); // extern
s16 func_8000D33C(f32, f32, u16, f32, s16, s32); // extern
? func_80014D30(s32, s32); // extern
? func_8001A348(s32, s32, s16); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
extern f64 D_800ED318;
extern f64 D_800ED320;
extern ? D_80163068;
@@ -12293,8 +12293,8 @@ block_8:
sp8C = temp_f12;
temp_f14 = arg0->unk14 - arg0->unk8;
sp84 = temp_f14;
arg0->unk26 = func_802B7830(temp_f12, temp_f14);
arg0->unk24 = func_802B7830(sqrtf((sp8C * sp8C) + (temp_f14 * temp_f14)), sp88);
arg0->unk26 = atan2s(temp_f12, temp_f14);
arg0->unk24 = atan2s(sqrtf((sp8C * sp8C) + (temp_f14 * temp_f14)), sp88);
arg0->unk28 = 0;
}
#else
@@ -12346,7 +12346,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001969C.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_80014D30(s32, ?); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
@@ -12375,8 +12375,8 @@ void func_80019760(void *arg0, ? arg1, ? arg2, s32 arg3) {
sp2C = temp_f12;
temp_f14 = arg0->unk14 - arg0->unk8;
sp24 = temp_f14;
arg0->unk26 = func_802B7830(temp_f12, temp_f14);
arg0->unk24 = func_802B7830(sqrtf((sp2C * sp2C) + (temp_f14 * temp_f14)), sp28);
arg0->unk26 = atan2s(temp_f12, temp_f14);
arg0->unk24 = atan2s(sqrtf((sp2C * sp2C) + (temp_f14 * temp_f14)), sp28);
arg0->unk28 = 0;
}
#else
+15 -15
View File
@@ -1,15 +1,15 @@
#ifndef CODE_80005FD0_H
#define CODE_80005FD0_H
#include "common_structs.h"
/* Function Prototypes */
s16 func_80005FD0();
// math_util.c
u32 func_802B5224();
/* This is where I'd put my static data, if I had any */
#endif
#ifndef CODE_80005FD0_H
#define CODE_80005FD0_H
#include "common_structs.h"
/* Function Prototypes */
s16 func_80005FD0();
// math_util.c
u32 func_802B5224();
/* This is where I'd put my static data, if I had any */
#endif
+12 -12
View File
@@ -892,7 +892,7 @@ GLOBAL_ASM("asm/non_matchings/code_8001C4D0/func_8001D944.s")
? func_8001CA78(void *, void *, f32 *, f32 *, f32 *, f32 *, s32, s32); // extern
? func_800224F0(s32, s16, s16, void *); // extern
s16 func_802ADDC8(void *, f32, f32, f32, f32); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
void func_8001E0C4(void *arg0, void *arg1, s8 arg2) {
f32 sp84;
@@ -960,8 +960,8 @@ void func_8001E0C4(void *arg0, void *arg1, s8 arg2) {
sp84 = temp_f12;
temp_f14 = arg0->unk14 - arg0->unk8;
sp7C = temp_f14;
arg0->unk26 = func_802B7830(temp_f12, temp_f14);
arg0->unk24 = func_802B7830(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
arg0->unk26 = atan2s(temp_f12, temp_f14);
arg0->unk24 = atan2s(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
arg0->unk28 = 0;
}
#else
@@ -974,7 +974,7 @@ GLOBAL_ASM("asm/non_matchings/code_8001C4D0/func_8001E0C4.s")
? func_800224F0(void *, s16, s16, s16); // extern
? move_s16_towards(void *, ?, ?, s16); // extern
? func_802ADDC8(void *, f32, f32, f32, f32); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
void func_8001E45C(void *arg0, void *arg1, s8 arg2) {
f32 sp94;
@@ -1068,8 +1068,8 @@ block_26:
sp94 = temp_f12;
temp_f14 = arg0->unk14 - arg0->unk8;
sp8C = temp_f14;
arg0->unk26 = func_802B7830(temp_f12, temp_f14);
arg0->unk24 = func_802B7830(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
arg0->unk26 = atan2s(temp_f12, temp_f14);
arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
arg0->unk28 = 0;
}
#else
@@ -1080,7 +1080,7 @@ GLOBAL_ASM("asm/non_matchings/code_8001C4D0/func_8001E45C.s")
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_8001D53C(void *, void *, f32 *, f32 *, f32 *, f32 *, s32, s32); // extern
? func_802ADDC8(void *, ?, f32, f32, f32); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
void func_8001E8E8(void *arg0, void *arg1, s8 arg2) {
f32 sp8C;
@@ -1108,8 +1108,8 @@ void func_8001E8E8(void *arg0, void *arg1, s8 arg2) {
sp8C = temp_f12;
temp_f14 = arg0->unk14 - arg0->unk8;
sp84 = temp_f14;
arg0->unk26 = func_802B7830(temp_f12, temp_f14);
arg0->unk24 = func_802B7830(sqrtf((sp8C * sp8C) + (temp_f14 * temp_f14)), sp88);
arg0->unk26 = atan2s(temp_f12, temp_f14);
arg0->unk24 = atan2s(sqrtf((sp8C * sp8C) + (temp_f14 * temp_f14)), sp88);
arg0->unk28 = 0;
}
#else
@@ -1122,7 +1122,7 @@ GLOBAL_ASM("asm/non_matchings/code_8001C4D0/func_8001E8E8.s")
? func_800224F0(void *, s16, s16, s16); // extern
? move_s16_towards(void *, ?, ?, s16); // extern
? func_802ADDC8(void *, f32, f32, f32, f32); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
void func_8001EA0C(void *arg0, void *arg1, s8 arg2) {
f32 sp94;
@@ -1216,8 +1216,8 @@ block_26:
sp94 = temp_f12;
temp_f14 = arg0->unk14 - arg0->unk8;
sp8C = temp_f14;
arg0->unk26 = func_802B7830(temp_f12, temp_f14);
arg0->unk24 = func_802B7830(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
arg0->unk26 = atan2s(temp_f12, temp_f14);
arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
arg0->unk28 = 0;
}
#else
+7 -7
View File
@@ -837,7 +837,7 @@ void func_80029200(Player *player, s8 arg1) {
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? move_s16_towards(void *, s16, ?, void *); // extern
? func_80029200(Player *, s8); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
s32 func_802B7C40(f32, s32); // extern
f32 sins(s32); // extern
f32 coss(s32); // extern
@@ -899,7 +899,7 @@ void func_8002934C(Player *player, s32 arg1, s8 arg2, s8 arg3) {
temp_t7 = arg2 * 2;
temp_a3 = player + temp_t7;
temp_a3->unk48 = func_802B7830(player->posX - arg1->unk0, player->posZ - arg1->unk8);
temp_a3->unk48 = atan2s(player->posX - arg1->unk0, player->posZ - arg1->unk8);
player->unk_244[arg2] = ((player->unk_02E + temp_a3->unk48 + player->unk_0C0) & 0xFFFF) / 0x80;
temp_f6 = player->unk_224;
temp_v1 = player->unk_0BC;
@@ -1671,7 +1671,7 @@ UNUSED void func_8002AE30(void) {
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
u16 func_802B7830(f32, f32, s16, void *); // extern
u16 atan2s(f32, f32, s16, void *); // extern
f32 sins(s32, void *); // extern
f32 coss(s32); // extern
@@ -1729,14 +1729,14 @@ void func_8002AE38(void *arg0, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5)
sp2E = temp_v0_3;
arg0 = temp_a2_2;
sp24 = temp_f16;
sp1A = func_802B7830(arg2 - arg4, arg3 - arg5, temp_v0_3, temp_a2_2);
arg0->unkC0 = sp1A - func_802B7830(arg2 - sp28, arg3 - temp_f16);
sp1A = atan2s(arg2 - arg4, arg3 - arg5, temp_v0_3, temp_a2_2);
arg0->unkC0 = sp1A - atan2s(arg2 - sp28, arg3 - temp_f16);
} else {
sp2E = temp_v0_3;
arg0 = temp_a2_2;
sp24 = temp_f16;
sp1A = func_802B7830(arg2 - arg4, arg3 - arg5, temp_v0_3, temp_a2_2);
arg0->unkC0 = (sp1A - func_802B7830(arg2 - sp28, arg3 - temp_f16)) * 2;
sp1A = atan2s(arg2 - arg4, arg3 - arg5, temp_v0_3, temp_a2_2);
arg0->unkC0 = (sp1A - atan2s(arg2 - sp28, arg3 - temp_f16)) * 2;
}
phi_a2 = arg0;
if (((arg0->unkBC & 0x10) != 0x10) && (((temp_t9 = arg0->unk7C >> 0x10, (temp_t9 > 0)) && (arg0->unkC0 < 0)) || ((temp_t9 < 0) && (arg0->unkC0 > 0)))) {
+6 -6
View File
@@ -377,15 +377,15 @@ GLOBAL_ASM("asm/non_matchings/code_80040E50/func_80041608.s")
#endif
s32 func_80041658(f32 arg0, f32 arg1) {
return -func_802B7830(arg0, arg1) & 0xFFFF;
return -atan2s(arg0, arg1) & 0xFFFF;
}
UNUSED s32 func_80041680(f32 arg0, f32 arg1) {
return func_802B7830(arg1, arg0);
return atan2s(arg1, arg0);
}
UNUSED s32 func_800416AC(f32 arg0, f32 arg1) {
return func_802B7830(arg1, arg0);
return atan2s(arg1, arg0);
}
f32 func_800416D8(f32 arg0, f32 arg1, u16 arg2) {
@@ -403,7 +403,7 @@ f32 func_80041724(f32 arg0, f32 arg1, u16 arg2) {
}
s32 func_80041770(f32 arg0, f32 arg1, f32 arg2, f32 arg3) {
return func_802B7830(arg1 - arg0, arg3 - arg2);
return atan2s(arg1 - arg0, arg3 - arg2);
}
#ifdef MIPS_TO_C
@@ -442,11 +442,11 @@ GLOBAL_ASM("asm/non_matchings/code_80040E50/func_800417B4.s")
#endif
s32 func_800418AC(f32 arg0, f32 arg1, Vec3f arg2) {
return func_802B7830(arg0 - arg2[0], arg1 - arg2[2]);
return atan2s(arg0 - arg2[0], arg1 - arg2[2]);
}
s32 func_800418E8(f32 arg0, f32 arg1, Vec3f arg2) {
return func_802B7830(arg0 - arg2[1], arg1 - arg2[2]);
return atan2s(arg0 - arg2[1], arg1 - arg2[2]);
}
#ifdef MIPS_TO_C
+6 -6
View File
@@ -6517,7 +6517,7 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007C360.s")
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
u16 func_800417B4(u16, s32); // extern
? func_8007C360(s32, s32); // extern
s32 func_802B7830(f32, f32); // extern
s32 atan2s(f32, f32); // extern
extern ? D_80165C18;
void func_8007C420(s32 arg0, void *arg1, s32 arg2) {
@@ -6526,7 +6526,7 @@ void func_8007C420(s32 arg0, void *arg1, s32 arg2) {
temp_v1 = (arg0 * 0xE0) + &D_80165C18;
sp18 = temp_v1;
temp_v1->unkC0 = func_800417B4(temp_v1->unkC0, func_802B7830(arg1->unk14 - temp_v1->unk4, arg1->unk1C - temp_v1->unkC) & 0xFFFF);
temp_v1->unkC0 = func_800417B4(temp_v1->unkC0, atan2s(arg1->unk14 - temp_v1->unk4, arg1->unk1C - temp_v1->unkC) & 0xFFFF);
func_8007C360(arg0, arg2);
}
#else
@@ -6574,7 +6574,7 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007C4A4.s")
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
u16 func_800417B4(u16, s32); // extern
? func_8007C4A4(s32); // extern
s32 func_802B7830(f32, f32); // extern
s32 atan2s(f32, f32); // extern
extern ? D_80165C18;
void func_8007C550(s32 arg0) {
@@ -6583,7 +6583,7 @@ void func_8007C550(s32 arg0) {
temp_v1 = (arg0 * 0xE0) + &D_80165C18;
sp18 = temp_v1;
temp_v1->unkC0 = func_800417B4(temp_v1->unkC0, func_802B7830(temp_v1->unk38, temp_v1->unk40) & 0xFFFF);
temp_v1->unkC0 = func_800417B4(temp_v1->unkC0, atan2s(temp_v1->unk38, temp_v1->unk40) & 0xFFFF);
func_8007C4A4(arg0);
}
#else
@@ -6940,7 +6940,7 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007CC00.s")
? func_80073444(? *, ? *, ?, s32); // extern
? func_80073844(s32); // extern
? func_80086EF0(s32); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
extern ? D_06005C80;
extern ? D_0F0D0E50;
extern f32 D_800EEEB8;
@@ -6964,7 +6964,7 @@ void func_8007CE0C(s32 arg0) {
func_80086EF0(arg0);
temp_s0->unkC2 = 0x8000;
temp_v0 = D_8018CF1C;
temp_s0->unkC0 = func_802B7830(temp_v0->unk14 - temp_s0->unk10, temp_v0->unk1C - temp_s0->unk18);
temp_s0->unkC0 = atan2s(temp_v0->unk14 - temp_s0->unk10, temp_v0->unk1C - temp_s0->unk18);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007CE0C.s")
+18 -18
View File
@@ -222,14 +222,14 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800871AC.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_802B7830(f32, f32); // extern
? atan2s(f32, f32); // extern
extern ? D_80165C18;
void func_800872D8(s32 arg0, void *arg1) {
void *temp_v0;
temp_v0 = (arg0 * 0xE0) + &D_80165C18;
func_802B7830(temp_v0->unk4 - arg1->unk0, temp_v0->unkC - arg1->unk8);
atan2s(temp_v0->unk4 - arg1->unk0, temp_v0->unkC - arg1->unk8);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800872D8.s")
@@ -237,14 +237,14 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800872D8.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_802B7830(f32, f32); // extern
s32 atan2s(f32, f32); // extern
extern ? D_80165C18;
s32 func_80087324(s32 arg0) {
void *temp_v0;
temp_v0 = (arg0 * 0xE0) + &D_80165C18;
return -func_802B7830(temp_v0->unk3C, temp_v0->unk40) & 0xFFFF;
return -atan2s(temp_v0->unk3C, temp_v0->unk40) & 0xFFFF;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087324.s")
@@ -252,14 +252,14 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087324.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_802B7830(f32, f32); // extern
? atan2s(f32, f32); // extern
extern ? D_80165C18;
void func_80087368(s32 arg0) {
void *temp_v0;
temp_v0 = (arg0 * 0xE0) + &D_80165C18;
func_802B7830(temp_v0->unk38, temp_v0->unk40);
atan2s(temp_v0->unk38, temp_v0->unk40);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087368.s")
@@ -509,7 +509,7 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087954.s")
s32 func_80072270(?); // extern
? func_8008751C(s32); // extern
? func_8008775C(s32); // extern
s16 func_802B7830(f32, f32, s16); // extern
s16 atan2s(f32, f32, s16); // extern
extern ? D_80165C18;
s32 func_80087A0C(s32 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) {
@@ -534,7 +534,7 @@ s32 func_80087A0C(s32 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) {
sp36 = sqrtf((temp_v0 * temp_v0) + (temp_a0 * temp_a0));
temp_v1->unk14 = 0.0f;
sp20 = temp_v1;
temp_v1->unkC0 = func_802B7830(temp_v0, temp_a0, temp_a0);
temp_v1->unkC0 = atan2s(temp_v0, temp_a0, temp_a0);
func_8008751C(arg0);
temp_v1->unkB0 = sp36 / temp_v1->unk34;
}
@@ -792,7 +792,7 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088150.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_802B7830(f32, f32); // extern
s32 atan2s(f32, f32); // extern
extern ? D_80165760;
extern ? D_80165780;
extern ? D_80165C18;
@@ -804,7 +804,7 @@ void func_80088178(s32 arg0, s32 arg1) {
temp_v1 = (arg0 * 0xE0) + &D_80165C18;
temp_a0 = temp_v1->unkC0;
temp_a1 = func_802B7830(D_80165760.unk2 - D_80165760.unk0, D_80165780.unk2 - D_80165780.unk0) - temp_a0;
temp_a1 = atan2s(D_80165760.unk2 - D_80165760.unk0, D_80165780.unk2 - D_80165780.unk0) - temp_a0;
if (temp_a1 > 0) {
temp_v1->unkC0 = temp_a0 + (arg1 << 8);
return;
@@ -907,7 +907,7 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088364.s")
s32 func_8007223C(s32, ?); // extern
f32 func_802ABE30(?32, ?, ?32, u16); // extern
? func_802ADDC8(? *, ?, ?32, ?, ?32); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
extern ? D_80165C18;
extern ? D_8018C3B0;
@@ -925,8 +925,8 @@ s32 func_80088538(s32 arg0) {
func_800721C0(arg0, 0x800000);
}
temp_s0->unk44 = func_802ABE30(temp_s0->unk4, 0, temp_s0->unkC, D_8018C3B0.unkA);
temp_s0->unkB8 = func_802B7830(D_8018C3B0.unk38, D_8018C3B0.unk34) + 0x4000;
temp_s0->unkBC = func_802B7830(D_8018C3B0.unk30, D_8018C3B0.unk34);
temp_s0->unkB8 = atan2s(D_8018C3B0.unk38, D_8018C3B0.unk34) + 0x4000;
temp_s0->unkBC = atan2s(D_8018C3B0.unk30, D_8018C3B0.unk34);
}
return sp2C;
}
@@ -974,7 +974,7 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008861C.s")
? func_800721E8(s32, ?); // extern
f32 func_802ABE30(?32, ?, ?32, u16); // extern
? func_802ADDC8(? *, ?, ?32, ?, ?32); // extern
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
extern ? D_80165C18;
extern ? D_8018C3B0;
@@ -986,8 +986,8 @@ void func_800886F4(s32 arg0) {
if (D_8018C3B0.unk4 == 1) {
func_800721C0(arg0, 0x800000);
temp_s0->unk44 = func_802ABE30(temp_s0->unk4, 0, temp_s0->unkC, D_8018C3B0.unkA);
temp_s0->unkB8 = func_802B7830(D_8018C3B0.unk38, D_8018C3B0.unk34) + 0x4000;
temp_s0->unkBC = func_802B7830(D_8018C3B0.unk30, D_8018C3B0.unk34);
temp_s0->unkB8 = atan2s(D_8018C3B0.unk38, D_8018C3B0.unk34) + 0x4000;
temp_s0->unkBC = atan2s(D_8018C3B0.unk30, D_8018C3B0.unk34);
return;
}
func_800721E8(arg0, 0x800000);
@@ -1663,7 +1663,7 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A060.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_802B7830(f32, f32); // extern
s32 atan2s(f32, f32); // extern
extern ? D_80165C18;
s32 func_8008A0B4(s32 arg0, void *arg1, void *arg2, u16 arg3) {
@@ -1674,7 +1674,7 @@ s32 func_8008A0B4(s32 arg0, void *arg1, void *arg2, u16 arg3) {
temp_v0 = (arg0 * 0xE0) + &D_80165C18;
sp18 = 0;
temp_t3 = ((arg2->unk26 - func_802B7830(temp_v0->unk4 - arg1->unk14, temp_v0->unkC - arg1->unk1C)) + (arg3 >> 1)) & 0xFFFF;
temp_t3 = ((arg2->unk26 - atan2s(temp_v0->unk4 - arg1->unk14, temp_v0->unkC - arg1->unk1C)) + (arg3 >> 1)) & 0xFFFF;
phi_t0 = sp18;
if ((temp_t3 >= 0) && (arg3 >= temp_t3)) {
phi_t0 = 1;
+3 -3
View File
@@ -2473,7 +2473,7 @@ void func_800914A0(void) {
//be unused/unnamed
? func_800914A0(s16, s32, s16); /* extern */
? func_802ADDC8(void *, ?, f32, f32, f32); /* extern */
s16 func_802B7830(f32, f32); /* extern */
s16 atan2s(f32, f32); /* extern */
f32 sqrtf(f32, f32); /* extern */
extern void *gPlayerOneCopy;
extern u16 D_80152308;
@@ -2553,8 +2553,8 @@ block_5:
temp_f14 = *(&cameras + 0x14) - *(&cameras + 8);
sp34 = *(&cameras + 0x10) - *(&cameras + 4);
sp30 = temp_f14;
*(&cameras + 0x26) = func_802B7830(temp_f12, temp_f14);
*(&cameras + 0x24) = func_802B7830(sqrtf((sp38 * sp38) + (temp_f14 * temp_f14), temp_f14), sp34);
*(&cameras + 0x26) = atan2s(temp_f12, temp_f14);
*(&cameras + 0x24) = atan2s(sqrtf((sp38 * sp38) + (temp_f14 * temp_f14), temp_f14), sp34);
*(&cameras + 0x28) = 0;
}
#else
+3 -3
View File
@@ -24,7 +24,7 @@ extern u16 D_8015F588; // Number of entires in D_8015F580
extern u16 gIsInQuitToMenuTransition, gQuitToMenuTransitionCounter;
extern s32 D_802874A0;
extern u16 func_802B7830(f32, f32);
extern u16 atan2s(f32, f32);
extern u16 D_80164714, D_80164716, D_80164718;
extern u16 D_800DC5E4;
extern u32 D_800DC524;
@@ -103,8 +103,8 @@ void func_802802AC(void) {
temp_f12 = camera->unk - camera->pos[0];
temp = camera->unk1 - camera->pos[1];
temp_f14 = camera->unk2 - camera->pos[2];
camera->rotX[1] = func_802B7830(temp_f12, temp_f14);
camera->rotX[0] = func_802B7830(sqrtf((temp_f12 * temp_f12) + (temp_f14 * temp_f14)), temp);
camera->rotX[1] = atan2s(temp_f12, temp_f14);
camera->rotX[0] = atan2s(sqrtf((temp_f12 * temp_f12) + (temp_f14 * temp_f14)), temp);
camera->rotX[2] = 0;
if (D_802874A0 != 0) {
D_800DC5E4++;
+3 -3
View File
@@ -4,7 +4,7 @@
extern Camera cameras[];
extern u16 func_802B7830(f32, f32);
extern u16 atan2s(f32, f32);
void func_80281610(void) {
Camera *camera = &cameras[0];
@@ -18,8 +18,8 @@ void func_80281610(void) {
temp_f12 = camera->unk - camera->pos[0];
temp = camera->unk1 - camera->pos[1];
temp_f14 = camera->unk2 - camera->pos[2];
camera->rotX[1] = func_802B7830(temp_f12, temp_f14);
camera->rotX[0] = func_802B7830(sqrtf((temp_f12 * temp_f12) + (temp_f14 * temp_f14)), temp);
camera->rotX[1] = atan2s(temp_f12, temp_f14);
camera->rotX[0] = atan2s(sqrtf((temp_f12 * temp_f12) + (temp_f14 * temp_f14)), temp);
camera->rotX[2] = 0;
}
+3 -3
View File
@@ -193,7 +193,7 @@ void func_80282434(s32 arg0) {
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
void func_80282454(void *arg0, void *arg1, f32 *arg2, s16 *arg3, s16 *arg4) {
f32 sp2C;
@@ -218,8 +218,8 @@ void func_80282454(void *arg0, void *arg1, f32 *arg2, s16 *arg3, s16 *arg4) {
sp1C = temp_f16;
sp18 = temp_f18;
*arg2 = sqrtf(temp_f16 + (temp_f2 * temp_f2) + temp_f18);
*arg3 = func_802B7830(sp28, sqrtf(temp_f16 + temp_f18));
*arg4 = func_802B7830(sp2C, temp_f14);
*arg3 = atan2s(sp28, sqrtf(temp_f16 + temp_f18));
*arg4 = atan2s(sp2C, temp_f14);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80282454.s")
+25 -46
View File
@@ -516,7 +516,7 @@ void func_802976D8(Vec3s arg0) {
arg0[2] = 0;
}
s16 func_802B7830(f32, f32); // extern
s16 atan2s(f32, f32); // extern
void func_802976EC(UnkActorInner *arg0, Vec3s arg1) {
f32 x, y, z;
@@ -531,9 +531,9 @@ void func_802976EC(UnkActorInner *arg0, Vec3s arg1) {
y = arg0->unk60[1];
z = arg0->unk60[2];
arg1[0] = func_802B7830(z, y) + 0x4000;
arg1[0] = atan2s(z, y) + 0x4000;
arg1[1] = 0;
arg1[2] = func_802B7830(x, y);
arg1[2] = atan2s(x, y);
}
f32 func_802ABE30(f32, f32, f32, u16); // extern
@@ -1256,56 +1256,35 @@ block_17:
GLOBAL_ASM("asm/non_matchings/code_actors/func_802986B4.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd
? func_800C9060(s32, ?); /* extern */
? func_800C90F4(s32, s32); /* extern */
? func_800C98B8(f32 *, f32 *, ?); /* extern */
s32 func_8029EEB8(Player *, f32 *, ?, ?, f32); /* extern */
extern ? D_06013F78;
extern f32 gCourseDirection;
static f32 D_802B964C = 0.8f;
void func_800C9060(Player*, s32); /* extern */
void func_800C90F4(Player*, s32); /* extern */
s32 func_8029EEB8(Player*, Vec3f, f32, f32, f32); /* extern */
extern s8 D_06013F78[];
extern f32 D_802B964C; // 0.8f
//static f32 D_802B964C = 0.8f;
#ifdef RO_DATA // Needs D_802B964C imported to match
void func_80298AC0(Player *player) {
f32 sp6C;
f32 sp68;
f32 sp64;
f32 *temp_a1;
s16 *temp_s0;
s16 temp_v0;
s16 temp_v0_2;
s16 phi_v0;
s16 *phi_s0;
Vec3f sp64;
s32 segment = (((unsigned int)(D_06013F78)) >> 24);
s32 offset = ((unsigned int)(D_06013F78) & 0x00ffffff);
struct UnkActorSpawnData *data = (gSegmentTable[segment] + offset) - 0x80000000U;
temp_s0 = gSegmentTable[(u32) &D_06013F78 >> 0x18] + ((s32) &D_06013F78 & 0xFFFFFF) + 0x80000000;
temp_v0 = *temp_s0;
phi_v0 = temp_v0;
phi_s0 = temp_s0;
if (temp_v0 != -0x8000) {
loop_2:
temp_a1 = &sp64;
sp64 = (f32) phi_v0 * gCourseDirection;
sp68 = (f32) phi_s0->unk2;
sp6C = (f32) phi_s0->unk_04;
if (func_8029EEB8(player, temp_a1, 0x40A00000, 0x42200000, D_802B964C) == 1) {
while (data->pos[0] != -0x8000) {
sp64[0] = data->pos[0] * gCourseDirection;
sp64[1] = data->pos[1];
sp64[2] = data->pos[2];
if (func_8029EEB8(player, sp64, 5.0f, 40.0f, 0.8f) == 1) {
if ((player->unk_0BC & 0x200) != 0) {
func_800C98B8(player->pos, &player->unk_034, 0x19018010);
func_800C90F4(((s32) (player - gPlayerOne) / 3544) & 0xFF, (player->characterId * 0x10) + 0x2900800D);
phi_s0->unk6 = (s16) (phi_s0->unk6 | 0x400);
func_800C98B8(player->pos, player->unk_034, 0x19018010);
func_800C90F4((u8) (player - gPlayerOne), (player->characterId * 0x10) + 0x2900800D);
data->someId |= 0x400;
}
if ((player->unk_000 & 0x100) == 0) {
func_800C9060(((s32) (player - gPlayerOne) / 3544) & 0xFF, 0x19007018);
}
} else {
temp_v0_2 = phi_s0->unkA;
phi_v0 = temp_v0_2;
phi_s0 += 0xA;
if (temp_v0_2 == -0x8000) {
} else {
goto loop_2;
func_800C9060((u8) (player - gPlayerOne), 0x19007018);
}
return;
}
data++;
}
}
#else
+3 -1
View File
@@ -2,7 +2,9 @@
#include "config.h"
u8 D_802BA290[224];
u16 gRandomSeed16;
u8 randomSeedPadding[216];
u8 frameBufferPadding[22544];
+1 -1
View File
@@ -4,7 +4,7 @@
#include <PR/ultratypes.h>
#include "config.h"
extern u8 D_802BA290[22768];
extern u8 gRandomSeed16[22768];
extern u8 D_802BFB80[77824];
extern u8 D_802D2B80[32768];
extern u8 D_802DAB80[20480];
+94 -192
View File
@@ -3,11 +3,11 @@
#include <math_util.h>
#include <variables.h>
#include <main.h>
// Location based from sm64.
// This may need to be moved before framebuffers.c
// If math_util has data that does not line-up with trig_tables.
#include "trig_tables.inc.c"
#pragma intrinsic (sqrtf)
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
@@ -68,14 +68,14 @@ f32 func_802B51E8(Vec3f arg0, Vec3f arg1) {
temp_f14 = arg1[2] - arg0[2];
return (temp_f2 * temp_f2) + (temp_f12 * temp_f12) + temp_f14 + temp_f14;
}
//u32 atan2s(f32, f32); // might be s32
u32 func_802B5224(Vec3f arg0, Vec3f arg1) {
f32 temp_v1;
f32 temp_v2;
temp_v1 = arg1[0] - arg0[0];
temp_v2 = arg1[2] - arg0[2];
return func_802B7830(temp_v1, temp_v2);
return atan2s(temp_v1, temp_v2);
}
u32 func_802B5258(Vec3f arg0, Vec3s arg1) {
@@ -84,7 +84,7 @@ u32 func_802B5258(Vec3f arg0, Vec3s arg1) {
temp_v1 = arg1[0] - arg0[0];
temp_v2 = arg1[2] - arg0[2];
return func_802B7830(temp_v1, temp_v2);
return atan2s(temp_v1, temp_v2);
}
void vec3f_set(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3) {
@@ -1438,86 +1438,79 @@ void func_802B75F8(void *arg0, f32 *arg1) {
GLOBAL_ASM("asm/non_matchings/math_util/func_802B75F8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
extern u16 gArctanTable;
static f32 D_802B9FD8 = 1000000.0f;
/**
* Comment from sm64 unverified. mk64 verison is modified
*
* Helper function for atan2s. Does a look up of the arctangent of y/x assuming
* the resulting angle is in range [0, 0x2000] (1/8 of a circle).
*/
extern f32 D_802B9FD8; // = 1000000.0f;
u16 func_802B7790(f32 arg0, f32 arg1) {
f32 temp_f0;
u16 atan2_lookup(f32 y, f32 x) {
u16 ret;
if (arg1 == 0.0f) {
return gArctanTable;
}
temp_f0 = arg0 / arg1;
if (D_802B9FD8 < temp_f0) {
if (arg0 > 0.0f) {
return 0x4000;
}
return 0xC000;
}
return (&gArctanTable)[(temp_f0 * 1024.0f) + 0.5f];
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7790.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
s32 func_802B7790(f32, f32); /* extern */
s32 func_802B7830(f32 arg0, f32 arg1) {
f32 temp_f20;
f32 temp_f20_2;
f32 temp_f22;
s32 phi_v1;
if (arg0 >= 0.0f) {
if (arg1 >= 0.0f) {
if (arg0 <= arg1) {
phi_v1 = func_802B7790() & 0xFFFF;
if (x == 0) {
ret = gArctanTable[0];
} else {
if (D_802B9FD8 < y / x) {
if (y > 0.0f) {
ret = 0x4000;
} else {
phi_v1 = (0x4000 - func_802B7790(arg1, arg0)) & 0xFFFF;
ret = 0xC000;
}
} else {
temp_f20 = -arg1;
if (temp_f20 < arg0) {
phi_v1 = (func_802B7790(temp_f20, arg0) + 0x4000) & 0xFFFF;
ret = gArctanTable[(s32)(y / x * 1024 + 0.5f)];
}
}
return ret;
}
u16 atan2_lookup(f32 y, f32 x);
/**
* Compute the angle from (0, 0) to (x, y) as a u16. Given that terrain is in
* the xz-plane, this is commonly called with (z, x) to get a yaw angle.
* sm64 but x, y swapped and returns u16.
*/
u16 atan2s(f32 x, f32 y) {
u16 ret;
if (x >= 0) {
if (y >= 0) {
if (y >= x) {
ret = atan2_lookup(x, y);
} else {
phi_v1 = (0x8000 - func_802B7790(arg0, temp_f20)) & 0xFFFF;
ret = 0x4000 - atan2_lookup(y, x);
}
} else {
y = -y;
if (y < x) {
ret = 0x4000 + atan2_lookup(y, x);
} else {
ret = 0x8000 - atan2_lookup(x, y);
}
}
} else {
temp_f22 = -arg0;
if (arg1 < 0.0f) {
temp_f20_2 = -arg1;
if (temp_f22 <= temp_f20_2) {
phi_v1 = (func_802B7790(temp_f22, temp_f20_2) + 0x8000) & 0xFFFF;
x = -x;
if (y < 0) {
y = -y;
if (y >= x) {
ret = 0x8000 + atan2_lookup(x, y);
} else {
phi_v1 = (0xC000 - func_802B7790(temp_f20_2, temp_f22)) & 0xFFFF;
ret = 0xC000 - atan2_lookup(y, x);
}
} else if (arg1 < temp_f22) {
phi_v1 = (func_802B7790(arg1, temp_f22) + 0xC000) & 0xFFFF;
} else {
phi_v1 = -func_802B7790(temp_f22, arg1) & 0xFFFF;
if (y < x) {
ret = 0xC000 + atan2_lookup(y, x);
} else {
ret = -atan2_lookup(x, y);
}
}
}
return phi_v1;
return ret;
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7830.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
//s16 func_802B7830(); /* extern */
f32 func_802B79B8(f32 arg0) {
return func_802B7830(arg0, 0.0f);
f32 func_802B79B8(f32 arg0, f32 arg1) {
return atan2s(arg0, arg1);
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B79B8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
@@ -1575,163 +1568,72 @@ f32 func_802B79F0(f32 arg0, f32 arg1) {
GLOBAL_ASM("asm/non_matchings/math_util/func_802B79F0.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
//This function did not have a glabel in the original assembly, as such it may
//be unused/unnamed
f32 func_802B79B8(); /* extern */
static f64 D_802BA018 = 3.141592653589793;
extern f64 D_802BA018; // = 3.141592653589793;
s32 func_802B7B50(void) {
return ((func_802B79B8() * 32768.0f) / D_802BA018) & 0xFFFF;
UNUSED u16 func_802B7B50(f32 arg0, f32 arg1) {
return ((func_802B79B8(arg0, arg1) * 32768.0f) / D_802BA018);
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7B50.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
//This function did not have a glabel in the original assembly, as such it may
//be unused/unnamed
//? func_802B79B8(?); /* extern */
void func_802B7C18(void) {
func_802B79B8(0x3F800000);
UNUSED void func_802B7C18(f32 arg0) {
func_802B79B8(arg0, 1.0f);
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7C18.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
s16 func_802B7830(?); /* extern */
s16 func_802B7C40(void) {
return func_802B7830(0x3F800000);
s16 func_802B7C40(f32 arg0) {
return atan2s(arg0, 1.0f);
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7C40.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
//This function did not have a glabel in the original assembly, as such it may
//be unused/unnamed
? func_802B79B8(f32); /* extern */
void func_802B7C6C(f32 arg0) {
func_802B79B8(sqrtf(1.0 - (arg0 * arg0)));
UNUSED void func_802B7C6C(f32 arg0) {
func_802B79B8(arg0, sqrtf(1.0 - (arg0 * arg0)));
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7C6C.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
s16 func_802B7830(f32); /* extern */
s16 func_802B7CA8(f32 arg0) {
return func_802B7830(sqrtf(1.0 - (arg0 * arg0)));
return atan2s(arg0, sqrtf(1.0 - (arg0 * arg0)));
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7CA8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
? func_802B79B8(f32, f32); /* extern */
void func_802B7CE8(f32 arg0) {
func_802B79B8(sqrtf(1.0 - (arg0 * arg0)), arg0);
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7CE8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
//This function did not have a glabel in the original assembly, as such it may
//be unused/unnamed
f32 func_802B79B8(f32, f32); /* extern */
static f64 D_802BA020 = 3.141592653589793;
s16 func_802B7D28(f32 arg0) {
return (func_802B79B8(sqrtf(1.0 - (arg0 * arg0)), arg0) * 32768.0f) / D_802BA020;
UNUSED s16 func_802B7D28(f32 arg0) {
return func_802B79B8(sqrtf(1.0 - (f64)(arg0 * arg0)), arg0) * 32768.0f / 3.141592653589793;
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7D28.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
extern u16 D_802BA290;
extern u16 gRandomSeed16;
u16 random_u16(void) {
s32 temp_a1;
s32 temp_t5;
s32 temp_t8;
s32 temp_v0_2;
u16 temp_t4;
u16 temp_v0;
u16 phi_v0;
u16 temp1, temp2;
temp_v0 = D_802BA290;
phi_v0 = temp_v0;
if (temp_v0 == 0x560A) {
D_802BA290 = 0;
phi_v0 = 0 & 0xFFFF;
if (gRandomSeed16 == 22026) {
gRandomSeed16 = 0;
}
temp_t8 = (phi_v0 << 8) ^ phi_v0;
temp_a1 = temp_t8 & 0xFF;
temp_t4 = (temp_a1 << 8) + ((temp_t8 & 0xFF00) >> 8);
temp_t5 = ((temp_a1 * 2) ^ temp_t4) & 0xFFFF;
D_802BA290 = temp_t4;
if ((temp_t5 & 1) == 0) {
temp_v0_2 = ((temp_t5 >> 1) ^ 0xFF80) & 0xFFFF;
if (temp_v0_2 == 0xAA55) {
D_802BA290 = 0;
temp1 = (gRandomSeed16 & 0x00FF) << 8;
temp1 = temp1 ^ gRandomSeed16;
gRandomSeed16 = ((temp1 & 0x00FF) << 8) + ((temp1 & 0xFF00) >> 8);
temp1 = ((temp1 & 0x00FF) << 1) ^ gRandomSeed16;
temp2 = (temp1 >> 1) ^ 0xFF80;
if ((temp1 & 1) == 0) {
if (temp2 == 43605) {
gRandomSeed16 = 0;
} else {
D_802BA290 = temp_v0_2 ^ 0x1FF4;
gRandomSeed16 = temp2 ^ 0x1FF4;
}
} else {
D_802BA290 = (temp_t5 >> 1) ^ 0xFF80 ^ 0x8180;
gRandomSeed16 = temp2 ^ 0x8180;
}
return D_802BA290;
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/random_u16.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
u32 random_u16(); /* extern */
static f64 D_802BA028 = 65535.0;
return gRandomSeed16;
}
s32 random_int(u16 arg0) {
f64 temp_f8;
f64 phi_f8;
temp_f8 = arg0;
phi_f8 = temp_f8;
if (arg0 < 0) {
phi_f8 = temp_f8 + 4294967296.0;
}
return ((random_u16() / D_802BA028) * phi_f8) & 0xFFFF;
return (u16) (arg0 * (( (f32) random_u16() ) / 65535.0));
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/random_int.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
s16 func_802B7830(f32, f32); /* extern */
s16 func_802B7F34(f32 arg0, f32 arg1, f32 arg2, f32 arg3) {
return func_802B7830(arg2 - arg0, arg3 - arg1);
return atan2s(arg2 - arg0, arg3 - arg1);
}
#else
GLOBAL_ASM("asm/non_matchings/math_util/func_802B7F34.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
+2 -1
View File
@@ -23,7 +23,8 @@ void mtxf_translate(Mat4, Vec3f);
void func_802B5F00(Mat4, f32);
void func_802B71CC(Mat4, Mat4, Mat4);
void func_802B75F8(Mtx*, Mat4);
u32 func_802B7830(f32, f32);
u16 atan2s(f32, f32);
f32 sins(u16);
f32 coss(u16);