summaryrefslogtreecommitdiff
path: root/src/code_80086E70.c
diff options
context:
space:
mode:
authorTyler McGavran <tyler.taggerung@gmail.com>2023-08-25 23:37:59 -0400
committerGitHub <noreply@github.com>2023-08-25 21:37:59 -0600
commita755428b200b817c02d657df91276b6e2dc96c18 (patch)
treec2033e7f222fc1c7452255bd2cfa1bfff95f1dda /src/code_80086E70.c
parent965d1e85b45ba0e596dbbd92ebe3b9799d7e64f0 (diff)
Some matches in in code_80086E70 (#384)
I really, really don't like a couple of the matches because of the handling of the `unk_80` member of the object struct. But if it matches it matches. Signed-off-by: Taggerung <tyler.taggerung@email.com>
Diffstat (limited to 'src/code_80086E70.c')
-rw-r--r--src/code_80086E70.c350
1 files changed, 125 insertions, 225 deletions
diff --git a/src/code_80086E70.c b/src/code_80086E70.c
index d234261dc..3e01e28ca 100644
--- a/src/code_80086E70.c
+++ b/src/code_80086E70.c
@@ -435,8 +435,7 @@ void func_80088178(s32 objectIndex, s32 arg1) {
}
// if the code is too ugly for you, then go fix it without tampering with the register allocations
-void func_80088228(s32 objectIndex)
-{
+void func_80088228(s32 objectIndex) {
s16 *temp_v1;
struct_80165C18_entry *temp_v0;
temp_v0 = &D_80165C18[objectIndex];
@@ -468,10 +467,7 @@ s32 func_800882B0(s32 objectIndex, s32 arg1) {
return var_v1;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-09-2023
void func_80088364(s32 objectIndex) {
- s16 temp_t9;
struct_80165C18_entry *temp_v0;
func_800880E4(objectIndex);
@@ -479,18 +475,30 @@ void func_80088364(s32 objectIndex) {
func_800876A0(objectIndex);
if (func_800882B0(objectIndex, 0x0000000A) != 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_084[9] = (u16) temp_v0->unk_084[9] + 1;
+ if (((u16)temp_v0->unk_084[9] + 3) == (u16) temp_v0->unk_084[8]) {
temp_v0->unk_0AE += 1;
- return;
+ } else {
+ func_80088150(objectIndex);
}
- func_80088150(objectIndex);
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_80088364.s")
-#endif
+
+void func_800883FC(s32 objectIndex) {
+ switch (D_80165C18[objectIndex].unk_0AE) {
+ case 0:
+ break;
+ case 1:
+ func_80088228(objectIndex);
+ break;
+ case 2:
+ func_80088364(objectIndex);
+ break;
+ case 3:
+ func_80086F60(objectIndex);
+ break;
+ }
+}
s32 func_8008847C(s32 objectIndex) {
s32 sp2C;
@@ -1501,71 +1509,29 @@ UNUSED void func_8008B1CC(void) {
}
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern s16 D_80165760;
-extern s16 D_80165762;
-extern s16 D_80165764;
-extern s16 D_80165766;
-extern s16 D_80165770;
-extern s16 D_80165772;
-extern s16 D_80165774;
-extern s16 D_80165776;
-extern s16 D_80165780;
-extern s16 D_80165782;
-extern s16 D_80165784;
-extern s16 D_80165786;
-extern ? D_80165C94;
-
-void func_8008B1D4(s32 arg0) {
- s16 *temp_v0;
- void *temp_v0_2;
-
- temp_v0 = *(&D_80165C94 + (arg0 * 0xE0));
- temp_v0_2 = temp_v0 + 0x18;
- D_80165760 = *temp_v0;
- D_80165770 = temp_v0_2->unk-16;
- D_80165780 = temp_v0_2->unk-14;
- D_80165762 = temp_v0_2->unk-10;
- D_80165772 = temp_v0_2->unk-E;
- D_80165782 = temp_v0_2->unk-C;
- D_80165764 = temp_v0_2->unk-8;
- D_80165774 = temp_v0_2->unk-6;
- D_80165784 = temp_v0_2->unk-4;
- D_80165766 = temp_v0_2->unk0;
- D_80165776 = temp_v0_2->unk2;
- D_80165786 = temp_v0_2->unk4;
-}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B1D4.s")
-#endif
+void func_8008B1D4(s32 objectIndex) {
+ s32 someIndex;
+ Vec4s *test;
-#ifdef MIPS_TO_C
-//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-09-2023
-extern s16 D_80165762;
-extern s16 D_80165764;
-extern s16 D_80165766;
-extern s16 D_80165772;
-extern s16 D_80165774;
-extern s16 D_80165776;
-extern s16 D_80165782;
-extern s16 D_80165784;
-extern s16 D_80165786;
+ test = D_80165C18[objectIndex].unk_07C;
+ for (someIndex = 0; someIndex < 4; someIndex++) {
+ D_80165760[someIndex] = (*test)[0];
+ D_80165770[someIndex] = (*test)[1];
+ D_80165780[someIndex] = (*test)[2];
+ test++;
+ }
+}
void func_8008B284(s32 objectIndex) {
+ s32 someIndex;
s32 sp0;
- s16 (*temp_v0)[4];
- s16 (*var_v0)[4];
- s16 (*var_v0_2)[4];
- s16 *var_v0_3;
- s16 temp_a1;
- struct_80165C18_entry *temp_v1;
- u16 temp_a2;
+ s32 temp_a1;
+ s32 temp_a2;
+ Vec4s *test;
- temp_v1 = &D_80165C18[objectIndex];
- temp_a2 = (u16) temp_v1->unk_084[8];
- temp_a1 = temp_v1->unk_084[9];
- temp_v0 = temp_v1->unk_07C;
+ test = D_80165C18[objectIndex].unk_07C;
+ temp_a1 = D_80165C18[objectIndex].unk_084[9];
+ temp_a2 = (u16) D_80165C18[objectIndex].unk_084[8];
if ((temp_a2 - 4) >= temp_a1) {
sp0 = 0x00002710;
} else if ((temp_a1 + 3) == temp_a2) {
@@ -1575,55 +1541,34 @@ void func_8008B284(s32 objectIndex) {
} else if ((temp_a1 + 1) == temp_a2) {
sp0 = 0;
}
- *D_80165760 = temp_v0[0][0];
- var_v0 = temp_v0 + 8;
- *D_80165770 = temp_v0[0][1];
- *D_80165780 = var_v0->unk-4;
- if (sp0 == 0) {
- var_v0 = (s16 (*)[4]) &temp_v1->unk_080[0][1];
- }
- var_v0_2 = var_v0 + 8;
- D_80165762 = var_v0[0][0];
- D_80165772 = var_v0_2->unk-6;
- D_80165782 = var_v0_2->unk-4;
- if (sp0 == 1) {
- var_v0_2 = (s16 (*)[4]) &temp_v1->unk_080[0][1];
- }
- D_80165764 = var_v0_2[0][0];
- D_80165774 = var_v0_2[0][1];
- D_80165784 = var_v0_2[0][2];
- if (sp0 == 2) {
- var_v0_3 = &temp_v1->unk_080[0][1];
- } else {
- var_v0_3 = *(var_v0_2 + 8);
+ for (someIndex = 0; someIndex < 4; someIndex++) {
+ D_80165760[someIndex] = (*test)[0];
+ D_80165770[someIndex] = (*test)[1];
+ D_80165780[someIndex] = (*test)[2];
+ if (sp0 == someIndex) {
+ // Huh???????? This makes no sense
+ test = &D_80165C18[objectIndex].unk_080[0][1];
+ } else {
+ test++;
+ }
}
- D_80165766 = var_v0_3->unk0;
- D_80165776 = var_v0_3->unk2;
- D_80165786 = var_v0_3->unk4;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B284.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
void func_8008B3E4(s32 objectIndex) {
- s32 temp_v1;
+ Vec4s *test;
struct_80165C18_entry *temp_v0;
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;
+ temp_v0->unk_07C = &D_80165C18[objectIndex].unk_080[0][1];
+ // Huh????????? Negative array indexing is a near certain sign
+ // that something has gone wrong on our end.
+ temp_v0->unk_084[8] = temp_v0->unk_07C[0][-1];
func_800721C0(objectIndex, 8);
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B3E4.s")
-#endif
void func_8008B44C(s32 arg0) {
D_80165C18[arg0].unk_098 = 0;
@@ -1631,11 +1576,7 @@ void func_8008B44C(s32 arg0) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-09-2023
-? func_8008B1D4(s32); /* extern */
-? func_8008B284(s32); /* extern */
-? func_8008B3E4(); /* extern */
-
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-24-2023
void func_8008B478(s32 objectIndex, s32 arg1) {
f32 sp34;
struct_80165C18_entry *sp24;
@@ -1647,7 +1588,7 @@ void func_8008B478(s32 objectIndex, s32 arg1) {
u16 temp_t9;
u32 temp_t3;
- func_8008B3E4();
+ func_8008B3E4(objectIndex);
if (arg1 != 0) {
func_8008B284(objectIndex);
} else {
@@ -1677,89 +1618,59 @@ void func_8008B478(s32 objectIndex, s32 arg1) {
GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B478.s")
#endif
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-void func_8008B478(?); /* extern */
-
void func_8008B620(s32 objectIndex) {
s16 temp_t0;
struct_80165C18_entry *temp_v0;
- func_8008B478(0);
+ func_8008B478(objectIndex, 0);
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]) {
+ if (temp_v0->unk_098 >= 0x2710) {
+ // Have to do it this way due to the u16 cast
+ temp_v0->unk_084[9] = (u16) temp_v0->unk_084[9] + 1;
+ if (((u16) temp_v0->unk_084[9] + 3) == (u16) temp_v0->unk_084[8]) {
temp_v0->unk_0AE += 1;
- return;
+ } else {
+ func_8008B44C(objectIndex);
}
- func_8008B44C(objectIndex);
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B620.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-void func_8008B478(?); /* extern */
void func_8008B6A4(s32 objectIndex) {
- s16 temp_t0;
struct_80165C18_entry *temp_v0;
- func_8008B478(1);
+ func_8008B478(objectIndex, 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) == (u16) temp_v0->unk_084[8]) {
+ if (temp_v0->unk_098 >= 0x2710) {
+ // Have to do it this way due to the u16 cast
+ temp_v0->unk_084[9] = (u16) temp_v0->unk_084[9] + 1;
+ if ((u16)temp_v0->unk_084[9] == (u16)temp_v0->unk_084[8]) {
func_800721E8(objectIndex, 8);
- return;
+ } else {
+ func_8008B44C(objectIndex);
}
- func_8008B44C(objectIndex);
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B6A4.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-void func_8008B620(); /* extern */
-extern ? D_80165CC6;
void func_8008B724(s32 objectIndex) {
- s16 temp_v0;
-
- temp_v0 = *(&D_80165CC6 + (objectIndex * 0xE0));
- switch (temp_v0) { /* irregular */
+ switch (D_80165C18[objectIndex].unk_0AE) {
+ case 0:
+ break;
case 1:
- func_8008B620();
- return;
+ func_8008B620(objectIndex);
+ break;
case 2:
func_80086F60(objectIndex);
- /* fallthrough */
- case 0:
- return;
+ break;
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008B724.s")
-#endif
-extern void func_8008B6A4(s32); /* extern */
-
-typedef struct {
- s16 a[0x70];
-} asdf;
-
-extern asdf D_80165CC6[0x70];
-
-void func_8008B78C(s32 arg0) {
- if ((D_80165CC6[arg0].a[0] != 0) && (D_80165CC6[arg0].a[0] == 1)) {
- func_8008B6A4(arg0);
+void func_8008B78C(s32 objectIndex) {
+ switch (D_80165C18[objectIndex].unk_0AE) {
+ case 0:
+ break;
+ case 1:
+ func_8008B6A4(objectIndex);
+ break;
}
}
@@ -1908,95 +1819,84 @@ void func_8008BFC0(s32 objectIndex) {
D_80165C18[objectIndex].unk_09E = D_80165C18[objectIndex].pos[1];
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-void func_80088228(); /* extern */
-void func_80088364(); /* extern */
-void func_8008B620(); /* extern */
-void func_8008B6A4(); /* extern */
-
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;
temp_v1 = &D_80165C18[objectIndex];
- temp_t8 = (u8) temp_v1->unk_0DE;
- switch (temp_t8) {
+ switch (temp_v1->unk_0DE) {
case 1:
if (temp_v1->unk_0AE == 1) {
- func_8008B620();
- return;
+ func_8008B620(objectIndex);
}
- default:
- case 0: /* switch 1 */
- case 0: /* switch 2 */
- case 0: /* switch 3 */
- return;
+ break;
case 2:
- temp_v0 = temp_v1->unk_0AE;
- if ((temp_v0 != 0) && (temp_v0 == 1)) {
- func_8008B6A4();
- return;
+ switch (temp_v1->unk_0AE) {
+ case 0:
+ break;
+ case 1:
+ func_8008B6A4(objectIndex);
+ break;
}
break;
case 3:
- temp_v0_2 = temp_v1->unk_0AE;
- if ((temp_v0_2 != 0) && (temp_v0_2 == 1)) {
- func_8008B620();
- return;
+ switch (temp_v1->unk_0AE) {
+ case 0:
+ break;
+ case 1:
+ func_8008B620(objectIndex);
+ break;
}
break;
case 4:
- temp_v0_3 = temp_v1->unk_0AE;
- switch (temp_v0_3) { /* switch 1; irregular */
+ switch (temp_v1->unk_0AE) { /* switch 1; irregular */
+ case 0: /* switch 1 */
+ break;
case 1: /* switch 1 */
- func_8008B620();
- return;
+ func_8008B620(objectIndex);
+ break;
case 2: /* switch 1 */
func_80086F60(objectIndex);
- return;
+ break;
}
break;
case 5:
- temp_v0_4 = temp_v1->unk_0AE;
- switch (temp_v0_4) { /* switch 2; irregular */
+ switch (temp_v1->unk_0AE) { /* switch 2; irregular */
+ case 0: /* switch 2 */
+ break;
case 1: /* switch 2 */
- func_8008B620();
- return;
+ func_8008B620(objectIndex);
+ break;
case 2: /* switch 2 */
func_80086F60(objectIndex);
- return;
+ break;
}
break;
case 6:
- temp_v0_5 = temp_v1->unk_0AE;
- if ((temp_v0_5 != 0) && (temp_v0_5 == 1)) {
- func_8008B620();
- return;
+ switch (temp_v1->unk_0AE) {
+ case 0:
+ break;
+ case 1:
+ func_8008B620(objectIndex);
+ break;
}
break;
case 7:
- temp_v0_6 = temp_v1->unk_0AE;
- switch (temp_v0_6) { /* switch 3; irregular */
+ switch (temp_v1->unk_0AE) { /* switch 3; irregular */
+ case 0: /* switch 3 */
+ break;
case 1: /* switch 3 */
- func_80088228();
- return;
+ func_80088228(objectIndex);
+ break;
case 2: /* switch 3 */
- func_80088364();
+ func_80088364(objectIndex);
break;
}
break;
+ case 0:
+ default:
+ break;
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008BFFC.s")
-#endif
UNUSED void func_8008C1B8(UNUSED s32 arg0) {