summaryrefslogtreecommitdiff
path: root/src/code_80086E70.c
diff options
context:
space:
mode:
authorTyler McGavran <tyler.taggerung@gmail.com>2022-08-23 12:33:00 -0400
committerGitHub <noreply@github.com>2022-08-23 09:33:00 -0700
commitdfd54d9a102b971e027058ce163e0f9cd84f5b44 (patch)
treef6d27fe4fb1c65f0a813cb753b4fc901386c23ce /src/code_80086E70.c
parent7d23fcc063bb0067e7e051d98d18622a134d0248 (diff)
Match a lot of functions, add header for objects (#251)
* Match a lot of functions, add header for objects * Refreshed a TON of functions and created/added to several header files * Add header for code_800431B0, address comments Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
Diffstat (limited to 'src/code_80086E70.c')
-rw-r--r--src/code_80086E70.c2566
1 files changed, 1011 insertions, 1555 deletions
diff --git a/src/code_80086E70.c b/src/code_80086E70.c
index 2ba66aa24..62187d527 100644
--- a/src/code_80086E70.c
+++ b/src/code_80086E70.c
@@ -2,32 +2,19 @@
#include <macros.h>
#include <common_structs.h>
#include <types.h>
+#include "camera.h"
+#include "objects.h"
+#include "math_util.h"
#include "math_util_2.h"
+#include "memory.h"
+#include "code_80071F00.h"
+#include "code_80086E70.h"
-// Struct from 80071F00.c
-// No idea if it goes here. But it gets us to the size requirement.
-// Once we find out what this actually is, we can replace it.
-struct struct_E0 {
- union {
- s8 s8;
- s16 s16;
- } unk00;
- s16 unk2;
- s8 unk4[0xDC];
-}; // Size 0xE0
-extern struct struct_E0 D_80165CC6[];
-
-extern s16 D_8018CF68[];
-extern s32 gPlayerCountSelection1;
-
-void func_800721E8(s32, s32); // extern
void func_80086E70(s32 arg0) {
- D_80165CC6[arg0].unk00.s16 = 1;// * 0xE0)) = 1;
+ D_80165C18[arg0].unk_0AE = 1;// * 0xE0)) = 1;
func_800721E8(arg0, 8);
}
-extern struct_80165C18_entry D_80165C18[];
-
void func_80086EAC(s32 arg0, s32 arg1, s16 arg2) {
D_80165C18[arg0].unk_0DD = arg1;
D_80165C18[arg0].unk_0AE = arg2;
@@ -51,11 +38,9 @@ void func_80086F60(s32 arg0) {
func_800721E8(arg0, 8);
}
-extern struct struct_E0 D_80165CC6[];
-
s32 func_80086FA4(s32 arg0) {
s32 ret = 0;
- if (D_80165CC6[arg0].unk00.s16 == 0) {
+ if (D_80165C18[arg0].unk_0AE == 0) {
ret = 1;
}
return ret;
@@ -68,291 +53,146 @@ void func_80086FD4(s32 arg0) {
void func_8008701C(s32 arg0, s32 arg1) {
func_800721E8(arg0, 8);
- D_80165CC6[arg0].unk00.s16 = arg1;
+ D_80165C18[arg0].unk_0AE = arg1;
}
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-extern ? D_80165C18;
-extern ? D_80165CC8;
-
-s32 func_80087060(s32 arg0, s32 arg1) {
+s32 func_80087060(s32 objectIndex, s32 arg1) {
s32 sp1C;
- s32 temp_a0;
- void *temp_v0;
- s32 phi_a0;
sp1C = 0;
- temp_a0 = arg0;
- phi_a0 = temp_a0;
- if (func_80072270(8) != 0) {
- arg0 = temp_a0;
- func_800721C0(temp_a0, 8);
- *(&D_80165CC8 + (arg0 * 0xE0)) = arg1;
- phi_a0 = arg0;
- }
- temp_v0 = (phi_a0 * 0xE0) + &D_80165C18;
- temp_v0->unkB0 = temp_v0->unkB0 - 1;
- if (temp_v0->unkB0 < 0) {
- func_800721E8(phi_a0, 8);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ D_80165C18[objectIndex].unk_0B0 = arg1;
+ }
+ D_80165C18[objectIndex].unk_0B0--;
+ if (D_80165C18[objectIndex].unk_0B0 < 0) {
+ func_800721E8(objectIndex, 8);
sp1C = 1;
}
return sp1C;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087060.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-extern ? D_80165C18;
-extern ? D_80165CC8;
-
-s32 func_80087104(s32 arg0, u16 arg1) {
+s32 func_80087104(s32 objectIndex, u16 arg1) {
s32 sp24;
- void *temp_v0;
sp24 = 0;
- if (func_80072270(8) != 0) {
- func_800721C0(arg0, 8);
- *(&D_80165CC8 + (arg0 * 0xE0)) = random_int(arg1);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ D_80165C18[objectIndex].unk_0B0 = random_int(arg1);
}
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unkB0 = temp_v0->unkB0 - 1;
- if (temp_v0->unkB0 < 0) {
- func_800721E8(arg0, 8);
+ D_80165C18[objectIndex].unk_0B0--;
+ if (D_80165C18[objectIndex].unk_0B0 < 0) {
+ func_800721E8(objectIndex, 8);
sp24 = 1;
}
return sp24;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087104.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-? func_80086FD4(s32); // extern
-extern ? D_80165C18;
-extern ? D_80165CC8;
-
-s32 func_800871AC(s32 arg0, s32 arg1) {
+s32 func_800871AC(s32 objectIndex, s32 arg1) {
s32 sp24;
- void *temp_v0;
sp24 = 0;
- if (func_80072270(8) != 0) {
- func_800721C0(arg0, 8);
- *(&D_80165CC8 + (arg0 * 0xE0)) = arg1;
- }
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unkB0 = temp_v0->unkB0 - 1;
- if (temp_v0->unkB0 < 0) {
- func_800721E8(arg0, 8);
- func_80086FD4(arg0);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ D_80165C18[objectIndex].unk_0B0 = (s16) arg1;
+ }
+ D_80165C18[objectIndex].unk_0B0--;
+ if (D_80165C18[objectIndex].unk_0B0 < 0) {
+ func_800721E8(objectIndex, 8);
+ func_80086FD4(objectIndex);
sp24 = 1;
}
return sp24;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800871AC.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? atan2s(f32, f32); // extern
-extern ? D_80165C18;
-void func_800872D8(s32 arg0, void *arg1) {
- void *temp_v0;
-
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- atan2s(temp_v0->unk4 - arg1->unk0, temp_v0->unkC - arg1->unk8);
+UNUSED void func_80087258(s32 objectIndex, s32 arg1, f32 arg2) {
+ D_80165C18[objectIndex].unk_028[1] += arg2;
+ D_80165C18[objectIndex].unk_028[2] -= arg2;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800872D8.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 atan2s(f32, f32); // extern
-extern ? D_80165C18;
-s32 func_80087324(s32 arg0) {
- void *temp_v0;
-
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- return -atan2s(temp_v0->unk3C, temp_v0->unk40) & 0xFFFF;
+UNUSED s32 func_80087294(s32 objectIndex, Player *player) {
+ return func_80041770(player->pos[0], D_80165C18[objectIndex].unk_004[0], player->pos[2], D_80165C18[objectIndex].unk_004[2]);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087324.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? atan2s(f32, f32); // extern
-extern ? D_80165C18;
-
-void func_80087368(s32 arg0) {
- void *temp_v0;
+s32 func_800872D8(s32 objectIndex, Camera *camera) {
+ return atan2s(D_80165C18[objectIndex].unk_004[0] - camera->pos[0], D_80165C18[objectIndex].unk_004[2] - camera->pos[2]);
+}
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- atan2s(temp_v0->unk38, temp_v0->unk40);
+u16 func_80087324(s32 objectIndex) {
+ return -atan2s(D_80165C18[objectIndex].unk_038[1], D_80165C18[objectIndex].unk_038[2]);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087368.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-u16 func_800417B4(u16, s32); // extern
-s32 func_80087368(); // extern
-extern ? D_80165C18;
+s32 func_80087368(s32 objectIndex) {
+ return atan2s(D_80165C18[objectIndex].unk_038[0], D_80165C18[objectIndex].unk_038[2]);
+}
-void func_800873F4(s32 arg0) {
- void *sp18;
- s32 temp_v0;
- void *temp_v1;
+UNUSED void func_800873A4(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_0BE = func_800417B4(D_80165C18[objectIndex].unk_0BE, func_80087324(objectIndex));
+}
- temp_v0 = func_80087368();
- temp_v1 = (arg0 * 0xE0) + &D_80165C18;
- sp18 = temp_v1;
- temp_v1->unkC0 = func_800417B4(temp_v1->unkC0, temp_v0 & 0xFFFF);
+void func_800873F4(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_0C0 = func_800417B4(D_80165C18[objectIndex].unk_0C0, func_80087368(objectIndex));
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800873F4.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-f32 sins(u16); // extern
-f32 coss(u16); // extern
-extern ? D_80165C18;
+UNUSED void func_80087444(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_038[0] = D_80165C18[objectIndex].unk_034 * sins(D_80165C18[objectIndex].unk_0C0);
+}
-void func_8008751C(s32 arg0) {
- void *sp1C;
- void *temp_v0;
+UNUSED void func_8008748C(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_038[1] = D_80165C18[objectIndex].unk_034 * coss(D_80165C18[objectIndex].unk_0BE);
+}
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- sp1C = temp_v0;
- temp_v0->unk38 = sins(temp_v0->unkC0) * temp_v0->unk34;
- temp_v0->unk40 = coss(temp_v0->unkC0) * temp_v0->unk34;
+UNUSED void func_800874D4(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_038[2] = D_80165C18[objectIndex].unk_034 * coss(D_80165C18[objectIndex].unk_0C0);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008751C.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-f32 sins(u16); // extern
-f32 coss(u16); // extern
-extern ? D_80165C18;
+void func_8008751C(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_038[0] = D_80165C18[objectIndex].unk_034 * sins(D_80165C18[objectIndex].unk_0C0);
+ D_80165C18[objectIndex].unk_038[2] = D_80165C18[objectIndex].unk_034 * coss(D_80165C18[objectIndex].unk_0C0);
+}
-void func_8008757C(s32 arg0) {
+void func_8008757C(s32 objectIndex) {
f32 sp24;
- void *temp_s0;
- temp_s0 = (arg0 * 0xE0) + &D_80165C18;
- sp24 = coss(temp_s0->unkBE);
- temp_s0->unk38 = sins(temp_s0->unkC0) * (temp_s0->unk34 * sp24);
- temp_s0->unk3C = sins(temp_s0->unkBE) * -temp_s0->unk34;
- sp24 = coss(temp_s0->unkBE);
- temp_s0->unk40 = coss(temp_s0->unkC0) * (temp_s0->unk34 * sp24);
+ sp24 = coss(D_80165C18[objectIndex].unk_0BE);
+ D_80165C18[objectIndex].unk_038[0] = (D_80165C18[objectIndex].unk_034 * sp24) * sins(D_80165C18[objectIndex].unk_0C0);
+ D_80165C18[objectIndex].unk_038[1] = -D_80165C18[objectIndex].unk_034 * sins(D_80165C18[objectIndex].unk_0BE);
+ sp24 = coss(D_80165C18[objectIndex].unk_0BE);
+ D_80165C18[objectIndex].unk_038[2] = (D_80165C18[objectIndex].unk_034 * sp24) * coss(D_80165C18[objectIndex].unk_0C0);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008757C.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-f32 sins(s32); // extern
-f32 coss(s32); // extern
-extern ? D_80165C18;
-
-void func_80087620(s32 arg0) {
- void *sp1C;
- void *temp_v0;
-
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- sp1C = temp_v0;
- temp_v0->unk38 = sins((temp_v0->unkC0 + 0x8000) & 0xFFFF) * temp_v0->unk34;
- temp_v0->unk40 = coss((temp_v0->unkC0 + 0x8000) & 0xFFFF) * temp_v0->unk34;
+void func_80087620(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_038[0] = D_80165C18[objectIndex].unk_034 * sins(D_80165C18[objectIndex].unk_0C0 + 0x8000);
+ D_80165C18[objectIndex].unk_038[2] = D_80165C18[objectIndex].unk_034 * coss(D_80165C18[objectIndex].unk_0C0 + 0x8000);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087620.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-f32 sins(u16); // extern
-f32 coss(u16); // extern
-extern ? D_80165C18;
-
-void func_800876A0(s32 arg0) {
- void *sp18;
- void *temp_v0;
-
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- sp18 = temp_v0;
- temp_v0->unk28 = temp_v0->unk28 + (temp_v0->unk34 * sins(temp_v0->unkC0));
- temp_v0->unk30 = temp_v0->unk30 + (temp_v0->unk34 * coss(temp_v0->unkC0));
+void func_800876A0(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_028[0] += D_80165C18[objectIndex].unk_034 * sins(D_80165C18[objectIndex].unk_0C0);
+ D_80165C18[objectIndex].unk_028[2] += D_80165C18[objectIndex].unk_034 * coss(D_80165C18[objectIndex].unk_0C0);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800876A0.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
-
-void func_80087710(s32 arg0) {
- void *temp_v0;
-
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unk28 = temp_v0->unk28 + temp_v0->unk38;
- temp_v0->unk2C = temp_v0->unk2C + temp_v0->unk3C;
- temp_v0->unk30 = temp_v0->unk30 + temp_v0->unk40;
+void func_80087710(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_028[0] += D_80165C18[objectIndex].unk_038[0];
+ D_80165C18[objectIndex].unk_028[1] += D_80165C18[objectIndex].unk_038[1];
+ D_80165C18[objectIndex].unk_028[2] += D_80165C18[objectIndex].unk_038[2];
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087710.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
-
-void func_8008775C(s32 arg0) {
- void *temp_v0;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unk28 = temp_v0->unk28 + temp_v0->unk38;
- temp_v0->unk30 = temp_v0->unk30 + temp_v0->unk40;
+void func_8008775C(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_028[0] += D_80165C18[objectIndex].unk_038[0];
+ D_80165C18[objectIndex].unk_028[2] += D_80165C18[objectIndex].unk_038[2];
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008775C.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+UNUSED void func_80087798(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_028[0] += D_80165C18[objectIndex].unk_038[0];
+}
-void func_800877C4(s32 arg0) {
- void *temp_v0;
+void func_800877C4(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_028[1] += D_80165C18[objectIndex].unk_038[1];
+}
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unk2C = temp_v0->unk2C + temp_v0->unk3C;
+UNUSED void func_800877F0(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_028[2] += D_80165C18[objectIndex].unk_038[2];
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800877C4.s")
-#endif
void func_8008781C(s32 arg0) {
func_8008751C(arg0);
@@ -368,307 +208,199 @@ f32 func_8008786C(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
return (((arg4 - arg2) / (arg3 - arg1)) * (arg0 - arg1)) + arg2;
}
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-? func_8008751C(s32); // extern
-? func_8008775C(s32); // extern
-extern ? D_80165C18;
-extern ? D_80165CC8;
-
-s32 func_8008789C(s32 arg0, s32 arg1) {
+s32 func_8008789C(s32 objectIndex, s32 arg1) {
s32 sp24;
- void *temp_v0;
sp24 = 0;
- if (func_80072270(8) != 0) {
- func_800721C0(arg0, 8);
- func_8008751C(arg0);
- *(&D_80165CC8 + (arg0 * 0xE0)) = arg1;
- }
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unkB0 = temp_v0->unkB0 - 1;
- if (temp_v0->unkB0 < 0) {
- func_800721E8(arg0, 8);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ func_8008751C(objectIndex);
+ D_80165C18[objectIndex].unk_0B0 = arg1;
+ }
+ D_80165C18[objectIndex].unk_0B0--;
+ if (D_80165C18[objectIndex].unk_0B0 < 0) {
+ func_800721E8(objectIndex, 8);
sp24 = 1;
} else {
- func_8008775C(arg0);
+ func_8008775C(objectIndex);
}
return sp24;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008789C.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-? func_80087620(s32); // extern
-? func_8008775C(s32); // extern
-extern ? D_80165C18;
-extern ? D_80165CC8;
-s32 func_80087954(s32 arg0, s32 arg1) {
+s32 func_80087954(s32 objectIndex, s32 arg1) {
s32 sp24;
- void *temp_v0;
sp24 = 0;
- if (func_80072270(8) != 0) {
- func_800721C0(arg0, 8);
- func_80087620(arg0);
- *(&D_80165CC8 + (arg0 * 0xE0)) = arg1;
- }
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unkB0 = temp_v0->unkB0 - 1;
- if (temp_v0->unkB0 < 0) {
- func_800721E8(arg0, 8);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ func_80087620(objectIndex);
+ D_80165C18[objectIndex].unk_0B0 = arg1;
+ }
+ D_80165C18[objectIndex].unk_0B0--;
+ if (D_80165C18[objectIndex].unk_0B0 < 0) {
+ func_800721E8(objectIndex, 8);
sp24 = 1;
} else {
- func_8008775C(arg0);
+ func_8008775C(objectIndex);
}
return sp24;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087954.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-? func_8008751C(s32); // extern
-? func_8008775C(s32); // extern
-s16 atan2s(f32, f32, s16); // extern
-extern ? D_80165C18;
-s32 func_80087A0C(s32 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) {
+s32 func_80087A0C(s32 objectIndex, s16 arg1, s16 arg2, s16 arg3, s16 arg4) {
s16 sp36;
- s32 sp2C;
- s32 sp28;
- s32 sp24;
- void *sp20;
s16 temp_a0;
s16 temp_v0;
- void *temp_v1;
- void *temp_v1_2;
+ s32 sp2C;
sp2C = 0;
- if (func_80072270(8) != 0) {
- func_800721C0(arg0, 8);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
temp_v0 = arg2 - arg1;
temp_a0 = arg4 - arg3;
- sp24 = temp_a0;
- sp28 = temp_v0;
- temp_v1 = (arg0 * 0xE0) + &D_80165C18;
sp36 = sqrtf((temp_v0 * temp_v0) + (temp_a0 * temp_a0));
- temp_v1->unk14 = 0.0f;
- sp20 = temp_v1;
- temp_v1->unkC0 = atan2s(temp_v0, temp_a0, temp_a0);
- func_8008751C(arg0);
- temp_v1->unkB0 = sp36 / temp_v1->unk34;
- }
- temp_v1_2 = (arg0 * 0xE0) + &D_80165C18;
- temp_v1_2->unkB0 = temp_v1_2->unkB0 - 1;
- if (temp_v1_2->unkB0 < 0) {
- func_800721E8(arg0, 8);
+ D_80165C18[objectIndex].unk_010[1] = 0.0f;
+ D_80165C18[objectIndex].unk_0C0 = atan2s(temp_v0, temp_a0);
+ func_8008751C(objectIndex);
+ D_80165C18[objectIndex].unk_0B0 = sp36 / D_80165C18[objectIndex].unk_034;
+ }
+ D_80165C18[objectIndex].unk_0B0--;
+ if (D_80165C18[objectIndex].unk_0B0 < 0) {
+ func_800721E8(objectIndex, 8);
sp2C = 1;
} else {
- func_8008775C(arg0);
+ func_8008775C(objectIndex);
}
return sp2C;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087A0C.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-? func_80086FD4(s32); // extern
-? func_800877C4(s32); // extern
-extern ? D_80165C18;
-extern ? D_80165C54;
-s32 func_80087B84(s32 arg0, f32 arg1, f32 arg2) {
+s32 func_80087B84(s32 objectIndex, f32 arg1, f32 arg2) {
s32 sp24;
- void *sp20;
sp24 = 0;
- if (func_80072270(8) != 0) {
- func_800721C0(arg0, 8);
- *(&D_80165C54 + (arg0 * 0xE0)) = -arg1;
- }
- sp20 = (arg0 * 0xE0) + &D_80165C18;
- func_800877C4(arg0);
- if (sp20->unk8 <= arg2) {
- func_800721E8(arg0, 8);
- func_80086FD4(arg0);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ D_80165C18[objectIndex].unk_038[1] = -arg1;
+ }
+ func_800877C4(objectIndex);
+ if (D_80165C18[objectIndex].unk_004[1] <= arg2) {
+ func_800721E8(objectIndex, 8);
+ func_80086FD4(objectIndex);
sp24 = 1;
}
return sp24;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087B84.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-? func_80086FD4(s32); // extern
-? func_800877C4(s32); // extern
-extern ? D_80165C18;
-
-s32 func_80087C48(s32 arg0, f32 arg1, f32 arg2, s32 arg3) {
+s32 func_80087C48(s32 objectIndex, f32 arg1, f32 arg2, s32 arg3) {
s32 sp24;
- void *temp_v0;
- void *temp_v0_2;
sp24 = 0;
- if (func_80072270(8) != 0) {
- func_800721C0(arg0, 8);
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unk3C = arg1;
- temp_v0->unkB0 = arg3;
- }
- temp_v0_2 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0_2->unkB0 = temp_v0_2->unkB0 - 1;
- if (temp_v0_2->unkB0 < 0) {
- func_800721E8(arg0, 8);
- func_80086FD4(arg0);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ D_80165C18[objectIndex].unk_038[1] = arg1;
+ D_80165C18[objectIndex].unk_0B0 = (s16) arg3;
+ }
+ D_80165C18[objectIndex].unk_0B0--;
+ if (D_80165C18[objectIndex].unk_0B0 < 0) {
+ func_800721E8(objectIndex, 8);
+ func_80086FD4(objectIndex);
sp24 = 1;
} else {
- temp_v0_2->unk3C = temp_v0_2->unk3C - arg2;
- func_800877C4(arg0);
+ D_80165C18[objectIndex].unk_038[1] -= arg2;
+ func_800877C4(objectIndex);
}
return sp24;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087C48.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-? func_80086FD4(s32); // extern
-? func_800877C4(s32); // extern
-extern ? D_80165C18;
-extern ? D_80165C54;
-s32 func_80087D24(s32 arg0, f32 arg1, f32 arg2, f32 arg3) {
+s32 func_80087D24(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3) {
s32 sp24;
- void *sp20;
- void *temp_v0;
sp24 = 0;
- if (func_80072270(8) != 0) {
- func_800721C0(arg0, 8);
- *(&D_80165C54 + (arg0 * 0xE0)) = arg1;
- }
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- sp20 = temp_v0;
- temp_v0->unk3C = temp_v0->unk3C - arg2;
- func_800877C4(arg0);
- if (temp_v0->unk2C <= arg3) {
- sp20 = temp_v0;
- func_800721E8(arg0, 8);
- temp_v0->unk2C = arg3;
- func_80086FD4(arg0);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ D_80165C18[objectIndex].unk_038[1] = arg1;
+ }
+ D_80165C18[objectIndex].unk_038[1] -= arg2;
+ func_800877C4(objectIndex);
+ if (D_80165C18[objectIndex].unk_028[1] <= arg3) {
+ func_800721E8(objectIndex, 8);
+ D_80165C18[objectIndex].unk_028[1] = arg3;
+ func_80086FD4(objectIndex);
sp24 = 1;
}
return sp24;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087D24.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-s32 func_80072270(?); // extern
-? func_80086FD4(s32); // extern
-? func_8008751C(s32); // extern
-? func_80087710(s32); // extern
-extern ? D_80165C18;
-
-s32 func_80087E08(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s32 arg5) {
+s32 func_80087E08(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s32 arg5) {
s32 sp2C;
- void *sp24;
- void *temp_v0;
- void *temp_v0_2;
+ s32 stackPadding;
sp2C = 0;
- if (func_80072270(8) != 0) {
- func_800721C0(arg0, 8);
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- sp24 = temp_v0;
- temp_v0->unk30 = 0.0f;
- temp_v0->unk2C = 0.0f;
- temp_v0->unk28 = 0.0f;
- temp_v0->unk34 = arg3;
- temp_v0->unk3C = arg1;
- temp_v0->unkC0 = arg4;
- func_8008751C(arg0);
- temp_v0->unkB0 = arg5;
- }
- temp_v0_2 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0_2->unkB0 = temp_v0_2->unkB0 - 1;
- if (temp_v0_2->unkB0 < 0) {
- func_800721E8(arg0, 8);
- func_80086FD4(arg0);
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ D_80165C18[objectIndex].unk_028[2] = 0.0f;
+ D_80165C18[objectIndex].unk_028[1] = 0.0f;
+ D_80165C18[objectIndex].unk_028[0] = 0.0f;
+ D_80165C18[objectIndex].unk_034 = arg3;
+ D_80165C18[objectIndex].unk_038[1] = arg1;
+ D_80165C18[objectIndex].unk_0C0 = arg4;
+ func_8008751C(objectIndex);
+ D_80165C18[objectIndex].unk_0B0 = arg5;
+ }
+ D_80165C18[objectIndex].unk_0B0--;
+ if (D_80165C18[objectIndex].unk_0B0 < 0) {
+ func_800721E8(objectIndex, 8);
+ func_80086FD4(objectIndex);
sp2C = 1;
} else {
- temp_v0_2->unk3C = temp_v0_2->unk3C - arg2;
- func_80087710(arg0);
+ D_80165C18[objectIndex].unk_038[1] -= arg2;
+ func_80087710(objectIndex);
}
return sp2C;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80087E08.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-f32 sins(s32); // extern
-f32 coss(u16); // extern
-extern ? D_80165C18;
+UNUSED s32 func_80087F14(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s32 arg5) {
+ s32 sp2C;
+ s32 stackPadding;
-void func_80088038(s32 arg0, f32 arg1, s32 arg2) {
- f32 sp24;
- f32 sp20;
- void *sp1C;
- f32 temp_f2;
+ sp2C = 0;
+ if (func_80072270(objectIndex, 8) != 0) {
+ func_800721C0(objectIndex, 8);
+ D_80165C18[objectIndex].unk_028[2] = 0.0f;
+ D_80165C18[objectIndex].unk_028[1] = 0.0f;
+ D_80165C18[objectIndex].unk_028[0] = 0.0f;
+ D_80165C18[objectIndex].unk_034 = arg3;
+ D_80165C18[objectIndex].unk_038[1] = arg1;
+ D_80165C18[objectIndex].unk_0C0 = arg4;
+ func_8008751C(objectIndex);
+ D_80165C18[objectIndex].unk_0B0 = gVBlankTimer;
+ }
+ if (D_80165C18[objectIndex].unk_028[1] <= arg5) {
+ func_800721E8(objectIndex, 8);
+ func_80086FD4(objectIndex);
+ sp2C = 1;
+ } else {
+ D_80165C18[objectIndex].unk_038[1] -= arg2;
+ func_80087710(objectIndex);
+ }
+ return sp2C;
+}
+
+void func_80088038(s32 objectIndex, f32 arg1, u16 arg2) {
f32 temp_f4;
- u16 temp_t0;
- void *temp_v0;
+ f32 sp20;
+
+ temp_f4 = D_80165C18[objectIndex].unk_028[0];
+ sp20 = D_80165C18[objectIndex].unk_028[2];
+ D_80165C18[objectIndex].unk_0C4 += arg2;
+ D_80165C18[objectIndex].unk_028[0] = sins(D_80165C18[objectIndex].unk_0C4) * arg1;
+ D_80165C18[objectIndex].unk_028[2] = coss(D_80165C18[objectIndex].unk_0C4) * arg1;
+ D_80165C18[objectIndex].unk_038[0] = D_80165C18[objectIndex].unk_028[0] - temp_f4;
+ D_80165C18[objectIndex].unk_038[2] = D_80165C18[objectIndex].unk_028[2] - sp20;
+}
+
+UNUSED void func_800880DC(void) {
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_f4 = temp_v0->unk28;
- temp_t0 = temp_v0->unkC4 + arg2;
- temp_v0->unkC4 = temp_t0;
- sp1C = temp_v0;
- sp24 = temp_f4;
- sp20 = temp_v0->unk30;
- temp_v0->unk28 = sins(temp_t0 & 0xFFFF) * arg1;
- temp_f2 = coss(temp_v0->unkC4) * arg1;
- temp_v0->unk30 = temp_f2;
- temp_v0->unk38 = temp_v0->unk28 - temp_f4;
- temp_v0->unk40 = temp_f2 - sp20;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088038.s")
-#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
@@ -742,23 +474,20 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088178.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80086FD4(); // extern
-extern ? D_80165C18;
-
-void func_80088228(s32 arg0) {
- void *temp_v0;
- void *temp_v1;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+void func_80088228(s32 objectIndex) {
+ s32 temp_v1;
+ struct_80165C18_entry *temp_v0;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v1 = temp_v0->unk80 + 2;
- temp_v0->unk96 = 0;
- temp_v0->unk7C = temp_v1;
- temp_v0->unk94 = temp_v1->unk-2;
- temp_v0->unk28 = temp_v1->unk0;
- temp_v0->unk2C = temp_v1->unk2;
- temp_v0->unk30 = temp_v1->unk4;
- func_80086FD4();
+ temp_v0 = &D_80165C18[objectIndex];
+ temp_v1 = temp_v0->unk_080 + 2;
+ temp_v0->unk_084[9] = 0;
+ temp_v0->unk_07C = temp_v1;
+ temp_v0->unk_084[8] = temp_v1->unk-2;
+ temp_v0->unk_028[0] = (f32) temp_v1->unk0;
+ temp_v0->unk_028[1] = (f32) temp_v1->unk2;
+ temp_v0->unk_028[2] = (f32) temp_v1->unk4;
+ func_80086FD4(objectIndex);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088228.s")
@@ -793,345 +522,321 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800882B0.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800876A0(s32); // extern
-? func_800880E4(); // extern
-? func_80088150(s32); // extern
-? func_80088178(s32, ?); // extern
-s32 func_800882B0(s32, ?); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_800880E4(); /* extern */
+? func_80088178(s32, ?); /* extern */
+s32 func_800882B0(s32, ?); /* extern */
-void func_80088364(s32 arg0) {
- u16 temp_t9;
- void *temp_v0;
+void func_80088364(s32 objectIndex) {
+ s16 temp_t9;
+ struct_80165C18_entry *temp_v0;
func_800880E4();
- func_80088178(arg0, 1);
- func_800876A0(arg0);
- if (func_800882B0(arg0, 0xA) != 0) {
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_t9 = temp_v0->unk96 + 1;
- temp_v0->unk96 = temp_t9;
- if (((temp_t9 & 0xFFFF) + 3) == temp_v0->unk94) {
- temp_v0->unkAE = temp_v0->unkAE + 1;
+ func_80088178(objectIndex, 1);
+ func_800876A0(objectIndex);
+ if (func_800882B0(objectIndex, 0xA) != 0) {
+ temp_v0 = &D_80165C18[objectIndex];
+ temp_t9 = (u16) temp_v0->unk_084[9] + 1;
+ temp_v0->unk_084[9] = temp_t9;
+ if (((temp_t9 & 0xFFFF) + 3) == (u16) temp_v0->unk_084[8]) {
+ temp_v0->unk_0AE += 1;
return;
}
- func_80088150(arg0);
- // Duplicate return node #4. Try simplifying control flow for better match
+ func_80088150(objectIndex);
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088364.s")
#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(?); // extern
-s32 func_8007223C(s32, ?); // extern
-f32 func_802ABE30(?32, ?, ?32, u16); // extern
-? func_802ADDC8(? *, ?, ?32, ?, ?32); // extern
-s16 atan2s(f32, f32); // extern
-extern ? D_80165C18;
-extern ? D_8018C3B0;
-
-s32 func_80088538(s32 arg0) {
+s32 func_80088538(s32 objectIndex) {
s32 sp2C;
- void *temp_s0;
sp2C = 0;
- func_800721E8(0x800000);
- if (func_8007223C(arg0, 0x400) != 0) {
- temp_s0 = (arg0 * 0xE0) + &D_80165C18;
- func_802ADDC8(&D_8018C3B0, 0x41200000, temp_s0->unk4, 0x41A00000, temp_s0->unkC);
- if (D_8018C3B0.unk4 == 1) {
+ func_800721E8(objectIndex, 0x00800000);
+ if (func_8007223C(objectIndex, 0x00000400) != 0) {
+ func_802ADDC8(&D_8018C3B0, 10.0f, D_80165C18[objectIndex].unk_004[0], 20.0f, D_80165C18[objectIndex].unk_004[2]);
+ if (D_8018C3B0.unk34 == 1) {
sp2C = 1;
- func_800721C0(arg0, 0x800000);
+ func_800721C0(objectIndex, 0x00800000);
}
- temp_s0->unk44 = func_802ABE30(temp_s0->unk4, 0, temp_s0->unkC, D_8018C3B0.unkA);
- temp_s0->unkB8 = atan2s(D_8018C3B0.unk38, D_8018C3B0.unk34) + 0x4000;
- temp_s0->unkBC = atan2s(D_8018C3B0.unk30, D_8018C3B0.unk34);
+ D_80165C18[objectIndex].unk_044 = func_802ABE30(D_80165C18[objectIndex].unk_004[0], 0.0f, D_80165C18[objectIndex].unk_004[2], D_8018C3B0.unk3A);
+ D_80165C18[objectIndex].unk_0B8[0] = atan2s(D_8018C3B0.unk60[2], D_8018C3B0.unk60[1]) + 0x4000;
+ D_80165C18[objectIndex].unk_0B8[2] = atan2s(D_8018C3B0.unk60[0], D_8018C3B0.unk60[1]);
}
return sp2C;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088538.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(?); // extern
-s32 func_8007223C(s32, ?); // extern
-f32 func_802ABE30(?32, ?, ?32, u16); // extern
-? func_802ADDC8(? *, ?, ?32, ?, ?32); // extern
-extern ? D_80165C18;
-extern ? D_8018C3B0;
-s32 func_8008861C(s32 arg0) {
+s32 func_8008861C(s32 objectIndex) {
s32 sp2C;
- void *temp_s0;
sp2C = 0;
- func_800721E8(0x800000);
- if (func_8007223C(arg0, 0x400) != 0) {
- temp_s0 = (arg0 * 0xE0) + &D_80165C18;
- func_802ADDC8(&D_8018C3B0, 0x41200000, temp_s0->unk4, 0x41A00000, temp_s0->unkC);
- if (D_8018C3B0.unk4 == 1) {
+ func_800721E8(objectIndex, 0x00800000);
+ if (func_8007223C(objectIndex, 0x00000400) != 0) {
+ func_802ADDC8(&D_8018C3B0, 10.0f, D_80165C18[objectIndex].unk_004[0], 20.0f, D_80165C18[objectIndex].unk_004[2]);
+ if (D_8018C3B0.unk34 == 1) {
sp2C = 1;
- func_800721C0(arg0, 0x800000);
+ func_800721C0(objectIndex, 0x00800000);
}
- temp_s0->unk44 = func_802ABE30(temp_s0->unk4, 0, temp_s0->unkC, D_8018C3B0.unkA);
- temp_s0->unk1C = D_8018C3B0.unk30;
- temp_s0->unk20 = D_8018C3B0.unk34;
- temp_s0->unk24 = D_8018C3B0.unk38;
+ D_80165C18[objectIndex].unk_044 = func_802ABE30(D_80165C18[objectIndex].unk_004[0], 0.0f, D_80165C18[objectIndex].unk_004[2], D_8018C3B0.unk3A);
+ D_80165C18[objectIndex].unk_01C[0] = D_8018C3B0.unk60[0];
+ D_80165C18[objectIndex].unk_01C[1] = D_8018C3B0.unk60[1];
+ D_80165C18[objectIndex].unk_01C[2] = D_8018C3B0.unk60[2];
}
return sp2C;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008861C.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-f32 func_802ABE30(?32, ?, ?32, u16); // extern
-? func_802ADDC8(? *, ?, ?32, ?, ?32); // extern
-s16 atan2s(f32, f32); // extern
-extern ? D_80165C18;
-extern ? D_8018C3B0;
-
-void func_800886F4(s32 arg0) {
- void *temp_s0;
-
- temp_s0 = (arg0 * 0xE0) + &D_80165C18;
- func_802ADDC8(&D_8018C3B0, 0x41200000, temp_s0->unk4, 0x41A00000, temp_s0->unkC);
- 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 = atan2s(D_8018C3B0.unk38, D_8018C3B0.unk34) + 0x4000;
- temp_s0->unkBC = atan2s(D_8018C3B0.unk30, D_8018C3B0.unk34);
+void func_800886F4(s32 objectIndex) {
+ func_802ADDC8(&D_8018C3B0, 10.0f, D_80165C18[objectIndex].unk_004[0], 20.0f, D_80165C18[objectIndex].unk_004[2]);
+ if (D_8018C3B0.unk34 == 1) {
+ func_800721C0(objectIndex, 0x00800000);
+ D_80165C18[objectIndex].unk_044 = func_802ABE30(D_80165C18[objectIndex].unk_004[0], 0.0f, D_80165C18[objectIndex].unk_004[2], D_8018C3B0.unk3A);
+ D_80165C18[objectIndex].unk_0B8[0] = atan2s(D_8018C3B0.unk60[2], D_8018C3B0.unk60[1]) + 0x4000;
+ D_80165C18[objectIndex].unk_0B8[2] = atan2s(D_8018C3B0.unk60[0], D_8018C3B0.unk60[1]);
return;
}
- func_800721E8(arg0, 0x800000);
+ func_800721E8(objectIndex, 0x00800000);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800886F4.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-f32 func_802ABE30(?32, ?, ?32, u16); // extern
-? func_802ADDC8(? *, ?, ?32, ?, ?32); // extern
-extern ? D_80165C18;
-extern ? D_8018C3B0;
-
-void func_800887C0(s32 arg0) {
- void *temp_s0;
-
- temp_s0 = (arg0 * 0xE0) + &D_80165C18;
- func_802ADDC8(&D_8018C3B0, 0x41200000, temp_s0->unk4, 0x41A00000, temp_s0->unkC);
- 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->unk38 = D_8018C3B0.unk30;
- temp_s0->unk3C = D_8018C3B0.unk34;
- temp_s0->unk40 = D_8018C3B0.unk38;
+void func_800887C0(s32 objectIndex) {
+ func_802ADDC8(&D_8018C3B0, 10.0f, D_80165C18[objectIndex].unk_004[0], 20.0f, D_80165C18[objectIndex].unk_004[2]);
+ if (D_8018C3B0.unk34 == 1) {
+ func_800721C0(objectIndex, 0x00800000);
+ D_80165C18[objectIndex].unk_044 = func_802ABE30(D_80165C18[objectIndex].unk_004[0], 0.0f, D_80165C18[objectIndex].unk_004[2], D_8018C3B0.unk3A);
+ D_80165C18[objectIndex].unk_038[0] = D_8018C3B0.unk60[0];
+ D_80165C18[objectIndex].unk_038[1] = D_8018C3B0.unk60[1];
+ D_80165C18[objectIndex].unk_038[2] = D_8018C3B0.unk60[2];
return;
}
- func_800721E8(arg0, 0x800000);
+ func_800721E8(objectIndex, 0x00800000);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800887C0.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+UNUSED s32 func_80088880(s32 objectIndex, Player *player) {
+ s32 temp_f10;
+ s32 temp_f6;
+
+ temp_f10 = D_80165C18[objectIndex].unk_004[0] - player->pos[0];
+ temp_f6 = D_80165C18[objectIndex].unk_004[2] - player->pos[2];
+ return (temp_f10 * temp_f10) + (temp_f6 * temp_f6);
+}
-s32 func_8008896C(s32 arg0, void *arg1) {
+UNUSED s32 func_800888E8(s32 objectIndex, Player *player) {
s32 temp_f10;
+ s32 temp_f18;
s32 temp_f6;
- void *temp_a2;
- temp_a2 = (arg0 * 0xE0) + &D_80165C18;
- temp_f10 = temp_a2->unk4 - arg1->unk0;
- temp_f6 = temp_a2->unkC - arg1->unk8;
+ temp_f10 = D_80165C18[objectIndex].unk_004[0] - player->pos[0];
+ temp_f6 = D_80165C18[objectIndex].unk_004[1] - player->pos[1];
+ temp_f18 = D_80165C18[objectIndex].unk_004[2] - player->pos[2];
+ return (temp_f10 * temp_f10) + (temp_f6 * temp_f6) + (temp_f18 * temp_f18);
+}
+
+u32 func_8008896C(s32 objectIndex, Camera *camera) {
+ s32 temp_f10;
+ s32 temp_f6;
+
+ temp_f10 = D_80165C18[objectIndex].unk_004[0] - camera->pos[0];
+ temp_f6 = D_80165C18[objectIndex].unk_004[2] - camera->pos[2];
return (temp_f10 * temp_f10) + (temp_f6 * temp_f6);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008896C.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+UNUSED s32 func_800889D4(s32 objectIndex, Camera *camera) {
+ s32 temp_f10;
+ s32 temp_f18;
+ s32 temp_f6;
-? func_80088A58(s32 arg0, void *arg1, f32 arg2) {
+ temp_f10 = D_80165C18[objectIndex].unk_004[0] - camera->pos[0];
+ temp_f6 = D_80165C18[objectIndex].unk_004[1] - camera->pos[1];
+ temp_f18 = D_80165C18[objectIndex].unk_004[2] - camera->pos[2];
+ return (temp_f10 * temp_f10) + (temp_f6 * temp_f6) + (temp_f18 * temp_f18);
+}
+
+s32 func_80088A58(s32 objectIndex, Player *player, f32 arg2) {
f32 temp_f0;
f32 temp_f2;
- void *temp_v0;
- ? phi_v1;
+ s32 var_v1;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_f0 = temp_v0->unk4 - arg1->unk14;
- temp_f2 = temp_v0->unkC - arg1->unk1C;
- phi_v1 = 0;
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[0] - player->pos[0];
+ temp_f2 = D_80165C18[objectIndex].unk_004[2] - player->pos[2];
if (((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) <= (arg2 * arg2)) {
- phi_v1 = 1;
+ var_v1 = 1;
}
- return phi_v1;
+ return var_v1;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088A58.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+s32 func_80088AC0(s32 objectIndex, Player *player, f32 arg2, f32 arg3) {
+ f32 temp_f0;
+ f32 temp_f12;
+ f32 temp_f2;
+ s32 var_v1;
-? func_80088BB8(s32 arg0, void *arg1, f32 arg2) {
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[0] - player->pos[0];
+ temp_f2 = D_80165C18[objectIndex].unk_004[2] - player->pos[2];
+ temp_f12 = (temp_f0 * temp_f0) + (temp_f2 * temp_f2);
+ if (((arg2 * arg2) <= temp_f12) && (temp_f12 <= (arg3 * arg3))) {
+ var_v1 = 1;
+ }
+ return var_v1;
+}
+
+s32 func_80088B40(s32 objectIndex, Player *player, f32 arg2) {
f32 temp_f0;
+ f32 temp_f12;
f32 temp_f2;
- void *temp_v0;
- ? phi_v1;
+ s32 var_v1;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_f0 = temp_v0->unk4 - arg1->unk0;
- temp_f2 = temp_v0->unkC - arg1->unk8;
- phi_v1 = 0;
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[0] - player->pos[0];
+ temp_f2 = D_80165C18[objectIndex].unk_004[1] - player->pos[1];
+ temp_f12 = D_80165C18[objectIndex].unk_004[2] - player->pos[2];
+ if (((temp_f0 * temp_f0) + (temp_f2 * temp_f2) + (temp_f12 * temp_f12)) <= (arg2 * arg2)) {
+ var_v1 = 1;
+ }
+ return var_v1;
+}
+
+s32 func_80088BB8(s32 objectIndex, Camera *camera, f32 arg2) {
+ f32 temp_f0;
+ f32 temp_f2;
+ s32 var_v1;
+
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[0] - camera->pos[0];
+ temp_f2 = D_80165C18[objectIndex].unk_004[2] - camera->pos[2];
if (((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) <= (arg2 * arg2)) {
- phi_v1 = 1;
+ var_v1 = 1;
}
- return phi_v1;
+ return var_v1;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088BB8.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+UNUSED s32 func_80088C20(s32 objectIndex, Camera *camera, f32 arg2, f32 arg3) {
+ f32 temp_f0;
+ f32 temp_f12;
+ f32 temp_f2;
+ s32 var_v1;
+
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[0] - camera->pos[0];
+ temp_f2 = D_80165C18[objectIndex].unk_004[2] - camera->pos[2];
+ temp_f12 = (temp_f0 * temp_f0) + (temp_f2 * temp_f2);
+ if (((arg2 * arg2) <= temp_f12) && (temp_f12 <= (arg3 * arg3))) {
+ var_v1 = 1;
+ }
+ return var_v1;
+}
-? func_80088D18(s32 arg0, void *arg1) {
+UNUSED s32 func_80088CA0(s32 objectIndex, Camera *camera, f32 arg2) {
f32 temp_f0;
f32 temp_f12;
- f32 temp_f18;
f32 temp_f2;
- u16 temp_t8;
- void *temp_v0;
- f32 phi_f18;
- ? phi_v1;
+ s32 var_v1;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_f0 = temp_v0->unk4 - arg1->unk14;
- temp_t8 = temp_v0->unkC8;
- temp_f2 = temp_v0->unkC - arg1->unk1C;
- temp_f18 = temp_t8;
- phi_f18 = temp_f18;
- phi_v1 = 0;
- if (temp_t8 < 0) {
- phi_f18 = temp_f18 + 4294967296.0f;
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[0] - camera->pos[0];
+ temp_f2 = D_80165C18[objectIndex].unk_004[1] - camera->pos[1];
+ temp_f12 = D_80165C18[objectIndex].unk_004[2] - camera->pos[2];
+ if (((temp_f0 * temp_f0) + (temp_f2 * temp_f2) + (temp_f12 * temp_f12)) <= (arg2 * arg2)) {
+ var_v1 = 1;
}
- temp_f12 = phi_f18 + arg1->unk70;
+ return var_v1;
+}
+
+s32 func_80088D18(s32 objectIndex, Player *player) {
+ f32 temp_f0;
+ f32 temp_f12;
+ f32 temp_f2;
+ f32 var_f18;
+ s32 var_v1;
+ u16 temp_t8;
+
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[0] - player->pos[0];
+ temp_f2 = D_80165C18[objectIndex].unk_004[2] - player->pos[2];
+ temp_f12 = D_80165C18[objectIndex].unk_0C8 + player->boundingBoxSize;
if (((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) <= (temp_f12 * temp_f12)) {
- phi_v1 = 1;
+ var_v1 = 1;
}
- return phi_v1;
+ return var_v1;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088D18.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
-
-? func_80088DA4(s32 arg0, void *arg1) {
+s32 func_80088DA4(s32 objectIndex, Player *player) {
f32 temp_f0;
f32 temp_f12;
f32 temp_f14;
f32 temp_f2;
- f32 temp_f6;
- u16 temp_t8;
- void *temp_v0;
- f32 phi_f6;
- ? phi_v1;
+ s32 var_v1;
+ struct_80165C18_entry *temp_v0;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_f0 = temp_v0->unk4 - arg1->unk14;
- temp_t8 = temp_v0->unkC8;
- temp_f2 = temp_v0->unk8 - arg1->unk18;
- temp_f12 = temp_v0->unkC - arg1->unk1C;
- temp_f6 = temp_t8;
- phi_f6 = temp_f6;
- phi_v1 = 0;
- if (temp_t8 < 0) {
- phi_f6 = temp_f6 + 4294967296.0f;
- }
- temp_f14 = phi_f6 + arg1->unk70;
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[0] - player->pos[0];
+ temp_f2 = D_80165C18[objectIndex].unk_004[1] - player->pos[1];
+ temp_f12 = D_80165C18[objectIndex].unk_004[2] - player->pos[2];
+ temp_f14 = D_80165C18[objectIndex].unk_0C8 + player->boundingBoxSize;
if (((temp_f0 * temp_f0) + (temp_f2 * temp_f2) + (temp_f12 * temp_f12)) <= (temp_f14 * temp_f14)) {
- phi_v1 = 1;
+ var_v1 = 1;
}
- return phi_v1;
+ return var_v1;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088DA4.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+UNUSED s32 func_80088E48(s32 objectIndex, Player *player, f32 arg2) {
+ f32 temp_f0;
+ s32 var_v1;
+
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[1] - player->pos[1];
+ if ((temp_f0 * temp_f0) <= (arg2 * arg2)) {
+ var_v1 = 1;
+ }
+ return var_v1;
+}
-? func_80088E98(s32 arg0, void *arg1, f32 arg2) {
+s32 func_80088E98(s32 objectIndex, Player *player, f32 arg2) {
f32 temp_f0;
f32 temp_f12;
f32 temp_f14;
- f32 temp_f2;
- void *temp_v0;
- f32 phi_f2;
- ? phi_v1;
+ f32 var_f2;
+ s32 var_v1;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_f0 = temp_v0->unk4 - arg1->unk14;
- temp_f12 = temp_v0->unkC - arg1->unk1C;
- temp_f2 = temp_v0->unk8 - arg1->unk18;
- temp_f14 = temp_v0->unkC8 + arg1->unk70;
- phi_f2 = temp_f2;
- phi_v1 = 0;
- if (temp_f2 < 0.0f) {
- phi_f2 = -temp_f2;
+ var_v1 = 0;
+ temp_f0 = D_80165C18[objectIndex].unk_004[0] - player->pos[0];
+ var_f2 = D_80165C18[objectIndex].unk_004[1] - player->pos[1];
+ temp_f12 = D_80165C18[objectIndex].unk_004[2] - player->pos[2];
+ temp_f14 = D_80165C18[objectIndex].unk_0C8 + player->boundingBoxSize;
+ if (var_f2 < 0.0f) {
+ var_f2 = -var_f2;
}
- if ((((temp_f0 * temp_f0) + (temp_f12 * temp_f12)) <= (temp_f14 * temp_f14)) && (phi_f2 <= arg2)) {
- phi_v1 = 1;
+ if ((((temp_f0 * temp_f0) + (temp_f12 * temp_f12)) <= (temp_f14 * temp_f14)) && (var_f2 <= arg2)) {
+ var_v1 = 1;
}
- return phi_v1;
+ return var_v1;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088E98.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C20;
+f32 func_80088F54(s32 objectIndex, Player *player) {
+ f32 var_f2;
-f32 func_80088F54(s32 arg0, void *arg1) {
- f32 temp_f2;
- f32 phi_f2;
+ var_f2 = D_80165C18[objectIndex].unk_004[1] - player->unk_074;
+ if (var_f2 < 0.0f) {
+ var_f2 = -var_f2;
+ }
+ return var_f2;
+}
+
+UNUSED s32 func_80088F94(s32 objectIndex, Player *player, f32 arg2) {
+ f32 var_f0;
+ s32 var_v1;
- temp_f2 = *(&D_80165C20 + (arg0 * 0xE0)) - arg1->unk74;
- phi_f2 = temp_f2;
- if (temp_f2 < 0.0f) {
- phi_f2 = -temp_f2;
+ var_f0 = D_80165C18[objectIndex].unk_004[1] - player->unk_074;
+ var_v1 = 0;
+ if (var_f0 < 0.0f) {
+ var_f0 = -var_f0;
+ }
+ if (var_f0 <= arg2) {
+ var_v1 = 1;
}
- return phi_f2;
+ return var_v1;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088F54.s")
-#endif
void func_80088FF0(Player *player) {
player->unk_08C = 0.0f;
@@ -1145,9 +850,11 @@ UNUSED void func_8008900C(Player *player) {
player->unk_09C = 0.0f;
}
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? f32_step_towards(f32, f32 *, f32, f32, f32 *); // extern
+#ifdef NEEDS_RODATA
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+extern Player *gPlayerOne;
+extern s16 gCurrentCourseId; /* unable to generate initializer */
+// These are all .rodata
extern f32 D_800EF4A0;
extern f32 D_800EF4A4;
extern f32 D_800EF4A8;
@@ -1163,87 +870,86 @@ extern f32 D_800EF4CC;
extern f32 D_800EF4D0;
extern f32 D_800EF4D4;
-void func_80089020(s32 arg0, f32 *arg1) {
- f32 temp_f0;
- f64 temp_f0_2;
- f64 temp_f0_3;
- f64 temp_f0_4;
- f64 temp_f0_5;
- f32 phi_f2;
- f32 phi_f0;
-
- temp_f0 = *arg1;
- if (temp_f0 >= 0.0f) {
- phi_f2 = temp_f0;
+void func_80089020(s32 playerId, f32 *arg1) {
+ f32 var_f0;
+ f32 var_f2;
+ Player *player = &gPlayerOne[playerId];
+
+ if (*arg1 >= 0.0f) {
+ var_f2 = *arg1;
} else {
- phi_f2 = -temp_f0;
- }
- if ((gPlayerOne[arg0].unk_0BC & 0xC0) != 0) {
- if (gCurrentCourseId == 0xC) {
- temp_f0_2 = phi_f2;
- if (temp_f0_2 <= 0.5) {
- phi_f0 = D_800EF4A0;
- } else if (temp_f0_2 <= 2.0) {
- phi_f0 = D_800EF4A4;
- } else if (temp_f0_2 <= 4.0) {
- phi_f0 = D_800EF4A8;
+ var_f2 = -*arg1;
+ }
+ if (player->unk_0BC & 0xC0) {
+ if (gCurrentCourseId == 0x000C) {
+ if (var_f2 <= 0.5) {
+ var_f0 = 0.025f;
+ } else if (var_f2 <= 2.0) {
+ var_f0 = 0.075f;
+ } else if (var_f2 <= 4.0) {
+ var_f0 = 0.15f;
} else {
- phi_f0 = 0.25f;
+ var_f0 = 0.25f;
}
} else {
- temp_f0_3 = phi_f2;
- if (temp_f0_3 <= 2.0) {
- phi_f0 = D_800EF4AC;
- } else if (temp_f0_3 <= 3.0) {
- phi_f0 = D_800EF4B0;
- } else if (temp_f0_3 <= 4.0) {
- phi_f0 = D_800EF4B4;
+ if (var_f2 <= 2.0) {
+ var_f0 = 0.1f;
+ } else if (var_f2 <= 3.0) {
+ var_f0 = 0.15f;
+ } else if (var_f2 <= 4.0) {
+ var_f0 = 0.2f;
} else {
- phi_f0 = 0.25f;
+ var_f0 = 0.25f;
}
}
- } else if (gCurrentCourseId == 0xC) {
- temp_f0_4 = phi_f2;
- if (temp_f0_4 <= 0.5) {
- phi_f0 = D_800EF4B8;
- } else if (temp_f0_4 <= 2.0) {
- phi_f0 = D_800EF4BC;
- } else if (temp_f0_4 <= 4.0) {
- phi_f0 = D_800EF4C0;
+ } else if (gCurrentCourseId == 0x000C) {
+ if (var_f2 <= 0.5) {
+ var_f0 = 0.025f;
+ } else if (var_f2 <= 2.0) {
+ var_f0 = 0.075f;
+ } else if (var_f2 <= 4.0) {
+ var_f0 = 0.1f;
} else {
- phi_f0 = D_800EF4C4;
+ var_f0 = 0.15f;
}
} else {
- temp_f0_5 = phi_f2;
- if (temp_f0_5 <= 2.0) {
- phi_f0 = D_800EF4C8;
- } else if (temp_f0_5 <= 3.0) {
- phi_f0 = D_800EF4CC;
- } else if (temp_f0_5 <= 4.0) {
- phi_f0 = D_800EF4D4;
+ if (var_f2 <= 2.0) {
+ var_f0 = 0.06f;
+ } else if (var_f2 <= 3.0) {
+ var_f0 = 0.07f;
+ } else if (var_f2 <= 4.0) {
+ var_f0 = 0.1f;
} else {
- phi_f0 = D_800EF4D0;
+ var_f0 = 0.075f;
}
}
- f32_step_towards(0.0f, arg1, 0.0f, phi_f0, arg1);
+ f32_step_towards(arg1, 0.0f, var_f0);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80089020.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80089020(f32 *, f32 *); // extern
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+typedef struct {
+ /* 0x00 */ char pad0[4];
+ /* 0x04 */ f32 unk_04;
+ /* 0x08 */ char pad8[4];
+ /* 0x0C */ f32 unk_0C;
+ /* 0x10 */ char pad10[0xE]; /* maybe part of unk_0C[4]? */
+ /* 0x1E */ s8 unk1E; /* inferred */
+ /* 0x1F */ char pad1F[1];
+} struct_D_8018CE10; /* size = 0x20 */
-void func_800892E0(s32 arg0) {
+void func_800892E0(s32 objectIndex) {
struct_D_8018CE10 *sp1C;
s8 temp_v1;
struct_D_8018CE10 *temp_v0;
- temp_v0 = &D_8018CE10[arg0];
+ temp_v0 = &D_8018CE10[objectIndex];
sp1C = temp_v0;
- func_80089020(&temp_v0->unk_04);
- func_80089020(arg0, &temp_v0->unk_0C);
+ func_80089020(objectIndex, &temp_v0->unk_04);
+ func_80089020(objectIndex, &temp_v0->unk_0C);
temp_v1 = temp_v0->unk1E;
if (temp_v1 > 0) {
temp_v0->unk1E = temp_v1 - 1;
@@ -1254,42 +960,41 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_800892E0.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-f32 func_8008933C(void *arg0, s32 arg1, f32 arg2, f32 arg3) {
+f32 func_8008933C(Player *player, s32 objectIndex, f32 arg2, f32 arg3) {
f32 temp_f0;
f32 temp_f12;
f32 temp_f2;
f32 temp_f2_2;
+ f32 var_f2;
+ struct_80165C18_entry *temp_v0;
struct_D_8018CE10 *temp_v1;
- void *temp_v0;
- f32 phi_f2;
- temp_v1 = &D_8018CE10[(arg0 - gPlayerOne) / 0xDD8];
- phi_f2 = 0.0f;
+ temp_v1 = &D_8018CE10[(s32) (player - gPlayerOne) / 3544];
+ var_f2 = 0.0f;
if (temp_v1->unk1E == 0) {
- arg0->unk46 = arg0->unk46 | 2;
- arg0->unkBC = arg0->unkBC | 0x8000;
+ player->unk_046 |= 2;
+ player->unk_0BC |= 0x8000;
temp_v1->unk1E = 4;
- temp_v0 = (arg1 * 0xE0) + &D_80165C18;
- temp_f2 = temp_v0->unk38;
- if ((temp_f2 * (arg0->unk14 - temp_v0->unk4)) >= 0.0f) {
- temp_v1->unk_04 = (temp_f2 * arg3) + (-arg0->unk34 * arg2);
+ temp_v0 = &D_80165C18[objectIndex];
+ temp_f2 = temp_v0->unk_038[0];
+ if ((temp_f2 * (player->pos[0] - temp_v0->unk_004[0])) >= 0.0f) {
+ temp_v1->unk_04 = (temp_f2 * arg3) + (-player->unk_034[0] * arg2);
} else {
- temp_v1->unk_04 = -arg0->unk34 * arg2;
+ temp_v1->unk_04 = -player->unk_034[0] * arg2;
}
- temp_f2_2 = temp_v0->unk40;
- if ((temp_f2_2 * (arg0->unk1C - temp_v0->unkC)) >= 0.0f) {
- temp_v1->unk_0C = (temp_f2_2 * arg3) + (-arg0->unk3C * arg2);
+ temp_f2_2 = temp_v0->unk_038[2];
+ if ((temp_f2_2 * (player->pos[2] - temp_v0->unk_004[2])) >= 0.0f) {
+ temp_v1->unk_0C = (temp_f2_2 * arg3) + (-player->unk_034[2] * arg2);
} else {
- temp_v1->unk_0C = -arg0->unk3C * arg2;
+ temp_v1->unk_0C = -player->unk_034[2] * arg2;
}
temp_f0 = temp_v1->unk_0C;
temp_f12 = temp_v1->unk_04;
- phi_f2 = (temp_f0 * temp_f0) + (temp_f12 * temp_f12);
+ var_f2 = (temp_f0 * temp_f0) + (temp_f12 * temp_f12);
}
- return phi_f2;
+ return var_f2;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008933C.s")
@@ -1318,53 +1023,40 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80089474.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80072180(); // extern
-? func_800721C0(s32, ?); // extern
-? func_800721E8(?); // extern
-s32 func_8007223C(s32, ?); // extern
-s32 func_80088D18(s32, Player *); // extern
-f32 func_8008933C(Player *, s32, ?, f32); // extern
-? func_800C9060(s32, ?); // extern
-extern f64 D_800EF4E0;
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_80072180(); /* extern */
+f32 func_8008933C(Player *, s32, s32, f32); /* extern */
extern s32 D_8018D158;
-void func_80089820(s32 arg0, ? arg1, f32 arg2, ? arg3) {
- Player *temp_s0;
- f32 temp_f20;
- s32 temp_s1;
+void func_80089820(s32 objectIndex, s32 arg1, f32 arg2, u32 arg3) {
+ Player *var_s0;
+ s32 var_s1;
u16 temp_v0;
- Player *phi_s0;
- s32 phi_s1;
- temp_s0 = gPlayerOne;
- func_800721E8(0x2000000);
- if (func_8007223C(arg0, 0x200) != 0) {
- phi_s1 = 0;
+ var_s0 = gPlayerOne;
+ func_800721E8(objectIndex, 0x02000000);
+ if (func_8007223C(objectIndex, 0x00000200) != 0) {
+ var_s1 = 0;
if (D_8018D158 > 0) {
- phi_s0 = temp_s0;
do {
- if ((((arg0 * 0xE0) + &D_80165C18)->unkA6 != 0) && ((phi_s0->unk_0BC & 0x80000000) == 0)) {
- temp_v0 = phi_s0->unk_000;
- if (((temp_v0 & 0x8000) != 0) && ((temp_v0 & 0x100) == 0) && (func_80088D18(arg0, phi_s0) != 0)) {
- if ((phi_s0->unk_0BC & 0x200) != 0) {
- func_800721C0(arg0, 0x2000000);
+ if ((D_80165C18[objectIndex].unk_0A6 != 0) && !(var_s0->unk_0BC & 0x80000000)) {
+ temp_v0 = var_s0->unk_000;
+ if ((temp_v0 & 0x8000) && !(temp_v0 & 0x100) && (func_80088D18(objectIndex, var_s0) != 0)) {
+ if (var_s0->unk_0BC & 0x200) {
+ func_800721C0(objectIndex, 0x02000000);
} else {
- temp_f20 = arg2 * D_800EF4E0;
- if (func_8007223C(arg0, 0x4000000) != 0) {
+ if (func_8007223C(objectIndex, 0x04000000) != 0) {
func_80072180();
}
- if ((func_8008933C(phi_s0, arg0, arg1, temp_f20) >= 4.0) && ((phi_s0->unk_000 & 0x1000) != 0x1000)) {
- func_800C9060(phi_s1 & 0xFF, arg3);
+ if (((f64) func_8008933C(var_s0, objectIndex, arg1, (f32) ((f64) arg2 * 1.1)) >= 4.0) && ((var_s0->unk_000 & 0x1000) != 0x1000)) {
+ func_800C9060(var_s1 & 0xFF, arg3);
}
}
}
}
- temp_s1 = phi_s1 + 1;
- phi_s0 += 0xDD8;
- phi_s1 = temp_s1;
- } while (temp_s1 < D_8018D158);
+ var_s1 += 1;
+ var_s0 += 0xDD8;
+ } while (var_s1 < D_8018D158);
}
}
}
@@ -1373,39 +1065,29 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80089820.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80072180(); // extern
-s32 func_8007223C(s32, ?); // extern
-s32 func_80088DA4(s32, Player *); // extern
-? func_8008933C(Player *, s32, ?, f32); // extern
-extern f64 D_800EF4E8;
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_80072180(); /* extern */
+? func_8008933C(Player *, s32, s32, f32); /* extern */
extern s32 D_8018D158;
-void func_80089A04(s32 arg0, ? arg1, f32 arg2) {
- Player *temp_s0;
- f64 temp_f20;
- s32 temp_s1;
- Player *phi_s0;
- s32 phi_s1;
+void func_80089A04(s32 objectIndex, s32 arg1, f32 arg2) {
+ Player *var_s0;
+ s32 var_s1;
- temp_s0 = gPlayerOne;
- if (func_8007223C(0x200) != 0) {
- phi_s1 = 0;
+ var_s0 = gPlayerOne;
+ if (func_8007223C(objectIndex, 0x00000200) != 0) {
+ var_s1 = 0;
if (D_8018D158 > 0) {
- temp_f20 = D_800EF4E8;
- phi_s0 = temp_s0;
do {
- if ((((arg0 * 0xE0) + &D_80165C18)->unkA6 != 0) && ((phi_s0->unk_0BC & 0x80000200) == 0) && (func_80088DA4(arg0, phi_s0) != 0)) {
- func_8008933C(phi_s0, arg0, arg1, arg2 * temp_f20);
- if (func_8007223C(arg0, 0x4000000) != 0) {
+ if ((D_80165C18[objectIndex].unk_0A6 != 0) && !(var_s0->unk_0BC & 0x80000200) && (func_80088DA4(objectIndex, var_s0) != 0)) {
+ func_8008933C(var_s0, objectIndex, arg1, (f32) ((f64) arg2 * 1.1));
+ if (func_8007223C(objectIndex, 0x04000000) != 0) {
func_80072180();
}
}
- temp_s1 = phi_s1 + 1;
- phi_s0 += 0xDD8;
- phi_s1 = temp_s1;
- } while (temp_s1 < D_8018D158);
+ var_s1 += 1;
+ var_s0 += 0xDD8;
+ } while (var_s1 < D_8018D158);
}
}
}
@@ -1414,50 +1096,42 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80089A04.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80072180(); // extern
-s32 func_8007223C(s32, ?); // extern
-s32 func_80088D18(s32, Player *); // extern
-? func_800C9060(s32, ?); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_80072180(); /* extern */
extern s32 D_8018D158;
-s32 func_80089B50(s32 arg0) {
+s32 func_80089B50(s32 objectIndex) {
s32 sp40;
- Player *temp_s0;
- s32 temp_s2;
+ Player *var_s0;
+ s32 var_s1;
+ s32 var_s2;
u16 temp_v0;
- Player *phi_s0;
- s32 phi_s1;
- s32 phi_s2;
+ var_s1 = 0;
sp40 = 0;
- temp_s0 = gPlayerOne;
- phi_s1 = 0;
- if (func_8007223C(0x200) != 0) {
- phi_s2 = 0;
+ var_s0 = gPlayerOne;
+ if (func_8007223C(objectIndex, 0x00000200) != 0) {
+ var_s2 = 0;
if (D_8018D158 > 0) {
- phi_s0 = temp_s0;
do {
- if ((((arg0 * 0xE0) + &D_80165C18)->unkA6 != 0) && ((phi_s0->unk_0BC & 0x81000000) == 0)) {
- temp_v0 = phi_s0->unk_000;
- if (((temp_v0 & 0x8000) != 0) && ((temp_v0 & 0x100) == 0) && (func_80088D18(arg0, phi_s0) != 0)) {
+ if ((D_80165C18[objectIndex].unk_0A6 != 0) && !(var_s0->unk_0BC & 0x81000000)) {
+ temp_v0 = var_s0->unk_000;
+ if ((temp_v0 & 0x8000) && !(temp_v0 & 0x100) && (func_80088D18(objectIndex, var_s0) != 0)) {
sp40 = 1;
- if ((phi_s0->unk_0BC & 0x200) == 0) {
- phi_s0->unk_00C |= 0x400000;
- if (func_8007223C(arg0, 0x4000000) != 0) {
+ if (!(var_s0->unk_0BC & 0x200)) {
+ var_s0->unk_00C |= 0x400000;
+ if (func_8007223C(objectIndex, 0x04000000) != 0) {
func_80072180();
}
} else {
- func_800C9060(phi_s1 & 0xFF, 0x19018010);
+ func_800C9060(var_s1 & 0xFF, 0x19018010U);
}
}
}
- temp_s2 = phi_s2 + 1;
- phi_s0 += 0xDD8;
- phi_s1 += 1;
- phi_s2 = temp_s2;
- } while (temp_s2 < D_8018D158);
+ var_s2 += 1;
+ var_s0 += 0xDD8;
+ var_s1 += 1;
+ } while (var_s2 < D_8018D158);
}
}
return sp40;
@@ -1467,403 +1141,256 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80089B50.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80072180(); // extern
-s32 func_8007223C(s32, ?); // extern
-s32 func_80088E98(s32, Player *, ?); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_80072180(); /* extern */
extern s32 D_8018D158;
-? func_80089CBC(s32 arg0, ? arg1) {
- Player *temp_s0;
- s32 temp_s1;
+s32 func_80089CBC(s32 objectIndex, f32 arg1) {
+ Player *var_s0;
+ s32 var_s1;
+ s32 var_s7;
u16 temp_v0;
- Player *phi_s0;
- s32 phi_s1;
- ? phi_s7;
- ? phi_s7_2;
-
- temp_s0 = gPlayerOne;
- phi_s7 = 0;
- phi_s7_2 = 0;
- if (func_8007223C(0x200) != 0) {
- phi_s1 = 0;
+
+ var_s7 = 0;
+ var_s0 = gPlayerOne;
+ if (func_8007223C(objectIndex, 0x00000200) != 0) {
+ var_s1 = 0;
if (D_8018D158 > 0) {
- phi_s0 = temp_s0;
do {
- if ((((arg0 * 0xE0) + &D_80165C18)->unkA6 != 0) && ((phi_s0->unk_0BC & 0x81000000) == 0)) {
- temp_v0 = phi_s0->unk_000;
- if (((temp_v0 & 0x8000) != 0) && ((temp_v0 & 0x100) == 0) && (func_80088E98(arg0, phi_s0, arg1) != 0)) {
- phi_s7_2 = 1;
- if ((phi_s0->unk_0BC & 0x200) == 0) {
- phi_s0->unk_00C |= 0x400000;
- if (func_8007223C(arg0, 0x4000000) != 0) {
+ if ((D_80165C18[objectIndex].unk_0A6 != 0) && !(var_s0->unk_0BC & 0x81000000)) {
+ temp_v0 = var_s0->unk_000;
+ if ((temp_v0 & 0x8000) && !(temp_v0 & 0x100) && (func_80088E98(objectIndex, var_s0, arg1) != 0)) {
+ var_s7 = 1;
+ if (!(var_s0->unk_0BC & 0x200)) {
+ var_s0->unk_00C |= 0x400000;
+ if (func_8007223C(objectIndex, 0x04000000) != 0) {
func_80072180();
}
}
}
}
- temp_s1 = phi_s1 + 1;
- phi_s0 += 0xDD8;
- phi_s1 = temp_s1;
- phi_s7 = phi_s7_2;
- } while (temp_s1 < D_8018D158);
+ var_s1 += 1;
+ var_s0 += 0xDD8;
+ } while (var_s1 < D_8018D158);
}
}
- return phi_s7;
+ return var_s7;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80089CBC.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80072180(); // extern
-s32 func_8007223C(s32, ?); // extern
-s32 func_80088D18(s32, Player *); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_80072180(); /* extern */
extern s32 D_8018D158;
-? func_80089F24(s32 arg0) {
- Player *temp_s0;
- s32 temp_s1;
+s32 func_80089F24(s32 objectIndex) {
+ Player *var_s0;
+ s32 var_s1;
+ s32 var_s7;
u16 temp_v0;
- Player *phi_s0;
- s32 phi_s1;
- ? phi_s7;
- ? phi_s7_2;
-
- temp_s0 = gPlayerOne;
- phi_s7 = 0;
- phi_s7_2 = 0;
- if (func_8007223C(0x200) != 0) {
- phi_s1 = 0;
+
+ var_s7 = 0;
+ var_s0 = gPlayerOne;
+ if (func_8007223C(objectIndex, 0x00000200) != 0) {
+ var_s1 = 0;
if (D_8018D158 > 0) {
- phi_s0 = temp_s0;
do {
- if ((((arg0 * 0xE0) + &D_80165C18)->unkA6 != 0) && ((phi_s0->unk_0BC & 0x800002C0) == 0)) {
- temp_v0 = phi_s0->unk_000;
- if (((temp_v0 & 0x8000) != 0) && ((temp_v0 & 0x100) == 0) && (func_80088D18(arg0, phi_s0) != 0)) {
- phi_s7_2 = 1;
- if (func_8007223C(arg0, 0x4000000) != 0) {
+ if ((D_80165C18[objectIndex].unk_0A6 != 0) && !(var_s0->unk_0BC & 0x800002C0)) {
+ temp_v0 = var_s0->unk_000;
+ if ((temp_v0 & 0x8000) && !(temp_v0 & 0x100) && (func_80088D18(objectIndex, var_s0) != 0)) {
+ var_s7 = 1;
+ if (func_8007223C(objectIndex, 0x04000000) != 0) {
func_80072180();
}
- phi_s0->unk_00C |= 0x200000;
+ var_s0->unk_00C |= 0x200000;
}
}
- temp_s1 = phi_s1 + 1;
- phi_s0 += 0xDD8;
- phi_s1 = temp_s1;
- phi_s7 = phi_s7_2;
- } while (temp_s1 < D_8018D158);
+ var_s1 += 1;
+ var_s0 += 0xDD8;
+ } while (var_s1 < D_8018D158);
}
}
- return phi_s7;
+ return var_s7;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80089F24.s")
#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165CD8;
-
-? func_8008A060(s32 arg0, void *arg1, s32 arg2) {
- s32 temp_t3;
- s32 temp_t6;
- ? phi_v1;
+s32 func_8008A060(s32 objectIndex, Camera *camera, u16 arg2) {
+ u16 temp_t3;
+ s32 var_v1;
- temp_t6 = arg2 & 0xFFFF;
- temp_t3 = ((arg1->unk26 - *(&D_80165CD8 + (arg0 * 0xE0))) + (temp_t6 >> 1)) & 0xFFFF;
- phi_v1 = 0;
- if ((temp_t3 >= 0) && (temp_t6 >= temp_t3)) {
- phi_v1 = 1;
+ var_v1 = 0;
+ temp_t3 = (((u16)camera->rot[1] - D_80165C18[objectIndex].unk_0C0) + (arg2 >> 1));
+ if ((temp_t3 >= 0) && (arg2 >= temp_t3)) {
+ var_v1 = 1;
}
- return phi_v1;
+ return var_v1;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A060.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 atan2s(f32, f32); // extern
-extern ? D_80165C18;
-
-s32 func_8008A0B4(s32 arg0, void *arg1, void *arg2, u16 arg3) {
- s32 sp18;
- s32 temp_t3;
- void *temp_v0;
- s32 phi_t0;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- sp18 = 0;
- temp_t3 = ((arg2->unk26 - atan2s(temp_v0->unk4 - arg1->unk14, temp_v0->unkC - arg1->unk1C)) + (arg3 >> 1)) & 0xFFFF;
- phi_t0 = sp18;
+s32 func_8008A0B4(s32 objectIndex, Player *player, Camera *camera, u16 arg3) {
+ u16 temp_t3;
+ f32 x_diff;
+ f32 z_diff;
+ s32 var_t0;
+
+ var_t0 = 0;
+ x_diff = D_80165C18[objectIndex].unk_004[0] - player->pos[0];
+ z_diff = D_80165C18[objectIndex].unk_004[2] - player->pos[2];
+ temp_t3 = ((u16) camera->rot[1] - atan2s(x_diff, z_diff)) + (arg3 >> 1);
if ((temp_t3 >= 0) && (arg3 >= temp_t3)) {
- phi_t0 = 1;
+ var_t0 = 1;
}
- return phi_t0;
+ return var_t0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A0B4.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_80041770(f32, f32, s32, s32); // extern
-extern ? D_80165C18;
-s32 func_8008A140(s32 arg0, void *arg1, u16 arg2) {
- s32 sp18;
- s32 temp_t2;
- void *temp_v0;
- s32 phi_t0;
+s32 func_8008A140(s32 objectIndex, Camera *camera, u16 arg2) {
+ u16 temp_t2;
+ s32 var_t0;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- sp18 = 0;
- temp_t2 = ((func_80041770(arg1->unk0, temp_v0->unk4, arg1->unk8, temp_v0->unkC) + (arg2 / 2)) - arg1->unk26) & 0xFFFF;
- phi_t0 = sp18;
+ var_t0 = 0;
+ temp_t2 = (func_80041770(camera->pos[0], D_80165C18[objectIndex].unk_004[0], camera->pos[2], D_80165C18[objectIndex].unk_004[2]) + ((s32) arg2 / 2)) - camera->rot[1];
if ((temp_t2 >= 0) && (arg2 >= temp_t2)) {
- phi_t0 = 1;
+ var_t0 = 1;
}
- return phi_t0;
+ return var_t0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A140.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(?); // extern
-u32 func_8008896C(s32, s32); // extern
-s32 func_8008A140(s32, s32, ?); // extern
+void func_8008A1D0(s32 objectIndex, s32 cameraId, s32 arg2, s32 arg3) {
+ s32 temp_v0;
+ u16 var_a2;
+ Camera *camera;
-void func_8008A1D0(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
- u32 sp2C;
- s32 sp24;
- u32 temp_v0;
- ? phi_a2;
-
- sp24 = (arg1 * 0xB8) + camera1;
- func_800721E8(0x140000);
- temp_v0 = func_8008896C(arg0, sp24);
- if (temp_v0 < 0x2711) {
- phi_a2 = 0x5555;
+ camera = &camera1[cameraId];
+ func_800721E8(objectIndex, 0x00140000);
+ temp_v0 = func_8008896C(objectIndex, camera);
+ if (temp_v0 < 0x2711U) {
+ var_a2 = 0x5555;
+ } else if (temp_v0 < 0x9C41U) {
+ var_a2 = 0x4000;
} else {
- phi_a2 = 0x2AAB;
- if (temp_v0 < 0x9C41) {
- phi_a2 = 0x4000;
- }
+ var_a2 = 0x2AAB;
}
- sp2C = temp_v0;
- if ((func_8008A140(arg0, sp24, phi_a2) != 0) && ((arg3 * arg3) >= temp_v0)) {
- sp2C = temp_v0;
- func_800721C0(arg0, 0x40000);
- if (temp_v0 >= (arg2 * arg2)) {
- func_800721C0(arg0, 0x100000);
+ if ((func_8008A140(objectIndex, camera, var_a2) != 0) && ((u32) (arg3 * arg3) >= temp_v0)) {
+ func_800721C0(objectIndex, 0x00040000);
+ if (temp_v0 >= (u32) (arg2 * arg2)) {
+ func_800721C0(objectIndex, 0x00100000);
}
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A1D0.s")
-#endif
-#ifdef MIPS_TO_C
-void func_8008A2CC(s32 arg0, s32 arg1, u16 arg2) {
- Camera sp1C;
+// This function is really cool, it tests the value of an unitialized local variable
+UNUSED void func_8008A2CC(s32 objectIndex, s32 cameraId, u16 arg2) {
+ Camera *camera;
+ u32 no_init;
u16 var_a2;
- // camera1[arg1]? m2c said this, but makes no sense. camera1->unk000 = arg1? would make sense.
- sp1C = cameras[arg1];
- func_800721E8(0x40000);
- if (sp18 < 0x2711U) {
+
+ camera = &camera1[cameraId];
+ func_800721E8(objectIndex, 0x00040000);
+ if (no_init < 0x2711U) {
var_a2 = 0x5555;
+ } else if (no_init < 0x9C41U) {
+ var_a2 = 0x4000;
} else {
var_a2 = arg2;
- if (sp18 < 0x9C41U) {
- var_a2 = 0x4000;
- }
}
- if (func_8008A140(arg0, sp1C, var_a2) != 0) {
- func_800721C0(arg0, 0x40000);
+ if (func_8008A140(objectIndex, camera, var_a2) != 0) {
+ func_800721C0(objectIndex, 0x00040000);
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A2CC.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(?); // extern
-u32 func_8008896C(s32, s32); // extern
-s32 func_8008A140(s32, s32, u16); // extern
+u32 func_8008A364(s32 objectIndex, s32 cameraId, u16 arg2, s32 arg3) {
+ Camera *camera;
+ u32 var_v1;
+ u16 var_a2;
-u32 func_8008A364(s32 arg0, s32 arg1, u16 arg2, s32 arg3) {
- s32 sp24;
- u32 sp20;
- u32 temp_v0;
- u16 phi_a2;
- u32 phi_v1;
-
- sp24 = (arg1 * 0xB8) + camera1;
- func_800721E8(0x60000);
- temp_v0 = func_8008896C(arg0, sp24);
- phi_v1 = temp_v0;
- if (temp_v0 < (arg3 * arg3)) {
- sp20 = temp_v0;
- func_800721C0(arg0, 0x20000);
- if (sp20 < 0x2711) {
- phi_a2 = 0x5555;
+ camera = &camera1[cameraId];
+ func_800721E8(objectIndex, 0x00060000);
+ var_v1 = func_8008896C(objectIndex, camera);
+ if (var_v1 < (arg3 * arg3)) {
+ func_800721C0(objectIndex, 0x00020000);
+ if (var_v1 < 0x2711U) {
+ var_a2 = 0x5555;
+ } else if (var_v1 < 0x9C41U) {
+ var_a2 = 0x4000;
} else {
- phi_a2 = arg2;
- if (sp20 < 0x9C41) {
- phi_a2 = 0x4000;
- }
+ var_a2 = arg2;
}
- sp20 = sp20;
- phi_v1 = sp20;
- if (func_8008A140(arg0, sp24, phi_a2) != 0) {
- sp20 = sp20;
- func_800721C0(arg0, 0x40000);
- phi_v1 = sp20;
+ if (func_8008A140(objectIndex, camera, var_a2) != 0) {
+ func_800721C0(objectIndex, 0x00040000);
}
}
- return phi_v1;
+ return var_v1;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A364.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(s32, ?); // extern
-u32 func_8008896C(s32); // extern
-void func_8008A454(s32 arg0, s32 arg1, s32 arg2) {
- if (func_8008896C((arg1 * 0xB8) + camera1) < (arg2 * arg2)) {
- func_800721C0(arg0, 0x20);
- return;
+void func_8008A454(s32 objectIndex, s32 cameraId, s32 arg2) {
+ if (func_8008896C(objectIndex, &camera1[cameraId]) < (u32) (arg2 * arg2)) {
+ func_800721C0(objectIndex, 0x00000020);
+ } else {
+ func_800721E8(objectIndex, 0x00000020);
}
- func_800721E8(arg0, 0x20);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A454.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(?); // extern
-s32 func_8008A140(s32, s32, ?); // extern
-extern ? D_80165C18;
-extern ? D_8018CF68;
+void func_8008A4CC(s32 objectIndex) {
+ s32 loopIndex;
+ Camera *camera;
-void func_8008A4CC(s32 arg0) {
- s16 *temp_s0;
- s16 temp_v0;
- s32 temp_s2;
- u8 temp_v1;
- void *temp_s3;
- s32 phi_s2;
- s32 phi_s4;
-
- func_800721E8(0x70000);
- phi_s2 = 0;
- phi_s4 = camera1;
- if (gPlayerCountSelection1 > 0) {
- temp_s3 = (arg0 * 0xE0) + &D_80165C18;
- do {
- temp_s0 = &D_8018CF68 + (phi_s2 * 2);
- if (temp_s3->unkA6 != 0) {
- temp_v1 = temp_s3->unkDF;
- temp_v0 = *temp_s0;
- if ((temp_v0 >= (temp_v1 - 1)) && ((temp_v1 + 1) >= temp_v0)) {
- func_800721C0(arg0, 0x10000);
- if (*temp_s0 == temp_s3->unkDF) {
- func_800721C0(arg0, 0x20000);
- }
- if (func_8008A140(arg0, phi_s4, 0x2AAB) != 0) {
- func_800721C0(arg0, 0x40000);
- }
+ func_800721E8(objectIndex, 0x00070000);
+ for (loopIndex = 0, camera = camera1; loopIndex < gPlayerCountSelection1; loopIndex++, camera++) {
+ if (D_80165C18[objectIndex].unk_0A6 != 0) {
+ if ((D_8018CF68[loopIndex] >= (D_80165C18[objectIndex].unk_0DF - 1)) && ((D_80165C18[objectIndex].unk_0DF + 1) >= D_8018CF68[loopIndex])) {
+ func_800721C0(objectIndex, 0x00010000);
+ if (D_8018CF68[loopIndex] == D_80165C18[objectIndex].unk_0DF) {
+ func_800721C0(objectIndex, 0x00020000);
+ }
+ if (func_8008A140(objectIndex, camera, 0x2AABU) != 0) {
+ func_800721C0(objectIndex, 0x00040000);
}
}
- temp_s2 = phi_s2 + 1;
- phi_s2 = temp_s2;
- phi_s4 += 0xB8;
- } while (temp_s2 < gPlayerCountSelection1);
+ }
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A4CC.s")
-#endif
-#ifdef MIPS_TO_C
-void func_8008A610(s32 arg0) {
- s32 var_s0;
- s32 var_s1;
+UNUSED void func_8008A610(s32 objectIndex) {
+ s32 loopIndex;
+ Camera *camera;
- func_800721E8(0x40000);
- var_s0 = camera1;
- var_s1 = 0;
- if (gPlayerCountSelection1 > 0) {
- do {
- if ((((arg0 * 0xE0) + &D_80165C18)->unkA6 != 0) && (func_8008A140(arg0, var_s0, 0x2AAB) != 0)) {
- func_800721C0(arg0, 0x40000);
- }
- var_s1 += 1;
- var_s0 += 0xB8;
- } while (var_s1 < gPlayerCountSelection1);
+ func_800721E8(objectIndex, 0x00040000);
+ for (camera = camera1, loopIndex = 0; loopIndex < gPlayerCountSelection1; loopIndex++, camera++) {
+ if ((D_80165C18[objectIndex].unk_0A6 != 0) && (func_8008A140(objectIndex, camera, 0x2AABU) != 0)) {
+ func_800721C0(objectIndex, 0x00040000);
+ }
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A610.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-? func_800721E8(?); // extern
-s32 func_80088BB8(s32, s32, f32); // extern
-s32 func_8008A140(s32, s32, ?); // extern
-extern f64 D_800EF4F0;
-extern ? D_80165C18;
-
-void func_8008A6DC(s32 arg0, f32 arg1) {
- f64 temp_f22;
- s32 temp_s2;
- s32 phi_s1;
- ? phi_a2;
- s32 phi_s2;
-
- func_800721E8(0x60000);
- phi_s1 = camera1;
- phi_s2 = 0;
- if (gPlayerCountSelection1 > 0) {
- temp_f22 = D_800EF4F0;
- do {
- if ((((arg0 * 0xE0) + &D_80165C18)->unkA6 != 0) && (func_80088BB8(arg0, phi_s1, arg1) != 0)) {
- func_800721C0(arg0, 0x20000);
- phi_a2 = 0x2AAB;
- if (arg1 <= temp_f22) {
- phi_a2 = 0x4000;
- }
- if (func_8008A140(arg0, phi_s1, phi_a2) != 0) {
- func_800721C0(arg0, 0x40000);
- }
+#ifdef NEEDS_RODATA
+extern f64 D_800EF4F0;// = 500.0;
+void func_8008A6DC(s32 objectIndex, f32 arg1) {
+ u16 var_a2;
+ s32 loopIndex;
+ Camera *camera;
+
+ func_800721E8(objectIndex, 0x00060000);
+ for (camera = camera1, loopIndex = 0; loopIndex < gPlayerCountSelection1; loopIndex++, camera++) {
+ if ((D_80165C18[objectIndex].unk_0A6 != 0) && (func_80088BB8(objectIndex, camera, arg1) != 0)) {
+ func_800721C0(objectIndex, 0x00020000);
+ if (arg1 <= 500.0) {
+ var_a2 = 0x4000;
+ } else {
+ var_a2 = 0x2AAB;
}
- temp_s2 = phi_s2 + 1;
- phi_s1 += 0xB8;
- phi_s2 = temp_s2;
- } while (temp_s2 < gPlayerCountSelection1);
+ if (func_8008A140(objectIndex, camera, var_a2) != 0) {
+ func_800721C0(objectIndex, 0x00040000);
+ }
+ }
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A6DC.s")
#endif
-void func_8008A6DC(s32, f32);
+
UNUSED void func_8008A810(s32 arg0) {
func_8008A6DC(arg0, 500.0f);
}
@@ -1876,17 +1403,12 @@ UNUSED void func_8008A850(s32 arg0) {
func_8008A6DC(arg0, 2000.0f);
}
-struct struct_8008A870 {
- s8 unk0[0x119];
- u16 unk11A;
-};
-
-UNUSED s32 func_8008A870(struct struct_8008A870 *arg0) {
- return func_802ABD40(arg0->unk11A);
+UNUSED s32 func_8008A870(Player *player) {
+ return func_802ABD40(player->unk_110.unk3A);
}
-s32 func_8008A890(struct UnkStruct8008A890 *arg0) {
- return func_802ABD40(arg0->value);
+s32 func_8008A890(Camera *camera) {
+ return func_802ABD40(camera->unk_54.unk3A);
}
s32 func_8008A8B0(s16 arg0, s16 arg1) {
@@ -1904,37 +1426,34 @@ s32 func_8008A8B0(s16 arg0, s16 arg1) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
-
-void func_8008A920(s32 arg0) {
- void *temp_v0;
- void *temp_v1;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+void func_8008A920(s32 objectIndex) {
+ s32 temp_v0;
+ struct_80165C18_entry *temp_v1;
- temp_v1 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0 = temp_v1->unk7C;
- temp_v1->unk38 = (temp_v0->unk8 - temp_v0->unk0) / temp_v0->unk6;
- temp_v1->unk3C = (temp_v0->unkA - temp_v0->unk2) / temp_v0->unk6;
- temp_v1->unk40 = (temp_v0->unkC - temp_v0->unk4) / temp_v0->unk6;
+ temp_v1 = &D_80165C18[objectIndex];
+ temp_v0 = temp_v1->unk_07C;
+ temp_v1->unk_038[0] = (f32) (temp_v0->unk8 - temp_v0->unk0) / (f32) temp_v0->unk6;
+ temp_v1->unk_038[1] = (f32) (temp_v0->unkA - temp_v0->unk2) / (f32) temp_v0->unk6;
+ temp_v1->unk_038[2] = (f32) (temp_v0->unkC - temp_v0->unk4) / (f32) temp_v0->unk6;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A920.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8008A920(); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_8008A920(); /* extern */
-void func_8008A9B8(s32 arg0) {
- void *temp_t9;
- void *temp_v0;
+void func_8008A9B8(s32 objectIndex) {
+ s32 temp_t9;
+ struct_80165C18_entry *temp_v0;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_t9 = temp_v0->unk7C + 8;
- temp_v0->unk7C = temp_t9;
- temp_v0->unk9A = 0x2710 / temp_t9->unk6;
- temp_v0->unk98 = 0;
+ temp_v0 = &D_80165C18[objectIndex];
+ temp_t9 = temp_v0->unk_07C + 8;
+ temp_v0->unk_07C = temp_t9;
+ temp_v0->unk_09A = (s16) (0x2710 / (s16) temp_t9->unk6);
+ temp_v0->unk_098 = 0;
func_8008A920();
}
#else
@@ -1942,66 +1461,61 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008A9B8.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80086FD4(s32); // extern
-? func_8008A920(); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_8008A920(); /* extern */
-void func_8008AA3C(s32 arg0) {
- void *temp_v0;
- void *temp_v1;
+void func_8008AA3C(s32 objectIndex) {
+ s32 temp_v1;
+ struct_80165C18_entry *temp_v0;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v1 = temp_v0->unk80 + 2;
- temp_v0->unk7C = temp_v1;
- temp_v0->unk96 = 0;
- temp_v0->unk98 = 0;
- temp_v0->unk94 = temp_v1->unk-2;
- temp_v0->unk28 = temp_v1->unk0;
- temp_v0->unk2C = temp_v1->unk2;
- temp_v0->unk30 = temp_v1->unk4;
- temp_v0->unk9A = 0x2710 / temp_v1->unk6;
+ temp_v0 = &D_80165C18[objectIndex];
+ temp_v1 = temp_v0->unk_080 + 2;
+ temp_v0->unk_07C = temp_v1;
+ temp_v0->unk_084[9] = 0;
+ temp_v0->unk_098 = 0;
+ temp_v0->unk_084[8] = temp_v1->unk-2;
+ temp_v0->unk_028[0] = (f32) temp_v1->unk0;
+ temp_v0->unk_028[1] = (f32) temp_v1->unk2;
+ temp_v0->unk_028[2] = (f32) temp_v1->unk4;
+ temp_v0->unk_09A = (s16) (0x2710 / (s16) temp_v1->unk6);
func_8008A920();
- func_80086FD4(arg0);
+ func_80086FD4(objectIndex);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008AA3C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8008A9B8(); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_8008A9B8(); /* extern */
-void func_8008AB10(s32 arg0) {
- u16 temp_t0;
- u16 temp_t3;
- void *temp_v0;
+void func_8008AB10(s32 objectIndex) {
+ s16 temp_t0;
+ s16 temp_t3;
+ struct_80165C18_entry *temp_v0;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unk28 = temp_v0->unk28 + temp_v0->unk38;
- temp_t0 = temp_v0->unk98 + temp_v0->unk9A;
- temp_v0->unk2C = temp_v0->unk2C + temp_v0->unk3C;
- temp_v0->unk30 = temp_v0->unk30 + temp_v0->unk40;
- temp_v0->unk98 = temp_t0;
+ temp_v0 = &D_80165C18[objectIndex];
+ temp_v0->unk_028[0] += temp_v0->unk_038[0];
+ temp_t0 = (u16) temp_v0->unk_098 + (u16) temp_v0->unk_09A;
+ temp_v0->unk_028[1] += temp_v0->unk_038[1];
+ temp_v0->unk_028[2] += temp_v0->unk_038[2];
+ temp_v0->unk_098 = temp_t0;
if ((temp_t0 & 0xFFFF) >= 0x2710) {
- temp_t3 = temp_v0->unk96 + 1;
- temp_v0->unk96 = temp_t3;
- if (((temp_t3 & 0xFFFF) + 1) == temp_v0->unk94) {
- temp_v0->unkAE = temp_v0->unkAE + 1;
+ temp_t3 = (u16) temp_v0->unk_084[9] + 1;
+ temp_v0->unk_084[9] = temp_t3;
+ if (((temp_t3 & 0xFFFF) + 1) == (u16) temp_v0->unk_084[8]) {
+ temp_v0->unk_0AE += 1;
return;
}
func_8008A9B8();
- // Duplicate return node #4. Try simplifying control flow for better match
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008AB10.s")
#endif
-extern struct struct_E0 D_80165CC6[];
UNUSED void func_8008ABC0(s32 arg0) {
- switch (D_80165CC6[arg0].unk00.s16) {
+ switch (D_80165C18[arg0].unk_0AE) {
case 1:
func_8008AA3C();
break;
@@ -2017,7 +1531,7 @@ UNUSED void func_8008ABC0(s32 arg0) {
}
UNUSED void func_8008AC40(s32 arg0) {
- switch (D_80165CC6[arg0].unk00.s16) {
+ switch (D_80165C18[arg0].unk_0AE) {
case 1:
func_8008AA3C();
break;
@@ -2139,8 +1653,6 @@ void func_8008AE9C(s32 arg0) {
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008AE9C.s")
#endif
-extern s32 D_80183DC8;
-void func_8008ADD0(s32, f32);
void func_8008AFE0(s32 arg0, f32 arg1) {
func_8008ADD0(&D_80183DC8, arg1);
func_8008AE9C(arg0);
@@ -2190,8 +1702,6 @@ void func_8008B038(s32 arg0) {
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B038.s")
#endif
-extern s32 D_80183DA8;
-void func_8008ACE0(s32,f32);
void func_8008B17C(s32 arg0, f32 arg1) {
func_8008ACE0(&D_80183DA8, arg1);
func_8008B038(arg0);
@@ -2326,23 +1836,19 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B284.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721C0(s32, ?); // extern
-s32 func_80072270(?); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+void func_8008B3E4(s32 objectIndex) {
+ s32 temp_v1;
+ struct_80165C18_entry *temp_v0;
-void func_8008B3E4(s32 arg0) {
- void *temp_v0;
- void *temp_v1;
-
- if (func_80072270(8) != 0) {
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unk96 = 0;
- temp_v0->unk98 = 0;
- temp_v1 = temp_v0->unk80 + 2;
- temp_v0->unk7C = temp_v1;
- temp_v0->unk94 = temp_v1->unk-2;
- func_800721C0(arg0, 8);
+ if (func_80072270(objectIndex, 8) != 0) {
+ temp_v0 = &D_80165C18[objectIndex];
+ temp_v0->unk_084[9] = 0;
+ temp_v0->unk_098 = 0;
+ temp_v1 = temp_v0->unk_080 + 2;
+ temp_v0->unk_07C = temp_v1;
+ temp_v0->unk_084[8] = temp_v1->unk-2;
+ func_800721C0(objectIndex, 8);
}
}
#else
@@ -2355,83 +1861,72 @@ void func_8008B44C(s32 arg0) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_8007223C(s32, ?); // extern
-? func_8008AFE0(s32, f32); // extern
-? func_8008B17C(s32, f32); // extern
-? func_8008B1D4(s32); // extern
-? func_8008B284(s32); // extern
-? func_8008B3E4(); // extern
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_8008B1D4(s32); /* extern */
+? func_8008B284(s32); /* extern */
+? func_8008B3E4(); /* extern */
extern f64 D_800EF508;
extern f64 D_800EF510;
-extern ? D_80165C18;
-void func_8008B478(s32 arg0, s32 arg1) {
+void func_8008B478(s32 objectIndex, s32 arg1) {
f32 sp34;
- void *sp24;
+ struct_80165C18_entry *sp24;
f32 temp_f0;
f32 temp_f0_2;
- f32 temp_f6;
- s32 temp_t7;
+ f32 var_f6;
+ s32 temp_v0;
+ struct_80165C18_entry *temp_v1;
u16 temp_t9;
u32 temp_t3;
- void *temp_v0;
- void *temp_v1;
- f32 phi_f6;
func_8008B3E4();
if (arg1 != 0) {
- func_8008B284(arg0);
+ func_8008B284(objectIndex);
} else {
- func_8008B1D4(arg0);
+ func_8008B1D4(objectIndex);
}
- temp_t7 = arg0 * 0xE0;
- temp_v1 = temp_t7 + &D_80165C18;
- temp_t9 = temp_v1->unk98;
- temp_f6 = temp_t9;
- phi_f6 = temp_f6;
- if (temp_t9 < 0) {
- phi_f6 = temp_f6 + 4294967296.0f;
+ temp_v1 = &D_80165C18[objectIndex];
+ temp_t9 = (u16) temp_v1->unk_098;
+ var_f6 = (f32) temp_t9;
+ if ((s32) temp_t9 < 0) {
+ var_f6 += 4294967296.0f;
}
sp24 = temp_v1;
- temp_f0 = phi_f6 / D_800EF508;
+ temp_f0 = (f32) ((f64) var_f6 / 10000.0);
sp34 = temp_f0;
- func_8008B17C(arg0, temp_f0);
- if (func_8007223C(arg0, 0x800) != 0) {
+ func_8008B17C(objectIndex, temp_f0);
+ if (func_8007223C(objectIndex, 0x00000800) != 0) {
sp24 = temp_v1;
- func_8008AFE0(arg0, sp34);
+ func_8008AFE0(objectIndex, sp34);
}
- temp_v0 = (temp_t7 + &D_80165C18)->unk7C;
- temp_f0_2 = temp_v0->unk6;
- temp_t3 = D_800EF510 / (((temp_v0->unkE - temp_f0_2) * sp34) + temp_f0_2);
- (temp_t7 + &D_80165C18)->unk9A = temp_t3;
- (temp_t7 + &D_80165C18)->unk98 = (temp_t7 + &D_80165C18)->unk98 + temp_t3;
+ temp_v0 = temp_v1->unk_07C;
+ temp_f0_2 = (f32) temp_v0->unk6;
+ temp_t3 = (u32) (10000.0 / (f64) ((((f32) temp_v0->unkE - temp_f0_2) * sp34) + temp_f0_2));
+ temp_v1->unk_09A = (s16) temp_t3;
+ temp_v1->unk_098 = (u16) temp_v1->unk_098 + temp_t3;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B478.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8008B44C(s32); // extern
-? func_8008B478(?); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_8008B478(?); /* extern */
-void func_8008B620(s32 arg0) {
- u16 temp_t0;
- void *temp_v0;
+void func_8008B620(s32 objectIndex) {
+ s16 temp_t0;
+ struct_80165C18_entry *temp_v0;
func_8008B478(0);
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- if (temp_v0->unk98 >= 0x2710) {
- temp_t0 = temp_v0->unk96 + 1;
- temp_v0->unk96 = temp_t0;
- if (((temp_t0 & 0xFFFF) + 3) == temp_v0->unk94) {
- temp_v0->unkAE = temp_v0->unkAE + 1;
+ temp_v0 = &D_80165C18[objectIndex];
+ if ((s32) (u16) temp_v0->unk_098 >= 0x2710) {
+ temp_t0 = (u16) temp_v0->unk_084[9] + 1;
+ temp_v0->unk_084[9] = temp_t0;
+ if (((temp_t0 & 0xFFFF) + 3) == (u16) temp_v0->unk_084[8]) {
+ temp_v0->unk_0AE += 1;
return;
}
- func_8008B44C(arg0);
- // Duplicate return node #4. Try simplifying control flow for better match
+ func_8008B44C(objectIndex);
}
}
#else
@@ -2439,27 +1934,23 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B620.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800721E8(s32, ?); // extern
-? func_8008B44C(s32); // extern
-? func_8008B478(?); // extern
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_8008B478(?); /* extern */
-void func_8008B6A4(s32 arg0) {
- u16 temp_t0;
- void *temp_v0;
+void func_8008B6A4(s32 objectIndex) {
+ s16 temp_t0;
+ struct_80165C18_entry *temp_v0;
func_8008B478(1);
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- if (temp_v0->unk98 >= 0x2710) {
- temp_t0 = temp_v0->unk96 + 1;
- temp_v0->unk96 = temp_t0;
- if ((temp_t0 & 0xFFFF) == temp_v0->unk94) {
- func_800721E8(arg0, 8);
+ temp_v0 = &D_80165C18[objectIndex];
+ if ((s32) (u16) temp_v0->unk_098 >= 0x2710) {
+ temp_t0 = (u16) temp_v0->unk_084[9] + 1;
+ temp_v0->unk_084[9] = temp_t0;
+ if ((temp_t0 & 0xFFFF) == (u16) temp_v0->unk_084[8]) {
+ func_800721E8(objectIndex, 8);
return;
}
- func_8008B44C(arg0);
- // Duplicate return node #4. Try simplifying control flow for better match
+ func_8008B44C(objectIndex);
}
}
#else
@@ -2467,25 +1958,23 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B6A4.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80086F60(); // extern
-? func_8008B620(); // extern
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+? func_8008B620(); /* extern */
extern ? D_80165CC6;
-void func_8008B724(s32 arg0) {
+void func_8008B724(s32 objectIndex) {
s16 temp_v0;
- temp_v0 = *(&D_80165CC6 + (arg0 * 0xE0));
- if (temp_v0 != 0) {
- if (temp_v0 != 1) {
- if (temp_v0 != 2) {
- return;
- }
- func_80086F60();
- // Duplicate return node #6. Try simplifying control flow for better match
- return;
- }
+ temp_v0 = *(&D_80165CC6 + (objectIndex * 0xE0));
+ switch (temp_v0) { /* irregular */
+ case 1:
func_8008B620();
+ return;
+ case 2:
+ func_80086F60(objectIndex);
+ /* fallthrough */
+ case 0:
+ return;
}
}
#else
@@ -2542,262 +2031,229 @@ void func_8008B8BC(s32 arg0, u16 arg1, u16 arg2, u16 arg3) {
}
void func_8008B8F0(s32 arg0, f32 arg1, f32 arg2, f32 arg3) {
- D_80165C18[arg0].unk_038 = arg1;
- D_80165C18[arg0].unk_03C = arg2;
- D_80165C18[arg0].unk_040 = arg3;
+ D_80165C18[arg0].unk_038[0] = arg1;
+ D_80165C18[arg0].unk_038[1] = arg2;
+ D_80165C18[arg0].unk_038[2] = arg3;
}
#ifdef MIPS_TO_C
-UNUSED void func_8008B928(s32 arg0, s16 arg1, s16 arg2, s16 arg3, void *arg4) {
- s16 temp_v0;
- s32 temp_t3;
- void *temp_s0;
-
- temp_s0 = (arg0 * 0xE0) + &D_80165C18;
- temp_s0->unk10 = (f32) arg1;
- temp_s0->unk14 = (f32) arg2;
- temp_s0->unk80 = arg4;
- temp_s0->unk18 = (f32) arg3;
- temp_s0->unk38 = (f32) (arg4->unkA - arg4->unk2);
- temp_s0->unk3C = (f32) (arg4->unkC - arg4->unk4);
- temp_s0->unk40 = (f32) (arg4->unkE - arg4->unk6);
- temp_v0 = func_80087368(arg1, arg2, arg3);
- temp_t3 = -temp_v0 & 0xFFFF;
- temp_s0->unkC0 = temp_v0;
- temp_s0->unk40 = func_800416D8(temp_s0->unk40, temp_s0->unk38, temp_t3);
- temp_s0->unkBE = func_80087324(arg0);
-}
-
-UNUSED void func_8008BA40(s32 arg0, s16 arg1, u16 arg2) {
- *(&D_80165C28 + (arg0 * 0xE0)) = (f32) (arg1 + (s16) (random_int(arg2) - ((s32) arg2 / 2)));
-}
-*/
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+extern ? D_80165C28;
+
+void func_8008B928(s32 objectIndex, s16 arg1, s16 arg2, s16 arg3, s32 arg4) {
+ s32 temp_v0;
+ struct_80165C18_entry *temp_s0;
+
+ temp_s0 = &D_80165C18[objectIndex];
+ temp_s0->unk_010[0] = (f32) arg1;
+ temp_s0->unk_010[1] = (f32) arg2;
+ temp_s0->unk_080 = arg4;
+ temp_s0->unk_010[2] = (f32) arg3;
+ temp_s0->unk_038[0] = (f32) (arg4->unkA - arg4->unk2);
+ temp_s0->unk_038[1] = (f32) (arg4->unkC - arg4->unk4);
+ temp_s0->unk_038[2] = (f32) (arg4->unkE - arg4->unk6);
+ temp_v0 = func_80087368(objectIndex);
+ temp_s0->unk_0C0 = (u16) temp_v0;
+ temp_s0->unk_038[2] = func_800416D8(temp_s0->unk_038[2], temp_s0->unk_038[0], -temp_v0 & 0xFFFF);
+ temp_s0->unk_0BE = func_80087324(objectIndex);
+}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B928.s")
#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C2C;
+UNUSED void func_8008BA40(s32 objectIndex, s16 arg1, u16 arg2) {
+ s16 test;
-void func_8008BAB4(s32 arg0, s16 arg1, u16 arg2) {
- *(&D_80165C2C + (arg0 * 0xE0)) = arg1 + (random_int(arg2) - (arg2 / 2));
+ test = random_int(arg2) - (arg2 / 2);
+ D_80165C18[objectIndex].unk_010[0] = arg1 + test;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008BAB4.s")
-#endif
-/*
-UNUSED void func_8008BB28(s32 arg0, s16 arg1, u16 arg2) {
- *(&D_80165C30 + (arg0 * 0xE0)) = (f32) (arg1 + (s16) (random_int(arg2) - ((s32) arg2 / 2)));
+void func_8008BAB4(s32 objectIndex, s16 arg1, u16 arg2) {
+ s16 test;
+
+ test = random_int(arg2) - (arg2 / 2);
+ D_80165C18[objectIndex].unk_010[1] = arg1 + test;
}
-UNUSED void func_8008BB9C(s32 arg0, s16 arg1, s16 arg2, u16 arg3, u16 arg4) {
- s16 sp1E;
- s32 temp_v0;
- void *temp_v1;
+UNUSED void func_8008BB28(s32 objectIndex, s16 arg1, u16 arg2) {
+ s16 test;
- sp1E = random_int(arg3) - ((s32) arg3 / 2);
- temp_v0 = random_int(arg4);
- temp_v1 = (arg0 * 0xE0) + &D_80165C18;
- temp_v1->unk10 = (f32) (arg1 + sp1E);
- temp_v1->unk14 = (f32) (arg2 + (s16) (temp_v0 - ((s32) arg4 / 2)));
+ test = random_int(arg2) - (arg2 / 2);
+ D_80165C18[objectIndex].unk_010[2] = arg1 + test;
}
-UNUSED void func_8008BC58(s32 arg0, s16 arg1, s16 arg2, u16 arg3, u16 arg4) {
+UNUSED void func_8008BB9C(s32 objectIndex, s16 arg1, s16 arg2, u16 arg3, u16 arg4) {
s16 sp1E;
- s32 temp_v0;
- void *temp_v1;
+ s16 temp_v0;
- sp1E = random_int(arg3) - ((s32) arg3 / 2);
- temp_v0 = random_int(arg4);
- temp_v1 = (arg0 * 0xE0) + &D_80165C18;
- temp_v1->unk10 = (f32) (arg1 + sp1E);
- temp_v1->unk18 = (f32) (arg2 + (s16) (temp_v0 - ((s32) arg4 / 2)));
+ sp1E = random_int(arg3) - ((s32) arg3 / 2);
+ temp_v0 = random_int(arg4) - ((s32) arg4 / 2);
+ D_80165C18[objectIndex].unk_010[0] = arg1 + sp1E;
+ D_80165C18[objectIndex].unk_010[1] = arg2 + temp_v0;
}
-*/
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008BB28.s")
+UNUSED void func_8008BC58(s32 objectIndex, s16 arg1, s16 arg2, u16 arg3, u16 arg4) {
+ s16 sp1E;
+ s16 temp_v0;
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+ sp1E = random_int(arg3) - ((s32) arg3 / 2);
+ temp_v0 = random_int(arg4) - ((s32) arg4 / 2);
+ D_80165C18[objectIndex].unk_010[0] = arg1 + sp1E;
+ D_80165C18[objectIndex].unk_010[2] = arg2 + temp_v0;
+}
-void func_8008BD14(s32 arg0, s16 arg1, s16 arg2, s16 arg3, u16 arg4, u16 arg5, u16 arg6) {
+void func_8008BD14(s32 objectIndex, s16 arg1, s16 arg2, s16 arg3, u16 arg4, u16 arg5, u16 arg6) {
s16 sp1E;
s16 sp1C;
- s32 temp_v0;
- void *temp_v1;
+ s16 temp_v0;
- sp1E = random_int(arg4) - (arg4 / 2);
- sp1C = random_int(arg5) - (arg5 / 2);
- temp_v0 = random_int(arg6);
- temp_v1 = (arg0 * 0xE0) + &D_80165C18;
- temp_v1->unk10 = arg1 + sp1E;
- temp_v1->unk14 = arg2 + sp1C;
- temp_v1->unk18 = arg3 + (temp_v0 - (arg6 / 2));
+ sp1E = random_int(arg4) - ((s32) arg4 / 2);
+ sp1C = random_int(arg5) - ((s32) arg5 / 2);
+ temp_v0 = random_int(arg6) - ((s32) arg6 / 2);
+ D_80165C18[objectIndex].unk_010[0] = arg1 + sp1E;
+ D_80165C18[objectIndex].unk_010[1] = arg2 + sp1C;
+ D_80165C18[objectIndex].unk_010[2] = arg3 + temp_v0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008BD14.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-f32 sins(u16); // extern
-f32 coss(u16); // extern
-extern ? D_80165C18;
-void func_8008BE0C(s32 arg0, s16 arg1, u16 arg2) {
- void *sp1C;
- f32 sp18;
- f32 temp_f2;
- f32 temp_f6;
- void *temp_v0;
-
- temp_f2 = arg1;
- temp_f6 = sins(arg2) * temp_f2;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- sp1C = temp_v0;
- sp18 = temp_f2;
- temp_v0->unk10 = temp_f6 + gPlayerOneCopy->posX;
- temp_v0->unk18 = (coss(arg2) * temp_f2) + gPlayerOneCopy->posZ;
+void func_8008BE0C(s32 objectIndex, s16 arg1, u16 arg2) {
+ D_80165C18[objectIndex].unk_010[0] = gPlayerOneCopy->pos[0] + (sins(arg2) * arg1);
+ D_80165C18[objectIndex].unk_010[2] = gPlayerOneCopy->pos[2] + (coss(arg2) * arg1);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008BE0C.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+void func_8008BEA4(s32 objectIndex, u16 arg1, u16 arg2) {
+ u16 thing;
+ u16 thing2;
-void func_8008BF18(s32 arg0) {
- void *temp_v0;
+ thing = random_int(arg1);
+ thing2 = camera1->rot[1] + random_int(arg2) - ((s32) arg2 / 2);
+ func_8008BE0C(objectIndex, thing, thing2);
+}
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unk4 = temp_v0->unk28 + temp_v0->unk10;
- temp_v0->unk8 = temp_v0->unk2C + temp_v0->unk14;
- temp_v0->unkC = temp_v0->unk30 + temp_v0->unk18;
+void func_8008BF18(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_004[0] = D_80165C18[objectIndex].unk_010[0] + D_80165C18[objectIndex].unk_028[0];
+ D_80165C18[objectIndex].unk_004[1] = D_80165C18[objectIndex].unk_010[1] + D_80165C18[objectIndex].unk_028[1];
+ D_80165C18[objectIndex].unk_004[2] = D_80165C18[objectIndex].unk_010[2] + D_80165C18[objectIndex].unk_028[2];
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008BF18.s")
-#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_80165C18;
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
+extern ? D_80183E40;
+extern ? D_80183E80;
-void func_8008BFC0(s32 arg0) {
- void *temp_v0;
+void func_8008BF64(s32 objectIndex) {
+ struct_80165C18_entry *temp_v0;
- temp_v0 = (arg0 * 0xE0) + &D_80165C18;
- temp_v0->unk9C = temp_v0->unk4;
- temp_v0->unk9E = temp_v0->unk8;
+ temp_v0 = &D_80165C18[objectIndex];
+ D_80183E40.unk0 = (f32) temp_v0->unk_004[0];
+ D_80183E40.unk4 = (f32) temp_v0->unk_004[1];
+ D_80183E40.unk8 = (f32) temp_v0->unk_004[2];
+ D_80183E80.unk0 = (u16) temp_v0->unk_0BE;
+ D_80183E80.unk2 = (u16) temp_v0->unk_0C0;
+ D_80183E80.unk4 = (u16) temp_v0->unk_0C2;
}
#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008BFC0.s")
+GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008BF64.s")
#endif
+void func_8008BFC0(s32 objectIndex) {
+ D_80165C18[objectIndex].unk_09C = D_80165C18[objectIndex].unk_004[0];
+ D_80165C18[objectIndex].unk_09E = D_80165C18[objectIndex].unk_004[1];
+}
+
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
-? func_80086F60(); /* extern */
+//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
? func_80088228(); /* extern */
? func_80088364(); /* extern */
? func_8008B620(); /* extern */
? func_8008B6A4(); /* extern */
-extern ? D_80165C18;
-void func_8008BFFC(s32 arg0) {
+void func_8008BFFC(s32 objectIndex) {
s16 temp_v0;
s16 temp_v0_2;
s16 temp_v0_3;
s16 temp_v0_4;
s16 temp_v0_5;
s16 temp_v0_6;
+ struct_80165C18_entry *temp_v1;
u8 temp_t8;
- void *temp_v1;
- temp_v1 = (arg0 * 0xE0) + &D_80165C18;
- temp_t8 = temp_v1->unkDE;
+ temp_v1 = &D_80165C18[objectIndex];
+ temp_t8 = (u8) temp_v1->unk_0DE;
switch (temp_t8) {
case 1:
- if (temp_v1->unkAE == 1) {
+ if (temp_v1->unk_0AE == 1) {
func_8008B620();
return;
}
default:
+ case 0: /* switch 1 */
+ case 0: /* switch 2 */
+ case 0: /* switch 3 */
return;
case 2:
- temp_v0 = temp_v1->unkAE;
+ temp_v0 = temp_v1->unk_0AE;
if ((temp_v0 != 0) && (temp_v0 == 1)) {
func_8008B6A4();
return;
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
case 3:
- temp_v0_2 = temp_v1->unkAE;
+ temp_v0_2 = temp_v1->unk_0AE;
if ((temp_v0_2 != 0) && (temp_v0_2 == 1)) {
func_8008B620();
return;
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
case 4:
- temp_v0_3 = temp_v1->unkAE;
- if (temp_v0_3 != 0) {
- if (temp_v0_3 != 1) {
- if (temp_v0_3 != 2) {
- return;
- }
- func_80086F60();
- return;
- }
+ temp_v0_3 = temp_v1->unk_0AE;
+ switch (temp_v0_3) { /* switch 1; irregular */
+ case 1: /* switch 1 */
func_8008B620();
return;
+ case 2: /* switch 1 */
+ func_80086F60(objectIndex);
+ return;
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
case 5:
- temp_v0_4 = temp_v1->unkAE;
- if (temp_v0_4 != 0) {
- if (temp_v0_4 != 1) {
- if (temp_v0_4 != 2) {
- return;
- }
- func_80086F60();
- return;
- }
+ temp_v0_4 = temp_v1->unk_0AE;
+ switch (temp_v0_4) { /* switch 2; irregular */
+ case 1: /* switch 2 */
func_8008B620();
return;
+ case 2: /* switch 2 */
+ func_80086F60(objectIndex);
+ return;
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
case 6:
- temp_v0_5 = temp_v1->unkAE;
+ temp_v0_5 = temp_v1->unk_0AE;
if ((temp_v0_5 != 0) && (temp_v0_5 == 1)) {
func_8008B620();
return;
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
case 7:
- temp_v0_6 = temp_v1->unkAE;
- if (temp_v0_6 != 0) {
- if (temp_v0_6 != 1) {
- if (temp_v0_6 != 2) {
- return;
- }
- func_80088364();
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
- }
+ temp_v0_6 = temp_v1->unk_0AE;
+ switch (temp_v0_6) { /* switch 3; irregular */
+ case 1: /* switch 3 */
func_80088228();
return;
+ case 2: /* switch 3 */
+ func_80088364();
+ break;
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008BFFC.s")
#endif
+
+UNUSED void func_8008C1B8(s32 arg0) {
+
+}
+
+UNUSED void func_8008C1C0(s32 arg0) {
+
+}