Code 80281FA0 decomp (#126)

* Match a few functions in code_80281FA0.c

* Match func_80282200
This commit is contained in:
ChiefFruitcake
2022-01-01 20:11:03 -05:00
committed by GitHub
parent 7df6d01ef3
commit c4048a1e1c
6 changed files with 42 additions and 287 deletions
+42 -79
View File
@@ -7,8 +7,9 @@ extern Player *gPlayerOne;
extern Player *gPlayerTwo;
extern Player *gPlayerThree;
extern Player *gPlayerFour;
extern s16 D_802876D2;
s32 func_802832C4(s32, s32, s16, s16);
s32 func_802832C4(void (*)(s32), s32, s16, s16);
void func_80281FA0(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3) {
arg0[0] = arg1;
@@ -96,122 +97,93 @@ void func_802820F8(void *arg0, u16 arg2) {
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_802820F8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_802821A0(f32 *arg0, f32 arg1, f32 arg2) {
f32 temp_f0;
f32 phi_f12;
phi_f12 = arg2;
s32 func_802821A0(f32* arg0, f32 arg1, f32 arg2) {
if (arg2 > 1.0f) {
phi_f12 = 1.0f;
arg2 = 1.0f;
}
temp_f0 = *arg0;
*arg0 = ((arg1 - temp_f0) * phi_f12) + temp_f0;
*arg0 = *arg0 + ((arg1 - *arg0) * arg2);
if (arg1 == *arg0) {
return 0;
}
return 1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_802821A0.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_80282200(s16 *arg0, s16 arg1, s16 arg2) {
s16 temp_v0;
s32 func_80282200(s16* arg0, s16 arg1, s16 arg2) {
s16 temp_v0 = *arg0;
if (arg2 == 0) {
*arg0 = arg1;
} else {
temp_v0 = *arg0 - arg1;
*arg0 = (temp_v0 - (temp_v0 / arg2)) + arg1;
temp_v0 -= arg1;
temp_v0 -= (temp_v0 / arg2);
temp_v0 += arg1;
*arg0 = temp_v0;
}
if (arg1 == *arg0) {
return 0;
}
return 1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80282200.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_802822AC(f32 *arg0, f32 arg1, f32 arg2) {
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f0_3;
f32 phi_f14;
temp_f0 = arg1 - *arg0;
phi_f14 = arg2;
s32 func_802822AC(f32* arg0, f32 arg1, f32 arg2) {
f32 temp_f0 = arg1 - *arg0;
if (arg2 < 0.0f) {
phi_f14 = -1.0f * arg2;
arg2 = -1.0f * arg2;
}
if (temp_f0 > 0.0f) {
temp_f0_2 = temp_f0 - phi_f14;
if (temp_f0_2 > 0.0f) {
*arg0 = arg1 - temp_f0_2;
temp_f0 -= arg2;
if (temp_f0 > 0.0f) {
*arg0 = arg1 - temp_f0;
} else {
goto block_8;
*arg0 = arg1;
}
} else {
temp_f0_3 = temp_f0 + phi_f14;
if (temp_f0_3 < 0.0f) {
*arg0 = arg1 - temp_f0_3;
temp_f0 += arg2;
if (temp_f0 < 0.0f) {
*arg0 = arg1 - temp_f0;
} else {
block_8:
*arg0 = arg1;
}
}
if (arg1 == *arg0) {
return 0;
}
return 1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_802822AC.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_80282364(s16 *arg0, s16 arg1, s16 arg2) {
s16 temp_v0;
s16 temp_v0_2;
s16 temp_v0_3;
s16 phi_a2;
s32 func_80282364(s16* arg0, s16 arg1, s16 arg2) {
s16 temp_v0 = arg1 - *arg0;
temp_v0 = arg1 - *arg0;
phi_a2 = arg2;
if (arg2 < 0) {
phi_a2 = arg2 * -1;
arg2 = arg2 * -1;
}
if (temp_v0 > 0) {
temp_v0_2 = temp_v0 - phi_a2;
if (temp_v0_2 >= 0) {
*arg0 = arg1 - temp_v0_2;
if ( temp_v0 > 0) {
temp_v0 -= arg2;
if (temp_v0 >= 0) {
*arg0 = arg1 - temp_v0;
} else {
goto block_8;
*arg0 = arg1;
}
} else {
temp_v0_3 = temp_v0 + phi_a2;
if (temp_v0_3 <= 0) {
*arg0 = arg1 - temp_v0_3;
temp_v0 += arg2;
if (temp_v0 <= 0) {
*arg0 = arg1 - temp_v0;
} else {
block_8:
*arg0 = arg1;
}
}
if (arg1 == *arg0) {
return 0;
}
return 1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80282364.s")
#endif
extern f32 D_80287B18;
extern s16 D_80287B1C;
@@ -677,21 +649,12 @@ void func_80283240(s16 arg0) {
}
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern s16 D_802876D2;
s32 func_802832C4(s32 arg0, s32 arg1, s16 arg2, s16 arg3) {
s32 func_802832C4(void (*func_ptr)(s32), s32 arg1, s16 arg2, s16 arg3) {
if ((D_802876D2 >= arg2) && ((arg3 == -1) || (arg3 >= D_802876D2))) {
return arg0;
func_ptr(arg1);
}
return arg1;
return 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_802832C4.s")
#endif
extern s16 D_802876D0;
extern s16 D_802876D2;