diff --git a/include/common_structs.h b/include/common_structs.h index 9cbe2e883..acc640d05 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -655,4 +655,85 @@ typedef struct { /* 0x04 */ s32 offset; } struct_8018E118_entry; // size = 0x08 +// Something related to human players +// Also might be used for the camera during the post race screens +typedef struct { + /* 0x00 */ f32 unknownScaling; // Looks to be some type of scaling, unknown use + /* 0x04 */ f32 rankScaling; // Scaling done on the rank text in the bottom left corner of the screen + // All time measurements are in centiseconds + /* 0x08 */ u32 someTimer; // The someTimers seem to always have the same value, the total time since race start + /* 0x0C */ u32 someTimer1; + /* 0x10 */ u32 timeLastTouchedFinishLine; // Sum of time of all completed laps + // Times at which each lap was completed + /* 0x14 */ u32 lap1CompletionTime; + /* 0x18 */ u32 lap2CompletionTime; + /* 0x1C */ u32 lap3CompletionTime; + // Time each lap took to complete + /* 0x20 */ u32 lap1Duration; + /* 0x24 */ u32 lap2Duration; + /* 0x28 */ u32 lap3Duration; + // Integer parts of the player's X/Y/X coordinates + /* 0x2C */ s32 posXInt; + /* 0x30 */ s32 posYInt; + /* 0x34 */ s32 posZInt; + /* 0x38 */ s32 unk_38; + // Timer for how long the on screen should blink on lap completion + // Blinking occurs as long as this is a non-zero value. + // Other on screen effects may override the blinking + /* 0x3C */ s16 blinkTimer; + /* 0x3E */ s16 speedometerX; + /* 0x40 */ s16 speedometerY; + /* 0x42 */ s16 itemBoxX; + /* 0x44 */ s16 itemBoxY; + /* 0x46 */ s16 slideItemBoxX; + /* 0x48 */ s16 slideItemBoxY; + // These 2 s16's have values, but I have yet to identify any places that read them + /* 0x4A */ s16 unk_4A; + /* 0x4C */ s16 unk_4C; + /* 0x4E */ s16 timerX; // X coordinate of the on screen timer + // These 4 X coordinates are "slide" values + /* 0x50 */ s16 lap1CompletionTimeX; // Pulls double-duty as timerAfterImage1X + /* 0x52 */ s16 lap2CompletionTimeX; // Pulls double-duty as timerAfterImage2X + /* 0x54 */ s16 lap3CompletionTimeX; + /* 0x56 */ s16 totalTimeX; + /* 0x58 */ s16 timerY; // Y coordinate of the on screen timer (used as Y coordinate for lap completion times in post-race screen) + /* 0x5A */ s16 lapX; // X coordinate of the on screen lap counter + // 0x5C and 0x5E seem to be relative to lapX + /* 0x5C */ s16 lapAfterImage1X; + /* 0x5E */ s16 lapAfterImage2X; + /* 0x60 */ s16 lapY; // Y coordinate of the on screen lap counter + /* 0x62 */ s16 rankX; // X coordinate of the on screen rank indicator + /* 0x64 */ s16 rankY; // Y coordinate of the on screen rank indicator + /* 0x66 */ s16 slideRankX; // Adds with the other rankX, used during post race screen to make the rank "slide" into place + /* 0x68 */ s16 slideRankY; // Adds with the other rankY, used during post race screen to make the rank "slide" into place + /* 0x6A */ s16 stagingPosition; // Position to take during race staging + // These s16's occasionally have values, but I have yet to identify any places that read them + // They appear to have values when in 3/4 player split screen mode, otherwise they're 0 + /* 0x6C */ s16 unk_6C; + /* 0x6E */ s16 unk_6E; + /* 0x70 */ s8 raceCompleteBool; // Indicates if race is over? + /* 0x71 */ s8 lapCount; // This increases to 3 when a race is over, while alsoLapCount stays at 2 + /* 0x72 */ s8 alsoLapCount; + // Related to the timer blinking on lap completion + // If blinkTimer is counting down: + // 0: Show timer + // 1: Hide timer + // 2: ? Seems to be a transition state, never lasts a long enough for blinkTimer to tick + /* 0x73 */ s8 blinkState; + /* 0x74 */ s8 unk_74; + /* 0x75 */ s8 unk_75; + /* 0x76 */ s16 itemOverride; // Something related to item generation. If non-zero, it determines the item you get + // 0x78 to 0x7F appear to be some type of "state" trackers for the lap and timer text during a race start + // When a race starts those texts (and their afterimages) slide in and "bounce" a bit. These states control the bouncing (somehow) + /* 0x78 */ s8 unk_78; + /* 0x79 */ s8 unk_79; + /* 0x7A */ s8 unk_7A; + /* 0x7B */ s8 unk_7B; + /* 0x7C */ s8 unk_7C; + /* 0x7D */ s8 unk_7D; + /* 0x7E */ s8 unk_7E; + /* 0x7F */ s8 unk_7F; + /* 0x80 */ s32 unk_80; +} struct_8018CA70_entry; // size = 0x84 + #endif diff --git a/include/variables.h b/include/variables.h index b375dd5b1..b7270131e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -92,6 +92,8 @@ extern Player* gPlayerOneCopy; extern SaveData D_8018EB90; +extern struct_8018CA70_entry D_8018CA70[]; + extern Mtx D_80183D60[]; extern struct_D_8018CE10 D_8018CE10[]; diff --git a/src/code_800431B0.c b/src/code_800431B0.c index f63a742ee..27a83d364 100644 --- a/src/code_800431B0.c +++ b/src/code_800431B0.c @@ -5008,20 +5008,19 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004E4CC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8004E4CC(s32, s32, s32, s32); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_8004E4CC(s32, s32, s32, s32); /* extern */ extern ? D_80165C18; extern ? D_80183E88; -extern ? D_8018CA70; -void func_8004E638(s32 arg0) { - void *temp_v0; +void func_8004E638(s32 playerId) { + struct_8018CA70_entry *temp_v0; void *temp_v1; - temp_v1 = (*(&D_80183E88 + (arg0 * 4)) * 0xE0) + &D_80165C18; - if (temp_v1->unkA6 >= 2) { - temp_v0 = (arg0 * 0x84) + &D_8018CA70; - func_8004E4CC(temp_v0->unk46 + temp_v0->unk42, temp_v0->unk48 + temp_v0->unk44, temp_v1->unk60, temp_v1->unk64); + temp_v1 = (*(&D_80183E88 + (playerId * 4)) * 0xE0) + &D_80165C18; + if ((s32) temp_v1->unkA6 >= 2) { + temp_v0 = &D_8018CA70[playerId]; + func_8004E4CC(temp_v0->slideItemBoxX + temp_v0->itemBoxX, temp_v0->slideItemBoxY + temp_v0->itemBoxY, temp_v1->unk60, temp_v1->unk64); } } #else @@ -5029,21 +5028,20 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004E638.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80047910(s32, s32, ?, s32, s32, s32, ? *, s32, s32, s32, s32); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_80047910(s32, s32, ?, f32, s32, s32, ? *, s32, s32, s32, s32); /* extern */ extern ? D_0D005C30; extern ? D_80165C18; extern ? D_80183E88; -extern ? D_8018CA70; -void func_8004E6C4(s32 arg0) { - void *temp_v0; +void func_8004E6C4(s32 playerId) { + struct_8018CA70_entry *temp_v0; void *temp_v1; - temp_v1 = (*(&D_80183E88 + (arg0 * 4)) * 0xE0) + &D_80165C18; - if (temp_v1->unkA6 >= 2) { - temp_v0 = (arg0 * 0x84) + &D_8018CA70; - func_80047910(temp_v0->unk46 + temp_v0->unk42, temp_v0->unk48 + temp_v0->unk44, 0, temp_v0->unk0, temp_v1->unk60, temp_v1->unk64, &D_0D005C30, 0x28, 0x20, 0x28, 0x20); + temp_v1 = (*(&D_80183E88 + (playerId * 4)) * 0xE0) + &D_80165C18; + if ((s32) temp_v1->unkA6 >= 2) { + temp_v0 = &D_8018CA70[playerId]; + func_80047910(temp_v0->slideItemBoxX + temp_v0->itemBoxX, temp_v0->slideItemBoxY + temp_v0->itemBoxY, 0, temp_v0->unknownScaling, temp_v1->unk60, temp_v1->unk64, &D_0D005C30, 0x28, 0x20, 0x28, 0x20); } } #else @@ -5051,49 +5049,49 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004E6C4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8004CB60(s16, s32, ? *); // extern -? func_8004CB90(s32, s16, s32); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_8004CB60(s16, s32, ? *); /* extern */ +? func_8004CB90(s32, s16, ? *); /* extern */ extern ? D_0D00A958; -extern ? D_800E4570; -extern ? D_8018CA70; +extern ? D_0D00B158; +extern ? D_0D00B558; +extern ? D_0D00B958; +static ? *D_800E4570[3] = { &D_0D00B158, &D_0D00B558, &D_0D00B958 }; /* const */ -void func_8004E78C(s32 arg0) { - void *sp1C; - void *temp_v0; +void func_8004E78C(s32 playerId) { + struct_8018CA70_entry *sp1C; + struct_8018CA70_entry *temp_v0; - temp_v0 = (arg0 * 0x84) + &D_8018CA70; + temp_v0 = &D_8018CA70[playerId]; sp1C = temp_v0; - func_8004CB60(temp_v0->unk5A, temp_v0->unk60 + 3, &D_0D00A958); - func_8004CB90(temp_v0->unk5A + 0x1C, temp_v0->unk60, *(&D_800E4570 + (temp_v0->unk72 * 4))); + func_8004CB60(temp_v0->lapX, temp_v0->lapY + 3, &D_0D00A958); + func_8004CB90(temp_v0->lapX + 0x1C, temp_v0->lapY, D_800E4570[temp_v0->alsoLapCount]); } #else GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004E78C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8004A384(s32, s32, ?, s32, s32, s32, s32, s32, void *, ? *, s32, s32, s32, s32); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_8004A384(s32, s32, ?, f32, s32, s32, s32, s32, void *, ? *, s32, s32, s32, s32); /* extern */ extern ? D_0D0068F0; extern ? D_0D00D258; -extern ? D_800E55F8; extern s32 D_80165594; -extern ? D_8018CA70; extern ? D_8018CF98; +static s32 D_800E55F8[8] = { 0xFF, 0xED, 0xD7, 0xBF, 0xA2, 0x82, 0x61, 0x3A }; /* const */ -void func_8004E800(s32 arg0) { +void func_8004E800(s32 playerId) { s16 temp_v1; - void *temp_v0; + struct_8018CA70_entry *temp_v0; - temp_v0 = (arg0 * 0x84) + &D_8018CA70; + temp_v0 = &D_8018CA70[playerId]; if (temp_v0->unk81 != 0) { - if (temp_v0->unk71 != 3) { - temp_v1 = *(&D_8018CF98 + (arg0 * 2)); - func_8004A384(temp_v0->unk66 + temp_v0->unk62, temp_v0->unk68 + temp_v0->unk64, 0, temp_v0->unk4, 0xFF, *(&D_800E55F8 + (temp_v1 * 4)), 0, 0xFF, (temp_v1 << 0xC) + &D_0D00D258, &D_0D0068F0, 0x80, 0x40, 0x80, 0x40); + if (temp_v0->lapCount != 3) { + temp_v1 = *(&D_8018CF98 + (playerId * 2)); + func_8004A384(temp_v0->slideRankX + temp_v0->rankX, temp_v0->slideRankY + temp_v0->rankY, 0, temp_v0->rankScaling, 0xFF, D_800E55F8[temp_v1], 0, 0xFF, (temp_v1 << 0xC) + &D_0D00D258, &D_0D0068F0, 0x80, 0x40, 0x80, 0x40); return; } - func_8004A384(temp_v0->unk66 + temp_v0->unk62, temp_v0->unk68 + temp_v0->unk64, 0, temp_v0->unk4, 0xFF, *(&D_800E55F8 + (D_80165594 * 4)), 0, 0xFF, (gPlayerPositions[arg0] << 0xC) + &D_0D00D258, &D_0D0068F0, 0x80, 0x40, 0x80, 0x40); - // Duplicate return node #4. Try simplifying control flow for better match + func_8004A384(temp_v0->slideRankX + temp_v0->rankX, temp_v0->slideRankY + temp_v0->rankY, 0, temp_v0->rankScaling, 0xFF, D_800E55F8[D_80165594], 0, 0xFF, (gPlayerPositions[playerId] << 0xC) + &D_0D00D258, &D_0D0068F0, 0x80, 0x40, 0x80, 0x40); } } #else @@ -5101,27 +5099,25 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004E800.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8004A384(s32, s32, ?, s32, s32, s32, s32, s32, void *, ? *, s32, s32, s32, s32); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_8004A384(s32, s32, ?, f32, s32, s32, s32, s32, void *, ? *, s32, s32, s32, s32); /* extern */ extern ? D_0D006030; extern ? D_0D015258; -extern ? D_800E5618; extern s32 D_80165598; -extern ? D_8018CA70; +static s32 D_800E5618[4] = { 0xFF, 0xD7, 0xA2, 0x61 }; /* const */ -void func_8004E998(s32 arg0) { +void func_8004E998(s32 playerId) { s32 temp_v1; - void *temp_v0; + struct_8018CA70_entry *temp_v0; - temp_v0 = (arg0 * 0x84) + &D_8018CA70; + temp_v0 = &D_8018CA70[playerId]; if (temp_v0->unk81 != 0) { - if (temp_v0->unk71 != 3) { - temp_v1 = gPlayerPositions[arg0]; - func_8004A384(temp_v0->unk66 + temp_v0->unk62, temp_v0->unk68 + temp_v0->unk64, 0, temp_v0->unk4, 0xFF, *(&D_800E5618 + (temp_v1 * 4)), 0, 0xFF, (temp_v1 << 0xB) + &D_0D015258, &D_0D006030, 0x40, 0x40, 0x40, 0x40); + if (temp_v0->lapCount != 3) { + temp_v1 = gPlayerPositions[playerId]; + func_8004A384(temp_v0->slideRankX + temp_v0->rankX, temp_v0->slideRankY + temp_v0->rankY, 0, temp_v0->rankScaling, 0xFF, D_800E5618[temp_v1], 0, 0xFF, (temp_v1 << 0xB) + &D_0D015258, &D_0D006030, 0x40, 0x40, 0x40, 0x40); return; } - func_8004A384(temp_v0->unk66 + temp_v0->unk62, temp_v0->unk68 + temp_v0->unk64, 0, temp_v0->unk4, 0xFF, *(&D_800E5618 + (D_80165598 * 4)), 0, 0xFF, (gPlayerPositions[arg0] << 0xB) + &D_0D015258, &D_0D006030, 0x40, 0x40, 0x40, 0x40); - // Duplicate return node #4. Try simplifying control flow for better match + func_8004A384(temp_v0->slideRankX + temp_v0->rankX, temp_v0->slideRankY + temp_v0->rankY, 0, temp_v0->rankScaling, 0xFF, D_800E5618[D_80165598], 0, 0xFF, (gPlayerPositions[playerId] << 0xB) + &D_0D015258, &D_0D006030, 0x40, 0x40, 0x40, 0x40); } } #else @@ -5138,33 +5134,35 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004EB30.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8004C9D8(s16, s16, ?, ? *, s32, s32, s32, s32); // extern -? func_8004F950(s16, s16, ?, s32); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_8004C9D8(s16, s16, ?, ? *, s32, s32, s32, s32); /* extern */ +? func_8004F950(s16, s16, ?, u32); /* extern */ extern ? D_0D00A958; +extern ? D_0D00B158; +extern ? D_0D00B558; +extern ? D_0D00B958; extern ? D_0D00C158; -extern ? D_800E4570; -extern ? D_8018CA70; +static ? *D_800E4570[3] = { &D_0D00B158, &D_0D00B558, &D_0D00B958 }; /* const */ -void func_8004EB38(s32 arg0) { - void *temp_s0; +void func_8004EB38(s32 playerId) { + struct_8018CA70_entry *temp_s0; - temp_s0 = (arg0 * 0x84) + &D_8018CA70; - if (temp_s0->unk7B != 0) { - func_8004C9D8(temp_s0->unk50 - 0x13, temp_s0->unk58 + 8, 0x80, &D_0D00C158, 0x20, 0x10, 0x20, 0x10); - func_8004F950(temp_s0->unk50, temp_s0->unk58, 0x80, temp_s0->unk8); + temp_s0 = &D_8018CA70[playerId]; + if ((u8) temp_s0->unk_7B != 0) { + func_8004C9D8(temp_s0->lap1CompletionTimeX - 0x13, temp_s0->timerY + 8, 0x80, &D_0D00C158, 0x20, 0x10, 0x20, 0x10); + func_8004F950(temp_s0->lap1CompletionTimeX, temp_s0->timerY, 0x80, temp_s0->someTimer); } - if (temp_s0->unk7C != 0) { - func_8004C9D8(temp_s0->unk52 - 0x13, temp_s0->unk58 + 8, 0x50, &D_0D00C158, 0x20, 0x10, 0x20, 0x10); - func_8004F950(temp_s0->unk52, temp_s0->unk58, 0x50, temp_s0->unk8); + if ((u8) temp_s0->unk_7C != 0) { + func_8004C9D8(temp_s0->lap2CompletionTimeX - 0x13, temp_s0->timerY + 8, 0x50, &D_0D00C158, 0x20, 0x10, 0x20, 0x10); + func_8004F950(temp_s0->lap2CompletionTimeX, temp_s0->timerY, 0x50, temp_s0->someTimer); } - if (temp_s0->unk7E != 0) { - func_8004C9D8(temp_s0->unk5C, temp_s0->unk60 + 3, 0x80, &D_0D00A958, 0x20, 8, 0x20, 8); - func_8004C9D8(temp_s0->unk5C + 0x1C, temp_s0->unk60, 0x80, *(&D_800E4570 + (temp_s0->unk72 * 4)), 0x20, 0x10, 0x20, 0x10); + if ((u8) temp_s0->unk_7E != 0) { + func_8004C9D8(temp_s0->lapAfterImage1X, temp_s0->lapY + 3, 0x80, &D_0D00A958, 0x20, 8, 0x20, 8); + func_8004C9D8(temp_s0->lapAfterImage1X + 0x1C, temp_s0->lapY, 0x80, D_800E4570[temp_s0->alsoLapCount], 0x20, 0x10, 0x20, 0x10); } - if (temp_s0->unk7F != 0) { - func_8004C9D8(temp_s0->unk5E, temp_s0->unk60 + 3, 0x50, &D_0D00A958, 0x20, 8, 0x20, 8); - func_8004C9D8(temp_s0->unk5E + 0x1C, temp_s0->unk60, 0x50, *(&D_800E4570 + (temp_s0->unk72 * 4)), 0x20, 0x10, 0x20, 0x10); + if ((u8) temp_s0->unk_7F != 0) { + func_8004C9D8(temp_s0->lapAfterImage2X, temp_s0->lapY + 3, 0x50, &D_0D00A958, 0x20, 8, 0x20, 8); + func_8004C9D8(temp_s0->lapAfterImage2X + 0x1C, temp_s0->lapY, 0x50, D_800E4570[temp_s0->alsoLapCount], 0x20, 0x10, 0x20, 0x10); } } #else @@ -5172,27 +5170,26 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004EB38.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8004A258(s32, s32, u16, ?, ? *, ? *, s32, s32, s32, s32); // extern -? func_8004A2F4(s16, s16, ?, ?, s32, s32, s32, s32, ? *, ? *, s32, s32, s32, s32); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_8004A258(s32, s32, u16, ?, ? *, ? *, s32, s32, s32, s32); /* extern */ +? func_8004A2F4(s16, s16, ?, ?, s32, s32, s32, s32, ? *, ? *, s32, s32, s32, s32); /* extern */ extern ? D_0D005FF0; extern ? D_0D0064B0; extern ? D_0D009958; extern ? D_0D00A558; extern u16 D_8016579E; -extern ? D_8018CA70; extern f32 D_8018CFEC; extern f32 D_8018CFF4; extern u16 D_8018D300; extern u16 D_8018D308; extern u16 D_8018D310; -void func_8004ED40(s32 arg0) { - void *temp_v0; +void func_8004ED40(s32 playerId) { + struct_8018CA70_entry *temp_v0; - temp_v0 = (arg0 * 0x84) + &D_8018CA70; - func_8004A2F4(temp_v0->unk3E, temp_v0->unk40, 0, 0x3F800000, D_8018D300, D_8018D308, D_8018D310, 0xFF, &D_0D009958, &D_0D0064B0, 0x40, 0x60, 0x40, 0x30); - func_8004A258(D_8018CFEC, D_8018CFF4, D_8016579E, 0x3F800000, &D_0D00A558, &D_0D005FF0, 0x40, 0x20, 0x40, 0x20); + temp_v0 = &D_8018CA70[playerId]; + func_8004A2F4(temp_v0->speedometerX, temp_v0->speedometerY, 0, 0x3F800000, (s32) D_8018D300, (s32) D_8018D308, (s32) D_8018D310, 0xFF, &D_0D009958, &D_0D0064B0, 0x40, 0x60, 0x40, 0x30); + func_8004A258((s32) D_8018CFEC, (s32) D_8018CFF4, D_8016579E, 0x3F800000, &D_0D00A558, &D_0D005FF0, 0x40, 0x20, 0x40, 0x20); } #else GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004ED40.s") @@ -5666,31 +5663,30 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004F9CC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8004CB90(s32, s32, ? *); // extern -? func_8004F9CC(s16, s16, s32); // extern -? print_timer(s16, s16, s32); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_8004CB90(s32, s32, ? *); /* extern */ +? func_8004F9CC(s16, s16, u32); /* extern */ +? print_timer(s16, s16, u32); /* extern */ extern ? D_0D00BD58; extern ? D_0D00C158; extern s32 D_80165658; extern s8 D_801657E3; extern s8 D_801657E5; -extern ? D_8018CA70; extern s32 D_8018D320; -void func_8004FA78(s32 arg0) { +void func_8004FA78(s32 playerId) { s32 temp_s0; s32 temp_v0; - void *temp_s4; + struct_8018CA70_entry *temp_s4; s32 *phi_s3; - void *phi_s1; + struct_8018CA70_entry *phi_s1; s32 phi_s0; - void *phi_s2; + struct_8018CA70_entry *phi_s2; temp_v0 = gModeSelection; - if ((temp_v0 != VERSUS) && (temp_v0 != BATTLE)) { - temp_s4 = (arg0 * 0x84) + &D_8018CA70; - if (D_8018D320 == temp_s4->unk71) { + if ((temp_v0 != 2) && (temp_v0 != 3)) { + temp_s4 = &D_8018CA70[playerId]; + if (D_8018D320 == temp_s4->lapCount) { phi_s3 = &D_80165658; phi_s1 = temp_s4; if (D_8015F890 == 0) { @@ -5698,9 +5694,9 @@ void func_8004FA78(s32 arg0) { phi_s2 = temp_s4; do { if (*phi_s3 == 0) { - print_timer(phi_s1->unk50, temp_s4->unk58 + phi_s0, phi_s2->unk20); + print_timer(phi_s1->lap1CompletionTimeX, temp_s4->timerY + phi_s0, phi_s2->lap1Duration); } else { - func_8004F9CC(phi_s1->unk50, temp_s4->unk58 + phi_s0, phi_s2->unk20); + func_8004F9CC(phi_s1->lap1CompletionTimeX, temp_s4->timerY + phi_s0, phi_s2->lap1Duration); } temp_s0 = phi_s0 + 0x10; phi_s3 += 4; @@ -5708,31 +5704,28 @@ void func_8004FA78(s32 arg0) { phi_s0 = temp_s0; phi_s2 += 4; } while (temp_s0 != 0x30); - func_8004CB90(temp_s4->unk56 - 0x13, temp_s4->unk58 + 0x38, &D_0D00BD58); + func_8004CB90(temp_s4->totalTimeX - 0x13, temp_s4->timerY + 0x38, &D_0D00BD58); if (D_801657E5 != 0) { - func_8004F9CC(temp_s4->unk56, temp_s4->unk58 + 0x30, temp_s4->unk8); + func_8004F9CC(temp_s4->totalTimeX, temp_s4->timerY + 0x30, temp_s4->someTimer); return; } - print_timer(temp_s4->unk56, temp_s4->unk58 + 0x30, temp_s4->unk8); + print_timer(temp_s4->totalTimeX, temp_s4->timerY + 0x30, temp_s4->someTimer); + } + } else { + if (temp_s4->blinkTimer == 0) { + func_8004CB90(temp_s4->timerX - 0x13, temp_s4->timerY + 8, &D_0D00C158); + print_timer(temp_s4->timerX, temp_s4->timerY, temp_s4->someTimer); return; } - // Duplicate return node #18. Try simplifying control flow for better match - return; + func_8004CB90(temp_s4->timerX - 0x13, temp_s4->timerY + 8, (? *)0x0D00AD58); + if (D_801657E3 != 0) { + func_8004F9CC(temp_s4->timerX, temp_s4->timerY, temp_s4->someTimer1); + return; + } + if (temp_s4->blinkState == 0) { + print_timer(temp_s4->timerX, temp_s4->timerY, temp_s4->someTimer1); + } } - if (temp_s4->unk3C == 0) { - func_8004CB90(temp_s4->unk4E - 0x13, temp_s4->unk58 + 8, &D_0D00C158); - print_timer(temp_s4->unk4E, temp_s4->unk58, temp_s4->unk8); - return; - } - func_8004CB90(temp_s4->unk4E - 0x13, temp_s4->unk58 + 8, 0xD00AD58); - if (D_801657E3 != 0) { - func_8004F9CC(temp_s4->unk4E, temp_s4->unk58, temp_s4->unkC); - return; - } - if (temp_s4->unk73 == 0) { - print_timer(temp_s4->unk4E, temp_s4->unk58, temp_s4->unkC); - } - // Duplicate return node #18. Try simplifying control flow for better match } } #else diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 9936d42fe..e47484528 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -721,20 +721,20 @@ void func_80059358(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -//? func_8004CB60(s16, s16, ? *); // extern -//? func_8004E638(?); // extern -//? func_8004FA78(?); // extern -//? func_8004FC78(s16, s16, s8); // extern -extern s8 D_0D00A958; -extern s32 D_8018CA70; +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_8004CB60(s16, s16, ? *); /* extern */ +? func_8004E638(?); /* extern */ +? func_8004FA78(?); /* extern */ +? func_8004FC78(s16, s16, s8); /* extern */ +extern ? D_0D00A958; +extern s8 D_801657B0; void func_80059360(void) { if (D_801657B0 == 0) { func_8004FA78(0); - if (D_8018CA70.unk71 != 3) { - func_8004CB60(D_8018CA70.unk5A, D_8018CA70.unk60, &D_0D00A958); - func_8004FC78(D_8018CA70.unk5A + 0xC, D_8018CA70.unk60 - 4, D_8018CA70.unk72); + if (D_8018CA70->lapCount != 3) { + func_8004CB60(D_8018CA70->lapX, D_8018CA70->lapY, &D_0D00A958); + func_8004FC78((s16) (D_8018CA70->lapX + 0xC), (s16) (D_8018CA70->lapY - 4), D_8018CA70->alsoLapCount); func_8004E638(0); } } @@ -805,11 +805,11 @@ void func_80059530(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80047910(s16, s16, ?, ?, ? *, ? *, ? *, s32, s32, s32, s32); // extern -? func_8004CB60(s16, s16, ? *); // extern -? func_8004E6C4(s32); // extern -? func_8004FC78(s16, s16, s8); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_80047910(s16, s16, ?, ?, ? *, ? *, ? *, s32, s32, s32, s32); /* extern */ +? func_8004CB60(s16, s16, ? *); /* extern */ +? func_8004E6C4(s32); /* extern */ +? func_8004FC78(s16, s16, s8); /* extern */ extern ? D_0D005AE0; extern ? D_0D00A958; extern ? D_0D01B4D8; @@ -817,29 +817,28 @@ extern ? D_0D01D6D8; extern s32 D_80165608; extern s8 D_801657E4; extern s8 D_801657F8; -extern ? D_8018CA70; extern s32 D_8018D188; -void func_80059560(s32 arg0) { - void *sp3C; - void *temp_v0; - void *temp_v0_2; +void func_80059560(s32 playerId) { + struct_8018CA70_entry *sp3C; + struct_8018CA70_entry *temp_v0; + struct_8018CA70_entry *temp_v0_2; - if (gModeSelection != BATTLE) { + if (gModeSelection != 3) { if ((D_801657F8 != 0) && (D_8018D188 != 0)) { - temp_v0 = (arg0 * 0x84) + &D_8018CA70; + temp_v0 = &D_8018CA70[playerId]; sp3C = temp_v0; - func_8004CB60(temp_v0->unk5A, temp_v0->unk60, &D_0D00A958); - func_8004FC78(temp_v0->unk5A - 0xC, temp_v0->unk60 + 4, temp_v0->unk72); + func_8004CB60(temp_v0->lapX, temp_v0->lapY, &D_0D00A958); + func_8004FC78((s16) (temp_v0->lapX - 0xC), (s16) (temp_v0->lapY + 4), temp_v0->alsoLapCount); } if (D_801657E4 == 2) { - temp_v0_2 = (arg0 * 0x84) + &D_8018CA70; - if ((temp_v0_2->unk74 != 0) && (D_80165608 != 0)) { - func_80047910(temp_v0_2->unk6C, temp_v0_2->unk6E, 0, 0x3F800000, &D_0D01B4D8, &D_0D01D6D8, &D_0D005AE0, 0x20, 0x20, 0x20, 0x20); + temp_v0_2 = &D_8018CA70[playerId]; + if ((temp_v0_2->unk_74 != 0) && (D_80165608 != 0)) { + func_80047910(temp_v0_2->unk_6C, temp_v0_2->unk_6E, 0, 0x3F800000, &D_0D01B4D8, &D_0D01D6D8, &D_0D005AE0, 0x20, 0x20, 0x20, 0x20); } } } - func_8004E6C4(arg0); + func_8004E6C4(playerId); } #else GLOBAL_ASM("asm/non_matchings/code_80057C60/func_80059560.s") @@ -908,25 +907,21 @@ void func_800597E8(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -//extern ? D_8018CA70; -extern s32 D_8018CF14; -extern Player *gPlayerOne; +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +extern Camera *D_8018CF14; extern Player *D_8018CF1C; -extern Camera *camera1; -extern s8 D_8018CA70; -void func_80059820(s32 arg0) { +void func_80059820(s32 playerId) { Player *temp_v1; - Camera *temp_v0; + struct_8018CA70_entry *temp_v0; - D_8018CF1C = gPlayerOne; //&gPlayerOne[arg0]; - D_8018CF14 = camera1->unk27 * arg0; //(arg0 * 0xB8) + camera1; + D_8018CF1C = &gPlayerOne[playerId]; + D_8018CF14 = &camera1[playerId]; temp_v1 = D_8018CF1C; - temp_v0 = (arg0 * 0x84) + &D_8018CA70; - temp_v0->unk2C = temp_v1->posX; - temp_v0->unk30 = temp_v1->posY; - temp_v0->unk34 = temp_v1->posZ; + temp_v0 = &D_8018CA70[playerId]; + temp_v0->posXInt = (s32) temp_v1->posX; + temp_v0->posYInt = (s32) temp_v1->posY; + temp_v0->posZInt = (s32) temp_v1->posZ; } #else GLOBAL_ASM("asm/non_matchings/code_80057C60/func_80059820.s") @@ -955,14 +950,13 @@ void func_8005994C(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 extern s8 D_80165890; -extern ? D_8018CA70; void func_8005995C(void) { s32 temp_v1; - void *temp_a0; - void *temp_a0_2; + struct_8018CA70_entry *temp_a0; + struct_8018CA70_entry *temp_a0_2; void *temp_v0; Player *phi_v0; s32 phi_v1; @@ -972,25 +966,25 @@ void func_8005995C(void) { do { if ((D_80165890 != 0) && ((phi_v0->unk_000 & 0x100) != 0)) { phi_v0->unk_010 = 0xC; - (&D_8018CA70 + (phi_v1 * 0x84))->unk75 = 2; + D_8018CA70[phi_v1].unk_75 = 2; } if (((phi_v0->unk_000 & 0x100) != 0) && (phi_v0->unk_010 == 0)) { - temp_a0 = &D_8018CA70 + (phi_v1 * 0x84); - if (temp_a0->unk75 != 0) { + temp_a0 = &D_8018CA70[phi_v1]; + if (temp_a0->unk_75 != 0) { phi_v0->unk_010 = 0xC; - temp_a0->unk75 = temp_a0->unk75 - 1; + temp_a0->unk_75 += -1; } } temp_v0 = phi_v0 + 0xDD8; if ((D_80165890 != 0) && ((temp_v0->unk0 & 0x100) != 0)) { temp_v0->unk10 = 0xC; - (&D_8018CA70 + (phi_v1 * 0x84))->unkF9 = 2; + D_8018CA70[phi_v1].unkF9 = 2; } if (((temp_v0->unk0 & 0x100) != 0) && (temp_v0->unk10 == 0)) { - temp_a0_2 = &D_8018CA70 + (phi_v1 * 0x84); + temp_a0_2 = &D_8018CA70[phi_v1]; if (temp_a0_2->unkF9 != 0) { temp_v0->unk10 = 0xC; - temp_a0_2->unkF9 = temp_a0_2->unkF9 - 1; + temp_a0_2->unkF9 = (s8) (temp_a0_2->unkF9 - 1); } } temp_v1 = phi_v1 + 2; @@ -1631,9 +1625,10 @@ void func_8005AB20(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 s32 func_80041288(? *, ?, ?); /* extern */ -extern ? D_8018CA70; +extern s16 D_8016579E; +extern u8 D_801657E7; extern ? D_8018CAAE; extern ? D_8018CAB0; extern ? D_8018CAB8; @@ -1643,7 +1638,9 @@ extern ? D_8018CAC2; extern ? D_8018CACA; extern ? D_8018CACC; extern ? D_8018CACE; -static ? D_800E55B0; /* unable to generate initializer; const */ +extern f32 D_8018CFEC; +extern f32 D_8018CFF4; +static u16 D_800E55B0[0]; /* unable to generate initializer; const */ void func_8005AB60(void) { s32 temp_v0_2; @@ -1658,371 +1655,364 @@ void func_8005AB60(void) { u8 temp_t8_2; u8 temp_v0; - temp_t6 = D_8018CA70.unk78; + temp_t6 = (u8) D_8018CA70->unk_78; switch (temp_t6) { /* switch 1 */ case 1: /* switch 1 */ func_80041288(&D_8018CAAE, 0x106, 0x10); if (func_80041288(&D_8018CAB0, 0xB6, 0x10) != 0) { - D_8018CA70.unk79 = 1; - D_8018CA70.unk78 = D_8018CA70.unk78 + 1; + D_8018CA70->unk_79 = 1; + D_8018CA70->unk_78 = (u8) D_8018CA70->unk_78 + 1; } break; case 2: /* switch 1 */ func_80041288(&D_8018CAAE, 0x116, 4); if (func_80041288(&D_8018CAB0, 0xC6, 4) != 0) { - D_8018CA70.unk78 = D_8018CA70.unk78 + 1; + D_8018CA70->unk_78 = (u8) D_8018CA70->unk_78 + 1; } break; case 3: /* switch 1 */ func_80041288(&D_8018CAAE, 0x106, 4); if (func_80041288(&D_8018CAB0, 0xB6, 4) != 0) { - D_8018CA70.unk78 = D_8018CA70.unk78 + 1; + D_8018CA70->unk_78 = (u8) D_8018CA70->unk_78 + 1; } break; case 4: /* switch 1 */ func_80041288(&D_8018CAAE, 0x10E, 4); if (func_80041288(&D_8018CAB0, 0xBE, 4) != 0) { - D_8018CA70.unk78 = D_8018CA70.unk78 + 1; + D_8018CA70->unk_78 = (u8) D_8018CA70->unk_78 + 1; } break; case 5: /* switch 1 */ func_80041288(&D_8018CAAE, 0x106, 4); if (func_80041288(&D_8018CAB0, 0xB6, 4) != 0) { - D_8018CA70.unk78 = D_8018CA70.unk78 + 1; + D_8018CA70->unk_78 = (u8) D_8018CA70->unk_78 + 1; } break; case 6: /* switch 1 */ func_80041288(&D_8018CAAE, 0x10A, 2); if (func_80041288(&D_8018CAB0, 0xBA, 2) != 0) { - D_8018CA70.unk78 = D_8018CA70.unk78 + 1; + D_8018CA70->unk_78 = (u8) D_8018CA70->unk_78 + 1; } break; case 7: /* switch 1 */ func_80041288(&D_8018CAAE, 0x106, 2); if (func_80041288(&D_8018CAB0, 0xB6, 2) != 0) { - D_8018CA70.unk78 = D_8018CA70.unk78 + 1; + D_8018CA70->unk_78 = (u8) D_8018CA70->unk_78 + 1; } break; case 8: /* switch 1 */ - D_8018CA70.unk78 = 0; + D_8018CA70->unk_78 = 0; break; } - temp_v0 = D_8018CA70.unk79; + temp_v0 = (u8) D_8018CA70->unk_79; if ((temp_v0 != 0) && (temp_v0 == 1)) { temp_t3 = D_801657E7 + 1; temp_v0_2 = temp_t3 & 0xFF; D_801657E7 = temp_t3; if (temp_v0_2 >= 0x10) { D_801657E7 = 0; - D_8016579E = -0x2300; - D_8018CA70.unk79 = 0; + D_8016579E = 0xDD00; + D_8018CA70->unk_79 = 0; } else { - D_8016579E = *(&D_800E55B0 + (temp_v0_2 * 2)) + 0xDD00; + D_8016579E = D_800E55B0[temp_v0_2] + 0xDD00; } } - temp_t8 = D_8018CA70.unk80; + temp_t8 = D_8018CA70->unk80; switch (temp_t8) { /* switch 2 */ case 1: /* switch 2 */ if (func_80041288(&D_8018CAB8, 0x40, 8) != 0) { - D_8018CA70.unk80 = D_8018CA70.unk80 + 1; + D_8018CA70->unk80 = (u8) (D_8018CA70->unk80 + 1); } break; case 2: /* switch 2 */ if (func_80041288(&D_8018CAB8, 0x38, 8) != 0) { - D_8018CA70.unk80 = D_8018CA70.unk80 + 1; + D_8018CA70->unk80 = (u8) (D_8018CA70->unk80 + 1); } break; case 3: /* switch 2 */ if (func_80041288(&D_8018CAB8, 0x40, 8) != 0) { - D_8018CA70.unk80 = D_8018CA70.unk80 + 1; + D_8018CA70->unk80 = (u8) (D_8018CA70->unk80 + 1); } break; case 4: /* switch 2 */ if (func_80041288(&D_8018CAB8, 0x38, 8) != 0) { - D_8018CA70.unk80 = D_8018CA70.unk80 + 1; + D_8018CA70->unk80 = (u8) (D_8018CA70->unk80 + 1); } break; case 5: /* switch 2 */ if (func_80041288(&D_8018CAB8, 0x40, 8) != 0) { - D_8018CA70.unk80 = D_8018CA70.unk80 + 1; + D_8018CA70->unk80 = (u8) (D_8018CA70->unk80 + 1); } break; case 6: /* switch 2 */ if (func_80041288(&D_8018CAB8, 0x38, 4) != 0) { - D_8018CA70.unk80 = D_8018CA70.unk80 + 1; + D_8018CA70->unk80 = (u8) (D_8018CA70->unk80 + 1); } break; case 7: /* switch 2 */ if (func_80041288(&D_8018CAB8, 0x40, 4) != 0) { - D_8018CA70.unk80 = D_8018CA70.unk80 + 1; + D_8018CA70->unk80 = (u8) (D_8018CA70->unk80 + 1); } break; case 8: /* switch 2 */ - D_8018CA70.unk80 = 0; + D_8018CA70->unk80 = 0U; break; } - temp_t3_2 = D_8018CA70.unk7A; + temp_t3_2 = (u8) D_8018CA70->unk_7A; switch (temp_t3_2) { /* switch 3 */ case 1: /* switch 3 */ if (func_80041288(&D_8018CABE, 0xE4, 0x10) != 0) { - D_8018CA70.unk7A = D_8018CA70.unk7A + 1; + D_8018CA70->unk_7A = (u8) D_8018CA70->unk_7A + 1; } break; case 2: /* switch 3 */ if (func_80041288(&D_8018CABE, 0xF4, 4) != 0) { - D_8018CA70.unk7A = D_8018CA70.unk7A + 1; + D_8018CA70->unk_7A = (u8) D_8018CA70->unk_7A + 1; } break; case 3: /* switch 3 */ if (func_80041288(&D_8018CABE, 0xE4, 4) != 0) { - D_8018CA70.unk7A = D_8018CA70.unk7A + 1; + D_8018CA70->unk_7A = (u8) D_8018CA70->unk_7A + 1; } break; case 4: /* switch 3 */ if (func_80041288(&D_8018CABE, 0xEC, 4) != 0) { - D_8018CA70.unk7A = D_8018CA70.unk7A + 1; + D_8018CA70->unk_7A = (u8) D_8018CA70->unk_7A + 1; } break; case 5: /* switch 3 */ if (func_80041288(&D_8018CABE, 0xE4, 4) != 0) { - D_8018CA70.unk7A = D_8018CA70.unk7A + 1; + D_8018CA70->unk_7A = (u8) D_8018CA70->unk_7A + 1; } break; case 6: /* switch 3 */ if (func_80041288(&D_8018CABE, 0xE8, 2) != 0) { - D_8018CA70.unk7A = D_8018CA70.unk7A + 1; + D_8018CA70->unk_7A = (u8) D_8018CA70->unk_7A + 1; } break; case 7: /* switch 3 */ if (func_80041288(&D_8018CABE, 0xE4, 2) != 0) { - D_8018CA70.unk7A = D_8018CA70.unk7A + 1; + D_8018CA70->unk_7A = (u8) D_8018CA70->unk_7A + 1; } break; case 8: /* switch 3 */ - D_8018CA70.unk7A = 0; + D_8018CA70->unk_7A = 0; break; } - temp_t8_2 = D_8018CA70.unk7D; + temp_t8_2 = (u8) D_8018CA70->unk_7D; switch (temp_t8_2) { /* switch 4 */ case 1: /* switch 4 */ if (func_80041288(&D_8018CACA, 0x53, 0x10) != 0) { - D_8018CA70.unk7D = D_8018CA70.unk7D + 1; + D_8018CA70->unk_7D = (u8) D_8018CA70->unk_7D + 1; } break; case 2: /* switch 4 */ if (func_80041288(&D_8018CACA, 0x43, 4) != 0) { - D_8018CA70.unk7D = D_8018CA70.unk7D + 1; + D_8018CA70->unk_7D = (u8) D_8018CA70->unk_7D + 1; } break; case 3: /* switch 4 */ if (func_80041288(&D_8018CACA, 0x53, 4) != 0) { - D_8018CA70.unk7D = D_8018CA70.unk7D + 1; + D_8018CA70->unk_7D = (u8) D_8018CA70->unk_7D + 1; } break; case 4: /* switch 4 */ if (func_80041288(&D_8018CACA, 0x4B, 4) != 0) { - D_8018CA70.unk7D = D_8018CA70.unk7D + 1; + D_8018CA70->unk_7D = (u8) D_8018CA70->unk_7D + 1; } break; case 5: /* switch 4 */ if (func_80041288(&D_8018CACA, 0x53, 4) != 0) { - D_8018CA70.unk7D = D_8018CA70.unk7D + 1; + D_8018CA70->unk_7D = (u8) D_8018CA70->unk_7D + 1; } break; case 6: /* switch 4 */ if (func_80041288(&D_8018CACA, 0x4F, 2) != 0) { - D_8018CA70.unk7D = D_8018CA70.unk7D + 1; + D_8018CA70->unk_7D = (u8) D_8018CA70->unk_7D + 1; } break; case 7: /* switch 4 */ if (func_80041288(&D_8018CACA, 0x53, 2) != 0) { - D_8018CA70.unk7D = D_8018CA70.unk7D + 1; + D_8018CA70->unk_7D = (u8) D_8018CA70->unk_7D + 1; } break; case 8: /* switch 4 */ - D_8018CA70.unk7D = 0; + D_8018CA70->unk_7D = 0; break; } - D_8018CFEC = D_8018CA70.unk3E + 0x18; - D_8018CFF4 = D_8018CA70.unk40 + 6; - temp_t7 = D_8018CA70.unk7B; + D_8018CFEC = (f32) (D_8018CA70->speedometerX + 0x18); + D_8018CFF4 = (f32) (D_8018CA70->speedometerY + 6); + temp_t7 = (u8) D_8018CA70->unk_7B; switch (temp_t7) { /* switch 5 */ case 1: /* switch 5 */ if (func_80041288(&D_8018CAC0, 0xE4, 0x10) != 0) { - D_8018CA70.unk7B = D_8018CA70.unk7B + 1; + D_8018CA70->unk_7B = (u8) D_8018CA70->unk_7B + 1; } break; case 2: /* switch 5 */ if (func_80041288(&D_8018CAC0, 0xF4, 4) != 0) { - D_8018CA70.unk7B = D_8018CA70.unk7B + 1; + D_8018CA70->unk_7B = (u8) D_8018CA70->unk_7B + 1; } break; case 3: /* switch 5 */ if (func_80041288(&D_8018CAC0, 0xE4, 4) != 0) { - D_8018CA70.unk7B = D_8018CA70.unk7B + 1; + D_8018CA70->unk_7B = (u8) D_8018CA70->unk_7B + 1; } break; case 4: /* switch 5 */ if (func_80041288(&D_8018CAC0, 0xEC, 4) != 0) { - D_8018CA70.unk7B = D_8018CA70.unk7B + 1; + D_8018CA70->unk_7B = (u8) D_8018CA70->unk_7B + 1; } break; case 5: /* switch 5 */ if (func_80041288(&D_8018CAC0, 0xE4, 4) != 0) { - D_8018CA70.unk7B = D_8018CA70.unk7B + 1; + D_8018CA70->unk_7B = (u8) D_8018CA70->unk_7B + 1; } break; case 6: /* switch 5 */ if (func_80041288(&D_8018CAC0, 0xE8, 2) != 0) { - D_8018CA70.unk7B = D_8018CA70.unk7B + 1; + D_8018CA70->unk_7B = (u8) D_8018CA70->unk_7B + 1; } break; case 7: /* switch 5 */ if (func_80041288(&D_8018CAC0, 0xE4, 2) != 0) { - D_8018CA70.unk7B = D_8018CA70.unk7B + 1; + D_8018CA70->unk_7B = (u8) D_8018CA70->unk_7B + 1; } break; case 8: /* switch 5 */ - D_8018CA70.unk7B = 0; + D_8018CA70->unk_7B = 0; break; } - temp_t2 = D_8018CA70.unk7E; + temp_t2 = (u8) D_8018CA70->unk_7E; switch (temp_t2) { /* switch 6 */ case 1: /* switch 6 */ if (func_80041288(&D_8018CACC, 0x53, 0x10) != 0) { - D_8018CA70.unk7E = D_8018CA70.unk7E + 1; + D_8018CA70->unk_7E = (u8) D_8018CA70->unk_7E + 1; } break; case 2: /* switch 6 */ if (func_80041288(&D_8018CACC, 0x43, 4) != 0) { - D_8018CA70.unk7E = D_8018CA70.unk7E + 1; + D_8018CA70->unk_7E = (u8) D_8018CA70->unk_7E + 1; } break; case 3: /* switch 6 */ if (func_80041288(&D_8018CACC, 0x53, 4) != 0) { - D_8018CA70.unk7E = D_8018CA70.unk7E + 1; + D_8018CA70->unk_7E = (u8) D_8018CA70->unk_7E + 1; } break; case 4: /* switch 6 */ if (func_80041288(&D_8018CACC, 0x4B, 4) != 0) { - D_8018CA70.unk7E = D_8018CA70.unk7E + 1; + D_8018CA70->unk_7E = (u8) D_8018CA70->unk_7E + 1; } break; case 5: /* switch 6 */ if (func_80041288(&D_8018CACC, 0x53, 4) != 0) { - D_8018CA70.unk7E = D_8018CA70.unk7E + 1; + D_8018CA70->unk_7E = (u8) D_8018CA70->unk_7E + 1; } break; case 6: /* switch 6 */ if (func_80041288(&D_8018CACC, 0x4F, 2) != 0) { - D_8018CA70.unk7E = D_8018CA70.unk7E + 1; + D_8018CA70->unk_7E = (u8) D_8018CA70->unk_7E + 1; } break; case 7: /* switch 6 */ if (func_80041288(&D_8018CACC, 0x53, 2) != 0) { - D_8018CA70.unk7E = D_8018CA70.unk7E + 1; + D_8018CA70->unk_7E = (u8) D_8018CA70->unk_7E + 1; } break; case 8: /* switch 6 */ - D_8018CA70.unk7E = 0; + D_8018CA70->unk_7E = 0; break; } - temp_t7_2 = D_8018CA70.unk7C; + temp_t7_2 = (u8) D_8018CA70->unk_7C; switch (temp_t7_2) { /* switch 7 */ case 1: /* switch 7 */ if (func_80041288(&D_8018CAC2, 0xE4, 0x10) != 0) { - D_8018CA70.unk7C = D_8018CA70.unk7C + 1; + D_8018CA70->unk_7C = (u8) D_8018CA70->unk_7C + 1; } break; case 2: /* switch 7 */ if (func_80041288(&D_8018CAC2, 0xF4, 4) != 0) { - D_8018CA70.unk7C = D_8018CA70.unk7C + 1; + D_8018CA70->unk_7C = (u8) D_8018CA70->unk_7C + 1; } break; case 3: /* switch 7 */ if (func_80041288(&D_8018CAC2, 0xE4, 4) != 0) { - D_8018CA70.unk7C = D_8018CA70.unk7C + 1; + D_8018CA70->unk_7C = (u8) D_8018CA70->unk_7C + 1; } break; case 4: /* switch 7 */ if (func_80041288(&D_8018CAC2, 0xEC, 4) != 0) { - D_8018CA70.unk7C = D_8018CA70.unk7C + 1; + D_8018CA70->unk_7C = (u8) D_8018CA70->unk_7C + 1; } break; case 5: /* switch 7 */ if (func_80041288(&D_8018CAC2, 0xE4, 4) != 0) { - D_8018CA70.unk7C = D_8018CA70.unk7C + 1; + D_8018CA70->unk_7C = (u8) D_8018CA70->unk_7C + 1; } break; case 6: /* switch 7 */ if (func_80041288(&D_8018CAC2, 0xE8, 2) != 0) { - D_8018CA70.unk7C = D_8018CA70.unk7C + 1; + D_8018CA70->unk_7C = (u8) D_8018CA70->unk_7C + 1; } break; case 7: /* switch 7 */ if (func_80041288(&D_8018CAC2, 0xE4, 2) != 0) { - D_8018CA70.unk7C = D_8018CA70.unk7C + 1; + D_8018CA70->unk_7C = (u8) D_8018CA70->unk_7C + 1; } break; case 8: /* switch 7 */ - D_8018CA70.unk7C = 0; + D_8018CA70->unk_7C = 0; break; } - temp_t2_2 = D_8018CA70.unk7F; + temp_t2_2 = (u8) D_8018CA70->unk_7F; switch (temp_t2_2) { /* switch 8 */ case 1: /* switch 8 */ if (func_80041288(&D_8018CACE, 0x53, 0x10) != 0) { - D_8018CA70.unk7F = D_8018CA70.unk7F + 1; + D_8018CA70->unk_7F = (u8) D_8018CA70->unk_7F + 1; return; } default: /* switch 8 */ return; case 2: /* switch 8 */ if (func_80041288(&D_8018CACE, 0x43, 4) != 0) { - D_8018CA70.unk7F = D_8018CA70.unk7F + 1; + D_8018CA70->unk_7F = (u8) D_8018CA70->unk_7F + 1; return; } - /* Duplicate return node #141. Try simplifying control flow for better match */ - return; + break; case 3: /* switch 8 */ if (func_80041288(&D_8018CACE, 0x53, 4) != 0) { - D_8018CA70.unk7F = D_8018CA70.unk7F + 1; + D_8018CA70->unk_7F = (u8) D_8018CA70->unk_7F + 1; return; } - /* Duplicate return node #141. Try simplifying control flow for better match */ - return; + break; case 4: /* switch 8 */ if (func_80041288(&D_8018CACE, 0x4B, 4) != 0) { - D_8018CA70.unk7F = D_8018CA70.unk7F + 1; + D_8018CA70->unk_7F = (u8) D_8018CA70->unk_7F + 1; return; } - /* Duplicate return node #141. Try simplifying control flow for better match */ - return; + break; case 5: /* switch 8 */ if (func_80041288(&D_8018CACE, 0x53, 4) != 0) { - D_8018CA70.unk7F = D_8018CA70.unk7F + 1; + D_8018CA70->unk_7F = (u8) D_8018CA70->unk_7F + 1; return; } - /* Duplicate return node #141. Try simplifying control flow for better match */ - return; + break; case 6: /* switch 8 */ if (func_80041288(&D_8018CACE, 0x4F, 2) != 0) { - D_8018CA70.unk7F = D_8018CA70.unk7F + 1; + D_8018CA70->unk_7F = (u8) D_8018CA70->unk_7F + 1; return; } - /* Duplicate return node #141. Try simplifying control flow for better match */ - return; + break; case 7: /* switch 8 */ if (func_80041288(&D_8018CACE, 0x53, 2) != 0) { - D_8018CA70.unk7F = D_8018CA70.unk7F + 1; + D_8018CA70->unk_7F = (u8) D_8018CA70->unk_7F + 1; return; } - /* Duplicate return node #141. Try simplifying control flow for better match */ - return; + break; case 8: /* switch 8 */ - D_8018CA70.unk7F = 0; - /* Duplicate return node #141. Try simplifying control flow for better match */ - return; + D_8018CA70->unk_7F = 0; + break; } } #else @@ -2030,9 +2020,9 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8005AB60.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80041288(? *, ?, ?); // extern -? func_800413B8(f32 *, f32, f32); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_80041288(? *, ?, ?); /* extern */ +? func_800413B8(f32 *, f32, f32); /* extern */ extern ? D_8018CAC0; extern ? D_8018CAC2; extern ? D_8018CAC4; @@ -2068,7 +2058,7 @@ void func_8005B7A0(void) { if (temp_f0 == *temp_s3) { *temp_s4 = 0.0f; } - if (temp_f0 <= -32.0) { + if ((f64) temp_f0 <= -32.0) { *phi_s1 = -32.0f; } } @@ -2082,8 +2072,8 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8005B7A0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_800413B8(f32 *, f32, s32); /* extern */ +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_800413B8(f32 *, f32, ?32); /* extern */ ? func_8005AA4C(); /* extern */ ? func_8005AA6C(?); /* extern */ ? func_8005AA80(); /* extern */ @@ -2091,317 +2081,344 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8005B7A0.s") ? func_8005AAF0(); /* extern */ ? func_8005AB60(); /* extern */ ? func_8005B7A0(); /* extern */ -extern ? D_8018CA70; +extern s8 D_801657E2; +extern f32 D_8018D028; +extern f32 D_8018D02C; +extern f32 D_8018D030; +extern f32 D_8018D034; +extern f32 D_8018D038; +extern f32 D_8018D03C; +extern f32 D_8018D040; +extern f32 D_8018D044; +extern f32 D_8018D050; +extern f32 D_8018D054; +extern f32 D_8018D058; +extern f32 D_8018D05C; +extern f32 D_8018D060; +extern f32 D_8018D064; +extern f32 D_8018D068; +extern f32 D_8018D06C; extern ? D_8018D070; -extern s32 D_8018D078; +extern ?32 D_8018D078; +extern f32 D_8018D07C; +extern f32 D_8018D080; +extern f32 D_8018D084; +extern f32 D_8018D088; +extern f32 D_8018D08C; +extern f32 D_8018D090; +extern f32 D_8018D094; extern ? D_8018D098; +extern f32 D_8018D0C8; +extern f32 D_8018D0CC; +extern f32 D_8018D0D0; +extern f32 D_8018D0D4; +extern f32 D_8018D0D8; +extern f32 D_8018D0DC; +extern f32 D_8018D0E0; +extern f32 D_8018D0E4; +extern s32 D_8018D1CC; void func_8005B914(void) { - s32 *sp20; + ?32 *sp20; f32 *sp1C; f32 *sp18; + ?32 *temp_v0_3; f32 *temp_v0_2; f32 *temp_v1; - s32 *temp_v0_3; s32 temp_v0; f32 *phi_v0; - s32 *phi_v0_2; + ?32 *phi_v0_2; s32 phi_v0_3; s32 phi_v0_4; - s32 *phi_v0_5; + ?32 *phi_v0_5; f32 *phi_v1; f32 *phi_a0; temp_v0 = D_8018D1CC; phi_v0_3 = temp_v0; - if (temp_v0 >= 0x1D) { - switch (temp_v0) { /* switch 1 */ - case 0x64: /* switch 1 */ - func_8005AA4C(); - goto block_76; - case 0x65: /* switch 1 */ - func_8005AA94(0x3A); - goto block_76; - case 0x66: /* switch 1 */ - D_8018D078 = -0x3F000000; - D_8018D0C8 = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x67: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x68: /* switch 1 */ - D_8018D07C = -8.0f; - D_8018D0CC = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x69: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x6A: /* switch 1 */ - D_8018D080 = -8.0f; - D_8018D0D0 = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x6B: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x6C: /* switch 1 */ - D_8018D084 = -8.0f; - D_8018D0D4 = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x6D: /* switch 1 */ - func_8005AA94(0xA); - goto block_76; - case 0x6E: /* switch 1 */ - phi_v0 = &D_8018D050; - do { - temp_v0_2 = phi_v0 + 0x10; - temp_v0_2->unk-10 = -32.0f; - temp_v0_2->unk-C = -32.0f; - temp_v0_2->unk-8 = -32.0f; - temp_v0_2->unk-4 = -32.0f; - phi_v0 = temp_v0_2; - } while (temp_v0_2 != &D_8018D070); - D_8018D028 = 360.0f; - D_8018D050 = 110.0f; - D_8018D0C8 = 44.0f; - D_8018D078 = -0x3E800000; - D_801657E2 = 1; - func_8005AA4C(); - goto block_76; - case 0x6F: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x70: /* switch 1 */ - D_8018D02C = 360.0f; - D_8018D054 = 110.0f; - D_8018D0CC = 76.0f; - D_8018D07C = -16.0f; - func_8005AA4C(); - goto block_76; - case 0x71: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x72: /* switch 1 */ - D_8018D030 = 360.0f; - D_8018D058 = 110.0f; - D_8018D0D0 = 108.0f; - D_8018D080 = -16.0f; - func_8005AA4C(); - goto block_76; - case 0x73: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x74: /* switch 1 */ - D_8018D034 = 360.0f; - D_8018D05C = 110.0f; - D_8018D0D4 = 140.0f; - D_8018D084 = -16.0f; - func_8005AA4C(); - goto block_76; - case 0x75: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x76: /* switch 1 */ - D_8018D038 = 360.0f; - D_8018D060 = 110.0f; - D_8018D0D8 = 180.0f; - D_8018D088 = -16.0f; - func_8005AA4C(); - goto block_76; - case 0x77: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x78: /* switch 1 */ - D_8018D03C = 360.0f; - D_8018D064 = 110.0f; - D_8018D0DC = 212.0f; - D_8018D08C = -16.0f; - func_8005AA4C(); - goto block_76; - case 0x79: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x7A: /* switch 1 */ - D_8018D040 = 360.0f; - D_8018D068 = 110.0f; - D_8018D0E0 = 244.0f; - D_8018D090 = -16.0f; - func_8005AA4C(); - goto block_76; - case 0x7B: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x7C: /* switch 1 */ - D_8018D044 = 360.0f; - D_8018D06C = 110.0f; - D_8018D0E4 = 276.0f; - D_8018D094 = -16.0f; - func_8005AA4C(); - goto block_76; - case 0x7D: /* switch 1 */ - func_8005AA94(0xA); - goto block_76; - case 0x7E: /* switch 1 */ - phi_v0_2 = &D_8018D078; - do { - temp_v0_3 = phi_v0_2 + 0x10; - temp_v0_3->unk-C = 0.0f; - temp_v0_3->unk-8 = 0.0f; - temp_v0_3->unk-4 = 0.0f; - temp_v0_3->unk-10 = 0.0f; - phi_v0_2 = temp_v0_3; - } while (temp_v0_3 != &D_8018D098); - func_8005AA4C(); - goto block_76; - case 0x7F: /* switch 1 */ - func_8005AA94(0x82); - goto block_76; - case 0x80: /* switch 1 */ - if (gPlayerPositions[0] < 4) { - func_8005AA6C(0x8C); - } else { - func_8005AA6C(0x82); - } - goto block_76; - case 0x82: /* switch 1 */ - func_8005AA80(); - goto block_76; - case 0x8C: /* switch 1 */ - D_8018D078 = -0x3E800000; - D_8018D0C8 = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x8D: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x8E: /* switch 1 */ - D_8018D07C = -16.0f; - D_8018D0CC = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x8F: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x90: /* switch 1 */ - D_8018D080 = -16.0f; - D_8018D0D0 = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x91: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x92: /* switch 1 */ - D_8018D084 = -16.0f; - D_8018D0D4 = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x93: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x94: /* switch 1 */ - D_8018D088 = -16.0f; - D_8018D0D8 = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x95: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x96: /* switch 1 */ - D_8018D08C = -16.0f; - D_8018D0DC = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x97: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x98: /* switch 1 */ - D_8018D090 = -16.0f; - D_8018D0E0 = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x99: /* switch 1 */ - func_8005AA94(4); - goto block_76; - case 0x9A: /* switch 1 */ - D_8018D094 = -16.0f; - D_8018D0E4 = -32.0f; - func_8005AA4C(); - goto block_76; - case 0x9B: /* switch 1 */ - func_8005AA94(0x14); - goto block_76; - case 0x9C: /* switch 1 */ - func_8005AA80(); - goto block_76; - } - } else { - switch (temp_v0) { /* switch 2 */ - case 1: /* switch 2 */ - func_8005AAF0(); + switch (temp_v0) { /* irregular */ + case 0x1: + func_8005AAF0(); block_76: - phi_v0_3 = D_8018D1CC; - break; - case 2: /* switch 2 */ - if (gModeSelection == TIME_TRIALS) { - D_8018CA70.unk80 = 1; - } - D_8018CA70.unk78 = 1; - D_8018CA70.unk7A = 1; - D_8018CA70.unk7D = 1; - func_8005AA4C(); - goto block_76; - case 3: /* switch 2 */ - func_8005AA94(0); - goto block_76; - case 4: /* switch 2 */ - D_8018CA70.unk7B = 1; - D_8018CA70.unk7E = 1; - func_8005AA4C(); - goto block_76; - case 5: /* switch 2 */ - func_8005AA94(0); - goto block_76; - case 6: /* switch 2 */ - D_8018CA70.unk7C = 1; - D_8018CA70.unk7F = 1; - func_8005AA4C(); - func_8005AA80(); - goto block_76; - case 20: /* switch 2 */ - D_8018D078 = 0x41800000; - func_8005AA4C(); - goto block_76; - case 21: /* switch 2 */ - func_8005AA94(4); - goto block_76; - case 22: /* switch 2 */ - D_8018D07C = 16.0f; - func_8005AA4C(); - goto block_76; - case 23: /* switch 2 */ - func_8005AA94(4); - goto block_76; - case 24: /* switch 2 */ - D_8018D080 = 16.0f; - func_8005AA4C(); - goto block_76; - case 25: /* switch 2 */ - func_8005AA94(4); - goto block_76; - case 26: /* switch 2 */ - D_8018D084 = 16.0f; - func_8005AA4C(); - goto block_76; - case 27: /* switch 2 */ - func_8005AA94(0xA); - goto block_76; - case 28: /* switch 2 */ - func_8005AA80(); - goto block_76; + phi_v0_3 = D_8018D1CC; + break; + case 0x2: + if (gModeSelection == 1) { + D_8018CA70->unk80 = 1; } + D_8018CA70->unk_78 = 1; + D_8018CA70->unk_7A = 1; + D_8018CA70->unk_7D = 1; + func_8005AA4C(); + goto block_76; + case 0x3: + func_8005AA94(0); + goto block_76; + case 0x4: + D_8018CA70->unk_7B = 1; + D_8018CA70->unk_7E = 1; + func_8005AA4C(); + goto block_76; + case 0x5: + func_8005AA94(0); + goto block_76; + case 0x6: + D_8018CA70->unk_7C = 1; + D_8018CA70->unk_7F = 1; + func_8005AA4C(); + func_8005AA80(); + goto block_76; + case 0x14: + D_8018D078 = 0x41800000; + func_8005AA4C(); + goto block_76; + case 0x15: + func_8005AA94(4); + goto block_76; + case 0x16: + D_8018D07C = 16.0f; + func_8005AA4C(); + goto block_76; + case 0x17: + func_8005AA94(4); + goto block_76; + case 0x18: + D_8018D080 = 16.0f; + func_8005AA4C(); + goto block_76; + case 0x19: + func_8005AA94(4); + goto block_76; + case 0x1A: + D_8018D084 = 16.0f; + func_8005AA4C(); + goto block_76; + case 0x1B: + func_8005AA94(0xA); + goto block_76; + case 0x1C: + func_8005AA80(); + goto block_76; + case 0x64: + func_8005AA4C(); + goto block_76; + case 0x65: + func_8005AA94(0x3A); + goto block_76; + case 0x66: + D_8018D078 = 0xC1000000; + D_8018D0C8 = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x67: + func_8005AA94(4); + goto block_76; + case 0x68: + D_8018D07C = -8.0f; + D_8018D0CC = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x69: + func_8005AA94(4); + goto block_76; + case 0x6A: + D_8018D080 = -8.0f; + D_8018D0D0 = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x6B: + func_8005AA94(4); + goto block_76; + case 0x6C: + D_8018D084 = -8.0f; + D_8018D0D4 = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x6D: + func_8005AA94(0xA); + goto block_76; + case 0x6E: + phi_v0 = &D_8018D050; + do { + temp_v0_2 = phi_v0 + 0x10; + temp_v0_2->unk-10 = -32.0f; + temp_v0_2->unk-C = -32.0f; + temp_v0_2->unk-8 = -32.0f; + temp_v0_2->unk-4 = -32.0f; + phi_v0 = temp_v0_2; + } while (temp_v0_2 != &D_8018D070); + D_8018D028 = 360.0f; + D_8018D050 = 110.0f; + D_8018D0C8 = 44.0f; + D_8018D078 = 0xC1800000; + D_801657E2 = 1; + func_8005AA4C(); + goto block_76; + case 0x6F: + func_8005AA94(4); + goto block_76; + case 0x70: + D_8018D02C = 360.0f; + D_8018D054 = 110.0f; + D_8018D0CC = 76.0f; + D_8018D07C = -16.0f; + func_8005AA4C(); + goto block_76; + case 0x71: + func_8005AA94(4); + goto block_76; + case 0x72: + D_8018D030 = 360.0f; + D_8018D058 = 110.0f; + D_8018D0D0 = 108.0f; + D_8018D080 = -16.0f; + func_8005AA4C(); + goto block_76; + case 0x73: + func_8005AA94(4); + goto block_76; + case 0x74: + D_8018D034 = 360.0f; + D_8018D05C = 110.0f; + D_8018D0D4 = 140.0f; + D_8018D084 = -16.0f; + func_8005AA4C(); + goto block_76; + case 0x75: + func_8005AA94(4); + goto block_76; + case 0x76: + D_8018D038 = 360.0f; + D_8018D060 = 110.0f; + D_8018D0D8 = 180.0f; + D_8018D088 = -16.0f; + func_8005AA4C(); + goto block_76; + case 0x77: + func_8005AA94(4); + goto block_76; + case 0x78: + D_8018D03C = 360.0f; + D_8018D064 = 110.0f; + D_8018D0DC = 212.0f; + D_8018D08C = -16.0f; + func_8005AA4C(); + goto block_76; + case 0x79: + func_8005AA94(4); + goto block_76; + case 0x7A: + D_8018D040 = 360.0f; + D_8018D068 = 110.0f; + D_8018D0E0 = 244.0f; + D_8018D090 = -16.0f; + func_8005AA4C(); + goto block_76; + case 0x7B: + func_8005AA94(4); + goto block_76; + case 0x7C: + D_8018D044 = 360.0f; + D_8018D06C = 110.0f; + D_8018D0E4 = 276.0f; + D_8018D094 = -16.0f; + func_8005AA4C(); + goto block_76; + case 0x7D: + func_8005AA94(0xA); + goto block_76; + case 0x7E: + phi_v0_2 = &D_8018D078; + do { + temp_v0_3 = phi_v0_2 + 0x10; + temp_v0_3->unk-C = 0.0f; + temp_v0_3->unk-8 = 0.0f; + temp_v0_3->unk-4 = 0.0f; + temp_v0_3->unk-10 = 0.0f; + phi_v0_2 = temp_v0_3; + } while (temp_v0_3 != &D_8018D098); + func_8005AA4C(); + goto block_76; + case 0x7F: + func_8005AA94(0x82); + goto block_76; + case 0x80: + if (*gPlayerPositions < 4) { + func_8005AA6C(0x8C); + } else { + func_8005AA6C(0x82); + } + goto block_76; + case 0x82: + func_8005AA80(); + goto block_76; + case 0x8C: + D_8018D078 = 0xC1800000; + D_8018D0C8 = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x8D: + func_8005AA94(4); + goto block_76; + case 0x8E: + D_8018D07C = -16.0f; + D_8018D0CC = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x8F: + func_8005AA94(4); + goto block_76; + case 0x90: + D_8018D080 = -16.0f; + D_8018D0D0 = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x91: + func_8005AA94(4); + goto block_76; + case 0x92: + D_8018D084 = -16.0f; + D_8018D0D4 = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x93: + func_8005AA94(4); + goto block_76; + case 0x94: + D_8018D088 = -16.0f; + D_8018D0D8 = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x95: + func_8005AA94(4); + goto block_76; + case 0x96: + D_8018D08C = -16.0f; + D_8018D0DC = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x97: + func_8005AA94(4); + goto block_76; + case 0x98: + D_8018D090 = -16.0f; + D_8018D0E0 = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x99: + func_8005AA94(4); + goto block_76; + case 0x9A: + D_8018D094 = -16.0f; + D_8018D0E4 = -32.0f; + func_8005AA4C(); + goto block_76; + case 0x9B: + func_8005AA94(0x14); + goto block_76; + case 0x9C: + func_8005AA80(); + goto block_76; } phi_v0_4 = phi_v0_3; if (phi_v0_3 < 0x64) { @@ -2728,15 +2745,14 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8005C980.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80041288(void *, ?, ?, s32); // extern -? func_800413B8(void *, ?, ?, s32); // extern -? func_80079054(s32); // extern -? func_80079084(s32); // extern -? func_800790B4(s32); // extern -? func_800C9060(s32, ?); // extern -? func_800C90F4(?, s32, s8, s32); // extern -extern ? gTimePlayerLastTouchedFinishLine; +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_80041288(s16 *, ?, ?, s32); /* extern */ +? func_800413B8(f32 *, ?, ?, s32); /* extern */ +? func_80079054(s32); /* extern */ +? func_80079084(s32); /* extern */ +? func_800790B4(s32); /* extern */ +? func_800C9060(s32, ?); /* extern */ +? func_800C90F4(?, s32, s8, s32); /* extern */ extern s32 D_80165594; extern u32 D_80165638; extern u32 D_80165648; @@ -2746,21 +2762,21 @@ extern s8 D_801657E3; extern s8 D_801657E4; extern s8 D_801657E5; extern s8 D_801657E6; -extern s8 D_801657E8; extern s8 D_801657F0; extern ? D_80165800; extern s32 D_8016587C; extern s8 D_80165898; -extern ? D_8018CA70; extern s32 D_8018D114; extern s32 D_8018D1CC; extern s32 D_8018D1FC; extern s32 D_8018D204; extern s32 D_8018D20C; extern s32 D_8018D320; -extern f32 gCourseTimer; +extern s8 D_8018EDF3; +extern s32 gScreenModeSelection; +s16 gCurrentCourseId; /* unable to generate initializer */ -void func_8005CB60(s32 arg0, s32 arg1) { +void func_8005CB60(s32 playerId, s32 arg1) { s8 *sp20; s32 temp_a3; s32 temp_f18; @@ -2771,73 +2787,73 @@ void func_8005CB60(s32 arg0, s32 arg1) { s8 *temp_v1_2; s8 temp_a0; s8 temp_v0_4; + struct_8018CA70_entry *temp_s0; u16 temp_a1; u32 temp_a0_2; u32 temp_v0_2; - void *temp_s0; void *temp_v0; s8 *phi_v1; s8 phi_a2; s32 phi_t1; s32 phi_a3; - temp_s0 = &D_8018CA70 + (arg0 * 0x84); - temp_a3 = arg0; + temp_s0 = &D_8018CA70[playerId]; + temp_a3 = playerId; phi_a3 = temp_a3; phi_a3 = temp_a3; - if (temp_s0->unk71 < D_8018D320) { - temp_v1 = temp_s0 + 0x72; - temp_s0->unk8 = gCourseTimer * 100.0f; + if ((s32) temp_s0->lapCount < D_8018D320) { + temp_v1 = &temp_s0->alsoLapCount; + temp_s0->someTimer = (u32) (s32) (gCourseTimer * 100.0f); phi_v1 = temp_v1; phi_t1 = 3; - if (*temp_v1 < arg1) { - temp_f18 = *(&gTimePlayerLastTouchedFinishLine + (arg0 * 4)) * 100.0f; - temp_s0->unk10 = temp_f18; + if ((s32) *temp_v1 < arg1) { + temp_f18 = (s32) (gTimePlayerLastTouchedFinishLine[playerId] * 100.0f); + temp_s0->timeLastTouchedFinishLine = (u32) temp_f18; (temp_s0 + (*temp_v1 * 4))->unk14 = temp_f18; temp_a0 = *temp_v1; if (temp_a0 == 0) { - (temp_s0 + (temp_a0 * 4))->unk20 = temp_s0->unk10; + (temp_s0 + (temp_a0 * 4))->unk20 = (u32) temp_s0->timeLastTouchedFinishLine; } else { - temp_v0 = &D_8018CA70 + (temp_a3 * 0x84) + (temp_a0 * 4); - temp_v0->unk20 = temp_v0->unk14 - temp_v0->unk10; + temp_v0 = &D_8018CA70[temp_a3] + (temp_a0 * 4); + temp_v0->unk20 = (s32) (temp_v0->unk14 - temp_v0->unk10); } - temp_s0->unk3C = 0x3C; - temp_s0->unkC = (temp_s0 + (*temp_v1 * 4))->unk20; + temp_s0->blinkTimer = 0x3C; + temp_s0->someTimer1 = (temp_s0 + (*temp_v1 * 4))->unk20; if (arg1 == 3) { - temp_s0->unk8 = (temp_s0 + (*temp_v1 * 4))->unk14; + temp_s0->someTimer = (temp_s0 + (*temp_v1 * 4))->unk14; } phi_a2 = 1; - if (gModeSelection == TIME_TRIALS) { + if (gModeSelection == 1) { temp_v0_2 = D_80165638; - temp_a0_2 = temp_s0->unkC; + temp_a0_2 = temp_s0->someTimer1; if (temp_v0_2 >= temp_a0_2) { if (temp_v0_2 != temp_a0_2) { D_80165658.unk4 = 0; D_80165658.unk0 = 0; } - temp_a1 = gPlayerOne[arg0].characterId; - arg0 = temp_a3; + temp_a1 = gPlayerOne[playerId].characterId; + playerId = temp_a3; sp20 = temp_v1; func_800C90F4(0, (temp_a1 * 0x10) + 0x2900800D, 1, temp_a3); - D_80165638 = temp_s0->unkC; + D_80165638 = temp_s0->someTimer1; *(&D_80165654 + (arg1 * 4)) = 1; D_801657E3 = 1; - phi_a3 = arg0; + phi_a3 = playerId; } - phi_v1 = temp_s0 + 0x72; + phi_v1 = &temp_s0->alsoLapCount; phi_a2 = 1; phi_t1 = 3; - if ((arg1 == 3) && (temp_s0->unk8 < D_80165648)) { + if ((arg1 == 3) && ((u32) temp_s0->someTimer < (u32) D_80165648)) { D_801657E5 = 1; } } - *phi_v1 = *phi_v1 + 1; + *phi_v1 += 1; temp_v0_3 = D_8018D320; if (temp_v0_3 == *phi_v1) { *phi_v1 = temp_v0_3 - 1; } - temp_v1_2 = temp_s0 + 0x71; - *temp_v1_2 = *temp_v1_2 + 1; + temp_v1_2 = &temp_s0->lapCount; + *temp_v1_2 += 1; temp_v0_4 = *temp_v1_2; if (temp_v0_4 != 0) { if (temp_v0_4 != phi_a2) { @@ -2853,20 +2869,20 @@ void func_8005CB60(s32 arg0, s32 arg1) { D_801657E8 = phi_a2; D_80165800.unk0 = phi_a2; D_80165800.unk1 = phi_a2; - D_8018D204 = phi_a2; + D_8018D204 = (s32) phi_a2; } - temp_s0->unk70 = phi_a2; + temp_s0->raceCompleteBool = phi_a2; if (temp_v0_5 == 2) { *(&D_80165800 + phi_a3) = 0; } if (gCurrentCourseId == 4) { temp_s0->unk81 = 1; } - temp_s0->unk50 = 0x140; - temp_s0->unk52 = 0x1E0; - temp_s0->unk54 = 0x280; - temp_s0->unk56 = 0x320; - D_8016587C = phi_a2; + temp_s0->lap1CompletionTimeX = 0x140; + temp_s0->lap2CompletionTimeX = 0x1E0; + temp_s0->lap3CompletionTimeX = 0x280; + temp_s0->totalTimeX = 0x320; + D_8016587C = (s32) phi_a2; if (D_8018D20C == 0) { func_80079054(phi_a3); D_8018D20C = 1; @@ -2879,65 +2895,62 @@ void func_8005CB60(s32 arg0, s32 arg1) { func_800790B4(phi_a3); } } else { - arg0 = phi_a3; + playerId = phi_a3; func_80079084(phi_a3); - func_800C9060(arg0 & 0xFF, 0x1900F015); - if ((gCurrentCourseId == 8) && (D_80165898 == 0) && (gModeSelection != TIME_TRIALS)) { + func_800C9060(playerId & 0xFF, 0x1900F015); + if ((gCurrentCourseId == 8) && (D_80165898 == 0) && (gModeSelection != 1)) { D_80165898 = 1; } } } } } else { - arg0 = temp_a3; - func_800413B8(temp_s0 + 4, 0x3F800000, 0x3E000000, temp_a3); + playerId = temp_a3; + func_800413B8(&temp_s0->rankScaling, 0x3F800000, 0x3E000000, temp_a3); temp_v0_6 = gScreenModeSelection; - if (temp_v0_6 != 0) { - if (temp_v0_6 != 1) { - if (temp_v0_6 != 2) { - if (temp_v0_6 != 3) { - - } else { - if ((arg0 & 1) == 1) { - func_80041288(temp_s0 + 0x66, -8, 2, arg0); - } else { - func_80041288(temp_s0 + 0x66, 8, 2, arg0); - } - func_80041288(temp_s0 + 0x68, -0x10, 4); - } - } else { - func_80041288(temp_s0 + 0x66, 0x1C, 7, arg0); - func_80041288(temp_s0 + 0x68, -0x10, 4); - } - } else { - func_80041288(temp_s0 + 0x66, 0x1C, 7, arg0); - func_80041288(temp_s0 + 0x68, -0x10, 4); - func_80041288(temp_s0 + 0x50, 0xE4, 0x10); - func_80041288(temp_s0 + 0x52, 0xE4, 0x10); - func_80041288(temp_s0 + 0x54, 0xE4, 0x10); - func_80041288(temp_s0 + 0x56, 0xE4, 0x10); - } - } else { - func_80041288(temp_s0 + 0x66, 0x1C, 7, arg0); + switch (temp_v0_6) { /* irregular */ + case 0: + func_80041288(&temp_s0->slideRankX, 0x1C, 7, playerId); if (D_8018D1FC != 0) { - func_80041288(temp_s0 + 0x68, -0x28, 1); + func_80041288(&temp_s0->slideRankY, -0x28, 1); } else { - func_80041288(temp_s0 + 0x68, -0x10, 4); + func_80041288(&temp_s0->slideRankY, -0x10, 4); } + break; + case 2: + func_80041288(&temp_s0->slideRankX, 0x1C, 7, playerId); + func_80041288(&temp_s0->slideRankY, -0x10, 4); + break; + case 1: + func_80041288(&temp_s0->slideRankX, 0x1C, 7, playerId); + func_80041288(&temp_s0->slideRankY, -0x10, 4); + func_80041288(&temp_s0->lap1CompletionTimeX, 0xE4, 0x10); + func_80041288(&temp_s0->lap2CompletionTimeX, 0xE4, 0x10); + func_80041288(&temp_s0->lap3CompletionTimeX, 0xE4, 0x10); + func_80041288(&temp_s0->totalTimeX, 0xE4, 0x10); + break; + case 3: + if ((playerId & 1) == 1) { + func_80041288(&temp_s0->slideRankX, -8, 2, playerId); + } else { + func_80041288(&temp_s0->slideRankX, 8, 2, playerId); + } + func_80041288(&temp_s0->slideRankY, -0x10, 4); + break; } } - if (temp_s0->unk3C == 0) { - temp_s0->unkC = temp_s0->unk8; + if (temp_s0->blinkTimer == 0) { + temp_s0->someTimer1 = temp_s0->someTimer; D_801657E3 = 0; return; } if (D_80165594 == 0) { - temp_s0->unk73 = temp_s0->unk73 + 1; - temp_s0->unk73 = temp_s0->unk73 & 1; + temp_s0->blinkState += 1; + temp_s0->blinkState &= 1; } - temp_s0->unk3C = temp_s0->unk3C - 1; - if (temp_s0->unk3C == 0) { - temp_s0->unk73 = 0; + temp_s0->blinkTimer += -1; + if (temp_s0->blinkTimer == 0) { + temp_s0->blinkState = 0; } } #else @@ -2977,36 +2990,38 @@ void func_8005D18C(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 extern ? D_80163DE8; extern ? D_80164034; extern ? D_80164438; -extern ? D_8018CA70; -void func_8005D1F4(s32 arg0) { +void func_8005D1F4(s32 playerId) { ? *temp_a2; s32 temp_a1; + struct_8018CA70_entry *temp_v1; u16 temp_a0; - void *temp_v1; ? *phi_a2; - if (gModeSelection == VERSUS) { - temp_v1 = (arg0 * 0x84) + &D_8018CA70; - temp_v1->unk74 = 0; + if (gModeSelection == 2) { + temp_v1 = &D_8018CA70[playerId]; + temp_v1->unk_74 = 0; phi_a2 = &D_80163DE8; loop_2: temp_a0 = phi_a2->unk44; - if ((temp_a0 != 4) && (temp_a0 != 0) && (temp_a1 = phi_a2->unk42 - *(&D_80164438 + (arg0 * 2)), ((temp_a1 < -5) == 0)) && (temp_a1 < 0x1F)) { - temp_v1->unk74 = 1; - return; + if ((temp_a0 != 4) && (temp_a0 != 0)) { + temp_a1 = phi_a2->unk42 - *(&D_80164438 + (playerId * 2)); + if ((temp_a1 >= -5) && (temp_a1 < 0x1F)) { + temp_v1->unk_74 = 1; + return; + } } temp_a2 = phi_a2 + 0x54; phi_a2 = temp_a2; if (temp_a2 == &D_80164034) { - // Duplicate return node #8. Try simplifying control flow for better match - return; + + } else { + goto loop_2; } - goto loop_2; } } #else diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index 23ed8dc27..2ecac2fe9 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -1878,14 +1878,12 @@ GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_80070780.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? find_unused_obj_index(s32 *); // extern -? func_8006EE7C(s32); // extern -? func_80070190(); // extern -? func_8007055C(); // extern -? func_80070780(); // extern -s32 func_800B4E24(?); // extern -s32 func_800B4F2C(?, f32, s32 *, s32, s16, s16); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? find_unused_obj_index(s32 *); /* extern */ +? func_8006EE7C(s32); /* extern */ +? func_80070190(); /* extern */ +? func_8007055C(); /* extern */ +? func_80070780(); /* extern */ extern s32 D_80165638; extern s32 D_80165648; extern s16 D_801656B0; @@ -1899,7 +1897,6 @@ extern s32 D_80183DB8; extern s32 D_80183DBC; extern s32 D_80183E88; extern s32 D_80183E8C; -extern ? D_8018CA70; extern f32 D_8018CFCC; extern f32 D_8018CFD4; extern f32 D_8018CFEC; @@ -1960,28 +1957,28 @@ void func_80071428(void) { func_8007055C(); func_8007055C(); func_80070780(); - D_8018CA70.unk3E = 0x156; - D_8018CA70.unk40 = 0x106; - D_8018CFEC = D_8018CA70.unk3E + 0x18; - D_8018CFF4 = D_8018CA70.unk40 + 6; + D_8018CA70->speedometerX = 0x156; + D_8018CA70->speedometerY = 0x106; + D_8018CFEC = (f32) (D_8018CA70->speedometerX + 0x18); + D_8018CFF4 = (f32) (D_8018CA70->speedometerY + 6); D_8016579E = 0xDD00; - D_8018CA70.unk62 = 0x34; - D_8018CA70.unk64 = 0xC8; - D_8018CA70.unk66 = 0; - D_8018CA70.unk68 = 0; - D_8018CA70.unk4E = 0x12C; - D_8018CA70.unk50 = 0x12C; - D_8018CA70.unk52 = 0x12C; - D_8018CA70.unk58 = 0x11; - D_8018CA70.unk5A = -0x28; - D_8018CA70.unk5C = -0x28; - D_8018CA70.unk5E = -0x28; - D_8018CA70.unk60 = 0x19; - D_8018CA70.unk42 = 0xA0; - D_8018CA70.unk44 = -0x20; - D_8018CA70.unk46 = 0; - D_8018CA70.unk48 = 0; - D_8018CA70.unk6A = *gPlayerPositions; + D_8018CA70->rankX = 0x34; + D_8018CA70->rankY = 0xC8; + D_8018CA70->slideRankX = 0; + D_8018CA70->slideRankY = 0; + D_8018CA70->timerX = 0x12C; + D_8018CA70->lap1CompletionTimeX = 0x12C; + D_8018CA70->lap2CompletionTimeX = 0x12C; + D_8018CA70->timerY = 0x11; + D_8018CA70->lapX = -0x28; + D_8018CA70->lapAfterImage1X = -0x28; + D_8018CA70->lapAfterImage2X = -0x28; + D_8018CA70->lapY = 0x19; + D_8018CA70->itemBoxX = 0xA0; + D_8018CA70->itemBoxY = -0x20; + D_8018CA70->slideItemBoxX = 0; + D_8018CA70->slideItemBoxY = 0; + D_8018CA70->stagingPosition = (s16) *gPlayerPositions; func_8006EE7C(D_80183E88); phi_f0 = 35.0f; phi_a1 = &D_8018D050; @@ -1995,7 +1992,7 @@ void func_80071428(void) { phi_a2->unk0 = phi_f0; temp_v0 = phi_v0 + 0x10; phi_v1->unk4 = 40.0f; - temp_f0 = phi_f0 + 32.0; + temp_f0 = (f32) ((f64) phi_f0 + 32.0); phi_a0->unk4 = -24.0f; phi_a3->unk4 = 0.0f; temp_v0->unk-C = 0.0f; @@ -2003,7 +2000,7 @@ void func_80071428(void) { phi_a2->unk4 = temp_f0; phi_v1->unk8 = 40.0f; phi_a0->unk8 = -24.0f; - temp_f0_2 = temp_f0 + 32.0; + temp_f0_2 = (f32) ((f64) temp_f0 + 32.0); phi_a3->unk8 = 0.0f; temp_v0->unk-8 = 0.0f; phi_v1->unkC = 40.0f; @@ -2011,7 +2008,7 @@ void func_80071428(void) { phi_a2->unk8 = temp_f0_2; phi_a0->unkC = -24.0f; phi_a3->unkC = 0.0f; - temp_f0_3 = temp_f0_2 + 32.0; + temp_f0_3 = (f32) ((f64) temp_f0_2 + 32.0); temp_v0->unk-4 = 0.0f; temp_v1 = phi_v1 + 0x10; temp_a0 = phi_a0 + 0x10; @@ -2022,7 +2019,7 @@ void func_80071428(void) { temp_a0->unk-10 = -24.0f; temp_a3->unk-10 = 0.0f; temp_v0->unk-10 = 0.0f; - phi_f0 = temp_f0_3 + 32.0; + phi_f0 = (f32) ((f64) temp_f0_3 + 32.0); phi_a1 += 0x10; phi_a2 += 0x10; phi_v1 = temp_v1; @@ -2040,51 +2037,50 @@ void func_80071428(void) { D_8018D3EC = 0xFF; D_8018D3F0 = 0xFF; D_8018D3F4 = 1; - D_8018CA70.unk4C = 0x78; - D_8018CA70.unk4A = 0xA0; - D_8018CA70.unk4 = 0.5f; + D_8018CA70->unk_4C = 0x78; + D_8018CA70->unk_4A = 0xA0; + D_8018CA70->rankScaling = 0.5f; D_801656B0 = 0; D_80165708 = 0x28; D_8018D00C = 5.0f; D_8018D388 = 4; - D_8018D380 = 0xA0; - D_8018D384 = 0x78; + D_8018D380 = (s32) 0xA0; + D_8018D384 = (s32) 0x78; D_8018D3C4 = 0x32; - D_8018D3BC = 0x28; + D_8018D3BC = (s32) 0x28; temp_v1_2 = gModeSelection; D_8018D3C0 = 0x50; D_801657A2 = 0x333; - if (temp_v1_2 != GRAND_PRIX) { - if (temp_v1_2 != TIME_TRIALS) { - return; - } + switch (temp_v1_2) { /* irregular */ + case 0: + D_8018D158 = 8; + return; + case 1: D_80165638 = (func_800B4F2C(0, 40.0f, &D_8018D3DC, 1, 0x78, 0x28) & 0xFFFFF) - 1; D_80165648 = func_800B4E24(0) & 0xFFFFF; D_80165888 = 1; D_80165890 = 1; - D_8018D158 = 1; + D_8018D158 = (s32) 1; return; } - D_8018D158 = 8; } #else GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_80071428.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? find_unused_obj_index(s32 *); // extern -? func_8006EE7C(s32); // extern -? func_80070190(); // extern -? func_8007055C(); // extern -? func_80070780(); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? find_unused_obj_index(s32 *); /* extern */ +? func_8006EE7C(s32); /* extern */ +? func_80070190(); /* extern */ +? func_8007055C(); /* extern */ +? func_80070780(); /* extern */ extern s16 D_801657A2; extern s32 D_80183DA0; extern s32 D_80183DB8; extern s32 D_80183DBC; extern s32 D_80183E88; extern s32 D_80183E8C; -extern ? D_8018CA70; extern s32 D_8018D158; extern s32 D_8018D3BC; extern s32 D_8018D3C0; @@ -2102,76 +2098,74 @@ void func_80071818(void) { func_8007055C(); func_8007055C(); func_80070780(); - D_8018CA70.unk42 = -0x52; - D_8018CA70.unk44 = 0x32; - D_8018CA70.unk46 = 0; - D_8018CA70.unk48 = 0; - D_8018CA70.unk4A = 0x50; - D_8018CA70.unk4C = 0x78; - D_8018CA70.unk62 = 0x32; - D_8018CA70.unk64 = 0xD2; - D_8018CA70.unk66 = 0; - D_8018CA70.unk68 = 0; - D_8018CA70.unk4E = 0x4B; - D_8018CA70.unk58 = 0x10; - D_8018CA70.unk5A = 0x67; - D_8018CA70.unk60 = 0x28; + D_8018CA70->itemBoxX = -0x52; + D_8018CA70->itemBoxY = 0x32; + D_8018CA70->slideItemBoxX = 0; + D_8018CA70->slideItemBoxY = 0; + D_8018CA70->unk_4A = 0x50; + D_8018CA70->unk_4C = 0x78; + D_8018CA70->rankX = 0x32; + D_8018CA70->rankY = 0xD2; + D_8018CA70->slideRankX = 0; + D_8018CA70->slideRankY = 0; + D_8018CA70->timerX = 0x4B; + D_8018CA70->timerY = 0x10; + D_8018CA70->lapX = 0x67; + D_8018CA70->lapY = 0x28; func_8006EE7C(D_80183E88); - D_8018CA70.unkC6 = 0x43; - D_8018CA70.unkC8 = 0x32; - D_8018CA70.unkCA = 0; - D_8018CA70.unkCC = 0; - D_8018CA70.unkCE = 0xF0; - D_8018CA70.unkD0 = 0x78; - D_8018CA70.unkE6 = 0xC8; - D_8018CA70.unkE8 = 0xD2; - D_8018CA70.unkEA = 0; - D_8018CA70.unkEC = 0; - D_8018CA70.unkD2 = 0xDC; - D_8018CA70.unkDC = 0x10; - D_8018CA70.unkDE = 0xF7; - D_8018CA70.unkE4 = 0x28; + D_8018CA70->unkC6 = 0x43; + D_8018CA70->unkC8 = 0x32; + D_8018CA70->unkCA = 0; + D_8018CA70->unkCC = 0; + D_8018CA70->unkCE = 0xF0; + D_8018CA70->unkD0 = 0x78; + D_8018CA70->unkE6 = 0xC8; + D_8018CA70->unkE8 = 0xD2; + D_8018CA70->unkEA = 0; + D_8018CA70->unkEC = 0; + D_8018CA70->unkD2 = 0xDC; + D_8018CA70->unkDC = 0x10; + D_8018CA70->unkDE = 0xF7; + D_8018CA70->unkE4 = 0x28; func_8006EE7C(D_80183E8C); - D_8018CA70.unk88 = 0.5f; - D_8018CA70.unk6A = gPlayerPositions->unk0; - D_8018CA70.unkEE = gPlayerPositions->unk4; - D_8018CA70.unk4 = D_8018CA70.unk88; + D_8018CA70->unk88 = 0.5f; + D_8018CA70->stagingPosition = (s16) gPlayerPositions->unk0; + D_8018CA70->unkEE = (s16) gPlayerPositions->unk4; + D_8018CA70->rankScaling = D_8018CA70->unk88; D_8018D3C4 = 0x1E; D_8018D3BC = 0x18; temp_v1 = gModeSelection; D_8018D3C0 = 0x28; D_801657A2 = 0x666; - if (temp_v1 != GRAND_PRIX) { - if (temp_v1 != VERSUS) { - if (temp_v1 != BATTLE) { - return; - } - goto block_7; - } + switch (temp_v1) { /* irregular */ + case 0: + D_8018D158 = 8; + return; + case 2: block_7: D_8018D158 = 2; return; + case 3: + goto block_7; } - D_8018D158 = 8; } #else GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_80071818.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? find_unused_obj_index(s32 *); // extern -? func_8006EE7C(s32, s16, s16, s16); // extern -? func_80070190(); // extern -? func_8007055C(); // extern -? func_80070780(); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? find_unused_obj_index(s32 *); /* extern */ +? func_8006EE7C(s32, s16, s16, s16); /* extern */ +? func_80070190(); /* extern */ +? func_8007055C(); /* extern */ +? func_80070780(); /* extern */ extern s16 D_801657A2; extern s32 D_80183DA0; extern s32 D_80183DB8; extern s32 D_80183DBC; extern s32 D_80183E88; extern s32 D_80183E8C; -extern ? D_8018CA70; extern s32 D_8018D158; extern s32 D_8018D3BC; extern s32 D_8018D3C0; @@ -2189,42 +2183,42 @@ void func_80071A20(void) { func_8007055C(); func_8007055C(); func_80070780(); - D_8018CA70.unk44 = 0x22; - D_8018CA70.unk42 = -0x53; - D_8018CA70.unk46 = 0; - D_8018CA70.unk48 = 0; - D_8018CA70.unk4A = 0xA0; - D_8018CA70.unk4C = 0x3C; - D_8018CA70.unk62 = 0x34; - D_8018CA70.unk64 = 0x62; - D_8018CA70.unk66 = 0; - D_8018CA70.unk68 = 0; - D_8018CA70.unk4E = 0xEA; - D_8018CA70.unk58 = 0x10; - D_8018CA70.unk5A = 0x101; - D_8018CA70.unk60 = 0x6A; - D_8018CA70.unkC6 = -0x53; - D_8018CA70.unkC8 = 0x8F; - D_8018CA70.unkCA = 0; - D_8018CA70.unkCC = 0; - D_8018CA70.unkCE = 0xA0; - D_8018CA70.unkD0 = 0xB4; - D_8018CA70.unkE6 = 0x34; - D_8018CA70.unkE8 = 0xD2; - D_8018CA70.unkEA = 0; - D_8018CA70.unkEC = 0; - D_8018CA70.unkD2 = 0xEA; - D_8018CA70.unkDC = 0x7F; - D_8018CA70.unkDE = 0x101; - D_8018CA70.unkE4 = 0xDA; - if (gModeSelection == BATTLE) { - D_8018CA70.unk44 = 0x5E; - D_8018CA70.unkC8 = 0xD0; + D_8018CA70->itemBoxY = 0x22; + D_8018CA70->itemBoxX = -0x53; + D_8018CA70->slideItemBoxX = 0; + D_8018CA70->slideItemBoxY = 0; + D_8018CA70->unk_4A = 0xA0; + D_8018CA70->unk_4C = 0x3C; + D_8018CA70->rankX = 0x34; + D_8018CA70->rankY = 0x62; + D_8018CA70->slideRankX = 0; + D_8018CA70->slideRankY = 0; + D_8018CA70->timerX = 0xEA; + D_8018CA70->timerY = 0x10; + D_8018CA70->lapX = 0x101; + D_8018CA70->lapY = 0x6A; + D_8018CA70->unkC6 = -0x53; + D_8018CA70->unkC8 = 0x8F; + D_8018CA70->unkCA = 0; + D_8018CA70->unkCC = 0; + D_8018CA70->unkCE = 0xA0; + D_8018CA70->unkD0 = 0xB4; + D_8018CA70->unkE6 = 0x34; + D_8018CA70->unkE8 = 0xD2; + D_8018CA70->unkEA = 0; + D_8018CA70->unkEC = 0; + D_8018CA70->unkD2 = 0xEA; + D_8018CA70->unkDC = 0x7F; + D_8018CA70->unkDE = 0x101; + D_8018CA70->unkE4 = 0xDA; + if (gModeSelection == 3) { + D_8018CA70->itemBoxY = 0x5E; + D_8018CA70->unkC8 = 0xD0; } - D_8018CA70.unk88 = 0.5f; - D_8018CA70.unk6A = gPlayerPositions->unk0; - D_8018CA70.unkEE = gPlayerPositions->unk4; - D_8018CA70.unk4 = D_8018CA70.unk88; + D_8018CA70->unk88 = 0.5f; + D_8018CA70->stagingPosition = (s16) gPlayerPositions->unk0; + D_8018CA70->unkEE = (s16) gPlayerPositions->unk4; + D_8018CA70->rankScaling = D_8018CA70->unk88; func_8006EE7C(D_80183E88, 0x34, 0xEA, 0x101); func_8006EE7C(D_80183E8C); D_8018D3C4 = 0x1E; @@ -2232,29 +2226,28 @@ void func_80071A20(void) { temp_v0 = gModeSelection; D_8018D3C0 = 0x28; D_801657A2 = 0x666; - if (temp_v0 != GRAND_PRIX) { - if (temp_v0 != VERSUS) { - if (temp_v0 != BATTLE) { - return; - } - goto block_9; - } + switch (temp_v0) { /* irregular */ + case 0: + D_8018D158 = 8; + return; + case 2: block_9: D_8018D158 = 2; return; + case 3: + goto block_9; } - D_8018D158 = 8; } #else GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_80071A20.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? find_unused_obj_index(s32 *); // extern -? func_8006EE7C(s32, s16, s16, s16); // extern -? func_80070190(); // extern -? func_80070780(); // extern +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? find_unused_obj_index(s32 *); /* extern */ +? func_8006EE7C(s32, s16, s16, s16); /* extern */ +? func_80070190(); /* extern */ +? func_80070780(); /* extern */ extern s16 D_801657A2; extern s32 D_80183DA0; extern s32 D_80183DB8; @@ -2265,11 +2258,11 @@ extern s32 D_80183E88; extern s32 D_80183E8C; extern s32 D_80183E90; extern s32 D_80183E94; -extern ? D_8018CA70; extern s32 D_8018D158; extern s32 D_8018D3BC; extern s32 D_8018D3C0; extern s32 D_8018D3C4; +extern s8 D_8018EDF3; void func_80071C28(void) { f32 temp_f0; @@ -2286,87 +2279,87 @@ void func_80071C28(void) { find_unused_obj_index(&D_80183E94); func_80070190(); func_80070780(); - D_8018CA70.unkE6 = 0x11A; - D_8018CA70.unk16C = 0xD2; - D_8018CA70.unk14C = 0x2D; - D_8018CA70.unk168 = 0xD4; - D_8018CA70.unk176 = 0xC0; - D_8018CA70.unk1D0 = 0x2D; - D_8018CA70.unk1EE = 0x11A; - D_8018CA70.unk42 = -0x36; - D_8018CA70.unk44 = 0x36; - D_8018CA70.unk46 = 0; - D_8018CA70.unk48 = 0; - D_8018CA70.unk4A = 0x50; - D_8018CA70.unk4C = 0x3C; - D_8018CA70.unk62 = 0x25; - D_8018CA70.unk64 = 0x64; - D_8018CA70.unk66 = 0; - D_8018CA70.unk68 = 0; - D_8018CA70.unk5A = 0x8C; - D_8018CA70.unk60 = 0x60; - D_8018CA70.unk6C = 0xDE; - D_8018CA70.unk6E = 0xC8; - D_8018CA70.unkC6 = 0x175; - D_8018CA70.unkC8 = 0x36; - D_8018CA70.unkCA = 0; - D_8018CA70.unkCC = 0; - D_8018CA70.unkCE = 0xF0; - D_8018CA70.unkD0 = 0x3C; - D_8018CA70.unkE8 = 0x64; - D_8018CA70.unkEA = 0; - D_8018CA70.unkEC = 0; - D_8018CA70.unkDE = 0xB4; - D_8018CA70.unkE4 = 0x60; - D_8018CA70.unkF0 = 0xC8; - D_8018CA70.unkF2 = 0xC8; - D_8018CA70.unk14A = -0x36; - D_8018CA70.unk14E = 0; - D_8018CA70.unk150 = 0; - D_8018CA70.unk152 = 0x50; - D_8018CA70.unk154 = 0xB4; - D_8018CA70.unk16A = 0x25; - D_8018CA70.unk16E = 0; - D_8018CA70.unk170 = 0; - D_8018CA70.unk162 = 0x8C; - D_8018CA70.unk174 = 0xDE; - D_8018CA70.unk1CE = 0x175; - D_8018CA70.unk1D2 = 0; - D_8018CA70.unk1D4 = 0; - D_8018CA70.unk1D6 = 0xF0; - D_8018CA70.unk1D8 = 0xB4; - D_8018CA70.unk1F0 = 0xD2; - D_8018CA70.unk1F2 = 0; - D_8018CA70.unk1F4 = 0; - D_8018CA70.unk1E6 = 0xB4; - D_8018CA70.unk1EC = 0xD4; - D_8018CA70.unk1F8 = 0xC8; - D_8018CA70.unk1FA = 0xC0; - if (gModeSelection == BATTLE) { - D_8018CA70.unk44 = 0xC8; - D_8018CA70.unkC8 = 0xC8; - D_8018CA70.unk14C = 0xB8; - D_8018CA70.unk1D0 = 0xB8; + D_8018CA70->unkE6 = 0x11A; + D_8018CA70->unk16C = 0xD2; + D_8018CA70->unk14C = 0x2D; + D_8018CA70->unk168 = 0xD4; + D_8018CA70->unk176 = 0xC0; + D_8018CA70->unk1D0 = 0x2D; + D_8018CA70->unk1EE = 0x11A; + D_8018CA70->itemBoxX = -0x36; + D_8018CA70->itemBoxY = 0x36; + D_8018CA70->slideItemBoxX = 0; + D_8018CA70->slideItemBoxY = 0; + D_8018CA70->unk_4A = 0x50; + D_8018CA70->unk_4C = 0x3C; + D_8018CA70->rankX = 0x25; + D_8018CA70->rankY = 0x64; + D_8018CA70->slideRankX = 0; + D_8018CA70->slideRankY = 0; + D_8018CA70->lapX = 0x8C; + D_8018CA70->lapY = 0x60; + D_8018CA70->unk_6C = 0xDE; + D_8018CA70->unk_6E = 0xC8; + D_8018CA70->unkC6 = 0x175; + D_8018CA70->unkC8 = 0x36; + D_8018CA70->unkCA = 0; + D_8018CA70->unkCC = 0; + D_8018CA70->unkCE = 0xF0; + D_8018CA70->unkD0 = 0x3C; + D_8018CA70->unkE8 = 0x64; + D_8018CA70->unkEA = 0; + D_8018CA70->unkEC = 0; + D_8018CA70->unkDE = 0xB4; + D_8018CA70->unkE4 = 0x60; + D_8018CA70->unkF0 = 0xC8; + D_8018CA70->unkF2 = 0xC8; + D_8018CA70->unk14A = -0x36; + D_8018CA70->unk14E = 0; + D_8018CA70->unk150 = 0; + D_8018CA70->unk152 = 0x50; + D_8018CA70->unk154 = 0xB4; + D_8018CA70->unk16A = 0x25; + D_8018CA70->unk16E = 0; + D_8018CA70->unk170 = 0; + D_8018CA70->unk162 = 0x8C; + D_8018CA70->unk174 = 0xDE; + D_8018CA70->unk1CE = 0x175; + D_8018CA70->unk1D2 = 0; + D_8018CA70->unk1D4 = 0; + D_8018CA70->unk1D6 = 0xF0; + D_8018CA70->unk1D8 = 0xB4; + D_8018CA70->unk1F0 = 0xD2; + D_8018CA70->unk1F2 = 0; + D_8018CA70->unk1F4 = 0; + D_8018CA70->unk1E6 = 0xB4; + D_8018CA70->unk1EC = 0xD4; + D_8018CA70->unk1F8 = 0xC8; + D_8018CA70->unk1FA = 0xC0; + if (gModeSelection == 3) { + D_8018CA70->itemBoxY = 0xC8; + D_8018CA70->unkC8 = 0xC8; + D_8018CA70->unk14C = 0xB8; + D_8018CA70->unk1D0 = 0xB8; } - D_8018CA70.unk190 = 0.5f; - temp_f0 = D_8018CA70.unk190; - D_8018CA70.unk10C = temp_f0; - D_8018CA70.unk88 = temp_f0; - D_8018CA70.unk4 = temp_f0; - D_8018CA70.unk6A = gPlayerPositions->unk0; - D_8018CA70.unkEE = gPlayerPositions->unk4; - D_8018CA70.unk172 = gPlayerPositions->unk8; - D_8018CA70.unk1F6 = gPlayerPositions->unkC; + D_8018CA70->unk190 = 0.5f; + temp_f0 = D_8018CA70->unk190; + D_8018CA70->unk10C = temp_f0; + D_8018CA70->unk88 = temp_f0; + D_8018CA70->rankScaling = temp_f0; + D_8018CA70->stagingPosition = (s16) gPlayerPositions->unk0; + D_8018CA70->unkEE = (s16) gPlayerPositions->unk4; + D_8018CA70->unk172 = (s16) gPlayerPositions->unk8; + D_8018CA70->unk1F6 = (s16) gPlayerPositions->unkC; func_8006EE7C(D_80183E88, 0x36, 0x50, 0x3C); func_8006EE7C(D_80183E8C); func_8006EE7C(D_80183E90); func_8006EE7C(D_80183E94); - D_8018CA70.unk18C = 1.5f; - temp_f0_2 = D_8018CA70.unk18C; - D_8018CA70.unk108 = temp_f0_2; - D_8018CA70.unk84 = temp_f0_2; - D_8018CA70.unk0 = temp_f0_2; - D_8018D158 = D_8018EDF3; + D_8018CA70->unk18C = 1.5f; + temp_f0_2 = D_8018CA70->unk18C; + D_8018CA70->unk108 = temp_f0_2; + D_8018CA70->unk84 = temp_f0_2; + D_8018CA70->unknownScaling = temp_f0_2; + D_8018D158 = (s32) D_8018EDF3; D_8018D3C4 = 0x14; D_8018D3BC = 0x10; D_8018D3C0 = 0x1E; diff --git a/src/code_80071F00.c b/src/code_80071F00.c index 5c01bd911..e7a1b6f41 100644 --- a/src/code_80071F00.c +++ b/src/code_80071F00.c @@ -5795,9 +5795,9 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007B254.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_80040FD8(void *, ?, ?); /* extern */ -s32 func_8004106C(void *, ?, ?); /* extern */ +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? func_80040FD8(s16 *, ?, ?); /* extern */ +s32 func_8004106C(s16 *, ?, ?); /* extern */ ? func_800722CC(s32, ?); /* extern */ s32 func_80072320(s32, ?); /* extern */ s32 func_80072354(s32, ?); /* extern */ @@ -5811,41 +5811,111 @@ s32 func_80072354(s32, ?); /* extern */ ? func_80072E54(s32, ?, ?, ?, s32, s32); /* extern */ ? func_80073600(s32); /* extern */ ? func_8007AC9C(s32); /* extern */ +s8 func_8007AFB0(s32, s32); /* extern */ +s32 func_8007B040(s32, s32); /* extern */ ? func_8007B254(s32, s32); /* extern */ ? func_800C8F80(u8, ?); /* extern */ ? func_800C9018(u8, ?); /* extern */ +extern ? D_0D01DED8; +extern ? D_0D01E0D8; +extern ? D_0D01E2D8; +extern ? D_0D01E4D8; +extern ? D_0D01E6D8; +extern ? D_0D01E8D8; +extern ? D_0D01EAD8; +extern ? D_0D01ECD8; +extern ? D_0D01EED8; +extern ? D_0D01F0D8; +extern ? D_0D01F2D8; +extern ? D_0D01F4D8; +extern ? D_0D01F6D8; +extern ? D_0D01F8D8; +extern ? D_0D01FAD8; +extern ? D_0D01FCD8; +extern ? D_0D01FED8; +extern ? D_0D0203D8; +extern ? D_0D0208D8; +extern ? D_0D020DD8; +extern ? D_0D0212D8; +extern ? D_0D0217D8; +extern ? D_0D021CD8; +extern ? D_0D0221D8; +extern ? D_0D0226D8; +extern ? D_0D022BD8; +extern ? D_0D0230D8; +extern ? D_0D0235D8; +extern ? D_0D023AD8; +extern ? D_0D023FD8; +extern ? D_0D0244D8; +extern ? D_0D0249D8; +extern s8 D_80165888; extern ? D_80165C18; extern ? D_80183E88; -extern ? D_8018CA70; -static ? D_800E44F0; /* unable to generate initializer; const */ -static ? D_800E4530; /* unable to generate initializer; const */ +extern s32 gActiveScreenMode; +extern s32 gControllerOne; +static ? *D_800E44F0[0x10] = { + &D_0D01DED8, + &D_0D01E0D8, + &D_0D01E2D8, + &D_0D01F0D8, + &D_0D01F2D8, + &D_0D01F4D8, + &D_0D01F6D8, + &D_0D01ECD8, + &D_0D01FAD8, + &D_0D01FCD8, + &D_0D01F8D8, + &D_0D01EED8, + &D_0D01E4D8, + &D_0D01E6D8, + &D_0D01E8D8, + &D_0D01EAD8, +}; /* const */ +static ? *D_800E4530[0x10] = { + &D_0D01FED8, + &D_0D0203D8, + &D_0D0208D8, + &D_0D022BD8, + &D_0D0230D8, + &D_0D0235D8, + &D_0D023AD8, + &D_0D0221D8, + &D_0D0244D8, + &D_0D0249D8, + &D_0D023FD8, + &D_0D0226D8, + &D_0D020DD8, + &D_0D0212D8, + &D_0D0217D8, + &D_0D021CD8, +}; /* const */ void func_8007B34C(s32 playerId) { s32 sp40; - void *sp38; + Player *sp38; void *sp2C; - void *sp28; + struct_8018CA70_entry *sp28; s16 temp_a1; s16 temp_a1_2; s16 temp_a1_3; s16 temp_v0_6; s32 temp_s0; - s32 temp_t6_2; s32 temp_v0; s32 temp_v0_2; s32 temp_v0_4; + s8 temp_v0_7; + struct_8018CA70_entry *temp_v1; + struct_8018CA70_entry *temp_v1_2; + struct_8018CA70_entry *temp_v1_3; + struct_8018CA70_entry *temp_v1_4; + struct_8018CA70_entry *temp_v1_5; + struct_8018CA70_entry *temp_v1_6; u16 temp_t6; u16 temp_v0_3; u8 temp_v0_5; void *temp_t0; - void *temp_v1; - void *temp_v1_2; - void *temp_v1_3; - void *temp_v1_4; - void *temp_v1_5; - void *temp_v1_6; - sp38 = (playerId * 0xDD8) + gPlayerOne; + sp38 = &gPlayerOne[playerId]; sp40 = 0; temp_s0 = *(&D_80183E88 + (playerId * 4)); if ((((playerId * 0x10) + gControllerOne)->unk6 & 0x2000) != 0) { @@ -5858,103 +5928,103 @@ void func_8007B34C(s32 playerId) { sp2C = temp_t0; temp_t6 = temp_t0->unkA6; switch (temp_t6) { - case 0x1: + case 1: func_8007B254(temp_s0, playerId); break; - case 0x2: + case 2: temp_v0 = gActiveScreenMode; if (temp_v0 == 0) { - temp_v1 = (playerId * 0x84) + &D_8018CA70; + temp_v1 = &D_8018CA70[playerId]; sp28 = temp_v1; - func_80040FD8(temp_v1 + 0x48, 0x40, 4); - if (temp_v1->unk48 == 0x40) { + func_80040FD8(&temp_v1->slideItemBoxY, 0x40, 4); + if (temp_v1->slideItemBoxY == 0x40) { func_80072488(temp_s0); } } else if (temp_v0 == 3) { if ((playerId == 0) || (playerId == 2)) { - temp_v1_3 = (playerId * 0x84) + &D_8018CA70; - sp28 = temp_v1_3; - func_80040FD8(temp_v1_3 + 0x46, 0x80, 8); - if (temp_v1_3->unk46 == 0x80) { + temp_v1_2 = &D_8018CA70[playerId]; + sp28 = temp_v1_2; + func_80040FD8(&temp_v1_2->slideItemBoxX, 0x80, 8); + if (temp_v1_2->slideItemBoxX == 0x80) { func_80072488(temp_s0); } } else { - temp_v1_2 = (playerId * 0x84) + &D_8018CA70; - sp28 = temp_v1_2; - func_8004106C(temp_v1_2 + 0x46, -0x80, 8); - if (temp_v1_2->unk46 == -0x80) { + temp_v1_3 = &D_8018CA70[playerId]; + sp28 = temp_v1_3; + func_8004106C(&temp_v1_3->slideItemBoxX, -0x80, 8); + if (temp_v1_3->slideItemBoxX == -0x80) { func_80072488(temp_s0); } } } else { - temp_v1_4 = (playerId * 0x84) + &D_8018CA70; + temp_v1_4 = &D_8018CA70[playerId]; sp28 = temp_v1_4; - func_80040FD8(temp_v1_4 + 0x46, 0x80, 8); - if (temp_v1_4->unk46 == 0x80) { + func_80040FD8(&temp_v1_4->slideItemBoxX, 0x80, 8); + if (temp_v1_4->slideItemBoxX == 0x80) { func_80072488(temp_s0); } } break; - case 0x3: + case 3: func_80072E54(temp_s0, 1, 0xF, 1, 2, 2); break; - case 0x4: + case 4: func_80072E54(temp_s0, 1, 6, 1, 8, 1); break; - case 0x5: + case 5: func_80072E54(temp_s0, 1, 4, 1, 0x10, 1); break; - case 0x6: + case 6: sp2C->unkD2 = func_8007AFB0(temp_s0, playerId); sp2C->unk4C = 8; - sp2C->unkD6 = 2; + sp2C->unkD6 = 2U; func_80072488(temp_s0); - sp28 = playerId; - func_800C9018(playerId, 0x100FE1C); - func_800C8F80(playerId, 0x100FE47); + sp28 = (struct_8018CA70_entry *) (u8) playerId; + func_800C9018((u8) playerId, 0x0100FE1C); + func_800C8F80((u8) playerId, 0x0100FE47); break; - case 0x7: + case 7: func_80072D3C(temp_s0, sp2C->unkA2, 0, 8, 0xA); break; - case 0x9: + case 9: func_800722CC(temp_s0, 4); func_80073600(temp_s0); sp2C->unkD2 = 0; func_80072488(temp_s0); break; - case 0xA: + case 10: func_8007278C(temp_s0, 0x14); break; - case 0xB: + case 11: temp_v0_2 = gActiveScreenMode; if (temp_v0_2 == 0) { - if (func_8004106C((playerId * 0x84) + 0x48 + &D_8018CA70, 0, 4) != 0) { + if (func_8004106C((playerId * 0x84) + 0x48 + D_8018CA70, 0, 4) != 0) { func_80072488(temp_s0); } } else if (temp_v0_2 == 3) { if ((playerId == 0) || (playerId == 2)) { - temp_v1_6 = (playerId * 0x84) + &D_8018CA70; - sp28 = temp_v1_6; - func_8004106C(temp_v1_6 + 0x46, 0, 8); - if (temp_v1_6->unk46 == 0) { + temp_v1_5 = &D_8018CA70[playerId]; + sp28 = temp_v1_5; + func_8004106C(&temp_v1_5->slideItemBoxX, 0, 8); + if (temp_v1_5->slideItemBoxX == 0) { func_80072488(temp_s0); } } else { - temp_v1_5 = (playerId * 0x84) + &D_8018CA70; - sp28 = temp_v1_5; - func_80040FD8(temp_v1_5 + 0x46, 0, 8); - if (temp_v1_5->unk46 == 0) { + temp_v1_6 = &D_8018CA70[playerId]; + sp28 = temp_v1_6; + func_80040FD8(&temp_v1_6->slideItemBoxX, 0, 8); + if (temp_v1_6->slideItemBoxX == 0) { func_80072488(temp_s0); } } - } else if (func_8004106C((playerId * 0x84) + 0x46 + &D_8018CA70, 0, 8) != 0) { + } else if (func_8004106C((playerId * 0x84) + 0x46 + D_8018CA70, 0, 8) != 0) { func_80072488(temp_s0); } break; - case 0xC: + case 12: func_80072428(temp_s0); break; - case 0x14: + case 20: temp_a1 = sp2C->unkA2; if (temp_a1 == 0xB) { func_80072D3C(temp_s0, temp_a1, 0, 8, 0xA); @@ -5962,11 +6032,11 @@ void func_8007B34C(s32 playerId) { func_80072D3C(temp_s0, temp_a1, 0xB, 8, 0xA); } break; - case 0x15: + case 21: func_800726CC(temp_s0, 8); - sp2C->unkD6 = 2; + sp2C->unkD6 = 2U; break; - case 0x1E: + case 30: temp_a1_2 = sp2C->unkA2; if (temp_a1_2 == 0xB) { func_80072D3C(temp_s0, temp_a1_2, 0, 8, 0xA); @@ -5974,10 +6044,10 @@ void func_8007B34C(s32 playerId) { func_80072D3C(temp_s0, temp_a1_2, 0xB, 8, 0xA); } break; - case 0x1F: + case 31: func_800726CC(temp_s0, 9); break; - case 0x28: + case 40: temp_a1_3 = sp2C->unkA2; if (temp_a1_3 == 0xD) { func_80072D3C(temp_s0, temp_a1_3, 0xE, 8, 0xA); @@ -5985,10 +6055,10 @@ void func_8007B34C(s32 playerId) { func_80072D3C(temp_s0, temp_a1_3, 0xD, 8, 0xA); } break; - case 0x29: + case 41: func_800726CC(temp_s0, 8); break; - case 0x32: + case 50: func_80072D3C(temp_s0, sp2C->unkA2, 0, 8, 0x64); break; } @@ -5997,57 +6067,59 @@ void func_8007B34C(s32 playerId) { if (temp_v0_3 == 0) { func_8007AC9C(playerId); } else { - sp2C->unk98 = temp_v0_3 - 1; + sp2C->unk98 = (u16) (temp_v0_3 - 1); } } temp_v0_4 = sp2C->unk4C; if (temp_v0_4 >= 0) { if (temp_v0_4 > 0) { - sp2C->unk4C = temp_v0_4 - 1; + sp2C->unk4C = (s32) (temp_v0_4 - 1); } else { temp_v0_5 = sp2C->unkD6; - if (temp_v0_5 != 1) { - if (temp_v0_5 != 2) { - if (temp_v0_5 != 3) { - - } else if (sp2C->unkA4 == 0) { - if (func_80072354(temp_s0, 1) != 0) { - temp_v0_6 = sp2C->unkA2; - if (temp_v0_6 == 0xB) { - if (func_8007B040(temp_s0, playerId) != 0) { - func_800726CC(temp_s0, 0x14); - sp2C->unkD6 = 0; - } else { - func_800726CC(temp_s0, 9); - } - } else if ((temp_v0_6 == 0xD) || (temp_v0_6 == 0xE)) { - sp2C->unkA2 = temp_v0_6 - 1; - func_800729D0(temp_s0, sp2C->unkA2); - sp2C->unkD6 = 3; - func_800726CC(temp_s0, 0x28); + switch (temp_v0_5) { /* switch 1; irregular */ + case 1: /* switch 1 */ + if (sp40 != 0) { + func_80073600(temp_s0); + func_800726CC(temp_s0, 6); + } + break; + case 2: /* switch 1 */ + func_800729D0(temp_s0, sp2C->unkA2); + sp2C->unkD6 = 3U; + break; + case 3: /* switch 1 */ + if (sp2C->unkA4 == 0) { + if (func_80072354(temp_s0, 1) != 0) { + temp_v0_6 = sp2C->unkA2; + if (temp_v0_6 == 0xB) { + if (func_8007B040(temp_s0, playerId) != 0) { + func_800726CC(temp_s0, 0x14); + sp2C->unkD6 = 0U; } else { func_800726CC(temp_s0, 9); } + } else if ((temp_v0_6 == 0xD) || (temp_v0_6 == 0xE)) { + sp2C->unkA2 = (s16) (temp_v0_6 - 1); + func_800729D0(temp_s0, sp2C->unkA2); + sp2C->unkD6 = 3U; + func_800726CC(temp_s0, 0x28); } else { - func_800722CC(temp_s0, 1); - func_800726CC(temp_s0, 0x1E); - sp2C->unkD6 = 0; + func_800726CC(temp_s0, 9); } + } else { + func_800722CC(temp_s0, 1); + func_800726CC(temp_s0, 0x1E); + sp2C->unkD6 = 0U; } - } else { - func_800729D0(temp_s0, sp2C->unkA2); - sp2C->unkD6 = 3; } - } else if (sp40 != 0) { - func_80073600(temp_s0); - func_800726CC(temp_s0, 6); + break; } } } - temp_t6_2 = sp2C->unkD2 * 4; - sp2C->unk60 = *(&D_800E44F0 + temp_t6_2); - sp2C->unk64 = *(&D_800E4530 + temp_t6_2); - sp38->unk10 = sp2C->unkA4; + temp_v0_7 = sp2C->unkD2; + sp2C->unk60 = (? *) D_800E44F0[temp_v0_7]; + sp2C->unk64 = (? *) D_800E4530[temp_v0_7]; + sp38->unk_010 = sp2C->unkA4; } #else GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007B34C.s") diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c index c915f263e..87fbf8617 100644 --- a/src/code_800AF9B0.c +++ b/src/code_800AF9B0.c @@ -3072,48 +3072,44 @@ GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5020.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800B45E0(s32); // extern -? populate_time_trial_record(void *, u32, s32, s32); // extern -s32 func_800B4F2C(s32, ? *, ? *, s32); // extern -extern ? D_8018CA70; +//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +? populate_time_trial_record(u8 *, u32, s32, s32); /* extern */ extern ? D_8018CA74; -extern ? D_8018EB90; -extern s8 gCupSelection; +s8 gCharacterSelections[4]; /* unable to generate initializer; const */ s32 func_800B5218(void) { s32 sp38; s32 sp28; s32 sp24; - void *sp20; - ? *sp18; + u8 *sp20; + struct_8018CA70_entry *sp18; ? *temp_a1; s32 temp_a0; s32 temp_v0; s32 temp_v1; u32 temp_a1_2; - void *temp_v0_2; + u8 *temp_v0_2; ? *phi_a1; - ? *phi_a2; + struct_8018CA70_entry *phi_a2; s32 phi_v0; - ? *phi_a2_2; + struct_8018CA70_entry *phi_a2_2; s32 phi_a3; s32 phi_v0_2; s32 phi_a3_2; sp38 = (gCupSelection * 4) + gCupCourseSelection; - sp28 = *gCharacterSelections; + sp28 = (s32) *gCharacterSelections; phi_a1 = &D_8018CA74; - phi_a2 = &D_8018CA70; + phi_a2 = D_8018CA70; phi_v0 = 1; phi_a3_2 = 1; do { temp_v1 = phi_a1->unk20; - temp_a0 = phi_a2->unk20; + temp_a0 = phi_a2->lap1Duration; phi_a2_2 = phi_a2; phi_a3 = phi_a3_2; if (temp_v1 < temp_a0) { - phi_a2_2 = (phi_v0 * 4) + &D_8018CA70; + phi_a2_2 = (phi_v0 * 4) + D_8018CA70; phi_a3 = 1 << phi_v0; } else if (temp_a0 == temp_v1) { phi_a3 = phi_a3_2 | (1 << phi_v0); @@ -3127,10 +3123,10 @@ s32 func_800B5218(void) { } while (temp_v0 != 3); sp18 = phi_a2_2; sp24 = phi_a3; - temp_a1_2 = phi_a2_2->unk20; + temp_a1_2 = phi_a2_2->lap1Duration; phi_v0_2 = 0; - if (temp_a1_2 < (func_800B4F2C(temp_a0, temp_a1, phi_a2_2, phi_a3) & 0xFFFFF)) { - temp_v0_2 = ((sp38 / 4) * 0x60) + ((sp38 % 4) * 0x18) + &D_8018EB90; + if (temp_a1_2 < (u32) (func_800B4F2C(temp_a0, temp_a1, phi_a2_2, phi_a3) & 0xFFFFF)) { + temp_v0_2 = &D_8018EB90.allCourseTimeTrialRecords.cupRecords[sp38].courseRecords[sp38].records[0]; sp20 = temp_v0_2; sp24 = phi_a3; populate_time_trial_record(temp_v0_2 + 0xF, temp_a1_2, sp28, phi_a3);