summaryrefslogtreecommitdiff
path: root/src/code_80005FD0.c
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2024-04-17 14:00:13 -0600
committerGitHub <noreply@github.com>2024-04-17 14:00:13 -0600
commit7f046d94057275605cdce7f22326dfa013a16330 (patch)
tree3b74868746c61f7e9b09b5f0cea5da0c7084cb46 /src/code_80005FD0.c
parent91dcf56629b295100b88c8ae0280a9becbefdf73 (diff)
Update a couple attempts (#612)
* Fix warning * Update a couple attempts --------- Co-authored-by: = <=>
Diffstat (limited to 'src/code_80005FD0.c')
-rw-r--r--src/code_80005FD0.c253
1 files changed, 109 insertions, 144 deletions
diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c
index dbc19c94e..3084c84e3 100644
--- a/src/code_80005FD0.c
+++ b/src/code_80005FD0.c
@@ -1158,177 +1158,142 @@ void func_80008424(s32 playerId, f32 arg1, Player *player) {
}
}
-#ifdef MIPS_TO_C
+#ifdef NON_MATCHING
//generated by m2c commit 05102b12b75400ad2be8bd0872404237b36e1702 on Feb-20-2024
-static ? D_800DCAF4; /* unable to generate initializer: unknown type */
-static ? D_800DCB34; /* unable to generate initializer: unknown type */
-static ? *D_800DCBB4[0x15] = {
- &D_800DCB34,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
- &D_800DCAF4,
-};
-
-s32 func_800088D8(s32 arg0, s16 arg1, s16 arg2) {
- s32 sp10;
- s32 *sp4;
- Player *temp_t1;
- f32 temp_f0;
- f32 temp_f0_2;
- f32 temp_f0_3;
- s16 temp_t5_2;
- s16 temp_v0;
+// static ? D_800DCAF4; /* unable to generate initializer: unknown type */
+// static ? D_800DCB34; /* unable to generate initializer: unknown type */
+// static ? *D_800DCBB4[0x15] = {
+// &D_800DCB34,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// &D_800DCAF4,
+// };
+
+s32 func_800088D8(s32 playerId, s16 arg1, s16 arg2) {
+ Player* player;
+ f32 interp;
+ s16 rank;
s16 var_a0_4;
- s16 var_a1;
s16 var_t1;
s16 var_v0;
- s32 *temp_t4;
- s32 *temp_t5;
- s32 *var_v1;
+ s16* temp_a3;
s32 temp_a2;
- s32 temp_lo;
- s32 temp_t2;
- s32 temp_t8;
- s32 var_a0;
+ s32 arg1_times_8;
s32 var_a0_2;
- s32 var_a0_5;
- s32 var_a1_2;
- s32 var_a1_3;
+ s32 progress;
s32 var_a1_4;
- u16 *var_a0_3;
- u16 temp_t7;
- void *temp_a2_2;
- void *temp_a3;
-
- var_a1 = arg1;
- temp_t5 = &D_80163128[arg0];
- temp_t4 = &D_80163150[arg0];
- *temp_t5 = -1;
- *temp_t4 = -1;
+ s32 i;
+
+ D_80163128[playerId] = -1;
+ D_80163150[playerId] = -1;
if (gModeSelection == 1) {
- return 1;
+ return TRUE;
}
- if (var_a1 < 0) {
- return 1;
+ if (arg1 < 0) {
+ return TRUE;
+ } else if (arg1 >= 4) {
+ arg1 = 3;
}
- if (var_a1 >= 4) {
- var_a1 = 3;
+ if (D_80163330[playerId] == 1) {
+ return TRUE;
}
- if (D_80163330[arg0] == 1) {
- return 1;
- }
- temp_t1 = &gPlayers[arg0];
- if (temp_t1->type & 0x4000) {
- return 1;
+ player = &gPlayers[playerId];
+ if (player->type & 0x4000) {
+ return TRUE;
}
- temp_t2 = var_a1 * 8;
- temp_a3 = D_800DCBB4[gCurrentCourseId] + (temp_t2 * 2);
+ arg1_times_8 = arg1 * 8;
+ temp_a3 = &D_800DCBB4[gCurrentCourseId][arg1_times_8];
if (arg2 == 0) {
if (gDemoMode == 1) {
- temp_a2 = D_80164450[arg0].unk2 - D_80164450[*(D_80164378 + 0xE)].unk2;
- var_a1_2 = temp_a2;
+ temp_a2 = D_80164450[playerId] - D_80164450[D_80164378[7]];
if (temp_a2 < 0) {
- var_a1_2 = -temp_a2;
+ temp_a2 = -temp_a2;
}
- if (temp_t2 < 0x18) {
- temp_f0 = gLapCompletionPercentByPlayerId[arg0];
- var_a0 = (s32) (((f32) temp_a3->unk10 * temp_f0) + ((f32) temp_a3->unk0 * (1.0f - temp_f0)));
+ if (arg1_times_8 < 24) {
+ interp = gLapCompletionPercentByPlayerId[playerId];
+ D_80163150[playerId] = temp_a3[8] * interp + temp_a3[0] * (1.0f - interp);
} else {
- var_a0 = (s32) temp_a3->unk0;
+ D_80163150[playerId] = temp_a3[0];
}
- *temp_t4 = var_a0;
- if ((var_a0 < var_a1_2) && (((temp_t1->unk_094 / 18.0f) * 216.0f) >= 20.0f)) {
- goto block_55;
+ if (D_80163150[playerId] < temp_a2 && player->unk_094 / 18.0f * 216.0f >= 20.0f) {
+ return FALSE;
}
- return 1;
+ return TRUE;
}
- temp_v0 = D_80164450[arg0].unk2;
- var_a1_3 = temp_v0 - D_80164450[D_80163478].unk2;
- temp_t5_2 = *(gGPCurrentRaceRankByPlayerId + 2 + (D_80163478 * 4));
- if ((((s32) (*gWaypointCountByPathIndex * 2) / 3) < var_a1_3) && (temp_t5_2 >= 6)) {
- var_a1_3 = temp_v0 - D_80164450[*(gLapCountByPlayerId - 0x1A + (temp_t5_2 * 2))].unk2;
+ progress = D_80164450[playerId] - D_80164450[D_80163478];
+ rank = gGPCurrentRaceRankByPlayerId[2 + (D_80163478 * 4)];
+ if (gWaypointCountByPathIndex[0] * 2 / 3 < progress && rank >= 6) {
+ progress = D_80164450[playerId] - D_80164450[gLapCountByPlayerId[-26 + rank * 2]];
}
- if (var_a1_3 < 0) {
- var_a1_3 = -var_a1_3;
+ if (progress < 0) {
+ progress = -progress;
}
- if (temp_t2 < 0x18) {
- temp_f0_2 = gLapCompletionPercentByPlayerId[arg0];
- var_a0_2 = (s32) (((f32) temp_a3->unk10 * temp_f0_2) + ((f32) temp_a3->unk0 * (1.0f - temp_f0_2)));
+ if (arg1_times_8 < 24) {
+ interp = gLapCompletionPercentByPlayerId[playerId];
+ var_a0_2 = temp_a3[8] * interp + temp_a3[0] * (1.0f - interp);
} else {
- var_a0_2 = (s32) temp_a3->unk0;
+ var_a0_2 = temp_a3[0];
}
- temp_lo = (gCCSelection + 1) * var_a0_2;
- *temp_t4 = temp_lo;
- if ((temp_lo < var_a1_3) && (((temp_t1->unk_094 / 18.0f) * 216.0f) >= 20.0f)) {
- goto block_55;
+ D_80163150[playerId] = (gCCSelection + 1) * var_a0_2;
+ if (D_80163150[playerId] < progress && player->unk_094 / 18.0f * 216.0f >= 20.0f) {
+ return FALSE;
}
- return 1;
- }
- var_a0_3 = D_80163344;
- temp_t8 = D_80164450[(s16) *D_80163344].unk2 - D_80164450[arg0].unk2;
- sp10 = temp_t8;
- var_a1_4 = temp_t8;
- if (temp_t8 < 0) {
- var_a1_4 = -temp_t8;
- }
- var_v0 = 0;
- do {
- temp_t7 = *var_a0_3;
- var_a0_3 += 2;
- if (gGPCurrentRaceRankByPlayerId[temp_t7] < arg2) {
- var_v0 += 1;
- }
- } while ((u32) var_a0_3 < (u32) D_80163348);
- var_a0_4 = 0;
- var_v1 = gGPCurrentRaceRankByPlayerId;
- if (gPlayerCount > 0) {
- sp4 = &gGPCurrentRaceRankByPlayerId[gPlayerCount];
- do {
- if (*var_v1 < arg2) {
- var_a0_4 += 1;
- }
- var_v1 += 4;
- } while ((u32) var_v1 < (u32) sp4);
- }
- var_t1 = (arg2 - var_v0) - var_a0_4;
- if ((var_v0 > 0) || (var_a0_4 > 0)) {
- var_t1 += 1;
- }
- D_80164538[arg0] = var_t1;
- if ((var_t1 < 0) || (var_t1 >= 8)) {
- goto block_55;
- }
- if (temp_t2 < 0x18) {
- temp_a2_2 = temp_a3 + (var_t1 * 2);
- temp_f0_3 = gLapCompletionPercentByPlayerId[arg0];
- var_a0_5 = (s32) (((f32) temp_a2_2->unk10 * temp_f0_3) + ((f32) temp_a2_2->unk0 * (1.0f - temp_f0_3)));
+ return TRUE;
} else {
- var_a0_5 = (s32) *(temp_a3 + (var_t1 * 2));
- }
- *temp_t5 = var_a1_4;
- *temp_t4 = var_a0_5;
- if (var_a0_5 < var_a1_4) {
- return 1;
+ var_a1_4 = D_80164450[(s16) *D_80163344] - D_80164450[playerId];
+ if (var_a1_4 < 0) {
+ var_a1_4 = -var_a1_4;
+ }
+ var_v0 = 0;
+ for (i = 0; i < 2; i++) {
+ if (gGPCurrentRaceRankByPlayerId[D_80163344[i]] < arg2) {
+ var_v0++;
+ }
+ }
+ var_a0_4 = 0;
+ for (i = 0; i < gPlayerCount; i++) {
+ if (gGPCurrentRaceRankByPlayerId[i] < arg2) {
+ var_a0_4++;
+ }
+ }
+ var_t1 = (arg2 - var_v0) - var_a0_4;
+ if (var_v0 > 0 || var_a0_4 > 0) {
+ var_t1++;
+ }
+ D_80164538[playerId] = var_t1;
+ if (var_t1 < 0 || var_t1 >= 8) {
+ return FALSE;
+ }
+ if (arg1_times_8 < 24) {
+ temp_a3 = &temp_a3[var_t1];
+ interp = gLapCompletionPercentByPlayerId[playerId];
+ D_80163150[playerId] = temp_a3[8] * interp + temp_a3[0] * (1.0f - interp);
+ } else {
+ D_80163150[playerId] = temp_a3[var_t1];
+ }
+ D_80163128[playerId] = var_a1_4;
+ if (D_80163150[playerId] < var_a1_4) {
+ return TRUE;
+ }
+ return FALSE;
}
-block_55:
- return 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800088D8.s")