diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2023-10-18 13:56:26 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-18 13:56:26 -0600 |
| commit | 53f84286d62139d3d84d5e438002a2f2a09bdeee (patch) | |
| tree | adfeee611ee0e2562b8cb9a042dc73cfde9735d0 /src | |
| parent | 03a5550a94bcc104c757d99a1da6da859e864613 (diff) | |
match a few funcs and add compiler option (#465)
* match a few funcs and add compiler option
Diffstat (limited to 'src')
| -rw-r--r-- | src/code_80005FD0.c | 134 | ||||
| -rw-r--r-- | src/code_80005FD0.h | 5 | ||||
| -rw-r--r-- | src/code_8006E9C0.c | 64 |
3 files changed, 83 insertions, 120 deletions
diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index a18952242..c6693f8e1 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -482,52 +482,43 @@ s32 func_800061DC(Vec3f arg0, f32 arg1, s32 arg2) { return var_v1; } -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -extern s16 D_80163258; -extern s16 D_80163270; -extern s32 D_80163288; +extern u16 D_80163258[]; +extern u16 D_80163270[]; +extern s32 D_80163288[]; -void func_800065D0(s32 arg0, Player *player) { - Player *temp_a3; - Player *temp_a3_2; +void func_800065D0(s32 playerId, Player *player) { s16 temp_t2; s16 var_t1; - s32 *temp_a2; - s32 temp_a1; - s32 temp_v0; - u16 *temp_v1; - u16 temp_t9; + s16 temp_t3; + s16 a; + u32 b; - temp_v0 = arg0 * 2; - temp_t2 = (s16) ((s16) player->unk_02C[1] / 182) - (s16) ((s16) D_80164590[(s16) gPathIndexByPlayerId[arg0]][gNearestWaypointByPlayerId[arg0]] / 182); - var_t1 = temp_t2; - if (temp_t2 < 0) { - var_t1 = temp_t2 * -1; - } - temp_a2 = (arg0 * 4) + &D_80163288; - temp_a1 = D_80164450[arg0]; - if ((temp_a1 < *temp_a2) && (var_t1 >= 0x88) && (var_t1 < 0xE1)) { - temp_v1 = temp_v0 + &D_80163258; - temp_t9 = *temp_v1 + 1; - *temp_v1 = temp_t9; - if ((temp_t9 & 0xFFFF) >= 5) { - *(&D_80163270 + temp_v0) = 1; - temp_a3 = &gPlayers[arg0]; - *temp_v1 = 5; - temp_a3->effects |= 0x400000; - } - } else if ((var_t1 < 0x2D) || (var_t1 >= 0x13C)) { - *(&D_80163270 + temp_v0) = 0; - *(&D_80163258 + temp_v0) = 0; - temp_a3_2 = &gPlayers[arg0]; - temp_a3_2->effects &= 0xFFBFFFFF; - } - *temp_a2 = temp_a1; + a = (s16) gPathIndexByPlayerId[playerId]; + b = gNearestWaypointByPlayerId[playerId]; + + temp_t2 = (s16) ((s16) player->unk_02C[1] / 182); + temp_t3 = (s16) ((s16) D_80164590[a][b] / 182); + + var_t1 = temp_t2 - temp_t3; + + if (var_t1 < 0) { + var_t1 = -var_t1; + } + + if ((D_80164450[playerId] < D_80163288[playerId]) && (var_t1 >= 136) && (var_t1 < 225)) { + D_80163258[playerId]++; + if ((D_80163258[playerId]) >= 5) { + D_80163270[playerId] = 1; + D_80163258[playerId] = 5; + gPlayers[playerId].effects |= 0x400000; + } + } else if ((var_t1 < 45) || (var_t1 >= 316)) { + D_80163270[playerId] = 0; + D_80163258[playerId] = 0; + gPlayers[playerId].effects &= 0xFFBFFFFF; + } + D_80163288[playerId] = D_80164450[playerId]; } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800065D0.s") -#endif void set_places(void) { s32 temp_s2; @@ -3370,7 +3361,7 @@ s16 func_8000DBAC(Vec3f pos, s16 *waypointIndex, f32 speed) { GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000DBAC.s") #endif -void func_8000DD78(void) { +void set_bomb_kart_spawn_positions(void) { Collision *var_s2; f32 startingXPos; f32 startingZPos; @@ -3521,7 +3512,7 @@ void func_8000DF8C(s32 arg0) { temp_t2 = temp_t9 & 0xFFFF; sp4C = temp_t2; sp7E = temp_t9; - if ((temp_t2 != 0) && (((u16) temp_s0->unk_4A != 1) || (gCurrentCourseId == 0x0014))) { + if ((temp_t2 != 0) && (((u16) temp_s0->unk_4A != 1) || (gCurrentCourseId == COURSE_AWARD_CEREMONY))) { var_f22 = temp_s0->bombPos[0]; var_f20 = temp_s0->bombPos[1]; var_f24 = temp_s0->bombPos[2]; @@ -4077,7 +4068,7 @@ void func_8000F2DC(void) { func_80014BDC(); break; } - func_8000DD78(); + set_bomb_kart_spawn_positions(); func_8000EEDC(); } @@ -4794,50 +4785,35 @@ void func_80010DBC(s32 pathIndex) { } } -#ifdef MIPS_TO_C -//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-09-2023 -s16 gCurrentCourseId; /* unable to generate initializer */ - void func_80010E6C(s32 pathIndex) { s16 *var_a2; - s16 temp_t0; s16 var_a0; - s32 var_a1; - s32 var_a3; - s32 var_t1; - u16 temp_v0; + s16 temp_t0; + s32 temp_v0; + s16 *temp; + s32 i, j; temp_v0 = gWaypointCountByPathIndex[pathIndex]; + temp = D_80164580[pathIndex]; var_a2 = D_801645A0[pathIndex]; - var_a3 = 0; - if ((s32) temp_v0 > 0) { - do { - var_a0 = 0; - var_a1 = 0; - if ((s32) temp_v0 > 0) { - var_t1 = var_a3; -loop_4: - temp_t0 = D_80164580[pathIndex][var_t1 % (s32) temp_v0]; - var_a1 += 1; - if ((temp_t0 == 1) || (temp_t0 == 0)) { - var_a0 += 1; - if (gCurrentCourseId != 0x0014) { - var_t1 += 1; - if (var_a1 != temp_v0) { - goto loop_4; - } - } - } + + for (i = 0; i < temp_v0; i++) { + var_a0 = 0; + for (j = 0; j < temp_v0; j++) { + temp_t0 = temp[(i + j) % temp_v0]; + if ((temp_t0 == 1) || (temp_t0 == 0)) { + var_a0 += 1; + } else { + break; } - var_a3 += 1; - *var_a2 = var_a0; - var_a2 += 2; - } while (var_a3 != temp_v0); + if (gCurrentCourseId == COURSE_AWARD_CEREMONY) { + break; + } + } + *var_a2 = var_a0; + var_a2++; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80010E6C.s") -#endif f32 func_80010F40(f32 arg0, f32 arg1, f32 arg2, UNUSED s32 arg3) { arg1 = func_802AE1C0(arg0, 2000.0f, arg2); diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h index 4e96ee64d..7901ac986 100644 --- a/src/code_80005FD0.h +++ b/src/code_80005FD0.h @@ -67,7 +67,8 @@ s32 func_80006018(f32, f32, f32, f32, f32, f32, f32, f32); void func_80006114(Vec3f, Vec3f, s16); s32 func_800061DC(Vec3f, f32, s32); void set_places(void); - +void func_80010E6C(s32 pathIndex); +void set_bomb_kart_spawn_positions(void); void func_800070F4(void); void func_800074D4(void); s32 func_80007BF8(u16, u16, u16, u16, u16); @@ -104,7 +105,7 @@ f32 func_8000D3B8(s32); s16 func_8000D6D0(Vec3f, s16*, f32, f32, s16, s16); s16 func_8000D940(Vec3f, s16*, f32, f32, s16); s16 func_8000DBAC(Vec3f, s16*, f32); -void func_8000DD78(void); +void set_bomb_kart_spawn_positions(void); void func_8000DF8C(s32); s32 func_8000ED14(s32, s16); diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index 1f7764a58..ad3a23316 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -88,9 +88,7 @@ void func_8006EA5C(void) { **/ } -#ifdef MIPS_TO_C -//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-29-2022 -extern ? D_8018C5F0; + extern s16 D_8018CF18; extern s16 D_8018CF20; extern s16 D_8018CF48; @@ -120,40 +118,31 @@ extern s16 D_8018D0E8; extern s16 D_8018D110; void func_8006EB10(void) { - s32 *var_v1; - s32 *var_v1_2; - s32 *var_v1_3; - s32 *var_v1_4; - s32 *var_v1_5; + s32 i = 0; + + for (i = 0; i < 128; i++) { + D_8018C1B0[i] = -1; + } - var_v1 = D_8018C1B0; - do { - var_v1 += 4; - var_v1->unk-4 = -1; - } while ((u32) var_v1 < (u32) &D_8018C3B0); - var_v1_2 = D_8018C3F0; - do { - var_v1_2 += 4; - var_v1_2->unk-4 = -1; - } while ((u32) var_v1_2 < (u32) &D_8018C5F0); - var_v1_3 = D_8018C630; - do { - var_v1_3 += 4; - var_v1_3->unk-4 = -1; - } while ((u32) var_v1_3 < (u32) &D_8018C830); - var_v1_4 = D_8018C870; - do { - var_v1_4 += 4; - var_v1_4->unk-4 = -1; - } while ((u32) var_v1_4 < (u32) D_8018C970); - var_v1_5 = D_8018C970; - do { - var_v1_5 += 0x10; - var_v1_5->unk-10 = -1; - var_v1_5->unk-C = -1; - var_v1_5->unk-8 = -1; - var_v1_5->unk-4 = -1; - } while (var_v1_5 != D_8018CA70); + for (i = 0; i < 128; i++) { + D_8018C3F0[i] = -1; + } + + for (i = 0; i < 128; i++) { + D_8018C630[i] = -1; + } + + for (i = 0; i < 64; i++) { + D_8018C870[i] = -1; + } + + for (i = 0; i < 64; i += 4) { + D_8018C970[i + 0] = -1; + D_8018C970[i + 1] = -1; + D_8018C970[i + 2] = -1; + D_8018C970[i + 3] = -1; + } + D_8018CFA8 = 0; D_8018CF90 = D_8018CFA8; D_8018CF78 = D_8018CF90; @@ -188,9 +177,6 @@ void func_8006EB10(void) { D_80183E4C = D_80183E5C; D_80183E38 = D_80183E4C; } -#else -GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_8006EB10.s") -#endif void func_8006ED60() { bzero(gObjectList, OBJECT_LIST_SIZE * sizeof(Objects)); |
