From 044e056fbe1721e4875e9ba816832ce5b575a297 Mon Sep 17 00:00:00 2001 From: Tyler McGavran Date: Tue, 19 Apr 2022 15:31:08 -0400 Subject: [PATCH] Match assorted functions in code_80027D00 (#179) Also refresh a couple mips_to_c outputs Signed-off-by: Taggerung --- .../code_80027D00/func_80029200.s | 93 --- .../code_80027D00/func_80031F48.s | 72 -- .../code_80027D00/func_80032CB0.s | 62 -- .../code_80027D00/func_80033280.s | 29 - .../code_80027D00/func_80036C5C.s | 24 - .../code_80027D00/func_80038BE4.s | 37 - src/code_80027D00.c | 633 +++++++++--------- src/code_80027D00.h | 11 + src/code_8008C1D0.h | 2 - 9 files changed, 310 insertions(+), 653 deletions(-) delete mode 100644 asm/non_matchings/code_80027D00/func_80029200.s delete mode 100644 asm/non_matchings/code_80027D00/func_80031F48.s delete mode 100644 asm/non_matchings/code_80027D00/func_80032CB0.s delete mode 100644 asm/non_matchings/code_80027D00/func_80033280.s delete mode 100644 asm/non_matchings/code_80027D00/func_80036C5C.s delete mode 100644 asm/non_matchings/code_80027D00/func_80038BE4.s diff --git a/asm/non_matchings/code_80027D00/func_80029200.s b/asm/non_matchings/code_80027D00/func_80029200.s deleted file mode 100644 index 5f707dac4..000000000 --- a/asm/non_matchings/code_80027D00/func_80029200.s +++ /dev/null @@ -1,93 +0,0 @@ -glabel func_80029200 -/* 029E00 80029200 AFA50004 */ sw $a1, 4($sp) -/* 029E04 80029204 848200C4 */ lh $v0, 0xc4($a0) -/* 029E08 80029208 00057600 */ sll $t6, $a1, 0x18 -/* 029E0C 8002920C 000E7E03 */ sra $t7, $t6, 0x18 -/* 029E10 80029210 2841F8E5 */ slti $at, $v0, -0x71b -/* 029E14 80029214 10200005 */ beqz $at, .L8002922C -/* 029E18 80029218 01E02825 */ move $a1, $t7 -/* 029E1C 8002921C 000FC040 */ sll $t8, $t7, 1 -/* 029E20 80029220 0098C821 */ addu $t9, $a0, $t8 -/* 029E24 80029224 A720024C */ sh $zero, 0x24c($t9) -/* 029E28 80029228 848200C4 */ lh $v0, 0xc4($a0) -.L8002922C: -/* 029E2C 8002922C 2841FB07 */ slti $at, $v0, -0x4f9 -/* 029E30 80029230 10200007 */ beqz $at, .L80029250 -/* 029E34 80029234 2841F8E5 */ slti $at, $v0, -0x71b -/* 029E38 80029238 14200005 */ bnez $at, .L80029250 -/* 029E3C 8002923C 24080001 */ li $t0, 1 -/* 029E40 80029240 00054840 */ sll $t1, $a1, 1 -/* 029E44 80029244 00895021 */ addu $t2, $a0, $t1 -/* 029E48 80029248 A548024C */ sh $t0, 0x24c($t2) -/* 029E4C 8002924C 848200C4 */ lh $v0, 0xc4($a0) -.L80029250: -/* 029E50 80029250 2841FDDF */ slti $at, $v0, -0x221 -/* 029E54 80029254 10200007 */ beqz $at, .L80029274 -/* 029E58 80029258 2841FB07 */ slti $at, $v0, -0x4f9 -/* 029E5C 8002925C 14200005 */ bnez $at, .L80029274 -/* 029E60 80029260 240B0002 */ li $t3, 2 -/* 029E64 80029264 00056040 */ sll $t4, $a1, 1 -/* 029E68 80029268 008C6821 */ addu $t5, $a0, $t4 -/* 029E6C 8002926C A5AB024C */ sh $t3, 0x24c($t5) -/* 029E70 80029270 848200C4 */ lh $v0, 0xc4($a0) -.L80029274: -/* 029E74 80029274 2841FE95 */ slti $at, $v0, -0x16b -/* 029E78 80029278 10200007 */ beqz $at, .L80029298 -/* 029E7C 8002927C 2841FDDF */ slti $at, $v0, -0x221 -/* 029E80 80029280 14200005 */ bnez $at, .L80029298 -/* 029E84 80029284 240E0003 */ li $t6, 3 -/* 029E88 80029288 00057840 */ sll $t7, $a1, 1 -/* 029E8C 8002928C 008FC021 */ addu $t8, $a0, $t7 -/* 029E90 80029290 A70E024C */ sh $t6, 0x24c($t8) -/* 029E94 80029294 848200C4 */ lh $v0, 0xc4($a0) -.L80029298: -/* 029E98 80029298 2841016C */ slti $at, $v0, 0x16c -/* 029E9C 8002929C 10200007 */ beqz $at, .L800292BC -/* 029EA0 800292A0 2841FE95 */ slti $at, $v0, -0x16b -/* 029EA4 800292A4 14200005 */ bnez $at, .L800292BC -/* 029EA8 800292A8 24190004 */ li $t9, 4 -/* 029EAC 800292AC 00054840 */ sll $t1, $a1, 1 -/* 029EB0 800292B0 00894021 */ addu $t0, $a0, $t1 -/* 029EB4 800292B4 A519024C */ sh $t9, 0x24c($t0) -/* 029EB8 800292B8 848200C4 */ lh $v0, 0xc4($a0) -.L800292BC: -/* 029EBC 800292BC 2841016C */ slti $at, $v0, 0x16c -/* 029EC0 800292C0 14200008 */ bnez $at, .L800292E4 -/* 029EC4 800292C4 24080008 */ li $t0, 8 -/* 029EC8 800292C8 28410222 */ slti $at, $v0, 0x222 -/* 029ECC 800292CC 10200005 */ beqz $at, .L800292E4 -/* 029ED0 800292D0 240A0005 */ li $t2, 5 -/* 029ED4 800292D4 00056040 */ sll $t4, $a1, 1 -/* 029ED8 800292D8 008C5821 */ addu $t3, $a0, $t4 -/* 029EDC 800292DC A56A024C */ sh $t2, 0x24c($t3) -/* 029EE0 800292E0 848200C4 */ lh $v0, 0xc4($a0) -.L800292E4: -/* 029EE4 800292E4 28410222 */ slti $at, $v0, 0x222 -/* 029EE8 800292E8 14200008 */ bnez $at, .L8002930C -/* 029EEC 800292EC 00056040 */ sll $t4, $a1, 1 -/* 029EF0 800292F0 284104FA */ slti $at, $v0, 0x4fa -/* 029EF4 800292F4 10200005 */ beqz $at, .L8002930C -/* 029EF8 800292F8 240D0006 */ li $t5, 6 -/* 029EFC 800292FC 00057840 */ sll $t7, $a1, 1 -/* 029F00 80029300 008F7021 */ addu $t6, $a0, $t7 -/* 029F04 80029304 A5CD024C */ sh $t5, 0x24c($t6) -/* 029F08 80029308 848200C4 */ lh $v0, 0xc4($a0) -.L8002930C: -/* 029F0C 8002930C 284104FA */ slti $at, $v0, 0x4fa -/* 029F10 80029310 14200008 */ bnez $at, .L80029334 -/* 029F14 80029314 008C5021 */ addu $t2, $a0, $t4 -/* 029F18 80029318 2841071C */ slti $at, $v0, 0x71c -/* 029F1C 8002931C 10200005 */ beqz $at, .L80029334 -/* 029F20 80029320 24180007 */ li $t8, 7 -/* 029F24 80029324 00054840 */ sll $t1, $a1, 1 -/* 029F28 80029328 0089C821 */ addu $t9, $a0, $t1 -/* 029F2C 8002932C A738024C */ sh $t8, 0x24c($t9) -/* 029F30 80029330 848200C4 */ lh $v0, 0xc4($a0) -.L80029334: -/* 029F34 80029334 2841071C */ slti $at, $v0, 0x71c -/* 029F38 80029338 14200002 */ bnez $at, .L80029344 -/* 029F3C 8002933C 00000000 */ nop -/* 029F40 80029340 A548024C */ sh $t0, 0x24c($t2) -.L80029344: -/* 029F44 80029344 03E00008 */ jr $ra -/* 029F48 80029348 00000000 */ nop diff --git a/asm/non_matchings/code_80027D00/func_80031F48.s b/asm/non_matchings/code_80027D00/func_80031F48.s deleted file mode 100644 index 194075a22..000000000 --- a/asm/non_matchings/code_80027D00/func_80031F48.s +++ /dev/null @@ -1,72 +0,0 @@ -glabel func_80031F48 -/* 032B48 80031F48 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 032B4C 80031F4C AFBF0014 */ sw $ra, 0x14($sp) -/* 032B50 80031F50 AFA5001C */ sw $a1, 0x1c($sp) -/* 032B54 80031F54 0C009F40 */ jal get_player_index_for_player -/* 032B58 80031F58 AFA40018 */ sw $a0, 0x18($sp) -/* 032B5C 80031F5C 8FA40018 */ lw $a0, 0x18($sp) -/* 032B60 80031F60 C7A6001C */ lwc1 $f6, 0x1c($sp) -/* 032B64 80031F64 44800000 */ mtc1 $zero, $f0 -/* 032B68 80031F68 C484009C */ lwc1 $f4, 0x9c($a0) -/* 032B6C 80031F6C 00401825 */ move $v1, $v0 -/* 032B70 80031F70 00032E00 */ sll $a1, $v1, 0x18 -/* 032B74 80031F74 46062201 */ sub.s $f8, $f4, $f6 -/* 032B78 80031F78 00055603 */ sra $t2, $a1, 0x18 -/* 032B7C 80031F7C 01402825 */ move $a1, $t2 -/* 032B80 80031F80 E488009C */ swc1 $f8, 0x9c($a0) -/* 032B84 80031F84 C48A009C */ lwc1 $f10, 0x9c($a0) -/* 032B88 80031F88 4600503E */ c.le.s $f10, $f0 -/* 032B8C 80031F8C 00000000 */ nop -/* 032B90 80031F90 45020003 */ bc1fl .L80031FA0 -/* 032B94 80031F94 C4900094 */ lwc1 $f16, 0x94($a0) -/* 032B98 80031F98 E480009C */ swc1 $f0, 0x9c($a0) -/* 032B9C 80031F9C C4900094 */ lwc1 $f16, 0x94($a0) -.L80031FA0: -/* 032BA0 80031FA0 3C01800F */ lui $at, %hi(D_800EDAF8) -/* 032BA4 80031FA4 D424DAF8 */ ldc1 $f4, %lo(D_800EDAF8)($at) -/* 032BA8 80031FA8 460084A1 */ cvt.d.s $f18, $f16 -/* 032BAC 80031FAC 4624903C */ c.lt.d $f18, $f4 -/* 032BB0 80031FB0 00000000 */ nop -/* 032BB4 80031FB4 45020003 */ bc1fl .L80031FC4 -/* 032BB8 80031FB8 C4800214 */ lwc1 $f0, 0x214($a0) -/* 032BBC 80031FBC E480008C */ swc1 $f0, 0x8c($a0) -/* 032BC0 80031FC0 C4800214 */ lwc1 $f0, 0x214($a0) -.L80031FC4: -/* 032BC4 80031FC4 C486009C */ lwc1 $f6, 0x9c($a0) -/* 032BC8 80031FC8 4606003E */ c.le.s $f0, $f6 -/* 032BCC 80031FCC 00000000 */ nop -/* 032BD0 80031FD0 45020003 */ bc1fl .L80031FE0 -/* 032BD4 80031FD4 8C8E00BC */ lw $t6, 0xbc($a0) -/* 032BD8 80031FD8 E480009C */ swc1 $f0, 0x9c($a0) -/* 032BDC 80031FDC 8C8E00BC */ lw $t6, 0xbc($a0) -.L80031FE0: -/* 032BE0 80031FE0 24010008 */ li $at, 8 -/* 032BE4 80031FE4 31CF0008 */ andi $t7, $t6, 8 -/* 032BE8 80031FE8 51E10008 */ beql $t7, $at, .L8003200C -/* 032BEC 80031FEC 84980044 */ lh $t8, 0x44($a0) -/* 032BF0 80031FF0 C480009C */ lwc1 $f0, 0x9c($a0) -/* 032BF4 80031FF4 3C0141C8 */ li $at, 0x41C80000 # 25.000000 -/* 032BF8 80031FF8 44815000 */ mtc1 $at, $f10 -/* 032BFC 80031FFC 46000202 */ mul.s $f8, $f0, $f0 -/* 032C00 80032000 460A4403 */ div.s $f16, $f8, $f10 -/* 032C04 80032004 E490008C */ swc1 $f16, 0x8c($a0) -/* 032C08 80032008 84980044 */ lh $t8, 0x44($a0) -.L8003200C: -/* 032C0C 8003200C 8C88000C */ lw $t0, 0xc($a0) -/* 032C10 80032010 3319FFDF */ andi $t9, $t8, 0xffdf -/* 032C14 80032014 000848C0 */ sll $t1, $t0, 3 -/* 032C18 80032018 05210009 */ bgez $t1, .L80032040 -/* 032C1C 8003201C A4990044 */ sh $t9, 0x44($a0) -/* 032C20 80032020 0C023C41 */ jal func_8008F104 -/* 032C24 80032024 AFA40018 */ sw $a0, 0x18($sp) -/* 032C28 80032028 8FA40018 */ lw $a0, 0x18($sp) -/* 032C2C 8003202C 3C01EFFF */ lui $at, (0xEFFFFFFF >> 16) # lui $at, 0xefff -/* 032C30 80032030 3421FFFF */ ori $at, (0xEFFFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* 032C34 80032034 8C8B000C */ lw $t3, 0xc($a0) -/* 032C38 80032038 01616024 */ and $t4, $t3, $at -/* 032C3C 8003203C AC8C000C */ sw $t4, 0xc($a0) -.L80032040: -/* 032C40 80032040 8FBF0014 */ lw $ra, 0x14($sp) -/* 032C44 80032044 27BD0018 */ addiu $sp, $sp, 0x18 -/* 032C48 80032048 03E00008 */ jr $ra -/* 032C4C 8003204C 00000000 */ nop diff --git a/asm/non_matchings/code_80027D00/func_80032CB0.s b/asm/non_matchings/code_80027D00/func_80032CB0.s deleted file mode 100644 index 577a5b141..000000000 --- a/asm/non_matchings/code_80027D00/func_80032CB0.s +++ /dev/null @@ -1,62 +0,0 @@ -glabel func_80032CB0 -/* 0338B0 80032CB0 44856000 */ mtc1 $a1, $f12 -/* 0338B4 80032CB4 C484009C */ lwc1 $f4, 0x9c($a0) -/* 0338B8 80032CB8 44800000 */ mtc1 $zero, $f0 -/* 0338BC 80032CBC 460C2181 */ sub.s $f6, $f4, $f12 -/* 0338C0 80032CC0 E486009C */ swc1 $f6, 0x9c($a0) -/* 0338C4 80032CC4 C488009C */ lwc1 $f8, 0x9c($a0) -/* 0338C8 80032CC8 4600403E */ c.le.s $f8, $f0 -/* 0338CC 80032CCC 00000000 */ nop -/* 0338D0 80032CD0 45020003 */ bc1fl .L80032CE0 -/* 0338D4 80032CD4 C48A0094 */ lwc1 $f10, 0x94($a0) -/* 0338D8 80032CD8 E480009C */ swc1 $f0, 0x9c($a0) -/* 0338DC 80032CDC C48A0094 */ lwc1 $f10, 0x94($a0) -.L80032CE0: -/* 0338E0 80032CE0 3C01800F */ lui $at, %hi(D_800EDB98) -/* 0338E4 80032CE4 D432DB98 */ ldc1 $f18, %lo(D_800EDB98)($at) -/* 0338E8 80032CE8 46005421 */ cvt.d.s $f16, $f10 -/* 0338EC 80032CEC 3C01800F */ lui $at, %hi(D_800EDBA0) -/* 0338F0 80032CF0 4632803C */ c.lt.d $f16, $f18 -/* 0338F4 80032CF4 00000000 */ nop -/* 0338F8 80032CF8 45020003 */ bc1fl .L80032D08 -/* 0338FC 80032CFC C480009C */ lwc1 $f0, 0x9c($a0) -/* 033900 80032D00 E480008C */ swc1 $f0, 0x8c($a0) -/* 033904 80032D04 C480009C */ lwc1 $f0, 0x9c($a0) -.L80032D08: -/* 033908 80032D08 C4820214 */ lwc1 $f2, 0x214($a0) -/* 03390C 80032D0C 4600103E */ c.le.s $f2, $f0 -/* 033910 80032D10 00000000 */ nop -/* 033914 80032D14 45000003 */ bc1f .L80032D24 -/* 033918 80032D18 00000000 */ nop -/* 03391C 80032D1C E482009C */ swc1 $f2, 0x9c($a0) -/* 033920 80032D20 C480009C */ lwc1 $f0, 0x9c($a0) -.L80032D24: -/* 033924 80032D24 D426DBA0 */ ldc1 $f6, %lo(D_800EDBA0)($at) -/* 033928 80032D28 46001121 */ cvt.d.s $f4, $f2 -/* 03392C 80032D2C 460002A1 */ cvt.d.s $f10, $f0 -/* 033930 80032D30 46262202 */ mul.d $f8, $f4, $f6 -/* 033934 80032D34 3C01EFFF */ lui $at, (0xEFFFFFFF >> 16) # lui $at, 0xefff -/* 033938 80032D38 4628503E */ c.le.d $f10, $f8 -/* 03393C 80032D3C 00000000 */ nop -/* 033940 80032D40 45020007 */ bc1fl .L80032D60 -/* 033944 80032D44 8C98000C */ lw $t8, 0xc($a0) -/* 033948 80032D48 8C8E000C */ lw $t6, 0xc($a0) -/* 03394C 80032D4C 3421FFFF */ ori $at, (0xEFFFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* 033950 80032D50 C480009C */ lwc1 $f0, 0x9c($a0) -/* 033954 80032D54 01C17824 */ and $t7, $t6, $at -/* 033958 80032D58 AC8F000C */ sw $t7, 0xc($a0) -/* 03395C 80032D5C 8C98000C */ lw $t8, 0xc($a0) -.L80032D60: -/* 033960 80032D60 46000402 */ mul.s $f16, $f0, $f0 -/* 033964 80032D64 3C01FDFF */ lui $at, (0xFDFFFFFF >> 16) # lui $at, 0xfdff -/* 033968 80032D68 3421FFFF */ ori $at, (0xFDFFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* 03396C 80032D6C 0301C824 */ and $t9, $t8, $at -/* 033970 80032D70 3C0141C8 */ li $at, 0x41C80000 # 25.000000 -/* 033974 80032D74 44819000 */ mtc1 $at, $f18 -/* 033978 80032D78 84880044 */ lh $t0, 0x44($a0) -/* 03397C 80032D7C AC99000C */ sw $t9, 0xc($a0) -/* 033980 80032D80 46128103 */ div.s $f4, $f16, $f18 -/* 033984 80032D84 3109FFDF */ andi $t1, $t0, 0xffdf -/* 033988 80032D88 A4890044 */ sh $t1, 0x44($a0) -/* 03398C 80032D8C 03E00008 */ jr $ra -/* 033990 80032D90 E4840098 */ swc1 $f4, 0x98($a0) diff --git a/asm/non_matchings/code_80027D00/func_80033280.s b/asm/non_matchings/code_80027D00/func_80033280.s deleted file mode 100644 index b04b7fbb5..000000000 --- a/asm/non_matchings/code_80027D00/func_80033280.s +++ /dev/null @@ -1,29 +0,0 @@ -glabel func_80033280 -/* 033E80 80033280 44856000 */ mtc1 $a1, $f12 -/* 033E84 80033284 C484009C */ lwc1 $f4, 0x9c($a0) -/* 033E88 80033288 44801000 */ mtc1 $zero, $f2 -/* 033E8C 8003328C 460C2181 */ sub.s $f6, $f4, $f12 -/* 033E90 80033290 E486009C */ swc1 $f6, 0x9c($a0) -/* 033E94 80033294 C480009C */ lwc1 $f0, 0x9c($a0) -/* 033E98 80033298 4602003E */ c.le.s $f0, $f2 -/* 033E9C 8003329C 00000000 */ nop -/* 033EA0 800332A0 45020004 */ bc1fl .L800332B4 -/* 033EA4 800332A4 C4820214 */ lwc1 $f2, 0x214($a0) -/* 033EA8 800332A8 E482009C */ swc1 $f2, 0x9c($a0) -/* 033EAC 800332AC C480009C */ lwc1 $f0, 0x9c($a0) -/* 033EB0 800332B0 C4820214 */ lwc1 $f2, 0x214($a0) -.L800332B4: -/* 033EB4 800332B4 4600103E */ c.le.s $f2, $f0 -/* 033EB8 800332B8 00000000 */ nop -/* 033EBC 800332BC 45000003 */ bc1f .L800332CC -/* 033EC0 800332C0 00000000 */ nop -/* 033EC4 800332C4 E482009C */ swc1 $f2, 0x9c($a0) -/* 033EC8 800332C8 C480009C */ lwc1 $f0, 0x9c($a0) -.L800332CC: -/* 033ECC 800332CC 46000202 */ mul.s $f8, $f0, $f0 -/* 033ED0 800332D0 3C0141C8 */ li $at, 0x41C80000 # 25.000000 -/* 033ED4 800332D4 44815000 */ mtc1 $at, $f10 -/* 033ED8 800332D8 00000000 */ nop -/* 033EDC 800332DC 460A4403 */ div.s $f16, $f8, $f10 -/* 033EE0 800332E0 03E00008 */ jr $ra -/* 033EE4 800332E4 E4900098 */ swc1 $f16, 0x98($a0) diff --git a/asm/non_matchings/code_80027D00/func_80036C5C.s b/asm/non_matchings/code_80027D00/func_80036C5C.s deleted file mode 100644 index bef9ecfdb..000000000 --- a/asm/non_matchings/code_80027D00/func_80036C5C.s +++ /dev/null @@ -1,24 +0,0 @@ -glabel func_80036C5C -/* 03785C 80036C5C 3C0141A0 */ li $at, 0x41A00000 # 20.000000 -/* 037860 80036C60 44812000 */ mtc1 $at, $f4 -/* 037864 80036C64 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 037868 80036C68 44814000 */ mtc1 $at, $f8 -/* 03786C 80036C6C C4860094 */ lwc1 $f6, 0x94($a0) -/* 037870 80036C70 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 037874 80036C74 44818000 */ mtc1 $at, $f16 -/* 037878 80036C78 46083283 */ div.s $f10, $f6, $f8 -/* 03787C 80036C7C 46105482 */ mul.s $f18, $f10, $f16 -/* 037880 80036C80 4612203C */ c.lt.s $f4, $f18 -/* 037884 80036C84 00000000 */ nop -/* 037888 80036C88 45000008 */ bc1f .L80036CAC -/* 03788C 80036C8C 00000000 */ nop -/* 037890 80036C90 8C8E00BC */ lw $t6, 0xbc($a0) -/* 037894 80036C94 949800B6 */ lhu $t8, 0xb6($a0) -/* 037898 80036C98 A4800204 */ sh $zero, 0x204($a0) -/* 03789C 80036C9C 35CF0010 */ ori $t7, $t6, 0x10 -/* 0378A0 80036CA0 37190800 */ ori $t9, $t8, 0x800 -/* 0378A4 80036CA4 AC8F00BC */ sw $t7, 0xbc($a0) -/* 0378A8 80036CA8 A49900B6 */ sh $t9, 0xb6($a0) -.L80036CAC: -/* 0378AC 80036CAC 03E00008 */ jr $ra -/* 0378B0 80036CB0 00000000 */ nop diff --git a/asm/non_matchings/code_80027D00/func_80038BE4.s b/asm/non_matchings/code_80027D00/func_80038BE4.s deleted file mode 100644 index b9864b478..000000000 --- a/asm/non_matchings/code_80027D00/func_80038BE4.s +++ /dev/null @@ -1,37 +0,0 @@ -glabel func_80038BE4 -/* 0397E4 80038BE4 AFA50004 */ sw $a1, 4($sp) -/* 0397E8 80038BE8 00057400 */ sll $t6, $a1, 0x10 -/* 0397EC 80038BEC 000E2C03 */ sra $a1, $t6, 0x10 -/* 0397F0 80038BF0 44853000 */ mtc1 $a1, $f6 -/* 0397F4 80038BF4 C484009C */ lwc1 $f4, 0x9c($a0) -/* 0397F8 80038BF8 44801000 */ mtc1 $zero, $f2 -/* 0397FC 80038BFC 46803220 */ cvt.s.w $f8, $f6 -/* 039800 80038C00 3C01437A */ li $at, 0x437A0000 # 250.000000 -/* 039804 80038C04 46082280 */ add.s $f10, $f4, $f8 -/* 039808 80038C08 E48A009C */ swc1 $f10, 0x9c($a0) -/* 03980C 80038C0C C480009C */ lwc1 $f0, 0x9c($a0) -/* 039810 80038C10 4602003C */ c.lt.s $f0, $f2 -/* 039814 80038C14 00000000 */ nop -/* 039818 80038C18 45020004 */ bc1fl .L80038C2C -/* 03981C 80038C1C 44811000 */ mtc1 $at, $f2 -/* 039820 80038C20 E482009C */ swc1 $f2, 0x9c($a0) -/* 039824 80038C24 C480009C */ lwc1 $f0, 0x9c($a0) -/* 039828 80038C28 44811000 */ mtc1 $at, $f2 -.L80038C2C: -/* 03982C 80038C2C 00000000 */ nop -/* 039830 80038C30 4600103E */ c.le.s $f2, $f0 -/* 039834 80038C34 00000000 */ nop -/* 039838 80038C38 45000003 */ bc1f .L80038C48 -/* 03983C 80038C3C 00000000 */ nop -/* 039840 80038C40 E482009C */ swc1 $f2, 0x9c($a0) -/* 039844 80038C44 C480009C */ lwc1 $f0, 0x9c($a0) -.L80038C48: -/* 039848 80038C48 46000402 */ mul.s $f16, $f0, $f0 -/* 03984C 80038C4C 3C0141C8 */ li $at, 0x41C80000 # 25.000000 -/* 039850 80038C50 44819000 */ mtc1 $at, $f18 -/* 039854 80038C54 84980044 */ lh $t8, 0x44($a0) -/* 039858 80038C58 37190020 */ ori $t9, $t8, 0x20 -/* 03985C 80038C5C 46128183 */ div.s $f6, $f16, $f18 -/* 039860 80038C60 A4990044 */ sh $t9, 0x44($a0) -/* 039864 80038C64 03E00008 */ jr $ra -/* 039868 80038C68 E486008C */ swc1 $f6, 0x8c($a0) diff --git a/src/code_80027D00.c b/src/code_80027D00.c index 5c602f2de..1282c87ec 100644 --- a/src/code_80027D00.c +++ b/src/code_80027D00.c @@ -803,17 +803,35 @@ void func_800291F8(void) { } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80029200(Player *arg0, s8 arg1) { - s32 i; - for (i = 0; i < 8; i++) { - arg0->unk_24C[arg1] = i; +void func_80029200(Player *player, s8 arg1) { + if ((s32) player->unk_0C4 < -0x71B) { + player->unk_24C[arg1] = 0; + } + if (((s32) player->unk_0C4 < -0x4F9) && ((s32) player->unk_0C4 >= -0x71B)) { + player->unk_24C[arg1] = 1; + } + if ((player->unk_0C4 < -0x221) && (player->unk_0C4 >= -0x4F9)) { + player->unk_24C[arg1] = 2; + } + if ((player->unk_0C4 < -0x16B) && (player->unk_0C4 >= -0x221)) { + player->unk_24C[arg1] = 3; + } + if ((player->unk_0C4 < 0x16C) && (player->unk_0C4 >= -0x16B)) { + player->unk_24C[arg1] = 4; + } + if ((player->unk_0C4 >= 0x16C) && (player->unk_0C4 < 0x222)) { + player->unk_24C[arg1] = 5; + } + if ((player->unk_0C4 >= 0x222) && (player->unk_0C4 < 0x4FA)) { + player->unk_24C[arg1] = 6; + } + if ((player->unk_0C4 >= 0x4FA) && (player->unk_0C4 < 0x71C)) { + player->unk_24C[arg1] = 7; + } + if (player->unk_0C4 >= 0x71C) { + player->unk_24C[arg1] = 8; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80029200.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -2280,15 +2298,16 @@ void func_8002C11C(Player *player) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_802ABDF4(u16, s8, void *); // extern +//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf +s32 func_802ABDF4(u16, s8, Player *); /* extern */ extern ? D_80164438; extern ? D_801645B0; extern ? D_80165310; extern ? D_80165320; extern ? D_80165330; +s16 gCurrentCourseId; /* unable to generate initializer */ -void func_8002C17C(void *arg0, s8 arg1) { +void func_8002C17C(Player *player, s8 arg1) { s16 *sp1C; s16 *temp_v1; s16 *temp_v1_2; @@ -2297,7 +2316,7 @@ void func_8002C17C(void *arg0, s8 arg1) { s16 *temp_v1_5; s16 *temp_v1_6; s16 temp_v0; - s32 temp_a0; + s32 temp_a0_2; s32 temp_a3; s32 temp_v0_2; s32 temp_v0_3; @@ -2307,92 +2326,101 @@ void func_8002C17C(void *arg0, s8 arg1) { s32 temp_v0_7; s32 temp_v0_8; s32 temp_v0_9; - u16 temp_a0_2; + u16 temp_a0; temp_v0 = gCurrentCourseId; - if (temp_v0 != 4) { - if (temp_v0 != 5) { - if (temp_v0 != 7) { - if (temp_v0 != 0xD) { - *(&D_80165330 + (arg1 * 2)) = 0; - // Duplicate return node #33. Try simplifying control flow for better match - return; - } - temp_v0_2 = arg1 * 2; - temp_v1 = temp_v0_2 + &D_80165330; - if ((arg0->unk124 >= 600.0f) && (*temp_v1 == 0)) { - *temp_v1 = 1; - *(&D_80165320 + temp_v0_2) = *(&D_80164438 + temp_v0_2); - *(&D_80165310 + temp_v0_2) = *(&D_801645B0 + temp_v0_2); - return; - } - temp_v0_3 = arg1 * 2; - temp_v1_2 = temp_v0_3 + &D_80165330; - if (*temp_v1_2 == 0) { - *(&D_80165320 + temp_v0_3) = *(&D_80164438 + temp_v0_3); - *(&D_80165310 + temp_v0_3) = *(&D_801645B0 + temp_v0_3); - return; - } - if (((arg0->unkBC & 8) == 0) && ((arg0->unkCA & 1) == 0)) { - *temp_v1_2 = 0; - return; - } - // Duplicate return node #33. Try simplifying control flow for better match + switch (temp_v0) { /* irregular */ + case 4: + temp_v0_2 = arg1 * 2; + temp_v1 = temp_v0_2 + &D_80165330; + if ((player->unk_124 >= 600.0f) && (*temp_v1 == 0)) { + *temp_v1 = 1; + *(&D_80165320 + temp_v0_2) = *(&D_80164438 + temp_v0_2); + *(&D_80165310 + temp_v0_2) = *(&D_801645B0 + temp_v0_2); + return; + } + temp_v0_3 = arg1 * 2; + temp_v1_2 = temp_v0_3 + &D_80165330; + if (*temp_v1_2 == 0) { + *(&D_80165320 + temp_v0_3) = *(&D_80164438 + temp_v0_3); + *(&D_80165310 + temp_v0_3) = *(&D_801645B0 + temp_v0_3); + return; + } + if ((player->unk_0BC & 8) == 0) { + sp1C = temp_v1_2; + if (func_802ABDF4((u16) player->unk_11A, arg1, player) == 0) { + *temp_v1_2 = 0; return; } - temp_a0 = arg0->unkBC; - temp_v0_4 = arg1 * 2; - temp_a3 = temp_a0 & 0x100000; - if ((temp_a3 != 0) && (temp_v1_3 = temp_v0_4 + &D_80165330, (*temp_v1_3 == 0))) { + } + return; + case 5: + temp_a0 = player->unkF8; + temp_v0_4 = arg1 * 2; + if (temp_a0 == 0xB) { + temp_v1_3 = temp_v0_4 + &D_80165330; + if (*temp_v1_3 == 0) { *temp_v1_3 = 1; *(&D_80165320 + temp_v0_4) = *(&D_80164438 + temp_v0_4); *(&D_80165310 + temp_v0_4) = *(&D_801645B0 + temp_v0_4); return; } - if ((temp_a3 == 0) && (temp_v0_5 = arg1 * 2, ((temp_a0 & 8) == 0))) { - *(&D_80165330 + temp_v0_5) = 0; - *(&D_80165320 + temp_v0_5) = *(&D_80164438 + temp_v0_5); - *(&D_80165310 + temp_v0_5) = *(&D_801645B0 + temp_v0_5); + } + temp_v0_5 = arg1 * 2; + if (temp_a0 != 0xB) { + *(&D_80165330 + temp_v0_5) = 0; + *(&D_80165320 + temp_v0_5) = *(&D_80164438 + temp_v0_5); + *(&D_80165310 + temp_v0_5) = *(&D_801645B0 + temp_v0_5); + return; + } + break; + case 7: + temp_a0_2 = player->unk_0BC; + temp_v0_6 = arg1 * 2; + temp_a3 = temp_a0_2 & 0x100000; + if (temp_a3 != 0) { + temp_v1_4 = temp_v0_6 + &D_80165330; + if (*temp_v1_4 == 0) { + *temp_v1_4 = 1; + *(&D_80165320 + temp_v0_6) = *(&D_80164438 + temp_v0_6); + *(&D_80165310 + temp_v0_6) = *(&D_801645B0 + temp_v0_6); return; } - // Duplicate return node #33. Try simplifying control flow for better match + } + if (temp_a3 == 0) { + temp_v0_7 = arg1 * 2; + if ((temp_a0_2 & 8) == 0) { + *(&D_80165330 + temp_v0_7) = 0; + *(&D_80165320 + temp_v0_7) = *(&D_80164438 + temp_v0_7); + *(&D_80165310 + temp_v0_7) = *(&D_801645B0 + temp_v0_7); + return; + } + } + break; + case 13: + temp_v0_8 = arg1 * 2; + temp_v1_5 = temp_v0_8 + &D_80165330; + if ((player->unk_124 >= 600.0f) && (*temp_v1_5 == 0)) { + *temp_v1_5 = 1; + *(&D_80165320 + temp_v0_8) = *(&D_80164438 + temp_v0_8); + *(&D_80165310 + temp_v0_8) = *(&D_801645B0 + temp_v0_8); return; } - temp_a0_2 = arg0->unkF8; - temp_v0_6 = arg1 * 2; - if ((temp_a0_2 == 0xB) && (temp_v1_4 = temp_v0_6 + &D_80165330, (*temp_v1_4 == 0))) { - *temp_v1_4 = 1; - *(&D_80165320 + temp_v0_6) = *(&D_80164438 + temp_v0_6); - *(&D_80165310 + temp_v0_6) = *(&D_801645B0 + temp_v0_6); + temp_v0_9 = arg1 * 2; + temp_v1_6 = temp_v0_9 + &D_80165330; + if (*temp_v1_6 == 0) { + *(&D_80165320 + temp_v0_9) = *(&D_80164438 + temp_v0_9); + *(&D_80165310 + temp_v0_9) = *(&D_801645B0 + temp_v0_9); return; } - temp_v0_7 = arg1 * 2; - if (temp_a0_2 != 0xB) { - *(&D_80165330 + temp_v0_7) = 0; - *(&D_80165320 + temp_v0_7) = *(&D_80164438 + temp_v0_7); - *(&D_80165310 + temp_v0_7) = *(&D_801645B0 + temp_v0_7); + if (((player->unk_0BC & 8) == 0) && ((player->unk_0CA & 1) == 0)) { + *temp_v1_6 = 0; return; } - // Duplicate return node #33. Try simplifying control flow for better match - return; - } - temp_v0_8 = arg1 * 2; - temp_v1_5 = temp_v0_8 + &D_80165330; - if ((arg0->unk124 >= 600.0f) && (*temp_v1_5 == 0)) { - *temp_v1_5 = 1; - *(&D_80165320 + temp_v0_8) = *(&D_80164438 + temp_v0_8); - *(&D_80165310 + temp_v0_8) = *(&D_801645B0 + temp_v0_8); - return; - } - temp_v0_9 = arg1 * 2; - temp_v1_6 = temp_v0_9 + &D_80165330; - if (*temp_v1_6 == 0) { - *(&D_80165320 + temp_v0_9) = *(&D_80164438 + temp_v0_9); - *(&D_80165310 + temp_v0_9) = *(&D_801645B0 + temp_v0_9); - return; - } - if (((arg0->unkBC & 8) == 0) && (sp1C = temp_v1_6, (func_802ABDF4(arg0->unk11A, arg1, arg0) == 0))) { - *temp_v1_6 = 0; + break; + default: + *(&D_80165330 + (arg1 * 2)) = 0; + break; } } #else @@ -4848,45 +4876,29 @@ void func_80030FC8(Player *player) { } } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s8 get_player_index_for_player(); // extern -? func_8008F104(void *, s8); // extern -extern f64 D_800EDAF8; +void func_80031F48(Player *player, f32 arg1) { + s32 player_index; + player_index = get_player_index_for_player(player); -void func_80031F48(void *arg0, f32 arg1) { - f32 temp_f0; - f32 temp_f0_2; - s8 temp_a1; - void *temp_a0; - - temp_a0 = arg0; - temp_a1 = get_player_index_for_player(); - temp_a0->unk9C = temp_a0->unk9C - arg1; - if (temp_a0->unk9C <= 0.0f) { - temp_a0->unk9C = 0.0f; + player->unk_09C -= arg1; + if (player->unk_09C <= 0.0f) { + player->unk_09C = 0.0f; } - if (temp_a0->unk94 < D_800EDAF8) { - temp_a0->unk8C = 0.0f; + if (player->unk_094 < D_800EDAF8) { + player->unk_08C = 0.0f; } - temp_f0 = temp_a0->unk214; - if (temp_f0 <= temp_a0->unk9C) { - temp_a0->unk9C = temp_f0; + if (player->unk_214 <= player->unk_09C) { + player->unk_09C = player->unk_214; } - if ((temp_a0->unkBC & 8) != 8) { - temp_f0_2 = temp_a0->unk9C; - temp_a0->unk8C = (temp_f0_2 * temp_f0_2) / 25.0f; + if ((player->unk_0BC & 8) != 8) { + player->unk_08C = (player->unk_09C * player->unk_09C) / 25.0f; } - temp_a0->unk44 = temp_a0->unk44 & 0xFFDF; - if ((temp_a0->unkC * 8) < 0) { - arg0 = temp_a0; - func_8008F104(temp_a0, temp_a1); - arg0->unkC = arg0->unkC & 0xEFFFFFFF; + player->unk_044 &= 0xFFDF; + if ((player->unk_00C * 8) < 0) { + func_8008F104(player, player_index); + player->unk_00C &= 0xEFFFFFFF; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80031F48.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -5302,38 +5314,24 @@ void func_80032700(void *arg0) { GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80032700.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f64 D_800EDB98; -extern f64 D_800EDBA0; - -void func_80032CB0(void *arg0, f32 arg1) { - f32 temp_f2; - f32 phi_f0; - - arg0->unk9C = arg0->unk9C - arg1; - if (arg0->unk9C <= 0.0f) { - arg0->unk9C = 0.0f; +void func_80032CB0(Player *player, f32 arg1) { + player->unk_09C -= arg1; + if (player->unk_09C <= 0.0f) { + player->unk_09C = 0.0f; } - if (arg0->unk94 < D_800EDB98) { - arg0->unk8C = 0.0f; + if (player->unk_094 < D_800EDB98) { + player->unk_08C = 0.0f; } - temp_f2 = arg0->unk214; - if (temp_f2 <= arg0->unk9C) { - arg0->unk9C = temp_f2; + if (player->unk_214 <= player->unk_09C) { + player->unk_09C = player->unk_214; } - phi_f0 = arg0->unk9C; - if (arg0->unk9C <= (temp_f2 * D_800EDBA0)) { - arg0->unkC = arg0->unkC & 0xEFFFFFFF; - phi_f0 = arg0->unk9C; + if ((f64) player->unk_09C <= (player->unk_214 * D_800EDBA0)) { + player->unk_00C &= 0xEFFFFFFF; } - arg0->unkC = arg0->unkC & 0xFDFFFFFF; - arg0->unk44 = arg0->unk44 & 0xFFDF; - arg0->unk98 = (phi_f0 * phi_f0) / 25.0f; + player->unk_00C &= 0xFDFFFFFF; + player->unk_044 &= 0xFFDF; + player->unk_098 = (player->unk_09C * player->unk_09C) / 25.0f; } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80032CB0.s") -#endif void func_80032D94(Player *player) { f64 some_multiplier; @@ -5382,27 +5380,16 @@ void func_80032D94(Player *player) { player->unk_098 = (player->unk_09C * player->unk_09C) / 25.0f; } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80033280(void *arg0, f32 arg1) { - f32 temp_f2; - f32 phi_f0; - - arg0->unk9C = arg0->unk9C - arg1; - if (arg0->unk9C <= 0.0f) { - arg0->unk9C = 0.0f; +void func_80033280(Player *player, f32 arg1) { + player->unk_09C -= arg1; + if (player->unk_09C <= 0.0f) { + player->unk_09C = 0.0f; } - temp_f2 = arg0->unk214; - phi_f0 = arg0->unk9C; - if (temp_f2 <= arg0->unk9C) { - arg0->unk9C = temp_f2; - phi_f0 = arg0->unk9C; + if (player->unk_214 <= player->unk_09C) { + player->unk_09C = player->unk_214; } - arg0->unk98 = (phi_f0 * phi_f0) / 25.0f; + player->unk_098 = (player->unk_09C * player->unk_09C) / 25.0f; } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80033280.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -6433,18 +6420,13 @@ void func_8003680C(void *arg0, s16 arg1) { GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8003680C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80036C5C(void *arg0) { - if (((arg0->unk94 / 18.0f) * 216.0f) > 20.0f) { - arg0->unk204 = 0; - arg0->unkBC = arg0->unkBC | 0x10; - arg0->unkB6 = arg0->unkB6 | 0x800; +void func_80036C5C(Player *arg0) { + if (((arg0->unk_094 / 18.0f) * 216.0f) > 20.0f) { + arg0->unk_204 = 0; + arg0->unk_0BC |= 0x10; + arg0->unk_0B6 |= 0x800; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80036C5C.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -6946,22 +6928,22 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80037BB4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8002AA50(void *, s32, s32); // extern -? func_80030C34(void *); // extern -? func_80030E00(void *); // extern -? func_80030FC8(void *, s32, s32); // extern -? func_80031F48(void *, ?, s32, s32); // extern -? func_80032050(void *); // extern -? func_8003221C(void *); // extern -? func_800323E4(void *); // extern -? func_800332E8(void *, s8); // extern -? func_800337CC(void *, ?, s8); // extern -? func_80033AE0(void *, void *, s8); // extern -s32 func_800388B0(void *); // extern -? func_800C9060(u8, ?); // extern +//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf +? func_8002AA50(Player *, s32, s32); /* extern */ +? func_80030C34(Player *); /* extern */ +? func_80030E00(Player *); /* extern */ +? func_80030FC8(Player *, s32, s32); /* extern */ +? func_80031F48(Player *, ?, s32, s32); /* extern */ +? func_80032050(Player *); /* extern */ +? func_8003221C(Player *); /* extern */ +? func_800323E4(Player *); /* extern */ +? func_800332E8(Player *, s8); /* extern */ +? func_800337CC(Player *, ?, s8); /* extern */ +? func_80033AE0(Player *, struct Controller *, s8); /* extern */ +s32 func_800388B0(struct Controller *); /* extern */ +? func_800C9060(u8, ?); /* extern */ -void func_80037CFC(void *arg0, void *arg1, u8 arg2) { +void func_80037CFC(Player *arg0, struct Controller *arg1, u8 arg2) { s16 temp_v0_5; s32 temp_t0; s32 temp_t4; @@ -6978,110 +6960,105 @@ void func_80037CFC(void *arg0, void *arg1, u8 arg2) { s32 phi_a2; s32 phi_a3; - temp_v0 = arg0->unkBC; + temp_v0 = arg0->unk_0BC; temp_v1 = temp_v0 & 0x80; phi_v1 = temp_v1; phi_v0_2 = temp_v0; - if ((temp_v1 != 0x80) && ((temp_v0 & 0x40) != 0x40) && ((temp_v0 & 0x400) != 0x400) && ((temp_v0 & 0x4000) != 0x4000) && ((temp_v0 & 0x1000000) != 0x1000000) && ((temp_v0 & 0x2000000) != 0x2000000) && ((temp_v0 & 0x10000) != 0x10000) && ((temp_v0 & 0x20000) != 0x20000)) { - if (((temp_v0 & 0x4000000) != 0x4000000) && ((temp_v0 & 8) != 8) && ((temp_v0 & 2) != 2) && ((temp_v0 & 0x10) != 0x10) && ((arg1->unk6 & 0x10) != 0)) { - func_8002AA50(arg0, 0x1000000, 0x2000000); - temp_v0_2 = arg0->unk0; + if ((temp_v1 != 0x80) && ((temp_v0 & 0x40) != 0x40) && ((temp_v0 & 0x400) != 0x400) && ((temp_v0 & 0x4000) != 0x4000) && ((temp_v0 & 0x01000000) != 0x01000000) && ((temp_v0 & 0x02000000) != 0x02000000) && ((temp_v0 & 0x10000) != 0x10000) && ((temp_v0 & 0x20000) != 0x20000)) { + if (((temp_v0 & 0x04000000) != 0x04000000) && ((temp_v0 & 8) != 8) && ((temp_v0 & 2) != 2) && ((temp_v0 & 0x10) != 0x10) && ((arg1->buttonPressed & 0x10) != 0)) { + func_8002AA50(arg0, 0x01000000, 0x02000000); + temp_v0_2 = arg0->unk_000; if (((temp_v0_2 & 0x4000) == 0x4000) && ((temp_v0_2 & 0x100) != 0x100)) { func_800C9060(arg2, 0x19008000); } } - temp_v0_3 = arg0->unkBC; + temp_v0_3 = arg0->unk_0BC; if ((temp_v0_3 & 8) != 8) { - func_80033AE0(arg0, arg1, arg2); - goto block_21; + func_80033AE0(arg0, arg1, (s8) arg2); + } else if (((temp_v0_3 & 2) == 2) && (arg0->unk_124 <= 5.0f)) { + func_80033AE0(arg0, arg1, (s8) arg2); } - if (((temp_v0_3 & 2) == 2) && (arg0->unk124 <= 5.0f)) { - func_80033AE0(arg0, arg1, arg2); -block_21: - } - temp_t4 = arg0->unkBC & ~1; - arg0->unkBC = temp_t4; + temp_t4 = arg0->unk_0BC & ~1; + arg0->unk_0BC = temp_t4; phi_v0 = temp_t4; if (((temp_t4 << 0xB) >= 0) && ((temp_t4 & 4) == 0)) { - if (((arg0->unk94 / 18.0f) * 216.0f) <= 12.0f) { - temp_v1_2 = arg1->unk4; + if (((arg0->unk_094 / 18.0f) * 216.0f) <= 12.0f) { + temp_v1_2 = arg1->button; if ((temp_v1_2 & 0x8000) != 0) { temp_t0 = temp_t4 | 0x20; if ((temp_v1_2 & 0x4000) != 0) { - arg0->unkBC = temp_t0; + arg0->unk_0BC = temp_t0; phi_v0 = temp_t0; if ((temp_t0 & 0x20) != 0x20) { - arg0->unk9C = arg0->unk9C + 100.0f; + arg0->unk_09C += 100.0f; phi_v0 = temp_t0; } } } } - if (((phi_v0 & 0x20) == 0x20) && ((temp_v1_3 = arg1->unk4, ((temp_v1_3 & 0x4000) == 0)) || ((temp_v1_3 & 0x8000) == 0))) { - arg0->unkBC = phi_v0 & ~0x20; + if (((phi_v0 & 0x20) == 0x20) && ((temp_v1_3 = arg1->button, ((temp_v1_3 & 0x4000) == 0)) || ((temp_v1_3 & 0x8000) == 0))) { + arg0->unk_0BC = phi_v0 & ~0x20; } } - if ((arg0->unk44 & 1) != 1) { - if ((arg1->unk4 & 0x8000) != 0) { + if ((arg0->unk_044 & 1) != 1) { + if ((arg1->button & 0x8000) != 0) { func_80030FC8(arg0); func_80030E00(arg0); } else { - if (gModeSelection == BATTLE) { + if (gModeSelection == 3) { func_80031F48(arg0, 0x40000000); } else { func_80031F48(arg0, 0x3F800000); } func_80030C34(arg0); } - if ((arg1->unk4 & 0x4000) != 0) { + if ((arg1->button & 0x4000) != 0) { func_800323E4(arg0); func_8003221C(arg0); } else { - arg0->unk20C = 0.0f; + arg0->unk_20C = 0.0f; func_80032050(arg0); } } - temp_v0_4 = arg0->unkBC; + temp_v0_4 = arg0->unk_0BC; if (((temp_v0_4 << 0xB) >= 0) && ((temp_v0_4 & 4) == 0)) { - if ((func_800388B0(arg1) < -0x31) && (((arg0->unk94 / 18.0f) * 216.0f) <= 5.0f) && ((arg1->unk4 & 0x4000) != 0)) { - arg0->unk9C = 140.0f; - arg0->unk44 = arg0->unk44 | 1; - arg0->unk20C = 0.0f; - arg0->unk8C = (140.0f * 140.0f) / 25.0f; + if ((func_800388B0(arg1) < -0x31) && (((arg0->unk_094 / 18.0f) * 216.0f) <= 5.0f) && ((arg1->button & 0x4000) != 0)) { + arg0->unk_09C = 140.0f; + arg0->unk_044 |= 1; + arg0->unk_20C = 0.0f; + arg0->unk_08C = (140.0f * 140.0f) / 25.0f; } - if (((func_800388B0(arg1) >= -0x1D) || ((arg1->unk4 & 0x4000) == 0)) && (temp_v0_5 = arg0->unk44, ((temp_v0_5 & 1) == 1))) { - arg0->unk44 = temp_v0_5 & 0xFFFE; - arg0->unk9C = 0.0f; + if ((func_800388B0(arg1) >= -0x1D) || ((arg1->button & 0x4000) == 0)) { + temp_v0_5 = arg0->unk_044; + if ((temp_v0_5 & 1) == 1) { + arg0->unk_044 = temp_v0_5 & 0xFFFE; + arg0->unk_09C = 0.0f; + } + } + } + } else { + phi_a2 = 0x01000000; + phi_a3 = 0x02000000; + if ((temp_v0 & 0x4000) == 0x4000) { + if ((arg1->button & 0x8000) != 0) { + func_80030FC8(arg0, 0x01000000, 0x02000000); + } else { + func_80031F48(arg0, 0x40A00000, 0x01000000, 0x02000000); + } + phi_v1 = arg0->unk_0BC & 0x80; + phi_v0_2 = arg0->unk_0BC; + phi_a2 = 0x01000000; + phi_a3 = 0x02000000; + } + if ((phi_v1 == 0x80) || ((phi_v0_2 & 0x40) == 0x40) || (phi_a2 == (phi_v0_2 & phi_a2)) || (phi_a3 == (phi_v0_2 & phi_a3))) { + if ((arg1->button & 0x8000) != 0) { + func_80030E00(arg0); + func_800332E8(arg0, (s8) arg2); return; } - // Duplicate return node #65. Try simplifying control flow for better match - return; + func_80030C34(arg0); + func_800337CC(arg0, 0x40A00000, (s8) arg2); } - // Duplicate return node #65. Try simplifying control flow for better match - return; - } - phi_a2 = 0x1000000; - phi_a3 = 0x2000000; - if ((temp_v0 & 0x4000) == 0x4000) { - if ((arg1->unk4 & 0x8000) != 0) { - func_80030FC8(arg0, 0x1000000, 0x2000000); - } else { - func_80031F48(arg0, 0x40A00000, 0x1000000, 0x2000000); - } - phi_v1 = arg0->unkBC & 0x80; - phi_v0_2 = arg0->unkBC; - phi_a2 = 0x1000000; - phi_a3 = 0x2000000; - } - if ((phi_v1 == 0x80) || ((phi_v0_2 & 0x40) == 0x40) || (phi_a2 == (phi_v0_2 & phi_a2)) || (phi_a3 == (phi_v0_2 & phi_a3))) { - if ((arg1->unk4 & 0x8000) != 0) { - func_80030E00(arg0); - func_800332E8(arg0, arg2); - return; - } - func_80030C34(arg0); - func_800337CC(arg0, 0x40A00000, arg2); - // Duplicate return node #65. Try simplifying control flow for better match } } #else @@ -7089,28 +7066,28 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80037CFC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80032700(s8); // extern -? func_80032CB0(?, s8); // extern -? func_80032D94(s8); // extern -? func_80033280(?, s8); // extern -? func_80037CFC(s8); // extern +//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf +? func_80032700(s8); /* extern */ +? func_80032CB0(?, s8); /* extern */ +? func_80032D94(s8); /* extern */ +? func_80033280(?, s8); /* extern */ +? func_80037CFC(s8); /* extern */ extern s8 D_80164A89; extern s16 D_801656F0; extern s32 D_8018D168; extern s32 gRaceFrameCounter; -void func_800381AC(void *arg0, void *arg1, s8 arg2) { +void func_800381AC(Player *arg0, struct Controller *arg1, s8 arg2) { s16 temp_v0_2; s32 *temp_v0_3; u16 temp_v0; - temp_v0 = arg0->unk0; + temp_v0 = arg0->unk_000; if (((temp_v0 & 0x8000) == 0x8000) && ((temp_v0 & 0x4000) == 0x4000) && ((temp_v0 & 0x1000) != 0x1000)) { if ((temp_v0 & 0x2000) != 0x2000) { - temp_v0_2 = arg0->unkCA; + temp_v0_2 = arg0->unk_0CA; if (((temp_v0_2 & 2) == 2) || ((temp_v0_2 & 8) == 8)) { - if ((arg1->unk4 & 0x8000) != 0) { + if ((arg1->button & 0x8000) != 0) { func_80032D94(arg2); } else { func_80033280(0x40A00000, arg2); @@ -7128,15 +7105,12 @@ void func_800381AC(void *arg0, void *arg1, s8 arg2) { *temp_v0_3 = gRaceFrameCounter; } } - if ((arg1->unk4 & 0x8000) != 0) { + if ((arg1->button & 0x8000) != 0) { func_80032700(arg2); return; } func_80032CB0(0x40A00000, arg2); - // Duplicate return node #18. Try simplifying control flow for better match - return; } - // Duplicate return node #18. Try simplifying control flow for better match } } #else @@ -7144,14 +7118,15 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800381AC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800381AC(Player *, struct Controller *, ?); // extern -extern struct Controller *gControllerTwo; -extern struct Controller *gControllerThree; -extern struct Controller *gControllerFour; -extern struct Controller *gControllerSix; -extern struct Controller *gControllerSeven; -extern struct Controller *gControllerEight; +//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf +? func_800381AC(Player *, s32, ?); /* extern */ +extern s32 gControllerEight; +extern s32 gControllerFour; +extern s32 gControllerOne; +extern s32 gControllerSeven; +extern s32 gControllerSix; +extern s32 gControllerThree; +extern s32 gControllerTwo; void func_800382DC(void) { Player *temp_a0; @@ -7167,63 +7142,62 @@ void func_800382DC(void) { u16 temp_v0_6; temp_v0 = gActiveScreenMode; - if (temp_v0 != 0) { - if ((temp_v0 != 1) && (temp_v0 != 2)) { - if (temp_v0 != 3) { + switch (temp_v0) { /* irregular */ + case 0: + temp_v0_2 = gModeSelection; + switch (temp_v0_2) { /* switch 1; irregular */ + case 0: /* switch 1 */ + func_800381AC(gPlayerOne, gControllerOne, 0); + return; + case 1: /* switch 1 */ + if (D_8015F890 != 1) { + func_800381AC(gPlayerOne, gControllerOne, 0); + temp_a0 = gPlayerTwo; + temp_v0_3 = temp_a0->unk_000; + if (((temp_v0_3 & 0x100) == 0x100) && ((temp_v0_3 & 0x800) != 0x800)) { + func_800381AC(temp_a0, gControllerSix, 1); + } + temp_a0_2 = gPlayerThree; + temp_v0_4 = temp_a0_2->unk_000; + if (((temp_v0_4 & 0x100) == 0x100) && ((temp_v0_4 & 0x800) != 0x800)) { + func_800381AC(temp_a0_2, gControllerSeven, 2); + return; + } + } else { + temp_a0_3 = gPlayerOne; + if ((temp_a0_3->unk_000 & 0x800) != 0x800) { + func_800381AC(temp_a0_3, gControllerEight, 0); + } + temp_a0_4 = gPlayerTwo; + temp_v0_5 = temp_a0_4->unk_000; + if (((temp_v0_5 & 0x100) == 0x100) && ((temp_v0_5 & 0x800) != 0x800)) { + func_800381AC(temp_a0_4, gControllerSix, 1); + } + temp_a0_5 = gPlayerThree; + temp_v0_6 = temp_a0_5->unk_000; + if (((temp_v0_6 & 0x100) == 0x100) && ((temp_v0_6 & 0x800) != 0x800)) { + func_800381AC(temp_a0_5, gControllerSeven, 2); + return; + } return; } - func_800381AC(gPlayerOne, gControllerOne, 0); - func_800381AC(gPlayerTwo, gControllerTwo, 1); - func_800381AC(gPlayerThree, gControllerThree, 2); - if (gPlayerCountSelection1 == 4) { - func_800381AC(gPlayerFour, gControllerFour, 3); - } - // Duplicate return node #27. Try simplifying control flow for better match - return; + break; } + break; + case 1: + case 2: func_800381AC(gPlayerOne, gControllerOne, 0); func_800381AC(gPlayerTwo, gControllerTwo, 1); return; + case 3: + func_800381AC(gPlayerOne, gControllerOne, 0); + func_800381AC(gPlayerTwo, gControllerTwo, 1); + func_800381AC(gPlayerThree, gControllerThree, 2); + if (gPlayerCountSelection1 == 4) { + func_800381AC(gPlayerFour, gControllerFour, 3); + } + break; } - temp_v0_2 = gModeSelection; - if (temp_v0_2 != GRAND_PRIX) { - if (temp_v0_2 != TIME_TRIALS) { - return; - } - if (D_8015F890 != 1) { - func_800381AC(gPlayerOne, gControllerOne, 0); - temp_a0 = gPlayerTwo; - temp_v0_3 = temp_a0->unk_000; - if (((temp_v0_3 & 0x100) == 0x100) && ((temp_v0_3 & 0x800) != 0x800)) { - func_800381AC(temp_a0, gControllerSix, 1); - } - temp_a0_2 = gPlayerThree; - temp_v0_4 = temp_a0_2->unk_000; - if (((temp_v0_4 & 0x100) == 0x100) && ((temp_v0_4 & 0x800) != 0x800)) { - func_800381AC(temp_a0_2, gControllerSeven, 2); - return; - } - // Duplicate return node #27. Try simplifying control flow for better match - return; - } - temp_a0_3 = gPlayerOne; - if ((temp_a0_3->unk_000 & 0x800) != 0x800) { - func_800381AC(temp_a0_3, gControllerEight, 0); - } - temp_a0_4 = gPlayerTwo; - temp_v0_5 = temp_a0_4->unk_000; - if (((temp_v0_5 & 0x100) == 0x100) && ((temp_v0_5 & 0x800) != 0x800)) { - func_800381AC(temp_a0_4, gControllerSix, 1); - } - temp_a0_5 = gPlayerThree; - temp_v0_6 = temp_a0_5->unk_000; - if (((temp_v0_6 & 0x100) == 0x100) && ((temp_v0_6 & 0x800) != 0x800)) { - func_800381AC(temp_a0_5, gControllerSeven, 2); - return; - } - return; - } - func_800381AC(gPlayerOne, gControllerOne, 0); } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800382DC.s") @@ -7391,26 +7365,17 @@ s32 func_800388B0(void *arg0) { GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800388B0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80038BE4(void *arg0, s16 arg1) { - f32 phi_f0; - - arg0->unk9C = arg0->unk9C + arg1; - if (arg0->unk9C < 0.0f) { - arg0->unk9C = 0.0f; +void func_80038BE4(Player *player, s16 arg1) { + player->unk_09C += (f32) arg1; + if (player->unk_09C < 0.0f) { + player->unk_09C = 0.0f; } - phi_f0 = arg0->unk9C; - if (arg0->unk9C >= 250.0f) { - arg0->unk9C = 250.0f; - phi_f0 = arg0->unk9C; + if (player->unk_09C >= 250.0f) { + player->unk_09C = 250.0f; } - arg0->unk44 = arg0->unk44 | 0x20; - arg0->unk8C = (phi_f0 * phi_f0) / 25.0f; + player->unk_044 |= 0x20; + player->unk_08C = (player->unk_09C * player->unk_09C) / 25.0f; } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80038BE4.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 diff --git a/src/code_80027D00.h b/src/code_80027D00.h index 26a32e469..378e0bbd8 100644 --- a/src/code_80027D00.h +++ b/src/code_80027D00.h @@ -13,12 +13,18 @@ void func_80029158(); void func_800291E8(); void func_800291F0(); void func_800291F8(); +void func_80029200(Player*, s8); void func_8002C11C(Player*); void func_8002AAC0(Player*); void func_8002E4C4(Player*); void func_80030FC8(Player*); +void func_80031F48(Player*, f32); +void func_80032CB0(Player*, f32); void func_80032D94(Player*); +void func_80033280(Player*, f32); void func_80033850(Player*, f32); +void func_80036C5C(Player*); +void func_80038BE4(Player*, s16); /* This is where I'd put my static data, if I had any */ @@ -62,6 +68,11 @@ extern f64 D_800EDAE0; extern f64 D_800EDAE8; extern f64 D_800EDAF0; +extern f64 D_800EDAF8; + +extern f64 D_800EDB98; +extern f64 D_800EDBA0; + extern f64 D_800EDBA8; extern f64 D_800EDBB0; extern f64 D_800EDBB8; diff --git a/src/code_8008C1D0.h b/src/code_8008C1D0.h index 609b5ca9b..e239d4c54 100644 --- a/src/code_8008C1D0.h +++ b/src/code_8008C1D0.h @@ -80,8 +80,6 @@ void func_80056A40(s32, s32); void func_80056A94(s32, Player*); // code_80057C60 void func_8006B8B4(Player*, s8); -// code_80027D00.c -s32 func_80031F48(Player*, float); // audio/external.c void func_800C90F4(u8, s32); void func_800C9060(u8, s32);