Match func_80091AC0 (#166)

* Match func_80091AC0

* Match func_8009A6D4

Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
Tyler McGavran
2022-02-22 13:45:29 -05:00
committed by GitHub
parent a4e6192030
commit 4e4339126e
4 changed files with 27 additions and 140 deletions
+25 -53
View File
@@ -159,45 +159,29 @@ f64 func_80091A6C(f64 value, s32 exponent) {
return value;
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
/**
* Its unclear what exact purpose this function serves
* The function multiplies/divides arg0 by 2 until its in
* the range (0.5, 1.0].
* arg2 appears to track the exponent in the power-of-2
* that would undo the changes to arg0
**/
f64 func_80091AC0(f64 arg0, s32 *arg2) {
f64 phi_f12;
f64 phi_f12_2;
s32 phi_v0;
f64 phi_f12_3;
s32 phi_v0_2;
s32 phi_v0_3;
const f64 const1 = 2.0;
s32 exponent = 0;
phi_f12 = arg0;
phi_v0 = 0;
phi_f12_3 = arg0;
phi_v0_3 = 0;
if ((arg0 < 0.5) || (arg0 >= 1.0)) {
do {
loop_2:
if (phi_f12 < 0.5) {
phi_f12_2 = phi_f12 * 2.0;
phi_v0_2 = phi_v0_3 - 1;
} else {
phi_f12_2 = phi_f12 / 2.0;
phi_v0_2 = phi_v0_3 + 1;
}
phi_f12 = phi_f12_2;
phi_v0 = phi_v0_2;
phi_f12_3 = phi_f12_2;
phi_v0_3 = phi_v0_2;
if (phi_f12_2 < 0.5) {
goto loop_2;
}
} while (phi_f12_2 >= 1.0);
while ((arg0 < 0.5) || (arg0 >= 1.0)) {
if (arg0 < 0.5) {
arg0 *= const1;
exponent -= 1;
} else {
arg0 /= const1;
exponent += 1;
}
}
*arg2 = phi_v0;
return phi_f12_3;
*arg2 = exponent;
return arg0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80091AC0.s")
#endif
void swap_values(s32 *arg0, s32 *arg1) {
s32 temp;
@@ -4648,28 +4632,16 @@ void func_8009A640(s32 arg0, s32 arg1, s32 arg2, MkAnimation *arg3) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A640.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit dacbf209f1bb5d4acaecaf1fefff331d60ffd80c
extern ? D_8018E060;
UNUSED void func_8009A6D4(void) {
struct_8018DEE0_entry *temp_s0;
struct_8018DEE0_entry *phi_s0;
phi_s0 = D_8018DEE0;
do {
if ((phi_s0->visible & 0x80000000) != 0) {
func_8009A878(phi_s0);
gDisplayListHead = func_8009C434((s32) gDisplayListHead, phi_s0, 0, 0, 0);
s32 index;
for (index = 0; index < D_8018DEE0_SIZE; index++) {
if ((D_8018DEE0[index].visible & 0x80000000) != 0) {
func_8009A878(&D_8018DEE0[index]);
gDisplayListHead = func_8009C434(gDisplayListHead, &D_8018DEE0[index], 0, 0, 0);
}
temp_s0 = phi_s0 + 0x18;
phi_s0 = temp_s0;
} while (temp_s0 != &D_8018E060);
}
func_80099AEC();
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A6D4.s")
#endif
void func_8009A76C(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
struct_8018DEE0_entry *temp = &D_8018DEE0[arg0];