summaryrefslogtreecommitdiff
path: root/src/code_80005FD0.c
diff options
context:
space:
mode:
authorTyler McGavran <tyler.taggerung@gmail.com>2024-01-05 18:03:45 -0500
committerGitHub <noreply@github.com>2024-01-05 16:03:45 -0700
commit4429c490627ac9fa8f45e95924a0b25a554f12f3 (patch)
tree289711b286f5953f4c82fc86368fea70e67fb763 /src/code_80005FD0.c
parentb923157c6781fbf9783b2554b1e5abbdc59f1449 (diff)
Match a function, add some comments for some NON_MATCHING functions (#528)
Signed-off-by: Taggerung <tyler.taggerung@email.com>
Diffstat (limited to 'src/code_80005FD0.c')
-rw-r--r--src/code_80005FD0.c168
1 files changed, 65 insertions, 103 deletions
diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c
index bc3c09c58..3ae925ae0 100644
--- a/src/code_80005FD0.c
+++ b/src/code_80005FD0.c
@@ -1161,10 +1161,10 @@ void func_80008424(s32 playerId, f32 arg1, Player *player) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Dec-26-2023
-static ? D_800DCAF4; /* unable to generate initializer */
-static ? D_800DCB34; /* unable to generate initializer */
-static ? *D_800DCBB4[0x15] = {
+//generated by m2c commit a39b70e85329b0bcaeb4350510ddb23dc9840dce on Jan-01-2024
+static s16 D_800DCAF4; /* unable to generate initializer: not enough data */
+static s16 D_800DCB34; /* unable to generate initializer: not enough data */
+s16 *D_800DCBB4[0x15] = {
&D_800DCB34,
&D_800DCAF4,
&D_800DCAF4,
@@ -1195,6 +1195,8 @@ s32 func_800088D8(s32 arg0, s16 arg1, s16 arg2) {
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f0_3;
+ s16 *temp_a2_2;
+ s16 *temp_a3;
s16 temp_t5_2;
s16 temp_v0;
s16 var_a0_4;
@@ -1216,8 +1218,6 @@ s32 func_800088D8(s32 arg0, s16 arg1, s16 arg2) {
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];
@@ -1241,7 +1241,7 @@ s32 func_800088D8(s32 arg0, s16 arg1, s16 arg2) {
return 1;
}
temp_t2 = var_a1 * 8;
- temp_a3 = D_800DCBB4[gCurrentCourseId] + (temp_t2 * 2);
+ temp_a3 = &D_800DCBB4[gCurrentCourseId][temp_t2];
if (arg2 == 0) {
if (gDemoMode == (u16) 1) {
temp_a2 = D_80164450[arg0].unk2 - D_80164450[*(D_80164378 + 0xE)].unk2;
@@ -1318,11 +1318,11 @@ s32 func_800088D8(s32 arg0, s16 arg1, s16 arg2) {
goto block_55;
}
if (temp_t2 < 0x18) {
- temp_a2_2 = temp_a3 + (var_t1 * 2);
+ temp_a2_2 = &temp_a3[var_t1];
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)));
} else {
- var_a0_5 = (s32) *(temp_a3 + (var_t1 * 2));
+ var_a0_5 = (s32) temp_a3[var_t1].unk0;
}
*temp_t5 = var_a1_4;
*temp_t4 = var_a0_5;
@@ -2545,7 +2545,7 @@ s16 func_8000C9DC(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex
return nearestWaypointIndex;
}
-void func_8000CBA4(UNUSED f32 posX, f32 posY, UNUSED f32 posZ, s16 *waypointIndex) {
+void func_8000CBA4(UNUSED f32 posX, f32 posY, UNUSED f32 posZ, s16 *waypointIndex, s32 arg4) {
s16 var_v0;
var_v0 = *waypointIndex;
@@ -2582,106 +2582,68 @@ s16 func_8000CC88(f32 posX, f32 posY, f32 posZ, Player *player, s32 playerId, s3
return ret;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit b52d92c2340f6f4ba1aafb464188bb698752fbb0 on Jul-08-2023
s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, Player *player, s32 playerId, s32 pathIndex) {
s16 sp5E;
- s32 sp48;
- s16 *sp44;
- f32 var_f20;
- f32 var_f22;
- f32 var_f24;
- s16 *temp_v1_2;
- s16 temp_a0;
- s16 temp_v0_2;
- s16 temp_v0_3;
- s16 temp_v0_4;
- s16 temp_v0_5;
- s16 temp_v0_6;
- s16 temp_v0_7;
- s16 var_v0;
+ s16 stackPadding0;
+ s32 stackPadding1;
+ s32 stackPadding2;
TrackWaypoint *temp_v1;
- TrackWaypoint *temp_v1_3;
- TrackWaypoint *temp_v1_4;
- u16 temp_v0;
-
- temp_v0 = player->type;
- var_f24 = posZ;
- var_f20 = posX;
- var_f22 = posY;
- if ((temp_v0 & 0x4000) && !(temp_v0 & 0x1000)) {
- temp_v0_2 = func_8000C884(var_f20, var_f22, var_f24, waypointIndex, pathIndex, (u16) func_802ABD40(player->unk_110.unk3A));
- sp5E = temp_v0_2;
- if (temp_v0_2 == -1) {
- sp5E = func_8000CC88(var_f20, var_f22, var_f24, player, playerId, &pathIndex);
- }
- goto block_17;
- }
- sp48 = playerId * 2;
- if (D_801631E0[playerId] == 1) {
- temp_a0 = player->unk_0CA;
- if (temp_a0 & 1) {
- temp_v1 = &D_80164550[pathIndex][waypointIndex];
- player->pos[0] = (f32) temp_v1->posX;
- player->pos[1] = (f32) temp_v1->posY;
- player->unk_0CA = temp_a0 & 0xFFFE;
- player->pos[2] = (f32) temp_v1->posZ;
- return waypointIndex;
- }
- if (playerId == ((s32) D_80163488 % 8)) {
- func_802ADDC8(&player->unk_110, 10.0f, var_f20, var_f22, var_f24);
- temp_v0_3 = func_802ABD40(player->unk_110.unk3A);
- temp_v1_2 = sp48 + D_80163318;
- *temp_v1_2 = temp_v0_3;
- sp44 = temp_v1_2;
- var_v0 = func_8000C884(var_f20, var_f22, var_f24, waypointIndex, pathIndex, (u16) (temp_v0_3 & 0xFFFF));
- sp5E = var_v0;
- if (var_v0 == -1) {
- sp44 = temp_v1_2;
- var_v0 = func_8000C9DC(var_f20, var_f22, var_f24, waypointIndex, pathIndex);
- sp5E = var_v0;
- }
- if (var_v0 == -1) {
- temp_v0_4 = func_8000C0BC(var_f20, var_f22, var_f24, (u16) *temp_v1_2, &pathIndex);
- sp5E = temp_v0_4;
- temp_v1_3 = &D_80164550[pathIndex][temp_v0_4];
- player->pos[0] = (f32) temp_v1_3->posX;
- player->pos[1] = (f32) temp_v1_3->posY;
- player->pos[2] = (f32) temp_v1_3->posZ;
+
+ if ((player->type & 0x4000) && !(player->type & 0x1000)) {
+ sp5E = func_8000C884(posX, posY, posZ, waypointIndex, pathIndex, (u16) func_802ABD40(player->unk_110.unk3A));
+ if (sp5E == -1) {
+ sp5E = func_8000CC88(posX, posY, posZ, player, playerId, &pathIndex);
+ }
+ } else {
+ if (D_801631E0[playerId] == 1) {
+ if (player->unk_0CA & 1) {
+ temp_v1 = &D_80164550[pathIndex][waypointIndex];
+ player->pos[0] = (f32) temp_v1->posX;
+ player->pos[1] = (f32) temp_v1->posY;
+ player->pos[2] = (f32) temp_v1->posZ;
+ player->unk_0CA &= ~0x0001;
+ return waypointIndex;
+ }
+ if (playerId == ((s32) D_80163488 % 8)) {
+ func_802ADDC8(&player->unk_110, 10.0f, posX, posY, posZ);
+ D_80163318[playerId] = func_802ABD40(player->unk_110.unk3A);
+ sp5E = func_8000C884(posX, posY, posZ, waypointIndex, pathIndex, D_80163318[playerId]);
+ if (sp5E == -1) {
+ sp5E = func_8000C9DC(posX, posY, posZ, waypointIndex, pathIndex);
+ }
+ if (sp5E == -1) {
+ sp5E = func_8000C0BC(posX, posY, posZ, D_80163318[playerId], &pathIndex);
+ temp_v1 = &D_80164550[pathIndex][sp5E];
+ player->pos[0] = (f32) temp_v1->posX;
+ player->pos[1] = (f32) temp_v1->posY;
+ player->pos[2] = (f32) temp_v1->posZ;
+ }
+ } else {
+ sp5E = func_8000C9DC(posX, posY, posZ, waypointIndex, pathIndex);
+ if (sp5E == -1) {
+ sp5E = func_8000BD94(posX, posY, posZ, pathIndex);
+ temp_v1 = &D_80164550[pathIndex][sp5E];
+ posX = (f32) temp_v1->posX;
+ posY = (f32) temp_v1->posY;
+ posZ = (f32) temp_v1->posZ;
+ player->pos[0] = posX;
+ player->pos[1] = posY;
+ player->pos[2] = posZ;
+ func_802ADDC8(&player->unk_110, 10.0f, posX, posY, posZ);
+ D_80163318[playerId] = func_802ABD40(player->unk_110.unk3A);
+ }
}
} else {
- temp_v0_5 = func_8000C9DC(var_f20, var_f22, var_f24, waypointIndex, pathIndex);
- sp5E = temp_v0_5;
- if (temp_v0_5 == -1) {
- temp_v0_6 = func_8000BD94(var_f20, var_f22, var_f24, pathIndex);
- sp5E = temp_v0_6;
- temp_v1_4 = &D_80164550[pathIndex][temp_v0_6];
- var_f20 = (f32) temp_v1_4->posX;
- var_f22 = (f32) temp_v1_4->posY;
- player->pos[0] = var_f20;
- var_f24 = (f32) temp_v1_4->posZ;
- player->pos[1] = var_f22;
- player->pos[2] = var_f24;
- func_802ADDC8(&player->unk_110, 10.0f, var_f20, var_f22, var_f24);
- *(D_80163318 + sp48) = func_802ABD40(player->unk_110.unk3A);
- }
- }
- goto block_16;
- }
- temp_v0_7 = func_8000C9DC(var_f20, var_f22, var_f24, waypointIndex, pathIndex);
- sp5E = temp_v0_7;
- if (temp_v0_7 == -1) {
- sp5E = func_8000CC88(var_f20, var_f22, var_f24, player, playerId, &pathIndex);
- }
-block_16:
- func_8000CBA4(var_f20, var_f22, var_f24, &sp5E, /* extra? */ pathIndex);
-block_17:
- func_8000CBF8(var_f20, var_f22, var_f24, &sp5E, pathIndex);
+ sp5E = func_8000C9DC(posX, posY, posZ, waypointIndex, pathIndex);
+ if (sp5E == -1) {
+ sp5E = func_8000CC88(posX, posY, posZ, player, playerId, &pathIndex);
+ }
+ }
+ func_8000CBA4(posX, posY, posZ, &sp5E, pathIndex);
+ }
+ func_8000CBF8(posX, posY, posZ, &sp5E, pathIndex);
return sp5E;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000CD24.s")
-#endif
s16 func_8000D100(f32 xPos, f32 yPos, f32 zPos, s16 arg3) {
f32 xdiff;