From 6562421673281df8150086a7c1d75e893e1f24ee Mon Sep 17 00:00:00 2001 From: MegaMech Date: Wed, 30 Aug 2023 22:45:51 -0600 Subject: [PATCH] some matches (#391) --- asm/bss_80005FD0.s | 2 +- .../code_80005FD0/func_8000F2DC.s | 221 ----------- .../code_80005FD0/func_8001BE78.s | 129 ------ .../code_80005FD0/func_8001C05C.s | 92 ----- include/waypoints.h | 2 +- src/code_80005FD0.c | 374 +++++++----------- 6 files changed, 145 insertions(+), 675 deletions(-) delete mode 100644 asm/non_matchings/code_80005FD0/func_8000F2DC.s delete mode 100644 asm/non_matchings/code_80005FD0/func_8001BE78.s delete mode 100644 asm/non_matchings/code_80005FD0/func_8001C05C.s diff --git a/asm/bss_80005FD0.s b/asm/bss_80005FD0.s index 39fb81d4b..82227fae4 100644 --- a/asm/bss_80005FD0.s +++ b/asm/bss_80005FD0.s @@ -279,7 +279,7 @@ glabel D_801634F0 glabel D_801634F4 .skip 4 -glabel D_801634F8 +glabel D_801634F8 # array ptrs below may be fake .skip 4 glabel D_801634FC diff --git a/asm/non_matchings/code_80005FD0/func_8000F2DC.s b/asm/non_matchings/code_80005FD0/func_8000F2DC.s deleted file mode 100644 index 5af41f522..000000000 --- a/asm/non_matchings/code_80005FD0/func_8000F2DC.s +++ /dev/null @@ -1,221 +0,0 @@ -glabel func_8000F2DC -/* 00FEDC 8000F2DC 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 00FEE0 8000F2E0 3C0E800E */ lui $t6, %hi(gCurrentCourseId) -/* 00FEE4 8000F2E4 85CEC5A0 */ lh $t6, %lo(gCurrentCourseId)($t6) -/* 00FEE8 8000F2E8 3C18800E */ lui $t8, %hi(D_800DD9D0) -/* 00FEEC 8000F2EC 2718D9D0 */ addiu $t8, %lo(D_800DD9D0) # addiu $t8, $t8, -0x2630 -/* 00FEF0 8000F2F0 000E7900 */ sll $t7, $t6, 4 -/* 00FEF4 8000F2F4 AFBF0034 */ sw $ra, 0x34($sp) -/* 00FEF8 8000F2F8 AFB70030 */ sw $s7, 0x30($sp) -/* 00FEFC 8000F2FC AFB6002C */ sw $s6, 0x2c($sp) -/* 00FF00 8000F300 AFB50028 */ sw $s5, 0x28($sp) -/* 00FF04 8000F304 AFB40024 */ sw $s4, 0x24($sp) -/* 00FF08 8000F308 AFB30020 */ sw $s3, 0x20($sp) -/* 00FF0C 8000F30C AFB2001C */ sw $s2, 0x1c($sp) -/* 00FF10 8000F310 AFB10018 */ sw $s1, 0x18($sp) -/* 00FF14 8000F314 AFB00014 */ sw $s0, 0x14($sp) -/* 00FF18 8000F318 01F81021 */ addu $v0, $t7, $t8 -/* 00FF1C 8000F31C 94590000 */ lhu $t9, ($v0) -/* 00FF20 8000F320 3C038016 */ lui $v1, %hi(D_80163368) # $v1, 0x8016 -/* 00FF24 8000F324 24633368 */ addiu $v1, %lo(D_80163368) # addiu $v1, $v1, 0x3368 -/* 00FF28 8000F328 AC790000 */ sw $t9, ($v1) -/* 00FF2C 8000F32C 94480002 */ lhu $t0, 2($v0) -/* 00FF30 8000F330 AC680004 */ sw $t0, 4($v1) -/* 00FF34 8000F334 94490004 */ lhu $t1, 4($v0) -/* 00FF38 8000F338 AC690008 */ sw $t1, 8($v1) -/* 00FF3C 8000F33C 944A0006 */ lhu $t2, 6($v0) -/* 00FF40 8000F340 AC6A000C */ sw $t2, 0xc($v1) -/* 00FF44 8000F344 94450008 */ lhu $a1, 8($v0) -/* 00FF48 8000F348 0C0A9EDC */ jal get_next_available_memory_addr -/* 00FF4C 8000F34C 00052080 */ sll $a0, $a1, 2 -/* 00FF50 8000F350 3C018016 */ lui $at, %hi(D_80163598) # $at, 0x8016 -/* 00FF54 8000F354 3C118016 */ lui $s1, %hi(D_80163368) # $s1, 0x8016 -/* 00FF58 8000F358 3C138016 */ lui $s3, %hi(D_80164550) # $s3, 0x8016 -/* 00FF5C 8000F35C 3C148016 */ lui $s4, %hi(D_80164560) # $s4, 0x8016 -/* 00FF60 8000F360 3C128016 */ lui $s2, %hi(D_80164570) # $s2, 0x8016 -/* 00FF64 8000F364 3C168016 */ lui $s6, %hi(D_80164580) # $s6, 0x8016 -/* 00FF68 8000F368 3C178016 */ lui $s7, %hi(D_80164590) # $s7, 0x8016 -/* 00FF6C 8000F36C 3C158016 */ lui $s5, %hi(D_801645A0) # $s5, 0x8016 -/* 00FF70 8000F370 3C108016 */ lui $s0, %hi(gPathIndexByPlayerId) # $s0, 0x8016 -/* 00FF74 8000F374 AC223598 */ sw $v0, %lo(D_80163598)($at) -/* 00FF78 8000F378 261045B0 */ addiu $s0, %lo(gPathIndexByPlayerId) # addiu $s0, $s0, 0x45b0 -/* 00FF7C 8000F37C 26B545A0 */ addiu $s5, %lo(D_801645A0) # addiu $s5, $s5, 0x45a0 -/* 00FF80 8000F380 26F74590 */ addiu $s7, %lo(D_80164590) # addiu $s7, $s7, 0x4590 -/* 00FF84 8000F384 26D64580 */ addiu $s6, %lo(D_80164580) # addiu $s6, $s6, 0x4580 -/* 00FF88 8000F388 26524570 */ addiu $s2, %lo(D_80164570) # addiu $s2, $s2, 0x4570 -/* 00FF8C 8000F38C 26944560 */ addiu $s4, %lo(D_80164560) # addiu $s4, $s4, 0x4560 -/* 00FF90 8000F390 26734550 */ addiu $s3, %lo(D_80164550) # addiu $s3, $s3, 0x4550 -/* 00FF94 8000F394 26313368 */ addiu $s1, %lo(D_80163368) # addiu $s1, $s1, 0x3368 -.L8000F398: -/* 00FF98 8000F398 8E240000 */ lw $a0, ($s1) -/* 00FF9C 8000F39C 000458C0 */ sll $t3, $a0, 3 -/* 00FFA0 8000F3A0 0C0A9EDC */ jal get_next_available_memory_addr -/* 00FFA4 8000F3A4 01602025 */ move $a0, $t3 -/* 00FFA8 8000F3A8 8E240000 */ lw $a0, ($s1) -/* 00FFAC 8000F3AC AE620000 */ sw $v0, ($s3) -/* 00FFB0 8000F3B0 000460C0 */ sll $t4, $a0, 3 -/* 00FFB4 8000F3B4 0C0A9EDC */ jal get_next_available_memory_addr -/* 00FFB8 8000F3B8 01802025 */ move $a0, $t4 -/* 00FFBC 8000F3BC 8E240000 */ lw $a0, ($s1) -/* 00FFC0 8000F3C0 AE820000 */ sw $v0, ($s4) -/* 00FFC4 8000F3C4 000468C0 */ sll $t5, $a0, 3 -/* 00FFC8 8000F3C8 0C0A9EDC */ jal get_next_available_memory_addr -/* 00FFCC 8000F3CC 01A02025 */ move $a0, $t5 -/* 00FFD0 8000F3D0 8E240000 */ lw $a0, ($s1) -/* 00FFD4 8000F3D4 AE420000 */ sw $v0, ($s2) -/* 00FFD8 8000F3D8 00047040 */ sll $t6, $a0, 1 -/* 00FFDC 8000F3DC 0C0A9EDC */ jal get_next_available_memory_addr -/* 00FFE0 8000F3E0 01C02025 */ move $a0, $t6 -/* 00FFE4 8000F3E4 8E240000 */ lw $a0, ($s1) -/* 00FFE8 8000F3E8 AEC20000 */ sw $v0, ($s6) -/* 00FFEC 8000F3EC 00047840 */ sll $t7, $a0, 1 -/* 00FFF0 8000F3F0 0C0A9EDC */ jal get_next_available_memory_addr -/* 00FFF4 8000F3F4 01E02025 */ move $a0, $t7 -/* 00FFF8 8000F3F8 8E240000 */ lw $a0, ($s1) -/* 00FFFC 8000F3FC AEE20000 */ sw $v0, ($s7) -/* 010000 8000F400 0004C040 */ sll $t8, $a0, 1 -/* 010004 8000F404 0C0A9EDC */ jal get_next_available_memory_addr -/* 010008 8000F408 03002025 */ move $a0, $t8 -/* 01000C 8000F40C 26B50004 */ addiu $s5, $s5, 4 -/* 010010 8000F410 02B0082B */ sltu $at, $s5, $s0 -/* 010014 8000F414 26310004 */ addiu $s1, $s1, 4 -/* 010018 8000F418 26730004 */ addiu $s3, $s3, 4 -/* 01001C 8000F41C 26940004 */ addiu $s4, $s4, 4 -/* 010020 8000F420 26520004 */ addiu $s2, $s2, 4 -/* 010024 8000F424 26D60004 */ addiu $s6, $s6, 4 -/* 010028 8000F428 26F70004 */ addiu $s7, $s7, 4 -/* 01002C 8000F42C 1420FFDA */ bnez $at, .L8000F398 -/* 010030 8000F430 AEA2FFFC */ sw $v0, -4($s5) -/* 010034 8000F434 3C198016 */ lui $t9, %hi(D_80164550) # $t9, 0x8016 -/* 010038 8000F438 8F394550 */ lw $t9, %lo(D_80164550)($t9) -/* 01003C 8000F43C 3C088016 */ lui $t0, %hi(D_80164560) # $t0, 0x8016 -/* 010040 8000F440 8D084560 */ lw $t0, %lo(D_80164560)($t0) -/* 010044 8000F444 3C018016 */ lui $at, %hi(D_80164490) # $at, 0x8016 -/* 010048 8000F448 3C098016 */ lui $t1, %hi(D_80164570) # $t1, 0x8016 -/* 01004C 8000F44C AC394490 */ sw $t9, %lo(D_80164490)($at) -/* 010050 8000F450 8D294570 */ lw $t1, %lo(D_80164570)($t1) -/* 010054 8000F454 3C018016 */ lui $at, %hi(D_801631D0) # $at, 0x8016 -/* 010058 8000F458 3C0A8016 */ lui $t2, %hi(D_80164580) # $t2, 0x8016 -/* 01005C 8000F45C AC2831D0 */ sw $t0, %lo(D_801631D0)($at) -/* 010060 8000F460 8D4A4580 */ lw $t2, %lo(D_80164580)($t2) -/* 010064 8000F464 3C018016 */ lui $at, %hi(D_801631D4) # $at, 0x8016 -/* 010068 8000F468 3C0B8016 */ lui $t3, %hi(D_80164590) # $t3, 0x8016 -/* 01006C 8000F46C AC2931D4 */ sw $t1, %lo(D_801631D4)($at) -/* 010070 8000F470 8D6B4590 */ lw $t3, %lo(D_80164590)($t3) -/* 010074 8000F474 3C018016 */ lui $at, %hi(D_801631D8) # $at, 0x8016 -/* 010078 8000F478 3C0C8016 */ lui $t4, %hi(D_801645A0) # $t4, 0x8016 -/* 01007C 8000F47C AC2A31D8 */ sw $t2, %lo(D_801631D8)($at) -/* 010080 8000F480 8D8C45A0 */ lw $t4, %lo(D_801645A0)($t4) -/* 010084 8000F484 3C018016 */ lui $at, %hi(D_801631DC) # $at, 0x8016 -/* 010088 8000F488 AC2B31DC */ sw $t3, %lo(D_801631DC)($at) -/* 01008C 8000F48C 3C018016 */ lui $at, %hi(D_801645E0) # $at, 0x8016 -/* 010090 8000F490 3C118016 */ lui $s1, %hi(D_80163368) # $s1, 0x8016 -/* 010094 8000F494 3C138016 */ lui $s3, %hi(D_80164550) # $s3, 0x8016 -/* 010098 8000F498 3C148016 */ lui $s4, %hi(D_80164560) # $s4, 0x8016 -/* 01009C 8000F49C 3C128016 */ lui $s2, %hi(D_80164570) # $s2, 0x8016 -/* 0100A0 8000F4A0 3C108016 */ lui $s0, %hi(D_80164580) # $s0, 0x8016 -/* 0100A4 8000F4A4 26104580 */ addiu $s0, %lo(D_80164580) # addiu $s0, $s0, 0x4580 -/* 0100A8 8000F4A8 26524570 */ addiu $s2, %lo(D_80164570) # addiu $s2, $s2, 0x4570 -/* 0100AC 8000F4AC 26944560 */ addiu $s4, %lo(D_80164560) # addiu $s4, $s4, 0x4560 -/* 0100B0 8000F4B0 26734550 */ addiu $s3, %lo(D_80164550) # addiu $s3, $s3, 0x4550 -/* 0100B4 8000F4B4 26313368 */ addiu $s1, %lo(D_80163368) # addiu $s1, $s1, 0x3368 -/* 0100B8 8000F4B8 AC2C45E0 */ sw $t4, %lo(D_801645E0)($at) -.L8000F4BC: -/* 0100BC 8000F4BC 8E640000 */ lw $a0, ($s3) -/* 0100C0 8000F4C0 0C003CAF */ jal func_8000F2BC -/* 0100C4 8000F4C4 8E250000 */ lw $a1, ($s1) -/* 0100C8 8000F4C8 8E840000 */ lw $a0, ($s4) -/* 0100CC 8000F4CC 0C003CAF */ jal func_8000F2BC -/* 0100D0 8000F4D0 8E250000 */ lw $a1, ($s1) -/* 0100D4 8000F4D4 8E440000 */ lw $a0, ($s2) -/* 0100D8 8000F4D8 0C003CAF */ jal func_8000F2BC -/* 0100DC 8000F4DC 8E250000 */ lw $a1, ($s1) -/* 0100E0 8000F4E0 26520004 */ addiu $s2, $s2, 4 -/* 0100E4 8000F4E4 0250082B */ sltu $at, $s2, $s0 -/* 0100E8 8000F4E8 26310004 */ addiu $s1, $s1, 4 -/* 0100EC 8000F4EC 26730004 */ addiu $s3, $s3, 4 -/* 0100F0 8000F4F0 1420FFF2 */ bnez $at, .L8000F4BC -/* 0100F4 8000F4F4 26940004 */ addiu $s4, $s4, 4 -/* 0100F8 8000F4F8 00008025 */ move $s0, $zero -/* 0100FC 8000F4FC 26100001 */ addiu $s0, $s0, 1 -.L8000F500: -/* 010100 8000F500 2A010004 */ slti $at, $s0, 4 -/* 010104 8000F504 5420FFFE */ bnel $at, $zero, .L8000F500 -/* 010108 8000F508 26100001 */ addiu $s0, $s0, 1 -/* 01010C 8000F50C 3C118016 */ lui $s1, %hi(D_80163368) # $s1, 0x8016 -/* 010110 8000F510 26313368 */ addiu $s1, %lo(D_80163368) # addiu $s1, $s1, 0x3368 -/* 010114 8000F514 00008025 */ move $s0, $zero -/* 010118 8000F518 24120004 */ li $s2, 4 -.L8000F51C: -/* 01011C 8000F51C 8E2D0000 */ lw $t5, ($s1) -/* 010120 8000F520 29A10002 */ slti $at, $t5, 2 -/* 010124 8000F524 5420000C */ bnel $at, $zero, .L8000F558 -/* 010128 8000F528 26100001 */ addiu $s0, $s0, 1 -/* 01012C 8000F52C 0C00403C */ jal func_800100F0 -/* 010130 8000F530 02002025 */ move $a0, $s0 -/* 010134 8000F534 0C004086 */ jal func_80010218 -/* 010138 8000F538 02002025 */ move $a0, $s0 -/* 01013C 8000F53C 0C0041F1 */ jal func_800107C4 -/* 010140 8000F540 02002025 */ move $a0, $s0 -/* 010144 8000F544 0C00436F */ jal func_80010DBC -/* 010148 8000F548 02002025 */ move $a0, $s0 -/* 01014C 8000F54C 0C00439B */ jal func_80010E6C -/* 010150 8000F550 02002025 */ move $a0, $s0 -/* 010154 8000F554 26100001 */ addiu $s0, $s0, 1 -.L8000F558: -/* 010158 8000F558 1612FFF0 */ bne $s0, $s2, .L8000F51C -/* 01015C 8000F55C 26310004 */ addiu $s1, $s1, 4 -/* 010160 8000F560 3C0E8016 */ lui $t6, %hi(gWaypointCountByPathIndex) # $t6, 0x8016 -/* 010164 8000F564 95CE45C8 */ lhu $t6, %lo(gWaypointCountByPathIndex)($t6) -/* 010168 8000F568 3C02800E */ lui $v0, %hi(gCurrentCourseId) -/* 01016C 8000F56C 8442C5A0 */ lh $v0, %lo(gCurrentCourseId)($v0) -/* 010170 8000F570 3C018016 */ lui $at, %hi(D_80164430) # $at, 0x8016 -/* 010174 8000F574 A42E4430 */ sh $t6, %lo(D_80164430)($at) -/* 010178 8000F578 2401000A */ li $at, 10 -/* 01017C 8000F57C 10410013 */ beq $v0, $at, .L8000F5CC -/* 010180 8000F580 2401000B */ li $at, 11 -/* 010184 8000F584 10410005 */ beq $v0, $at, .L8000F59C -/* 010188 8000F588 24010012 */ li $at, 18 -/* 01018C 8000F58C 10410009 */ beq $v0, $at, .L8000F5B4 -/* 010190 8000F590 00000000 */ nop -/* 010194 8000F594 10000015 */ b .L8000F5EC -/* 010198 8000F598 00000000 */ nop -.L8000F59C: -/* 01019C 8000F59C 0C004832 */ jal func_800120C8 -/* 0101A0 8000F5A0 00000000 */ nop -/* 0101A4 8000F5A4 0C0049F8 */ jal func_800127E0 -/* 0101A8 8000F5A8 00000000 */ nop -/* 0101AC 8000F5AC 1000000F */ b .L8000F5EC -/* 0101B0 8000F5B0 00000000 */ nop -.L8000F5B4: -/* 0101B4 8000F5B4 0C004864 */ jal func_80012190 -/* 0101B8 8000F5B8 00000000 */ nop -/* 0101BC 8000F5BC 0C004CBD */ jal func_800132F4 -/* 0101C0 8000F5C0 00000000 */ nop -/* 0101C4 8000F5C4 10000009 */ b .L8000F5EC -/* 0101C8 8000F5C8 00000000 */ nop -.L8000F5CC: -/* 0101CC 8000F5CC 0C0051F8 */ jal func_800147E0 -/* 0101D0 8000F5D0 00000000 */ nop -/* 0101D4 8000F5D4 0C00524D */ jal func_80014934 -/* 0101D8 8000F5D8 00000000 */ nop -/* 0101DC 8000F5DC 0C0052A2 */ jal func_80014A88 -/* 0101E0 8000F5E0 00000000 */ nop -/* 0101E4 8000F5E4 0C0052F7 */ jal func_80014BDC -/* 0101E8 8000F5E8 00000000 */ nop -.L8000F5EC: -/* 0101EC 8000F5EC 0C00375E */ jal func_8000DD78 -/* 0101F0 8000F5F0 00000000 */ nop -/* 0101F4 8000F5F4 0C003BB7 */ jal func_8000EEDC -/* 0101F8 8000F5F8 00000000 */ nop -/* 0101FC 8000F5FC 8FBF0034 */ lw $ra, 0x34($sp) -/* 010200 8000F600 8FB00014 */ lw $s0, 0x14($sp) -/* 010204 8000F604 8FB10018 */ lw $s1, 0x18($sp) -/* 010208 8000F608 8FB2001C */ lw $s2, 0x1c($sp) -/* 01020C 8000F60C 8FB30020 */ lw $s3, 0x20($sp) -/* 010210 8000F610 8FB40024 */ lw $s4, 0x24($sp) -/* 010214 8000F614 8FB50028 */ lw $s5, 0x28($sp) -/* 010218 8000F618 8FB6002C */ lw $s6, 0x2c($sp) -/* 01021C 8000F61C 8FB70030 */ lw $s7, 0x30($sp) -/* 010220 8000F620 03E00008 */ jr $ra -/* 010224 8000F624 27BD0038 */ addiu $sp, $sp, 0x38 diff --git a/asm/non_matchings/code_80005FD0/func_8001BE78.s b/asm/non_matchings/code_80005FD0/func_8001BE78.s deleted file mode 100644 index 76ba6978c..000000000 --- a/asm/non_matchings/code_80005FD0/func_8001BE78.s +++ /dev/null @@ -1,129 +0,0 @@ -glabel func_8001BE78 -/* 01CA78 8001BE78 27BDFF80 */ addiu $sp, $sp, -0x80 -/* 01CA7C 8001BE7C AFBF004C */ sw $ra, 0x4c($sp) -/* 01CA80 8001BE80 AFBE0048 */ sw $fp, 0x48($sp) -/* 01CA84 8001BE84 AFB70044 */ sw $s7, 0x44($sp) -/* 01CA88 8001BE88 AFB60040 */ sw $s6, 0x40($sp) -/* 01CA8C 8001BE8C AFB5003C */ sw $s5, 0x3c($sp) -/* 01CA90 8001BE90 AFB40038 */ sw $s4, 0x38($sp) -/* 01CA94 8001BE94 AFB30034 */ sw $s3, 0x34($sp) -/* 01CA98 8001BE98 AFB20030 */ sw $s2, 0x30($sp) -/* 01CA9C 8001BE9C AFB1002C */ sw $s1, 0x2c($sp) -/* 01CAA0 8001BEA0 AFB00028 */ sw $s0, 0x28($sp) -/* 01CAA4 8001BEA4 F7B60020 */ sdc1 $f22, 0x20($sp) -/* 01CAA8 8001BEA8 0C003D8A */ jal func_8000F628 -/* 01CAAC 8001BEAC F7B40018 */ sdc1 $f20, 0x18($sp) -/* 01CAB0 8001BEB0 3C0144FA */ li $at, 0x44FA0000 # 2000.000000 -/* 01CAB4 8001BEB4 3C168016 */ lui $s6, %hi(gPathIndexByPlayerId) # $s6, 0x8016 -/* 01CAB8 8001BEB8 3C148016 */ lui $s4, %hi(D_801634F8) # $s4, 0x8016 -/* 01CABC 8001BEBC 3C138016 */ lui $s3, %hi(gNearestWaypointByPlayerId) # $s3, 0x8016 -/* 01CAC0 8001BEC0 3C178016 */ lui $s7, %hi(D_80164550) # $s7, 0x8016 -/* 01CAC4 8001BEC4 3C1E8016 */ lui $fp, %hi(D_80164590) # $fp, 0x8016 -/* 01CAC8 8001BEC8 3C028016 */ lui $v0, %hi(D_80163410) # $v0, 0x8016 -/* 01CACC 8001BECC 4481B000 */ mtc1 $at, $f22 -/* 01CAD0 8001BED0 4480A000 */ mtc1 $zero, $f20 -/* 01CAD4 8001BED4 24423410 */ addiu $v0, %lo(D_80163410) # addiu $v0, $v0, 0x3410 -/* 01CAD8 8001BED8 27DE4590 */ addiu $fp, %lo(D_80164590) # addiu $fp, $fp, 0x4590 -/* 01CADC 8001BEDC 26F74550 */ addiu $s7, %lo(D_80164550) # addiu $s7, $s7, 0x4550 -/* 01CAE0 8001BEE0 26734438 */ addiu $s3, %lo(gNearestWaypointByPlayerId) # addiu $s3, $s3, 0x4438 -/* 01CAE4 8001BEE4 269434F8 */ addiu $s4, %lo(D_801634F8) # addiu $s4, $s4, 0x34f8 -/* 01CAE8 8001BEE8 26D645B0 */ addiu $s6, %lo(gPathIndexByPlayerId) # addiu $s6, $s6, 0x45b0 -/* 01CAEC 8001BEEC 00009025 */ move $s2, $zero -/* 01CAF0 8001BEF0 0000A825 */ move $s5, $zero -.L8001BEF4: -/* 01CAF4 8001BEF4 3C0E800E */ lui $t6, %hi(gPlayerOne) -/* 01CAF8 8001BEF8 8DCEC4DC */ lw $t6, %lo(gPlayerOne)($t6) -/* 01CAFC 8001BEFC 24010001 */ li $at, 1 -/* 01CB00 8001BF00 24190006 */ li $t9, 6 -/* 01CB04 8001BF04 02AE8821 */ addu $s1, $s5, $t6 -/* 01CB08 8001BF08 962F0000 */ lhu $t7, ($s1) -/* 01CB0C 8001BF0C 31F8DFFF */ andi $t8, $t7, 0xdfff -/* 01CB10 8001BF10 A6380000 */ sh $t8, ($s1) -/* 01CB14 8001BF14 A6D20000 */ sh $s2, ($s6) -/* 01CB18 8001BF18 E694000C */ swc1 $f20, 0xc($s4) -/* 01CB1C 8001BF1C E6940004 */ swc1 $f20, 4($s4) -/* 01CB20 8001BF20 1240000B */ beqz $s2, .L8001BF50 -/* 01CB24 8001BF24 E6940000 */ swc1 $f20, ($s4) -/* 01CB28 8001BF28 1241000B */ beq $s2, $at, .L8001BF58 -/* 01CB2C 8001BF2C 24080001 */ li $t0, 1 -/* 01CB30 8001BF30 24010002 */ li $at, 2 -/* 01CB34 8001BF34 1241000A */ beq $s2, $at, .L8001BF60 -/* 01CB38 8001BF38 24090006 */ li $t1, 6 -/* 01CB3C 8001BF3C 24010003 */ li $at, 3 -/* 01CB40 8001BF40 12410009 */ beq $s2, $at, .L8001BF68 -/* 01CB44 8001BF44 240A0001 */ li $t2, 1 -/* 01CB48 8001BF48 10000009 */ b .L8001BF70 -/* 01CB4C 8001BF4C 966B0000 */ lhu $t3, ($s3) -.L8001BF50: -/* 01CB50 8001BF50 10000006 */ b .L8001BF6C -/* 01CB54 8001BF54 A6790000 */ sh $t9, ($s3) -.L8001BF58: -/* 01CB58 8001BF58 10000004 */ b .L8001BF6C -/* 01CB5C 8001BF5C A6680000 */ sh $t0, ($s3) -.L8001BF60: -/* 01CB60 8001BF60 10000002 */ b .L8001BF6C -/* 01CB64 8001BF64 A6690000 */ sh $t1, ($s3) -.L8001BF68: -/* 01CB68 8001BF68 A66A0000 */ sh $t2, ($s3) -.L8001BF6C: -/* 01CB6C 8001BF6C 966B0000 */ lhu $t3, ($s3) -.L8001BF70: -/* 01CB70 8001BF70 8EED0000 */ lw $t5, ($s7) -/* 01CB74 8001BF74 4600B386 */ mov.s $f14, $f22 -/* 01CB78 8001BF78 000B60C0 */ sll $t4, $t3, 3 -/* 01CB7C 8001BF7C 018D8021 */ addu $s0, $t4, $t5 -/* 01CB80 8001BF80 860E0000 */ lh $t6, ($s0) -/* 01CB84 8001BF84 448E2000 */ mtc1 $t6, $f4 -/* 01CB88 8001BF88 00000000 */ nop -/* 01CB8C 8001BF8C 468021A0 */ cvt.s.w $f6, $f4 -/* 01CB90 8001BF90 E6260014 */ swc1 $f6, 0x14($s1) -/* 01CB94 8001BF94 86180004 */ lh $t8, 4($s0) -/* 01CB98 8001BF98 860F0000 */ lh $t7, ($s0) -/* 01CB9C 8001BF9C AFA20054 */ sw $v0, 0x54($sp) -/* 01CBA0 8001BFA0 44985000 */ mtc1 $t8, $f10 -/* 01CBA4 8001BFA4 448F4000 */ mtc1 $t7, $f8 -/* 01CBA8 8001BFA8 468052A0 */ cvt.s.w $f10, $f10 -/* 01CBAC 8001BFAC 46804320 */ cvt.s.w $f12, $f8 -/* 01CBB0 8001BFB0 44065000 */ mfc1 $a2, $f10 -/* 01CBB4 8001BFB4 0C0AB870 */ jal func_802AE1C0 -/* 01CBB8 8001BFB8 00000000 */ nop -/* 01CBBC 8001BFBC C6300070 */ lwc1 $f16, 0x70($s1) -/* 01CBC0 8001BFC0 02202025 */ move $a0, $s1 -/* 01CBC4 8001BFC4 00002825 */ move $a1, $zero -/* 01CBC8 8001BFC8 46100480 */ add.s $f18, $f0, $f16 -/* 01CBCC 8001BFCC E6320018 */ swc1 $f18, 0x18($s1) -/* 01CBD0 8001BFD0 86190004 */ lh $t9, 4($s0) -/* 01CBD4 8001BFD4 44992000 */ mtc1 $t9, $f4 -/* 01CBD8 8001BFD8 00000000 */ nop -/* 01CBDC 8001BFDC 468021A0 */ cvt.s.w $f6, $f4 -/* 01CBE0 8001BFE0 E626001C */ swc1 $f6, 0x1c($s1) -/* 01CBE4 8001BFE4 8FC80000 */ lw $t0, ($fp) -/* 01CBE8 8001BFE8 85090000 */ lh $t1, ($t0) -/* 01CBEC 8001BFEC 0C00DA03 */ jal func_8003680C -/* 01CBF0 8001BFF0 A629002E */ sh $t1, 0x2e($s1) -/* 01CBF4 8001BFF4 8FA20054 */ lw $v0, 0x54($sp) -/* 01CBF8 8001BFF8 26520001 */ addiu $s2, $s2, 1 -/* 01CBFC 8001BFFC 24010004 */ li $at, 4 -/* 01CC00 8001C000 26B50DD8 */ addiu $s5, $s5, 0xdd8 -/* 01CC04 8001C004 26D60002 */ addiu $s6, $s6, 2 -/* 01CC08 8001C008 26940010 */ addiu $s4, $s4, 0x10 -/* 01CC0C 8001C00C 26730002 */ addiu $s3, $s3, 2 -/* 01CC10 8001C010 26F70004 */ addiu $s7, $s7, 4 -/* 01CC14 8001C014 27DE0004 */ addiu $fp, $fp, 4 -/* 01CC18 8001C018 24420002 */ addiu $v0, $v0, 2 -/* 01CC1C 8001C01C 1641FFB5 */ bne $s2, $at, .L8001BEF4 -/* 01CC20 8001C020 A440FFFE */ sh $zero, -2($v0) -/* 01CC24 8001C024 8FBF004C */ lw $ra, 0x4c($sp) -/* 01CC28 8001C028 D7B40018 */ ldc1 $f20, 0x18($sp) -/* 01CC2C 8001C02C D7B60020 */ ldc1 $f22, 0x20($sp) -/* 01CC30 8001C030 8FB00028 */ lw $s0, 0x28($sp) -/* 01CC34 8001C034 8FB1002C */ lw $s1, 0x2c($sp) -/* 01CC38 8001C038 8FB20030 */ lw $s2, 0x30($sp) -/* 01CC3C 8001C03C 8FB30034 */ lw $s3, 0x34($sp) -/* 01CC40 8001C040 8FB40038 */ lw $s4, 0x38($sp) -/* 01CC44 8001C044 8FB5003C */ lw $s5, 0x3c($sp) -/* 01CC48 8001C048 8FB60040 */ lw $s6, 0x40($sp) -/* 01CC4C 8001C04C 8FB70044 */ lw $s7, 0x44($sp) -/* 01CC50 8001C050 8FBE0048 */ lw $fp, 0x48($sp) -/* 01CC54 8001C054 03E00008 */ jr $ra -/* 01CC58 8001C058 27BD0080 */ addiu $sp, $sp, 0x80 diff --git a/asm/non_matchings/code_80005FD0/func_8001C05C.s b/asm/non_matchings/code_80005FD0/func_8001C05C.s deleted file mode 100644 index 86b3412c5..000000000 --- a/asm/non_matchings/code_80005FD0/func_8001C05C.s +++ /dev/null @@ -1,92 +0,0 @@ -.section .late_rodata - -glabel D_800ED4B4 -.float 19.166999817 - -glabel D_800ED4B8 -.float -3202.475097656 - -glabel D_800ED4BC -.float -477.623992920 - -glabel D_800ED4C0 -.float -3205.080078125 - -glabel D_800ED4C4 -.float -462.851989746 - -glabel D_800ED4C8 -.float -3199.870117188 - -glabel D_800ED4CC -.float -492.395996094 - -glabel D_800ED4D0 -.float -2409.197021484 - -glabel D_800ED4D4 -.float -355.253997803 - -.section .text - -glabel func_8001C05C -/* 01CC5C 8001C05C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 01CC60 8001C060 AFBF0014 */ sw $ra, 0x14($sp) -/* 01CC64 8001C064 0C000433 */ jal init_seg_8028DF00 -/* 01CC68 8001C068 00000000 */ nop -/* 01CC6C 8001C06C 240E0014 */ li $t6, 20 -/* 01CC70 8001C070 3C01800E */ lui $at, %hi(gCurrentCourseId) -/* 01CC74 8001C074 A42EC5A0 */ sh $t6, %lo(gCurrentCourseId)($at) -/* 01CC78 8001C078 3C018016 */ lui $at, %hi(D_8016347C) # $at, 0x8016 -/* 01CC7C 8001C07C A420347C */ sh $zero, %lo(D_8016347C)($at) -/* 01CC80 8001C080 3C018016 */ lui $at, %hi(D_8016347E) # $at, 0x8016 -/* 01CC84 8001C084 A420347E */ sh $zero, %lo(D_8016347E)($at) -/* 01CC88 8001C088 3C018016 */ lui $at, %hi(D_80163480) # $at, 0x8016 -/* 01CC8C 8001C08C AC203480 */ sw $zero, %lo(D_80163480)($at) -/* 01CC90 8001C090 3C018016 */ lui $at, %hi(D_80163484) # $at, 0x8016 -/* 01CC94 8001C094 0C003CB7 */ jal func_8000F2DC -/* 01CC98 8001C098 AC203484 */ sw $zero, %lo(D_80163484)($at) -/* 01CC9C 8001C09C 0C005379 */ jal func_80014DE4 -/* 01CCA0 8001C0A0 00002025 */ move $a0, $zero -/* 01CCA4 8001C0A4 0C006F9E */ jal func_8001BE78 -/* 01CCA8 8001C0A8 00000000 */ nop -/* 01CCAC 8001C0AC 3C01800F */ lui $at, %hi(D_800ED4B4) # $at, 0x800f -/* 01CCB0 8001C0B0 C420D4B4 */ lwc1 $f0, %lo(D_800ED4B4)($at) -/* 01CCB4 8001C0B4 3C01800F */ lui $at, %hi(D_800ED4B8) # $at, 0x800f -/* 01CCB8 8001C0B8 C424D4B8 */ lwc1 $f4, %lo(D_800ED4B8)($at) -/* 01CCBC 8001C0BC 3C028016 */ lui $v0, %hi(D_80163418) # $v0, 0x8016 -/* 01CCC0 8001C0C0 3C038016 */ lui $v1, %hi(D_80163428) # $v1, 0x8016 -/* 01CCC4 8001C0C4 24633428 */ addiu $v1, %lo(D_80163428) # addiu $v1, $v1, 0x3428 -/* 01CCC8 8001C0C8 24423418 */ addiu $v0, %lo(D_80163418) # addiu $v0, $v0, 0x3418 -/* 01CCCC 8001C0CC 3C01800F */ lui $at, %hi(D_800ED4BC) # $at, 0x800f -/* 01CCD0 8001C0D0 E4600000 */ swc1 $f0, ($v1) -/* 01CCD4 8001C0D4 E4440000 */ swc1 $f4, ($v0) -/* 01CCD8 8001C0D8 C426D4BC */ lwc1 $f6, %lo(D_800ED4BC)($at) -/* 01CCDC 8001C0DC 3C048016 */ lui $a0, %hi(D_80163438) # $a0, 0x8016 -/* 01CCE0 8001C0E0 24843438 */ addiu $a0, %lo(D_80163438) # addiu $a0, $a0, 0x3438 -/* 01CCE4 8001C0E4 3C01800F */ lui $at, %hi(D_800ED4C0) # $at, 0x800f -/* 01CCE8 8001C0E8 E4860000 */ swc1 $f6, ($a0) -/* 01CCEC 8001C0EC C428D4C0 */ lwc1 $f8, %lo(D_800ED4C0)($at) -/* 01CCF0 8001C0F0 3C01800F */ lui $at, %hi(D_800ED4C4) # $at, 0x800f -/* 01CCF4 8001C0F4 E4600004 */ swc1 $f0, 4($v1) -/* 01CCF8 8001C0F8 E4480004 */ swc1 $f8, 4($v0) -/* 01CCFC 8001C0FC C42AD4C4 */ lwc1 $f10, %lo(D_800ED4C4)($at) -/* 01CD00 8001C100 3C01800F */ lui $at, %hi(D_800ED4C8) # $at, 0x800f -/* 01CD04 8001C104 44803000 */ mtc1 $zero, $f6 -/* 01CD08 8001C108 E48A0004 */ swc1 $f10, 4($a0) -/* 01CD0C 8001C10C C430D4C8 */ lwc1 $f16, %lo(D_800ED4C8)($at) -/* 01CD10 8001C110 3C01800F */ lui $at, %hi(D_800ED4CC) # $at, 0x800f -/* 01CD14 8001C114 E4600008 */ swc1 $f0, 8($v1) -/* 01CD18 8001C118 E4500008 */ swc1 $f16, 8($v0) -/* 01CD1C 8001C11C C432D4CC */ lwc1 $f18, %lo(D_800ED4CC)($at) -/* 01CD20 8001C120 3C01800F */ lui $at, %hi(D_800ED4D0) # $at, 0x800f -/* 01CD24 8001C124 8FBF0014 */ lw $ra, 0x14($sp) -/* 01CD28 8001C128 E4920008 */ swc1 $f18, 8($a0) -/* 01CD2C 8001C12C C424D4D0 */ lwc1 $f4, %lo(D_800ED4D0)($at) -/* 01CD30 8001C130 3C01800F */ lui $at, %hi(D_800ED4D4) # $at, 0x800f -/* 01CD34 8001C134 E466000C */ swc1 $f6, 0xc($v1) -/* 01CD38 8001C138 E444000C */ swc1 $f4, 0xc($v0) -/* 01CD3C 8001C13C C428D4D4 */ lwc1 $f8, %lo(D_800ED4D4)($at) -/* 01CD40 8001C140 27BD0018 */ addiu $sp, $sp, 0x18 -/* 01CD44 8001C144 03E00008 */ jr $ra -/* 01CD48 8001C148 E488000C */ swc1 $f8, 0xc($a0) diff --git a/include/waypoints.h b/include/waypoints.h index aac722656..bdd23eaf1 100644 --- a/include/waypoints.h +++ b/include/waypoints.h @@ -26,7 +26,7 @@ extern struct TrackWayPoint *D_80164570[]; extern s16 *D_80164580[]; // Based on func_80010DBC this may be angles between waypoints // D_80164590[i] = atan2(waypoint_i, waypoint_i+1)? -extern u16 *D_80164590[]; +extern s16 *D_80164590[]; // No idea. Adjacency list? extern s16 *D_801645A0[]; diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index e8058b075..22f641165 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -1782,7 +1782,7 @@ extern ? D_80163418; extern ? D_80163438; extern s16 D_8016344A; extern s32 D_80163488; -extern ? D_801634F8; +//extern ? D_801634F8; extern ? D_801634FC; extern ? D_80163504; extern u16 D_801646CC; @@ -3124,7 +3124,7 @@ s16 func_8000D33C(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_801634F8; +//extern ? D_801634F8; f32 func_8000D3B8(s32 arg0) { f32 temp_f0; @@ -4114,142 +4114,91 @@ void func_8000F2BC(struct TrackWayPoint *arg0, size_t size) { bzero((void *) arg0, size << 3); } -#ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 struct _struct_D_800DD9D0_0x10 { - /* 0x00 */ u16 unk0; /* inferred */ - /* 0x02 */ u16 unk2; /* inferred */ - /* 0x04 */ u16 unk4; /* inferred */ - /* 0x06 */ u16 unk6; /* inferred */ - /* 0x08 */ u16 unk8; /* inferred */ - /* 0x0A */ char padA[6]; /* maybe part of unk8[4]? */ -}; /* size = 0x10 */ + /* 0x00 */ u16 unk0; + /* 0x02 */ u16 unk2; + /* 0x04 */ u16 unk4; + /* 0x06 */ u16 unk6; + /* 0x08 */ u16 unk8; + /* 0x0A */ char padA[6]; +}; // size 0x10 +extern uintptr_t *D_80163598; -void func_8000DD78(); /* extern */ -void func_8000EEDC(); /* extern */ -void func_8000F2BC(struct TrackWayPoint *, s32); /* extern */ -void func_800100F0(s32); /* extern */ -void func_80010E6C(s32); /* extern */ -void func_800120C8(); /* extern */ -void func_80012190(); /* extern */ -void func_800127E0(); /* extern */ -void func_800132F4(); /* extern */ -void func_800147E0(); /* extern */ -void func_80014934(); /* extern */ -void func_80014A88(); /* extern */ -void func_80014BDC(); /* extern */ -extern s32 D_80163598; -static struct _struct_D_800DD9D0_0x10 D_800DD9D0[0]; /* unable to generate initializer */ -s16 gCurrentCourseId; /* unable to generate initializer */ +// An array of 21 items. The final element is for podium ceremony. +extern struct _struct_D_800DD9D0_0x10 D_800DD9D0[]; void func_8000F2DC(void) { - s16 **var_s5; - s16 **var_s6; - s16 temp_v0_3; - s32 *var_s1; - s32 *var_s1_2; - s32 *var_s1_3; - s32 temp_v0_2; - s32 var_s0; - s32 var_s0_2; - struct TrackWayPoint **var_s2; - struct TrackWayPoint **var_s2_2; - struct TrackWayPoint **var_s3; - struct TrackWayPoint **var_s3_2; - struct TrackWayPoint **var_s4; - struct TrackWayPoint **var_s4_2; - struct _struct_D_800DD9D0_0x10 *temp_v0; - u16 **var_s7; - temp_v0 = &D_800DD9D0[gCurrentCourseId]; - D_80163368->unk0 = (s32) temp_v0->unk0; - D_80163368->unk4 = (s32) temp_v0->unk2; - D_80163368->unk8 = (s32) temp_v0->unk4; - D_80163368->unkC = (s32) temp_v0->unk6; - D_80163598 = get_next_available_memory_addr(temp_v0->unk8 * 4); - var_s5 = D_801645A0; - var_s7 = D_80164590; - var_s6 = D_80164580; - var_s2 = D_80164570; - var_s4 = D_80164560; - var_s3 = D_80164550; - var_s1 = D_80163368; - do { - *var_s3 = get_next_available_memory_addr(*var_s1 * 8); - *var_s4 = get_next_available_memory_addr(*var_s1 * 8); - *var_s2 = get_next_available_memory_addr(*var_s1 * 8); - *var_s6 = get_next_available_memory_addr(*var_s1 * 2); - *var_s7 = get_next_available_memory_addr(*var_s1 * 2); - temp_v0_2 = get_next_available_memory_addr(*var_s1 * 2); - var_s5 += 4; - var_s1 += 4; - var_s3 += 4; - var_s4 += 4; - var_s2 += 4; - var_s6 += 4; - var_s7 += 4; - var_s5->unk-4 = temp_v0_2; - } while ((u32) var_s5 < (u32) gPathIndexByPlayerId); - D_80164490 = *D_80164550; - D_801631D0 = *D_80164560; - D_801631D4 = *D_80164570; - D_801631D8 = *D_80164580; + struct _struct_D_800DD9D0_0x10 *ptr = &D_800DD9D0[gCurrentCourseId]; + s32 temp; + s32 i; + + D_80163368[0] = (s32) ptr->unk0; + D_80163368[1] = (s32) ptr->unk2; + D_80163368[2] = (s32) ptr->unk4; + D_80163368[3] = (s32) ptr->unk6; + + temp = ptr->unk8; + D_80163598 = (uintptr_t *) get_next_available_memory_addr(temp * 4); + + // Podium ceremony appears to allocate 1 * 8 bytes of data. Which would be aligned to 0x10. + for (i = 0; i < 4; i++) { + D_80164550[i] = get_next_available_memory_addr(D_80163368[i] * 8); + D_80164560[i] = get_next_available_memory_addr(D_80163368[i] * 8); + D_80164570[i] = get_next_available_memory_addr(D_80163368[i] * 8); + D_80164580[i] = get_next_available_memory_addr(D_80163368[i] * 2); + D_80164590[i] = get_next_available_memory_addr(D_80163368[i] * 2); + D_801645A0[i] = get_next_available_memory_addr(D_80163368[i] * 2); + } + + D_80164490 = D_80164550[0]; + D_801631D0 = D_80164560[0]; + D_801631D4 = D_80164570[0]; + D_801631D8 = D_80164580[0]; D_801631DC = *D_80164590; - var_s2_2 = D_80164570; - var_s4_2 = D_80164560; - var_s3_2 = D_80164550; - var_s1_2 = D_80163368; - D_801645E0 = *D_801645A0; - do { - func_8000F2BC(*var_s3_2, *var_s1_2); - func_8000F2BC(*var_s4_2, *var_s1_2); - func_8000F2BC(*var_s2_2, *var_s1_2); - var_s2_2 += 4; - var_s1_2 += 4; - var_s3_2 += 4; - var_s4_2 += 4; - } while ((u32) var_s2_2 < (u32) D_80164580); - var_s0 = 0; - do { - var_s0 += 1; - } while (var_s0 < 4); - var_s1_3 = D_80163368; - var_s0_2 = 0; - do { - if (*var_s1_3 >= 2) { - func_800100F0(var_s0_2); - func_80010218(var_s0_2); - func_800107C4(var_s0_2); - func_80010DBC(var_s0_2); - func_80010E6C(var_s0_2); + D_801645E0 = D_801645A0[0]; + + // zero allocated memory? + // @warning does not appear to zero all the above allocated variables. + for (i = 0; i < 4; i++) { + func_8000F2BC(D_80164550[i], D_80163368[i]); + func_8000F2BC(D_80164560[i], D_80163368[i]); + func_8000F2BC(D_80164570[i], D_80163368[i]); + } + + // Skips several cpu cycles. + for (i = 0; i < 4; i++) {} + + for (i = 0; i < 4; i++) { + if (D_80163368[i] >= 2) { + func_800100F0(i); + func_80010218(i); + func_800107C4(i); + func_80010DBC(i); + func_80010E6C(i); } - var_s0_2 += 1; - var_s1_3 += 4; - } while (var_s0_2 != 4); - temp_v0_3 = gCurrentCourseId; + } + D_80164430 = *gWaypointCountByPathIndex; - switch (temp_v0_3) { /* irregular */ - case 11: - func_800120C8(); - func_800127E0(); - break; - case 18: - func_80012190(); - func_800132F4(); - break; - case 10: - func_800147E0(); - func_80014934(); - func_80014A88(); - func_80014BDC(); - break; + switch (gCurrentCourseId) { + case 11: + func_800120C8(); + func_800127E0(); + break; + case 18: + func_80012190(); + func_800132F4(); + break; + case 10: + func_800147E0(); + func_80014934(); + func_80014A88(); + func_80014BDC(); + break; } func_8000DD78(); func_8000EEDC(); } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F2DC.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de @@ -4303,7 +4252,7 @@ extern ? D_801634D8; extern s16 D_801634EC; extern s32 D_801634F0; extern s32 D_801634F4; -extern ? D_801634F8; +//extern ? D_801634F8; extern u16 D_801637BC; extern s16 D_80164358; extern u16 D_8016435A; @@ -5527,7 +5476,7 @@ extern ? D_80162EB8; extern s16 D_801630E8; extern s16 D_801632D0; extern s16 D_801632E8; -extern ? D_801634F8; +//extern ? D_801634F8; extern u16 gNearestWaypointByPlayerId; s16 gCurrentCourseId; /* unable to generate initializer */ @@ -6997,8 +6946,8 @@ void func_80014D30(s32 cameraId, s32 pathIndex) { //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 extern s32 D_80163238; extern s16 gNearestWaypointByCameraId; -extern s16 D_80164670; -extern s16 D_80164678; +extern s16 D_80164670[]; +//extern s16 D_80164678; extern s16 D_80164680; extern ? D_801646C0; extern s32 D_801646C8; @@ -7015,8 +6964,8 @@ void func_80014DE4(s32 arg0) { temp_v0 = arg0 * 2; D_801646CC = 0; - temp_v1 = temp_v0 + &D_80164678; - *temp_v1 = *(&D_80164670 + temp_v0); + temp_v1 = D_80164678[temp_v0]; + *temp_v1 = D_80164670[temp_v0]; temp_a1 = gModeSelection; if ((temp_a1 != TIME_TRIALS) && ((gCupCourseSelection == CUP_COURSE_ONE) || (gDemoMode))) { goto block_8; @@ -10505,105 +10454,72 @@ block_146: GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001AC10.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -void func_8000F628(); /* extern */ -void func_8003680C(void *, ?); /* extern */ -extern ? D_80163410; -extern ? D_801634F8; +extern u16 D_80163410[]; // One per player? + +typedef struct { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; +} Test; + +extern Test D_801634F8[]; void func_8001BE78(void) { - ? *sp54; - ? *var_s4; - ? *var_v0; - s32 var_s5; - struct TrackWayPoint **var_s7; - struct TrackWayPoint *temp_s0; - u16 **var_fp; - u16 *var_s3; - u16 *var_s6; - u16 var_s2; - void *temp_s1; + Player* temp_s1; + struct TrackWayPoint* temp_s0; + s32 i; func_8000F628(); - var_v0 = &D_80163410; - var_fp = D_80164590; - var_s7 = D_80164550; - var_s3 = gNearestWaypointByPlayerId; - var_s4 = &D_801634F8; - var_s6 = gPathIndexByPlayerId; - var_s2 = 0; - var_s5 = 0; - do { - temp_s1 = var_s5 + gPlayerOne; - temp_s1->unk0 = (u16) (temp_s1->unk0 & 0xDFFF); - *var_s6 = var_s2; - var_s4->unkC = 0.0f; - var_s4->unk4 = 0.0f; - var_s4->unk0 = 0.0f; - switch (var_s2) { /* irregular */ - case 0: - *var_s3 = 6; - break; - case 1: - *var_s3 = 1; - break; - case 2: - *var_s3 = 6; - break; - case 3: - *var_s3 = 1; - break; + for (i = 0; i < 4; i++) { + temp_s1 = &gPlayerOne[i]; + temp_s1->unk_000 &= 0xDFFF; + gPathIndexByPlayerId[i] = i; + D_801634F8[i].unkC = 0.0f; + D_801634F8[i].unk4 = 0.0f; + D_801634F8[i].unk0 = 0.0f; + switch (i) { + case 0: + gNearestWaypointByPlayerId[i] = 6; + break; + case 1: + gNearestWaypointByPlayerId[i] = 1; + break; + case 2: + gNearestWaypointByPlayerId[i] = 6; + break; + case 3: + gNearestWaypointByPlayerId[i] = 1; + break; } - temp_s0 = &(*var_s7)[*var_s3]; - temp_s1->unk14 = (f32) temp_s0->wayPointX; - sp54 = var_v0; - temp_s1->unk18 = (f32) (func_802AE1C0((f32) temp_s0->wayPointX, 2000.0f, (f32) temp_s0->wayPointZ) + temp_s1->unk70); - temp_s1->unk1C = (f32) temp_s0->wayPointZ; - temp_s1->unk2E = (s16) **var_fp; + temp_s0 = &D_80164550[i][gNearestWaypointByPlayerId[i]]; + temp_s1->pos[0] = (f32) temp_s0->wayPointX; + temp_s1->pos[1] = func_802AE1C0((f32) temp_s0->wayPointX, 2000.0f, (f32) temp_s0->wayPointZ) + temp_s1->boundingBoxSize; + temp_s1->pos[2] = (f32) temp_s0->wayPointZ; + temp_s1->unk_02C[1] = (s16) *D_80164590[i]; func_8003680C(temp_s1, 0); - var_s2 += 1; - var_s5 += 0xDD8; - var_s6 += 2; - var_s4 += 0x10; - var_s3 += 2; - var_s7 += 4; - var_fp += 4; - var_v0 += 2; - var_v0->unk-2 = 0; - } while (var_s2 != 4); + temp_s1++; + D_80163410[i] = 0; + } } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001BE78.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void init_seg_8028DF00(); // extern -void func_80014DE4(?); // extern -void func_8001BE78(); // extern -extern f32 D_800ED4B4; -extern f32 D_800ED4B8; -extern f32 D_800ED4BC; -extern f32 D_800ED4C0; -extern f32 D_800ED4C4; -extern f32 D_800ED4C8; -extern f32 D_800ED4CC; -extern f32 D_800ED4D0; -extern f32 D_800ED4D4; -extern ? D_80163418; -extern ? D_80163428; -extern ? D_80163438; extern s16 D_8016347C; extern s16 D_8016347E; extern s32 D_80163480; extern s32 D_80163484; +typedef struct { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; +} Struct80163418; +extern Struct80163418 D_80163418; +extern Struct80163418 D_80163428; +extern Struct80163418 D_80163438; void func_8001C05C(void) { - f32 temp_f0; - init_seg_8028DF00(); - gCurrentCourseId = 0x14; + gCurrentCourseId = COURSE_AWARD_CEREMONY; D_8016347C = 0; D_8016347E = 0; D_80163480 = 0; @@ -10611,23 +10527,19 @@ void func_8001C05C(void) { func_8000F2DC(); func_80014DE4(0); func_8001BE78(); - temp_f0 = D_800ED4B4; - D_80163428.unk0 = temp_f0; - D_80163418.unk0 = D_800ED4B8; - D_80163438.unk0 = D_800ED4BC; - D_80163428.unk4 = temp_f0; - D_80163418.unk4 = D_800ED4C0; - D_80163438.unk4 = D_800ED4C4; - D_80163428.unk8 = temp_f0; - D_80163418.unk8 = D_800ED4C8; - D_80163438.unk8 = D_800ED4CC; + D_80163418.unk0 = -3202.475097656f; + D_80163428.unk0 = 19.166999817f; + D_80163438.unk0 = -477.623992920f; + D_80163418.unk4 = -3205.080078125f; + D_80163428.unk4 = 19.166999817f; + D_80163438.unk4 = -462.851989746f; + D_80163418.unk8 = -3199.870117188f; + D_80163428.unk8 = 19.166999817f; + D_80163438.unk8 = -492.395996094f; + D_80163418.unkC = -2409.197021484f; D_80163428.unkC = 0.0f; - D_80163418.unkC = D_800ED4D0; - D_80163438.unkC = D_800ED4D4; + D_80163438.unkC = -355.253997803; } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001C05C.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9