summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/code_80005FD0.c3636
-rw-r--r--src/code_80005FD0.h103
-rw-r--r--src/code_80057C60.c51
-rw-r--r--src/code_8006E9C0.c630
-rw-r--r--src/code_8006E9C0.h6
-rw-r--r--src/code_800B45E0.c162
-rw-r--r--src/racing/actors.h2
7 files changed, 1875 insertions, 2715 deletions
diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c
index 6ec8ee1b8..99e8cc0b4 100644
--- a/src/code_80005FD0.c
+++ b/src/code_80005FD0.c
@@ -9,6 +9,7 @@
#include "waypoints.h"
#include "camera.h"
#include "actors.h"
+#include "actors_extended.h"
#include "code_8001F980.h"
#include "player_controller.h"
#include "code_80071F00.h"
@@ -24,7 +25,6 @@
#include "common_structs.h"
#include "main.h"
#include "menus.h"
-#include <actor_types.h>
extern UnkCommonTextureStruct0 *D_800DC720[];
@@ -1426,22 +1426,17 @@ f32 func_80009258(UNUSED s32 playerId, f32 arg1, f32 arg2) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-void func_800065D0(s32, Player *, s32 *); /* extern */
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-12-2023
+? func_800065D0(s32, Player *, s32 *); /* extern */
f32 func_80009258(s32, f32, f32, u16 *); /* extern */
-void func_80011AE4(s32); /* extern */
extern s16 D_801630E0;
extern s16 D_801630E2;
extern ? D_80163240;
-extern f32 D_80163450;
-extern s16 D_80163478;
-extern s16 D_8016348C;
+extern ? D_80163450;
extern s16 D_801634EC;
extern ? D_801642DE;
extern ? D_801643B0;
-extern s32 D_80164408;
extern s32 D_8016440C;
-extern s8 gPlayerCount;
s16 gCurrentCourseId; /* unable to generate initializer */
void func_8000929C(s32 playerId, Player *player) {
@@ -1453,15 +1448,12 @@ void func_8000929C(s32 playerId, Player *player) {
s16 *sp2C;
f32 temp_f0;
f32 temp_f0_2;
- f32 temp_f0_3;
- f32 temp_f0_4;
f32 temp_f12;
s16 *temp_v1;
s16 temp_a3;
- s16 temp_v0;
s16 var_t0;
+ s32 *temp_v0;
s32 *temp_v0_2;
- s32 *temp_v0_3;
s32 *var_v0;
s32 temp_t1;
s32 temp_t2;
@@ -1471,8 +1463,8 @@ void func_8000929C(s32 playerId, Player *player) {
s32 var_a3;
s32 var_v1;
u16 *temp_t0;
+ u16 temp_v0_3;
u16 temp_v0_4;
- u16 temp_v0_5;
temp_f0 = player->pos[2];
temp_f12 = player->pos[0];
@@ -1493,17 +1485,16 @@ void func_8000929C(s32 playerId, Player *player) {
sp4C = temp_f12;
func_80008F38(playerId);
}
- temp_v0 = gCurrentCourseId;
- if (temp_v0 == 0x0014) {
- func_8000B95C(playerId, D_80162FCE & 0xFFFF, D_80163448);
+ if (gCurrentCourseId == 0x0014) {
+ func_8000B95C(playerId, temp_a3 & 0xFFFF, D_80163448);
return;
}
- if ((D_80162FCE < 0x14) || ((gWaypointCountByPathIndex[D_80163448] - 0x14) < D_80162FCE) || (temp_v0 == 0x000B)) {
+ if ((temp_a3 < 0x14) || ((gWaypointCountByPathIndex[D_80163448] - 0x14) < temp_a3) || (gCurrentCourseId == 0x000B)) {
var_v1 = 0;
var_t0 = 0;
- if (temp_v0 == 0x000B) {
+ if (gCurrentCourseId == 0x000B) {
D_801634EC = 0;
- if ((player->effects & 0x200) != 0) {
+ if (player->effects & 0x200) {
D_801634EC = 1;
}
if (gIsMirrorMode != 0) {
@@ -1538,64 +1529,58 @@ block_25:
var_a3 = playerId * 4;
}
sp38 = *(&D_80163450 + var_a3);
- if (var_v1 != 0) {
- temp_f0_2 = D_8016344C;
- if (sp44 <= temp_f0_2) {
- temp_v0_2 = var_a3 + gLapCountByPlayerId;
- if (temp_f0_2 < sp38) {
- temp_t1 = *temp_v0_2 + 1;
- *temp_v0_2 = temp_t1;
- if ((gModeSelection == GRAND_PRIX) && (temp_t1 == 5)) {
- var_v0 = gLapCountByPlayerId;
- if (*(&D_80164408 + var_a3) == 7) {
- do {
- temp_t5 = var_v0->unk0;
- temp_t7 = var_v0->unk4;
- temp_t9 = var_v0->unk8;
- temp_t2 = var_v0->unkC;
- var_v0 += 0x10;
- var_v0->unk-4 = (s32) (temp_t2 - 1);
- var_v0->unk-8 = (s32) (temp_t9 - 1);
- var_v0->unk-C = (s32) (temp_t7 - 1);
- var_v0->unk-10 = (s32) (temp_t5 - 1);
- } while (var_v0 != &D_801643B0);
- }
+ if ((var_v1 != 0) && (sp44 <= D_8016344C)) {
+ temp_v0 = var_a3 + gLapCountByPlayerId;
+ if (D_8016344C < sp38) {
+ temp_t1 = *temp_v0 + 1;
+ *temp_v0 = temp_t1;
+ if ((gModeSelection == 0) && (temp_t1 == 5)) {
+ var_v0 = gLapCountByPlayerId;
+ if (*(D_80164408 + var_a3) == 7) {
+ do {
+ temp_t5 = var_v0->unk0;
+ temp_t7 = var_v0->unk4;
+ temp_t9 = var_v0->unk8;
+ temp_t2 = var_v0->unkC;
+ var_v0 += 0x10;
+ var_v0->unk-4 = (s32) (temp_t2 - 1);
+ var_v0->unk-8 = (s32) (temp_t9 - 1);
+ var_v0->unk-C = (s32) (temp_t7 - 1);
+ var_v0->unk-10 = (s32) (temp_t5 - 1);
+ } while (var_v0 != &D_801643B0);
}
- *sp2C = 1;
- sp34 = var_t0;
+ }
+ *sp2C = 1;
+ sp34 = var_t0;
+ sp30 = var_a3;
+ func_80008F38(playerId);
+ func_80011AE4(playerId);
+ *(&D_801642DE + (playerId * 0x10)) = 0;
+ if ((D_8016348C == 0) && !(player->type & 0x800)) {
sp30 = var_a3;
- func_80008F38(playerId);
- func_80011AE4(playerId);
- *(&D_801642DE + (playerId * 0x10)) = 0;
- if ((D_8016348C == 0) && ((player->type & PLAYER_CINEMATIC_MODE) == 0)) {
- sp30 = var_a3;
- sp34 = var_t0;
- temp_f0_3 = func_80009258(playerId, sp38, sp44, (u16 *) var_a3);
- *(gTimePlayerLastTouchedFinishLine + var_a3) = temp_f0_3;
- }
+ sp34 = var_t0;
+ temp_f0_2 = func_80009258(playerId, sp38, sp44, (u16 *) var_a3);
+ *(gTimePlayerLastTouchedFinishLine + var_a3) = temp_f0_2;
}
}
}
- if (var_t0 != 0) {
- temp_f0_4 = D_8016344C;
- if (sp38 <= temp_f0_4) {
- temp_v0_3 = var_a3 + gLapCountByPlayerId;
- if (temp_f0_4 < sp44) {
- *temp_v0_3 -= 1;
- func_80008F38(playerId);
- }
+ if ((var_t0 != 0) && (sp38 <= D_8016344C)) {
+ temp_v0_2 = var_a3 + gLapCountByPlayerId;
+ if (D_8016344C < sp44) {
+ *temp_v0_2 -= 1;
+ func_80008F38(playerId);
}
}
}
*(&D_80163450 + (playerId * 4)) = sp44;
- if ((gCurrentCourseId == 4) && (D_801630E2 == 1) && ((func_80009000(playerId), temp_v0_4 = player->type, ((temp_v0_4 & 0x4000) == 0)) || ((temp_v0_4 & 0x1000) != 0))) {
+ if ((gCurrentCourseId == 4) && (D_801630E2 == 1) && ((func_80009000(playerId), temp_v0_3 = player->type, ((temp_v0_3 & 0x4000) == 0)) || (temp_v0_3 & 0x1000))) {
func_800090F0(playerId, player);
}
- temp_v0_5 = player->type;
- if (((temp_v0_5 & 0x4000) != 0) && ((temp_v0_5 & 0x1000) == 0)) {
+ temp_v0_4 = player->type;
+ if ((temp_v0_4 & 0x4000) && !(temp_v0_4 & 0x1000)) {
func_800065D0(playerId, player, &D_80163448);
- if ((gModeSelection == GRAND_PRIX) && (gPlayerCount == 2) && (playerId == 0)) {
- if (D_80164408 < D_8016440C) {
+ if ((gModeSelection == 0) && (gPlayerCount == 2) && (playerId == 0)) {
+ if (*D_80164408 < D_8016440C) {
D_80163478 = 0;
} else {
D_80163478 = 1;
@@ -1645,32 +1630,47 @@ void func_800097E0(void) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-void func_800C92CC(u8, ?, s16 *, Player *); /* extern */
-extern s16 D_80163398;
-extern s16 D_801633B0;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-12-2023
+extern ? D_80163398;
+extern ? D_801633B0;
-void func_800098FC(u8 arg0, Player *player) {
+void func_800098FC(u32 arg0, Player *player) {
s32 sp1C;
s16 *sp18;
s16 *temp_a2;
s16 *temp_a2_2;
- s32 temp_v0;
s32 temp_v0_2;
s32 temp_v1;
+ u32 temp_v0;
temp_v1 = arg0 * 2;
temp_a2 = temp_v1 + &D_80163398;
- if ((*temp_a2 >= 0xB) && ((temp_v0 = player->effects, ((temp_v0 & 0x80) != 0)) || ((temp_v0 & 0x40) != 0) || (temp_v0 & 0x20000))) {
- sp1C = temp_v1;
- sp18 = temp_a2;
- func_800C92CC(arg0, 0x2900800A, temp_a2, player);
- *temp_a2 = 0;
+ if (*temp_a2 >= 0xB) {
+ temp_v0 = player->effects;
+ if (!(temp_v0 & 0x80) && !(temp_v0 & 0x40)) {
+ if (temp_v0 & 0x20000) {
+ goto block_6;
+ }
+ } else {
+block_6:
+ sp1C = temp_v1;
+ sp18 = temp_a2;
+ func_800C92CC((u8) arg0, 0x2900800AU);
+ *temp_a2 = 0;
+ }
}
temp_a2_2 = temp_v1 + &D_801633B0;
- if ((*temp_a2_2 >= 0xB) && ((temp_v0_2 = player->statusEffects, ((temp_v0_2 << 9) < 0)) || ((temp_v0_2 << 7) < 0) || ((temp_v0_2 & 2) != 0) || ((temp_v0_2 & 4) != 0) || (player->effects & 0x04000000))) {
+ if (*temp_a2_2 >= 0xB) {
+ temp_v0_2 = player->statusEffects;
+ if (!(temp_v0_2 & 0x400000) && !(temp_v0_2 & 0x01000000) && !(temp_v0_2 & 2) && !(temp_v0_2 & 4)) {
+ if (player->effects & 0x04000000) {
+ goto block_15;
+ }
+ return;
+ }
+block_15:
sp18 = temp_a2_2;
- func_800C92CC(arg0, 0x2900800B, temp_a2_2, player);
+ func_800C92CC((u8) arg0, 0x2900800BU);
*temp_a2_2 = 0;
}
}
@@ -1679,57 +1679,48 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800098FC.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C92CC(s32, ?); // extern
-extern s16 D_80163398;
-extern s16 D_801633B0;
-extern s16 D_801633C8;
-extern s32 D_801643E0;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-12-2023
+extern ? D_80163398;
+extern ? D_801633B0;
+extern ? D_801633C8;
-void func_800099EC(s32 arg0, ? arg1) {
+void func_800099EC(s32 arg0, s32 arg1) {
s32 sp40;
s16 *temp_s7;
s16 *temp_v0_2;
s16 *temp_v0_3;
s16 temp_v1_2;
s16 temp_v1_3;
- s32 temp_s0;
+ s32 *var_s2;
s32 temp_t6;
s32 temp_v0;
s32 temp_v1;
- s8 temp_a0;
- s32 *phi_s2;
- s32 phi_s1;
- s32 phi_s0;
- s32 phi_a0;
+ s32 var_s0;
+ s32 var_s1;
temp_t6 = arg0 * 2;
temp_s7 = temp_t6 + &D_801633C8;
sp40 = temp_t6;
if (*temp_s7 >= 0x65) {
- temp_a0 = gPlayerCount;
- phi_s0 = 0;
- phi_a0 = temp_a0;
- if (temp_a0 > ZERO_PLAYERS_SELECTED) {
- phi_s2 = gGPCurrentRaceRankByPlayerId;
- phi_s1 = 0;
+ var_s0 = 0;
+ if (gPlayerCount > 0) {
+ var_s2 = gGPCurrentRaceRankByPlayerId;
+ var_s1 = 0;
do {
temp_v0 = gGPCurrentRaceRankByPlayerId[arg0];
- temp_v1 = *phi_s2;
- if ((temp_v0 < temp_v1) && (temp_v0 == *(&D_801643E0 + phi_s1)) && (temp_v1 == *(&D_801643E0 + (arg0 * 4)))) {
- func_800C92CC(arg0 & 0xFF, 0x2900800D);
+ temp_v1 = *var_s2;
+ if ((temp_v0 < temp_v1) && (temp_v0 == *(D_801643E0 + var_s1)) && (temp_v1 == D_801643E0[arg0])) {
+ func_800C92CC(arg0 & 0xFF, 0x2900800DU);
*temp_s7 = 0;
- phi_a0 = gPlayerCount;
}
- temp_s0 = phi_s0 + 1;
- phi_s2 += 4;
- phi_s1 += 4;
- phi_s0 = temp_s0;
- } while (temp_s0 < phi_a0);
+ var_s0 += 1;
+ var_s1 += 4;
+ var_s2 += 4;
+ } while (var_s0 < gPlayerCount);
}
}
if (*temp_s7 < 0x3E8) {
- *temp_s7 = *temp_s7 + 1;
+ *temp_s7 += 1;
}
temp_v0_2 = sp40 + &D_80163398;
temp_v1_2 = *temp_v0_2;
@@ -1747,62 +1738,40 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800099EC.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-void func_80008424(s32, ?32, Player *); /* extern */
-void func_8000929C(s32, Player *); /* extern */
-void func_800099EC(s32, Player *); /* extern */
-void func_8000B140(s32); /* extern */
-void func_8000BBD8(s32, ?32, s16, f32 *); /* extern */
-f32 func_8000D3B8(s32); /* extern */
-void func_8000D438(s32, u16); /* extern */
-void func_80011E38(s32); /* extern */
-void func_80012DC0(s32, Player *); /* extern */
-void func_80013054(); /* extern */
-void func_800131DC(s32); /* extern */
-void func_80013854(Player *); /* extern */
-void func_8001AC10(s32); /* extern */
-void func_8003680C(Player *, s16, Player *, s16, Player *); /* extern */
-void set_places(); /* extern */
-extern f32 D_0D009418;
-extern f32 D_0D009568;
-extern f32 D_0D0096B8;
-extern f32 D_0D009808;
-extern f32 D_80162FA0;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-12-2023
+? func_80008424(s32, ?32, Player *); /* extern */
+? func_8000929C(s32, Player *); /* extern */
+? func_800099EC(s32, Player *); /* extern */
+? func_8000B140(s32); /* extern */
+? func_8000D438(s32, u16); /* extern */
extern s16 D_80162FD0;
-extern s16 D_80162FF8;
-extern f32 D_80163028;
-extern s16 D_80163050;
-extern f32 D_80163090;
+extern ? D_80162FF8;
+extern ? D_80163028;
+extern ? D_80163050;
+extern ? D_80163090;
extern ? D_801630B8;
extern u16 D_801630E0;
extern s16 D_801630E2;
-extern s16 D_801630E8;
-extern s32 D_80163100;
-extern f32 D_80163178;
-extern f32 D_801631A0;
-extern s16 D_801631E0;
-extern s16 D_801631F8;
+extern ? D_801630E8;
+extern ? D_80163100;
+extern ? D_80163178;
+extern ? D_801631A0;
+extern ? D_801631F8;
extern ?32 D_8016320C;
-extern f32 D_80163210;
+extern ? D_80163210;
extern ? D_80163240;
-extern s16 D_801632E8;
extern ? D_80163300;
-extern u16 D_80163330;
+extern ? D_80163330;
extern ? D_8016334C;
extern s32 D_80163378;
extern ? D_801633E0;
-extern ? D_80163410;
extern ? D_80163418;
extern ? D_80163438;
extern s16 D_8016344A;
-extern s32 D_80163488;
-//extern ? D_801634F8;
extern ? D_801634FC;
extern ? D_80163504;
-extern u16 D_801646CC;
+s16 gCurrentCourseId; /* unable to generate initializer */
static s16 D_800DCA20[0]; /* unable to generate initializer */
-static ?32 D_800ECFB4 = 0x41055555; /* const */
-static ?32 D_800ECFC8 = 0x40555555; /* const */
f32 D_800DCA4C[0x15] = {
50.0f,
35.0f,
@@ -1826,7 +1795,8 @@ f32 D_800DCA4C[0x15] = {
-1.0f,
40.0f,
};
-s16 gCurrentCourseId; /* unable to generate initializer */
+static ?32 D_800ECFB4 = 0x41055555; /* const */
+static ?32 D_800ECFC8 = 0x40555555; /* const */
void func_80009B60(s32 playerId) {
s16 sp94;
@@ -1845,8 +1815,11 @@ void func_80009B60(s32 playerId) {
?32 *var_v0_2;
?32 *var_v1_3;
Player *temp_v1;
+ Test *temp_v1_2;
+ Test *temp_v1_3;
+ Test *temp_v1_6;
f32 *temp_a2_2;
- f32 *temp_v0_16;
+ f32 *temp_v0_9;
f32 *temp_v1_5;
f32 *temp_v1_7;
f32 temp_f0;
@@ -1858,18 +1831,14 @@ void func_80009B60(s32 playerId) {
f32 temp_f2_2;
s16 *temp_v0_2;
s16 *temp_v1_4;
- s16 temp_v0_11;
+ s16 temp_v0_10;
s16 temp_v0_12;
s16 temp_v0_13;
s16 temp_v0_14;
- s16 temp_v0_17;
- s16 temp_v0_19;
- s16 temp_v0_20;
- s16 temp_v0_21;
s16 temp_v0_3;
- s16 temp_v0_4;
+ s16 temp_v0_5;
s16 temp_v0_6;
- s16 temp_v0_8;
+ s16 temp_v0_7;
s16 temp_v1_8;
s16 var_a0_2;
s16 var_a1;
@@ -1886,11 +1855,6 @@ void func_80009B60(s32 playerId) {
s32 temp_f6;
s32 temp_t5;
s32 temp_t6;
- s32 temp_v0_10;
- s32 temp_v0_18;
- s32 temp_v0_5;
- s32 temp_v0_7;
- s8 temp_v0_9;
u16 *temp_a1;
u16 *temp_a3_2;
u16 *temp_t0;
@@ -1898,12 +1862,10 @@ void func_80009B60(s32 playerId) {
u16 *temp_t6_2;
u16 *temp_t8;
u16 temp_a0;
- u16 temp_a0_2;
u16 var_a0;
- void *temp_v0_15;
- void *temp_v1_2;
- void *temp_v1_3;
- void *temp_v1_6;
+ u32 temp_v0_11;
+ u32 temp_v0_4;
+ void *temp_v0_8;
temp_a3 = playerId * 4;
temp_v0 = temp_a3 + &D_80163100;
@@ -1946,8 +1908,7 @@ void func_80009B60(s32 playerId) {
sp38 = temp_a3;
D_80163448 = (s32) temp_a0;
func_80008DC0((s32) temp_a0);
- temp_v0_4 = gCurrentCourseId;
- switch (temp_v0_4) { /* irregular */
+ switch (gCurrentCourseId) { /* irregular */
case 11:
func_80012DC0(playerId, sp40);
if (playerId == 0) {
@@ -1982,31 +1943,28 @@ void func_80009B60(s32 playerId) {
func_8001AC10(playerId);
}
func_800099EC(playerId, sp40);
- temp_v0_5 = gModeSelection;
D_80162FD0 = 0;
- switch (temp_v0_5) { /* switch 1; irregular */
- case TIME_TRIALS: /* switch 1 */
- case VERSUS: /* switch 1 */
- case BATTLE: /* switch 1 */
+ switch (gModeSelection) { /* switch 1; irregular */
+ case 1: /* switch 1 */
+ case 2: /* switch 1 */
+ case 3: /* switch 1 */
break;
- case GRAND_PRIX: /* switch 1 */
+ case 0: /* switch 1 */
break;
}
- temp_a1 = sp34 + &D_801631E0;
+ temp_a1 = sp34 + D_801631E0;
*temp_a1 = 0;
if ((sp40->effects & 0x1000) && (gCurrentCourseId != 0x0014)) {
*temp_a1 = 1;
}
- temp_v0_6 = gCurrentCourseId;
- if ((D_801646CC == 1) || (sp40->type & 0x800) || (temp_v0_6 == 0x0014)) {
- if (temp_v0_6 != 0x000A) {
+ if (((u16) D_801646CC == 1) || (sp40->type & 0x800) || (gCurrentCourseId == 0x0014)) {
+ if (gCurrentCourseId != 0x000A) {
*(&D_801634FC + (playerId * 0x10)) = 0.0f;
}
*(&D_80163504 + (playerId * 0x10)) = 0.0f;
}
- temp_v0_7 = D_80163448;
- if (temp_v0_7 > 0) {
- temp_v1_2 = (playerId * 0x10) + &D_801634F8;
+ if (D_80163448 > 0) {
+ temp_v1_2 = &D_801634F8[playerId];
temp_v1_2->unk4 = 0.0f;
temp_v1_2->unkC = 0.0f;
}
@@ -2014,7 +1972,7 @@ void func_80009B60(s32 playerId) {
sp24 = temp_t6_2;
temp_a2_2 = sp38 + D_80164510;
temp_a3_2 = sp34 + &D_801631F8;
- *temp_a2_2 = (f32) D_80164550[temp_v0_7][*temp_t6_2].posY + 4.3f;
+ *temp_a2_2 = (f32) D_80164550[D_80163448][*temp_t6_2].posY + 4.3f;
if ((*temp_a3_2 == 1) && (*temp_a1 == 0)) {
sp2C = temp_a1;
sp28 = temp_a2_2;
@@ -2025,11 +1983,10 @@ void func_80009B60(s32 playerId) {
sp40->pos[1] = *temp_a2_2;
}
*temp_a3_2 = *temp_a1;
- temp_v0_8 = gCurrentCourseId;
- if (temp_v0_8 != 4) {
- if (temp_v0_8 != 0x000A) {
+ if (gCurrentCourseId != 4) {
+ if (gCurrentCourseId != 0x000A) {
var_a0 = *temp_a1;
- if (temp_v0_8 != 0x0014) {
+ if (gCurrentCourseId != 0x0014) {
} else {
goto block_63;
@@ -2055,49 +2012,48 @@ block_63:
func_80008424(playerId, *(&D_80163210 + sp38), sp40);
return;
}
- temp_v0_9 = gPlayerCount;
- if ((temp_v0_9 > 0) && (temp_v0_9 < 3) && (*(&D_80163330 + sp34) == 1) && ((s32) *(&D_8016334C + sp34) < *(gGPCurrentRaceRankByPlayerId + sp38))) {
+ if ((gPlayerCount > 0) && (gPlayerCount < 3) && (*(&D_80163330 + sp34) == 1) && ((s32) *(&D_8016334C + sp34) < *(gGPCurrentRaceRankByPlayerId + sp38))) {
var_t0 = sp38 + &D_80163210;
*var_t0 = 0x41055555;
} else if (D_80162FD0 == (s16) 1U) {
- temp_v1_3 = (playerId * 0x10) + &D_801634F8;
+ temp_v1_3 = &D_801634F8[playerId];
sp30 = temp_v1_3;
var_t0 = sp38 + &D_80163210;
- *var_t0 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D0096B8);
+ *var_t0 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + D_0D0096B8);
temp_v1_3->unk4 = -0.5f;
} else if (D_801645E0[D_80162FCE] > 0) {
var_t0 = sp38 + &D_80163210;
- *var_t0 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009418);
+ *var_t0 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + D_0D009418);
} else {
var_t0 = sp38 + &D_80163210;
- *var_t0 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009568);
+ *var_t0 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + D_0D009568);
}
sp3C = var_t0;
func_800131DC(playerId);
func_8000D3B8(playerId);
func_8000D438(playerId, D_801630E0);
- temp_v0_10 = sp40->effects;
- temp_f0 = D_80162FA0.unk0 - sp40->pos[0];
+ temp_v0_4 = sp40->effects;
+ temp_f0 = D_80162FA0->unk0 - sp40->pos[0];
var_t0_2 = var_t0;
- temp_f2 = D_80162FA0.unk8 - sp40->pos[2];
- if (!(temp_v0_10 & 0x80) && !(temp_v0_10 & 0x40) && !(temp_v0_10 & 0x800)) {
+ temp_f2 = D_80162FA0->unk8 - sp40->pos[2];
+ if (!(temp_v0_4 & 0x80) && !(temp_v0_4 & 0x40) && !(temp_v0_4 & 0x800)) {
if (((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) > 6400.0f) {
if (D_80163448 == 0) {
sp3C = var_t0_2;
func_8000B140(playerId);
if (*(&D_80162FF8 + sp34) > 0) {
sp3C = var_t0_2;
- func_8000BBD8(((s32) ((D_801630E0 + 5) & 0xFFFF) % (s32) D_80164430) & 0xFFFF, *(&D_80163090 + sp38), D_8016344A, &D_80162FA0);
+ func_8000BBD8(((s32) ((D_801630E0 + 5) & 0xFFFF) % (s32) D_80164430) & 0xFFFF, *(&D_80163090 + sp38), D_8016344A);
}
}
sp3C = var_t0_2;
- sp40->unk_02E = -get_angle_between_points(sp40->pos, &D_80162FA0);
+ sp40->unk_02C[1] = -get_angle_between_points(sp40->pos, D_80162FA0);
} else {
- sp40->unk_02E = (s16) D_80164590[D_80163448][(s32) (D_801630E0 + 4) % (s32) D_80164430];
+ sp40->unk_02C[1] = D_80164590[D_80163448][(s32) (D_801630E0 + 4) % (s32) D_80164430];
}
}
sp3C = var_t0_2;
- func_8003680C(sp40, 0, sp40);
+ func_8003680C(sp40, 0);
func_80008424(playerId, *var_t0_2, sp40);
return;
}
@@ -2125,16 +2081,16 @@ block_63:
if (var_a1 >= 0xB5) {
var_a1 -= 0x168;
}
- temp_v0_11 = var_a0_2 - var_a1;
- var_v1 = temp_v0_11;
- if (temp_v0_11 < -0xB4) {
- var_v1 = temp_v0_11 + 0x168;
+ temp_v0_5 = var_a0_2 - var_a1;
+ var_v1 = temp_v0_5;
+ if (temp_v0_5 < -0xB4) {
+ var_v1 = temp_v0_5 + 0x168;
}
if (var_v1 >= 0xB5) {
var_v1 -= 0x168;
}
- temp_v0_12 = (s16) *sp2C;
- switch (temp_v0_12) { /* switch 2; irregular */
+ temp_v0_6 = (s16) *sp2C;
+ switch (temp_v0_6) { /* switch 2; irregular */
case -1: /* switch 2 */
if (var_v1 >= 6) {
*sp2C = 0;
@@ -2159,26 +2115,24 @@ block_63:
*temp_v1_5 = func_8000B7E4(playerId, (u16) D_80162FCE);
sp28 = temp_v1_5;
func_8000D438(playerId, (u16) D_80162FCE);
- temp_v0_13 = gCurrentCourseId;
- if (temp_v0_13 != 0x0014) {
+ if (gCurrentCourseId != 0x0014) {
temp_a1_2 = *(D_80164450 + sp38);
if (temp_a1_2 < 0xB) {
- temp_a0_2 = D_801630E0;
- temp_v1_6 = (playerId * 0x10) + &D_801634F8;
- if ((temp_a1_2 > 0) && (temp_v0_13 == 0x000A)) {
+ temp_v1_6 = &D_801634F8[playerId];
+ if ((temp_a1_2 > 0) && (gCurrentCourseId == 0x000A)) {
sp30 = temp_v1_6;
- func_8000BBD8(((s32) ((temp_a0_2 + 0x14) & 0xFFFF) % (s32) D_80164430) & 0xFFFF, 0, 0);
+ func_8000BBD8(((s32) ((D_801630E0 + 0x14) & 0xFFFF) % (s32) D_80164430) & 0xFFFF, 0.0f, 0);
temp_v1_6->unk4 = 0.0f;
} else {
temp_t0 = sp38 + D_80163068;
sp20 = temp_t0;
sp30 = temp_v1_6;
- func_8000BBD8(((s32) ((temp_a0_2 + 8) & 0xFFFF) % (s32) D_80164430) & 0xFFFF, *temp_t0, D_8016344A);
- temp_v1_6->unk0 = (?32) *temp_t0;
+ func_8000BBD8(((s32) ((D_801630E0 + 8) & 0xFFFF) % (s32) D_80164430) & 0xFFFF, *temp_t0, D_8016344A);
+ temp_v1_6->unk0 = *temp_t0;
}
}
if ((D_80162FD0 == 1) && (*(&D_80162FF8 + sp34) == 0)) {
- func_8000BBD8(((s32) ((D_801630E0 + 7) & 0xFFFF) % (s32) D_80164430) & 0xFFFF, 0xBF333333, D_8016344A);
+ func_8000BBD8(((s32) ((D_801630E0 + 7) & 0xFFFF) % (s32) D_80164430) & 0xFFFF, -0.7f, D_8016344A);
}
if (D_80163448 == 0) {
sp3C = sp34 + &D_80162FF8;
@@ -2190,28 +2144,28 @@ block_63:
}
temp_t0_2 = sp38 + D_80163068;
if (gCurrentCourseId == 0x0014) {
- temp_v0_14 = *(&D_80163410 + sp34);
- switch (temp_v0_14) { /* switch 3; irregular */
+ temp_v0_7 = *(D_80163410 + sp34);
+ switch (temp_v0_7) { /* switch 3; irregular */
case 3: /* switch 3 */
- D_80162FA0.unk0 = *(&D_80163418 + sp38);
- D_80162FA0.unk8 = (f32) *(&D_80163438 + sp38);
+ D_80162FA0->unk0 = *(&D_80163418 + sp38);
+ D_80162FA0->unk8 = (f32) *(&D_80163438 + sp38);
break;
case 4: /* switch 3 */
- temp_v0_15 = (((s32) (*sp24 + 0xA) % (s32) *(gWaypointCountByPathIndex + sp34)) * 8) + *(D_80164550 + sp38);
- D_80162FA0.unk0 = (f32) temp_v0_15->unk0;
- D_80162FA0.unk8 = (f32) temp_v0_15->unk4;
+ temp_v0_8 = (((s32) (*sp24 + 0xA) % (s32) *(gWaypointCountByPathIndex + sp34)) * 8) + *(D_80164550 + sp38);
+ D_80162FA0->unk0 = (f32) temp_v0_8->unk0;
+ D_80162FA0->unk8 = (f32) temp_v0_8->unk4;
break;
}
}
- temp_v0_16 = sp38 + &D_80163178;
+ temp_v0_9 = sp38 + &D_80163178;
temp_v1_7 = sp38 + &D_801631A0;
- D_80162FA0.unk0 = (D_80162FA0.unk0 + *temp_v0_16) * 0.5f;
- D_80162FA0.unk8 = (f32) ((D_80162FA0.unk8 + *temp_v1_7) * 0.5f);
- *temp_v0_16 = D_80162FA0.unk0;
+ D_80162FA0->unk0 = (D_80162FA0->unk0 + *temp_v0_9) * 0.5f;
+ D_80162FA0->unk8 = (f32) ((D_80162FA0->unk8 + *temp_v1_7) * 0.5f);
+ *temp_v0_9 = D_80162FA0->unk0;
sp20 = temp_t0_2;
- *temp_v1_7 = D_80162FA0.unk8;
+ *temp_v1_7 = D_80162FA0->unk8;
temp_f2_2 = 1.5f * 182.0f;
- temp_v1_8 = -get_angle_between_points(sp1C, &D_80162FA0) - sp40->unk_02E;
+ temp_v1_8 = -get_angle_between_points(sp1C, D_80162FA0) - sp40->unk_02C[1];
temp_f10 = (s32) temp_f2_2;
var_a2 = temp_v1_8;
temp_f6 = (s32) (-1.5f * 182.0f);
@@ -2221,9 +2175,9 @@ block_63:
if (var_a2 < (s16) temp_f6) {
var_a2 = (s16) temp_f6;
}
- temp_v0_17 = *(D_801631D8 + sp34);
+ temp_v0_10 = *(D_801631D8 + sp34);
var_v1_2 = D_800DCA20[gCurrentCourseId];
- switch (temp_v0_17) { /* switch 4; irregular */
+ switch (temp_v0_10) { /* switch 4; irregular */
case 2: /* switch 4 */
temp_f0_2 = *temp_t0_2;
if (temp_f0_2 > 0.5f) {
@@ -2243,17 +2197,17 @@ block_63:
}
break;
}
- if ((*(&D_801632E8 + sp34) == 2) && ((temp_f0_4 = *temp_t0_2, (temp_f0_4 > 0.9f)) || (temp_f0_4 < -0.9f))) {
+ if ((*(D_801632E8 + sp34) == 2) && ((temp_f0_4 = *temp_t0_2, (temp_f0_4 > 0.9f)) || (temp_f0_4 < -0.9f))) {
*sp2C = 0;
sp40->effects &= ~0x10;
}
- temp_v0_18 = sp40->effects;
- if (temp_v0_18 & 2) {
- temp_v0_19 = (s16) *sp2C;
+ temp_v0_11 = sp40->effects;
+ if (temp_v0_11 & 2) {
+ temp_v0_12 = (s16) *sp2C;
var_a1_2 = -0x0035;
- if (temp_v0_19 != -1) {
+ if (temp_v0_12 != -1) {
var_a1_2 = 0x0035;
- if (temp_v0_19 != 1) {
+ if (temp_v0_12 != 1) {
var_v0_2 = sp34 + &D_80163050;
var_a1_2 = (s16) (s32) (((f32) *var_v0_2 + ((f32) (var_a2 * var_v1_2) / temp_f2_2)) / 2.0f);
} else {
@@ -2262,7 +2216,7 @@ block_63:
} else {
var_v0_2 = sp34 + &D_80163050;
}
- } else if (temp_v0_18 & 0x1000000C) {
+ } else if (temp_v0_11 & 0x1000000C) {
var_a1_2 = 0;
var_v0_2 = sp34 + &D_80163050;
} else {
@@ -2272,28 +2226,28 @@ block_63:
sp3C = var_v0_2;
sp94 = var_a1_2;
sp20 = temp_t0_2;
- func_8003680C((bitwise Player *) 182.0f, (s16) sp40, (Player *) var_a1_2, var_a2, sp40);
+ func_8003680C(sp40, var_a1_2);
*var_v0_2 = var_a1_2;
- if (((bitwise s32) *sp28 == 1) || (temp_v0_20 = (s16) *sp2C, (temp_v0_20 == 1)) || (temp_v0_20 == -1) || (sp40->effects & 0x1000000C)) {
+ if (((bitwise s32) *sp28 == 1) || (temp_v0_13 = (s16) *sp2C, (temp_v0_13 == 1)) || (temp_v0_13 == -1) || (sp40->effects & 0x1000000C)) {
sp20 = temp_t0_2;
var_v1_3 = sp38 + &D_80163028;
- *var_v1_3 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009418);
+ *var_v1_3 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + D_0D009418);
} else {
sp20 = temp_t0_2;
var_v1_3 = sp38 + &D_80163028;
- *var_v1_3 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009568);
+ *var_v1_3 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + D_0D009568);
}
temp_f0_5 = *temp_t0_2;
if ((temp_f0_5 > 0.9f) || (temp_f0_5 < -0.9f)) {
sp34 = var_v1_3;
- *var_v1_3 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009808);
+ *var_v1_3 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + D_0D009808);
}
if (D_80162FD0 == 1) {
sp34 = var_v1_3;
- *var_v1_3 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D0096B8);
+ *var_v1_3 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + D_0D0096B8);
}
- temp_v0_21 = (s16) *sp2C;
- if ((temp_v0_21 == 2) || (temp_v0_21 == -2) || (temp_v0_21 == 3)) {
+ temp_v0_14 = (s16) *sp2C;
+ if ((temp_v0_14 == 2) || (temp_v0_14 == -2) || (temp_v0_14 == 3)) {
*var_v1_3 = 0x40555555;
}
D_8016320C = *var_v1_3;
@@ -2310,11 +2264,11 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80009B60.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-extern s16 D_80162FF8;
-extern s16 D_80163010;
-extern f32 D_80163090;
-extern s16 D_801630E8;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-12-2023
+extern ? D_80162FF8;
+extern ? D_80163010;
+extern ? D_80163090;
+extern ? D_801630E8;
void func_8000B140(s32 playerId) {
s32 spFC;
@@ -2345,6 +2299,7 @@ void func_8000B140(s32 playerId) {
f32 temp_f14_2;
f32 temp_f14_3;
f32 temp_f16;
+ f32 temp_f22;
f32 temp_f2;
f32 temp_f2_2;
f32 temp_f2_3;
@@ -2364,7 +2319,6 @@ void func_8000B140(s32 playerId) {
s16 temp_v0_3;
s16 temp_v1_2;
s16 var_t1;
- s32 temp_a1;
s32 temp_t5;
s32 temp_v0_5;
s32 var_t0;
@@ -2372,14 +2326,16 @@ void func_8000B140(s32 playerId) {
s32 var_t2;
s32 var_v0_2;
u16 temp_v0_2;
+ u32 temp_a1;
temp_v1 = &gPlayers[playerId];
temp_a1 = temp_v1->effects;
- if (((temp_a1 & 0x10) == 0) && (temp_t5 = playerId * 2, temp_v0 = *(&D_801630E8 + temp_t5), sp5C = temp_t5, (temp_v0 != 1)) && (temp_v0 != -1) && (temp_t8 = &D_80163068[playerId], sp54 = temp_t8, sp58 = playerId * 4, temp_f0 = *temp_t8, !(temp_f0 < -1.0f)) && !(temp_f0 > 1.0f) && (temp_v0_2 = temp_v1->characterId, (temp_v0_2 != 5)) && (temp_v0_2 != 7) && (temp_v0_2 != 4) && ((temp_a1 & 0x200) == 0)) {
+ if (!(temp_a1 & 0x10) && (temp_t5 = playerId * 2, temp_v0 = *(&D_801630E8 + temp_t5), sp5C = temp_t5, (temp_v0 != 1)) && (temp_v0 != -1) && (temp_t8 = &D_80163068[playerId], sp54 = temp_t8, sp58 = playerId * 4, temp_f0 = *temp_t8, !(temp_f0 < -1.0f)) && !(temp_f0 > 1.0f) && (temp_v0_2 = temp_v1->characterId, (temp_v0_2 != 5)) && (temp_v0_2 != 7) && (temp_v0_2 != 4) && !(temp_a1 & 0x200)) {
var_t1 = (s16) gNearestWaypointByPlayerId[playerId];
var_a1 = &sp9C;
var_v0 = &spB0[0];
var_t2 = 0;
+ temp_f22 = (temp_v1->unk_094 / 18.0f) * 216.0f;
do {
var_v0 += 2;
var_a1 += 2;
@@ -2400,8 +2356,8 @@ void func_8000B140(s32 playerId) {
loop_15:
if (var_t0 != playerId) {
temp_v0_4 = &gPlayers[var_t0];
- if ((temp_v0_4->type & 0x8000) != 0) {
- temp_f2 = ((temp_v1->unk_094 / 18.0f) * 216.0f) - 5.0f;
+ if (temp_v0_4->type & 0x8000) {
+ temp_f2 = temp_f22 - 5.0f;
temp_v1_2 = (s16) gNearestWaypointByPlayerId[var_t0];
temp_f0_2 = (temp_v0_4->unk_094 / 18.0f) * 216.0f;
if (temp_f0_2 < temp_f2) {
@@ -2437,8 +2393,8 @@ loop_15:
var_f18 = 1.0f;
var_f20 = -1.0f;
if (var_t2 > 0) {
- if ((var_t2 & 1) != 0) {
- temp_f2_2 = D_80163068[sp9C];
+ if (var_t2 & 1) {
+ temp_f2_2 = *(D_80163068 + (sp9C * 4));
var_t0_2 = 1;
if ((temp_f2_2 > -1.0f) && (temp_f2_2 < 1.0f)) {
temp_f12 = ((sp74[0] + 10.0f) * (0.2f * (20.0f / ((f32) spB0[0] + 20.0f)))) / 20.0f;
@@ -2464,7 +2420,7 @@ block_40:
var_v0_2 = var_t0_2 * 2;
var_a1_2 = &(&sp9C)[var_t0_2];
do {
- temp_f2_3 = D_80163068[var_a1_2->unk0];
+ temp_f2_3 = *(D_80163068 + (var_a1_2->unk0 * 4));
if ((temp_f2_3 > -1.0f) && (temp_f2_3 < 1.0f)) {
temp_f0_3 = (((&sp74[0])[var_t0_2].unk0 + 10.0f) * (0.2f * (20.0f / ((f32) *(&spB0[0] + var_v0_2) + 20.0f)))) / 20.0f;
if ((var_f18 == 1.0f) && (var_f20 == -1.0f)) {
@@ -2483,7 +2439,7 @@ block_40:
}
temp_t4 = var_a1_2->unk2;
var_a1_2 += 4;
- temp_f0_4 = D_80163068[temp_t4];
+ temp_f0_4 = *(D_80163068 + (temp_t4 * 4));
if ((temp_f0_4 > -1.0f) && (temp_f0_4 < 1.0f)) {
temp_f2_4 = (((&sp74[0])[var_t0_2].unk4 + 10.0f) * (0.2f * (20.0f / ((f32) (&spB0[0] + var_v0_2)->unk2 + 20.0f)))) / 20.0f;
if ((var_f18 == 1.0f) && (var_f20 == -1.0f)) {
@@ -2582,73 +2538,60 @@ void func_8000B95C(s32 playerId, u16 waypointIndex, s32 pathIndex) {
}
}
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern f32 D_800ECFE4;
-extern f32 D_80162FA0;
-extern f32 D_80162FA8;
-extern u16 D_80164430;
-
-void func_8000BA14(u16 arg0, f32 arg1, f32 arg2, s16 arg3) {
- f32 sp54;
- f32 sp50;
- f32 sp4C;
- f32 sp48;
- f32 sp20;
- f32 sp1C;
- f32 temp_f0;
- f32 temp_f0_2;
+void func_8000BA14(u16 waypointIndex, f32 arg1, f32 arg2, s16 pathIndex) {
+ s32 stackPadding0;
+ s32 stackPadding1;
+ s32 stackPadding2;
+ s32 stackPadding3;
+ f32 waypointOneX;
+ f32 waypointOneZ;
+ f32 waypointTwoX;
+ f32 waypointTwoZ;
+ s32 stackPadding4;
+ f32 xdiff;
+ f32 zdiff;
+ f32 distance;
f32 temp_f12;
- f32 temp_f14;
- f32 temp_f16;
- f32 temp_f18;
- f32 temp_f2;
f32 temp_f2_2;
- s16 *temp_v1;
- s32 temp_t6;
- void *temp_a1;
- void *temp_v0;
-
- temp_t6 = arg0 & 0xFFFF;
- temp_v1 = (&D_80164550)[arg3];
- temp_v0 = temp_v1 + (temp_t6 * 8);
- temp_a1 = temp_v1 + (((temp_t6 + 1) % D_80164430) * 8);
- temp_f18 = temp_v0->unk0;
- sp54 = temp_f18;
- temp_f2 = temp_a1->unk0;
- sp48 = temp_a1->unk4;
- temp_f0 = temp_v0->unk4;
- temp_f16 = temp_f2 - temp_f18;
- sp50 = temp_f0;
- sp4C = temp_f2;
- temp_f14 = sp48 - temp_f0;
- sp1C = temp_f16;
- sp20 = temp_f14;
- temp_f0_2 = sqrtf((temp_f16 * temp_f16) + (temp_f14 * temp_f14));
- if (temp_f0_2 < D_800ECFE4) {
- D_80162FA0.unk0 = temp_f2;
- D_80162FA0.unk8 = sp48;
- return;
+ TrackWaypoint *path;
+ TrackWaypoint *waypointTwo;
+ TrackWaypoint *waypointOne;
+
+ waypointOne = &D_80164550[pathIndex][waypointIndex];
+ waypointOneX = waypointOne->posX;
+ waypointOneZ = waypointOne->posZ;
+ waypointTwo = &D_80164550[pathIndex][(waypointIndex + 1) % D_80164430];
+ waypointTwoX = waypointTwo->posX;
+ waypointTwoZ = waypointTwo->posZ;
+ zdiff = waypointTwoZ - waypointOneZ;
+ xdiff = waypointTwoX - waypointOneX;
+ if (xdiff && xdiff) {}
+ distance = sqrtf((xdiff * xdiff) + (zdiff * zdiff));
+ if (distance < 0.01f) {
+ D_80162FA0[0] = waypointTwoX;
+ D_80162FA0[2] = waypointTwoZ;
+ } else {
+ D_80162FA0[0] = ((0.5f - (arg1 * 0.5f)) * (((arg2 * zdiff) / distance) + waypointOneX)) + ((1.0f - (0.5f - (arg1 * 0.5f))) * (((arg2 * -zdiff) / distance) + waypointOneX));
+ D_80162FA0[2] = ((0.5f - (arg1 * 0.5f)) * (((arg2 * -xdiff) / distance) + waypointOneZ)) + ((1.0f - (0.5f - (arg1 * 0.5f))) * (((arg2 * xdiff) / distance) + waypointOneZ));
}
- temp_f2_2 = 0.5f - (arg1 * 0.5f);
- temp_f12 = 1.0f - temp_f2_2;
- D_80162FA0.unk0 = (temp_f2_2 * (((arg2 * temp_f14) / temp_f0_2) + temp_f18)) + (temp_f12 * (((arg2 * -temp_f14) / temp_f0_2) + temp_f18));
- D_80162FA8 = (temp_f2_2 * (((arg2 * -temp_f16) / temp_f0_2) + sp50)) + (temp_f12 * (((arg2 * temp_f16) / temp_f0_2) + sp50));
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000BA14.s")
-#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-12-2023
extern f32 D_80162FA8;
-void func_8000BBD8(s32 waypointIndex, f32 arg1, s16 pathIndex) {
+void func_8000BBD8(u16 waypointIndex, f32 arg1, s16 pathIndex) {
f32 sp14;
f32 sp10;
f32 sp8;
f32 sp4;
f32 sp0;
+ TrackWaypoint *temp_a1;
+ TrackWaypoint *temp_t0;
+ TrackWaypoint *temp_t0_2;
+ TrackWaypoint *temp_t1;
+ TrackWaypoint *temp_v0;
+ TrackWaypoint *temp_v0_2;
f32 temp_f0;
f32 temp_f12;
f32 temp_f4;
@@ -2657,12 +2600,6 @@ void func_8000BBD8(s32 waypointIndex, f32 arg1, s16 pathIndex) {
f32 temp_f8_2;
s32 temp_t6;
s32 temp_t8;
- TrackWaypoint *temp_a1;
- TrackWaypoint *temp_t0;
- TrackWaypoint *temp_t0_2;
- TrackWaypoint *temp_t1;
- TrackWaypoint *temp_v0;
- TrackWaypoint *temp_v0_2;
temp_t6 = waypointIndex & 0xFFFF;
temp_a1 = D_80164560[pathIndex];
@@ -3048,8 +2985,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000CD24.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern f32 D_800ECFF8;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-12-2023
extern s32 D_80163598;
extern s32 D_8016359C;
@@ -3057,51 +2993,44 @@ s16 func_8000D100(f32 arg0, f32 arg1, f32 arg2, s16 arg3) {
f32 temp_f14;
f32 temp_f16;
f32 temp_f2;
+ f32 var_f0;
s16 temp_a0;
s16 temp_v0;
+ s16 var_a0;
+ s16 var_v0;
+ s16 var_v1;
s32 temp_a1;
- s32 temp_a2;
s32 temp_hi;
void *temp_t0;
- s16 phi_v0;
- s32 phi_a0;
- f32 phi_f0;
- s16 phi_v1;
- s16 phi_v1_2;
- s16 phi_v1_3;
temp_a0 = arg3 - 2;
+ var_f0 = 250000.0f;
temp_a1 = arg3 + 7;
- phi_v0 = temp_a0;
- phi_f0 = D_800ECFF8;
- phi_v1 = -1;
- phi_v1_3 = -1;
+ var_v1 = -1;
+ var_v0 = temp_a0;
if (temp_a0 < temp_a1) {
- temp_a2 = D_8016359C;
do {
- phi_a0 = phi_v0;
- if (phi_v0 < 0) {
- phi_a0 = phi_v0 + temp_a2;
- }
- temp_hi = phi_a0 % temp_a2;
- temp_t0 = (temp_hi * 4) + D_80163598;
- temp_v0 = phi_v0 + 1;
- temp_f2 = temp_t0->unk0 - arg0;
- temp_f14 = temp_t0->unk2 - arg2;
+ var_a0 = var_v0;
+ if (var_v0 < 0) {
+ var_a0 = var_v0 + D_8016359C;
+ }
+ temp_hi = var_a0 % (s32) D_8016359C;
+ temp_t0 = ((s16) temp_hi * 4) + D_80163598;
+ temp_v0 = var_v0 + 1;
+ temp_f2 = (f32) temp_t0->unk0 - arg0;
+ temp_f14 = (f32) temp_t0->unk2 - arg2;
temp_f16 = (temp_f2 * temp_f2) + (temp_f14 * temp_f14);
- if (temp_f16 < phi_f0) {
- phi_f0 = temp_f16;
- phi_v1_3 = temp_hi;
+ if (temp_f16 < var_f0) {
+ var_f0 = temp_f16;
+ var_v1 = (s16) temp_hi;
}
- phi_v0 = temp_v0;
- phi_v1 = phi_v1_3;
+ var_v0 = temp_v0;
} while (temp_v0 < temp_a1);
}
- phi_v1_2 = phi_v1;
- if (phi_v1 == -1) {
- phi_v1_2 = arg3;
+ if (var_v1 == -1) {
+ var_v1 = arg3;
}
- return phi_v1_2;
+ return var_v1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D100.s")
@@ -3136,49 +3065,34 @@ s16 func_8000D33C(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex
return var_v1;
}
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-//extern ? D_801634F8;
-
-f32 func_8000D3B8(s32 arg0) {
+f32 func_8000D3B8(s32 playerId) {
+ Test *temp_v0;
f32 temp_f0;
- f32 temp_f2;
- f32 temp_f2_2;
- f32 temp_f2_3;
- void *temp_v0;
- f32 phi_f2;
+ f32 var_f2;
- temp_v0 = (arg0 * 0x10) + &D_801634F8;
- temp_f2 = temp_v0->unk0;
+ temp_v0 = &D_801634F8[playerId];
+ var_f2 = temp_v0->unk0;
temp_f0 = temp_v0->unk4;
- phi_f2 = temp_f2;
- if (temp_f2 < temp_f0) {
- temp_f2_2 = temp_f2 + temp_v0->unk8;
- phi_f2 = temp_f2_2;
- if (temp_f0 < temp_f2_2) {
- goto block_5;
+ if (var_f2 < temp_f0) {
+ var_f2 += temp_v0->unk8;
+ if (temp_f0 < var_f2) {
+ var_f2 = temp_f0;
}
- } else if (temp_f0 < temp_f2) {
- temp_f2_3 = temp_f2 - temp_v0->unk8;
- phi_f2 = temp_f2_3;
- if (temp_f2_3 < temp_f0) {
-block_5:
- phi_f2 = temp_f0;
+ } else if (temp_f0 < var_f2) {
+ var_f2 -= temp_v0->unk8;
+ if (var_f2 < temp_f0) {
+ var_f2 = temp_f0;
}
}
- temp_v0->unk0 = phi_f2;
- return phi_f2;
+ temp_v0->unk0 = var_f2;
+ return var_f2;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D3B8.s")
-#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8000BBD8(s32, f32, s16, u16); /* extern */
-f32 func_8000D3B8(s32, u16); /* extern */
-extern f32 D_80162FA0;
-extern s16 D_80163380;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-09-2023
+? func_8000BBD8(s32, f32, s16, u16); /* extern */
+extern ? D_80162FA0;
+extern ? D_80163380;
extern s16 D_8016344A;
s16 gCurrentCourseId; /* unable to generate initializer */
@@ -3192,9 +3106,7 @@ void func_8000D438(s32 arg0, u16 arg1) {
f32 temp_f0;
s16 *temp_v1_2;
s16 temp_v0;
- s16 temp_v0_2;
s16 temp_v1;
- s32 temp_a0;
s32 temp_hi;
s32 var_a2;
s32 var_a2_2;
@@ -3207,12 +3119,11 @@ void func_8000D438(s32 arg0, u16 arg1) {
sp1C = temp_a3 * 2;
arg1 = temp_a3;
sp26 = temp_v1;
- temp_v0 = gCurrentCourseId;
var_a2 = 6;
- sp2C = func_8000D3B8(6, temp_a3);
- if (temp_v0 != 4) {
- if (temp_v0 != 0x000A) {
- if (temp_v0 == 0x0014) {
+ sp2C = func_8000D3B8(arg0);
+ if (gCurrentCourseId != 4) {
+ if (gCurrentCourseId != 0x000A) {
+ if (gCurrentCourseId == 0x0014) {
var_a2 = 1;
} else if (temp_v1 < 6) {
var_a2 = 8;
@@ -3233,24 +3144,22 @@ void func_8000D438(s32 arg0, u16 arg1) {
}
}
sp28 = var_a2;
- arg1 = arg1;
var_a2_2 = var_a2;
temp_a3_2 = arg1;
if (func_8000B820(arg0) == 1) {
var_a2_2 = 5;
}
temp_v1_2 = (arg0 * 2) + &D_80163380;
- temp_v0_2 = *temp_v1_2;
- if (temp_v0_2 < var_a2_2) {
- *temp_v1_2 = temp_v0_2 + 1;
+ temp_v0 = *temp_v1_2;
+ if (temp_v0 < var_a2_2) {
+ *temp_v1_2 = temp_v0 + 1;
}
if (var_a2_2 < *temp_v1_2) {
*temp_v1_2 -= 1;
}
temp_hi = (s32) (*temp_v1_2 + temp_a3_2) % (s32) D_80164430;
- temp_a0 = temp_hi & 0xFFFF;
arg1 = (u16) temp_hi;
- func_8000BBD8(temp_a0, sp2C, D_8016344A, temp_a3_2);
+ func_8000BBD8(temp_hi & 0xFFFF, sp2C, D_8016344A, temp_a3_2);
sp48 = D_80162FA0.unk0;
sp44 = D_80162FA0.unk8;
func_8000BBD8(((s32) (arg1 + 1) % (s32) D_80164430) & 0xFFFF, sp2C, D_8016344A, arg1);
@@ -3261,165 +3170,135 @@ void func_8000D438(s32 arg0, u16 arg1) {
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D438.s")
#endif
-#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-void func_8000BBD8(u16, s32, s16, u16); /* extern */
-extern f32 D_80162FA0;
-
-void func_8000D6D0(Vec3f arg0, s16 *waypointIndex, f32 arg2, s32 arg3, s16 pathIndex, s16 arg5) {
- s16 spA0;
- u16 sp9E;
- f32 sp98;
- f32 sp90;
- f32 sp58;
- f32 sp54;
- f32 sp50;
- TrackWaypoint *sp4C;
- f32 sp48;
- f32 sp44;
- f32 sp40;
- f32 temp_f0;
- f32 temp_f16;
- f32 temp_f18;
+#ifdef NON_MATCHING
+// Something about the handling of D_80162FA0 is really off, can't figure out what
+s16 func_8000D6D0(Vec3f arg0, s16 *waypointIndex, f32 arg2, f32 arg3, s16 pathIndex, s16 arg5) {
+ s32 stackPadding0;
+ s32 stackPadding1;
+ s32 stackPadding2;
+ s32 stackPadding3;
+ s16 waypoint2;
+ s16 waypoint1;
+ s32 stackPadding4;
+ s32 stackPadding5;
+ s32 stackPadding6;
+ s32 stackPadding7;
+ f32 distance;
f32 temp_f20;
f32 temp_f22;
f32 temp_f24;
- f32 temp_f4;
- f32 temp_f4_2;
+ f32 var_f2;
f32 var_f12;
f32 var_f14;
- f32 var_f2;
s16 temp_v0;
- s32 temp_hi;
s32 temp_v1;
- u16 temp_a3;
+ f32 xdiff;
+ f32 ydiff;
+ f32 zdiff;
+ Vec3f sp50;
+ TrackWaypoint *path;
- sp4C = D_80164550[pathIndex];
- sp50 = arg0->unk0;
- sp54 = arg0->unk4;
- sp58 = arg0->unk8;
- temp_f24 = arg0->unk8;
- temp_f20 = arg0->unk0;
- temp_f22 = arg0->unk4;
+ path = D_80164550[pathIndex];
+ sp50[0] = arg0[0];
+ sp50[1] = arg0[1];
+ sp50[2] = arg0[2];
+ temp_f20 = arg0[0];
+ temp_f22 = arg0[1];
+ temp_f24 = arg0[2];
temp_v0 = func_8000D2B4(temp_f20, temp_f22, temp_f24, *waypointIndex, (s32) pathIndex);
*waypointIndex = temp_v0;
- temp_a3 = gWaypointCountByPathIndex[pathIndex];
temp_v1 = temp_v0 + arg5;
- temp_hi = temp_v1 % (s32) temp_a3;
- sp9E = (u16) ((s32) (temp_v1 + 1) % (s32) temp_a3);
- spA0 = (s16) temp_hi;
- func_8000BBD8((s16) temp_hi & 0xFFFF, arg3, pathIndex, temp_a3);
- temp_f4 = D_80162FA0.unk8;
- sp98 = D_80162FA0.unk0;
- sp90 = temp_f4;
- func_8000BBD8(sp9E, arg3, pathIndex);
- temp_f18 = ((f32) (sp4C[(s16) sp9E].posY + sp4C[spA0].posY) * 0.5f) - temp_f22;
- temp_f16 = ((sp98 + D_80162FA0.unk0) * 0.5f) - temp_f20;
- sp44 = temp_f18;
- sp48 = temp_f16;
- temp_f4_2 = ((temp_f4 + D_80162FA0.unk8) * 0.5f) - temp_f24;
- sp40 = temp_f4_2;
- temp_f0 = sqrtf((temp_f16 * temp_f16) + (temp_f18 * temp_f18) + (temp_f4_2 * temp_f4_2));
- if (temp_f0 > 0.01f) {
- var_f2 = ((temp_f16 * arg2) / temp_f0) + temp_f20;
- var_f12 = ((temp_f18 * arg2) / temp_f0) + temp_f22;
- var_f14 = ((sp40 * arg2) / temp_f0) + temp_f24;
+ waypoint1 = temp_v1 % gWaypointCountByPathIndex[pathIndex];
+ waypoint2 = (temp_v1 + 1) % gWaypointCountByPathIndex[pathIndex];
+ func_8000BBD8(waypoint1, arg3, pathIndex);
+ func_8000BBD8(waypoint2, arg3, pathIndex);
+ ydiff = ((path[waypoint2].posY + path[waypoint1].posY) * 0.5f) - temp_f22;
+ xdiff = ((D_80162FA0[0] + D_80162FA0[0]) * 0.5f) - temp_f20;
+ zdiff = ((D_80162FA0[2] + D_80162FA0[2]) * 0.5f) - temp_f24;
+ distance = sqrtf((xdiff * xdiff) + (ydiff * ydiff) + (zdiff * zdiff));
+ if (distance > 0.01f) {
+ var_f2 = ((xdiff * arg2) / distance) + temp_f20;
+ var_f12 = ((ydiff * arg2) / distance) + temp_f22;
+ var_f14 = ((zdiff * arg2) / distance) + temp_f24;
} else {
- var_f2 = temp_f20;
+ var_f2 = temp_f20;
var_f12 = temp_f22;
var_f14 = temp_f24;
}
- arg0->unk0 = var_f2;
- arg0->unk4 = var_f12;
- arg0->unk8 = var_f14;
- func_80005FD0(&sp50, arg0);
+ arg0[0] = var_f2;
+ arg0[1] = var_f12;
+ arg0[2] = var_f14;
+ return func_80005FD0(sp50, arg0);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D6D0.s")
#endif
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8000BBD8(u16, s32, s16, s32); /* extern */
-extern f32 D_80162FA0;
-
-void func_8000D940(Vec3f arg0, s16 *arg1, f32 arg2, s32 arg3, s16 pathIndex) {
- s16 spA8;
- u16 spA6;
- f32 spA0;
- f32 sp98;
- s32 sp60;
- f32 sp5C;
- f32 sp58;
- f32 sp54;
- f32 sp50;
- f32 sp4C;
- f32 sp48;
- f32 temp_f0;
- f32 temp_f16;
- f32 temp_f18;
+#ifdef NON_MATCHING
+// Something about the handling of D_80162FA0 is really off, can't figure out what
+s16 func_8000D940(f32 *arg0, s16 *waypointIndex, f32 arg2, f32 arg3, s16 pathIndex) {
+ s32 stackPadding0;
+ s32 stackPadding1;
+ s32 stackPadding2;
+ s32 stackPadding3;
+ s16 waypoint2;
+ s16 waypoint1;
+ s32 stackPadding4;
+ s32 stackPadding5;
+ s32 stackPadding6;
+ s32 stackPadding7;
+ s32 stackPadding8;
+ f32 distance;
f32 temp_f20;
f32 temp_f22;
f32 temp_f24;
- f32 temp_f4;
- f32 temp_f4_2;
+ f32 var_f2;
f32 var_f12;
f32 var_f14;
- f32 var_f2;
s16 temp_v0;
- s32 temp_a3;
- s32 temp_t2;
- s32 temp_v1;
- TrackWaypoint *temp_v0_2;
- u16 temp_t0;
+ s32 waypointCount;
+ f32 xdiff;
+ f32 ydiff;
+ f32 zdiff;
+ Vec3f sp54;
+ s32 stackPadding9;
+ TrackWaypoint *path;
- sp54 = arg0->unk0;
- sp58 = arg0->unk4;
- temp_t0 = gWaypointCountByPathIndex[pathIndex];
- sp5C = arg0->unk8;
- temp_f24 = arg0->unk8;
- temp_f20 = arg0->unk0;
- temp_f22 = arg0->unk4;
- sp60 = (s32) temp_t0;
- temp_v0 = func_8000D2B4(temp_f20, temp_f22, temp_f24, *arg1, (s32) pathIndex);
- temp_v1 = temp_v0 + temp_t0;
- temp_t2 = temp_v1 - 4;
- temp_a3 = (s32) (temp_v1 - 3) % (s32) temp_t0;
- *arg1 = temp_v0;
- spA8 = (s16) temp_a3;
- spA6 = (u16) (temp_t2 % (s32) temp_t0);
- func_8000BBD8(temp_a3 & 0xFFFF, arg3, pathIndex, temp_a3);
- temp_f4 = D_80162FA0.unk8;
- spA0 = D_80162FA0.unk0;
- sp98 = temp_f4;
- func_8000BBD8(spA6, arg3, pathIndex);
- temp_v0_2 = D_80164550[pathIndex];
- temp_f18 = ((f32) (temp_v0_2[(s16) spA6].posY + temp_v0_2[spA8].posY) * 0.5f) - temp_f22;
- temp_f16 = ((spA0 + D_80162FA0.unk0) * 0.5f) - temp_f20;
- sp4C = temp_f18;
- sp50 = temp_f16;
- temp_f4_2 = ((temp_f4 + D_80162FA0.unk8) * 0.5f) - temp_f24;
- sp48 = temp_f4_2;
- temp_f0 = sqrtf((temp_f16 * temp_f16) + (temp_f18 * temp_f18) + (temp_f4_2 * temp_f4_2));
- if (temp_f0 > 0.01f) {
- var_f2 = ((temp_f16 * arg2) / temp_f0) + temp_f20;
- var_f12 = ((temp_f18 * arg2) / temp_f0) + temp_f22;
- var_f14 = ((sp48 * arg2) / temp_f0) + temp_f24;
+ sp54[0] = arg0[0];
+ sp54[1] = arg0[1];
+ sp54[2] = arg0[2];
+ waypointCount = gWaypointCountByPathIndex[pathIndex];
+ temp_f20 = arg0[0];
+ temp_f22 = arg0[1];
+ temp_f24 = arg0[2];
+ temp_v0 = func_8000D2B4(temp_f20, temp_f22, temp_f24, *waypointIndex, (s32) pathIndex);
+ *waypointIndex = temp_v0;
+ waypoint1 = ((temp_v0 + waypointCount) - 3) % waypointCount;
+ waypoint2 = ((temp_v0 + waypointCount) - 4) % waypointCount;
+ func_8000BBD8(waypoint1, arg3, pathIndex);
+ func_8000BBD8(waypoint2, arg3, pathIndex);
+ ydiff = ((D_80164550[pathIndex][waypoint2].posY + D_80164550[pathIndex][waypoint1].posY) * 0.5f) - temp_f22;
+ xdiff = ((D_80162FA0[0] + D_80162FA0[0]) * 0.5f) - temp_f20;
+ zdiff = ((D_80162FA0[2] + D_80162FA0[2]) * 0.5f) - temp_f24;
+ distance = sqrtf((xdiff * xdiff) + (ydiff * ydiff) + (zdiff * zdiff));
+ if (distance > 0.01f) {
+ var_f2 = ((xdiff * arg2) / distance) + temp_f20;
+ var_f12 = ((ydiff * arg2) / distance) + temp_f22;
+ var_f14 = ((zdiff * arg2) / distance) + temp_f24;
} else {
- var_f2 = temp_f20;
+ var_f2 = temp_f20;
var_f12 = temp_f22;
var_f14 = temp_f24;
}
- arg0->unk0 = var_f2;
- arg0->unk4 = var_f12;
- arg0->unk8 = var_f14;
- func_80005FD0(&sp54, arg0);
+ arg0[0] = var_f2;
+ arg0[1] = var_f12;
+ arg0[2] = var_f14;
+ return func_80005FD0(sp54, arg0);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D940.s")
#endif
-extern s32 D_8016359C;
#ifdef MIPS_TO_C
//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
s16 func_8000D100(f32, f32, f32, s16); /* extern */
@@ -4014,117 +3893,95 @@ void func_8000F0E0(void) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-09-2023
extern u16 D_80163348;
extern ? D_8016334C;
void func_8000F124(void) {
- s32 temp_a0;
s32 temp_a3;
- s32 temp_s0;
- s8 *temp_v0_2;
- s8 temp_a2;
- u16 *temp_v0;
+ s32 var_a0;
+ s32 var_a1;
+ s32 var_s0;
+ s8 *var_v0_2;
+ s8 temp_t9;
+ u16 *var_s1;
+ u16 *var_v0;
+ u16 *var_v0_3;
+ u16 *var_v0_4;
+ u16 temp_t9_2;
u16 temp_v1;
- void *temp_v0_3;
- u16 *phi_v0;
- u16 *phi_s1;
- s8 *phi_v0_2;
- s32 phi_s0;
- u16 *phi_v0_3;
- s32 phi_a0;
- void *phi_v0_4;
- s32 phi_a1;
- s32 phi_a0_2;
- s32 phi_a1_2;
- s32 phi_a1_3;
- s32 phi_a1_4;
- s32 phi_a1_5;
-
- phi_v0 = &D_80163348;
+
+ var_v0 = &D_80163348;
do {
- temp_v0 = phi_v0 + 2;
- temp_v0->unk-2 = 0;
- phi_v0 = temp_v0;
- } while (temp_v0 != &D_8016334C);
- if (!gDemoMode) {
- phi_s1 = &D_80163348;
- phi_s0 = 0;
- if (gModeSelection == GRAND_PRIX) {
+ var_v0 += 2;
+ var_v0->unk-2 = 0;
+ } while (var_v0 != &D_8016334C);
+ if (gDemoMode != 1) {
+ var_s1 = &D_80163348;
+ var_s0 = 0;
+ if (gModeSelection == 0) {
do {
loop_5:
- temp_a2 = gPlayerCount;
- *phi_s1 = random_int(8);
- phi_a1_2 = 0;
- phi_a1_5 = 0;
- if (temp_a2 < THREE_PLAYERS_SELECTED) {
- phi_v0_2 = gCharacterSelections;
- if (temp_a2 > ZERO_PLAYERS_SELECTED) {
- if (temp_a2 > ZERO_PLAYERS_SELECTED) {
+ *var_s1 = random_int(8U);
+ var_a1 = 0;
+ if (gPlayerCount < 3) {
+ var_v0_2 = gCharacterSelections;
+ if (gPlayerCount > 0) {
+ var_a0 = 0;
+ if (gPlayerCount > 0) {
do {
- temp_v0_2 = phi_v0_2 + 1;
- phi_v0_2 = temp_v0_2;
- if (*phi_v0_2 == *phi_s1) {
- phi_a1_5 = 1;
+ temp_t9 = *var_v0_2;
+ var_v0_2 += 1;
+ if (temp_t9 == *var_s1) {
+ var_a1 = 1;
}
- phi_a1_2 = phi_a1_5;
- } while (temp_v0_2 < &gCharacterSelections[temp_a2]);
+ } while ((u32) var_v0_2 < (u32) &gCharacterSelections[gPlayerCount]);
+ var_a0 = 0;
}
- temp_a3 = phi_s0 & 3;
- phi_a0 = 0;
- phi_a1 = phi_a1_2;
- phi_a0_2 = 0;
- phi_a1_3 = phi_a1_2;
- phi_a1_4 = phi_a1_2;
- if (phi_s0 > 0) {
- temp_v1 = *phi_s1;
+ temp_a3 = var_s0 & 3;
+ if (var_s0 > 0) {
+ temp_v1 = *var_s1;
if (temp_a3 != 0) {
- phi_v0_3 = (0 * 2) + &D_80163348;
+ var_v0_3 = &(&D_80163348)[0];
do {
- temp_a0 = phi_a0 + 1;
- phi_a0 = temp_a0;
- phi_a0_2 = temp_a0;
- if (*phi_v0_3 == temp_v1) {
- phi_a1_3 = 1;
+ var_a0 += 1;
+ if (*var_v0_3 == temp_v1) {
+ var_a1 = 1;
}
- phi_v0_3 += 2;
- phi_a1 = phi_a1_3;
- phi_a1_4 = phi_a1_3;
- } while (temp_a3 != temp_a0);
- if (temp_a0 != phi_s0) {
+ var_v0_3 += 2;
+ } while (temp_a3 != var_a0);
+ if (var_a0 != var_s0) {
goto block_20;
}
} else {
block_20:
- phi_v0_4 = (phi_a0_2 * 2) + &D_80163348;
+ var_v0_4 = &(&D_80163348)[var_a0];
do {
- if (phi_v0_4->unk0 == temp_v1) {
- phi_a1_4 = 1;
+ if (var_v0_4->unk0 == temp_v1) {
+ var_a1 = 1;
}
- if (phi_v0_4->unk2 == temp_v1) {
- phi_a1_4 = 1;
+ if (var_v0_4->unk2 == temp_v1) {
+ var_a1 = 1;
}
- if (phi_v0_4->unk4 == temp_v1) {
- phi_a1_4 = 1;
+ if (var_v0_4->unk4 == temp_v1) {
+ var_a1 = 1;
}
- temp_v0_3 = phi_v0_4 + 8;
- phi_v0_4 = temp_v0_3;
- if (phi_v0_4->unk6 == temp_v1) {
- phi_a1_4 = 1;
+ temp_t9_2 = var_v0_4->unk6;
+ var_v0_4 += 8;
+ if (temp_t9_2 == temp_v1) {
+ var_a1 = 1;
}
- phi_a1 = phi_a1_4;
- } while (temp_v0_3 != ((phi_s0 * 2) + &D_80163348));
+ } while (var_v0_4 != &(&D_80163348)[var_s0]);
}
}
- if (phi_a1 != 0) {
+ if (var_a1 != 0) {
goto loop_5;
}
}
}
- temp_s0 = phi_s0 + 1;
- phi_s1 += 2;
- phi_s0 = temp_s0;
- } while (temp_s0 != 2);
+ var_s0 += 1;
+ var_s1 += 2;
+ } while (var_s0 != 2);
}
}
}
@@ -4134,7 +3991,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F124.s")
// Delete track waypoints
void func_8000F2BC(TrackWaypoint *arg0, size_t size) {
- bzero((void *) arg0, size << 3);
+ bzero((void *) arg0, size * sizeof(TrackWaypoint));
}
struct _struct_D_800DD9D0_0x10 {
@@ -4225,11 +4082,8 @@ void func_8000F2DC(void) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_80011A5C(); /* extern */
-void func_80011AB8(s32, s32); /* extern */
-void func_8001AB00(? *, s16, u16 *, u16); /* extern */
-extern f32 D_0D009418;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-13-2023
+? func_80011A5C(); /* extern */
extern ? D_80162F10;
extern ? D_80162F50;
extern ? D_80162F8C;
@@ -4246,7 +4100,6 @@ extern s32 D_80163150;
extern f32 D_80163178;
extern f32 D_801631A0;
extern s32 D_801631CC;
-extern s16 D_801631E0;
extern s16 D_801631F8;
extern f32 D_80163210;
extern s16 D_80163258;
@@ -4260,37 +4113,25 @@ extern u16 D_80163348;
extern ? D_8016334C;
extern s16 D_80163350;
extern s32 D_80163378;
-extern s32 D_8016337C;
extern s16 D_80163380;
extern s16 D_80163398;
extern s16 D_801633B0;
extern s16 D_801633C8;
extern s16 D_801633F8;
extern f32 D_80163450;
-extern s16 D_80163478;
-extern u16 D_8016347A;
-extern s32 D_80163488;
-extern s16 D_8016348C;
extern ? D_801634C0;
-extern ? D_801634D8;
extern s16 D_801634EC;
extern s32 D_801634F0;
extern s32 D_801634F4;
-//extern ? D_801634F8;
-extern u16 D_801637BC;
extern s16 D_80164358;
-extern u16 D_8016435A;
-extern u16 D_8016435C;
-extern ? D_80164378;
-extern s32 D_801643E0;
-extern s32 D_80164408;
+extern s16 D_8016435A;
+extern s16 D_8016435C;
extern ? D_80164448;
-extern ? D_80164478;
extern ? D_80164538;
extern f32 D_80164698;
extern f32 D_8016469C;
extern f32 D_801646A0;
-extern s8 D_8018EE08;
+s16 gCurrentCourseId; /* unable to generate initializer */
static f32 D_800DCAA0[0x15] = {
0.3f,
0.3f,
@@ -4314,7 +4155,6 @@ static f32 D_800DCAA0[0x15] = {
0.5f,
0.5f,
};
-s16 gCurrentCourseId; /* unable to generate initializer */
void func_8000F628(void) {
void *sp104;
@@ -4333,7 +4173,7 @@ void func_8000F628(void) {
s32 *spBC;
s16 *spB8;
s16 *spB4;
- s16 *spB0;
+ u16 *spB0;
s16 *spAC;
s32 *spA8;
s32 *spA4;
@@ -4354,13 +4194,11 @@ void func_8000F628(void) {
s32 *sp5C;
? *sp58;
? *sp54;
- ? *sp50;
+ s16 *sp50;
? *sp4C;
- ? *temp_a0;
? *temp_a1;
? *temp_a2;
? *temp_v1;
- ? *var_s5;
? *var_v0_2;
? *var_v0_4;
? *var_v1_2;
@@ -4370,10 +4208,12 @@ void func_8000F628(void) {
Player *temp_s1_3;
Player *temp_s1_4;
Player *var_s1;
+ Test *var_s5;
f32 *var_ra;
f32 *var_t2;
f32 *var_t5;
f32 temp_f0;
+ s16 *temp_a0;
s16 *var_a3;
s16 *var_t0;
s16 *var_t1;
@@ -4384,13 +4224,15 @@ void func_8000F628(void) {
s16 temp_t9;
s16 temp_t9_2;
s16 temp_v0;
+ s16 temp_v0_2;
s16 var_s0_2;
+ s16 var_s0_3;
s32 *var_s4;
s32 *var_s4_2;
s32 *var_s6;
s32 *var_t4;
s32 temp_s3;
- s32 temp_v0_2;
+ s32 temp_v0_3;
s32 temp_v1_2;
s32 temp_v1_3;
s32 temp_v1_4;
@@ -4405,15 +4247,14 @@ void func_8000F628(void) {
u16 *var_v0_3;
u16 *var_v1;
u16 temp_t7;
- u16 var_s0_3;
spD4 = &D_80163210;
spD0 = gLapCountByPlayerId;
spB8 = &D_80163258;
- spBC = &D_80164408;
+ spBC = D_80164408;
spCC = gCourseCompletionPercentByPlayerId;
spC8 = gTimePlayerLastTouchedFinishLine;
- spB0 = &D_801631E0;
+ spB0 = D_801631E0;
spB4 = &D_80163270;
spAC = &D_801631F8;
spA8 = D_80164450;
@@ -4441,13 +4282,13 @@ void func_8000F628(void) {
var_t0 = &D_80162FF8;
var_a3 = &D_80163050;
var_ra = &D_801631A0;
- var_s6 = &D_801643E0;
- var_s5 = &D_801634F8;
+ var_s6 = D_801643E0;
+ var_s5 = D_801634F8;
var_s4 = gGPCurrentRaceRankByPlayerId;
var_s2 = &D_80163330;
var_s1 = gPlayers;
sp4C = &D_801630B8;
- sp50 = &D_801634D8;
+ sp50 = D_801634D8;
sp58 = &D_80164538;
sp54 = &D_801634C0;
var_s0 = 0;
@@ -4457,8 +4298,9 @@ void func_8000F628(void) {
*var_a3 = 0;
*var_t0 = 0;
*var_t1 = 0;
+ temp_v0 = gCurrentCourseId;
sp104 = var_s7 + gPlayerOne;
- if (gCurrentCourseId < 0x14) {
+ if (temp_v0 < 0x14) {
spD8 = var_ra;
spF8 = var_a3;
spF4 = var_t0;
@@ -4477,7 +4319,7 @@ void func_8000F628(void) {
spE4 = var_t3;
spE0 = var_t4;
spDC = var_t5;
- *var_t2 = *segmented_to_virtual_dupe_2((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009418);
+ *var_t2 = *segmented_to_virtual_dupe_2((temp_v0 * 0x10) + (gCCSelection * 4) + D_0D009418);
*var_t3 = 0;
*var_t4 = 0;
*var_t5 = 0.0f;
@@ -4486,18 +4328,18 @@ void func_8000F628(void) {
*spD0 = -1;
*spCC = 0.0f;
*spC8 = 0.0f;
- if (gModeSelection == GRAND_PRIX) {
- temp_v0 = *(var_fp + D_80165270);
- *var_s4 = (s32) temp_v0;
- *var_s6 = (s32) temp_v0;
+ if (gModeSelection == 0) {
+ temp_v0_2 = *(var_fp + D_80165270);
+ *var_s4 = (s32) temp_v0_2;
+ *var_s6 = (s32) temp_v0_2;
} else {
*var_s4 = var_s0;
*var_s6 = var_s0;
}
- temp_v0_2 = *var_s4;
- gGPCurrentRacePlayerIdByRank[temp_v0_2] = (s16) var_s0;
- *(&D_80164378 + (temp_v0_2 * 2)) = (s16) var_s0;
- *spBC = temp_v0_2;
+ temp_v0_3 = *var_s4;
+ gGPCurrentRacePlayerIdByRank[temp_v0_3] = (s16) var_s0;
+ D_80164378[temp_v0_3] = (s16) var_s0;
+ *spBC = temp_v0_3;
*spB8 = 0;
temp_s3 = var_s0 + 1;
*spB4 = 0;
@@ -4505,7 +4347,7 @@ void func_8000F628(void) {
*spAC = 0;
*spA8 = -0x00000014;
*spA4 = -0x00000014;
- *(&D_80164478 + (var_s1->characterId * 2)) = (s16) var_s0;
+ D_80164478[var_s1->characterId] = (s16) var_s0;
*sp9C = 0.0f;
*sp98 = 0.0f;
spD8 = var_ra;
@@ -4521,7 +4363,7 @@ void func_8000F628(void) {
var_s5->unkC = temp_f0;
var_s5->unk4 = temp_f0;
var_s5->unk8 = 0.015f;
- func_80011AB8(var_s0, -0x00000014);
+ func_80011AB8(var_s0);
*sp90 = 0;
var_s0 = temp_s3;
*sp8C = 0;
@@ -4595,18 +4437,18 @@ void func_8000F628(void) {
temp_a1->unk-2 = 0;
temp_a2->unk-2 = (s16) -1;
} while (temp_s3 < 8);
- D_801637BC.unk0 = 0;
- D_801637BC.unk2 = 0;
- if (!gDemoMode) {
+ D_801637BC->unk0 = 0;
+ D_801637BC->unk2 = 0;
+ if (gDemoMode == 0) {
var_v0 = &D_80163344;
var_s0_2 = 0;
- if (gModeSelection == GRAND_PRIX) {
+ if (gModeSelection == 0) {
var_a0 = &D_80163348;
do {
temp_t7 = *var_a0;
var_v0 += 2;
var_a0 += 2;
- temp_t9 = *(&D_80164478 + (temp_t7 * 2));
+ temp_t9 = D_80164478[temp_t7];
temp_v1_2 = temp_t9 & 0xFFFF;
(&D_80163330)[temp_v1_2] = 1;
*(&D_8016334C + (temp_v1_2 * 2)) = var_s0_2;
@@ -4615,13 +4457,13 @@ void func_8000F628(void) {
} while (var_s0_2 != 2);
}
}
- if ((D_8018EE08 == (s8) 1U) && (gCurrentCourseId != 0x0014)) {
+ if ((D_8018EE08 == (s8) 1) && (gCurrentCourseId != 0x0014)) {
var_s2_2 = &D_80163330;
do {
var_s2_2 += 2;
var_s2_2->unk-2 = 0;
} while ((u32) var_s2_2 < (u32) &D_80163340);
- if (gModeSelection == VERSUS) {
+ if (gModeSelection == 2) {
temp_t6 = cameras->playerId;
temp_v1_3 = temp_t6 & 0xFFFF;
(&D_80163330)[temp_v1_3] = 1;
@@ -4639,7 +4481,7 @@ void func_8000F628(void) {
*(&D_8016334C + (temp_v1_4 * 2)) = var_s0_3;
var_s0_3 += 1;
var_v0_2->unk-2 = temp_t6_2;
- } while (var_s0_3 != (u16) 2);
+ } while (var_s0_3 != (s16) 2);
}
}
var_v1 = gNearestWaypointByPlayerId;
@@ -4655,7 +4497,7 @@ void func_8000F628(void) {
} while ((u32) var_v1 < (u32) &D_80164448);
D_8016347A = 0;
var_v1_2 = &D_80162F10;
- if (gCCSelection == CC_EXTRA) {
+ if (gCCSelection == 3) {
D_8016347A = 1;
}
var_v0_4 = &D_80162F50;
@@ -4681,25 +4523,25 @@ void func_8000F628(void) {
D_80163488 = 0;
D_8016348C = 0;
D_801634EC = 0;
- func_8001AB00(&D_80162F8C, -1, &D_80163330, 1U);
- if (D_8018EE08 == (s8) 1U) {
+ func_8001AB00();
+ if (D_8018EE08 == (s8) 1) {
var_s2_3 = &D_80163330;
var_s0_4 = 0;
- if (gDemoMode) {
+ if (gDemoMode == (u16) 1) {
do {
- if (var_s2_3->unk0 == 1) {
+ if (var_s2_3->unk0 == (u16) 1) {
temp_s1 = &gPlayers[var_s0_4];
temp_s1->statusEffects |= 0x02000000;
}
- if (var_s2_3->unk2 == 1) {
+ if (var_s2_3->unk2 == (u16) 1) {
temp_s1_2 = &gPlayers[var_s0_4];
temp_s1_2->unkDE4 = (s32) (temp_s1_2->unkDE4 | 0x02000000);
}
- if (var_s2_3->unk4 == 1) {
+ if (var_s2_3->unk4 == (u16) 1) {
temp_s1_3 = &gPlayers[var_s0_4];
temp_s1_3->unk1BBC = (s32) (temp_s1_3->unk1BBC | 0x02000000);
}
- if (var_s2_3->unk6 == 1) {
+ if (var_s2_3->unk6 == (u16) 1) {
temp_s1_4 = &gPlayers[var_s0_4];
temp_s1_4->unk2994 = (s32) (temp_s1_4->unk2994 | 0x02000000);
}
@@ -4714,9 +4556,6 @@ void func_8000F628(void) {
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F628.s")
#endif
-// dest src size pathIndex
-u16 func_80011014(TrackWaypoint *, TrackWaypoint *, s32, s32); /* extern */
-
extern uintptr_t gCoursePathTable[20][4];
extern uintptr_t D_800DC8D0[20][4];
@@ -4956,7 +4795,7 @@ void func_80010DBC(s32 pathIndex) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-09-2023
s16 gCurrentCourseId; /* unable to generate initializer */
void func_80010E6C(s32 pathIndex) {
@@ -5378,19 +5217,13 @@ void func_80011AE4(s32 index) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-void func_80011AB8(u16, u16 *); /* extern */
-void func_80011EC0(s32, u16); /* extern */
-void func_8002AA50(Player *, u16, u16 *); /* extern */
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-10-2023
+? func_80011EC0(s32, u16); /* extern */
extern ? D_80162EB8;
-extern s16 D_801630E8;
-extern s16 D_801631E0;
+extern ? D_801630E8;
extern void *D_801632B0;
-extern s16 D_801632B8;
-extern s16 D_801632D0;
-extern s16 D_801632E8;
-extern s16 D_80163350;
-extern s16 D_801633F8;
+extern ? D_80163350;
+extern ? D_801633F8;
extern ? D_801634FC;
s16 gCurrentCourseId; /* unable to generate initializer */
@@ -5398,17 +5231,17 @@ void func_80011B14(s32 playerId, Player *player) {
u16 sp2E;
s32 sp1C;
Player *temp_v0;
+ s16 *temp_a3;
s16 temp_t1;
s32 temp_t3;
s32 temp_v1;
- u16 *temp_a3;
u16 temp_a2;
void *temp_t0;
void *temp_t6;
temp_v1 = playerId * 2;
- temp_a3 = temp_v1 + &D_801632B8;
- temp_a2 = *temp_a3;
+ temp_a3 = &D_801632B8[playerId];
+ temp_a2 = (u16) *temp_a3;
temp_t0 = *(&D_80162EB8 + (gCurrentCourseId * 4));
temp_t6 = (temp_a2 * 8) + temp_t0;
D_801632B0 = temp_t6;
@@ -5417,12 +5250,12 @@ void func_80011B14(s32 playerId, Player *player) {
temp_t3 = temp_t6->unk4;
if ((temp_t1 == -1) && (temp_t6->unk2 == -1)) {
D_801632B0 = temp_t0;
- func_80011AB8(temp_a2, temp_a3);
+ func_80011AB8(playerId);
return;
}
if (sp2E == temp_t1) {
- *(&D_801632E8 + temp_v1) = 2;
- *(&D_801632D0 + temp_v1) = temp_a2;
+ D_801632E8[playerId] = 2;
+ D_801632D0[playerId] = (s16) temp_a2;
*temp_a3 = temp_a2 + 1;
switch (temp_t3) {
case 1:
@@ -5430,7 +5263,7 @@ void func_80011B14(s32 playerId, Player *player) {
return;
case 2:
sp1C = temp_v1;
- func_8002AA50(player, temp_a2, temp_a3);
+ func_8002AA50(player);
player->effects &= ~0x10;
*(&D_801630E8 + temp_v1) = 0;
return;
@@ -5457,7 +5290,7 @@ void func_80011B14(s32 playerId, Player *player) {
return;
case 9:
*(&D_801633F8 + temp_v1) = 1;
- *(&D_801631E0 + temp_v1) = 0;
+ D_801631E0[playerId] = 0;
temp_v0 = &gPlayers[playerId];
temp_v0->effects &= ~0x1000;
return;
@@ -5541,10 +5374,9 @@ void func_80011E38(s32 playerIndex) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-void func_8002AA50(Player *, s16 *, s32); /* extern */
-extern s16 D_80162FF8;
-extern s16 D_801630E8;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-10-2023
+extern ? D_80162FF8;
+extern ? D_801630E8;
void func_80011EC0(s32 arg0, Player *player, s32 arg2, s32 arg3) {
s16 *sp1C;
@@ -5565,7 +5397,7 @@ void func_80011EC0(s32 arg0, Player *player, s32 arg2, s32 arg3) {
temp_f0 = (f64) D_80163068[arg0];
if ((temp_f0 > -0.8) && (temp_f0 < 0.5)) {
sp1C = temp_a2;
- func_8002AA50(player, temp_a2, arg2);
+ func_8002AA50(player);
player->effects |= 0x10;
*temp_a2 = 1;
return;
@@ -5579,7 +5411,7 @@ void func_80011EC0(s32 arg0, Player *player, s32 arg2, s32 arg3) {
temp_f0_2 = (f64) D_80163068[arg0];
if ((temp_f0_2 > -0.5) && (temp_f0_2 < 0.8)) {
sp1C = temp_a2;
- func_8002AA50(player, temp_a2, arg2);
+ func_8002AA50(player);
player->effects |= 0x10;
*temp_a2 = -1;
return;
@@ -5596,12 +5428,6 @@ void func_80011EC0(s32 arg0, Player *player, s32 arg2, s32 arg3) {
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011EC0.s")
#endif
-extern s16 D_80162EB0;
-f32 func_802AE1C0(f32, f32, f32);
-
-s32 func_8001168C(void *, void *, s32);
-
-
void func_800120C8(void) {
s32 i;
s16 *temp;
@@ -5751,8 +5577,6 @@ void init_course_vehicles(void) {
}
}
-extern s16 D_80162EB0;
-
void func_80012780(TrainCarStuff *trainCar, s16 *arg1, u16 arg2) {
trainCar->position[0] = (f32) arg1[0];
trainCar->position[1] = (f32) D_80162EB0;
@@ -5765,12 +5589,6 @@ void func_80012780(TrainCarStuff *trainCar, s16 *arg1, u16 arg2) {
trainCar->velocity[2] = 0.0f;
}
-
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-//void func_80012780(TrainStuff *, s32, s32); /* extern */
-extern s16 D_80162FCC;
-//extern s32 D_80163598
-
// This is really Vec2s D_80163598[465] but that does not match.
// Likely because this is a shared pointer between courses.
//extern uintptr_t *D_80163598;
@@ -5860,11 +5678,6 @@ void func_80012A48(TrainCarStuff *trainCar, s16 arg1) {
trainCarActor->velocity[2] = trainCar->velocity[2];
}
-s32 func_800755FC(s32, Vec3f, f32);
-s16 func_800DBAC(Vec3f, Vec3s, f32);
-extern s16 D_80162FCC;
-
-
void func_80012AC0(void) {
s32 pad[3];
f32 temp_f20;
@@ -5984,8 +5797,6 @@ void func_80012DC0(s32 playerId, Player *player) {
}
}
-extern u16 D_801637BC[2];
-
/**
* Appears to check if the train is close to the crossing.
* Implements D_801637BC as a counter
@@ -6024,9 +5835,6 @@ void func_80013054(void) {
}
}
-extern s16 D_801634D8[8];
-extern u16 D_801637BE;
-
void func_800131DC(s32 playerId) {
D_801634D8[playerId] = 0;
if (gCurrentCourseId == COURSE_KALAMARI_DESERT) {
@@ -6049,8 +5857,6 @@ void func_800131DC(s32 playerId) {
}
}
-extern s16 D_801630FC;
-extern s8 gPlayerCount;
void func_800132F4(void) {
PaddleWheelBoatStuff *var_a1;
s32 i;
@@ -6086,9 +5892,7 @@ void func_800132F4(void) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-extern s16 D_80162EB0;
-extern s16 D_801630FC;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-10-2023
extern s32 D_80163598;
extern s32 D_8016359C;
@@ -6135,12 +5939,12 @@ void func_800133C4(void) {
sp7C = (f32) ((f64) var_s0->position[1] + 180.0);
sp80 = (f32) ((f64) var_s0->position[2] + 45.0);
func_80006114(&sp78, temp_s2, var_s0->yRotation);
- func_80075A6C(var_s3, (s32) &sp78, 1.1f);
+ func_80075A6C(var_s3, &sp78, 1.1f);
sp78 = (f32) ((f64) var_s0->position[0] + 30.0);
sp7C = (f32) ((f64) var_s0->position[1] + 180.0);
sp80 = (f32) ((f64) var_s0->position[2] + 45.0);
func_80006114(&sp78, temp_s2, var_s0->yRotation);
- func_80075A6C(var_s3, (s32) &sp78, 1.1f);
+ func_80075A6C(var_s3, &sp78, 1.1f);
}
if (random_int(0x0064U) == 0) {
temp_s1 = var_s0->velocity;
@@ -6245,9 +6049,6 @@ void func_80013854(Player *player) {
}
}
-extern s16 D_801631C8;
-extern s16 D_8016347A;
-
void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, VehicleStuff *vehicle, TrackWaypoint *waypointList) {
VehicleStuff *veh;
TrackWaypoint *temp_v0;
@@ -6389,12 +6190,8 @@ void func_80013D20(VehicleStuff *vehicle) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_800C9EF4(f32 *, u32); /* extern */
-extern s16 D_801631C8;
-extern s16 D_801631E0;
-extern s16 D_80163270;
-extern s16 D_8016347A;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-10-2023
+extern ? D_80163270;
void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3, f32 arg4, s32 arg5, u32 arg6) {
f32 spC4;
@@ -6415,25 +6212,22 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3
f64 temp_f0_5;
f64 temp_f0_6;
f64 temp_f20;
- s16 temp_v0_3;
- s16 temp_v1;
s32 temp_s2;
s32 temp_s7;
- s32 temp_v0_6;
+ s32 temp_v0_4;
s32 var_fp;
- s8 temp_v0_4;
- s8 temp_v0_7;
+ s8 temp_v0_3;
+ s8 temp_v0_5;
u16 temp_v0;
u16 temp_v0_2;
- u16 temp_v0_5;
+ u16 temp_v1;
u16 temp_v1_2;
- u16 temp_v1_3;
u16 var_s1;
u32 var_a2;
temp_s7 = playerId * 2;
var_s0 = vehicle;
- if (((*(&D_801631E0 + temp_s7) != 1) || ((temp_v0 = player->type, ((temp_v0 & 0x4000) != 0)) && !(temp_v0 & 0x1000))) && ((player->effects << 7) >= 0)) {
+ if (((D_801631E0[playerId] != 1) || ((temp_v0 = player->type, ((temp_v0 & 0x4000) != 0)) && !(temp_v0 & 0x1000))) && !(player->effects & 0x01000000)) {
spC4 = player->pos[0];
var_fp = 0;
spC0 = player->pos[1];
@@ -6450,7 +6244,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3
if ((temp_f0 > -20.0) && (temp_f0 < 20.0)) {
temp_f0_2 = (f64) temp_f24;
if ((temp_f0_2 > -100.0) && (temp_f0_2 < 100.0) && (func_80006018(temp_f12, temp_f14, var_s0->velocity[0], var_s0->velocity[2], arg3, arg4, spC4, spBC) == (s32) 1U)) {
- player->statusEffects |= REVERSE_EFFECT;
+ player->statusEffects |= 0x400000;
}
}
}
@@ -6458,16 +6252,15 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3
if ((temp_v0_2 & 0x4000) && !(temp_v0_2 & 0x1000)) {
temp_s2 = 1 << playerId;
if ((temp_f20 > -300.0) && (temp_f20 < 300.0) && (temp_f0_3 = (f64) temp_f22, (temp_f0_3 > -20.0)) && (temp_f0_3 < 20.0) && (temp_f0_4 = (f64) temp_f24, (temp_f0_4 > -300.0)) && (temp_f0_4 < 300.0)) {
- temp_v0_3 = D_801631C8;
- if ((temp_v0_3 > 0) && (var_s0->someFlags == 0)) {
- D_801631C8 = temp_v0_3 - 1;
+ if ((D_801631C8 > 0) && (var_s0->someFlags == 0)) {
+ D_801631C8 -= 1;
var_s0->someFlags |= temp_s2;
- func_800C9D80((f32 (*)[3]) var_s0->position, (f32 (*)[3]) var_s0->velocity, arg6);
+ func_800C9D80(var_s0->position, var_s0->velocity, arg6);
}
} else {
- temp_v0_4 = var_s0->someFlags;
- if (temp_v0_4 != 0) {
- var_s0->someFlags = temp_v0_4 & ~temp_s2;
+ temp_v0_3 = var_s0->someFlags;
+ if (temp_v0_3 != 0) {
+ var_s0->someFlags = temp_v0_3 & ~temp_s2;
if (var_s0->someFlags == 0) {
D_801631C8 += 1;
func_800C9EF4(var_s0->position, arg6);
@@ -6476,29 +6269,27 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3
}
if ((temp_f20 > -200.0) && (temp_f20 < 200.0) && (temp_f0_5 = (f64) temp_f22, (temp_f0_5 > -20.0)) && (temp_f0_5 < 20.0) && (temp_f0_6 = (f64) temp_f24, (temp_f0_6 > -200.0)) && (temp_f0_6 < 200.0)) {
if (!(var_s0->someFlagsTheSequel & temp_s2)) {
- temp_v1 = D_8016347A;
var_s1 = 0;
- temp_v0_5 = *gWaypointCountByPathIndex;
- switch (temp_v1) { /* irregular */
+ switch (D_8016347A) { /* irregular */
case 0:
sp9C = temp_s7 + &D_80163270;
- temp_v0_6 = func_80007BF8((u16) var_s0->waypointIndex, gNearestWaypointByPlayerId[playerId], 0x000AU, 0U, (u16) (s32) temp_v0_5);
- temp_v1_2 = *sp9C;
- if ((temp_v1_2 == 0) && (temp_v0_6 > 0) && (player->unk_094 < var_s0->someMultiplier)) {
+ temp_v0_4 = func_80007BF8(var_s0->waypointIndex, gNearestWaypointByPlayerId[playerId], 0x000AU, 0U, (u16) (s32) *gWaypointCountByPathIndex);
+ temp_v1 = *sp9C;
+ if ((temp_v1 == 0) && (temp_v0_4 > 0) && (player->unk_094 < var_s0->someMultiplier)) {
var_s1 = 1;
}
- if ((temp_v1_2 == 1) && (temp_v0_6 > 0)) {
+ if ((temp_v1 == 1) && (temp_v0_4 > 0)) {
var_s1 = 1;
}
break;
case 1:
- if (func_80007BF8((u16) var_s0->waypointIndex, gNearestWaypointByPlayerId[playerId], 0U, 0x000AU, (u16) (s32) temp_v0_5) > 0) {
+ if (func_80007BF8(var_s0->waypointIndex, gNearestWaypointByPlayerId[playerId], 0U, 0x000AU, (u16) (s32) *gWaypointCountByPathIndex) > 0) {
if (random_int(2U) == 0) {
- temp_v1_3 = *(&D_80163270 + temp_s7);
- if (temp_v1_3 == 0) {
+ temp_v1_2 = *(&D_80163270 + temp_s7);
+ if (temp_v1_2 == 0) {
var_s1 = 1;
}
- if ((temp_v1_3 == 1) && (player->unk_094 < var_s0->someMultiplier)) {
+ if ((temp_v1_2 == 1) && (player->unk_094 < var_s0->someMultiplier)) {
var_s1 = 1;
}
} else {
@@ -6545,9 +6336,9 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3
}
}
} else {
- temp_v0_7 = var_s0->someFlagsTheSequel;
- if (temp_v0_7 & temp_s2) {
- var_s0->someFlagsTheSequel = temp_v0_7 & ~temp_s2;
+ temp_v0_5 = var_s0->someFlagsTheSequel;
+ if (temp_v0_5 & temp_s2) {
+ var_s0->someFlagsTheSequel = temp_v0_5 & ~temp_s2;
}
}
}
@@ -6600,40 +6391,28 @@ f32 func_800145A8(s16 arg0, f32 arg1, s16 arg2) {
return arg1;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-extern ? D_801634FC;
-
+#ifdef NON_MATCHING
+extern f32 D_801634FC[][4];
+// Something about the handling of `vehicle` is the source of
+// mismatch. Not sure how to fix it.
void func_800146B8(s32 playerId, s32 arg1, VehicleStuff *vehicle) {
- VehicleStuff *var_s0;
- s16 var_v1;
- s32 var_a2;
+ s32 var_v1;
s32 var_v0;
+ s32 var_s2;
+ s32 waypointCount;
u16 temp_a1;
-
- var_s0 = vehicle;
- if (!((f64) *(&gPlayers->unk_094 + (playerId * 0xDD8)) < 1.6666666666666667) && (var_a2 = 0, (arg1 > 0))) {
-loop_3:
- temp_a1 = (u16) var_s0->waypointIndex;
- var_v0 = 0;
- var_v1 = D_80162FCE;
-loop_4:
- var_v0 += 3;
- if (temp_a1 == (var_v1 % (s32) *gWaypointCountByPathIndex)) {
- *(&D_801634FC + (playerId * 0x10)) = func_800145A8(var_s0->someType, D_80163068[playerId], (s16) temp_a1);
- return;
- }
- var_v1 += 3;
- if (var_v0 == 0x18) {
- var_a2 += 1;
- var_s0 += 0x34;
- if (var_a2 == arg1) {
-
- } else {
- goto loop_3;
+ VehicleStuff *tempVehicle;
+
+ waypointCount = gWaypointCountByPathIndex[0];
+ if (!(gPlayers[playerId].unk_094 < 1.6666666666666667)) {
+ for (var_s2 = 0; var_s2 < arg1; var_s2++) {
+ temp_a1 = vehicle[var_s2].waypointIndex;
+ for (var_v0 = 0, var_v1 = D_80162FCE; var_v0 < 0x18; var_v0 += 3, var_v1 += 3) {
+ if ((var_v1 % waypointCount) == temp_a1) {
+ D_801634FC[playerId][0] = func_800145A8(vehicle[var_s2].someType, D_80163068[playerId], temp_a1);
+ return;
+ }
}
- } else {
- goto loop_4;
}
}
}
@@ -6757,35 +6536,28 @@ void func_80014D30(s32 cameraId, s32 pathIndex) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-10-2023
extern s32 D_80163238;
-extern s16 gNearestWaypointByCameraId;
-extern s16 D_80164670[];
-
-extern s16 D_80164680;
+extern ? D_80164680;
extern ? D_801646C0;
extern s32 D_801646C8;
-extern s16 D_801646CC;
extern ? D_801646D0;
-extern s8 D_8018EDFC;
void func_80014DE4(s32 arg0) {
s16 *temp_v1;
s16 temp_a2;
- s32 temp_a1;
s32 temp_v0;
void *temp_a2_2;
temp_v0 = arg0 * 2;
D_801646CC = 0;
- temp_v1 = D_80164678[temp_v0];
- *temp_v1 = D_80164670[temp_v0];
- temp_a1 = gModeSelection;
- if ((temp_a1 != TIME_TRIALS) && ((gCupCourseSelection == CUP_COURSE_ONE) || (gDemoMode))) {
+ temp_v1 = &D_80164678[arg0];
+ *temp_v1 = D_80164670[arg0];
+ if ((gModeSelection != 1) && ((gCupCourseSelection == 0) || (gDemoMode == (u16) 1))) {
goto block_8;
}
temp_a2 = *temp_v1;
- if ((temp_a2 != 0) && (temp_a2 != 1) && (temp_a2 != 2) && (temp_a2 != 3)) {
+ if ((temp_a2 != 0) && (temp_a2 != (s16) 1) && (temp_a2 != 2) && (temp_a2 != 3)) {
block_8:
*temp_v1 = 0;
}
@@ -6797,171 +6569,125 @@ block_8:
temp_a2_2->unk0 = 0;
temp_a2_2->unk2 = 0;
temp_a2_2->unk4 = 0;
- if ((temp_a1 == TIME_TRIALS) && (D_8018EDFC == 0)) {
+ if ((gModeSelection == 1) && (D_8018EDFC == 0)) {
*temp_v1 = 0;
}
- gNearestWaypointByCameraId = 0;
- gNearestWaypointByCameraId = 0;
- gNearestWaypointByCameraId = 0;
- gNearestWaypointByCameraId = 0;
+ *gNearestWaypointByCameraId = 0;
+ *gNearestWaypointByCameraId = 0;
+ *gNearestWaypointByCameraId = 0;
+ *gNearestWaypointByCameraId = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80014DE4.s")
#endif
-#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-extern ? D_80164498;
-
f32 func_80014EE4(f32 arg0, s32 arg1) {
f32 temp_f0;
- f32 var_f12;
f64 temp_f2;
- f64 temp_f2_2;
- f64 temp_f2_3;
- f64 temp_f2_4;
- f64 var_f14;
- f64 var_f14_2;
- f64 var_f14_3;
- f64 var_f14_4;
- s16 temp_v0;
- var_f12 = arg0;
- temp_v0 = *(&D_80164678 + (arg1 * 2));
- temp_f0 = *(&D_80164498 + (arg1 * 4));
- switch (temp_v0) { /* irregular */
+ temp_f0 = D_80164498[arg1];
+ switch (D_80164678[arg1]) { /* irregular */
default:
- return 40.0f;
+ arg0 = 40.0f;
+ break;
case 0:
- var_f14 = (f64) var_f12;
- temp_f2 = 40.0 + (f64) temp_f0;
- if (temp_f2 < var_f14) {
- var_f12 = (f32) (var_f14 - 1.0);
- var_f14 = (f64) var_f12;
- if (var_f14 < temp_f2) {
- var_f12 = (f32) temp_f2;
- var_f14 = (f64) var_f12;
+ temp_f2 = 40.0;
+ temp_f2 += temp_f0;
+ if (temp_f2 < arg0) {
+ arg0 -= 1.0;
+ if (arg0 < temp_f2) {
+ arg0 = temp_f2;
}
}
- if (var_f14 < temp_f2) {
- var_f12 = (f32) (var_f14 + 1.0);
- if (temp_f2 < (f64) var_f12) {
- return (f32) temp_f2;
+ if (arg0 < temp_f2) {
+ arg0 += 1.0;
+ if (temp_f2 < arg0) {
+ arg0 = temp_f2;;
}
}
- return var_f12;
+ break;
case 1:
- var_f14_2 = (f64) var_f12;
- temp_f2_2 = 60.0 + (f64) temp_f0;
- if (var_f14_2 < temp_f2_2) {
- var_f12 = (f32) (var_f14_2 + 1.0);
- var_f14_2 = (f64) var_f12;
- if (temp_f2_2 < var_f14_2) {
- var_f12 = (f32) temp_f2_2;
- var_f14_2 = (f64) var_f12;
+ temp_f2 = 60.0;
+ temp_f2 += temp_f0;
+ if (arg0 < temp_f2) {
+ arg0 += 1.0;
+ if (temp_f2 < arg0) {
+ arg0 = temp_f2;
}
}
- if (temp_f2_2 < var_f14_2) {
- var_f12 = (f32) (var_f14_2 - 1.0);
- if ((f64) var_f12 < temp_f2_2) {
- return (f32) temp_f2_2;
+ if (temp_f2 < arg0) {
+ arg0 -= 1.0;
+ if (arg0 < temp_f2) {
+ arg0 = temp_f2;;
}
}
- /* Duplicate return node #29. Try simplifying control flow for better match */
- return var_f12;
+ break;
case 3:
- var_f14_3 = (f64) var_f12;
- temp_f2_3 = 60.0 + (f64) temp_f0;
- if (var_f14_3 < temp_f2_3) {
- var_f12 = (f32) (var_f14_3 + 0.5);
- var_f14_3 = (f64) var_f12;
- if (temp_f2_3 < var_f14_3) {
- var_f12 = (f32) temp_f2_3;
- var_f14_3 = (f64) var_f12;
+ temp_f2 = 60.0;
+ temp_f2 += temp_f0;
+ if (arg0 < temp_f2) {
+ arg0 += 0.5;
+ if (temp_f2 < arg0) {
+ arg0 = temp_f2;
}
}
- if (temp_f2_3 < var_f14_3) {
- var_f12 = (f32) (var_f14_3 - 0.5);
- if ((f64) var_f12 < temp_f2_3) {
- return (f32) temp_f2_3;
+ if (temp_f2 < arg0) {
+ arg0 -= 0.5;
+ if (arg0 < temp_f2) {
+ arg0 = temp_f2;
}
}
- /* Duplicate return node #29. Try simplifying control flow for better match */
- return var_f12;
+ break;
case 2:
- var_f14_4 = (f64) var_f12;
- temp_f2_4 = 60.0 + (f64) temp_f0;
- if (var_f14_4 < temp_f2_4) {
- var_f12 = (f32) (var_f14_4 + 1.0);
- var_f14_4 = (f64) var_f12;
- if (temp_f2_4 < var_f14_4) {
- var_f12 = (f32) temp_f2_4;
- var_f14_4 = (f64) var_f12;
+ temp_f2 = 60.0;
+ temp_f2 += temp_f0;
+ if (arg0 < temp_f2) {
+ arg0 += 1.0;
+ if (temp_f2 < arg0) {
+ arg0 = temp_f2;
}
}
- if (temp_f2_4 < var_f14_4) {
- var_f12 = (f32) (var_f14_4 - 1.0);
- if ((f64) var_f12 < temp_f2_4) {
- var_f12 = (f32) temp_f2_4;
+ if (temp_f2 < arg0) {
+ arg0 -= 1.0;
+ if (arg0 < temp_f2) {
+ arg0 = temp_f2;
}
}
- /* Duplicate return node #29. Try simplifying control flow for better match */
- return var_f12;
+ break;
}
+ return arg0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80014EE4.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-extern ? D_801646C0;
void func_800151A4(Camera *camera, s32 arg1) {
- f32 sp44;
- f32 sp40;
- f32 sp3C;
- f32 sp38;
- f32 sp34;
- f32 sp30;
+ f32 xnorm;
+ f32 ynorm;
+ f32 znorm;
+ f32 xdiff;
+ f32 ydiff;
+ f32 zdiff;
+ f32 distance;
f32 sp28;
- f32 sp20;
- f32 temp_f0;
- f32 temp_f10;
- f32 temp_f14;
- f32 temp_f16;
- f32 temp_f2;
- f32 temp_f2_2;
- u16 temp_s1;
+ u16 thing;
- temp_s1 = *(&D_801646C0 + (arg1 * 2));
- if (temp_s1 == 0) {
+ thing = D_801646C0[arg1];
+ if (thing == 0) {
camera->up[0] = 0.0f;
camera->up[2] = 0.0f;
camera->up[1] = 1.0f;
- return;
+ } else {
+ xdiff = camera->lookAt[0] - camera->pos[0];
+ ydiff = camera->lookAt[1] - camera->pos[1];
+ zdiff = camera->lookAt[2] - camera->pos[2];
+ distance = sqrtf((xdiff * xdiff) + (ydiff * ydiff) + (zdiff * zdiff));
+ xnorm = xdiff / distance;
+ ynorm = ydiff / distance;
+ znorm = zdiff / distance;
+ sp28 = 1.0 - coss(thing);
+ camera->up[0] = (sp28 * xnorm * ynorm) - (sins(thing) * znorm);
+ camera->up[1] = coss(thing) + (sp28 * ynorm * ynorm);
+ camera->up[2] = (sins(thing) * xnorm) + (sp28 * ynorm * znorm);
}
- temp_f2 = camera->lookAt[0] - camera->pos[0];
- temp_f14 = camera->lookAt[1] - camera->pos[1];
- sp38 = temp_f2;
- temp_f16 = camera->lookAt[2] - camera->pos[2];
- sp34 = temp_f14;
- sp30 = temp_f16;
- temp_f0 = sqrtf((temp_f2 * temp_f2) + (temp_f14 * temp_f14) + (temp_f16 * temp_f16));
- sp44 = temp_f2 / temp_f0;
- temp_f10 = temp_f16 / temp_f0;
- sp40 = temp_f14 / temp_f0;
- sp3C = temp_f10;
- sp28 = (f32) (1.0 - (f64) coss(temp_s1 & 0xFFFF));
- camera->up[0] = (sp28 * sp44 * sp40) - (sins(temp_s1 & 0xFFFF) * temp_f10);
- temp_f2_2 = sp28 * sp40;
- camera->up[1] = coss(temp_s1 & 0xFFFF) + (temp_f2_2 * sp40);
- sp20 = temp_f2_2;
- camera->up[2] = (sins(temp_s1 & 0xFFFF) * sp44) + (temp_f2_2 * temp_f10);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800151A4.s")
-#endif
UNUSED void func_8001530C(void) {
@@ -7028,14 +6754,6 @@ void func_80015390(Camera *camera, UNUSED Player *player, UNUSED s32 arg2) {
camera->rot[2] = 0;
}
-void func_8000BBD8(u16, f32, s16); /* extern */
-f32 func_802AE1C0(f32,f32,f32);
-extern f32 D_80162FA0[];
-extern f32 D_801645F8[];
-extern f32 D_80164618[];
-extern f32 D_80164638[];
-extern f32 D_80164648[];
-extern f32 D_80164688[];
void func_80015544(s32 playerId, f32 arg1, s32 cameraId, s32 pathIndex) {
Camera* camera;
@@ -7067,103 +6785,66 @@ void func_80015544(s32 playerId, f32 arg1, s32 cameraId, s32 pathIndex) {
camera->pos[2] = D_80164638[cameraId];
}
+void func_8001577C(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
+ s16 cameraWaypoint;
+ s16 playerWaypoint;
+ s32 stackPadding0;
+ f32 xdiff;
+ f32 ydiff;
+ f32 zdiff;
+ s32 stackPadding1;
+ s32 playerId;
+ s32 stackPadding2;
+ s32 stackPadding3;
+ s32 stackPadding4;
+ s32 stackPadding5;
+ s32 stackPadding6;
+ s32 stackPadding7;
+ s32 stackPadding8;
+ s32 stackPadding9;
+ s32 stackPaddingA;
+ Player *player;
+ s32 waypointDiff;
+ s32 pathIndex;
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_80014D30(s32, s32); /* extern */
-void func_8001A348(s32, s32, s16); /* extern */
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-extern s16 D_80164680;
-extern ? D_80164688;
-
-void func_8001577C(Camera *camera, s32 arg1, s32 arg2, s32 arg3) {
- s16 sp8E;
- s16 sp8C;
- f32 sp84;
- f32 sp80;
- f32 sp7C;
- s32 sp74;
- s32 sp44;
- s32 sp3C;
- s32 sp38;
- s16 *sp34;
- Player *temp_s2;
- f32 temp_f12;
- f32 temp_f14;
- f64 temp_f0;
- s16 *temp_t0;
- s16 temp_t2;
- s16 temp_t3;
- s16 temp_v1;
- s32 temp_v0;
- s32 temp_v0_2;
- s32 temp_v1_2;
- s32 temp_v1_3;
- s32 var_v1;
- u16 temp_a1;
-
- temp_v1 = camera->playerId;
- temp_a1 = gPathIndexByPlayerId[temp_v1];
- temp_t0 = &gNearestWaypointByCameraId[arg3];
- sp34 = temp_t0;
- sp38 = arg3 * 2;
- sp3C = temp_v1 * 2;
- sp74 = (s32) temp_v1;
- sp44 = (s32) temp_a1;
- temp_s2 = &gPlayerOne[temp_v1];
- *temp_t0 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *temp_t0, (s32) temp_a1);
- temp_t2 = (s16) gNearestWaypointByPlayerId[temp_v1];
- temp_t3 = *temp_t0;
- sp8C = temp_t2;
- sp8E = temp_t3;
- if (func_80007BF8(temp_t2 & 0xFFFF, temp_t3 & 0xFFFF, 0x0032U, 0x000FU, (u16) (s32) gWaypointCountByPathIndex[sp44]) <= 0) {
- temp_v1_2 = arg3 * 4;
- sp3C = temp_v1_2;
- func_8001A348(arg3, *(&D_80164680 + temp_v1_2), *(&D_80164688 + sp38));
- goto block_10;
+ playerId = camera->playerId;
+ pathIndex = gPathIndexByPlayerId[playerId];
+ player = gPlayerOne;
+ player += playerId;
+ gNearestWaypointByCameraId[cameraId] = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], gNearestWaypointByCameraId[cameraId], pathIndex);
+ playerWaypoint = gNearestWaypointByPlayerId[playerId];
+ cameraWaypoint = gNearestWaypointByCameraId[cameraId];
+ if (func_80007BF8(playerWaypoint, cameraWaypoint, 0x0032U, 0x000FU, gWaypointCountByPathIndex[pathIndex]) <= 0) {
+ func_8001A348(cameraId, D_80164688[cameraId], D_80164680[cameraId]);
+ } else {
+ if (D_80163068[playerId] < (-0.7)) {
+ waypointDiff = playerWaypoint - cameraWaypoint;
+ if ((D_80164688[cameraId] < (-0.5)) && ((waypointDiff * waypointDiff) < 5)) {
+ func_8001A348(cameraId, 1.0f, 3);
+ goto alable;
+ }
+ }
+ // I hate this, but a fakematch is a fakematch
+ if (D_80163068[playerId] > 0.7) { waypointDiff = playerWaypoint - cameraWaypoint; if ((D_80164688[cameraId] > 0.5) && ((waypointDiff * waypointDiff) < 5)) {
+ func_8001A348(cameraId, -1.0f, 2);
+ }
+ }
}
- temp_f0 = (f64) D_80163068[temp_v1];
- temp_v1_3 = arg3 * 4;
- if (temp_f0 < -0.7) {
- temp_v0 = temp_t2 - temp_t3;
- if (((f64) *(&D_80164688 + temp_v1_3) < -0.5) && ((temp_v0 * temp_v0) < 5)) {
- sp3C = temp_v1_3;
- func_8001A348(arg3, 0x3F800000, 3);
- goto block_10;
- }
- }
- var_v1 = arg3 * 4;
- if (temp_f0 > 0.7) {
- temp_v0_2 = temp_t2 - temp_t3;
- if (((f64) *(&D_80164688 + var_v1) > 0.5) && ((temp_v0_2 * temp_v0_2) < 5)) {
- sp3C = var_v1;
- func_8001A348(arg3, 0xBF800000, 2);
-block_10:
- var_v1 = sp3C;
- }
- }
- camera->pos[0] = *(&D_801645F8 + var_v1);
- camera->pos[1] = *(&D_80164618 + var_v1);
- camera->pos[2] = *(&D_80164638 + var_v1);
- camera->lookAt[0] = temp_s2->pos[0];
- camera->lookAt[1] = (f32) ((f64) temp_s2->pos[1] + 6.0);
- camera->lookAt[2] = temp_s2->pos[2];
- func_80014D30(arg3, sp44);
- temp_f12 = camera->lookAt[0] - camera->pos[0];
- sp80 = camera->lookAt[1] - camera->pos[1];
- sp84 = temp_f12;
- temp_f14 = camera->lookAt[2] - camera->pos[2];
- sp7C = temp_f14;
- camera->rot[1] = atan2s(temp_f12, temp_f14);
- camera->rot[0] = atan2s(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
+alable:
+ camera->pos[0] = D_801645F8[cameraId];
+ camera->pos[1] = D_80164618[cameraId];
+ camera->pos[2] = D_80164638[cameraId];
+ camera->lookAt[0] = player->pos[0];
+ camera->lookAt[1] = player->pos[1] + 6.0;
+ camera->lookAt[2] = player->pos[2];
+ func_80014D30(cameraId, pathIndex);
+ xdiff = camera->lookAt[0] - camera->pos[0];
+ ydiff = camera->lookAt[1] - camera->pos[1];
+ zdiff = camera->lookAt[2] - camera->pos[2];
+ camera->rot[1] = atan2s(xdiff, zdiff);
+ camera->rot[0] = atan2s(sqrtf((xdiff * xdiff) + (zdiff * zdiff)), ydiff);
camera->rot[2] = 0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001577C.s")
-#endif
void func_80015A9C(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
Camera* camera = cameras + cameraId;
@@ -7189,19 +6870,7 @@ void func_80015A9C(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8000BBD8(u16, s32, u16, s16, s32 *); /* extern */
-void func_80014D30(s32, s32); /* extern */
-void func_8001A348(s32, s32, s16, s32 *, s32 *); /* extern */
-extern f32 D_80162FA0;
-extern s32 D_80163238;
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-extern ? D_80164648;
-extern s16 D_80164680;
-extern ? D_80164688;
-
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-11-2023
void func_80015C94(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
f32 spA8;
f32 spA4;
@@ -7218,10 +6887,14 @@ void func_80015C94(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s32 sp5C; /* compiler-managed */
s16 *sp58;
u16 *sp54;
- s32 *sp50;
+ f32 *sp50;
s32 sp44;
f64 sp38;
+ TrackWaypoint *temp_v0_2;
+ f32 *temp_a3;
+ f32 *temp_a3_2;
f32 *temp_a3_3;
+ f32 *temp_a3_4;
f32 temp_f0_2;
f32 temp_f0_3;
f32 temp_f14;
@@ -7232,6 +6905,7 @@ void func_80015C94(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
f32 temp_f20_2;
f32 temp_f2;
f32 temp_f6;
+ f32 var_f12;
f32 var_f18;
f32 var_f20;
f64 temp_f0;
@@ -7241,13 +6915,8 @@ void func_80015C94(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 *temp_t0;
s16 temp_v0;
s16 temp_v1;
- s32 *temp_a3;
- s32 *temp_a3_2;
- s32 *var_a3;
s32 temp_hi;
- s32 var_f12;
s32 var_s1;
- TrackWaypoint *temp_v0_2;
u16 *temp_t1_2;
u16 *temp_t2;
u16 temp_t1;
@@ -7267,67 +6936,65 @@ void func_80015C94(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp54 = temp_t2;
if (func_80007BF8((s16) gNearestWaypointByPlayerId[temp_v1] & 0xFFFF, *sp58 & 0xFFFF, 0x0032U, 0x000FU, (u16) (s32) *temp_t2) <= 0) {
var_s1 = cameraId * 4;
- temp_a3 = var_s1 + &D_80164688;
+ temp_a3 = &D_80164688[cameraId];
sp50 = temp_a3;
- func_8001A348(cameraId, *temp_a3, *(&D_80164680 + sp5C), temp_a3);
- var_a3 = temp_a3;
+ func_8001A348(cameraId, *temp_a3, (s32) *(D_80164680 + sp5C));
goto block_8;
}
temp_f0 = (f64) D_80163068[temp_v1];
if (temp_f0 < -0.5) {
var_s1 = cameraId * 4;
- temp_a3_2 = var_s1 + &D_80164688;
+ temp_a3_2 = &D_80164688[cameraId];
if ((f64) *temp_a3_2 < -0.5) {
sp50 = temp_a3_2;
- func_8001A348(cameraId, 0x3F800000, 7, temp_a3_2);
- var_a3 = temp_a3_2;
+ func_8001A348(cameraId, 1.0f, 7);
goto block_8;
}
}
var_s1 = cameraId * 4;
- var_a3 = var_s1 + &D_80164688;
- var_f12 = *var_a3;
+ temp_a3_3 = &D_80164688[cameraId];
+ var_f12 = *temp_a3_3;
if ((temp_f0 > 0.5) && ((f64) var_f12 > 0.5)) {
- sp50 = var_a3;
- func_8001A348(var_f12, cameraId, 0xBF800000, (s32 *)6, var_a3);
+ sp50 = temp_a3_3;
+ func_8001A348(cameraId, -1.0f, 6);
block_8:
- var_f12 = *var_a3;
+ var_f12 = D_80164688[cameraId];
}
temp_v1_2 = *sp54;
temp_v0 = *sp58;
- sp50 = var_a3;
+ sp50 = &D_80164688[cameraId];
temp_hi = (s32) (temp_v0 + 1) % (s32) temp_v1_2;
sp78 = (u16) ((s32) (temp_v0 + 2) % (s32) temp_v1_2);
sp7A = (s16) temp_hi;
sp44 = (s32) unksp6A;
- func_8000BBD8((u16) var_f12, (s16) temp_hi & 0xFFFF, (u16) var_f12, unksp6A, var_a3);
- temp_f20 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
- temp_f18 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
+ func_8000BBD8((s16) temp_hi & 0xFFFF, var_f12, unksp6A);
+ temp_f20 = (f32) ((f64) D_80162FA0->unk0 * 0.5);
+ temp_f18 = (f32) ((f64) D_80162FA0->unk8 * 0.5);
sp90 = temp_f18;
- func_8000BBD8(sp78, *var_a3, (u16) unksp6A, (s16) var_a3);
+ func_8000BBD8(sp78, D_80164688[cameraId], unksp6A);
temp_v0_2 = D_80164550[sp68];
- temp_a3_3 = var_s1 + &D_801645F8;
- temp_t0 = var_s1 + &D_80164618;
- temp_f14 = (f32) ((f64) temp_f20 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_a3_3;
- temp_t1_2 = var_s1 + &D_80164638;
+ temp_a3_4 = var_s1 + D_801645F8;
+ temp_t0 = var_s1 + D_80164618;
+ temp_f14 = (f32) ((f64) temp_f20 + ((f64) D_80162FA0->unk0 * 0.5)) - *temp_a3_4;
+ temp_t1_2 = var_s1 + D_80164638;
temp_f6 = (f32) ((f64) (temp_v0_2[(s16) sp78].posY + temp_v0_2[sp7A].posY) * 0.5);
sp54 = temp_t1_2;
sp94 = temp_f6;
sp8C = temp_f14;
temp_f16 = temp_f6 - *temp_t0;
sp58 = temp_t0;
- sp5C = temp_a3_3;
- temp_f0_2 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1_2;
+ sp5C = temp_a3_4;
+ temp_f0_2 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0->unk8 * 0.5)) - *temp_t1_2;
sp88 = temp_f16;
sp84 = temp_f0_2;
temp_f0_3 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f0_2 * temp_f0_2));
if ((f64) temp_f0_3 != 0.0) {
- temp_f2 = *(&D_80164648 + var_s1);
- var_f20 = ((temp_f2 * temp_f14) / temp_f0_3) + *temp_a3_3;
+ temp_f2 = *(D_80164648 + var_s1);
+ var_f20 = ((temp_f2 * temp_f14) / temp_f0_3) + *temp_a3_4;
sp94 = ((temp_f2 * temp_f16) / temp_f0_3) + *temp_t0;
var_f18 = ((temp_f2 * sp84) / temp_f0_3) + *temp_t1_2;
} else {
- var_f20 = *temp_a3_3;
+ var_f20 = *temp_a3_4;
var_f18 = *temp_t1_2;
sp94 = *temp_t0;
}
@@ -7338,14 +7005,14 @@ block_8:
sp90 = var_f18;
sp54 = temp_t1_2;
sp58 = temp_t0;
- sp5C = temp_a3_3;
+ sp5C = temp_a3_4;
temp_f2_2 = (f64) func_802AE1C0(var_f20, (f32) (temp_f16_2 + 30.0), var_f18);
if ((temp_f2_2 < (temp_f16_2 - 20.0)) || (temp_f2_2 >= 3000.0)) {
camera->pos[1] = (f32) (temp_f16_2 + 10.0);
} else {
camera->pos[1] = (f32) (temp_f2_2 + 8.0);
}
- *temp_a3_3 = var_f20;
+ *temp_a3_4 = var_f20;
*temp_t1_2 = var_f18;
*temp_t0 = sp94;
camera->lookAt[0] = spA0->pos[0];
@@ -7364,8 +7031,6 @@ block_8:
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80015C94.s")
#endif
-extern f32 D_80164658[];
-
void func_800162CC(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
Camera* camera = cameras + cameraId;
@@ -7388,20 +7053,7 @@ void func_800162CC(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8000BBD8(u16, f32, s16, u16, s16, s16); /* extern */
-void func_80014D30(s32, s32); /* extern */
-void func_8001A348(s32, f32, s16, ?, ?); /* extern */
-extern f32 D_80162FA0;
-extern s32 D_80163238;
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-extern ? D_80164648;
-extern ? D_80164658;
-extern s16 D_80164680;
-extern ? D_80164688;
-
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-11-2023
void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 spB6;
s16 spB4;
@@ -7431,6 +7083,7 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
f32 *sp3C;
u16 *sp38;
f64 sp28;
+ TrackWaypoint *temp_v0_2;
f32 *temp_a3;
f32 *temp_t0;
f32 *temp_t1_2;
@@ -7463,17 +7116,14 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 temp_t3_2;
s16 temp_v0;
s16 temp_v1;
- s32 temp_a1;
s32 temp_hi;
s32 temp_ra;
- TrackWaypoint *temp_v0_2;
u16 *temp_t7;
u16 temp_t3;
u16 temp_v1_2;
- temp_a1 = cameraId * 4;
- temp_t5 = temp_a1 + &D_80164648;
- temp_t4 = temp_a1 + &D_80164658;
+ temp_t5 = &D_80164648[cameraId];
+ temp_t4 = &D_80164658[cameraId];
temp_f2 = *temp_t5;
temp_v1 = camera->playerId;
*temp_t5 = temp_f2 + ((*temp_t4 - temp_f2) * 0.5f);
@@ -7488,12 +7138,12 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp50 = temp_v1 * 2;
sp58 = temp_t5;
sp54 = temp_t4;
- sp5C = temp_a1;
+ sp5C = cameraId * 4;
sp9C = (s32) temp_v1;
sp68 = (s32) temp_t3;
*sp44 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *temp_t1, (s32) temp_t3);
temp_t1_2 = &D_80163068[temp_v1];
- temp_t5_2 = sp5C + &D_80164688;
+ temp_t5_2 = sp5C + D_80164688;
temp_f2_2 = *temp_t1_2 - *temp_t5_2;
temp_t3_2 = *sp44;
temp_t7 = &gWaypointCountByPathIndex[sp68];
@@ -7507,7 +7157,7 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
spB4 = temp_t2;
if (func_80007BF8(temp_t2 & 0xFFFF, temp_t3_2 & 0xFFFF, 0x000FU, 0x000FU, (u16) (s32) *temp_t7) <= 0) {
sp3C = temp_t5_2;
- func_8001A348(cameraId, *temp_t5_2, *(&D_80164680 + sp48));
+ func_8001A348(cameraId, *temp_t5_2, (s32) *(D_80164680 + sp48));
var_f12 = *temp_t5_2;
} else {
temp_f0 = (f64) *temp_t1_2;
@@ -7519,7 +7169,7 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
var_f12 = *temp_t5_2;
if ((temp_f0 > 0.0) && ((f64) var_f12 > 0.0) && ((f64) temp_f2_3 < 0.01)) {
sp3C = temp_t5_2;
- func_8001A348((bitwise s32) var_f12, 0.0f, (s16) cameraId, 0xBF800000, 4);
+ func_8001A348(cameraId, -1.0f, 4);
var_f12 = *temp_t5_2;
} else {
if ((temp_t3_2 < temp_t2) && ((temp_t2 - temp_t3_2) < 0xA)) {
@@ -7546,24 +7196,24 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp78 = (u16) ((s32) (temp_v0 + 2) % (s32) temp_v1_2);
sp7A = (s16) temp_hi;
sp54 = (f32 *) unksp6A;
- func_8000BBD8((bitwise u16) var_f12, 0.0f, (s16) temp_hi & 0xFFFF, (bitwise u16) var_f12, unksp6A, (s16) temp_hi);
- temp_f6 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
+ func_8000BBD8((s16) temp_hi & 0xFFFF, var_f12, unksp6A);
+ temp_f6 = (f32) ((f64) D_80162FA0->unk0 * 0.5);
sp98 = temp_f6;
- temp_f18 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
+ temp_f18 = (f32) ((f64) D_80162FA0->unk8 * 0.5);
sp90 = temp_f18;
func_8000BBD8(sp78, *temp_t5_2, unksp6A);
temp_v0_2 = D_80164550[sp68];
- temp_f4 = (f32) ((f64) temp_f6 + ((f64) D_80162FA0.unk0 * 0.5));
+ temp_f4 = (f32) ((f64) temp_f6 + ((f64) D_80162FA0->unk0 * 0.5));
sp98 = temp_f4;
- temp_a3 = sp5C + &D_801645F8;
- temp_t0 = sp5C + &D_80164618;
- temp_t1_3 = sp5C + &D_80164638;
+ temp_a3 = sp5C + D_801645F8;
+ temp_t0 = sp5C + D_80164618;
+ temp_t1_3 = sp5C + D_80164638;
sp4C = temp_t1_3;
sp50 = temp_t0;
sp54 = temp_a3;
temp_f14 = temp_f4 - *temp_a3;
temp_f6_2 = (f32) ((f64) (temp_v0_2[(s16) sp78].posY + temp_v0_2[sp7A].posY) * 0.5);
- temp_f2_4 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1_3;
+ temp_f2_4 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0->unk8 * 0.5)) - *temp_t1_3;
sp94 = temp_f6_2;
sp8C = temp_f14;
temp_f16 = temp_f6_2 - *temp_t0;
@@ -7615,18 +7265,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80016494.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8000BBD8(s32, ?32, ?32, s32); /* extern */
-extern f32 D_80162FA0;
-extern ? D_80163DD8;
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-extern ? D_80164648;
-extern ? D_80164658;
-extern ? D_80164688;
-static ?32 D_800ED260 = 0x3DCCCCCD; /* const */
-static ?32 D_800ED264 = 0xBDCCCCCD; /* const */
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-11-2023
s16 gCurrentCourseId; /* unable to generate initializer */
void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) {
@@ -7637,10 +7276,10 @@ void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) {
s32 *sp34;
f32 *sp2C;
f32 *sp28;
- ?32 *var_s2;
Camera *temp_v0_2;
f32 *temp_t2;
f32 *temp_t3;
+ f32 *var_s2;
f32 temp_f12;
f32 temp_f2;
s16 *temp_s1;
@@ -7648,63 +7287,57 @@ void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) {
s16 temp_v1_3;
s32 *temp_v0;
s32 *temp_v1;
- s32 temp_t6;
- s32 temp_t6_2;
- s32 temp_t8;
+ s32 temp_hi;
s32 var_a3;
- TrackWaypoint *temp_t7;
u16 temp_s0;
if (random_int(0x0064U) < 0x32) {
- temp_t6 = cameraId * 4;
- var_s2 = temp_t6 + &D_80164688;
- var_a3 = temp_t6;
- *var_s2 = 0x3DCCCCCD;
+ var_s2 = &D_80164688[cameraId];
+ var_a3 = cameraId * 4;
+ *var_s2 = 0.1f;
} else {
- temp_t8 = cameraId * 4;
- var_s2 = temp_t8 + &D_80164688;
- var_a3 = temp_t8;
- *var_s2 = 0xBDCCCCCD;
+ var_s2 = &D_80164688[cameraId];
+ var_a3 = cameraId * 4;
+ *var_s2 = -0.1f;
}
- temp_v1 = var_a3 + &D_80163DD8;
+ temp_v1 = var_a3 + D_80163DD8;
*temp_v1 = 0;
if (gCurrentCourseId == 4) {
sp34 = temp_v1;
sp3C = var_a3;
*temp_v1 = random_int(4U);
- *var_s2 = 0;
+ *var_s2 = 0.0f;
}
temp_s1 = &gNearestWaypointByCameraId[cameraId];
temp_s0 = gWaypointCountByPathIndex[*temp_v1];
- temp_t6_2 = (s16) *temp_s1 % (s32) temp_s0;
- *temp_s1 = (s16) temp_t6_2;
+ temp_hi = (s16) *temp_s1 % (s32) temp_s0;
+ *temp_s1 = (s16) temp_hi;
sp3C = var_a3;
- func_8000BBD8(temp_t6_2 & 0xFFFF, *var_s2, 0, var_a3);
+ func_8000BBD8(temp_hi & 0xFFFF, *var_s2, 0);
temp_v1_2 = *temp_s1;
- temp_t2 = var_a3 + &D_80164618;
- temp_v0 = var_a3 + &D_801645F8;
- *temp_v0 = D_80162FA0.unk0;
- temp_t3 = var_a3 + &D_80164638;
- *temp_t3 = D_80162FA0.unk8;
+ temp_t2 = var_a3 + D_80164618;
+ temp_v0 = var_a3 + D_801645F8;
+ *temp_v0 = D_80162FA0->unk0;
+ temp_t3 = var_a3 + D_80164638;
+ *temp_t3 = D_80162FA0->unk8;
*temp_t2 = (f32) (*D_80164550)[temp_v1_2].posY;
- *(&D_80164658 + var_a3) = 16.666666f;
- *(&D_80164648 + var_a3) = 0.0f;
+ *(D_80164658 + var_a3) = 16.666666f;
+ *(D_80164648 + var_a3) = 0.0f;
sp44 = (u16) ((s32) (temp_v1_2 + 0xB) % (s32) temp_s0);
sp28 = temp_t3;
sp2C = temp_t2;
sp34 = temp_v0;
- func_8000BBD8((s16) ((s32) (temp_v1_2 + 0xA) % (s32) temp_s0) & 0xFFFF, *var_s2, 0, var_a3);
- temp_f2 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
- temp_f12 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
+ func_8000BBD8((s16) ((s32) (temp_v1_2 + 0xA) % (s32) temp_s0) & 0xFFFF, *var_s2, 0);
+ temp_f2 = (f32) ((f64) D_80162FA0->unk0 * 0.5);
+ temp_f12 = (f32) ((f64) D_80162FA0->unk8 * 0.5);
sp5C = temp_f2;
sp54 = temp_f12;
- func_8000BBD8((bitwise s32) temp_f12, (?32) sp44, *var_s2, 0);
+ func_8000BBD8(sp44, *var_s2, 0);
temp_v1_3 = *temp_s1;
- temp_t7 = *D_80164550;
temp_v0_2 = &cameras[cameraId];
- temp_v0_2->lookAt[0] = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5));
- temp_v0_2->lookAt[2] = (f32) ((f64) temp_f12 + ((f64) D_80162FA0.unk8 * 0.5));
- temp_v0_2->lookAt[1] = (f32) ((f64) ((f32) (temp_t7[(s16) ((s32) (temp_v1_3 + 6) % (s32) temp_s0)].posY + temp_t7[(s16) ((s32) (temp_v1_3 + 5) % (s32) temp_s0)].posY) * 0.5f) + 8.0);
+ temp_v0_2->lookAt[0] = (f32) ((f64) temp_f2 + ((f64) D_80162FA0->unk0 * 0.5));
+ temp_v0_2->lookAt[2] = (f32) ((f64) temp_f12 + ((f64) D_80162FA0->unk8 * 0.5));
+ temp_v0_2->lookAt[1] = (f32) ((f64) ((f32) ((*D_80164550)[(s16) ((s32) (temp_v1_3 + 6) % (s32) temp_s0)].posY + (*D_80164550)[(s16) ((s32) (temp_v1_3 + 5) % (s32) temp_s0)].posY) * 0.5f) + 8.0);
temp_v0_2->pos[0] = (bitwise f32) *sp34;
temp_v0_2->pos[1] = *sp2C;
temp_v0_2->pos[2] = *sp28;
@@ -7714,18 +7347,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80016C3C.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8000BBD8(u16, s32, s16, s16); /* extern */
-void func_80014D30(s32, s32, f32 *); /* extern */
-extern f32 D_80162FA0;
-extern s32 D_80163238;
-extern ? D_80163DD8;
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-extern ? D_80164648;
-extern ? D_80164658;
-extern ? D_80164688;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-11-2023
s16 gCurrentCourseId; /* unable to generate initializer */
void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
@@ -7752,6 +7374,9 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 *sp40;
f32 *sp3C;
TrackWaypoint **sp2C;
+ TrackWaypoint **temp_t2_2;
+ TrackWaypoint *temp_t0_2;
+ TrackWaypoint *temp_t0_3;
f32 *temp_a2;
f32 *temp_t1;
f32 temp_f0;
@@ -7779,18 +7404,13 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s32 *temp_v1;
s32 temp_hi;
s32 temp_t2;
- s32 temp_t6;
s32 temp_v0;
- TrackWaypoint **temp_t2_2;
- TrackWaypoint *temp_t0_2;
- TrackWaypoint *temp_t0_3;
- temp_t6 = cameraId * 4;
- temp_t1 = temp_t6 + &D_80164648;
+ temp_t1 = &D_80164648[cameraId];
temp_f2 = *temp_t1;
- temp_a1 = temp_t6 + &D_80163DD8;
+ temp_a1 = &D_80163DD8[cameraId];
temp_t2 = *temp_a1;
- *temp_t1 = temp_f2 + ((*(&D_80164658 + temp_t6) - temp_f2) * 0.5f);
+ *temp_t1 = temp_f2 + ((D_80164658[cameraId] - temp_f2) * 0.5f);
temp_t0 = &gNearestWaypointByCameraId[cameraId];
D_80163238 = (s32) camera->playerId;
temp_a3 = *temp_t0;
@@ -7799,7 +7419,7 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp48 = temp_t1;
sp40 = temp_t0;
sp44 = temp_a1;
- sp4C = temp_t6;
+ sp4C = cameraId * 4;
sp5C = temp_t2;
*sp40 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], temp_a3, temp_t2);
if (gCurrentCourseId == 4) {
@@ -7812,16 +7432,16 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
}
}
temp_a3_3 = *sp40;
- temp_v1 = sp4C + &D_80164688;
+ temp_v1 = sp4C + D_80164688;
sp6C = (u16) ((s32) (temp_a3_3 + 0xB) % sp58);
sp44 = temp_v1;
sp3C = (f32 *) unksp5E;
- func_8000BBD8((s16) ((s32) (temp_a3_3 + 0xA) % sp58) & 0xFFFF, *temp_v1, unksp5E, temp_a3_3);
- sp8C = (f32) ((f64) D_80162FA0.unk0 * 0.5);
- sp84 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
- func_8000BBD8(sp6C, *sp44, unksp3E);
- sp8C = (f32) ((f64) sp8C + ((f64) D_80162FA0.unk0 * 0.5));
- sp84 = (f32) ((f64) sp84 + ((f64) D_80162FA0.unk8 * 0.5));
+ func_8000BBD8((s16) ((s32) (temp_a3_3 + 0xA) % sp58) & 0xFFFF, *temp_v1, unksp5E);
+ sp8C = (f32) ((f64) D_80162FA0->unk0 * 0.5);
+ sp84 = (f32) ((f64) D_80162FA0->unk8 * 0.5);
+ func_8000BBD8(sp6C, (bitwise f32) *sp44, unksp3E);
+ sp8C = (f32) ((f64) sp8C + ((f64) D_80162FA0->unk0 * 0.5));
+ sp84 = (f32) ((f64) sp84 + ((f64) D_80162FA0->unk8 * 0.5));
temp_a3_4 = *sp40;
temp_t2_2 = &D_80164550[sp5C];
temp_t0_2 = *temp_t2_2;
@@ -7830,23 +7450,23 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp2C = temp_t2_2;
sp6C = (u16) ((s32) (temp_a3_4 + 2) % sp58);
sp6E = (s16) temp_hi;
- func_8000BBD8((s16) temp_hi & 0xFFFF, *sp44, unksp3E, temp_a3_4);
- temp_f14 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
- temp_f16 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
+ func_8000BBD8((s16) temp_hi & 0xFFFF, (bitwise f32) *sp44, unksp3E);
+ temp_f14 = (f32) ((f64) D_80162FA0->unk0 * 0.5);
+ temp_f16 = (f32) ((f64) D_80162FA0->unk8 * 0.5);
sp98 = temp_f14;
sp90 = temp_f16;
- func_8000BBD8(sp6C, *sp44, unksp3E);
+ func_8000BBD8(sp6C, (bitwise f32) *sp44, unksp3E);
temp_t0_3 = *sp2C;
- temp_a0 = sp4C + &D_801645F8;
+ temp_a0 = sp4C + D_801645F8;
temp_f10 = (f32) (temp_t0_3[(s16) sp6C].posY + temp_t0_3[(s16) temp_hi].posY) * 0.5f;
- temp_a1_2 = sp4C + &D_80164618;
- temp_f18 = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_a0;
+ temp_a1_2 = sp4C + D_80164618;
+ temp_f18 = (f32) ((f64) temp_f14 + ((f64) D_80162FA0->unk0 * 0.5)) - *temp_a0;
sp94 = temp_f10;
temp_f2_2 = temp_f10 - *temp_a1_2;
- temp_a2 = sp4C + &D_80164638;
+ temp_a2 = sp4C + D_80164638;
sp3C = temp_a2;
sp7C = temp_f2_2;
- temp_f8 = (f32) ((f64) temp_f16 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a2;
+ temp_f8 = (f32) ((f64) temp_f16 + ((f64) D_80162FA0->unk8 * 0.5)) - *temp_a2;
sp80 = temp_f18;
sp40 = temp_a1_2;
sp44 = temp_a0;
@@ -7875,7 +7495,7 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
camera->lookAt[0] = sp8C;
camera->lookAt[2] = sp84;
camera->lookAt[1] = (f32) ((f64) sp88 + 8.0);
- func_80014D30(cameraId, sp5C, temp_a2);
+ func_80014D30(cameraId, sp5C);
temp_f12 = camera->lookAt[0] - camera->pos[0];
spA8 = camera->lookAt[1] - camera->pos[1];
spAC = temp_f12;
@@ -7912,20 +7532,7 @@ void func_80017720(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8000BBD8(u16, f32, s16, s32); /* extern */
-void func_80014D30(s32, s32, f32 *, f32 *); /* extern */
-void func_8001A348(s32, f32, s16); /* extern */
-extern f32 D_80162FA0;
-extern s32 D_80163238;
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-extern ? D_80164648;
-extern ? D_80164658;
-extern s16 D_80164680;
-extern ? D_80164688;
-
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-11-2023
void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 sp9E;
s16 sp9C;
@@ -7950,6 +7557,7 @@ void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s32 sp30;
s32 sp2C;
s16 *sp28;
+ TrackWaypoint *temp_v0_3;
f32 *temp_a1;
f32 *temp_a2;
f32 *temp_a3;
@@ -7976,15 +7584,14 @@ void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s32 temp_hi_2;
s32 temp_t3;
s32 temp_t4;
- TrackWaypoint *temp_v0_3;
u16 temp_ra;
temp_v0 = camera->playerId;
temp_t4 = cameraId * 4;
- temp_a1 = temp_t4 + &D_80164688;
- temp_t6 = temp_t4 + &D_80164648;
+ temp_a1 = &D_80164688[cameraId];
+ temp_t6 = &D_80164648[cameraId];
sp3C = temp_t6;
- temp_v1 = temp_t4 + &D_80164658;
+ temp_v1 = &D_80164658[cameraId];
*temp_a1 = D_80163068[temp_v0];
temp_f16 = *temp_t6;
temp_t3 = temp_v0 * 0xDD8;
@@ -8009,7 +7616,7 @@ void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp9E = temp_t1_2;
if (func_80007BF8(temp_hi & 0xFFFF, temp_t1_2 & 0xFFFF, 0x000DU, 1U, (u16) sp4C) <= 0) {
sp44 = temp_t4;
- func_8001A348(cameraId, *sp40, *(&D_80164680 + sp2C));
+ func_8001A348(cameraId, *sp40, (s32) *(D_80164680 + sp2C));
} else {
if ((temp_t1_2 < sp9C) && ((sp9C - temp_t1_2) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) + 0.1);
@@ -8032,23 +7639,23 @@ void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp62 = (s16) temp_hi_2;
sp44 = temp_t4;
sp38 = (f32 *) unksp52;
- func_8000BBD8((s16) temp_hi_2 & 0xFFFF, *sp40, unksp52, sp4C);
- temp_f2 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
- temp_f14 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
+ func_8000BBD8((s16) temp_hi_2 & 0xFFFF, *sp40, unksp52);
+ temp_f2 = (f32) ((f64) D_80162FA0->unk0 * 0.5);
+ temp_f14 = (f32) ((f64) D_80162FA0->unk8 * 0.5);
sp80 = temp_f2;
sp78 = temp_f14;
func_8000BBD8(sp60, *sp40, unksp52);
temp_v0_3 = D_80164550[sp50];
- temp_a2 = temp_t4 + &D_80164618;
- temp_v1_2 = temp_t4 + &D_801645F8;
- temp_a3 = temp_t4 + &D_80164638;
- temp_f16_2 = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_v1_2;
+ temp_a2 = &D_80164618[cameraId];
+ temp_v1_2 = &D_801645F8[cameraId];
+ temp_a3 = &D_80164638[cameraId];
+ temp_f16_2 = (f32) ((f64) temp_f2 + ((f64) D_80162FA0->unk0 * 0.5)) - *temp_v1_2;
sp34 = temp_a3;
sp40 = temp_v1_2;
sp74 = temp_f16_2;
sp38 = temp_a2;
sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].posY + temp_v0_3[sp62].posY) * 0.5) - *temp_a2;
- sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a3;
+ sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0->unk8 * 0.5)) - *temp_a3;
temp_f0 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C));
if ((f64) temp_f0 != 0.0) {
temp_f16_3 = *sp3C;
@@ -8069,7 +7676,7 @@ void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
camera->lookAt[0] = sp88->pos[0];
camera->lookAt[1] = (f32) ((f64) sp88->pos[1] + 6.0);
camera->lookAt[2] = sp88->pos[2];
- func_80014D30(cameraId, sp50, temp_a2, temp_a3);
+ func_80014D30(cameraId, sp50);
temp_f12 = camera->lookAt[0] - camera->pos[0];
sp90 = camera->lookAt[1] - camera->pos[1];
sp94 = temp_f12;
@@ -8106,20 +7713,7 @@ void func_80017F10(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8000BBD8(u16, f32, s16); /* extern */
-void func_80014D30(s32, s32, f32 *, f32 *); /* extern */
-void func_8001A348(s32, f32, s16); /* extern */
-extern f32 D_80162FA0;
-extern s32 D_80163238;
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-extern ? D_80164648;
-extern ? D_80164658;
-extern s16 D_80164680;
-extern ? D_80164688;
-
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-11-2023
void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 sp9E;
s16 sp9C;
@@ -8144,6 +7738,7 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s32 sp2C;
s16 *sp28;
Player *temp_s1;
+ TrackWaypoint *temp_v0_3;
f32 *temp_a1;
f32 *temp_a2;
f32 *temp_a3;
@@ -8170,16 +7765,15 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s32 temp_hi_2;
s32 temp_t3;
s32 temp_t5;
- TrackWaypoint *temp_v0_3;
u16 temp_ra;
u16 temp_t4;
temp_v0 = camera->playerId;
temp_t5 = cameraId * 4;
- temp_a1 = temp_t5 + &D_80164688;
- temp_t6 = temp_t5 + &D_80164648;
+ temp_a1 = &D_80164688[cameraId];
+ temp_t6 = &D_80164648[cameraId];
sp3C = temp_t6;
- temp_v1 = temp_t5 + &D_80164658;
+ temp_v1 = &D_80164658[cameraId];
*temp_a1 = D_80163068[temp_v0];
temp_f16 = *temp_t6;
*temp_t6 = temp_f16 + ((*temp_v1 - temp_f16) * 0.5f);
@@ -8206,7 +7800,7 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
if (func_80007BF8(temp_hi & 0xFFFF, temp_t1_2 & 0xFFFF, 1U, 0x000AU, (u16) (s32) temp_t4) <= 0) {
sp44 = temp_t5;
sp4C = (s32) temp_t4;
- func_8001A348(cameraId, *sp40, *(&D_80164680 + sp2C));
+ func_8001A348(cameraId, *sp40, (s32) *(D_80164680 + sp2C));
} else {
if ((temp_t1_2 < sp9C) && ((sp9C - temp_t1_2) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) + 0.1);
@@ -8230,22 +7824,22 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp44 = temp_t5;
sp38 = (f32 *) unksp52;
func_8000BBD8((s16) temp_hi_2 & 0xFFFF, *sp40, unksp52);
- temp_f2 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
- temp_f14 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
+ temp_f2 = (f32) ((f64) D_80162FA0->unk0 * 0.5);
+ temp_f14 = (f32) ((f64) D_80162FA0->unk8 * 0.5);
sp80 = temp_f2;
sp78 = temp_f14;
func_8000BBD8(sp60, *sp40, unksp52);
temp_v0_3 = D_80164550[sp50];
- temp_a2 = temp_t5 + &D_80164618;
- temp_v1_2 = temp_t5 + &D_801645F8;
- temp_a3 = temp_t5 + &D_80164638;
- temp_f16_2 = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_v1_2;
+ temp_a2 = &D_80164618[cameraId];
+ temp_v1_2 = &D_801645F8[cameraId];
+ temp_a3 = &D_80164638[cameraId];
+ temp_f16_2 = (f32) ((f64) temp_f2 + ((f64) D_80162FA0->unk0 * 0.5)) - *temp_v1_2;
sp34 = temp_a3;
sp40 = temp_v1_2;
sp74 = temp_f16_2;
sp38 = temp_a2;
sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].posY + temp_v0_3[sp62].posY) * 0.5) - *temp_a2;
- sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a3;
+ sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0->unk8 * 0.5)) - *temp_a3;
temp_f0 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C));
if ((f64) temp_f0 != 0.0) {
temp_f16_3 = *sp3C;
@@ -8266,7 +7860,7 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
camera->lookAt[0] = temp_s1->pos[0];
camera->lookAt[1] = (f32) ((f64) temp_s1->pos[1] + 6.0);
camera->lookAt[2] = temp_s1->pos[2];
- func_80014D30(cameraId, sp50, temp_a2, temp_a3);
+ func_80014D30(cameraId, sp50);
temp_f12 = camera->lookAt[0] - camera->pos[0];
sp90 = camera->lookAt[1] - camera->pos[1];
sp94 = temp_f12;
@@ -8280,8 +7874,6 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800180F0.s")
#endif
-extern s32 D_8016448C;
-
void func_80018718(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
Camera* camera = cameras + cameraId;
s32 test = gWaypointCountByPathIndex[pathIndex];
@@ -8304,19 +7896,8 @@ void func_80018718(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8000BA14(u16, f32, ?, s16); /* extern */
-void func_80014D30(s32, s32); /* extern */
-void func_8001A348(s32, f32, s16); /* extern */
-extern f32 D_80162FA0;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-11-2023
extern s32 D_80163238;
-extern s32 D_8016448C;
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-extern ? D_80164648;
-extern s16 D_80164680;
-extern ? D_80164688;
void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
f32 spAC;
@@ -8343,11 +7924,13 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s32 sp40;
u16 *sp3C;
f64 sp28;
+ TrackWaypoint *temp_v0;
f32 *temp_a3_2;
f32 *temp_t1;
f32 *temp_t5;
f32 *temp_v1;
- f32 *var_v1;
+ f32 *temp_v1_2;
+ f32 *temp_v1_3;
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f10;
@@ -8374,7 +7957,6 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s32 temp_hi;
s32 temp_t4;
s32 var_ra;
- TrackWaypoint *temp_v0;
u16 *temp_t8;
u16 *temp_t8_2;
u16 temp_t2;
@@ -8387,7 +7969,7 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
temp_f12 = *(&gPlayers->unk_094 + (temp_a1 * 0xDD8));
temp_t4 = cameraId * 4;
temp_t2 = gWaypointCountByPathIndex[temp_t7];
- temp_t5 = temp_t4 + &D_80164648;
+ temp_t5 = &D_80164648[cameraId];
*temp_t5 = temp_f12;
if (D_8016448C == 0) {
temp_t8 = &gNearestWaypointByPlayerId[temp_a1];
@@ -8399,17 +7981,17 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
D_8016448C = 1;
}
temp_f2 = (f64) D_80163068[temp_a1];
- var_v1 = temp_t4 + &D_80164688;
- var_f0 = (f64) *var_v1;
+ temp_v1 = &D_80164688[cameraId];
+ var_f0 = (f64) *temp_v1;
if (var_f0 < (temp_f2 - 0.2)) {
*temp_t5 = (f32) ((f64) temp_f12 * 0.7);
}
if ((temp_f2 - 0.5) < var_f0) {
- *var_v1 = (f32) (var_f0 - 0.01);
- var_f0 = (f64) *var_v1;
+ *temp_v1 = (f32) (var_f0 - 0.01);
+ var_f0 = (f64) *temp_v1;
}
if (var_f0 < -0.9) {
- *var_v1 = -0.9f;
+ *temp_v1 = -0.9f;
*temp_t5 = (f32) ((f64) temp_f12 * 0.8);
}
sp40 = (s32) temp_a3;
@@ -8423,18 +8005,18 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
D_8016448C = 0;
}
temp_f2_2 = (f64) D_80163068[temp_a1];
- var_v1 = temp_t4 + &D_80164688;
- var_f0_2 = (f64) *var_v1;
+ temp_v1_2 = &D_80164688[cameraId];
+ var_f0_2 = (f64) *temp_v1_2;
if ((temp_f2_2 + 0.2) < var_f0_2) {
*temp_t5 = (f32) ((f64) temp_f12 * 1.3);
}
if (var_f0_2 < (temp_f2_2 + 0.5)) {
- *var_v1 = (f32) (var_f0_2 + 0.01);
- var_f0_2 = (f64) *var_v1;
+ *temp_v1_2 = (f32) (var_f0_2 + 0.01);
+ var_f0_2 = (f64) *temp_v1_2;
}
sp40 = (s32) temp_t0;
if (var_f0_2 > 0.9) {
- *var_v1 = 0.9f;
+ *temp_v1_2 = 0.9f;
sp40 = (s32) temp_t0;
*temp_t5 = (f32) ((f64) temp_f12 * 1.2);
}
@@ -8446,54 +8028,54 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp58 = temp_t4;
sp44 = var_t3;
sp64 = (s32) temp_t2;
- sp5C = var_v1;
+ sp5C = &D_80164688[cameraId];
*var_t3 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], (s16) sp40, sp68);
if (func_80007BF8((s16) *sp3C & 0xFFFF, *var_t3 & 0xFFFF, 0x000FU, 0x000FU, (u16) (s32) temp_t2) <= 0) {
- sp5C = var_v1;
+ sp5C = &D_80164688[cameraId];
sp64 = (s32) temp_t2;
sp44 = var_t3;
sp58 = temp_t4;
sp54 = temp_t5;
- func_8001A348(cameraId, *var_v1, *(&D_80164680 + var_ra));
+ func_8001A348(cameraId, D_80164688[cameraId], (s32) *(D_80164680 + var_ra));
}
temp_t0_2 = *var_t3;
temp_hi = (s32) (temp_t0_2 + 1) % (s32) temp_t2;
sp78 = (u16) ((s32) (temp_t0_2 + 2) % (s32) temp_t2);
sp7A = (s16) temp_hi;
- sp5C = var_v1;
+ sp5C = &D_80164688[cameraId];
sp58 = temp_t4;
sp54 = temp_t5;
sp50 = (f32 *) unksp6A;
- func_8000BA14((s16) temp_hi & 0xFFFF, *var_v1, 0x42700000, unksp6A);
- temp_f10 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
+ func_8000BA14((s16) temp_hi & 0xFFFF, D_80164688[cameraId], 60.0f, unksp6A);
+ temp_f10 = (f32) ((f64) D_80162FA0->unk0 * 0.5);
sp98 = temp_f10;
- temp_f18 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
+ temp_f18 = (f32) ((f64) D_80162FA0->unk8 * 0.5);
sp90 = temp_f18;
- func_8000BA14(sp78, *var_v1, 0x42700000, unksp6A);
+ func_8000BA14(sp78, D_80164688[cameraId], 60.0f, unksp6A);
temp_v0 = D_80164550[sp68];
- temp_f10_2 = (f32) ((f64) temp_f10 + ((f64) D_80162FA0.unk0 * 0.5));
+ temp_f10_2 = (f32) ((f64) temp_f10 + ((f64) D_80162FA0->unk0 * 0.5));
sp98 = temp_f10_2;
- temp_v1 = temp_t4 + &D_801645F8;
- temp_a3_2 = temp_t4 + &D_80164618;
- temp_f14 = temp_f10_2 - *temp_v1;
- temp_t1 = temp_t4 + &D_80164638;
+ temp_v1_3 = &D_801645F8[cameraId];
+ temp_a3_2 = &D_80164618[cameraId];
+ temp_f14 = temp_f10_2 - *temp_v1_3;
+ temp_t1 = &D_80164638[cameraId];
sp4C = temp_t1;
sp8C = temp_f14;
sp50 = temp_a3_2;
- sp5C = temp_v1;
+ sp5C = temp_v1_3;
temp_f16 = (f32) ((f64) (temp_v0[(s16) sp78].posY + temp_v0[sp7A].posY) * 0.5) - *temp_a3_2;
- temp_f0 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1;
+ temp_f0 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0->unk8 * 0.5)) - *temp_t1;
sp88 = temp_f16;
sp84 = temp_f0;
temp_f0_2 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f0 * temp_f0));
if ((f64) temp_f0_2 != 0.0) {
temp_f2_3 = *temp_t5;
- sp98 = ((temp_f2_3 * temp_f14) / temp_f0_2) + *temp_v1;
+ sp98 = ((temp_f2_3 * temp_f14) / temp_f0_2) + *temp_v1_3;
sp94 = ((temp_f2_3 * temp_f16) / temp_f0_2) + *temp_a3_2;
var_f18 = ((temp_f2_3 * sp84) / temp_f0_2) + *temp_t1;
} else {
var_f18 = *temp_t1;
- sp98 = *temp_v1;
+ sp98 = *temp_v1_3;
sp94 = *temp_a3_2;
}
camera->pos[2] = var_f18;
@@ -8503,7 +8085,7 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
sp90 = var_f18;
sp4C = temp_t1;
sp50 = temp_a3_2;
- sp5C = temp_v1;
+ sp5C = temp_v1_3;
temp_f2_4 = (f64) func_802AE1C0(sp98, (f32) (temp_f16_2 + 30.0), var_f18);
if ((temp_f2_4 < (temp_f16_2 - 20.0)) || (temp_f2_4 >= 3000.0)) {
camera->pos[1] = (f32) (temp_f16_2 + 10.0);
@@ -8511,7 +8093,7 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
camera->pos[1] = (f32) (temp_f2_4 + 8.0);
}
*temp_t1 = var_f18;
- *temp_v1 = sp98;
+ *temp_v1_3 = sp98;
*temp_a3_2 = sp94;
camera->lookAt[0] = spA0->pos[0];
camera->lookAt[1] = (f32) ((f64) spA0->pos[1] + 6.0);
@@ -8559,93 +8141,62 @@ void func_80019118(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
camera->pos[2] = D_80164638[cameraId];
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_80014D30(s32, s32); /* extern */
-void func_8001A348(s32, s32, s16); /* extern */
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-extern s16 D_80164680;
-extern ? D_80164688;
-
void func_8001933C(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
- s16 sp96;
- f32 sp8C;
- f32 sp88;
- f32 sp84;
- s32 sp7C;
- s32 sp48;
- s32 sp44;
- s32 sp3C;
- s32 sp38;
- s16 *sp34;
- Player *temp_s2;
- f32 temp_f12;
- f32 temp_f14;
- f64 temp_f0;
- s16 *temp_t0;
- s16 temp_t3;
- s16 temp_v1;
- s32 temp_v1_2;
- s32 temp_v1_3;
- s32 var_v1;
- TrackWaypoint *temp_v0;
- u16 temp_a1;
+ s16 cameraWaypoint;
+ s16 playerWaypoint;
+ s32 stackPadding0;
+ f32 xdiff;
+ f32 ydiff;
+ f32 zdiff;
+ s32 stackPadding1;
+ s32 playerId;
+ s32 stackPadding4;
+ s32 stackPadding5;
+ s32 stackPadding6;
+ s32 stackPadding7;
+ s32 stackPadding8;
+ s32 stackPadding9;
+ s32 stackPaddingA;
+ s32 stackPaddingB;
+ s32 stackPaddingC;
+ s32 stackPaddingD;
+ Player *player;
+ TrackWaypoint *waypoint;
+ s32 pathIndex;
+ s32 waypointCount;
- temp_v1 = camera->playerId;
- temp_a1 = gPathIndexByPlayerId[temp_v1];
- sp44 = (s32) gWaypointCountByPathIndex[temp_a1];
- temp_t0 = &gNearestWaypointByCameraId[cameraId];
- sp34 = temp_t0;
- sp38 = cameraId * 2;
- sp3C = temp_v1 * 2;
- sp7C = (s32) temp_v1;
- sp48 = (s32) temp_a1;
- temp_s2 = &gPlayerOne[temp_v1];
- *temp_t0 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *temp_t0, 0);
- temp_t3 = *temp_t0;
- sp96 = temp_t3;
- if (func_80007BF8((s16) gNearestWaypointByPlayerId[temp_v1] & 0xFFFF, temp_t3 & 0xFFFF, 0x0032U, 0x0014U, (u16) sp44) <= 0) {
- temp_v1_2 = cameraId * 4;
- sp3C = temp_v1_2;
- func_8001A348(cameraId, *(&D_80164688 + temp_v1_2), *(&D_80164680 + sp38));
- goto block_8;
- }
- temp_f0 = (f64) D_80163068[temp_v1];
- temp_v1_3 = cameraId * 4;
- if ((temp_f0 < -0.5) && ((f64) *(&D_80164688 + temp_v1_3) < -0.5)) {
- sp3C = temp_v1_3;
- func_8001A348(cameraId, 0x3F800000, 0x000D);
- goto block_8;
+ playerId = camera->playerId;
+ pathIndex = gPathIndexByPlayerId[playerId];
+ player = gPlayerOne;
+ player += playerId;
+ waypointCount = gWaypointCountByPathIndex[pathIndex];
+ gNearestWaypointByCameraId[cameraId] = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], gNearestWaypointByCameraId[cameraId], 0);
+ playerWaypoint = gNearestWaypointByPlayerId[playerId];
+ cameraWaypoint = gNearestWaypointByCameraId[cameraId];
+ if (func_80007BF8(playerWaypoint, cameraWaypoint, 0x0032U, 0x0014U, waypointCount) <= 0) {
+ func_8001A348(cameraId, D_80164688[cameraId], D_80164680[cameraId]);
+ } else {
+ if ((D_80163068[playerId] < -0.5) && ((f64) D_80164688[cameraId] < -0.5)) {
+ func_8001A348(cameraId, 1.0f, 0x0000000D);
+ } else if ((D_80163068[playerId] > 0.5) && ((f64) D_80164688[cameraId] > 0.5)) {
+ func_8001A348(cameraId, -1.0f, 0x0000000C);
+ }
}
- var_v1 = cameraId * 4;
- if ((temp_f0 > 0.5) && ((f64) *(&D_80164688 + var_v1) > 0.5)) {
- sp3C = var_v1;
- func_8001A348(cameraId, 0xBF800000, 0x000C);
-block_8:
- var_v1 = sp3C;
- }
- camera->pos[0] = *(&D_801645F8 + var_v1);
- camera->pos[1] = *(&D_80164618 + var_v1);
- camera->pos[2] = *(&D_80164638 + var_v1);
- temp_v0 = &D_80164550[sp48][sp96];
- camera->lookAt[0] = (f32) (((f64) temp_s2->pos[0] * 0.8) + (0.2 * (f64) temp_v0->posX));
- camera->lookAt[1] = (f32) (((f64) temp_s2->pos[1] * 0.8) + (0.2 * (f64) temp_v0->posY));
- camera->lookAt[2] = (f32) (((f64) temp_s2->pos[2] * 0.8) + (0.2 * (f64) temp_v0->posZ));
- func_80014D30(cameraId, sp48);
- temp_f12 = camera->lookAt[0] - camera->pos[0];
- sp88 = camera->lookAt[1] - camera->pos[1];
- sp8C = temp_f12;
- temp_f14 = camera->lookAt[2] - camera->pos[2];
- sp84 = temp_f14;
- camera->rot[1] = atan2s(temp_f12, temp_f14);
- camera->rot[0] = atan2s(sqrtf((sp8C * sp8C) + (temp_f14 * temp_f14)), sp88);
+ camera->pos[0] = D_801645F8[cameraId];
+ camera->pos[1] = D_80164618[cameraId];
+ camera->pos[2] = D_80164638[cameraId];
+ waypoint = &D_80164550[pathIndex][cameraWaypoint];
+ camera->lookAt[0] = (player->pos[0] * 0.8) + (0.2 * waypoint->posX);
+ camera->lookAt[1] = (player->pos[1] * 0.8) + (0.2 * waypoint->posY);
+ camera->lookAt[2] = (player->pos[2] * 0.8) + (0.2 * waypoint->posZ);
+ func_80014D30(cameraId, pathIndex);
+ xdiff = camera->lookAt[0] - camera->pos[0];
+ ydiff = camera->lookAt[1] - camera->pos[1];
+ zdiff = camera->lookAt[2] - camera->pos[2];
+ camera->rot[1] = atan2s(xdiff, zdiff);
+ camera->rot[0] = atan2s(sqrtf((xdiff * xdiff) + (zdiff * zdiff)), ydiff);
camera->rot[2] = 0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001933C.s")
-#endif
void func_8001968C(void) {
D_80164678[0] = 3;
@@ -8666,56 +8217,28 @@ void func_8001969C(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
D_80164678[cameraId] = 0;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_80014D30(s32, ?); /* extern */
-extern ? D_801645F8;
-extern ? D_80164618;
-extern ? D_80164638;
-
void func_80019760(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
- f32 sp2C;
- f32 sp28;
- f32 sp24;
- f32 temp_f12;
- f32 temp_f14;
- s32 temp_v0;
+ s32 stackPadding[2];
+ f32 xdiff;
+ f32 ydiff;
+ f32 zdiff;
TrackWaypoint *temp_v1;
- temp_v0 = cameraId * 4;
- camera->pos[0] = *(&D_801645F8 + temp_v0);
- camera->pos[1] = *(&D_80164618 + temp_v0);
- camera->pos[2] = *(&D_80164638 + temp_v0);
+ camera->pos[0] = D_801645F8[cameraId];
+ camera->pos[1] = D_80164618[cameraId];
+ camera->pos[2] = D_80164638[cameraId];
temp_v1 = &(*D_80164550)[gNearestWaypointByCameraId[cameraId]];
camera->lookAt[0] = (f32) temp_v1->posX;
camera->lookAt[1] = (f32) temp_v1->posY;
camera->lookAt[2] = (f32) temp_v1->posZ;
func_80014D30(cameraId, 0);
- temp_f12 = camera->lookAt[0] - camera->pos[0];
- sp28 = camera->lookAt[1] - camera->pos[1];
- sp2C = temp_f12;
- temp_f14 = camera->lookAt[2] - camera->pos[2];
- sp24 = temp_f14;
- camera->rot[1] = atan2s(temp_f12, temp_f14);
- camera->rot[0] = atan2s(sqrtf((sp2C * sp2C) + (temp_f14 * temp_f14)), sp28);
+ xdiff = camera->lookAt[0] - camera->pos[0];
+ ydiff = camera->lookAt[1] - camera->pos[1];
+ zdiff = camera->lookAt[2] - camera->pos[2];
+ camera->rot[1] = atan2s(xdiff, zdiff);
+ camera->rot[0] = atan2s(sqrtf((xdiff * xdiff) + (zdiff * zdiff)), ydiff);
camera->rot[2] = 0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019760.s")
-#endif
-
-void func_80016C3C(s32, f32, s32);
-void func_80015314(s32, f32, s32);
-void func_80017720(s32, f32, s32, s16);
-void func_80017F10(s32, f32, s32, s16);
-void func_80018718(s32, f32, s32, s16);
-void func_80015544(s32, f32, s32, s32);
-void func_80019118(s32, f32, s32, s16);
-void func_800162CC(s32, f32, s32, s16);
-void func_80015A9C(s32, f32, s32, s16);
-extern s32 D_80163DD8[];
-extern s16 D_80164680[];
-extern s16 D_801646C0[];
void func_80019890(s32 playerId, s32 cameraId) {
s32 pathIndex;
@@ -8782,134 +8305,78 @@ void func_80019890(s32 playerId, s32 cameraId) {
}
}
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_801646C0;
+void func_80019B50(s32 arg0, u16 arg1) {
+ u16 var_v0;
-void func_80019B50(s32 arg0, s32 arg1) {
- s32 temp_a0;
- s32 temp_a0_2;
- s32 temp_a2;
- s32 temp_a2_2;
- s32 temp_t6;
- s32 temp_v0_2;
- s32 temp_v0_3;
- u16 *temp_v1;
- u16 temp_v0;
- s32 phi_a2;
- s32 phi_a2_2;
- u16 phi_v0;
-
- temp_v1 = (arg0 * 2) + &D_801646C0;
- temp_v0 = *temp_v1;
- temp_t6 = arg1 & 0xFFFF;
- phi_v0 = temp_v0;
- if (temp_v0 < temp_t6) {
- temp_a0 = temp_t6 - temp_v0;
- if (temp_a0 < 0x8000) {
- temp_a2 = (temp_v0 + 0x5A) & 0xFFFF;
- phi_a2 = temp_a2;
- phi_v0 = temp_a2;
- if (temp_t6 < temp_a2) {
- temp_v0_2 = temp_t6 & 0xFFFF;
- phi_a2 = temp_v0_2;
- phi_v0 = temp_v0_2;
- }
- if (phi_a2 < 0x5A) {
- phi_v0 = 0;
- }
- } else if (temp_a0 >= 0x8000) {
- phi_v0 = (temp_v0 - 0x5A) & 0xFFFF;
- }
- } else if (temp_t6 < temp_v0) {
- temp_a0_2 = temp_v0 - temp_t6;
- if (temp_a0_2 < 0x8000) {
- temp_a2_2 = (temp_v0 - 0x5A) & 0xFFFF;
- phi_a2_2 = temp_a2_2;
- phi_v0 = temp_a2_2;
- if (temp_a2_2 < temp_t6) {
- temp_v0_3 = temp_t6 & 0xFFFF;
- phi_a2_2 = temp_v0_3;
- phi_v0 = temp_v0_3;
- }
- if (phi_a2_2 >= 0xFFA6) {
- phi_v0 = 0;
- }
- } else if (temp_a0_2 >= 0x8000) {
- phi_v0 = (temp_v0 + 0x5A) & 0xFFFF;
- }
- }
- *temp_v1 = phi_v0;
+ var_v0 = D_801646C0[arg0];
+ if (var_v0 < arg1) {
+ if ((arg1 - var_v0) < 0x8000) {
+ var_v0 += 0x5A;
+ if (arg1 < var_v0) {
+ var_v0 = arg1;
+ }
+ if (var_v0 < 0x5A) {
+ var_v0 = 0;
+ }
+ } else if ((arg1 - var_v0) >= 0x8000) {
+ var_v0 -= 0x5A;
+ }
+ } else if (arg1 < var_v0) {
+ if ((var_v0 - arg1) < 0x8000) {
+ var_v0 -= 0x5A;
+ if (var_v0 < arg1) {
+ var_v0 = arg1;
+ }
+ if (var_v0 >= 0xFFA6) {
+ var_v0 = 0;
+ }
+ } else if ((var_v0 - arg1) >= 0x8000) {
+ var_v0 += 0x5A;
+ if (!arg0) {} // wtf?
+ }
+ }
+ D_801646C0[arg0] = (s16) var_v0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019B50.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C9060(s32, ?, s32, s32); // extern
-extern ? D_80164608;
-extern s16 D_80164670;
void func_80019C50(s32 arg0) {
- s32 sp20;
- s16 *sp1C;
- s16 *temp_v0;
- s16 temp_v1;
- s32 temp_a3;
-
- temp_a3 = arg0 * 2;
- temp_v0 = temp_a3 + &D_80164678;
- temp_v1 = *temp_v0;
- if (temp_v1 != 0) {
- if (temp_v1 != 1) {
- return;
+ switch (D_80164678[arg0]) { /* irregular */
+ case 0:
+ if (D_80164608[arg0] == (s32) 1) {
+ D_80164678[arg0] = 1;
+ func_800C9060(arg0 & 0xFF, 0x1900904FU);
+ D_80164670[arg0] = D_80164678[arg0];
}
- if (*(&D_80164608 + (arg0 * 4)) == 1) {
- *temp_v0 = 0;
- sp1C = temp_v0;
- sp20 = temp_a3;
- func_800C9060(arg0 & 0xFF, 0x19009050, arg0, temp_a3);
- *(&D_80164670 + temp_a3) = *temp_v0;
+ break;
+ case 1:
+ if (D_80164608[arg0] == 1) {
+ D_80164678[arg0] = 0;
+ func_800C9060(arg0 & 0xFF, 0x19009050U);
+ D_80164670[arg0] = D_80164678[arg0];
}
- // Duplicate return node #7. Try simplifying control flow for better match
- return;
- }
- if (*(&D_80164608 + (arg0 * 4)) == 1) {
- *temp_v0 = 1;
- sp1C = temp_v0;
- sp20 = temp_a3;
- func_800C9060(arg0 & 0xFF, 0x1900904F, arg0, temp_a3);
- *(&D_80164670 + temp_a3) = *temp_v0;
+ break;
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019C50.s")
-#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800151A4(s32); // extern
-void func_80019B50(s32, s32, s32); // extern
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-12-2023
extern s32 D_80163378;
-extern u16 gNearestWaypointByPlayerId;
+s16 gCurrentCourseId; /* unable to generate initializer */
-void func_80019D2C(void *arg0, void *arg1, s32 arg2) {
+void func_80019D2C(Camera *camera, Player *player, s32 arg2) {
s32 sp1C;
s16 temp_v1;
u16 temp_v0;
- temp_v1 = arg0->unkAE;
+ temp_v1 = camera->playerId;
if ((D_80163378 != 0) && (gCurrentCourseId == 8)) {
- sp1C = temp_v1;
- func_800151A4(arg2);
- temp_v0 = *(&gNearestWaypointByPlayerId + (temp_v1 * 2));
- if (((temp_v0 >= 0x65) && (temp_v0 < 0xFA)) || ((temp_v0 >= 0x1AF) && (temp_v0 < 0x226))) {
- func_80019B50(arg2, (arg1->unk206 * 2) & 0xFFFF, arg2);
+ sp1C = (s32) temp_v1;
+ func_800151A4(camera, arg2);
+ temp_v0 = gNearestWaypointByPlayerId[temp_v1];
+ if ((((s32) temp_v0 >= 0x65) && ((s32) temp_v0 < 0xFA)) || (((s32) temp_v0 >= 0x1AF) && ((s32) temp_v0 < 0x226))) {
+ func_80019B50(arg2, (player->unk_206 * 2) & 0xFFFF);
return;
}
- func_80019B50(arg2, 0, arg2);
- // Duplicate return node #8. Try simplifying control flow for better match
+ func_80019B50(arg2, 0U);
}
}
#else
@@ -8920,21 +8387,15 @@ void func_80019DE4(void) {
D_801646CC = 1;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-//extern s16 D_80164670;
-//extern s16 D_8016467A;
-//extern s16 D_8016467C;
-//extern s16 D_8016467E;
-//extern s16 D_801646CC;
-
+#ifdef NON_MATCHING
+// It really seems like this should be it,
+// its unclear what about that for-loop is wrong
void func_80019DF4(void) {
- // unrolled loop?
- D_80164670 = D_80164678[3];
- D_80164670 = D_80164678[2];
- D_80164670 = D_80164678[1];
- D_80164670 = D_80164678[0];
- camera1->playerId = *gGPCurrentRacePlayerIdByRank;
+ s32 i;
+ for (i = 0; i < 4; i++) {
+ D_80164670[i] = D_80164678[i];
+ }
+ camera1->playerId = gGPCurrentRacePlayerIdByRank[0];
D_80164678[0] = 1;
D_801646CC = 2;
}
@@ -8942,8 +8403,6 @@ void func_80019DF4(void) {
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019DF4.s")
#endif
-extern s16 D_80164682;
-
void func_80019E58(void) {
D_80164680[0] = 1;
func_80019890(0, 0);
@@ -8974,7 +8433,7 @@ void func_80019ED0(void) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-10-2023
extern ? D_801645D0;
extern ? D_801645E8;
extern ? D_80164608;
@@ -8985,40 +8444,36 @@ void func_80019FB4(s32 arg0) {
s32 *temp_a0_2;
s32 *temp_a1;
s32 *temp_v0_2;
- s32 temp_v1;
- s32 temp_v1_2;
+ s32 var_v1;
struct Controller *temp_v0;
- s32 phi_v1;
temp_v0 = &gControllerOne[arg0];
- temp_v1 = arg0 * 4;
- temp_a1 = temp_v1 + &D_801645D0;
- phi_v1 = temp_v1;
- if ((temp_v0->buttonPressed & 2) != 0) {
- *temp_a1 = *temp_a1 + 1;
+ var_v1 = arg0 * 4;
+ temp_a1 = var_v1 + &D_801645D0;
+ if (temp_v0->buttonPressed & 2) {
+ *temp_a1 += 1;
} else {
- temp_v1_2 = arg0 * 4;
- *(&D_801645D0 + temp_v1_2) = 0;
- phi_v1 = temp_v1_2;
+ var_v1 = arg0 * 4;
+ *(&D_801645D0 + var_v1) = 0;
}
- temp_a0 = phi_v1 + &D_801645E8;
- if ((temp_v0->buttonPressed & 4) != 0) {
- *temp_a0 = *temp_a0 + 1;
+ temp_a0 = var_v1 + &D_801645E8;
+ if (temp_v0->buttonPressed & 4) {
+ *temp_a0 += 1;
} else {
- *(&D_801645E8 + phi_v1) = 0;
+ *(&D_801645E8 + var_v1) = 0;
}
- temp_a0_2 = phi_v1 + &D_80164608;
- if ((temp_v0->buttonPressed & 8) != 0) {
- *temp_a0_2 = *temp_a0_2 + 1;
+ temp_a0_2 = var_v1 + &D_80164608;
+ if (temp_v0->buttonPressed & 8) {
+ *temp_a0_2 += 1;
} else {
- *(&D_80164608 + phi_v1) = 0;
+ *(&D_80164608 + var_v1) = 0;
}
- temp_v0_2 = phi_v1 + &D_80164628;
- if ((temp_v0->buttonPressed & 1) != 0) {
- *temp_v0_2 = *temp_v0_2 + 1;
+ temp_v0_2 = var_v1 + &D_80164628;
+ if (temp_v0->buttonPressed & 1) {
+ *temp_v0_2 += 1;
return;
}
- *(&D_80164628 + phi_v1) = 0;
+ *(&D_80164628 + var_v1) = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019FB4.s")
@@ -9034,43 +8489,30 @@ void func_8001A0DC(u16 *arg0, Camera *arg1, Player *arg2, s8 arg3, s32 arg4) {
func_80019D2C(arg1, arg2, arg4);
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_800CA270(); /* extern */
-extern s16 D_80164680;
-
void func_8001A124(s32 arg0, s32 arg1) {
- s32 temp_v0;
-
- temp_v0 = gGPCurrentRaceRankByPlayerId[arg0];
- switch (temp_v0) { /* irregular */
+ switch (gGPCurrentRaceRankByPlayerId[arg0]) { /* irregular */
case 0:
if (random_int(0x0064U) < 0x32) {
- *(&D_80164680 + (arg1 * 2)) = 0x000C;
+ D_80164680[arg1] = 0x000C;
} else {
- *(&D_80164680 + (arg1 * 2)) = 0x000D;
+ D_80164680[arg1] = 0x000D;
}
func_800CA270();
- return;
+ break;
case 1:
case 2:
case 3:
- *(&D_80164680 + (arg1 * 2)) = 8;
- return;
+ D_80164680[arg1] = 8;
+ break;
default:
if (random_int(0x0064U) < 0x32) {
- *(&D_80164680 + (arg1 * 2)) = 0x000F;
- return;
+ D_80164680[arg1] = 0x000F;
+ } else {
+ D_80164680[arg1] = 0x0010;
}
- *(&D_80164680 + (arg1 * 2)) = 0x0010;
- return;
+ break;
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A124.s")
-#endif
-
-extern s16 D_80164680[];
void func_8001A220(s32 arg0, s32 arg1) {
switch (random_int(6)) {
@@ -9105,121 +8547,69 @@ s32 func_8001A310(s32 arg0, s32 arg1) {
return arg1;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-//extern f32 D_80164688[];
-
void func_8001A348(s32 cameraId, f32 arg1, s32 arg2) {
- //s32 sp20;
- //s32 sp1C;
- //s32 temp_v1;
+ s32 stackPadding;
+ s32 playerId;
- //temp_v1 = cameraId * 2;
- //sp1C = temp_v1;
- //sp20 = (s32) cameras[1].playerId; // + (cameraId * 0xB8));
+ playerId = cameras[cameraId].playerId;
D_80164688[cameraId] = arg1;
- D_80164680[cameraId] = func_8001A310(arg1, gNearestWaypointByCameraId[cameraId]);
- func_80019890(cameras[0].playerId, cameraId);
+ D_80164680[cameraId] = func_8001A310((s32) gNearestWaypointByCameraId[cameraId], arg2);
+ func_80019890(playerId, cameraId);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A348.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_80019890(f32, s16, s32, s16); // extern
-extern s16 D_80164680;
-extern ? D_80164688;
-extern ? D_8016479E;
-
-void func_8001A3D8(s32 arg0, f32 arg1, s16 arg2) {
- s16 *temp_v0;
- s16 temp_a3;
+void func_8001A3D8(s32 arg0, f32 arg1, s32 arg2) {
+ s32 playerId;
- temp_v0 = (arg0 * 2) + &D_80164680;
- *(&D_80164688 + (arg0 * 4)) = arg1;
- temp_a3 = *(&D_8016479E + (arg0 * 0xB8));
- if (arg2 != *temp_v0) {
- *temp_v0 = arg2;
- func_80019890(arg1, temp_a3, arg0, temp_a3);
+ playerId = cameras[arg0].playerId;
+ D_80164688[arg0] = arg1;
+ if (arg2 != D_80164680[arg0]) {
+ D_80164680[arg0] = arg2;
+ func_80019890(playerId, arg0);
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A3D8.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_80019890(s32, s32, s16 *, s32); /* extern */
-s16 func_8001A310(s16, s32, s16 *, s32); /* extern */
-extern s16 D_80164680;
void func_8001A450(s32 playerId, s32 arg1, s32 arg2) {
- s32 sp24;
- s16 *sp18;
- s16 *temp_a2;
- s16 temp_v0;
- s16 temp_v1;
+ s32 temp_v1;
+ s16 waypoint;
+ s32 temp_v0;
- if (!(*(&gPlayers->effects + (playerId * 0xDD8)) & 0x1000000C) && ((temp_a2 = (arg1 * 2) + &D_80164680, temp_v1 = *temp_a2, sp18 = temp_a2, sp24 = (s32) temp_v1, temp_v0 = func_8001A310(gNearestWaypointByCameraId[arg1], (s32) (temp_v1 + 1) % 10, temp_a2, playerId), (temp_v0 != temp_v1)) || (arg2 != playerId))) {
- *temp_a2 = temp_v0;
- func_80019890(arg2, arg1, temp_a2, playerId);
+ if (!(gPlayers[playerId].effects & 0x1000000C)) {
+ temp_v1 = D_80164680[arg1];
+ waypoint = gNearestWaypointByCameraId[arg1];
+ temp_v0 = func_8001A310(waypoint, (temp_v1 + 1) % 10);
+ if ((temp_v0 != temp_v1) || (arg2 != playerId)) {
+ D_80164680[arg1] = temp_v0;
+ func_80019890(arg2, arg1);
+ }
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A450.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
-void func_8001A450(s32, s32, s32); /* extern */
-extern s16 D_80164680;
void func_8001A518(s32 arg0, s32 arg1, s32 arg2) {
switch (arg1) { /* irregular */
- default:
- *(&D_80164680 + (arg2 * 2)) = 0;
- return;
case 0:
- *(&D_80164680 + (arg2 * 2)) = 1;
- return;
+ D_80164680[arg2] = 1;
+ break;
case 1:
case 2:
case 3:
- func_8001A450(arg2, arg0, arg2);
- return;
+ func_8001A450(arg0, arg2, arg0);
+ break;
+ default:
+ D_80164680[arg2] = 0;
+ break;
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A518.s")
-#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-void func_800151A4(Camera *, s32); /* extern */
-void func_80015390(Camera *, u16 *, s8, s32); /* extern */
-void func_8001577C(Camera *, u16 *, s8, s32); /* extern */
-void func_80015C94(Camera *, u16 *, s8, s32); /* extern */
-void func_80016494(Camera *, u16 *, s8, s32); /* extern */
-void func_80017054(Camera *, u16 *, s8, s32); /* extern */
-void func_800178F4(Camera *, u16 *, s8, s32); /* extern */
-void func_800180F0(Camera *, u16 *, s8, s32); /* extern */
-void func_800188F4(Camera *, u16 *, s8, s32); /* extern */
-void func_8001933C(Camera *, u16 *, s8, s32); /* extern */
-void func_80019760(Camera *, u16 *, s8, s32); /* extern */
-void func_80019890(s32, s32); /* extern */
-void func_80019C50(s32); /* extern */
-void func_80019D2C(Camera *, u16 *, s32, s32); /* extern */
-void func_80019FB4(s32); /* extern */
-void func_8001A124(?, s32, s32); /* extern */
-void func_8001A220(?, s32, s32); /* extern */
-void func_8001A3D8(s32, ?, s16, s32); /* extern */
-void func_8001A450(s32, s32, s32, s32); /* extern */
-void func_8001A518(s32, s32, ?, s32); /* extern */
-extern s16 D_80164680;
-extern ? D_801646C0;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-12-2023
+? func_80015C94(Camera *, Player *, s8, s32); /* extern */
+? func_80016494(Camera *, Player *, s8, s32); /* extern */
+? func_80017054(Camera *, Player *, s8, s32); /* extern */
+? func_800178F4(Camera *, Player *, s8, s32); /* extern */
+? func_800180F0(Camera *, Player *, s8, s32); /* extern */
+? func_800188F4(Camera *, Player *, s8, s32); /* extern */
+? func_8001A220(?, s32, s32); /* extern */
extern u32 D_801646C8;
-extern u16 D_801646CC;
extern ? D_801646D0;
void func_8001A588(u16 *arg0, Camera *camera, Player *arg2, s8 arg3, s32 arg4) {
@@ -9228,22 +8618,19 @@ void func_8001A588(u16 *arg0, Camera *camera, Player *arg2, s8 arg3, s32 arg4) {
f64 temp_f0;
f64 temp_f2;
s16 *temp_t8;
- s16 temp_v0_6;
+ s16 temp_v0_3;
s16 temp_v1;
s16 var_s0;
- s32 temp_v0;
- s32 temp_v0_2;
s32 var_v1;
u16 temp_t3;
- u16 temp_v0_3;
u32 temp_t1;
u32 temp_t4;
- u32 temp_v0_4;
- u32 temp_v0_5;
- void *temp_v0_7;
+ u32 temp_v0;
+ u32 temp_v0_2;
+ void *temp_v0_4;
var_s0 = camera->playerId;
- if (gModeSelection == TIME_TRIALS) {
+ if (gModeSelection == 1) {
var_s0 = 0;
}
func_80019FB4(arg4);
@@ -9255,40 +8642,37 @@ void func_8001A588(u16 *arg0, Camera *camera, Player *arg2, s8 arg3, s32 arg4) {
camera->pos[2] = (f32) (temp_f2 + 100.0);
}
}
- temp_v0 = gModeSelection;
- if ((temp_v0 != BATTLE) && (*(&D_80164680 + (arg4 * 2)) == -1) && (*arg2 & 0x800) && (D_801646CC == 0) && (D_801646C8 == 0)) {
- if (temp_v0 == VERSUS) {
+ if ((gModeSelection != 3) && (D_80164680[arg4] == -1) && (arg2->type & 0x800) && ((u16) D_801646CC == 0) && (D_801646C8 == 0)) {
+ if (gModeSelection == 2) {
func_8001A220(0, (s32) var_s0, arg4);
} else {
- func_8001A124(0, (s32) var_s0, arg4);
+ func_8001A124((s32) var_s0, arg4);
}
func_80019890((s32) var_s0, arg4);
}
- temp_v0_2 = arg4 * 2;
- temp_t8 = temp_v0_2 + &D_80164680;
+ temp_t8 = &D_80164680[arg4];
sp24 = temp_t8;
temp_v1 = *temp_t8;
if ((temp_v1 == 0x000E) || (temp_v1 == 0)) {
- func_80019D2C(camera, arg2, arg4, arg4);
+ func_80019D2C(camera, arg2, arg4);
} else {
- *(&D_801646C0 + temp_v0_2) = 0;
+ D_801646C0[arg4] = 0;
func_800151A4(camera, arg4);
}
- temp_v0_3 = D_801646CC;
- switch (temp_v0_3) { /* switch 1; irregular */
+ switch ((u16) D_801646CC) { /* switch 1; irregular */
case 1: /* switch 1 */
temp_t1 = D_801646C8 + 1;
D_801646C8 = temp_t1;
if (temp_t1 >= 0x1F5U) {
D_801646C8 = 0;
}
- if ((arg4 == 0) && ((temp_v0_4 = D_801646C8, (temp_v0_4 == 0x0000000A)) || (temp_v0_4 == 0x0000000B))) {
- func_8001A518((s32) var_s0, gGPCurrentRaceRankByPlayerId[var_s0], 0, arg4);
+ if ((arg4 == 0) && ((temp_v0 = D_801646C8, (temp_v0 == 0x0000000A)) || (temp_v0 == 0x0000000B))) {
+ func_8001A518((s32) var_s0, gGPCurrentRaceRankByPlayerId[var_s0], 0);
}
- if ((gModeSelection != TIME_TRIALS) && (arg4 == 1) && ((temp_v0_5 = D_801646C8, (temp_v0_5 == 0x00000104)) || (temp_v0_5 == 0x00000105))) {
+ if ((gModeSelection != 1) && (arg4 == 1) && ((temp_v0_2 = D_801646C8, (temp_v0_2 == 0x00000104)) || (temp_v0_2 == 0x00000105))) {
var_v1 = 0;
if (gPlayerCount == 2) {
- func_8001A518((s32) var_s0, gGPCurrentRaceRankByPlayerId[var_s0], 1, arg4);
+ func_8001A518((s32) var_s0, gGPCurrentRaceRankByPlayerId[var_s0], 1);
} else {
sp44 = (s32) var_s0;
loop_34:
@@ -9297,11 +8681,11 @@ loop_34:
if (var_s0 >= 8) {
var_s0 = 1;
}
- temp_v0_6 = gPlayers[var_s0].unk_0CA;
- if (((temp_v0_6 & 2) || (temp_v0_6 & 8)) && (var_v1 != 8)) {
+ temp_v0_3 = gPlayers[var_s0].unk_0CA;
+ if (((temp_v0_3 & 2) || (temp_v0_3 & 8)) && (var_v1 != 8)) {
goto loop_34;
}
- func_8001A450(sp44, arg4, (s32) var_s0, arg4);
+ func_8001A450(sp44, arg4, (s32) var_s0);
}
}
break;
@@ -9312,15 +8696,15 @@ loop_34:
D_801646C8 = 0;
}
if ((arg4 == 0) && (D_801646C8 == 0x0000000A)) {
- func_8001A450((s32) var_s0, arg4, (s32) var_s0, arg4);
+ func_8001A450((s32) var_s0, arg4, (s32) var_s0);
}
break;
default: /* switch 1 */
- temp_v0_7 = (arg4 * 8) + &D_801646D0;
- if (temp_v0_7->unk0 == (s16) 1) {
- temp_v0_7->unk0 = 0;
- *(&cameras->playerId + (arg4 * 0xB8)) = temp_v0_7->unk4;
- func_8001A3D8(arg4, 0, temp_v0_7->unk2, arg4);
+ temp_v0_4 = (arg4 * 8) + &D_801646D0;
+ if (temp_v0_4->unk0 == (s16) 1) {
+ temp_v0_4->unk0 = 0;
+ *(&cameras->playerId + (arg4 * 0xB8)) = temp_v0_4->unk4;
+ func_8001A3D8(arg4, 0.0f, (s32) temp_v0_4->unk2);
}
break;
}
@@ -9328,11 +8712,11 @@ loop_34:
temp_t3 = (u16) *sp24;
switch (temp_t3) {
case 0:
- func_80015390(camera, arg2, arg3, arg4);
+ func_80015390(camera, arg2, (s32) arg3);
return;
case 2:
case 3:
- func_8001577C(camera, arg2, arg3, arg4);
+ func_8001577C(camera, (s32) arg2, (s32) arg3, arg4);
return;
case 6:
case 7:
@@ -9356,14 +8740,14 @@ loop_34:
return;
case 12:
case 13:
- func_8001933C(camera, arg2, arg3, arg4);
+ func_8001933C(camera, (s32) arg2, (s32) arg3, arg4);
return;
case 15:
case 16:
- func_80019760(camera, arg2, arg3, arg4);
+ func_80019760(camera, (s32) arg2, (s32) arg3, arg4);
return;
default:
- func_80015390(camera, arg2, arg3, arg4);
+ func_80015390(camera, arg2, (s32) arg3);
return;
}
}
@@ -9372,7 +8756,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A588.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-10-2023
extern ? D_801646D0;
void func_8001AAAC(s16 arg0, s16 arg1, s16 arg2) {
@@ -9389,71 +8773,44 @@ void func_8001AAAC(s16 arg0, s16 arg1, s16 arg2) {
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001AAAC.s")
#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_801642D8;
-extern s16 D_80164358;
-
void func_8001AB00(void) {
- ? *temp_v1;
- ? *phi_v1;
+ s32 var_v1;
- phi_v1 = &D_801642D8;
- do {
- temp_v1 = phi_v1 + 0x40;
- temp_v1->unk-30 = 0;
- temp_v1->unk-2C = 0;
- temp_v1->unk-2E = -1;
- temp_v1->unk-2A = 0;
- temp_v1->unk-28 = 0;
- temp_v1->unk-20 = 0;
- temp_v1->unk-1C = 0;
- temp_v1->unk-1E = -1;
- temp_v1->unk-1A = 0;
- temp_v1->unk-18 = 0;
- temp_v1->unk-10 = 0;
- temp_v1->unk-C = 0;
- temp_v1->unk-E = -1;
- temp_v1->unk-A = 0;
- temp_v1->unk-8 = 0;
- temp_v1->unk-40 = 0;
- temp_v1->unk-3C = 0;
- temp_v1->unk-3E = -1;
- temp_v1->unk-3A = 0;
- temp_v1->unk-38 = 0;
- phi_v1 = temp_v1;
- } while (temp_v1 != &D_80164358);
+ for (var_v1 = 0; var_v1 < 8; var_v1++) {
+ D_801642D8[var_v1].unk_00 = 0;
+ D_801642D8[var_v1].unk_04 = 0;
+ D_801642D8[var_v1].actorIndex = -1;
+ D_801642D8[var_v1].unk_06 = 0;
+ D_801642D8[var_v1].unk_08 = 0;
+ }
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001AB00.s")
-#endif
void func_8001AB74(s32 arg0, s16 *arg1, s32 arg2) {
s32 value = -1;
switch (arg2) {
- case 9:
+ case ITEM_FAKE_ITEM_BOX:
value = 0xD;
break;
- case 11:
+ case ITEM_BOO:
value = 0x1B;
break;
- case 1:
+ case ITEM_BANANA:
value = 1;
break;
- case 8:
+ case ITEM_THUNDERBOLT:
value = 0x16;
break;
- case 10:
+ case ITEM_STAR:
value = 0x19;
break;
- case 12:
+ case ITEM_MUSHROOM:
value = 0x1D;
break;
- case 13:
+ case ITEM_DOUBLE_MUSHROOM:
break;
- case 14:
+ case ITEM_TRIPLE_MUSHROOM:
break;
- case 15:
+ case ITEM_SUPER_MUSHROOM:
break;
}
if (value >= 0) {
@@ -9461,7 +8818,7 @@ void func_8001AB74(s32 arg0, s16 *arg1, s32 arg2) {
}
}
-void func_8001ABE0(UNUSED s32 arg0, UNUSED s32 arg1) {
+void func_8001ABE0(UNUSED s32 arg0, UNUSED D_801642D8_entry *arg1) {
}
@@ -9472,474 +8829,456 @@ void func_8001ABEC(struct struct_801642D8 *arg0) {
}
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? func_8001AB74(s32, struct struct_801642D8 *, u8); /* extern */
-? func_800C92CC(s32, ?, s32, struct Actor *); /* extern */
-? func_800CAC60(s32); /* extern */
-? func_800CAD40(u8, s16); /* extern */
-extern ? D_801631E0;
-extern s16 D_80163478;
-extern ? D_801642D8;
-extern u16 D_801646CC;
-
+#ifdef NON_MATCHING
+// By the looks of this function is probably something like `cpu_player_use_item`
+// The use of several different actor types might make getting a match hard(er),
+// might have to get creative/ugly with just a single generic `Actor` variable.
+// https://decomp.me/scratch/FOlbG
void func_8001AC10(s32 playerId) {
- Player *sp2C;
- struct Actor *sp28;
- Player *temp_t9;
- s16 temp_a1;
- s16 temp_a2;
- s16 temp_v1_2;
- s16 temp_v1_3;
- s16 temp_v1_4;
- s16 temp_v1_5;
- s16 temp_v1_6;
- s16 temp_v1_7;
- s16 temp_v1_8;
- s16 temp_v1_9;
- s16 var_v0;
- s32 temp_a0;
- s32 temp_v1;
- s32 var_v1;
- struct Actor *temp_a3;
- struct Actor *temp_a3_10;
- struct Actor *temp_a3_11;
- struct Actor *temp_a3_12;
- struct Actor *temp_a3_13;
- struct Actor *temp_a3_2;
- struct Actor *temp_a3_3;
- struct Actor *temp_a3_4;
- struct Actor *temp_a3_5;
- struct Actor *temp_a3_6;
- struct Actor *temp_a3_7;
- struct Actor *temp_a3_8;
- struct Actor *temp_a3_9;
- TrackWaypoint *temp_v0_2;
- struct struct_801642D8 *temp_s0;
- u16 temp_v0;
-
- temp_t9 = &gPlayerOne[playerId];
- sp2C = temp_t9;
- if ((gModeSelection != (s32) 1) && (D_801646CC != (u16) 1) && !(temp_t9->type & 0x800)) {
- temp_s0 = (playerId * 0x10) + &D_801642D8;
- temp_a1 = temp_s0->unk0;
- switch (temp_a1) { /* switch 1 */
- case 0: /* switch 1 */
- temp_s0->ffff = -1;
- if ((((playerId * 0x14) + 0x64) < D_80164450[playerId]) && (temp_s0->timer >= 0x259) && (temp_s0->laps < 3) && (temp_v1 = gLapCountByPlayerId[playerId], ((temp_v1 < 3) != 0))) {
- func_8001AB74(playerId, temp_s0, gen_random_item_cpu((s32) (s16) temp_v1, gGPCurrentRaceRankByPlayerId[playerId].unk2));
+ s32 var_v0;
+ Player *player;
+ TrackWaypoint *waypoint;
+ D_801642D8_entry *temp_s0;
+ struct Actor *actor;
+ struct ShellActor *shell;
+ struct BananaActor *banana;
+ struct FakeItemBox *fakeItemBox;
+ struct BananaBunchParent *bananaBunchParent;
+
+ player = &gPlayerOne[playerId];
+ if (((gModeSelection != ((s32) 1)) && (((u16) D_801646CC) != ((u16) 1))) && (!(player->type & 0x800))) {
+ temp_s0 = &D_801642D8[playerId];
+ switch (temp_s0->unk_00) {
+ case 0:
+ temp_s0->actorIndex = -1;
+ if ((((playerId * 0x14) + 0x64) < D_80164450[playerId]) && (temp_s0->unk_04 >= 0x259) && (temp_s0->unk_06 < 3) && (gLapCountByPlayerId[playerId] < 3)) {
+ func_8001AB74(playerId, &temp_s0->unk_00, gen_random_item_cpu((s16)gLapCountByPlayerId[playerId], gGPCurrentRaceRankByPlayerId[playerId]));
} else {
- func_8001ABE0(playerId, (s32) temp_s0);
+ func_8001ABE0(playerId, temp_s0);
}
- default: /* switch 1 */
break;
- case 1: /* switch 1 */
- if ((gLapCountByPlayerId[playerId] > 0) && (temp_v1_2 = D_80163478, temp_a0 = gGPCurrentRaceRankByPlayerId[temp_v1_2], ((temp_a0 < gGPCurrentRaceRankByPlayerId[playerId]) != 0)) && (temp_a0 == 0)) {
- temp_v0 = sp2C->characterId;
- switch (temp_v0) { /* switch 3; irregular */
- case 4: /* switch 3 */
- if (func_80007BF8(gNearestWaypointByPlayerId[playerId], gNearestWaypointByPlayerId[temp_v1_2], 0x0028U, 2U, (u16) (s32) D_80164430) > 0) {
- temp_s0->unk0 = 0x0022;
+
+ case 1:
+ if ((gLapCountByPlayerId[playerId] > 0) && (gGPCurrentRaceRankByPlayerId[D_80163478] > gGPCurrentRaceRankByPlayerId[playerId]) && (gGPCurrentRaceRankByPlayerId[D_80163478] == 0)) {
+ switch (player->characterId) {
+ case 4:
+ if (func_80007BF8(gNearestWaypointByPlayerId[playerId], gNearestWaypointByPlayerId[D_80163478], 0x0028U, 2U, (u16) ((s32) D_80164430)) > 0) {
+ temp_s0->unk_00 = 0x0022;
}
break;
- case 6: /* switch 3 */
- if (func_80007BF8(gNearestWaypointByPlayerId[playerId], gNearestWaypointByPlayerId[temp_v1_2], 4U, 2U, (u16) (s32) D_80164430) > 0) {
- temp_s0->unk0 = 0x0022;
+
+ case 6:
+ if (func_80007BF8(gNearestWaypointByPlayerId[playerId], gNearestWaypointByPlayerId[D_80163478], 4U, 2U, (u16) ((s32) D_80164430)) > 0) {
+ temp_s0->unk_00 = 0x0022;
}
break;
- default: /* switch 3 */
- if (func_80007BF8(gNearestWaypointByPlayerId[playerId], gNearestWaypointByPlayerId[temp_v1_2], 0x000AU, 2U, (u16) (s32) D_80164430) > 0) {
- temp_s0->unk0 = 0x0022;
+
+ default:
+ if (func_80007BF8(gNearestWaypointByPlayerId[playerId], gNearestWaypointByPlayerId[D_80163478], 0x000AU, 2U, (u16) ((s32) D_80164430)) > 0) {
+ temp_s0->unk_00 = 0x0022;
}
break;
}
- } else if (temp_a1 == 1) {
- temp_s0->ffff = use_banana_item(sp2C);
- temp_v1_3 = temp_s0->ffff;
- if ((temp_v1_3 >= 0) && (temp_v1_3 < 0x64)) {
- sp2C->statusEffects |= 0x40000;
- temp_s0->unk0 = 2;
- temp_s0->timer = 0;
- temp_s0->laps += 1;
- temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA);
+ } else if (temp_s0->unk_00 == 1) {
+ temp_s0->actorIndex = use_banana_item(player);
+ if ((temp_s0->actorIndex >= 0) && (temp_s0->actorIndex < 0x64)) {
+ player->statusEffects |= 0x40000;
+ temp_s0->unk_00 = 2;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
+ temp_s0->unk_0E = (random_int(3U) * 0x14) + 0xA;
} else {
- temp_s0->unk0 = 0;
- temp_s0->timer = 0;
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
}
}
break;
- case 2: /* switch 1 */
- temp_a3 = &gActorList[temp_s0->ffff];
- if (!(temp_a3->flags & 0x8000) || (temp_a3->type != 6) || (temp_a3->state != 0) || (playerId != temp_a3->rot[0])) {
- temp_s0->unk0 = 0;
- temp_s0->timer = 0;
- sp2C->statusEffects &= 0xFFFBFFFF;
- } else if (temp_s0->unkE < temp_s0->timer) {
- temp_s0->unk0 = 3;
+
+ case 2:
+ banana = (struct BananaActor*)&gActorList[temp_s0->actorIndex];
+ if ((!(banana->flags & 0x8000)) || (banana->type != 6) || (banana->state != 0) || (playerId != banana->playerId)) {
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
+ player->statusEffects &= ~0x00040000;
+ } else if (temp_s0->unk_0E < temp_s0->unk_04) {
+ temp_s0->unk_00 = 3;
}
break;
- case 3: /* switch 1 */
- temp_a3_2 = &gActorList[temp_s0->ffff];
- if (!(temp_a3_2->flags & 0x8000) || (temp_a3_2->type != 6) || (temp_a3_2->state != 0) || (playerId != temp_a3_2->rot[0])) {
- if (playerId != temp_a3_2->rot[0]) {
- }
+ case 3:
+ banana = (struct BananaActor*)&gActorList[temp_s0->actorIndex];
+ if ((((!(banana->flags & 0x8000)) || (banana->type != 6)) || (banana->state != 0)) || (playerId != banana->playerId)) {
+ if (playerId != banana->playerId) {}
} else {
- temp_a3_2->state = 1;
- temp_a3_2->velocity[0] = 0.0f;
- temp_a3_2->velocity[1] = 0.0f;
- temp_a3_2->velocity[2] = 0.0f;
- if (*(&D_801631E0 + (playerId * 2)) == (u16) 1) {
- sp28 = temp_a3_2;
- temp_a3_2->pos[1] = func_802AE1C0(sp2C->pos[0], (f32) ((f64) sp2C->pos[1] + 30.0), sp2C->pos[2]) + (temp_a3_2->boundingBoxSize + 1.0f);
+ banana->state = 1;
+ banana->velocity[0] = 0.0f;
+ banana->velocity[1] = 0.0f;
+ banana->velocity[2] = 0.0f;
+ if (D_801631E0[playerId] == ((u16) 1)) {
+ banana->pos[1] = func_802AE1C0(player->pos[0], (f32) (((f64) player->pos[1]) + 30.0), player->pos[2]) + (banana->boundingBoxSize + 1.0f);
}
}
- sp2C->statusEffects &= 0xFFFBFFFF;
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
+ player->statusEffects &= ~0x00040000;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_00 = 0;
break;
- case 34: /* switch 1 */
- temp_s0->ffff = use_banana_item(sp2C);
- temp_v1_4 = temp_s0->ffff;
- if ((temp_v1_4 >= 0) && (temp_v1_4 < 0x64)) {
- temp_a3_3 = &gActorList[temp_v1_4];
- temp_a3_3->state = 4;
- sp2C->statusEffects |= 0x40000;
- temp_s0->unk0 = 0x0023;
- temp_s0->timer = 0;
- temp_s0->laps += 1;
- temp_a2 = D_80163478;
- temp_v0_2 = &D_80164550[*gPathIndexByPlayerId][(s32) (gNearestWaypointByPlayerId[temp_a2] + 0x1E) % (s32) gWaypointCountByPathIndex[gPathIndexByPlayerId[temp_a2]]];
- temp_a3_3->velocity[0] = (f32) ((f64) ((f32) temp_v0_2->posX - sp2C->pos[0]) / 20.0);
- temp_a3_3->velocity[1] = (f32) (((f64) ((f32) temp_v0_2->posY - sp2C->pos[1]) / 20.0) + 4.0);
- temp_a3_3->velocity[2] = (f32) ((f64) ((f32) temp_v0_2->posZ - sp2C->pos[2]) / 20.0);
- temp_a3_3->pos[1] = sp2C->pos[1];
- func_800C92CC(playerId & 0xFF, 0x29008009, temp_a2 * 2, temp_a3_3);
- func_800C98B8(sp2C->pos, sp2C->velocity, 0x19018014U);
+
+ case 34:
+ temp_s0->actorIndex = use_banana_item(player);
+ if ((temp_s0->actorIndex >= 0) && (temp_s0->actorIndex < 0x64)) {
+ banana = (struct BananaActor*)&gActorList[temp_s0->actorIndex];
+ banana->state = 4;
+ player->statusEffects |= 0x40000;
+ temp_s0->unk_00 = 0x0023;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
+ waypoint = &D_80164550[gPathIndexByPlayerId[0]][(gNearestWaypointByPlayerId[D_80163478] + 0x1E) % gWaypointCountByPathIndex[gPathIndexByPlayerId[D_80163478]]];
+ banana->velocity[0] = (waypoint->posX - player->pos[0]) / 20.0;
+ banana->velocity[1] = ((waypoint->posY - player->pos[1]) / 20.0) + 4.0;
+ banana->velocity[2] = (waypoint->posZ - player->pos[2]) / 20.0;
+ banana->pos[1] = player->pos[1];
+ func_800C92CC(playerId, 0x29008009U);
+ func_800C98B8(player->pos, player->velocity, 0x19018014U);
} else {
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
}
break;
- case 35: /* switch 1 */
- temp_a3_4 = &gActorList[temp_s0->ffff];
- if (!(temp_a3_4->flags & 0x8000) || (temp_a3_4->type != 6) || (temp_a3_4->state != 4) || (playerId != temp_a3_4->rot[0])) {
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
- sp2C->statusEffects &= 0xFFFBFFFF;
+
+ case 35:
+ banana = (struct BananaActor*)&gActorList[temp_s0->actorIndex];
+ if ((((!(banana->flags & 0x8000)) || (banana->type != 6)) || (banana->state != 4)) || (playerId != banana->playerId)) {
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
+ player->statusEffects &= ~0x00040000;
} else {
- temp_a3_4->pos[0] += temp_a3_4->velocity[0];
- temp_a3_4->velocity[1] = (f32) ((f64) temp_a3_4->velocity[1] - 0.4);
- temp_a3_4->pos[2] += temp_a3_4->velocity[2];
- temp_a3_4->pos[1] += temp_a3_4->velocity[1];
- if (temp_s0->timer >= 0x15) {
- temp_s0->unk0 = 0x0024;
+ banana->velocity[1] -= 0.4;
+ banana->pos[0] += banana->velocity[0];
+ banana->pos[1] += banana->velocity[1];
+ banana->pos[2] += banana->velocity[2];
+ if (temp_s0->unk_04 >= 0x15) {
+ temp_s0->unk_00 = 0x0024;
}
}
break;
- case 36: /* switch 1 */
- temp_a3_5 = &gActorList[temp_s0->ffff];
- if (!(temp_a3_5->flags & 0x8000) || (temp_a3_5->type != 6) || (temp_a3_5->state != 4) || (playerId != temp_a3_5->rot[0])) {
- if (playerId != temp_a3_5->rot[0]) {
- }
+ case 36:
+ banana = (struct BananaActor*)&gActorList[temp_s0->actorIndex];
+ if ((((!(banana->flags & 0x8000)) || (banana->type != 6)) || (banana->state != 4)) || (playerId != banana->playerId)) {
+ if (playerId != banana->playerId) {}
} else {
- temp_a3_5->state = 1;
- temp_a3_5->velocity[0] = 0.0f;
- temp_a3_5->velocity[1] = 0.0f;
- temp_a3_5->velocity[2] = 0.0f;
- sp28 = temp_a3_5;
- temp_a3_5->pos[1] = func_802AE1C0(temp_a3_5->pos[0], (f32) ((f64) temp_a3_5->pos[1] + 30.0), temp_a3_5->pos[2]) + (temp_a3_5->boundingBoxSize + 1.0f);
- }
- sp2C->statusEffects &= 0xFFFBFFFF;
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
+ banana->state = 1;
+ banana->velocity[0] = 0.0f;
+ banana->velocity[1] = 0.0f;
+ banana->velocity[2] = 0.0f;
+ banana->pos[1] = func_802AE1C0(banana->pos[0], (f32) (((f64) banana->pos[1]) + 30.0), banana->pos[2]) + (banana->boundingBoxSize + 1.0f);
+ }
+ player->statusEffects &= ~0x00040000;
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
break;
- case 4: /* switch 1 */
- if ((s32) gNumActors < 0x50) {
- temp_s0->ffff = use_green_shell_item(sp2C);
- temp_v1_5 = temp_s0->ffff;
- if ((temp_v1_5 >= 0) && (temp_v1_5 < 0x64)) {
- temp_s0->unk0 = 5;
- temp_s0->timer = 0;
- temp_s0->laps += 1;
- temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA);
+
+ case 4:
+ if (((s32) gNumActors) < 0x50) {
+ temp_s0->actorIndex = use_green_shell_item(player);
+ if ((temp_s0->actorIndex >= 0) && (temp_s0->actorIndex < 0x64)) {
+ temp_s0->unk_00 = 5;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
+ temp_s0->unk_0E = (random_int(3U) * 0x14) + 0xA;
} else {
- goto block_71;
+ temp_s0->unk_00 = 0;
}
} else {
-block_71:
- temp_s0->unk0 = 0;
+ temp_s0->unk_00 = 0;
}
break;
- case 5: /* switch 1 */
- temp_a3_6 = &gActorList[temp_s0->ffff];
- if (!(temp_a3_6->flags & 0x8000) || (temp_a3_6->type != 7) || (temp_a3_6->state != 0) || (playerId != temp_a3_6->rot[2])) {
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
- } else if (temp_s0->unkE < temp_s0->timer) {
- temp_s0->timer = 0;
- temp_s0->unk0 = 6;
+
+ case 5:
+ actor = &gActorList[temp_s0->actorIndex];
+ if ((((!(actor->flags & 0x8000)) || (actor->type != 7)) || (actor->state != 0)) || (playerId != actor->rot[2])) {
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
+ } else if (temp_s0->unk_0E < temp_s0->unk_04) {
+ temp_s0->unk_00 = 6;
+ temp_s0->unk_04 = 0;
}
break;
- case 6: /* switch 1 */
- temp_a3_7 = &gActorList[temp_s0->ffff];
- if (!(temp_a3_7->flags & 0x8000) || (temp_a3_7->type != 7) || (temp_a3_7->state != 0) || (playerId != temp_a3_7->rot[2])) {
- temp_s0->unk0 = 0;
- temp_s0->timer = 0;
+
+ case 6:
+ actor = &gActorList[temp_s0->actorIndex];
+ if ((((!(actor->flags & 0x8000)) || (actor->type != 7)) || (actor->state != 0)) || (playerId != actor->rot[2])) {
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
} else {
- temp_a3_7->state = 1;
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
+ actor->state = 1;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_00 = 0;
}
break;
- case 7: /* switch 1 */
- if ((s32) gNumActors < 0x50) {
- temp_s0->ffff = use_red_shell_item(sp2C);
- temp_v1_6 = temp_s0->ffff;
- if ((temp_v1_6 >= 0) && (temp_v1_6 < 0x64)) {
- temp_s0->unk0 = 8;
- temp_s0->timer = 0;
- temp_s0->laps += 1;
- temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA);
+
+ case 7:
+ if (((s32) gNumActors) < 0x50) {
+ temp_s0->actorIndex = use_red_shell_item(player);
+ if ((temp_s0->actorIndex >= 0) && (temp_s0->actorIndex < 0x64)) {
+ temp_s0->unk_00 = 8;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
+ temp_s0->unk_0E = (random_int(3U) * 0x14) + 0xA;
} else {
- goto block_92;
+ temp_s0->unk_00 = 0;
}
} else {
-block_92:
- temp_s0->unk0 = 0;
+ temp_s0->unk_00 = 0;
}
break;
- case 8: /* switch 1 */
- temp_a3_8 = &gActorList[temp_s0->ffff];
- if (!(temp_a3_8->flags & 0x8000) || (temp_a3_8->type != 8) || (temp_a3_8->state != 0) || (playerId != temp_a3_8->rot[2])) {
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
- } else if (temp_s0->unkE < temp_s0->timer) {
- temp_s0->unk0 = 9;
+
+ case 8:
+ shell = (struct ShellActor*) &gActorList[temp_s0->actorIndex];
+ if ((((!(shell->flags & 0x8000)) || (shell->type != 8)) || (shell->state != 0)) || (playerId != shell->playerId)) {
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
+ } else if (temp_s0->unk_0E < temp_s0->unk_04) {
+ temp_s0->unk_00 = 9;
}
break;
- case 9: /* switch 1 */
- func_8001ABEC(temp_s0);
- temp_a3_9 = &gActorList[temp_s0->ffff];
- if (!(temp_a3_9->flags & 0x8000) || (temp_a3_9->type != 8) || (temp_a3_9->state != 0) || (playerId != temp_a3_9->rot[2])) {
- temp_s0->unk0 = 0;
- temp_s0->timer = 0;
+
+ case 9:
+ func_8001ABEC((struct struct_801642D8 *) temp_s0);
+ shell = (struct ShellActor*) &gActorList[temp_s0->actorIndex];
+ if ((((!(shell->flags & 0x8000)) || (shell->type != 8)) || (shell->state != 0)) || (playerId != shell->playerId)) {
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
} else {
- temp_a3_9->state = 1;
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
+ shell->state = 1;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_00 = 0;
}
break;
- case 10: /* switch 1 */
- if ((s32) gNumActors < 0x50) {
- temp_s0->ffff = use_banana_bunch_item(sp2C);
- temp_v1_7 = temp_s0->ffff;
- if ((temp_v1_7 >= 0) && (temp_v1_7 < 0x64)) {
- temp_s0->unk0 = 0x000B;
- temp_s0->timer = 0;
- temp_s0->laps += 1;
- temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0x3C);
+
+ case 10:
+ if (((s32) gNumActors) < 0x50) {
+ temp_s0->actorIndex = use_banana_bunch_item(player);
+ if ((temp_s0->actorIndex >= 0) && (temp_s0->actorIndex < 0x64)) {
+ temp_s0->unk_00 = 0x000B;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
+ temp_s0->unk_0E = (random_int(3U) * 0x14) + 0x3C;
} else {
- goto block_113;
+ temp_s0->unk_00 = 0;
}
} else {
-block_113:
- temp_s0->unk0 = 0;
+ temp_s0->unk_00 = 0;
}
break;
- case 11: /* switch 1 */
- temp_a3_10 = &gActorList[temp_s0->ffff];
- if (temp_a3_10->state == 6) {
- var_v1 = 0;
- if (temp_a3_10->unk1A != -1) {
- var_v1 = 1;
- }
- if (temp_a3_10->unk18 != -1) {
- var_v1 = 1;
+
+ case 11:
+ bananaBunchParent = (struct BananaBunchParent*)&gActorList[temp_s0->actorIndex];
+ if (bananaBunchParent->state == 6) {
+ var_v0 = 0;
+ if (bananaBunchParent->bananaIndices[4] != (-1)) {
+ var_v0 = 1;
}
- if (temp_a3_10->unk_16 != -1) {
- var_v1 = 1;
+ if (bananaBunchParent->bananaIndices[3] != (-1)) {
+ var_v0 = 1;
}
- if (temp_a3_10->rot[2] != -1) {
- var_v1 = 1;
+ if (bananaBunchParent->bananaIndices[2] != (-1)) {
+ var_v0 = 1;
}
- if (temp_a3_10->rot[1] != -1) {
- var_v1 = 1;
+ if (bananaBunchParent->bananaIndices[1] != (-1)) {
+ var_v0 = 1;
}
- if ((temp_a3_10->type != 0x000E) || (var_v1 == 0)) {
- temp_s0->unk0 = 0;
- goto block_131;
+ if (bananaBunchParent->bananaIndices[0] != (-1)) {
+ var_v0 = 1;
}
- if (temp_s0->unkE < temp_s0->timer) {
- temp_s0->unk0 = 0x000C;
- temp_s0->unk8 = 0;
-block_131:
- temp_s0->timer = 0;
+ if ((bananaBunchParent->type != 0x000E) || (var_v0 == 0)) {
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
+ } else if (temp_s0->unk_0E < temp_s0->unk_04) {
+ temp_s0->unk_00 = 0x000C;
+ temp_s0->unk_08 = 0;
+ temp_s0->unk_04 = 0;
}
}
break;
- case 12: /* switch 1 */
- if (((s16) temp_s0->timer % 10) == 0) {
- temp_v1_8 = temp_s0->unk8;
- if (temp_v1_8 < 5) {
+
+ case 12:
+ if ((((s16) temp_s0->unk_04) % 10) == 0) {
+ if (temp_s0->unk_08 < 5) {
+ bananaBunchParent = (struct BananaBunchParent*)&gActorList[temp_s0->actorIndex];
var_v0 = 0;
- temp_a3_11 = &gActorList[temp_s0->ffff];
- switch (temp_v1_8) { /* switch 2 */
- case 0: /* switch 2 */
- if (temp_a3_11->unk1A != -1) {
-block_146:
+ switch (temp_s0->unk_08) {
+ case 0:
+ if (bananaBunchParent->bananaIndices[4] != (-1)) {
var_v0 = 1;
}
break;
- case 1: /* switch 2 */
- if (temp_a3_11->unk18 != -1) {
- goto block_146;
+
+ case 1:
+ if (bananaBunchParent->bananaIndices[3] != (-1)) {
+ var_v0 = 1;
}
break;
- case 2: /* switch 2 */
- if (temp_a3_11->unk_16 != -1) {
- goto block_146;
+
+ case 2:
+ if (bananaBunchParent->bananaIndices[2] != (-1)) {
+ var_v0 = 1;
}
break;
- case 3: /* switch 2 */
- if (temp_a3_11->rot[2] != -1) {
- goto block_146;
+
+ case 3:
+ if (bananaBunchParent->bananaIndices[1] != (-1)) {
+ var_v0 = 1;
}
break;
- case 4: /* switch 2 */
- if (temp_a3_11->rot[1] != -1) {
- goto block_146;
+
+ case 4:
+ if (bananaBunchParent->bananaIndices[0] != (-1)) {
+ var_v0 = 1;
}
break;
}
- if ((temp_a3_11->type == 0x000E) && (temp_a3_11->state == 6) && (var_v0 == 1)) {
- func_802B0648((struct BananaBunchParent *) temp_a3_11);
+
+ if (((bananaBunchParent->type == 0x000E) && (bananaBunchParent->state == 6)) && (var_v0 == 1)) {
+ func_802B0648(bananaBunchParent);
}
- temp_s0->unk8 = (s16) (temp_s0->unk8 + 1);
+ temp_s0->unk_08 += 1;
} else {
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
}
}
break;
- case 13: /* switch 1 */
- temp_s0->ffff = use_fake_itembox_item(sp2C);
- temp_v1_9 = temp_s0->ffff;
- if ((temp_v1_9 >= 0) && (temp_v1_9 < 0x64)) {
- temp_s0->unk0 = 0x000E;
- temp_s0->timer = 0;
- temp_s0->laps += 1;
- temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA);
+
+ case 13:
+ temp_s0->actorIndex = use_fake_itembox_item(player);
+ if ((temp_s0->actorIndex >= 0) && (temp_s0->actorIndex < 0x64)) {
+ temp_s0->unk_00 = 0x000E;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
+ temp_s0->unk_0E = (random_int(3U) * 0x14) + 0xA;
} else {
- temp_s0->unk0 = 0;
+ temp_s0->unk_00 = 0;
}
break;
- case 14: /* switch 1 */
- temp_a3_12 = &gActorList[temp_s0->ffff];
- if (!(temp_a3_12->flags & 0x8000) || (temp_a3_12->type != 0x000D) || (temp_a3_12->state != 0) || (playerId != (s32) temp_a3_12->velocity[0])) {
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
- } else if (temp_s0->unkE < temp_s0->timer) {
- temp_s0->unk0 = 0x000F;
+
+ case 14:
+ fakeItemBox = (struct FakeItemBox*)&gActorList[temp_s0->actorIndex];
+ if ((((!(fakeItemBox->flags & 0x8000)) || (fakeItemBox->type != 0x000D)) || (fakeItemBox->state != 0)) || (playerId != ((s32) fakeItemBox->playerId))) {
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
+ } else if (temp_s0->unk_0E < temp_s0->unk_04) {
+ temp_s0->unk_00 = 0x000F;
}
break;
- case 15: /* switch 1 */
- temp_a3_13 = &gActorList[temp_s0->ffff];
- if (!(temp_a3_13->flags & 0x8000) || (temp_a3_13->type != 0x000D) || (temp_a3_13->state != 0) || (playerId != (s32) temp_a3_13->velocity[0])) {
- if (playerId != temp_a3_13->rot[0]) {
- }
+ case 15:
+ fakeItemBox = (struct FakeItemBox*)&gActorList[temp_s0->actorIndex];
+ if ((((!(fakeItemBox->flags & 0x8000)) || (fakeItemBox->type != 0x000D)) || (fakeItemBox->state != 0)) || (playerId != ((s32) fakeItemBox->playerId))) {
+ if (playerId != fakeItemBox->rot[0]) {}
} else {
- sp28 = temp_a3_13;
- func_802A1064((struct FakeItemBox *) temp_a3_13);
- if (*(&D_801631E0 + (playerId * 2)) == 1) {
- sp28 = temp_a3_13;
- temp_a3_13->pos[1] = func_802AE1C0(temp_a3_13->pos[0], (f32) ((f64) temp_a3_13->pos[1] + 30.0), temp_a3_13->pos[2]) + temp_a3_13->boundingBoxSize;
+ func_802A1064(fakeItemBox);
+ if (D_801631E0[playerId] == 1) {
+ fakeItemBox->pos[1] = func_802AE1C0(fakeItemBox->pos[0], fakeItemBox->pos[1] + 30.0, fakeItemBox->pos[2]) + fakeItemBox->boundingBoxSize;
}
}
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
break;
- case 22: /* switch 1 */
- use_thunder_item(sp2C);
- func_800CAC60(playerId & 0xFF);
+
+ case 22:
+ use_thunder_item(player);
+ func_800CAC60(playerId);
func_8009E5BC();
- temp_s0->timer = 0;
- temp_s0->unk0 = 0x0017;
- temp_s0->laps += 1;
+ temp_s0->unk_00 = 0x0017;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
break;
- case 23: /* switch 1 */
- if (temp_s0->timer >= 0xF1) {
- func_800CAD40((u8) playerId, temp_a1);
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
+
+ case 23:
+ if (temp_s0->unk_04 >= 0xF1) {
+ func_800CAD40((s32) ((u8) playerId));
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
}
break;
- case 25: /* switch 1 */
- sp2C->statusEffects |= 0x2000;
- temp_s0->timer = 0;
- temp_s0->unk0 = 0x001A;
- temp_s0->laps += 1;
+
+ case 25:
+ player->statusEffects |= 0x2000;
+ temp_s0->unk_00 = 0x001A;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
break;
- case 26: /* switch 1 */
- if (!(sp2C->effects & 0x200)) {
- temp_s0->unk0 = 0;
+
+ case 26:
+ if (!(player->effects & 0x200)) {
+ temp_s0->unk_00 = 0;
}
- temp_s0->timer = 0;
+ temp_s0->unk_04 = 0;
break;
- case 27: /* switch 1 */
- sp2C->statusEffects |= 0x800;
- temp_s0->timer = 0;
- temp_s0->unk0 = 0x001C;
- temp_s0->laps += 1;
+
+ case 27:
+ player->statusEffects |= 0x800;
+ temp_s0->unk_00 = 0x001C;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
break;
- case 28: /* switch 1 */
- if (!(sp2C->effects & 0x80000000)) {
- temp_s0->unk0 = 0;
+
+ case 28:
+ if (!(player->effects & 0x80000000)) {
+ temp_s0->unk_00 = 0;
}
- temp_s0->timer = 0;
+ temp_s0->unk_04 = 0;
break;
- case 29: /* switch 1 */
- sp2C->statusEffects |= 0x200;
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
- temp_s0->laps += 1;
+
+ case 29:
+ player->statusEffects |= 0x200;
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_06 += 1;
break;
- case 30: /* switch 1 */
- if (temp_s0->timer >= 0x3D) {
- sp2C->statusEffects |= 0x200;
- temp_s0->timer = 0;
- temp_s0->unk0 = 0x001D;
+
+ case 30:
+ if (temp_s0->unk_04 >= 0x3D) {
+ player->statusEffects |= 0x200;
+ temp_s0->unk_00 = 0x001D;
+ temp_s0->unk_04 = 0;
}
break;
- case 31: /* switch 1 */
- if (temp_s0->timer >= 0x3D) {
- sp2C->statusEffects |= 0x200;
- temp_s0->timer = 0;
- temp_s0->unk0 = 0x001E;
+
+ case 31:
+ if (temp_s0->unk_04 >= 0x3D) {
+ player->statusEffects |= 0x200;
+ temp_s0->unk_00 = 0x001E;
+ temp_s0->unk_04 = 0;
}
break;
- case 32: /* switch 1 */
- temp_s0->timer = 0;
- temp_s0->unk0 = 0x0021;
- temp_s0->unkE = 0x0258;
+
+ case 32:
+ temp_s0->unk_00 = 0x0021;
+ temp_s0->unk_04 = 0;
+ temp_s0->unk_0E = 0x0258;
break;
- case 33: /* switch 1 */
- if (((s16) temp_s0->timer % 60) == 0) {
- sp2C->statusEffects |= 0x200;
- if (temp_s0->unkE < temp_s0->timer) {
- temp_s0->timer = 0;
- temp_s0->unk0 = 0;
+
+ case 33:
+ if ((((s16) temp_s0->unk_04) % 60) == 0) {
+ player->statusEffects |= 0x200;
+ if (temp_s0->unk_0E < temp_s0->unk_04) {
+ temp_s0->unk_00 = 0;
+ temp_s0->unk_04 = 0;
}
}
break;
+
+ default:
+ break;
}
- if (temp_s0->timer < 0x2710) {
- temp_s0->timer += 1;
+
+ if (temp_s0->unk_04 < 0x2710) {
+ temp_s0->unk_04 += 1;
}
- if (sp2C->effects & 0x80002200) {
- temp_s0->timer = 0;
+ if (player->effects & 0x80002200) {
+ temp_s0->unk_04 = 0;
}
}
}
@@ -9947,8 +9286,6 @@ block_146:
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001AC10.s")
#endif
-extern u16 D_80163410[]; // One per player?
-
void func_8001BE78(void) {
Player* temp_s1;
TrackWaypoint* temp_s0;
@@ -10026,15 +9363,14 @@ void func_8001C05C(void) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-void func_80009B60(s32); /* extern */
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-11-2023
extern ? D_80163418;
extern ? D_80163438;
extern s16 D_8016347C;
extern s16 D_8016347E;
extern s32 D_80163480;
extern s32 D_80163484;
-extern u16 D_80163E2C; // This is really D_80163DE8.state
+extern u16 D_80163E2C;
void func_8001C14C(void) {
Player *temp_s0;
@@ -10059,41 +9395,47 @@ void func_8001C14C(void) {
}
var_s1 = 0;
loop_8:
- if ((var_s1 != 3) || (D_8016347C != 0)) {
- temp_s0 = &gPlayerOne[var_s1];
- func_80009B60(var_s1);
- temp_v1 = temp_s0->type;
- temp_v0 = var_s1 * 4;
- if ((temp_v1 & 0x2000) == 0) {
- temp_f0 = *(&D_80163418 + temp_v0) - temp_s0->pos[0];
- temp_f2 = *(&D_80163438 + temp_v0) - temp_s0->pos[2];
- if ((f64) ((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) < 1.0) {
- if (var_s1 != 3) {
- if (D_8016347C == 0) {
- temp_s0->type = temp_v1 | 0x2000;
- } else {
- temp_s0->type = temp_v1 & 0xDFFF;
- }
- if (((gPlayerOne->type & 0x2000) != 0) && ((gPlayerTwo->type & 0x2000) != 0) && ((gPlayerThree->type & 0x2000) != 0)) {
- D_8016347C = 1;
- D_80163480 = 0;
- }
- } else if (D_8016347E == 0) {
- if ((temp_s0->effects & 0x01000000) == 0) {
- temp_s0->type = temp_v1 | 0x2000;
- }
- D_8016347E = 1;
- D_80163484 = 0;
- } else if ((temp_s0->effects & 0x01000000) == 0) {
+ if (var_s1 == 3) {
+ if (D_8016347C != 0) {
+ goto block_12;
+ }
+ return;
+ }
+block_12:
+ temp_s0 = &gPlayerOne[var_s1];
+ func_80009B60(var_s1);
+ temp_v1 = temp_s0->type;
+ temp_v0 = var_s1 * 4;
+ if (!(temp_v1 & 0x2000)) {
+ temp_f0 = *(&D_80163418 + temp_v0) - temp_s0->pos[0];
+ temp_f2 = *(&D_80163438 + temp_v0) - temp_s0->pos[2];
+ if ((f64) ((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) < 1.0) {
+ if (var_s1 != 3) {
+ if (D_8016347C == 0) {
+ temp_s0->type = temp_v1 | 0x2000;
+ } else {
+ temp_s0->type = temp_v1 & 0xDFFF;
+ }
+ if ((gPlayerOne->type & 0x2000) && (gPlayerTwo->type & 0x2000) && (gPlayerThree->type & 0x2000)) {
+ D_8016347C = 1;
+ D_80163480 = 0;
+ }
+ } else if (D_8016347E == 0) {
+ if (!(temp_s0->effects & 0x01000000)) {
temp_s0->type = temp_v1 | 0x2000;
}
+ D_8016347E = 1;
+ D_80163484 = 0;
+ } else if (!(temp_s0->effects & 0x01000000)) {
+ temp_s0->type = temp_v1 | 0x2000;
}
}
- var_s1 += 1;
- if (var_s1 != 4) {
- goto loop_8;
- }
}
+ var_s1 += 1;
+ if (var_s1 == 4) {
+ return;
+ }
+ goto loop_8;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001C14C.s")
diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h
index a8bad64d3..4e96ee64d 100644
--- a/src/code_80005FD0.h
+++ b/src/code_80005FD0.h
@@ -3,6 +3,7 @@
#include "vehicles.h"
#include "camera.h"
+#include "waypoints.h"
struct struct_801642D8 {
/* 0x0 */ u16 unk0;
@@ -34,6 +35,20 @@ typedef struct {
extern Test D_801634F8[];
+// Something related to CPU item usage
+typedef struct {
+ /* 0x00 */ s16 unk_00;
+ /* 0x02 */ s16 actorIndex;
+ /* 0x04 */ s16 unk_04;
+ /* 0x06 */ s16 unk_06;
+ /* 0x08 */ s16 unk_08;
+ /* 0x0A */ s16 unk_0A;
+ /* 0x0C */ s16 unk_0C;
+ /* 0x0E */ s16 unk_0E;
+} D_801642D8_entry; // size = 0x10
+
+extern D_801642D8_entry D_801642D8[];
+
/* Function Prototypes */
void func_80012190(void);
void func_8000BA14(u16, f32, f32, s16);
@@ -44,7 +59,9 @@ void func_800147E0(void);
void func_800132F4(void);
s16 func_80005FD0(Vec3f, Vec3f);
void func_800100F0(s32);
+void func_80011E38(s32);
void func_800120C8(void);
+void func_80012780(TrainCarStuff*, s16*, u16);
void func_800127E0(void);
s32 func_80006018(f32, f32, f32, f32, f32, f32, f32, f32);
void func_80006114(Vec3f, Vec3f, s16);
@@ -61,6 +78,7 @@ void func_80008F38(s32);
void func_80009000(s32);
void func_800090F0(s32, Player*);
+f32 func_80009258(s32, f32, f32);
void func_800097E0(void);
void func_80009B60(s32);
@@ -68,6 +86,7 @@ s32 func_8000B7E4(s32, u16);
s32 func_8000B820(s32);
f32 func_8000B874(f32, f32, u16, s32);
void func_8000B95C(s32, u16, s32);
+void func_8000BBD8(u16, f32, s16);
s16 func_8000BD94(f32, f32, f32, s32);
s16 func_8000C0BC(f32, f32, f32, u16, s32*);
@@ -81,8 +100,9 @@ s16 func_8000CD24(f32, f32, f32, s16, Player*, s32, s32);
s16 func_8000D24C(f32, f32, f32, s32*);
s16 func_8000D2B4(f32, f32, f32, s16, s32);
s16 func_8000D33C(f32, f32, f32, s16, s32);
-s16 func_8000D6D0(Vec3f, s16*, f32, f32, s32, s32);
-s16 func_8000D940(Vec3f, s16*, f32, f32, s32);
+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 func_8000DF8C(s32);
@@ -94,19 +114,25 @@ s32 func_8000EE10(s32);
void func_8000EE58(s32);
void func_8000EEDC(void);
void func_8000EF20(void);
-void func_8000EF20(void);
void func_8000F0E0(void);
void func_8000F124(void);
+void func_8000F2BC(TrackWaypoint*, size_t);
+void func_8000F2DC(void);
void func_80010218(s32);
f32 func_80010480(s32, u16);
void func_800107C4(s32);
s16 func_80010CB0(s32, s32);
void func_80010DBC(s32);
+void func_80010E6C(s32);
f32 func_80010F40(f32, f32, f32, s32);
f32 func_80010FA0(f32, f32, f32, s32);
+u16 func_80011014(TrackWaypoint *, TrackWaypoint *, s32, s32);
+s32 process_path_data(TrackWaypoint*, TrackWaypoint*);
+s32 func_8001168C(void*, void*, s32);
+void func_80011A5C(void);
void func_80011AB8(s32);
void func_80011AE4(s32);
@@ -116,8 +142,11 @@ void func_80012A48(TrainCarStuff*, s16);
void func_80012AC0(void);
void func_80012DC0(s32, Player*);
+void func_80013054(void);
+void func_800131DC(s32);
void func_800133C4(void);
void func_80013854(Player*);
+void func_800139E4(f32, f32, s32, s32, VehicleStuff*, TrackWaypoint*);
f32 func_80013C74(s16, s16);
void func_80013D20(VehicleStuff*);
void func_80013F7C(s32, Player*, VehicleStuff*, f32, f32, s32, u32);
@@ -137,13 +166,31 @@ void func_80014C78(void);
void func_80014CC0(s32, Player*);
void func_80014D08(s32);
void func_80014D30(s32, s32);
-f32 func_80014EE4(f32 arg0, s32 arg1);
+f32 func_80014EE4(f32, s32);
+void func_800151A4(Camera*, s32);
void func_8001530C(void);
void func_80015314(s32, f32, s32);
void func_80015390(Camera*, Player*, s32);
+void func_80015544(s32, f32, s32, s32);
+void func_8001577C(Camera*, s32, s32, s32);
+void func_80015A9C(s32, f32, s32, s16);
+
+void func_800162CC(s32, f32, s32, s16);
+void func_80016C3C(s32, f32, s32);
+void func_80017720(s32, f32, s32, s16);
+void func_80017F10(s32, f32, s32, s16);
+
+void func_80018718(s32, f32, s32, s16);
+
+void func_80019118(s32, f32, s32, s16);
+void func_8001933C(Camera*, s32, s32, s32);
void func_8001968C(void);
+void func_8001969C(s32, f32, s32, s16);
+void func_80019760(Camera*, s32, s32, s32);
+void func_80019890(s32, s32);
+void func_80019B50(s32, u16);
void func_80019C50(s32);
void func_80019D2C(Camera*, Player*, s32);
void func_80019DE4(void);
@@ -154,10 +201,20 @@ void func_80019FB4(s32);
void func_8001A0A4(u16*, Camera*, Player*, s8, s32);
void func_8001A0DC(u16*, Camera*, Player*, s8, s32);
+void func_8001A124(s32, s32);
s32 func_8001A310(s32, s32);
+void func_8001A348(s32, f32, s32);
+void func_8001A3D8(s32, f32, s32);
+void func_8001A450(s32, s32, s32);
+void func_8001A518(s32, s32, s32);
void func_8001A588(u16*, Camera*, Player*, s8, s32);
-void func_8001ABE0(s32, s32);
+void func_8001AB00(void);
+void func_8001AB74(s32, s16*, s32);
+void func_8001ABE0(s32, D_801642D8_entry*);
void func_8001ABEC(struct struct_801642D8*);
+void func_8001AC10(s32);
+
+void func_8001BE78(void);
void func_8001C05C(void);
void func_8001C14C(void);
@@ -174,17 +231,22 @@ extern f32 D_800DCA4C[];
// See bss_80005FD0.s
extern Collision D_80162E70;
extern s16 D_80162EB0;
-extern u16 D_801631E0[8];
-extern s32 D_80163488;
+extern s16 D_80162FCC;
+extern f32 D_80162FA0[];
-
-extern s32 D_8016337C;
extern s16 D_80164378[];
extern s32 D_801643E0[];
extern struct unexpiredActors gUnexpiredActorsList[];
-extern s16 D_8016348C;
extern s32 D_801643E0[];
extern s32 D_80164408[];
+extern s32 D_8016448C;
+extern f32 D_80164498[];
+extern f32 D_801645F8[];
+extern s32 D_80164608[];
+extern f32 D_80164618[];
+extern f32 D_80164638[];
+extern f32 D_80164648[];
+extern f32 D_80164658[];
extern s16 D_80164670[];
extern s16 D_80164672;
extern s16 D_80164674;
@@ -193,11 +255,30 @@ extern s16 D_80164678[]; // Size 4? Is the three below this fake?
extern s16 D_8016467A;
extern s16 D_8016467C;
extern s16 D_8016467E;
+extern s16 D_80164680[];
+extern s16 D_80164682;
+extern f32 D_80164688[];
+extern s16 D_801646C0[];
+extern s16 D_801646CC;
+extern s16 D_801630FC;
+extern s16 D_801631C8;
+extern u16 D_801631E0[8];
+extern s32 D_80163238;
extern s16 D_801632B8[];
extern s16 D_801632D0[];
extern u16 D_801632E8[];
-extern s16 D_801646CC;
+extern s32 D_8016337C;
+extern u16 D_80163410[]; // One per player?
+extern s16 D_80163478;
+extern s32 D_80163488;
+extern s16 D_8016348C;
+extern s16 D_801634D8[8];
+extern s32 D_8016359C;
+extern u16 D_801637BC[2];
+extern u16 D_801637BE;
+extern s32 D_80163DD8[];
extern u16 D_80163E2A;
+
extern Gfx D_0D0076F8[];
extern s32 D_800DDB20;
diff --git a/src/code_80057C60.c b/src/code_80057C60.c
index 28cef0b0d..470eac200 100644
--- a/src/code_80057C60.c
+++ b/src/code_80057C60.c
@@ -4783,40 +4783,11 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_80065AB0.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b
-? func_800652D4(f32 *, s16 *, f32); /* extern */
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-09-2023
extern ? D_05FF8DB8;
-extern u32 D_8018D494;
-extern u32 D_8018D498;
-static s32 D_800E47DC[0xC] = {
- 0x00FBFFFB,
- 0x00A06011,
- 0x00E0C090,
- 0x00D0B080,
- 0x00907040,
- 0x00C07010,
- 0x00D0F0FF,
- 0x00E09030,
- 0x00C09030,
- 0x00604020,
- 0x00F0D0B0,
- 0x00A08030,
-};
-static s32 D_800E480C[0xC] = {
- 0x00B0B0B0,
- 0x00804011,
- 0x00B08050,
- 0x00A07040,
- 0x00603011,
- 0x00804010,
- 0x007090A0,
- 0x00A06030,
- 0x00A07010,
- 0x00301011,
- 0x00B0A080,
- 0x00806010,
-};
-static ? D_800E8C00; /* unable to generate initializer */
+extern ? D_800E47DC;
+extern ? D_800E480C;
+extern ? D_800E8C00;
void func_80065F0C(Player *player, s32 arg1, s16 arg2, s8 arg3) {
f32 spE4;
@@ -4862,11 +4833,11 @@ void func_80065F0C(Player *player, s32 arg1, s16 arg2, s8 arg3) {
Gfx *temp_s0_8;
Gfx *temp_s0_9;
s16 temp_a0;
- s16 temp_a1;
s16 temp_ra;
s16 temp_s2;
s16 temp_s3;
s32 temp_a2;
+ s32 temp_t6;
s32 temp_v1;
void *temp_v0;
@@ -4881,11 +4852,11 @@ void func_80065F0C(Player *player, s32 arg1, s16 arg2, s8 arg3) {
sp44 = temp_v0;
func_800652D4(&spDC, &spD4, temp_v0->unk534 * player->size);
if ((s32) sp44->unk53C != 8) {
- temp_a1 = sp44->unk560;
temp_a0 = sp44->unk562;
- temp_v1 = D_800E47DC[temp_a1];
+ temp_t6 = sp44->unk560 * 4;
+ temp_v1 = *(&D_800E47DC + temp_t6);
temp_ra = ((temp_v1 >> 0x10) & 0xFF) - temp_a0;
- temp_a2 = D_800E480C[temp_a1];
+ temp_a2 = *(&D_800E480C + temp_t6);
temp_s2 = ((temp_v1 >> 8) & 0xFF) - temp_a0;
temp_s3 = (temp_v1 & 0xFF) - temp_a0;
spCA = ((temp_a2 >> 0x10) & 0xFF) - temp_a0;
@@ -4900,7 +4871,7 @@ void func_80065F0C(Player *player, s32 arg1, s16 arg2, s8 arg3) {
temp_s0_2 = gDisplayListHead;
gDisplayListHead = temp_s0_2 + 8;
temp_s0_2->words.w0 = 0xFD900000;
- temp_s0_2->words.w1 = D_8018D494;
+ temp_s0_2->words.w1 = (u32) D_8018D494;
temp_s0_3 = gDisplayListHead;
gDisplayListHead = temp_s0_3 + 8;
temp_s0_3->words.w1 = 0x07000000;
@@ -4938,7 +4909,7 @@ void func_80065F0C(Player *player, s32 arg1, s16 arg2, s8 arg3) {
temp_s0_11 = gDisplayListHead;
gDisplayListHead = temp_s0_11 + 8;
temp_s0_11->words.w0 = 0xFD900000;
- temp_s0_11->words.w1 = D_8018D494;
+ temp_s0_11->words.w1 = (u32) D_8018D494;
temp_s0_12 = gDisplayListHead;
gDisplayListHead = temp_s0_12 + 8;
temp_s0_12->words.w1 = 0x07000000;
@@ -4985,7 +4956,7 @@ void func_80065F0C(Player *player, s32 arg1, s16 arg2, s8 arg3) {
temp_s0_22 = gDisplayListHead;
gDisplayListHead = temp_s0_22 + 8;
temp_s0_22->words.w0 = 0xFD100000;
- temp_s0_22->words.w1 = D_8018D498;
+ temp_s0_22->words.w1 = (u32) D_8018D498;
temp_s0_23 = gDisplayListHead;
gDisplayListHead = temp_s0_23 + 8;
temp_s0_23->words.w1 = 0x07080200;
diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c
index 82b67dda9..1f7764a58 100644
--- a/src/code_8006E9C0.c
+++ b/src/code_8006E9C0.c
@@ -233,153 +233,40 @@ void init_item_window(s32 objectIndex) {
temp_v0->sizeScaling = 1.0f;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-extern s32 D_8018D240;
-extern s16 D_8018D2B0;
-extern s16 D_8018D2B8;
-static s32 gCourseOutlineTextures[0x14] = {
- (s32) &gTextureCourseOutlineMarioRaceway,
- (s32) &gTextureCourseOutlineChocoMountain,
- (s32) &gTextureCourseOutlineBowsersCastle,
- (s32) &gTextureCourseOutlineBansheeBoardwalk,
- (s32) &gTextureCourseOutlineYoshiValley,
- (s32) &gTextureCourseOutlineFrappeSnowland,
- (s32) &gTextureCourseOutlineKoopaTroopaBeach,
- (s32) &gTextureCourseOutlineRoyalRaceway,
- (s32) &gTextureCourseOutlineLuigiRaceway,
- (s32) &gTextureCourseOutlineMooMooFarm,
- (s32) &gTextureCourseOutlineToadsTurnpike,
- (s32) &gTextureCourseOutlineKalimariDesert,
- (s32) &gTextureCourseOutlineSherbetLand,
- (s32) &gTextureCourseOutlineRainbowRoad,
- (s32) &gTextureCourseOutlineWarioStadium,
- (s32) &gTextureCourseOutlineBlockFort,
- (s32) &gTextureCourseOutlineSkyscraper,
- (s32) &gTextureCourseOutlineDoubleDeck,
- (s32) &gTextureCourseOutlineDksJungleParkway,
- (s32) &gTextureCourseOutlineBigDonut,
-};
-static s16 D_800E5520[0]; /* unable to generate initializer */
-static s16 D_800E5548[0]; /* unable to generate initializer */
-static s32 gTextureCourseOutlineBansheeBoardwalk; /* unable to generate initializer */
-static s32 gTextureCourseOutlineBigDonut; /* unable to generate initializer */
-static s32 gTextureCourseOutlineBlockFort; /* unable to generate initializer */
-static s32 gTextureCourseOutlineBowsersCastle; /* unable to generate initializer */
-static s32 gTextureCourseOutlineChocoMountain; /* unable to generate initializer */
-static s32 gTextureCourseOutlineDksJungleParkway; /* unable to generate initializer */
-static s32 gTextureCourseOutlineDoubleDeck; /* unable to generate initializer */
-static s32 gTextureCourseOutlineFrappeSnowland; /* unable to generate initializer */
-static s32 gTextureCourseOutlineKalimariDesert; /* unable to generate initializer */
-static s32 gTextureCourseOutlineKoopaTroopaBeach; /* unable to generate initializer */
-static s32 gTextureCourseOutlineLuigiRaceway; /* unable to generate initializer */
-static s32 gTextureCourseOutlineMarioRaceway; /* unable to generate initializer */
-static s32 gTextureCourseOutlineMooMooFarm; /* unable to generate initializer */
-static s32 gTextureCourseOutlineRainbowRoad; /* unable to generate initializer */
-static s32 gTextureCourseOutlineRoyalRaceway; /* unable to generate initializer */
-static s32 gTextureCourseOutlineSherbetLand; /* unable to generate initializer */
-static s32 gTextureCourseOutlineSkyscraper; /* unable to generate initializer */
-static s32 gTextureCourseOutlineToadsTurnpike; /* unable to generate initializer */
-static s32 gTextureCourseOutlineWarioStadium; /* unable to generate initializer */
-static s32 gTextureCourseOutlineYoshiValley; /* unable to generate initializer */
-#endif
-
void func_8006EEE8(s32 courseId) {
D_8018D240 = dma_textures(gCourseOutlineTextures[courseId], D_800E5520[courseId], D_800E5520[courseId]);
+ // This is incredibly dumb. D_800E5548 ought to be something more like
+ // `u16 D_800E5548[][2]` but that doesn't match for some insane reason
D_8018D2B0 = D_800E5548[courseId * 2];
D_8018D2B8 = D_800E5548[courseId * 2 + 1];
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-extern s32 D_8018D248;
-extern s32 D_8018D9B4;
-static s32 *gCourseOutlineTextures[0x14] = {
- gTextureCourseOutlineMarioRaceway,
- gTextureCourseOutlineChocoMountain,
- gTextureCourseOutlineBowsersCastle,
- gTextureCourseOutlineBansheeBoardwalk,
- gTextureCourseOutlineYoshiValley,
- gTextureCourseOutlineFrappeSnowland,
- gTextureCourseOutlineKoopaTroopaBeach,
- gTextureCourseOutlineRoyalRaceway,
- gTextureCourseOutlineLuigiRaceway,
- gTextureCourseOutlineMooMooFarm,
- gTextureCourseOutlineToadsTurnpike,
- gTextureCourseOutlineKalimariDesert,
- gTextureCourseOutlineSherbetLand,
- gTextureCourseOutlineRainbowRoad,
- gTextureCourseOutlineWarioStadium,
- gTextureCourseOutlineBlockFort,
- gTextureCourseOutlineSkyscraper,
- gTextureCourseOutlineDoubleDeck,
- gTextureCourseOutlineDksJungleParkway,
- gTextureCourseOutlineBigDonut,
-};
-static s16 D_800E5520; /* unable to generate initializer */
-static s32 gTextureCourseOutlineBansheeBoardwalk[];
-static s32 gTextureCourseOutlineBigDonut[];
-static s32 gTextureCourseOutlineBlockFort[];
-static s32 gTextureCourseOutlineBowsersCastle[];
-static s32 gTextureCourseOutlineChocoMountain[];
-static s32 gTextureCourseOutlineDksJungleParkway[];
-static s32 gTextureCourseOutlineDoubleDeck[];
-static s32 gTextureCourseOutlineFrappeSnowland[];
-static s32 gTextureCourseOutlineKalimariDesert[];
-static s32 gTextureCourseOutlineKoopaTroopaBeach[];
-static s32 gTextureCourseOutlineLuigiRaceway[];
-static s32 gTextureCourseOutlineMarioRaceway[];
-static s32 gTextureCourseOutlineMooMooFarm[];
-static s32 gTextureCourseOutlineRainbowRoad[];
-static s32 gTextureCourseOutlineRoyalRaceway[];
-static s32 gTextureCourseOutlineSherbetLand[];
-static s32 gTextureCourseOutlineSkyscraper[];
-static s32 gTextureCourseOutlineToadsTurnpike[];
-static s32 gTextureCourseOutlineWarioStadium[];
-static s32 gTextureCourseOutlineYoshiValley[];
+#ifdef NON_MATCHING
+// I really really don't know what D_8018D9B4 is supposed to be
+// Its value is a pointer that seems to point to compressesed data
+// of some variety (sometimes TKMK, sometimes MIO0)
+extern u8 *D_8018D9B4;
void func_8006EF60(void) {
- s16 *var_s0;
- s16 temp_a2;
- s16 temp_t6;
- s32 **var_s3;
- s32 *var_s4;
- s32 var_s1;
s32 var_s2;
- var_s4 = &D_8018D248;
- var_s3 = gCourseOutlineTextures;
- var_s0 = &D_800E5520;
- var_s2 = 0;
- var_s1 = D_8018D9B4 + 0xFFFF0000;
- do {
- temp_a2 = *var_s0;
- temp_t6 = *var_s0;
- var_s2 += 1;
- *var_s4 = func_8006ED94(*var_s3, var_s1, (s32) temp_a2, (s32) temp_a2);
- var_s3 += 4;
- var_s0 += 2;
- var_s4 += 4;
- var_s1 += temp_t6;
- } while (var_s2 != 0x14);
+ for (var_s2 = 0; var_s2 < 0x14; var_s2++) {
+ D_8018D248[var_s2] = func_8006ED94(gCourseOutlineTextures[var_s2], D_8018D9B4, D_800E5520[var_s2], D_800E5520[var_s2]);
+ D_8018D9B4 += D_800E5520[var_s2];
+ }
}
#else
GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_8006EF60.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-void func_8006EEE8(s16); /* extern */
-extern s32 D_0F0D0E50;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-09-2023
extern s32 D_801655C8;
extern s16 D_80165718;
extern s16 D_80165720;
extern s16 D_80165728;
-extern s32 D_80165880;
-extern f32 D_8018D01C;
-extern s32 D_8018D220;
+extern u8 *D_80165880;
extern f32 D_8018D2A0;
-extern s16 D_8018D2B0;
extern s16 D_8018D2C0;
extern s16 D_8018D2D8;
extern s16 D_8018D2E0;
@@ -388,18 +275,17 @@ extern s16 D_8018D300;
extern s16 D_8018D308;
extern s16 D_8018D310;
extern s16 D_8018D318;
-static ? gTextureExhaust0; /* unable to generate initializer */
-static ? gTextureExhaust1; /* unable to generate initializer */
-static ? gTextureExhaust2; /* unable to generate initializer */
-static ? gTextureExhaust3; /* unable to generate initializer */
-static ? gTextureExhaust4; /* unable to generate initializer */
-static ? gTextureExhaust5; /* unable to generate initializer */
s16 gCurrentCourseId; /* unable to generate initializer */
+static u8 gTextureExhaust0[0x479];
+static u8 gTextureExhaust1[0x485];
+static u8 gTextureExhaust2[0x4F4];
+static u8 gTextureExhaust3[0x3C8];
+static u8 gTextureExhaust4[0x3F8];
+static u8 gTextureExhaust5[0x443];
void func_8006F008(void) {
s16 temp_a0;
s16 var_t9;
- s8 temp_v0;
D_801655C8 = 0;
D_8018D01C = 1.0f;
@@ -414,11 +300,11 @@ void func_8006F008(void) {
D_8018D310 = 0x00FF;
D_8018D318 = 0x00FF;
if (temp_a0 < 0x14) {
- func_8006EEE8(temp_a0);
+ func_8006EEE8((s32) temp_a0);
}
- switch ((u32) gCurrentCourseId) {
+ switch (temp_a0) {
case 0:
- D_8018D220 = dma_textures((s32) &gTextureExhaust5, 0x00000443U, 0x00001000U);
+ D_8018D220 = dma_textures(gTextureExhaust5, 0x00000443U, 0x00001000U);
D_8018D2A0 = 0.022f;
D_8018D2E0 = 6;
D_8018D2E8 = 0x001C;
@@ -443,14 +329,14 @@ block_26:
D_8018D2E8 = 0x0030;
break;
case 3:
- D_80165880 = dma_textures((s32) &D_0F0D0E50, 0x00004CC2U, 0x0000D980U);
+ D_80165880 = dma_textures(D_0F0D0E50, 0x00004CC2U, 0x0000D980U);
D_8018D2A0 = 0.016f;
D_8018D2C0.unk0 = 0x0106;
D_8018D2E0 = 0x0037;
D_8018D2E8 = 0x0027;
break;
case 4:
- D_8018D220 = dma_textures((s32) &gTextureExhaust0, 0x00000479U, 0x00000C00U);
+ D_8018D220 = dma_textures(gTextureExhaust0, 0x00000479U, 0x00000C00U);
D_8018D2A0 = 0.018f;
D_8018D2E0 = 0x003D;
D_8018D2E8 = 0x0026;
@@ -465,14 +351,14 @@ block_26:
D_8018D310 = 0x00FF;
break;
case 6:
- D_8018D220 = dma_textures((s32) &gTextureExhaust3, 0x000003C8U, 0x00001000U);
+ D_8018D220 = dma_textures(gTextureExhaust3, 0x000003C8U, 0x00001000U);
D_8018D2A0 = 0.014f;
D_8018D2C0.unk0 = 0x010C;
D_8018D2E0 = 0x0028;
D_8018D2E8 = 0x0015;
break;
case 7:
- D_8018D220 = dma_textures((s32) &gTextureExhaust4, 0x000003F8U, 0x00001000U);
+ D_8018D220 = dma_textures(gTextureExhaust4, 0x000003F8U, 0x00001000U);
D_8018D2C0.unk0 = 0x0106;
D_8018D2A0 = 0.014f;
D_8018D2E0 = 0x0025;
@@ -482,7 +368,7 @@ block_26:
D_80165728 = -0x014A;
break;
case 8:
- D_8018D220 = dma_textures((s32) &gTextureExhaust2, 0x000004F4U, 0x00000C00U);
+ D_8018D220 = dma_textures(gTextureExhaust2, 0x000004F4U, 0x00000C00U);
D_8018D2A0 = 0.0155f;
D_8018D2C0.unk0 = 0x010F;
D_8018D2E0 = 0x002D;
@@ -492,7 +378,7 @@ block_26:
D_80165728 = -0x00D7;
break;
case 9:
- D_8018D220 = dma_textures((s32) &gTextureExhaust0, 0x00000479U, 0x00000C00U);
+ D_8018D220 = dma_textures(gTextureExhaust0, 0x00000479U, 0x00000C00U);
D_8018D2A0 = 0.0155f;
D_8018D2C0.unk0 = 0x010F;
D_8018D2E0 = 0x0012;
@@ -507,13 +393,13 @@ block_26:
case 11:
D_8018D2C0.unk0 = 0x0107;
D_8018D2D8.unk0 = 0x00A5;
- D_8018D220 = dma_textures((s32) &gTextureExhaust5, 0x00000443U, 0x00001000U);
+ D_8018D220 = dma_textures(gTextureExhaust5, 0x00000443U, 0x00001000U);
D_8018D2A0 = 0.015f;
D_8018D2E0 = 0x0037;
D_8018D2E8 = 0x001B;
break;
case 12:
- D_8018D220 = dma_textures((s32) &gTextureExhaust1, 0x00000485U, 0x00000C00U);
+ D_8018D220 = dma_textures(gTextureExhaust1, 0x00000485U, 0x00000C00U);
D_8018D2A0 = 0.015f;
D_8018D2C0.unk0 = 0x0106;
D_8018D2E0 = 0x0034;
@@ -565,18 +451,17 @@ block_26:
if (gIsMirrorMode != 0) {
D_8018D2E0 = D_8018D2B0 - D_8018D2E0;
}
- temp_v0 = gPlayerCount;
- if (temp_v0 == 4) {
+ if (gPlayerCount == 4) {
D_8018D2C0.unk0 = 0x00A0;
D_8018D2D8.unk0 = 0x0078;
return;
}
- if (temp_v0 == 3) {
+ if (gPlayerCount == 3) {
D_8018D2C0.unk0 = 0x00EB;
D_8018D2D8.unk0 = 0x00AF;
return;
}
- if (temp_v0 == 2) {
+ if (gPlayerCount == 2) {
if (gCurrentCourseId != 0x000A) {
D_8018D2C0.unk2 = 0x0109;
D_8018D2C0.unk0 = D_8018D2C0.unk2;
@@ -626,70 +511,60 @@ void func_8006F824(s32 arg0) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_8006F824(?, s8 *, s8 *, s32); // extern
-extern s8 D_801657E4;
-extern bool8 D_801657E6;
-extern bool8 D_801657E8;
-extern bool8 D_801657F0;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-09-2023
extern s8 D_801657F8;
-extern s8 D_80165800;
extern s8 D_80165808;
-extern bool8 D_80165810;
-extern bool8 D_80165818;
+extern s8 D_80165810;
+extern s8 D_80165818;
extern s8 D_80165820;
extern s8 D_80165828;
extern ? D_80165832;
-extern s16 D_8018D2D8;
-extern s8 D_8018EDFC;
+extern ? D_8018D2D8;
void func_8006F8CC(void) {
- s8 temp_a0;
-
if (D_8018EDFC == 0) {
D_8018EDFC = 1;
D_801657E4 = 0;
- D_801657E6 = FALSE;
- D_80165800.unk1 = 1;
+ D_801657E6 = 0;
+ D_80165800->unk1 = 1;
D_801657F0 = 0;
- D_801657E8 = TRUE;
- D_80165800.unk0 = D_80165800.unk1;
- temp_a0 = gPlayerCount;
- if (temp_a0 == FOUR_PLAYERS_SELECTED) {
- if (gModeSelection != BATTLE) {
+ D_801657E8 = 1;
+ D_80165800->unk0 = D_80165800->unk1;
+ if (gPlayerCount == 4) {
+ if (gModeSelection != 3) {
D_801657E4 = 1;
D_801657F0 = 1;
D_801657F8 = 1;
- D_80165800.unk1 = 0;
- D_80165800.unk0 = D_80165800.unk1;
+ D_80165800->unk1 = 0;
+ D_80165800->unk0 = D_80165800->unk1;
} else {
D_801657F8 = 0;
- D_80165800.unk0 = D_80165800.unk1;
+ D_80165800->unk0 = D_80165800->unk1;
}
- } else if (temp_a0 == THREE_PLAYERS_SELECTED) {
- D_801657E8 = FALSE;
+ } else if (gPlayerCount == 3) {
+ D_801657E8 = 0;
D_801657F8 = 1;
- } else if (temp_a0 == TWO_PLAYERS_SELECTED) {
- if (gModeSelection != BATTLE) {
- D_80165800.unk1 = 0;
+ } else if (gPlayerCount == 2) {
+ if (gModeSelection != (s32) 3) {
+ D_80165800->unk1 = 0;
D_801657E4 = 1;
D_801657F0 = 1;
- D_80165800.unk0 = D_80165800.unk1;
+ D_80165800->unk0 = D_80165800->unk1;
}
- D_8018D2D8.unk0 = 0x41;
- D_8018D2D8.unk2 = 0xB4;
+ D_8018D2D8.unk0 = 0x0041;
+ D_8018D2D8.unk2 = 0x00B4;
}
- func_8006F824(0, &D_801657E4, &D_801657F0, 3);
+ func_8006F824(0);
} else {
D_801657E4 = D_80165808;
D_801657E6 = D_80165810;
D_801657F0 = D_80165820;
D_801657E8 = D_80165818;
D_801657F8 = D_80165828;
- D_80165800.unk0 = D_80165832.unk0;
- D_80165800.unk1 = D_80165832.unk1;
+ D_80165800->unk0 = D_80165832.unk0;
+ D_80165800->unk1 = (s8) D_80165832.unk1;
}
- if (gDemoMode) {
+ if (gDemoMode != 0) {
D_801657F0 = 0;
}
}
@@ -698,31 +573,12 @@ GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_8006F8CC.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b
-typedef struct {
- /* 0x00 */ char pad0[4];
- /* 0x04 */ f32 unk_04;
- /* 0x08 */ f32 unk8; /* inferred */
- /* 0x0C */ f32 unk_0C;
- /* 0x10 */ char pad10[0x10]; /* maybe part of unk_0C[5]? */
-} struct_D_8018CE10; /* size = 0x20 */
-
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-09-2023
? func_8006F008(); /* extern */
? func_8006F8CC(); /* extern */
-extern s32 D_801655D8;
-extern s32 D_801655E8;
-extern s32 D_801655F8;
-extern s32 D_80165608;
-extern s32 D_80165618;
-extern s32 D_80165628;
extern ? D_80165658;
-extern s16 D_801656F0;
extern s8 D_8016576A;
extern s8 D_8016579C;
-extern s8 D_801657AE;
-extern s8 D_801657B0;
-extern s8 D_801657B2;
-extern s8 D_801657D8;
extern s8 D_801657E1;
extern s8 D_801657E2;
extern s8 D_801657E3;
@@ -732,14 +588,11 @@ extern s32 D_80165804;
extern s32 D_8016580C;
extern s32 D_80165814;
extern s32 D_8016581C;
-extern s8 D_801658BC;
extern s8 D_801658C6;
-extern s8 D_801658CE;
extern s8 D_801658D6;
extern s8 D_801658DC;
extern s8 D_801658E4;
extern s8 D_801658EC;
-extern s8 D_801658F4;
extern ? D_8018CF28;
extern ? D_8018CF50;
extern ? D_8018CFAC;
@@ -752,33 +605,15 @@ extern s32 D_8018D114;
extern s32 D_8018D160;
extern s32 D_8018D168;
extern s16 D_8018D16C;
-extern s32 D_8018D170;
-extern s16 D_8018D174;
-extern s32 D_8018D178;
extern s16 D_8018D17C;
extern s32 D_8018D180;
extern s16 D_8018D184;
-extern s32 gIsHUDVisible;
extern s16 D_8018D18C;
-extern s32 D_8018D190;
-extern s32 D_8018D1A0;
-extern s32 D_8018D1B4;
extern s32 D_8018D1C4;
-extern s32 D_8018D1CC;
extern s32 D_8018D1DC;
-extern s32 D_8018D1F0;
-extern s32 D_8018D1F8;
-extern s32 D_8018D1FC;
-extern s32 D_8018D204;
extern s32 D_8018D20C;
-extern bool D_8018D214;
-extern s32 D_8018D224;
extern s8 D_8018D228;
-extern s32 D_8018D2A4;
-extern s32 D_8018D2AC;
extern s32 D_8018D2B4;
-extern s32 D_8018D2BC;
-extern ? D_8018D2C8;
extern s16 D_8018D2F0;
extern s16 D_8018D2F8;
extern s32 D_8018D320;
@@ -792,16 +627,11 @@ void func_8006FA94(void) {
? *var_a3;
? *var_t0;
? *var_v1;
+ Player *temp_v0;
+ Player *temp_v0_2;
Player *temp_v0_3;
- Player *temp_v0_4;
- Player *temp_v0_5;
Player *var_v0;
- s16 temp_t7;
s16 var_a0;
- s32 temp_t6;
- s32 temp_v0;
- s32 temp_v0_2;
- s8 temp_ra;
struct_D_8018CE10 *var_v1_2;
func_8006F8CC();
@@ -828,9 +658,8 @@ void func_8006FA94(void) {
D_80165658.unk8 = 0;
D_80165658.unk4 = 0;
D_80165658.unk0 = 0;
- temp_ra = gPlayerCount;
D_801658BC = D_801658C6;
- switch (temp_ra) { /* irregular */
+ switch (gPlayerCount) { /* irregular */
case 1:
if (gModeSelection == 0) {
D_8018D114 = 0;
@@ -844,13 +673,12 @@ void func_8006FA94(void) {
break;
case 2:
if (gScreenModeSelection == 1) {
- temp_v0 = gModeSelection;
- if (temp_v0 == 0) {
+ if (gModeSelection == 0) {
D_8018D114 = 2;
D_8018D178 = 0x00000096;
D_8018D180 = 0x000000F0;
D_8018D2AC = 0x0000003C;
- } else if (temp_v0 == 2) {
+ } else if (gModeSelection == 2) {
D_8018D114 = 3;
D_8018D178 = 0x0000001E;
D_8018D180 = 0x0000001E;
@@ -861,15 +689,12 @@ void func_8006FA94(void) {
D_8018D180 = 0x00000028;
D_8018D2AC = 0x0000003C;
}
+ } else if (gModeSelection == 0) {
+ D_8018D114 = 5;
+ } else if (gModeSelection == 2) {
+ D_8018D114 = 6;
} else {
- temp_v0_2 = gModeSelection;
- if (temp_v0_2 == 0) {
- D_8018D114 = 5;
- } else if (temp_v0_2 == 2) {
- D_8018D114 = 6;
- } else {
- D_8018D114 = 7;
- }
+ D_8018D114 = 7;
}
break;
case 3:
@@ -903,7 +728,7 @@ void func_8006FA94(void) {
D_8016579C = 0;
}
var_a0 = 0;
- if (temp_ra > 0) {
+ if (gPlayerCount > 0) {
var_a0_2 = &D_8018CFB4;
var_a2 = &D_8018CFC4;
var_a1 = &D_8018CFAC;
@@ -917,7 +742,7 @@ void func_8006FA94(void) {
var_a1->unk-1 = 0;
var_a2->unk-1 = 0;
var_a0_2->unk-1 = 0;
- } while ((u32) var_a0_2 < (u32) (temp_ra + &D_8018CFB4));
+ } while ((u32) var_a0_2 < (u32) (gPlayerCount + &D_8018CFB4));
var_a0 = 0;
}
D_8018D204 = 1;
@@ -928,11 +753,10 @@ void func_8006FA94(void) {
D_8018D228 = 0xFF;
D_80165628 = 0;
D_80165618 = 0;
- temp_t6 = D_80165618;
- D_80165608 = temp_t6;
- D_801655F8 = temp_t6;
- D_801655E8 = temp_t6;
- D_801655D8 = temp_t6;
+ D_80165608 = D_80165618;
+ D_801655F8 = D_80165618;
+ D_801655E8 = D_80165618;
+ D_801655D8 = D_80165618;
D_8018D160 = 0;
D_8018D1DC = 0;
D_8018D1C4 = 0;
@@ -941,9 +765,9 @@ void func_8006FA94(void) {
D_8018D168 = 0;
D_801656F0 = 0;
D_801657B2 = 0;
- D_801657D8 = D_801657B2; // put all to 0
- D_8018D214 = (s32) D_801657D8; // put all to 0
- D_801657B0 = (s8) D_8018D214; // put all to 0
+ D_801657D8 = D_801657B2;
+ D_8018D214 = (s32) D_801657D8;
+ D_801657B0 = (s8) D_8018D214;
D_801657AE = D_801657B0;
D_8018D20C = 0;
D_8018D2F8 = 0;
@@ -953,21 +777,20 @@ void func_8006FA94(void) {
D_8018D2BC = 0;
D_8018D2B4 = D_8018D2BC;
D_8018D2A4 = D_8018D2B4;
- D_8018D2C8.unk0 = 0;
- D_8018D2C8.unk4 = 0;
- D_8018D2C8.unk8 = 0;
- D_8018D2C8.unkC = 0;
+ D_8018D2C8->unk0 = 0;
+ D_8018D2C8->unk4 = 0;
+ D_8018D2C8->unk8 = 0;
+ D_8018D2C8->unkC = 0;
D_8016581C = 0;
D_8016580C = 0;
D_80165814 = 0;
D_80165804 = 0;
D_801657FC = 0;
D_8018D18C = -1;
- temp_t7 = D_8018D18C;
- D_8018D184 = temp_t7;
- D_8018D16C = temp_t7;
- D_8018D17C = temp_t7;
- D_8018D174 = temp_t7;
+ D_8018D184 = D_8018D18C;
+ D_8018D16C = D_8018D18C;
+ D_8018D17C = D_8018D18C;
+ D_8018D174 = D_8018D18C;
var_v0 = gPlayerOne;
var_t0 = &D_8018CF28;
var_a3 = &D_8018CF50;
@@ -977,32 +800,32 @@ void func_8006FA94(void) {
do {
var_a1_2->unk0 = -32.0f;
var_a2_2->unk0 = -32.0f;
- var_v1_2->unk_0C = 0.0f;
- var_v1_2->unk8 = 0.0f;
- var_v1_2->unk_04 = 0.0f;
+ var_v1_2->unk_04[2] = 0.0f;
+ var_v1_2->unk_04[1] = 0.0f;
+ var_v1_2->unk_04[0] = 0.0f;
var_a3->unk0 = var_a0;
var_t0->unk0 = var_v0;
var_v0->unk_040 = -1;
- temp_v0_3 = var_v0 + 0xDD8;
- var_t0->unk4 = temp_v0_3;
+ temp_v0 = var_v0 + 0xDD8;
+ var_t0->unk4 = temp_v0;
var_a3->unk2 = (s16) (var_a0 + 1);
var_v1_2->unk24 = 0.0f;
var_v1_2->unk28 = 0.0f;
var_v1_2->unk2C = 0.0f;
var_a2_2->unk4 = -32.0f;
var_a1_2->unk4 = -32.0f;
- temp_v0_3->unk_040 = -1;
- temp_v0_4 = temp_v0_3 + 0xDD8;
+ temp_v0->unk_040 = -1;
+ temp_v0_2 = temp_v0 + 0xDD8;
var_a3->unk4 = (s16) (var_a0 + 2);
- var_t0->unk8 = temp_v0_4;
+ var_t0->unk8 = temp_v0_2;
var_v1_2->unk44 = 0.0f;
var_v1_2->unk48 = 0.0f;
var_v1_2->unk4C = 0.0f;
var_a2_2->unk8 = -32.0f;
var_a1_2->unk8 = -32.0f;
- temp_v0_4->unk_040 = -1;
- temp_v0_5 = temp_v0_4 + 0xDD8;
- var_t0->unkC = temp_v0_5;
+ temp_v0_2->unk_040 = -1;
+ temp_v0_3 = temp_v0_2 + 0xDD8;
+ var_t0->unkC = temp_v0_3;
var_a3->unk6 = (s16) (var_a0 + 3);
var_a0 += 4;
var_v1_2->unk64 = 0.0f;
@@ -1010,8 +833,8 @@ void func_8006FA94(void) {
var_v1_2->unk6C = 0.0f;
var_a2_2->unkC = -32.0f;
var_a1_2->unkC = -32.0f;
- temp_v0_5->unk_040 = -1;
- var_v0 = temp_v0_5 + 0xDD8;
+ temp_v0_3->unk_040 = -1;
+ var_v0 = temp_v0_3 + 0xDD8;
var_a1_2 += 0x10;
var_a2_2 += 0x10;
var_v1_2 += 0x80;
@@ -1185,8 +1008,7 @@ void func_80070714(void) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit b52d92c2340f6f4ba1aafb464188bb698752fbb0 on Jul-28-2023
-extern u8 d_course_banshee_boardwalk_bat;
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-09-2023
extern ? *D_80165758;
extern ? D_80183EB0;
extern ? D_80183EC8;
@@ -1204,10 +1026,6 @@ extern s8 D_8018D1A8;
extern ? D_8018D1B3;
extern s8 D_8018D1B8;
extern ? D_8018D1C4;
-extern s32 D_8018D1C8;
-extern s32 D_8018D1D0;
-extern s32 D_8018D1D8;
-extern u8 d_course_banshee_boardwalk_bat_tlut;
s16 gCurrentCourseId; /* unable to generate initializer */
static ? D_800E5728; /* unable to generate initializer */
static ? D_800E5854; /* unable to generate initializer */
@@ -1232,6 +1050,15 @@ void func_80070780(void) {
? *var_v1;
? *var_v1_2;
? *var_v1_3;
+ Objects *temp_v0;
+ Objects *temp_v0_2;
+ Objects *temp_v0_3;
+ Objects *temp_v0_4;
+ Objects *temp_v0_5;
+ Objects *temp_v0_6;
+ Objects *temp_v0_7;
+ Objects *temp_v0_8;
+ Objects *temp_v0_9;
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f0_3;
@@ -1294,15 +1121,6 @@ void func_80070780(void) {
s8 *var_s0_5;
s8 *var_s0_6;
s8 *var_s0_7;
- Objects *temp_v0;
- Objects *temp_v0_2;
- Objects *temp_v0_3;
- Objects *temp_v0_4;
- Objects *temp_v0_5;
- Objects *temp_v0_6;
- Objects *temp_v0_7;
- Objects *temp_v0_8;
- Objects *temp_v0_9;
switch ((u16) gCurrentCourseId) {
case 0:
@@ -1395,7 +1213,7 @@ void func_80070780(void) {
case 3:
if (gGamestate != 9) {
temp_s0_4 = D_80183EA0->unk0;
- init_texture_object(temp_s0_4, &d_course_banshee_boardwalk_bat_tlut, &d_course_banshee_boardwalk_bat, 0x20U, (u16) 0x00000040);
+ init_texture_object(temp_s0_4, d_course_banshee_boardwalk_bat_tlut, *d_course_banshee_boardwalk_bat, 0x20U, (u16) 0x00000040);
temp_v0_4 = &gObjectList[temp_s0_4];
temp_v0_4->unk_0B2[0] = 0;
temp_v0_4->unk_0B2[1] = 0;
@@ -1855,22 +1673,20 @@ void init_hud_one_player(void) {
GLOBAL_ASM("asm/non_matchings/code_8006E9C0/init_hud_one_player.s")
#endif
-extern void func_80070190(); /* extern */
-extern void func_8007055C(); /* extern */
-extern void func_80070780(); /* extern */
-extern s32 D_80183DA0;
-extern s32 D_80183DBC;
-
void init_hud_two_player_vertical(void) {
find_unused_obj_index(&D_80183DA0);
- find_unused_obj_index(D_80183DB8);
- find_unused_obj_index(&D_80183DBC);
+
+ find_unused_obj_index(&D_80183DB8[0]);
+ find_unused_obj_index(&D_80183DB8[1]);
+
find_unused_obj_index(&gItemWindowObjectByPlayerId[0]);
find_unused_obj_index(&gItemWindowObjectByPlayerId[1]);
+
func_80070190();
func_8007055C();
func_8007055C();
func_80070780();
+
D_8018CA70[0].itemBoxX = -0x52;
D_8018CA70[0].itemBoxY = 0x32;
D_8018CA70[0].slideItemBoxX = 0;
@@ -1886,6 +1702,7 @@ void init_hud_two_player_vertical(void) {
D_8018CA70[0].lapX = 0x67;
D_8018CA70[0].lapY = 0x28;
init_item_window(gItemWindowObjectByPlayerId[0]);
+
D_8018CA70[1].itemBoxX = 0x43;
D_8018CA70[1].itemBoxY = 0x32;
D_8018CA70[1].slideItemBoxX = 0;
@@ -1901,10 +1718,12 @@ void init_hud_two_player_vertical(void) {
D_8018CA70[1].lapX = 0xF7;
D_8018CA70[1].lapY = 0x28;
init_item_window(gItemWindowObjectByPlayerId[1]);
- D_8018CA70[1].rankScaling = 0.5f;
+
D_8018CA70[0].stagingPosition = (s16) gGPCurrentRaceRankByPlayerId[0];
D_8018CA70[1].stagingPosition = (s16) gGPCurrentRaceRankByPlayerId[1];
- D_8018CA70[0].rankScaling = D_8018CA70[1].rankScaling;
+
+ D_8018CA70[0].rankScaling = D_8018CA70[1].rankScaling = 0.5f;
+
D_8018D3C4 = 0x1E;
D_8018D3BC = 0x18;
D_8018D3C0 = 0x28;
@@ -1926,10 +1745,13 @@ void init_hud_two_player_vertical(void) {
void init_hud_two_player_horizontal() {
find_unused_obj_index(&D_80183DA0);
- find_unused_obj_index(D_80183DB8);
- find_unused_obj_index(&D_80183DBC);
+
+ find_unused_obj_index(&D_80183DB8[0]);
+ find_unused_obj_index(&D_80183DB8[1]);
+
find_unused_obj_index(&gItemWindowObjectByPlayerId[0]);
find_unused_obj_index(&gItemWindowObjectByPlayerId[1]);
+
func_80070190();
func_8007055C();
func_8007055C();
@@ -1950,6 +1772,7 @@ void init_hud_two_player_horizontal() {
D_8018CA70[0].timerY = 0x10;
D_8018CA70[0].lapX = 0x101;
D_8018CA70[0].lapY = 0x6A;
+
D_8018CA70[1].itemBoxX = -0x53;
D_8018CA70[1].itemBoxY = 0x8F;
D_8018CA70[1].slideItemBoxX = 0;
@@ -1964,16 +1787,20 @@ void init_hud_two_player_horizontal() {
D_8018CA70[1].timerY = 0x7F;
D_8018CA70[1].lapX = 0x101;
D_8018CA70[1].lapY = 0xDA;
+
if (gModeSelection == 3) {
D_8018CA70[0].itemBoxY = 0x5E;
D_8018CA70[1].itemBoxY = 0xD0;
}
- D_8018CA70[1].rankScaling = 0.5f;
+
+ D_8018CA70[0].rankScaling = D_8018CA70[1].rankScaling = 0.5f;
+
D_8018CA70[0].stagingPosition = (s16) gGPCurrentRaceRankByPlayerId[0];
D_8018CA70[1].stagingPosition = (s16) gGPCurrentRaceRankByPlayerId[1];
- D_8018CA70[0].rankScaling = D_8018CA70[1].rankScaling;
+
init_item_window(gItemWindowObjectByPlayerId[0]);
init_item_window((gItemWindowObjectByPlayerId[1]));
+
D_8018D3C4 = 0x1E;
D_8018D3BC = 0x18;
D_8018D3C0 = 0x28;
@@ -1992,115 +1819,106 @@ void init_hud_two_player_horizontal() {
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 44f261a363c51a295be8efe3d7ca7f4d2c967e9b on Dec-31-2022
-? func_80070780(); /* extern */
-extern s16 D_801657A2;
-extern s32 D_80183DA0;
-extern s32 D_80183DBC;
-extern s32 D_80183DC0;
-extern s32 D_80183DC4;
-extern s32 D_8018D158;
-extern s32 D_8018D3BC;
-extern s32 D_8018D3C0;
-extern s32 D_8018D3C4;
-
void init_hud_three_four_player(void) {
find_unused_obj_index(&D_80183DA0);
- find_unused_obj_index(D_80183DB8);
- find_unused_obj_index(&D_80183DBC);
- find_unused_obj_index(&D_80183DC0);
- find_unused_obj_index(&D_80183DC4);
- find_unused_obj_index(gItemWindowObjectByPlayerId);
- find_unused_obj_index(gItemWindowObjectByPlayerId + 4);
- find_unused_obj_index(gItemWindowObjectByPlayerId + 8);
- find_unused_obj_index(gItemWindowObjectByPlayerId + 0xC);
+
+ find_unused_obj_index(&D_80183DB8[0]);
+ find_unused_obj_index(&D_80183DB8[1]);
+ find_unused_obj_index(&D_80183DB8[2]);
+ find_unused_obj_index(&D_80183DB8[3]);
+
+ find_unused_obj_index(&gItemWindowObjectByPlayerId[0]);
+ find_unused_obj_index(&gItemWindowObjectByPlayerId[1]);
+ find_unused_obj_index(&gItemWindowObjectByPlayerId[2]);
+ find_unused_obj_index(&gItemWindowObjectByPlayerId[3]);
+
func_80070190();
func_80070780();
- D_8018CA70->unkE6 = 0x011A;
- D_8018CA70->unk16C = 0x00D2;
- D_8018CA70->unk14C = 0x002D;
- D_8018CA70->unk168 = 0x00D4;
- D_8018CA70->unk176 = 0x00C0;
- D_8018CA70->unk1D0 = 0x002D;
- D_8018CA70->unk1EE = 0x011A;
- D_8018CA70->itemBoxX = -0x0036;
- D_8018CA70->itemBoxY = 0x0036;
- D_8018CA70->slideItemBoxX = 0;
- D_8018CA70->slideItemBoxY = 0;
- D_8018CA70->unk_4A = 0x0050;
- D_8018CA70->unk_4C = 0x003C;
- D_8018CA70->rankX = 0x0025;
- D_8018CA70->rankY = 0x0064;
- D_8018CA70->slideRankX = 0;
- D_8018CA70->slideRankY = 0;
- D_8018CA70->lapX = 0x008C;
- D_8018CA70->lapY = 0x0060;
- D_8018CA70->unk_6C = 0x00DE;
- D_8018CA70->unk_6E = 0x00C8;
- D_8018CA70->unkC6 = 0x0175;
- D_8018CA70->unkC8 = 0x0036;
- D_8018CA70->unkCA = 0;
- D_8018CA70->unkCC = 0;
- D_8018CA70->unkCE = 0x00F0;
- D_8018CA70->unkD0 = 0x003C;
- D_8018CA70->unkE8 = 0x0064;
- D_8018CA70->unkEA = 0;
- D_8018CA70->unkEC = 0;
- D_8018CA70->unkDE = 0x00B4;
- D_8018CA70->unkE4 = 0x0060;
- D_8018CA70->unkF0 = 0x00C8;
- D_8018CA70->unkF2 = 0x00C8;
- D_8018CA70->unk14A = -0x0036;
- D_8018CA70->unk14E = 0;
- D_8018CA70->unk150 = 0;
- D_8018CA70->unk152 = 0x0050;
- D_8018CA70->unk154 = 0x00B4;
- D_8018CA70->unk16A = 0x0025;
- D_8018CA70->unk16E = 0;
- D_8018CA70->unk170 = 0;
- D_8018CA70->unk162 = 0x008C;
- D_8018CA70->unk174 = 0x00DE;
- D_8018CA70->unk1CE = 0x0175;
- D_8018CA70->unk1D2 = 0;
- D_8018CA70->unk1D4 = 0;
- D_8018CA70->unk1D6 = 0x00F0;
- D_8018CA70->unk1D8 = 0x00B4;
- D_8018CA70->unk1F0 = 0x00D2;
- D_8018CA70->unk1F2 = 0;
- D_8018CA70->unk1F4 = 0;
- D_8018CA70->unk1E6 = 0x00B4;
- D_8018CA70->unk1EC = 0x00D4;
- D_8018CA70->unk1F8 = 0x00C8;
- D_8018CA70->unk1FA = 0x00C0;
+
+ D_8018CA70[0].itemBoxX = -0x36;
+ D_8018CA70[0].itemBoxY = 0x36;
+ D_8018CA70[0].slideItemBoxX = 0;
+ D_8018CA70[0].slideItemBoxY = 0;
+ D_8018CA70[0].unk_4A = 0x50;
+ D_8018CA70[0].unk_4C = 0x3C;
+ D_8018CA70[0].rankX = 0x25;
+ D_8018CA70[0].rankY = 0x64;
+ D_8018CA70[0].slideRankX = 0;
+ D_8018CA70[0].slideRankY = 0;
+ D_8018CA70[0].lapX = 0x8C;
+ D_8018CA70[0].lapY = 0x60;
+ D_8018CA70[0].unk_6C = 0xDE;
+ D_8018CA70[0].unk_6E = 0xC8;
+
+ D_8018CA70[1].itemBoxX = 0x175;
+ D_8018CA70[1].itemBoxY = 0x36;
+ D_8018CA70[1].slideItemBoxX = 0;
+ D_8018CA70[1].slideItemBoxY = 0;
+ D_8018CA70[1].unk_4A = 0xF0;
+ D_8018CA70[1].unk_4C = 0x3C;
+ D_8018CA70[1].rankX = 0x11A;
+ D_8018CA70[1].rankY = 0x64;
+ D_8018CA70[1].slideRankX = 0;
+ D_8018CA70[1].slideRankY = 0;
+ D_8018CA70[1].lapX = 0xB4;
+ D_8018CA70[1].lapY = 0x60;
+ D_8018CA70[1].unk_6C = 0xC8;
+ D_8018CA70[1].unk_6E = 0xC8;
+
+ D_8018CA70[2].itemBoxX = -0x36;
+ D_8018CA70[2].itemBoxY = 0x2D;
+ D_8018CA70[2].slideItemBoxX = 0;
+ D_8018CA70[2].slideItemBoxY = 0;
+ D_8018CA70[2].unk_4A = 0x50;
+ D_8018CA70[2].unk_4C = 0xB4;
+ D_8018CA70[2].rankX = 0x25;
+ D_8018CA70[2].rankY = 0xD2;
+ D_8018CA70[2].slideRankX = 0;
+ D_8018CA70[2].slideRankY = 0;
+ D_8018CA70[2].lapX = 0x8C;
+ D_8018CA70[2].lapY = 0xD4;
+ D_8018CA70[2].unk_6C = 0xDE;
+ D_8018CA70[2].unk_6E = 0xC0;
+
+ D_8018CA70[3].itemBoxX = 0x175;
+ D_8018CA70[3].itemBoxY = 0x2D;
+ D_8018CA70[3].slideItemBoxX = 0;
+ D_8018CA70[3].slideItemBoxY = 0;
+ D_8018CA70[3].unk_4A = 0xF0;
+ D_8018CA70[3].unk_4C = 0xB4;
+ D_8018CA70[3].rankX = 0x11A;
+ D_8018CA70[3].rankY = 0xD2;
+ D_8018CA70[3].slideRankX = 0;
+ D_8018CA70[3].slideRankY = 0;
+ D_8018CA70[3].lapX = 0xB4;
+ D_8018CA70[3].lapY = 0xD4;
+ D_8018CA70[3].unk_6C = 0xC8;
+ D_8018CA70[3].unk_6E = 0xC0;
+
if (gModeSelection == 3) {
- D_8018CA70->itemBoxY = 0x00C8;
- D_8018CA70->unkC8 = 0x00C8;
- D_8018CA70->unk14C = 0x00B8;
- D_8018CA70->unk1D0 = 0x00B8;
+ D_8018CA70[0].itemBoxY = 0xC8;
+ D_8018CA70[1].itemBoxY = 0xC8;
+ D_8018CA70[2].itemBoxY = 0xB8;
+ D_8018CA70[3].itemBoxY = 0xB8;
}
- D_8018CA70->unk190 = 0.5f;
- D_8018CA70->unk10C = (f32) D_8018CA70->unk190;
- D_8018CA70->unk88 = (f32) D_8018CA70->unk190;
- D_8018CA70->rankScaling = D_8018CA70->unk190;
- D_8018CA70->stagingPosition = (s16) gGPCurrentRaceRankByPlayerId->unk0;
- D_8018CA70->unkEE = (s16) gGPCurrentRaceRankByPlayerId->unk4;
- D_8018CA70->unk172 = (s16) gGPCurrentRaceRankByPlayerId->unk8;
- D_8018CA70->unk1F6 = (s16) gGPCurrentRaceRankByPlayerId->unkC;
- init_item_window(*gItemWindowObjectByPlayerId);
- init_item_window(*(gItemWindowObjectByPlayerId + 4));
- init_item_window(*(gItemWindowObjectByPlayerId + 8));
- init_item_window(*(gItemWindowObjectByPlayerId + 0xC));
- D_8018CA70->unk18C = 1.5f;
- D_8018CA70->unk108 = (f32) D_8018CA70->unk18C;
- D_8018CA70->unk84 = (f32) D_8018CA70->unk18C;
- D_8018CA70->unknownScaling = D_8018CA70->unk18C;
+
+ D_8018CA70[0].rankScaling = D_8018CA70[1].rankScaling = D_8018CA70[2].rankScaling = D_8018CA70[3].rankScaling = 0.5f;
+
+ D_8018CA70[0].stagingPosition = (s16) gGPCurrentRaceRankByPlayerId[0];
+ D_8018CA70[1].stagingPosition = (s16) gGPCurrentRaceRankByPlayerId[1];
+ D_8018CA70[2].stagingPosition = (s16) gGPCurrentRaceRankByPlayerId[2];
+ D_8018CA70[3].stagingPosition = (s16) gGPCurrentRaceRankByPlayerId[3];
+
+ init_item_window(gItemWindowObjectByPlayerId[0]);
+ init_item_window(gItemWindowObjectByPlayerId[1]);
+ init_item_window(gItemWindowObjectByPlayerId[2]);
+ init_item_window(gItemWindowObjectByPlayerId[3]);
+
+ D_8018CA70[0].unknownScaling = D_8018CA70[1].unknownScaling = D_8018CA70[2].unknownScaling = D_8018CA70[3].unknownScaling = 1.5f;
+
D_8018D158 = (s32) gPlayerCount;
D_8018D3C4 = 0x00000014;
D_8018D3BC = 0x00000010;
D_8018D3C0 = 0x0000001E;
D_801657A2 = 0x0888;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_8006E9C0/init_hud_three_four_player.s")
-#endif
diff --git a/src/code_8006E9C0.h b/src/code_8006E9C0.h
index df0984335..0a08563ea 100644
--- a/src/code_8006E9C0.h
+++ b/src/code_8006E9C0.h
@@ -11,6 +11,8 @@ void func_8006ED60(void);
u8 *func_8006ED94(u8*, u8*, u32, u32);
void func_8006EE44(void);
void init_item_window(s32);
+void func_8006EEE8(s32);
+void func_8006F824(s32);
void func_8006FA94(void);
void func_80070148(void);
void func_80070190(void);
@@ -20,6 +22,7 @@ void func_800703E0(s32, s32, StarSpawn*);
void func_800704A0(StarSpawn*);
void func_8007055C(void);
void func_80070714(void);
+void func_80070780();
void init_hud_one_player(void);
void init_hud_two_player_vertical(void);
void init_hud_three_four_player(void);
@@ -27,7 +30,7 @@ void init_hud_two_player_horizontal(void);
extern s16 D_800E5520[];
extern s16 D_800E5548[];
-extern s32 gCourseOutlineTextures[0x14];
+extern u8 *gCourseOutlineTextures[0x14];
extern s8 *gTextureLogoMarioKart64;
extern s16 D_80165730;
@@ -42,6 +45,7 @@ extern intptr_t D_8018D9B0;
extern u8 (*D_8018D220)[1024];
extern s32 D_8018D240;
+extern u8 *D_8018D248[];
extern s16 D_8018D2B0;
extern s16 D_8018D2B8;
extern s32 D_80183DA0;
diff --git a/src/code_800B45E0.c b/src/code_800B45E0.c
index d238f18db..acb30d57c 100644
--- a/src/code_800B45E0.c
+++ b/src/code_800B45E0.c
@@ -840,95 +840,52 @@ u8 func_800B60E8(s32 arg0)
GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B60E8.s")
#endif
-#ifdef MIPS_TO_C
-//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022
s32 func_800B6178(s32 arg0) {
- s32 temp_v0;
- s32 var_s0_2;
s32 var_v0;
- s32 var_v1;
- s8 temp_t0;
- s8 temp_t1;
- s8 temp_t3;
- s8 temp_t4;
- s8 temp_t5;
- s8 temp_t9;
- s8 var_s0;
- s8 var_s0_3;
+ s32 var_s0;
struct_8018EE10_entry *temp_s3;
- struct_8018EE10_entry *var_s1;
- struct_8018EE10_entry *var_s1_2;
- struct_8018EE10_entry *var_s1_3;
- u8 temp_v0_2;
- if ((arg0 != 0) && (arg0 != 1)) {
- return -1;
+ switch (arg0) {
+ case 0:
+ case 1:
+ break;
+ default:
+ return -1;
}
if (gGamestate == 4) {
func_800051C4();
}
temp_s3 = &D_8018EE10[arg0];
temp_s3->ghostDataSaved = 0;
- temp_v0 = func_800B6088(arg0);
- var_v1 = temp_v0;
- if (temp_v0 != 0) {
+ var_v0 = func_800B6088(arg0);
+ if (var_v0 != 0) {
temp_s3->ghostDataSaved = 0;
- var_s0 = 0;
- var_s1 = temp_s3;
- do {
- temp_t9 = var_s0 + 1;
- temp_t0 = var_s0 + 2;
- temp_t1 = var_s0 + 3;
- var_s1->unk_07[0] = var_s0;
- var_s0 += 4;
- var_s1->unk_07[3] = temp_t1;
- var_s1->unk_07[2] = temp_t0;
- var_s1->unk_07[1] = temp_t9;
- var_s1 += 4;
- } while (var_s0 != 0x3C);
+ for (var_s0 = 0; var_s0 < 0x3C; var_s0++) {
+ temp_s3->unk_07[var_s0] = var_s0;
+ }
} else {
var_v0 = osPfsReadWriteFile(&gControllerPak1FileHandle, gControllerPak1FileNote, 1U, (arg0 * 0x3C00) + 0x100, 0x00003C00, (u8 *) D_800DC714);
- var_v1 = var_v0;
if (var_v0 == 0) {
temp_s3->ghostDataSaved = 1;
if (gGamestate == 4) {
temp_s3->courseIndex = (gCupSelection * 4) + gCupCourseSelection;
}
- var_s0_2 = 0;
temp_s3->unk_00 = D_80162DFC;
- var_s1_2 = temp_s3;
temp_s3->characterId = (u8) D_80162DE0;
- do {
- temp_v0_2 = func_800B60E8(var_s0_2);
- var_s0_2 += 1;
- var_s1_2 += 1;
- var_s1_2->characterId = temp_v0_2;
- } while (var_s0_2 != 0x0000003C);
+ for (var_s0 = 0; var_s0 < 0x3C; var_s0++) {
+ temp_s3->unk_07[var_s0] = func_800B60E8(var_s0);
+ }
var_v0 = func_800B6088(arg0);
- var_v1 = var_v0;
}
if (var_v0 != 0) {
temp_s3->ghostDataSaved = 0;
- var_s0_3 = 0;
- var_s1_3 = temp_s3;
- do {
- temp_t3 = var_s0_3 + 1;
- temp_t4 = var_s0_3 + 2;
- temp_t5 = var_s0_3 + 3;
- var_s1_3->unk_07[0] = var_s0_3;
- var_s0_3 += 4;
- var_s1_3->unk_07[3] = temp_t5;
- var_s1_3->unk_07[2] = temp_t4;
- var_s1_3->unk_07[1] = temp_t3;
- var_s1_3 += 4;
- } while (var_s0_3 != 0x3C);
+ for (var_s0 = 0; var_s0 < 0x3C; var_s0++) {
+ temp_s3->unk_07[var_s0] = var_s0;
+ }
}
}
- return var_v1;
+ return var_v0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B6178.s")
-#endif
s32 func_800B6348(s32 arg0) {
if ((D_8018EE10[0].ghostDataSaved != 0) && (arg0 == D_8018EE10[0].courseIndex)) {
@@ -1022,43 +979,36 @@ s32 func_800B64EC(s32 arg0) {
return temp_v0;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022
+#ifdef NON_MATCHING
+// Matching decomp courstesy of Vetri, leaving it as this becasue I'm lazy
+// https://decomp.me/scratch/qrC3l
s32 func_800B65F4(s32 arg0, s32 arg1) {
- s32 sp34;
- s32 temp_v0;
+ s32 stackPadding;
s32 var_s0;
+ s32 temp_v0;
struct_8018EE10_entry *temp_s3;
- struct_8018EE10_entry *var_s1;
- u8 temp_v0_2;
- if ((arg0 != 0) && (arg0 != 1)) {
- return -1;
+ switch (arg0) {
+ case 0:
+ case 1:
+ break;
+ default:
+ return -1;
}
temp_v0 = osPfsReadWriteFile(&gControllerPak2FileHandle, gControllerPak2FileNote, 0U, (arg0 * 0x3C00) + 0x100, 0x00003C00, (u8 *) D_800DC714);
- sp34 = temp_v0;
if (temp_v0 == 0) {
temp_s3 = &D_8018D9C0[arg0];
- var_s1 = temp_s3;
- var_s0 = 0;
-loop_5:
- temp_v0_2 = func_800B60E8(var_s0);
- var_s0 += 1;
- if ((u8) var_s1->unk_07[0] != temp_v0_2) {
- temp_s3->ghostDataSaved = 0;
- return -2;
- }
- var_s1 += 1;
- if (var_s0 == 0x0000003C) {
- D_80162DE0 = (s32) temp_s3->characterId;
- D_80162DFC = temp_s3->unk_00;
- *(&D_8018EE10->courseIndex + (arg1 << 7)) = temp_s3->courseIndex;
- goto block_9;
+ for (var_s0 = 0; var_s0 < 0x3C; var_s0++) {
+ if (temp_s3->unk_07[var_s0] != func_800B60E8(var_s0)) {
+ temp_s3->ghostDataSaved = 0;
+ return -2;
+ }
}
- goto loop_5;
+ D_80162DE0 = temp_s3->characterId;
+ D_80162DFC = temp_s3->unk_00;
+ D_8018EE10[arg1].courseIndex = temp_s3->courseIndex;
}
-block_9:
- return sp34;
+ return temp_v0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B65F4.s")
@@ -1095,7 +1045,7 @@ void func_800B6798(void) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-08-2023
u8 func_800B6828(s32 arg0) {
s32 temp_a2;
s32 temp_lo;
@@ -1130,30 +1080,26 @@ GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B6828.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern s32 D_8018D9C0;
-
-s32 func_800B68F4(s32 arg0) {
+//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-08-2023
+u8 func_800B68F4(s32 arg0) {
s32 temp_a1;
- s32 temp_a2;
s32 temp_a3;
+ s32 var_a1;
+ s32 var_a2;
+ struct_8018EE10_entry *temp_v1;
void *temp_v0;
- void *temp_v1;
- s32 phi_a2;
- s32 phi_a1;
temp_a3 = arg0 + 1;
- temp_v1 = (arg0 << 7) + D_8018D9C0;
- phi_a2 = 3;
- phi_a1 = (temp_v1->unk0 * temp_a3) + (temp_v1->unk1 * temp_a3) + 1 + (temp_v1->unk2 * temp_a3) + 2;
+ temp_v1 = &D_8018D9C0[arg0];
+ var_a2 = 3;
+ var_a1 = (temp_v1->unk0 * temp_a3) + (temp_v1->unk1 * temp_a3) + 1 + (temp_v1->unk2 * temp_a3) + 2;
do {
- temp_v0 = temp_v1 + phi_a2;
- temp_a2 = phi_a2 + 4;
- temp_a1 = phi_a1 + ((temp_v0->unk0 * temp_a3) + phi_a2) + ((temp_v0->unk1 * temp_a3) + phi_a2) + 1 + ((temp_v0->unk2 * temp_a3) + phi_a2) + 2 + ((temp_v0->unk3 * temp_a3) + phi_a2) + 3;
- phi_a2 = temp_a2;
- phi_a1 = temp_a1;
- } while (temp_a2 != 0x43);
- return temp_a1 & 0xFF;
+ temp_v0 = temp_v1 + var_a2;
+ temp_a1 = var_a1 + ((temp_v0->unk0 * temp_a3) + var_a2) + ((temp_v0->unk1 * temp_a3) + var_a2) + 1 + ((temp_v0->unk2 * temp_a3) + var_a2) + 2 + ((temp_v0->unk3 * temp_a3) + var_a2);
+ var_a2 += 4;
+ var_a1 = temp_a1 + 3;
+ } while (var_a2 != 0x43);
+ return var_a1 & 0xFF;
}
#else
GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B68F4.s")
diff --git a/src/racing/actors.h b/src/racing/actors.h
index 9591ec27b..b73dca1b8 100644
--- a/src/racing/actors.h
+++ b/src/racing/actors.h
@@ -120,8 +120,6 @@ extern u16 D_802BA260; // Box Truck sub-type?
// end of definition of actor.c variables
-extern u16 gNearestWaypointByPlayerId[];
-
extern s16 gCurrentCourseId;
extern u16 isCrossingTriggeredByIndex[];
extern Lights1 D_800DC610[];