diff --git a/asm/non_matchings/camera/func_8001D794.s b/asm/non_matchings/camera/func_8001D794.s deleted file mode 100644 index 75ae449ac..000000000 --- a/asm/non_matchings/camera/func_8001D794.s +++ /dev/null @@ -1,109 +0,0 @@ -glabel func_8001D794 -/* 01E394 8001D794 27BDFF70 */ addiu $sp, $sp, -0x90 -/* 01E398 8001D798 AFBF0034 */ sw $ra, 0x34($sp) -/* 01E39C 8001D79C AFB20030 */ sw $s2, 0x30($sp) -/* 01E3A0 8001D7A0 AFB1002C */ sw $s1, 0x2c($sp) -/* 01E3A4 8001D7A4 AFB00028 */ sw $s0, 0x28($sp) -/* 01E3A8 8001D7A8 F7B40020 */ sdc1 $f20, 0x20($sp) -/* 01E3AC 8001D7AC AFA7009C */ sw $a3, 0x9c($sp) -/* 01E3B0 8001D7B0 C4A40030 */ lwc1 $f4, 0x30($a1) -/* 01E3B4 8001D7B4 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 01E3B8 8001D7B8 4481A000 */ mtc1 $at, $f20 -/* 01E3BC 8001D7BC E7A40060 */ swc1 $f4, 0x60($sp) -/* 01E3C0 8001D7C0 C4A60034 */ lwc1 $f6, 0x34($a1) -/* 01E3C4 8001D7C4 3C0140C0 */ li $at, 0x40C00000 # 6.000000 -/* 01E3C8 8001D7C8 44815000 */ mtc1 $at, $f10 -/* 01E3CC 8001D7CC E7A60064 */ swc1 $f6, 0x64($sp) -/* 01E3D0 8001D7D0 C4A80038 */ lwc1 $f8, 0x38($a1) -/* 01E3D4 8001D7D4 44800000 */ mtc1 $zero, $f0 -/* 01E3D8 8001D7D8 00A08025 */ move $s0, $a1 -/* 01E3DC 8001D7DC 460A4101 */ sub.s $f4, $f8, $f10 -/* 01E3E0 8001D7E0 00C08825 */ move $s1, $a2 -/* 01E3E4 8001D7E4 00809025 */ move $s2, $a0 -/* 01E3E8 8001D7E8 44070000 */ mfc1 $a3, $f0 -/* 01E3EC 8001D7EC E7A40068 */ swc1 $f4, 0x68($sp) -/* 01E3F0 8001D7F0 C4A6003C */ lwc1 $f6, 0x3c($a1) -/* 01E3F4 8001D7F4 27A4006C */ addiu $a0, $sp, 0x6c -/* 01E3F8 8001D7F8 E7A60054 */ swc1 $f6, 0x54($sp) -/* 01E3FC 8001D7FC C4A80040 */ lwc1 $f8, 0x40($a1) -/* 01E400 8001D800 E7A80058 */ swc1 $f8, 0x58($sp) -/* 01E404 8001D804 C4AA0044 */ lwc1 $f10, 0x44($a1) -/* 01E408 8001D808 E7AA005C */ swc1 $f10, 0x5c($sp) -/* 01E40C 8001D80C C4A4000C */ lwc1 $f4, 0xc($a1) -/* 01E410 8001D810 E4C40000 */ swc1 $f4, ($a2) -/* 01E414 8001D814 C4A60010 */ lwc1 $f6, 0x10($a1) -/* 01E418 8001D818 E4C60004 */ swc1 $f6, 4($a2) -/* 01E41C 8001D81C C4A80014 */ lwc1 $f8, 0x14($a1) -/* 01E420 8001D820 44050000 */ mfc1 $a1, $f0 -/* 01E424 8001D824 E4C80008 */ swc1 $f8, 8($a2) -/* 01E428 8001D828 87AE00AA */ lh $t6, 0xaa($sp) -/* 01E42C 8001D82C 4406A000 */ mfc1 $a2, $f20 -/* 01E430 8001D830 0C0AD950 */ jal func_802B6540 -/* 01E434 8001D834 AFAE0010 */ sw $t6, 0x10($sp) -/* 01E438 8001D838 27A40054 */ addiu $a0, $sp, 0x54 -/* 01E43C 8001D83C 0C0AD8EE */ jal func_802B63B8 -/* 01E440 8001D840 27A5006C */ addiu $a1, $sp, 0x6c -/* 01E444 8001D844 C7AA0054 */ lwc1 $f10, 0x54($sp) -/* 01E448 8001D848 C6440014 */ lwc1 $f4, 0x14($s2) -/* 01E44C 8001D84C C7A6005C */ lwc1 $f6, 0x5c($sp) -/* 01E450 8001D850 C648001C */ lwc1 $f8, 0x1c($s2) -/* 01E454 8001D854 46045380 */ add.s $f14, $f10, $f4 -/* 01E458 8001D858 C6440018 */ lwc1 $f4, 0x18($s2) -/* 01E45C 8001D85C C7AA0058 */ lwc1 $f10, 0x58($sp) -/* 01E460 8001D860 46083400 */ add.s $f16, $f6, $f8 -/* 01E464 8001D864 C608000C */ lwc1 $f8, 0xc($s0) -/* 01E468 8001D868 C6260000 */ lwc1 $f6, ($s1) -/* 01E46C 8001D86C 46045480 */ add.s $f18, $f10, $f4 -/* 01E470 8001D870 27A40060 */ addiu $a0, $sp, 0x60 -/* 01E474 8001D874 27A5006C */ addiu $a1, $sp, 0x6c -/* 01E478 8001D878 46087281 */ sub.s $f10, $f14, $f8 -/* 01E47C 8001D87C 46145102 */ mul.s $f4, $f10, $f20 -/* 01E480 8001D880 C62A0004 */ lwc1 $f10, 4($s1) -/* 01E484 8001D884 46043200 */ add.s $f8, $f6, $f4 -/* 01E488 8001D888 E6280000 */ swc1 $f8, ($s1) -/* 01E48C 8001D88C C6060010 */ lwc1 $f6, 0x10($s0) -/* 01E490 8001D890 46069101 */ sub.s $f4, $f18, $f6 -/* 01E494 8001D894 46142202 */ mul.s $f8, $f4, $f20 -/* 01E498 8001D898 C6240008 */ lwc1 $f4, 8($s1) -/* 01E49C 8001D89C 46085180 */ add.s $f6, $f10, $f8 -/* 01E4A0 8001D8A0 E6260004 */ swc1 $f6, 4($s1) -/* 01E4A4 8001D8A4 C60A0014 */ lwc1 $f10, 0x14($s0) -/* 01E4A8 8001D8A8 460A8201 */ sub.s $f8, $f16, $f10 -/* 01E4AC 8001D8AC 46144182 */ mul.s $f6, $f8, $f20 -/* 01E4B0 8001D8B0 46062280 */ add.s $f10, $f4, $f6 -/* 01E4B4 8001D8B4 0C0AD8EE */ jal func_802B63B8 -/* 01E4B8 8001D8B8 E62A0008 */ swc1 $f10, 8($s1) -/* 01E4BC 8001D8BC C7A80060 */ lwc1 $f8, 0x60($sp) -/* 01E4C0 8001D8C0 C6440014 */ lwc1 $f4, 0x14($s2) -/* 01E4C4 8001D8C4 C7A60068 */ lwc1 $f6, 0x68($sp) -/* 01E4C8 8001D8C8 C64A001C */ lwc1 $f10, 0x1c($s2) -/* 01E4CC 8001D8CC 46044380 */ add.s $f14, $f8, $f4 -/* 01E4D0 8001D8D0 C6000000 */ lwc1 $f0, ($s0) -/* 01E4D4 8001D8D4 C6440018 */ lwc1 $f4, 0x18($s2) -/* 01E4D8 8001D8D8 460A3400 */ add.s $f16, $f6, $f10 -/* 01E4DC 8001D8DC C7A80064 */ lwc1 $f8, 0x64($sp) -/* 01E4E0 8001D8E0 8FAF009C */ lw $t7, 0x9c($sp) -/* 01E4E4 8001D8E4 46007181 */ sub.s $f6, $f14, $f0 -/* 01E4E8 8001D8E8 46044480 */ add.s $f18, $f8, $f4 -/* 01E4EC 8001D8EC 46143282 */ mul.s $f10, $f6, $f20 -/* 01E4F0 8001D8F0 46005200 */ add.s $f8, $f10, $f0 -/* 01E4F4 8001D8F4 E5E80000 */ swc1 $f8, ($t7) -/* 01E4F8 8001D8F8 C6020004 */ lwc1 $f2, 4($s0) -/* 01E4FC 8001D8FC 8FB800A0 */ lw $t8, 0xa0($sp) -/* 01E500 8001D900 46029101 */ sub.s $f4, $f18, $f2 -/* 01E504 8001D904 46142182 */ mul.s $f6, $f4, $f20 -/* 01E508 8001D908 46023280 */ add.s $f10, $f6, $f2 -/* 01E50C 8001D90C E70A0000 */ swc1 $f10, ($t8) -/* 01E510 8001D910 C60C0008 */ lwc1 $f12, 8($s0) -/* 01E514 8001D914 8FB900A4 */ lw $t9, 0xa4($sp) -/* 01E518 8001D918 460C8201 */ sub.s $f8, $f16, $f12 -/* 01E51C 8001D91C 46144102 */ mul.s $f4, $f8, $f20 -/* 01E520 8001D920 460C2180 */ add.s $f6, $f4, $f12 -/* 01E524 8001D924 E7260000 */ swc1 $f6, ($t9) -/* 01E528 8001D928 8FBF0034 */ lw $ra, 0x34($sp) -/* 01E52C 8001D92C 8FB20030 */ lw $s2, 0x30($sp) -/* 01E530 8001D930 8FB1002C */ lw $s1, 0x2c($sp) -/* 01E534 8001D934 8FB00028 */ lw $s0, 0x28($sp) -/* 01E538 8001D938 D7B40020 */ ldc1 $f20, 0x20($sp) -/* 01E53C 8001D93C 03E00008 */ jr $ra -/* 01E540 8001D940 27BD0090 */ addiu $sp, $sp, 0x90 diff --git a/asm/non_matchings/memory/func_802AF9F0.s b/asm/non_matchings/memory/func_802AF9F0.s deleted file mode 100644 index 39bfc49ce..000000000 --- a/asm/non_matchings/memory/func_802AF9F0.s +++ /dev/null @@ -1,18 +0,0 @@ -glabel func_802AF9F0 -/* 119000 802AF9F0 44856000 */ mtc1 $a1, $f12 -/* 119004 802AF9F4 C4860000 */ lwc1 $f6, ($a0) -/* 119008 802AF9F8 C4C40000 */ lwc1 $f4, ($a2) -/* 11900C 802AF9FC C4D00004 */ lwc1 $f16, 4($a2) -/* 119010 802AFA00 460C3202 */ mul.s $f8, $f6, $f12 -/* 119014 802AFA04 46082281 */ sub.s $f10, $f4, $f8 -/* 119018 802AFA08 C4C80008 */ lwc1 $f8, 8($a2) -/* 11901C 802AFA0C E4CA0000 */ swc1 $f10, ($a2) -/* 119020 802AFA10 C4920004 */ lwc1 $f18, 4($a0) -/* 119024 802AFA14 460C9182 */ mul.s $f6, $f18, $f12 -/* 119028 802AFA18 46068101 */ sub.s $f4, $f16, $f6 -/* 11902C 802AFA1C E4C40004 */ swc1 $f4, 4($a2) -/* 119030 802AFA20 C48A0008 */ lwc1 $f10, 8($a0) -/* 119034 802AFA24 460C5482 */ mul.s $f18, $f10, $f12 -/* 119038 802AFA28 46124401 */ sub.s $f16, $f8, $f18 -/* 11903C 802AFA2C 03E00008 */ jr $ra -/* 119040 802AFA30 E4D00008 */ swc1 $f16, 8($a2) diff --git a/include/common_structs.h b/include/common_structs.h index e7c6b3dcc..c278d5967 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -191,9 +191,7 @@ typedef struct { } mk64_surface_map_ram; // size = 0x2C typedef struct { - /* 0x00 */ f32 cornerX; - /* 0x04 */ f32 cornerY; - /* 0x08 */ f32 cornerZ; + /* 0x00 */ Vec3f cornerPos; // Type of surface the corner is above /* 0x0C */ u8 surfaceType; // Close to being a copy of the top byte of the surface_map "flag" member @@ -201,7 +199,7 @@ typedef struct { // Don't know if "tile" is right the right term // D_8015F580 is a pointer to an array of "tile" structs. This is an index to that array /* 0x0E */ u16 surfaceMapIndex; - // cornerX/Y/Z place the corner "in the air" as it were, this member indicates the Y position of the corner's "on the ground" sibling + // cornerPos places the corner "in the air" as it were, this member indicates the Y position of the corner's "on the ground" sibling // On flat ground this value should be cornerY - gKartBoundingBoxTable[characterId] /* 0x10 */ f32 cornerGroundY; // Something lighting related. 1 when in a shaded region, 2 when in a tree's shadow @@ -274,7 +272,14 @@ typedef struct { /* 0x00C6 */ s16 unk_0C6; /* 0x00C8 */ s16 unk_0C8; /* 0x00CA */ s16 unk_0CA; - /* 0x00CC */ char unk_0CC[0x10]; + /* 0x00CC */ s16 unk_0CC; + /* 0x00CE */ s16 unk_0CE; + /* 0x00D0 */ s16 unk_0D0; + /* 0x00D2 */ s16 unk_0D2; + /* 0x00D4 */ s16 unk_0D4; + /* 0x00D6 */ s16 unk_0D6; + /* 0x00D8 */ s16 unk_0D8; + /* 0x00DA */ s16 unk_0DA; /* 0x00DC */ s16 boostTimer; /* 0x00DE */ u16 unk_0DE; /* 0x00E0 */ s16 unk_0E0; diff --git a/include/functions.h b/include/functions.h index 24fd47363..4848ddb92 100644 --- a/include/functions.h +++ b/include/functions.h @@ -7,7 +7,6 @@ void mio0decode(u8* arg0, u8* arg1); void func_8000F2DC(void); void func_8000F628(void); -void func_802B6540(f32* arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4); void func_8006B7E4(Player* player, s32 arg1); void func_800267AC(Player* player, s8 arg1, s8 arg2); void func_8005D290(void); diff --git a/include/waypoints.h b/include/waypoints.h index c625c30b5..9a2e58eca 100644 --- a/include/waypoints.h +++ b/include/waypoints.h @@ -39,6 +39,8 @@ extern s16 *D_801645A0[]; extern s16 D_80162FCE; // Shadows values from gPathIndexByPlayerId extern s32 D_80163448; +// Shadows values from gPathIndexByPlayerId, but is an array +extern u16 D_80165310[]; // Shadows values from D_80164560 extern struct TrackWayPoint *D_801631D0; // Shadows values from D_80164570 diff --git a/src/audio/external.c b/src/audio/external.c index 7c07c8d54..52dad1c23 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -26,22 +26,21 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C13FC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b extern ? D_80191420; f32 func_800C1480(s32 arg0, s32 arg1) { - ? sp-10; f32 temp_f0; f32 temp_f12; + f32 var_f2; + f32 var_f2_2; s32 temp_v0_2; s32 temp_v1; + s32 var_v0; void *temp_v0; - s32 phi_v0; - f32 phi_f2; - f32 phi_f2_2; - sp-10.unk10 = arg0; - sp-10.unk14 = arg1; + unksp-10.unk10 = arg0; + unksp-10.unk14 = arg1; temp_v0 = ((arg0 & 0xFF) * 0x3C0) + ((arg1 & 0xFF) * 0x30) + &D_80191420; temp_v1 = temp_v0->unk24; if (temp_v1 & 0x400000) { @@ -50,30 +49,31 @@ f32 func_800C1480(s32 arg0, s32 arg1) { temp_f0 = temp_v0->unk1C; temp_v0_2 = temp_v1 & 0x30000; if (temp_f0 > 2000.0f) { - phi_f2 = 0.0f; + var_f2 = 0.0f; } else { - if (temp_v0_2 != 0x10000) { - if (temp_v0_2 != 0x20000) { - if (temp_v0_2 != 0x30000) { - phi_v0 = 0x190; - } else { - phi_v0 = 0x3E8; - } - } else { - phi_v0 = 0x29A; - } - } else { - phi_v0 = 0x1F4; + switch (temp_v0_2) { /* irregular */ + default: + var_v0 = 0x190; + break; + case 0x10000: + var_v0 = 0x1F4; + break; + case 0x20000: + var_v0 = 0x29A; + break; + case 0x30000: + var_v0 = 0x3E8; + break; } - temp_f12 = phi_v0; + temp_f12 = (f32) var_v0; if (temp_f0 < temp_f12) { - phi_f2_2 = (((temp_f12 - temp_f0) / temp_f12) * 0.5) + 0.5; + var_f2_2 = (f32) (((f64) ((temp_f12 - temp_f0) / temp_f12) * 0.5) + 0.5); } else { - phi_f2_2 = (1.0 - ((temp_f0 - temp_f12) / (2000.0f - temp_f12))) * 0.5; + var_f2_2 = (f32) ((1.0 - (f64) ((temp_f0 - temp_f12) / (2000.0f - temp_f12))) * 0.5); } - phi_f2 = phi_f2_2 * phi_f2_2; + var_f2 = var_f2_2 * var_f2_2; } - return phi_f2; + return var_f2; } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C1480.s") diff --git a/src/audio/load.c b/src/audio/load.c index a07be1a96..9a6acddbe 100644 --- a/src/audio/load.c +++ b/src/audio/load.c @@ -230,34 +230,27 @@ void *func_800BAD0C(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) { return (devAddr - dmaDevAddr) + dma->buffer; } -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 osPiStartDma(void *, ?, ?, s32, s32, s32, ? *); // extern -extern OSMesgQueue gCurrAudioFrameDmaQueue; -extern OSIoMesg gCurrAudioFrameDmaIoMesgBufs; -extern ? sSampleDmas; -extern u32 gSampleDmaNumListItems; -extern u32 sSampleDmaListSize1; -extern u8 sSampleDmaReuseQueue1; -extern u8 sSampleDmaReuseQueue2; -extern u8 sSampleDmaReuseQueueTail1; -extern u8 sSampleDmaReuseQueueTail2; -extern u8 sSampleDmaReuseQueueHead2; +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b extern s32 gCurrAudioFrameDmaCount; -s32 func_800BAD0C(s32 arg0, s32 arg1, s32 arg2, u8 *arg3) { - void *sp40; +void *func_800BAD0C(u32 devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) { + struct SharedDma *sp40; s32 sp30; - s32 temp_s0; s32 temp_t9; s32 temp_v0_2; s32 temp_v0_4; - s32 temp_v1_6; + s32 temp_v1_3; + s32 var_t2; + s32 var_t3; + struct SharedDma *temp_t0; + struct SharedDma *var_a0; + struct SharedDma *var_t0; u16 temp_v0_6; u32 temp_a1; u32 temp_a1_2; - u32 temp_v1; - u32 temp_v1_3; - u32 temp_v1_4; + u32 temp_s0; + u32 var_v1; + u32 var_v1_2; u8 *temp_v0_3; u8 *temp_v0_5; u8 temp_a0; @@ -265,120 +258,102 @@ s32 func_800BAD0C(s32 arg0, s32 arg1, s32 arg2, u8 *arg3) { u8 temp_a1_4; u8 temp_a3; u8 temp_t2; - u8 temp_t2_2; u8 temp_v0; + u8 temp_v1; u8 temp_v1_2; - u8 temp_v1_5; - void *temp_t0; - void *temp_t0_2; - void *phi_t0; - u32 phi_v1; - void *phi_a0; - u8 phi_v1_2; - s32 phi_t3; - void *phi_t0_2; - s32 phi_t2; - phi_t3 = 0; - phi_t3 = 0; - if ((arg2 != 0) || (temp_a1 = sSampleDmaListSize1, temp_v0 = *arg3, phi_v1 = 0, ((temp_v0 < temp_a1) == 0))) { + var_t3 = 0; + if ((arg2 != 0) || (temp_a1 = sSampleDmaListSize1, temp_v0 = *dmaIndexRef, var_v1 = 0, ((temp_v0 < temp_a1) == 0))) { temp_a1_2 = gSampleDmaNumListItems; - temp_v1_3 = sSampleDmaListSize1; - phi_v1_2 = temp_v1_3; - if (temp_v1_3 < temp_a1_2) { - phi_a0 = (temp_v1_3 * 0x10) + &sSampleDmas; + var_v1_2 = sSampleDmaListSize1; + if (var_v1_2 < temp_a1_2) { + var_a0 = &sSampleDmas[var_v1_2]; loop_4: - temp_v0_4 = arg0 - phi_a0->unk4; - if ((temp_v0_4 >= 0) && ((phi_a0->unkA - arg1) >= temp_v0_4)) { - if (phi_a0->unkE == 0) { + temp_t0 = var_a0; + temp_v0_2 = devAddr - var_a0->source; + if ((temp_v0_2 >= 0) && ((u32) (var_a0->bufSize - size) >= (u32) temp_v0_2)) { + if (var_a0->ttl == 0) { temp_a1_3 = sSampleDmaReuseQueueTail2; if (sSampleDmaReuseQueueHead2 != temp_a1_3) { - temp_a3 = phi_a0->unkD; - temp_v0_5 = &sSampleDmaReuseQueue2 + temp_a1_3; + temp_a3 = var_a0->reuseIndex; + temp_v0_3 = &sSampleDmaReuseQueue2[temp_a1_3]; if (temp_a1_3 != temp_a3) { - *(&sSampleDmaReuseQueue2 + temp_a3) = *temp_v0_5; - (&sSampleDmas + (*temp_v0_5 * 0x10))->unkD = phi_a0->unkD; + sSampleDmaReuseQueue2[temp_a3] = *temp_v0_3; + sSampleDmas[*temp_v0_3].reuseIndex = var_a0->reuseIndex; } sSampleDmaReuseQueueTail2 = temp_a1_3 + 1; } } - phi_a0->unkE = 0x3C; - *arg3 = phi_v1_2; - return (phi_a0->unk0 + arg0) - phi_a0->unk4; + var_a0->ttl = 0x3C; + *dmaIndexRef = (u8) var_v1_2; + return &var_a0->buffer[devAddr] - var_a0->source; } - temp_v1_4 = phi_v1_2 + 1; - phi_a0 += 0x10; - phi_v1_2 = temp_v1_4; - if (temp_v1_4 >= temp_a1_2) { - sp40 = phi_a0; + var_v1_2 += 1; + var_a0 += 0x10; + if (var_v1_2 >= temp_a1_2) { + sp40 = temp_t0; goto block_14; } goto loop_4; } block_14: temp_a1_4 = sSampleDmaReuseQueueTail2; - phi_t0_2 = sp40; + var_t0 = sp40; if ((sSampleDmaReuseQueueHead2 != temp_a1_4) && (arg2 != 0)) { - temp_t2 = *(&sSampleDmaReuseQueue2 + temp_a1_4); + temp_t2 = sSampleDmaReuseQueue2[temp_a1_4]; sSampleDmaReuseQueueTail2 = temp_a1_4 + 1; - sp30 = temp_t2; - phi_t3 = 1; - phi_t0_2 = &sSampleDmas + (temp_t2 * 0x10); + var_t0 = &sSampleDmas[temp_t2]; + var_t3 = 1; + sp30 = (s32) temp_t2; } goto block_27; } - temp_t0 = &sSampleDmas + (temp_v0 * 0x10); - phi_t0 = temp_t0; - phi_t0_2 = temp_t0; + var_t0 = &sSampleDmas[temp_v0]; if (temp_a1 != 0) { loop_19: - temp_v1 = phi_v1 + 1; - temp_v0_2 = arg0 - phi_t0->unk4; - phi_v1 = temp_v1; - if ((temp_v0_2 >= 0) && ((phi_t0->unkA - arg1) >= temp_v0_2)) { - if (phi_t0->unkE == 0) { - temp_v1_2 = sSampleDmaReuseQueueTail1; - temp_a0 = phi_t0->unkD; - temp_v0_3 = &sSampleDmaReuseQueue1 + temp_v1_2; - if (temp_v1_2 != temp_a0) { - *(&sSampleDmaReuseQueue1 + temp_a0) = *temp_v0_3; - (&sSampleDmas + (*temp_v0_3 * 0x10))->unkD = phi_t0->unkD; + temp_t9 = var_v1 * 0x10; + var_v1 += 1; + temp_v0_4 = devAddr - var_t0->source; + if ((temp_v0_4 >= 0) && ((u32) (var_t0->bufSize - size) >= (u32) temp_v0_4)) { + if (var_t0->ttl == 0) { + temp_v1 = sSampleDmaReuseQueueTail1; + temp_a0 = var_t0->reuseIndex; + temp_v0_5 = &sSampleDmaReuseQueue1[temp_v1]; + if (temp_v1 != temp_a0) { + sSampleDmaReuseQueue1[temp_a0] = *temp_v0_5; + sSampleDmas[*temp_v0_5].reuseIndex = var_t0->reuseIndex; } - sSampleDmaReuseQueueTail1 = temp_v1_2 + 1; + sSampleDmaReuseQueueTail1 = temp_v1 + 1; } - phi_t0->unkE = 2; - return (phi_t0->unk0 + arg0) - phi_t0->unk4; + var_t0->ttl = 2; + return &var_t0->buffer[devAddr] - var_t0->source; } - temp_t0_2 = &sSampleDmas + (phi_v1 * 0x10); - phi_t0 = temp_t0_2; - phi_t0_2 = temp_t0_2; - if (temp_v1 >= temp_a1) { + var_t0 = sSampleDmas + temp_t9; + if (var_v1 >= temp_a1) { goto block_27; } goto loop_19; } block_27: - phi_t2 = sp30; - if (phi_t3 == 0) { - temp_v1_5 = sSampleDmaReuseQueueTail1; - temp_t2_2 = *(&sSampleDmaReuseQueue1 + temp_v1_5); - sSampleDmaReuseQueueTail1 = temp_v1_5 + 1; - phi_t0_2 = &sSampleDmas + (temp_t2_2 * 0x10); - phi_t2 = temp_t2_2; + var_t2 = sp30; + if (var_t3 == 0) { + temp_v1_2 = sSampleDmaReuseQueueTail1; + var_t2 = (s32) sSampleDmaReuseQueue1[temp_v1_2]; + sSampleDmaReuseQueueTail1 = temp_v1_2 + 1; + var_t0 = sSampleDmas + (var_t2 * 0x10); } - temp_v0_6 = phi_t0_2->unkA; - temp_s0 = arg0 & ~0xF; - phi_t0_2->unkE = 2; - phi_t0_2->unk4 = temp_s0; - phi_t0_2->unk8 = temp_v0_6; - temp_v1_6 = gCurrAudioFrameDmaCount; - temp_t9 = temp_v1_6 * 0x18; - gCurrAudioFrameDmaCount = temp_v1_6 + 1; - sp30 = phi_t2; - sp40 = phi_t0_2;./ - osPiStartDma(temp_t9 + &gCurrAudioFrameDmaIoMesgBufs, 0, 0, temp_s0, phi_t0_2->unk0, temp_v0_6, &gCurrAudioFrameDmaQueue); - *arg3 = phi_t2; - return (arg0 - temp_s0) + phi_t0_2->unk0; + temp_v0_6 = var_t0->bufSize; + temp_s0 = devAddr & ~0xF; + var_t0->ttl = 2; + var_t0->source = temp_s0; + var_t0->sizeUnused = temp_v0_6; + temp_v1_3 = gCurrAudioFrameDmaCount; + gCurrAudioFrameDmaCount = temp_v1_3 + 1; + sp30 = var_t2; + sp40 = var_t0; + osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[temp_v1_3], 0, 0, temp_s0, var_t0->buffer, (u32) temp_v0_6, &gCurrAudioFrameDmaQueue); + *dmaIndexRef = (u8) var_t2; + return &var_t0->buffer[devAddr - temp_s0]; } #else GLOBAL_ASM("asm/non_matchings/audio/load/func_800BAD0C.s") @@ -475,43 +450,35 @@ s32 func_800BB304(struct AudioBankSample *sample) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800BB304(s32); // extern -void *func_800BC948(); // extern -void *func_800BC9F8(?); // extern +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +void *func_800BC948(); /* extern */ +void *func_800BC9F8(s32); /* extern */ -void func_800BB388(s32 arg1, ? arg2) { +void func_800BB388(s32 arg0, s32 arg1, s32 arg2) { void *sp1C; - void *temp_ret; void *temp_v0; void *temp_v0_2; if (arg1 < 0x7F) { - temp_ret = func_800BC948(); - temp_v0 = temp_ret; - if (temp_v0 == 0) { + temp_v0 = func_800BC948(); + if (temp_v0 == NULL) { return; } if (temp_v0->unk1 != 0) { sp1C = temp_v0; func_800BB304(temp_v0->unk8); } - sp1C = temp_ret; - func_800BB304(temp_ret->unk10); - if (temp_ret->unk2 != 0x7F) { - func_800BB304(temp_ret->unk18); - return; + sp1C = temp_v0; + func_800BB304(temp_v0->unk10); + if (temp_v0->unk2 != 0x7F) { + func_800BB304(temp_v0->unk18); } - // Duplicate return node #11. Try simplifying control flow for better match - return; - } - if (arg1 == 0x7F) { + } else if (arg1 == 0x0000007F) { temp_v0_2 = func_800BC9F8(arg2); - if (temp_v0_2 == 0) { + if (temp_v0_2 == NULL) { return; } func_800BB304(temp_v0_2->unk4); - // Duplicate return node #11. Try simplifying control flow for better match } } #else diff --git a/src/audio/load.h b/src/audio/load.h index 0ef0bea99..58b84fb7a 100644 --- a/src/audio/load.h +++ b/src/audio/load.h @@ -9,4 +9,10 @@ #define PRELOAD_BANKS 2 #define PRELOAD_SEQUENCE 1 +void func_800BAAF8(uintptr_t, void*, size_t, OSMesgQueue*, OSIoMesg*); +void func_800BAB58(uintptr_t*, u8**, ssize_t*, OSMesgQueue*, OSIoMesg*); +void func_800BAC04(); +void func_800BB030(s32); +s32 func_800BB304(struct AudioBankSample*); + #endif // AUDIO_LOAD_H diff --git a/src/camera.c b/src/camera.c index 916c0d791..d768b6562 100644 --- a/src/camera.c +++ b/src/camera.c @@ -3,6 +3,7 @@ #include #include #include "camera.h" +#include "math_util.h" Camera cameras[4]; Camera *camera1 = &cameras[0]; @@ -551,47 +552,46 @@ void func_8001D53C(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *ar GLOBAL_ASM("asm/non_matchings/camera/func_8001D53C.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -void func_802B6540(f32 *, ?, f32, ?, s32); /* extern */ +void func_8001D794(Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg6) { + Mat3 sp6C; + Vec3f sp60; + Vec3f sp54; + f32 stackPadding[4]; + f32 test1; + f32 test2; + f32 test3; -void func_8001D794(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg6) { - f32 sp6C; - f32 sp68; - f32 sp64; - f32 sp60; - f32 sp5C; - f32 sp58; - f32 sp54; - f32 temp_f0; - f32 temp_f12; - f32 temp_f2; + sp60[0] = camera->unk_30[0]; + sp60[1] = camera->unk_30[1]; + sp60[2] = camera->unk_30[2] - 6; - sp60 = camera->unk_30[0]; - sp64 = camera->unk_30[1]; - sp68 = camera->unk_30[2] - 6.0f; - sp54 = camera->unk_3C[0]; - sp58 = camera->unk_3C[1]; - sp5C = camera->unk_3C[2]; - arg2->unk0 = camera->lookAt[0]; - arg2->unk4 = (f32) camera->lookAt[1]; - arg2->unk8 = (f32) camera->lookAt[2]; - func_802B6540(&sp6C, 0, 1.0f, 0, (s32) arg6); - func_802B63B8(&sp54, &sp6C); - arg2->unk0 += ((sp54 + player->pos[0]) - camera->lookAt[0]) * 1.0f; - arg2->unk4 = (f32) (arg2->unk4 + (((sp58 + player->pos[1]) - camera->lookAt[1]) * 1.0f)); - arg2->unk8 = (f32) (arg2->unk8 + (((sp5C + player->pos[2]) - camera->lookAt[2]) * 1.0f)); - func_802B63B8(&sp60, &sp6C); - temp_f0 = camera->pos[0]; - *arg3 = (((sp60 + player->pos[0]) - temp_f0) * 1.0f) + temp_f0; - temp_f2 = camera->pos[1]; - *arg4 = (((sp64 + player->pos[1]) - temp_f2) * 1.0f) + temp_f2; - temp_f12 = camera->pos[2]; - *arg5 = (((sp68 + player->pos[2]) - temp_f12) * 1.0f) + temp_f12; + sp54[0] = camera->unk_3C[0]; + sp54[1] = camera->unk_3C[1]; + sp54[2] = camera->unk_3C[2]; + + arg2[0] = camera->lookAt[0]; + arg2[1] = camera->lookAt[1]; + arg2[2] = camera->lookAt[2]; + + func_802B6540(sp6C, 0, 1, 0, arg6); + func_802B63B8(sp54, sp6C); + + test1 = player->pos[0] + sp54[0]; + test3 = player->pos[2] + sp54[2]; + test2 = player->pos[1] + sp54[1]; + arg2[0] += (test1 - camera->lookAt[0]) * 1; + arg2[1] += (test2 - camera->lookAt[1]) * 1; + arg2[2] += (test3 - camera->lookAt[2]) * 1; + + func_802B63B8(sp60, sp6C); + + test1 = player->pos[0] + sp60[0]; + test3 = player->pos[2] + sp60[2]; + test2 = player->pos[1] + sp60[1]; + *arg3 = camera->pos[0] + ((test1 - camera->pos[0]) * 1); + *arg4 = camera->pos[1] + ((test2 - camera->pos[1]) * 1); + *arg5 = camera->pos[2] + ((test3 - camera->pos[2]) * 1); } -#else -GLOBAL_ASM("asm/non_matchings/camera/func_8001D794.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de diff --git a/src/camera.h b/src/camera.h index fba26e8c7..0b4227671 100644 --- a/src/camera.h +++ b/src/camera.h @@ -41,6 +41,7 @@ typedef struct { void func_8001CA10(Camera*); void func_8001CA24(Player*, f32); +void func_8001D794(Player*, Camera*, Vec3f, f32*, f32*, f32*, s16); extern Camera cameras[]; extern Camera *camera1; diff --git a/src/code_80027D00.c b/src/code_80027D00.c index 19bd7de8c..91ccd0184 100644 --- a/src/code_80027D00.c +++ b/src/code_80027D00.c @@ -991,12 +991,12 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { sp40 = temp_f2; sp90 = -player->boundingBoxSize; func_802B63B8(&sp8C, (f32 (*)[3]) &sp5C[0]); - sp80 = player->boundingBoxCorners[0].cornerX; - sp84 = player->boundingBoxCorners[0].cornerY; - sp88 = player->boundingBoxCorners[0].cornerZ; - player->boundingBoxCorners[0].cornerX = sp8C + player->pos[0]; - player->boundingBoxCorners[0].cornerY = sp90 + player->pos[1]; - player->boundingBoxCorners[0].cornerZ = sp94 + player->pos[2]; + sp80 = player->boundingBoxCorners[0].cornerPos[0]; + sp84 = player->boundingBoxCorners[0].cornerPos[1]; + sp88 = player->boundingBoxCorners[0].cornerPos[2]; + player->boundingBoxCorners[0].cornerPos[0] = sp8C + player->pos[0]; + player->boundingBoxCorners[0].cornerPos[1] = sp90 + player->pos[1]; + player->boundingBoxCorners[0].cornerPos[2] = sp94 + player->pos[2]; func_802AFA34(player, player->boundingBoxCorners, sp80, sp84, sp88); temp_f14 = -sp48; temp_f2_2 = (f64) temp_f14; @@ -1006,12 +1006,12 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { sp94 = sp40; sp90 = -player->boundingBoxSize; func_802B63B8(&sp8C, (f32 (*)[3]) &sp5C[0]); - sp80 = player->boundingBoxCorners[1].cornerX; - sp84 = player->boundingBoxCorners[1].cornerY; - sp88 = player->boundingBoxCorners[1].cornerZ; - player->boundingBoxCorners[1].cornerX = sp8C + player->pos[0]; - player->boundingBoxCorners[1].cornerY = sp90 + player->pos[1]; - player->boundingBoxCorners[1].cornerZ = sp94 + player->pos[2]; + sp80 = player->boundingBoxCorners[1].cornerPos[0]; + sp84 = player->boundingBoxCorners[1].cornerPos[1]; + sp88 = player->boundingBoxCorners[1].cornerPos[2]; + player->boundingBoxCorners[1].cornerPos[0] = sp8C + player->pos[0]; + player->boundingBoxCorners[1].cornerPos[1] = sp90 + player->pos[1]; + player->boundingBoxCorners[1].cornerPos[2] = sp94 + player->pos[2]; func_802AFA34(player, &player->boundingBoxCorners[1], sp80, sp84, sp88); temp_f12 = sp34 + 4.0f; sp8C = (f32) (sp38 - 2.6); @@ -1019,23 +1019,23 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { sp40 = temp_f12; sp90 = -player->boundingBoxSize; func_802B63B8(&sp8C, (f32 (*)[3]) &sp5C[0]); - sp80 = player->boundingBoxCorners[2].cornerX; - sp84 = player->boundingBoxCorners[2].cornerY; - sp88 = player->boundingBoxCorners[2].cornerZ; - player->boundingBoxCorners[2].cornerX = sp8C + player->pos[0]; - player->boundingBoxCorners[2].cornerY = sp90 + player->pos[1]; - player->boundingBoxCorners[2].cornerZ = sp94 + player->pos[2]; + sp80 = player->boundingBoxCorners[2].cornerPos[0]; + sp84 = player->boundingBoxCorners[2].cornerPos[1]; + sp88 = player->boundingBoxCorners[2].cornerPos[2]; + player->boundingBoxCorners[2].cornerPos[0] = sp8C + player->pos[0]; + player->boundingBoxCorners[2].cornerPos[1] = sp90 + player->pos[1]; + player->boundingBoxCorners[2].cornerPos[2] = sp94 + player->pos[2]; func_802AFA34(player, &player->boundingBoxCorners[2], sp80, sp84, sp88); sp8C = (f32) (sp28 + 2.6); sp94 = sp40; sp90 = -player->boundingBoxSize; func_802B63B8(&sp8C, (f32 (*)[3]) &sp5C[0]); - sp80 = player->boundingBoxCorners[3].cornerX; - sp84 = player->boundingBoxCorners[3].cornerY; - sp88 = player->boundingBoxCorners[3].cornerZ; - player->boundingBoxCorners[3].cornerX = sp8C + player->pos[0]; - player->boundingBoxCorners[3].cornerY = sp90 + player->pos[1]; - player->boundingBoxCorners[3].cornerZ = sp94 + player->pos[2]; + sp80 = player->boundingBoxCorners[3].cornerPos[0]; + sp84 = player->boundingBoxCorners[3].cornerPos[1]; + sp88 = player->boundingBoxCorners[3].cornerPos[2]; + player->boundingBoxCorners[3].cornerPos[0] = sp8C + player->pos[0]; + player->boundingBoxCorners[3].cornerPos[1] = sp90 + player->pos[1]; + player->boundingBoxCorners[3].cornerPos[2] = sp94 + player->pos[2]; func_802AFA34(player, &player->boundingBoxCorners[3], sp80, sp84, sp88); if (!(player->unk_0BC & 8)) { move_f32_towards(&player->unk_230, (player->boundingBoxCorners[0].cornerGroundY + player->boundingBoxCorners[2].cornerGroundY) / 2.0f, 0.5f); @@ -1124,27 +1124,27 @@ void func_8002A194(Player *player, f32 arg1, f32 arg2, f32 arg3) { temp_t7 = (temp_v1 + 0x2000) & 0xFFFF; sp28 = temp_t7; sp3A = temp_v1; - player->boundingBoxCorners[0].cornerZ = (coss((u16) temp_t7) * var_f20) + arg3; + player->boundingBoxCorners[0].cornerPos[2] = (coss((u16) temp_t7) * var_f20) + arg3; temp_f12 = (sins((u16) sp28) * var_f20) + arg1; - player->boundingBoxCorners[0].cornerX = temp_f12; - player->boundingBoxCorners[0].cornerGroundY = func_802ABE30(temp_f12, arg2, player->boundingBoxCorners[0].cornerZ, player->unk_110.unk3A); + player->boundingBoxCorners[0].cornerPos[0] = temp_f12; + player->boundingBoxCorners[0].cornerGroundY = func_802ABE30(temp_f12, arg2, player->boundingBoxCorners[0].cornerPos[2], player->unk_110.unk3A); temp_t8 = (sp3A - 0x2000) & 0xFFFF; sp28 = temp_t8; - player->boundingBoxCorners[1].cornerZ = (coss((u16) temp_t8) * var_f20) + arg3; + player->boundingBoxCorners[1].cornerPos[2] = (coss((u16) temp_t8) * var_f20) + arg3; temp_f12_2 = (sins((u16) sp28) * var_f20) + arg1; - player->boundingBoxCorners[1].cornerX = temp_f12_2; - player->boundingBoxCorners[1].cornerGroundY = func_802ABE30(temp_f12_2, arg2, player->boundingBoxCorners[1].cornerZ, player->unk_110.unk3A); + player->boundingBoxCorners[1].cornerPos[0] = temp_f12_2; + player->boundingBoxCorners[1].cornerGroundY = func_802ABE30(temp_f12_2, arg2, player->boundingBoxCorners[1].cornerPos[2], player->unk_110.unk3A); temp_t9 = (sp3A + 0x6000) & 0xFFFF; sp28 = temp_t9; - player->boundingBoxCorners[2].cornerZ = (coss((u16) temp_t9) * var_f20) + arg3; + player->boundingBoxCorners[2].cornerPos[2] = (coss((u16) temp_t9) * var_f20) + arg3; temp_f12_3 = (sins((u16) sp28) * var_f20) + arg1; - player->boundingBoxCorners[2].cornerX = temp_f12_3; - player->boundingBoxCorners[2].cornerGroundY = func_802ABE30(temp_f12_3, arg2, player->boundingBoxCorners[2].cornerZ, player->unk_110.unk3A); + player->boundingBoxCorners[2].cornerPos[0] = temp_f12_3; + player->boundingBoxCorners[2].cornerGroundY = func_802ABE30(temp_f12_3, arg2, player->boundingBoxCorners[2].cornerPos[2], player->unk_110.unk3A); temp_t0 = (sp3A - 0x6000) & 0xFFFF; sp28 = temp_t0; - player->boundingBoxCorners[3].cornerZ = (coss((u16) temp_t0) * var_f20) + arg3; - player->boundingBoxCorners[3].cornerX = (sins((u16) sp28) * var_f20) + arg1; - player->boundingBoxCorners[3].cornerGroundY = func_802ABE30(player->boundingBoxCorners[2].cornerX, arg2, player->boundingBoxCorners[2].cornerZ, player->unk_110.unk3A); + player->boundingBoxCorners[3].cornerPos[2] = (coss((u16) temp_t0) * var_f20) + arg3; + player->boundingBoxCorners[3].cornerPos[0] = (sins((u16) sp28) * var_f20) + arg1; + player->boundingBoxCorners[3].cornerGroundY = func_802ABE30(player->boundingBoxCorners[2].cornerPos[0], arg2, player->boundingBoxCorners[2].cornerPos[2], player->unk_110.unk3A); if ((player->unk_0BC & 8) != 8) { temp_f0 = player->boundingBoxCorners[0].cornerGroundY; temp_f2 = player->boundingBoxCorners[2].cornerGroundY; @@ -1958,59 +1958,37 @@ void func_8002BB9C(Player *player, f32 *arg1, f32 *arg2, f32 *arg3) { GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002BB9C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E3CAC; -extern ? D_800E3CC8; +#ifdef NEEDS_RODATA +// data_0DD0A0_2.s +// extern s32 D_800E3CAC; +// extern s32 D_800E3CC8; -void func_8002BD58(void *arg0) { - ? sp2C; - ? spC; +void func_8002BD58(Player *player) { + s32 sp2C[7] = { 0x002f0000, 0x00300000, 0x00310000, 0x00320000, 0x00320000, 0x00320000, 0x00320000 }; + s32 spC[8] = { 0x00280000, 0x002c0000, 0x00300000, 0x00320000, 0x00320000, 0x00320000, 0x00320000, 0x00320000 }; s16 temp_t5; - s16 temp_v0; - s32 phi_v0; - sp2C.unk0 = D_800E3CAC.unk0; - sp2C.unk4 = D_800E3CAC.unk4; - sp2C.unk8 = D_800E3CAC.unk8; - sp2C.unkC = D_800E3CAC.unkC; - sp2C.unk10 = D_800E3CAC.unk10; - sp2C.unk14 = D_800E3CAC.unk14; - sp2C.unk18 = D_800E3CAC.unk18; - spC.unk0 = D_800E3CC8.unk0; - spC.unk4 = D_800E3CC8.unk4; - spC.unk8 = D_800E3CC8.unk8; - spC.unkC = D_800E3CC8.unkC; - spC.unk10 = D_800E3CC8.unk10; - spC.unk14 = D_800E3CC8.unk14; - spC.unk18 = D_800E3CC8.unk18; - spC.unk1C = D_800E3CC8.unk1C; - temp_v0 = arg0->unk234; - if (temp_v0 >= 0) { - if ((temp_v0 >= 5) && (temp_v0 < 0x1E)) { - arg0->unk7C = *(&sp2C + ((temp_v0 / 6) * 4)); + if (player->unk_234 >= 0) { + if ((player->unk_234 >= 5) && (player->unk_234 < 0x1E)) { + player->unk_07C = sp2C[player->unk_234 / 6]; } - if ((temp_v0 >= 0x1E) && (temp_v0 < 0x50)) { - arg0->unk7C = *(&spC + (((temp_v0 - 0x1E) / 0xC) * 4)); + if ((player->unk_234 >= 0x1E) && (player->unk_234 < 0x50)) { + player->unk_07C = spC[(s32) (player->unk_234 - 0x1E) / 12]; } - if (((temp_v0 < 0x50) || (temp_v0 >= 0x5B)) && (temp_v0 >= 0x5B) && (temp_v0 < 0xA1)) { - arg0->unk7C = sp10; - return; + if (((player->unk_234 < 0x50) || (player->unk_234 >= 0x5B)) && (player->unk_234 >= 0x5B) && (player->unk_234 < 0xA1)) { + player->unk_07C = spC[1]; + } + } else { + temp_t5 = -player->unk_234; + if ((player->unk_234 < -4) && (player->unk_234 >= -0x1E)) { + player->unk_07C = sp2C[temp_t5 / 6] * -1; + } + if ((player->unk_234 < -0x1E) && (player->unk_234 >= -0x50)) { + player->unk_07C = spC[(s32) (temp_t5 - 0x1E) / 12] * -1; + } + if (((player->unk_234 >= -0x50) || (player->unk_234 < -0x5A)) && (player->unk_234 < -0x5A) && (player->unk_234 >= -0xA0)) { + player->unk_07C = spC[1] * -1; } - // Duplicate return node #23. Try simplifying control flow for better match - return; - } - temp_t5 = temp_v0 * -1; - if ((temp_v0 < -4) && (temp_v0 >= -0x1E)) { - arg0->unk7C = *(&sp2C + ((temp_t5 / 6) * 4)) * -1; - } - phi_v0 = arg0->unk234; - if ((arg0->unk234 < -0x1E) && (arg0->unk234 >= -0x50)) { - arg0->unk7C = *(&spC + (((temp_t5 - 0x1E) / 0xC) * 4)) * -1; - phi_v0 = arg0->unk234; - } - if (((phi_v0 >= -0x50) || (phi_v0 < -0x5A)) && (phi_v0 < -0x5A) && (phi_v0 >= -0xA0)) { - arg0->unk7C = sp10 * -1; } } #else @@ -6789,13 +6767,12 @@ void func_80038BE4(Player *player, s16 arg1) { } #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_80029B4C(Player *, f32, f32, f32); /* extern */ -void func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ -void func_8002C4F8(Player *, s8); /* extern */ -void func_8002C954(Player *, s8, f32 *); /* extern */ -void func_8002CD48(Player *, s8, s8); /* extern */ -void func_802B6540(f32 *, f32, f32, f32, s32); /* extern */ +//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b +? func_80029B4C(Player *, f32, f32, f32); /* extern */ +? func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ +? func_8002C4F8(Player *, s8); /* extern */ +? func_8002C954(Player *, s8, f32 *); /* extern */ +? func_8002CD48(Player *, s8, s8); /* extern */ static ? D_800E4328; /* unable to generate initializer */ static ? D_800E4334; /* unable to generate initializer */ static ? D_800E4340; /* unable to generate initializer */ @@ -6916,7 +6893,7 @@ void func_80038C6C(Player *player, Camera *camera, s8 arg2, s8 arg3) { player->unk_058 = 0.0f; player->unk_060 = 0.0f; player->unk_05C = 1.0f; - func_802B6540(sp50, 0.0f, 1.0f, 0.0f, (s32) player->unk_02E); + func_802B6540((f32 (*)[3]) sp50, 0.0f, 1.0f, 0.0f, (s16) (s32) player->unk_02E); player->unk_0BC |= 8; player->unk_0C2 += 1; sp98 = player->unk_110.unk3C[2]; @@ -6931,19 +6908,19 @@ void func_80038C6C(Player *player, Camera *camera, s8 arg2, s8 arg3) { if (sp98 <= 0.0f) { func_8003F46C(player, &sp7C, &sp88, &sp108, &sp98, &spEC, &spE8, &spE4); } - sp98 = player->unk_110.unk3C; + sp98 = player->unk_110.unk3C[0]; if (sp98 < 0.0f) { func_8003F734(player, &sp7C, &sp88, &sp98, &spEC, &spE8, &spE4); func_8002C954(player, arg3, &sp88); } - sp98 = player->unk_110.unk40; + sp98 = player->unk_110.unk3C[1]; if (sp98 < 0.0f) { func_8003FBAC(player, &sp7C, &sp88, &sp98, &spEC, &spE8, &spE4); func_8002C954(player, arg3, &sp88); } - sp98 = player->unk_110.unk3C; + sp98 = player->unk_110.unk3C[0]; if (sp98 >= 0.0f) { - sp98 = player->unk_110.unk40; + sp98 = player->unk_110.unk3C[1]; if (sp98 >= 0.0f) { player->unk_046 &= 0xFFDF; } diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 75652d72a..5d0600dd0 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -3162,9 +3162,9 @@ void func_8005D898(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { s32 temp_lo; if (player->unk_0C0 >= 0) { - func_8005D794(player, &player->unk_258[10 + arg1], player->boundingBoxCorners[2].cornerX, player->boundingBoxCorners[2].cornerGroundY + 2.0f, player->boundingBoxCorners[2].cornerZ, player->boundingBoxCorners[2].surfaceType, 1); + func_8005D794(player, &player->unk_258[10 + arg1], player->boundingBoxCorners[2].cornerPos[0], player->boundingBoxCorners[2].cornerGroundY + 2.0f, player->boundingBoxCorners[2].cornerPos[2], player->boundingBoxCorners[2].surfaceType, 1); } else { - func_8005D794(player, &player->unk_258[10 + arg1], player->boundingBoxCorners[3].cornerX, player->boundingBoxCorners[3].cornerGroundY + 2.0f, player->boundingBoxCorners[3].cornerZ, player->boundingBoxCorners[3].surfaceType, 0); + func_8005D794(player, &player->unk_258[10 + arg1], player->boundingBoxCorners[3].cornerPos[0], player->boundingBoxCorners[3].cornerGroundY + 2.0f, player->boundingBoxCorners[3].cornerPos[2], player->boundingBoxCorners[3].surfaceType, 0); } temp_lo = player->unk_0C0 / 182; @@ -3315,8 +3315,8 @@ void func_8005DAF4(Player *player, s32 arg1, s8 arg2, s32 arg3) { if ((temp_v0 == 0) || (temp_v0 == 4)) { sp44 = 1; sp3C = player->boundingBoxCorners[2].cornerGroundY + 2.0f; - sp40 = player->boundingBoxCorners[2].cornerX; - sp38 = player->boundingBoxCorners[2].cornerZ; + sp40 = player->boundingBoxCorners[2].cornerPos[0]; + sp38 = player->boundingBoxCorners[2].cornerPos[2]; phi_t1 = (s32) player->boundingBoxCorners[2].surfaceType; } phi_f12 = sp3C; @@ -3326,8 +3326,8 @@ void func_8005DAF4(Player *player, s32 arg1, s8 arg2, s32 arg3) { if ((temp_v0 == 2) || (temp_v0 == 6)) { phi_t1 = (s32) player->boundingBoxCorners[3].surfaceType; phi_f12 = player->boundingBoxCorners[3].cornerGroundY + 2.0f; - phi_f14 = player->boundingBoxCorners[3].cornerZ; - phi_f2 = player->boundingBoxCorners[3].cornerX; + phi_f14 = player->boundingBoxCorners[3].cornerPos[2]; + phi_f2 = player->boundingBoxCorners[3].cornerPos[0]; phi_t3 = 0; } switch (phi_t1) { @@ -3624,9 +3624,9 @@ void func_8005EA94(Player *player, s16 arg1, s32 arg2, s8 arg3) { temp_f0 = player->boundingBoxCorners[2].cornerGroundY; if ((f64) (D_801652A0[arg3] - temp_f0) >= 3.5) { sp44 = 1; - sp40 = player->boundingBoxCorners[2].cornerX; + sp40 = player->boundingBoxCorners[2].cornerPos[0]; sp3C = temp_f0 + 2.0f; - sp38 = player->boundingBoxCorners[2].cornerZ; + sp38 = player->boundingBoxCorners[2].cornerPos[2]; phi_t0 = 0; } } @@ -3639,8 +3639,8 @@ void func_8005EA94(Player *player, s16 arg1, s32 arg2, s8 arg3) { if ((f64) (D_801652A0[arg3] - temp_f0_2) >= 3.5) { phi_t0 = 0; phi_f12 = temp_f0_2 + 2.0f; - phi_f14 = player->boundingBoxCorners[3].cornerZ; - phi_f2 = player->boundingBoxCorners[3].cornerX; + phi_f14 = player->boundingBoxCorners[3].cornerPos[2]; + phi_f2 = player->boundingBoxCorners[3].cornerPos[0]; phi_t1 = 0; } } @@ -3752,8 +3752,8 @@ void func_8005ED48(Player *player, s16 arg1, s32 arg2, s32 arg3) { if ((temp_v0 == 2) || (temp_v0 == 4)) { sp44 = 1; sp3C = player->boundingBoxCorners[2].cornerGroundY + 2.0f; - sp40 = player->boundingBoxCorners[2].cornerX; - sp38 = player->boundingBoxCorners[2].cornerZ; + sp40 = player->boundingBoxCorners[2].cornerPos[0]; + sp38 = player->boundingBoxCorners[2].cornerPos[2]; phi_t2 = (s32) player->boundingBoxCorners[2].surfaceType; } phi_f12 = sp38; @@ -3762,8 +3762,8 @@ void func_8005ED48(Player *player, s16 arg1, s32 arg2, s32 arg3) { phi_t3 = sp44; if ((temp_v0 == 0) || (temp_v0 == 6)) { phi_t2 = (s32) player->boundingBoxCorners[3].surfaceType; - phi_f12 = player->boundingBoxCorners[3].cornerZ; - phi_f0 = player->boundingBoxCorners[3].cornerX; + phi_f12 = player->boundingBoxCorners[3].cornerPos[2]; + phi_f0 = player->boundingBoxCorners[3].cornerPos[0]; phi_f2 = player->boundingBoxCorners[3].cornerGroundY + 2.0f; phi_t3 = 0; } @@ -5577,11 +5577,11 @@ void func_80063268(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { void func_80063408(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { if (player->unk_258[10 + arg1].unk_010 == 1) { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerZ + (player->unk_258[10 + arg1].unk_01E * -7) * coss(player->unk_258[10 + arg1].unk_020); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerX + (player->unk_258[10 + arg1].unk_01E * -7) * sins(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerPos[2] + (player->unk_258[10 + arg1].unk_01E * -7) * coss(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerPos[0] + (player->unk_258[10 + arg1].unk_01E * -7) * sins(player->unk_258[10 + arg1].unk_020); } else { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerZ + (player->unk_258[10 + arg1].unk_01E * -7) * coss(player->unk_258[10 + arg1].unk_020); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerX + (player->unk_258[10 + arg1].unk_01E * -7) * sins(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerPos[2] + (player->unk_258[10 + arg1].unk_01E * -7) * coss(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerPos[0] + (player->unk_258[10 + arg1].unk_01E * -7) * sins(player->unk_258[10 + arg1].unk_020); } ++player->unk_258[10 + arg1].unk_01E; @@ -5616,19 +5616,19 @@ void func_800635D4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { if (player->unk_258[10 + arg1].unk_010 == 1) { if ((player->unk_0BC * 2) < 0) { func_80062B18(&sp44, &sp40, &sp3C, -2.0f, 0.0f, (-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16, -player->unk_258[10 + arg1].unk_020, 2 * -player->unk_206); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerX + sp44; - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerZ + sp3C; + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerPos[0] + sp44; + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerPos[2] + sp3C; } else { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerZ + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * coss(player->unk_258[10 + arg1].unk_020); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerX + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * sins(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerPos[2] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * coss(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerPos[0] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * sins(player->unk_258[10 + arg1].unk_020); } } else if ((player->unk_0BC * 2) < 0) { func_80062B18(&sp44, &sp40, &sp3C, 2.0f, 0.0f, (-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16, - player->unk_258[10 + arg1].unk_020, 2 * -player->unk_206); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerX + sp44; - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerZ + sp3C; + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerPos[0] + sp44; + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerPos[2] + sp3C; } else { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerZ + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * coss(player->unk_258[10 + arg1].unk_020); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerX + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * sins(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerPos[2] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * coss(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerPos[0] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * sins(player->unk_258[10 + arg1].unk_020); } ++player->unk_258[10 + arg1].unk_01E; @@ -5664,11 +5664,11 @@ void func_800635D4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { void func_800639DC(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { if (player->unk_258[10 + arg1].unk_010 == 1) { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerZ + (D_800EE680 * player->unk_258[10 + arg1].unk_01E) * coss(player->unk_258[10 + arg1].unk_020); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerX + (D_800EE684 * player->unk_258[10 + arg1].unk_01E) * sins(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerPos[2] + (D_800EE680 * player->unk_258[10 + arg1].unk_01E) * coss(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerPos[0] + (D_800EE684 * player->unk_258[10 + arg1].unk_01E) * sins(player->unk_258[10 + arg1].unk_020); } else { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerZ + (D_800EE688 * player->unk_258[10 + arg1].unk_01E) * coss(player->unk_258[10 + arg1].unk_020); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerX + (D_800EE68C * player->unk_258[10 + arg1].unk_01E) * sins(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerPos[2] + (D_800EE688 * player->unk_258[10 + arg1].unk_01E) * coss(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerPos[0] + (D_800EE68C * player->unk_258[10 + arg1].unk_01E) * sins(player->unk_258[10 + arg1].unk_020); } ++player->unk_258[10 + arg1].unk_01E; player->unk_258[10 + arg1].unk_000[1] += D_800EE690; @@ -5699,11 +5699,11 @@ void func_800639DC(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { void func_80063BD4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { if (player->unk_258[10 + arg1].unk_010 == 1) { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerZ + (-2 * player->unk_258[10 + arg1].unk_01E * coss(player->unk_258[10 + arg1].unk_020)); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerX + (-2 * player->unk_258[10 + arg1].unk_01E * sins(player->unk_258[10 + arg1].unk_020)); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerPos[2] + (-2 * player->unk_258[10 + arg1].unk_01E * coss(player->unk_258[10 + arg1].unk_020)); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerPos[0] + (-2 * player->unk_258[10 + arg1].unk_01E * sins(player->unk_258[10 + arg1].unk_020)); } else { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerZ + (-2 * player->unk_258[10 + arg1].unk_01E * coss(player->unk_258[10 + arg1].unk_020)); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerX + (-2 * player->unk_258[10 + arg1].unk_01E * sins(player->unk_258[10 + arg1].unk_020)); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerPos[2] + (-2 * player->unk_258[10 + arg1].unk_01E * coss(player->unk_258[10 + arg1].unk_020)); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerPos[0] + (-2 * player->unk_258[10 + arg1].unk_01E * sins(player->unk_258[10 + arg1].unk_020)); } ++player->unk_258[10 + arg1].unk_01E; @@ -5720,11 +5720,11 @@ void func_80063BD4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { void func_80063D58(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { if (player->unk_258[10 + arg1].unk_010 == 1) { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerZ + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 20.0f) * coss(player->unk_258[10 + arg1].unk_020); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerX + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 20.0f) * sins(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerPos[2] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 20.0f) * coss(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerPos[0] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 20.0f) * sins(player->unk_258[10 + arg1].unk_020); } else { - player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerZ + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 20.0f) * coss(player->unk_258[10 + arg1].unk_020); - player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerX + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 20.0f) * sins(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerPos[2] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 20.0f) * coss(player->unk_258[10 + arg1].unk_020); + player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerPos[0] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 20.0f) * sins(player->unk_258[10 + arg1].unk_020); } ++player->unk_258[10 + arg1].unk_01E; diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index a6ea44353..b6b101af4 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -1523,9 +1523,9 @@ void func_80070780(void) { temp_s0_4 = D_80183EA0->unk0; func_80073444(temp_s0_4, &D_06007BB8, &D_06007DB8, 0x20U, (u16) 0x00000040); temp_v0_5 = &D_80165C18[temp_s0_4]; - temp_v0_5->unk_0B2 = 0; - temp_v0_5->unk_0B4 = 0; - temp_v0_5->unk_0B6 = 0x8000; + temp_v0_5->unk_0B2[0] = 0; + temp_v0_5->unk_0B2[1] = 0; + temp_v0_5->unk_0B2[2] = 0x8000; func_800723A4(D_80183EA0->unk4, 0); func_800723A4(D_80183EA0->unk8, 0); return; diff --git a/src/code_8008C1D0.c b/src/code_8008C1D0.c index 52fc22211..35219497b 100644 --- a/src/code_8008C1D0.c +++ b/src/code_8008C1D0.c @@ -336,24 +336,15 @@ void func_8008C8C4(Player* player, s8 arg1) { } } -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern s16 D_8018D920; -static ? D_800E6F60; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// data_0DD0A0_2_0.s +extern s16 D_800E6F60[];// = { 1092, 1092, 2184, 1638, 1820 } void func_8008C9EC(Player *player, s8 arg1) { - s16 *temp_a0; - s16 *temp_a0_2; - s16 *temp_v0; - s16 *temp_v0_2; - s16 temp_t7; - s16 temp_t8; - s16 temp_v1; - s16 temp_v1_2; + s16 stackPadding1; + s16 stackPadding2; + s16 sp30[5] = { 1092, 1092, 2184, 1638, 1820 }; - sp30[0].unk0 = (s32) D_800E6F60.unk0; - sp30[0].unk4 = (s32) D_800E6F60.unk4; - sp30[0].unk8 = (u16) D_800E6F60.unk8; player->unk_206 = 0; player->unk_0C4 = 0; if ((player->unk_046 & 0x40) == 0x40) { @@ -369,14 +360,11 @@ void func_8008C9EC(Player *player, s8 arg1) { } } if ((player->unk_0BC & 0x80) == 0x80) { - temp_a0 = &(&sp30[0])[player->unk_0B2]; - player->unk_02E -= *temp_a0; - temp_v0 = (arg1 * 2) + &D_8018D920; - temp_t7 = *temp_v0 - *temp_a0; - *temp_v0 = temp_t7; - temp_v1 = player->unk_0B2; - if ((s16) ((s32) (temp_t7 & 0xFFFF) / (s32) (0x10000 / (s32) (0x168 / (s32) ((s16) (&sp30[0])[temp_v1] / 182)))) == 0) { - player->unk_0B2 = temp_v1 - 1; + player->unk_02C[1] -= sp30[player->unk_0B2]; + D_8018D920[arg1] -= sp30[player->unk_0B2]; + stackPadding1 = (u16)D_8018D920[arg1] / (0x10000 / (0x168 / (sp30[player->unk_0B2] / 182))); + if (stackPadding1 == 0) { + player->unk_0B2--; if (player->unk_0B2 <= 0) { if (gModeSelection == BATTLE) { func_8006B8B4(player, arg1); @@ -385,14 +373,11 @@ void func_8008C9EC(Player *player, s8 arg1) { } } } else { - temp_a0_2 = &(&sp30[0])[player->unk_0B2]; - player->unk_02E += *temp_a0_2; - temp_v0_2 = (arg1 * 2) + &D_8018D920; - temp_t8 = *temp_v0_2 - *temp_a0_2; - *temp_v0_2 = temp_t8; - temp_v1_2 = player->unk_0B2; - if ((s16) ((s32) (temp_t8 & 0xFFFF) / (s32) (0x10000 / (s32) (0x168 / (s32) ((s16) (sp + (temp_v1_2 * 2))->unk30 / 182)))) == 0) { - player->unk_0B2 = temp_v1_2 - 1; + player->unk_02C[1] += sp30[player->unk_0B2]; + D_8018D920[arg1] -= sp30[player->unk_0B2]; + stackPadding2 = (u16)D_8018D920[arg1] / (0x10000 / (0x168 / (sp30[player->unk_0B2] / 182))); + if (stackPadding2 == 0) { + player->unk_0B2--; if (player->unk_0B2 <= 0) { func_8008C8C4(player, arg1); if (gModeSelection == BATTLE) { @@ -430,7 +415,7 @@ void func_8008CDC0(Player* player, s8 arg1) { } #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b void func_8008CEB0(Player *player, s8 arg1) { f32 sp2C; s16 sp2A; @@ -445,7 +430,7 @@ void func_8008CEB0(Player *player, s8 arg1) { s32 temp_v0; s32 temp_v0_2; - var_v1 = player->unk_0B4 + 1; + var_v1 = (s16) player->unk_0B4 + 1; var_f0 = player->unk_0B8; var_a3 = player->unk_0AC; temp_f16 = (s32) ((f64) ((f32) var_v1 * var_f0) - (0.2 * (f64) (var_v1 * var_v1))); @@ -493,7 +478,7 @@ block_9: } player->unk_078 += var_a2 * 0x12; player->unk_0B8 = var_f0; - player->unk_0B4 = var_v1; + player->unk_0B4 = (u16) var_v1; player->unk_0AC = var_a3; if (player->unk_0BC & 8) { func_8008C73C(player, arg1); @@ -946,77 +931,59 @@ void func_8008DF98(Player* player, s8 arg1) { } } -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern s16 D_8018D920; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +extern f64 D_800EF590;// = 0.6; +extern f64 D_800EF598;// = 0.9; void func_8008E118(Player *player, s8 arg1) { - s16 *temp_v0_2; - s16 *temp_v0_3; - s16 *temp_v0_4; - s16 temp_t0; - s32 temp_v0; - s8 temp_t1; - s8 var_a2; - - temp_v0 = player->unk_0BC; - var_a2 = arg1; - if (((temp_v0 & 0x8000) == 0x8000) && ((temp_v0 & 0x04000000) != 0x04000000)) { - player->unk_0BC = temp_v0 & 0xFFFDFFFF; + s16 test; + if (((player->unk_0BC & 0x8000) == 0x8000) && ((player->unk_0BC & 0x04000000) != 0x04000000)) { + player->unk_0BC &= ~0x20000; player->unk_0A8 = 0; player->unk_07C = 0; player->unk_0C0 = 0; - temp_t1 = arg1; - player->unk_02E = player->unk_0AE; - arg1 = arg1; - func_8008E3C0(player, temp_t1); - temp_v0_2 = &(*D_80165190)[arg1]; - temp_v0_2->unk0 = 1; - temp_v0_2->unk10 = 1; - temp_v0_2->unk20 = 1; - temp_v0_2->unk30 = 1; + player->unk_02C[1] = player->unk_0AE; + func_8008E3C0(player, arg1); + D_80165190[0][arg1] = 1; + D_80165190[1][arg1] = 1; + D_80165190[2][arg1] = 1; + D_80165190[3][arg1] = 1; func_8008DABC(player, arg1); - return; - } - if ((temp_v0 & 0x20000) == 0x20000) { - player->unk_02E -= 0x5B0; - temp_v0_3 = (var_a2 * 2) + &D_8018D920; - temp_t0 = *temp_v0_3 - 0x5B0; - *temp_v0_3 = temp_t0; - if ((s16) ((s32) (temp_t0 & 0xFFFF) / 1456) == 0) { - player->unk_0B2 -= 1; + } else if ((player->unk_0BC & 0x20000) == 0x20000) { + player->unk_02C[1] -= 0x5B0; + D_8018D920[arg1] -= 0x5B0; + test = (u16)D_8018D920[arg1] / 1456; + if (test == 0) { + player->unk_0B2--; if (player->unk_0B2 <= 0) { player->unk_0A8 = 0; - player->unk_0BC &= 0xFFFDFFFF; + player->unk_0BC &= ~0x20000; player->unk_07C = 0; player->unk_0C0 = 0; - temp_v0_4 = &(*D_80165190)[var_a2]; - player->unk_02E = player->unk_0AE; - temp_v0_4->unk0 = 1; - temp_v0_4->unk10 = 1; - temp_v0_4->unk20 = 1; - temp_v0_4->unk30 = 1; + player->unk_02C[1] = player->unk_0AE; + D_80165190[0][arg1] = 1; + D_80165190[1][arg1] = 1; + D_80165190[2][arg1] = 1; + D_80165190[3][arg1] = 1; } } func_80031F48(player, 1.0f); - return; - } - player->unk_0B0 += 1; - player->unk_08C = (f32) ((f64) player->unk_08C * 0.6); - if ((player->unk_0B0 == 1) && (player->unk_000 & 0x4000)) { - arg1 = var_a2; - func_800C90F4(var_a2 & 0xFF, (player->characterId * 0x10) + 0x29008005); - var_a2 = arg1; - } - if ((player->unk_0B0 >= 0) && (player->unk_0B0 < 0x1CC)) { - move_f32_towards(&player->unk_224, 0.7f, 0.1f); - move_f32_towards(&player->boundingBoxSize, (f32) ((f64) gKartBoundingBoxSizeTable[player->characterId] * 0.9), 0.1f); - return; - } - arg1 = var_a2; - func_8008E3C0(player, var_a2); - if (player->unk_000 & 0x4000) { - func_800C90F4(arg1 & 0xFF, (player->characterId * 0x10) + 0x29008008); + } else { + player->unk_0B0 += 1; + player->unk_08C = (f32) ((f64) player->unk_08C * 0.6); + if ((player->unk_0B0 == 1) && (player->unk_000 & 0x4000)) { + func_800C90F4(arg1, (player->characterId * 0x10) + 0x29008005); + } + if ((player->unk_0B0 >= 0) && (player->unk_0B0 < 0x1CC)) { + move_f32_towards(&player->unk_224, 0.7f, 0.1f); + move_f32_towards(&player->boundingBoxSize, (f32) ((f64) gKartBoundingBoxSizeTable[player->characterId] * 0.9), 0.1f); + } else { + func_8008E3C0(player, arg1); + if (player->unk_000 & 0x4000) { + func_800C90F4(arg1, (player->characterId * 0x10) + 0x29008008); + } + } } } #else @@ -1697,84 +1664,67 @@ void func_8008FEDC(Player* player, UNUSED s8 arg1) { } #ifdef NEEDS_RODATA -void func_8008FF08(Player *player, s8 arg1) { - s8 arg1Copy; - arg1Copy = arg1; +// data_0DD0A0_3_0.s +// jpt_800EF5B0 +void func_8008FF08(Player *player, s8 playerId) { + if(player->nearestWaypointId){} switch (gCurrentCourseId) { case COURSE_BOWSER_CASTLE: - if ((((s16)gNearestWaypointByPlayerId[arg1Copy]) >= 0x235) && (((s16)gNearestWaypointByPlayerId[arg1Copy]) < 0x247)) { - player->nearestWaypointId = 0x214U; - break; + if (((s16)gNearestWaypointByPlayerId[playerId] >= 0x235) && ((s16)gNearestWaypointByPlayerId[playerId] < 0x247)) { + player->nearestWaypointId = 0x214; + } else if (((s16)gNearestWaypointByPlayerId[playerId] >= 0x267) && ((s16)gNearestWaypointByPlayerId[playerId] < 0x277)) { + player->nearestWaypointId = 0x25B; + } else { + player->nearestWaypointId = gNearestWaypointByPlayerId[playerId]; + if (player->nearestWaypointId < 0) { + player->nearestWaypointId = gWaypointCountByPathIndex[0] + player->nearestWaypointId; + } } - - if ((((s16)gNearestWaypointByPlayerId[arg1Copy]) >= 0x267) && (((s16)gNearestWaypointByPlayerId[arg1Copy]) < 0x277)) { - player->nearestWaypointId = 0x25BU; - break; - } - - player->nearestWaypointId = gNearestWaypointByPlayerId[arg1Copy]; - if (player->nearestWaypointId < 0) { - player->nearestWaypointId = gWaypointCountByPathIndex + player->nearestWaypointId; - break; - } - break; case COURSE_BANSHEE_BOARDWALK: - if ((((s16)gNearestWaypointByPlayerId[arg1Copy]) >= 0x12C) && (((s16)gNearestWaypointByPlayerId[arg1Copy]) < 0x13C)) { + if (((s16)gNearestWaypointByPlayerId[playerId] >= 0x12C) && ((s16)gNearestWaypointByPlayerId[playerId] < 0x13C)) { player->nearestWaypointId = 0x12CU; - break; + } else { + player->nearestWaypointId = gNearestWaypointByPlayerId[playerId]; + if (player->nearestWaypointId < 0) { + player->nearestWaypointId = gWaypointCountByPathIndex[0] + player->nearestWaypointId; + } } - - player->nearestWaypointId = gNearestWaypointByPlayerId[arg1Copy]; - if (player->nearestWaypointId < 0) { - player->nearestWaypointId = gWaypointCountByPathIndex + player->nearestWaypointId; - break; - } - break; case COURSE_YOSHI_VALLEY: case COURSE_RAINBOW_ROAD: - player->nearestWaypointId = D_80165320[arg1Copy]; + player->nearestWaypointId = D_80165320[playerId]; break; case COURSE_FRAPPE_SNOWLAND: - if ((((s16)gNearestWaypointByPlayerId[arg1Copy]) >= 0xF0) && (((s16)gNearestWaypointByPlayerId[arg1Copy]) < 0x105)) { + if (((s16)gNearestWaypointByPlayerId[playerId] >= 0xF0) && ((s16)gNearestWaypointByPlayerId[playerId] < 0x105)) { player->nearestWaypointId = 0xF0U; - break; + } else { + player->nearestWaypointId = D_80165320[playerId]; + if (player->nearestWaypointId < 0) { + player->nearestWaypointId = gWaypointCountByPathIndex[0] + player->nearestWaypointId; + } } - - player->nearestWaypointId = D_80165320[arg1Copy]; - if (player->nearestWaypointId < 0) { - player->nearestWaypointId = gWaypointCountByPathIndex + player->nearestWaypointId; - break; - } - break; case COURSE_ROYAL_RACEWAY: - if ((((s16)gNearestWaypointByPlayerId[arg1Copy]) >= 0x258) && (((s16)gNearestWaypointByPlayerId[arg1Copy]) < 0x2A4)) { + if (((s16)gNearestWaypointByPlayerId[playerId] >= 0x258) && ((s16)gNearestWaypointByPlayerId[playerId] < 0x2A4)) { player->nearestWaypointId = 0x258U; - break; + } else { + player->nearestWaypointId = D_80165320[playerId]; + if (player->nearestWaypointId < 0) { + player->nearestWaypointId = gWaypointCountByPathIndex[0] + player->nearestWaypointId; + } } - - player->nearestWaypointId = D_80165320[arg1Copy]; - if (player->nearestWaypointId < 0) { - player->nearestWaypointId = gWaypointCountByPathIndex + player->nearestWaypointId; - break; - } - break; case COURSE_DK_JUNGLE: - if ((((s16)gNearestWaypointByPlayerId[arg1Copy]) >= 0xB9) && (((s16)gNearestWaypointByPlayerId[arg1Copy]) < 0x119)) { + if (((s16)gNearestWaypointByPlayerId[playerId] >= 0xB9) && ((s16)gNearestWaypointByPlayerId[playerId] < 0x119)) { player->nearestWaypointId = 0xB9U; - break; + } else { + player->nearestWaypointId = gNearestWaypointByPlayerId[playerId]; + if (player->nearestWaypointId < 0) { + player->nearestWaypointId = gWaypointCountByPathIndex[0] + player->nearestWaypointId; + } } - - player->nearestWaypointId = gNearestWaypointByPlayerId[arg1Copy]; - if (player->nearestWaypointId < 0) { - player->nearestWaypointId = gWaypointCountByPathIndex + player->nearestWaypointId; - break; - } - break; case COURSE_BLOCK_FORT: case COURSE_SKYSCRAPER: @@ -1783,10 +1733,9 @@ void func_8008FF08(Player *player, s8 arg1) { player->nearestWaypointId = 0U; break; default: - player->nearestWaypointId = gNearestWaypointByPlayerId[arg1Copy]; + player->nearestWaypointId = gNearestWaypointByPlayerId[playerId]; if (player->nearestWaypointId < 0) { - player->nearestWaypointId = gWaypointCountByPathIndex + player->nearestWaypointId; - break; + player->nearestWaypointId = gWaypointCountByPathIndex[0] + player->nearestWaypointId; } break; } @@ -1795,171 +1744,102 @@ void func_8008FF08(Player *player, s8 arg1) { GLOBAL_ASM("asm/non_matchings/code_8008C1D0/func_8008FF08.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern ? D_80165310; -static ? D_800E6F6C; /* unable to generate initializer */ -static ? D_800E6F7C; /* unable to generate initializer */ -static ? D_800E6F8C; /* unable to generate initializer */ -static ? D_800E6F9C; /* unable to generate initializer */ -static ? D_800E6FAC; /* unable to generate initializer */ -static ? D_800E6FBC; /* unable to generate initializer */ -static ? D_800E6FCC; /* unable to generate initializer */ -static ? D_800E6FDC; /* unable to generate initializer */ -static ? D_800E6FEC; /* unable to generate initializer */ -static ? D_800E6FFC; /* unable to generate initializer */ -static ? D_800E700C; /* unable to generate initializer */ -static ? D_800E701C; /* unable to generate initializer */ -static ? D_800E702C; /* unable to generate initializer */ -static ? D_800E703C; /* unable to generate initializer */ -static ? D_800E704C; /* unable to generate initializer */ -static ? D_800E705C; /* unable to generate initializer */ -s16 gCurrentCourseId; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// data_0DD0A0_2_0.s +extern f32 D_800E6F6C[4];// = { 0.0f, 0.0f, -700.0f, 700.0f }; +extern f32 D_800E6F7C[4];// = { 700.0f, -700.0f, 0.0f, 0.0f }; +extern f32 D_800E6F8C[4];// = { 0.0f, 0.0f, -650.0f, 650.0f }; +extern f32 D_800E6F9C[4];// = { 650.0f, -650.0f, 0.0f, 0.0f }; +extern f32 D_800E6FAC[4];// = { 0.0f, 0.0f, -400.0f, 400.0f }; +extern f32 D_800E6FBC[4];// = { 400.0f, -400.0f, 0.0f, 0.0f }; +extern f32 D_800E6FCC[4];// = { 0.0f, 0.0f, -350.0f, 350.0f }; +extern f32 D_800E6FDC[4];// = { 350.0f, -350.0f, 0.0f, 0.0f }; +extern f32 D_800E6FEC[4];// = { 0.0f, 0.0f, -675.0f, 675.0f }; +extern f32 D_800E6FFC[4];// = { 675.0f, -675.0f, 0.0f, 0.0f }; +extern f32 D_800E700C[4];// = { 0.0f, 0.0f, -550.0f, 550.0f }; +extern f32 D_800E701C[4];// = { 550.0f, -550.0f, 0.0f, 0.0f }; +extern f32 D_800E702C[4];// = { 0.0f, 0.0f, -575.0f, 575.0f }; +extern f32 D_800E703C[4];// = { 575.0f, -575.0f, 0.0f, 0.0f }; +extern f32 D_800E704C[4];// = { 10.0f, -10.0f, -575.0f, 575.0f }; +extern f32 D_800E705C[4];// = { 575.0f, -575.0f, 10.0f, -10.0f }; +// data_0DD0A0_3_0.s +// jpt_800EF5F8 -void func_80090178(Player *player, s8 arg1, f32 *arg2, f32 *arg3) { - ? sp78; - ? sp68; - ? sp58; - ? sp48; - ? sp38; - ? sp28; - ? sp18; - ? sp8; - f32 var_f10; - s16 temp_t9; - s32 temp_a0; - s32 temp_a0_2; +void func_80090178(Player *player, s8 playerId, Vec3f arg2, Vec3f arg3) { + u16 test; struct TrackWayPoint *temp_v1; - struct TrackWayPoint *temp_v1_2; - struct TrackWayPoint *temp_v1_3; - struct TrackWayPoint *temp_v1_4; - u16 *temp_t0; - u16 temp_t1; + f32 spF8[4] = { 0.0f, 0.0f, -700.0f, 700.0f }; + f32 spE8[4] = { 700.0f, -700.0f, 0.0f, 0.0f }; + f32 spD8[4] = { 0.0f, 0.0f, -650.0f, 650.0f }; + f32 spC8[4] = { 650.0f, -650.0f, 0.0f, 0.0f }; + f32 spB8[4] = { 0.0f, 0.0f, -400.0f, 400.0f }; + f32 spA8[4] = { 400.0f, -400.0f, 0.0f, 0.0f }; + f32 sp98[4] = { 0.0f, 0.0f, -350.0f, 350.0f }; + f32 sp88[4] = { 350.0f, -350.0f, 0.0f, 0.0f }; + f32 sp78[4] = { 0.0f, 0.0f, -675.0f, 675.0f }; + f32 sp68[4] = { 675.0f, -675.0f, 0.0f, 0.0f }; + f32 sp58[4] = { 0.0f, 0.0f, -550.0f, 550.0f }; + f32 sp48[4] = { 550.0f, -550.0f, 0.0f, 0.0f }; + f32 sp38[4] = { 0.0f, 0.0f, -575.0f, 575.0f }; + f32 sp28[4] = { 575.0f, -575.0f, 0.0f, 0.0f }; + f32 sp18[4] = { 10.0f, -10.0f, -575.0f, 575.0f }; + f32 sp08[4] = { 575.0f, -575.0f, 10.0f, -10.0f }; - spF8[0].unk0 = D_800E6F6C.unk0; - spF8[0].unk4 = (s32) D_800E6F6C.unk4; - spF8[0].unk8 = (s32) D_800E6F6C.unk8; - spF8[0].unkC = (s32) D_800E6F6C.unkC; - spE8[0].unk0 = D_800E6F7C.unk0; - spE8[0].unk4 = (s32) D_800E6F7C.unk4; - spE8[0].unk8 = (s32) D_800E6F7C.unk8; - spE8[0].unkC = (s32) D_800E6F7C.unkC; - spD8[0].unk0 = D_800E6F8C.unk0; - spD8[0].unk4 = (s32) D_800E6F8C.unk4; - spD8[0].unk8 = (s32) D_800E6F8C.unk8; - spD8[0].unkC = (s32) D_800E6F8C.unkC; - spC8[0].unk0 = D_800E6F9C.unk0; - spC8[0].unk4 = (s32) D_800E6F9C.unk4; - spC8[0].unk8 = (s32) D_800E6F9C.unk8; - spC8[0].unkC = (s32) D_800E6F9C.unkC; - spB8[0].unk0 = D_800E6FAC.unk0; - spB8[0].unk4 = (s32) D_800E6FAC.unk4; - spB8[0].unk8 = (s32) D_800E6FAC.unk8; - spB8[0].unkC = (s32) D_800E6FAC.unkC; - spA8[0].unk0 = D_800E6FBC.unk0; - spA8[0].unk4 = (s32) D_800E6FBC.unk4; - spA8[0].unk8 = (s32) D_800E6FBC.unk8; - spA8[0].unkC = (s32) D_800E6FBC.unkC; - sp98[0].unk0 = D_800E6FCC.unk0; - sp98[0].unk4 = (s32) D_800E6FCC.unk4; - sp98[0].unk8 = (s32) D_800E6FCC.unk8; - sp98[0].unkC = (s32) D_800E6FCC.unkC; - sp88[0].unk0 = D_800E6FDC.unk0; - sp88[0].unk4 = (s32) D_800E6FDC.unk4; - sp88[0].unk8 = (s32) D_800E6FDC.unk8; - sp88[0].unkC = (s32) D_800E6FDC.unkC; - sp78.unk4 = (s32) D_800E6FEC.unk4; - sp78.unk0 = (s32) D_800E6FEC.unk0; - sp78.unk8 = (s32) D_800E6FEC.unk8; - sp78.unkC = (s32) D_800E6FEC.unkC; - sp68.unk0 = (s32) D_800E6FFC.unk0; - sp68.unk4 = (s32) D_800E6FFC.unk4; - sp68.unkC = (s32) D_800E6FFC.unkC; - sp68.unk8 = (s32) D_800E6FFC.unk8; - sp58.unk0 = (s32) D_800E700C.unk0; - sp58.unk4 = (s32) D_800E700C.unk4; - sp58.unkC = (s32) D_800E700C.unkC; - sp58.unk8 = (s32) D_800E700C.unk8; - sp48.unk0 = (s32) D_800E701C.unk0; - sp48.unk4 = (s32) D_800E701C.unk4; - sp48.unkC = (s32) D_800E701C.unkC; - sp48.unk8 = (s32) D_800E701C.unk8; - sp38.unk0 = (s32) D_800E702C.unk0; - sp38.unk4 = (s32) D_800E702C.unk4; - sp38.unkC = (s32) D_800E702C.unkC; - sp38.unk8 = (s32) D_800E702C.unk8; - sp28.unk0 = (s32) D_800E703C.unk0; - sp28.unk4 = (s32) D_800E703C.unk4; - sp28.unkC = (s32) D_800E703C.unkC; - sp28.unk8 = (s32) D_800E703C.unk8; - sp18.unk0 = (s32) D_800E704C.unk0; - sp18.unk4 = (s32) D_800E704C.unk4; - sp18.unkC = (s32) D_800E704C.unkC; - sp18.unk8 = (s32) D_800E704C.unk8; - sp8.unk0 = (s32) D_800E705C.unk0; - sp8.unk4 = (s32) D_800E705C.unk4; - sp8.unkC = (s32) D_800E705C.unkC; - sp8.unk8 = (s32) D_800E705C.unk8; - temp_t9 = gCurrentCourseId; - switch (temp_t9) { - case 4: - temp_t0 = (arg1 * 2) + &D_80165310; - temp_v1 = &D_80164550[*temp_t0][(u16) player->nearestWaypointId]; - arg2->unk0 = (f32) temp_v1->wayPointX; - arg2->unk4 = (f32) temp_v1->wayPointY; - arg2->unk8 = (f32) temp_v1->wayPointZ; - temp_t1 = *temp_t0; - temp_v1_2 = &D_80164550[temp_t1][(s32) (player->nearestWaypointId + 5) % (s32) (gWaypointCountByPathIndex[temp_t1] + 1)]; - arg3->unk0 = (f32) temp_v1_2->wayPointX; - arg3->unk4 = (f32) temp_v1_2->wayPointY; - arg3->unk8 = (f32) temp_v1_2->wayPointZ; - return; - case 15: - arg2->unk4 = 0.0f; - arg2->unk0 = (&spF8[0])[arg1]; - arg2->unk8 = (f32) (&spE8[0])[arg1]; - arg3->unk4 = 0.0f; - arg3->unk0 = (&spD8[0])[arg1]; - var_f10 = (&spC8[0])[arg1]; -block_8: - arg3->unk8 = var_f10; - return; - case 16: - arg2->unk4 = 480.0f; - arg2->unk0 = (&spB8[0])[arg1]; - arg2->unk8 = (f32) (&spA8[0])[arg1]; - arg3->unk4 = 480.0f; - arg3->unk0 = (&sp98[0])[arg1]; - arg3->unk8 = (f32) (&sp88[0])[arg1]; - return; - case 17: - temp_a0 = arg1 * 4; - arg2->unk4 = 0.0f; - arg2->unk0 = (sp + temp_a0)->unk78; - arg2->unk8 = (f32) (sp + temp_a0)->unk68; - arg3->unk4 = 0.0f; - arg3->unk0 = (sp + temp_a0)->unk58; - arg3->unk8 = (f32) (sp + temp_a0)->unk48; - return; - case 19: - temp_a0_2 = arg1 * 4; - arg2->unk4 = 200.0f; - arg2->unk0 = (sp + temp_a0_2)->unk38; - arg2->unk8 = (f32) (sp + temp_a0_2)->unk28; - arg3->unk4 = 200.0f; - arg3->unk0 = (sp + temp_a0_2)->unk18; - var_f10 = (sp + temp_a0_2)->unk8; - goto block_8; + switch (gCurrentCourseId) { + case COURSE_YOSHI_VALLEY: + test = player->nearestWaypointId; + temp_v1 = &D_80164550[D_80165310[playerId]][test]; + arg2[0] = temp_v1->wayPointX; + arg2[1] = temp_v1->wayPointY; + arg2[2] = temp_v1->wayPointZ; + temp_v1 = &D_80164550[D_80165310[playerId]][(player->nearestWaypointId + 5) % (gWaypointCountByPathIndex[D_80165310[playerId]] + 1)]; + arg3[0] = temp_v1->wayPointX; + arg3[1] = temp_v1->wayPointY; + arg3[2] = temp_v1->wayPointZ; + break; + case COURSE_BLOCK_FORT: + arg2[0] = spF8[playerId]; + arg2[1] = 0.0f; + arg2[2] = spE8[playerId]; + arg3[0] = spD8[playerId]; + arg3[1] = 0.0f; + arg3[2] = spC8[playerId]; + break; + case COURSE_SKYSCRAPER: + arg2[0] = spB8[playerId]; + arg2[1] = 480.0f; + arg2[2] = spA8[playerId]; + arg3[0] = sp98[playerId]; + arg3[1] = 480.0f; + arg3[2] = sp88[playerId]; + break; + case COURSE_DOUBLE_DECK: + arg2[0] = sp78[playerId]; + arg2[1] = 0.0f; + arg2[2] = sp68[playerId]; + arg3[0] = sp58[playerId]; + arg3[1] = 0.0f; + arg3[2] = sp48[playerId]; + break; + case COURSE_BIG_DONUT: + arg2[0] = sp38[playerId]; + arg2[1] = 200.0f; + arg2[2] = sp28[playerId]; + arg3[0] = sp18[playerId]; + arg3[1] = 200.0f; + arg3[2] = sp08[playerId]; + break; default: - temp_v1_3 = &(*D_80164550)[(u16) player->nearestWaypointId]; - arg2->unk0 = (f32) temp_v1_3->wayPointX; - arg2->unk4 = (f32) temp_v1_3->wayPointY; - arg2->unk8 = (f32) temp_v1_3->wayPointZ; - temp_v1_4 = &(*D_80164550)[(s32) (player->nearestWaypointId + 5) % (s32) (*gWaypointCountByPathIndex + 1)]; - arg3->unk0 = (f32) temp_v1_4->wayPointX; - arg3->unk4 = (f32) temp_v1_4->wayPointY; - var_f10 = (f32) temp_v1_4->wayPointZ; - goto block_8; + test = player->nearestWaypointId; + temp_v1 = &D_80164550[0][test]; + arg2[0] = temp_v1->wayPointX; + arg2[1] = temp_v1->wayPointY; + arg2[2] = temp_v1->wayPointZ; + temp_v1 = &D_80164550[0][(player->nearestWaypointId + 5) % (gWaypointCountByPathIndex[0] + 1)]; + arg3[0] = temp_v1->wayPointX; + arg3[1] = temp_v1->wayPointY; + arg3[2] = temp_v1->wayPointZ; + break; } } #else @@ -2027,14 +1907,11 @@ void func_80090868(Player* player) { } } -// Note that D_80004334 is a fake pointer. -// Should put this func through mips to C prior to decomp. #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_80090178(Player *, s8, f32 *, f32 *); /* extern */ -void func_8009E020(s8, ?); /* extern */ -void func_8009E088(s8, ?); /* extern */ -void func_800C9018(u8, ?); /* extern */ +//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b +? func_8009E020(s8, ?); /* extern */ +? func_8009E088(s8, ?); /* extern */ +? func_800C9018(u8, ?); /* extern */ extern ? D_80165330; void func_80090970(Player *player, s8 arg1, s8 arg2) { @@ -2120,7 +1997,7 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) { break; case 2: func_80090178(player, arg1, &sp44, &sp38); - player->unk_02E = -func_802B5224(&sp44, &sp38); + player->unk_02C[1] = -func_802B5224(&sp44, &sp38); player->pos[0] = sp44; player->pos[1] = sp48 + 40.0f; player->unk_222 = 3; @@ -2138,8 +2015,8 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) { player->pos[2] = sp4C; temp_v0_5 = arg1 * 0x1C70; sp28 = temp_v0_5; - player->pos[2] += coss((temp_v0_5 - player->unk_02E) & 0xFFFF) * -5.0f; - temp_f6 = sins((temp_v0_5 - player->unk_02E) & 0xFFFF) * -5.0f; + player->pos[2] += coss((temp_v0_5 - player->unk_02C[1]) & 0xFFFF) * -5.0f; + temp_f6 = sins((temp_v0_5 - player->unk_02C[1]) & 0xFFFF) * -5.0f; player->unk_0C6 += 8; player->pos[0] += temp_f6; if (player->unk_0C6 >= 0xF0) { @@ -2152,8 +2029,8 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) { case 4: temp_v0_6 = player->unk_0C8; if ((temp_v0_6 == 0x0096) || (temp_v0_6 == 0x00C8) || (temp_v0_6 == 0x00FA)) { - player->pos[2] += coss(-player->unk_02E & 0xFFFF) * -10.0f; - player->pos[0] += sins(-player->unk_02E & 0xFFFF) * -10.0f; + player->pos[2] += coss(-player->unk_02C[1] & 0xFFFF) * -10.0f; + player->pos[0] += sins(-player->unk_02C[1] & 0xFFFF) * -10.0f; } if (player->unk_0C8 == 0x00FC) { temp_v0_7 = *D_80164550; @@ -2209,10 +2086,9 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) { GLOBAL_ASM("asm/non_matchings/code_8008C1D0/func_80090970.s") #endif -#if NEEDS_RODATA +#ifdef NEEDS_RODATA s32 func_800910E4(Player *arg0) { - s32 phi_v0; - phi_v0 = 0; + s32 phi_v0 = 0; if ((((((arg0->unk_0CA & 2) == 2) || ((arg0->unk_0CA & 8) == 8)) || ((arg0->unk_000 & 0x40) != 0)) || ((arg0->unk_000 & 0x800) != 0)) || ((arg0->unk_000 & 0x8000) == 0)) { return 1; } @@ -2284,51 +2160,40 @@ void func_800911B4(Player* player, s8 arg1) { } while (temp_v0 < 10); } -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc - -extern s8 D_801658BC; -extern s16 D_8018D920; -static ? D_800E706C; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// data_0DD0A0_2_0.s +// May actually be a Vec3f? Its hard to tell if the 0.0f is part of the array or not +extern f32 D_800E706C[4];// = { 27.16666666666f, 25.16666666666f, 23.16666666666f, 0.0f }; void func_80091298(Player *player, s8 arg1) { - f32 temp_f0; - f32 temp_f2; - s16 *temp_a2; - s16 temp_t9; s16 var_v1; + s32 stackPadding1; + Vec3f spC = { 27.16666666666f, 25.16666666666f, 23.16666666666f }; - spC[0].unk0 = D_800E706C.unk0; - spC[0].unk4 = (s32) D_800E706C.unk4; - spC[0].unk8 = (s32) D_800E706C.unk8; player->unk_044 |= 0x2000; if (player->unk_0B2 == 0) { var_v1 = 0; } else { - temp_a2 = (arg1 * 2) + &D_8018D920; - player->unk_02E -= 0xE38; - temp_t9 = *temp_a2 - 0xE38; - *temp_a2 = temp_t9; - var_v1 = (s16) ((s32) (temp_t9 & 0xFFFF) / 3640); + player->unk_02C[1] -= 0xE38; + D_8018D920[arg1] -= 0xE38; + var_v1 = (u16)D_8018D920[arg1] / 3640; } if (((var_v1 == 9) && (player->unk_0B2 == 1)) || ((var_v1 == 0) && (player->unk_0B2 == 2)) || (player->unk_0B2 == 0)) { - player->unk_0B2 -= 1; + player->unk_0B2--; if (player->unk_0B2 <= 0) { player->unk_0B2 = 0; } if (player->unk_0B2 == 0) { - temp_f2 = player->boundingBoxSize; - temp_f0 = (&spC[0])[arg1]; - if ((player->pos[1] - (temp_f2 + 1.0f)) <= temp_f0) { + if ((player->pos[1] - (player->boundingBoxSize + 1.0f)) <= spC[arg1]) { + player->pos[1] = (f32) ((f64) (spC[arg1] + player->boundingBoxSize) + 1.08); player->unk_DCC = 0; player->unk_0A8 = 0; - player->pos[1] = (f32) ((f64) (temp_f0 + temp_f2) + 1.08); player->unk_07C = 0; player->unk_0C0 = 0; - player->unk_044 &= 0xF7FF; player->unk_DC0 = 3.0f; - player->unkD4 = 0; + player->unk_044 &= ~0x800; player->kartGravity = gKartGravityTable[player->characterId]; + player->unk_0D4 = 0; player->unk_000 |= 0x2000; player->unk_094 = 0.0f; player->unk_08C = 0.0f; diff --git a/src/code_8008C1D0.h b/src/code_8008C1D0.h index d15cf9820..2b9b164b5 100644 --- a/src/code_8008C1D0.h +++ b/src/code_8008C1D0.h @@ -52,6 +52,7 @@ void func_8008C62C(Player*, s8); void func_8008C6D0(Player*, s8); void func_8008C73C(Player*, s8); void func_8008C8C4(Player*, s8); +void func_8008C9EC(Player*, s8); void func_8008CDC0(Player*, s8); void func_8008D0E4(Player*, s8); void func_8008D0FC(Player*, s8); @@ -69,6 +70,7 @@ void func_8008D9C0(Player*); void func_8008DABC(Player*, s8); void func_8008DC08(Player*, s8); void func_8008DF98(Player*, s8); +void func_8008E118(Player*, s8); void func_8008E3C0(Player*, s8); void func_8008E4A4(Player*, s8); void func_8008E6C0(Player*, s8); @@ -103,9 +105,11 @@ void func_8008FDF4(Player*, s8); void func_8008FE84(Player*, s8); void func_8008FEDC(Player*, s8); void func_8008FF08(Player*, s8); +void func_80090178(Player*, s8, Vec3f, Vec3f); void func_80090778(Player*); void func_80090868(Player*); void func_800911B4(Player*, s8); +void func_80091298(Player*, s8); void func_80091440(s8); void func_800914A0(); @@ -153,6 +157,7 @@ extern s32 D_80165420[]; extern s32 D_80165440[]; extern s32 D_80165460[]; extern s32 D_80165480[]; +extern s8 D_801658BC; extern s32 D_8018D900[]; extern s16 D_8018D920[]; extern s32 D_8018D930[]; diff --git a/src/code_800B45E0.h b/src/code_800B45E0.h index 825fa02d1..b46950161 100644 --- a/src/code_800B45E0.h +++ b/src/code_800B45E0.h @@ -13,8 +13,6 @@ union GrandPrixPointsUnion /* Function Prototypes */ -s32 func_800B5020(u32 time, s32 charId); - void func_800B45E0(s32); void write_save_data_grand_prix_points_and_sound_mode(); void func_800B46D0(void); @@ -34,6 +32,7 @@ s32 func_800B4FB0(s32); void func_800B5404(s32, s32); u8 func_800B54C0(s32, s32); u8 func_800B54EC(s32, s32); +s32 func_800B5020(u32 time, s32 charId); u8 func_800B5508(s32, s32, s32); s32 func_800B5530(s32); s32 func_800B555C(); diff --git a/src/math_util.c b/src/math_util.c index 0fc85d44f..68aa835a7 100644 --- a/src/math_util.c +++ b/src/math_util.c @@ -1446,15 +1446,15 @@ UNUSED void func_802B8614(Player *player) { f64 temp_f4; f64 temp_f6; - temp_f6 = (f64) player->boundingBoxCorners[1].cornerX; + temp_f6 = (f64) player->boundingBoxCorners[1].cornerPos[0]; sp70 = (f64) player->boundingBoxCorners[1].cornerGroundY; - sp68 = (f64) player->boundingBoxCorners[1].cornerZ; - temp_f30 = (f64) player->boundingBoxCorners[0].cornerX; + sp68 = (f64) player->boundingBoxCorners[1].cornerPos[2]; + temp_f30 = (f64) player->boundingBoxCorners[0].cornerPos[0]; sp58 = (f64) player->boundingBoxCorners[0].cornerGroundY; - sp50 = (f64) player->boundingBoxCorners[0].cornerZ; - sp48 = (f64) player->boundingBoxCorners[3].cornerX; + sp50 = (f64) player->boundingBoxCorners[0].cornerPos[2]; + sp48 = (f64) player->boundingBoxCorners[3].cornerPos[0]; sp40 = (f64) player->boundingBoxCorners[3].cornerGroundY; - temp_f4 = (f64) player->boundingBoxCorners[3].cornerZ; + temp_f4 = (f64) player->boundingBoxCorners[3].cornerPos[2]; temp_f2 = sp58 - sp70; sp38 = temp_f4; temp_f12 = temp_f4 - sp50; diff --git a/src/math_util.h b/src/math_util.h index 217f508e6..b4578cf2e 100644 --- a/src/math_util.h +++ b/src/math_util.h @@ -45,6 +45,7 @@ void func_802B63B8(Vec3f, Mat3); void func_802B6434(Vec3f, Mat4); void func_802B64B0(s32, s32, s32, s32); void func_802B64C4(Vec3f, s16); +void func_802B6540(Mat3, f32, f32, f32, s16); void func_802B6BC0(Mat4, s16, f32, f32, f32); void func_802B6D58(Mat4, Vec3f, Vec3f); void func_802B71CC(Mat4, Mat4, Mat4); diff --git a/src/memory.c b/src/memory.c index a576e7ede..36eb9408a 100644 --- a/src/memory.c +++ b/src/memory.c @@ -1482,86 +1482,57 @@ void func_802AAAAC(UnkActorInner *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_802ABD10(u16, void *); // extern -s32 func_802ABD40(u16, void *); // extern -extern f32 D_802B9E00; -extern f32 D_802B9E04; -extern f32 D_802B9E08; -extern f32 D_802B9E0C; -extern f32 D_802B9E10; -extern f32 D_802B9E14; -extern f32 D_802B9E18; -extern f32 D_802B9E1C; -extern f32 D_802B9E20; -extern f32 D_802B9E24; -extern f32 D_802B9E28; -extern f32 D_802B9E2C; -extern f32 D_802B9E30; -extern f32 D_802B9E34; -extern f32 D_802B9E38; -extern f32 D_802B9E3C; -extern f32 D_802B9E40; -extern f32 D_802B9E44; +//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b +extern f32 D_8015F8E4; +static f32 D_802B9E00 = 1859.0f; +static f32 D_802B9E04 = 1549.0f; +static f32 D_802B9E08 = -1102.0f; +static f32 D_802B9E0C = -1402.0f; +static f32 D_802B9E10 = 2405.0f; +static f32 D_802B9E14 = 2233.0f; +static f32 D_802B9E18 = 0.8f; +static f32 D_802B9E1C = -475.0f; +static f32 D_802B9E20 = -33.9f; +static f32 D_802B9E24 = -838.0f; +static f32 D_802B9E28 = -475.0f; +static f32 D_802B9E2C = -475.0f; +static f32 D_802B9E30 = -993.0f; +static f32 D_802B9E34 = -33.9f; +static f32 D_802B9E38 = -475.0f; +static f32 D_802B9E3C = -33.9f; +static f32 D_802B9E40 = -475.0f; +static f32 D_802B9E44 = -33.9f; +s16 gCurrentCourseId; /* unable to generate initializer */ -f32 func_802AAB4C(void *arg0) { +f32 func_802AAB4C(Player *player) { f32 sp1C; f32 sp18; f32 temp_f0; f32 temp_f2; s16 temp_v0; s32 temp_v1; - u16 temp_a0; - void *temp_a1; temp_v0 = gCurrentCourseId; - temp_a1 = arg0; - temp_f0 = arg0->unk14; - temp_f2 = arg0->unk1C; - if (temp_v0 != 2) { - if (temp_v0 != 6) { - if (temp_v0 != 0xC) { - if (temp_v0 != 0x12) { - goto block_43; - } - temp_a0 = temp_a1->unk11A; - sp18 = temp_f2; - sp1C = temp_f0; - arg0 = temp_a1; - temp_v1 = func_802ABD40(temp_a0, temp_a1) & 0xFF; - if (temp_v1 == 0xFF) { - sp18 = temp_f2; - sp1C = temp_f0; - if ((func_802ABD10(arg0->unk11A, arg0) & 0xFF) == 0xF) { - return D_802B9E1C; - } - if (temp_f0 > -478.0f) { - return D_802B9E20; - } - if (temp_f0 < D_802B9E24) { - return D_802B9E28; - } - if (temp_f2 > -436.0f) { - return D_802B9E2C; - } - if (temp_f2 < D_802B9E30) { - return D_802B9E34; - } - if (temp_f2 < temp_f0) { - return D_802B9E38; - } - return D_802B9E3C; - } - if (temp_v1 >= 0x14) { - return D_802B9E40; - } - return D_802B9E44; - } - if ((func_802ABD10(temp_a1->unk11A, temp_a1) & 0xFF) == 5) { - return D_8015F6EE - 0xA; - } + temp_f0 = player->pos[0]; + temp_f2 = player->pos[2]; + switch (temp_v0) { /* irregular */ + case 2: + if (D_802B9E00 < temp_f0) { goto block_43; } + if (temp_f0 < D_802B9E04) { + goto block_43; + } + if (D_802B9E08 < temp_f2) { + goto block_43; + } + if (temp_f2 < D_802B9E0C) { +block_43: + default: + return D_8015F8E4; + } + return 20.0f; + case 6: if (temp_f0 > 239.0f) { goto block_43; } @@ -1575,21 +1546,43 @@ f32 func_802AAB4C(void *arg0) { goto block_43; } return D_802B9E18; - } - if (D_802B9E00 < temp_f0) { + case 12: + if ((func_802ABD10(player->unk_110.unk3A) & 0xFF) == 5) { + return (f32) (D_8015F6EE - 0xA); + } goto block_43; + case 18: + sp18 = temp_f2; + sp1C = temp_f0; + temp_v1 = func_802ABD40(player->unk_110.unk3A) & 0xFF; + if (temp_v1 == 0xFF) { + sp18 = temp_f2; + sp1C = temp_f0; + if ((func_802ABD10(player->unk_110.unk3A) & 0xFF) == 0xF) { + return D_802B9E1C; + } + if (temp_f0 > -478.0f) { + return D_802B9E20; + } + if (temp_f0 < D_802B9E24) { + return D_802B9E28; + } + if (temp_f2 > -436.0f) { + return D_802B9E2C; + } + if (temp_f2 < D_802B9E30) { + return D_802B9E34; + } + if (temp_f2 < temp_f0) { + return D_802B9E38; + } + return D_802B9E3C; + } + if (temp_v1 >= 0x14) { + return D_802B9E40; + } + return D_802B9E44; } - if (temp_f0 < D_802B9E04) { - goto block_43; - } - if (D_802B9E08 < temp_f2) { - goto block_43; - } - if (temp_f2 < D_802B9E0C) { -block_43: - return D_8015F8E4; - } - return 20.0f; } #else GLOBAL_ASM("asm/non_matchings/memory/func_802AAB4C.s") @@ -4120,23 +4113,23 @@ block_12: GLOBAL_ASM("asm/non_matchings/memory/func_802AF5D8.s") #endif -void func_802AF7B4(uintptr_t addr, s32 arg1, s32 arg2) { +void func_802AF7B4(uintptr_t addr, s32 uls, s32 ult) { s32 segment = SEGMENT_NUMBER2(addr); s32 offset = SEGMENT_OFFSET(addr); - struct UnkStruct802AF7B4 *phi_v0 = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset); - s32 temp_v1; + Gfx *phi_v0 = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset); + s32 gfxCommand; - arg1 = (arg1 << 12) & 0xFFF000; - arg2 &= 0xFFF; + uls = (uls << 12) & 0xFFF000; + ult &= 0xFFF; while(1) { - temp_v1 = phi_v0->unk0 & 0xFF000000; + gfxCommand = phi_v0->words.w0 & 0xFF000000; - if (temp_v1 == G_ENDDL << 24) { + if (gfxCommand == G_ENDDL << 24) { break; - } else if (temp_v1 == G_SETTILESIZE << 24) { - phi_v0->unk0 = 0xF2000000 | arg1 | arg2; + } else if (gfxCommand == (G_SETTILESIZE << 24)) { + phi_v0->words.w0 = 0xF2000000 | uls | ult; break; } @@ -4210,38 +4203,31 @@ loop_1: GLOBAL_ASM("asm/non_matchings/memory/func_802AF8BC.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_802AF9F0(void *arg0, f32 arg1, void *arg2) { - arg2->unk0 = arg2->unk0 - (arg0->unk0 * arg1); - arg2->unk4 = arg2->unk4 - (arg0->unk4 * arg1); - arg2->unk8 = arg2->unk8 - (arg0->unk8 * arg1); +void func_802AF9F0(Vec3f arg0, f32 arg1, Vec3f arg2) { + arg2[0] -= arg0[0] * arg1; + arg2[1] -= arg0[1] * arg1; + arg2[2] -= arg0[2] * arg1; } -#else -GLOBAL_ASM("asm/non_matchings/memory/func_802AF9F0.s") -#endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 -f32 func_802ABE30(f32, f32, f32, u16); /* extern */ +//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b s32 func_802AC760(s16 *, f32, f32, f32, f32, s32, f32, f32, f32); /* extern */ s32 func_802ACBA4(s16 *, f32, f32, f32, f32, s32, f32, f32, f32); /* extern */ s32 func_802AD278(s16 *, f32, f32, f32, f32, s32, f32, f32, f32); /* extern */ -void func_802AF9F0(f32, ? *, ?32, kartBoundingBoxCorner *); /* extern */ -extern u8 D_8014F110; +extern ? D_8014F110; extern s32 D_8015F584; extern s16 D_8015F6E8; extern s16 D_8015F6EA; extern s16 D_8015F6F0; extern s16 D_8015F6F2; -s32 func_802AFA34(Player *player, kartBoundingBoxCorner *corner, f32 cornerX, f32 cornerY, f32 cornerZ) { - ? sp128; - ? sp11C; - ? sp110; - ?32 sp10C; - ?32 sp108; - ?32 sp104; +s32 func_802AFA34(Player *player, KartBoundingBoxCorner *corner, f32 cornerPos[0], f32 cornerPos[1], f32 cornerPos[2]) { + f32 sp128; + f32 sp11C; + f32 sp110; + f32 sp10C; + f32 sp108; + f32 sp104; s16 sp102; s16 sp100; s16 spFE; @@ -4269,22 +4255,21 @@ s32 func_802AFA34(Player *player, kartBoundingBoxCorner *corner, f32 cornerX, f3 mk64_surface_map_ram *temp_v0_4; s16 temp_v0_2; s16 temp_v1; + s32 temp_at; s32 temp_f10; s32 temp_f16; s32 temp_t6; + s32 var_s2; u16 temp_s0; u16 temp_v0_3; u16 temp_v1_3; + u16 var_s1; u8 temp_v0; void *temp_v1_2; - u16 phi_s1; - s16 *phi_s7; - f32 phi_f30; - s32 phi_s2; - sp104 = 0x447A0000; - sp108 = 0x447A0000; - sp10C = 0x447A0000; + sp104 = 1000.0f; + sp108 = 1000.0f; + sp10C = 1000.0f; temp_f20 = player->boundingBoxSize; spFE = 0x1388; sp100 = 0x1388; @@ -4293,150 +4278,140 @@ s32 func_802AFA34(Player *player, kartBoundingBoxCorner *corner, f32 cornerX, f3 spFA = 0; spFC = 0; temp_v0 = corner->surfaceFlags; - temp_f22 = corner->cornerX; - temp_f24 = corner->cornerY; - temp_f26 = corner->cornerZ; - if (temp_v0 != 0) { - phi_s7 = &spF8; - if (temp_v0 != 0x20) { - phi_s7 = &spF8; - if (temp_v0 != 0x40) { - phi_s7 = &spF8; - if (temp_v0 != 0x80) { - goto block_21; - } - if (func_802AD278(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->surfaceMapIndex, cornerX, cornerY, cornerZ) == 1) { - temp_f0 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->surfaceMapIndex); - temp_f2 = player->pos[1]; - if (!(temp_f2 < temp_f0) && !((2.0f * temp_f20) < (temp_f2 - temp_f0))) { - corner->cornerGroundY = temp_f0; - func_802AF9F0(temp_f0, &sp11C, sp108, corner); - return 1; - } - } - phi_f30 = 2.0f; - goto block_22; - } - if (func_802AC760(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->surfaceMapIndex, cornerX, cornerY, cornerZ) == 1) { - temp_f0_2 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->surfaceMapIndex); - temp_f2_2 = player->pos[1]; - if (!(temp_f2_2 < temp_f0_2) && !((2.0f * temp_f20) < (temp_f2_2 - temp_f0_2))) { - corner->cornerGroundY = temp_f0_2; - func_802AF9F0(temp_f0_2, &sp128, sp10C, corner); - return 1; - } - } - phi_f30 = 2.0f; - goto block_22; - } - if (func_802ACBA4(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->surfaceMapIndex, cornerX, cornerY, cornerZ) == 1) { - temp_f0_3 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->surfaceMapIndex); - temp_f2_3 = player->pos[1]; - if (!(temp_f2_3 < temp_f0_3) && !((2.0f * temp_f20) < (temp_f2_3 - temp_f0_3))) { - corner->cornerGroundY = temp_f0_3; - func_802AF9F0(temp_f0_3, &sp110, sp104, corner); + temp_f22 = corner->cornerPos[0]; + temp_f24 = corner->cornerPos[1]; + temp_f26 = corner->cornerPos[2]; + switch (temp_v0) { /* irregular */ + case 0x80: + if (func_802AD278(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->surfaceMapIndex, cornerPos[0], cornerPos[1], cornerPos[2]) == 1) { + temp_f0 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->surfaceMapIndex); + temp_f2 = player->pos[1]; + if (!(temp_f2 < temp_f0) && !((2.0f * temp_f20) < (temp_f2 - temp_f0))) { + corner->cornerGroundY = temp_f0; + func_802AF9F0(&sp11C, sp108, &corner->cornerPos[0]); return 1; } } - phi_f30 = 2.0f; - goto block_22; - } -block_21: - phi_s7 = &spF8; - phi_f30 = 2.0f; + default: block_22: - temp_v0_2 = D_8015F6EA; - temp_v1 = D_8015F6F2; - temp_f10 = (s32) ((temp_f22 - (f32) temp_v0_2) / (f32) ((s32) (D_8015F6E8 - temp_v0_2) / 32)); - temp_f16 = (s32) ((temp_f26 - (f32) temp_v1) / (f32) ((s32) (D_8015F6F0 - temp_v1) / 32)); - if ((s32) (s16) temp_f10 < 0) { - goto block_57; - } - if ((s32) (s16) temp_f16 < 0) { - goto block_57; - } - if ((s32) (s16) temp_f10 >= 0x20) { - goto block_57; - } - if ((s32) (s16) temp_f16 >= 0x20) { - goto block_57; - } - temp_v1_2 = ((s16) ((s16) temp_f10 + ((s16) temp_f16 << 5)) * 4) + &D_8014F110; - temp_v0_3 = temp_v1_2->unk2; - sp8C = (s32) temp_v0_3; - if (temp_v0_3 == 0) { - goto block_57; - } - phi_s1 = temp_v1_2->unk0; - phi_s2 = 0; - if (sp8C > 0) { + temp_v0_2 = D_8015F6EA; + temp_v1 = D_8015F6F2; + temp_f10 = (s32) ((temp_f22 - (f32) temp_v0_2) / (f32) ((s32) (D_8015F6E8 - temp_v0_2) / 32)); + temp_f16 = (s32) ((temp_f26 - (f32) temp_v1) / (f32) ((s32) (D_8015F6F0 - temp_v1) / 32)); + if ((s16) temp_f10 < 0) { + goto block_57; + } + if ((s16) temp_f16 < 0) { + goto block_57; + } + if ((s16) temp_f10 >= 0x20) { + goto block_57; + } + if ((s16) temp_f16 >= 0x20) { + goto block_57; + } + temp_v1_2 = ((s16) ((s16) temp_f10 + ((s16) temp_f16 << 5)) * 4) + &D_8014F110; + temp_v0_3 = temp_v1_2->unk2; + sp8C = (s32) temp_v0_3; + if (temp_v0_3 == 0) { + goto block_57; + } + var_s1 = temp_v1_2->unk0; + var_s2 = 0; + if (sp8C > 0) { loop_34: - temp_s0 = *(D_8015F584 + (phi_s1 * 2)); - temp_v0_4 = &(*D_8015F580)[temp_s0]; - temp_v1_3 = temp_v0_4->flags; - if ((temp_v1_3 & 0x4000) != 0) { - if ((corner->surfaceMapIndex != temp_s0) && (func_802AC760(phi_s7, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerX, cornerY, cornerZ) == 1)) { + temp_s0 = *(D_8015F584 + (var_s1 * 2)); + temp_v0_4 = &D_8015F580[temp_s0]; + temp_v1_3 = temp_v0_4->flags; + if (temp_v1_3 & 0x4000) { + if ((corner->surfaceMapIndex != temp_s0) && (func_802AC760(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerPos[0], cornerPos[1], cornerPos[2]) == 1)) { + temp_f0_2 = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF); + temp_f2_2 = player->pos[1]; + if (!(temp_f2_2 < temp_f0_2) && !((2.0f * temp_f20) < (temp_f2_2 - temp_f0_2))) { + spD4 = temp_f0_2; + func_802AF9F0(&sp128, sp10C, &corner->cornerPos[0]); + corner->cornerGroundY = spD4; + corner->surfaceFlags = 0x40; + corner->surfaceMapIndex = temp_s0; + corner->surfaceType = (u8) D_8015F580[temp_s0].surfaceType; + if (D_8015F580[temp_s0].flags & 0x1000) { + corner->unk_14 = 1; + return 1; + } + corner->unk_14 = 0; + return 1; + } + } + goto block_55; + } + if (temp_v1_3 & 0x8000) { + if ((temp_v0_4->gravity != 0.0f) && (corner->surfaceMapIndex != temp_s0) && (func_802AD278(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerPos[0], cornerPos[1], cornerPos[2]) == 1)) { + temp_f0_3 = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF); + temp_f2_3 = player->pos[1]; + if (!(temp_f2_3 < temp_f0_3) && !((2.0f * temp_f20) < (temp_f2_3 - temp_f0_3))) { + corner->cornerGroundY = temp_f0_3; + func_802AF9F0(&sp11C, sp108, &corner->cornerPos[0]); + corner->cornerGroundY = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF); + corner->surfaceFlags = 0x80; + corner->surfaceMapIndex = temp_s0; + corner->surfaceType = (u8) D_8015F580[temp_s0].surfaceType; + return 1; + } + } + goto block_55; + } + if ((temp_v0_4->gravity != 0.0f) && (corner->surfaceMapIndex != temp_s0) && (func_802ACBA4(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerPos[0], cornerPos[1], cornerPos[2]) == 1)) { temp_f0_4 = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF); temp_f2_4 = player->pos[1]; - if (!(temp_f2_4 < temp_f0_4) && !((phi_f30 * temp_f20) < (temp_f2_4 - temp_f0_4))) { - spD4 = temp_f0_4; - func_802AF9F0(temp_f0_4, &sp128, sp10C, corner); - corner->cornerGroundY = spD4; - corner->surfaceFlags = 0x40; + if (!(temp_f2_4 < temp_f0_4) && !((2.0f * temp_f20) < (temp_f2_4 - temp_f0_4))) { + corner->cornerGroundY = temp_f0_4; + func_802AF9F0(&sp110, sp104, &corner->cornerPos[0]); + corner->surfaceFlags = 0x20; corner->surfaceMapIndex = temp_s0; - corner->surfaceType = (u8) (*D_8015F580)[temp_s0].surfaceType; - if (((*D_8015F580)[temp_s0].flags & 0x1000) != 0) { - corner->unk_14 = 1; - return 1; - } - corner->unk_14 = 0; + corner->surfaceType = (u8) D_8015F580[temp_s0].surfaceType; return 1; } } - goto block_55; - } - if ((temp_v1_3 & 0x8000) != 0) { - if ((temp_v0_4->gravity != 0.0f) && (corner->surfaceMapIndex != temp_s0) && (func_802AD278(phi_s7, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerX, cornerY, cornerZ) == 1)) { - temp_f0_5 = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF); - temp_f2_5 = player->pos[1]; - if (!(temp_f2_5 < temp_f0_5) && !((phi_f30 * temp_f20) < (temp_f2_5 - temp_f0_5))) { - corner->cornerGroundY = temp_f0_5; - func_802AF9F0(temp_f0_5, &sp11C, sp108, corner); - corner->cornerGroundY = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF); - corner->surfaceFlags = 0x80; - corner->surfaceMapIndex = temp_s0; - corner->surfaceType = (u8) (*D_8015F580)[temp_s0].surfaceType; - return 1; - } +block_55: + temp_t6 = (var_s2 + 1) & 0xFFFF; + temp_at = temp_t6 < sp8C; + var_s2 = temp_t6; + var_s1 = (var_s1 + 1) & 0xFFFF; + if (temp_at == 0) { + goto block_56; } - goto block_55; + goto loop_34; } - if ((temp_v0_4->gravity != 0.0f) && (corner->surfaceMapIndex != temp_s0) && (func_802ACBA4(phi_s7, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerX, cornerY, cornerZ) == 1)) { - temp_f0_6 = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF); - temp_f2_6 = player->pos[1]; - if (!(temp_f2_6 < temp_f0_6) && !((phi_f30 * temp_f20) < (temp_f2_6 - temp_f0_6))) { - corner->cornerGroundY = temp_f0_6; - func_802AF9F0(temp_f0_6, &sp110, sp104, corner); - corner->surfaceFlags = 0x20; - corner->surfaceMapIndex = temp_s0; - corner->surfaceType = (u8) (*D_8015F580)[temp_s0].surfaceType; +block_56: + corner->cornerGroundY = temp_f24; + corner->surfaceType = 0; +block_57: + return 0; + case 0x40: + if (func_802AC760(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->surfaceMapIndex, cornerPos[0], cornerPos[1], cornerPos[2]) == 1) { + temp_f0_5 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->surfaceMapIndex); + temp_f2_5 = player->pos[1]; + if (!(temp_f2_5 < temp_f0_5) && !((2.0f * temp_f20) < (temp_f2_5 - temp_f0_5))) { + corner->cornerGroundY = temp_f0_5; + func_802AF9F0(&sp128, sp10C, &corner->cornerPos[0]); return 1; } } -block_55: - temp_t6 = (phi_s2 + 1) & 0xFFFF; - phi_s1 = (phi_s1 + 1) & 0xFFFF; - phi_s2 = temp_t6; - if (temp_t6 >= sp8C) { - goto block_56; + goto block_22; + case 0x20: + if (func_802ACBA4(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->surfaceMapIndex, cornerPos[0], cornerPos[1], cornerPos[2]) == 1) { + temp_f0_6 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->surfaceMapIndex); + temp_f2_6 = player->pos[1]; + if (!(temp_f2_6 < temp_f0_6) && !((2.0f * temp_f20) < (temp_f2_6 - temp_f0_6))) { + corner->cornerGroundY = temp_f0_6; + func_802AF9F0(&sp110, sp104, &corner->cornerPos[0]); + return 1; + } } - goto loop_34; + goto block_22; + case 0x0: + goto block_22; } -block_56: - corner->cornerGroundY = temp_f24; - corner->surfaceType = 0; -block_57: - return 0; } #else GLOBAL_ASM("asm/non_matchings/memory/func_802AFA34.s") diff --git a/src/memory.h b/src/memory.h index ac0b66096..04597e7bf 100644 --- a/src/memory.h +++ b/src/memory.h @@ -107,6 +107,7 @@ void func_802AF5AC(s32, s8); void func_802AF5D8(u32, s8, s32); void func_802AF7B4(uintptr_t, s32, s32); void func_802AF8BC(uintptr_t, s8, u8, u8, u8); +void func_802AF9F0(Vec3f, f32, Vec3f); // main.c extern struct D_80150158 gD_80150158[]; diff --git a/src/render_courses.c b/src/render_courses.c index 6ed37963e..e26d33ccb 100644 --- a/src/render_courses.c +++ b/src/render_courses.c @@ -193,11 +193,8 @@ void func_802911C4(void) { } #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -s32 func_80290C20(Camera *); /* extern */ +//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b f32 func_802AAB4C(Player *); /* extern */ -void init_rdp(); /* extern */ -void load_surface_map(? *, struct UnkStruct_800DC5EC *, Gfx **); /* extern */ extern ? D_06009228; extern ? D_060164B8; extern ? D_06019578; @@ -221,8 +218,26 @@ void func_8029122C(struct UnkStruct_800DC5EC *arg0, s32 arg1) { Gfx *temp_v1_102; Gfx *temp_v1_103; Gfx *temp_v1_104; + Gfx *temp_v1_105; + Gfx *temp_v1_106; + Gfx *temp_v1_107; + Gfx *temp_v1_108; + Gfx *temp_v1_109; Gfx *temp_v1_10; + Gfx *temp_v1_110; + Gfx *temp_v1_111; + Gfx *temp_v1_112; + Gfx *temp_v1_113; + Gfx *temp_v1_114; + Gfx *temp_v1_115; + Gfx *temp_v1_116; + Gfx *temp_v1_117; + Gfx *temp_v1_118; + Gfx *temp_v1_119; Gfx *temp_v1_11; + Gfx *temp_v1_120; + Gfx *temp_v1_121; + Gfx *temp_v1_122; Gfx *temp_v1_12; Gfx *temp_v1_13; Gfx *temp_v1_14; @@ -319,9 +334,6 @@ void func_8029122C(struct UnkStruct_800DC5EC *arg0, s32 arg1) { Gfx *temp_v1_98; Gfx *temp_v1_99; Gfx *temp_v1_9; - Gfx *var_v1; - Gfx *var_v1_2; - Gfx *var_v1_3; s16 temp_t7; u32 var_t6; @@ -345,31 +357,31 @@ void func_8029122C(struct UnkStruct_800DC5EC *arg0, s32 arg1) { gDisplayListHead = temp_v1_3 + 8; temp_v1_3->words.w0 = 0x01030040; temp_v1_3->words.w1 = (s32) &gGfxPool->mtxPool[2] & 0x1FFFFFFF; - var_v1 = gDisplayListHead; - gDisplayListHead = var_v1 + 8; - var_v1->words.w0 = 0x01010040; - var_t6 = (s32) &gGfxPool->mtxPool[8] & 0x1FFFFFFF; -block_9: - var_v1->words.w1 = var_t6; - break; - case 2: /* switch 4 */ temp_v1_4 = gDisplayListHead; gDisplayListHead = temp_v1_4 + 8; - temp_v1_4->words.w0 = 0x01030040; - temp_v1_4->words.w1 = (s32) &gGfxPool->mtxPool[3] & 0x1FFFFFFF; + temp_v1_4->words.w0 = 0x01010040; + var_t6 = (s32) &gGfxPool->mtxPool[8] & 0x1FFFFFFF; +block_9: + gDisplayListHead->words.w1 = var_t6; + break; + case 2: /* switch 4 */ temp_v1_5 = gDisplayListHead; gDisplayListHead = temp_v1_5 + 8; - temp_v1_5->words.w0 = 0x01010040; - temp_v1_5->words.w1 = (s32) &gGfxPool->mtxPool[9] & 0x1FFFFFFF; - break; - case 3: /* switch 4 */ + temp_v1_5->words.w0 = 0x01030040; + temp_v1_5->words.w1 = (s32) &gGfxPool->mtxPool[3] & 0x1FFFFFFF; temp_v1_6 = gDisplayListHead; gDisplayListHead = temp_v1_6 + 8; - temp_v1_6->words.w0 = 0x01030040; - temp_v1_6->words.w1 = (s32) &gGfxPool->mtxPool[4] & 0x1FFFFFFF; - var_v1 = gDisplayListHead; - gDisplayListHead = var_v1 + 8; - var_v1->words.w0 = 0x01010040; + temp_v1_6->words.w0 = 0x01010040; + temp_v1_6->words.w1 = (s32) &gGfxPool->mtxPool[9] & 0x1FFFFFFF; + break; + case 3: /* switch 4 */ + temp_v1_7 = gDisplayListHead; + gDisplayListHead = temp_v1_7 + 8; + temp_v1_7->words.w0 = 0x01030040; + temp_v1_7->words.w1 = (s32) &gGfxPool->mtxPool[4] & 0x1FFFFFFF; + temp_v1_8 = gDisplayListHead; + gDisplayListHead = temp_v1_8 + 8; + temp_v1_8->words.w0 = 0x01010040; var_t6 = (s32) &gGfxPool->mtxPool[0xA] & 0x1FFFFFFF; goto block_9; } @@ -379,70 +391,70 @@ block_9: temp_t7 = gCurrentCourseId; switch (temp_t7) { /* switch 1 */ case 2: /* switch 1 */ - if ((gActiveScreenMode == SCREEN_MODE_1P) && ((s32) (u16) sp21A >= 6) && ((s32) (u16) sp21A < 0xA) && (((u16) sp21A != 9) || (((s32) (u16) sp218 >= 0xA000) && ((s32) (u16) sp218 < 0xE001)))) { - temp_v1_7 = gDisplayListHead; - gDisplayListHead = temp_v1_7 + 8; - temp_v1_7->words.w1 = (u32) &D_06009228; - temp_v1_7->words.w0 = 0x06000000; + if ((gActiveScreenMode == 0) && ((s32) (u16) sp21A >= 6) && ((s32) (u16) sp21A < 0xA) && (((u16) sp21A != 9) || (((s32) (u16) sp218 >= 0xA000) && ((s32) (u16) sp218 < 0xE001)))) { + temp_v1_9 = gDisplayListHead; + gDisplayListHead = temp_v1_9 + 8; + temp_v1_9->words.w1 = (u32) &D_06009228; + temp_v1_9->words.w0 = 0x06000000; return; } default: /* switch 1 */ return; case 3: /* switch 1 */ - temp_v1_8 = gDisplayListHead; - gDisplayListHead = temp_v1_8 + 8; - temp_v1_8->words.w1 = 0; - temp_v1_8->words.w0 = 0xE7000000; - temp_v1_9 = gDisplayListHead; - gDisplayListHead = temp_v1_9 + 8; - temp_v1_9->words.w1 = -1U; - temp_v1_9->words.w0 = 0xBB000001; temp_v1_10 = gDisplayListHead; gDisplayListHead = temp_v1_10 + 8; - temp_v1_10->words.w1 = 0x00020000; - temp_v1_10->words.w0 = 0xB6000000; + temp_v1_10->words.w1 = 0; + temp_v1_10->words.w0 = 0xE7000000; temp_v1_11 = gDisplayListHead; gDisplayListHead = temp_v1_11 + 8; - temp_v1_11->words.w1 = 0x004045D8; - temp_v1_11->words.w0 = 0xB900031D; + temp_v1_11->words.w1 = -1U; + temp_v1_11->words.w0 = 0xBB000001; temp_v1_12 = gDisplayListHead; gDisplayListHead = temp_v1_12 + 8; - temp_v1_12->words.w1 = 0; - temp_v1_12->words.w0 = 0xC0000000; + temp_v1_12->words.w1 = 0x00020000; + temp_v1_12->words.w0 = 0xB6000000; temp_v1_13 = gDisplayListHead; gDisplayListHead = temp_v1_13 + 8; - temp_v1_13->words.w1 = 0xFF33FFFF; - temp_v1_13->words.w0 = 0xFC121824; + temp_v1_13->words.w1 = 0x004045D8; + temp_v1_13->words.w0 = 0xB900031D; temp_v1_14 = gDisplayListHead; gDisplayListHead = temp_v1_14 + 8; - temp_v1_14->words.w1 = 0x07000878; - temp_v1_14->words.w0 = 0x06000000; + temp_v1_14->words.w1 = 0; + temp_v1_14->words.w0 = 0xC0000000; temp_v1_15 = gDisplayListHead; gDisplayListHead = temp_v1_15 + 8; - temp_v1_15->words.w1 = 0; - temp_v1_15->words.w0 = 0xB9000002; + temp_v1_15->words.w1 = 0xFF33FFFF; + temp_v1_15->words.w0 = 0xFC121824; temp_v1_16 = gDisplayListHead; gDisplayListHead = temp_v1_16 + 8; - temp_v1_16->words.w1 = 0; - temp_v1_16->words.w0 = 0xE7000000; - return; - case 6: /* switch 1 */ + temp_v1_16->words.w1 = 0x07000878; + temp_v1_16->words.w0 = 0x06000000; temp_v1_17 = gDisplayListHead; gDisplayListHead = temp_v1_17 + 8; temp_v1_17->words.w1 = 0; - temp_v1_17->words.w0 = 0xE7000000; + temp_v1_17->words.w0 = 0xB9000002; temp_v1_18 = gDisplayListHead; gDisplayListHead = temp_v1_18 + 8; - temp_v1_18->words.w1 = -1U; - temp_v1_18->words.w0 = 0xBB000001; + temp_v1_18->words.w1 = 0; + temp_v1_18->words.w0 = 0xE7000000; + return; + case 6: /* switch 1 */ temp_v1_19 = gDisplayListHead; gDisplayListHead = temp_v1_19 + 8; - temp_v1_19->words.w1 = 0x00020000; - temp_v1_19->words.w0 = 0xB6000000; + temp_v1_19->words.w1 = 0; + temp_v1_19->words.w0 = 0xE7000000; temp_v1_20 = gDisplayListHead; gDisplayListHead = temp_v1_20 + 8; - temp_v1_20->words.w1 = 0x004045D8; - temp_v1_20->words.w0 = 0xB900031D; + temp_v1_20->words.w1 = -1U; + temp_v1_20->words.w0 = 0xBB000001; + temp_v1_21 = gDisplayListHead; + gDisplayListHead = temp_v1_21 + 8; + temp_v1_21->words.w1 = 0x00020000; + temp_v1_21->words.w0 = 0xB6000000; + temp_v1_22 = gDisplayListHead; + gDisplayListHead = temp_v1_22 + 8; + temp_v1_22->words.w1 = 0x004045D8; + temp_v1_22->words.w0 = 0xB900031D; temp_t0 = gDisplayListHead; gDisplayListHead = temp_t0 + 8; temp_t0->words.w1 = 0; @@ -458,18 +470,18 @@ block_9: case 30: /* switch 2 */ case 31: /* switch 2 */ case 37: /* switch 2 */ - temp_v1_21 = gDisplayListHead; - gDisplayListHead = temp_v1_21 + 8; - temp_v1_21->words.w1 = 0x00002000; - temp_v1_21->words.w0 = 0xB6000000; - temp_v1_22 = gDisplayListHead; - gDisplayListHead = temp_v1_22 + 8; - temp_v1_22->words.w1 = 0x07009E70; - temp_v1_22->words.w0 = 0x06000000; temp_v1_23 = gDisplayListHead; gDisplayListHead = temp_v1_23 + 8; temp_v1_23->words.w1 = 0x00002000; - temp_v1_23->words.w0 = 0xB7000000; + temp_v1_23->words.w0 = 0xB6000000; + temp_v1_24 = gDisplayListHead; + gDisplayListHead = temp_v1_24 + 8; + temp_v1_24->words.w1 = 0x07009E70; + temp_v1_24->words.w0 = 0x06000000; + temp_v1_25 = gDisplayListHead; + gDisplayListHead = temp_v1_25 + 8; + temp_v1_25->words.w1 = 0x00002000; + temp_v1_25->words.w0 = 0xB7000000; break; } sp21C = 0.0f; @@ -477,424 +489,355 @@ block_9: sp220 = D_8015F8E4; mtxf_translate((f32 (*)[4]) &sp228[0], &sp21C); func_802B4FF8((f32 (*)[4]) &sp228[0], 0); - temp_v1_24 = gDisplayListHead; - gDisplayListHead = temp_v1_24 + 8; - temp_v1_24->words.w0 = 0xB900031D; - temp_v1_24->words.w1 = 0x004045D8; - temp_v1_25 = gDisplayListHead; - gDisplayListHead = temp_v1_25 + 8; - temp_v1_25->words.w1 = 0; - temp_v1_25->words.w0 = 0xC0000000; temp_v1_26 = gDisplayListHead; gDisplayListHead = temp_v1_26 + 8; - temp_v1_26->words.w1 = 0xFF33FFFF; - temp_v1_26->words.w0 = 0xFC121824; + temp_v1_26->words.w0 = 0xB900031D; + temp_v1_26->words.w1 = 0x004045D8; temp_v1_27 = gDisplayListHead; gDisplayListHead = temp_v1_27 + 8; - temp_v1_27->words.w1 = 0x00002000; - temp_v1_27->words.w0 = 0xB6000000; - load_surface_map(&D_06019578, arg0, &gDisplayListHead); + temp_v1_27->words.w1 = 0; + temp_v1_27->words.w0 = 0xC0000000; temp_v1_28 = gDisplayListHead; gDisplayListHead = temp_v1_28 + 8; - temp_v1_28->words.w1 = -1U; - temp_v1_28->words.w0 = 0xBB000900; + temp_v1_28->words.w1 = 0xFF33FFFF; + temp_v1_28->words.w0 = 0xFC121824; temp_v1_29 = gDisplayListHead; gDisplayListHead = temp_v1_29 + 8; temp_v1_29->words.w1 = 0x00002000; - temp_v1_29->words.w0 = 0xB7000000; + temp_v1_29->words.w0 = 0xB6000000; + load_surface_map((s32) &D_06019578, arg0); temp_v1_30 = gDisplayListHead; gDisplayListHead = temp_v1_30 + 8; - temp_v1_30->words.w1 = 0; - temp_v1_30->words.w0 = 0xB9000002; + temp_v1_30->words.w1 = -1U; + temp_v1_30->words.w0 = 0xBB000900; temp_v1_31 = gDisplayListHead; gDisplayListHead = temp_v1_31 + 8; - temp_v1_31->words.w1 = 0; - temp_v1_31->words.w0 = 0xE7000000; - return; - case 12: /* switch 1 */ + temp_v1_31->words.w1 = 0x00002000; + temp_v1_31->words.w0 = 0xB7000000; temp_v1_32 = gDisplayListHead; gDisplayListHead = temp_v1_32 + 8; temp_v1_32->words.w1 = 0; - temp_v1_32->words.w0 = 0xE7000000; + temp_v1_32->words.w0 = 0xB9000002; temp_v1_33 = gDisplayListHead; gDisplayListHead = temp_v1_33 + 8; - temp_v1_33->words.w1 = 0x00020000; - temp_v1_33->words.w0 = 0xB6000000; + temp_v1_33->words.w1 = 0; + temp_v1_33->words.w0 = 0xE7000000; + return; + case 12: /* switch 1 */ temp_v1_34 = gDisplayListHead; gDisplayListHead = temp_v1_34 + 8; - temp_v1_34->words.w1 = -1U; - temp_v1_34->words.w0 = 0xBB000001; + temp_v1_34->words.w1 = 0; + temp_v1_34->words.w0 = 0xE7000000; temp_v1_35 = gDisplayListHead; gDisplayListHead = temp_v1_35 + 8; - temp_v1_35->words.w1 = 0; - temp_v1_35->words.w0 = 0xC0000000; + temp_v1_35->words.w1 = 0x00020000; + temp_v1_35->words.w0 = 0xB6000000; temp_v1_36 = gDisplayListHead; gDisplayListHead = temp_v1_36 + 8; - temp_v1_36->words.w1 = 0xFF33FFFF; - temp_v1_36->words.w0 = 0xFC121824; + temp_v1_36->words.w1 = -1U; + temp_v1_36->words.w0 = 0xBB000001; temp_v1_37 = gDisplayListHead; gDisplayListHead = temp_v1_37 + 8; - temp_v1_37->words.w1 = 0x00002000; - temp_v1_37->words.w0 = 0xBA000C02; + temp_v1_37->words.w1 = 0; + temp_v1_37->words.w0 = 0xC0000000; temp_v1_38 = gDisplayListHead; gDisplayListHead = temp_v1_38 + 8; - temp_v1_38->words.w1 = 0x00080000; - temp_v1_38->words.w0 = 0xBA001301; - mtxf_identity((f32 (*)[4]) &sp228[0]); - func_802B4FF8((f32 (*)[4]) &sp228[0], 0); - load_surface_map(&D_090001D0, arg0); + temp_v1_38->words.w1 = 0xFF33FFFF; + temp_v1_38->words.w0 = 0xFC121824; temp_v1_39 = gDisplayListHead; gDisplayListHead = temp_v1_39 + 8; - temp_v1_39->words.w1 = 0; - temp_v1_39->words.w0 = 0xB9000002; - if ((func_80290C20(arg0->camera) == 1) && (func_802AAB4C(sp268) < sp268->pos[1])) { - temp_v1_40 = gDisplayListHead; - gDisplayListHead = temp_v1_40 + 8; - temp_v1_40->words.w1 = 1; - temp_v1_40->words.w0 = 0xB7000000; - temp_v1_41 = gDisplayListHead; - gDisplayListHead = temp_v1_41 + 8; - temp_v1_41->words.w1 = 0xFFFE793C; - temp_v1_41->words.w0 = 0xFCFFFFFF; - temp_v1_42 = gDisplayListHead; - gDisplayListHead = temp_v1_42 + 8; - temp_v1_42->words.w1 = 0x00552078; - temp_v1_42->words.w0 = 0xB900031D; - temp_v1_43 = gDisplayListHead; - gDisplayListHead = temp_v1_43 + 8; - temp_v1_43->words.w1 = 0x07002B48; - temp_v1_43->words.w0 = 0x06000000; - } - temp_v1_44 = gDisplayListHead; - gDisplayListHead = temp_v1_44 + 8; - temp_v1_44->words.w1 = 0; - temp_v1_44->words.w0 = 0xE7000000; - return; - case 13: /* switch 1 */ - temp_v1_45 = gDisplayListHead; - gDisplayListHead = temp_v1_45 + 8; - temp_v1_45->words.w1 = 0; - temp_v1_45->words.w0 = 0xE7000000; + temp_v1_39->words.w1 = 0x00002000; + temp_v1_39->words.w0 = 0xBA000C02; + temp_v1_40 = gDisplayListHead; + gDisplayListHead = temp_v1_40 + 8; + temp_v1_40->words.w1 = 0x00080000; + temp_v1_40->words.w0 = 0xBA001301; mtxf_identity((f32 (*)[4]) &sp228[0]); func_802B4FF8((f32 (*)[4]) &sp228[0], 0); + load_surface_map((s32) &D_090001D0, arg0); + temp_v1_41 = gDisplayListHead; + gDisplayListHead = temp_v1_41 + 8; + temp_v1_41->words.w1 = 0; + temp_v1_41->words.w0 = 0xB9000002; + if ((func_80290C20(arg0->camera) == 1) && (func_802AAB4C(sp268) < sp268->pos[1])) { + temp_v1_42 = gDisplayListHead; + gDisplayListHead = temp_v1_42 + 8; + temp_v1_42->words.w1 = 1; + temp_v1_42->words.w0 = 0xB7000000; + temp_v1_43 = gDisplayListHead; + gDisplayListHead = temp_v1_43 + 8; + temp_v1_43->words.w1 = 0xFFFE793C; + temp_v1_43->words.w0 = 0xFCFFFFFF; + temp_v1_44 = gDisplayListHead; + gDisplayListHead = temp_v1_44 + 8; + temp_v1_44->words.w1 = 0x00552078; + temp_v1_44->words.w0 = 0xB900031D; + temp_v1_45 = gDisplayListHead; + gDisplayListHead = temp_v1_45 + 8; + temp_v1_45->words.w1 = 0x07002B48; + temp_v1_45->words.w0 = 0x06000000; + } temp_v1_46 = gDisplayListHead; gDisplayListHead = temp_v1_46 + 8; - temp_v1_46->words.w1 = 0x00002000; - temp_v1_46->words.w0 = 0xB6000000; - load_surface_map(&D_060164B8, arg0, &gDisplayListHead); + temp_v1_46->words.w1 = 0; + temp_v1_46->words.w0 = 0xE7000000; + return; + case 13: /* switch 1 */ temp_v1_47 = gDisplayListHead; gDisplayListHead = temp_v1_47 + 8; - temp_v1_47->words.w1 = 0x00002000; - temp_v1_47->words.w0 = 0xB7000000; + temp_v1_47->words.w1 = 0; + temp_v1_47->words.w0 = 0xE7000000; + mtxf_identity((f32 (*)[4]) &sp228[0]); + func_802B4FF8((f32 (*)[4]) &sp228[0], 0); temp_v1_48 = gDisplayListHead; gDisplayListHead = temp_v1_48 + 8; - temp_v1_48->words.w1 = 0; - temp_v1_48->words.w0 = 0xB9000002; + temp_v1_48->words.w1 = 0x00002000; + temp_v1_48->words.w0 = 0xB6000000; + load_surface_map((s32) &D_060164B8, arg0); temp_v1_49 = gDisplayListHead; gDisplayListHead = temp_v1_49 + 8; - temp_v1_49->words.w1 = 0; - temp_v1_49->words.w0 = 0xE7000000; - return; - case 14: /* switch 1 */ + temp_v1_49->words.w1 = 0x00002000; + temp_v1_49->words.w0 = 0xB7000000; temp_v1_50 = gDisplayListHead; gDisplayListHead = temp_v1_50 + 8; temp_v1_50->words.w1 = 0; - temp_v1_50->words.w0 = 0xE7000000; + temp_v1_50->words.w0 = 0xB9000002; temp_v1_51 = gDisplayListHead; gDisplayListHead = temp_v1_51 + 8; - temp_v1_51->words.w1 = -1U; - temp_v1_51->words.w0 = 0xBB000001; + temp_v1_51->words.w1 = 0; + temp_v1_51->words.w0 = 0xE7000000; + return; + case 14: /* switch 1 */ temp_v1_52 = gDisplayListHead; gDisplayListHead = temp_v1_52 + 8; - temp_v1_52->words.w1 = 0x00020000; - temp_v1_52->words.w0 = 0xB6000000; + temp_v1_52->words.w1 = 0; + temp_v1_52->words.w0 = 0xE7000000; temp_v1_53 = gDisplayListHead; gDisplayListHead = temp_v1_53 + 8; - temp_v1_53->words.w1 = 0x004045D8; - temp_v1_53->words.w0 = 0xB900031D; + temp_v1_53->words.w1 = -1U; + temp_v1_53->words.w0 = 0xBB000001; temp_v1_54 = gDisplayListHead; gDisplayListHead = temp_v1_54 + 8; - temp_v1_54->words.w1 = 0; - temp_v1_54->words.w0 = 0xC0000000; + temp_v1_54->words.w1 = 0x00020000; + temp_v1_54->words.w0 = 0xB6000000; temp_v1_55 = gDisplayListHead; gDisplayListHead = temp_v1_55 + 8; - temp_v1_55->words.w1 = 0xFF33FFFF; - temp_v1_55->words.w0 = 0xFC121824; + temp_v1_55->words.w1 = 0x004045D8; + temp_v1_55->words.w0 = 0xB900031D; temp_v1_56 = gDisplayListHead; gDisplayListHead = temp_v1_56 + 8; - temp_v1_56->words.w1 = 0x00002000; - temp_v1_56->words.w0 = 0xBA000C02; + temp_v1_56->words.w1 = 0; + temp_v1_56->words.w0 = 0xC0000000; temp_v1_57 = gDisplayListHead; gDisplayListHead = temp_v1_57 + 8; - temp_v1_57->words.w1 = 0x00080000; - temp_v1_57->words.w0 = 0xBA001301; - mtxf_identity((f32 (*)[4]) &sp228[0]); - func_802B4FF8((f32 (*)[4]) &sp228[0], 0); + temp_v1_57->words.w1 = 0xFF33FFFF; + temp_v1_57->words.w0 = 0xFC121824; temp_v1_58 = gDisplayListHead; gDisplayListHead = temp_v1_58 + 8; temp_v1_58->words.w1 = 0x00002000; - temp_v1_58->words.w0 = 0xB6000000; + temp_v1_58->words.w0 = 0xBA000C02; temp_v1_59 = gDisplayListHead; gDisplayListHead = temp_v1_59 + 8; - temp_v1_59->words.w1 = -0x00000C07U; - temp_v1_59->words.w0 = 0xFC127E24; + temp_v1_59->words.w1 = 0x00080000; + temp_v1_59->words.w0 = 0xBA001301; + mtxf_identity((f32 (*)[4]) &sp228[0]); + func_802B4FF8((f32 (*)[4]) &sp228[0], 0); temp_v1_60 = gDisplayListHead; gDisplayListHead = temp_v1_60 + 8; - temp_v1_60->words.w1 = 0x005049D8; - temp_v1_60->words.w0 = 0xB900031D; + temp_v1_60->words.w1 = 0x00002000; + temp_v1_60->words.w0 = 0xB6000000; temp_v1_61 = gDisplayListHead; gDisplayListHead = temp_v1_61 + 8; - temp_v1_61->words.w0 = 0xFA000000; - temp_v1_61->words.w1 = 0xFFFF00FF; + temp_v1_61->words.w1 = -0x00000C07U; + temp_v1_61->words.w0 = 0xFC127E24; temp_v1_62 = gDisplayListHead; gDisplayListHead = temp_v1_62 + 8; - temp_v1_62->words.w1 = 0x07000EC0; - temp_v1_62->words.w0 = 0x06000000; + temp_v1_62->words.w1 = 0x005049D8; + temp_v1_62->words.w0 = 0xB900031D; temp_v1_63 = gDisplayListHead; gDisplayListHead = temp_v1_63 + 8; - temp_v1_63->words.w1 = -1U; - temp_v1_63->words.w0 = 0xBB000900; + temp_v1_63->words.w0 = 0xFA000000; + temp_v1_63->words.w1 = 0xFFFF00FF; temp_v1_64 = gDisplayListHead; gDisplayListHead = temp_v1_64 + 8; - temp_v1_64->words.w1 = 0x00002000; - temp_v1_64->words.w0 = 0xB7000000; + temp_v1_64->words.w1 = 0x07000EC0; + temp_v1_64->words.w0 = 0x06000000; temp_v1_65 = gDisplayListHead; gDisplayListHead = temp_v1_65 + 8; - temp_v1_65->words.w1 = 0; - temp_v1_65->words.w0 = 0xB9000002; + temp_v1_65->words.w1 = -1U; + temp_v1_65->words.w0 = 0xBB000900; temp_v1_66 = gDisplayListHead; gDisplayListHead = temp_v1_66 + 8; - temp_v1_66->words.w1 = 0; - temp_v1_66->words.w0 = 0xE7000000; - return; - case 18: /* switch 1 */ + temp_v1_66->words.w1 = 0x00002000; + temp_v1_66->words.w0 = 0xB7000000; temp_v1_67 = gDisplayListHead; gDisplayListHead = temp_v1_67 + 8; temp_v1_67->words.w1 = 0; - temp_v1_67->words.w0 = 0xE7000000; + temp_v1_67->words.w0 = 0xB9000002; temp_v1_68 = gDisplayListHead; gDisplayListHead = temp_v1_68 + 8; - temp_v1_68->words.w1 = 0x00020000; - temp_v1_68->words.w0 = 0xB6000000; + temp_v1_68->words.w1 = 0; + temp_v1_68->words.w0 = 0xE7000000; + return; + case 18: /* switch 1 */ temp_v1_69 = gDisplayListHead; gDisplayListHead = temp_v1_69 + 8; - temp_v1_69->words.w1 = -1U; - temp_v1_69->words.w0 = 0xBB000001; + temp_v1_69->words.w1 = 0; + temp_v1_69->words.w0 = 0xE7000000; temp_v1_70 = gDisplayListHead; gDisplayListHead = temp_v1_70 + 8; - temp_v1_70->words.w1 = 0; - temp_v1_70->words.w0 = 0xC0000000; + temp_v1_70->words.w1 = 0x00020000; + temp_v1_70->words.w0 = 0xB6000000; temp_v1_71 = gDisplayListHead; gDisplayListHead = temp_v1_71 + 8; - temp_v1_71->words.w1 = 0x00002000; - temp_v1_71->words.w0 = 0xBA000C02; + temp_v1_71->words.w1 = -1U; + temp_v1_71->words.w0 = 0xBB000001; temp_v1_72 = gDisplayListHead; gDisplayListHead = temp_v1_72 + 8; - temp_v1_72->words.w1 = 0x00080000; - temp_v1_72->words.w0 = 0xBA001301; + temp_v1_72->words.w1 = 0; + temp_v1_72->words.w0 = 0xC0000000; + temp_v1_73 = gDisplayListHead; + gDisplayListHead = temp_v1_73 + 8; + temp_v1_73->words.w1 = 0x00002000; + temp_v1_73->words.w0 = 0xBA000C02; + temp_v1_74 = gDisplayListHead; + gDisplayListHead = temp_v1_74 + 8; + temp_v1_74->words.w1 = 0x00080000; + temp_v1_74->words.w0 = 0xBA001301; sp216 = sp216; mtxf_identity((f32 (*)[4]) &sp228[0]); func_802B4FF8((f32 (*)[4]) &sp228[0], 0); - temp_v1_73 = gDisplayListHead; - gDisplayListHead = temp_v1_73 + 8; - temp_v1_73->words.w1 = 0xFF33FFFF; - temp_v1_73->words.w0 = 0xFC121824; - temp_v1_74 = gDisplayListHead; - gDisplayListHead = temp_v1_74 + 8; - temp_v1_74->words.w1 = 0x004045D8; - temp_v1_74->words.w0 = 0xB900031D; + temp_v1_75 = gDisplayListHead; + gDisplayListHead = temp_v1_75 + 8; + temp_v1_75->words.w1 = 0xFF33FFFF; + temp_v1_75->words.w0 = 0xFC121824; + temp_v1_76 = gDisplayListHead; + gDisplayListHead = temp_v1_76 + 8; + temp_v1_76->words.w1 = 0x004045D8; + temp_v1_76->words.w0 = 0xB900031D; if ((s32) (u16) sp21A < 0x11) { - temp_v1_75 = gDisplayListHead; - gDisplayListHead = temp_v1_75 + 8; - temp_v1_75->words.w1 = 0xFF33FFFF; - temp_v1_75->words.w0 = 0xFC121824; - temp_v1_76 = gDisplayListHead; - gDisplayListHead = temp_v1_76 + 8; - temp_v1_76->words.w1 = 0x07003E40; - temp_v1_76->words.w0 = 0x06000000; temp_v1_77 = gDisplayListHead; gDisplayListHead = temp_v1_77 + 8; - temp_v1_77->words.w1 = 0x07003EB0; - temp_v1_77->words.w0 = 0x06000000; + temp_v1_77->words.w1 = 0xFF33FFFF; + temp_v1_77->words.w0 = 0xFC121824; + temp_v1_78 = gDisplayListHead; + gDisplayListHead = temp_v1_78 + 8; + temp_v1_78->words.w1 = 0x07003E40; + temp_v1_78->words.w0 = 0x06000000; + temp_v1_79 = gDisplayListHead; + gDisplayListHead = temp_v1_79 + 8; + temp_v1_79->words.w1 = 0x07003EB0; + temp_v1_79->words.w0 = 0x06000000; if (((s32) (u16) sp21A >= 6) && ((s32) (u16) sp21A < 0xD)) { - temp_v1_78 = gDisplayListHead; - gDisplayListHead = temp_v1_78 + 8; - temp_v1_78->words.w1 = 0xFF33FFFF; - temp_v1_78->words.w0 = 0xFC121824; - temp_v1_79 = gDisplayListHead; - gDisplayListHead = temp_v1_79 + 8; - temp_v1_79->words.w1 = 0x07003DD0; - temp_v1_79->words.w0 = 0x06000000; + temp_v1_80 = gDisplayListHead; + gDisplayListHead = temp_v1_80 + 8; + temp_v1_80->words.w1 = 0xFF33FFFF; + temp_v1_80->words.w0 = 0xFC121824; + temp_v1_81 = gDisplayListHead; + gDisplayListHead = temp_v1_81 + 8; + temp_v1_81->words.w1 = 0x07003DD0; + temp_v1_81->words.w0 = 0x06000000; } } else { if (((u16) sp21A == 0x0015) || ((u16) sp21A == 0x0016)) { if (sp216 == 3) { - temp_v1_80 = gDisplayListHead; - gDisplayListHead = temp_v1_80 + 8; - temp_v1_80->words.w1 = -0x00000C07U; - temp_v1_80->words.w0 = 0xFC127E24; - temp_v1_81 = gDisplayListHead; - gDisplayListHead = temp_v1_81 + 8; - temp_v1_81->words.w1 = 0x070036A8; - temp_v1_81->words.w0 = 0x06000000; - } - if ((sp216 == 1) || (sp216 == 0)) { temp_v1_82 = gDisplayListHead; gDisplayListHead = temp_v1_82 + 8; temp_v1_82->words.w1 = -0x00000C07U; temp_v1_82->words.w0 = 0xFC127E24; - var_v1_2 = gDisplayListHead; - gDisplayListHead = var_v1_2 + 8; - var_v1_2->words.w1 = 0x070036A8; - } else { temp_v1_83 = gDisplayListHead; gDisplayListHead = temp_v1_83 + 8; - temp_v1_83->words.w1 = 0xFF33FFFF; - temp_v1_83->words.w0 = 0xFC121824; + temp_v1_83->words.w1 = 0x070036A8; + temp_v1_83->words.w0 = 0x06000000; + } + if ((sp216 == 1) || (sp216 == 0)) { temp_v1_84 = gDisplayListHead; gDisplayListHead = temp_v1_84 + 8; - temp_v1_84->words.w1 = 0x07003F30; - temp_v1_84->words.w0 = 0x06000000; - var_v1_2 = gDisplayListHead; - gDisplayListHead = var_v1_2 + 8; - var_v1_2->words.w1 = 0x070036A8; + temp_v1_84->words.w1 = -0x00000C07U; + temp_v1_84->words.w0 = 0xFC127E24; + temp_v1_85 = gDisplayListHead; + gDisplayListHead = temp_v1_85 + 8; + temp_v1_85->words.w1 = 0x070036A8; + } else { + temp_v1_86 = gDisplayListHead; + gDisplayListHead = temp_v1_86 + 8; + temp_v1_86->words.w1 = 0xFF33FFFF; + temp_v1_86->words.w0 = 0xFC121824; + temp_v1_87 = gDisplayListHead; + gDisplayListHead = temp_v1_87 + 8; + temp_v1_87->words.w1 = 0x07003F30; + temp_v1_87->words.w0 = 0x06000000; + temp_v1_88 = gDisplayListHead; + gDisplayListHead = temp_v1_88 + 8; + temp_v1_88->words.w1 = 0x070036A8; } goto block_53; } if ((u16) sp21A == 0x0018) { if ((sp216 == 0) || (sp216 == 3)) { - temp_v1_85 = gDisplayListHead; - gDisplayListHead = temp_v1_85 + 8; - temp_v1_85->words.w1 = -0x00000C07U; - temp_v1_85->words.w0 = 0xFC127E24; - temp_v1_86 = gDisplayListHead; - gDisplayListHead = temp_v1_86 + 8; - temp_v1_86->words.w0 = 0x06000000; - temp_v1_86->words.w1 = 0x070036A8; + temp_v1_89 = gDisplayListHead; + gDisplayListHead = temp_v1_89 + 8; + temp_v1_89->words.w1 = -0x00000C07U; + temp_v1_89->words.w0 = 0xFC127E24; + temp_v1_90 = gDisplayListHead; + gDisplayListHead = temp_v1_90 + 8; + temp_v1_90->words.w0 = 0x06000000; + temp_v1_90->words.w1 = 0x070036A8; } } else if ((u16) sp21A == 0x0017) { if (sp216 == 3) { - temp_v1_87 = gDisplayListHead; - gDisplayListHead = temp_v1_87 + 8; - temp_v1_87->words.w1 = -0x00000C07U; - temp_v1_87->words.w0 = 0xFC127E24; - var_v1_2 = gDisplayListHead; - gDisplayListHead = var_v1_2 + 8; - var_v1_2->words.w1 = 0x070036A8; + temp_v1_91 = gDisplayListHead; + gDisplayListHead = temp_v1_91 + 8; + temp_v1_91->words.w1 = -0x00000C07U; + temp_v1_91->words.w0 = 0xFC127E24; + temp_v1_92 = gDisplayListHead; + gDisplayListHead = temp_v1_92 + 8; + temp_v1_92->words.w1 = 0x070036A8; goto block_53; } if (sp216 == 0) { - temp_v1_88 = gDisplayListHead; - gDisplayListHead = temp_v1_88 + 8; - temp_v1_88->words.w1 = -0x00000C07U; - temp_v1_88->words.w0 = 0xFC127E24; - var_v1_2 = gDisplayListHead; - gDisplayListHead = var_v1_2 + 8; - var_v1_2->words.w1 = 0x070036A8; + temp_v1_93 = gDisplayListHead; + gDisplayListHead = temp_v1_93 + 8; + temp_v1_93->words.w1 = -0x00000C07U; + temp_v1_93->words.w0 = 0xFC127E24; + temp_v1_94 = gDisplayListHead; + gDisplayListHead = temp_v1_94 + 8; + temp_v1_94->words.w1 = 0x070036A8; block_53: - var_v1_2->words.w0 = 0x06000000; + gDisplayListHead->words.w0 = 0x06000000; } } } - temp_v1_89 = gDisplayListHead; - gDisplayListHead = temp_v1_89 + 8; - temp_v1_89->words.w1 = 0xFF33FFFF; - temp_v1_89->words.w0 = 0xFC121824; + temp_v1_95 = gDisplayListHead; + gDisplayListHead = temp_v1_95 + 8; + temp_v1_95->words.w1 = 0xFF33FFFF; + temp_v1_95->words.w0 = 0xFC121824; switch ((u16) sp21A) { /* switch 3 */ case 5: /* switch 3 */ if (sp216 != 3) { - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003DD0; + temp_v1_96 = gDisplayListHead; + gDisplayListHead = temp_v1_96 + 8; + temp_v1_96->words.w1 = 0x07003DD0; block_82: - var_v1_3->words.w0 = 0x06000000; + gDisplayListHead->words.w0 = 0x06000000; } break; case 17: /* switch 3 */ switch (sp216) { /* switch 5; irregular */ case 0: /* switch 5 */ - temp_v1_90 = gDisplayListHead; - gDisplayListHead = temp_v1_90 + 8; - temp_v1_90->words.w1 = 0x07003E40; - temp_v1_90->words.w0 = 0x06000000; - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003EB0; - goto block_82; - case 1: /* switch 5 */ - temp_v1_91 = gDisplayListHead; - gDisplayListHead = temp_v1_91 + 8; - temp_v1_91->words.w1 = 0x07003DD0; - temp_v1_91->words.w0 = 0x06000000; - temp_v1_92 = gDisplayListHead; - gDisplayListHead = temp_v1_92 + 8; - temp_v1_92->words.w1 = 0x07003E40; - temp_v1_92->words.w0 = 0x06000000; - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003EB0; - goto block_82; - case 2: /* switch 5 */ - temp_v1_93 = gDisplayListHead; - gDisplayListHead = temp_v1_93 + 8; - temp_v1_93->words.w1 = 0x07003E40; - temp_v1_93->words.w0 = 0x06000000; - temp_v1_94 = gDisplayListHead; - gDisplayListHead = temp_v1_94 + 8; - temp_v1_94->words.w1 = 0x07003EB0; - temp_v1_94->words.w0 = 0x06000000; - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003F30; - goto block_82; - case 3: /* switch 5 */ - temp_v1_95 = gDisplayListHead; - gDisplayListHead = temp_v1_95 + 8; - temp_v1_95->words.w1 = 0x07003EB0; - temp_v1_95->words.w0 = 0x06000000; - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003F30; - goto block_82; - } - break; - case 18: /* switch 3 */ - switch (sp216) { /* switch 6; irregular */ - case 0: /* switch 6 */ - temp_v1_96 = gDisplayListHead; - gDisplayListHead = temp_v1_96 + 8; - temp_v1_96->words.w1 = 0x07003E40; - temp_v1_96->words.w0 = 0x06000000; - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003EB0; - goto block_82; - case 1: /* switch 6 */ temp_v1_97 = gDisplayListHead; gDisplayListHead = temp_v1_97 + 8; - temp_v1_97->words.w1 = 0x07003DD0; + temp_v1_97->words.w1 = 0x07003E40; temp_v1_97->words.w0 = 0x06000000; temp_v1_98 = gDisplayListHead; gDisplayListHead = temp_v1_98 + 8; - temp_v1_98->words.w1 = 0x07003E40; - temp_v1_98->words.w0 = 0x06000000; - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003EB0; + temp_v1_98->words.w1 = 0x07003EB0; goto block_82; - case 2: /* switch 6 */ + case 1: /* switch 5 */ temp_v1_99 = gDisplayListHead; gDisplayListHead = temp_v1_99 + 8; - temp_v1_99->words.w1 = 0x07003E40; + temp_v1_99->words.w1 = 0x07003DD0; temp_v1_99->words.w0 = 0x06000000; - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003EB0; - goto block_82; - } - break; - case 21: /* switch 3 */ - if ((sp216 == 0) || (sp216 == 1)) { temp_v1_100 = gDisplayListHead; gDisplayListHead = temp_v1_100 + 8; temp_v1_100->words.w1 = 0x07003E40; @@ -902,45 +845,114 @@ block_82: temp_v1_101 = gDisplayListHead; gDisplayListHead = temp_v1_101 + 8; temp_v1_101->words.w1 = 0x07003EB0; - temp_v1_101->words.w0 = 0x06000000; - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003F30; + goto block_82; + case 2: /* switch 5 */ + temp_v1_102 = gDisplayListHead; + gDisplayListHead = temp_v1_102 + 8; + temp_v1_102->words.w1 = 0x07003E40; + temp_v1_102->words.w0 = 0x06000000; + temp_v1_103 = gDisplayListHead; + gDisplayListHead = temp_v1_103 + 8; + temp_v1_103->words.w1 = 0x07003EB0; + temp_v1_103->words.w0 = 0x06000000; + temp_v1_104 = gDisplayListHead; + gDisplayListHead = temp_v1_104 + 8; + temp_v1_104->words.w1 = 0x07003F30; + goto block_82; + case 3: /* switch 5 */ + temp_v1_105 = gDisplayListHead; + gDisplayListHead = temp_v1_105 + 8; + temp_v1_105->words.w1 = 0x07003EB0; + temp_v1_105->words.w0 = 0x06000000; + temp_v1_106 = gDisplayListHead; + gDisplayListHead = temp_v1_106 + 8; + temp_v1_106->words.w1 = 0x07003F30; + goto block_82; + } + break; + case 18: /* switch 3 */ + switch (sp216) { /* switch 6; irregular */ + case 0: /* switch 6 */ + temp_v1_107 = gDisplayListHead; + gDisplayListHead = temp_v1_107 + 8; + temp_v1_107->words.w1 = 0x07003E40; + temp_v1_107->words.w0 = 0x06000000; + temp_v1_108 = gDisplayListHead; + gDisplayListHead = temp_v1_108 + 8; + temp_v1_108->words.w1 = 0x07003EB0; + goto block_82; + case 1: /* switch 6 */ + temp_v1_109 = gDisplayListHead; + gDisplayListHead = temp_v1_109 + 8; + temp_v1_109->words.w1 = 0x07003DD0; + temp_v1_109->words.w0 = 0x06000000; + temp_v1_110 = gDisplayListHead; + gDisplayListHead = temp_v1_110 + 8; + temp_v1_110->words.w1 = 0x07003E40; + temp_v1_110->words.w0 = 0x06000000; + temp_v1_111 = gDisplayListHead; + gDisplayListHead = temp_v1_111 + 8; + temp_v1_111->words.w1 = 0x07003EB0; + goto block_82; + case 2: /* switch 6 */ + temp_v1_112 = gDisplayListHead; + gDisplayListHead = temp_v1_112 + 8; + temp_v1_112->words.w1 = 0x07003E40; + temp_v1_112->words.w0 = 0x06000000; + temp_v1_113 = gDisplayListHead; + gDisplayListHead = temp_v1_113 + 8; + temp_v1_113->words.w1 = 0x07003EB0; + goto block_82; + } + break; + case 21: /* switch 3 */ + if ((sp216 == 0) || (sp216 == 1)) { + temp_v1_114 = gDisplayListHead; + gDisplayListHead = temp_v1_114 + 8; + temp_v1_114->words.w1 = 0x07003E40; + temp_v1_114->words.w0 = 0x06000000; + temp_v1_115 = gDisplayListHead; + gDisplayListHead = temp_v1_115 + 8; + temp_v1_115->words.w1 = 0x07003EB0; + temp_v1_115->words.w0 = 0x06000000; + temp_v1_116 = gDisplayListHead; + gDisplayListHead = temp_v1_116 + 8; + temp_v1_116->words.w1 = 0x07003F30; } else { - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003EB0; + temp_v1_117 = gDisplayListHead; + gDisplayListHead = temp_v1_117 + 8; + temp_v1_117->words.w1 = 0x07003EB0; } goto block_82; case 22: /* switch 3 */ if (sp216 == 0) { - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003F30; + temp_v1_118 = gDisplayListHead; + gDisplayListHead = temp_v1_118 + 8; + temp_v1_118->words.w1 = 0x07003F30; goto block_82; } break; case 23: /* switch 3 */ if (sp216 != 1) { - var_v1_3 = gDisplayListHead; - gDisplayListHead = var_v1_3 + 8; - var_v1_3->words.w1 = 0x07003F30; + temp_v1_119 = gDisplayListHead; + gDisplayListHead = temp_v1_119 + 8; + temp_v1_119->words.w1 = 0x07003F30; goto block_82; } break; } - temp_v1_102 = gDisplayListHead; - gDisplayListHead = temp_v1_102 + 8; - temp_v1_102->words.w1 = -1U; - temp_v1_102->words.w0 = 0xBB000900; - temp_v1_103 = gDisplayListHead; - gDisplayListHead = temp_v1_103 + 8; - temp_v1_103->words.w1 = 0; - temp_v1_103->words.w0 = 0xB9000002; - temp_v1_104 = gDisplayListHead; - gDisplayListHead = temp_v1_104 + 8; - temp_v1_104->words.w1 = 0; - temp_v1_104->words.w0 = 0xE7000000; + temp_v1_120 = gDisplayListHead; + gDisplayListHead = temp_v1_120 + 8; + temp_v1_120->words.w1 = -1U; + temp_v1_120->words.w0 = 0xBB000900; + temp_v1_121 = gDisplayListHead; + gDisplayListHead = temp_v1_121 + 8; + temp_v1_121->words.w1 = 0; + temp_v1_121->words.w0 = 0xB9000002; + temp_v1_122 = gDisplayListHead; + gDisplayListHead = temp_v1_122 + 8; + temp_v1_122->words.w1 = 0; + temp_v1_122->words.w0 = 0xE7000000; break; } } diff --git a/src/render_courses.h b/src/render_courses.h index 0e8291849..f1c1b9062 100644 --- a/src/render_courses.h +++ b/src/render_courses.h @@ -154,7 +154,7 @@ extern s32 gGamestate; extern s32 gModeSelection; extern u16 gNumActors; extern s32 D_8015F58C; -extern uintptr_t D_8015F580; +extern mk64_surface_map_ram *D_8015F580; extern s32 gCCSelection; #endif diff --git a/src/skybox_and_splitscreen.c b/src/skybox_and_splitscreen.c index 8a7104a4f..0778f45ea 100644 --- a/src/skybox_and_splitscreen.c +++ b/src/skybox_and_splitscreen.c @@ -441,64 +441,62 @@ void func_802A487C(Vtx *arg0, UNUSED s32 arg1, UNUSED s32 arg2, UNUSED s32 arg3, } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -//void init_rdp(); // extern -//void func_802A450C(); // extern -//void func_802B5564(? *, ? *, s32, s32, f32, f32, f32); // extern -//void func_802B5794(? *, void *, void *); // extern -//void func_802B6434(f32 *, ? *); // extern -//void func_802B71CC(? *, ? *, ? *); // extern - -extern s32 D_80150148; +//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b +? func_802B5794(f32 (*)[4], Camera *, f32 *); /* extern */ +extern ? D_0D008E98; +extern f32 D_80150148; extern f32 D_8015014C; extern f32 D_80150150; -extern f32 D_802B9BB0; -// gControllers -void func_802A4A0C(Vtx *arg0, struct UnkStruct_800DC5EC *arg1, s32 arg2, s32 arg3) { - Camera *sp13C = arg1->camera; - s32 sp128; - s32 spE8; - s32 spA8; - s32 sp68; +static f32 D_802B9BB0 = 30000.0f; +s16 gCurrentCourseId; /* unable to generate initializer */ +void func_802A4A0C(Vtx *arg0, struct UnkStruct_800DC5EC *arg1, s32 arg2, s32 arg3) { + Camera *sp13C; + u16 sp128; f32 sp64; f32 sp60; f32 sp5C; f32 sp58; + Gfx *temp_v0; + Gfx *temp_v0_2; + Gfx *temp_v0_3; + Gfx *temp_v0_4; + Gfx *temp_v0_5; + Gfx *temp_v0_6; + Gfx *temp_v0_7; + Gfx *temp_v0_8; + Gfx *temp_v0_9; f32 temp_f0; - f32 temp_f10; f32 temp_f16; f32 temp_f18; f32 temp_f6; s16 temp_t5; + sp13C = arg1->camera; func_802A450C(arg0); sp64 = D_802B9BB0; sp5C = 0.0f; sp60 = 0.0f; - - func_802B5564(&spE8, &sp128, sp13C->unk30, D_80150148, D_80150150, D_8015014C, 1.0f); - func_802B5794(&spA8, sp13C, sp13C->unk); - func_802B71CC(&sp68, &spE8, &spA8); - sp58 = spA4 + ((sp74 * sp5C) + (sp84 * sp60) + (sp94 * sp64)); - func_802B6434(&sp5C, &sp68); - temp_f0 = 1.0 / sp58; + func_802B5564((f32 (*)[4]) &spE8[0], &sp128, sp13C->unk_B4, D_80150148, D_80150150, D_8015014C, 1.0f); + func_802B5794((f32 (*)[4]) &spA8[0], sp13C, sp13C->lookAt); + func_802B71CC((f32 (*)[4]) &sp68[0], (f32 (*)[4]) &spE8[0], (f32 (*)[4]) &spA8[0]); + sp58 = spA4 + ((sp68[3] * sp5C) + (sp84 * sp60) + (sp94 * sp64)); + func_802B6434(&sp5C, (f32 (*)[4]) &sp68[0]); + temp_f0 = (f32) (1.0 / (f64) sp58); temp_f18 = sp5C * temp_f0; temp_f6 = sp60 * temp_f0; - temp_f10 = temp_f18 * 160.0f; sp5C = temp_f18; temp_f16 = temp_f6 * 120.0f; sp60 = temp_f6; - sp5C = temp_f10; + sp5C = temp_f18 * 160.0f; sp60 = temp_f16; - temp_t5 = 0x78 - temp_f16; - arg1->pathCounter = temp_t5; - arg0->v.ob[0] = temp_t5;//->unk12 = temp_t5; - arg0->v.ob[1] = temp_t5; // = temp_t5; //unk22 - arg0->v.ob[4] = temp_t5;//unk42 = temp_t5; - arg0->v.ob[7] = temp_t5;//unk72 = temp_t5; + temp_t5 = 0x78 - (s32) temp_f16; + arg1->cameraHeight = temp_t5; + arg0->unk12 = temp_t5; + arg0->unk22 = temp_t5; + arg0->unk42 = temp_t5; + arg0->unk72 = temp_t5; init_rdp(); - gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); gSPClearGeometryMode(gDisplayListHead++, G_ZBUFFER | G_LIGHTING); guOrtho(&gGfxPool->mtxPool[0], 0.0f, 320.0f, 0.0f, 240.0f, 0.0f, 5.0f, 1.0f); @@ -507,44 +505,9 @@ void func_802A4A0C(Vtx *arg0, struct UnkStruct_800DC5EC *arg1, s32 arg2, s32 arg gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_0D008E98), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPVertex(gDisplayListHead++, &arg0, 4, 0); gSP2Triangles(gDisplayListHead++, 0, 3, 1, 0, 1, 3, 2, 0); - -/* - temp_v0->unk0 = 0xB900031D; - temp_v0->unk4 = 0xF0A4000; - - temp_v0_2->unk0 = 0xB6000000; - temp_v0_2->unk4 = 0x20001; - - guOrtho(gGfxPool, 0.0f, 320.0f, 0.0f, 240.0f, 0.0f, 5.0f, 1.0f); - - temp_v0_3->unk4 = 0xFFFF; - temp_v0_3->unk0 = 0xB4000000; - - temp_v0_4->unk0 = 0x1030040; - temp_v0_4->unk4 = gGfxPool & 0x1FFFFFFF; - temp_v0_5 = gDisplayListHead; - gDisplayListHead = temp_v0_5 + 8; - temp_v0_5->unk4 = &D_0D008E98 & 0x1FFFFFFF; - temp_v0_5->unk0 = 0x1020040; - - temp_v0_6->unk4 = arg0; - temp_v0_6->unk0 = 0x400103F; - - temp_v0_7->unk0 = 0xB1000602; - temp_v0_7->unk4 = 0x20604; -*/ if (gCurrentCourseId == COURSE_RAINBOW_ROAD) { - gSPVertex(gDisplayListHead++, &arg0[4], 4, 0); gSP2Triangles(gDisplayListHead++, 0, 3, 1, 0, 0, 0, 0, 0); - -/* - temp_v0_8->unk4 = arg0 + 0x40; - temp_v0_8->unk0 = 0x400103F; - - temp_v0_9->unk4 = 0x20604; - temp_v0_9->unk0 = 0xB1000602; - */ } } #else diff --git a/src/spawn_players.c b/src/spawn_players.c index ad1475a3d..d06a477a0 100644 --- a/src/spawn_players.c +++ b/src/spawn_players.c @@ -6,7 +6,10 @@ #include "framebuffers.h" #include "kart_dma.h" #include "camera.h" +#include "math_util.h" #include "code_80027D00.h" +#include "code_80057C60.h" +#include "render_courses.h" #include "spawn_players.h" // arg4 is height? Or something like that? @@ -256,21 +259,21 @@ void spawn_player(Player *player, s8 playerIndex, f32 startingRow, f32 startingC player->unk_110.unk38 = 0; player->unk_110.unk3A = 0; - player->boundingBoxCorners[FRONT_LEFT_TYRE].cornerX = 0.0f; - player->boundingBoxCorners[FRONT_LEFT_TYRE].cornerY = 0.0f; - player->boundingBoxCorners[FRONT_LEFT_TYRE].cornerZ = 0.0f; + player->boundingBoxCorners[FRONT_LEFT_TYRE].cornerPos[0] = 0.0f; + player->boundingBoxCorners[FRONT_LEFT_TYRE].cornerPos[1] = 0.0f; + player->boundingBoxCorners[FRONT_LEFT_TYRE].cornerPos[2] = 0.0f; - player->boundingBoxCorners[FRONT_RIGHT_TYRE].cornerX = 0.0f; - player->boundingBoxCorners[FRONT_RIGHT_TYRE].cornerY = 0.0f; - player->boundingBoxCorners[FRONT_RIGHT_TYRE].cornerZ = 0.0f; + player->boundingBoxCorners[FRONT_RIGHT_TYRE].cornerPos[0] = 0.0f; + player->boundingBoxCorners[FRONT_RIGHT_TYRE].cornerPos[1] = 0.0f; + player->boundingBoxCorners[FRONT_RIGHT_TYRE].cornerPos[2] = 0.0f; - player->boundingBoxCorners[BACK_LEFT_TYRE].cornerX = 0.0f; - player->boundingBoxCorners[BACK_LEFT_TYRE].cornerY = 0.0f; - player->boundingBoxCorners[BACK_LEFT_TYRE].cornerZ = 0.0f; + player->boundingBoxCorners[BACK_LEFT_TYRE].cornerPos[0] = 0.0f; + player->boundingBoxCorners[BACK_LEFT_TYRE].cornerPos[1] = 0.0f; + player->boundingBoxCorners[BACK_LEFT_TYRE].cornerPos[2] = 0.0f; - player->boundingBoxCorners[BACK_RIGHT_TYRE].cornerX = 0.0f; - player->boundingBoxCorners[BACK_RIGHT_TYRE].cornerY = 0.0f; - player->boundingBoxCorners[BACK_RIGHT_TYRE].cornerZ = 0.0f; + player->boundingBoxCorners[BACK_RIGHT_TYRE].cornerPos[0] = 0.0f; + player->boundingBoxCorners[BACK_RIGHT_TYRE].cornerPos[1] = 0.0f; + player->boundingBoxCorners[BACK_RIGHT_TYRE].cornerPos[2] = 0.0f; player->boundingBoxCorners[ FRONT_LEFT_TYRE].cornerGroundY = 0.0f; player->boundingBoxCorners[FRONT_RIGHT_TYRE].cornerGroundY = 0.0f; diff --git a/src/staff_ghosts.c b/src/staff_ghosts.c index ca47b4523..3e46e9611 100644 --- a/src/staff_ghosts.c +++ b/src/staff_ghosts.c @@ -4,17 +4,17 @@ #include #include #include "framebuffers.h" +#include "code_800B45E0.h" +#include "staff_ghosts.h" extern s32 mio0encode(s32 input, s32, s32); extern s32 func_80040174(void *, s32, s32); -extern s32 func_800B4E24(s32 arg0); -extern void func_80005AE8(Player *ply); -u32 *D_80162D80; +u8 *D_80162D80; s16 D_80162D84; -s16 D_80162D86; - +u16 D_80162D86; u16 D_80162D88; + u32 D_80162D8C; s16 D_80162D90; u32 *D_80162D94; @@ -479,130 +479,82 @@ void func_80005AE8(Player *ply) { } } -#ifdef NON_MATCHING +#ifdef MIPS_TO_C +//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b +extern s32 D_80162DC8; +extern s32 D_80162DCC; +extern s32 D_80162DD0; +extern s32 D_80162DDC; +extern s32 D_80162DEC; +extern s32 D_80162DF8; +extern s32 D_80162DFC; +extern s32 D_80162E00; +extern s32 D_8018CA78; + void func_80005B18(void) { - s16 *temp_v0_2; - s16 *temp_v0_3; - s32 temp_v0; - u16 *phi_a3; - - if (gModeSelection == TIME_TRIALS) { - temp_v0 = gLapCountByPlayerId[0]; - //phi_a3 = &D_80162DD4; - if ((gLapCountByPlayerId[0] == 3) && (D_80162DDC == 0) && D_80162DF8 != 1) { - //if (D_80162DF8 != 1) { - + if (gModeSelection == 1) { + if ((gLapCountByPlayerId[0] == 3) && (D_80162DDC == 0) && (D_80162DF8 != 1)) { if (D_80162DD4 == 1) { D_80162DD0 = D_80162DCC; - func_800052A4(); //gModeSelection, &D_80162DDC, 3, &D_80162DD4); + func_800052A4(); D_80162DD4 = 0; D_80162DDC = 1; D_80162DE0 = gPlayerOne->characterId; D_80162DE8 = gPlayerOne->characterId; D_80162E00 = 0; D_80162DFC = D_8018CA78; - func_80005AE8(gPlayerTwo); // (u16) &D_80162DDC); + func_80005AE8(gPlayerTwo); + func_80005AE8(gPlayerThree); + } else if (gLapCountByPlayerId[1] != 3) { + D_80162DD0 = D_80162DCC; + func_800052A4(); + D_80162DDC = 1; + D_80162DE0 = gPlayerOne->characterId; + D_80162DFC = D_8018CA78; + D_80162E00 = 0; + D_80162DE8 = gPlayerOne->characterId; + func_80005AE8(gPlayerTwo); func_80005AE8(gPlayerThree); - } else { - if (gLapCountByPlayerId[4] != 3) { - D_80162DD0 = D_80162DCC; - func_800052A4(); // gModeSelection, &D_80162DDC, 3, &D_80162DD4); - D_80162DDC = 1; - D_80162DE0 = gPlayerOne->characterId; - D_80162DFC = D_8018CA78; - D_80162E00 = 0; - D_80162DE8 = gPlayerOne->characterId; - func_80005AE8(gPlayerTwo); // (u16) &D_80162DDC); - func_80005AE8(gPlayerThree); - return; - + D_80162D80 = D_802BFB80[0][D_80162DC8][3].pixel_index_array; + D_80162D84 = D_80162D86; + D_80162DD0 = D_80162DCC; + D_80162DE8 = gPlayerOne->characterId; + D_80162DD8 = 0; + D_80162DD4 = 0; + D_80162DDC = 1; + func_80005AE8(gPlayerTwo); + func_80005AE8(gPlayerThree); + } + } else { + if ((gLapCountByPlayerId[0] == 3) && (D_80162DDC == 0) && (D_80162DF8 == 1)) { + D_80162D80 = D_802BFB80[0][D_80162DC8][3].pixel_index_array; + D_80162D84 = D_80162D86; + D_80162DDC = 1; + } + if ((gPlayerOne->unk_000 & 0x800) == 0x800) { + func_80005AE8(gPlayerTwo); + func_80005AE8(gPlayerThree); + } else { + D_80162DEC += 1; + if (D_80162DEC >= 0x65) { + D_80162DEC = 0x00000064; + } + if ((gModeSelection == 1) && (gActiveScreenMode == 0)) { + if ((D_80162DD4 == 0) && (gLapCountByPlayerId[1] != 3)) { + func_800057DC(); + } + if ((D_80162DD6 == 0) && (gLapCountByPlayerId[2] != 3)) { + func_8000561C(); + } + if (!(gPlayerOne->unk_000 & 0x800)) { + func_8000599C(); + } } } - D_80162D80 = (void *) &D_802BFB80[0][D_80162DC8][3]; - D_80162D84 = D_80162D86; - D_80162DD0 = D_80162DCC; - D_80162DE8 = gPlayerOne->characterId; - D_80162DD8 = 0; - D_80162DD4 = 0; - D_80162DDC = 1; - func_80005AE8(gPlayerTwo); // (u16) &D_80162DDC, 3, &D_80162DD4); - func_80005AE8(gPlayerThree); - - - return; } - if ((gLapCountByPlayerId[0] == 3) && (D_80162DDC == 0) && (D_80162DF8 == 1)) { - D_80162D80 = (void *) &D_802BFB80[0][D_80162DC8][3]; - D_80162D84 = D_80162D86; - D_80162DDC = 1; - } - if (( gPlayerOne->unk_000 & PLAYER_CINEMATIC_MODE) == PLAYER_CINEMATIC_MODE) { - func_80005AE8(gPlayerTwo); // (u16) &D_80162DDC, 3, phi_a3); - func_80005AE8(gPlayerThree); - return; - }; - D_80162DEC++; - if (D_80162DEC > 100) { - D_80162DEC = 100; - } - if ((gModeSelection == TIME_TRIALS) && (gActiveScreenMode == SCREEN_MODE_1P)) { - if ((D_80162DD4 == 0) && (gLapCountByPlayerId[4] != 3)) { - func_800057DC(); //gModeSelection, &D_80162DDC, 3, &D_80162DD4); - } - if ((D_80162DD6 == 0) && (3 != gLapCountByPlayerId[8])) { - func_8000561C(); - } - if (( gPlayerOne->unk_000 & PLAYER_CINEMATIC_MODE) == 0) { - func_8000599C(); - } - } - D_80162D80 = &D_802BFB80[(D_80162DC8 << 0xF) + 0x3000]; - D_80162D84 = D_80162D86; - D_80162DD0 = D_80162DCC; - D_80162DE8 = gPlayerOne->characterId; - D_80162DD8 = 0; - D_80162DD4 = 0; - D_80162DDC = 1; - func_80005AE8(gPlayerTwo); - func_80005AE8(gPlayerThree); - return; - } - if (((gLapCountByPlayerId[0] == 3) && (D_80162DDC == 0)) && (D_80162DF8 == 1)) - { - D_80162D80 = &D_802BFB80[(D_80162DC8 << 0xF) + 0x3000]; - D_80162D84 = D_80162D86; - D_80162DDC = 1; - } - if ((gPlayerOne->unk_000 & 0x800) == 0x800) - { - func_80005AE8(gPlayerTwo); - func_80005AE8(gPlayerThree); - return; - } - ; - D_80162DEC++; - if (D_80162DEC > 100) - { - D_80162DEC = 100; - } - if ((gModeSelection == TIME_TRIALS) && (gActiveScreenMode == SCREEN_MODE_1P)) - { - if ((D_80162DD4 == 0) && (gLapCountByPlayerId[1] != 3)) - { - func_800057DC(); - } - if ((D_80162DD6 == 0) && (3 != gLapCountByPlayerId[8])) - { - func_8000561C(); - } - if ((gPlayerOne->unk_000 & (1 << 11)) == 0) - { - func_8000599C(); - } } } - #else GLOBAL_ASM("asm/non_matchings/staff_ghosts/func_80005B18.s") #endif diff --git a/src/staff_ghosts.h b/src/staff_ghosts.h index 90d562c73..909650a46 100644 --- a/src/staff_ghosts.h +++ b/src/staff_ghosts.h @@ -5,9 +5,26 @@ #include "common_structs.h" #include -s32 func_800051C4(void); -void func_8000522C(void); -void func_80005AE8(Player *); +void func_80004EF0(); +void func_80004FB0(); +void func_80004FF8(); +void set_staff_ghost(); +s32 func_800051C4(); +void func_8000522C(); +void func_800052A4(); +void func_80005310(); +void func_8000546C(); +void func_8000561C(); +void func_800057DC(); +void func_8000599C(); +void func_80005AE8(Player*); +void func_80005E6C(); +void staff_ghosts_loop(); + +// mi0decode + +extern s32 mio0encode(s32 input, s32, s32); +extern s32 func_80040174(void *, s32, s32); extern s32 D_80162DC8; extern s32 D_80162DCC;