diff options
Diffstat (limited to 'src/code_80005FD0.c')
| -rw-r--r-- | src/code_80005FD0.c | 134 |
1 files changed, 55 insertions, 79 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); |
