diff --git a/asm/non_matchings/code_80027D00/func_8002AA50.s b/asm/non_matchings/code_80027D00/func_8002AA50.s deleted file mode 100644 index 1ec543a38..000000000 --- a/asm/non_matchings/code_80027D00/func_8002AA50.s +++ /dev/null @@ -1,29 +0,0 @@ -glabel func_8002AA50 -/* 02B650 8002AA50 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 02B654 8002AA54 AFBF0014 */ sw $ra, 0x14($sp) -/* 02B658 8002AA58 94820254 */ lhu $v0, 0x254($a0) -/* 02B65C 8002AA5C 3C01800E */ lui $at, %hi(gKartHopJerkTable) -/* 02B660 8002AA60 44803000 */ mtc1 $zero, $f6 -/* 02B664 8002AA64 00027080 */ sll $t6, $v0, 2 -/* 02B668 8002AA68 002E0821 */ addu $at, $at, $t6 -/* 02B66C 8002AA6C C42436F0 */ lwc1 $f4, %lo(gKartHopJerkTable)($at) -/* 02B670 8002AA70 3C01800E */ lui $at, %hi(gKartHopInitialVelocityTable) -/* 02B674 8002AA74 002E0821 */ addu $at, $at, $t6 -/* 02B678 8002AA78 E48600F4 */ swc1 $f6, 0xf4($a0) -/* 02B67C 8002AA7C E48400F0 */ swc1 $f4, 0xf0($a0) -/* 02B680 8002AA80 C42836D0 */ lwc1 $f8, %lo(gKartHopInitialVelocityTable)($at) -/* 02B684 8002AA84 3C014040 */ li $at, 0x40400000 # 3.000000 -/* 02B688 8002AA88 8C8F00BC */ lw $t7, 0xbc($a0) -/* 02B68C 8002AA8C 44815000 */ mtc1 $at, $f10 -/* 02B690 8002AA90 3C0143FA */ li $at, 0x43FA0000 # 500.000000 -/* 02B694 8002AA94 44818000 */ mtc1 $at, $f16 -/* 02B698 8002AA98 35F80002 */ ori $t8, $t7, 2 -/* 02B69C 8002AA9C AC9800BC */ sw $t8, 0xbc($a0) -/* 02B6A0 8002AAA0 E48800EC */ swc1 $f8, 0xec($a0) -/* 02B6A4 8002AAA4 E48A0DAC */ swc1 $f10, 0xdac($a0) -/* 02B6A8 8002AAA8 0C00DB17 */ jal func_80036C5C -/* 02B6AC 8002AAAC E4900100 */ swc1 $f16, 0x100($a0) -/* 02B6B0 8002AAB0 8FBF0014 */ lw $ra, 0x14($sp) -/* 02B6B4 8002AAB4 27BD0018 */ addiu $sp, $sp, 0x18 -/* 02B6B8 8002AAB8 03E00008 */ jr $ra -/* 02B6BC 8002AABC 00000000 */ nop diff --git a/asm/non_matchings/code_80027D00/func_80037614.s b/asm/non_matchings/code_80027D00/func_80037614.s deleted file mode 100644 index 55744c94b..000000000 --- a/asm/non_matchings/code_80027D00/func_80037614.s +++ /dev/null @@ -1,96 +0,0 @@ -glabel func_80037614 -/* 038214 80037614 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 038218 80037618 AFBF001C */ sw $ra, 0x1c($sp) -/* 03821C 8003761C AFB00018 */ sw $s0, 0x18($sp) -/* 038220 80037620 8C8200BC */ lw $v0, 0xbc($a0) -/* 038224 80037624 24011000 */ li $at, 4096 -/* 038228 80037628 00808025 */ move $s0, $a0 -/* 03822C 8003762C 304E1000 */ andi $t6, $v0, 0x1000 -/* 038230 80037630 11C10005 */ beq $t6, $at, .L80037648 -/* 038234 80037634 00A03825 */ move $a3, $a1 -/* 038238 80037638 304F0020 */ andi $t7, $v0, 0x20 -/* 03823C 8003763C 24010020 */ li $at, 32 -/* 038240 80037640 15E1000D */ bne $t7, $at, .L80037678 -/* 038244 80037644 30580010 */ andi $t8, $v0, 0x10 -.L80037648: -/* 038248 80037648 44807000 */ mtc1 $zero, $f14 -/* 03824C 8003764C 00E02025 */ move $a0, $a3 -/* 038250 80037650 26050174 */ addiu $a1, $s0, 0x174 -/* 038254 80037654 E4EE0000 */ swc1 $f14, ($a3) -/* 038258 80037658 E4EE0004 */ swc1 $f14, 4($a3) -/* 03825C 8003765C E4EE0008 */ swc1 $f14, 8($a3) -/* 038260 80037660 AFA70024 */ sw $a3, 0x24($sp) -/* 038264 80037664 0C0AD8EE */ jal func_802B63B8 -/* 038268 80037668 AFA60028 */ sw $a2, 0x28($sp) -/* 03826C 8003766C 8FA60028 */ lw $a2, 0x28($sp) -/* 038270 80037670 10000037 */ b .L80037750 -/* 038274 80037674 8FA70024 */ lw $a3, 0x24($sp) -.L80037678: -/* 038278 80037678 24010010 */ li $at, 16 -/* 03827C 8003767C 17010013 */ bne $t8, $at, .L800376CC -/* 038280 80037680 30590002 */ andi $t9, $v0, 2 -/* 038284 80037684 24010002 */ li $at, 2 -/* 038288 80037688 13210010 */ beq $t9, $at, .L800376CC -/* 03828C 8003768C 3C01C2A0 */ li $at, 0xC2A00000 # -80.000000 -/* 038290 80037690 44816000 */ mtc1 $at, $f12 -/* 038294 80037694 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 038298 80037698 44812000 */ mtc1 $at, $f4 -/* 03829C 8003769C C6000094 */ lwc1 $f0, 0x94($s0) -/* 0382A0 800376A0 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 0382A4 800376A4 44815000 */ mtc1 $at, $f10 -/* 0382A8 800376A8 46040183 */ div.s $f6, $f0, $f4 -/* 0382AC 800376AC 3C014000 */ li $at, 0x40000000 # 2.000000 -/* 0382B0 800376B0 44819000 */ mtc1 $at, $f18 -/* 0382B4 800376B4 46003207 */ neg.s $f8, $f6 -/* 0382B8 800376B8 460A4402 */ mul.s $f16, $f8, $f10 -/* 0382BC 800376BC 00000000 */ nop -/* 0382C0 800376C0 46128102 */ mul.s $f4, $f16, $f18 -/* 0382C4 800376C4 10000011 */ b .L8003770C -/* 0382C8 800376C8 460C2080 */ add.s $f2, $f4, $f12 -.L800376CC: -/* 0382CC 800376CC 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 0382D0 800376D0 44813000 */ mtc1 $at, $f6 -/* 0382D4 800376D4 C6000094 */ lwc1 $f0, 0x94($s0) -/* 0382D8 800376D8 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 0382DC 800376DC 44818000 */ mtc1 $at, $f16 -/* 0382E0 800376E0 46060203 */ div.s $f8, $f0, $f6 -/* 0382E4 800376E4 3C014000 */ li $at, 0x40000000 # 2.000000 -/* 0382E8 800376E8 44812000 */ mtc1 $at, $f4 -/* 0382EC 800376EC 3C01C1A0 */ li $at, 0xC1A00000 # -20.000000 -/* 0382F0 800376F0 46004287 */ neg.s $f10, $f8 -/* 0382F4 800376F4 44814000 */ mtc1 $at, $f8 -/* 0382F8 800376F8 46105482 */ mul.s $f18, $f10, $f16 -/* 0382FC 800376FC 3C01C220 */ li $at, 0xC2200000 # -40.000000 -/* 038300 80037700 44816000 */ mtc1 $at, $f12 -/* 038304 80037704 46049183 */ div.s $f6, $f18, $f4 -/* 038308 80037708 46083080 */ add.s $f2, $f6, $f8 -.L8003770C: -/* 03830C 8003770C 3C0141E0 */ li $at, 0x41E00000 # 28.000000 -/* 038310 80037710 44815000 */ mtc1 $at, $f10 -/* 038314 80037714 44807000 */ mtc1 $zero, $f14 -/* 038318 80037718 00E02025 */ move $a0, $a3 -/* 03831C 8003771C 460A1400 */ add.s $f16, $f2, $f10 -/* 038320 80037720 E4EE0004 */ swc1 $f14, 4($a3) -/* 038324 80037724 26050174 */ addiu $a1, $s0, 0x174 -/* 038328 80037728 46008482 */ mul.s $f18, $f16, $f0 -/* 03832C 8003772C E4F20000 */ swc1 $f18, ($a3) -/* 038330 80037730 C6040094 */ lwc1 $f4, 0x94($s0) -/* 038334 80037734 460C2182 */ mul.s $f6, $f4, $f12 -/* 038338 80037738 E4E60008 */ swc1 $f6, 8($a3) -/* 03833C 8003773C AFA70024 */ sw $a3, 0x24($sp) -/* 038340 80037740 0C0AD8EE */ jal func_802B63B8 -/* 038344 80037744 AFA60028 */ sw $a2, 0x28($sp) -/* 038348 80037748 8FA60028 */ lw $a2, 0x28($sp) -/* 03834C 8003774C 8FA70024 */ lw $a3, 0x24($sp) -.L80037750: -/* 038350 80037750 C4E80000 */ lwc1 $f8, ($a3) -/* 038354 80037754 E4C80000 */ swc1 $f8, ($a2) -/* 038358 80037758 C4EA0004 */ lwc1 $f10, 4($a3) -/* 03835C 8003775C E4CA0004 */ swc1 $f10, 4($a2) -/* 038360 80037760 C4F00008 */ lwc1 $f16, 8($a3) -/* 038364 80037764 E4D00008 */ swc1 $f16, 8($a2) -/* 038368 80037768 8FBF001C */ lw $ra, 0x1c($sp) -/* 03836C 8003776C 8FB00018 */ lw $s0, 0x18($sp) -/* 038370 80037770 27BD0020 */ addiu $sp, $sp, 0x20 -/* 038374 80037774 03E00008 */ jr $ra -/* 038378 80037778 00000000 */ nop diff --git a/asm/non_matchings/code_80027D00/func_8003777C.s b/asm/non_matchings/code_80027D00/func_8003777C.s deleted file mode 100644 index 50373eee5..000000000 --- a/asm/non_matchings/code_80027D00/func_8003777C.s +++ /dev/null @@ -1,97 +0,0 @@ -glabel func_8003777C -/* 03837C 8003777C 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 038380 80037780 AFBF001C */ sw $ra, 0x1c($sp) -/* 038384 80037784 AFB00018 */ sw $s0, 0x18($sp) -/* 038388 80037788 8C8200BC */ lw $v0, 0xbc($a0) -/* 03838C 8003778C 24011000 */ li $at, 4096 -/* 038390 80037790 00808025 */ move $s0, $a0 -/* 038394 80037794 304E1000 */ andi $t6, $v0, 0x1000 -/* 038398 80037798 11C10005 */ beq $t6, $at, .L800377B0 -/* 03839C 8003779C 00A03825 */ move $a3, $a1 -/* 0383A0 800377A0 304F0020 */ andi $t7, $v0, 0x20 -/* 0383A4 800377A4 24010020 */ li $at, 32 -/* 0383A8 800377A8 15E1000D */ bne $t7, $at, .L800377E0 -/* 0383AC 800377AC 30580010 */ andi $t8, $v0, 0x10 -.L800377B0: -/* 0383B0 800377B0 44807000 */ mtc1 $zero, $f14 -/* 0383B4 800377B4 00E02025 */ move $a0, $a3 -/* 0383B8 800377B8 26050174 */ addiu $a1, $s0, 0x174 -/* 0383BC 800377BC E4EE0000 */ swc1 $f14, ($a3) -/* 0383C0 800377C0 E4EE0004 */ swc1 $f14, 4($a3) -/* 0383C4 800377C4 E4EE0008 */ swc1 $f14, 8($a3) -/* 0383C8 800377C8 AFA70024 */ sw $a3, 0x24($sp) -/* 0383CC 800377CC 0C0AD8EE */ jal func_802B63B8 -/* 0383D0 800377D0 AFA60028 */ sw $a2, 0x28($sp) -/* 0383D4 800377D4 8FA60028 */ lw $a2, 0x28($sp) -/* 0383D8 800377D8 10000038 */ b .L800378BC -/* 0383DC 800377DC 8FA70024 */ lw $a3, 0x24($sp) -.L800377E0: -/* 0383E0 800377E0 24010010 */ li $at, 16 -/* 0383E4 800377E4 17010013 */ bne $t8, $at, .L80037834 -/* 0383E8 800377E8 30590002 */ andi $t9, $v0, 2 -/* 0383EC 800377EC 24010002 */ li $at, 2 -/* 0383F0 800377F0 13210010 */ beq $t9, $at, .L80037834 -/* 0383F4 800377F4 3C01C2A0 */ li $at, 0xC2A00000 # -80.000000 -/* 0383F8 800377F8 44816000 */ mtc1 $at, $f12 -/* 0383FC 800377FC 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 038400 80037800 44812000 */ mtc1 $at, $f4 -/* 038404 80037804 C6000094 */ lwc1 $f0, 0x94($s0) -/* 038408 80037808 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 03840C 8003780C 44815000 */ mtc1 $at, $f10 -/* 038410 80037810 46040183 */ div.s $f6, $f0, $f4 -/* 038414 80037814 3C014000 */ li $at, 0x40000000 # 2.000000 -/* 038418 80037818 44819000 */ mtc1 $at, $f18 -/* 03841C 8003781C 46003207 */ neg.s $f8, $f6 -/* 038420 80037820 460A4402 */ mul.s $f16, $f8, $f10 -/* 038424 80037824 00000000 */ nop -/* 038428 80037828 46128102 */ mul.s $f4, $f16, $f18 -/* 03842C 8003782C 10000011 */ b .L80037874 -/* 038430 80037830 460C2080 */ add.s $f2, $f4, $f12 -.L80037834: -/* 038434 80037834 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 038438 80037838 44813000 */ mtc1 $at, $f6 -/* 03843C 8003783C C6000094 */ lwc1 $f0, 0x94($s0) -/* 038440 80037840 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 038444 80037844 44818000 */ mtc1 $at, $f16 -/* 038448 80037848 46060203 */ div.s $f8, $f0, $f6 -/* 03844C 8003784C 3C014000 */ li $at, 0x40000000 # 2.000000 -/* 038450 80037850 44812000 */ mtc1 $at, $f4 -/* 038454 80037854 3C01C1A0 */ li $at, 0xC1A00000 # -20.000000 -/* 038458 80037858 46004287 */ neg.s $f10, $f8 -/* 03845C 8003785C 44814000 */ mtc1 $at, $f8 -/* 038460 80037860 46105482 */ mul.s $f18, $f10, $f16 -/* 038464 80037864 3C01C220 */ li $at, 0xC2200000 # -40.000000 -/* 038468 80037868 44816000 */ mtc1 $at, $f12 -/* 03846C 8003786C 46049183 */ div.s $f6, $f18, $f4 -/* 038470 80037870 46083080 */ add.s $f2, $f6, $f8 -.L80037874: -/* 038474 80037874 3C0141E0 */ li $at, 0x41E00000 # 28.000000 -/* 038478 80037878 44815000 */ mtc1 $at, $f10 -/* 03847C 8003787C 44807000 */ mtc1 $zero, $f14 -/* 038480 80037880 00E02025 */ move $a0, $a3 -/* 038484 80037884 460A1400 */ add.s $f16, $f2, $f10 -/* 038488 80037888 E4EE0004 */ swc1 $f14, 4($a3) -/* 03848C 8003788C 26050174 */ addiu $a1, $s0, 0x174 -/* 038490 80037890 46008487 */ neg.s $f18, $f16 -/* 038494 80037894 46009102 */ mul.s $f4, $f18, $f0 -/* 038498 80037898 E4E40000 */ swc1 $f4, ($a3) -/* 03849C 8003789C C6060094 */ lwc1 $f6, 0x94($s0) -/* 0384A0 800378A0 460C3202 */ mul.s $f8, $f6, $f12 -/* 0384A4 800378A4 E4E80008 */ swc1 $f8, 8($a3) -/* 0384A8 800378A8 AFA70024 */ sw $a3, 0x24($sp) -/* 0384AC 800378AC 0C0AD8EE */ jal func_802B63B8 -/* 0384B0 800378B0 AFA60028 */ sw $a2, 0x28($sp) -/* 0384B4 800378B4 8FA60028 */ lw $a2, 0x28($sp) -/* 0384B8 800378B8 8FA70024 */ lw $a3, 0x24($sp) -.L800378BC: -/* 0384BC 800378BC C4EA0000 */ lwc1 $f10, ($a3) -/* 0384C0 800378C0 E4CA0000 */ swc1 $f10, ($a2) -/* 0384C4 800378C4 C4F00004 */ lwc1 $f16, 4($a3) -/* 0384C8 800378C8 E4D00004 */ swc1 $f16, 4($a2) -/* 0384CC 800378CC C4F20008 */ lwc1 $f18, 8($a3) -/* 0384D0 800378D0 E4D20008 */ swc1 $f18, 8($a2) -/* 0384D4 800378D4 8FBF001C */ lw $ra, 0x1c($sp) -/* 0384D8 800378D8 8FB00018 */ lw $s0, 0x18($sp) -/* 0384DC 800378DC 27BD0020 */ addiu $sp, $sp, 0x20 -/* 0384E0 800378E0 03E00008 */ jr $ra -/* 0384E4 800378E4 00000000 */ nop diff --git a/asm/non_matchings/code_80027D00/func_800378E8.s b/asm/non_matchings/code_80027D00/func_800378E8.s deleted file mode 100644 index 5349784ba..000000000 --- a/asm/non_matchings/code_80027D00/func_800378E8.s +++ /dev/null @@ -1,94 +0,0 @@ -glabel func_800378E8 -/* 0384E8 800378E8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0384EC 800378EC AFBF001C */ sw $ra, 0x1c($sp) -/* 0384F0 800378F0 AFB00018 */ sw $s0, 0x18($sp) -/* 0384F4 800378F4 8C8200BC */ lw $v0, 0xbc($a0) -/* 0384F8 800378F8 24010020 */ li $at, 32 -/* 0384FC 800378FC 00A08025 */ move $s0, $a1 -/* 038500 80037900 304E0020 */ andi $t6, $v0, 0x20 -/* 038504 80037904 15C1000B */ bne $t6, $at, .L80037934 -/* 038508 80037908 00803825 */ move $a3, $a0 -/* 03850C 8003790C 44807000 */ mtc1 $zero, $f14 -/* 038510 80037910 00A02025 */ move $a0, $a1 -/* 038514 80037914 E4AE0000 */ swc1 $f14, ($a1) -/* 038518 80037918 E4AE0004 */ swc1 $f14, 4($a1) -/* 03851C 8003791C E4AE0008 */ swc1 $f14, 8($a1) -/* 038520 80037920 AFA60028 */ sw $a2, 0x28($sp) -/* 038524 80037924 0C0AD8EE */ jal func_802B63B8 -/* 038528 80037928 24E50174 */ addiu $a1, $a3, 0x174 -/* 03852C 8003792C 1000003C */ b .L80037A20 -/* 038530 80037930 8FA60028 */ lw $a2, 0x28($sp) -.L80037934: -/* 038534 80037934 304F0010 */ andi $t7, $v0, 0x10 -/* 038538 80037938 24010010 */ li $at, 16 -/* 03853C 8003793C 15E10016 */ bne $t7, $at, .L80037998 -/* 038540 80037940 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 038544 80037944 44812000 */ mtc1 $at, $f4 -/* 038548 80037948 C4E00094 */ lwc1 $f0, 0x94($a3) -/* 03854C 8003794C 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 038550 80037950 44815000 */ mtc1 $at, $f10 -/* 038554 80037954 46040183 */ div.s $f6, $f0, $f4 -/* 038558 80037958 3C0140A0 */ li $at, 0x40A00000 # 5.000000 -/* 03855C 8003795C 44819000 */ mtc1 $at, $f18 -/* 038560 80037960 3C014120 */ li $at, 0x41200000 # 10.000000 -/* 038564 80037964 46003207 */ neg.s $f8, $f6 -/* 038568 80037968 C4E60208 */ lwc1 $f6, 0x208($a3) -/* 03856C 8003796C 460A4402 */ mul.s $f16, $f8, $f10 -/* 038570 80037970 C4EA020C */ lwc1 $f10, 0x20c($a3) -/* 038574 80037974 46128102 */ mul.s $f4, $f16, $f18 -/* 038578 80037978 44819000 */ mtc1 $at, $f18 -/* 03857C 8003797C 46005407 */ neg.s $f16, $f10 -/* 038580 80037980 3C01C2C8 */ li $at, 0xC2C80000 # -100.000000 -/* 038584 80037984 44816000 */ mtc1 $at, $f12 -/* 038588 80037988 46043200 */ add.s $f8, $f6, $f4 -/* 03858C 8003798C 46128182 */ mul.s $f6, $f16, $f18 -/* 038590 80037990 10000015 */ b .L800379E8 -/* 038594 80037994 46064080 */ add.s $f2, $f8, $f6 -.L80037998: -/* 038598 80037998 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 03859C 8003799C 44812000 */ mtc1 $at, $f4 -/* 0385A0 800379A0 C4E00094 */ lwc1 $f0, 0x94($a3) -/* 0385A4 800379A4 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 0385A8 800379A8 44819000 */ mtc1 $at, $f18 -/* 0385AC 800379AC 46040283 */ div.s $f10, $f0, $f4 -/* 0385B0 800379B0 3C014220 */ li $at, 0x42200000 # 40.000000 -/* 0385B4 800379B4 44813000 */ mtc1 $at, $f6 -/* 0385B8 800379B8 3C014248 */ li $at, 0x42480000 # 50.000000 -/* 0385BC 800379BC C4EC0084 */ lwc1 $f12, 0x84($a3) -/* 0385C0 800379C0 46005407 */ neg.s $f16, $f10 -/* 0385C4 800379C4 C4EA0208 */ lwc1 $f10, 0x208($a3) -/* 0385C8 800379C8 46128202 */ mul.s $f8, $f16, $f18 -/* 0385CC 800379CC C4F2020C */ lwc1 $f18, 0x20c($a3) -/* 0385D0 800379D0 46064103 */ div.s $f4, $f8, $f6 -/* 0385D4 800379D4 44813000 */ mtc1 $at, $f6 -/* 0385D8 800379D8 46009207 */ neg.s $f8, $f18 -/* 0385DC 800379DC 46045400 */ add.s $f16, $f10, $f4 -/* 0385E0 800379E0 46064282 */ mul.s $f10, $f8, $f6 -/* 0385E4 800379E4 460A8080 */ add.s $f2, $f16, $f10 -.L800379E8: -/* 0385E8 800379E8 C4E40090 */ lwc1 $f4, 0x90($a3) -/* 0385EC 800379EC 44807000 */ mtc1 $zero, $f14 -/* 0385F0 800379F0 02002025 */ move $a0, $s0 -/* 0385F4 800379F4 46022480 */ add.s $f18, $f4, $f2 -/* 0385F8 800379F8 E60E0004 */ swc1 $f14, 4($s0) -/* 0385FC 800379FC 24E50174 */ addiu $a1, $a3, 0x174 -/* 038600 80037A00 46009202 */ mul.s $f8, $f18, $f0 -/* 038604 80037A04 E6080000 */ swc1 $f8, ($s0) -/* 038608 80037A08 C4E60094 */ lwc1 $f6, 0x94($a3) -/* 03860C 80037A0C 460C3402 */ mul.s $f16, $f6, $f12 -/* 038610 80037A10 E6100008 */ swc1 $f16, 8($s0) -/* 038614 80037A14 0C0AD8EE */ jal func_802B63B8 -/* 038618 80037A18 AFA60028 */ sw $a2, 0x28($sp) -/* 03861C 80037A1C 8FA60028 */ lw $a2, 0x28($sp) -.L80037A20: -/* 038620 80037A20 C60A0000 */ lwc1 $f10, ($s0) -/* 038624 80037A24 E4CA0000 */ swc1 $f10, ($a2) -/* 038628 80037A28 C6040004 */ lwc1 $f4, 4($s0) -/* 03862C 80037A2C E4C40004 */ swc1 $f4, 4($a2) -/* 038630 80037A30 C6120008 */ lwc1 $f18, 8($s0) -/* 038634 80037A34 E4D20008 */ swc1 $f18, 8($a2) -/* 038638 80037A38 8FBF001C */ lw $ra, 0x1c($sp) -/* 03863C 80037A3C 8FB00018 */ lw $s0, 0x18($sp) -/* 038640 80037A40 27BD0020 */ addiu $sp, $sp, 0x20 -/* 038644 80037A44 03E00008 */ jr $ra -/* 038648 80037A48 00000000 */ nop diff --git a/asm/non_matchings/code_80027D00/func_80037A4C.s b/asm/non_matchings/code_80027D00/func_80037A4C.s deleted file mode 100644 index d37208139..000000000 --- a/asm/non_matchings/code_80027D00/func_80037A4C.s +++ /dev/null @@ -1,95 +0,0 @@ -glabel func_80037A4C -/* 03864C 80037A4C 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 038650 80037A50 AFBF001C */ sw $ra, 0x1c($sp) -/* 038654 80037A54 AFB00018 */ sw $s0, 0x18($sp) -/* 038658 80037A58 8C8200BC */ lw $v0, 0xbc($a0) -/* 03865C 80037A5C 24010020 */ li $at, 32 -/* 038660 80037A60 00A08025 */ move $s0, $a1 -/* 038664 80037A64 304E0020 */ andi $t6, $v0, 0x20 -/* 038668 80037A68 15C1000B */ bne $t6, $at, .L80037A98 -/* 03866C 80037A6C 00803825 */ move $a3, $a0 -/* 038670 80037A70 44807000 */ mtc1 $zero, $f14 -/* 038674 80037A74 00A02025 */ move $a0, $a1 -/* 038678 80037A78 E4AE0000 */ swc1 $f14, ($a1) -/* 03867C 80037A7C E4AE0004 */ swc1 $f14, 4($a1) -/* 038680 80037A80 E4AE0008 */ swc1 $f14, 8($a1) -/* 038684 80037A84 AFA60028 */ sw $a2, 0x28($sp) -/* 038688 80037A88 0C0AD8EE */ jal func_802B63B8 -/* 03868C 80037A8C 24E50174 */ addiu $a1, $a3, 0x174 -/* 038690 80037A90 1000003D */ b .L80037B88 -/* 038694 80037A94 8FA60028 */ lw $a2, 0x28($sp) -.L80037A98: -/* 038698 80037A98 304F0010 */ andi $t7, $v0, 0x10 -/* 03869C 80037A9C 24010010 */ li $at, 16 -/* 0386A0 80037AA0 15E10016 */ bne $t7, $at, .L80037AFC -/* 0386A4 80037AA4 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 0386A8 80037AA8 44812000 */ mtc1 $at, $f4 -/* 0386AC 80037AAC C4E00094 */ lwc1 $f0, 0x94($a3) -/* 0386B0 80037AB0 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 0386B4 80037AB4 44815000 */ mtc1 $at, $f10 -/* 0386B8 80037AB8 46040183 */ div.s $f6, $f0, $f4 -/* 0386BC 80037ABC 3C0140A0 */ li $at, 0x40A00000 # 5.000000 -/* 0386C0 80037AC0 44819000 */ mtc1 $at, $f18 -/* 0386C4 80037AC4 3C014248 */ li $at, 0x42480000 # 50.000000 -/* 0386C8 80037AC8 46003207 */ neg.s $f8, $f6 -/* 0386CC 80037ACC C4E60208 */ lwc1 $f6, 0x208($a3) -/* 0386D0 80037AD0 460A4402 */ mul.s $f16, $f8, $f10 -/* 0386D4 80037AD4 C4EA020C */ lwc1 $f10, 0x20c($a3) -/* 0386D8 80037AD8 46128102 */ mul.s $f4, $f16, $f18 -/* 0386DC 80037ADC 44819000 */ mtc1 $at, $f18 -/* 0386E0 80037AE0 46005407 */ neg.s $f16, $f10 -/* 0386E4 80037AE4 3C01C2C8 */ li $at, 0xC2C80000 # -100.000000 -/* 0386E8 80037AE8 44816000 */ mtc1 $at, $f12 -/* 0386EC 80037AEC 46043200 */ add.s $f8, $f6, $f4 -/* 0386F0 80037AF0 46128182 */ mul.s $f6, $f16, $f18 -/* 0386F4 80037AF4 10000015 */ b .L80037B4C -/* 0386F8 80037AF8 46064080 */ add.s $f2, $f8, $f6 -.L80037AFC: -/* 0386FC 80037AFC 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 038700 80037B00 44812000 */ mtc1 $at, $f4 -/* 038704 80037B04 C4E00094 */ lwc1 $f0, 0x94($a3) -/* 038708 80037B08 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 03870C 80037B0C 44819000 */ mtc1 $at, $f18 -/* 038710 80037B10 46040283 */ div.s $f10, $f0, $f4 -/* 038714 80037B14 3C014220 */ li $at, 0x42200000 # 40.000000 -/* 038718 80037B18 44813000 */ mtc1 $at, $f6 -/* 03871C 80037B1C 3C014248 */ li $at, 0x42480000 # 50.000000 -/* 038720 80037B20 C4EC0084 */ lwc1 $f12, 0x84($a3) -/* 038724 80037B24 46005407 */ neg.s $f16, $f10 -/* 038728 80037B28 C4EA0208 */ lwc1 $f10, 0x208($a3) -/* 03872C 80037B2C 46128202 */ mul.s $f8, $f16, $f18 -/* 038730 80037B30 C4F2020C */ lwc1 $f18, 0x20c($a3) -/* 038734 80037B34 46064103 */ div.s $f4, $f8, $f6 -/* 038738 80037B38 44813000 */ mtc1 $at, $f6 -/* 03873C 80037B3C 46009207 */ neg.s $f8, $f18 -/* 038740 80037B40 46045400 */ add.s $f16, $f10, $f4 -/* 038744 80037B44 46064282 */ mul.s $f10, $f8, $f6 -/* 038748 80037B48 460A8080 */ add.s $f2, $f16, $f10 -.L80037B4C: -/* 03874C 80037B4C C4E40090 */ lwc1 $f4, 0x90($a3) -/* 038750 80037B50 44807000 */ mtc1 $zero, $f14 -/* 038754 80037B54 02002025 */ move $a0, $s0 -/* 038758 80037B58 46022480 */ add.s $f18, $f4, $f2 -/* 03875C 80037B5C E60E0004 */ swc1 $f14, 4($s0) -/* 038760 80037B60 24E50174 */ addiu $a1, $a3, 0x174 -/* 038764 80037B64 46009207 */ neg.s $f8, $f18 -/* 038768 80037B68 46004182 */ mul.s $f6, $f8, $f0 -/* 03876C 80037B6C E6060000 */ swc1 $f6, ($s0) -/* 038770 80037B70 C4F00094 */ lwc1 $f16, 0x94($a3) -/* 038774 80037B74 460C8282 */ mul.s $f10, $f16, $f12 -/* 038778 80037B78 E60A0008 */ swc1 $f10, 8($s0) -/* 03877C 80037B7C 0C0AD8EE */ jal func_802B63B8 -/* 038780 80037B80 AFA60028 */ sw $a2, 0x28($sp) -/* 038784 80037B84 8FA60028 */ lw $a2, 0x28($sp) -.L80037B88: -/* 038788 80037B88 C6040000 */ lwc1 $f4, ($s0) -/* 03878C 80037B8C E4C40000 */ swc1 $f4, ($a2) -/* 038790 80037B90 C6120004 */ lwc1 $f18, 4($s0) -/* 038794 80037B94 E4D20004 */ swc1 $f18, 4($a2) -/* 038798 80037B98 C6080008 */ lwc1 $f8, 8($s0) -/* 03879C 80037B9C E4C80008 */ swc1 $f8, 8($a2) -/* 0387A0 80037BA0 8FBF001C */ lw $ra, 0x1c($sp) -/* 0387A4 80037BA4 8FB00018 */ lw $s0, 0x18($sp) -/* 0387A8 80037BA8 27BD0020 */ addiu $sp, $sp, 0x20 -/* 0387AC 80037BAC 03E00008 */ jr $ra -/* 0387B0 80037BB0 00000000 */ nop diff --git a/include/common_structs.h b/include/common_structs.h index 3c8354983..af1d023e2 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -9,6 +9,9 @@ typedef s16 Vec3s[3]; typedef u16 Vec3su[3]; typedef s16 Vec4s[4]; +typedef f32 Mat3[3][3]; +typedef f32 Mat4[4][4]; + #define COURSE_NULL 0xFF typedef enum { @@ -293,7 +296,7 @@ typedef struct { /* 0x010E */ char unk_10E[0x2]; /* 0x0110 */ UnkActorInner unk_110; /* 0x0150 */ f32 unk_150[9]; - /* 0x0174 */ f32 unk_174[9]; + /* 0x0174 */ Mat3 unk_174; /* 0x0198 */ KartBoundingBoxCorner boundingBoxCorners[4]; /* 0x01F8 */ f32 unk_1F8; /* 0x01FC */ f32 unk_1FC; diff --git a/include/functions.h b/include/functions.h index 0b220fa31..5901ef9e1 100644 --- a/include/functions.h +++ b/include/functions.h @@ -9,15 +9,12 @@ void func_8000F2DC(void); void func_8000F628(void); void func_8000EEDC(void); void func_802B6540(f32* arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4); -void func_80295BF8(s32 arg0); void func_8005D6C0(Player* player); void func_8006B7E4(Player* player, s32 arg1); void func_800267AC(Player* player, s8 arg1, s8 arg2); void func_8005D290(void); // TODO: should rot, arg4, and arg5 be rotx, roty, and rotz? void func_8001C4D0(f32 x, f32 y, f32 z, s16 rot, s16 arg4, s32 arg5); -void func_8003DB5C(void); -void func_8003D080(void); diff --git a/include/types.h b/include/types.h index 3672c5b31..9ef2207cb 100644 --- a/include/types.h +++ b/include/types.h @@ -5,9 +5,6 @@ #include #include "camera.h" -typedef f32 Mat4[4][4]; -typedef f32 Mat3[3][3]; - enum SpTaskState { SPTASK_STATE_NOT_STARTED, SPTASK_STATE_RUNNING, diff --git a/progress.py b/progress.py index 8dabb472f..7ddd19983 100644 --- a/progress.py +++ b/progress.py @@ -65,27 +65,32 @@ TotalMipsToCFunctions = len(CountMipsToCFunctions(GetFiles("src", ".c")) if not TotalNonMatchingFunctions = len(CountNonMatchingFunctions(GetFiles("src", ".c")) if not args.matching else []) mainSegFiles2 = [ - "asm/non_matchings/crash_screen", "asm/non_matchings/code_80004740", - "asm/non_matchings/staff_ghosts", "asm/non_matchings/code_80005FD0", - "asm/non_matchings/code_8001C4D0", "asm/non_matchings/code_8001F980", - "asm/non_matchings/code_80027040", "asm/non_matchings/code_80027D00", - "asm/non_matchings/code_800393C0", "asm/non_matchings/code_8003DC40", - "asm/non_matchings/code_80040E50", "asm/non_matchings/code_800431B0", - "asm/non_matchings/code_80057C60", "asm/non_matchings/code_8006E9C0", - "asm/non_matchings/code_80071F00", "asm/non_matchings/code_80086E70", - "asm/non_matchings/code_8008C1D0", "asm/non_matchings/code_80091750", - "asm/non_matchings/menus" - ] + "asm/non_matchings/code_80004740", + "asm/non_matchings/code_80005FD0", + "asm/non_matchings/code_8001F980", + "asm/non_matchings/code_80027D00", + "asm/non_matchings/code_800431B0", + "asm/non_matchings/code_80057C60", + "asm/non_matchings/code_8006E9C0", + "asm/non_matchings/code_80071F00", + "asm/non_matchings/code_80086E70", + "asm/non_matchings/code_8008C1D0", + "asm/non_matchings/code_80091750", + "asm/non_matchings/crash_screen", + "asm/non_matchings/menus", + "asm/non_matchings/staff_ghosts", +] seg2Files2 = [ - "asm/non_matchings/code_8028DF00", "asm/non_matchings/code_80290C20", - "asm/non_matchings/code_actors", "asm/non_matchings/code_802A3730", - "asm/non_matchings/memory", "asm/non_matchings/code_802B0210", - "asm/non_matchings/math_util" + "asm/non_matchings/actors", + "asm/non_matchings/math_util", + "asm/non_matchings/memory", + "asm/non_matchings/race_logic", + "asm/non_matchings/render_courses", + "asm/non_matchings/skybox", ] seg3Files2 = [ - "asm/non_matchings/code_80280000", "asm/non_matchings/code_80280650", - "asm/non_matchings/code_80281610", "asm/non_matchings/code_80281780", - "asm/non_matchings/code_80281C40", "asm/non_matchings/code_80281FA0" + "asm/non_matchings/code_80280650", + "asm/non_matchings/code_80281FA0", ] audioFiles2 = [ "asm/non_matchings/audio" @@ -148,35 +153,54 @@ audio = 0 libultra = 0 mainSegFiles = [ - "build/us/src/main", "build/us/src/code_800029B0", - "build/us/src/profiler", "build/us/src/crash_screen", - "build/us/src/code_80004740", "build/us/src/staff_ghosts", + "build/us/src/code_800029B0", + "build/us/src/code_80004740", "build/us/src/code_80005FD0", - "build/us/src/code_8001C4D0", "build/us/src/code_8001F980", - "build/us/src/code_80027040", "build/us/src/code_80027D00", - "build/us/src/code_800393C0", "build/us/src/code_8003DC40", - "build/us/src/gbiMacro", "build/us/src/code_80040E50", - "build/us/src/code_800431B0", "build/us/src/code_80057C60", - "build/us/src/code_8006E9C0", "build/us/src/code_80071F00", - "build/us/src/code_80086E70", "build/us/src/code_8008C1D0", - "build/us/src/code_80091750", "build/us/src/code_800AF9B0" - ] + "build/us/src/code_8001F980", + "build/us/src/code_80027D00", + "build/us/src/code_800431B0", + "build/us/src/code_80057C60", + "build/us/src/code_8006E9C0", + "build/us/src/code_80071F00", + "build/us/src/code_80086E70", + "build/us/src/code_8008C1D0", + "build/us/src/code_80091750", + "build/us/src/code_800AF9B0", + "build/us/src/crash_screen", + "build/us/src/gbiMacro", + "build/us/src/kart_dma", + "build/us/src/main", + "build/us/src/math_util_2", + "build/us/src/profiler", + "build/us/src/spawn_players", + "build/us/src/staff_ghosts", +] seg2Files = [ - "build/us/src/code_8028DF00", "build/us/src/code_80290C20", - "build/us/src/code_80296A50", "build/us/src/code_802A3730", - "build/us/src/memory", "build/us/src/code_802B0210", - "build/us/src/math_util" + "build/us/src/actors", + "build/us/src/actors_extended", + "build/us/src/math_util", + "build/us/src/memory", + "build/us/src/race_logic", + "build/us/src/render_courses", + "build/us/src/skybox_and_splitscreen", ] seg3Files = [ - "build/us/src/code_80280000", "build/us/src/code_80280650", - "build/us/src/code_80281610", "build/us/src/code_80281780", - "build/us/src/code_80281C40", "build/us/src/code_80281FA0" + "build/us/src/camera_junk", + "build/us/src/code_80280000", + "build/us/src/code_80280650", + "build/us/src/code_80281780", + "build/us/src/code_80281C40", + "build/us/src/code_80281FA0", ] segAudioFiles = [ - "build/us/src/audio/synthesis", "build/us/src/audio/heap", - "build/us/src/audio/load", "build/us/src/audio/playback", - "build/us/src/audio/effects", "build/us/src/audio/seqplayer", - "build/us/src/audio/external", "build/us/src/audio/port_eu" + "build/us/src/audio/effects", + "build/us/src/audio/external", + "build/us/src/audio/heap", + "build/us/src/audio/load", + "build/us/src/audio/playback", + "build/us/src/audio/port_eu", + "build/us/src/audio/seqplayer", + "build/us/src/audio/synthesis", ] for line in mapFile: diff --git a/src/actors.c b/src/actors.c index ca83323d5..372c818dc 100644 --- a/src/actors.c +++ b/src/actors.c @@ -17,7 +17,6 @@ s32 D_802BA058; struct Actor *D_802BA05C; s8 D_802BA060[512]; // tlut 256 u16 D_802BA260; -extern u16 gNumActors; #ifdef MIPS_TO_C //generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b @@ -1560,8 +1559,6 @@ void func_8029A75C(Camera *arg0, Mat4 arg1, struct ShellActor *arg2) { func_8029A3AC(arg0, arg1, arg2); } -extern s8 D_0D004E68[]; - // Middle of a tlut access void func_8029A828(Camera *arg0, Mat4 arg1, struct ShellActor *arg2) { gDPLoadTLUT_pal256(gDisplayListHead++, &D_0D004E68[0x1D0]); diff --git a/src/actors.h b/src/actors.h index 310c3ba20..4d55a711a 100644 --- a/src/actors.h +++ b/src/actors.h @@ -31,6 +31,8 @@ void func_80298328(Camera*, Mat4, struct PiranhaPlant*); void func_802986B4(Camera*, Mat4, struct Actor*); void func_80298AC0(Player*); void func_80298D7C(Camera*, Mat4, struct Actor*); +void func_80298C94(); +void func_80298D10(); void func_80299144(Camera*, Mat4, struct Actor*); void func_8029930C(Camera*, Mat4, struct Actor*); void func_802994D4(Camera*, Mat4, struct Actor*); @@ -53,6 +55,7 @@ void update_obj_railroad_crossing(struct RailroadCrossing*); void update_obj_mario_raceway_sign(struct Actor*); void func_8029ABD4(Vec3f, s16); void func_8029AC18(Camera*, Mat4, struct Actor*); +void func_8029AE14(); void func_8029AE1C(Camera*, struct PaddleWheelBoat*, Mat4, u16); void func_8029B06C(Camera*, struct Actor*); void func_8029B2E4(Camera*, struct Actor*); @@ -110,6 +113,13 @@ extern void func_800C90F4(u8, uintptr_t); extern void func_800C99E0(Vec3f, s32); extern void func_800C9D80(Vec3f, Vec3f, u32); +extern s32 D_802BA050; +extern s32 D_802BA054; +extern s32 D_802BA058; +extern struct Actor *D_802BA05C; +extern s8 D_802BA060[512]; // tlut 256 +extern u16 D_802BA260; + extern struct Actor gActorList[]; extern Player gPlayers[]; extern u16 gNumActors; diff --git a/src/audio/external.h b/src/audio/external.h index 3a4512575..e2f290bbf 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -5,16 +5,21 @@ void play_sound2(s32); void func_800C8EAC(u16); +void func_800C8EF8(); +void func_800C90F4(u8, uintptr_t); void func_800CA008(u8, u8); void func_800CA0A0(); void func_800CA0B8(); void func_800CA0CC(); +void func_800CA118(); void func_800CA270(); +void func_800CA330(); void func_800CA330(s32); +void func_800CA388(); void func_800CA388(s32); +void func_800CA49C(); void func_800CB134(); void func_800CB2C4(void); -void func_800C90F4(u8, uintptr_t); extern s8 D_800EA0F4; extern s8 D_800EA108; diff --git a/src/camera_junk.c b/src/camera_junk.c index bc25bbfe9..aa2500f73 100644 --- a/src/camera_junk.c +++ b/src/camera_junk.c @@ -2,12 +2,9 @@ #include #include #include "camera.h" +#include "camera_junk.h" #include "math_util.h" -// guPerspective params -extern f32 D_80150148, D_8015014C, D_80150150; -extern f32 D_80150130[]; - void setup_camera_ending_sequence(void) { Camera *camera; f32 x_dist; diff --git a/src/camera_junk.h b/src/camera_junk.h new file mode 100644 index 000000000..402ef8ae1 --- /dev/null +++ b/src/camera_junk.h @@ -0,0 +1,13 @@ +#ifndef CAMERA_JUNK_H +#define CAMERA_JUNK_H + +/* Function Prototypes */ + +void setup_camera_ending_sequence(); +void func_802816B8(); + +// guPerspective params +extern f32 D_80150148, D_8015014C, D_80150150; +extern f32 D_80150130[]; + +#endif diff --git a/src/code_800029B0.c b/src/code_800029B0.c index 453ac52ec..d3451dd3b 100644 --- a/src/code_800029B0.c +++ b/src/code_800029B0.c @@ -5,9 +5,11 @@ #include "waypoints.h" #include "actors.h" #include "actor_types.h" +#include "math_util.h" +#include "audio/external.h" +#include "code_800029B0.h" #include -extern void func_800C8F44(u16 arg0); extern u16 D_800DC5A8; extern struct Controller *gControllerOne[]; @@ -34,13 +36,9 @@ extern u32 D_8015F734; extern u32 gPrevLoadedAddress; extern s32 D_80150120; -void func_800CA008(u8, u8); - extern f32 D_8015F738, D_8015F748, D_8015F758, D_8015F768, D_8015F778; extern u32 *D_802B91C8; -void vec3f_set(f32 *, f32, f32, f32); - // gfx? extern u32 *D_0F04FE28; extern u32 *D_0F050118; @@ -77,7 +75,7 @@ struct UnkStruct_800DC5EC *D_800DC5F0 = &D_8015F480[1]; struct UnkStruct_800DC5EC *D_800DC5F4 = &D_8015F480[2]; struct UnkStruct_800DC5EC *D_800DC5F8 = &D_8015F480[3]; u16 D_800DC5FC = 0; -uintptr_t *pAppNmiBuffer = &osAppNmiBuffer; +u8 *pAppNmiBuffer = &osAppNmiBuffer; s32 gIsMirrorMode = 0; f32 D_800DC608 = 1.0f; Lights1 D_800DC610[] = { diff --git a/src/code_800029B0.h b/src/code_800029B0.h new file mode 100644 index 000000000..95bec18fe --- /dev/null +++ b/src/code_800029B0.h @@ -0,0 +1,16 @@ +#ifndef CODE_800029B0_H +#define CODE_800029B0_H + +/* Function Prototypes */ + +void func_800029B0(); +void setup_race(); +void func_80002DAC(); +void clear_nmi_buffer(); +void func_80003040(); + +// audio/external + +void func_800C8F44(u16 arg0); + +#endif diff --git a/src/code_80004740.c b/src/code_80004740.c index 80e71f8fb..48f0d613e 100644 --- a/src/code_80004740.c +++ b/src/code_80004740.c @@ -2,10 +2,8 @@ #include #include #include -#include "trig_tables.h" - -//#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +#include "math_util.h" +#include "code_80004740.h" void func_80004740(Mtx *dest, Mat4 src) { #ifdef AVOID_UB @@ -27,10 +25,6 @@ void func_80004740(Mtx *dest, Mat4 src) { #endif } -extern f32 sins(u16); -extern f32 coss(u16); - - void func_800048D8(Mat4 dest, Vec3f b, Vec3s c) { register f32 sx = sins(c[0]); register f32 cx = coss(c[0]); @@ -63,139 +57,95 @@ void func_800048D8(Mat4 dest, Vec3f b, Vec3s c) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80004740(void *, ? *); // extern -? func_800048D8(? *, ? *, ? *); // extern +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_80162D70; extern s16 D_80162D76; extern s16 D_80162D7A; -extern s32 D_8018D120; -extern void *gDisplayListHead; void func_80004A1C(void *arg0, s32 arg1, void *arg2, s32 arg3) { - ? sp94; + f32 sp94; ? sp92; - ? sp8C; - ? sp4C; + s16 sp8C; u32 sp3C; - ? *temp_v0; - ? *temp_v1_3; + Gfx *temp_v1; + Gfx *temp_v1_2; + f32 *var_v0; + f32 *var_v0_2; + f32 temp_f18; + s16 *var_v1_3; s16 temp_t0; - s16 temp_t9; - s16 temp_t9_2; - s32 temp_t4; - s32 temp_t4_2; - s32 temp_t8; - s32 temp_t8_2; - s32 temp_v0_4; - void *temp_a0; - void *temp_a0_2; - void *temp_v0_2; - void *temp_v0_3; - void *temp_v1; - void *temp_v1_2; - void *temp_v1_4; - void *temp_v1_5; - s32 phi_t8; - s16 phi_t9; - ? *phi_v0; - void *phi_a0; - s32 phi_t8_2; - s16 phi_t9_2; - ? *phi_v0_2; - s32 phi_t4; - void *phi_v0_3; - s32 phi_t4_2; - void *phi_v0_4; - void *phi_v0_5; - s32 phi_a0_2; - ? *phi_v1; - void *phi_v1_2; - void *phi_v1_3; + s16 temp_t3; + s16 var_t9; + s32 temp_v0; + s32 var_a0_2; + s32 var_t4; + s32 var_t8; + void *var_a0; + void *var_v0_3; + void *var_v1; + void *var_v1_2; temp_t0 = D_80162D76; sp3C = arg0->unkC; if (temp_t0 == 0) { - temp_a0 = &D_80162D70 + 2; - temp_t9 = temp_a0->unk-2; - temp_t8 = arg0->unk10; - phi_t8 = temp_t8; - phi_t9 = temp_t9; - phi_v0 = &sp94; - phi_a0 = temp_a0; - phi_t8_2 = temp_t8; - phi_t9_2 = temp_t9; - phi_v0_2 = &sp94; - phi_v1_2 = arg0; - if (temp_a0 != &D_80162D76) { + var_v1 = arg0; + var_v0 = &sp94; + var_a0 = &D_80162D70 + 2; + var_t9 = var_a0->unk-2; + var_t8 = var_v1->unk10; + if (var_a0 != &D_80162D76) { do { - temp_a0_2 = phi_a0 + 2; - temp_v0 = phi_v0 + 4; - temp_v1 = phi_v1_2 + 4; - temp_t9_2 = temp_a0_2->unk-2; - temp_v0->unk-4 = phi_t8 + phi_t9; - temp_t8_2 = temp_v1->unk10; - phi_t8 = temp_t8_2; - phi_t9 = temp_t9_2; - phi_v0 = temp_v0; - phi_a0 = temp_a0_2; - phi_t8_2 = temp_t8_2; - phi_t9_2 = temp_t9_2; - phi_v0_2 = temp_v0; - phi_v1_2 = temp_v1; - } while (temp_a0_2 != &D_80162D76); + var_a0 += 2; + var_v0 += 4; + temp_f18 = (f32) (var_t8 + var_t9); + var_v1 += 4; + var_t9 = var_a0->unk-2; + var_v0->unk-4 = temp_f18; + var_t8 = var_v1->unk10; + } while (var_a0 != &D_80162D76); } - (phi_v0_2 + 4)->unk-4 = phi_t8_2 + phi_t9_2; + (var_v0 + 4)->unk-4 = (f32) (var_t8 + var_t9); D_80162D76 = temp_t0 + 1; } else { - temp_v0_2 = &sp94 + 4; - temp_t4 = arg0->unk10; - phi_t4 = temp_t4; - phi_v0_3 = temp_v0_2; - phi_t4_2 = temp_t4; - phi_v0_4 = temp_v0_2; - phi_v1_3 = arg0; - if (temp_v0_2 != &arg0) { + var_v1_2 = arg0; + var_v0_2 = &sp94 + 4; + var_t4 = var_v1_2->unk10; + if (var_v0_2 != &arg0) { do { - temp_v0_3 = phi_v0_3 + 4; - temp_v1_2 = phi_v1_3 + 4; - temp_v0_3->unk-8 = phi_t4; - temp_t4_2 = temp_v1_2->unk10; - phi_t4 = temp_t4_2; - phi_v0_3 = temp_v0_3; - phi_t4_2 = temp_t4_2; - phi_v0_4 = temp_v0_3; - phi_v1_3 = temp_v1_2; - } while (temp_v0_3 != &arg0); + var_v0_2 += 4; + var_v1_2 += 4; + var_v0_2->unk-8 = (f32) var_t4; + var_t4 = var_v1_2->unk10; + } while (var_v0_2 != &arg0); } - phi_v0_4->unk-4 = phi_t4_2; + var_v0_2->unk-4 = (f32) var_t4; } - phi_v0_5 = arg2; - phi_v1 = &sp8C; + var_v0_3 = arg2; + var_v1_3 = &sp8C; do { - phi_a0_2 = 0; - if (arg3 < phi_v0_5->unk0) { - phi_a0_2 = arg3; + var_a0_2 = 0; + if (arg3 < (s32) var_v0_3->unk0) { + var_a0_2 = arg3; } - temp_v1_3 = phi_v1 + 2; - temp_v1_3->unk-2 = *(arg1 + (phi_v0_5->unk2 * 2) + (phi_a0_2 * 2)); - phi_v0_5 += 4; - phi_v1 = temp_v1_3; - } while (temp_v1_3 != &sp92); - func_800048D8(&sp4C, &sp94, &sp8C); - func_80004740(gGfxPool + (D_8018D120 << 6) + 0x2C0, &sp4C); - temp_v1_4 = gDisplayListHead; - D_80162D7A = D_80162D7A + 1; - gDisplayListHead = temp_v1_4 + 8; - temp_v1_4->unk0 = 0x1040040; - temp_v1_4->unk4 = gGfxPool + (D_8018D120 << 6) + 0x800002C0; - D_8018D120 = D_8018D120 + 1; + var_v1_3 += 2; + temp_t3 = *(arg1 + (var_v0_3->unk2 * 2) + (var_a0_2 * 2)); + var_v0_3 += 4; + var_v1_3->unk-2 = temp_t3; + } while (var_v1_3 != &sp92); + func_800048D8((f32 (*)[4]) &sp4C[0], &sp94, &sp8C); + func_80004740(&gGfxPool->mtxPool[D_8018D120] + 0x2C0, (f32 (*)[4]) &sp4C[0]); + temp_v1 = gDisplayListHead; + D_80162D7A += 1; + gDisplayListHead = temp_v1 + 8; + temp_v1->words.w0 = 0x01040040; + temp_v1->words.w1 = (u32) (&gGfxPool->mtxPool[D_8018D120] + 0x800002C0); + D_8018D120 += 1; if (sp3C != 0) { - temp_v0_4 = lookup_item(sp3C); - temp_v1_5 = gDisplayListHead; - gDisplayListHead = temp_v1_5 + 8; - temp_v1_5->unk4 = temp_v0_4; - temp_v1_5->unk0 = 0x6000000; + temp_v0 = lookup_item(sp3C); + temp_v1_2 = gDisplayListHead; + gDisplayListHead = temp_v1_2 + 8; + temp_v1_2->words.w1 = (u32) temp_v0; + temp_v1_2->words.w0 = 0x06000000; } } #else diff --git a/src/code_80004740.h b/src/code_80004740.h new file mode 100644 index 000000000..b83804f29 --- /dev/null +++ b/src/code_80004740.h @@ -0,0 +1,11 @@ +#ifndef CODE_80004740_H +#define CODE_80004740_H + +#include "common_structs.h" + +/* Function Prototypes */ + +void func_80004740(Mtx *dest, Mat4 src); +void func_800048D8(Mat4 dest, Vec3f b, Vec3s c); + +#endif \ No newline at end of file diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h index 62fad9b51..14559c625 100644 --- a/src/code_80005FD0.h +++ b/src/code_80005FD0.h @@ -3,6 +3,7 @@ #include "common_structs.h" #include "vehicles.h" +#include "waypoints.h" // TODO: This header is missing some function prototypes @@ -12,12 +13,14 @@ s16 func_80005FD0(Vec3f, Vec3f); s32 func_80006018(f32, f32, f32, f32, f32, f32, f32, f32); void func_80006114(Vec3f, Vec3f, s16); s32 func_800061DC(Vec3f, f32, s32); +void func_800074D4(); s32 func_80007BF8(u16, u16, u16, u16, u16); void func_80008DC0(s32); s32 func_80008E58(s32, s32); void func_80008F38(s32); void func_80009000(s32); void func_800090F0(s32, Player*); +void func_80009B60(s32); s32 func_8000B7E4(s32, u16); s32 func_8000B820(s32); f32 func_8000B874(f32, f32, u16, s32); @@ -33,11 +36,11 @@ s16 func_8000CD24(f32, f32, f32, s16, Player*, s32, s32); s16 func_8000D24C(f32, f32, f32, s32*); s16 func_8000D2B4(f32, f32, f32, s16, s32); s16 func_8000D33C(f32, f32, f32, s16, s32); -s16 func_8000D6D0(Vec3f, s16 *, f32, f32, s32, s32); -s16 func_8000D940(Vec3f, s16 *, f32, f32, s32); +s16 func_8000D6D0(Vec3f, s16*, f32, f32, s32, s32); +s16 func_8000D940(Vec3f, s16*, f32, f32, s32); s16 func_8000DBAC(Vec3f, s16*, f32); -void func_8000F0E0(void); -void func_8000F124(void); +void func_8000F0E0(); +void func_8000F124(); void func_80010218(s32); f32 func_80010480(s32, u16); void func_800107C4(s32); @@ -67,6 +70,7 @@ void func_80014CC0(s32, Player*); void func_80014D08(s32); void func_80014D30(s32, s32); void func_8001968C(); +void func_8001C05C(); void func_8001C3C4(s32); /* This is where I'd put my static data, if I had any */ diff --git a/src/code_8001F980.c b/src/code_8001F980.c index 25af500ff..556c01c6e 100644 --- a/src/code_8001F980.c +++ b/src/code_8001F980.c @@ -6,10 +6,13 @@ #include "variables.h" #include "math_util.h" #include "math_util_2.h" +#include "main.h" +#include "functions.h" +#include "kart_dma.h" #include "code_8001F980.h" #include "code_80057C60.h" #include "framebuffers.h" -#include "main.h" +#include "waypoints.h" // Not yet implemented. Needs more work to match. // Remove ifdef when matching. @@ -132,9 +135,8 @@ u16 func_8001FD78(Player *player, f32 posX, f32 arg2, f32 posZ) { } #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc ? func_8001F9E4(s8); /* extern */ -? func_8002934C(Player *, Camera *, s8, s8); /* extern */ extern ? D_80164AB0; extern ? D_80164AC0; extern ? D_80164AD0; @@ -268,16 +270,6 @@ block_21: GLOBAL_ASM("asm/non_matchings/code_8001F980/func_80020000.s") #endif -extern OSMesgQueue gDmaMesgQueue; -extern void *gMainReceivedMesg; -extern s16 D_80164AAE[]; -extern s16 D_80164AB0[]; -extern s16 D_80164ABE[]; -extern s16 D_80164AC0[]; -extern s32 D_80164AD0[]; -void func_80027560(Player*, s8, s8, s8, s8); -void mio0decode(u8*, u8*); - void func_80020524(void) { s16 i; @@ -308,39 +300,41 @@ void func_80020524(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80027560(s32, s8, s8, s8, s32); // extern -? func_8006E634(Player *, ?, ?); // extern -extern s32 D_800DDB58; -extern OSMesgQueue gDmaMesgQueue; -extern void *gMainReceivedMesg; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +typedef struct { + /* 0x000 */ u8 unk0; /* inferred */ + /* 0x001 */ char pad1[0x91F]; /* maybe part of unk0[0x920]? */ +} struct_D_802DFB80; /* size = 0x920 */ + extern ? D_80164AAE; extern s16 D_80164AB0; extern ? D_80164ABE; extern s16 D_80164AC0; -extern s32 D_80164AD0; +extern Player *D_80164AD0; +extern ? gFramebuffer0; +extern ? gFramebuffer1; +extern ? gFramebuffer2; +static s32 D_800DDB58[4] = { 0, (s32) &gFramebuffer0, (s32) &gFramebuffer1, (s32) &gFramebuffer2 }; void func_8002088C(void) { + s16 *temp_s1; + s16 *temp_s2; s16 temp_a2; s16 temp_a2_2; - s16 temp_s0; s16 temp_t0; s16 temp_t0_2; s16 temp_v0; - s16 temp_v0_3; + s16 temp_v0_2; s16 temp_v1; s16 temp_v1_2; s16 temp_v1_3; s16 temp_v1_4; + s16 var_s0; s32 temp_a3; - s32 temp_v0_2; - void *temp_s1; - void *temp_s2; - s16 phi_s0; temp_v1 = D_80164AC0; temp_v0 = D_80164AB0; - func_80027560(D_80164AD0, temp_v0, temp_v1, temp_v1, *(&D_801651D0[temp_v1] + (temp_v0 * 2))); + func_80027560(D_80164AD0, (s8) temp_v0, (s8) temp_v1, (s8) temp_v1, (s8) (s32) D_801651D0[temp_v1][temp_v0]); func_8006E634(gPlayerOneCopy, 0, 1); func_8006E634(gPlayerTwo, 1, 1); func_8006E634(gPlayerThree, 2, 1); @@ -352,163 +346,161 @@ void func_8002088C(void) { func_8006E634(gPlayerEight, 7, 1); } osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); - phi_s0 = 1; - if (D_800DDB58 >= 2) { + var_s0 = 1; + if (*D_800DDB58 >= 2) { do { - temp_v0_2 = phi_s0 * 2; - temp_s2 = temp_v0_2 + &D_80164AC0; + temp_s2 = &(&D_80164AC0)[var_s0]; temp_t0 = temp_s2->unk0; - temp_s1 = temp_v0_2 + &D_80164AB0; + temp_s1 = &(&D_80164AB0)[var_s0]; temp_v1_2 = temp_s1->unk0; - func_80027560(*(&D_80164AD0 + (phi_s0 * 4)), temp_v1_2, temp_t0, temp_t0, *(&D_801651D0[temp_t0] + (temp_v1_2 * 2))); - temp_v0_3 = temp_s2->unk-2; + func_80027560((&D_80164AD0)[var_s0], (s8) temp_v1_2, (s8) temp_t0, (s8) temp_t0, (s8) (s32) D_801651D0[temp_t0][temp_v1_2]); + temp_v0_2 = temp_s2->unk-2; temp_v1_3 = temp_s1->unk-2; - temp_a2 = *(&D_801651D0[temp_v0_3] + (temp_v1_3 * 2)); - mio0decode(D_802DFB80 + (temp_a2 * 0x9200) + (temp_v0_3 * 0x4900) + (temp_v1_3 * 0x920), &D_802BFB80[(temp_a2 << 0x10) + (temp_v0_3 << 0xF) + (temp_v1_3 << 0xC)]); + temp_a2 = D_801651D0[temp_v0_2][temp_v1_3]; + mio0decode(&D_802DFB80[temp_a2][temp_v0_2][temp_v1_3], &D_802BFB80[temp_a2][temp_v0_2][temp_v1_3]); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); - temp_s0 = phi_s0 + 1; - phi_s0 = temp_s0; - } while (temp_s0 < D_800DDB58); + var_s0 += 1; + } while (var_s0 < *D_800DDB58); } - temp_a3 = D_800DDB58 * 2; + temp_a3 = *D_800DDB58 * 2; temp_v1_4 = *(&D_80164ABE + temp_a3); temp_a2_2 = *(&D_80164AAE + temp_a3); - temp_t0_2 = *(&D_801651D0[temp_v1_4] + (temp_a2_2 * 2)); - mio0decode(D_802DFB80 + (temp_t0_2 * 0x9200) + (temp_v1_4 * 0x4900) + (temp_a2_2 * 0x920), &D_802BFB80[(temp_t0_2 << 0x10) + (temp_v1_4 << 0xF) + (temp_a2_2 << 0xC)]); + temp_t0_2 = D_801651D0[temp_v1_4][temp_a2_2]; + mio0decode(&D_802DFB80[temp_t0_2][temp_v1_4][temp_a2_2], &D_802BFB80[temp_t0_2][temp_v1_4][temp_a2_2]); } #else GLOBAL_ASM("asm/non_matchings/code_8001F980/func_8002088C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80027560(s32, s8, s8, s8, s32); // extern -? func_8006E6BC(Player *, ?, ?); // extern -extern s32 D_800DDB58; -extern OSMesgQueue gDmaMesgQueue; -extern void *gMainReceivedMesg; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +typedef struct { + /* 0x000 */ u8 unk0; /* inferred */ + /* 0x001 */ char pad1[0x91F]; /* maybe part of unk0[0x920]? */ +} struct_D_802DFB80; /* size = 0x920 */ + extern ? D_80164AAE; extern s16 D_80164AB0; extern ? D_80164ABE; extern s16 D_80164AC0; -extern s32 D_80164AD0; +extern Player *D_80164AD0; +extern ? gFramebuffer0; +extern ? gFramebuffer1; +extern ? gFramebuffer2; +static s32 D_800DDB58[4] = { 0, (s32) &gFramebuffer0, (s32) &gFramebuffer1, (s32) &gFramebuffer2 }; void func_80020BF4(void) { + s16 *temp_s1; + s16 *temp_s2; s16 temp_a2; s16 temp_a2_2; - s16 temp_s0; s16 temp_t0; s16 temp_t0_2; s16 temp_v0; s16 temp_v0_2; s16 temp_v0_3; s16 temp_v1; + s16 temp_v1_2; s16 temp_v1_3; - s16 temp_v1_4; + s16 var_s0; s32 temp_a3; - s32 temp_v1_2; - void *temp_s1; - void *temp_s2; - s16 phi_s0; temp_v0 = D_80164AC0; temp_v1 = D_80164AB0; - func_80027560(D_80164AD0, temp_v1 + 4, temp_v0, temp_v0 - 2, *(&D_801651D0[temp_v0] + (temp_v1 * 2))); + func_80027560(D_80164AD0, (s8) (temp_v1 + 4), (s8) temp_v0, (s8) (temp_v0 - 2), (s8) (s32) D_801651D0[temp_v0][temp_v1]); func_8006E6BC(gPlayerOneCopy, 0, 2); func_8006E6BC(gPlayerTwo, 1, 2); func_8006E6BC(gPlayerThree, 2, 2); func_8006E6BC(gPlayerFour, 3, 2); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); - phi_s0 = 1; - if (D_800DDB58 >= 2) { + var_s0 = 1; + if (*D_800DDB58 >= 2) { do { - temp_v1_2 = phi_s0 * 2; - temp_s1 = temp_v1_2 + &D_80164AB0; + temp_s1 = &(&D_80164AB0)[var_s0]; temp_t0 = temp_s1->unk0; - temp_s2 = temp_v1_2 + &D_80164AC0; + temp_s2 = &(&D_80164AC0)[var_s0]; temp_v0_2 = temp_s2->unk0; - func_80027560(*(&D_80164AD0 + (phi_s0 * 4)), temp_t0 + 4, temp_v0_2, temp_v0_2 - 2, *(&D_801651D0[temp_v0_2] + (temp_t0 * 2))); + func_80027560((&D_80164AD0)[var_s0], (s8) (temp_t0 + 4), (s8) temp_v0_2, (s8) (temp_v0_2 - 2), (s8) (s32) D_801651D0[temp_v0_2][temp_t0]); temp_v0_3 = temp_s2->unk-2; - temp_v1_3 = temp_s1->unk-2; - temp_a2 = *(&D_801651D0[temp_v0_3] + (temp_v1_3 * 2)); - mio0decode((D_802DFB80 + (temp_a2 * 0x9200) + (temp_v0_3 * 0x4900) + (temp_v1_3 * 0x920)) - 0x6D80, &D_802BFB80[(temp_a2 << 0x10) + (temp_v0_3 << 0xF) + (temp_v1_3 << 0xC) + 0xFFFF4000]); + temp_v1_2 = temp_s1->unk-2; + temp_a2 = D_801651D0[temp_v0_3][temp_v1_2]; + mio0decode(&D_802DFB80[temp_a2][temp_v0_3 - 2][temp_v1_2 + 4], &D_802BFB80[temp_a2][temp_v0_3 - 2][temp_v1_2 + 4]); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); - temp_s0 = phi_s0 + 1; - phi_s0 = temp_s0; - } while (temp_s0 < D_800DDB58); + var_s0 += 1; + } while (var_s0 < *D_800DDB58); } - temp_a3 = D_800DDB58 * 2; - temp_v1_4 = *(&D_80164ABE + temp_a3); + temp_a3 = *D_800DDB58 * 2; + temp_v1_3 = *(&D_80164ABE + temp_a3); temp_a2_2 = *(&D_80164AAE + temp_a3); - temp_t0_2 = *(&D_801651D0[temp_v1_4] + (temp_a2_2 * 2)); - mio0decode((D_802DFB80 + (temp_t0_2 * 0x9200) + (temp_v1_4 * 0x4900) + (temp_a2_2 * 0x920)) - 0x6D80, &D_802BFB80[(temp_t0_2 << 0x10) + (temp_v1_4 << 0xF) + (temp_a2_2 << 0xC) + 0xFFFF4000]); + temp_t0_2 = D_801651D0[temp_v1_3][temp_a2_2]; + mio0decode(&D_802DFB80[temp_a2][temp_v0_3 - 2][temp_v1_2 + 4], &D_802BFB80[temp_t0_2][temp_v1_3 - 2][temp_a2_2 + 4]); } #else GLOBAL_ASM("asm/non_matchings/code_8001F980/func_80020BF4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80027560(s32, s8, s8, s8, s32); // extern -? func_8006E744(Player *, ?, ?); // extern -extern s32 D_800DDB58; -extern OSMesgQueue gDmaMesgQueue; -extern void *gMainReceivedMesg; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +typedef struct { + /* 0x000 */ u8 unk0; /* inferred */ + /* 0x001 */ char pad1[0x91F]; /* maybe part of unk0[0x920]? */ +} struct_D_802DFB80; /* size = 0x920 */ + extern ? D_80164AAE; extern s16 D_80164AB0; extern ? D_80164ABE; extern s16 D_80164AC0; -extern s32 D_80164AD0; +extern Player *D_80164AD0; +extern ? gFramebuffer0; +extern ? gFramebuffer1; +extern ? gFramebuffer2; +static s32 D_800DDB58[4] = { 0, (s32) &gFramebuffer0, (s32) &gFramebuffer1, (s32) &gFramebuffer2 }; void func_80020F1C(void) { + s16 *temp_s1; + s16 *temp_s2; s16 temp_a2; s16 temp_a2_2; - s16 temp_s0; s16 temp_t0; s16 temp_t0_2; s16 temp_v0; s16 temp_v0_2; s16 temp_v0_3; s16 temp_v1; + s16 temp_v1_2; s16 temp_v1_3; - s16 temp_v1_4; + s16 var_s0; s32 temp_a3; - s32 temp_v1_2; - void *temp_s1; - void *temp_s2; - s16 phi_s0; temp_v0 = D_80164AC0; temp_v1 = D_80164AB0; - func_80027560(D_80164AD0, temp_v1 + 4, temp_v0, temp_v0 - 2, *(&D_801651D0[temp_v0] + (temp_v1 * 2))); + func_80027560(D_80164AD0, (s8) (temp_v1 + 4), (s8) temp_v0, (s8) (temp_v0 - 2), (s8) (s32) D_801651D0[temp_v0][temp_v1]); func_8006E744(gPlayerOneCopy, 0, 3); func_8006E744(gPlayerTwo, 1, 3); func_8006E744(gPlayerThree, 2, 3); func_8006E744(gPlayerFour, 3, 3); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); - phi_s0 = 1; - if (D_800DDB58 >= 2) { + var_s0 = 1; + if (*D_800DDB58 >= 2) { do { - temp_v1_2 = phi_s0 * 2; - temp_s1 = temp_v1_2 + &D_80164AB0; + temp_s1 = &(&D_80164AB0)[var_s0]; temp_t0 = temp_s1->unk0; - temp_s2 = temp_v1_2 + &D_80164AC0; + temp_s2 = &(&D_80164AC0)[var_s0]; temp_v0_2 = temp_s2->unk0; - func_80027560(*(&D_80164AD0 + (phi_s0 * 4)), temp_t0 + 4, temp_v0_2, temp_v0_2 - 2, *(&D_801651D0[temp_v0_2] + (temp_t0 * 2))); + func_80027560((&D_80164AD0)[var_s0], (s8) (temp_t0 + 4), (s8) temp_v0_2, (s8) (temp_v0_2 - 2), (s8) (s32) D_801651D0[temp_v0_2][temp_t0]); temp_v0_3 = temp_s2->unk-2; - temp_v1_3 = temp_s1->unk-2; - temp_a2 = *(&D_801651D0[temp_v0_3] + (temp_v1_3 * 2)); - mio0decode((D_802DFB80 + (temp_a2 * 0x9200) + (temp_v0_3 * 0x4900) + (temp_v1_3 * 0x920)) - 0x6D80, &D_802BFB80[(temp_a2 << 0x10) + (temp_v0_3 << 0xF) + (temp_v1_3 << 0xC) + 0xFFFF4000]); + temp_v1_2 = temp_s1->unk-2; + temp_a2 = D_801651D0[temp_v0_3][temp_v1_2]; + mio0decode(&D_802DFB80[temp_a2][temp_v0_3 - 2][temp_v1_2 + 4], &D_802BFB80[temp_a2][temp_v0_3 - 2][temp_v1_2 + 4]); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); - temp_s0 = phi_s0 + 1; - phi_s0 = temp_s0; - } while (temp_s0 < D_800DDB58); + var_s0 += 1; + } while (var_s0 < *D_800DDB58); } - temp_a3 = D_800DDB58 * 2; - temp_v1_4 = *(&D_80164ABE + temp_a3); + temp_a3 = *D_800DDB58 * 2; + temp_v1_3 = *(&D_80164ABE + temp_a3); temp_a2_2 = *(&D_80164AAE + temp_a3); - temp_t0_2 = *(&D_801651D0[temp_v1_4] + (temp_a2_2 * 2)); - mio0decode((D_802DFB80 + (temp_t0_2 * 0x9200) + (temp_v1_4 * 0x4900) + (temp_a2_2 * 0x920)) - 0x6D80, &D_802BFB80[(temp_t0_2 << 0x10) + (temp_v1_4 << 0xF) + (temp_a2_2 << 0xC) + 0xFFFF4000]); + temp_t0_2 = D_801651D0[temp_v1_3][temp_a2_2]; + mio0decode(&D_802DFB80[temp_a2][temp_v0_3 - 2][temp_v1_2 + 4], &D_802BFB80[temp_t0_2][temp_v1_3 - 2][temp_a2_2 + 4]); } #else GLOBAL_ASM("asm/non_matchings/code_8001F980/func_80020F1C.s") @@ -525,57 +517,57 @@ void func_80021244(Player *player, s8 arg1, s8 arg2) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80020000(Player *, s32, ?, ?); // extern -? func_80020524(Player **, ?, ?); // extern -? func_80021244(Player *, ?, ?); // extern -? func_8006E5AC(Player *, ?, ?); // extern -extern s32 D_800DDB58; -extern ? D_800DDB68; -extern ? D_800DDB88; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_80020524(Player **, s8, s8); /* extern */ +extern ? gFramebuffer0; +extern ? gFramebuffer1; +extern ? gFramebuffer2; +static ? *D_800DDB58[4] = { NULL, &gFramebuffer0, &gFramebuffer1, &gFramebuffer2 }; +static ? D_800DDB68; /* unable to generate initializer */ +static ? D_800DDB88; /* unable to generate initializer */ void func_800212B4(void) { ? sp3C; ? sp1C; - sp3C.unk0 = D_800DDB68.unk0; - sp3C.unk4 = D_800DDB68.unk4; - sp3C.unkC = D_800DDB68.unkC; - sp3C.unk8 = D_800DDB68.unk8; - sp3C.unk10 = D_800DDB68.unk10; - sp3C.unk14 = D_800DDB68.unk14; - sp3C.unk1C = D_800DDB68.unk1C; - sp3C.unk18 = D_800DDB68.unk18; - sp1C.unk0 = D_800DDB88.unk0; - sp1C.unk4 = D_800DDB88.unk4; - sp1C.unk8 = D_800DDB88.unk8; - sp1C.unkC = D_800DDB88.unkC; - sp1C.unk10 = D_800DDB88.unk10; - sp1C.unk14 = D_800DDB88.unk14; - sp1C.unk18 = D_800DDB88.unk18; - sp1C.unk1C = D_800DDB88.unk1C; - D_800DDB58 = 0; - func_80020000(gPlayerOneCopy, camera1, 0, 0); - func_80020000(gPlayerTwo, camera1, 1, 0); - func_80020000(gPlayerThree, camera1, 2, 0); - func_80020000(gPlayerFour, camera1, 3, 0); + sp3C.unk0 = (s32) D_800DDB68.unk0; + sp3C.unk4 = (s32) D_800DDB68.unk4; + sp3C.unkC = (s32) D_800DDB68.unkC; + sp3C.unk8 = (s32) D_800DDB68.unk8; + sp3C.unk10 = (s32) D_800DDB68.unk10; + sp3C.unk14 = (s32) D_800DDB68.unk14; + sp3C.unk1C = (s32) D_800DDB68.unk1C; + sp3C.unk18 = (s32) D_800DDB68.unk18; + sp1C.unk0 = (s32) D_800DDB88.unk0; + sp1C.unk4 = (s32) D_800DDB88.unk4; + sp1C.unk8 = (s32) D_800DDB88.unk8; + sp1C.unkC = (s32) D_800DDB88.unkC; + sp1C.unk10 = (s32) D_800DDB88.unk10; + sp1C.unk14 = (s32) D_800DDB88.unk14; + sp1C.unk18 = (s32) D_800DDB88.unk18; + sp1C.unk1C = (s32) D_800DDB88.unk1C; + *D_800DDB58 = NULL; + func_80020000(gPlayerOneCopy, camera1, 0U, 0U); + func_80020000(gPlayerTwo, camera1, 1U, 0U); + func_80020000(gPlayerThree, camera1, 2U, 0U); + func_80020000(gPlayerFour, camera1, 3U, 0U); if (gActiveScreenMode != 3) { - func_80020000(gPlayerFive, camera1, 4, 0); - func_80020000(gPlayerSix, camera1, 5, 0); - func_80020000(gPlayerSeven, camera1, 6, 0); - func_80020000(gPlayerEight, camera1, 7, 0); + func_80020000(gPlayerFive, camera1, 4U, 0U); + func_80020000(gPlayerSix, camera1, 5U, 0U); + func_80020000(gPlayerSeven, camera1, 6U, 0U); + func_80020000(gPlayerEight, camera1, 7U, 0U); } - func_80021244(gPlayerOne, 0, 0); - func_80021244(gPlayerTwo, 1, 0); - func_80021244(gPlayerThree, 2, 0); - func_80021244(gPlayerFour, 3, 0); + func_80021244(gPlayerOne, 0U, 0U); + func_80021244(gPlayerTwo, 1U, 0U); + func_80021244(gPlayerThree, 2U, 0U); + func_80021244(gPlayerFour, 3U, 0U); if (gActiveScreenMode != 3) { - func_80021244(gPlayerFive, 4, 0); - func_80021244(gPlayerSix, 5, 0); - func_80021244(gPlayerSeven, 6, 0); - func_80021244(gPlayerEight, 7, 0); + func_80021244(gPlayerFive, 4U, 0U); + func_80021244(gPlayerSix, 5U, 0U); + func_80021244(gPlayerSeven, 6U, 0U); + func_80021244(gPlayerEight, 7U, 0U); } - if (D_800DDB58 != 0) { + if (*D_800DDB58 != NULL) { func_80020524(&gPlayerOneCopy, 0, 0); } else { func_8006E5AC(gPlayerOneCopy, 0, 0); @@ -589,7 +581,7 @@ void func_800212B4(void) { func_8006E5AC(gPlayerEight, 7, 0); } } - D_800DDB58 = 0; + *D_800DDB58 = NULL; } #else GLOBAL_ASM("asm/non_matchings/code_8001F980/func_800212B4.s") @@ -679,9 +671,9 @@ void func_800219BC(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80024374(Player *, ?, ?); // extern -? func_8006E7CC(Player *, ?, ?); // extern +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_80024374(Player *, ?, ?); /* extern */ +extern s32 gGamestate; void func_80021B0C(void) { Player *temp_a0; @@ -699,21 +691,21 @@ void func_80021B0C(void) { func_8006E7CC(gPlayerSeven, 6, 0); func_8006E7CC(gPlayerEight, 7, 0); } - if (gGamestate == ENDING_SEQUENCE) { + if (gGamestate == 5) { temp_a0 = gPlayerOne; - if ((temp_a0->unk_044 & 0x2000) != 0) { + if (temp_a0->unk_044 & 0x2000) { func_80024374(temp_a0, 0, 0); } temp_a0_2 = gPlayerTwo; - if ((temp_a0_2->unk_044 & 0x2000) != 0) { + if (temp_a0_2->unk_044 & 0x2000) { func_80024374(temp_a0_2, 1, 0); } temp_a0_3 = gPlayerThree; - if ((temp_a0_3->unk_044 & 0x2000) != 0) { + if (temp_a0_3->unk_044 & 0x2000) { func_80024374(temp_a0_3, 2, 0); } temp_a0_4 = gPlayerFour; - if ((temp_a0_4->unk_044 & 0x2000) != 0) { + if (temp_a0_4->unk_044 & 0x2000) { func_80024374(temp_a0_4, 3, 0); } } @@ -1067,13 +1059,6 @@ Vtx D_800E49C0[] = { }; */ -// uintptr_t derefereced to Vtx -// import me .data -extern Vtx *D_800DDBB4[]; - -// import me .data -extern f32 D_800ED6A8; - void func_80022CA8(Player *player, s8 arg1, s8 arg2, s8 arg3) { s16 temp_v0 = player->unk_DA4; @@ -1130,10 +1115,6 @@ void func_80022E84(Player *player, s8 arg1, s8 arg2, s8 arg3) { D_800DDBB4[arg1][arg3 + 0x7].v.ob[1] = 9 - temp_v0; } -extern u16 D_80164B10[]; -extern u16 D_80164B20[]; -extern u16 D_80164B30[]; - /** * Sets player shading/colour. */ @@ -1145,19 +1126,12 @@ void func_80022F14(Player *player, s8 arg1, s32 arg2, f32 arg3) { D_80164B30[arg1] = (s16) ((f32)D_80164B30[arg1] - ((D_80164B30[arg1] - (arg2 & 0xFF)) * arg3)); } -extern u16 D_80164B40[]; -extern u16 D_80164B50[]; -extern u16 D_80164B60[]; - void func_80023038(Player *player, s8 arg1, s32 arg2, f32 arg3) { move_u16_towards(&D_80164B40[arg1], (arg2 >> 16) & 0xFF, arg3); move_u16_towards(&D_80164B50[arg1], (arg2 >> 8) & 0xFF, arg3); move_u16_towards(&D_80164B60[arg1], arg2 & 0xFF, arg3); } -extern u16 gNearestWaypointByPlayerId[]; -extern s32 D_80164B80[]; - /** * Activates in the tunnel to shade the player a bit darker * Sort of an atmospheric effect. @@ -1243,8 +1217,6 @@ void func_800231D8(Player *player, s8 arg1) { } } -extern s32 D_8018D930[]; - void func_800235AC(Player *player, s8 arg1) { s32 temp; @@ -1353,18 +1325,6 @@ void func_80023BF0(Player *player, s8 arg1, s8 arg2, s8 arg3) { } } -//#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -//? func_8004B414(?, ?, ?, ?); /* extern */ -extern Gfx D_0D008C78[]; -extern Gfx D_0D008D58[]; -extern u32 D_8018D474; -//static f32 D_800DDBD4[8] = { 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f }; -extern Vtx D_800E51D0[]; //static? /* unable to generate initializer */ -extern f32 D_800DDBD4[]; - -#define SOME_TEXTURE_POINTER_MATH 0x800 - void func_80023C84(Player *player, s8 arg1, s8 arg2) { Mat4 sp118; Mat4 pad; @@ -1440,17 +1400,15 @@ void func_80023C84(Player *player, s8 arg1, s8 arg2) { } #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -? func_8004B414(?, ?, ?, ?); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_0D008C78; extern ? D_0D008D58; extern ? D_80165C20; -extern ? D_80183EA0; extern u32 D_8018D474; static f32 D_800DDBD4[8] = { 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f }; static ? D_800DDE9C; /* unable to generate initializer */ static ? D_800E51D0; /* unable to generate initializer */ -static ? D_800E5210; // COMPILER GENERATED [4] +0x40 /* unable to generate initializer */ +static ? D_800E5210; /* unable to generate initializer */ void func_80024374(Player *player, s8 arg1, s8 arg2) { f32 spD4; @@ -1493,39 +1451,35 @@ void func_80024374(Player *player, s8 arg1, s8 arg2) { s16 temp_v1; s32 temp_s0; s32 temp_s0_2; - s32 temp_s0_3; - s32 temp_t8; s32 temp_t9; sp94.unk0 = (s32) D_800DDE9C.unk0; sp94.unk4 = (s32) D_800DDE9C.unk4; sp94.unk8 = (s32) D_800DDE9C.unk8; - temp_v0 = player->unk_02C[1]; + temp_v0 = player->unk_02E; temp_v1 = player->unk_0C0; temp_t9 = (((s32) ((temp_v0 + (player + (arg2 * 2))->unk48 + temp_v1) & 0xFFFF) / 128) << 7) & 0xFFFF; spC0 = -temp_v0 - temp_v1; - temp_s0 = temp_t9; spB0 = -coss(temp_t9 & 0xFFFF) * 3.0f; - temp_f18 = -sins(temp_s0 & 0xFFFF) * 3.0f; + temp_f18 = -sins(temp_t9 & 0xFFFF) * 3.0f; spC4 = 0; - temp_s0_2 = spC0 & 0xFFFF; + temp_s0 = spC0 & 0xFFFF; spC8 = 0; spC6 = spC0; spAC = temp_f18; - sp30 = sins(temp_s0_2 & 0xFFFF); - spCC = (coss(temp_s0_2 & 0xFFFF) * spAC) + (spB0 * sp30) + player->pos[0]; - sp30 = coss(temp_s0_2 & 0xFFFF); - temp_t8 = arg1 * 4; - spD4 = ((spB0 * sp30) - (sins(temp_s0_2 & 0xFFFF) * temp_f18)) + player->pos[2]; - spD0 = (sp + temp_t8)->unk94 + *(&D_80165C20 + (*(&D_80183EA0 + temp_t8) * 0xE0)); + sp30 = sins(temp_s0 & 0xFFFF); + spCC = (coss(temp_s0 & 0xFFFF) * spAC) + (spB0 * sp30) + player->pos[0]; + sp30 = coss(temp_s0 & 0xFFFF); + spD4 = ((spB0 * sp30) - (sins(temp_s0 & 0xFFFF) * temp_f18)) + player->pos[2]; + spD0 = (sp + (arg1 * 4))->unk94 + *(&D_80165C20 + (D_80183EA0[arg1] * 0xE0)); func_80021E10((f32 (*)[4]) &sp118[0], &spCC, &spC4); func_80021F84((f32 (*)[4]) &sp118[0], D_800DDBD4[player->characterId] * player->unk_224); - temp_s0_3 = arg2 << 9; - func_80022180(&gGfxPool->mtxPool[arg1] + temp_s0_3 + 0xEAC0, (f32 (*)[4]) &sp118[0]); + temp_s0_2 = arg2 << 9; + func_80022180(&gGfxPool->mtxPool[arg1] + temp_s0_2 + 0xEAC0, (f32 (*)[4]) &sp118[0]); temp_v0_2 = gDisplayListHead; gDisplayListHead = temp_v0_2 + 8; temp_v0_2->words.w0 = 0x01020040; - temp_v0_2->words.w1 = (s32) (&gGfxPool->mtxPool[arg1] + temp_s0_3 + 0xEAC0) & 0x1FFFFFFF; + temp_v0_2->words.w1 = (s32) (&gGfxPool->mtxPool[arg1] + temp_s0_2 + 0xEAC0) & 0x1FFFFFFF; temp_v0_3 = gDisplayListHead; gDisplayListHead = temp_v0_3 + 8; temp_v0_3->words.w1 = (u32) &D_0D008D58; @@ -1562,7 +1516,7 @@ void func_80024374(Player *player, s8 arg1, s8 arg2) { gDisplayListHead = temp_v0_11 + 8; temp_v0_11->words.w0 = 0xF2000000; temp_v0_11->words.w1 = 0x000FC07C; - func_8004B414(0, 0, 0, 0xD0); + func_8004B414(0, 0, 0, 0x000000D0); temp_v0_12 = gDisplayListHead; gDisplayListHead = temp_v0_12 + 8; temp_v0_12->words.w0 = 0xB900031D; @@ -1603,7 +1557,7 @@ void func_80024374(Player *player, s8 arg1, s8 arg2) { gDisplayListHead = temp_v0_21 + 8; temp_v0_21->words.w0 = 0xF2000000; temp_v0_21->words.w1 = 0x000FC07C; - func_8004B414(0, 0, 0, 0xD0); + func_8004B414(0, 0, 0, 0x000000D0); temp_v0_22 = gDisplayListHead; gDisplayListHead = temp_v0_22 + 8; temp_v0_22->words.w0 = 0xB900031D; @@ -1626,10 +1580,8 @@ GLOBAL_ASM("asm/non_matchings/code_8001F980/func_80024374.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -? func_8004B614(u16, u16, u16, u16, s32, s32, s32); /* extern */ -? func_80062B18(f32 *, f32 *, f32 *, f32, f32, f32, s32, s32); /* extern */ -extern ? D_0D008C78; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +extern u8 D_0D008C78; extern ? D_0D008CD8; extern void *D_80164B04; extern u8 *D_80164B08; @@ -1670,7 +1622,7 @@ void func_800248D0(Player *player, s8 arg1, s8 arg2, s8 arg3) { Gfx *temp_v0_21; Gfx *temp_v0_22; Gfx *temp_v0_23; - Gfx *temp_v0_25; + Gfx *temp_v0_24; Gfx *temp_v0_26; Gfx *temp_v0_27; Gfx *temp_v0_28; @@ -1711,16 +1663,18 @@ void func_800248D0(Player *player, s8 arg1, s8 arg2, s8 arg3) { Gfx *temp_v0_62; Gfx *temp_v0_63; Gfx *temp_v0_64; + Gfx *temp_v0_65; + Gfx *temp_v0_66; Gfx *temp_v0_6; Gfx *temp_v0_7; Gfx *temp_v0_8; Gfx *temp_v0_9; - Gfx *var_v0; s16 temp_v1; + s16 temp_v1_2; s32 *temp_t5; s32 temp_t0; s32 temp_t7; - s32 temp_v0_24; + s32 temp_v0_25; s32 var_s0; u32 var_t7; u8 *temp_v0_3; @@ -1734,41 +1688,42 @@ void func_800248D0(Player *player, s8 arg1, s8 arg2, s8 arg3) { temp_v0 = player + (arg2 * 2); sp150 = 0; sp14E = temp_v0->unk48; - func_80062B18(&sp148, &sp144, &sp140, 0.0f, 1.5f, 0.0f, (s32) -temp_v0->unk48, (s32) temp_v0->unk50); + func_80062B18(&sp148, &sp144, &sp140, 0.0f, 1.5f, 0.0f, (u16) (s32) -temp_v0->unk48, (u16) (s32) temp_v0->unk50); sp158 = (f32) ((f64) (player->pos[1] - player->boundingBoxSize) + ((f64) sp144 - 2.0)); sp154 = player->pos[0] + sp148; sp15C = player->pos[2] + sp140; } else { temp_v0_2 = player + (arg2 * 2); sp44 = temp_v0_2; + temp_v1 = (s16) (s32) (sins((player->unk_02E + temp_v0_2->unk48 + player->unk_0C0) & 0xFFFF) * (f32) temp_v0_2->unkCC); if ((player->unk_0BC & 8) == 8) { sp14C = *(cameras->rot + (arg2 * 0xB8)) - 0x4000; } else { - sp14C = (s16) (s32) ((f64) -(s16) (s32) (sins((player->unk_02C[1] + temp_v0_2->unk48 + player->unk_0C0) & 0xFFFF) * (f32) temp_v0_2->unkCC) * 0.8); + sp14C = (s16) (s32) ((f64) -temp_v1 * 0.8); } sp14E = temp_v0_2->unk48; sp150 = temp_v0_2->unk50; if ((player->unk_0BC & 0x04000000) == 0x04000000) { - func_80062B18(&sp148, &sp144, &sp140, 0.0f, 8.0f, 0.0f, (s32) -temp_v0_2->unk48, (s32) temp_v0_2->unk50); + func_80062B18(&sp148, &sp144, &sp140, 0.0f, 8.0f, 0.0f, (u16) (s32) -temp_v0_2->unk48, (u16) (s32) temp_v0_2->unk50); sp158 = (player->pos[1] - player->boundingBoxSize) + player->unk_108; sp154 = player->pos[0] + sp148; sp15C = player->pos[2] + sp140; } else { - func_80062B18(&sp148, &sp144, &sp140, 0.0f, 1.5f, 0.0f, (s32) -temp_v0_2->unk48, (s32) temp_v0_2->unk50); + func_80062B18(&sp148, &sp144, &sp140, 0.0f, 1.5f, 0.0f, (u16) (s32) -temp_v0_2->unk48, (u16) (s32) temp_v0_2->unk50); sp158 = (f32) ((f64) ((player->pos[1] - player->boundingBoxSize) + player->unk_108) + ((f64) sp144 - 2.0)); sp154 = player->pos[0] + sp148; sp15C = player->pos[2] + sp140; } } temp_t0 = arg1 * 2; - temp_v1 = *(D_801651D0 + ((arg2 * 0x10) + temp_t0)); - D_80164B04 = (temp_v1 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + D_802F1F80; + temp_v1_2 = *(D_801651D0 + ((arg2 * 0x10) + temp_t0)); + D_80164B04 = (temp_v1_2 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + D_802F1F80; if ((arg2 == 0) || (arg2 == 1)) { - temp_v0_3 = &D_802BFB80[0][0][0].pixel_index_array[(temp_v1 << 0x10) + (arg2 << 0xF) + (arg1 << 0xC)]; + temp_v0_3 = &D_802BFB80[0][0][0].pixel_index_array[(temp_v1_2 << 0x10) + (arg2 << 0xF) + (arg1 << 0xC)]; D_80164B08 = temp_v0_3; var_t9 = temp_v0_3 + 0x7C0; } else { - temp_v0_4 = &D_802BFB80[0][0][0].pixel_index_array[(temp_v1 << 0x10) + (arg2 << 0xF) + (arg1 << 0xC)]; + temp_v0_4 = &D_802BFB80[0][0][0].pixel_index_array[(temp_v1_2 << 0x10) + (arg2 << 0xF) + (arg1 << 0xC)]; D_80164B08 = temp_v0_4 + 0xFFFF4000; var_t9 = temp_v0_4 + 0xFFFF47C0; } @@ -1817,239 +1772,237 @@ void func_800248D0(Player *player, s8 arg1, s8 arg2, s8 arg3) { gDisplayListHead = temp_v0_13 + 8; temp_v0_13->words.w1 = 0x00008000; temp_v0_13->words.w0 = 0xBA000E02; - func_8004B614(*(&D_80164B10 + sp44), *(&D_80164B20 + sp44), *(&D_80164B30 + sp44), *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), (s32) player->unk_0C6); - var_v0 = gDisplayListHead; - gDisplayListHead = var_v0 + 8; + func_8004B614((s32) *(&D_80164B10 + sp44), (s32) *(&D_80164B20 + sp44), (s32) *(&D_80164B30 + sp44), (s32) *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), (s32) player->unk_0C6); + temp_v0_14 = gDisplayListHead; + gDisplayListHead = temp_v0_14 + 8; var_t7 = 0x00505978; var_s0 = arg1 * 4; - var_v0->words.w0 = 0xB900031D; + temp_v0_14->words.w0 = 0xB900031D; goto block_21; } - temp_v0_14 = gDisplayListHead; - gDisplayListHead = temp_v0_14 + 8; - temp_v0_14->words.w0 = 0x01020040; - temp_v0_14->words.w1 = (s32) (&gGfxPool->mtxPool[arg1] + sp40 + 0xF2C0) & 0x1FFFFFFF; temp_v0_15 = gDisplayListHead; gDisplayListHead = temp_v0_15 + 8; - temp_v0_15->words.w0 = 0x06000000; - temp_v0_15->words.w1 = (u32) &D_0D008CD8; + temp_v0_15->words.w0 = 0x01020040; + temp_v0_15->words.w1 = (s32) (&gGfxPool->mtxPool[arg1] + sp40 + 0xF2C0) & 0x1FFFFFFF; temp_v0_16 = gDisplayListHead; gDisplayListHead = temp_v0_16 + 8; - temp_v0_16->words.w0 = 0xFD100000; - var_s0 = arg1 * 4; - temp_v0_16->words.w1 = (u32) D_80164B04; + temp_v0_16->words.w0 = 0x06000000; + temp_v0_16->words.w1 = (u32) &D_0D008CD8; temp_v0_17 = gDisplayListHead; gDisplayListHead = temp_v0_17 + 8; - temp_v0_17->words.w1 = 0; - temp_v0_17->words.w0 = 0xE8000000; + temp_v0_17->words.w0 = 0xFD100000; + var_s0 = arg1 * 4; + temp_v0_17->words.w1 = (u32) D_80164B04; temp_v0_18 = gDisplayListHead; gDisplayListHead = temp_v0_18 + 8; - temp_v0_18->words.w1 = 0x07000000; - temp_v0_18->words.w0 = 0xF5000100; + temp_v0_18->words.w1 = 0; + temp_v0_18->words.w0 = 0xE8000000; temp_v0_19 = gDisplayListHead; gDisplayListHead = temp_v0_19 + 8; - temp_v0_19->words.w1 = 0; - temp_v0_19->words.w0 = 0xE6000000; + temp_v0_19->words.w1 = 0x07000000; + temp_v0_19->words.w0 = 0xF5000100; temp_v0_20 = gDisplayListHead; gDisplayListHead = temp_v0_20 + 8; - temp_v0_20->words.w1 = 0x073FC000; - temp_v0_20->words.w0 = 0xF0000000; + temp_v0_20->words.w1 = 0; + temp_v0_20->words.w0 = 0xE6000000; temp_v0_21 = gDisplayListHead; gDisplayListHead = temp_v0_21 + 8; - temp_v0_21->words.w1 = 0; - temp_v0_21->words.w0 = 0xE7000000; + temp_v0_21->words.w1 = 0x073FC000; + temp_v0_21->words.w0 = 0xF0000000; temp_v0_22 = gDisplayListHead; gDisplayListHead = temp_v0_22 + 8; - temp_v0_22->words.w0 = 0xBA000E02; - temp_v0_22->words.w1 = 0x00008000; - func_8004B614(*(&D_80164B10 + sp44), *(&D_80164B20 + sp44), *(&D_80164B30 + sp44), *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), *(&D_8018D970 + var_s0)); + temp_v0_22->words.w1 = 0; + temp_v0_22->words.w0 = 0xE7000000; temp_v0_23 = gDisplayListHead; gDisplayListHead = temp_v0_23 + 8; - temp_v0_23->words.w0 = 0xB900031D; - temp_v0_23->words.w1 = 0x00505978; - } else if (((player->unk_0CA & 4) == 4) || (temp_v0_24 = player->unk_00C, ((temp_v0_24 * 0x10) < 0)) || (temp_v0_24 & 0x04000000)) { - temp_v0_25 = gDisplayListHead; - gDisplayListHead = temp_v0_25 + 8; - temp_v0_25->words.w0 = 0x01020040; - temp_v0_25->words.w1 = (s32) (&gGfxPool->mtxPool[arg1] + sp40 + 0xF2C0) & 0x1FFFFFFF; + temp_v0_23->words.w0 = 0xBA000E02; + temp_v0_23->words.w1 = 0x00008000; + func_8004B614((s32) *(&D_80164B10 + sp44), (s32) *(&D_80164B20 + sp44), (s32) *(&D_80164B30 + sp44), (s32) *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), *(&D_8018D970 + var_s0)); + temp_v0_24 = gDisplayListHead; + gDisplayListHead = temp_v0_24 + 8; + temp_v0_24->words.w0 = 0xB900031D; + temp_v0_24->words.w1 = 0x00505978; + } else if (((player->unk_0CA & 4) == 4) || (temp_v0_25 = player->unk_00C, ((temp_v0_25 * 0x10) < 0)) || (temp_v0_25 & 0x04000000)) { temp_v0_26 = gDisplayListHead; gDisplayListHead = temp_v0_26 + 8; - temp_v0_26->words.w0 = 0x06000000; - temp_v0_26->words.w1 = (u32) &D_0D008CD8; + temp_v0_26->words.w0 = 0x01020040; + temp_v0_26->words.w1 = (s32) (&gGfxPool->mtxPool[arg1] + sp40 + 0xF2C0) & 0x1FFFFFFF; temp_v0_27 = gDisplayListHead; gDisplayListHead = temp_v0_27 + 8; - temp_v0_27->words.w0 = 0xFD100000; - temp_v0_27->words.w1 = (u32) D_80164B04; + temp_v0_27->words.w0 = 0x06000000; + temp_v0_27->words.w1 = (u32) &D_0D008CD8; temp_v0_28 = gDisplayListHead; gDisplayListHead = temp_v0_28 + 8; - temp_v0_28->words.w1 = 0; - temp_v0_28->words.w0 = 0xE8000000; + temp_v0_28->words.w0 = 0xFD100000; + temp_v0_28->words.w1 = (u32) D_80164B04; temp_v0_29 = gDisplayListHead; gDisplayListHead = temp_v0_29 + 8; - temp_v0_29->words.w1 = 0x07000000; - temp_v0_29->words.w0 = 0xF5000100; + temp_v0_29->words.w1 = 0; + temp_v0_29->words.w0 = 0xE8000000; temp_v0_30 = gDisplayListHead; gDisplayListHead = temp_v0_30 + 8; - temp_v0_30->words.w1 = 0; - temp_v0_30->words.w0 = 0xE6000000; + temp_v0_30->words.w1 = 0x07000000; + temp_v0_30->words.w0 = 0xF5000100; temp_v0_31 = gDisplayListHead; gDisplayListHead = temp_v0_31 + 8; - temp_v0_31->words.w1 = 0x073FC000; - temp_v0_31->words.w0 = 0xF0000000; + temp_v0_31->words.w1 = 0; + temp_v0_31->words.w0 = 0xE6000000; temp_v0_32 = gDisplayListHead; gDisplayListHead = temp_v0_32 + 8; - temp_v0_32->words.w1 = 0; - temp_v0_32->words.w0 = 0xE7000000; + temp_v0_32->words.w1 = 0x073FC000; + temp_v0_32->words.w0 = 0xF0000000; temp_v0_33 = gDisplayListHead; gDisplayListHead = temp_v0_33 + 8; - temp_v0_33->words.w1 = 0x00008000; - temp_v0_33->words.w0 = 0xBA000E02; - func_8004B614(*(&D_80164B10 + sp44), *(&D_80164B20 + sp44), *(&D_80164B30 + sp44), *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), (s32) player->unk_0C6); + temp_v0_33->words.w1 = 0; + temp_v0_33->words.w0 = 0xE7000000; temp_v0_34 = gDisplayListHead; gDisplayListHead = temp_v0_34 + 8; - temp_v0_34->words.w1 = 3; - temp_v0_34->words.w0 = 0xB9000002; + temp_v0_34->words.w1 = 0x00008000; + temp_v0_34->words.w0 = 0xBA000E02; + func_8004B614((s32) *(&D_80164B10 + sp44), (s32) *(&D_80164B20 + sp44), (s32) *(&D_80164B30 + sp44), (s32) *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), (s32) player->unk_0C6); temp_v0_35 = gDisplayListHead; gDisplayListHead = temp_v0_35 + 8; - var_s0 = arg1 * 4; - temp_v0_35->words.w1 = 0x00504A50; - temp_v0_35->words.w0 = 0xB900031D; - } else { + temp_v0_35->words.w1 = 3; + temp_v0_35->words.w0 = 0xB9000002; temp_v0_36 = gDisplayListHead; gDisplayListHead = temp_v0_36 + 8; - temp_v0_36->words.w0 = 0x01020040; - temp_v0_36->words.w1 = (s32) (&gGfxPool->mtxPool[arg1] + sp40 + 0xF2C0) & 0x1FFFFFFF; + var_s0 = arg1 * 4; + temp_v0_36->words.w1 = 0x00504A50; + temp_v0_36->words.w0 = 0xB900031D; + } else { temp_v0_37 = gDisplayListHead; gDisplayListHead = temp_v0_37 + 8; - temp_v0_37->words.w0 = 0x06000000; - temp_v0_37->words.w1 = (u32) &D_0D008CD8; + temp_v0_37->words.w0 = 0x01020040; + temp_v0_37->words.w1 = (s32) (&gGfxPool->mtxPool[arg1] + sp40 + 0xF2C0) & 0x1FFFFFFF; temp_v0_38 = gDisplayListHead; gDisplayListHead = temp_v0_38 + 8; - temp_v0_38->words.w0 = 0xFD100000; - temp_v0_38->words.w1 = (u32) D_80164B04; + temp_v0_38->words.w0 = 0x06000000; + temp_v0_38->words.w1 = (u32) &D_0D008CD8; temp_v0_39 = gDisplayListHead; gDisplayListHead = temp_v0_39 + 8; - temp_v0_39->words.w1 = 0; - temp_v0_39->words.w0 = 0xE8000000; + temp_v0_39->words.w0 = 0xFD100000; + temp_v0_39->words.w1 = (u32) D_80164B04; temp_v0_40 = gDisplayListHead; gDisplayListHead = temp_v0_40 + 8; - temp_v0_40->words.w1 = 0x07000000; - temp_v0_40->words.w0 = 0xF5000100; + temp_v0_40->words.w1 = 0; + temp_v0_40->words.w0 = 0xE8000000; temp_v0_41 = gDisplayListHead; gDisplayListHead = temp_v0_41 + 8; - temp_v0_41->words.w1 = 0; - temp_v0_41->words.w0 = 0xE6000000; + temp_v0_41->words.w1 = 0x07000000; + temp_v0_41->words.w0 = 0xF5000100; temp_v0_42 = gDisplayListHead; gDisplayListHead = temp_v0_42 + 8; - temp_v0_42->words.w1 = 0x073FC000; - temp_v0_42->words.w0 = 0xF0000000; + temp_v0_42->words.w1 = 0; + temp_v0_42->words.w0 = 0xE6000000; temp_v0_43 = gDisplayListHead; gDisplayListHead = temp_v0_43 + 8; - temp_v0_43->words.w1 = 0; - temp_v0_43->words.w0 = 0xE7000000; + temp_v0_43->words.w1 = 0x073FC000; + temp_v0_43->words.w0 = 0xF0000000; temp_v0_44 = gDisplayListHead; gDisplayListHead = temp_v0_44 + 8; - temp_v0_44->words.w1 = 0x00008000; - temp_v0_44->words.w0 = 0xBA000E02; - func_8004B614(*(&D_80164B10 + sp44), *(&D_80164B20 + sp44), *(&D_80164B30 + sp44), *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), (s32) player->unk_0C6); - var_v0 = gDisplayListHead; - gDisplayListHead = var_v0 + 8; + temp_v0_44->words.w1 = 0; + temp_v0_44->words.w0 = 0xE7000000; + temp_v0_45 = gDisplayListHead; + gDisplayListHead = temp_v0_45 + 8; + temp_v0_45->words.w1 = 0x00008000; + temp_v0_45->words.w0 = 0xBA000E02; + func_8004B614((s32) *(&D_80164B10 + sp44), (s32) *(&D_80164B20 + sp44), (s32) *(&D_80164B30 + sp44), (s32) *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), (s32) player->unk_0C6); + temp_v0_46 = gDisplayListHead; + gDisplayListHead = temp_v0_46 + 8; var_t7 = 0x00553078; var_s0 = arg1 * 4; - var_v0->words.w0 = 0xB900031D; + temp_v0_46->words.w0 = 0xB900031D; block_21: - var_v0->words.w1 = var_t7; + gDisplayListHead->words.w1 = var_t7; } - temp_v0_45 = gDisplayListHead; - gDisplayListHead = temp_v0_45 + 8; - temp_v0_45->words.w0 = 0xFD500000; - temp_v0_45->words.w1 = D_80164B08; - temp_v0_46 = gDisplayListHead; - gDisplayListHead = temp_v0_46 + 8; - temp_v0_46->words.w1 = 0x07080200; - temp_v0_46->words.w0 = 0xF5500000; temp_v0_47 = gDisplayListHead; gDisplayListHead = temp_v0_47 + 8; - temp_v0_47->words.w1 = 0; - temp_v0_47->words.w0 = 0xE6000000; + temp_v0_47->words.w0 = 0xFD500000; + temp_v0_47->words.w1 = D_80164B08; temp_v0_48 = gDisplayListHead; gDisplayListHead = temp_v0_48 + 8; - temp_v0_48->words.w1 = 0x073FF100; - temp_v0_48->words.w0 = 0xF3000000; + temp_v0_48->words.w1 = (u8 *)0x07080200; + temp_v0_48->words.w0 = 0xF5500000; temp_v0_49 = gDisplayListHead; gDisplayListHead = temp_v0_49 + 8; - temp_v0_49->words.w1 = 0; - temp_v0_49->words.w0 = 0xE7000000; + temp_v0_49->words.w1 = NULL; + temp_v0_49->words.w0 = 0xE6000000; temp_v0_50 = gDisplayListHead; gDisplayListHead = temp_v0_50 + 8; - temp_v0_50->words.w0 = 0xF5481000; - temp_v0_50->words.w1 = 0x00080200; + temp_v0_50->words.w1 = (u8 *)0x073FF100; + temp_v0_50->words.w0 = 0xF3000000; temp_v0_51 = gDisplayListHead; gDisplayListHead = temp_v0_51 + 8; - temp_v0_51->words.w0 = 0xF2000000; - temp_v0_51->words.w1 = 0x000FC07C; + temp_v0_51->words.w1 = NULL; + temp_v0_51->words.w0 = 0xE7000000; temp_v0_52 = gDisplayListHead; gDisplayListHead = temp_v0_52 + 8; - temp_v0_52->words.w0 = 0x0400103F; - temp_t5 = var_s0 + &D_800DDBB4; - temp_v0_52->words.w1 = *temp_t5 + (arg3 * 0x10); + temp_v0_52->words.w0 = 0xF5481000; + temp_v0_52->words.w1 = (u8 *)0x00080200; temp_v0_53 = gDisplayListHead; gDisplayListHead = temp_v0_53 + 8; - temp_v0_53->words.w1 = &D_0D008C78; - temp_v0_53->words.w0 = 0x06000000; + temp_v0_53->words.w0 = 0xF2000000; + temp_v0_53->words.w1 = (u8 *)0x000FC07C; temp_v0_54 = gDisplayListHead; gDisplayListHead = temp_v0_54 + 8; - temp_v0_54->words.w0 = 0xFD500000; - temp_v0_54->words.w1 = D_80164B0C; + temp_v0_54->words.w0 = 0x0400103F; + temp_t5 = var_s0 + &D_800DDBB4; + temp_v0_54->words.w1 = *temp_t5 + (arg3 * 0x10); temp_v0_55 = gDisplayListHead; gDisplayListHead = temp_v0_55 + 8; - temp_v0_55->words.w1 = 0x07080200; - temp_v0_55->words.w0 = 0xF5500000; + temp_v0_55->words.w1 = &D_0D008C78; + temp_v0_55->words.w0 = 0x06000000; temp_v0_56 = gDisplayListHead; gDisplayListHead = temp_v0_56 + 8; - temp_v0_56->words.w1 = 0; - temp_v0_56->words.w0 = 0xE6000000; + temp_v0_56->words.w0 = 0xFD500000; + temp_v0_56->words.w1 = D_80164B0C; temp_v0_57 = gDisplayListHead; gDisplayListHead = temp_v0_57 + 8; - temp_v0_57->words.w1 = 0x073FF100; - temp_v0_57->words.w0 = 0xF3000000; + temp_v0_57->words.w1 = (u8 *)0x07080200; + temp_v0_57->words.w0 = 0xF5500000; temp_v0_58 = gDisplayListHead; gDisplayListHead = temp_v0_58 + 8; - temp_v0_58->words.w1 = 0; - temp_v0_58->words.w0 = 0xE7000000; + temp_v0_58->words.w1 = NULL; + temp_v0_58->words.w0 = 0xE6000000; temp_v0_59 = gDisplayListHead; gDisplayListHead = temp_v0_59 + 8; - temp_v0_59->words.w0 = 0xF5481000; - temp_v0_59->words.w1 = 0x00080200; + temp_v0_59->words.w1 = (u8 *)0x073FF100; + temp_v0_59->words.w0 = 0xF3000000; temp_v0_60 = gDisplayListHead; gDisplayListHead = temp_v0_60 + 8; - temp_v0_60->words.w0 = 0xF2000000; - temp_v0_60->words.w1 = 0x000FC07C; + temp_v0_60->words.w1 = NULL; + temp_v0_60->words.w0 = 0xE7000000; temp_v0_61 = gDisplayListHead; gDisplayListHead = temp_v0_61 + 8; - temp_v0_61->words.w0 = 0x0400103F; - temp_v0_61->words.w1 = *temp_t5 + ((arg3 + 4) * 0x10); + temp_v0_61->words.w0 = 0xF5481000; + temp_v0_61->words.w1 = (u8 *)0x00080200; temp_v0_62 = gDisplayListHead; gDisplayListHead = temp_v0_62 + 8; - temp_v0_62->words.w1 = &D_0D008C78; - temp_v0_62->words.w0 = 0x06000000; + temp_v0_62->words.w0 = 0xF2000000; + temp_v0_62->words.w1 = (u8 *)0x000FC07C; temp_v0_63 = gDisplayListHead; gDisplayListHead = temp_v0_63 + 8; - temp_v0_63->words.w1 = 0x00010001; - temp_v0_63->words.w0 = 0xBB000000; + temp_v0_63->words.w0 = 0x0400103F; + temp_v0_63->words.w1 = *temp_t5 + ((arg3 + 4) * 0x10); temp_v0_64 = gDisplayListHead; gDisplayListHead = temp_v0_64 + 8; - temp_v0_64->words.w1 = 0; - temp_v0_64->words.w0 = 0xB9000002; + temp_v0_64->words.w1 = &D_0D008C78; + temp_v0_64->words.w0 = 0x06000000; + temp_v0_65 = gDisplayListHead; + gDisplayListHead = temp_v0_65 + 8; + temp_v0_65->words.w1 = (u8 *)0x00010001; + temp_v0_65->words.w0 = 0xBB000000; + temp_v0_66 = gDisplayListHead; + gDisplayListHead = temp_v0_66 + 8; + temp_v0_66->words.w1 = NULL; + temp_v0_66->words.w0 = 0xB9000002; } #else GLOBAL_ASM("asm/non_matchings/code_8001F980/func_800248D0.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -? func_8004B614(u16, u16, u16, u16, s32, s32, s32); /* extern */ -? func_80062B18(f32 *, f32 *, f32 *, f32, f32, f32, s32, s32); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_0D008C78; extern ? D_0D008CD8; extern void *D_80164B04; @@ -2139,10 +2092,10 @@ void func_800256F4(Player *player, s8 arg1, s8 arg2, s8 arg3) { } temp_v0 = player + (arg2 * 2); sp44 = temp_v0; - spD4 = (s16) (s32) ((f64) -(s16) (s32) (sins((temp_v0->unk48 - player->unk_02C[1]) & 0xFFFF) * 0.0f) * 0.8); + spD4 = (s16) (s32) ((f64) -(s16) (s32) (sins((temp_v0->unk48 - player->unk_02E) & 0xFFFF) * 0.0f) * 0.8); spD6 = temp_v0->unk48; spD8 = temp_v0->unk50; - func_80062B18(&spD0, &spCC, &spC8, 0.0f, 1.5f, 0.0f, (s32) -temp_v0->unk48, (s32) temp_v0->unk50); + func_80062B18(&spD0, &spCC, &spC8, 0.0f, 1.5f, 0.0f, (u16) (s32) -temp_v0->unk48, (u16) (s32) temp_v0->unk50); temp_t5 = arg1 * 2; temp_v1 = *(D_801651D0 + ((arg2 * 0x10) + temp_t5)); spE0 = (f32) ((f64) (player->pos[1] - player->boundingBoxSize) + ((f64) spCC - 2.0)); @@ -2200,7 +2153,7 @@ void func_800256F4(Player *player, s8 arg1, s8 arg2, s8 arg3) { gDisplayListHead = temp_v0_12 + 8; temp_v0_12->words.w1 = 0x00008000; temp_v0_12->words.w0 = 0xBA000E02; - func_8004B614(*(&D_80164B10 + sp44), *(&D_80164B20 + sp44), *(&D_80164B30 + sp44), *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), (s32) spC2); + func_8004B614((s32) *(&D_80164B10 + sp44), (s32) *(&D_80164B20 + sp44), (s32) *(&D_80164B30 + sp44), (s32) *(&D_80164B40 + sp44), (s32) *(&D_80164B50 + sp44), (s32) *(&D_80164B60 + sp44), (s32) spC2); temp_v0_13 = gDisplayListHead; gDisplayListHead = temp_v0_13 + 8; temp_v0_13->words.w0 = 0xB900031D; @@ -2292,8 +2245,7 @@ GLOBAL_ASM("asm/non_matchings/code_8001F980/func_800256F4.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -? func_8004B614(u16, u16, u16, u16, s32, s32, s32); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_0D008C78; extern ? D_0D008D10; extern u32 D_80164B08; @@ -2359,9 +2311,9 @@ void func_80025DE8(Player *player, s8 arg1, s8 arg2, s8 arg3) { s32 temp_t9; void *temp_v0; - sp9C = (f32) (((f64) sins(-player->unk_02C[1] & 0xFFFF) * -1.5) + (f64) player->pos[0]); + sp9C = (f32) (((f64) sins(-player->unk_02E & 0xFFFF) * -1.5) + (f64) player->pos[0]); spA0 = (f32) ((f64) ((player->pos[1] - player->boundingBoxSize) + player->unk_108) + 0.1); - temp_f4 = (f64) coss(-player->unk_02C[1] & 0xFFFF) * -1.5; + temp_f4 = (f64) coss(-player->unk_02E & 0xFFFF) * -1.5; sp94 = -0x00B6; temp_v0 = player + (arg2 * 2); spA4 = (f32) (temp_f4 + (f64) player->pos[2]); @@ -2383,7 +2335,7 @@ void func_80025DE8(Player *player, s8 arg1, s8 arg2, s8 arg3) { temp_v0_4->words.w1 = 0x00008000; temp_v0_4->words.w0 = 0xBA000E02; temp_t9 = arg1 * 2; - func_8004B614(*(&D_80164B10 + temp_t9), *(&D_80164B20 + temp_t9), *(&D_80164B30 + temp_t9), *(&D_80164B40 + temp_t9), (s32) *(&D_80164B50 + temp_t9), (s32) *(&D_80164B60 + temp_t9), 0x00000040); + func_8004B614((s32) *(&D_80164B10 + temp_t9), (s32) *(&D_80164B20 + temp_t9), (s32) *(&D_80164B30 + temp_t9), (s32) *(&D_80164B40 + temp_t9), (s32) *(&D_80164B50 + temp_t9), (s32) *(&D_80164B60 + temp_t9), 0x00000040); temp_v0_5 = gDisplayListHead; gDisplayListHead = temp_v0_5 + 8; temp_v0_5->words.w0 = 0xB900031D; @@ -2472,8 +2424,7 @@ GLOBAL_ASM("asm/non_matchings/code_8001F980/func_80025DE8.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -? func_8004B614(u16, u16, u16, u16, s32, s32, s32); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_0D008C78; extern ? D_0D008CD8; extern u32 D_80164B08; @@ -2566,7 +2517,7 @@ void func_800262E0(Player *player, s8 arg1, s8 arg2, s8 arg3) { temp_v0_2->words.w1 = 0x00008000; temp_v0_2->words.w0 = 0xBA000E02; temp_t8 = arg1 * 2; - func_8004B614(*(&D_80164B10 + temp_t8), *(&D_80164B20 + temp_t8), *(&D_80164B30 + temp_t8), *(&D_80164B40 + temp_t8), (s32) *(&D_80164B50 + temp_t8), (s32) *(&D_80164B60 + temp_t8), (s16) player->unk_0C6 / 2); + func_8004B614((s32) *(&D_80164B10 + temp_t8), (s32) *(&D_80164B20 + temp_t8), (s32) *(&D_80164B30 + temp_t8), (s32) *(&D_80164B40 + temp_t8), (s32) *(&D_80164B50 + temp_t8), (s32) *(&D_80164B60 + temp_t8), (s16) player->unk_0C6 / 2); temp_v0_3 = gDisplayListHead; gDisplayListHead = temp_v0_3 + 8; temp_v0_3->words.w0 = 0xB900031D; @@ -2713,8 +2664,6 @@ void func_800267AC(Player *player, s8 arg1, s8 arg2) { GLOBAL_ASM("asm/non_matchings/code_8001F980/func_800267AC.s") #endif -extern s32 D_800DDE74[]; - void func_80026A48(Player *player, s8 arg1) { f32 temp_f0; @@ -2738,52 +2687,85 @@ void func_80026A48(Player *player, s8 arg1) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80027C74(s32, void *, ?); // extern -extern ? D_800DDE34; -extern ? D_800DDE54; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +static ? *D_800DDE34[8] = { + &gKartMarioWheels0, + &gKartLuigiWheels0, + &gKartYoshiWheels0, + &gKartToadWheels0, + &gKartDKWheels0, + &gKartWarioWheels0, + &gKartPeachWheels0, + &gKartBowserWheels0, +}; +static ? *D_800DDE54[8] = { + &gKartMarioWheels1, + &gKartLuigiWheels1, + &gKartYoshiWheels1, + &gKartToadWheels1, + &gKartDKWheels1, + &gKartWarioWheels1, + &gKartPeachWheels1, + &gKartBowserWheels1, +}; +static ? gKartBowserWheels0; /* unable to generate initializer */ +static ? gKartBowserWheels1; /* unable to generate initializer */ +static ? gKartDKWheels0; /* unable to generate initializer */ +static ? gKartDKWheels1; /* unable to generate initializer */ +static ? gKartLuigiWheels0; /* unable to generate initializer */ +static ? gKartLuigiWheels1; /* unable to generate initializer */ +static ? gKartMarioWheels0; /* unable to generate initializer */ +static ? gKartMarioWheels1; /* unable to generate initializer */ +static ? gKartPeachWheels0; /* unable to generate initializer */ +static ? gKartPeachWheels1; /* unable to generate initializer */ +static ? gKartToadWheels0; /* unable to generate initializer */ +static ? gKartToadWheels1; /* unable to generate initializer */ +static ? gKartWarioWheels0; /* unable to generate initializer */ +static ? gKartWarioWheels1; /* unable to generate initializer */ +static ? gKartYoshiWheels0; /* unable to generate initializer */ +static ? gKartYoshiWheels1; /* unable to generate initializer */ -void func_80026B4C(void *arg0, s8 arg1, s8 arg2, s8 arg3) { +void func_80026B4C(Player *player, s8 arg1, s8 arg2, s8 arg3) { s16 temp_t0; s16 temp_t1; s16 temp_t2; s32 temp_v0; s32 temp_v1; - temp_v1 = arg0->unkBC; + temp_v1 = player->unk_0BC; temp_v0 = arg1 * 2; temp_t0 = *(D_801650D0 + ((arg2 * 0x10) + temp_v0)); temp_t1 = *(D_80165110 + ((arg2 * 0x10) + temp_v0)); - temp_t2 = arg0->unk242; - if (((temp_v1 & 0x4000) == 0x4000) && ((arg0->unk0 & 0x2000) == 0)) { - if (((temp_v1 & 0x80) != 0x80) && ((temp_v1 & 0x40) != 0x40) && ((temp_v1 & 0x20000) != 0x20000) && ((temp_v1 & 0x80000) != 0x80000) && ((temp_v1 & 0x800000) != 0x800000) && ((arg0->unk44 & 0x800) == 0)) { + temp_t2 = player->unk242; + if (((temp_v1 & 0x4000) == 0x4000) && !(player->unk_000 & 0x2000)) { + if (((temp_v1 & 0x80) != 0x80) && ((temp_v1 & 0x40) != 0x40) && ((temp_v1 & 0x20000) != 0x20000) && ((temp_v1 & 0x80000) != 0x80000) && ((temp_v1 & 0x800000) != 0x800000) && !(player->unk_044 & 0x800)) { if (temp_t0 < 0x15) { - func_80027C74(*(*(&D_800DDE34 + (arg0->unk254 * 4)) + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x80); + func_80027C74(player, *(D_800DDE34[player->characterId] + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x0080U); return; } - func_80027C74(*(*(&D_800DDE54 + (arg0->unk254 * 4)) + (temp_t1 * 4)) + (((temp_t0 << 8) - 0x1500) * 2) + ((temp_t2 >> 8) << 7) + 0xC00, (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x80); + func_80027C74(player, *(D_800DDE54[player->characterId] + (temp_t1 * 4)) + (((temp_t0 << 8) - 0x1500) * 2) + ((temp_t2 >> 8) << 7) + 0xC00, (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x0080U); return; } if (temp_t0 == 0) { - func_80027C74(*(*(&D_800DDE34 + (arg0->unk254 * 4)) + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x80); + func_80027C74(player, *(D_800DDE34[player->characterId] + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x0080U); return; } - func_80027C74(*(*(&D_800DDE54 + (arg0->unk254 * 4)) + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x80); + func_80027C74(player, *(D_800DDE54[player->characterId] + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x0080U); return; } - if (((temp_v1 & 0x80) != 0x80) && ((temp_v1 & 0x40) != 0x40) && ((temp_v1 & 0x80000) != 0x80000) && ((temp_v1 & 0x800000) != 0x800000) && ((temp_v1 & 0x20000) != 0x20000) && ((arg0->unk44 & 0x800) == 0)) { + if (((temp_v1 & 0x80) != 0x80) && ((temp_v1 & 0x40) != 0x40) && ((temp_v1 & 0x80000) != 0x80000) && ((temp_v1 & 0x800000) != 0x800000) && ((temp_v1 & 0x20000) != 0x20000) && !(player->unk_044 & 0x800)) { if (temp_t0 < 0x15) { - func_80027C74(*(*(&D_800DDE34 + (arg0->unk254 * 4)) + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x80); + func_80027C74(player, *(D_800DDE34[player->characterId] + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x0080U); return; } - func_80027C74(*(*(&D_800DDE54 + (arg0->unk254 * 4)) + (temp_t1 * 4)) + (((temp_t0 << 8) - 0x1500) * 2) + ((temp_t2 >> 8) << 7) + 0xC00, (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x80); + func_80027C74(player, *(D_800DDE54[player->characterId] + (temp_t1 * 4)) + (((temp_t0 << 8) - 0x1500) * 2) + ((temp_t2 >> 8) << 7) + 0xC00, (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x0080U); return; } if (temp_t0 == 0) { - func_80027C74(*(*(&D_800DDE34 + (arg0->unk254 * 4)) + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x80); + func_80027C74(player, *(D_800DDE34[player->characterId] + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x0080U); return; } - func_80027C74(*(*(&D_800DDE54 + (arg0->unk254 * 4)) + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x80); + func_80027C74(player, *(D_800DDE54[player->characterId] + (temp_t1 * 4)) + (temp_t0 << 9) + ((temp_t2 >> 8) << 7), (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + 0x180 + D_802F1F80, 0x0080U); } #else GLOBAL_ASM("asm/non_matchings/code_8001F980/func_80026B4C.s") diff --git a/src/code_8001F980.h b/src/code_8001F980.h index a47dd528b..fca0ac9b7 100644 --- a/src/code_8001F980.h +++ b/src/code_8001F980.h @@ -4,16 +4,21 @@ #include "types.h" #include "common_structs.h" +#define SOME_TEXTURE_POINTER_MATH 0x800 + /* Function Prototypes */ void func_8001F980(s32*, s32*); +void func_8001F9E4(Player*, Camera*, s8); u16 func_8001FB0C(Player*, Camera*, f32, f32); u16 func_8001FD78(Player*, f32, f32, f32); void func_80020000(Player*, Camera*, u8, u8); void func_8002088C(); void func_80020F1C(); +void func_80020524(); void func_80021244(Player*, s8, s8); void func_800215DC(); +void func_8002186C(); void func_800219BC(); void func_80021C78(); void func_80021D40(); @@ -29,21 +34,59 @@ void move_s32_towards(s32*, s32, f32); void move_f32_towards(f32*, f32, f32); void move_s16_towards(s16*, s16, f32); void move_u16_towards(u16*, s16, f32); +void func_80022744(); +void func_8002276C(); void func_80022A98(Player*, s8); void func_80022B50(Player*, s8); void func_80022BC4(Player*, s8); +void func_80022CA8(Player*, s8, s8, s8); +void func_80022D60(Player*, s8, s8, s8); void func_80022DB4(Player*, s8); +void func_80022E84(Player*, s8, s8, s8); +void func_80022F14(Player*, s8, s32, f32); +void func_80023038(Player*, s8, s32, f32); +s32 func_800230E4(s32, s8); +void func_800231D8(Player*, s8); void func_800235AC(Player*, s8); +void func_80023BF0(Player*, s8, s8, s8); +void func_80023C84(Player*, s8, s8); void func_80026A48(Player*, s8); void func_80030A34(Player*); +void func_8002701C(); +void func_80027024(s32, s32, s32); /* This is where I'd put my static data, if I had any */ -extern u16 D_800DC51C; -extern s32 D_800DDB58; -extern f64 D_800ED680; -extern f64 D_800ED688; -extern s32 D_80164A28; extern u16 D_8015F894; +extern s32 D_80164A28; +extern s16 D_80164AAE[]; +extern s16 D_80164AB0[]; +extern s16 D_80164ABE[]; +extern s16 D_80164AC0[]; +extern s32 D_80164AD0[]; +extern u16 D_80164B10[]; +extern u16 D_80164B20[]; +extern u16 D_80164B30[]; +extern u16 D_80164B40[]; +extern u16 D_80164B50[]; +extern u16 D_80164B60[]; +extern s32 D_80164B80[]; + +extern u32 D_8018D474; +extern s32 D_8018D930[]; + +extern Gfx D_0D008C78[]; +extern Gfx D_0D008D58[]; + +extern u16 D_800DC51C; +extern s32 D_800DDB58; +extern Vtx *D_800DDBB4[]; +extern f32 D_800DDBD4[]; +extern s32 D_800DDE74[]; +extern Vtx D_800E51D0[]; +extern f64 D_800ED680; +extern f64 D_800ED688; +extern f32 D_800ED6A8; + #endif diff --git a/src/code_80027D00.c b/src/code_80027D00.c index 800dc7b2a..da30bdc71 100644 --- a/src/code_80027D00.c +++ b/src/code_80027D00.c @@ -93,18 +93,16 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80027DA8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc ? func_800C8F80(s32, ?, s8); /* extern */ ? func_800C9018(s32, ?, s8); /* extern */ ? func_800CA288(s32, ?, s8); /* extern */ ? func_800CA2B8(s32, s8); /* extern */ ? func_800CA2E4(s32, ?, s8); /* extern */ ? func_800CA30C(s32, s8); /* extern */ -extern ? gNearestWaypointByPlayerId; -extern ? D_80165300; -u16 gCurrentCourseId; /* unable to generate initializer */ +s16 gCurrentCourseId; /* unable to generate initializer */ -void func_80027EDC(u16 *arg0, s8 arg1) { +void func_80027EDC(u16 *arg0, s8 playerId) { s16 *sp1C; s16 *temp_v0_10; s16 *temp_v0_12; @@ -117,435 +115,380 @@ void func_80027EDC(u16 *arg0, s8 arg1) { s16 *temp_v0_21; s16 *temp_v0_23; s16 *temp_v0_24; - s16 *temp_v0_25; + s16 *temp_v0_26; s16 *temp_v0_27; - s16 *temp_v0_28; + s16 *temp_v0_29; s16 *temp_v0_30; - s16 *temp_v0_31; + s16 *temp_v0_32; s16 *temp_v0_33; - s16 *temp_v0_34; + s16 *temp_v0_35; s16 *temp_v0_36; - s16 *temp_v0_37; + s16 *temp_v0_38; s16 *temp_v0_39; s16 *temp_v0_3; s16 *temp_v0_40; s16 *temp_v0_41; - s16 *temp_v0_42; + s16 *temp_v0_43; s16 *temp_v0_44; - s16 *temp_v0_45; + s16 *temp_v0_46; s16 *temp_v0_47; - s16 *temp_v0_48; s16 *temp_v0_4; s16 *temp_v0_6; s16 *temp_v0_7; s16 *temp_v0_9; - s16 temp_a0; + s16 *var_v0; s16 temp_v0_11; s16 temp_v0_14; s16 temp_v0_19; s16 temp_v0_22; - s16 temp_v0_26; - s16 temp_v0_29; + s16 temp_v0_25; + s16 temp_v0_28; s16 temp_v0_2; - s16 temp_v0_32; - s16 temp_v0_35; - s16 temp_v0_38; - s16 temp_v0_43; - s16 temp_v0_46; + s16 temp_v0_31; + s16 temp_v0_34; + s16 temp_v0_37; + s16 temp_v0_42; + s16 temp_v0_45; s16 temp_v0_5; s16 temp_v0_8; - s32 temp_a0_2; - s32 temp_t2; - s32 temp_t6; - s32 temp_v1; - s32 temp_v1_10; - s32 temp_v1_11; - s32 temp_v1_12; - s32 temp_v1_13; - s32 temp_v1_14; - s32 temp_v1_2; - s32 temp_v1_3; - s32 temp_v1_4; - s32 temp_v1_5; - s32 temp_v1_6; - s32 temp_v1_7; - s32 temp_v1_8; - s32 temp_v1_9; - s8 temp_a2; + s16 var_a0; + s8 var_a2; u16 temp_t5; u16 temp_t9; u16 temp_v0; - s16 phi_a0; - s8 phi_a2; - s16 *phi_v0; temp_v0 = *arg0; - temp_a2 = arg1; - phi_a2 = temp_a2; + var_a2 = playerId; if (((temp_v0 & 0x4000) == 0x4000) && ((temp_v0 & 0x100) != 0x100)) { - temp_t9 = gCurrentCourseId; + temp_t9 = (u16) gCurrentCourseId; switch (temp_t9) { /* switch 1 */ case 0: /* switch 1 */ - temp_v1 = temp_a2 * 2; - temp_v0_2 = *(&gNearestWaypointByPlayerId + temp_v1); + temp_v0_2 = (s16) gNearestWaypointByPlayerId[var_a2]; if ((temp_v0_2 >= 0x19B) && (temp_v0_2 < 0x1B9)) { - temp_v0_3 = temp_v1 + &D_80165300; + temp_v0_3 = &D_80165300[var_a2]; if (*temp_v0_3 != 1) { sp1C = temp_v0_3; - func_800CA288(temp_a2 & 0xFF, 0x55, temp_a2); + func_800CA288(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1 + &D_80165300) = 1; + *temp_v0_3 = 1; return; } - temp_v0_4 = temp_v1 + &D_80165300; + temp_v0_4 = &D_80165300[var_a2]; if (*temp_v0_4 != 0) { sp1C = temp_v0_4; - func_800CA2B8(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_4; + func_800CA2B8(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_4; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 1: /* switch 1 */ - temp_v1_2 = temp_a2 * 2; - temp_v0_5 = *(&gNearestWaypointByPlayerId + temp_v1_2); + temp_v0_5 = (s16) gNearestWaypointByPlayerId[var_a2]; if ((temp_v0_5 >= 0xA0) && (temp_v0_5 < 0xB4)) { - temp_v0_6 = temp_v1_2 + &D_80165300; + temp_v0_6 = &D_80165300[var_a2]; if (*temp_v0_6 != 1) { sp1C = temp_v0_6; - func_800CA288(temp_a2 & 0xFF, 0x55, temp_a2); + func_800CA288(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1_2 + &D_80165300) = 1; + *temp_v0_6 = 1; return; } - temp_v0_7 = temp_v1_2 + &D_80165300; + temp_v0_7 = &D_80165300[var_a2]; if (*temp_v0_7 != 0) { sp1C = temp_v0_7; - func_800CA2B8(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_7; + func_800CA2B8(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_7; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 2: /* switch 1 */ - temp_v1_3 = temp_a2 * 2; - temp_v0_8 = *(&gNearestWaypointByPlayerId + temp_v1_3); + temp_v0_8 = (s16) gNearestWaypointByPlayerId[var_a2]; if ((temp_v0_8 >= 0x29) && (temp_v0_8 < 0x1D2)) { - temp_v0_9 = temp_v1_3 + &D_80165300; + temp_v0_9 = &D_80165300[var_a2]; if (*temp_v0_9 != 1) { sp1C = temp_v0_9; - func_800CA288(temp_a2 & 0xFF, 0x41, temp_a2); + func_800CA288(var_a2 & 0xFF, 0x41, var_a2); } - *(temp_v1_3 + &D_80165300) = 1; + *temp_v0_9 = 1; return; } - temp_v0_10 = temp_v1_3 + &D_80165300; + temp_v0_10 = &D_80165300[var_a2]; if (*temp_v0_10 != 0) { sp1C = temp_v0_10; - func_800CA2B8(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_10; + func_800CA2B8(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_10; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 3: /* switch 1 */ - temp_v1_4 = temp_a2 * 2; - temp_v0_11 = *(&gNearestWaypointByPlayerId + temp_v1_4); + temp_v0_11 = (s16) gNearestWaypointByPlayerId[var_a2]; if ((temp_v0_11 >= 0x180) && (temp_v0_11 < 0x1E1)) { - temp_v0_12 = temp_v1_4 + &D_80165300; + temp_v0_12 = &D_80165300[var_a2]; if (*temp_v0_12 != 1) { sp1C = temp_v0_12; - func_800CA288(temp_a2 & 0xFF, 0x41, temp_a2); + func_800CA288(var_a2 & 0xFF, 0x41, var_a2); } - *(temp_v1_4 + &D_80165300) = 1; + *temp_v0_12 = 1; return; } - temp_v0_13 = temp_v1_4 + &D_80165300; + temp_v0_13 = &D_80165300[var_a2]; if (*temp_v0_13 != 0) { sp1C = temp_v0_13; - func_800CA2B8(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_13; + func_800CA2B8(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_13; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 8: /* switch 1 */ - temp_v1_5 = temp_a2 * 2; - temp_v0_14 = *(&gNearestWaypointByPlayerId + temp_v1_5); + temp_v0_14 = (s16) gNearestWaypointByPlayerId[var_a2]; if ((temp_v0_14 >= 0x145) && (temp_v0_14 < 0x18B)) { - temp_v0_15 = temp_v1_5 + &D_80165300; + temp_v0_15 = &D_80165300[var_a2]; if (*temp_v0_15 != 1) { sp1C = temp_v0_15; - func_800CA288(temp_a2 & 0xFF, 0x55, temp_a2); + func_800CA288(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1_5 + &D_80165300) = 1; + *temp_v0_15 = 1; return; } - temp_v0_16 = temp_v1_5 + &D_80165300; + temp_v0_16 = &D_80165300[var_a2]; if (*temp_v0_16 != 0) { sp1C = temp_v0_16; - func_800CA2B8(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_16; + func_800CA2B8(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_16; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 10: /* switch 1 */ if ((temp_v0 & 0x800) != 0x800) { - temp_t6 = temp_a2 * 2; - temp_v0_17 = temp_t6 + &D_80165300; + temp_v0_17 = &D_80165300[var_a2]; if (*temp_v0_17 != 1) { sp1C = temp_v0_17; - func_800CA288(temp_a2 & 0xFF, 0x1E, temp_a2); + func_800CA288(var_a2 & 0xFF, 0x1E, var_a2); } - *(temp_t6 + &D_80165300) = 1; + *temp_v0_17 = 1; return; } - temp_v0_18 = (temp_a2 * 2) + &D_80165300; + temp_v0_18 = &D_80165300[var_a2]; if (*temp_v0_18 != 0) { sp1C = temp_v0_18; - func_800CA2B8(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_18; + func_800CA2B8(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_18; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 12: /* switch 1 */ - temp_v1_6 = temp_a2 * 2; - temp_v0_19 = *(&gNearestWaypointByPlayerId + temp_v1_6); + temp_v0_19 = (s16) gNearestWaypointByPlayerId[var_a2]; if ((temp_v0_19 >= 0x11C) && (temp_v0_19 < 0x209)) { - temp_v0_20 = temp_v1_6 + &D_80165300; + temp_v0_20 = &D_80165300[var_a2]; if (*temp_v0_20 != 1) { sp1C = temp_v0_20; - func_800CA288(temp_a2 & 0xFF, 0x55, temp_a2); + func_800CA288(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1_6 + &D_80165300) = 1; + *temp_v0_20 = 1; return; } - temp_v0_21 = temp_v1_6 + &D_80165300; + temp_v0_21 = &D_80165300[var_a2]; if (*temp_v0_21 != 0) { sp1C = temp_v0_21; - func_800CA2B8(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_21; + func_800CA2B8(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_21; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 18: /* switch 1 */ - temp_v1_7 = temp_a2 * 2; - temp_v0_22 = *(&gNearestWaypointByPlayerId + temp_v1_7); + temp_v0_22 = (s16) gNearestWaypointByPlayerId[var_a2]; if (((temp_v0_22 >= 0) && (temp_v0_22 < 0x65)) || ((temp_v0_22 >= 0x14A) && (temp_v0_22 < 0x21F))) { - temp_v0_25 = temp_v1_7 + &D_80165300; - if (*temp_v0_25 != 2) { - sp1C = temp_v0_25; - func_800C8F80(temp_a2 & 0xFF, 0x170802D, temp_a2); + temp_v0_23 = &D_80165300[var_a2]; + if (*temp_v0_23 != 2) { + sp1C = temp_v0_23; + func_800C8F80(var_a2 & 0xFF, 0x0170802D, var_a2); } - *(temp_v1_7 + &D_80165300) = 2; + *temp_v0_23 = 2; return; } if ((temp_v0_22 >= 0x288) && (temp_v0_22 < 0x305)) { - temp_v0_23 = temp_v1_7 + &D_80165300; - if (*temp_v0_23 != 1) { - sp1C = temp_v0_23; - func_800CA288(temp_a2 & 0xFF, 0x55, temp_a2); + temp_v0_24 = &D_80165300[var_a2]; + if (*temp_v0_24 != 1) { + sp1C = temp_v0_24; + func_800CA288(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1_7 + &D_80165300) = 1; + *temp_v0_24 = 1; return; } - temp_v0_24 = temp_v1_7 + &D_80165300; - temp_a0 = *temp_v0_24; - phi_a0 = temp_a0; - if (temp_a0 != 0) { - if (temp_a0 == 1) { - temp_a0_2 = temp_a2 & 0xFF; - sp1C = temp_v0_24; - arg1 = temp_a2; - func_800CA2B8(temp_a0_2, temp_a2); - phi_a0 = *temp_v0_24; - phi_a2 = arg1; + var_v0 = &D_80165300[var_a2]; + var_a0 = *var_v0; + if (var_a0 != 0) { + if (var_a0 == 1) { + sp1C = var_v0; + playerId = var_a2; + func_800CA2B8(var_a2 & 0xFF, var_a2); + var_a2 = playerId; + var_a0 = *var_v0; } - if (phi_a0 == 2) { - sp1C = temp_v1_7 + &D_80165300; - func_800C9018(phi_a2 & 0xFF, 0x170802D, phi_a2); + if (var_a0 == 2) { + sp1C = var_v0; + func_800C9018(var_a2 & 0xFF, 0x0170802D, var_a2); } - phi_v0 = temp_v1_7 + &D_80165300; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; } } else { - temp_t5 = gCurrentCourseId; + temp_t5 = (u16) gCurrentCourseId; switch (temp_t5) { /* switch 2 */ case 0: /* switch 2 */ - temp_v1_8 = temp_a2 * 2; - temp_v0_26 = *(&gNearestWaypointByPlayerId + temp_v1_8); - if ((temp_v0_26 >= 0x19B) && (temp_v0_26 < 0x1B9)) { - temp_v0_27 = temp_v1_8 + &D_80165300; - if (*temp_v0_27 != 1) { - sp1C = temp_v0_27; - func_800CA2E4(temp_a2 & 0xFF, 0x55, temp_a2); + temp_v0_25 = (s16) gNearestWaypointByPlayerId[var_a2]; + if ((temp_v0_25 >= 0x19B) && (temp_v0_25 < 0x1B9)) { + temp_v0_26 = &D_80165300[var_a2]; + if (*temp_v0_26 != 1) { + sp1C = temp_v0_26; + func_800CA2E4(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1_8 + &D_80165300) = 1; + *temp_v0_26 = 1; return; } - temp_v0_28 = temp_v1_8 + &D_80165300; - if (*temp_v0_28 != 0) { - sp1C = temp_v0_28; - func_800CA30C(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_28; + temp_v0_27 = &D_80165300[var_a2]; + if (*temp_v0_27 != 0) { + sp1C = temp_v0_27; + func_800CA30C(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_27; block_127: - *phi_v0 = 0; + *var_v0 = 0; } default: /* switch 2 */ default: /* switch 1 */ return; case 1: /* switch 2 */ - temp_v1_9 = temp_a2 * 2; - temp_v0_29 = *(&gNearestWaypointByPlayerId + temp_v1_9); - if ((temp_v0_29 >= 0xA0) && (temp_v0_29 < 0xB4)) { - temp_v0_30 = temp_v1_9 + &D_80165300; - if (*temp_v0_30 != 1) { - sp1C = temp_v0_30; - func_800CA2E4(temp_a2 & 0xFF, 0x55, temp_a2); + temp_v0_28 = (s16) gNearestWaypointByPlayerId[var_a2]; + if ((temp_v0_28 >= 0xA0) && (temp_v0_28 < 0xB4)) { + temp_v0_29 = &D_80165300[var_a2]; + if (*temp_v0_29 != 1) { + sp1C = temp_v0_29; + func_800CA2E4(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1_9 + &D_80165300) = 1; + *temp_v0_29 = 1; return; } - temp_v0_31 = temp_v1_9 + &D_80165300; - if (*temp_v0_31 != 0) { - sp1C = temp_v0_31; - func_800CA30C(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_31; + temp_v0_30 = &D_80165300[var_a2]; + if (*temp_v0_30 != 0) { + sp1C = temp_v0_30; + func_800CA30C(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_30; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 2: /* switch 2 */ - temp_v1_10 = temp_a2 * 2; - temp_v0_32 = *(&gNearestWaypointByPlayerId + temp_v1_10); - if ((temp_v0_32 >= 0x29) && (temp_v0_32 < 0x1D2)) { - temp_v0_33 = temp_v1_10 + &D_80165300; - if (*temp_v0_33 != 1) { - sp1C = temp_v0_33; - func_800CA2E4(temp_a2 & 0xFF, 0x41, temp_a2); + temp_v0_31 = (s16) gNearestWaypointByPlayerId[var_a2]; + if ((temp_v0_31 >= 0x29) && (temp_v0_31 < 0x1D2)) { + temp_v0_32 = &D_80165300[var_a2]; + if (*temp_v0_32 != 1) { + sp1C = temp_v0_32; + func_800CA2E4(var_a2 & 0xFF, 0x41, var_a2); } - *(temp_v1_10 + &D_80165300) = 1; + *temp_v0_32 = 1; return; } - temp_v0_34 = temp_v1_10 + &D_80165300; - if (*temp_v0_34 != 0) { - sp1C = temp_v0_34; - func_800CA30C(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_34; + temp_v0_33 = &D_80165300[var_a2]; + if (*temp_v0_33 != 0) { + sp1C = temp_v0_33; + func_800CA30C(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_33; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 3: /* switch 2 */ - temp_v1_11 = temp_a2 * 2; - temp_v0_35 = *(&gNearestWaypointByPlayerId + temp_v1_11); - if ((temp_v0_35 >= 0x180) && (temp_v0_35 < 0x1E1)) { - temp_v0_36 = temp_v1_11 + &D_80165300; - if (*temp_v0_36 != 1) { - sp1C = temp_v0_36; - func_800CA2E4(temp_a2 & 0xFF, 0x41, temp_a2); + temp_v0_34 = (s16) gNearestWaypointByPlayerId[var_a2]; + if ((temp_v0_34 >= 0x180) && (temp_v0_34 < 0x1E1)) { + temp_v0_35 = &D_80165300[var_a2]; + if (*temp_v0_35 != 1) { + sp1C = temp_v0_35; + func_800CA2E4(var_a2 & 0xFF, 0x41, var_a2); } - *(temp_v1_11 + &D_80165300) = 1; + *temp_v0_35 = 1; return; } - temp_v0_37 = temp_v1_11 + &D_80165300; - if (*temp_v0_37 != 0) { - sp1C = temp_v0_37; - func_800CA30C(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_37; + temp_v0_36 = &D_80165300[var_a2]; + if (*temp_v0_36 != 0) { + sp1C = temp_v0_36; + func_800CA30C(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_36; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 8: /* switch 2 */ - temp_v1_12 = temp_a2 * 2; - temp_v0_38 = *(&gNearestWaypointByPlayerId + temp_v1_12); - if ((temp_v0_38 >= 0x145) && (temp_v0_38 < 0x18B)) { - temp_v0_39 = temp_v1_12 + &D_80165300; - if (*temp_v0_39 != 1) { - sp1C = temp_v0_39; - func_800CA2E4(temp_a2 & 0xFF, 0x55, temp_a2); + temp_v0_37 = (s16) gNearestWaypointByPlayerId[var_a2]; + if ((temp_v0_37 >= 0x145) && (temp_v0_37 < 0x18B)) { + temp_v0_38 = &D_80165300[var_a2]; + if (*temp_v0_38 != 1) { + sp1C = temp_v0_38; + func_800CA2E4(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1_12 + &D_80165300) = 1; + *temp_v0_38 = 1; return; } - temp_v0_40 = temp_v1_12 + &D_80165300; - if (*temp_v0_40 != 0) { - sp1C = temp_v0_40; - func_800CA30C(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_40; + temp_v0_39 = &D_80165300[var_a2]; + if (*temp_v0_39 != 0) { + sp1C = temp_v0_39; + func_800CA30C(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_39; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 10: /* switch 2 */ if ((temp_v0 & 0x800) != 0x800) { - temp_t2 = temp_a2 * 2; - temp_v0_41 = temp_t2 + &D_80165300; - if (*temp_v0_41 != 1) { - sp1C = temp_v0_41; - func_800CA2E4(temp_a2 & 0xFF, 0x1E, temp_a2); + temp_v0_40 = &D_80165300[var_a2]; + if (*temp_v0_40 != 1) { + sp1C = temp_v0_40; + func_800CA2E4(var_a2 & 0xFF, 0x1E, var_a2); } - *(temp_t2 + &D_80165300) = 1; + *temp_v0_40 = 1; return; } - temp_v0_42 = (temp_a2 * 2) + &D_80165300; - if (*temp_v0_42 != 0) { - sp1C = temp_v0_42; - func_800CA30C(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_42; + temp_v0_41 = &D_80165300[var_a2]; + if (*temp_v0_41 != 0) { + sp1C = temp_v0_41; + func_800CA30C(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_41; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 12: /* switch 2 */ - temp_v1_13 = temp_a2 * 2; - temp_v0_43 = *(&gNearestWaypointByPlayerId + temp_v1_13); - if ((temp_v0_43 >= 0x11C) && (temp_v0_43 < 0x209)) { - temp_v0_44 = temp_v1_13 + &D_80165300; - if (*temp_v0_44 != 1) { - sp1C = temp_v0_44; - func_800CA2E4(temp_a2 & 0xFF, 0x55, temp_a2); + temp_v0_42 = (s16) gNearestWaypointByPlayerId[var_a2]; + if ((temp_v0_42 >= 0x11C) && (temp_v0_42 < 0x209)) { + temp_v0_43 = &D_80165300[var_a2]; + if (*temp_v0_43 != 1) { + sp1C = temp_v0_43; + func_800CA2E4(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1_13 + &D_80165300) = 1; + *temp_v0_43 = 1; return; } - temp_v0_45 = temp_v1_13 + &D_80165300; - if (*temp_v0_45 != 0) { - sp1C = temp_v0_45; - func_800CA30C(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_45; + temp_v0_44 = &D_80165300[var_a2]; + if (*temp_v0_44 != 0) { + sp1C = temp_v0_44; + func_800CA30C(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_44; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; case 18: /* switch 2 */ - temp_v1_14 = temp_a2 * 2; - temp_v0_46 = *(&gNearestWaypointByPlayerId + temp_v1_14); - if ((temp_v0_46 >= 0x288) && (temp_v0_46 < 0x305)) { - temp_v0_47 = temp_v1_14 + &D_80165300; - if (*temp_v0_47 != 1) { - sp1C = temp_v0_47; - func_800CA2E4(temp_a2 & 0xFF, 0x55, temp_a2); + temp_v0_45 = (s16) gNearestWaypointByPlayerId[var_a2]; + if ((temp_v0_45 >= 0x288) && (temp_v0_45 < 0x305)) { + temp_v0_46 = &D_80165300[var_a2]; + if (*temp_v0_46 != 1) { + sp1C = temp_v0_46; + func_800CA2E4(var_a2 & 0xFF, 0x55, var_a2); } - *(temp_v1_14 + &D_80165300) = 1; + *temp_v0_46 = 1; return; } - temp_v0_48 = temp_v1_14 + &D_80165300; - if (*temp_v0_48 != 0) { - sp1C = temp_v0_48; - func_800CA30C(temp_a2 & 0xFF, temp_a2); - phi_v0 = temp_v0_48; + temp_v0_47 = &D_80165300[var_a2]; + if (*temp_v0_47 != 0) { + sp1C = temp_v0_47; + func_800CA30C(var_a2 & 0xFF, var_a2); + var_v0 = temp_v0_47; goto block_127; } - /* Duplicate return node #128. Try simplifying control flow for better match */ - return; + break; } } } @@ -554,20 +497,15 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80027EDC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? control_cpu_movement(Player *, s32, s8, s8); // extern -u16 func_8001FB0C(s32, f32, f32, ?); // extern -? func_8002D028(s8); // extern -? func_8002E594(Player *, s32, s8, s8); // extern -? func_8002F730(Player *, s32, s8, s8); // extern +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? control_cpu_movement(Player *, Camera *, s8, s8); /* extern */ +? func_8002D028(s8); /* extern */ +? func_8002E594(Player *, Camera *, s8, s8); /* extern */ +? func_8002F730(Player *, Camera *, s8, s8); /* extern */ extern ? D_801633F8; -void func_80028864(Player *arg0, s32 arg1, s8 arg2, s8 arg3) { +void func_80028864(Player *player, Camera *camera, s8 arg2, s8 arg3) { u16 sp1E; - Player *temp_a0; - Player *temp_a0_2; - Player *temp_a0_3; - Player *temp_a0_4; s16 temp_v0_7; s32 temp_t4; s32 temp_v0_2; @@ -576,93 +514,72 @@ void func_80028864(Player *arg0, s32 arg1, s8 arg2, s8 arg3) { u16 temp_v0_4; u16 temp_v0_5; u16 temp_v0_6; - Player *phi_a0; - temp_v0 = arg0->unk_000; - phi_a0 = arg0; - if ((temp_v0 & PLAYER_START_SEQUENCE) == 0) { + temp_v0 = player->unk_000; + if (!(temp_v0 & 0x2000)) { temp_v0_2 = gActiveScreenMode; - if (temp_v0_2 != 0) { - if ((temp_v0_2 != 1) && (temp_v0_2 != 2)) { - if (temp_v0_2 != 3) { + switch (temp_v0_2) { /* irregular */ + case 0: + sp1E = func_8001FB0C(player, camera1, (f32) D_8016557C, 0.0f); + break; + case 1: + case 2: + temp_v0_3 = func_8001FB0C(player, camera1, (f32) D_8016557C, 0.0f); + sp1E = temp_v0_3; + if (temp_v0_3 == 1) { + + } else { + sp1E = func_8001FB0C(player, camera2, (f32) D_8016557C, 0.0f); + } + break; + case 3: + temp_v0_4 = func_8001FB0C(player, camera1, (f32) D_8016557C, 0.0f); + sp1E = temp_v0_4; + if (temp_v0_4 == 1) { + + } else { + temp_v0_5 = func_8001FB0C(player, camera2, (f32) D_8016557C, 0.0f); + sp1E = temp_v0_5; + if (temp_v0_5 == 1) { } else { - temp_v0_3 = func_8001FB0C(camera1, D_8016557C, 0.0f); - temp_a0 = arg0; - sp1E = temp_v0_3; - phi_a0 = temp_a0; - if (temp_v0_3 == 1) { + temp_v0_6 = func_8001FB0C(player, camera3, (f32) D_8016557C, 0.0f); + sp1E = temp_v0_6; + if (temp_v0_6 == 1) { } else { - arg0 = temp_a0; - temp_v0_4 = func_8001FB0C(temp_a0, (bitwise f32) camera2, D_8016557C, 0); - temp_a0_2 = arg0; - sp1E = temp_v0_4; - phi_a0 = temp_a0_2; - if (temp_v0_4 == 1) { - - } else { - arg0 = temp_a0_2; - temp_v0_5 = func_8001FB0C(temp_a0_2, (bitwise f32) camera3, D_8016557C, 0); - temp_a0_3 = arg0; - sp1E = temp_v0_5; - phi_a0 = temp_a0_3; - if (temp_v0_5 == 1) { - - } else { - arg0 = temp_a0_3; - sp1E = func_8001FB0C(temp_a0_3, (bitwise f32) camera4, D_8016557C, 0); - phi_a0 = arg0; - } - } + sp1E = func_8001FB0C(player, camera4, (f32) D_8016557C, 0.0f); } - goto block_17; } - } else { - temp_v0_6 = func_8001FB0C(camera1, D_8016557C, 0.0f); - temp_a0_4 = arg0; - sp1E = temp_v0_6; - phi_a0 = temp_a0_4; - if (temp_v0_6 == 1) { - - } else { - arg0 = temp_a0_4; - sp1E = func_8001FB0C(temp_a0_4, (bitwise f32) camera2, D_8016557C, 0); - phi_a0 = arg0; - } - goto block_17; } - } else { - sp1E = func_8001FB0C(camera1, D_8016557C, 0.0f); - phi_a0 = arg0; -block_17: + break; } - if ((sp1E == 1) || ((phi_a0->unk_000 & PLAYER_INVISIBLE_OR_BOMB) == PLAYER_INVISIBLE_OR_BOMB) || (gModeSelection == BATTLE) || (temp_v0_7 = phi_a0->unk_0CA, ((temp_v0_7 & 2) != 0)) || ((temp_v0_7 & 8) != 0) || (*(&D_801633F8 + (arg2 * 2)) == 1)) { - temp_t4 = phi_a0->unk_0BC & ~0x1000; - phi_a0->unk_0BC = temp_t4; - if (((temp_t4 & 0x80) == 0x80) || ((temp_t4 & 0x40) == 0x40) || ((temp_t4 & 0x400) == 0x400) || ((temp_t4 & 0x4000) == 0x4000) || ((temp_t4 & 0x80000) == 0x80000) || ((temp_t4 & 0x800000) == 0x800000) || ((temp_t4 & 0x1000000) == 0x1000000) || ((temp_t4 & 0x2000000) == 0x2000000) || ((temp_t4 & 0x20000) == 0x20000) || ((phi_a0->unk_044 & 0x800) != 0)) { - func_8002E594(phi_a0, arg1, arg3, arg2); + if ((sp1E == 1) || ((player->unk_000 & 0x100) == 0x100) || (gModeSelection == 3) || (temp_v0_7 = player->unk_0CA, ((temp_v0_7 & 2) != 0)) || (temp_v0_7 & 8) || (*(&D_801633F8 + (arg2 * 2)) == (s16) 1U)) { + temp_t4 = player->unk_0BC & ~0x1000; + player->unk_0BC = temp_t4; + if (((temp_t4 & 0x80) == 0x80) || ((temp_t4 & 0x40) == 0x40) || ((temp_t4 & 0x400) == 0x400) || ((temp_t4 & 0x4000) == 0x4000) || ((temp_t4 & 0x80000) == 0x80000) || ((temp_t4 & 0x800000) == 0x800000) || ((temp_t4 & 0x01000000) == 0x01000000) || ((temp_t4 & 0x02000000) == 0x02000000) || ((temp_t4 & 0x20000) == 0x20000) || (player->unk_044 & 0x800)) { + func_8002E594(player, camera, arg3, arg2); return; } - func_8002D268(phi_a0, arg1, arg3, arg2); + func_8002D268(player, camera, arg3, arg2); return; } - control_cpu_movement(phi_a0, arg1, arg3, arg2); + control_cpu_movement(player, camera, arg3, arg2); return; } if ((temp_v0 & 0x200) == 0x200) { func_8002D028(arg2); - func_8002F730(arg0, arg1, arg3, arg2); + func_8002F730(player, camera, arg3, arg2); return; } - if ((temp_v0 & 0x80) != 0) { - func_8002D268(arg0, arg1, arg3, arg2); + if (temp_v0 & 0x80) { + func_8002D268(player, camera, arg3, arg2); return; } if ((temp_v0 & 0x4000) != 0x4000) { - arg0->unk_09C = 50.0f; + player->unk_09C = 50.0f; } - arg0->unk_0BC &= -9; + player->unk_0BC &= ~8; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80028864.s") @@ -840,16 +757,8 @@ void func_80029200(Player *player, s8 arg1) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? move_s16_towards(void *, s16, ?, void *); // extern -? func_80029200(Player *, s8); // extern -s16 atan2s(f32, f32); // extern -s32 func_802B7C40(f32, s32); // extern -f32 sins(s32); // extern -f32 coss(s32); // extern -extern ? D_800DDBD4; -extern f64 D_800ED788; -extern f64 D_800ED790; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +static f32 D_800DDBD4[8] = { 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f }; void func_8002934C(Player *player, struct Camera *arg1, s8 arg2, s8 arg3) { f32 sp50; @@ -858,220 +767,183 @@ void func_8002934C(Player *player, struct Camera *arg1, s8 arg2, s8 arg3) { s32 sp20; f32 temp_f0; f32 temp_f2; - f32 temp_f4; - f32 temp_f6; + f32 var_f0; s16 *temp_a1; - s16 *temp_v0_3; - s16 temp_t8; - s16 temp_v1_6; + s16 *temp_v0_2; + s16 var_v1; s32 temp_a0; - s32 temp_a0_3; - s32 temp_a2; - s32 temp_a2_2; + s32 temp_a0_2; s32 temp_t3; s32 temp_t6; s32 temp_t6_3; s32 temp_t7; - s32 temp_t7_2; s32 temp_t9; s32 temp_t9_2; - s32 temp_v0_2; s32 temp_v1; s32 temp_v1_2; s32 temp_v1_3; s32 temp_v1_4; s32 temp_v1_5; - s32 temp_v1_7; - u16 temp_a0_2; + s32 temp_v1_6; + s32 var_a1; + s32 var_a2; + s32 var_t0; + s32 var_v0; + s32 var_v0_2; + s32 var_v0_3; u16 temp_t6_2; + u16 temp_t8; u16 temp_v0; + u16 var_a0; void *temp_a3; - void *phi_a3; - s32 phi_v1; - f32 phi_f2; - f32 phi_f0; - s32 phi_a0; - s32 phi_t1; - s32 phi_v0; - s32 phi_a2; - s32 phi_v1_2; - s32 phi_t2; - s32 phi_a1; - s32 phi_v0_2; - s32 phi_t0; - s16 phi_v1_3; - s32 phi_a2_2; - s32 phi_v0_3; - temp_t7 = arg2 * 2; - temp_a3 = player + temp_t7; - temp_a3->unk48 = atan2s(player->posX - arg1->unk0, player->posZ - arg1->unk8); - player->unk_244[arg2] = ((player->unk_02C[1] + temp_a3->unk48 + player->unk_0C0) & 0xFFFF) / 0x80; - temp_f6 = player->unk_224; + temp_a3 = player + (arg2 * 2); + temp_a3->unk48 = atan2s(player->pos[0] - arg1->unk0, player->pos[2] - arg1->unk8); + player->unk_244[arg2] = (u16) ((s32) ((player->unk_02E + (s16) temp_a3->unk48 + player->unk_0C0) & 0xFFFF) / 128); temp_v1 = player->unk_0BC; - temp_f4 = D_800DDBD4[player->characterId] * 18.0f; temp_f0 = player->unk_230 - player->unk_23C; - temp_f2 = temp_f4 * temp_f6; - phi_a3 = temp_a3; - phi_f2 = temp_f2; + temp_f2 = D_800DDBD4[player->characterId] * 18.0f * player->unk_224; if ((temp_v1 & 8) != 8) { if ((temp_v1 & 0x40000000) == 0x40000000) { sp24 = temp_a3; sp50 = temp_f2; - temp_a3->unkCC = func_802B7C40(temp_f0 / temp_f2) * D_800ED788; + temp_a3->unkCC = (s16) (s32) ((f64) func_802B7C40(temp_f0 / temp_f2) * 1.6); } else { sp24 = temp_a3; sp50 = temp_f2; - temp_a3->unkCC = func_802B7C40(temp_f0 / temp_f2) * 2; + temp_a3->unkCC = (s16) (func_802B7C40(temp_f0 / temp_f2) * 2); } - phi_a3 = player + temp_t7; - phi_f2 = temp_f4 * temp_f6; } - phi_v1 = player->unk_0BC; - if ((player->unk_0BC & 0x4000000) == 0x4000000) { - phi_a3->unkCC = player->unk_D9C; - phi_v1 = player->unk_0BC; + if ((player->unk_0BC & 0x04000000) == 0x04000000) { + temp_a3->unkCC = (s16) (s32) player->unk_D9C; } - if ((phi_v1 & 8) != 8) { - sp24 = phi_a3; - phi_a3->unkD4 = func_802B7C40((player->unk_1F8 - player->unk_1FC) / phi_f2, 0x4000000) * D_800ED790; + if ((player->unk_0BC & 8) != 8) { + sp24 = temp_a3; + temp_a3->unkD4 = (s16) (s32) ((f64) func_802B7C40((player->unk_1F8 - player->unk_1FC) / temp_f2) * 0.9); } else { - temp_v0 = phi_a3->unk244; - if ((temp_v0 >= 0) && (temp_v0 < 0x101)) { - phi_f0 = player->rotY - player->pos[1]; + temp_v0 = player->unk_244[arg2]; + if (((s32) temp_v0 >= 0) && ((s32) temp_v0 < 0x101)) { + var_f0 = player->rotY - player->pos[1]; } else { - phi_f0 = player->pos[1] - player->rotY; + var_f0 = player->pos[1] - player->rotY; } - sp24 = phi_a3; - phi_a3->unkD4 = func_802B7C40(phi_f0 / phi_f2, 0x4000000) * 0.5; + sp24 = temp_a3; + temp_a3->unkD4 = (s16) (s32) ((f64) func_802B7C40(var_f0 / temp_f2) * 0.5); } - if ((player->unk_0BC & 0x4000000) == 0x4000000) { - phi_a3->unkD4 = player->unk_D9C; + if ((player->unk_0BC & 0x04000000) == 0x04000000) { + temp_a3->unkD4 = (s16) (s32) player->unk_D9C; } - sp24 = phi_a3; + sp24 = temp_a3; func_80029200(player, arg2); - temp_a0 = (player->unk_02C[1] + phi_a3->unk48 + player->unk_0C0) & 0xFFFF; + temp_a0 = (player->unk_02E + temp_a3->unk48 + player->unk_0C0) & 0xFFFF; sp20 = temp_a0; - sp28 = sins(temp_a0); - move_s16_towards(phi_a3 + 0x50, (coss(temp_a0) * phi_a3->unkCC) + (phi_a3->unkD4 * sp28), 0x3F000000, phi_a3); - temp_a0_2 = phi_a3->unk244; + sp28 = sins((u16) temp_a0); + move_s16_towards(temp_a3 + 0x50, (s16) (s32) ((coss((u16) temp_a0) * (f32) temp_a3->unkCC) + ((f32) temp_a3->unkD4 * sp28)), 0.5f); + var_a0 = temp_a3->unk244; temp_t3 = arg2 * 4; temp_v1_2 = 4 << temp_t3; temp_t8 = player->unk_002 & ~temp_v1_2; player->unk_002 = temp_t8; - phi_a0 = temp_a0_2; - if (temp_a0_2 >= 0x101) { + if ((s32) var_a0 >= 0x101) { + var_a0 = (0x201 - var_a0) & 0xFFFF; player->unk_002 = temp_t8 | temp_v1_2; - phi_a0 = (0x201 - temp_a0_2) & 0xFFFF; } temp_v1_3 = player->unk_0BC; - if (((temp_v1_3 & 0x80) != 0x80) && (phi_t1 = 0x80000, ((temp_v1_3 & 0x40) != 0x40)) && (temp_v0_2 = temp_v1_3 & 0x80000, phi_v0 = temp_v0_2, phi_a2 = 0x800000, phi_v0 = temp_v0_2, (temp_v0_2 != 0x80000)) && (phi_t2 = 0x20000, ((temp_v1_3 & 0x800000) != 0x800000)) && ((temp_v1_3 & 0x20000) != 0x20000) && ((player->unk_044 & 0x800) == 0)) { - phi_a1 = 0x666; - if (phi_a0 < 0x51) { - phi_a1 = 0x208; + if (((temp_v1_3 & 0x80) != 0x80) && ((temp_v1_3 & 0x40) != 0x40) && (var_v0 = temp_v1_3 & 0x80000, (var_v0 != 0x80000)) && ((temp_v1_3 & 0x800000) != 0x800000) && ((temp_v1_3 & 0x20000) != 0x20000) && !(player->unk_044 & 0x800)) { + var_a1 = 0x666; + if ((s32) var_a0 < 0x51) { + var_a1 = 0x208; goto block_28; } - phi_t0 = 0xF; + var_t0 = 0xF; } else { - phi_v0 = temp_v1_3 & 0x80000; - phi_a1 = 0x666; + var_a1 = 0x666; + var_v0 = temp_v1_3 & 0x80000; block_28: - phi_t1 = 0x80000; - phi_a2 = 0x800000; - phi_t2 = 0x20000; - phi_t0 = 0; + var_t0 = 0; } - if ((phi_t1 == phi_v0) || (phi_a2 == (temp_v1_3 & phi_a2)) || ((player->unk_044 & 0x800) != 0)) { - phi_a3->unk50 = 0; + if ((var_v0 == 0x80000) || ((temp_v1_3 & 0x800000) == 0x800000) || (player->unk_044 & 0x800)) { + temp_a3->unk50 = 0; } - phi_v1_2 = player->unk_0BC; if (((player->unk_0BC & 8) == 8) && ((player->unk_0CA & 2) == 2)) { - phi_a3->unk50 = 0; - phi_v1_2 = player->unk_0BC; + temp_a3->unk50 = 0; } - temp_t9 = (player->unk_02C[1] + phi_a3->unk48 + player->unk_0C0) & 0xFFFF; - if (((phi_v1_2 & 0x80) == 0x80) || ((phi_v1_2 & 0x40) == 0x40) || (phi_t1 == (phi_v1_2 & phi_t1)) || (phi_a2 == (phi_v1_2 & phi_a2)) || (phi_t2 == (phi_v1_2 & phi_t2)) || ((player->unk_044 & 0x800) != 0)) { + temp_t9 = (player->unk_02E + temp_a3->unk48 + player->unk_0C0) & 0xFFFF; + if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) || ((player->unk_0BC & 0x80000) == 0x80000) || ((player->unk_0BC & 0x800000) == 0x800000) || ((player->unk_0BC & 0x20000) == 0x20000) || (player->unk_044 & 0x800)) { if (temp_t9 >= 0x7FF9) { - temp_t6 = ((-temp_t9 & 0xFFFF) / phi_a1) & 0xFFFF; - phi_v0_2 = temp_t6; + temp_t6 = ((s32) (-temp_t9 & 0xFFFF) / var_a1) & 0xFFFF; + var_v0_2 = temp_t6; if (temp_t6 == 0) { - phi_v0_2 = 1; + var_v0_2 = 1; } } else { - phi_v0_2 = (temp_t9 / phi_a1) & 0xFFFF; + var_v0_2 = (temp_t9 / var_a1) & 0xFFFF; } } else { - phi_v0_3 = temp_t9; + var_v0_3 = temp_t9; if (temp_t9 >= 0x7FF9) { - phi_v0_3 = -temp_t9 & 0xFFFF; + var_v0_3 = -var_v0_3 & 0xFFFF; } - phi_v0_2 = (phi_v0_3 / phi_a1) & 0xFFFF; + var_v0_2 = (var_v0_3 / var_a1) & 0xFFFF; } - temp_t6_2 = phi_v0_2 + phi_t0; - phi_a3->unk244 = temp_t6_2; + temp_t6_2 = var_v0_2 + var_t0; + temp_a3->unk244 = temp_t6_2; if ((temp_t6_2 & 0xFFFF) >= 0x23) { - phi_a3->unk244 = 0x22; + temp_a3->unk244 = 0x0022U; } temp_v1_4 = player->unk_0BC; - if ((((temp_v1_4 & 0x80) != 0) || ((temp_v1_4 & 0x40) != 0) || ((temp_v1_4 & phi_t1) != 0) || ((temp_v1_4 & phi_a2) != 0) || ((temp_v1_4 & phi_t2) != 0) || ((player->unk_044 & 0x800) != 0)) && (phi_a3->unk244 >= 0x14)) { - phi_a3->unk244 = 0; + if (((temp_v1_4 & 0x80) || (temp_v1_4 & 0x40) || (temp_v1_4 & 0x80000) || (temp_v1_4 & 0x800000) || (temp_v1_4 & 0x20000) || (player->unk_044 & 0x800)) && ((s32) temp_a3->unk244 >= 0x14)) { + temp_a3->unk244 = 0U; } - if (phi_a3->unk24C >= 9) { - phi_a3->unk24C = 4; + if ((s32) temp_a3->unk24C >= 9) { + temp_a3->unk24C = 4U; } temp_v1_5 = player->unk_0BC; - if ((phi_t1 == (temp_v1_5 & phi_t1)) || (phi_a2 == (temp_v1_5 & phi_a2)) || ((player->unk_044 & 0x800) != 0)) { - phi_a3->unk24C = 4; + if (((temp_v1_5 & 0x80000) == 0x80000) || ((temp_v1_5 & 0x800000) == 0x800000) || (player->unk_044 & 0x800)) { + temp_a3->unk24C = 4U; } - if (((player->unk_0BC & 0x400) == 0x400) || ((player->unk_0BC & 0x1000000) == 0x1000000) || ((player->unk_0BC & 0x2000000) == 0x2000000) || ((player->unk_0BC << 0xF) < 0) || ((player->unk_0BC & 0x80) != 0) || ((player->unk_0BC & 0x40) != 0)) { - temp_a2_2 = 1 << temp_t3; - player->unk_002 = player->unk_002 | temp_a2_2; + if (((player->unk_0BC & 0x400) == 0x400) || ((player->unk_0BC & 0x01000000) == 0x01000000) || ((player->unk_0BC & 0x02000000) == 0x02000000) || ((player->unk_0BC << 0xF) < 0) || (player->unk_0BC & 0x80) || (player->unk_0BC & 0x40)) { + var_a2 = 1 << temp_t3; + player->unk_002 |= var_a2; temp_t9_2 = arg3 * 2; - temp_v0_3 = (arg2 * 0x10) + temp_t9_2 + D_80165190; - *temp_v0_3 = 1; - temp_v1_7 = player->unk_0BC; - phi_a2_2 = temp_a2_2; - if (((temp_v1_7 & 0x80) != 0) || ((temp_v1_7 & 0x40) != 0)) { - if ((phi_a3->unk244 == *(D_801650D0 + ((arg2 * 0x10) + temp_t9_2))) && (phi_a3->unk24C == *(D_80165110 + ((arg2 * 0x10) + temp_t9_2)))) { - player->unk_002 = player->unk_002 & ~temp_a2_2; - *temp_v0_3 = 1; + temp_v0_2 = (arg2 * 0x10) + temp_t9_2 + D_80165190; + *temp_v0_2 = 1; + temp_v1_6 = player->unk_0BC; + if ((temp_v1_6 & 0x80) || (temp_v1_6 & 0x40)) { + if ((temp_a3->unk244 == *(D_801650D0 + ((arg2 * 0x10) + temp_t9_2))) && (temp_a3->unk24C == *(D_80165110 + ((arg2 * 0x10) + temp_t9_2)))) { + player->unk_002 &= ~var_a2; + *temp_v0_2 = 1; } - } else if ((player->unk_0A8 >> 8) == (*(D_80165150 + ((arg2 * 0x10) + temp_t9_2)) >> 8)) { - player->unk_002 = player->unk_002 & ~temp_a2_2; + } else if (((s16) player->unk_0A8 >> 8) == ((s16) *(D_80165150 + ((arg2 * 0x10) + temp_t9_2)) >> 8)) { + player->unk_002 &= ~var_a2; } - phi_v1_3 = *(D_801650D0 + ((arg2 * 0x10) + temp_t9_2)); + var_v1 = *(D_801650D0 + ((arg2 * 0x10) + temp_t9_2)); } else { - temp_a2 = 1 << temp_t3; - player->unk_002 = player->unk_002 | temp_a2; + var_a2 = 1 << temp_t3; + player->unk_002 |= var_a2; temp_t6_3 = arg3 * 2; - temp_t7_2 = arg2 * 0x10; - temp_a1 = temp_t7_2 + temp_t6_3 + D_801650D0; - temp_v1_6 = *temp_a1; - phi_v1_3 = temp_v1_6; - phi_a2_2 = temp_a2; - if ((phi_a3->unk244 == temp_v1_6) && (phi_a3->unk24C == *(D_80165110 + (temp_t7_2 + temp_t6_3))) && (*(D_80165190 + (temp_t7_2 + temp_t6_3)) == 0)) { - player->unk_002 = player->unk_002 & ~temp_a2; - phi_v1_3 = *temp_a1; + temp_t7 = arg2 * 0x10; + temp_a1 = temp_t7 + temp_t6_3 + D_801650D0; + var_v1 = *temp_a1; + if ((temp_a3->unk244 == var_v1) && (temp_a3->unk24C == *(D_80165110 + (temp_t7 + temp_t6_3))) && (*(D_80165190 + (temp_t7 + temp_t6_3)) == 0)) { + player->unk_002 &= ~var_a2; + var_v1 = *temp_a1; } } - temp_a0_3 = phi_v1_3 - phi_a3->unk244; - if ((temp_a0_3 >= 0x14) || (temp_a0_3 < -0x13)) { - player->unk_002 = player->unk_002 | phi_a2_2; + temp_a0_2 = var_v1 - temp_a3->unk244; + if ((temp_a0_2 >= 0x14) || (temp_a0_2 < -0x13)) { + player->unk_002 |= var_a2; } } +/* Warning: struct Camera is not defined (only forward-declared) */ #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002934C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 -s32 func_802ABD10(u16); /* extern */ -? func_802AFA34(Player *, kartBoundingBoxCorner *, f32, f32, f32); /* extern */ -? func_802B63B8(f32, f32 *, f32 *, f32 *); /* extern */ -? func_802B6540(f32, f32 *, ?, ?, ?, s32); /* extern */ -s32 func_802B7C40(f32); /* extern */ -? move_f32_towards(f32 *, f32, ?); /* extern */ -? move_s16_towards(s16 *, s16, ?); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_802AFA34(Player *, KartBoundingBoxCorner *, f32, f32, f32); /* extern */ +? func_802B6540(f32, f32 (*)[3], ?, ?, ?, s32); /* extern */ static f32 D_800DDBD4[8] = { 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f }; void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { @@ -1081,7 +953,6 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { f32 sp88; f32 sp84; f32 sp80; - f32 sp5C; f32 sp54; f32 sp50; f32 sp48; @@ -1089,44 +960,38 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { f64 sp38; f32 sp34; f64 sp28; - f32 *temp_a0; - f32 *temp_a0_2; - f32 *temp_a0_3; - f32 *temp_a0_4; f32 temp_f0_2; f32 temp_f12; f32 temp_f14; f32 temp_f2; f32 temp_f2_3; + f32 var_f12; f64 temp_f0; f64 temp_f2_2; - s16 temp_t5; + s16 temp_v0; + s16 var_a1; s32 temp_t2; - s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; - s32 temp_v1; - f32 phi_f12; - s32 phi_v0; - s16 phi_a1; - s32 phi_v1; + s32 var_v0; + s32 var_v1; + u16 temp_t5; if ((player->unk_0BC & 0x40000000) == 0x40000000) { - phi_f12 = (f32) ((f64) (D_800DDBD4[player->characterId] / 2.0f) * ((f64) player->unk_224 * 1.5) * 18.0); + var_f12 = (f32) ((f64) (D_800DDBD4[player->characterId] / 2.0f) * ((f64) player->unk_224 * 1.5) * 18.0); } else { - phi_f12 = (D_800DDBD4[player->characterId] / 2.0f) * 18.0f; + var_f12 = (D_800DDBD4[player->characterId] / 2.0f) * 18.0f; } - sp48 = phi_f12; - func_802B6540(phi_f12, &sp5C, 0, 0x3F800000, 0, player->unk_02C[1] + player->unk_0C0); + sp48 = var_f12; + func_802B6540(var_f12, (f32 (*)[3]) &sp5C[0], 0, 0x3F800000, 0, player->unk_02E + player->unk_0C0); temp_f0 = (f64) sp48; - temp_a0 = &sp8C; temp_f2 = sp48 - 2.0f; sp8C = (f32) (temp_f0 - 3.6); sp38 = temp_f0; sp94 = temp_f2; sp40 = temp_f2; sp90 = -player->boundingBoxSize; - func_802B63B8(sp48, temp_a0, &sp5C); + func_802B63B8(&sp8C, (f32 (*)[3]) &sp5C[0]); sp80 = player->boundingBoxCorners[0].cornerX; sp84 = player->boundingBoxCorners[0].cornerY; sp88 = player->boundingBoxCorners[0].cornerZ; @@ -1136,13 +1001,12 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { func_802AFA34(player, player->boundingBoxCorners, sp80, sp84, sp88); temp_f14 = -sp48; temp_f2_2 = (f64) temp_f14; - temp_a0_2 = &sp8C; sp8C = (f32) (temp_f2_2 + 3.6); sp34 = temp_f14; sp28 = temp_f2_2; sp94 = sp40; sp90 = -player->boundingBoxSize; - func_802B63B8(sp48, (bitwise f32 *) temp_f14, temp_a0_2, &sp5C); + func_802B63B8(&sp8C, (f32 (*)[3]) &sp5C[0]); sp80 = player->boundingBoxCorners[1].cornerX; sp84 = player->boundingBoxCorners[1].cornerY; sp88 = player->boundingBoxCorners[1].cornerZ; @@ -1150,13 +1014,12 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { player->boundingBoxCorners[1].cornerY = sp90 + player->pos[1]; player->boundingBoxCorners[1].cornerZ = sp94 + player->pos[2]; func_802AFA34(player, &player->boundingBoxCorners[1], sp80, sp84, sp88); - temp_a0_3 = &sp8C; temp_f12 = sp34 + 4.0f; sp8C = (f32) (sp38 - 2.6); sp94 = temp_f12; sp40 = temp_f12; sp90 = -player->boundingBoxSize; - func_802B63B8(temp_f12, temp_a0_3, &sp5C); + func_802B63B8(&sp8C, (f32 (*)[3]) &sp5C[0]); sp80 = player->boundingBoxCorners[2].cornerX; sp84 = player->boundingBoxCorners[2].cornerY; sp88 = player->boundingBoxCorners[2].cornerZ; @@ -1164,11 +1027,10 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { player->boundingBoxCorners[2].cornerY = sp90 + player->pos[1]; player->boundingBoxCorners[2].cornerZ = sp94 + player->pos[2]; func_802AFA34(player, &player->boundingBoxCorners[2], sp80, sp84, sp88); - temp_a0_4 = &sp8C; sp8C = (f32) (sp28 + 2.6); sp94 = sp40; sp90 = -player->boundingBoxSize; - func_802B63B8((bitwise f32) temp_a0_4, &sp5C); + func_802B63B8(&sp8C, (f32 (*)[3]) &sp5C[0]); sp80 = player->boundingBoxCorners[3].cornerX; sp84 = player->boundingBoxCorners[3].cornerY; sp88 = player->boundingBoxCorners[3].cornerZ; @@ -1176,7 +1038,7 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { player->boundingBoxCorners[3].cornerY = sp90 + player->pos[1]; player->boundingBoxCorners[3].cornerZ = sp94 + player->pos[2]; func_802AFA34(player, &player->boundingBoxCorners[3], sp80, sp84, sp88); - if ((player->unk_0BC & 8) == 0) { + if (!(player->unk_0BC & 8)) { move_f32_towards(&player->unk_230, (player->boundingBoxCorners[0].cornerGroundY + player->boundingBoxCorners[2].cornerGroundY) / 2.0f, 0.5f); move_f32_towards(&player->unk_23C, (player->boundingBoxCorners[1].cornerGroundY + player->boundingBoxCorners[3].cornerGroundY) / 2.0f, 0.5f); move_f32_towards(&player->unk_1FC, (player->boundingBoxCorners[0].cornerGroundY + player->boundingBoxCorners[1].cornerGroundY) / 2.0f, 0.5f); @@ -1184,42 +1046,37 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { } temp_f2_3 = ((D_800DDBD4[player->characterId] * 18.0f) + 1.0f) * player->unk_224; sp50 = temp_f2_3; - player->unk_206 = (s16) -func_802B7C40((player->unk_23C - player->unk_230) / temp_f2_3); - if (((player->unk_0CA & 2) == 2) || (temp_t2 = player->unk_0BC & 8, phi_v0 = temp_t2, (temp_t2 != 0))) { + player->unk_206 = -func_802B7C40((player->unk_23C - player->unk_230) / temp_f2_3); + if (((player->unk_0CA & 2) == 2) || (temp_t2 = player->unk_0BC & 8, var_v0 = temp_t2, (temp_t2 != 0))) { player->unk_206 = 0; - phi_v0 = player->unk_0BC & 8; + var_v0 = player->unk_0BC & 8; } - if (phi_v0 != 8) { - move_s16_towards(&player->unk_0C4, func_802B7C40((player->unk_1F8 - player->unk_1FC) / temp_f2_3), 0x3F000000); + if (var_v0 != 8) { + move_s16_towards(&player->unk_0C4, func_802B7C40((player->unk_1F8 - player->unk_1FC) / temp_f2_3), 0.5f); } else { temp_f0_2 = player->rotY - arg2; sp54 = temp_f0_2; temp_v0 = func_802B7C40(temp_f0_2 / temp_f2_3); - phi_a1 = (s16) (temp_v0 * 0xA); + var_a1 = temp_v0 * 0xA; if (temp_f0_2 >= 0.0f) { - phi_a1 = (s16) (temp_v0 / 4); + var_a1 = (s16) (temp_v0 / 4); } - move_s16_towards(&player->unk_0C4, phi_a1, 0x3F000000); + move_s16_towards(&player->unk_0C4, var_a1, 0.5f); } if (((player->unk_0BC & 8) == 8) && ((player->unk_0CA & 2) == 2)) { player->unk_0C4 = (s16) (s32) player->unk_D9C; } - temp_t5 = func_802ABD10((u16) player->unk_11A) & 0xFF; - temp_v1 = temp_t5 & 0xFFFF; - player->unkF8 = temp_t5; - phi_v1 = temp_v1; - if (temp_v1 == 0xFE) { + temp_t5 = func_802ABD10(player->unk_110.unk3A) & 0xFF; + var_v1 = temp_t5 & 0xFFFF; + player->unk_0F8 = temp_t5; + if (var_v1 == 0xFE) { temp_v0_2 = player->unk_0BC; - phi_v1 = temp_v1; - if ((temp_v0_2 & 0x100000) != 0x100000) { - phi_v1 = temp_v1; - if ((temp_v0_2 & 8) != 8) { - player->unk_00C |= 0x800000; - phi_v1 = temp_t5 & 0xFFFF; - } + if (((temp_v0_2 & 0x100000) != 0x100000) && ((temp_v0_2 & 8) != 8)) { + var_v1 = temp_t5 & 0xFFFF; + player->unk_00C |= 0x800000; } } - if (phi_v1 == 0xFC) { + if (var_v1 == 0xFC) { temp_v0_3 = player->unk_0BC; if (((temp_v0_3 & 4) != 4) && ((temp_v0_3 & 8) != 8)) { player->unk_00C |= 0x8000; @@ -1231,12 +1088,7 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80029B4C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 -s32 func_802ABD10(u16); /* extern */ -s32 func_802ABD7C(u16); /* extern */ -f32 func_802ABE30(f32, f32, f32, u16); /* extern */ -s32 func_802B7C40(f32); /* extern */ -? move_s16_towards(s16 *, s16, ?); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc static f32 D_800DDBD4[8] = { 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f }; void func_8002A194(Player *player, f32 arg1, f32 arg2, f32 arg3) { @@ -1252,48 +1104,48 @@ void func_8002A194(Player *player, f32 arg1, f32 arg2, f32 arg3) { f32 temp_f14; f32 temp_f20; f32 temp_f2; + f32 var_f20; + s16 temp_v0; s16 temp_v1; + s16 var_a1; s32 temp_t0; s32 temp_t7; s32 temp_t8; s32 temp_t9; - s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; u16 temp_v1_2; - f32 phi_f20; - s16 phi_a1; - temp_v1 = -(s32) player->unk_02C[1] - player->unk_0C0; + temp_v1 = -player->unk_02E - player->unk_0C0; if ((player->unk_0BC & 0x40000000) == 0x40000000) { - phi_f20 = (f32) (((f64) ((D_800DDBD4[player->characterId] * 18.0f) / 2.0f) * ((f64) player->unk_224 * 1.5)) - 1.0); + var_f20 = (f32) (((f64) ((D_800DDBD4[player->characterId] * 18.0f) / 2.0f) * ((f64) player->unk_224 * 1.5)) - 1.0); } else { - phi_f20 = (((D_800DDBD4[player->characterId] * 18.0f) / 2.0f) * player->unk_224) - 1.0f; + var_f20 = (((D_800DDBD4[player->characterId] * 18.0f) / 2.0f) * player->unk_224) - 1.0f; } temp_t7 = (temp_v1 + 0x2000) & 0xFFFF; sp28 = temp_t7; sp3A = temp_v1; - player->boundingBoxCorners[0].cornerZ = (coss((u16) temp_t7) * phi_f20) + arg3; - temp_f12 = (sins((u16) sp28) * phi_f20) + arg1; + player->boundingBoxCorners[0].cornerZ = (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, (u16) player->unk_11A); + player->boundingBoxCorners[0].cornerGroundY = func_802ABE30(temp_f12, arg2, player->boundingBoxCorners[0].cornerZ, player->unk_110.unk3A); temp_t8 = (sp3A - 0x2000) & 0xFFFF; sp28 = temp_t8; - player->boundingBoxCorners[1].cornerZ = (coss((u16) temp_t8) * phi_f20) + arg3; - temp_f12_2 = (sins((u16) sp28) * phi_f20) + arg1; + player->boundingBoxCorners[1].cornerZ = (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, (u16) player->unk_11A); + player->boundingBoxCorners[1].cornerGroundY = func_802ABE30(temp_f12_2, arg2, player->boundingBoxCorners[1].cornerZ, player->unk_110.unk3A); temp_t9 = (sp3A + 0x6000) & 0xFFFF; sp28 = temp_t9; - player->boundingBoxCorners[2].cornerZ = (coss((u16) temp_t9) * phi_f20) + arg3; - temp_f12_3 = (sins((u16) sp28) * phi_f20) + arg1; + player->boundingBoxCorners[2].cornerZ = (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, (u16) player->unk_11A); + player->boundingBoxCorners[2].cornerGroundY = func_802ABE30(temp_f12_3, arg2, player->boundingBoxCorners[2].cornerZ, player->unk_110.unk3A); temp_t0 = (sp3A - 0x6000) & 0xFFFF; sp28 = temp_t0; - player->boundingBoxCorners[3].cornerZ = (coss((u16) temp_t0) * phi_f20) + arg3; - player->boundingBoxCorners[3].cornerX = (sins((u16) sp28) * phi_f20) + arg1; - player->boundingBoxCorners[3].cornerGroundY = func_802ABE30(player->boundingBoxCorners[2].cornerX, arg2, player->boundingBoxCorners[2].cornerZ, (u16) player->unk_11A); + 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); if ((player->unk_0BC & 8) != 8) { temp_f0 = player->boundingBoxCorners[0].cornerGroundY; temp_f2 = player->boundingBoxCorners[2].cornerGroundY; @@ -1304,38 +1156,38 @@ void func_8002A194(Player *player, f32 arg1, f32 arg2, f32 arg3) { player->unk_1FC = (temp_f0 + temp_f12_4) / 2.0f; player->unk_1F8 = (temp_f2 + temp_f14) / 2.0f; } - temp_v1_2 = func_802ABD10((u16) player->unk_11A) & 0xFF; - player->unkF8 = temp_v1_2; + temp_v1_2 = func_802ABD10(player->unk_110.unk3A) & 0xFF; + player->unk_0F8 = temp_v1_2; player->boundingBoxCorners[3].surfaceType = (u8) temp_v1_2; player->boundingBoxCorners[2].surfaceType = (u8) temp_v1_2; player->boundingBoxCorners[1].surfaceType = (u8) temp_v1_2; player->boundingBoxCorners[0].surfaceType = (u8) temp_v1_2; temp_f20 = (D_800DDBD4[player->characterId] * 18.0f) + 1.0f; - player->unk_206 = (s16) -func_802B7C40((player->unk_23C - player->unk_230) / temp_f20); + player->unk_206 = -func_802B7C40((player->unk_23C - player->unk_230) / temp_f20); if ((player->unk_0BC & 8) != 8) { - move_s16_towards(&player->unk_0C4, func_802B7C40((player->unk_1F8 - player->unk_1FC) / temp_f20), 0x3F000000); + move_s16_towards(&player->unk_0C4, func_802B7C40((player->unk_1F8 - player->unk_1FC) / temp_f20), 0.5f); } else { temp_f0_2 = player->rotY - arg2; sp30 = temp_f0_2; temp_v0 = func_802B7C40(temp_f0_2 / temp_f20); - phi_a1 = (s16) (temp_v0 * 0xA); + var_a1 = temp_v0 * 0xA; if (temp_f0_2 >= 0.0f) { - phi_a1 = (s16) (temp_v0 * 2); + var_a1 = temp_v0 * 2; } - move_s16_towards(&player->unk_0C4, phi_a1, 0x3F000000); + move_s16_towards(&player->unk_0C4, var_a1, 0.5f); } - if (func_802ABD7C((u16) player->unk_11A) != 0) { + if (func_802ABD7C(player->unk_110.unk3A) != 0) { player->boundingBoxCorners[3].unk_14 |= 1; } else { - player->boundingBoxCorners[3].unk_14 &= -2; + player->boundingBoxCorners[3].unk_14 &= ~1; } - if (player->unkF8 == 0xFE) { + if (player->unk_0F8 == 0x00FE) { temp_v0_2 = player->unk_0BC; if (((temp_v0_2 & 0x100000) != 0x100000) && ((temp_v0_2 & 8) != 8)) { player->unk_00C |= 0x800000; } } - if (player->unkF8 == 0xFC) { + if (player->unk_0F8 == 0x00FC) { temp_v0_3 = player->unk_0BC; if (((temp_v0_3 & 4) != 4) && ((temp_v0_3 & 8) != 8)) { player->unk_00C |= 0x8000; @@ -1523,55 +1375,15 @@ block_29: GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002A8A4.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80036C5C(); // extern -extern ? gkartHopJerkTable; -extern ? gKartHopInitialVelocityTable; - -/** - * Function: func_8002AA50 - - * Parameters: - * Player *player - A pointer to a Player - - * Some sort of hop initalization function, only runs when the hop button is - * first pressed. - - * Initializes several Player struct members, most importantly kartHopVelocity. - * This marks the beginning of a hop. - - * Refer to gKartHopInitialVelocityTable in kart_attributes.inc.c for possible - * starting values of kartHopVelocity (by default, 0.93f for all characterIds) - - * Sets kartHopAcceleration (kartHopAccleration) to 0.0f - - * Refer to gKartHopJerkTable in kart_attributes.inc.c for possible starting - * values of kartHopJerk (by default, 0.03f for all characterIds) - - * Sets unk_100 to 500.0f - - * Sets unk_DAC to 3.0f - - * Sets the second bit of unk_0BC. - * This is probably some sort of flag, something like "is hopping" or "is in the air" - - * Calls func_80036C5C - * No idea what that function does -**/ - void func_8002AA50(Player *player) { + player->kartHopJerk = gKartHopJerkTable[player->characterId]; player->kartHopAcceleration = 0.0f; - player->kartHopJerk = gkartHopJerkTable[player->characterId]; - player->unk_0BC |= 2; player->kartHopVelocity = gKartHopInitialVelocityTable[player->characterId]; + player->unk_0BC |= 2; player->unk_DAC = 3.0f; player->unk_100 = 500.0f; func_80036C5C(player); } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002AA50.s") -#endif /** * Function: func_8002AAC0 @@ -1674,12 +1486,8 @@ UNUSED void func_8002AE30(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -u16 atan2s(f32, f32, s16, void *); // extern -f32 sins(s32, void *); // extern -f32 coss(s32); // extern - -void func_8002AE38(void *arg0, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) { +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +void func_8002AE38(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) { s16 sp2E; f32 sp28; f32 sp24; @@ -1687,87 +1495,66 @@ void func_8002AE38(void *arg0, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) f32 temp_f16; f32 temp_f2; s16 temp_a0; - s16 temp_a0_2; s16 temp_v0_2; s16 temp_v0_3; s32 temp_lo; s32 temp_t2; s32 temp_t9; s32 temp_v0; - void *temp_a2; - void *temp_a2_2; - s32 phi_v1; - s32 phi_v0; - s32 phi_v0_2; - s16 phi_t7; - void *phi_a2; - s32 phi_v0_3; + s32 var_t7; + s32 var_v1; - temp_a2 = arg0; - temp_a0 = arg0->unk2E; - arg0 = temp_a2; - sp28 = (sins(-temp_a0 & 0xFFFF, temp_a2) * arg0->unk94) + arg2; - temp_a2_2 = arg0; - temp_f2 = temp_a2_2->unk94; - temp_v0 = temp_a2_2->unkBC; - temp_f16 = (coss(-arg0->unk2E & 0xFFFF) * temp_f2) + arg3; - phi_a2 = temp_a2_2; - if (((temp_v0 & 0x800) != 0x800) && ((temp_v0 & 0x10) != 0x10) && ((temp_a2_2->unk44 & 0x4000) == 0) && ((((temp_f2 / 18.0f) * 216.0f) <= 8.0f) || ((temp_t2 = temp_a2_2->unk7C >> 0x10, ((temp_t2 < 5) != 0)) && (temp_t2 >= -4)))) { + sp28 = (sins(-player->unk_02E & 0xFFFF) * player->unk_094) + arg2; + temp_f2 = player->unk_094; + temp_v0 = player->unk_0BC; + temp_f16 = (coss(-player->unk_02E & 0xFFFF) * temp_f2) + arg3; + if (((temp_v0 & 0x800) != 0x800) && ((temp_v0 & 0x10) != 0x10) && !(player->unk_044 & 0x4000) && ((((temp_f2 / 18.0f) * 216.0f) <= 8.0f) || ((temp_t2 = (s32) player->unk_07C >> 0x10, ((temp_t2 < 5) != 0)) && (temp_t2 >= -4)))) { if ((temp_v0 & 0x20) == 0x20) { - temp_v0_2 = temp_a2_2->unkC0; - phi_t7 = temp_v0_2 - (temp_v0_2 / 0xA); + temp_v0_2 = player->unk_0C0; + var_t7 = (s32) (f32) (temp_v0_2 - (temp_v0_2 / 10)); goto block_33; } - temp_a0_2 = temp_a2_2->unkC0; - temp_a2_2->unkC0 = temp_a2_2->unk78 * 9; - temp_a2_2->unkC0 = temp_a0_2 + ((temp_a2_2->unkC0 - temp_a0_2) / 0xF); + temp_a0 = player->unk_0C0; + player->unk_0C0 = player->unk_078 * 9; + player->unk_0C0 = (s16) (s32) (f32) (temp_a0 + ((s16) (player->unk_0C0 - temp_a0) / 15)); return; } - temp_v0_3 = temp_a2_2->unkC0; - if ((D_801652C0[arg1] & 8) != 0) { - phi_v1 = 2; + temp_v0_3 = player->unk_0C0; + if (D_801652C0[arg1] & 8) { + var_v1 = 2; } else { - phi_v1 = 0; + var_v1 = 0; } - if ((temp_a2_2->unk9C >= 200.0f) && (phi_v1 == 2) && ((temp_lo = temp_v0_3 / 0xB6, ((temp_lo < 0x10) == 0)) || (temp_lo < -0xF))) { + if ((player->unk_09C >= 200.0f) && (var_v1 == 2) && ((temp_lo = temp_v0_3 / 182, ((temp_lo < 0x10) == 0)) || (temp_lo < -0xF))) { sp2E = temp_v0_3; - arg0 = temp_a2_2; sp24 = temp_f16; - sp1A = atan2s(arg2 - arg4, arg3 - arg5, temp_v0_3, temp_a2_2); - arg0->unkC0 = sp1A - atan2s(arg2 - sp28, arg3 - temp_f16); + sp1A = atan2s(arg2 - arg4, arg3 - arg5); + player->unk_0C0 = sp1A - atan2s(arg2 - sp28, arg3 - temp_f16); } else { sp2E = temp_v0_3; - arg0 = temp_a2_2; sp24 = temp_f16; - sp1A = atan2s(arg2 - arg4, arg3 - arg5, temp_v0_3, temp_a2_2); - arg0->unkC0 = (sp1A - atan2s(arg2 - sp28, arg3 - temp_f16)) * 2; + sp1A = atan2s(arg2 - arg4, arg3 - arg5); + player->unk_0C0 = (sp1A - atan2s(arg2 - sp28, arg3 - temp_f16)) * 2; } - phi_a2 = arg0; - if (((arg0->unkBC & 0x10) != 0x10) && (((temp_t9 = arg0->unk7C >> 0x10, (temp_t9 > 0)) && (arg0->unkC0 < 0)) || ((temp_t9 < 0) && (arg0->unkC0 > 0)))) { - phi_v0 = arg0->unkC0; - if (arg0->unkC0 > 0) { - arg0->unkC0 = arg0->unk78 * 0x14; - phi_v0 = arg0->unkC0; + if (((player->unk_0BC & 0x10) != 0x10) && (((temp_t9 = (s32) player->unk_07C >> 0x10, (temp_t9 > 0)) && (player->unk_0C0 < 0)) || ((temp_t9 < 0) && (player->unk_0C0 > 0)))) { + if (player->unk_0C0 > 0) { + player->unk_0C0 = player->unk_078 * 0x14; } - phi_v0_2 = phi_v0; - if (phi_v0 < 0) { - arg0->unkC0 = arg0->unk78 * 0x14; - phi_v0_2 = arg0->unkC0; + if (player->unk_0C0 < 0) { + player->unk_0C0 = player->unk_078 * 0x14; } - arg0->unkC0 = temp_v0_3 + ((phi_v0_2 - temp_v0_3) / 0xC); + player->unk_0C0 = (s16) (s32) (f32) (temp_v0_3 + ((s16) (player->unk_0C0 - temp_v0_3) / 12)); return; } - if (arg0->unkC0 >= 0x1C71) { - arg0->unkC0 = 0x1C70; + if (player->unk_0C0 >= 0x1C71) { + player->unk_0C0 = 0x1C70; } - phi_v0_3 = arg0->unkC0; - if (arg0->unkC0 < -0x1C70) { - arg0->unkC0 = -0x1C70; - phi_v0_3 = arg0->unkC0; + if (player->unk_0C0 < -0x1C70) { + player->unk_0C0 = -0x1C70; } - phi_t7 = temp_v0_3 + ((phi_v0_3 - temp_v0_3) / 0xC); + var_t7 = (s32) (f32) (temp_v0_3 + ((s16) (player->unk_0C0 - temp_v0_3) / 12)); block_33: - phi_a2->unkC0 = phi_t7; + player->unk_0C0 = (s16) var_t7; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002AE38.s") @@ -2081,13 +1868,9 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002B8A4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8008C73C(void *, s8); // extern -s32 func_802B5224(void *, void *); // extern -extern f64 D_800ED7D0; - -void func_8002B9CC(void *arg0, s8 arg1, ? arg2) { - f32 (*temp_v0_3)[3]; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +void func_8002B9CC(Player *player, s8 arg1, s32 arg2) { + f32 *temp_v0_3; f32 temp_f0; f32 temp_f0_2; f32 temp_f14; @@ -2097,43 +1880,44 @@ void func_8002B9CC(void *arg0, s8 arg1, ? arg2) { s32 temp_v0_4; struct_D_8018CE10 *temp_v0; - if ((arg0->unk46 & 2) == 2) { + if ((player->unk_046 & 2) == 2) { temp_v0 = &D_8018CE10[arg1]; temp_f0 = temp_v0->unk_04; temp_f14 = temp_v0->unk_0C; - if ((sqrtf((temp_f0 * temp_f0) + (0.0f * 0.0f) + (temp_f14 * temp_f14)) >= 6.5) && (temp_v0_2 = arg0->unkBC, arg0->unk8C = arg0->unk8C / 4.0f, arg0->unk9C = arg0->unk9C / 4.0f, ((temp_v0_2 & 0x80) == 0)) && ((temp_v0_2 & 0x40) == 0)) { - func_8008C73C(arg0, arg1); - return; + if ((f64) sqrtf((temp_f0 * temp_f0) + (0.0f * 0.0f) + (temp_f14 * temp_f14)) >= 6.5) { + temp_v0_2 = player->unk_0BC; + player->unk_08C /= 4.0f; + player->unk_09C /= 4.0f; + if (!(temp_v0_2 & 0x80) && !(temp_v0_2 & 0x40)) { + func_8008C73C(player, arg1); + } } - // Duplicate return node #10. Try simplifying control flow for better match - return; - } - temp_v0_3 = &D_80165070[arg1]; - temp_f0_2 = temp_v0_3->unk0 - arg0->unk34; - temp_f2 = temp_v0_3->unk4 - arg0->unk38; - temp_f14_2 = temp_v0_3->unk8 - arg0->unk3C; - if (D_800ED7D0 <= sqrtf((temp_f0_2 * temp_f0_2) + (temp_f2 * temp_f2) + (temp_f14_2 * temp_f14_2))) { - temp_v0_4 = arg0->unkBC; - arg0->unk8C = arg0->unk8C / 4.0f; - arg0->unk9C = arg0->unk9C / 4.0f; - if (((temp_v0_4 & 0x80) == 0) && ((temp_v0_4 & 0x40) == 0)) { - func_8008C73C(arg0, arg1); + } else { + temp_v0_3 = D_80165070[arg1]; + temp_f0_2 = temp_v0_3->unk0 - player->unk_034[0]; + temp_f2 = temp_v0_3->unk4 - player->unk_034[1]; + temp_f14_2 = temp_v0_3->unk8 - player->unk_034[2]; + if ((f64) sqrtf((temp_f0_2 * temp_f0_2) + (temp_f2 * temp_f2) + (temp_f14_2 * temp_f14_2)) >= 4.2) { + temp_v0_4 = player->unk_0BC; + player->unk_08C /= 4.0f; + player->unk_09C /= 4.0f; + if (!(temp_v0_4 & 0x80) && !(temp_v0_4 & 0x40)) { + func_8008C73C(player, arg1); + } } + player->unk_234 = (s16) ((s16) (-func_802B5224(player->pos, &player->rotX) - (player->unk_02E - player->unk_0C0)) / 182); } - arg0->unk234 = (-func_802B5224(arg0 + 0x14, arg0 + 0x20) - (arg0->unk2E - arg0->unkC0)) / 0xB6; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002B9CC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_802B5224(f32 *, f32 *); // extern -? func_802B63B8(f32 *, f32 *); // extern -extern ? D_800E3C98; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_802B6540(f32 (*)[3], ?, ?, ?, s32); /* extern */ +static ? D_800E3C98; /* unable to generate initializer */ -void func_8002BB9C(void *arg0, f32 *arg1, f32 *arg2, ? arg3) { - f32 sp64; +void func_8002BB9C(Player *player, f32 *arg1, f32 *arg2, f32 *arg3) { f32 sp60; f32 sp5C; f32 sp58; @@ -2141,39 +1925,34 @@ void func_8002BB9C(void *arg0, f32 *arg1, f32 *arg2, ? arg3) { f32 sp50; f32 sp4C; ? sp30; - f32 *temp_a0; - f32 *temp_a0_2; s16 temp_a1; + s16 var_v0; s32 temp_lo; s32 temp_lo_2; s32 temp_t9; u16 temp_v0; - s32 phi_v0; - s32 phi_v0_2; - sp30.unk0 = D_800E3C98.unk0; - sp30.unk4 = D_800E3C98.unk4; - sp30.unk8 = D_800E3C98.unk8; - sp30.unkC = D_800E3C98.unkC; - sp30.unk10 = D_800E3C98.unk10; - temp_v0 = arg0->unk256; - if ((temp_v0 > 0) && (temp_v0 < 3) && ((arg0->unk46 & 0x20) != 0) && ((func_802B6540(&sp64, 0.0f, 1.0f, 0.0f, 0), sp5C = 0.0f, temp_a0 = &sp58, sp58 = *arg1, sp60 = *arg2, func_802B63B8(temp_a0, &sp64), temp_a0_2 = &sp4C, sp4C = arg0->unk20, sp50 = 0.0f, sp54 = arg0->unk28, func_802B63B8(temp_a0_2, &sp64), temp_a1 = arg0->unk2E, temp_lo = ((temp_a1 - -func_802B5224(&sp58, &sp4C)) + 0x10000) / 0xB6, ((temp_lo < 0x97) == 0)) || (temp_lo < -0x96))) { - temp_t9 = arg0->unk7C >> 0x10; + sp30.unk0 = (s32) D_800E3C98.unk0; + sp30.unk4 = (s32) D_800E3C98.unk4; + sp30.unk8 = (s32) D_800E3C98.unk8; + sp30.unkC = (s32) D_800E3C98.unkC; + sp30.unk10 = (s32) D_800E3C98.unk10; + temp_v0 = (u16) player->unk_256; + if (((s32) temp_v0 > 0) && ((s32) temp_v0 < 3) && (player->unk_046 & 0x20) && ((func_802B6540((f32 (*)[3]) &sp64[0], 0, 0x3F800000, 0, 0), sp5C = 0.0f, sp58 = *arg1, sp60 = *arg2, func_802B63B8(&sp58, (f32 (*)[3]) &sp64[0]), sp4C = player->rotX, sp50 = 0.0f, sp54 = player->rotZ, func_802B63B8(&sp4C, (f32 (*)[3]) &sp64[0]), temp_a1 = player->unk_02E, temp_lo = (s16) ((temp_a1 - -func_802B5224(&sp58, &sp4C)) + 0x10000) / 182, (((s16) temp_lo < 0x97) == 0)) || ((s16) temp_lo < -0x96))) { + temp_t9 = (s32) player->unk_07C >> 0x10; temp_lo_2 = temp_t9 / 6; - phi_v0 = temp_lo_2; - if (temp_lo_2 < 0) { - phi_v0 = temp_lo_2 * -1; + var_v0 = (s16) temp_lo_2; + if ((s16) temp_lo_2 < 0) { + var_v0 = (s16) temp_lo_2 * -1; } - phi_v0_2 = phi_v0; - if (phi_v0 >= 8) { - phi_v0_2 = 8; + if (var_v0 >= 8) { + var_v0 = 8; } if (temp_t9 < 0) { - arg0->unk2E = temp_a1 - (sp + (phi_v0_2 * 2))->unk30; + player->unk_02E = temp_a1 - (sp + (var_v0 * 2))->unk30; return; } - arg0->unk2E = temp_a1 + (sp + (phi_v0_2 * 2))->unk30; - // Duplicate return node #12. Try simplifying control flow for better match + player->unk_02E = temp_a1 + (sp + (var_v0 * 2))->unk30; } } #else @@ -2326,16 +2105,13 @@ void func_8002C11C(Player *player) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf -s32 func_802ABDF4(u16, s8, Player *); /* extern */ -extern ? gNearestWaypointByPlayerId; -extern ? gPathIndexByPlayerId; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_80165310; extern ? D_80165320; extern ? D_80165330; s16 gCurrentCourseId; /* unable to generate initializer */ -void func_8002C17C(Player *player, s8 arg1) { +void func_8002C17C(Player *player, s8 playerId) { s16 *sp1C; s16 *temp_v1; s16 *temp_v1_2; @@ -2359,95 +2135,95 @@ void func_8002C17C(Player *player, s8 arg1) { temp_v0 = gCurrentCourseId; switch (temp_v0) { /* irregular */ case 4: - temp_v0_2 = arg1 * 2; + temp_v0_2 = playerId * 2; temp_v1 = temp_v0_2 + &D_80165330; - if ((player->unk_124 >= 600.0f) && (*temp_v1 == 0)) { + if ((player->unk_110.unk44 >= 600.0f) && (*temp_v1 == 0)) { *temp_v1 = 1; - *(&D_80165320 + temp_v0_2) = *(&gNearestWaypointByPlayerId + temp_v0_2); - *(&D_80165310 + temp_v0_2) = *(&gPathIndexByPlayerId + temp_v0_2); + *(&D_80165320 + temp_v0_2) = gNearestWaypointByPlayerId[playerId]; + *(&D_80165310 + temp_v0_2) = gPathIndexByPlayerId[playerId]; return; } - temp_v0_3 = arg1 * 2; + temp_v0_3 = playerId * 2; temp_v1_2 = temp_v0_3 + &D_80165330; if (*temp_v1_2 == 0) { - *(&D_80165320 + temp_v0_3) = *(&gNearestWaypointByPlayerId + temp_v0_3); - *(&D_80165310 + temp_v0_3) = *(&gPathIndexByPlayerId + temp_v0_3); + *(&D_80165320 + temp_v0_3) = gNearestWaypointByPlayerId[playerId]; + *(&D_80165310 + temp_v0_3) = gPathIndexByPlayerId[playerId]; return; } - if ((player->unk_0BC & 8) == 0) { + if (!(player->unk_0BC & 8)) { sp1C = temp_v1_2; - if (func_802ABDF4((u16) player->unk_11A, arg1, player) == 0) { + if (func_802ABDF4(player->unk_110.unk3A) == 0) { *temp_v1_2 = 0; return; } } return; case 5: - temp_a0 = player->unkF8; - temp_v0_4 = arg1 * 2; - if (temp_a0 == 0xB) { + temp_a0 = player->unk_0F8; + temp_v0_4 = playerId * 2; + if (temp_a0 == 0x000B) { temp_v1_3 = temp_v0_4 + &D_80165330; if (*temp_v1_3 == 0) { *temp_v1_3 = 1; - *(&D_80165320 + temp_v0_4) = *(&gNearestWaypointByPlayerId + temp_v0_4); - *(&D_80165310 + temp_v0_4) = *(&gPathIndexByPlayerId + temp_v0_4); + *(&D_80165320 + temp_v0_4) = gNearestWaypointByPlayerId[playerId]; + *(&D_80165310 + temp_v0_4) = gPathIndexByPlayerId[playerId]; return; } } - temp_v0_5 = arg1 * 2; - if (temp_a0 != 0xB) { + temp_v0_5 = playerId * 2; + if (temp_a0 != 0x000B) { *(&D_80165330 + temp_v0_5) = 0; - *(&D_80165320 + temp_v0_5) = *(&gNearestWaypointByPlayerId + temp_v0_5); - *(&D_80165310 + temp_v0_5) = *(&gPathIndexByPlayerId + temp_v0_5); + *(&D_80165320 + temp_v0_5) = gNearestWaypointByPlayerId[playerId]; + *(&D_80165310 + temp_v0_5) = gPathIndexByPlayerId[playerId]; return; } break; case 7: temp_a0_2 = player->unk_0BC; - temp_v0_6 = arg1 * 2; + temp_v0_6 = playerId * 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) = *(&gNearestWaypointByPlayerId + temp_v0_6); - *(&D_80165310 + temp_v0_6) = *(&gPathIndexByPlayerId + temp_v0_6); + *(&D_80165320 + temp_v0_6) = gNearestWaypointByPlayerId[playerId]; + *(&D_80165310 + temp_v0_6) = gPathIndexByPlayerId[playerId]; return; } } if (temp_a3 == 0) { - temp_v0_7 = arg1 * 2; - if ((temp_a0_2 & 8) == 0) { + temp_v0_7 = playerId * 2; + if (!(temp_a0_2 & 8)) { *(&D_80165330 + temp_v0_7) = 0; - *(&D_80165320 + temp_v0_7) = *(&gNearestWaypointByPlayerId + temp_v0_7); - *(&D_80165310 + temp_v0_7) = *(&gPathIndexByPlayerId + temp_v0_7); + *(&D_80165320 + temp_v0_7) = gNearestWaypointByPlayerId[playerId]; + *(&D_80165310 + temp_v0_7) = gPathIndexByPlayerId[playerId]; return; } } break; case 13: - temp_v0_8 = arg1 * 2; + temp_v0_8 = playerId * 2; temp_v1_5 = temp_v0_8 + &D_80165330; - if ((player->unk_124 >= 600.0f) && (*temp_v1_5 == 0)) { + if ((player->unk_110.unk44 >= 600.0f) && (*temp_v1_5 == 0)) { *temp_v1_5 = 1; - *(&D_80165320 + temp_v0_8) = *(&gNearestWaypointByPlayerId + temp_v0_8); - *(&D_80165310 + temp_v0_8) = *(&gPathIndexByPlayerId + temp_v0_8); + *(&D_80165320 + temp_v0_8) = gNearestWaypointByPlayerId[playerId]; + *(&D_80165310 + temp_v0_8) = gPathIndexByPlayerId[playerId]; return; } - temp_v0_9 = arg1 * 2; + temp_v0_9 = playerId * 2; temp_v1_6 = temp_v0_9 + &D_80165330; if (*temp_v1_6 == 0) { - *(&D_80165320 + temp_v0_9) = *(&gNearestWaypointByPlayerId + temp_v0_9); - *(&D_80165310 + temp_v0_9) = *(&gPathIndexByPlayerId + temp_v0_9); + *(&D_80165320 + temp_v0_9) = gNearestWaypointByPlayerId[playerId]; + *(&D_80165310 + temp_v0_9) = gPathIndexByPlayerId[playerId]; return; } - if (((player->unk_0BC & 8) == 0) && ((player->unk_0CA & 1) == 0)) { + if (!(player->unk_0BC & 8) && !(player->unk_0CA & 1)) { *temp_v1_6 = 0; return; } break; default: - *(&D_80165330 + (arg1 * 2)) = 0; + *(&D_80165330 + (playerId * 2)) = 0; break; } } @@ -2456,17 +2232,14 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002C17C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8002C17C(void *, s8); // extern -? func_80090778(void *); // extern -? func_80090868(void *); // extern -? func_800C9060(u8, ?, f32 *); // extern -f32 func_802AAB4C(); // extern -s32 func_802ABDF4(u16); // extern +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_8002C17C(Player *, s8); /* extern */ +f32 func_802AAB4C(); /* extern */ +s16 gCurrentCourseId; /* unable to generate initializer */ -void func_8002C4F8(void *arg0, s8 arg1) { +void func_8002C4F8(Player *player, s8 arg1) { f32 *sp24; - f32 *temp_a2; + f32 *var_a2; f32 temp_f0; s16 temp_v0; s16 temp_v0_2; @@ -2474,132 +2247,126 @@ void func_8002C4F8(void *arg0, s8 arg1) { u16 temp_t1; u16 temp_t5; u16 temp_v1; - f32 *phi_a2; temp_f0 = func_802AAB4C(); - temp_a2 = &D_801652A0[arg1]; - *temp_a2 = temp_f0; - phi_a2 = temp_a2; - if (arg0->unk18 <= temp_f0) { - arg0->unkDE = arg0->unkDE | 2; + var_a2 = &D_801652A0[arg1]; + *var_a2 = temp_f0; + if (player->pos[1] <= temp_f0) { + player->unk_0DE |= 2; } else { - arg0->unkDE = arg0->unkDE & 0xFFFD; + player->unk_0DE &= 0xFFFD; } - if (arg0->unk70 < (*temp_a2 - arg0->unk18)) { - temp_t5 = arg0->unkDE | 1; - arg0->unkDE = temp_t5; - arg0->unkDE = temp_t5 & 0xFFFD; + if (player->boundingBoxSize < (*var_a2 - player->pos[1])) { + temp_t5 = player->unk_0DE | 1; + player->unk_0DE = temp_t5; + player->unk_0DE = temp_t5 & 0xFFFD; } else { - arg0->unkDE = arg0->unkDE & 0xFFFE; + player->unk_0DE &= 0xFFFE; } - if (arg0->unk70 < (*temp_a2 - arg0->unk18)) { - temp_v1 = arg0->unkDE; + if (player->boundingBoxSize < (*var_a2 - player->pos[1])) { + temp_v1 = player->unk_0DE; temp_t1 = temp_v1 | 8; if ((temp_v1 & 4) != 4) { - arg0->unkDE = temp_t1; - arg0->unkDE = temp_t1 | 4; + player->unk_0DE = temp_t1; + player->unk_0DE = temp_t1 | 4; temp_v0 = gCurrentCourseId; - if ((temp_v0 != 6) && (temp_v0 != 0x10) && (temp_v0 != 0xD) && ((arg0->unk0 & 0x4000) == 0x4000)) { - if ((temp_v0 == 2) || (temp_v0 == 0x13)) { - sp24 = temp_a2; - func_800C9060(arg1, 0x1900801C, temp_a2); + if ((temp_v0 != 6) && (temp_v0 != 0x0010) && (temp_v0 != 0x000D) && ((player->unk_000 & 0x4000) == 0x4000)) { + if ((temp_v0 == 2) || (temp_v0 == 0x0013)) { + sp24 = var_a2; + func_800C9060((u8) arg1, 0x1900801CU); } else { - sp24 = temp_a2; - func_800C9060(arg1, 0x19008008, temp_a2); + sp24 = var_a2; + func_800C9060((u8) arg1, 0x19008008U); } - phi_a2 = sp24; + var_a2 = sp24; } } } temp_v0_2 = gCurrentCourseId; - if ((temp_v0_2 == 6) || (temp_v0_2 == 0x10) || (temp_v0_2 == 0xD)) { - arg0->unkDE = arg0->unkDE & 0xFFF3; + if ((temp_v0_2 == 6) || (temp_v0_2 == 0x0010) || (temp_v0_2 == 0x000D)) { + player->unk_0DE &= 0xFFF3; } - if ((arg0->unk70 < (*phi_a2 - arg0->unk18)) && (arg0->unk124 >= 600.0f)) { - arg0->unkCA = arg0->unkCA | 1; + if ((player->boundingBoxSize < (*var_a2 - player->pos[1])) && (player->unk_110.unk44 >= 600.0f)) { + player->unk_0CA |= 1; } - if (arg0->unk124 >= 600.0f) { - arg0->unkCA = arg0->unkCA | 0x100; - } else if ((arg0->unkBC & 8) != 8) { - arg0->unkCA = arg0->unkCA & 0xFEFF; + if (player->unk_110.unk44 >= 600.0f) { + player->unk_0CA |= 0x100; + } else if ((player->unk_0BC & 8) != 8) { + player->unk_0CA &= 0xFEFF; } - if (((arg0->unk0 & 0x1000) != 0) && ((func_802ABDF4(arg0->unk11A) != 0) || ((arg0->unkCA & 1) != 0))) { - temp_v0_3 = arg0->unkCA; - if (((temp_v0_3 & 2) == 0) && ((temp_v0_3 & 8) == 0) && ((arg0->unkBC & 0x1000) == 0)) { - func_80090778(arg0); - func_80090868(arg0); + if ((player->unk_000 & 0x1000) && ((func_802ABDF4(player->unk_110.unk3A) != 0) || (player->unk_0CA & 1))) { + temp_v0_3 = player->unk_0CA; + if (!(temp_v0_3 & 2) && !(temp_v0_3 & 8) && !(player->unk_0BC & 0x1000)) { + func_80090778(player); + func_80090868(player); } } - if (((arg0->unk0 & 0x1000) != 0) && (arg0->unkF8 == 0xFD) && ((arg0->unkBC & 8) == 0)) { - func_80090778(arg0); - func_80090868(arg0); + if ((player->unk_000 & 0x1000) && (player->unk_0F8 == 0x00FD) && !(player->unk_0BC & 8)) { + func_80090778(player); + func_80090868(player); } - func_8002C17C(arg0, arg1); + func_8002C17C(player, arg1); } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002C4F8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8001CA24(void *, ?); // extern -? func_8002B9CC(s8, s8); // extern -? func_8008D554(void *); // extern +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_8002B9CC(s8, s8); /* extern */ -void func_8002C7E4(void *arg0, s8 arg1, s8 arg2) { - s16 temp_v1_3; +void func_8002C7E4(Player *player, s8 arg1, s8 arg2) { + s16 temp_v1_2; s32 temp_v0; s32 temp_v0_2; u16 temp_t3; u16 temp_t6; u16 temp_v1; - u16 temp_v1_2; - u16 phi_v1; + u16 var_v1; - temp_v1 = arg0->unk46; - phi_v1 = temp_v1; - if ((temp_v1 & 1) != 1) { - temp_v0 = arg0->unkBC; + var_v1 = player->unk_046; + if ((var_v1 & 1) != 1) { + temp_v0 = player->unk_0BC; if ((temp_v0 & 0x8000) == 0x8000) { if ((temp_v0 & 0x2000) != 0x2000) { func_8002B9CC(arg1, arg2); - phi_v1 = arg0->unk46; + var_v1 = player->unk_046; } - temp_t6 = phi_v1 | 1; - arg0->unk46 = temp_t6; - arg0->unk44 = arg0->unk44 & 0xFFFE; - arg0->unk46 = temp_t6 | 8; - if ((arg0->unk0 & 0x4000) == 0x4000) { - func_8001CA24(arg0, 0x40333333); + temp_t6 = var_v1 | 1; + player->unk_046 = temp_t6; + player->unk_044 &= 0xFFFE; + player->unk_046 = temp_t6 | 8; + if ((player->unk_000 & 0x4000) == 0x4000) { + func_8001CA24(player, 2.8f); } - temp_v1_2 = arg0->unk46; - if ((temp_v1_2 & 2) == 2) { - temp_t3 = temp_v1_2 | 4; - if ((temp_v1_2 & 4) != 4) { - arg0->unk46 = temp_t3; - arg0->unk46 = temp_t3 | 0x40; - if ((arg0->unkBC & 0x2000) != 0) { - func_8008D554(arg0); + temp_v1 = player->unk_046; + if ((temp_v1 & 2) == 2) { + temp_t3 = temp_v1 | 4; + if ((temp_v1 & 4) != 4) { + player->unk_046 = temp_t3; + player->unk_046 = temp_t3 | 0x40; + if (player->unk_0BC & 0x2000) { + func_8008D554(player); } } } } } - temp_v0_2 = arg0->unkBC; + temp_v0_2 = player->unk_0BC; if ((temp_v0_2 & 0x8000) == 0x8000) { - arg0->unkBC = temp_v0_2 & 0xFFFF7FFF; - arg0->unk10C = 1; - arg0->unk44 = arg0->unk44 & 0xFFFE; + player->unk_0BC = temp_v0_2 & 0xFFFF7FFF; + player->unk_10C = 1; + player->unk_044 &= 0xFFFE; return; } - temp_v1_3 = arg0->unk10C; - arg0->unk46 = arg0->unk46 & 0xFFFE; - arg0->unkBC = temp_v0_2 & 0xFFFF7FFF; - if (temp_v1_3 > 0) { - arg0->unk10C = temp_v1_3 + 1; + temp_v1_2 = player->unk_10C; + player->unk_046 &= 0xFFFE; + player->unk_0BC = temp_v0_2 & 0xFFFF7FFF; + if (temp_v1_2 > 0) { + player->unk_10C = temp_v1_2 + 1; } - if (arg0->unk10C >= 0xA) { - arg0->unk10C = 0; + if (player->unk_10C >= 0xA) { + player->unk_10C = 0; } } #else @@ -2607,106 +2374,70 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002C7E4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8001CA24(u16 *, ?); // extern -? func_80031F48(u16 *, ?); // extern -? func_8008D554(u16 *); // extern -? func_8008F494(u16 *, s8, u16 *); // extern -? func_800CAEC4(u8, f32); // extern -extern f64 D_800ED7D8; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_800CAEC4(u8, f32); /* extern */ -void func_8002C954(u16 *arg0, s8 arg1, void *arg2) { - f32 (*temp_v0_3)[3]; +void func_8002C954(Player *player, s8 arg1, f32 *arg2) { + f32 *temp_v0_3; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_4; f32 temp_f14; - f32 temp_f14_2; f32 temp_f2; + f32 var_f14; f64 temp_f0_3; - f64 temp_f2_2; + s16 temp_t1; s16 temp_v0_2; s32 temp_v0; s32 temp_v1; - u16 *temp_a0; - u16 *temp_a3; - u16 temp_t1; - u16 *phi_a3; - u16 *phi_a3_2; - u16 *phi_a3_3; - f32 phi_f14; - u16 *phi_a3_4; - temp_v0 = arg0->unkBC; + temp_v0 = player->unk_0BC; temp_v1 = temp_v0 & 0x10000; - temp_a3 = arg0; - temp_f0 = arg0->unk18 - arg0->unk74; - phi_a3 = temp_a3; - if ((((temp_v1 != 0x10000) && ((temp_v0 & 0x100000) == 0x100000)) || (((temp_f0 >= 20.0f) || (temp_f0 < -1.0f)) && (temp_v1 == 0) && ((temp_v0 & 8) != 0)) || ((temp_a3->unk114 == 0) && (temp_v1 == 0))) && ((temp_v0_2 = temp_a3->unkCA, temp_a0 = temp_a3, ((temp_v0_2 & 2) == 0)) || ((temp_v0_2 & 8) == 0))) { - arg0 = temp_a3; - func_8008F494(temp_a0, arg1, temp_a3); - phi_a3 = arg0; + temp_f0 = player->pos[1] - player->unk_074; + if ((((temp_v1 != 0x10000) && ((temp_v0 & 0x100000) == 0x100000)) || (((temp_f0 >= 20.0f) || (temp_f0 < -1.0f)) && (temp_v1 == 0) && (temp_v0 & 8)) || ((player->unk_110.unk34 == 0) && (temp_v1 == 0))) && ((temp_v0_2 = player->unk_0CA, ((temp_v0_2 & 2) == 0)) || !(temp_v0_2 & 8))) { + func_8008F494(player, arg1); } - phi_a3_2 = phi_a3; - if ((phi_a3->unk46 & 0x20) != 0x20) { - if ((phi_a3->unk11C < -1.0f) || (phi_a3->unk120 < -1.0f)) { - phi_a3->unk256 = 1; + if ((player->unk_046 & 0x20) != 0x20) { + if ((player->unk_110.unk3C < -1.0f) || (player->unk_110.unk40 < -1.0f)) { + player->unk_256 = 1; } - phi_a3->unk46 = phi_a3->unk46 | 0x20; + player->unk_046 |= 0x20; } - if (((phi_a3->unk0 & 0x4000) == 0x4000) && (((phi_a3->unk94 / 18.0f) * 216.0f) > 30.0f)) { - arg0 = phi_a3; - func_8001CA24(phi_a3, 0x40400000); - phi_a3_2 = arg0; + if (((player->unk_000 & 0x4000) == 0x4000) && (((player->unk_094 / 18.0f) * 216.0f) > 30.0f)) { + func_8001CA24(player, 3.0f); } - temp_t1 = phi_a3_2->unk256 + 1; - phi_a3_2->unk46 = phi_a3_2->unk46 | 0x10; - phi_a3_2->unk256 = temp_t1; - phi_a3_3 = phi_a3_2; + temp_t1 = (u16) player->unk_256 + 1; + player->unk_046 |= 0x10; + player->unk_256 = temp_t1; if ((temp_t1 & 0xFFFF) >= 0xA) { - phi_a3_2->unk256 = 0; + player->unk_256 = 0; } - if ((phi_a3_2->unkC4 >= 0) && (((phi_a3_2->unk94 / 18.0f) * 216.0f) > 5.0f)) { - arg0 = phi_a3_2; - func_80031F48(phi_a3_2, 0x41900000); - phi_a3_3 = arg0; + if ((player->unk_0C4 >= 0) && (((player->unk_094 / 18.0f) * 216.0f) > 5.0f)) { + func_80031F48(player, 18.0f); } - phi_a3_4 = phi_a3_3; - if ((*phi_a3_3 & 0x4000) == 0x4000) { - temp_v0_3 = &D_80165070[arg1]; + if ((player->unk_000 & 0x4000) == 0x4000) { + temp_v0_3 = D_80165070[arg1]; temp_f0_2 = temp_v0_3->unk0 - arg2->unk0; temp_f14 = temp_v0_3->unk4 - arg2->unk4; - arg0 = phi_a3_3; temp_f2 = temp_v0_3->unk8 - arg2->unk8; - temp_f14_2 = sqrtf((temp_f0_2 * temp_f0_2) + (temp_f14 * temp_f14) + (temp_f2 * temp_f2)) / 3.0f; - phi_f14 = temp_f14_2; - phi_a3_4 = arg0; - if (temp_f14_2 >= 1.0) { - phi_f14 = 1.0f; + var_f14 = sqrtf((temp_f0_2 * temp_f0_2) + (temp_f14 * temp_f14) + (temp_f2 * temp_f2)) / 3.0f; + if ((f64) var_f14 >= 1.0) { + var_f14 = 1.0f; } - temp_f2_2 = D_800ED7D8; - temp_f0_3 = phi_f14; - if ((temp_f0_3 <= temp_f2_2) && (((arg0->unk94 / 18.0f) * 216.0f) >= 40.0f) && ((arg0->unk0 & 0x100) == 0)) { - arg0 = arg0; - func_800CAEC4(arg1, 0.6f); - goto block_37; - } - if ((arg0->unk0 & 0x100) == 0) { - if ((temp_f0_3 <= temp_f2_2) && (temp_f0_4 = (arg0->unk94 / 18.0f) * 216.0f, (temp_f0_4 < 40.0f)) && (temp_f0_4 >= 10.0f)) { - arg0 = arg0; - func_800CAEC4(arg1, 0.3f); + temp_f0_3 = (f64) var_f14; + if ((temp_f0_3 <= 0.6) && (((player->unk_094 / 18.0f) * 216.0f) >= 40.0f) && !(player->unk_000 & 0x100)) { + func_800CAEC4((u8) arg1, 0.6f); + } else if (!(player->unk_000 & 0x100)) { + if ((temp_f0_3 <= 0.6) && (temp_f0_4 = (player->unk_094 / 18.0f) * 216.0f, (temp_f0_4 < 40.0f)) && (temp_f0_4 >= 10.0f)) { + func_800CAEC4((u8) arg1, 0.3f); } else { - arg0 = arg0; - func_800CAEC4(arg1, phi_f14); + func_800CAEC4((u8) arg1, var_f14); } -block_37: - phi_a3_4 = arg0; } } - if ((phi_a3_4->unkBC & 0x2000) != 0) { - arg0 = phi_a3_4; - func_8008D554(phi_a3_4); - arg0->unk8C = arg0->unk8C / 2.0f; + if (player->unk_0BC & 0x2000) { + func_8008D554(player); + player->unk_08C /= 2.0f; } } #else @@ -2714,145 +2445,87 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002C954.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80031F48(void *, ?); // extern -? func_8008C62C(void *, s8); // extern -? func_8008C9EC(void *, s8); // extern -? func_8008CEB0(void *, s8); // extern -? func_8008D170(void *, s8); // extern -? func_8008D4B4(void *); // extern -? func_8008D698(void *, s8); // extern -? func_8008D8B4(void *, s8); // extern -? func_8008DC08(void *, s8); // extern -? func_8008E118(void *, s8); // extern -? func_8008E4A4(void *, s8); // extern -? func_8008E8D8(void *, s8); // extern -? func_8008EDC0(void *); // extern -? func_8008F008(void *); // extern -? func_8008F1B8(void *, s8); // extern -? func_8008F3F4(void *, s8); // extern -? func_8008F650(void *, s8); // extern -? func_8008F8DC(void *, s8); // extern -? func_8008FC64(void *, s8); // extern -? func_8008FCDC(void *, s8); // extern -? func_80090970(void *, s8, s8); // extern -? func_80091298(void *, s8); // extern +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_8008C9EC(Player *, s8); /* extern */ +? func_8008CEB0(Player *, s8); /* extern */ +? func_8008D170(Player *, s8); /* extern */ +? func_8008E118(Player *, s8); /* extern */ +? func_80090970(Player *, s8, s8); /* extern */ +? func_80091298(Player *, s8); /* extern */ extern s32 D_800DC510; -void func_8002CD48(void *arg0, s8 arg1, s8 arg2) { +void func_8002CD48(Player *player, s8 arg1, s8 arg2) { s16 temp_v0; - s32 phi_v0; - s32 phi_v0_2; - s32 phi_v0_3; - s32 phi_v0_4; - s32 phi_v0_5; - s32 phi_v0_6; - s32 phi_v0_7; - s32 phi_v0_8; - s32 phi_v0_9; - s32 phi_v0_10; - s32 phi_v0_11; - s32 phi_v0_12; - s32 phi_v0_13; - s32 phi_v0_14; - temp_v0 = arg0->unkCA; + temp_v0 = player->unk_0CA; if (((temp_v0 & 2) == 2) || ((temp_v0 & 8) == 8)) { - func_80090970(arg0, arg1, arg2); + func_80090970(player, arg1, arg2); } - if ((arg0->unkBC & 0x800) == 0x800) { - func_8008CEB0(arg0, arg1); + if ((player->unk_0BC & 0x800) == 0x800) { + func_8008CEB0(player, arg1); } - if ((arg0->unk44 & 0x4000) != 0) { - func_8008D170(arg0, arg1); + if (player->unk_044 & 0x4000) { + func_8008D170(player, arg1); } - if ((arg0->unkBC & 0x2000) == 0x2000) { - func_8008D4B4(arg0); + if ((player->unk_0BC & 0x2000) == 0x2000) { + func_8008D4B4(player); } - phi_v0 = arg0->unkBC; - if ((arg0->unkBC & 0x100000) == 0x100000) { - func_8008EDC0(arg0); - phi_v0 = arg0->unkBC; + if ((player->unk_0BC & 0x100000) == 0x100000) { + func_8008EDC0(player); } - phi_v0_2 = phi_v0; - if ((phi_v0 & 4) == 4) { - func_8008F008(arg0); - phi_v0_2 = arg0->unkBC; + if ((player->unk_0BC & 4) == 4) { + func_8008F008(player); } - phi_v0_3 = phi_v0_2; - if ((phi_v0_2 & 0x4000000) == 0x4000000) { - func_8008DC08(arg0, arg1); - phi_v0_3 = arg0->unkBC; + if ((player->unk_0BC & 0x04000000) == 0x04000000) { + func_8008DC08(player, arg1); } - phi_v0_4 = phi_v0_3; - if ((phi_v0_3 & 0x40000000) == 0x40000000) { - func_8008E118(arg0, arg1); - phi_v0_4 = arg0->unkBC; + if ((player->unk_0BC & 0x40000000) == 0x40000000) { + func_8008E118(player, arg1); } - phi_v0_5 = phi_v0_4; - if ((phi_v0_4 & 0x10000) == 0x10000) { - func_8008F3F4(arg0, arg1); - phi_v0_5 = arg0->unkBC; + if ((player->unk_0BC & 0x10000) == 0x10000) { + func_8008F3F4(player, arg1); } - phi_v0_6 = phi_v0_5; - if ((phi_v0_5 & 0x200) == 0x200) { - func_8008F650(arg0, arg1); - phi_v0_6 = arg0->unkBC; + if ((player->unk_0BC & 0x200) == 0x200) { + func_8008F650(player, arg1); } - phi_v0_7 = phi_v0_6; - if ((phi_v0_6 & 0x80000000) == 0x80000000) { - func_8008F8DC(arg0, arg1); - phi_v0_7 = arg0->unkBC; + if ((player->unk_0BC & 0x80000000) == 0x80000000) { + func_8008F8DC(player, arg1); } - phi_v0_8 = phi_v0_7; - if (((phi_v0_7 & 0x20000000) == 0x20000000) && (arg0->unk228 >= 0x64)) { - func_80031F48(arg0, 0x40800000); - phi_v0_8 = arg0->unkBC; + if (((player->unk_0BC & 0x20000000) == 0x20000000) && (player->unk_228 >= 0x64)) { + func_80031F48(player, 4.0f); } - phi_v0_9 = phi_v0_8; - if (((phi_v0_8 & 0x80) == 0x80) || ((phi_v0_8 & 0x40) == 0x40)) { - func_8008C9EC(arg0, arg1); - phi_v0_9 = arg0->unkBC; + if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40)) { + func_8008C9EC(player, arg1); } - phi_v0_10 = phi_v0_9; - if ((phi_v0_9 & 0x400) == 0x400) { - func_8008C62C(arg0, arg1); - phi_v0_10 = arg0->unkBC; + if ((player->unk_0BC & 0x400) == 0x400) { + func_8008C62C(player, arg1); } - phi_v0_11 = phi_v0_10; - if ((phi_v0_10 & 0x1000000) == 0x1000000) { - func_8008E4A4(arg0, arg1); - phi_v0_11 = arg0->unkBC; + if ((player->unk_0BC & 0x01000000) == 0x01000000) { + func_8008E4A4(player, arg1); } - phi_v0_12 = phi_v0_11; - if ((phi_v0_11 & 0x2000000) == 0x2000000) { - func_8008E8D8(arg0, arg1); - phi_v0_12 = arg0->unkBC; + if ((player->unk_0BC & 0x02000000) == 0x02000000) { + func_8008E8D8(player, arg1); } - phi_v0_13 = phi_v0_12; - if ((phi_v0_12 & 0x4000) == 0x4000) { - func_8008F1B8(arg0, arg1); - phi_v0_13 = arg0->unkBC; + if ((player->unk_0BC & 0x4000) == 0x4000) { + func_8008F1B8(player, arg1); } - phi_v0_14 = phi_v0_13; - if ((phi_v0_13 & 0x80000) == 0x80000) { - func_8008D698(arg0, arg1); - phi_v0_14 = arg0->unkBC; + if ((player->unk_0BC & 0x80000) == 0x80000) { + func_8008D698(player, arg1); } - if ((phi_v0_14 & 0x800000) == 0x800000) { - func_8008D8B4(arg0, arg1); - func_80031F48(arg0, 0x41200000); + if ((player->unk_0BC & 0x800000) == 0x800000) { + func_8008D8B4(player, arg1); + func_80031F48(player, 10.0f); } if (D_800DC510 != 5) { - if (arg0->unkC & 0x4000000) { - func_8008FC64(arg0, arg1); + if (player->unk_00C & 0x04000000) { + func_8008FC64(player, arg1); } - if ((arg0->unkC * 0x10) < 0) { - func_8008FCDC(arg0, arg1); + if ((player->unk_00C * 0x10) < 0) { + func_8008FCDC(player, arg1); } } - if ((arg0->unk44 & 0x800) != 0) { - func_80091298(arg0, arg1); + if (player->unk_044 & 0x800) { + func_80091298(player, arg1); } } #else @@ -2931,59 +2604,31 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002D028.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80027EDC(Player *, s8); // extern -? func_80029B4C(Player *, f32, f32, f32); // extern -? func_8002A194(Player *, f32, f32, f32); // extern -? func_8002A79C(Player *, s8); // extern -? func_8002AAC0(f32, f64, Player *); // extern -? func_8002AB70(Player *); // extern -? func_8002AE38(Player *, s8, f32, f32, f32, f32); // extern -? func_8002B830(Player *, s8, s8); // extern -? func_8002BB9C(Player *, f32 *, f32 *, s8, s32, f32 *); // extern -? func_8002BF4C(Player *, s8); // extern -? func_8002C11C(Player *); // extern -? func_8002C4F8(Player *, s8); // extern -? func_8002C7E4(f32, f32, Player *, s8, s8); // extern -? func_8002C954(Player *, s8, f32 *); // extern -? func_8002CD48(Player *, s8, s8); // extern -? func_8002FCA8(Player *, s8); // extern -f32 func_80030150(Player *, s8); // extern -? func_80037BB4(Player *, f32 *); // extern -? func_8003F46C(Player *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -? func_8003F734(Player *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -? func_8003FBAC(Player *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -? func_8008F494(Player *, s8); // extern -? func_8008F5A4(Player *, s8); // extern -? func_800C9060(u8, ?); // extern -? func_800CADD0(u8, f32); // extern -s32 func_802ABDB8(u16); // extern -f32 func_802ABE30(f32, f32, f32, u16); // extern -? func_802AD950(s16 *, f32, f32, f32, f32, f32, f32, f32); // extern -? func_802B63B8(f32 *, f32 *); // extern -f32 sins(s32); // extern -f32 coss(f32, f32, s32, s32); // extern -extern ? D_800E3CE8; -extern ? D_800E3CF4; -extern ? D_800E3D00; -extern ? D_800E3D0C; -extern s32 D_800E3D18; -extern f64 D_800ED7E0; -extern f64 D_800ED7E8; -extern f32 D_800ED7F0; -extern f64 D_800ED7F8; -extern f64 D_800ED800; -extern f64 D_800ED808; -extern f64 D_800ED810; -extern f64 D_800ED818; -extern f64 D_800ED820; -extern f64 D_800ED828; -extern f64 D_800ED830; -extern f32 D_800ED838; -extern f64 D_800ED840; -extern ? gKartTopSpeedTable; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_80027EDC(Player *, s8); /* extern */ +? func_80029B4C(Player *, f32, f32, f32); /* extern */ +? func_8002A194(Player *, f32, f32, f32); /* extern */ +? func_8002A79C(Player *, s8); /* extern */ +? func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ +? func_8002BB9C(Player *, f32 *, f32 *, s8, s32, f32 *); /* extern */ +? func_8002BF4C(Player *, s8); /* extern */ +? func_8002C4F8(Player *, s8); /* extern */ +? func_8002C7E4(f32, f32, Player *, s8, s8); /* extern */ +? func_8002C954(Player *, s8, f32 *); /* extern */ +? func_8002CD48(Player *, s8, s8); /* extern */ +? func_8002FCA8(Player *, s8); /* extern */ +f32 func_80030150(Player *, s8); /* extern */ +? func_80037BB4(Player *, f32 *); /* extern */ +? func_800CADD0(u8, f32); /* extern */ +? func_802B6540(f32 *, f32, f32, f32, s32); /* extern */ +static ? D_800E3CE8; /* unable to generate initializer */ +static ? D_800E3CF4; /* unable to generate initializer */ +static ? D_800E3D00; /* unable to generate initializer */ +static ? D_800E3D0C; /* unable to generate initializer */ +static s32 D_800E3D18[0x17]; +s16 gCurrentCourseId; /* unable to generate initializer */ -void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { +void func_8002D268(Player *player, Camera *camera, s8 arg2, s8 arg3) { f32 sp18C; f32 sp184; f32 sp180; @@ -3001,17 +2646,17 @@ void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { f32 spB0; f32 spAC; f32 spA8; - //f32 spA0; - //f32 sp9C; - Vec3f sp98; // Clearly a vec3f - ? sp8C; + f32 spA0; + f32 sp9C; + f32 sp98; + f32 sp8C; s32 sp7C; f32 sp60; f32 *sp58; struct_D_8018CE10 *sp54; - ? *temp_t7; - f32 (*temp_v0_18)[3]; + ? *var_t7; f32 *temp_a1; + f32 *temp_v0_18; f32 *temp_v0_19; f32 temp_f0; f32 temp_f0_2; @@ -3019,38 +2664,27 @@ void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { f32 temp_f0_8; f32 temp_f0_9; f32 temp_f12; - f32 temp_f12_2; - f32 temp_f12_3; - f32 temp_f12_6; - f32 temp_f12_7; + f32 temp_f12_4; + f32 temp_f12_5; f32 temp_f14; - f32 temp_f14_2; - f32 temp_f14_3; + f32 temp_f2; f32 temp_f2_2; - f32 temp_f2_3; + f32 temp_f2_6; f32 temp_f2_7; f32 temp_f2_8; - f32 temp_f2_9; f32 temp_f4; + f32 var_f12; + f32 var_f14; f64 temp_f0_3; f64 temp_f0_4; f64 temp_f0_5; f64 temp_f0_6; - f64 temp_f12_4; - f64 temp_f12_5; - f64 temp_f14_4; - f64 temp_f14_5; - f64 temp_f14_6; - f64 temp_f16; - f64 temp_f16_2; - f64 temp_f16_3; - f64 temp_f18; - f64 temp_f2; + f64 temp_f12_2; + f64 temp_f12_3; + f64 temp_f2_3; f64 temp_f2_4; f64 temp_f2_5; - f64 temp_f2_6; - f64 temp_f8; - s16 temp_t6_2; + s16 temp_t6; s16 temp_v0_11; s16 temp_v0_13; s16 temp_v0_15; @@ -3059,17 +2693,17 @@ void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { s16 temp_v0_6; s16 temp_v0_7; s16 temp_v0_9; - s32 *temp_t6; - s32 temp_f6; + s32 *var_t6; + s32 temp_at; s32 temp_t4; s32 temp_t4_2; - s32 temp_t5; s32 temp_v0_16; s32 temp_v0_2; s32 temp_v0_3; s32 temp_v1; - s32 temp_v1_2; - s32 temp_v1_3; + s32 var_v0; + s32 var_v1; + s32 var_v1_2; struct_D_8018CE10 *temp_t9; u16 temp_v0; u16 temp_v0_10; @@ -3077,41 +2711,31 @@ void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { u16 temp_v0_14; u16 temp_v0_17; u16 temp_v0_8; - s32 *phi_t6; - ? *phi_t7; - s32 phi_v0; - f32 phi_f12; - f32 phi_f14; - f64 phi_f14_2; - f64 phi_f16; - s32 phi_v1; - s32 phi_v1_2; sp184.unk0 = D_800E3CE8.unk0; - sp184.unk4 = D_800E3CE8.unk4; - sp184.unk8 = D_800E3CE8.unk8; + sp184.unk4 = (s32) D_800E3CE8.unk4; + sp184.unk8 = (s32) D_800E3CE8.unk8; sp178.unk0 = D_800E3CF4.unk0; - sp178.unk4 = D_800E3CF4.unk4; - sp178.unk8 = D_800E3CF4.unk8; + sp178.unk4 = (s32) D_800E3CF4.unk4; + sp178.unk8 = (s32) D_800E3CF4.unk8; sp16C.unk0 = D_800E3D00.unk0; - sp16C.unk4 = D_800E3D00.unk4; - sp16C.unk8 = D_800E3D00.unk8; + sp16C.unk4 = (s32) D_800E3D00.unk4; + sp16C.unk8 = (s32) D_800E3D00.unk8; sp160.unk0 = D_800E3D0C.unk0; - sp160.unk4 = D_800E3D0C.unk4; - sp160.unk8 = D_800E3D0C.unk8; - phi_t6 = &D_800E3D18; - phi_t7 = &sp104; + var_t6 = D_800E3D18; + var_t7 = &sp104; + sp160.unk4 = (s32) D_800E3D0C.unk4; + sp160.unk8 = (s32) D_800E3D0C.unk8; do { - temp_t6 = phi_t6 + 0xC; - temp_t7 = phi_t7 + 0xC; - temp_t7->unk-C = *phi_t6; - temp_t7->unk-8 = temp_t6->unk-8; - temp_t7->unk-4 = temp_t6->unk-4; - phi_t6 = temp_t6; - phi_t7 = temp_t7; - } while (temp_t6 != (&D_800E3D18 + 0x54)); - temp_t7->unk0 = temp_t6->unk0; - temp_t7->unk4 = temp_t6->unk4; + temp_at = *var_t6; + var_t6 += 0xC; + var_t7 += 0xC; + var_t7->unk-C = temp_at; + var_t7->unk-8 = (s32) var_t6->unk-8; + var_t7->unk-4 = (s32) var_t6->unk-4; + } while (var_t6 != (D_800E3D18 + 0x54)); + var_t7->unk0 = (s32) var_t6->unk0; + var_t7->unk4 = (s32) var_t6->unk4; sp7C = 0; func_80027EDC(player, arg3); func_8002C11C(player); @@ -3130,112 +2754,93 @@ void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { func_80037BB4(player, &sp160); func_8002AB70(player); func_8002FCA8(player, arg3); - if ((player->unk_044 & 1) != 0) { + if (player->unk_044 & 1) { player->unk_064 *= -1.0f; player->unk_06C *= -1.0f; } - if ((player->unk_1D4 == 1) && (player->unk_1EC == 1)) { + if ((player->boundingBoxCorners[2].surfaceType == 1) && (player->boundingBoxCorners[3].surfaceType == 1)) { temp_f0 = player->unk_100; - temp_f12 = player->unk_064 + sp16C; - temp_f2 = D_800ED7E0; - spB4 = ((-player->unk_140 * temp_f0) * temp_f2) + (-1.0f * temp_f12); - spB0 = -player->unk_144 * temp_f0; - temp_f14 = player->unk_06C + sp174; - spAC = ((-player->unk_148 * temp_f0) * temp_f2) + (-1.0f * temp_f14); - phi_f12 = temp_f12; - phi_f14 = temp_f14; + var_f12 = player->unk_064 + sp16C; + spB4 = (f32) (((f64) (-player->unk_110.unk60[0] * temp_f0) * 0.925) + (f64) (-1.0f * var_f12)); + spB0 = -player->unk_110.unk60[1] * temp_f0; + var_f14 = player->unk_06C + sp174; + spAC = (f32) (((f64) (-player->unk_110.unk60[2] * temp_f0) * 0.925) + (f64) (-1.0f * var_f14)); } else { - temp_f6 = ((player->unk_094 / 18.0f) * 216.0f) / 10.0f; - phi_v0 = temp_f6; - if (temp_f6 >= 0xA) { - phi_v0 = 0xA; + var_v0 = (s32) (((player->unk_094 / 18.0f) * 216.0f) / 10.0f); + if (var_v0 >= 0xA) { + var_v0 = 0x0000000A; } temp_f0_2 = player->unk_100; - temp_f12_2 = player->unk_064 + sp16C; - temp_f2_2 = (sp + (phi_v0 * 4))->unk104; - spB4 = (temp_f2_2 * (-player->unk_140 * temp_f0_2)) + (-1.0f * temp_f12_2); - spB0 = -player->unk_144 * temp_f0_2; - temp_f14_2 = player->unk_06C + sp174; - spAC = (temp_f2_2 * (-player->unk_148 * temp_f0_2)) + (-1.0f * temp_f14_2); - phi_f12 = temp_f12_2; - phi_f14 = temp_f14_2; + var_f12 = player->unk_064 + sp16C; + temp_f2 = (sp + (var_v0 * 4))->unk104; + spB4 = (temp_f2 * (-player->unk_110.unk60[0] * temp_f0_2)) + (-1.0f * var_f12); + spB0 = -player->unk_110.unk60[1] * temp_f0_2; + var_f14 = player->unk_06C + sp174; + spAC = (temp_f2 * (-player->unk_110.unk60[2] * temp_f0_2)) + (-1.0f * var_f14); } temp_v0_2 = player->unk_0BC; temp_v1 = temp_v0_2 & 8; if ((temp_v1 != 8) && ((temp_v0_2 & 0x20) == 0x20)) { - spB4 = phi_f12 * 0.0f; - spAC = phi_f14 * 0.0f; + spB4 = var_f12 * 0.0f; + spAC = var_f14 * 0.0f; spB0 = (player->unk_100 * -1.0f) / 4.0f; } if (temp_v1 == 8) { - spB4 = phi_f12 * 0.0f; + spB4 = var_f12 * 0.0f; spB0 = player->unk_100 * -1.0f; - spAC = phi_f14 * 0.0f; + spAC = var_f14 * 0.0f; } - sp60 = coss(phi_f12, phi_f14, (player->unk_02C[1] + player->unk_0C0) & 0xFFFF, 1); + sp60 = coss((player->unk_02E + player->unk_0C0) & 0xFFFF); temp_a1 = player->unk_174; - temp_f2_3 = (sins((player->unk_02C[1] + player->unk_0C0) & 0xFFFF) * -(player->rotX - player->posX)) + ((player->rotZ - player->posZ) * sp60); - if (D_800ED7E8 < temp_f2_3) { + temp_f2_2 = (sins((player->unk_02E + player->unk_0C0) & 0xFFFF) * -(player->rotX - player->pos[0])) + ((player->rotZ - player->pos[2]) * sp60); + if ((f64) temp_f2_2 > 0.1) { player->unk_044 |= 8; } else { player->unk_044 &= 0xFFF7; } if ((player->unk_08C <= 0.0f) && (temp_v0_3 = player->unk_0BC, ((temp_v0_3 & 1) == 1)) && ((temp_v0_3 & 0x20) != 0x20)) { - sp180 = temp_f2_3 * D_800ED7F0; + sp180 = temp_f2_2 * 4500.0f; } else { sp180 = 0.0f; } sp17C = 0.0f; sp58 = temp_a1; - func_802B63B8(&sp178, temp_a1); - temp_f14_3 = spAC; - temp_f12_3 = temp_f14_3 + sp180; + func_802B63B8(&sp178, (f32 (*)[3]) temp_a1); + temp_f14 = spAC; + temp_f12 = temp_f14 + sp180; spB4 += sp178; - spAC = temp_f12_3; - func_8002C7E4(temp_f12_3, temp_f14_3, player, arg3, arg2); + spAC = temp_f12; + func_8002C7E4(temp_f12, temp_f14, player, arg3, arg2); sp18C = func_80030150(player, arg3); - func_802B63B8(&sp184, temp_a1); + func_802B63B8(&sp184, (f32 (*)[3]) sp58); sp98 = player->unk_034[0]; sp9C = player->unk_034[1]; spA0 = player->unk_034[2]; - if (((player->unk_10C < 3) && (player->unk_256 < 3)) || ((player->unk_0BC & 0x2000) == 0x2000)) { - temp_t4 = player->unk_07C >> 0x10; + if (((player->unk_10C < 3) && ((s32) (u16) player->unk_256 < 3)) || ((player->unk_0BC & 0x2000) == 0x2000)) { + temp_t4 = (s32) player->unk_07C >> 0x10; if ((temp_t4 >= 0x28) || (temp_t4 < -0x27)) { - temp_f0_5 = sp98; - temp_f14_6 = D_800ED7F8; - temp_f12_5 = sp7C; - temp_f16_3 = D_800ED800; - temp_f18 = D_800ED808; - temp_f2_6 = spA0; - sp98 = temp_f0_5 + ((((sp184 + spB4 + sp160) - (temp_f0_5 * (temp_f14_6 * player->unk_0FC))) / temp_f16_3) / ((player->unk_20C * temp_f18) + 1.0 + temp_f12_5)); - spA0 = temp_f2_6 + ((((sp18C + spAC + sp168) - (temp_f2_6 * (temp_f14_6 * player->unk_0FC))) / temp_f16_3) / ((player->unk_20C * temp_f18) + 1.0 + temp_f12_5)); - phi_f14_2 = temp_f14_6; - phi_f16 = temp_f16_3; + temp_f0_3 = (f64) sp98; + temp_f12_2 = (f64) sp7C; + temp_f2_3 = (f64) spA0; + sp98 = (f32) (temp_f0_3 + ((((f64) (sp184 + spB4 + sp160) - (temp_f0_3 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / (((f64) player->unk_20C * 0.6) + 1.0 + temp_f12_2))); + spA0 = (f32) (temp_f2_3 + ((((f64) (sp18C + spAC + sp168) - (temp_f2_3 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / (((f64) player->unk_20C * 0.6) + 1.0 + temp_f12_2))); } else { - temp_f0_4 = sp98; - temp_f14_5 = D_800ED810; - temp_f12_4 = sp7C + 1; - temp_f16_2 = D_800ED818; - temp_f2_5 = spA0; - sp98 = temp_f0_4 + ((((sp184 + spB4 + sp160) - (temp_f0_4 * (temp_f14_5 * player->unk_0FC))) / temp_f16_2) / temp_f12_4); - spA0 = temp_f2_5 + ((((sp18C + spAC + sp168) - (temp_f2_5 * (temp_f14_5 * player->unk_0FC))) / temp_f16_2) / temp_f12_4); - phi_f14_2 = temp_f14_5; - phi_f16 = temp_f16_2; + temp_f0_4 = (f64) sp98; + temp_f12_3 = (f64) (sp7C + 1); + temp_f2_4 = (f64) spA0; + sp98 = (f32) (temp_f0_4 + ((((f64) (sp184 + spB4 + sp160) - (temp_f0_4 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / temp_f12_3)); + spA0 = (f32) (temp_f2_4 + ((((f64) (sp18C + spAC + sp168) - (temp_f2_4 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / temp_f12_3)); } } else { - temp_f0_3 = sp98; - temp_f14_4 = D_800ED820; - temp_f16 = D_800ED828; - temp_f2_4 = spA0; - sp98 = temp_f0_3 + ((((sp184 + spB4 + sp160) - (temp_f0_3 * (temp_f14_4 * player->unk_0FC))) / temp_f16) / 30.0); - spA0 = temp_f2_4 + ((((sp18C + spAC + sp168) - (temp_f2_4 * (temp_f14_4 * player->unk_0FC))) / temp_f16) / 30.0); - phi_f14_2 = temp_f14_4; - phi_f16 = temp_f16; + temp_f0_5 = (f64) sp98; + temp_f2_5 = (f64) spA0; + sp98 = (f32) (temp_f0_5 + ((((f64) (sp184 + spB4 + sp160) - (temp_f0_5 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / 30.0)); + spA0 = (f32) (temp_f2_5 + ((((f64) (sp18C + spAC + sp168) - (temp_f2_5 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / 30.0)); } - temp_f0_6 = sp9C; - sp9C = temp_f0_6 + ((((sp188 + spB0 + sp164) - (temp_f0_6 * (phi_f14_2 * player->unk_0FC))) / phi_f16) / player->unk_DAC); + temp_f0_6 = (f64) sp9C; + sp9C = (f32) (temp_f0_6 + ((((f64) (sp188 + spB0 + sp164) - (temp_f0_6 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / (f64) player->unk_DAC)); temp_v0_4 = player->unk_0CA; - if (((temp_v0_4 & 2) == 2) || ((temp_v0_4 & 8) == 8) || ((player->unk_0BC & 0x4000000) == 0x4000000) || ((temp_v0_4 & 1) != 0)) { + if (((temp_v0_4 & 2) == 2) || ((temp_v0_4 & 8) == 8) || ((player->unk_0BC & 0x04000000) == 0x04000000) || (temp_v0_4 & 1)) { sp98 = 0.0f; sp9C = 0.0f; spA0 = 0.0f; @@ -3246,76 +2851,72 @@ void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { } temp_f0_7 = player->pos[0]; spF0 = temp_f0_7; - temp_f2_7 = player->pos[2]; - temp_f12_6 = player->pos[1]; - spE8 = temp_f2_7; + temp_f2_6 = player->pos[2]; + temp_f12_4 = player->pos[1]; + spE8 = temp_f2_6; player->rotX = temp_f0_7; - player->rotZ = temp_f2_7; - player->rotY = temp_f12_6; + player->rotZ = temp_f2_6; + player->rotY = temp_f12_4; temp_t9 = &D_8018CE10[arg3]; sp54 = temp_t9; spFC = temp_t9->unk_04 + (temp_f0_7 + player->unk_034[0]); - spF8 = player->unk_034[1] + temp_f12_6; + spF8 = player->unk_034[1] + temp_f12_4; spF4 = temp_t9->unk_0C + (spE8 + player->unk_034[2]); temp_v0_6 = player->unk_0CA; - if (((temp_v0_6 & 2) != 2) && ((temp_v0_6 & 8) != 8) && ((player->unk_0BC & 0x4000000) != 0x4000000) && ((temp_v0_6 & 1) == 0)) { - func_8002AAC0(temp_f12_6, phi_f14_2, player); - temp_f4 = spF8 + player->unk_0EC; - temp_f8 = temp_f4; + if (((temp_v0_6 & 2) != 2) && ((temp_v0_6 & 8) != 8) && ((player->unk_0BC & 0x04000000) != 0x04000000) && !(temp_v0_6 & 1)) { + func_8002AAC0(player); + temp_f4 = spF8 + player->kartHopVelocity; spF8 = temp_f4; - spF8 = temp_f8 - D_800ED830; + spF8 = (f32) ((f64) temp_f4 - 0.02); } func_802AD950(&player->unk_110, player->boundingBoxSize, spFC, spF8, spF4, player->rotX, player->rotY, player->rotZ); player->unk_058 = 0.0f; player->unk_060 = 0.0f; player->unk_05C = 1.0f; if ((player->unk_044 & 1) != 1) { - func_802B6540(sp58, player->unk_058, player->unk_05C, player->unk_060, player->unk_02C[1]); + func_802B6540(sp58, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_02E); } else { - func_802B6540(sp58, player->unk_058, player->unk_05C, player->unk_060, player->unk_02C[1] + 0x8000); + func_802B6540(sp58, player->unk_058, player->unk_05C, player->unk_060, player->unk_02E + 0x8000); } player->unk_0BC |= 8; player->unk_0C2 += 1; - spA8 = player->unk_124; + spA8 = player->unk_110.unk44; if (spA8 <= 0.0f) { temp_v0_7 = player->unk_0C2; temp_t4_2 = player->unk_0BC & ~2; - temp_t5 = temp_t4_2 & ~8; player->unk_0BC = temp_t4_2; - player->unk_0BC = temp_t5; + player->unk_0BC = temp_t4_2 & ~8; if (temp_v0_7 >= 0x23) { if (temp_v0_7 >= 0x32) { - player->unk_0C2 = 0x32; + player->unk_0C2 = 0x0032; } temp_v0_8 = player->unk_000; - temp_v1_2 = temp_v0_8 & 0x4000; + var_v1 = temp_v0_8 & 0x4000; player->unk_DCC = 0; - player->unk_0B6 = player->unk_0B6 | 0x100; + player->unk_0B6 |= 0x100; player->unk_DC0 = 3.0f; - phi_v1 = temp_v1_2; - if ((temp_v1_2 == 0x4000) && ((player->unk_0BC & 0x100000) == 0x100000) && ((temp_v0_8 & 0x100) != 0x100)) { - func_800C9060(arg3, 0x1900A60A); - phi_v1 = player->unk_000 & 0x4000; - } else if ((temp_v1_2 == 0x4000) && ((temp_v0_8 & 0x100) != 0x100)) { - func_800CADD0(arg3, player->unk_0C2 / 35.0f); - phi_v1 = player->unk_000 & 0x4000; + if ((var_v1 == 0x4000) && ((player->unk_0BC & 0x100000) == 0x100000) && ((temp_v0_8 & 0x100) != 0x100)) { + func_800C9060((u8) arg3, 0x1900A60AU); + var_v1 = player->unk_000 & 0x4000; + } else if ((var_v1 == 0x4000) && ((temp_v0_8 & 0x100) != 0x100)) { + func_800CADD0((u8) arg3, (f32) player->unk_0C2 / 35.0f); + var_v1 = player->unk_000 & 0x4000; } - if (phi_v1 == 0x4000) { + if (var_v1 == 0x4000) { player->unk_044 |= 0x100; } } temp_v0_9 = player->unk_0C2; if ((temp_v0_9 < 0x23) && (temp_v0_9 >= 0x1C) && (((player->unk_094 / 18.0f) * 216.0f) >= 20.0f)) { temp_v0_10 = player->unk_000; - temp_v1_3 = temp_v0_10 & 0x4000; + var_v1_2 = temp_v0_10 & 0x4000; player->unk_DCC = 0; - player->unk_DC0 = D_800ED838; - phi_v1_2 = temp_v1_3; - if ((temp_v1_3 == 0x4000) && ((temp_v0_10 & 0x100) != 0x100)) { - func_800CADD0(arg3, player->unk_0C2 / 35.0f); - phi_v1_2 = player->unk_000 & 0x4000; + player->unk_DC0 = 2.8f; + if ((var_v1_2 == 0x4000) && ((temp_v0_10 & 0x100) != 0x100)) { + func_800CADD0((u8) arg3, (f32) player->unk_0C2 / 35.0f); + var_v1_2 = player->unk_000 & 0x4000; } - if (phi_v1_2 == 0x4000) { + if (var_v1_2 == 0x4000) { player->unk_044 |= 0x100; } } @@ -3327,53 +2928,53 @@ void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { if (((temp_v0_12 & 0x4000) == 0x4000) && ((temp_v0_12 & 0x100) != 0x100)) { temp_v0_13 = player->unk_0C2; if ((temp_v0_13 < 0xB) && (temp_v0_13 >= 4) && (gCurrentCourseId == 2)) { - func_800CADD0(arg3, temp_v0_13 / 14.0f); + func_800CADD0((u8) arg3, (f32) temp_v0_13 / 14.0f); } else { - func_800CADD0(arg3, temp_v0_13 / 25.0f); + func_800CADD0((u8) arg3, (f32) temp_v0_13 / 25.0f); } } } player->unk_0C2 = 0; - player->unk_0EC = player->unk_0C2; + player->kartHopVelocity = (f32) player->unk_0C2; } - spA8 = player->unk_124; + spA8 = player->unk_110.unk44; if (spA8 <= 0.0f) { func_8003F46C(player, &sp8C, &sp98, &sp178, &spA8, &spFC, &spF8, &spF4); } - spA8 = player->unk_11C; + spA8 = player->unk_110.unk3C; if (spA8 < 0.0f) { func_8003F734(player, &sp8C, &sp98, &spA8, &spFC, &spF8, &spF4); func_8002C954(player, arg3, &sp98); } - spA8 = player->unk_120; + spA8 = player->unk_110.unk40; if (spA8 < 0.0f) { func_8003FBAC(player, &sp8C, &sp98, &spA8, &spFC, &spF8, &spF4); func_8002C954(player, arg3, &sp98); } - spA8 = player->unk_11C; + spA8 = player->unk_110.unk3C; if (spA8 >= 0.0f) { - spA8 = player->unk_120; + spA8 = player->unk_110.unk40; if (spA8 >= 0.0f) { - temp_v0_14 = player->unk_256; - player->unk_046 = player->unk_046 & 0xFFDF; + temp_v0_14 = (u16) player->unk_256; + player->unk_046 &= 0xFFDF; if (temp_v0_14 != 0) { - temp_t6_2 = temp_v0_14 + 1; - player->unk_256 = temp_t6_2; - if ((temp_t6_2 & 0xFFFF) >= 0xA) { + temp_t6 = temp_v0_14 + 1; + player->unk_256 = temp_t6; + if ((temp_t6 & 0xFFFF) >= 0xA) { player->unk_256 = 0; } } } } - if (((player->unk_0BC & 8) == 0) && (func_802ABDB8(player->unk_11A) != 0) && ((player->unk_0BC & 0x10000) != 0x10000)) { + if (!(player->unk_0BC & 8) && (func_802ABDB8(player->unk_110.unk3A) != 0) && ((player->unk_0BC & 0x10000) != 0x10000)) { temp_v0_15 = player->unk_0CA; - if (((temp_v0_15 & 2) == 0) || ((temp_v0_15 & 8) == 0)) { + if (!(temp_v0_15 & 2) || !(temp_v0_15 & 8)) { func_8008F494(player, arg3); } - } else if (((player->unk_0BC & 8) == 0) && (func_802ABDB8(player->unk_11A) == 0) && (player->unk_0BC & 0x10000)) { + } else if (!(player->unk_0BC & 8) && (func_802ABDB8(player->unk_110.unk3A) == 0) && (player->unk_0BC & 0x10000)) { func_8008F5A4(player, arg3); } - player->unk_074 = func_802ABE30(spFC, spF8, spF4, player->unk_11A); + player->unk_074 = func_802ABE30(spFC, spF8, spF4, player->unk_110.unk3A); if (((player->unk_000 & 0x4000) == 0x4000) && ((temp_v0_16 = gActiveScreenMode, (temp_v0_16 == 0)) || (temp_v0_16 == 2) || (temp_v0_16 == 1))) { func_80029B4C(player, spFC, spF8, spF4); } else { @@ -3382,33 +2983,33 @@ void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { func_8002AE38(player, arg3, spF0, spE8, spFC, spF4); player->unk_22C = player->unk_094; player->unk_094 = sqrtf((spA0 * spA0) + (sp98 * sp98)); - if ((player->unk_08C <= 0.0f) && (player->unk_094 <= D_800ED840) && (sp54->unk_04 == 0.0f) && (sp54->unk_0C == 0.0f)) { + if ((player->unk_08C <= 0.0f) && ((f64) player->unk_094 <= 0.08) && (sp54->unk_04 == 0.0f) && (sp54->unk_0C == 0.0f)) { sp98 += sp98 * -1.0f; spA0 += spA0 * -1.0f; } else { - player->posX = spFC; - player->posZ = spF4; + player->pos[0] = spFC; + player->pos[2] = spF4; } temp_v0_17 = player->unk_000; player->pos[1] = spF8; - if (((temp_v0_17 & 0x4000) != 0) && ((temp_v0_17 & 0x1000) == 0)) { - func_8002BB9C(player, &spFC, &spF4, arg2, arg3, &sp98); + if ((temp_v0_17 & 0x4000) && !(temp_v0_17 & 0x1000)) { + func_8002BB9C(player, &spFC, &spF4, arg2, (s32) arg3, &sp98); } player->unk_064 = sp178; player->unk_06C = sp180; - player->unk_034[0] = sp98[0]; - player->unk_034[1] = sp98[1]; - player->unk_034[2] = sp98[2]; - temp_v0_18 = &D_80165070[arg3]; + player->unk_034[0] = sp98; + player->unk_034[1] = sp9C; + player->unk_034[2] = spA0; + temp_v0_18 = D_80165070[arg3]; temp_v0_18->unk0 = sp98; temp_v0_18->unk4 = sp9C; temp_v0_18->unk8 = spA0; if ((player->unk_000 & 0x4000) == 0x4000) { - temp_f2_8 = player->unk_094; - temp_v0_19 = (player->characterId * 4) + &gKartTopSpeedTable; - temp_f12_7 = *temp_v0_19; - if (temp_f12_7 < temp_f2_8) { - temp_f0_8 = temp_f12_7 / temp_f2_8; + temp_f2_7 = player->unk_094; + temp_v0_19 = &gKartTopSpeedTable[player->characterId]; + temp_f12_5 = *temp_v0_19; + if (temp_f12_5 < temp_f2_7) { + temp_f0_8 = temp_f12_5 / temp_f2_7; player->unk_034[0] *= temp_f0_8; player->unk_034[1] *= temp_f0_8; player->unk_034[2] *= temp_f0_8; @@ -3416,17 +3017,17 @@ void func_8002D268(Player *player, Camera *arg1, s8 arg2, s8 arg3) { } } if ((player->unk_044 & 1) == 1) { - temp_f2_9 = player->unk_094; - if (temp_f2_9 > 1.0f) { - temp_f0_9 = 1.0f / temp_f2_9; + temp_f2_8 = player->unk_094; + if (temp_f2_8 > 1.0f) { + temp_f0_9 = 1.0f / temp_f2_8; player->unk_094 = 1.0f; player->unk_034[0] *= temp_f0_9; player->unk_034[1] *= temp_f0_9; player->unk_034[2] *= temp_f0_9; } } - if (player->unk_124 >= 500.0f) { - player->unk_078 = player->unk_078 / 2; + if (player->unk_110.unk44 >= 500.0f) { + player->unk_078 = (s16) ((s16) player->unk_078 / 2); } func_8002C4F8(player, arg3); } @@ -3449,47 +3050,23 @@ void func_8002E4C4(Player *player) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80029B4C(void *, f32, f32, f32); // extern -? func_8002A194(void *, f32, f32, f32); // extern -? func_8002AAC0(f64, f64, void *); // extern -? func_8002AB70(void *); // extern -? func_8002AE38(void *, s8, f32, f32, f32, f32); // extern -? func_8002B830(s8, s8); // extern -? func_8002C4F8(void *, s8); // extern -? func_8002C7E4(void *, s8, s8); // extern -? func_8002C954(void *, s8, f32 *); // extern -? func_8002CD48(void *, s8, s8); // extern -? func_8002FCA8(void *, s8); // extern -f32 func_80030150(void *, s8); // extern -? func_80031F48(void *, ?); // extern -? func_8003F46C(void *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -? func_8003F734(void *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -? func_8003FBAC(void *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -? func_8008F494(void *, s8); // extern -? func_8008F5A4(void *, s8); // extern -? func_800CADD0(u8, f32); // extern -s32 func_802ABDB8(u16); // extern -f32 func_802ABE30(f32, f32, f32, u16); // extern -? func_802AD950(void *, s32, f32, f32, f32, f32, f32, f32); // extern -? func_802B63B8(f32 *, f32 *); // extern -extern ? D_800E3D74; -extern ? D_800E3D80; -extern ? D_800E3D8C; -extern f64 D_800ED848; -extern f64 D_800ED850; -extern f64 D_800ED858; -extern f64 D_800ED860; -extern f64 D_800ED868; -extern f64 D_800ED870; -extern f64 D_800ED878; -extern f32 D_800ED880; -extern f32 D_800ED884; -extern f64 D_800ED888; -extern f64 D_800ED890; -extern ? gKartTopSpeedTable; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_80029B4C(Player *, f32, f32, f32); /* extern */ +? func_8002A194(Player *, f32, f32, f32); /* extern */ +? func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ +? func_8002C4F8(Player *, s8); /* extern */ +? func_8002C7E4(Player *, s8, s8); /* extern */ +? func_8002C954(Player *, s8, f32 *); /* extern */ +? func_8002CD48(Player *, s8, s8); /* extern */ +? func_8002FCA8(Player *, s8); /* extern */ +f32 func_80030150(Player *, s8); /* extern */ +? func_800CADD0(u8, f32); /* extern */ +? func_802B6540(f32 *, f32, f32, f32, s32); /* extern */ +static ? D_800E3D74; /* unable to generate initializer */ +static ? D_800E3D80; /* unable to generate initializer */ +static ? D_800E3D8C; /* unable to generate initializer */ -void func_8002E594(void *arg0, ? arg1, s8 arg2, s8 arg3) { +void func_8002E594(Player *player, Camera *camera, s8 arg2, s8 arg3) { f32 spF4; f32 spEC; f32 spE0; @@ -3506,353 +3083,302 @@ void func_8002E594(void *arg0, ? arg1, s8 arg2, s8 arg3) { f32 sp5C; f32 sp58; f32 sp54; - ? sp48; + f32 sp48; s16 sp46; f32 *sp40; f32 *temp_a0; f32 *temp_a0_2; - f32 *temp_v0_15; + f32 *temp_v0_13; f32 temp_f0; f32 temp_f0_5; f32 temp_f0_6; - f32 temp_f12_3; + f32 temp_f12; f32 temp_f18; + f32 temp_f2_3; f32 temp_f2_4; - f32 temp_f2_5; f32 temp_f4; f32 temp_f6; f64 temp_f0_2; f64 temp_f0_3; f64 temp_f0_4; - f64 temp_f12; - f64 temp_f12_2; - f64 temp_f14; - f64 temp_f14_2; - f64 temp_f16; f64 temp_f2; f64 temp_f2_2; - f64 temp_f2_3; + s16 temp_t8; s16 temp_v0_10; - s16 temp_v0_12; s16 temp_v0_4; s16 temp_v0_6; + s16 temp_v0_7; s16 temp_v0_8; s32 temp_t1; s32 temp_t5; s32 temp_v0; - s32 temp_v0_13; - s32 temp_v0_14; + s32 temp_v0_11; + s32 temp_v0_12; s32 temp_v0_2; s32 temp_v0_3; - s32 temp_v0_7; - s32 temp_v0_9; s32 temp_v1_4; + s32 var_v0; + s32 var_v0_2; struct_D_8018CE10 *temp_v0_5; - u16 temp_t8; - u16 temp_v0_11; + u16 temp_v0_9; u16 temp_v1; u16 temp_v1_2; u16 temp_v1_3; - f64 phi_f14; - f64 phi_f12; - s32 phi_v0; - s32 phi_v0_2; - s32 phi_v0_3; - s32 phi_v0_4; - f32 phi_f0; - f32 phi_f0_2; - f32 phi_f0_3; - f32 phi_f0_4; - f32 phi_f0_5; spEC.unk0 = D_800E3D74.unk0; - spEC.unk4 = D_800E3D74.unk4; - spEC.unk8 = D_800E3D74.unk8; + spEC.unk4 = (s32) D_800E3D74.unk4; + spEC.unk8 = (s32) D_800E3D74.unk8; spE0.unk0 = D_800E3D80.unk0; - spE0.unk4 = D_800E3D80.unk4; - spE0.unk8 = D_800E3D80.unk8; + spE0.unk4 = (s32) D_800E3D80.unk4; + spE0.unk8 = (s32) D_800E3D80.unk8; spD4.unk0 = D_800E3D8C.unk0; - spD4.unk4 = D_800E3D8C.unk4; - spD4.unk8 = D_800E3D8C.unk8; - func_8002B830(arg3, arg2); - temp_v0 = arg0->unkBC; - if (((temp_v0 & 0x80) == 0x80) || ((temp_v0 & 0x40) == 0x40) || ((temp_v0 & 0x4000) == 0x4000) || ((temp_v0 & 0x80000) == 0x80000) || ((temp_v0 & 0x800000) == 0x800000) || ((temp_v0 & 0x20000) == 0x20000) || ((arg0->unk44 & 0x800) != 0)) { + spD4.unk4 = (s32) D_800E3D8C.unk4; + spD4.unk8 = (s32) D_800E3D8C.unk8; + func_8002B830(player, arg3, arg2); + temp_v0 = player->unk_0BC; + if (((temp_v0 & 0x80) == 0x80) || ((temp_v0 & 0x40) == 0x40) || ((temp_v0 & 0x4000) == 0x4000) || ((temp_v0 & 0x80000) == 0x80000) || ((temp_v0 & 0x800000) == 0x800000) || ((temp_v0 & 0x20000) == 0x20000) || (player->unk_044 & 0x800)) { sp46 = 1; } else { sp46 = 0; } - func_8002CD48(arg0, arg3, arg2); - func_8002AB70(arg0); - func_8002FCA8(arg0, arg3); - temp_v0_2 = arg0->unkBC; + func_8002CD48(player, arg3, arg2); + func_8002AB70(player); + func_8002FCA8(player, arg3); + temp_v0_2 = player->unk_0BC; if (((temp_v0_2 & 0x80) == 0x80) || ((temp_v0_2 & 0x40) == 0x40) || ((temp_v0_2 & 0x20000) == 0x20000)) { - temp_f2 = D_800ED848; - temp_f0 = arg0->unk100; - sp80 = ((-arg0->unk140 * temp_f0) * temp_f2) + (-1.0f * arg0->unk64); - sp7C = -arg0->unk144 * temp_f0; - sp78 = ((-arg0->unk148 * temp_f0) * temp_f2) + (-1.0f * arg0->unk6C); + temp_f0 = player->unk_100; + sp80 = (f32) (((f64) (-player->unk_110.unk60[0] * temp_f0) * 0.1) + (f64) (-1.0f * player->unk_064)); + sp7C = -player->unk_110.unk60[1] * temp_f0; + sp78 = (f32) (((f64) (-player->unk_110.unk60[2] * temp_f0) * 0.1) + (f64) (-1.0f * player->unk_06C)); } else { - sp80 = arg0->unk64 * -1.0f; - sp7C = arg0->unk100 * -1.0f; - sp78 = arg0->unk6C * -1.0f; + sp80 = player->unk_064 * -1.0f; + sp7C = player->unk_100 * -1.0f; + sp78 = player->unk_06C * -1.0f; } - func_8002C7E4(arg0, arg3, arg2); + func_8002C7E4(player, arg3, arg2); if (sp46 == 1) { - temp_a0 = arg0 + 0x174; + temp_a0 = player->unk_174; sp40 = temp_a0; - func_802B6540(temp_a0, arg0->unk58, arg0->unk5C, arg0->unk60, arg0->unk2E); - func_802B6540(arg0 + 0x150, arg0->unk58, arg0->unk5C, arg0->unk60, arg0->unkAE); + func_802B6540(temp_a0, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_02E); + func_802B6540(player->unk_150, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_0AE); } else { - temp_a0_2 = arg0 + 0x174; + temp_a0_2 = player->unk_174; sp40 = temp_a0_2; - func_802B6540(temp_a0_2, arg0->unk58, arg0->unk5C, arg0->unk60, arg0->unk2E); + func_802B6540(temp_a0_2, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_02E); } - spF4 = func_80030150(arg0, arg3); + spF4 = func_80030150(player, arg3); if (sp46 == 1) { - func_802B63B8(&spEC, arg0 + 0x150); + func_802B63B8(&spEC, (f32 (*)[3]) player->unk_150); } else { - func_802B63B8(&spEC, sp40); + func_802B63B8(&spEC, (f32 (*)[3]) sp40); } - sp54 = arg0->unk34; - sp58 = arg0->unk38; - sp5C = arg0->unk3C; - if ((arg0->unk10C < 3) && (arg0->unk256 < 3) && (temp_v0_3 = arg0->unkBC, ((temp_v0_3 & 0x400) != 0x400)) && ((temp_v0_3 & 0x1000000) != 0x1000000) && ((temp_v0_3 & 0x2000000) != 0x2000000)) { - temp_f0_2 = sp54; - temp_f12 = D_800ED850; - temp_f14 = D_800ED858; - temp_f2_2 = sp5C; - sp54 = temp_f0_2 + ((((spEC + sp80 + spD4) - (temp_f0_2 * (temp_f14 * arg0->unkFC))) / temp_f12) / ((arg0->unk20C * 5.0f) + 1.0f)); - sp5C = temp_f2_2 + ((((spF4 + sp78 + spDC) - (temp_f2_2 * (temp_f14 * arg0->unkFC))) / temp_f12) / ((arg0->unk20C * 5.0f) + 1.0f)); - phi_f14 = temp_f14; - phi_f12 = temp_f12; + sp54 = player->unk_034[0]; + sp58 = player->unk_034[1]; + sp5C = player->unk_034[2]; + if ((player->unk_10C < 3) && ((s32) (u16) player->unk_256 < 3) && (temp_v0_3 = player->unk_0BC, ((temp_v0_3 & 0x400) != 0x400)) && ((temp_v0_3 & 0x01000000) != 0x01000000) && ((temp_v0_3 & 0x02000000) != 0x02000000)) { + temp_f0_2 = (f64) sp54; + temp_f2 = (f64) sp5C; + sp54 = (f32) (temp_f0_2 + ((((f64) (spEC + sp80 + spD4) - (temp_f0_2 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / (f64) ((player->unk_20C * 5.0f) + 1.0f))); + sp5C = (f32) (temp_f2 + ((((f64) (spF4 + sp78 + spDC) - (temp_f2 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / (f64) ((player->unk_20C * 5.0f) + 1.0f))); } else { - temp_f0_3 = sp54; - temp_f12_2 = D_800ED860; - temp_f14_2 = D_800ED868; - temp_f16 = D_800ED870; - temp_f2_3 = sp5C; - sp54 = temp_f0_3 + ((((spEC + sp80 + spD4) - (temp_f0_3 * (temp_f14_2 * arg0->unkFC))) / temp_f12_2) * temp_f16); - sp5C = temp_f2_3 + ((((spF4 + sp78 + spDC) - (temp_f2_3 * (temp_f14_2 * arg0->unkFC))) / temp_f12_2) * temp_f16); - phi_f14 = D_800ED878; - phi_f12 = temp_f12_2; + temp_f0_3 = (f64) sp54; + temp_f2_2 = (f64) sp5C; + sp54 = (f32) (temp_f0_3 + ((((f64) (spEC + sp80 + spD4) - (temp_f0_3 * (0.2 * (f64) player->unk_0FC))) / 6000.0) * 0.08)); + sp5C = (f32) (temp_f2_2 + ((((f64) (spF4 + sp78 + spDC) - (temp_f2_2 * (0.2 * (f64) player->unk_0FC))) / 6000.0) * 0.08)); } - temp_f0_4 = sp58; - sp58 = temp_f0_4 + ((((spF0 + sp7C + spD8) - (temp_f0_4 * (phi_f14 * arg0->unkFC))) / phi_f12) / arg0->unkDAC); - temp_v0_4 = arg0->unkCA; + temp_f0_4 = (f64) sp58; + sp58 = (f32) (temp_f0_4 + ((((f64) (spF0 + sp7C + spD8) - (temp_f0_4 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / (f64) player->unk_DAC)); + temp_v0_4 = player->unk_0CA; if (((temp_v0_4 & 2) == 2) || ((temp_v0_4 & 8) == 8)) { sp58 = 0.0f; sp54 = 0.0f; sp5C = 0.0f; } - temp_f0_5 = arg0->unk14; + temp_f0_5 = player->pos[0]; spBC = temp_f0_5; - temp_f2_4 = arg0->unk18; - temp_f18 = arg0->unk1C; - arg0->unk20 = temp_f0_5; - arg0->unk24 = temp_f2_4; - arg0->unk28 = temp_f18; + temp_f2_3 = player->pos[1]; + temp_f18 = player->pos[2]; + player->rotX = temp_f0_5; + player->rotY = temp_f2_3; + player->rotZ = temp_f18; temp_v0_5 = &D_8018CE10[arg3]; - spD0 = temp_v0_5->unk_04 + (temp_f0_5 + arg0->unk34); - spCC = arg0->unk38 + temp_f2_4; + spD0 = temp_v0_5->unk_04 + (temp_f0_5 + player->unk_034[0]); + spCC = player->unk_034[1] + temp_f2_3; spB4 = temp_f18; - temp_f6 = temp_v0_5->unk_0C + (temp_f18 + arg0->unk3C); + temp_f6 = temp_v0_5->unk_0C + (temp_f18 + player->unk_034[2]); spC8 = temp_f6; - func_8002AAC0(phi_f12, phi_f14, arg0); - temp_f4 = spCC + arg0->unkEC; + func_8002AAC0(player); + temp_f4 = spCC + player->kartHopVelocity; spCC = temp_f4; - func_802AD950(arg0 + 0x110, arg0->unk70, spD0, temp_f4, temp_f6, arg0->unk20, arg0->unk24, arg0->unk28); - arg0->unkBC = arg0->unkBC | 8; - arg0->unkC2 = arg0->unkC2 + 1; - arg0->unk58 = 0.0f; - arg0->unk60 = 0.0f; - arg0->unk5C = 1.0f; - sp74 = arg0->unk124; - phi_f0 = 0.0f; - phi_f0_2 = 0.0f; - phi_f0_3 = 0.0f; - phi_f0_4 = 0.0f; - phi_f0 = 0.0f; - phi_f0_5 = 0.0f; - phi_f0 = 0.0f; + func_802AD950(&player->unk_110, player->boundingBoxSize, spD0, temp_f4, temp_f6, player->rotX, player->rotY, player->rotZ); + player->unk_0BC |= 8; + player->unk_0C2 += 1; + player->unk_058 = 0.0f; + player->unk_060 = 0.0f; + player->unk_05C = 1.0f; + sp74 = player->unk_110.unk44; if (sp74 <= 0.0f) { - temp_t1 = arg0->unkBC & ~2; + temp_t1 = player->unk_0BC & ~2; temp_t5 = temp_t1 & ~8; - arg0->unkBC = temp_t1; - arg0->unkBC = temp_t5; - if (((temp_t5 & 0x400) != 0x400) && ((temp_t5 & 0x1000000) != 0x1000000) && ((temp_t5 & 0x2000000) != 0x2000000)) { - temp_v0_6 = arg0->unkC2; + player->unk_0BC = temp_t1; + player->unk_0BC = temp_t5; + if (((temp_t5 & 0x400) != 0x400) && ((temp_t5 & 0x01000000) != 0x01000000) && ((temp_t5 & 0x02000000) != 0x02000000)) { + temp_v0_6 = player->unk_0C2; if (temp_v0_6 >= 0x1C) { if (temp_v0_6 >= 0x32) { - arg0->unkC2 = 0x32; + player->unk_0C2 = 0x0032; } - temp_v1 = arg0->unk0; - temp_v0_7 = temp_v1 & 0x4000; - arg0->unkDCC = 0; - arg0->unkB6 = arg0->unkB6 | 0x100; - arg0->unkDC0 = 3.0f; - phi_v0 = temp_v0_7; - if ((temp_v0_7 == 0x4000) && ((temp_v1 & 0x100) != 0x100)) { - func_800CADD0(arg3, arg0->unkC2 / 50.0f); - phi_v0 = arg0->unk0 & 0x4000; + temp_v1 = player->unk_000; + var_v0 = temp_v1 & 0x4000; + player->unk_DCC = 0; + player->unk_0B6 |= 0x100; + player->unk_DC0 = 3.0f; + if ((var_v0 == 0x4000) && ((temp_v1 & 0x100) != 0x100)) { + func_800CADD0((u8) arg3, (f32) player->unk_0C2 / 50.0f); + var_v0 = player->unk_000 & 0x4000; } - phi_f0_5 = 0.0f; - if (phi_v0 == 0x4000) { - arg0->unk44 = arg0->unk44 | 0x100; + if (var_v0 == 0x4000) { + player->unk_044 |= 0x100; } } - temp_v0_8 = arg0->unkC2; - phi_f0 = phi_f0_5; - phi_f0 = phi_f0_5; - if ((temp_v0_8 < 0x1C) && (temp_v0_8 >= 0xA) && (((arg0->unk94 / 18.0f) * 216.0f) >= 20.0f)) { - temp_v1_2 = arg0->unk0; - temp_v0_9 = temp_v1_2 & 0x4000; - arg0->unkDCC = 0; - arg0->unkDC0 = 2.0f; - phi_v0_2 = temp_v0_9; - if ((temp_v0_9 == 0x4000) && ((temp_v1_2 & 0x100) != 0x100)) { - func_800CADD0(arg3, arg0->unkC2 / 50.0f); - phi_v0_2 = arg0->unk0 & 0x4000; + temp_v0_7 = player->unk_0C2; + if ((temp_v0_7 < 0x1C) && (temp_v0_7 >= 0xA) && (((player->unk_094 / 18.0f) * 216.0f) >= 20.0f)) { + temp_v1_2 = player->unk_000; + var_v0_2 = temp_v1_2 & 0x4000; + player->unk_DCC = 0; + player->unk_DC0 = 2.0f; + if ((var_v0_2 == 0x4000) && ((temp_v1_2 & 0x100) != 0x100)) { + func_800CADD0((u8) arg3, (f32) player->unk_0C2 / 50.0f); + var_v0_2 = player->unk_000 & 0x4000; } - if (phi_v0_2 == 0x4000) { - arg0->unk44 = arg0->unk44 | 0x100; + if (var_v0_2 == 0x4000) { + player->unk_044 |= 0x100; } } goto block_63; } - temp_v0_10 = arg0->unkC2; - if (temp_v0_10 >= 0xA) { - if (temp_v0_10 >= 0x32) { - arg0->unkC2 = 0x32; + temp_v0_8 = player->unk_0C2; + if (temp_v0_8 >= 0xA) { + if (temp_v0_8 >= 0x32) { + player->unk_0C2 = 0x0032; } - temp_v1_3 = arg0->unk0; - phi_v0_3 = arg0->unkC2; + temp_v1_3 = player->unk_000; if (((temp_v1_3 & 0x4000) == 0x4000) && ((temp_v1_3 & 0x100) != 0x100)) { - func_800CADD0(arg3, arg0->unkC2 / 20.0f); - phi_v0_3 = arg0->unkC2; + func_800CADD0((u8) arg3, (f32) player->unk_0C2 / 20.0f); } - phi_v0_4 = phi_v0_3; - phi_f0 = 0.0f; - if (phi_v0_3 >= 0x28) { - arg0->unkC2 = 0x14; - phi_v0_4 = arg0->unkC2; + if (player->unk_0C2 >= 0x28) { + player->unk_0C2 = 0x0014; } - if ((arg0->unkBC & 0x400) == 0x400) { - arg0->unkC2 = phi_v0_4 / 6.5; - arg0->unkF4 = 0.0f; - arg0->unkF0 = D_800ED880; + if ((player->unk_0BC & 0x400) == 0x400) { + player->unk_0C2 = (s16) (s32) ((f64) player->unk_0C2 / 6.5); + player->kartHopAcceleration = 0.0f; + player->kartHopJerk = 0.06f; } else { - arg0->unkC2 = phi_v0_4 / 7.5; - arg0->unkF4 = 0.0f; - arg0->unkF0 = D_800ED884; - if ((arg0->unk0 & 0x4000) == 0x4000) { - arg0->unk44 = arg0->unk44 | 0x100; + player->unk_0C2 = (s16) (s32) ((f64) player->unk_0C2 / 7.5); + player->kartHopAcceleration = 0.0f; + player->kartHopJerk = 0.06f; + if ((player->unk_000 & 0x4000) == 0x4000) { + player->unk_044 |= 0x100; } } } else { block_63: - arg0->unkC2 = 0; + player->unk_0C2 = 0; } - arg0->unkEC = arg0->unkC2; + player->kartHopVelocity = (f32) player->unk_0C2; } - sp74 = arg0->unk124; - phi_f0_2 = phi_f0; - if (sp74 <= phi_f0) { - func_8003F46C(arg0, &sp48, &sp54, &spE0, &sp74, &spD0, &spCC, &spC8); + sp74 = player->unk_110.unk44; + if (sp74 <= 0.0f) { + func_8003F46C(player, &sp48, &sp54, &spE0, &sp74, &spD0, &spCC, &spC8); } - sp74 = arg0->unk11C; - phi_f0_3 = phi_f0_2; - if (sp74 < phi_f0_2) { - func_8003F734(arg0, &sp48, &sp54, &sp74, &spD0, &spCC, &spC8); - func_8002C954(arg0, arg3, &sp54); - func_80031F48(arg0, 0x40C00000); + sp74 = player->unk_110.unk3C; + if (sp74 < 0.0f) { + func_8003F734(player, &sp48, &sp54, &sp74, &spD0, &spCC, &spC8); + func_8002C954(player, arg3, &sp54); + func_80031F48(player, 6.0f); } - sp74 = arg0->unk120; - phi_f0_4 = phi_f0_3; - if (sp74 < phi_f0_3) { - func_8003FBAC(arg0, &sp48, &sp54, &sp74, &spD0, &spCC, &spC8); - func_8002C954(arg0, arg3, &sp54); - func_80031F48(arg0, 0x40C00000); + sp74 = player->unk_110.unk40; + if (sp74 < 0.0f) { + func_8003FBAC(player, &sp48, &sp54, &sp74, &spD0, &spCC, &spC8); + func_8002C954(player, arg3, &sp54); + func_80031F48(player, 6.0f); } - sp74 = arg0->unk11C; - if (phi_f0_4 <= sp74) { - sp74 = arg0->unk120; - if (phi_f0_4 <= sp74) { - temp_v0_11 = arg0->unk256; - arg0->unk46 = arg0->unk46 & 0xFFDF; - if (temp_v0_11 != 0) { - temp_t8 = temp_v0_11 + 1; - arg0->unk256 = temp_t8; + sp74 = player->unk_110.unk3C; + if (sp74 >= 0.0f) { + sp74 = player->unk_110.unk40; + if (sp74 >= 0.0f) { + temp_v0_9 = (u16) player->unk_256; + player->unk_046 &= 0xFFDF; + if (temp_v0_9 != 0) { + temp_t8 = temp_v0_9 + 1; + player->unk_256 = temp_t8; if ((temp_t8 & 0xFFFF) >= 0xA) { - arg0->unk256 = 0; + player->unk_256 = 0; } } } } - if ((func_802ABDB8(arg0->unk11A) != 0) && ((arg0->unkBC & 0x10000) != 0x10000) && (((arg0->unk94 / 18.0f) * 216.0f) >= 20.0f)) { - temp_v0_12 = arg0->unkCA; - if (((temp_v0_12 & 2) == 0) || ((temp_v0_12 & 8) == 0)) { - func_8008F494(arg0, arg3); + if ((func_802ABDB8(player->unk_110.unk3A) != 0) && ((player->unk_0BC & 0x10000) != 0x10000) && (((player->unk_094 / 18.0f) * 216.0f) >= 20.0f)) { + temp_v0_10 = player->unk_0CA; + if (!(temp_v0_10 & 2) || !(temp_v0_10 & 8)) { + func_8008F494(player, arg3); } - } else if (((arg0->unkBC & 8) == 0) && (func_802ABDB8(arg0->unk11A) == 0) && (arg0->unkBC & 0x10000)) { - func_8008F5A4(arg0, arg3); + } else if (!(player->unk_0BC & 8) && (func_802ABDB8(player->unk_110.unk3A) == 0) && (player->unk_0BC & 0x10000)) { + func_8008F5A4(player, arg3); } - arg0->unk74 = func_802ABE30(spD0, spCC, spC8, arg0->unk11A); - if (((arg0->unk0 & 0x4000) == 0x4000) && ((temp_v0_13 = gActiveScreenMode, (temp_v0_13 == 0)) || (temp_v0_13 == 2) || (temp_v0_13 == 1))) { - func_80029B4C(arg0, spD0, spCC, spC8); + player->unk_074 = func_802ABE30(spD0, spCC, spC8, player->unk_110.unk3A); + if (((player->unk_000 & 0x4000) == 0x4000) && ((temp_v0_11 = gActiveScreenMode, (temp_v0_11 == 0)) || (temp_v0_11 == 2) || (temp_v0_11 == 1))) { + func_80029B4C(player, spD0, spCC, spC8); } else { - func_8002A194(arg0, spD0, spCC, spC8); + func_8002A194(player, spD0, spCC, spC8); } - func_8002AE38(arg0, arg3, spBC, spB4, spD0, spC8); - arg0->unk22C = arg0->unk94; - temp_v0_14 = arg0->unkBC; - arg0->unk94 = sqrtf((sp5C * sp5C) + (sp54 * sp54)); - temp_v1_4 = temp_v0_14 & 0x400; - if (((temp_v1_4 != 0x400) && (arg0->unk8C <= 0.0f) && (arg0->unk94 < D_800ED888)) || ((temp_v1_4 != 0x400) && (arg0->unk8C <= 0.0f) && (arg0->unk94 < D_800ED890) && ((temp_v0_14 & 1) == 1))) { + func_8002AE38(player, arg3, spBC, spB4, spD0, spC8); + player->unk_22C = player->unk_094; + temp_v0_12 = player->unk_0BC; + player->unk_094 = sqrtf((sp5C * sp5C) + (sp54 * sp54)); + temp_v1_4 = temp_v0_12 & 0x400; + if (((temp_v1_4 != 0x400) && (player->unk_08C <= 0.0f) && ((f64) player->unk_094 < 0.13)) || ((temp_v1_4 != 0x400) && (player->unk_08C <= 0.0f) && ((f64) player->unk_094 < 0.2) && ((temp_v0_12 & 1) == 1))) { sp54 += sp54 * -1.0f; sp5C += sp5C * -1.0f; } else { - arg0->unk14 = spD0; - arg0->unk1C = spC8; + player->pos[0] = spD0; + player->pos[2] = spC8; } - arg0->unk18 = spCC; - arg0->unk64 = spE0; - arg0->unk6C = spE8; - arg0->unk34 = sp54; - arg0->unk38 = sp58; - arg0->unk3C = sp5C; - if ((arg0->unk0 & 0x4000) == 0x4000) { - temp_f2_5 = arg0->unk94; - temp_v0_15 = (arg0->unk254 * 4) + &gKartTopSpeedTable; - temp_f12_3 = *temp_v0_15; - if (temp_f12_3 < temp_f2_5) { - temp_f0_6 = temp_f12_3 / temp_f2_5; - arg0->unk34 = arg0->unk34 * temp_f0_6; - arg0->unk38 = arg0->unk38 * temp_f0_6; - arg0->unk3C = arg0->unk3C * temp_f0_6; - arg0->unk94 = *temp_v0_15; + player->pos[1] = spCC; + player->unk_064 = spE0; + player->unk_06C = spE8; + player->unk_034[0] = sp54; + player->unk_034[1] = sp58; + player->unk_034[2] = sp5C; + if ((player->unk_000 & 0x4000) == 0x4000) { + temp_f2_4 = player->unk_094; + temp_v0_13 = &gKartTopSpeedTable[player->characterId]; + temp_f12 = *temp_v0_13; + if (temp_f12 < temp_f2_4) { + temp_f0_6 = temp_f12 / temp_f2_4; + player->unk_034[0] *= temp_f0_6; + player->unk_034[1] *= temp_f0_6; + player->unk_034[2] *= temp_f0_6; + player->unk_094 = *temp_v0_13; } } - func_8002C4F8(arg0, arg3); + func_8002C4F8(player, arg3); } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002E594.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8002B830(s8, s8); // extern -? func_8002CD48(void *, s8, s8); // extern -f32 func_80030150(void *, s8); // extern -? func_802B63B8(f32 *, f32 *); // extern -extern ? D_800E3D98; -extern ? D_800E3DA4; -extern ? D_800E3DB0; -extern ? D_800E3DBC; -extern f64 D_800ED898; -extern f64 D_800ED8A0; -extern ? gKartTopSpeedTable; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_8002CD48(Player *, s8, s8); /* extern */ +f32 func_80030150(Player *, s8); /* extern */ +? func_802B6540(f32, f32, f32 *, f32, f32, f32, s32); /* extern */ +static ? D_800E3D98; /* unable to generate initializer */ +static ? D_800E3DA4; /* unable to generate initializer */ +static ? D_800E3DB0; /* unable to generate initializer */ +static ? D_800E3DBC; /* unable to generate initializer */ -void control_cpu_movement(void *arg0, ? arg1, s8 arg2, s8 arg3) { +void control_cpu_movement(Player *player, Camera *camera, s8 arg2, s8 arg3) { f32 spFC; f32 spF4; ? spE8; @@ -3867,8 +3393,8 @@ void control_cpu_movement(void *arg0, ? arg1, s8 arg2, s8 arg3) { f32 sp68; f32 sp40; f32 *sp3C; - f32 (*temp_v0)[3]; f32 *temp_a1; + f32 *temp_v0; f32 *temp_v1; f32 temp_f0_2; f32 temp_f12; @@ -3878,91 +3404,87 @@ void control_cpu_movement(void *arg0, ? arg1, s8 arg2, s8 arg3) { f32 temp_f8; f32 temp_f8_2; f64 temp_f0; - f64 temp_f16; - f64 temp_f18; f64 temp_f2; s32 temp_t1; spF4.unk0 = D_800E3D98.unk0; - spF4.unk4 = D_800E3D98.unk4; - spF4.unk8 = D_800E3D98.unk8; - spE8.unk0 = D_800E3DA4.unk0; - spE8.unk8 = D_800E3DA4.unk8; - spE8.unk4 = D_800E3DA4.unk4; + spF4.unk4 = (s32) D_800E3D98.unk4; + spF4.unk8 = (s32) D_800E3D98.unk8; + spE8.unk0 = (s32) D_800E3DA4.unk0; + spE8.unk8 = (s32) D_800E3DA4.unk8; + spE8.unk4 = (s32) D_800E3DA4.unk4; spDC.unk0 = D_800E3DB0.unk0; - spDC.unk4 = D_800E3DB0.unk4; - spDC.unk8 = D_800E3DB0.unk8; + spDC.unk4 = (s32) D_800E3DB0.unk4; + spDC.unk8 = (s32) D_800E3DB0.unk8; spD0.unk0 = D_800E3DBC.unk0; - spD0.unk4 = D_800E3DBC.unk4; - spD0.unk8 = D_800E3DBC.unk8; - arg0->unkBC = arg0->unkBC | 0x1000; - arg0->unk44 = arg0->unk44 | 0x10; + spD0.unk4 = (s32) D_800E3DBC.unk4; + spD0.unk8 = (s32) D_800E3DBC.unk8; + player->unk_0BC |= 0x1000; + player->unk_044 |= 0x10; sp40 = D_80164510[arg3]; - arg0->unk204 = 0; - arg0->unkBC = arg0->unkBC & ~0x10; - func_8002B830(arg3, arg2); - func_8002CD48(arg0, arg3, arg2); - sp84 = spDC + (0.0f * arg0->unk64); - sp7C = spE4 + (0.0f * arg0->unk6C); - arg0->unk10C = 0; - arg0->unk256 = 0; - arg0->unkBC = arg0->unkBC & 0xFFFF7FFF; - temp_a1 = arg0 + 0x174; - spFC = func_80030150(arg0, arg3); + player->unk_204 = 0; + player->unk_0BC &= ~0x10; + func_8002B830(player, arg3, arg2); + func_8002CD48(player, arg3, arg2); + sp84 = spDC + (0.0f * player->unk_064); + sp7C = spE4 + (0.0f * player->unk_06C); + player->unk_10C = 0; + player->unk_256 = 0; + player->unk_0BC &= 0xFFFF7FFF; + temp_a1 = player->unk_174; + spFC = func_80030150(player, arg3); sp3C = temp_a1; - func_802B63B8(&spF4, temp_a1); + func_802B63B8(&spF4, (f32 (*)[3]) temp_a1); sp6C = 0.0f; - sp68 = arg0->unk34; - sp70 = arg0->unk3C; - temp_f0 = sp68; - temp_f16 = D_800ED898; - temp_f18 = D_800ED8A0; - temp_f2 = sp70; - temp_f8 = temp_f0 + (((spF4 + sp84 + spD0) - (temp_f0 * (temp_f16 * arg0->unkFC))) / temp_f18); + sp68 = player->unk_034[0]; + sp70 = player->unk_034[2]; + temp_f0 = (f64) sp68; + temp_f2 = (f64) sp70; + temp_f8 = (f32) (temp_f0 + (((f64) (spF4 + sp84 + spD0) - (temp_f0 * (0.12 * (f64) player->unk_0FC))) / 6000.0)); sp68 = temp_f8; - temp_f8_2 = temp_f2 + (((spFC + sp7C + spD8) - (temp_f2 * (temp_f16 * arg0->unkFC))) / temp_f18); + temp_f8_2 = (f32) (temp_f2 + (((f64) (spFC + sp7C + spD8) - (temp_f2 * (0.12 * (f64) player->unk_0FC))) / 6000.0)); sp70 = temp_f8_2; - temp_f12 = arg0->unk14; - temp_f14 = arg0->unk1C; - arg0->unk20 = temp_f12; - arg0->unk28 = temp_f14; - arg0->unk24 = sp40; - spCC = arg0->unk34 + temp_f12; - spC4 = arg0->unk3C + temp_f14; - arg0->unkC0 = 0; - arg0->unkF0 = 0.0f; - arg0->unkF4 = 0.0f; - arg0->unkEC = 0.0f; - func_802B6540(sp3C, arg0->unk58, arg0->unk5C, arg0->unk60, arg0->unk2E); - arg0->unkC2 = 0; - temp_t1 = arg0->unkBC & ~2; - arg0->unkBC = temp_t1; - arg0->unkBC = temp_t1 & ~8; - arg0->unkC4 = 0; - arg0->unk206 = 0; - arg0->unk22C = arg0->unk94; - arg0->unk94 = sqrtf((sp70 * sp70) + (temp_f8 * temp_f8)); - arg0->unk14 = spCC; - arg0->unk1C = spC4; - arg0->unk64 = 0.0f; - arg0->unk6C = 0.0f; - arg0->unk18 = sp40; - temp_v0 = &D_80165070[arg3]; - arg0->unk34 = sp68; - arg0->unk38 = sp6C; - arg0->unk3C = sp70; + temp_f12 = player->pos[0]; + temp_f14 = player->pos[2]; + player->rotX = temp_f12; + player->rotZ = temp_f14; + player->rotY = sp40; + spCC = player->unk_034[0] + temp_f12; + spC4 = player->unk_034[2] + temp_f14; + player->unk_0C0 = 0; + player->kartHopJerk = 0.0f; + player->kartHopAcceleration = 0.0f; + player->kartHopVelocity = 0.0f; + func_802B6540(temp_f12, temp_f14, sp3C, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_02E); + player->unk_0C2 = 0; + temp_t1 = player->unk_0BC & ~2; + player->unk_0BC = temp_t1; + player->unk_0BC = temp_t1 & ~8; + player->unk_0C4 = 0; + player->unk_206 = 0; + player->unk_22C = player->unk_094; + player->unk_094 = sqrtf((sp70 * sp70) + (temp_f8 * temp_f8)); + player->pos[0] = spCC; + player->pos[2] = spC4; + player->unk_064 = 0.0f; + player->unk_06C = 0.0f; + player->pos[1] = sp40; + temp_v0 = D_80165070[arg3]; + player->unk_034[0] = sp68; + player->unk_034[1] = sp6C; + player->unk_034[2] = sp70; temp_v0->unk0 = sp68; temp_v0->unk4 = sp6C; temp_v0->unk8 = temp_f8_2; - temp_f2_2 = arg0->unk94; - temp_v1 = (arg0->unk254 * 4) + &gKartTopSpeedTable; + temp_f2_2 = player->unk_094; + temp_v1 = &gKartTopSpeedTable[player->characterId]; temp_f12_2 = *temp_v1; if (temp_f12_2 < temp_f2_2) { temp_f0_2 = temp_f12_2 / temp_f2_2; - arg0->unk34 = arg0->unk34 * temp_f0_2; - arg0->unk38 = arg0->unk38 * temp_f0_2; - arg0->unk3C = arg0->unk3C * temp_f0_2; - arg0->unk94 = *temp_v1; + player->unk_034[0] *= temp_f0_2; + player->unk_034[1] *= temp_f0_2; + player->unk_034[2] *= temp_f0_2; + player->unk_094 = *temp_v1; } } #else @@ -3970,30 +3492,19 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/control_cpu_movement.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80029B4C(void *, f32, f32, f32); // extern -? func_8002A194(void *, f32, f32, f32); // extern -? func_8002AAC0(f64, f32, void *); // extern -? func_8002AE38(void *, s8, f32, f32, f32, f32); // extern -f32 func_80030150(void *, s8); // extern -? func_80037BB4(? *); // extern -? func_8003F46C(void *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -f32 func_802ABE30(f32, f32, f32, u16); // extern -? func_802AD950(void *, s32, f32, f32, f32, f32, f32, f32); // extern -? func_802B63B8(f32 *, f32 *); // extern -extern ? D_800E3DC8; -extern ? D_800E3DD4; -extern ? D_800E3DE0; -extern ? D_800E3DEC; -extern f64 D_800ED8A8; -extern f64 D_800ED8B0; -extern f32 D_800ED8B8; -extern f64 D_800ED8C0; -extern f64 D_800ED8C8; -extern f64 D_800ED8D0; -extern ? gKartTopSpeedTable; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_80029B4C(Player *, f32, f32, f32); /* extern */ +? func_8002A194(Player *, f32, f32, f32); /* extern */ +? func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ +f32 func_80030150(Player *, s8); /* extern */ +? func_80037BB4(? *); /* extern */ +? func_802B6540(f32 *, f32, f32, f32, s32); /* extern */ +static ? D_800E3DC8; /* unable to generate initializer */ +static ? D_800E3DD4; /* unable to generate initializer */ +static ? D_800E3DE0; /* unable to generate initializer */ +static ? D_800E3DEC; /* unable to generate initializer */ -void func_8002F730(void *arg0, ? arg1, ? arg2, s8 arg3) { +void func_8002F730(Player *player, Camera *camera, s8 arg2, s8 arg3) { f32 spFC; f32 spF4; f32 spE8; @@ -4011,128 +3522,120 @@ void func_8002F730(void *arg0, ? arg1, ? arg2, s8 arg3) { f32 sp70; f32 sp6C; f32 sp68; - ? sp5C; + f32 sp5C; f32 *sp4C; f32 sp44; f32 sp34; - f32 (*temp_v0_2)[3]; f32 *temp_a1; + f32 *temp_v0_2; f32 *temp_v0_3; f32 temp_f0_2; f32 temp_f10; - f32 temp_f10_2; f32 temp_f12_2; f32 temp_f14; f32 temp_f2_2; f32 temp_f2_3; f32 temp_f6; f32 temp_f6_2; - f32 temp_f6_3; f32 temp_f8; f64 temp_f0; f64 temp_f12; - f64 temp_f16; - f64 temp_f18; f64 temp_f2; s32 temp_v0; spF4.unk0 = D_800E3DC8.unk0; - spF4.unk4 = D_800E3DC8.unk4; - spF4.unk8 = D_800E3DC8.unk8; + spF4.unk4 = (s32) D_800E3DC8.unk4; + spF4.unk8 = (s32) D_800E3DC8.unk8; spE8.unk0 = D_800E3DD4.unk0; - spE8.unk4 = D_800E3DD4.unk4; - spE8.unk8 = D_800E3DD4.unk8; - spDC.unk0 = D_800E3DE0.unk0; - spDC.unk4 = D_800E3DE0.unk4; - spDC.unk8 = D_800E3DE0.unk8; - spD0.unk0 = D_800E3DEC.unk0; - spD0.unk4 = D_800E3DEC.unk4; - spD0.unk8 = D_800E3DEC.unk8; + spE8.unk4 = (s32) D_800E3DD4.unk4; + spE8.unk8 = (s32) D_800E3DD4.unk8; + spDC.unk0 = (s32) D_800E3DE0.unk0; + spDC.unk4 = (s32) D_800E3DE0.unk4; + spDC.unk8 = (s32) D_800E3DE0.unk8; + spD0.unk0 = (s32) D_800E3DEC.unk0; + spD0.unk4 = (s32) D_800E3DEC.unk4; + spD0.unk8 = (s32) D_800E3DEC.unk8; func_80037BB4(&spD0); - temp_f6 = arg0->unk64 * 0.0f; - sp84 = temp_f6; - temp_f10 = arg0->unk6C * 0.0f; - sp7C = temp_f10; - temp_a1 = arg0 + 0x174; - spFC = func_80030150(arg0, arg3); + sp84 = player->unk_064 * 0.0f; + sp7C = player->unk_06C * 0.0f; + temp_a1 = player->unk_174; + spFC = func_80030150(player, arg3); sp4C = temp_a1; - func_802B63B8(&spF4, temp_a1); - temp_f16 = D_800ED8A8; - sp68 = arg0->unk34; - sp6C = arg0->unk38; - temp_f0 = sp68; - sp70 = arg0->unk3C; - temp_f18 = D_800ED8B0; - temp_f2 = sp70; - sp68 = temp_f0 + (((spF4 + temp_f6) - (temp_f0 * temp_f16)) / temp_f18); - temp_f12 = sp6C; - sp70 = temp_f2 + (((spFC + temp_f10) - (temp_f2 * temp_f16)) / temp_f18); - sp6C = temp_f12 + (((spF8 + D_800ED8B8) - (temp_f12 * temp_f16)) / temp_f18); - temp_f14 = arg0->unk14; + func_802B63B8(&spF4, (f32 (*)[3]) temp_a1); + sp68 = player->unk_034[0]; + sp6C = player->unk_034[1]; + temp_f0 = (f64) sp68; + sp70 = player->unk_034[2]; + temp_f2 = (f64) sp70; + sp68 = (f32) (temp_f0 + (((f64) (spF4 + sp84) - (temp_f0 * 780.0)) / 6500.0)); + temp_f12 = (f64) sp6C; + sp70 = (f32) (temp_f2 + (((f64) (spFC + sp7C) - (temp_f2 * 780.0)) / 6500.0)); + sp6C = (f32) (temp_f12 + (((f64) (spF8 + -1100.0f) - (temp_f12 * 780.0)) / 6500.0)); + temp_f14 = player->pos[0]; spC0 = temp_f14; - temp_f6_2 = arg0->unk18; - sp44 = temp_f6_2; + temp_f6 = player->pos[1]; + sp44 = temp_f6; spBC = sp44; - sp34 = arg0->unk1C; + sp34 = player->pos[2]; spB8 = sp34; - arg0->unk20 = temp_f14; - arg0->unk24 = temp_f6_2; - arg0->unk28 = sp34; - spCC = arg0->unk34 + temp_f14; - temp_f10_2 = arg0->unk38 + sp44; - spC8 = temp_f10_2; - temp_f8 = arg0->unk3C + spB8; + player->rotX = temp_f14; + player->rotY = temp_f6; + player->rotZ = sp34; + spCC = player->unk_034[0] + temp_f14; + temp_f10 = player->unk_034[1] + sp44; + spC8 = temp_f10; + temp_f8 = player->unk_034[2] + spB8; spC4 = temp_f8; - func_8002AAC0(temp_f12, temp_f14, arg0); - temp_f6_3 = temp_f10_2 + arg0->unkEC; - spC8 = temp_f6_3; - func_802AD950(arg0 + 0x110, arg0->unk70, spCC, temp_f6_3, temp_f8, arg0->unk20, arg0->unk24, arg0->unk28); - arg0->unk58 = 0.0f; - arg0->unk60 = 0.0f; - arg0->unk5C = 1.0f; - func_802B6540(sp4C, 0.0f, 1.0f, 0.0f, arg0->unk2E); - arg0->unkBC = arg0->unkBC & ~8; - sp78 = arg0->unk124; + func_8002AAC0(player); + temp_f6_2 = temp_f10 + player->kartHopVelocity; + spC8 = temp_f6_2; + func_802AD950(&player->unk_110, player->boundingBoxSize, spCC, temp_f6_2, temp_f8, player->rotX, player->rotY, player->rotZ); + player->unk_058 = 0.0f; + player->unk_060 = 0.0f; + player->unk_05C = 1.0f; + func_802B6540(sp4C, 0.0f, 1.0f, 0.0f, (s32) player->unk_02E); + player->unk_0BC &= ~8; + sp78 = player->unk_110.unk44; if (sp78 <= 0.0f) { - func_8003F46C(arg0, &sp5C, &sp68, &spE8, &sp78, &spCC, &spC8, &spC4); + func_8003F46C(player, &sp5C, &sp68, &spE8, &sp78, &spCC, &spC8, &spC4); } - arg0->unk74 = func_802ABE30(spCC, spC8, spC4, arg0->unk11A); - if (((arg0->unk0 & 0x4000) == 0x4000) && ((temp_v0 = gActiveScreenMode, (temp_v0 == 0)) || (temp_v0 == 2) || (temp_v0 == 1))) { - func_80029B4C(arg0, spCC, spC8, spC4); + player->unk_074 = func_802ABE30(spCC, spC8, spC4, player->unk_110.unk3A); + if (((player->unk_000 & 0x4000) == 0x4000) && ((temp_v0 = gActiveScreenMode, (temp_v0 == 0)) || (temp_v0 == 2) || (temp_v0 == 1))) { + func_80029B4C(player, spCC, spC8, spC4); } else { - func_8002A194(arg0, spCC, spC8, spC4); + func_8002A194(player, spCC, spC8, spC4); } - func_8002AE38(arg0, arg3, spC0, spB8, spCC, spC4); - arg0->unk22C = arg0->unk94; - temp_f2_2 = arg0->unk8C; - arg0->unk94 = sqrtf((sp70 * sp70) + ((sp68 * sp68) + (sp6C * sp6C))); - if (((temp_f2_2 <= 0.0f) && (arg0->unk94 < D_800ED8C0)) || ((temp_f2_2 <= 0.0f) && (arg0->unk94 < D_800ED8C8) && ((arg0->unkBC & 1) == 1))) { + func_8002AE38(player, arg3, spC0, spB8, spCC, spC4); + player->unk_22C = player->unk_094; + temp_f2_2 = player->unk_08C; + player->unk_094 = sqrtf((sp70 * sp70) + ((sp68 * sp68) + (sp6C * sp6C))); + if (((temp_f2_2 <= 0.0f) && ((f64) player->unk_094 < 0.13)) || ((temp_f2_2 <= 0.0f) && ((f64) player->unk_094 < 0.2) && ((player->unk_0BC & 1) == 1))) { sp68 += sp68 * -1.0f; sp70 += sp70 * -1.0f; } else { - arg0->unk14 = spCC; - arg0->unk1C = spC4; + player->pos[0] = spCC; + player->pos[2] = spC4; } - arg0->unk18 = spC8 - D_800ED8D0; - arg0->unk64 = spE8; - arg0->unk6C = spF0; - arg0->unk34 = sp68; - arg0->unk38 = sp6C; - arg0->unk3C = sp70; - temp_v0_2 = &D_80165070[arg3]; + player->pos[1] = (f32) ((f64) spC8 - 0.018); + player->unk_064 = spE8; + player->unk_06C = spF0; + player->unk_034[0] = sp68; + player->unk_034[1] = sp6C; + player->unk_034[2] = sp70; + temp_v0_2 = D_80165070[arg3]; temp_v0_2->unk0 = sp68; temp_v0_2->unk4 = sp6C; temp_v0_2->unk8 = sp70; - if ((arg0->unk0 & 0x4000) == 0x4000) { - temp_f2_3 = arg0->unk94; - temp_v0_3 = (arg0->unk254 * 4) + &gKartTopSpeedTable; + if ((player->unk_000 & 0x4000) == 0x4000) { + temp_f2_3 = player->unk_094; + temp_v0_3 = &gKartTopSpeedTable[player->characterId]; temp_f12_2 = *temp_v0_3; if (temp_f12_2 < temp_f2_3) { temp_f0_2 = temp_f12_2 / temp_f2_3; - arg0->unk34 = arg0->unk34 * temp_f0_2; - arg0->unk38 = arg0->unk38 * temp_f0_2; - arg0->unk3C = arg0->unk3C * temp_f0_2; - arg0->unk94 = *temp_v0_3; + player->unk_034[0] *= temp_f0_2; + player->unk_034[1] *= temp_f0_2; + player->unk_034[2] *= temp_f0_2; + player->unk_094 = *temp_v0_3; } } } @@ -6690,297 +6193,198 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80036DB4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_802B63B8(f32, f32, void *, void *, void *); // extern -extern f64 D_800EDDC8; -extern f64 D_800EDDD0; -extern f64 D_800EDDD8; -extern f64 D_800EDDE0; -extern f64 D_800EDDE8; -extern f64 D_800EDDF0; -extern f64 D_800EDDF8; - -void func_800371F4(void *arg0, void *arg1, void *arg2) { +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +void func_800371F4(Player *player, f32 *arg1, f32 *arg2) { f32 sp20; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f12; - f32 temp_f12_2; - f32 temp_f14; - f32 temp_f14_2; - f32 temp_f14_3; - f32 temp_f14_4; - f32 temp_f14_5; - f32 temp_f2; - f32 temp_f2_2; - f32 temp_f2_3; - f32 temp_f2_4; - f32 temp_f2_5; - s16 temp_v0; + f32 var_f14; + f32 var_f18; + f32 var_f2; + s16 var_v0; s32 temp_a0; s32 temp_t0; s32 temp_t6; - s32 phi_v0; - f32 phi_f18; - f32 phi_f12; - f32 phi_f14; - f32 phi_f0; - f32 phi_f2; - temp_t0 = arg0->unkBC; + temp_t0 = player->unk_0BC; if (((temp_t0 & 0x1000) == 0x1000) || ((temp_t0 & 0x20) == 0x20)) { arg1->unk0 = 0.0f; arg1->unk4 = 0.0f; arg1->unk8 = 0.0f; - func_802B63B8((bitwise f32) arg1, (bitwise f32) (arg0 + 0x174), arg0); + func_802B63B8(arg1, (f32 (*)[3]) player->unk_174); } else { temp_a0 = temp_t0 & 0x10; if ((temp_a0 == 0x10) && ((temp_t0 & 2) != 2)) { - temp_f12 = arg0->unk94; - temp_f0 = arg0->unk208; - temp_f2 = -(temp_f12 / 18.0f) * 216.0f; - temp_f14 = -arg0->unk20C * 50.0f; - sp20 = arg0->unk84 * 3.0f; - phi_f12 = temp_f12; - phi_f14 = temp_f14; - phi_f18 = temp_f0 + (temp_f2 * 3.0f) + temp_f14; - phi_f0 = temp_f0; - phi_f2 = temp_f2; - } else if (((temp_t0 & 0x800) == 0) && ((arg0->unk44 & 0x4000) == 0)) { - temp_v0 = arg0->unkFA; - phi_v0 = temp_v0; - if (temp_v0 > 0) { - phi_v0 = temp_v0 * -1; + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f14 = -player->unk_20C * 50.0f; + var_f18 = player->unk_208 + (var_f2 * 3.0f) + var_f14; + sp20 = player->unk_084 * 3.0f; + } else if (!(temp_t0 & 0x800) && !(player->unk_044 & 0x4000)) { + var_v0 = player->unk_0FA; + if (var_v0 > 0) { + var_v0 *= -1; } - temp_t6 = arg0->unk7C >> 0x10; + temp_t6 = (s32) player->unk_07C >> 0x10; if ((temp_t6 < 0x15) && (temp_t6 >= -0x14)) { - if (phi_v0 < 0x14) { - temp_f2_2 = -(arg0->unk94 / 18.0f) * 216.0f; - temp_f14_2 = -arg0->unk20C * 50.0f; - phi_f14 = temp_f14_2; - phi_f18 = (arg0->unk208 + (temp_f2_2 / 3.0f)) + (-arg0->unk9C * D_800EDDC8) + temp_f14_2; - phi_f2 = temp_f2_2; + if (var_v0 < 0x14) { + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f14 = -player->unk_20C * 50.0f; + var_f18 = (f32) ((f64) (player->unk_208 + (var_f2 / 3.0f)) + ((f64) -player->unk_09C * 0.02) + (f64) var_f14); } else { - temp_f2_3 = -(arg0->unk94 / 18.0f) * 216.0f; - temp_f14_3 = -arg0->unk20C * 50.0f; - phi_f14 = temp_f14_3; - phi_f18 = ((arg0->unk208 + (temp_f2_3 / 3.0f)) - ((temp_t6 * D_800EDDD0) + (arg0->unk9C * D_800EDDD8))) + temp_f14_3; - phi_f2 = temp_f2_3; + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f14 = -player->unk_20C * 50.0f; + var_f18 = (f32) (((f64) (player->unk_208 + (var_f2 / 3.0f)) - (((f64) temp_t6 * 0.01) + ((f64) player->unk_09C * 0.05))) + (f64) var_f14); } } else { - temp_f2_4 = -(arg0->unk94 / 18.0f) * 216.0f; - temp_f14_4 = -arg0->unk20C * 50.0f; - phi_f14 = temp_f14_4; - phi_f18 = ((arg0->unk208 + (temp_f2_4 / 3.0f)) - ((temp_t6 * D_800EDDE0) + (arg0->unk9C * D_800EDDE8))) + temp_f14_4; - phi_f2 = temp_f2_4; + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f14 = -player->unk_20C * 50.0f; + var_f18 = (f32) (((f64) (player->unk_208 + (var_f2 / 3.0f)) - (((f64) temp_t6 * 0.1) + ((f64) player->unk_09C * 0.15))) + (f64) var_f14); } - sp20 = arg0->unk84; - phi_f12 = arg0->unk94; - phi_f0 = arg0->unk208; + sp20 = player->unk_084; } else { - temp_f12_2 = arg0->unk94; - temp_f0_2 = arg0->unk208; - temp_f2_5 = -(temp_f12_2 / 18.0f) * 216.0f; - temp_f14_5 = -arg0->unk20C * 50.0f; - sp20 = arg0->unk84; - phi_f12 = temp_f12_2; - phi_f14 = temp_f14_5; - phi_f18 = ((temp_f0_2 + (temp_f2_5 * 1.5)) - (((arg0->unk7C >> 0x10) * D_800EDDF0) + (arg0->unk9C * D_800EDDF8))) + temp_f14_5; - phi_f0 = temp_f0_2; - phi_f2 = temp_f2_5; + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f14 = -player->unk_20C * 50.0f; + sp20 = player->unk_084; + var_f18 = (f32) ((((f64) player->unk_208 + ((f64) var_f2 * 1.5)) - (((f64) ((s32) player->unk_07C >> 0x10) * 0.1) + ((f64) player->unk_09C * 0.05))) + (f64) var_f14); } if ((temp_t0 & 0x200) == 0x200) { if ((temp_a0 == 0x10) && ((temp_t0 & 2) != 2)) { - sp20 = arg0->unk84 * 3.0f; - phi_f18 = phi_f0 + (phi_f2 * 3.0f) + phi_f14; + var_f18 = player->unk_208 + (var_f2 * 3.0f) + var_f14; + sp20 = player->unk_084 * 3.0f; } else { - sp20 = arg0->unk84; - phi_f18 = phi_f0 + (phi_f2 / 3.0f); + sp20 = player->unk_084; + var_f18 = player->unk_208 + (var_f2 / 3.0f); } } arg1->unk4 = 0.0f; - arg1->unk0 = -(arg0->unk90 + phi_f18) * phi_f12; - arg1->unk8 = arg0->unk94 * sp20; - func_802B63B8(phi_f12, phi_f14, arg1, arg0 + 0x174, arg0); + arg1->unk0 = -(player->unk_090 + var_f18) * player->unk_094; + arg1->unk8 = (f32) (player->unk_094 * sp20); + func_802B63B8(arg1, (f32 (*)[3]) player->unk_174); } arg2->unk0 = arg1->unk0; - arg2->unk4 = arg1->unk4; - arg2->unk8 = arg1->unk8; + arg2->unk4 = (f32) arg1->unk4; + arg2->unk8 = (f32) arg1->unk8; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800371F4.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_802B63B8(f32, void *, void *, void *, void *); // extern +void func_80037614(Player *player, Vec3f arg1, Vec3f arg2) { + f32 var_f12; + f32 var_f2; -void func_80037614(void *arg0, void *arg1, void *arg2) { - s32 temp_v0; - void *temp_a0; - void *temp_a3; - f32 phi_f2; - f32 phi_f12; - - temp_v0 = arg0->unkBC; - temp_a3 = arg1; - if (((temp_v0 & 0x1000) == 0x1000) || ((temp_v0 & 0x20) == 0x20)) { - temp_a3->unk0 = 0.0f; - temp_a3->unk4 = 0.0f; - temp_a3->unk8 = 0.0f; - arg1 = temp_a3; - func_802B63B8(0.0f, temp_a3, arg0 + 0x174, temp_a3); + if (((player->unk_0BC & 0x1000) == 0x1000) || ((player->unk_0BC & 0x20) == 0x20)) { + arg1[0] = 0.0f; + arg1[1] = 0.0f; + arg1[2] = 0.0f; + func_802B63B8(arg1, player->unk_174); } else { - if (((temp_v0 & 0x10) == 0x10) && ((temp_v0 & 2) != 2)) { - phi_f2 = (-(arg0->unk94 / 18.0f) * 216.0f * 2.0f) + -80.0f; - phi_f12 = -80.0f; + if (((player->unk_0BC & 0x10) == 0x10) && ((player->unk_0BC & 2) != 2)) { + var_f2 = ((-(player->unk_094 / 18.0f) * 216.0f) * 2) + -80.0f; + var_f12 = -80.0f; } else { - phi_f2 = ((-(arg0->unk94 / 18.0f) * 216.0f) / 2.0f) + -20.0f; - phi_f12 = -40.0f; + var_f2 = ((-(player->unk_094 / 18.0f) * 216.0f) / 2) + -20.0f; + var_f12 = -40.0f; } - temp_a0 = temp_a3; - temp_a3->unk4 = NULL; - temp_a3->unk0 = (phi_f2 + 28.0f) * arg0->unk94; - temp_a3->unk8 = arg0->unk94 * phi_f12; - arg1 = temp_a3; - func_802B63B8(phi_f12, NULL, temp_a0, arg0 + 0x174, temp_a3); + arg1[0] = (var_f2 + 28.0f) * player->unk_094; + arg1[1] = 0.0f; + arg1[2] = var_f12 * player->unk_094; + func_802B63B8(arg1, player->unk_174); } - *arg2 = arg1->unk0; - arg2->unk4 = arg1->unk4; - arg2->unk8 = arg1->unk8; + arg2[0] = arg1[0]; + arg2[1] = arg1[1]; + arg2[2] = arg1[2]; } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80037614.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_802B63B8(f32, void *, void *, void *, void *); // extern +void func_8003777C(Player *player, Vec3f arg1, Vec3f arg2) { + f32 var_f12; + f32 var_f2; -void func_8003777C(void *arg0, void *arg1, void *arg2) { - s32 temp_v0; - void *temp_a0; - void *temp_a3; - f32 phi_f2; - f32 phi_f12; - - temp_v0 = arg0->unkBC; - temp_a3 = arg1; - if (((temp_v0 & 0x1000) == 0x1000) || ((temp_v0 & 0x20) == 0x20)) { - temp_a3->unk0 = 0.0f; - temp_a3->unk4 = 0.0f; - temp_a3->unk8 = 0.0f; - arg1 = temp_a3; - func_802B63B8(0.0f, temp_a3, arg0 + 0x174, temp_a3); + if (((player->unk_0BC & 0x1000) == 0x1000) || ((player->unk_0BC & 0x20) == 0x20)) { + arg1[0] = 0.0f; + arg1[1] = 0.0f; + arg1[2] = 0.0f; + func_802B63B8(arg1, player->unk_174); } else { - if (((temp_v0 & 0x10) == 0x10) && ((temp_v0 & 2) != 2)) { - phi_f2 = (-(arg0->unk94 / 18.0f) * 216.0f * 2.0f) + -80.0f; - phi_f12 = -80.0f; + if (((player->unk_0BC & 0x10) == 0x10) && ((player->unk_0BC & 2) != 2)) { + var_f2 = ((-(player->unk_094 / 18.0f) * 216.0f) * 2) + -80.0f; + var_f12 = -80.0f; } else { - phi_f2 = ((-(arg0->unk94 / 18.0f) * 216.0f) / 2.0f) + -20.0f; - phi_f12 = -40.0f; + var_f2 = ((-(player->unk_094 / 18.0f) * 216.0f) / 2) + -20.0f; + var_f12 = -40.0f; } - temp_a0 = temp_a3; - temp_a3->unk4 = NULL; - temp_a3->unk0 = -(phi_f2 + 28.0f) * arg0->unk94; - temp_a3->unk8 = arg0->unk94 * phi_f12; - arg1 = temp_a3; - func_802B63B8(phi_f12, NULL, temp_a0, arg0 + 0x174, temp_a3); + arg1[0] = -(var_f2 + 28.0f) * player->unk_094; + arg1[1] = 0.0f; + arg1[2] = var_f12 * player->unk_094; + func_802B63B8(arg1, player->unk_174); } - *arg2 = arg1->unk0; - arg2->unk4 = arg1->unk4; - arg2->unk8 = arg1->unk8; + arg2[0] = arg1[0]; + arg2[1] = arg1[1]; + arg2[2] = arg1[2]; } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8003777C.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_802B63B8(f32, void *, void *, void *, void *); // extern +void func_800378E8(Player *player, Vec3f arg1, Vec3f arg2) { + f32 var_f12; + f32 var_f2; -void func_800378E8(void *arg0, void *arg1, void *arg2) { - s32 temp_v0; - f32 phi_f2; - f32 phi_f12; - - temp_v0 = arg0->unkBC; - if ((temp_v0 & 0x20) == 0x20) { - arg1->unk0 = 0.0f; - arg1->unk4 = 0.0f; - arg1->unk8 = 0.0f; - func_802B63B8(0.0f, arg1, arg0 + 0x174, arg0); + if ((player->unk_0BC & 0x20) == 0x20) { + arg1[0] = 0.0f; + arg1[1] = 0.0f; + arg1[2] = 0.0f; + func_802B63B8(arg1, player->unk_174); } else { - if ((temp_v0 & 0x10) == 0x10) { - phi_f2 = arg0->unk208 + (-(arg0->unk94 / 18.0f) * 216.0f * 5.0f) + (-arg0->unk20C * 10.0f); - phi_f12 = -100.0f; + if ((player->unk_0BC & 0x10) == 0x10) { + var_f2 = player->unk_208 + (-(player->unk_094 / 18.0f) * 216.0f * 5.0f) + (-player->unk_20C * 10.0f); + var_f12 = -100.0f; } else { - phi_f2 = arg0->unk208 + ((-(arg0->unk94 / 18.0f) * 216.0f) / 40.0f) + (-arg0->unk20C * 50.0f); - phi_f12 = arg0->unk84; + var_f2 = player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 40.0f) + (-player->unk_20C * 50.0f); + var_f12 = player->unk_084; } - arg1->unk4 = 0.0f; - arg1->unk0 = (arg0->unk90 + phi_f2) * arg0->unk94; - arg1->unk8 = arg0->unk94 * phi_f12; - func_802B63B8(phi_f12, (bitwise void *) 0.0f, arg1, arg0 + 0x174, arg0); + arg1[0] = (player->unk_090 + var_f2) * player->unk_094; + arg1[1] = 0.0f; + arg1[2] = player->unk_094 * var_f12; + func_802B63B8(arg1, player->unk_174); } - arg2->unk0 = arg1->unk0; - arg2->unk4 = arg1->unk4; - arg2->unk8 = arg1->unk8; + arg2[0] = arg1[0]; + arg2[1] = arg1[1]; + arg2[2] = arg1[2]; } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800378E8.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_802B63B8(f32, void *, void *, void *, void *); // extern +void func_80037A4C(Player *player, Vec3f arg1, Vec3f arg2) { + f32 var_f12; + f32 var_f2; -void func_80037A4C(void *arg0, void *arg1, void *arg2) { - s32 temp_v0; - f32 phi_f2; - f32 phi_f12; - - temp_v0 = arg0->unkBC; - if ((temp_v0 & 0x20) == 0x20) { - arg1->unk0 = 0.0f; - arg1->unk4 = 0.0f; - arg1->unk8 = 0.0f; - func_802B63B8(0.0f, arg1, arg0 + 0x174, arg0); + if ((player->unk_0BC & 0x20) == 0x20) { + arg1[0] = 0.0f; + arg1[1] = 0.0f; + arg1[2] = 0.0f; + func_802B63B8(arg1, player->unk_174); } else { - if ((temp_v0 & 0x10) == 0x10) { - phi_f2 = arg0->unk208 + (-(arg0->unk94 / 18.0f) * 216.0f * 5.0f) + (-arg0->unk20C * 50.0f); - phi_f12 = -100.0f; + if ((player->unk_0BC & 0x10) == 0x10) { + var_f2 = player->unk_208 + (-(player->unk_094 / 18.0f) * 216.0f * 5.0f) + (-player->unk_20C * 50.0f); + var_f12 = -100.0f; } else { - phi_f2 = arg0->unk208 + ((-(arg0->unk94 / 18.0f) * 216.0f) / 40.0f) + (-arg0->unk20C * 50.0f); - phi_f12 = arg0->unk84; + var_f2 = player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 40.0f) + (-player->unk_20C * 50.0f); + var_f12 = player->unk_084; } - arg1->unk4 = 0.0f; - arg1->unk0 = -(arg0->unk90 + phi_f2) * arg0->unk94; - arg1->unk8 = arg0->unk94 * phi_f12; - func_802B63B8(phi_f12, (bitwise void *) 0.0f, arg1, arg0 + 0x174, arg0); + arg1[0] = -(player->unk_090 + var_f2) * player->unk_094; + arg1[1] = 0.0f; + arg1[2] = player->unk_094 * var_f12; + func_802B63B8(arg1, player->unk_174); } - arg2->unk0 = arg1->unk0; - arg2->unk4 = arg1->unk4; - arg2->unk8 = arg1->unk8; + arg2[0] = arg1[0]; + arg2[1] = arg1[1]; + arg2[2] = arg1[2]; } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80037A4C.s") -#endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80036DB4(? *, void *); // extern -? func_800371F4(? *, void *); // extern -? func_80037614(? *, void *); // extern -? func_8003777C(? *, void *); // extern -? func_800378E8(? *, void *); // extern -? func_80037A4C(? *, void *); // extern +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_80036DB4(f32 *, f32 *); /* extern */ +? func_800371F4(f32 *, f32 *); /* extern */ -void func_80037BB4(void *arg0, void *arg1) { - ? sp20; +void func_80037BB4(Player *player, f32 *arg1) { + f32 sp20; s16 temp_v0; - temp_v0 = arg0->unk78; + temp_v0 = player->unk_078; if (temp_v0 == 0) { arg1->unk0 = 0.0f; arg1->unk4 = 0.0f; @@ -6988,44 +6392,41 @@ void func_80037BB4(void *arg0, void *arg1) { return; } if (temp_v0 < 0) { - if (((arg0->unkBC & 0x20000000) != 0x20000000) || (arg0->unk228 >= 0x64)) { - arg0->unk2E = arg0->unk2E + temp_v0; + if (((player->unk_0BC & 0x20000000) != 0x20000000) || (player->unk_228 >= 0x64)) { + player->unk_02E += temp_v0; } - if ((arg0->unk0 & 0x1000) == 0) { - if (gModeSelection == BATTLE) { - func_800378E8(&sp20, arg1); + if (!(player->unk_000 & 0x1000)) { + if (gModeSelection == 3) { + func_800378E8(player, &sp20, arg1); return; } func_80036DB4(&sp20, arg1); return; } - func_80037614(&sp20, arg1); + func_80037614(player, &sp20, arg1); return; } - if (((arg0->unkBC & 0x20000000) != 0x20000000) || (arg0->unk228 >= 0x64)) { - arg0->unk2E = arg0->unk2E + temp_v0; + if (((player->unk_0BC & 0x20000000) != 0x20000000) || (player->unk_228 >= 0x64)) { + player->unk_02E += temp_v0; } - if ((arg0->unk0 & 0x1000) == 0) { - if (gModeSelection == BATTLE) { - func_80037A4C(&sp20, arg1); + if (!(player->unk_000 & 0x1000)) { + if (gModeSelection == 3) { + func_80037A4C(player, &sp20, arg1); return; } func_800371F4(&sp20, arg1); return; } - func_8003777C(&sp20, arg1); + func_8003777C(player, &sp20, arg1); } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80037BB4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf -? func_8002AA50(Player *, s32, s32); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc ? 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 */ @@ -7033,123 +6434,113 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80037BB4.s") ? 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(Player *arg0, struct Controller *arg1, u8 arg2) { - s16 temp_v0_5; +void func_80037CFC(Player *player, struct Controller *controller, u8 arg2) { + s16 temp_v0_4; s32 temp_t0; s32 temp_t4; - s32 temp_v0; + s32 temp_v0_2; s32 temp_v0_3; - s32 temp_v0_4; - s32 temp_v1; - u16 temp_v0_2; + s32 var_v0; + s32 var_v0_2; + s32 var_v1; + u16 temp_v0; + u16 temp_v1; u16 temp_v1_2; - u16 temp_v1_3; - s32 phi_v0; - s32 phi_v1; - s32 phi_v0_2; - s32 phi_a2; - s32 phi_a3; - 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 & 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); + var_v0 = player->unk_0BC; + var_v1 = var_v0 & 0x80; + if ((var_v1 != 0x80) && ((var_v0 & 0x40) != 0x40) && ((var_v0 & 0x400) != 0x400) && ((var_v0 & 0x4000) != 0x4000) && ((var_v0 & 0x01000000) != 0x01000000) && ((var_v0 & 0x02000000) != 0x02000000) && ((var_v0 & 0x10000) != 0x10000) && ((var_v0 & 0x20000) != 0x20000)) { + if (((var_v0 & 0x04000000) != 0x04000000) && ((var_v0 & 8) != 8) && ((var_v0 & 2) != 2) && ((var_v0 & 0x10) != 0x10) && (controller->buttonPressed & 0x10)) { + func_8002AA50(player); + temp_v0 = player->unk_000; + if (((temp_v0 & 0x4000) == 0x4000) && ((temp_v0 & 0x100) != 0x100)) { + func_800C9060(arg2, 0x19008000U); } } - temp_v0_3 = arg0->unk_0BC; - if ((temp_v0_3 & 8) != 8) { - func_80033AE0(arg0, arg1, (s8) arg2); - } else if (((temp_v0_3 & 2) == 2) && (arg0->unk_124 <= 5.0f)) { - func_80033AE0(arg0, arg1, (s8) arg2); + temp_v0_2 = player->unk_0BC; + if ((temp_v0_2 & 8) != 8) { + func_80033AE0(player, controller, (s8) arg2); + } else if (((temp_v0_2 & 2) == 2) && (player->unk_110.unk44 <= 5.0f)) { + func_80033AE0(player, controller, (s8) arg2); } - 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->unk_094 / 18.0f) * 216.0f) <= 12.0f) { - temp_v1_2 = arg1->button; - if ((temp_v1_2 & 0x8000) != 0) { + temp_t4 = player->unk_0BC & ~1; + player->unk_0BC = temp_t4; + var_v0_2 = temp_t4; + if (((temp_t4 << 0xB) >= 0) && !(temp_t4 & 4)) { + if (((player->unk_094 / 18.0f) * 216.0f) <= 12.0f) { + temp_v1 = controller->button; + if (temp_v1 & 0x8000) { temp_t0 = temp_t4 | 0x20; - if ((temp_v1_2 & 0x4000) != 0) { - arg0->unk_0BC = temp_t0; - phi_v0 = temp_t0; + if (temp_v1 & 0x4000) { + player->unk_0BC = temp_t0; + var_v0_2 = temp_t0; if ((temp_t0 & 0x20) != 0x20) { - arg0->unk_09C += 100.0f; - phi_v0 = temp_t0; + var_v0_2 = temp_t0; + player->unk_09C += 100.0f; } } } } - 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 (((var_v0_2 & 0x20) == 0x20) && ((temp_v1_2 = controller->button, ((temp_v1_2 & 0x4000) == 0)) || !(temp_v1_2 & 0x8000))) { + player->unk_0BC = var_v0_2 & ~0x20; } } - if ((arg0->unk_044 & 1) != 1) { - if ((arg1->button & 0x8000) != 0) { - func_80030FC8(arg0); - func_80030E00(arg0); + if ((player->unk_044 & 1) != 1) { + if (controller->button & 0x8000) { + func_80030FC8(player); + func_80030E00(player); } else { if (gModeSelection == 3) { - func_80031F48(arg0, 0x40000000); + func_80031F48(player, 2.0f); } else { - func_80031F48(arg0, 0x3F800000); + func_80031F48(player, 1.0f); } - func_80030C34(arg0); + func_80030C34(player); } - if ((arg1->button & 0x4000) != 0) { - func_800323E4(arg0); - func_8003221C(arg0); + if (controller->button & 0x4000) { + func_800323E4(player); + func_8003221C(player); } else { - arg0->unk_20C = 0.0f; - func_80032050(arg0); + player->unk_20C = 0.0f; + func_80032050(player); } } - temp_v0_4 = arg0->unk_0BC; - if (((temp_v0_4 << 0xB) >= 0) && ((temp_v0_4 & 4) == 0)) { - 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; + temp_v0_3 = player->unk_0BC; + if (((temp_v0_3 << 0xB) >= 0) && !(temp_v0_3 & 4)) { + if ((func_800388B0(controller) < -0x31) && (((player->unk_094 / 18.0f) * 216.0f) <= 5.0f) && (controller->button & 0x4000)) { + player->unk_09C = 140.0f; + player->unk_044 |= 1; + player->unk_20C = 0.0f; + player->unk_08C = (140.0f * 140.0f) / 25.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; + if ((func_800388B0(controller) >= -0x1D) || !(controller->button & 0x4000)) { + temp_v0_4 = player->unk_044; + if ((temp_v0_4 & 1) == 1) { + player->unk_044 = temp_v0_4 & 0xFFFE; + player->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); + if ((var_v0 & 0x4000) == 0x4000) { + if (controller->button & 0x8000) { + func_80030FC8(player); + var_v0 = player->unk_0BC; } else { - func_80031F48(arg0, 0x40A00000, 0x01000000, 0x02000000); + func_80031F48(player, 5.0f); + var_v0 = player->unk_0BC; } - phi_v1 = arg0->unk_0BC & 0x80; - phi_v0_2 = arg0->unk_0BC; - phi_a2 = 0x01000000; - phi_a3 = 0x02000000; + var_v1 = var_v0 & 0x80; } - 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); + if ((var_v1 == 0x80) || ((var_v0 & 0x40) == 0x40) || ((var_v0 & 0x01000000) == 0x01000000) || ((var_v0 & 0x02000000) == 0x02000000)) { + if (controller->button & 0x8000) { + func_80030E00(player); + func_800332E8(player, (s8) arg2); return; } - func_80030C34(arg0); - func_800337CC(arg0, 0x40A00000, (s8) arg2); + func_80030C34(player); + func_800337CC(player, 0x40A00000, (s8) arg2); } } } @@ -7158,50 +6549,47 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80037CFC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc ? 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(Player *arg0, struct Controller *arg1, s8 arg2) { +void func_800381AC(Player *player, struct Controller *controller, u8 arg2) { s16 temp_v0_2; s32 *temp_v0_3; u16 temp_v0; - temp_v0 = arg0->unk_000; + temp_v0 = player->unk_000; if (((temp_v0 & 0x8000) == 0x8000) && ((temp_v0 & 0x4000) == 0x4000) && ((temp_v0 & 0x1000) != 0x1000)) { if ((temp_v0 & 0x2000) != 0x2000) { - temp_v0_2 = arg0->unk_0CA; + temp_v0_2 = player->unk_0CA; if (((temp_v0_2 & 2) == 2) || ((temp_v0_2 & 8) == 8)) { - if ((arg1->button & 0x8000) != 0) { - func_80032D94(arg2); + if (controller->button & 0x8000) { + func_80032D94(player); } else { - func_80033280(0x40A00000, arg2); + func_80033280(player, 5.0f); } } else { - func_80037CFC(arg2); + func_80037CFC((s8) arg2); } D_80164A89 = 1; return; } if (D_8018D168 == 1) { - if (D_801656F0 == 1) { - temp_v0_3 = &D_801652E0[arg2]; + if (D_801656F0 == (s16) 1) { + temp_v0_3 = &D_801652E0[(s8) arg2]; if (*temp_v0_3 == 0) { *temp_v0_3 = gRaceFrameCounter; } } - if ((arg1->button & 0x8000) != 0) { - func_80032700(arg2); + if (controller->button & 0x8000) { + func_80032700((s8) arg2); return; } - func_80032CB0(0x40A00000, arg2); + func_80032CB0(player, 5.0f); } } } @@ -7296,162 +6684,124 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800382DC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s16 func_80038534(void *arg0) { +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +s16 func_80038534(struct Controller *controller) { s16 temp_a2; + s16 temp_t5; + s16 temp_t6; + s16 temp_t8; s16 temp_v0; - s32 phi_a3; - s32 phi_t0; - s32 phi_t0_2; - s32 phi_v1; - s32 phi_v1_2; - s32 phi_a1; - s32 phi_a1_2; - s16 phi_v1_3; - s32 phi_t0_3; - s16 phi_a3_2; - s32 phi_a1_3; - s16 phi_v1_4; - s16 phi_a3_3; - s32 phi_a1_4; - s16 phi_v1_5; - s16 phi_a3_4; - s32 phi_t0_4; + s16 var_a1; + s16 var_a3; + s16 var_t0; + s16 var_v1; - temp_v0 = arg0->unk0; - temp_a2 = arg0->unk2; - phi_a3 = temp_v0; - phi_t0_3 = temp_a2; + temp_v0 = controller->rawStickX; + temp_a2 = controller->rawStickY; + var_a3 = temp_v0; + var_t0 = temp_a2; if (temp_v0 >= 0xD) { - phi_a3 = 0xC; - phi_t0_3 = (temp_a2 * 0xC) / temp_v0; + var_a3 = 0x000C; + var_t0 = (s16) ((s32) (temp_a2 * 0x000C) / temp_v0); } - phi_t0 = phi_t0_3; - phi_a3_4 = phi_a3; - if (phi_a3 < -0xC) { - phi_t0 = (phi_t0_3 * 0xC) / -phi_a3; - phi_a3_4 = -0xC; + if (var_a3 < -0xC) { + temp_t6 = -var_a3; + var_a3 = -0x000C; + var_t0 = (s16) ((s32) (var_t0 * 0x000C) / temp_t6); } - phi_t0_2 = phi_t0; - phi_a3_3 = phi_a3_4; - if (phi_t0 >= 0xD) { - phi_t0_2 = 0xC; - phi_a3_3 = (phi_a3_4 * 0xC) / phi_t0; + if (var_t0 >= 0xD) { + var_a3 = (s16) ((s32) (var_a3 * 0x000C) / var_t0); + var_t0 = 0x000C; } - phi_a3_2 = phi_a3_3; - phi_t0_4 = phi_t0_2; - if (phi_t0_2 < -0xC) { - phi_a3_2 = (phi_a3_3 * 0xC) / -phi_t0_2; - phi_t0_4 = -0xC; + if (var_t0 < -0xC) { + temp_t5 = -var_t0; + var_t0 = -0x000C; + var_a3 = (s16) ((s32) (var_a3 * 0x000C) / temp_t5); } if ((temp_v0 >= -0xC) && (temp_v0 < 0xD) && (temp_a2 >= -0xC) && (temp_a2 < 0xD)) { - phi_v1 = 0; - phi_a1_4 = 0; + var_v1 = 0; + var_a1 = 0; } else { - phi_v1 = temp_v0 - phi_a3_2; - phi_a1_4 = temp_a2 - phi_t0_4; + var_v1 = temp_v0 - var_a3; + var_a1 = temp_a2 - var_t0; } - phi_v1_2 = phi_v1; - phi_a1_3 = phi_a1_4; - if (phi_v1 >= 0x36) { - phi_v1_2 = 0x35; - phi_a1_3 = (phi_a1_4 * 0x35) / phi_v1; + if (var_v1 >= 0x36) { + var_a1 = (s16) ((s32) (var_a1 * 0x0035) / var_v1); + var_v1 = 0x0035; } - phi_a1 = phi_a1_3; - phi_v1_5 = phi_v1_2; - if (phi_v1_2 < -0x35) { - phi_a1 = (phi_a1_3 * 0x35) / -phi_v1_2; - phi_v1_5 = -0x35; + if (var_v1 < -0x35) { + temp_t8 = -var_v1; + var_v1 = -0x0035; + var_a1 = (s16) ((s32) (var_a1 * 0x0035) / temp_t8); } - phi_a1_2 = phi_a1; - phi_v1_4 = phi_v1_5; - if (phi_a1 >= 0x36) { - phi_a1_2 = 0x35; - phi_v1_4 = (phi_v1_5 * 0x35) / phi_a1; + if (var_a1 >= 0x36) { + var_v1 = (s16) ((s32) (var_v1 * 0x0035) / var_a1); + var_a1 = 0x0035; } - phi_v1_3 = phi_v1_4; - if (phi_a1_2 < -0x35) { - phi_v1_3 = (phi_v1_4 * 0x35) / -phi_a1_2; + if (var_a1 < -0x35) { + var_v1 = (s16) ((s32) (var_v1 * 0x0035) / (s16) -var_a1); } - return phi_v1_3; + return var_v1; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80038534.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800388B0(void *arg0) { +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +s16 func_800388B0(struct Controller *controller) { s16 temp_a2; + s16 temp_t5; + s16 temp_t6; s16 temp_v1; - s32 phi_a3; - s32 phi_t0; - s32 phi_t0_2; - s32 phi_v0; - s32 phi_v0_2; - s32 phi_a1; - s32 phi_a1_2; - s32 phi_a1_3; - s32 phi_t0_3; - s16 phi_a3_2; - s32 phi_a1_4; - s16 phi_a3_3; - s32 phi_a1_5; - s16 phi_a3_4; - s32 phi_t0_4; + s16 var_a1; + s16 var_a3; + s16 var_t0; + s16 var_v0; - temp_v1 = arg0->unk0; - temp_a2 = arg0->unk2; - phi_a3 = temp_v1; - phi_t0_3 = temp_a2; + temp_v1 = controller->rawStickX; + temp_a2 = controller->rawStickY; + var_a3 = temp_v1; + var_t0 = temp_a2; if (temp_v1 >= 0xD) { - phi_a3 = 0xC; - phi_t0_3 = (temp_a2 * 0xC) / temp_v1; + var_a3 = 0x000C; + var_t0 = (s16) ((s32) (temp_a2 * 0x000C) / temp_v1); } - phi_t0 = phi_t0_3; - phi_a3_4 = phi_a3; - if (phi_a3 < -0xC) { - phi_t0 = (phi_t0_3 * 0xC) / -phi_a3; - phi_a3_4 = -0xC; + if (var_a3 < -0xC) { + temp_t6 = -var_a3; + var_a3 = -0x000C; + var_t0 = (s16) ((s32) (var_t0 * 0x000C) / temp_t6); } - phi_t0_2 = phi_t0; - phi_a3_3 = phi_a3_4; - if (phi_t0 >= 0xD) { - phi_t0_2 = 0xC; - phi_a3_3 = (phi_a3_4 * 0xC) / phi_t0; + if (var_t0 >= 0xD) { + var_a3 = (s16) ((s32) (var_a3 * 0x000C) / var_t0); + var_t0 = 0x000C; } - phi_a3_2 = phi_a3_3; - phi_t0_4 = phi_t0_2; - if (phi_t0_2 < -0xC) { - phi_a3_2 = (phi_a3_3 * 0xC) / -phi_t0_2; - phi_t0_4 = -0xC; + if (var_t0 < -0xC) { + temp_t5 = -var_t0; + var_t0 = -0x000C; + var_a3 = (s16) ((s32) (var_a3 * 0x000C) / temp_t5); } if ((temp_v1 >= -0xC) && (temp_v1 < 0xD) && (temp_a2 >= -0xC) && (temp_a2 < 0xD)) { - phi_v0 = 0; - phi_a1_5 = 0; + var_v0 = 0; + var_a1 = 0; } else { - phi_v0 = temp_v1 - phi_a3_2; - phi_a1_5 = temp_a2 - phi_t0_4; + var_v0 = temp_v1 - var_a3; + var_a1 = temp_a2 - var_t0; } - phi_v0_2 = phi_v0; - phi_a1_4 = phi_a1_5; - if (phi_v0 >= 0x36) { - phi_v0_2 = 0x35; - phi_a1_4 = (phi_a1_5 * 0x35) / phi_v0; + if (var_v0 >= 0x36) { + var_a1 = (s16) ((s32) (var_a1 * 0x0035) / var_v0); + var_v0 = 0x0035; } - phi_a1 = phi_a1_4; - if (phi_v0_2 < -0x35) { - phi_a1 = (phi_a1_4 * 0x35) / -phi_v0_2; + if (var_v0 < -0x35) { + var_a1 = (s16) ((s32) (var_a1 * 0x0035) / (s16) -var_v0); } - phi_a1_2 = phi_a1; - if (phi_a1 >= 0x36) { - phi_a1_2 = 0x35; + if (var_a1 >= 0x36) { + var_a1 = 0x0035; } - phi_a1_3 = phi_a1_2; - if (phi_a1_2 < -0x35) { - phi_a1_3 = -0x35; + if (var_a1 < -0x35) { + var_a1 = -0x0035; } - return phi_a1_3; + return var_a1; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800388B0.s") @@ -7470,31 +6820,19 @@ void func_80038BE4(Player *player, s16 arg1) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80029B4C(void *, f32, f32, f32); // extern -? func_8002AAC0(f64, f64, void *); // extern -? func_8002AB70(void *); // extern -? func_8002AE38(void *, s8, f32, f32, f32, f32); // extern -? func_8002B830(s8, s8); // extern -? func_8002C4F8(void *, s8); // extern -? func_8002C954(void *, s8, f32 *); // extern -? func_8002CD48(void *, s8, s8); // extern -? func_8003F46C(void *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -? func_8003F734(void *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -? func_8003FBAC(void *, ? *, f32 *, f32 *, f32 *, f32 *, f32 *); // extern -f32 func_802ABE30(f32, f32, f32, u16); // extern -? func_802AD950(void *, s32, f32, f32, f32, f32, f32, f32); // extern -? func_802B63B8(f32 *, f32 *); // extern -extern ? D_800E4328; -extern ? D_800E4334; -extern ? D_800E4340; -extern ? D_800E434C; -extern f64 D_800EDE00; -extern f64 D_800EDE08; -extern f64 D_800EDE10; -extern ? gKartTopSpeedTable; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? 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 */ +? func_802B6540(f32 *, f32, f32, f32, s32); /* extern */ +static ? D_800E4328; /* unable to generate initializer */ +static ? D_800E4334; /* unable to generate initializer */ +static ? D_800E4340; /* unable to generate initializer */ +static ? D_800E434C; /* unable to generate initializer */ -void func_80038C6C(void *arg0, ? arg1, s8 arg2, s8 arg3) { +void func_80038C6C(Player *player, Camera *camera, s8 arg2, s8 arg3) { f32 sp11C; f32 sp114; f32 sp110; @@ -7516,188 +6854,174 @@ void func_80038C6C(void *arg0, ? arg1, s8 arg2, s8 arg3) { f32 sp90; f32 sp8C; f32 sp88; - ? sp7C; + f32 sp7C; f32 *sp50; - f32 (*temp_v0_2)[3]; - f32 *temp_a0; f32 *temp_a1; + f32 *temp_v0_2; f32 *temp_v0_3; f32 temp_f0_2; f32 temp_f0_3; f32 temp_f0_4; f32 temp_f10; f32 temp_f10_2; - f32 temp_f10_3; f32 temp_f12_2; - f32 temp_f16_2; + f32 temp_f16; f32 temp_f2_2; f32 temp_f2_3; f32 temp_f2_4; f32 temp_f4; - f32 temp_f6; f32 temp_f8; - f32 temp_f8_2; f64 temp_f0; f64 temp_f12; - f64 temp_f14; - f64 temp_f16; f64 temp_f2; - f64 temp_f4_2; s16 temp_v0; s32 temp_t6; sp114.unk0 = D_800E4328.unk0; - sp114.unk4 = D_800E4328.unk4; - sp114.unk8 = D_800E4328.unk8; + sp114.unk4 = (s32) D_800E4328.unk4; + sp114.unk8 = (s32) D_800E4328.unk8; sp108.unk0 = D_800E4334.unk0; - sp108.unk4 = D_800E4334.unk4; - sp108.unk8 = D_800E4334.unk8; + sp108.unk4 = (s32) D_800E4334.unk4; + sp108.unk8 = (s32) D_800E4334.unk8; spFC.unk0 = D_800E4340.unk0; - spFC.unk4 = D_800E4340.unk4; - spFC.unk8 = D_800E4340.unk8; + spFC.unk4 = (s32) D_800E4340.unk4; + spFC.unk8 = (s32) D_800E4340.unk8; spF0.unk0 = D_800E434C.unk0; - spF0.unk4 = D_800E434C.unk4; - spF0.unk8 = D_800E434C.unk8; - arg0->unk84 = -10.0f; - arg0->unk88 = 28.0f; - arg0->unk214 = 250.0f; - func_8002B830(arg3, arg2); - func_8002CD48(arg0, arg3, arg2); - arg0->unk2E = arg0->unk2E + arg0->unk78; + spF0.unk4 = (s32) D_800E434C.unk4; + spF0.unk8 = (s32) D_800E434C.unk8; + player->unk_084 = -10.0f; + player->unk_088 = 28.0f; + player->unk_214 = 250.0f; + func_8002B830(player, arg3, arg2); + func_8002CD48(player, arg3, arg2); + player->unk_02E += player->unk_078; spF0 = 0.0f; spF4 = 0.0f; spF8 = 0.0f; - func_8002AB70(arg0); - temp_a1 = arg0 + 0x174; - temp_a0 = &sp108; - temp_f8 = (spFC + arg0->unk64) * 0.0f; - spA4 = temp_f8; - spA0 = arg0->unk100 * -1.0f; + func_8002AB70(player); + temp_a1 = player->unk_174[0]; + spA4 = (spFC + player->unk_064) * 0.0f; + spA0 = player->unk_100 * -1.0f; sp110 = 0.0f; sp10C = 0.0f; sp108 = 0.0f; sp50 = temp_a1; - temp_f6 = (sp104 + arg0->unk6C) * 0.0f; - sp9C = temp_f6; - func_802B63B8(temp_a0, temp_a1); - temp_f10 = temp_f6 + sp110; - spA4 = temp_f8 + sp108; - sp9C = temp_f10; - sp11C = arg0->unk8C; - func_802B63B8(&sp114, temp_a1); - temp_f14 = D_800EDE00; - sp88 = arg0->unk34; - temp_f8_2 = arg0->unk38; - sp8C = temp_f8_2; - temp_f0 = sp88; - sp90 = arg0->unk3C; - temp_f16 = D_800EDE08; - temp_f2 = sp90; - sp88 = temp_f0 + ((((sp114 + spA4 + spF0) - (temp_f0 * (temp_f14 * arg0->unkFC))) / temp_f16) / 1.0); - temp_f12 = temp_f8_2; - sp90 = temp_f2 + ((((sp11C + temp_f10 + spF8) - (temp_f2 * (temp_f14 * arg0->unkFC))) / temp_f16) / 1.0); - sp8C = temp_f12 + ((((sp118 + spA0 + spF4) - (temp_f12 * (temp_f14 * arg0->unkFC))) / temp_f16) / 1.0); - temp_v0 = arg0->unk44; + sp9C = (sp104 + player->unk_06C) * 0.0f; + func_802B63B8(&sp108, (f32 (*)[3]) temp_a1); + spA4 += sp108; + sp9C += sp110; + sp11C = player->unk_08C; + func_802B63B8(&sp114, (f32 (*)[3]) sp50); + sp88 = player->unk_034[0]; + temp_f8 = player->unk_034[1]; + sp8C = temp_f8; + temp_f0 = (f64) sp88; + sp90 = player->unk_034[2]; + temp_f2 = (f64) sp90; + sp88 = (f32) (temp_f0 + ((((f64) (sp114 + spA4 + spF0) - (temp_f0 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / 1.0)); + temp_f12 = (f64) temp_f8; + sp90 = (f32) (temp_f2 + ((((f64) (sp11C + sp9C + spF8) - (temp_f2 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / 1.0)); + sp8C = (f32) (temp_f12 + ((((f64) (sp118 + spA0 + spF4) - (temp_f12 * (0.12 * (f64) player->unk_0FC))) / 6000.0) / 1.0)); + temp_v0 = player->unk_044; if ((temp_v0 & 0x10) == 0x10) { - arg0->unk44 = temp_v0 & 0xFFEF; + player->unk_044 = temp_v0 & 0xFFEF; } - temp_f0_2 = arg0->unk14; + temp_f0_2 = player->pos[0]; spE0 = temp_f0_2; - temp_f2_2 = arg0->unk18; - temp_f16_2 = arg0->unk1C; - arg0->unk20 = temp_f0_2; - arg0->unk24 = temp_f2_2; - arg0->unk28 = temp_f16_2; - spEC = arg0->unk34 + temp_f0_2; - spE8 = arg0->unk38 + temp_f2_2; - spD8 = temp_f16_2; - temp_f4 = arg0->unk3C + temp_f16_2; + temp_f2_2 = player->pos[1]; + temp_f16 = player->pos[2]; + player->rotX = temp_f0_2; + player->rotY = temp_f2_2; + player->rotZ = temp_f16; + spEC = player->unk_034[0] + temp_f0_2; + spE8 = player->unk_034[1] + temp_f2_2; + spD8 = temp_f16; + temp_f4 = player->unk_034[2] + temp_f16; spE4 = temp_f4; - func_8002AAC0(temp_f12, temp_f14, arg0); - temp_f10_2 = spE8 + arg0->unkEC; - temp_f4_2 = temp_f10_2; + func_8002AAC0(player); + temp_f10 = spE8 + player->kartHopVelocity; + spE8 = temp_f10; + temp_f10_2 = (f32) ((f64) temp_f10 - 0.02); spE8 = temp_f10_2; - temp_f10_3 = temp_f4_2 - D_800EDE10; - spE8 = temp_f10_3; - func_802AD950(arg0 + 0x110, arg0->unk70, spEC, temp_f10_3, temp_f4, arg0->unk20, arg0->unk24, arg0->unk28); - arg0->unk58 = 0.0f; - arg0->unk60 = 0.0f; - arg0->unk5C = 1.0f; - func_802B6540(sp50, 0.0f, 1.0f, 0.0f, arg0->unk2E); - arg0->unkBC = arg0->unkBC | 8; - arg0->unkC2 = arg0->unkC2 + 1; - sp98 = arg0->unk124; + func_802AD950(&player->unk_110, player->boundingBoxSize, spEC, temp_f10_2, temp_f4, player->rotX, player->rotY, player->rotZ); + 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); + player->unk_0BC |= 8; + player->unk_0C2 += 1; + sp98 = player->unk_110.unk44; if (sp98 <= 0.0f) { - arg0->unkC2 = 0; - temp_t6 = arg0->unkBC & ~2; - arg0->unkBC = temp_t6; - arg0->unkBC = temp_t6 & ~8; - arg0->unkEC = arg0->unkC2; + player->unk_0C2 = 0; + temp_t6 = player->unk_0BC & ~2; + player->unk_0BC = temp_t6; + player->unk_0BC = temp_t6 & ~8; + player->kartHopVelocity = (f32) player->unk_0C2; } - sp98 = arg0->unk124; + sp98 = player->unk_110.unk44; if (sp98 <= 0.0f) { - func_8003F46C(arg0, &sp7C, &sp88, &sp108, &sp98, &spEC, &spE8, &spE4); + func_8003F46C(player, &sp7C, &sp88, &sp108, &sp98, &spEC, &spE8, &spE4); } - sp98 = arg0->unk11C; + sp98 = player->unk_110.unk3C; if (sp98 < 0.0f) { - func_8003F734(arg0, &sp7C, &sp88, &sp98, &spEC, &spE8, &spE4); - func_8002C954(arg0, arg3, &sp88); + func_8003F734(player, &sp7C, &sp88, &sp98, &spEC, &spE8, &spE4); + func_8002C954(player, arg3, &sp88); } - sp98 = arg0->unk120; + sp98 = player->unk_110.unk40; if (sp98 < 0.0f) { - func_8003FBAC(arg0, &sp7C, &sp88, &sp98, &spEC, &spE8, &spE4); - func_8002C954(arg0, arg3, &sp88); + func_8003FBAC(player, &sp7C, &sp88, &sp98, &spEC, &spE8, &spE4); + func_8002C954(player, arg3, &sp88); } - sp98 = arg0->unk11C; + sp98 = player->unk_110.unk3C; if (sp98 >= 0.0f) { - sp98 = arg0->unk120; + sp98 = player->unk_110.unk40; if (sp98 >= 0.0f) { - arg0->unk46 = arg0->unk46 & 0xFFDF; + player->unk_046 &= 0xFFDF; } } - arg0->unk74 = func_802ABE30(spEC, spE8, spE4, arg0->unk11A); - func_80029B4C(arg0, spEC, spE8, spE4); - func_8002AE38(arg0, arg3, spE0, spD8, spEC, spE4); - arg0->unk22C = arg0->unk94; - arg0->unk94 = sqrtf((sp90 * sp90) + (sp88 * sp88)); - arg0->unk14 = spEC; - arg0->unk1C = spE4; - arg0->unk18 = spE8; - arg0->unk64 = sp108; - arg0->unk6C = sp110; - arg0->unk34 = sp88; - arg0->unk38 = sp8C; - arg0->unk3C = sp90; - temp_v0_2 = &D_80165070[arg3]; + player->unk_074 = func_802ABE30(spEC, spE8, spE4, player->unk_110.unk3A); + func_80029B4C(player, spEC, spE8, spE4); + func_8002AE38(player, arg3, spE0, spD8, spEC, spE4); + player->unk_22C = player->unk_094; + player->unk_094 = sqrtf((sp90 * sp90) + (sp88 * sp88)); + player->pos[0] = spEC; + player->pos[2] = spE4; + player->pos[1] = spE8; + player->unk_064 = sp108; + player->unk_06C = sp110; + player->unk_034[0] = sp88; + player->unk_034[1] = sp8C; + player->unk_034[2] = sp90; + temp_v0_2 = D_80165070[arg3]; temp_v0_2->unk0 = sp88; temp_v0_2->unk4 = sp8C; temp_v0_2->unk8 = sp90; - if ((arg0->unk0 & 0x4000) == 0x4000) { - temp_f2_3 = arg0->unk94; - temp_v0_3 = (arg0->unk254 * 4) + &gKartTopSpeedTable; + if ((player->unk_000 & 0x4000) == 0x4000) { + temp_f2_3 = player->unk_094; + temp_v0_3 = &gKartTopSpeedTable[player->characterId]; temp_f12_2 = *temp_v0_3; if (temp_f12_2 < temp_f2_3) { temp_f0_3 = temp_f12_2 / temp_f2_3; - arg0->unk34 = arg0->unk34 * temp_f0_3; - arg0->unk38 = arg0->unk38 * temp_f0_3; - arg0->unk3C = arg0->unk3C * temp_f0_3; - arg0->unk94 = *temp_v0_3; + player->unk_034[0] *= temp_f0_3; + player->unk_034[1] *= temp_f0_3; + player->unk_034[2] *= temp_f0_3; + player->unk_094 = *temp_v0_3; } } - if ((arg0->unk44 & 1) == 1) { - temp_f2_4 = arg0->unk94; + if ((player->unk_044 & 1) == 1) { + temp_f2_4 = player->unk_094; if (temp_f2_4 > 1.0f) { temp_f0_4 = 1.0f / temp_f2_4; - arg0->unk94 = 1.0f; - arg0->unk34 = arg0->unk34 * temp_f0_4; - arg0->unk38 = arg0->unk38 * temp_f0_4; - arg0->unk3C = arg0->unk3C * temp_f0_4; + player->unk_094 = 1.0f; + player->unk_034[0] *= temp_f0_4; + player->unk_034[1] *= temp_f0_4; + player->unk_034[2] *= temp_f0_4; } } - if (arg0->unk124 >= 500.0f) { - arg0->unk78 = arg0->unk78 / 2; + if (player->unk_110.unk44 >= 500.0f) { + player->unk_078 = (s16) ((s16) player->unk_078 / 2); } - func_8002C4F8(arg0, arg3); + func_8002C4F8(player, arg3); } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80038C6C.s") diff --git a/src/code_80027D00.h b/src/code_80027D00.h index 20c604132..e326c1121 100644 --- a/src/code_80027D00.h +++ b/src/code_80027D00.h @@ -2,6 +2,7 @@ #define CODE_80027D00_H #include "common_structs.h" +#include "camera.h" /* Function Prototypes */ @@ -16,6 +17,7 @@ void func_800291F8(); void func_80029200(Player*, s8); void func_8002934C(Player*, Camera*, s8, s8); void func_8002A5F4(Vec3f, f32, Vec3f, f32, f32); +void func_8002AA50(Player*); void func_8002AAC0(Player*); void func_8002AB70(Player*); void func_8002AE20(); @@ -34,6 +36,10 @@ void func_80032D94(Player*); void func_80033280(Player*, f32); void func_80033850(Player*, f32); void func_80036C5C(Player*); +void func_80037614(Player*, Vec3f, Vec3f); +void func_8003777C(Player*, Vec3f, Vec3f); +void func_800378E8(Player*, Vec3f, Vec3f); +void func_80037A4C(Player*, Vec3f, Vec3f); void func_80038BE4(Player*, s16); /* This is where I'd put my static data, if I had any */ diff --git a/src/code_800431B0.h b/src/code_800431B0.h index b572c4b77..933c3df85 100644 --- a/src/code_800431B0.h +++ b/src/code_800431B0.h @@ -164,20 +164,15 @@ void func_8004B180(s32, s32, s32, s32); void func_8004B1C8(s32, s32, s32, s32, s32, s32, s32); void func_8004B254(s32, s32, s32); void func_8004B2BC(s32); -void func_8004B2BC(s32); void func_8004B310(s32); void func_8004B35C(s32, s32, s32, s32); -void func_8004B35C(s32,s32,s32,s32); void func_8004B3C8(s32); void func_8004B414(s32, s32, s32, s32); -void func_8004B414(s32,s32,s32,s32); void func_8004B480(s32, s32, s32); void func_8004B4E8(s32, s32, s32, s32); void func_8004B554(s32); void func_8004B5A8(s32, s32, s32, s32); void func_8004B614(s32, s32, s32, s32, s32, s32, s32); -void func_8004B614(s32, s32, s32, s32, s32, s32, s32); -void func_8004B6C4(s32, s32, s32); void func_8004B6C4(s32, s32, s32); void func_8004B72C(s32, s32, s32, s32, s32, s32, s32); void func_8004B950(s32, s32, s32, s32, s32); diff --git a/src/code_80057C60.h b/src/code_80057C60.h index 416d28737..d0d70ef5e 100644 --- a/src/code_80057C60.h +++ b/src/code_80057C60.h @@ -75,6 +75,7 @@ void func_8005AB20(); void func_8005B914(); void func_8005C360(f32); +void func_8005C64C(s32); void func_8005C6B4(s8, s16*, s16*, s16*); void func_8005C728(); void func_8005CB60(s32, s32); diff --git a/src/code_80071F00.h b/src/code_80071F00.h index 9ce513efa..89eca98d4 100644 --- a/src/code_80071F00.h +++ b/src/code_80071F00.h @@ -119,7 +119,6 @@ void func_80075F98(Vec3f, s32, f32); void func_8007601C(s32); void func_80076194(s32, Vec3f, f32, s32); void func_80076538(s32); -void func_80086604(); void func_8007675C(s32, Vec3s, s32); void func_80076B7C(); void func_80076DC4(s32); @@ -133,6 +132,7 @@ void func_80077B3C(s32); void func_80077BCC(s32); void func_80078C68(); void func_80078C70(s32); +void func_80078F64(); void func_80079054(s32); void func_80079084(s32); void func_800790B4(s32); @@ -182,6 +182,7 @@ void func_80085080(s32); void func_80085534(s32); void func_80085BB4(s32); void func_80086424(s32); +void func_80086604(); void func_80086D80(); // audio/external.c diff --git a/src/code_8008C1D0.c b/src/code_8008C1D0.c index 9f0ca04c0..3621122dc 100644 --- a/src/code_8008C1D0.c +++ b/src/code_8008C1D0.c @@ -4,6 +4,7 @@ #include "functions.h" #include "variables.h" #include "kart_attributes.h" +#include "waypoints.h" #include "code_80005FD0.h" #include "code_8001F980.h" #include "code_80027D00.h" @@ -336,18 +337,11 @@ void func_8008C8C4(Player* player, s8 arg1) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_80031F48(void *, ?); /* extern */ -? func_8006B8B4(void *, s8, ? *); /* extern */ -? func_8008C8C4(void *, s8); /* extern */ -extern ? D_80165460; -extern ? D_80165480; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_8018D920; -extern s32 gModeSelection; -static ? D_800E6F60; /* unable to generate initializer; const */ +static ? D_800E6F60; /* unable to generate initializer */ -void func_8008C9EC(void *arg0, s8 arg1) { - ? sp30; +void func_8008C9EC(Player *player, s8 arg1) { s16 *temp_a0; s16 *temp_a0_2; s16 *temp_v0; @@ -356,63 +350,61 @@ void func_8008C9EC(void *arg0, s8 arg1) { s16 temp_t8; s16 temp_v1; s16 temp_v1_2; - s32 temp_t7_2; - sp30.unk0 = D_800E6F60.unk0; - sp30.unk4 = D_800E6F60.unk4; - sp30.unk8 = D_800E6F60.unk8; - arg0->unk206 = 0; - arg0->unkC4 = 0; - if ((arg0->unk46 & 0x40) == 0x40) { - func_80031F48(0x42C80000); + 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) { + func_80031F48(player, 100.0f); } else { - if ((arg0->unk0 & 0x4000) == 0x4000) { - func_80031F48(arg0, 0x3F800000); + if ((player->unk_000 & 0x4000) == 0x4000) { + func_80031F48(player, 1.0f); } else { - func_80031F48(arg0, 0x40800000); + func_80031F48(player, 4.0f); } - if ((arg0->unk0 & 0x4000) == 0) { - func_80031F48(arg0, 0x41F00000); + if (!(player->unk_000 & 0x4000)) { + func_80031F48(player, 30.0f); } } - if ((arg0->unkBC & 0x80) == 0x80) { - temp_a0 = &sp30 + (arg0->unkB2 * 2); - arg0->unk2E = arg0->unk2E - *temp_a0; + 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 = arg0->unkB2; - if (((temp_t7 & 0xFFFF) / (0x10000 / (0x168 / (*(&sp30 + (temp_v1 * 2)) / 182)))) == 0) { - arg0->unkB2 = temp_v1 - 1; - if (arg0->unkB2 <= 0) { - if (gModeSelection == BATTLE) { - func_8006B8B4(arg0, arg1, &sp30); + 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; + if (player->unk_0B2 <= 0) { + if (gModeSelection == 3) { + func_8006B8B4(player, arg1); } - func_8008C8C4(arg0, arg1); + func_8008C8C4(player, arg1); } } } else { - temp_a0_2 = (arg0->unkB2 * 2) + &sp30; - arg0->unk2E = arg0->unk2E + *temp_a0_2; + 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 = arg0->unkB2; - if (((temp_t8 & 0xFFFF) / (0x10000 / (0x168 / ((sp + (temp_v1_2 * 2))->unk30 / 182)))) == 0) { - arg0->unkB2 = temp_v1_2 - 1; - if (arg0->unkB2 <= 0) { - func_8008C8C4(arg0, arg1); - if (gModeSelection == BATTLE) { - func_8006B8B4(arg0, arg1); + 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; + if (player->unk_0B2 <= 0) { + func_8008C8C4(player, arg1); + if (gModeSelection == 3) { + func_8006B8B4(player, arg1); } } } } - temp_t7_2 = arg1 * 4; - if ((*(&D_80165460 + temp_t7_2) == 1) && ((arg0->unk0 & 0x4000) == 0x4000)) { - *(&D_80165480 + temp_t7_2) = 0x78; - if (arg0->unk9C <= 90.0f) { - arg0->unk9C = 90.0f; + if ((D_80165460[arg1] == 1) && ((player->unk_000 & 0x4000) == 0x4000)) { + D_80165480[arg1] = 0x00000078; + if (player->unk_09C <= 90.0f) { + player->unk_09C = 90.0f; } } } @@ -991,87 +983,76 @@ void func_8008DF98(Player* player, s8 arg1) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? move_f32_towards(void *, f32, ?); /* extern */ -? func_80031F48(void *, ?, s8); /* extern */ -? func_8008DABC(void *, s8, s8); /* extern */ -? func_8008E3C0(s8, s8, s8); /* extern */ -? func_800C90F4(s32, s32, s8); /* extern */ -extern ? D_80165190; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_8018D920; -extern ? gKartBoundingBoxSizeTable; -void func_8008E118(void *arg0, s8 arg1) { +void func_8008E118(Player *player, s8 arg1) { + s16 *temp_v0_2; s16 *temp_v0_3; + s16 *temp_v0_4; s16 temp_t0; - s32 temp_a0; s32 temp_v0; - s8 temp_a2; s8 temp_t1; - void *temp_v0_2; - void *temp_v0_4; - s8 phi_a2; + s8 var_a2; - temp_v0 = arg0->unkBC; - temp_a2 = arg1; - phi_a2 = temp_a2; - if (((temp_v0 & 0x8000) == 0x8000) && ((temp_v0 & 0x4000000) != 0x4000000)) { - arg0->unkBC = temp_v0 & 0xFFFDFFFF; - arg0->unkA8 = 0; - arg0->unk7C = 0; - arg0->unkC0 = 0; + temp_v0 = player->unk_0BC; + var_a2 = arg1; + if (((temp_v0 & 0x8000) == 0x8000) && ((temp_v0 & 0x04000000) != 0x04000000)) { + player->unk_0BC = temp_v0 & 0xFFFDFFFF; + player->unk_0A8 = 0; + player->unk_07C = 0; + player->unk_0C0 = 0; temp_t1 = arg1; - arg0->unk2E = arg0->unkAE; + player->unk_02E = player->unk_0AE; arg1 = arg1; - func_8008E3C0(temp_t1, temp_a2); - temp_v0_2 = (arg1 * 2) + &D_80165190; + 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; - func_8008DABC(arg0, arg1, arg1); + func_8008DABC(player, arg1); return; } - temp_a0 = temp_a2 * 2; if ((temp_v0 & 0x20000) == 0x20000) { - arg0->unk2E = arg0->unk2E - 0x5B0; - temp_v0_3 = temp_a0 + &D_8018D920; + player->unk_02E -= 0x5B0; + temp_v0_3 = (var_a2 * 2) + &D_8018D920; temp_t0 = *temp_v0_3 - 0x5B0; *temp_v0_3 = temp_t0; - if (((temp_t0 & 0xFFFF) / 1456) == 0) { - arg0->unkB2 = arg0->unkB2 - 1; - if (arg0->unkB2 <= 0) { - arg0->unkA8 = 0; - arg0->unkBC = arg0->unkBC & 0xFFFDFFFF; - arg0->unk7C = 0; - arg0->unkC0 = 0; - temp_v0_4 = temp_a0 + &D_80165190; - arg0->unk2E = arg0->unkAE; + if ((s16) ((s32) (temp_t0 & 0xFFFF) / 1456) == 0) { + player->unk_0B2 -= 1; + if (player->unk_0B2 <= 0) { + player->unk_0A8 = 0; + player->unk_0BC &= 0xFFFDFFFF; + 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; } } - func_80031F48(arg0, 0x3F800000, temp_a2); + func_80031F48(player, 1.0f); return; } - arg0->unkB0 = arg0->unkB0 + 1; - arg0->unk8C = arg0->unk8C * 0.6; - if ((arg0->unkB0 == 1) && ((arg0->unk0 & 0x4000) != 0)) { - arg1 = temp_a2; - func_800C90F4(temp_a2 & 0xFF, (arg0->unk254 * 0x10) + 0x29008005, temp_a2); - phi_a2 = arg1; + 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 ((arg0->unkB0 >= 0) && (arg0->unkB0 < 0x1CC)) { - move_f32_towards(arg0 + 0x224, 0.7f, 0x3DCCCCCD); - move_f32_towards(arg0 + 0x70, *(&gKartBoundingBoxSizeTable + (arg0->unk254 * 4)) * 0.9, 0x3DCCCCCD); + 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 = phi_a2; - func_8008E3C0(arg0, phi_a2, phi_a2); - if ((arg0->unk0 & 0x4000) != 0) { - func_800C90F4(arg1 & 0xFF, (arg0->unk254 * 0x10) + 0x29008008, arg1); + arg1 = var_a2; + func_8008E3C0(player, var_a2); + if (player->unk_000 & 0x4000) { + func_800C90F4(arg1 & 0xFF, (player->characterId * 0x10) + 0x29008008); } } #else @@ -2099,219 +2080,178 @@ 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 mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? move_f32_towards(void *, f32, ?); /* extern */ -? move_s16_towards(void *, ?, ?); /* extern */ -? func_8006B8B4(void *, s8); /* extern */ -? func_8008C354(s8); /* extern */ -? func_8008F104(void *, s8); /* extern */ -? func_8008FB30(void *, s8); /* extern */ -? func_80090178(void *, s8, f32 *, ? *); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_80090178(Player *, s8, f32 *, f32 *); /* extern */ ? func_8009E020(s8, ?); /* extern */ ? func_8009E088(s8, ?); /* extern */ ? func_800C9018(u8, ?); /* extern */ -s32 func_802B5224(f32 *, ? *); /* extern */ -f32 sins(s32); /* extern */ -f32 coss(s32); /* extern */ -extern ? D_80004334; -extern void *D_80164550; -extern ? D_801652A0; extern ? D_80165330; -extern s32 gModeSelection; -void func_80090970(void *arg0, s8 arg1, s8 arg2) { +void func_80090970(Player *player, s8 arg1, s8 arg2) { f32 sp44; - ? sp38; - f32 *sp28; + f32 sp38; + f32 *sp28; /* compiler-managed */ f32 *temp_v0_2; f32 temp_f6; s16 temp_v0; s16 temp_v0_6; s16 temp_v1; s16 temp_v1_2; - s32 temp_at; s32 temp_v0_5; + s32 temp_v0_8; + struct TrackWayPoint *temp_v0_7; u16 temp_t7; u16 temp_v0_3; u16 temp_v0_4; - void *temp_v0_7; - f32 phi_at; - arg0->unkC2 = 0xC; - arg0->unk78 = 0; - arg0->unk7C = 0; - arg0->unkC0 = 0; - arg0->unk8C = 0.0f; - func_8008C354(arg1); - temp_t7 = arg0->unk222; + player->unk_0C2 = 0x000C; + player->unk_078 = 0; + player->unk_07C = 0; + player->unk_0C0 = 0; + player->unk_08C = 0.0f; + func_8008C354(player, arg1); + temp_t7 = (u16) player->unk_222; switch (temp_t7) { case 0: - temp_v1 = arg0->unkCA; + temp_v1 = player->unk_0CA; if ((temp_v1 & 1) == 1) { - temp_v0 = arg0->unkC8; + temp_v0 = player->unk_0C8; if ((temp_v0 < 0x3C) || ((temp_v1 & 2) != 2)) { - arg0->unkC8 = temp_v0 + 1; - temp_at = arg0->unkC8 < 0x3C; - phi_at = (bitwise f32) temp_at; - if (temp_at == 0) { - arg0->unkC8 = 0x3C; + player->unk_0C8 = temp_v0 + 1; + if (player->unk_0C8 >= 0x3C) { + player->unk_0C8 = 0x003C; } } else { - temp_v0_2 = (arg1 * 4) + &D_801652A0; + temp_v0_2 = &D_801652A0[arg1]; sp28 = temp_v0_2; - move_f32_towards(arg0 + 0x18, *temp_v0_2 + 100.0f, 0x3C449BA6); - move_s16_towards(arg0 + (arg2 * 2) + 0xCC, 0, 0x3E4CCCCD); - phi_at = 40.0f; - if ((*sp28 + 40.0f) <= arg0->unk18) { - arg0->unk222 = 1; - arg0->unkC6 = 0xFF; - arg0->unkCA = arg0->unkCA | 4; - phi_at = 40.0f; + move_f32_towards(&player->pos[1], *temp_v0_2 + 100.0f, 0.012f); + move_s16_towards(player + (arg2 * 2) + 0xCC, 0, 0.2f); + if ((*sp28 + 40.0f) <= player->pos[1]) { + player->unk_222 = 1; + player->unk_0C6 = 0x00FF; + player->unk_0CA |= 4; } } - } else { - phi_at = 100.0f; - if ((temp_v1 & 2) == 2) { - move_f32_towards(arg0 + 0x18, arg0->unk74 + 100.0f, 0x3CCCCCCD); - move_s16_towards(arg0 + (arg2 * 2) + 0xCC, 0, 0x3E4CCCCD); - phi_at = 40.0f; - if ((arg0->unk74 + 40.0f) <= arg0->unk18) { - arg0->unk222 = 1; - arg0->unkC6 = 0xFF; - arg0->unkCA = arg0->unkCA | 4; - phi_at = 40.0f; - } + } else if ((temp_v1 & 2) == 2) { + move_f32_towards(&player->pos[1], player->unk_074 + 100.0f, 0.025f); + move_s16_towards(player + (arg2 * 2) + 0xCC, 0, 0.2f); + if ((player->unk_074 + 40.0f) <= player->pos[1]) { + player->unk_222 = 1; + player->unk_0C6 = 0x00FF; + player->unk_0CA |= 4; } } - if (&D_80004334 != (arg0->unkBC & &D_80004334)) { - // Error: Got lui instruction with macro other than %hi - // At instruction: lui $at, %lo(D_80004334) - // D_80004334 FAKE POINTER - } else { - func_8008FB30(arg0, arg1); - default: -block_49: - phi_at = 180.0f; + if ((player->unk_0BC & 0x80000000) == 0x80000000) { + func_8008FB30(player, arg1); } break; case 1: - temp_v0_3 = arg0->unk0; - if (((temp_v0_3 & 0x4000) == 0x4000) && ((temp_v0_3 & 0x1000) == 0)) { + temp_v0_3 = player->unk_000; + if (((temp_v0_3 & 0x4000) == 0x4000) && !(temp_v0_3 & 0x1000)) { func_8009E088(arg1, 0xA); } - if ((arg0->unkCA & 1) == 1) { - move_f32_towards(arg0 + 0x18, *(&D_801652A0 + (arg1 * 4)) + 40.0f, 0x3CA3D70A); - arg0->unkC6 = arg0->unkC6 - 8; - if (arg0->unkC6 < 9) { - arg0->unkC6 = 0; - arg0->unk222 = 2; - arg0->unkCA = arg0->unkCA & 0xFFFE; + if ((player->unk_0CA & 1) == 1) { + move_f32_towards(&player->pos[1], D_801652A0[arg1] + 40.0f, 0.02f); + player->unk_0C6 -= 8; + if (player->unk_0C6 < 9) { + player->unk_0C6 = 0; + player->unk_222 = 2; + player->unk_0CA &= 0xFFFE; } } else { - move_f32_towards(arg0 + 0x18, arg0->unk24 + 40.0f, 0x3CA3D70A); - arg0->unkC6 = arg0->unkC6 - 8; - if (arg0->unkC6 < 9) { - arg0->unkC6 = 0; - arg0->unk222 = 2; + move_f32_towards(&player->pos[1], player->rotY + 40.0f, 0.02f); + player->unk_0C6 -= 8; + if (player->unk_0C6 < 9) { + player->unk_0C6 = 0; + player->unk_222 = 2; } } - arg0->unkCA = arg0->unkCA & 0xDFFF; - goto block_49; + player->unk_0CA &= 0xDFFF; + break; case 2: - func_80090178(arg0, arg1, &sp44, &sp38); - arg0->unk2E = -func_802B5224(&sp44, &sp38); - arg0->unk14 = sp44; - arg0->unk18 = sp48 + 40.0f; - arg0->unk222 = 3; - arg0->unk1C = sp4C; - goto block_49; + func_80090178(player, arg1, &sp44, &sp38); + player->unk_02E = -func_802B5224(&sp44, &sp38); + player->pos[0] = sp44; + player->pos[1] = sp48 + 40.0f; + player->unk_222 = 3; + player->pos[2] = sp4C; + break; case 3: *(&D_80165330 + (arg1 * 2)) = 0; - temp_v0_4 = arg0->unk0; - if (((temp_v0_4 & 0x4000) == 0x4000) && ((temp_v0_4 & 0x1000) == 0)) { + temp_v0_4 = player->unk_000; + if (((temp_v0_4 & 0x4000) == 0x4000) && !(temp_v0_4 & 0x1000)) { func_8009E020(arg1, 0x14); } - func_80090178(arg0, arg1, &sp44, &sp38); - arg0->unk14 = sp44; - arg0->unk18 = sp48 + 40.0f; - arg0->unk1C = sp4C; + func_80090178(player, arg1, &sp44, &sp38); + player->pos[0] = sp44; + player->pos[1] = sp48 + 40.0f; + player->pos[2] = sp4C; temp_v0_5 = arg1 * 0x1C70; sp28 = temp_v0_5; - arg0->unk1C = (coss((temp_v0_5 - arg0->unk2E) & 0xFFFF) * -5.0f) + arg0->unk1C; - temp_f6 = sins((temp_v0_5 - arg0->unk2E) & 0xFFFF) * -5.0f; - arg0->unkC6 = arg0->unkC6 + 8; - arg0->unk14 = temp_f6 + arg0->unk14; - if (arg0->unkC6 >= 0xF0) { - arg0->unkC6 = 0xFF; - arg0->unk222 = 4; - arg0->unkCA = arg0->unkCA & 0xFFFB; - arg0->unkC8 = 0; + 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->unk_0C6 += 8; + player->pos[0] += temp_f6; + if (player->unk_0C6 >= 0xF0) { + player->unk_0C6 = 0x00FF; + player->unk_222 = 4; + player->unk_0CA &= 0xFFFB; + player->unk_0C8 = 0; } - goto block_49; + break; case 4: - temp_v0_6 = arg0->unkC8; - if ((temp_v0_6 == 0x96) || (temp_v0_6 == 0xC8) || (temp_v0_6 == 0xFA)) { - arg0->unk1C = (coss(-arg0->unk2E & 0xFFFF) * -10.0f) + arg0->unk1C; - arg0->unk14 = (sins(-arg0->unk2E & 0xFFFF) * -10.0f) + arg0->unk14; + 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; } - if (arg0->unkC8 == 0xFC) { - temp_v0_7 = D_80164550; - arg0->unk14 = temp_v0_7->unk0; - arg0->unk18 = temp_v0_7->unk2; - arg0->unk1C = temp_v0_7->unk4; + if (player->unk_0C8 == 0x00FC) { + temp_v0_7 = *D_80164550; + player->pos[0] = (f32) temp_v0_7->wayPointX; + player->pos[1] = (f32) temp_v0_7->wayPointY; + player->pos[2] = (f32) temp_v0_7->wayPointZ; } - move_f32_towards(arg0 + 0x18, (arg0->unk74 + arg0->unk70) - 2.0f, 0x3D23D70A); - arg0->unkC8 = arg0->unkC8 + 1; - phi_at = (bitwise f32) 8; - if ((arg0->unkBC & 8) == 8) { - // Error: %hi macro outside of lui - // At instruction: andi $t8, $v0, %hi(D_80004334) - if (MIPS2C_ERROR()) { - // Error: Got lui instruction with macro other than %hi - // At instruction: lui $at, %lo(D_80004334) - } else { - goto block_41; - } - } else { -block_41: - arg0->unkCA = arg0->unkCA & 0xEFFF; - if (arg0->unkC8 >= 0x5B) { - if ((arg0->unk0 & 0x4000) != 0) { - func_800C9018(arg1, 0x100FA28); + move_f32_towards(&player->pos[1], (player->unk_074 + player->boundingBoxSize) - 2.0f, 0.04f); + temp_v0_8 = player->unk_0BC; + player->unk_0C8 += 1; + if (((temp_v0_8 & 8) != 8) || (temp_v0_8 & 0x8000)) { + player->unk_0CA &= 0xEFFF; + if (player->unk_0C8 >= 0x5B) { + if (player->unk_000 & 0x4000) { + func_800C9018((u8) arg1, 0x0100FA28); } - if (gModeSelection == BATTLE) { - func_8006B8B4(arg0, arg1); + if (gModeSelection == 3) { + func_8006B8B4(player, arg1); } - arg0->unkCA = arg0->unkCA & 0xFFFD; - temp_v1_2 = arg0->unkCA; - arg0->unkDE = arg0->unkDE & 0xFFFB; + player->unk_0CA &= 0xFFFD; + temp_v1_2 = player->unk_0CA; + player->unk_0DE &= 0xFFFB; if ((temp_v1_2 & 0x80) != 0x80) { - arg0->unkCA = temp_v1_2 & 0xFFF7; - if ((arg0->unk214 * 0.9) <= arg0->unk9C) { - func_8008F104(arg0, arg1); + player->unk_0CA = temp_v1_2 & 0xFFF7; + if (((f64) player->unk_214 * 0.9) <= (f64) player->unk_09C) { + func_8008F104(player, arg1); } } } - goto block_49; } break; } - arg0->unkDA0 = arg0->unkDA0 + 8.0f; - if (phi_at <= arg0->unkDA0) { - arg0->unkDA0 = phi_at; + player->unk_DA0 += 8.0f; + if (player->unk_DA0 >= 180.0f) { + player->unk_DA0 = 180.0f; } - if (arg0->unkD98 == 1) { - arg0->unkD9C = arg0->unkD9C + arg0->unkDA0; - if (arg0->unkD9C >= 1820.0f) { - arg0->unkDA0 = 0.0f; - arg0->unkD98 = arg0->unkD98 * -1; + if (player->unk_D98 == 1) { + player->unk_D9C += player->unk_DA0; + if (player->unk_D9C >= 1820.0f) { + player->unk_DA0 = 0.0f; + player->unk_D98 *= -1; } } - if (arg0->unkD98 == -1) { - arg0->unkD9C = arg0->unkD9C - arg0->unkDA0; - if (arg0->unkD9C <= -1820.0f) { - arg0->unkDA0 = 0.0f; - arg0->unkD98 = arg0->unkD98 * -1; + if (player->unk_D98 == -1) { + player->unk_D9C -= player->unk_DA0; + if (player->unk_D9C <= -1820.0f) { + player->unk_DA0 = 0.0f; + player->unk_D98 *= -1; } } } @@ -2395,57 +2335,54 @@ void func_800911B4(Player* player, s8 arg1) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc + extern s8 D_801658BC; extern ? D_8018D920; -extern ? gKartGravityTable; -static ? D_800E706C; /* unable to generate initializer; const */ +static ? D_800E706C; /* unable to generate initializer */ -void func_80091298(void *arg0, s8 arg1) { - ? spC; +void func_80091298(Player *player, s8 arg1) { f32 temp_f0; f32 temp_f2; s16 *temp_a2; s16 temp_t9; - s32 temp_t8; - s16 phi_v1; + s16 var_v1; - spC.unk0 = D_800E706C.unk0; - spC.unk4 = D_800E706C.unk4; - spC.unk8 = D_800E706C.unk8; - arg0->unk44 = arg0->unk44 | 0x2000; - if (arg0->unkB2 == 0) { - phi_v1 = 0; + 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; - arg0->unk2E = arg0->unk2E - 0xE38; + player->unk_02E -= 0xE38; temp_t9 = *temp_a2 - 0xE38; - temp_t8 = (temp_t9 & 0xFFFF) / 3640; *temp_a2 = temp_t9; - phi_v1 = temp_t8; + var_v1 = (s16) ((s32) (temp_t9 & 0xFFFF) / 3640); } - if (((phi_v1 == 9) && (arg0->unkB2 == 1)) || ((phi_v1 == 0) && (arg0->unkB2 == 2)) || (arg0->unkB2 == 0)) { - arg0->unkB2 = arg0->unkB2 - 1; - if (arg0->unkB2 <= 0) { - arg0->unkB2 = 0; + if (((var_v1 == 9) && (player->unk_0B2 == 1)) || ((var_v1 == 0) && (player->unk_0B2 == 2)) || (player->unk_0B2 == 0)) { + player->unk_0B2 -= 1; + if (player->unk_0B2 <= 0) { + player->unk_0B2 = 0; } - if (arg0->unkB2 == 0) { - temp_f2 = arg0->unk70; - temp_f0 = *(&spC + (arg1 * 4)); - if ((arg0->unk18 - (temp_f2 + 1.0f)) <= temp_f0) { - arg0->unkDCC = 0; - arg0->unkA8 = 0; - arg0->unk18 = (temp_f0 + temp_f2) + 1.08; - arg0->unk7C = 0; - arg0->unkC0 = 0; - arg0->unk44 = arg0->unk44 & 0xF7FF; - arg0->unkDC0 = 3.0f; - arg0->unkD4 = 0; - arg0->unk100 = *(&gKartGravityTable + (arg0->unk254 * 4)); - arg0->unk0 = arg0->unk0 | 0x2000; - arg0->unk94 = 0.0f; - arg0->unk8C = 0.0f; - arg0->unk9C = 0.0f; + if (player->unk_0B2 == 0) { + temp_f2 = player->boundingBoxSize; + temp_f0 = (&spC[0])[arg1]; + if ((player->pos[1] - (temp_f2 + 1.0f)) <= temp_f0) { + 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_100 = gKartGravityTable[player->characterId]; + player->unk_000 |= 0x2000; + player->unk_094 = 0.0f; + player->unk_08C = 0.0f; + player->unk_09C = 0.0f; if (arg1 == 0) { D_801658BC = 1; } @@ -2472,21 +2409,12 @@ void func_800914A0(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -//This function did not have a glabel in the original assembly, as such it may -//be unused/unnamed -? func_800914A0(s16, s32, s16); /* extern */ -? func_802ADDC8(void *, ?, f32, f32, f32); /* extern */ -s16 atan2s(f32, f32); /* extern */ -f32 sqrtf(f32, f32); /* extern */ -extern void *gPlayerOneCopy; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern u16 D_80152308; extern s16 D_8015F6F8; extern u32 D_8015F718; -extern ? cameras; -extern ? gSegmentTable; -static ? D_800E7080; /* unable to generate initializer; const */ -static ? D_800E708C; /* unable to generate initializer; const */ +static ? D_800E7080; /* unable to generate initializer */ +static ? D_800E708C; /* unable to generate initializer */ void func_800914E0(void) { ? sp64; @@ -2495,6 +2423,7 @@ void func_800914E0(void) { f32 sp38; f32 sp34; f32 sp30; + Player **var_t1; f32 temp_f12; f32 temp_f14; f32 temp_f16; @@ -2502,64 +2431,55 @@ void func_800914E0(void) { f32 temp_f8; s16 temp_a0; s16 temp_a0_2; - s16 temp_a3; s16 temp_v0_2; - u16 temp_t0; u32 temp_v0; void *temp_v0_3; - u16 phi_t0; - void **phi_t1; - sp64.unk0 = D_800E7080.unk0; - sp64.unk4 = D_800E7080.unk4; - sp64.unk8 = D_800E7080.unk8; - sp58.unk0 = D_800E708C.unk0; - sp58.unk4 = D_800E708C.unk4; - sp58.unk8 = D_800E708C.unk8; + sp64.unk0 = (s32) D_800E7080.unk0; + sp64.unk4 = (s32) D_800E7080.unk4; + sp64.unk8 = (s32) D_800E7080.unk8; + sp58.unk0 = (s32) D_800E708C.unk0; + sp58.unk4 = (s32) D_800E708C.unk4; + sp58.unk8 = (s32) D_800E708C.unk8; temp_v0 = D_8015F718; temp_a0 = temp_v0 & 0xFFFFFF; - sp48 = *(&gSegmentTable + ((temp_v0 >> 0x18) * 4)) + temp_a0 + 0x80000000; - temp_t0 = D_80152308; - temp_a3 = gPlayerOneCopy->unk6; - temp_v0_2 = temp_a3 - temp_t0; - cameras.unk18 = 0.0f; - cameras.unk20 = 0.0f; - cameras.unk1C = 1.0f; - phi_t0 = temp_t0; - phi_t1 = &gPlayerOneCopy; + var_t1 = &gPlayerOneCopy; + sp48 = gSegmentTable[temp_v0 >> 0x18] + temp_a0 + 0x80000000; + temp_v0_2 = (s16) gPlayerOneCopy->unk_006 - D_80152308; + cameras->up[0] = 0.0f; + cameras->up[2] = 0.0f; + cameras->up[1] = 1.0f; if (temp_v0_2 == 7) { - func_800914A0(temp_a0, 7, temp_a3); - phi_t0 = D_80152308; + func_800914A0(temp_a0, 7); goto block_5; } if (temp_v0_2 < 0xE) { temp_a0_2 = temp_v0_2 + D_8015F6F8; if (temp_a0_2 == 7) { - func_800914A0(temp_a0_2, 7, temp_a3); - phi_t0 = D_80152308; + func_800914A0(temp_a0_2, 7); block_5: - phi_t1 = &gPlayerOneCopy; + var_t1 = &gPlayerOneCopy; } } - temp_v0_3 = (phi_t0 * 8) + sp48; - temp_f8 = temp_v0_3->unk0 + 0xA; - cameras.unk0 = temp_f8; - temp_f16 = temp_v0_3->unk2 + 7; - *(&cameras + 4) = temp_f16; - temp_f4 = temp_v0_3->unk4 - 0x14; - *(&cameras + 8) = temp_f4; - *(&cameras + 0xC) = (*phi_t1)->unk14; - *(&cameras + 0x10) = (*phi_t1)->unk18; - *(&cameras + 0x14) = (*phi_t1)->unk1C; - func_802ADDC8(&cameras + 0x54, 0x41A00000, temp_f8, temp_f16, temp_f4); - temp_f12 = *(&cameras + 0xC) - cameras.unk0; + temp_v0_3 = (D_80152308 * 8) + sp48; + temp_f8 = (f32) (temp_v0_3->unk0 + 0xA); + cameras->pos[0] = temp_f8; + temp_f16 = (f32) (temp_v0_3->unk2 + 7); + cameras->pos[1] = temp_f16; + temp_f4 = (f32) (temp_v0_3->unk4 - 0x14); + cameras->pos[2] = temp_f4; + cameras->lookAt[0] = (*var_t1)->pos[0]; + cameras->lookAt[1] = (*var_t1)->pos[1]; + cameras->lookAt[2] = (*var_t1)->pos[2]; + func_802ADDC8(&cameras->unk_54, 20.0f, temp_f8, temp_f16, temp_f4); + temp_f12 = cameras->lookAt[0] - cameras->pos[0]; sp38 = temp_f12; - temp_f14 = *(&cameras + 0x14) - *(&cameras + 8); - sp34 = *(&cameras + 0x10) - *(&cameras + 4); + temp_f14 = cameras->lookAt[2] - cameras->pos[2]; + sp34 = cameras->lookAt[1] - cameras->pos[1]; sp30 = temp_f14; - *(&cameras + 0x26) = atan2s(temp_f12, temp_f14); - *(&cameras + 0x24) = atan2s(sqrtf((sp38 * sp38) + (temp_f14 * temp_f14), temp_f14), sp34); - *(&cameras + 0x28) = 0; + cameras->rot[1] = atan2s(temp_f12, temp_f14); + cameras->rot[0] = atan2s(sqrtf((sp38 * sp38) + (temp_f14 * temp_f14)), sp34); + cameras->rot[2] = 0; } #else GLOBAL_ASM("asm/non_matchings/code_8008C1D0/func_800914E0.s") diff --git a/src/code_8008C1D0.h b/src/code_8008C1D0.h index 128895e6b..d15cf9820 100644 --- a/src/code_8008C1D0.h +++ b/src/code_8008C1D0.h @@ -146,8 +146,6 @@ extern f32 D_800EF678; extern f32 D_800EF67C; extern u16 D_80152308; extern u16 D_8015F6F8; -extern u16 gNearestWaypointByPlayerId[]; -extern u16 gWaypointCountByPathIndex; extern s16 D_80165190[4][8]; extern f32 D_80165280[]; extern s16 D_80165320[]; diff --git a/src/code_80280000.c b/src/code_80280000.c index 74aa18900..30b596a97 100644 --- a/src/code_80280000.c +++ b/src/code_80280000.c @@ -6,32 +6,13 @@ #include "main.h" #include "types.h" #include "camera.h" +#include "memory.h" +#include "math_util.h" +#include "code_80280000.h" #include "code_80281780.h" +#include "skybox_and_splitscreen.h" #include -extern Gfx *gDisplayListHead; - -extern f32 D_80150148, D_8015014C, D_80150150; -extern f32 D_80150130[4]; -extern s16 gCreditsCourseId; -extern u16 D_80150112; -extern u16 D_80164AF0; -extern u32 D_8018D120; -extern s32 gPrevLoadedAddress; -extern mk64_surface_map_ram (*D_8015F580)[]; -extern u16 D_8015F588; // Number of entires in D_8015F580 - -extern u16 gIsInQuitToMenuTransition, gQuitToMenuTransitionCounter; -extern s32 D_802874A0; - -extern u16 atan2s(f32, f32); -extern u16 D_80164714, D_80164716, D_80164718; -extern u16 D_800DC5E4; -extern u32 gGamestate; -extern u32 D_802874FC; - -extern u16 D_800DC518; - void func_80280000(void) { func_802966A0(); func_80059AC8(); diff --git a/src/code_80280000.h b/src/code_80280000.h new file mode 100644 index 000000000..be17c0ba3 --- /dev/null +++ b/src/code_80280000.h @@ -0,0 +1,35 @@ +#ifndef CODE_80280000_H +#define CODE_80280000_H + +#include "common_structs.h" + +/* Function Prototypes */ + +void func_80280000(); +void func_80280038(); +void func_80280268(s32 arg0); +void credits_loop(); +void load_credits(); + +extern Gfx *gDisplayListHead; + +extern f32 D_80150148, D_8015014C, D_80150150; +extern f32 D_80150130[4]; +extern s16 gCreditsCourseId; +extern u16 D_80150112; +extern s16 D_80164AF0; +extern u32 D_8018D120; +extern mk64_surface_map_ram (*D_8015F580)[]; +extern u16 D_8015F588; // Number of entires in D_8015F580 + +extern u16 gIsInQuitToMenuTransition, gQuitToMenuTransitionCounter; +extern s32 D_802874A0; + +extern u16 D_80164714, D_80164716, D_80164718; +extern u16 D_800DC5E4; +extern u32 gGamestate; +extern u32 D_802874FC; + +extern u16 D_800DC518; + +#endif diff --git a/src/code_80280650.c b/src/code_80280650.c index 66c42dcae..898c420c0 100644 --- a/src/code_80280650.c +++ b/src/code_80280650.c @@ -3,6 +3,7 @@ #include #include #include "main.h" +#include "variables.h" #include "code_8001F980.h" #include "code_80280650.h" diff --git a/src/code_80280650.h b/src/code_80280650.h index a4d1232a7..b8e8c0f47 100644 --- a/src/code_80280650.h +++ b/src/code_80280650.h @@ -1,6 +1,8 @@ #ifndef CODE_80280650_H #define CODE_80280650_H +#include "common_structs.h" + struct UnkStruct_80280658 { s32 unk0; s16 unk4; @@ -73,7 +75,7 @@ f32 func_8028080C(); f32 func_80280850(f32); void func_80280884(); void func_8028093C(struct UnkStruct_80280658*); -void func_80280A28(Vec3f, Vec3s, f32); +void func_80280A28(Vec3f, Vec3s, f32 ); void func_80280FA0(s32); void func_80280FA8(s32); void func_80280FB0(); @@ -85,7 +87,7 @@ void func_80281528(); void func_80281530(); void func_80281538(); void func_80281540(); -void func_80281548(); +void ending_sequence_loop(); extern struct UnkStruct_80280658 *D_802874F8; extern struct UnkStruct_80280658 *D_80284E7C; @@ -96,7 +98,6 @@ extern s32 D_80284E88; extern s32 D_802874E0; extern s8 D_802874F4; extern s32 D_802874D4; -extern s16 D_80150112; extern s32 D_802874FC; extern Mat4 D_80287500; extern s16 D_80164AF0; diff --git a/src/code_80281780.c b/src/code_80281780.c index 352154834..ac0b980a9 100644 --- a/src/code_80281780.c +++ b/src/code_80281780.c @@ -4,25 +4,14 @@ #include "variables.h" #include #include - +#include "memory.h" +#include "camera.h" +#include "spawn_players.h" +#include "skybox_and_splitscreen.h" +#include "code_8006E9C0.h" +#include "code_80280650.h" #include "code_80281780.h" -extern Camera cameras[]; - -extern s32 gPrevLoadedAddress; - -/* -extern Gfx D_070067E8[]; -extern Gfx D_0700AEF8[]; -extern Gfx D_0700A970[]; -extern Gfx D_0700AC30[]; -extern Gfx D_07000CE0[]; -extern Gfx D_07000E88[]; -extern Gfx D_0700A618[]; -extern Gfx D_070023F8[]; -extern Gfx D_07002478[]; -*/ - // unk4 is buttonDown? void func_80281780(void) { if (gEnableDebugMode != 0) { diff --git a/src/code_80281780.h b/src/code_80281780.h index 5c79ffec7..5126e1bf3 100644 --- a/src/code_80281780.h +++ b/src/code_80281780.h @@ -1,23 +1,25 @@ #ifndef CODE_80281780_H #define CODE_80281780_H -// variables found in code_80281780.c; not necessarily ones that belong there -extern void func_802A4D18(); -extern void func_802A74BC(); -extern void load_course(); -extern u32 set_segment_base_addr(); +/* Function Prototypes */ + +void func_80281780(void); +s32 func_80281880(s32 arg0); +void func_802818BC(void); +void load_ending_sequence_royalraceway(void); + + extern int func_802AA88C(); -extern void func_802AF5AC(); -extern void func_80295C6C(); -extern void func_80281780(); -extern void func_802818BC(); -extern void func_8003D080(); -extern void func_8006E9C0(); -extern void func_8001C05C(); -extern void func_80280FB0(); -extern void func_802816B8(); +extern u32 set_segment_base_addr(); +extern void load_course(); + extern void func_80093E60(); -extern void *gHeapEndPtr; + +extern void func_802816B8(); + +extern void func_80295C6C(); + +extern void func_802A4D18(); extern s16 gCurrentCourseId; extern u16 D_800DC5B4; @@ -35,7 +37,6 @@ extern s32 D_80287554; extern f32 D_801647A4; extern f32 D_80150130[]; -extern s32 gPrevLoadedAddress; extern s32 D_8015F734; extern s32 D_8015F730; @@ -44,9 +45,9 @@ extern f32 D_8015F8E4; extern s16 D_8015F6EA; extern s16 D_8015F6EE; extern s16 D_8015F6F2; -extern u16 D_8015F6E8; -extern u16 D_8015F6EC; // s16 or u16? -extern u16 D_8015F6F0; +extern s16 D_8015F6E8; +extern s16 D_8015F6EC; // s16 or u16? +extern s16 D_8015F6F0; extern s32 D_8015F59C; extern s32 D_8015F5A0; extern s32 D_8015F58C; diff --git a/src/code_80281C40.c b/src/code_80281C40.c index 708b2869a..c1e63d3cb 100644 --- a/src/code_80281C40.c +++ b/src/code_80281C40.c @@ -2,28 +2,15 @@ #include #include #include "main.h" +#include "math_util.h" +#include "skybox_and_splitscreen.h" +#include "code_800431B0.h" +#include "code_80057C60.h" +#include "code_80091750.h" +#include "code_80280650.h" +#include "code_80281C40.h" +#include "code_80281FA0.h" -extern Gfx *gDisplayListHead; - -struct UnkStruct80287560 { - s16 unk0; - s16 unk2; - s32 unk4; - s32 unk8; -}; // 0xC - -extern struct UnkStruct80287560 D_80287560[]; -extern s32 D_802874FC; - -extern u32 gMenuSelectionFromEndingSequence; -extern s32 D_80287554; -extern u16 gIsInQuitToMenuTransition; -extern Gfx D_00284F70[]; -extern Gfx D_00284EE0[]; - -extern f32 D_80150148, D_8015014C, D_80150150; - -extern f32 D_80150130[]; void func_80281C40(void) { s32 i; diff --git a/src/code_80281C40.h b/src/code_80281C40.h new file mode 100644 index 000000000..d150bb76d --- /dev/null +++ b/src/code_80281C40.h @@ -0,0 +1,30 @@ +#ifndef CODE_80281C40_H +#define CODE_80281C40_h + +struct UnkStruct80287560 { + s16 unk0; + s16 unk2; + s32 unk4; + s32 unk8; +}; // 0xC + +/* Function Prototypes */ + +void func_80281C40(); +void func_80281CB4(s32, s32, s32, s32); +void func_80281D00(); + +extern struct UnkStruct80287560 D_80287560[]; +extern s32 D_802874FC; + +extern u32 gMenuSelectionFromEndingSequence; +extern s32 D_80287554; +extern u16 gIsInQuitToMenuTransition; +extern Gfx D_00284F70[]; +extern Gfx D_00284EE0[]; + +extern f32 D_80150148, D_8015014C, D_80150150; + +extern f32 D_80150130[]; + +#endif diff --git a/src/kart_dma.c b/src/kart_dma.c index d4daa2ad6..88c05294a 100644 --- a/src/kart_dma.c +++ b/src/kart_dma.c @@ -4,7 +4,7 @@ #include "variables.h" #include "framebuffers.h" #include "common_structs.h" -#include "code_80027040.h" +#include "kart_dma.h" uintptr_t **gKartMarioTable0[] = { gKartMarioGroup8, gKartMarioGroup7, gKartMarioGroup6, diff --git a/src/code_80027040.h b/src/kart_dma.h similarity index 97% rename from src/code_80027040.h rename to src/kart_dma.h index b19ef62f2..a1503888c 100644 --- a/src/code_80027040.h +++ b/src/kart_dma.h @@ -1,5 +1,5 @@ -#ifndef CODE_80027040_H -#define CODE_80027040_H +#ifndef KART_DMA_H +#define KART_DMA_H #include "macros.h" #include "common_structs.h" @@ -9,8 +9,8 @@ void func_80027040(Player*, s8, s8, s8, s8); void func_80027560(Player*, s8, s8, s8, s8); void func_80027A20(Player*, s8, s8, s8); -void func_80027BDC(UNUSED Player*, s32, void*, u16); -void func_80027C74(UNUSED Player*, s32, void*, u16); +void func_80027BDC(Player*, s32, void*, u16); +void func_80027C74(Player*, s32, void*, u16); /* This is where I'd put my static data, if I had any */ diff --git a/src/main.c b/src/main.c index 9b2b84743..2a9c5e6e7 100644 --- a/src/main.c +++ b/src/main.c @@ -12,23 +12,22 @@ #include "common_structs.h" #include #include "framebuffers.h" +#include "camera.h" +#include "profiler.h" +#include "race_logic.h" +#include "skybox_and_splitscreen.h" +#include "code_800431B0.h" +#include "code_8008C1D0.h" +#include "code_80281780.h" // Declarations (not in this file) -void func_8008C214(void); void func_80091B78(void); -void func_802A4D18(void); -void init_rdp(void); -void set_viewport(void); -void select_framebuffer(void); -void init_z_buffer(void); + void audio_init(); -void profiler_log_gfx_time(enum ProfilerGfxEvent eventID); -void profiler_log_vblank_time(void); + void create_debug_thread(void); void start_debug_thread(void); -extern void func_80290B14(); -extern void func_80057A50(s32 arg0, s32 arg1, char arg2[8], s16 arg3); struct SPTask *create_next_audio_frame_task(void); @@ -182,55 +181,6 @@ UNUSED s16 D_800DC590 = 0; f32 gVBlankTimer = 0.0f; f32 gCourseTimer = 0.0f; - -extern u64 rspbootTextStart[], rspbootTextEnd[]; -extern u64 gspF3DEXTextStart[], gspF3DEXTextEnd[]; -extern u64 gspF3DLXTextStart[], gspF3DLXTextEnd[]; -extern u64 gspF3DEXDataStart[]; -extern u64 gspF3DLXDataStart[]; - -extern u64 gGfxSPTaskOutputBuffer[]; -extern u32 gGfxSPTaskOutputBufferSize; - -extern u32 gPrevLoadedAddress; -extern u32 D_8015F734; -extern u8 _data_segment2SegmentRomStart[]; -extern u8 _data_segment2SegmentRomEnd[]; -extern u8 _common_texturesSegmentRomStart[]; -extern u8 _common_texturesSegmentRomEnd[]; -extern u8 _data_802BA370SegmentRomStart[]; -extern u32 gHeapEndPtr; -extern u32 *D_801978D0; // Segment? Keeps track of segmented addresses? - - - -//extern u16 gFramebuffer0; -//extern u16 gFramebuffer1; -//extern u16 gFramebuffer2; - -extern s16 gCurrentlyLoadedCourseId; -extern s16 gCurrentCourseId; - -extern u16 D_80164AF0; -extern u16 D_800DC5FC; -extern u16 gIsInQuitToMenuTransition; - - -extern s32 D_8015F788; -extern s16 D_801625E8; -extern struct UnkStruct_800DC5EC *D_800DC5EC; - - -extern Camera *camera1; -extern Camera *camera2; -extern Camera *camera3; -extern Camera *camera4; - -extern u16 D_800DC5B0; -extern s32 gPlayerWinningIndex; - -extern s32 gEnableResourceMeters; - void create_thread(OSThread *thread, OSId id, void (*entry)(void *), void *arg, void *sp, OSPri pri) { thread->next = NULL; thread->queue = NULL; @@ -1160,12 +1110,12 @@ void thread5_game_loop(UNUSED void *arg) { set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg) OS_EVENT_SW2); // These variables track stats such as player wins. // In the event of a console reset, it remembers them. - gNmiUnknown1 = (s32) pAppNmiBuffer; - gNmiUnknown2 = (s32) pAppNmiBuffer + 2; - gNmiUnknown3 = (s32) pAppNmiBuffer + 11; - gNmiUnknown4 = (s32) pAppNmiBuffer + 23; - gNmiUnknown5 = (s32) pAppNmiBuffer + 25; - gNmiUnknown6 = (s32) pAppNmiBuffer + 28; + gNmiUnknown1 = &pAppNmiBuffer[0]; // 2 u8's, tracks number of times player 1/2 won a VS race + gNmiUnknown2 = &pAppNmiBuffer[2]; // 9 u8's, 3x3, tracks number of times player 1/2/3 has placed in 1st/2nd/3rd in a VS race + gNmiUnknown3 = &pAppNmiBuffer[11]; // 12 u8's, 4x3, tracks number of times player 1/2/3/4 has placed in 1st/2nd/3rd in a VS race + gNmiUnknown4 = &pAppNmiBuffer[23]; // 2 u8's, tracking number of Battle mode wins by player 1/2 + gNmiUnknown5 = &pAppNmiBuffer[25]; // 3 u8's, tracking number of Battle mode wins by player 1/2/3 + gNmiUnknown6 = &pAppNmiBuffer[28]; // 4 u8's, tracking number of Battle mode wins by player 1/2/3/4 rendering_init(); read_controllers(); func_800C5CB8(); @@ -1210,4 +1160,4 @@ void thread4_audio(UNUSED void *arg) { } profiler_log_thread4_time(); } -} \ No newline at end of file +} diff --git a/src/main.h b/src/main.h index ff92c4197..d6d7c8feb 100644 --- a/src/main.h +++ b/src/main.h @@ -40,6 +40,8 @@ void init_seg_80280000(); void init_seg_8028DF00(); void dma_copy(u8*, u8*, u32); void setup_game_memory(); +void game_init_clear_framebuffer(); +void race_logic_loop(); void game_state_handler(); void interrupt_gfx_sptask(); void receive_new_tasks(); @@ -67,10 +69,51 @@ extern OSMesgQueue gDmaMesgQueue; extern s32 gGamestateNext; extern s32 gActiveScreenMode; extern f32 gVBlankTimer; -extern uintptr_t pAppNmiBuffer; -extern s32 gNmiUnknown1, gNmiUnknown2, gNmiUnknown3, gNmiUnknown4, gNmiUnknown5, gNmiUnknown6; +extern u8 *pAppNmiBuffer; +extern u8 *gNmiUnknown1; +extern u8 *gNmiUnknown2; +extern u8 *gNmiUnknown3; +extern u8 *gNmiUnknown4; +extern u8 *gNmiUnknown5; +extern u8 *gNmiUnknown6; extern s32 gScreenModeSelection; extern s16 sIsController1Unplugged; +extern u64 rspbootTextStart[], rspbootTextEnd[]; +extern u64 gspF3DEXTextStart[], gspF3DEXTextEnd[]; +extern u64 gspF3DLXTextStart[], gspF3DLXTextEnd[]; +extern u64 gspF3DEXDataStart[]; +extern u64 gspF3DLXDataStart[]; + +extern u64 gGfxSPTaskOutputBuffer[]; +extern u32 gGfxSPTaskOutputBufferSize; + +extern u32 gPrevLoadedAddress; +extern s32 D_8015F734; +extern u8 _data_segment2SegmentRomStart[]; +extern u8 _data_segment2SegmentRomEnd[]; +extern u8 _common_texturesSegmentRomStart[]; +extern u8 _common_texturesSegmentRomEnd[]; +extern u8 _data_802BA370SegmentRomStart[]; +extern u32 gHeapEndPtr; +extern u32 *D_801978D0; // Segment? Keeps track of segmented addresses? + +extern s16 gCurrentlyLoadedCourseId; +extern s16 gCurrentCourseId; + +extern s16 D_80164AF0; +extern u16 D_800DC5FC; +extern u16 gIsInQuitToMenuTransition; + + +extern s32 D_8015F788; +extern s16 D_801625E8; +extern struct UnkStruct_800DC5EC *D_800DC5EC; + +extern u16 D_800DC5B0; +extern s32 gPlayerWinningIndex; + +extern s32 gEnableResourceMeters; + #endif diff --git a/src/math_util.h b/src/math_util.h index 0289a2e02..b193ad80a 100644 --- a/src/math_util.h +++ b/src/math_util.h @@ -35,6 +35,7 @@ void func_802B5A44(Mat4, s16); void func_802B5AAC(Mat4, s16); void func_802B5CAC(s16, s16, Vec3f); void func_802B5D30(s16, s16, s32); +void func_802B5D64(u32, s16, s32, s32); void func_802B5F00(Mat4, f32); void func_802B5F74(Mat4, Vec3f, Vec3s); void func_802B60B4(Mat4, Vec3s, Vec3s); diff --git a/src/memory.c b/src/memory.c index ef2341beb..d95b558e0 100644 --- a/src/memory.c +++ b/src/memory.c @@ -484,8 +484,6 @@ void func_802A8940(Gfx *arg0, u8 *arg1, u8 arg2) { D_802BA270++; } -extern s32 D_802BA270; - // end display list void func_802A89C0(Gfx *arg0, u8 arg1, u8 arg2) { arg0[D_802BA270].words.w0 = G_ENDDL << 24; @@ -4233,14 +4231,6 @@ block_12: GLOBAL_ASM("asm/non_matchings/memory/func_802AF5D8.s") #endif -//#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 - -struct UnkStruct802AF7B4 { - s32 unk0; - s32 unk4; -}; - void func_802AF7B4(uintptr_t addr, s32 arg1, s32 arg2) { s32 segment = SEGMENT_NUMBER2(addr); s32 offset = SEGMENT_OFFSET(addr); diff --git a/src/memory.h b/src/memory.h index 9cf97ef17..abda6844a 100644 --- a/src/memory.h +++ b/src/memory.h @@ -15,6 +15,11 @@ struct MainPoolState { struct MainPoolState *prev; }; +struct UnkStruct802AF7B4 { + s32 unk0; + s32 unk4; +}; + struct UnkStruct_802B8CD4 { s16 unk0; s16 unk2; @@ -35,7 +40,7 @@ struct AllocOnlyPool { #define ALIGN4(val) (((val) + 0x3) & ~0x3) -s32 func_802A7B70(s32); +s32 func_802A7B70(s32); uintptr_t set_segment_base_addr(s32, void*); void *get_segment_base_addr(s32); s32 lookup_item(u32); @@ -56,44 +61,51 @@ void *load_segment(s32, u8*, u8*, u32); void *func_802A8190(s32, s32); void func_802A81EC(); struct AllocOnlyPool *alloc_only_pool_init(u32, u32); -u32 func_802A82AC(s32); -s32 func_802A82E4(u8*, u8*); -s32 func_802A8348(s32, s32, s32); -s32 func_802A841C(s32, s32, s32); -s32 func_802A84F4(s32, u32, u32); -u32 MIO0_0F(s32, u32, u32); -void func_802A8844(); -void func_802A884C(Gfx*, u8, s8); -void func_802A8940(Gfx*, u8*, u8); -void func_802A89C0(Gfx*, u8, u8); -void func_802A8A04(Gfx*, u8, u8); -void func_802A8A70(Gfx*, u8, u8); -void func_802A8ADC(Gfx*, u8, u8); -void func_802A8B48(Gfx*, u8, u8); -void func_802A8BB4(Gfx*, u8, u8); -void func_802A8C20(Gfx*, u8, u8); -void func_802A8C8C(Gfx*, u8, u8); -void func_802A8CF8(Gfx*, u8, u8); -void func_802A8D64(Gfx*, u8, u8); -void func_802A8DD0(Gfx*, u8, u8); -void func_802A8E3C(Gfx*, u8, u8); -void func_802A8EA8(Gfx*, u8, u8); -void func_802A8F14(Gfx*, u8, u8); -void func_802A94D8(Gfx*, u8, u8); -void func_802A9544(Gfx*, u8, u8); -void func_802AAAAC(UnkActorInner*); -s8 func_802ABD10(u16); -s16 func_802ABD40(u16); -s16 func_802ABD7C(u16); -s16 func_802ABDB8(u16); -s16 func_802ABDF4(u16); -f32 func_802ABE30(f32, f32, f32, u16); -f32 func_802ABEAC(UnkActorInner*, Vec3f); -void process_shell_collision(Vec3f, f32, Vec3f, f32); -void func_802AC098(UnkActorInner*, Vec3f); -void func_802AD950(UnkActorInner*, f32, f32, f32, f32, f32, f32, f32); -void func_802ADDC8(UnkActorInner*, f32, f32, f32, f32); -f32 func_802AE1C0(f32, f32, f32); +u32 func_802A82AC(s32); +s32 func_802A82E4(u8*, u8*); +s32 func_802A8348(s32, s32, s32); +s32 func_802A841C(s32, s32, s32); +s32 func_802A84F4(s32, u32, u32); +u32 MIO0_0F(s32, u32, u32); +void func_802A8844(); +void func_802A884C(Gfx*, u8, s8); +void func_802A8940(Gfx*, u8*, u8); +void func_802A89C0(Gfx*, u8, u8); +void func_802A8A04(Gfx*, u8, u8); +void func_802A8A70(Gfx*, u8, u8); +void func_802A8ADC(Gfx*, u8, u8); +void func_802A8B48(Gfx*, u8, u8); +void func_802A8BB4(Gfx*, u8, u8); +void func_802A8C20(Gfx*, u8, u8); +void func_802A8C8C(Gfx*, u8, u8); +void func_802A8CF8(Gfx*, u8, u8); +void func_802A8D64(Gfx*, u8, u8); +void func_802A8DD0(Gfx*, u8, u8); +void func_802A8E3C(Gfx*, u8, u8); +void func_802A8EA8(Gfx*, u8, u8); +void func_802A8F14(Gfx*, u8, u8); +void func_802A94D8(Gfx*, u8, u8); +void func_802A9544(Gfx*, u8, u8); +void func_802AAA70(uintptr_t); +void func_802AAAAC(UnkActorInner*); +s8 func_802ABD10(u16); +s16 func_802ABD40(u16); +s16 func_802ABD7C(u16); +s16 func_802ABDB8(u16); +s16 func_802ABDF4(u16); +f32 func_802ABE30(f32, f32, f32, u16); +f32 func_802ABEAC(UnkActorInner*, Vec3f); +void process_shell_collision(Vec3f, f32, Vec3f, f32); +void func_802AC098(UnkActorInner*, f32*); +void func_802AD950(UnkActorInner*, f32, f32, f32, f32, f32, f32, f32); +void func_802ADDC8(UnkActorInner*, f32, f32, f32, f32); +f32 func_802AE1C0(f32, f32, f32); +void func_802AF314(); +void func_802AF588(s32); +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); // main.c extern struct D_80150158 gD_80150158[]; diff --git a/src/race_logic.c b/src/race_logic.c index 9af7faa14..75beba8b9 100644 --- a/src/race_logic.c +++ b/src/race_logic.c @@ -4,8 +4,16 @@ #include #include #include -#include "waypoints.h" #include "camera.h" +#include "waypoints.h" +#include "staff_ghosts.h" +#include "code_800029B0.h" +#include "code_80057C60.h" +#include "code_80071F00.h" +#include "code_80091750.h" +#include "audio/external.h" +#include "race_logic.h" +#include "skybox_and_splitscreen.h" extern Player *gPlayerTwo; extern Player *gPlayerThree; @@ -27,8 +35,8 @@ extern struct UnkStruct_800DC5EC *D_800DC5F0; extern struct UnkStruct_800DC5EC *D_800DC5F4; extern struct UnkStruct_800DC5EC *D_800DC5F8; -extern u8 *gNmiUnknown2; extern u8 *gNmiUnknown1; +extern u8 *gNmiUnknown2; extern u8 *gNmiUnknown3; extern u8 *gNmiUnknown4; extern u8 *gNmiUnknown5; @@ -40,7 +48,6 @@ extern s8 gCupCourseSelection; extern s32 D_800DC544; extern Player gPlayers[]; -extern Player *gPlayerTwo; extern Player *gPlayerOne; extern s32 gLapCountByPlayerId[]; extern s32 D_80150120; @@ -78,38 +85,6 @@ extern s16 D_8015F8F2[]; extern f32 D_8015F8D8; extern f32 D_80150148; -extern void func_800CA118(); -extern void func_800CA49C(); -extern void func_8028E678(); -extern void func_80009B60(); - -extern void func_800CA330(); -extern void func_800CA388(); - -extern void func_80092630(); -extern void func_8028E438(); -extern void func_800C8EF8(); -extern void play_sound2(); -extern void func_80002DAC(); -extern void func_8005C64C(); -extern void func_8028F914(); -extern void func_802A7940(); -extern void func_802A7728(); -extern void func_80078F64(); -extern void func_800925A0(); -extern void func_8028F4E8(); -extern void func_8028EDA8(); -extern void update_player_battle_status(); -extern void update_race_position_data(); -extern void func_8028F970(); -extern void func_8028E298(); -extern void func_80092564(); -extern void func_8028F8BC(); -extern void func_800029B0(); -extern void func_800C8EAC(); -extern void func_800074D4(); -extern void func_80005AE8(); - extern u16 D_8015F894; u16 D_802BA030; @@ -200,9 +175,6 @@ void update_player_battle_status(void) { } } -extern f32 gTimePlayerLastTouchedFinishLine[]; -extern f32 gLapCompletionPercentByPlayerId[]; - void func_8028E298(void) { f32 temp_v0; s32 i; @@ -723,8 +695,6 @@ void func_8028EF28(void) { void func_8028F3E8(void) { } -extern s32 gPlayerPositions[]; // D_801643B8 (position for each player) -extern s16 gPlayerPositionLUT[]; // D_8015F8F0 (player index at each position) // func_8028F3F0 void update_race_position_data(void) { @@ -780,120 +750,97 @@ void func_8028F4E8(void) { } #ifdef MIPS_TO_C +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +extern void *D_800DC5EC; +extern void *D_800DC5F0; +extern void *D_800DC5F4; +extern void *D_800DC5F8; +extern f32 D_802BA034; + void func_8028F588(void) { - s32 temp_f10; - s32 temp_f10_2; - s32 temp_f10_3; - s32 temp_f18; - s32 temp_f18_2; - s32 temp_f6; - s32 temp_f6_2; - s32 temp_f6_3; + s16 var_v0; + s16 var_v0_2; + s16 var_v0_3; + s16 var_v0_4; + s16 var_v0_5; + s16 var_v0_6; + s16 var_v0_7; + s16 var_v0_8; s32 temp_v0; - s16 phi_v0; - s16 phi_v0_2; - s16 phi_v0_3; - s16 phi_v0_4; - s16 phi_v0_5; - s16 phi_v0_6; - s16 phi_v0_7; - s16 phi_v0_8; temp_v0 = gActiveScreenMode; - if (temp_v0 != 0) { - if (temp_v0 != 1) { - if (temp_v0 != 2) { - if (temp_v0 != 3) { - return; - } - temp_f10 = (s32) (160.0f * D_802BA034); - if ((s32) (s16) temp_f10 <= 0) { - phi_v0 = 1; - } else { - phi_v0 = (s16) temp_f10; - if ((s32) (s16) temp_f10 >= 0x140) { - phi_v0 = 0x13C; - } - } - D_800DC5EC->screenWidth = phi_v0; - D_800DC5F0->screenWidth = phi_v0; - D_800DC5F4->screenWidth = phi_v0; - D_800DC5F8->screenWidth = phi_v0; - temp_f6 = (s32) (120.0f * D_802BA034); - if ((s32) (s16) temp_f6 <= 0) { - phi_v0_2 = 1; - } else { - phi_v0_2 = (s16) temp_f6; - if ((s32) (s16) temp_f6 >= 0xF0) { - phi_v0_2 = 0xEC; - } - } - D_800DC5EC->screenHeight = phi_v0_2; - D_800DC5F0->screenHeight = phi_v0_2; - D_800DC5F4->screenHeight = phi_v0_2; - D_800DC5F8->screenHeight = phi_v0_2; - return; - } - temp_f18 = (s32) (160.0f * D_802BA034); - if ((s32) (s16) temp_f18 <= 0) { - phi_v0_3 = 1; - } else { - phi_v0_3 = (s16) temp_f18; - if ((s32) (s16) temp_f18 >= 0x140) { - phi_v0_3 = 0x13C; - } - } - D_800DC5EC->screenWidth = phi_v0_3; - D_800DC5F0->screenWidth = phi_v0_3; - temp_f10_2 = (s32) (240.0f * D_802BA034); - if ((s32) (s16) temp_f10_2 <= 0) { - phi_v0_4 = 1; - } else { - phi_v0_4 = (s16) temp_f10_2; - if ((s32) (s16) temp_f10_2 >= 0x1E0) { - phi_v0_4 = 0x1DC; - } - } - D_800DC5EC->screenHeight = phi_v0_4; - D_800DC5F0->screenHeight = phi_v0_4; - return; + switch (temp_v0) { /* irregular */ + case 0: + var_v0 = (s16) (s32) (320.0f * D_802BA034); + if (var_v0 < 0) { + var_v0 = 1; } - temp_f6_2 = (s32) (320.0f * D_802BA034); - if ((s32) (s16) temp_f6_2 <= 0) { - phi_v0_5 = 1; - } else { - phi_v0_5 = (s16) temp_f6_2; - if ((s32) (s16) temp_f6_2 >= 0x280) { - phi_v0_5 = 0x27C; - } + D_800DC5EC->unk2C = var_v0; + var_v0_2 = (s16) (s32) (240.0f * D_802BA034); + if (var_v0_2 < 0) { + var_v0_2 = 1; } - D_800DC5EC->screenWidth = phi_v0_5; - D_800DC5F0->screenWidth = phi_v0_5; - temp_f18_2 = (s32) (120.0f * D_802BA034); - if ((s32) (s16) temp_f18_2 <= 0) { - phi_v0_6 = 1; - } else { - phi_v0_6 = (s16) temp_f18_2; - if ((s32) (s16) temp_f18_2 >= 0xF0) { - phi_v0_6 = 0xEC; - } + D_800DC5EC->unk2E = var_v0_2; + return; + case 2: + var_v0_3 = (s16) (s32) (160.0f * D_802BA034); + if (var_v0_3 <= 0) { + var_v0_3 = 1; + } else if (var_v0_3 >= 0x140) { + var_v0_3 = 0x013C; } - D_800DC5EC->screenHeight = phi_v0_6; - D_800DC5F0->screenHeight = phi_v0_6; + D_800DC5EC->unk2C = var_v0_3; + D_800DC5F0->unk2C = var_v0_3; + var_v0_4 = (s16) (s32) (240.0f * D_802BA034); + if (var_v0_4 <= 0) { + var_v0_4 = 1; + } else if (var_v0_4 >= 0x1E0) { + var_v0_4 = 0x01DC; + } + D_800DC5EC->unk2E = var_v0_4; + D_800DC5F0->unk2E = var_v0_4; + return; + case 1: + var_v0_5 = (s16) (s32) (320.0f * D_802BA034); + if (var_v0_5 <= 0) { + var_v0_5 = 1; + } else if (var_v0_5 >= 0x280) { + var_v0_5 = 0x027C; + } + D_800DC5EC->unk2C = var_v0_5; + D_800DC5F0->unk2C = var_v0_5; + var_v0_6 = (s16) (s32) (120.0f * D_802BA034); + if (var_v0_6 <= 0) { + var_v0_6 = 1; + } else if (var_v0_6 >= 0xF0) { + var_v0_6 = 0x00EC; + } + D_800DC5EC->unk2E = var_v0_6; + D_800DC5F0->unk2E = var_v0_6; + return; + case 3: + var_v0_7 = (s16) (s32) (160.0f * D_802BA034); + if (var_v0_7 <= 0) { + var_v0_7 = 1; + } else if (var_v0_7 >= 0x140) { + var_v0_7 = 0x013C; + } + D_800DC5EC->unk2C = var_v0_7; + D_800DC5F0->unk2C = var_v0_7; + D_800DC5F4->unk2C = var_v0_7; + D_800DC5F8->unk2C = var_v0_7; + var_v0_8 = (s16) (s32) (120.0f * D_802BA034); + if (var_v0_8 <= 0) { + var_v0_8 = 1; + } else if (var_v0_8 >= 0xF0) { + var_v0_8 = 0x00EC; + } + D_800DC5EC->unk2E = var_v0_8; + D_800DC5F0->unk2E = var_v0_8; + D_800DC5F4->unk2E = var_v0_8; + D_800DC5F8->unk2E = var_v0_8; return; } - temp_f10_3 = (s32) (320.0f * D_802BA034); - phi_v0_7 = (s16) temp_f10_3; - if ((s32) (s16) temp_f10_3 < 0) { - phi_v0_7 = 1; - } - D_800DC5EC->screenWidth = phi_v0_7; - temp_f6_3 = (s32) (240.0f * D_802BA034); - phi_v0_8 = (s16) temp_f6_3; - if ((s32) (s16) temp_f6_3 < 0) { - phi_v0_8 = 1; - } - D_800DC5EC->screenHeight = phi_v0_8; } #else GLOBAL_ASM("asm/non_matchings/race_logic/func_8028F588.s") @@ -916,100 +863,100 @@ void func_8028F914(void) { } #ifdef MIPS_TO_C +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_800029B0(); /* extern */ +? func_80005AE8(Player *); /* extern */ +? func_800C9F90(?); /* extern */ +? play_sound2(?); /* extern */ +extern s32 D_80162DF0; +extern void *gControllerOne; +static u16 D_800DC5A8; /* unable to generate initializer */ + void func_8028F970(void) { Player *temp_a0; Player *temp_a0_2; Player *temp_a0_3; - s32 temp_s2; - struct Controller *temp_a1; + Player *var_s3; + s32 var_s2; struct Controller *temp_s0; u16 temp_t7; u16 temp_v0; u16 temp_v0_2; u16 temp_v0_3; - Player *phi_s3; - s32 phi_s2; - u16 phi_a0; + void *temp_a1; if (D_8015F890 == 0) { - phi_s3 = gPlayers; - phi_s2 = 0; + var_s3 = gPlayers; + var_s2 = 0; loop_2: - temp_v0 = phi_s3->unk_000; - if (((temp_v0 & PLAYER_HUMAN) != 0) && ((temp_v0 & PLAYER_CPU) == 0)) { - temp_s0 = &gControllers[phi_s2]; + temp_v0 = var_s3->unk_000; + if ((temp_v0 & 0x4000) && !(temp_v0 & 0x1000)) { + temp_s0 = &gControllers[var_s2]; if (gActiveScreenMode != 3) { temp_v0_2 = temp_s0->buttonPressed; - if (((temp_v0_2 & 0x20) != 0) && ((temp_s0->button & 0x10) == 0)) { + if ((temp_v0_2 & 0x20) && !(temp_s0->button & 0x10)) { temp_s0->buttonPressed = temp_v0_2 & 0xFFDF; temp_t7 = D_800DC5A8 + 1; D_800DC5A8 = temp_t7; if ((temp_t7 & 0xFFFF) >= 3) { - D_800DC5A8 = 0U; + D_800DC5A8 = 0; } play_sound2(0x4900801C); func_800029B0(); } } - if (((temp_s0->buttonPressed & 0x1000) != 0) && (temp_v0_3 = temp_s0->button, ((temp_v0_3 & 0x10) == 0)) && ((temp_v0_3 & 0x20) == 0)) { + if ((temp_s0->buttonPressed & 0x1000) && (temp_v0_3 = temp_s0->button, ((temp_v0_3 & 0x10) == 0)) && !(temp_v0_3 & 0x20)) { func_8028DF00(); - D_800DC5FC = (s16) (((s32) (temp_s0 - gControllerOne) >> 4) + 1); + D_800DC5FC = ((s32) (temp_s0 - gControllerOne) >> 4) + 1; temp_s0->buttonPressed = 0; func_800C9F90(1); D_80162DF0 = 1; - if (gModeSelection == TIME_TRIALS) { + if (gModeSelection == 1) { temp_a0 = gPlayerOne; - if ((temp_a0->unk_000 & 0x8100) != 0) { + if (temp_a0->unk_000 & 0x8100) { func_80005AE8(temp_a0); } temp_a0_2 = gPlayerTwo; - if ((temp_a0_2->unk_000 & 0x8100) != 0) { + if (temp_a0_2->unk_000 & 0x8100) { func_80005AE8(temp_a0_2); } temp_a0_3 = gPlayerThree; - if ((temp_a0_3->unk_000 & 0x8100) != 0) { + if (temp_a0_3->unk_000 & 0x8100) { func_80005AE8(temp_a0_3); - return; } - // Duplicate return node #29. Try simplifying control flow for better match - return; } - // Duplicate return node #29. Try simplifying control flow for better match - return; + } else { + goto block_20; } - goto block_20; - } + } else { block_20: - temp_s2 = phi_s2 + 1; - phi_s3 += 0xDD8; - phi_s2 = temp_s2; - if (temp_s2 == 4) { - if ((gEnableDebugMode != 0) && (gModeSelection != BATTLE)) { - temp_a1 = gControllerOne; - if ((temp_a1->buttonPressed & 0x800) != 0) { - gLapCountByPlayerId->unk0 = 2; - } - phi_a0 = temp_a1->buttonPressed; - if ((temp_a1->buttonPressed & 0x100) != 0) { - gLapCountByPlayerId->unk0 = 2; - gLapCountByPlayerId->unk4 = 2; - phi_a0 = temp_a1->buttonPressed; - } - if ((phi_a0 & 0x400) != 0) { - gLapCountByPlayerId->unk0 = 2; - gLapCountByPlayerId->unk4 = 2; - gLapCountByPlayerId->unk8 = 2; - gLapCountByPlayerId->unkC = 2; - gLapCountByPlayerId->unk10 = 2; - gLapCountByPlayerId->unk14 = 2; - gLapCountByPlayerId->unk18 = 2; - gLapCountByPlayerId->unk1C = 2; + var_s2 += 1; + var_s3 += 0xDD8; + if (var_s2 == 4) { + if ((gEnableDebugMode != 0) && (gModeSelection != 3)) { + temp_a1 = gControllerOne; + if (temp_a1->unk6 & 0x800) { + gLapCountByPlayerId->unk0 = 2; + } + if (temp_a1->unk6 & 0x100) { + gLapCountByPlayerId->unk0 = 2; + gLapCountByPlayerId->unk4 = 2; + } + if (temp_a1->unk6 & 0x400) { + gLapCountByPlayerId->unk0 = 2; + gLapCountByPlayerId->unk4 = 2; + gLapCountByPlayerId->unk8 = 2; + gLapCountByPlayerId->unkC = 2; + gLapCountByPlayerId->unk10 = 2; + gLapCountByPlayerId->unk14 = 2; + gLapCountByPlayerId->unk18 = 2; + gLapCountByPlayerId->unk1C = 2; + } } + } else { + goto loop_2; } - // Duplicate return node #29. Try simplifying control flow for better match - return; } - goto loop_2; } } #else @@ -1043,7 +990,6 @@ void func_8028FC34(void) { gMenuSelection = LOGO_INTRO_MENU; } } -extern u16 D_80162DD6; void func_8028FCBC(void) { Player *ply = &gPlayers[0]; @@ -1255,7 +1201,14 @@ void func_802903B0(void) { } #ifdef MIPS_TO_C -void func_802903D8(u16 *arg0, u16 *arg1) { +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +static f32 D_802B92A0 = 0.1f; +static f32 D_802B92A4 = 0.2f; +static f32 D_802B92A8 = 0.55f; +static f64 D_802B92B0 = 0.85; +static ? gFloatArray802B8790; /* unable to generate initializer */ + +void func_802903D8(Player *player_one, Player *player_two) { f32 sp74; f32 sp70; f32 sp68; @@ -1264,14 +1217,12 @@ void func_802903D8(u16 *arg0, u16 *arg1) { f32 sp5C; f32 sp58; f32 sp54; - ? sp28; f32 sp24; f32 sp20; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; f32 temp_f0_4; - f32 temp_f0_5; f32 temp_f14; f32 temp_f16; f32 temp_f2; @@ -1280,119 +1231,102 @@ void func_802903D8(u16 *arg0, u16 *arg1) { f32 temp_f6; f32 temp_f6_2; s32 temp_v0; - u16 *temp_a0; - u16 *temp_a2; - u16 *temp_a3; - u16 *phi_a3; - u16 *phi_a2; - temp_f4 = (arg0->unk70 + arg1->unk70) - 5.0f; - temp_a3 = arg0; - temp_a2 = arg1; + temp_f4 = (player_one->boundingBoxSize + player_two->boundingBoxSize) - 5.0f; sp74 = temp_f4; - sp28.unk0 = (s32) gFloatArray802B8790.unk0; - sp28.unk4 = (s32) gFloatArray802B8790.unk4; - sp28.unk8 = (s32) gFloatArray802B8790.unk8; - sp28.unkC = (s32) gFloatArray802B8790.unkC; - sp28.unk10 = (s32) gFloatArray802B8790.unk10; - sp28.unk14 = (s32) gFloatArray802B8790.unk14; - sp28.unk18 = (s32) gFloatArray802B8790.unk18; - sp28.unk1C = (s32) gFloatArray802B8790.unk1C; - sp24 = *(&sp28 + (arg0->unk254 * 4)); - sp20 = *(&sp28 + (arg1->unk254 * 4)); - sp60 = arg0->unk14 - arg1->unk14; - temp_f6 = (arg0->unk18 - arg0->unk70) - (arg1->unk18 - arg1->unk70); + sp28[0].unk0 = gFloatArray802B8790.unk0; + sp28[0].unk4 = (s32) gFloatArray802B8790.unk4; + sp28[0].unk8 = (s32) gFloatArray802B8790.unk8; + sp28[0].unkC = (s32) gFloatArray802B8790.unkC; + sp28[0].unk10 = (s32) gFloatArray802B8790.unk10; + sp28[0].unk14 = (s32) gFloatArray802B8790.unk14; + sp28[0].unk18 = (s32) gFloatArray802B8790.unk18; + sp28[0].unk1C = (s32) gFloatArray802B8790.unk1C; + sp24 = (&sp28[0])[player_one->characterId]; + sp20 = (&sp28[0])[player_two->characterId]; + sp60 = player_one->pos[0] - player_two->pos[0]; + temp_f6 = (player_one->pos[1] - player_one->boundingBoxSize) - (player_two->pos[1] - player_two->boundingBoxSize); sp64 = temp_f6; - sp68 = arg0->unk1C - arg1->unk1C; - sp54 = arg1->unk34 - arg0->unk34; - sp58 = arg1->unk38 - arg0->unk38; - sp5C = arg1->unk3C - arg0->unk3C; - temp_f0 = (sp68 * sp68) + ((sp60 * sp60) + (temp_f6 * temp_f6)); - temp_f0_2 = sqrtf(temp_f0); - if (!(temp_f0_2 < D_802B92A0) && !(temp_f4 < temp_f0_2)) { - if ((arg0->unk0 & 0x40) != 0) { - if ((arg1->unk0 & 0x40) != 0) { - func_8008FC1C(temp_f0_2, temp_a2, temp_a3); - func_8008FC1C((bitwise f32) arg1); - func_800C9060(((s32) (arg1 - gPlayerOne) / 0xDD8) & 0xFF, 6.643295e-24f, arg1); + sp68 = player_one->pos[2] - player_two->pos[2]; + sp54 = player_two->unk_034[0] - player_one->unk_034[0]; + sp58 = player_two->unk_034[1] - player_one->unk_034[1]; + sp5C = player_two->unk_034[2] - player_one->unk_034[2]; + temp_f0 = sqrtf((sp68 * sp68) + ((sp60 * sp60) + (temp_f6 * temp_f6))); + if (!(temp_f0 < D_802B92A0) && !(temp_f4 < temp_f0)) { + if (player_one->unk_000 & 0x40) { + if (player_two->unk_000 & 0x40) { + func_8008FC1C(player_one); + func_8008FC1C(player_two); + func_800C9060(((s32) (player_two - gPlayerOne) / 3544) & 0xFF, 0x19008001U); return; } - temp_a0 = temp_a3; - temp_a2->unkC = (s32) (temp_a2->unkC | 0x400000); - sp70 = temp_f0_2; - arg0 = temp_a3; - arg1 = temp_a2; - func_8008FC1C(temp_f0_2, temp_a0, temp_a2, temp_a3); - func_800C9060(((s32) (arg1 - gPlayerOne) / 0xDD8) & 0xFF, 6.643295e-24f, arg1); - phi_a3 = arg0; - phi_a2 = arg1; + player_two->unk_00C |= 0x400000; + sp70 = temp_f0; + func_8008FC1C(player_one); + func_800C9060(((s32) (player_two - gPlayerOne) / 3544) & 0xFF, 0x19008001U); goto block_8; } - phi_a3 = temp_a3; - phi_a2 = temp_a2; - if ((temp_a2->unk0 & 0x40) != 0) { - temp_a3->unkC = (s32) (temp_a3->unkC | 0x400000); - arg0 = temp_a3; - func_8008FC1C(temp_f0_2, temp_a2, temp_a2, temp_a3); - func_800C9060(((s32) (arg0 - gPlayerOne) / 0xDD8) & 0xFF, 6.643295e-24f); + if (player_two->unk_000 & 0x40) { + player_one->unk_00C |= 0x400000; + func_8008FC1C(player_two); + func_800C9060(((s32) (player_one - gPlayerOne) / 3544) & 0xFF, 0x19008001U); return; } block_8: - temp_v0 = phi_a3->unkBC; - if ((temp_v0 & 0x200) != 0) { - if ((phi_a2->unkBC & 0x200) == 0) { - phi_a2->unkC = (s32) (phi_a2->unkC | 0x1000000); + temp_v0 = player_one->unk_0BC; + if (temp_v0 & 0x200) { + if (!(player_two->unk_0BC & 0x200)) { + player_two->unk_00C |= 0x01000000; } - } else if ((phi_a2->unkBC & 0x200) != 0) { - phi_a3->unkC = (s32) (phi_a3->unkC | 0x1000000); + } else if (player_two->unk_0BC & 0x200) { + player_one->unk_00C |= 0x01000000; } else { - phi_a3->unkBC = (s32) (temp_v0 | 0x8000); - phi_a2->unkBC = (s32) (phi_a2->unkBC | 0x8000); + player_one->unk_0BC = temp_v0 | 0x8000; + player_two->unk_0BC |= 0x8000; } - temp_f6_2 = sp60 / sqrtf(temp_f0); - temp_f0_3 = sqrtf((sp5C * sp5C) + ((sp54 * sp54) + (sp58 * sp58))); + temp_f6_2 = sp60 / temp_f0; + temp_f0_2 = sqrtf((sp5C * sp5C) + ((sp54 * sp54) + (sp58 * sp58))); sp60 = temp_f6_2; - sp64 /= sqrtf(temp_f0); - sp68 /= sqrtf(temp_f0); - if (temp_f0_3 < D_802B92A4) { - temp_f14 = (phi_a3->unk70 + phi_a2->unk70) * D_802B92A8; - phi_a3->unk14 = (f32) ((temp_f6_2 * temp_f14) + phi_a2->unk14); - phi_a3->unk18 = (f32) ((sp64 * temp_f14) + phi_a2->unk18); - phi_a3->unk1C = (f32) ((sp68 * temp_f14) + phi_a2->unk1C); - phi_a2->unk14 = (f32) (phi_a2->unk14 - (temp_f14 * sp60)); - phi_a2->unk18 = (f32) (phi_a2->unk18 - (temp_f14 * sp64)); - phi_a2->unk1C = (f32) (phi_a2->unk1C - (temp_f14 * sp68)); + sp64 /= temp_f0; + sp68 /= temp_f0; + if (temp_f0_2 < D_802B92A4) { + temp_f14 = (player_one->boundingBoxSize + player_two->boundingBoxSize) * D_802B92A8; + player_one->pos[0] = (temp_f6_2 * temp_f14) + player_two->pos[0]; + player_one->pos[1] = (sp64 * temp_f14) + player_two->pos[1]; + player_one->pos[2] = (sp68 * temp_f14) + player_two->pos[2]; + player_two->pos[0] -= temp_f14 * sp60; + player_two->pos[1] -= temp_f14 * sp64; + player_two->pos[2] -= temp_f14 * sp68; return; } - temp_f16 = (f32) ((f64) (temp_f0_3 * (((sp5C * sp68) + ((sp60 * sp54) + (sp64 * sp58))) / temp_f0_3)) * D_802B92B0); - if ((phi_a3->unkBC & 0x200) != 0x200) { + temp_f16 = (f32) ((f64) (temp_f0_2 * (((sp5C * sp68) + ((sp60 * sp54) + (sp64 * sp58))) / temp_f0_2)) * D_802B92B0); + if ((player_one->unk_0BC & 0x200) != 0x200) { temp_f2 = (temp_f16 * sp20) / sp24; - phi_a3->unk34 = (f32) (phi_a3->unk34 + (sp60 * temp_f2)); - phi_a3->unk38 = (f32) (phi_a3->unk38 + (sp64 * temp_f2)); - phi_a3->unk3C = (f32) (phi_a3->unk3C + (sp68 * temp_f2)); - temp_f0_4 = sqrtf(temp_f0) - sp74; - phi_a3->unk14 = (f32) (phi_a3->unk14 - (sp60 * temp_f0_4 * 0.5f)); - phi_a3->unk18 = (f32) (phi_a3->unk18 - (sp64 * temp_f0_4 * 0.5f)); - phi_a3->unk1C = (f32) (phi_a3->unk1C - (sp68 * temp_f0_4 * 0.5f)); + player_one->unk_034[0] += sp60 * temp_f2; + player_one->unk_034[1] += sp64 * temp_f2; + player_one->unk_034[2] += sp68 * temp_f2; + temp_f0_3 = temp_f0 - sp74; + player_one->pos[0] -= sp60 * temp_f0_3 * 0.5f; + player_one->pos[1] -= sp64 * temp_f0_3 * 0.5f; + player_one->pos[2] -= sp68 * temp_f0_3 * 0.5f; } - if ((phi_a2->unkBC & 0x200) != 0x200) { + if ((player_two->unk_0BC & 0x200) != 0x200) { temp_f2_2 = (temp_f16 * sp24) / sp20; - phi_a2->unk34 = (f32) (phi_a2->unk34 - (sp60 * temp_f2_2)); - phi_a2->unk38 = (f32) (phi_a2->unk38 - (sp64 * temp_f2_2)); - phi_a2->unk3C = (f32) (phi_a2->unk3C - (sp68 * temp_f2_2)); - temp_f0_5 = sqrtf(temp_f0) - sp74; - phi_a2->unk14 = (f32) (phi_a2->unk14 + (sp60 * temp_f0_5 * 0.5f)); - phi_a2->unk18 = (f32) (phi_a2->unk18 + (sp64 * temp_f0_5 * 0.5f)); - phi_a2->unk1C = (f32) (phi_a2->unk1C + (sp68 * temp_f0_5 * 0.5f)); + player_two->unk_034[0] -= sp60 * temp_f2_2; + player_two->unk_034[1] -= sp64 * temp_f2_2; + player_two->unk_034[2] -= sp68 * temp_f2_2; + temp_f0_4 = temp_f0 - sp74; + player_two->pos[0] += sp60 * temp_f0_4 * 0.5f; + player_two->pos[1] += sp64 * temp_f0_4 * 0.5f; + player_two->pos[2] += sp68 * temp_f0_4 * 0.5f; } - if ((phi_a3->unk0 & 0x4000) != 0) { - func_800C9060((bitwise s32) 0.5f, sqrtf(temp_f0), (u16 *) (((s32) (phi_a3 - gPlayerOne) / 0xDD8) & 0xFF), 0x19008001, phi_a2, phi_a3); + if (player_one->unk_000 & 0x4000) { + func_800C9060(((s32) (player_one - gPlayerOne) / 3544) & 0xFF, 0x19008001U); return; } - if ((phi_a2->unk0 & 0x4000) != 0) { - func_800C9060((bitwise s32) 0.5f, sqrtf(temp_f0), (u16 *) (((s32) (phi_a2 - gPlayerOne) / 0xDD8) & 0xFF), 0x19008001, phi_a2, phi_a3); + if (player_two->unk_000 & 0x4000) { + func_800C9060(((s32) (player_two - gPlayerOne) / 3544) & 0xFF, 0x19008001U); } - // Duplicate return node #24. Try simplifying control flow for better match } } #else diff --git a/src/race_logic.h b/src/race_logic.h new file mode 100644 index 000000000..21c99917c --- /dev/null +++ b/src/race_logic.h @@ -0,0 +1,44 @@ +#ifndef RACE_LOGIC_H +#define RACE_LOGIC_H + +/* Function Prototypes */ + +void func_8028DF00(); +void func_8028DF38(); +void func_8028E028(); +void update_player_battle_status(); +void func_8028E298(); +void func_8028E3A0(); +void func_8028E438(); +void func_8028E678(); +void func_8028EC38(s32); +void func_8028EC98(s32); +void func_8028EDA8(); +f32 func_8028EE8C(s32); +void func_8028EEF0(s32); +void func_8028EF28(); +void func_8028F3E8(); +void update_race_position_data(); +void func_8028F474(); +void func_8028F4E8(); +void func_8028F8BC(); +void func_8028F914(); +void func_8028F970(); +void func_8028FBD4(); +void func_8028FC34(); +void func_8028FCBC(); +void func_80290314(); +void func_80290338(); +void func_80290360(); +void func_80290388(); +void func_802903B0(); +void func_802909F0(); +void func_80290B14(); + +extern f32 gTimePlayerLastTouchedFinishLine[]; +extern f32 gLapCompletionPercentByPlayerId[]; +extern s32 gPlayerPositions[]; // D_801643B8 (position for each player) +extern s16 gPlayerPositionLUT[]; // D_8015F8F0 (player index at each position) +extern u16 D_80162DD6; + +#endif diff --git a/src/render_courses.c b/src/render_courses.c index c87c9b18d..9fdaa05d3 100644 --- a/src/render_courses.c +++ b/src/render_courses.c @@ -3,35 +3,11 @@ #include #include #include - -extern Gfx *gDisplayListHead; -s32 func_80290C20(Camera *camera); -void load_surface_map(s32, struct UnkStruct_800DC5EC *arg1); -extern void func_802B5D64(u32, s16, s32, s32); -extern s16 gCurrentCourseId; -extern s32 gPrevLoadedAddress; -extern s32 gActiveScreenMode; - -extern u16 sRenderedFramebuffer; -extern uintptr_t *gPhysicalFramebuffers[]; -extern uintptr_t gSegmentTable[]; - -extern void func_802AAAAC(Player *); -extern Player gPlayers[]; - -extern s32 D_8015F59C; -extern s32 D_8015F5A0; - -extern s32 D_800DC5DC; -extern s32 D_800DC5E0; -extern s16 D_802B87D8; - -void func_80298C94(); // extern -void func_802AF7B4(s32, s32, s32); // extern -extern s32 D_802B87C4; -extern s32 D_802B87C8; -extern s32 D_802B87CC; -void func_802A7658(s32, s32, s32, s32, u16*, u16*); +#include "actors.h" +#include "math_util.h" +#include "memory.h" +#include "code_80281780.h" +#include "render_courses.h" s32 func_80290C20(Camera *camera) { if (camera->unk_54.unk34 == 0) { @@ -46,16 +22,6 @@ s32 func_80290C20(Camera *camera) { return 0; } -void func_802AF5D8(u32, s8, s32); // extern -extern s32 D_8015F5A4; - -struct Unk0CAC { - s32 unk0; - u8 unk4; - u8 unk5; - u16 unk6; -}; - void func_80290CAC(uintptr_t arg0) { s32 segment = SEGMENT_NUMBER2(arg0); s32 offset = SEGMENT_OFFSET(arg0); @@ -218,8 +184,6 @@ void func_80291198(void) { gSPDisplayList(gDisplayListHead++, 0x07001140); } -extern s32 gScreenModeSelection; - void func_802911C4(void) { if (gScreenModeSelection == SCREEN_MODE_1P) { gSPDisplayList(gDisplayListHead++, 0x070008E8); @@ -984,10 +948,6 @@ block_82: GLOBAL_ASM("asm/non_matchings/render_courses/func_8029122C.s") #endif -void func_80291198(); -void func_802911C4(); -extern Gfx mario_raceway_dls[]; - void render_mario_raceway(struct UnkStruct_800DC5EC *arg0) { s32 pad; u16 sp22 = arg0->pathCounter; @@ -1097,13 +1057,6 @@ void render_mario_raceway(struct UnkStruct_800DC5EC *arg0) { gSPDisplayList(gDisplayListHead++, 0x07000160); } -extern s32 D_801625EC; -extern s32 D_801625F0; -extern s32 D_801625F4; -extern s16 D_802B87B0; -extern s16 D_802B87B4; -extern Gfx choco_mountain_dls[]; - void render_choco_mountain(struct UnkStruct_800DC5EC *arg0) { s32 pad[13]; @@ -1146,9 +1099,6 @@ void render_choco_mountain(struct UnkStruct_800DC5EC *arg0) { } -extern s32 D_802B87BC; -extern Gfx bowsers_castle_dls[]; - void render_bowsers_castle(struct UnkStruct_800DC5EC *arg0) { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); @@ -1175,11 +1125,6 @@ void render_bowsers_castle(struct UnkStruct_800DC5EC *arg0) { gSPDisplayList(gDisplayListHead++, 0x07000248); } -extern Gfx banshee_boardwalk_dls[]; -extern Gfx D_0600B278[]; - -extern void mtxf_translate(Mat4 dest, Vec3f b); -extern void func_802B4FF8(Mat4 arg0, s32 arg1); void render_banshee_boardwalk(struct UnkStruct_800DC5EC *arg0) { Camera *camera = arg0->camera; Mat4 spCC; @@ -1231,8 +1176,6 @@ void render_banshee_boardwalk(struct UnkStruct_800DC5EC *arg0) { gDPPipeSync(gDisplayListHead++); } -extern Gfx yoshi_valley_dls; - void render_yoshi_valley(struct UnkStruct_800DC5EC *arg0) { gDPPipeSync(gDisplayListHead++); @@ -1243,8 +1186,6 @@ void render_yoshi_valley(struct UnkStruct_800DC5EC *arg0) { gDPPipeSync(gDisplayListHead++); } -extern u8 frappe_snowland_dls[]; - void render_frappe_snowland(struct UnkStruct_800DC5EC *arg0) { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); @@ -1262,8 +1203,6 @@ void render_frappe_snowland(struct UnkStruct_800DC5EC *arg0) { load_surface_map(&frappe_snowland_dls, arg0); } -extern Gfx koopa_troopa_beach_dls[]; - void render_koopa_troopa_beach(struct UnkStruct_800DC5EC *arg0) { gDPPipeSync(gDisplayListHead++); @@ -1288,8 +1227,6 @@ void render_koopa_troopa_beach(struct UnkStruct_800DC5EC *arg0) { gDPPipeSync(gDisplayListHead++); } -extern Gfx royal_raceway_dls[]; - void render_royal_raceway(struct UnkStruct_800DC5EC *arg0) { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); @@ -1316,8 +1253,6 @@ void render_royal_raceway(struct UnkStruct_800DC5EC *arg0) { gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK); } -extern Gfx luigi_raceway_dls[]; - void render_luigi_raceway(struct UnkStruct_800DC5EC *arg0) { s32 pad; @@ -1462,17 +1397,6 @@ void render_moo_moo_farm(struct UnkStruct_800DC5EC *arg0) { GLOBAL_ASM("asm/non_matchings/render_courses/render_moo_moo_farm.s") #endif -extern s32 D_801625EC; -extern s32 D_801625F0; -extern s32 D_801625F4; -extern s16 D_802B87B0; -extern s16 D_802B87B4; -extern s16 D_802B87D4; - -extern Gfx toads_turnpike_dls[]; - -extern Lights1 D_800DC610[]; // Light data? - void render_toads_turnpike(struct UnkStruct_800DC5EC *arg0) { s32 pad[13]; @@ -1498,8 +1422,6 @@ void render_toads_turnpike(struct UnkStruct_800DC5EC *arg0) { gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE); } -extern u8 kalimari_desert_dls[]; - void render_kalimari_desert(struct UnkStruct_800DC5EC *arg0) { func_802B5D64(&D_800DC610, D_802B87D4, 0, 1); @@ -1528,8 +1450,6 @@ void render_kalimari_desert(struct UnkStruct_800DC5EC *arg0) { gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK); } -extern u8 sherbet_land_dls[]; - void render_sherbet_land(struct UnkStruct_800DC5EC *arg0) { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); @@ -1549,8 +1469,6 @@ void render_rainbow_road(struct UnkStruct_800DC5EC *arg0) { gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2); } -extern Gfx wario_stadium_dls[]; - void render_wario_stadium(struct UnkStruct_800DC5EC *arg0) { s16 prevFrame; @@ -1651,10 +1569,6 @@ void render_double_deck(struct UnkStruct_800DC5EC *arg0) { gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK); } -extern s16 D_802B87D0; - -extern Gfx dks_jungle_parkway_dls[]; - void render_dks_jungle_parkway(struct UnkStruct_800DC5EC *arg0) { func_802B5D64(&D_800DC610, D_802B87D4, 0, 1); @@ -1699,24 +1613,6 @@ void render_big_donut(struct UnkStruct_800DC5EC *arg0) { gSPDisplayList(gDisplayListHead++, 0x07000230); } -extern Gfx D_060071B0[]; -extern Gfx D_060076A0[]; -extern Gfx D_06009148[]; -extern Gfx D_06009348[]; -extern Gfx D_06009AE8[]; -extern Gfx D_0600B308[]; -extern Gfx D_0600CA78[]; -extern Gfx D_0600D8E8[]; -extern Gfx D_0600FD40[]; -extern Gfx D_06013C30[]; -extern Gfx D_06014088[]; -extern Gfx D_06016220[]; -extern Gfx D_06018020[]; -extern Gfx D_06018D68[]; -extern Gfx D_06022E00[]; -extern Gfx D_06023930[]; -extern Gfx D_sherbet_land_06000000[]; - void func_8029569C(void) { switch (gCurrentCourseId) { case 0: @@ -1782,8 +1678,6 @@ void func_8029569C(void) { } } -extern u16 D_800DC518; - void func_80295A38(struct UnkStruct_800DC5EC *arg0) { func_802B5D64(D_800DC610, D_802B87D4, 0, 1); @@ -1870,24 +1764,6 @@ void func_80295BF8(s32 playerIndex) { player->boundingBoxCorners[BACK_LEFT_TYRE].surfaceMapIndex = 0x1388; } - -extern void func_802AF314(u16 *, s16 *, s16 *, s16 *); -extern u16 D_8015F58A; - -extern s16 D_8015F700; -extern s16 D_8015F702; -extern f32 D_8015F8E8; -extern f32 D_8015F8E4; - -extern s16 D_8015F6E8; -extern s16 D_8015F6F0; -extern s16 D_8015F6EA; -extern s16 D_8015F6F2; -extern s16 D_8015F6EE; -extern u16 D_8015F588; - -#define ALIGNF(x) (((x) + 0xF) & ~0xF) - void func_80295C6C(void) { gPrevLoadedAddress += ALIGNF(D_8015F588 * 0x2C); D_8015F6E8 += 20; @@ -1895,61 +1771,20 @@ void func_80295C6C(void) { D_8015F6EA += -20; D_8015F6F2 += -20; D_8015F6EE += -20; - func_802AF314(&D_8015F6F0, &D_8015F6EA, &D_8015F6F2, &D_8015F6EE); + func_802AF314(); gPrevLoadedAddress += ALIGNF(D_8015F58A * 2); } - -extern s16 D_8015F6F4; -extern s16 D_8015F6F6; - UNUSED void func_80295D50(s16 arg0, s16 arg1) { D_8015F6F4 = arg1; D_8015F6F6 = arg0; } -extern s16 D_8015F6F4; -extern s16 D_8015F6F6; - void func_80295D6C(void) { D_8015F6F4 = 3000; D_8015F6F6 = -3000; } -void func_802AAA70(uintptr_t); /* extern */ -void func_802AF588(uintptr_t); /* extern */ -void func_802AF5AC(uintptr_t, s8); /* extern */ -void func_802AF8BC(uintptr_t, s8, u8, u8, u8); /* extern */ -void func_802B5CAC(s16 arg0, s16 arg1, Vec3f arg2); - -extern Gfx D_060072D0[]; -extern Gfx D_060079A0[]; -extern Gfx D_060093D8[]; -extern Gfx D_06009650[]; -extern Gfx D_06009C20[]; -extern Gfx D_0600B458[]; -extern Gfx D_0600CC38[]; -extern Gfx D_0600DC28[]; -extern Gfx D_0600FF28[]; -extern Gfx D_06014338[]; -extern Gfx D_060144B8[]; -extern Gfx D_06016440[]; -extern Gfx D_06016558[]; -extern Gfx D_06018240[]; -extern Gfx D_06018FD8[]; -extern Gfx D_06023070[]; -extern Gfx D_06023B68[]; -extern Vec3f D_8015F590; -extern u16 D_800DC5BC; /* unable to generate initializer */ -extern s16 D_800DC5C8; /* unable to generate initializer */ -extern s32 gGamestate; -extern s32 gModeSelection; -extern u16 gNumActors; -extern s16 D_8015F6EC; -extern s32 D_8015F58C; -extern uintptr_t D_8015F580; -extern s32 gCCSelection; - void func_80295D88(void) { f32 phi_f10; diff --git a/src/render_courses.h b/src/render_courses.h new file mode 100644 index 000000000..839e23dbb --- /dev/null +++ b/src/render_courses.h @@ -0,0 +1,160 @@ +#ifndef RENDER_COURSES_H +#define RENDER_COURSES_H + +#define ALIGNF(x) (((x) + 0xF) & ~0xF) + +struct Unk0CAC { + s32 unk0; + u8 unk4; + u8 unk5; + u16 unk6; +}; + +s32 func_80290C20(Camera*); +void func_80290CAC(uintptr_t); +void load_surface_map(s32, struct UnkStruct_800DC5EC*); +void func_80291198(); +void func_802911C4(); +void render_mario_raceway(struct UnkStruct_800DC5EC*); +void render_choco_mountain(struct UnkStruct_800DC5EC*); +void render_bowsers_castle(struct UnkStruct_800DC5EC*); +void render_banshee_boardwalk(struct UnkStruct_800DC5EC*); +void render_yoshi_valley(struct UnkStruct_800DC5EC*); +void render_frappe_snowland(struct UnkStruct_800DC5EC*); +void render_koopa_troopa_beach(struct UnkStruct_800DC5EC*); +void render_royal_raceway(struct UnkStruct_800DC5EC*); +void render_luigi_raceway(struct UnkStruct_800DC5EC*); +void render_toads_turnpike(struct UnkStruct_800DC5EC*); +void render_kalimari_desert(struct UnkStruct_800DC5EC*); +void render_sherbet_land(struct UnkStruct_800DC5EC*); +void render_rainbow_road(struct UnkStruct_800DC5EC*); +void render_wario_stadium(struct UnkStruct_800DC5EC*); +void render_block_fort(struct UnkStruct_800DC5EC*); +void render_skyscraper(struct UnkStruct_800DC5EC*); +void render_double_deck(struct UnkStruct_800DC5EC*); +void render_dks_jungle_parkway(struct UnkStruct_800DC5EC*); +void render_big_donut(struct UnkStruct_800DC5EC*); +void func_8029569C(); +void func_80295A38(struct UnkStruct_800DC5EC*); +void func_80295BF8(s32); +void func_80295C6C(); +void func_80295D50(s16, s16); +void func_80295D6C(); +void func_80295D88(); +void func_802966A0(); +void func_802969F8(); + +extern Gfx *gDisplayListHead; +extern s16 gCurrentCourseId; +extern u32 gPrevLoadedAddress; +extern s32 gActiveScreenMode; + +extern u16 sRenderedFramebuffer; +extern uintptr_t *gPhysicalFramebuffers[]; +extern uintptr_t gSegmentTable[]; + +extern Player gPlayers[]; + +extern s32 D_8015F59C; +extern s32 D_8015F5A0; + +extern s32 D_800DC5DC; +extern s32 D_800DC5E0; +extern s16 D_802B87D8; +extern s32 D_802B87C4; +extern s32 D_802B87C8; +extern s32 D_802B87CC; +extern s32 D_8015F5A4; +extern s32 gScreenModeSelection; +extern Gfx mario_raceway_dls[]; +extern s32 D_801625EC; +extern s32 D_801625F0; +extern s32 D_801625F4; +extern s16 D_802B87B0; +extern s16 D_802B87B4; +extern Gfx choco_mountain_dls[]; +extern s32 D_802B87BC; +extern Gfx bowsers_castle_dls[]; +extern Gfx banshee_boardwalk_dls[]; +extern Gfx D_0600B278[]; +extern Gfx yoshi_valley_dls; +extern u8 frappe_snowland_dls[]; +extern Gfx koopa_troopa_beach_dls[]; +extern Gfx royal_raceway_dls[]; +extern Gfx luigi_raceway_dls[]; +extern s32 D_801625EC; +extern s32 D_801625F0; +extern s32 D_801625F4; +extern s16 D_802B87B0; +extern s16 D_802B87B4; +extern s16 D_802B87D4; + +extern Gfx toads_turnpike_dls[]; + +extern Lights1 D_800DC610[]; // Light data? +extern u8 kalimari_desert_dls[]; +extern u8 sherbet_land_dls[]; +extern Gfx wario_stadium_dls[]; +extern s16 D_802B87D0; + +extern Gfx dks_jungle_parkway_dls[]; +extern Gfx D_060071B0[]; +extern Gfx D_060076A0[]; +extern Gfx D_06009148[]; +extern Gfx D_06009348[]; +extern Gfx D_06009AE8[]; +extern Gfx D_0600B308[]; +extern Gfx D_0600CA78[]; +extern Gfx D_0600D8E8[]; +extern Gfx D_0600FD40[]; +extern Gfx D_06013C30[]; +extern Gfx D_06014088[]; +extern Gfx D_06016220[]; +extern Gfx D_06018020[]; +extern Gfx D_06018D68[]; +extern Gfx D_06022E00[]; +extern Gfx D_06023930[]; +extern Gfx D_sherbet_land_06000000[]; +extern u16 D_800DC518; +extern u16 D_8015F58A; + +extern s16 D_8015F700; +extern s16 D_8015F702; +extern f32 D_8015F8E8; +extern f32 D_8015F8E4; + +extern s16 D_8015F6EA; +extern s16 D_8015F6F2; +extern s16 D_8015F6EE; +extern u16 D_8015F588; +extern s16 D_8015F6F4; +extern s16 D_8015F6F6; +extern s16 D_8015F6F4; +extern s16 D_8015F6F6; +extern Gfx D_060072D0[]; +extern Gfx D_060079A0[]; +extern Gfx D_060093D8[]; +extern Gfx D_06009650[]; +extern Gfx D_06009C20[]; +extern Gfx D_0600B458[]; +extern Gfx D_0600CC38[]; +extern Gfx D_0600DC28[]; +extern Gfx D_0600FF28[]; +extern Gfx D_06014338[]; +extern Gfx D_060144B8[]; +extern Gfx D_06016440[]; +extern Gfx D_06016558[]; +extern Gfx D_06018240[]; +extern Gfx D_06018FD8[]; +extern Gfx D_06023070[]; +extern Gfx D_06023B68[]; +extern Vec3f D_8015F590; +extern u16 D_800DC5BC; /* unable to generate initializer */ +extern s32 gGamestate; +extern s32 gModeSelection; +extern u16 gNumActors; +extern s32 D_8015F58C; +extern uintptr_t D_8015F580; +extern s32 gCCSelection; + +#endif diff --git a/src/skybox_and_splitscreen.c b/src/skybox_and_splitscreen.c index edbf371ec..eb7135bf4 100644 --- a/src/skybox_and_splitscreen.c +++ b/src/skybox_and_splitscreen.c @@ -7,30 +7,7 @@ #include #include #include "camera.h" - -void select_framebuffer(); - -extern Gfx *gDisplayListHead; - -extern struct UnkStruct_800DC5EC *D_800DC5EC; -extern struct UnkStruct_800DC5EC *D_800DC5F0; -extern struct UnkStruct_800DC5EC *D_800DC5F4; -extern struct UnkStruct_800DC5EC *D_800DC5F8; - -extern u16 D_800DC5B0; - -void init_rdp(); -extern s32 gGamestateNext; -extern s16 gIsInQuitToMenuTransition; -extern u16 gQuitToMenuTransitionCounter; -extern s32 gMenuSelection; -extern s32 D_800E86A4; -extern s32 gMenuSelectionFromQuit; - -extern s32 D_801502B4; -extern uintptr_t *gPhysicalFramebuffers[]; -extern u16 sRenderingFramebuffer; - +#include "skybox_and_splitscreen.h" Vp D_802B8880[] = { {640, 480, 511, 0, @@ -259,8 +236,6 @@ UNUSED void func_802A40CC(void) {} UNUSED void func_802A40D4(void) {} UNUSED void func_802A40DC(void) {} -#define G_CLEAR_ALL_MODES 0xFFFFFFFF - UNUSED s32 set_viewport2(void) { gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_800DC5EC->viewport)); gSPClearGeometryMode(gDisplayListHead++, G_CLEAR_ALL_MODES); @@ -274,10 +249,6 @@ void set_viewport(void) { gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); } -extern s32 D_800DC5D0; -extern s32 D_800DC5D4; -extern s32 D_800DC5D8; - /** * Tells the RDP which of the three framebuffers it shall draw to. */ @@ -325,10 +296,6 @@ void func_802A4300(void) { } -extern s32 D_801625EC; -extern s32 D_801625F0; -extern s32 D_801625F4; - struct Skybox { s16 unk0; s16 unk2; @@ -393,7 +360,6 @@ struct Skybox D_802B8BCC[21] = { {0, 0, 0, 0, 0, 0}, {255, 224, 240, 0, 0, 0}, }; -extern u16 D_800DC5BC; void func_802A450C(Vtx *skybox) { s32 i; @@ -458,9 +424,6 @@ void func_802A450C(Vtx *skybox) { skybox[7].v.cn[2] = D_802B8BCC[gCurrentCourseId].unk4; } -extern Mtx *D_0D008E98; -extern struct GfxPool *gGfxPool; - void func_802A487C(Vtx *arg0, UNUSED s32 arg1, UNUSED s32 arg2, UNUSED s32 arg3, UNUSED s32 arg4) { init_rdp(); @@ -670,8 +633,6 @@ GLOBAL_ASM("asm/non_matchings/skybox/func_802A4D18.s") //extern f32 D_80150138; //extern f32 D_8015013C; -extern f32 D_80150130[]; - void func_802A4EF4(void) { switch(gActiveScreenMode) { case 0: @@ -695,8 +656,6 @@ void func_802A4EF4(void) { } } -extern u16 D_800DC5B4; - void func_802A5004(void) { init_rdp(); @@ -875,15 +834,6 @@ void func_802A5760(void) { } } -extern f32 D_80150148; -extern f32 D_80150150; -extern f32 D_8015014C; - - -extern u16 D_800DC5C8; -extern u16 D_800DC5B8; -extern Camera cameras[]; - void func_802A59A4(void) { Camera *camera = &cameras[0]; u16 spAA[32]; @@ -932,8 +882,6 @@ void func_802A59A4(void) { } } -extern s32 D_8015F788; - void func_802A5CB4(void) { Camera *camera = &cameras[0]; u16 sp9A[22]; @@ -1317,12 +1265,6 @@ void func_802A7178(void) { D_8015F788 += 1; } -extern struct UnkStruct_800DC5EC D_8015F480[]; -extern s32 D_8015F790[]; - -extern struct Controller gControllers[]; -extern Player gPlayers[]; - void func_802A74BC(void) { struct UnkStruct_800DC5EC *wrapper = &D_8015F480[0]; Player *player = &gPlayers[0]; diff --git a/src/skybox_and_splitscreen.h b/src/skybox_and_splitscreen.h new file mode 100644 index 000000000..f5e3cae36 --- /dev/null +++ b/src/skybox_and_splitscreen.h @@ -0,0 +1,98 @@ +#ifndef SKYBOX_AND_SPLITSCREEN_H +#define SKYBOX_AND_SPLITSCREEN_H + +#define G_CLEAR_ALL_MODES 0xFFFFFFFF + +/* Function Prototypes */ + +void func_802A3730(struct UnkStruct_800DC5EC*); +void func_802A38AC(); +void func_802A38B4(); +void func_802A39E0(struct UnkStruct_800DC5EC*); +void init_z_buffer(); +void init_rdp(); +void func_802A40A4(); +void func_802A40AC(); +void func_802A40B4(); +void func_802A40BC(); +void func_802A40C4(); +void func_802A40CC(); +void func_802A40D4(); +void func_802A40DC(); +s32 set_viewport2(); +void set_viewport(); +void select_framebuffer(); +void func_802A4300(); +void func_802A450C(Vtx*); +void func_802A487C(Vtx*, s32, s32, s32, s32); +void func_802A4EF4(); +void func_802A5004(); +void func_802A50EC(); +void func_802A51D4(); +void func_802A52BC(); +void func_802A53A4(); +void func_802A54A8(); +void func_802A5590(); +void func_802A5678(); +void func_802A5760(); +void func_802A59A4(); +void func_802A5CB4(); +void func_802A5FAC(); +void func_802A62A4(); +void func_802A65B8(); +void func_802A68CC(); +void func_802A6BB0(); +void func_802A6E94(); +void func_802A7178(); +void func_802A74BC(); +void func_802A7658(s32, s32, s32, s32, u16*, u16*); +void func_802A7728(); +void func_802A7940(); + +extern Gfx *gDisplayListHead; + +extern struct UnkStruct_800DC5EC *D_800DC5EC; +extern struct UnkStruct_800DC5EC *D_800DC5F0; +extern struct UnkStruct_800DC5EC *D_800DC5F4; +extern struct UnkStruct_800DC5EC *D_800DC5F8; +extern u16 D_800DC5B0; +extern s32 gGamestateNext; +extern u16 gIsInQuitToMenuTransition; +extern u16 gQuitToMenuTransitionCounter; +extern s32 gMenuSelection; +extern s32 D_800E86A4; +extern s32 gMenuSelectionFromQuit; + +extern u32 D_801502B4; +extern uintptr_t gPhysicalFramebuffers[3]; +extern u16 sRenderingFramebuffer; +extern s32 D_800DC5D0; +extern s32 D_800DC5D4; +extern s32 D_800DC5D8; +extern s32 D_801625EC; +extern s32 D_801625F0; +extern s32 D_801625F4; +extern u16 D_800DC5BC; +extern Mtx *D_0D008E98; +extern struct GfxPool *gGfxPool; +extern f32 D_80150130[]; +extern u16 D_800DC5B4; +extern f32 D_80150148; +extern f32 D_80150150; +extern f32 D_8015014C; + + +extern u16 D_800DC5C8; +extern u16 D_800DC5B8; +extern s32 D_8015F788; +extern struct UnkStruct_800DC5EC D_8015F480[]; +extern s32 D_8015F790[]; + +extern struct Controller gControllers[]; +extern Player gPlayers[]; +extern s32 D_800DC5DC; +extern s32 D_800DC5E0; +extern uintptr_t gSegmentTable[]; +extern u16 sRenderedFramebuffer; + +#endif diff --git a/src/spawn_players.c b/src/spawn_players.c index c9d574b6c..9cc0f05b9 100644 --- a/src/spawn_players.c +++ b/src/spawn_players.c @@ -4,18 +4,10 @@ #include "memory.h" #include "waypoints.h" #include "framebuffers.h" -#include "code_80027040.h" +#include "kart_dma.h" +#include "camera.h" #include "code_80027D00.h" - -extern s16 D_80165560[]; -extern s32* D_800E3C50[]; -extern u16* D_800E3890[]; -extern s16 D_80165340; - -extern Camera *camera1; -extern Camera *camera2; -extern Camera *camera3; -extern Camera *camera4; +#include "spawn_players.h" void spawn_player(Player *player, s8 playerIndex, f32 arg2, f32 arg3, f32 arg4, f32 arg5, u16 arg6, s16 arg7) { f32 ret; @@ -1011,7 +1003,7 @@ void func_8003CD78(void) { func_8003BE30(); } -void func_8003CD98(Player *player, struct Camera *camera, s8 arg2, s8 arg3) { +void func_8003CD98(Player *player, Camera *camera, s8 arg2, s8 arg3) { if (player->unk_000 & PLAYER_EXISTS) { if (arg3 == 0) { func_8002D268(player, camera, arg3, arg2); @@ -1206,4 +1198,3 @@ void func_8003DB5C(void) { func_80027A20(player, i, 1, 1); } } - diff --git a/src/spawn_players.h b/src/spawn_players.h new file mode 100644 index 000000000..a62cb2675 --- /dev/null +++ b/src/spawn_players.h @@ -0,0 +1,34 @@ +#ifndef SPAWN_PLAYERS_H +#define SPAWN_PLAYERS_H + +#include "camera.h" +#include "common_structs.h" + +/* Function Prototypes */ + +void spawn_player(Player*, s8, f32, f32, f32, f32, u16, s16); +void func_80039AE4(); +void func_80039DA4(); +void func_80039F44(f32*, f32*, f32); +void func_8003A59C(f32*, f32*, f32); +void func_8003A9F0(f32* arg0, f32* arg1, f32); +void func_8003AE24(f32*, f32*, f32); +void spawn_players_2p_battle(f32*, f32*, f32); +void func_8003B318(f32*, f32*, f32); +void spawn_players_3p_battle(f32*, f32*, f32); +void func_8003B870(f32*, f32*, f32); +void spawn_players_4p_battle(f32*, f32*, f32); +void func_8003BE30(); +void func_8003C0F0(); +void func_8003CD78(); +void func_8003CD98(Player*, Camera*, s8, s8); +void func_8003D080(); +void func_8003DB5C(); + +extern s16 D_80165560[]; +extern s32* D_800E3C50[]; +extern u16* D_800E3890[]; +extern s16 D_80165340; + + +#endif