diff --git a/asm/non_matchings/code_802B0210/func_802B1FFC.s b/asm/non_matchings/code_802B0210/func_802B1FFC.s deleted file mode 100644 index 423c1b974..000000000 --- a/asm/non_matchings/code_802B0210/func_802B1FFC.s +++ /dev/null @@ -1,15 +0,0 @@ -glabel func_802B1FFC -/* 11B60C 802B1FFC 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 11B610 802B2000 AFBF0014 */ sw $ra, 0x14($sp) -/* 11B614 802B2004 0C0AC792 */ jal func_802B1E48 -/* 11B618 802B2008 00000000 */ nop -/* 11B61C 802B200C 000278C0 */ sll $t7, $v0, 3 -/* 11B620 802B2010 8FBF0014 */ lw $ra, 0x14($sp) -/* 11B624 802B2014 01E27823 */ subu $t7, $t7, $v0 -/* 11B628 802B2018 000F7900 */ sll $t7, $t7, 4 -/* 11B62C 802B201C 3C018016 */ lui $at, %hi(gActorList) # 0x8016 -/* 11B630 802B2020 002F0821 */ addu $at, $at, $t7 -/* 11B634 802B2024 240E002A */ li $t6, 42 -/* 11B638 802B2028 A42EF9B8 */ sh $t6, %lo(gActorList)($at) -/* 11B63C 802B202C 03E00008 */ jr $ra -/* 11B640 802B2030 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/non_matchings/code_802B0210/func_802B2D70.s b/asm/non_matchings/code_802B0210/func_802B2D70.s deleted file mode 100644 index 237a4d9bd..000000000 --- a/asm/non_matchings/code_802B0210/func_802B2D70.s +++ /dev/null @@ -1,87 +0,0 @@ -glabel func_802B2D70 -/* 11C380 802B2D70 3C0E800E */ lui $t6, %hi(gPlayerOne) # $t6, 0x800e -/* 11C384 802B2D74 8DCEC4DC */ lw $t6, %lo(gPlayerOne)($t6) -/* 11C388 802B2D78 24010DD8 */ li $at, 3544 -/* 11C38C 802B2D7C 27BDFF98 */ addiu $sp, $sp, -0x68 -/* 11C390 802B2D80 008E1023 */ subu $v0, $a0, $t6 -/* 11C394 802B2D84 0041001A */ div $zero, $v0, $at -/* 11C398 802B2D88 00007812 */ mflo $t7 -/* 11C39C 802B2D8C 31E8FFFF */ andi $t0, $t7, 0xffff -/* 11C3A0 802B2D90 AFB00018 */ sw $s0, 0x18($sp) -/* 11C3A4 802B2D94 29010008 */ slti $at, $t0, 8 -/* 11C3A8 802B2D98 00808025 */ move $s0, $a0 -/* 11C3AC 802B2D9C 14200003 */ bnez $at, .L802B2DAC -/* 11C3B0 802B2DA0 AFBF001C */ sw $ra, 0x1c($sp) -/* 11C3B4 802B2DA4 10000040 */ b .L802B2EA8 -/* 11C3B8 802B2DA8 2402FFFF */ li $v0, -1 -.L802B2DAC: -/* 11C3BC 802B2DAC 44802000 */ mtc1 $zero, $f4 -/* 11C3C0 802B2DB0 3C014080 */ li $at, 0x40800000 # 4.000000 -/* 11C3C4 802B2DB4 44818000 */ mtc1 $at, $f16 -/* 11C3C8 802B2DB8 E7A40028 */ swc1 $f4, 0x28($sp) -/* 11C3CC 802B2DBC C6060070 */ lwc1 $f6, 0x70($s0) -/* 11C3D0 802B2DC0 27A40028 */ addiu $a0, $sp, 0x28 -/* 11C3D4 802B2DC4 26050174 */ addiu $a1, $s0, 0x174 -/* 11C3D8 802B2DC8 46003207 */ neg.s $f8, $f6 -/* 11C3DC 802B2DCC E7A8002C */ swc1 $f8, 0x2c($sp) -/* 11C3E0 802B2DD0 C60A0070 */ lwc1 $f10, 0x70($s0) -/* 11C3E4 802B2DD4 AFA80020 */ sw $t0, 0x20($sp) -/* 11C3E8 802B2DD8 46105480 */ add.s $f18, $f10, $f16 -/* 11C3EC 802B2DDC 46009107 */ neg.s $f4, $f18 -/* 11C3F0 802B2DE0 0C0AD8EE */ jal func_802B63B8 -/* 11C3F4 802B2DE4 E7A40030 */ swc1 $f4, 0x30($sp) -/* 11C3F8 802B2DE8 C7A60028 */ lwc1 $f6, 0x28($sp) -/* 11C3FC 802B2DEC C6080014 */ lwc1 $f8, 0x14($s0) -/* 11C400 802B2DF0 C7B0002C */ lwc1 $f16, 0x2c($sp) -/* 11C404 802B2DF4 27A40028 */ addiu $a0, $sp, 0x28 -/* 11C408 802B2DF8 46083280 */ add.s $f10, $f6, $f8 -/* 11C40C 802B2DFC C7A60030 */ lwc1 $f6, 0x30($sp) -/* 11C410 802B2E00 27A50034 */ addiu $a1, $sp, 0x34 -/* 11C414 802B2E04 27A6003C */ addiu $a2, $sp, 0x3c -/* 11C418 802B2E08 E7AA0028 */ swc1 $f10, 0x28($sp) -/* 11C41C 802B2E0C C6120018 */ lwc1 $f18, 0x18($s0) -/* 11C420 802B2E10 24070006 */ li $a3, 6 -/* 11C424 802B2E14 46128100 */ add.s $f4, $f16, $f18 -/* 11C428 802B2E18 E7A4002C */ swc1 $f4, 0x2c($sp) -/* 11C42C 802B2E1C C608001C */ lwc1 $f8, 0x1c($s0) -/* 11C430 802B2E20 46083280 */ add.s $f10, $f6, $f8 -/* 11C434 802B2E24 E7AA0030 */ swc1 $f10, 0x30($sp) -/* 11C438 802B2E28 C6100034 */ lwc1 $f16, 0x34($s0) -/* 11C43C 802B2E2C E7B0003C */ swc1 $f16, 0x3c($sp) -/* 11C440 802B2E30 C6120038 */ lwc1 $f18, 0x38($s0) -/* 11C444 802B2E34 E7B20040 */ swc1 $f18, 0x40($sp) -/* 11C448 802B2E38 C604003C */ lwc1 $f4, 0x3c($s0) -/* 11C44C 802B2E3C A7A00034 */ sh $zero, 0x34($sp) -/* 11C450 802B2E40 A7A00036 */ sh $zero, 0x36($sp) -/* 11C454 802B2E44 A7A00038 */ sh $zero, 0x38($sp) -/* 11C458 802B2E48 0C0A7B22 */ jal func_8029EC88 -/* 11C45C 802B2E4C E7A40044 */ swc1 $f4, 0x44($sp) -/* 11C460 802B2E50 00022400 */ sll $a0, $v0, 0x10 -/* 11C464 802B2E54 0004CC03 */ sra $t9, $a0, 0x10 -/* 11C468 802B2E58 03202025 */ move $a0, $t9 -/* 11C46C 802B2E5C 04410003 */ bgez $v0, .L802B2E6C -/* 11C470 802B2E60 8FA80020 */ lw $t0, 0x20($sp) -/* 11C474 802B2E64 10000010 */ b .L802B2EA8 -/* 11C478 802B2E68 03201025 */ move $v0, $t9 -.L802B2E6C: -/* 11C47C 802B2E6C 000448C0 */ sll $t1, $a0, 3 -/* 11C480 802B2E70 01244823 */ subu $t1, $t1, $a0 -/* 11C484 802B2E74 3C0A8016 */ lui $t2, %hi(gActorList) # $t2, 0x8016 -/* 11C488 802B2E78 254AF9B8 */ addiu $t2, %lo(gActorList) # addiu $t2, $t2, -0x648 -/* 11C48C 802B2E7C 00094900 */ sll $t1, $t1, 4 -/* 11C490 802B2E80 012A1821 */ addu $v1, $t1, $t2 -/* 11C494 802B2E84 240B0014 */ li $t3, 20 -/* 11C498 802B2E88 A4680010 */ sh $t0, 0x10($v1) -/* 11C49C 802B2E8C A4600006 */ sh $zero, 6($v1) -/* 11C4A0 802B2E90 A46B0004 */ sh $t3, 4($v1) -/* 11C4A4 802B2E94 8E0C000C */ lw $t4, 0xc($s0) -/* 11C4A8 802B2E98 3C010004 */ lui $at, 4 -/* 11C4AC 802B2E9C 00801025 */ move $v0, $a0 -/* 11C4B0 802B2EA0 01816825 */ or $t5, $t4, $at -/* 11C4B4 802B2EA4 AE0D000C */ sw $t5, 0xc($s0) -.L802B2EA8: -/* 11C4B8 802B2EA8 8FBF001C */ lw $ra, 0x1c($sp) -/* 11C4BC 802B2EAC 8FB00018 */ lw $s0, 0x18($sp) -/* 11C4C0 802B2EB0 27BD0068 */ addiu $sp, $sp, 0x68 -/* 11C4C4 802B2EB4 03E00008 */ jr $ra -/* 11C4C8 802B2EB8 00000000 */ nop diff --git a/asm/non_matchings/code_802B0210/func_802B2EBC.s b/asm/non_matchings/code_802B0210/func_802B2EBC.s deleted file mode 100644 index 7c43a74da..000000000 --- a/asm/non_matchings/code_802B0210/func_802B2EBC.s +++ /dev/null @@ -1,64 +0,0 @@ -glabel func_802B2EBC -/* 11C4CC 802B2EBC 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 11C4D0 802B2EC0 AFBF0014 */ sw $ra, 0x14($sp) -/* 11C4D4 802B2EC4 0C02796F */ jal func_8009E5BC -/* 11C4D8 802B2EC8 AFA40018 */ sw $a0, 0x18($sp) -/* 11C4DC 802B2ECC 8FA60018 */ lw $a2, 0x18($sp) -/* 11C4E0 802B2ED0 3C18800E */ lui $t8, %hi(gPlayerOne) # $t8, 0x800e -/* 11C4E4 802B2ED4 94CE0000 */ lhu $t6, ($a2) -/* 11C4E8 802B2ED8 31CF4000 */ andi $t7, $t6, 0x4000 -/* 11C4EC 802B2EDC 11E0000B */ beqz $t7, .L802B2F0C -/* 11C4F0 802B2EE0 00000000 */ nop -/* 11C4F4 802B2EE4 8F18C4DC */ lw $t8, %lo(gPlayerOne)($t8) -/* 11C4F8 802B2EE8 24010DD8 */ li $at, 3544 -/* 11C4FC 802B2EEC AFA60018 */ sw $a2, 0x18($sp) -/* 11C500 802B2EF0 00D82023 */ subu $a0, $a2, $t8 -/* 11C504 802B2EF4 0081001A */ div $zero, $a0, $at -/* 11C508 802B2EF8 0000C812 */ mflo $t9 -/* 11C50C 802B2EFC 332400FF */ andi $a0, $t9, 0xff -/* 11C510 802B2F00 0C032AD3 */ jal func_800CAB4C -/* 11C514 802B2F04 00000000 */ nop -/* 11C518 802B2F08 8FA60018 */ lw $a2, 0x18($sp) -.L802B2F0C: -/* 11C51C 802B2F0C 3C03800F */ lui $v1, %hi(gPlayers) # $v1, 0x800f -/* 11C520 802B2F10 3C04800F */ lui $a0, %hi(gPlayers+0xDD8) # $a0, 0x800f -/* 11C524 802B2F14 3C058010 */ lui $a1, %hi(gPlayers+0x1BB0) # $a1, 0x8010 -/* 11C528 802B2F18 3C028010 */ lui $v0, %hi(gPlayers+0x2988) # $v0, 0x8010 -/* 11C52C 802B2F1C 3C078010 */ lui $a3, %hi(gGfxPools+0x2978) # $a3, 0x8010 -/* 11C530 802B2F20 24E701D8 */ addiu $a3, %lo(gGfxPools+0x2978) # addiu $a3, $a3, 0x1d8 -/* 11C534 802B2F24 24429318 */ addiu $v0, %lo(gPlayers+0x2988) # addiu $v0, $v0, -0x6ce8 -/* 11C538 802B2F28 24A58540 */ addiu $a1, %lo(gPlayers+0x1BB0) # addiu $a1, $a1, -0x7ac0 -/* 11C53C 802B2F2C 24847768 */ addiu $a0, %lo(gPlayers+0xDD8) # addiu $a0, $a0, 0x7768 -/* 11C540 802B2F30 24636990 */ addiu $v1, %lo(gPlayers) # addiu $v1, $v1, 0x6990 -.L802B2F34: -/* 11C544 802B2F34 10C30004 */ beq $a2, $v1, .L802B2F48 -/* 11C548 802B2F38 00000000 */ nop -/* 11C54C 802B2F3C 8C69000C */ lw $t1, 0xc($v1) -/* 11C550 802B2F40 352A4000 */ ori $t2, $t1, 0x4000 -/* 11C554 802B2F44 AC6A000C */ sw $t2, 0xc($v1) -.L802B2F48: -/* 11C558 802B2F48 10C40004 */ beq $a2, $a0, .L802B2F5C -/* 11C55C 802B2F4C 24633760 */ addiu $v1, $v1, 0x3760 -/* 11C560 802B2F50 8C8B000C */ lw $t3, 0xc($a0) -/* 11C564 802B2F54 356C4000 */ ori $t4, $t3, 0x4000 -/* 11C568 802B2F58 AC8C000C */ sw $t4, 0xc($a0) -.L802B2F5C: -/* 11C56C 802B2F5C 10C50004 */ beq $a2, $a1, .L802B2F70 -/* 11C570 802B2F60 24843760 */ addiu $a0, $a0, 0x3760 -/* 11C574 802B2F64 8CAD000C */ lw $t5, 0xc($a1) -/* 11C578 802B2F68 35AE4000 */ ori $t6, $t5, 0x4000 -/* 11C57C 802B2F6C ACAE000C */ sw $t6, 0xc($a1) -.L802B2F70: -/* 11C580 802B2F70 50C20005 */ beql $a2, $v0, .L802B2F88 -/* 11C584 802B2F74 24423760 */ addiu $v0, $v0, 0x3760 -/* 11C588 802B2F78 8C4F000C */ lw $t7, 0xc($v0) -/* 11C58C 802B2F7C 35F84000 */ ori $t8, $t7, 0x4000 -/* 11C590 802B2F80 AC58000C */ sw $t8, 0xc($v0) -/* 11C594 802B2F84 24423760 */ addiu $v0, $v0, 0x3760 -.L802B2F88: -/* 11C598 802B2F88 1447FFEA */ bne $v0, $a3, .L802B2F34 -/* 11C59C 802B2F8C 24A53760 */ addiu $a1, $a1, 0x3760 -/* 11C5A0 802B2F90 8FBF0014 */ lw $ra, 0x14($sp) -/* 11C5A4 802B2F94 27BD0018 */ addiu $sp, $sp, 0x18 -/* 11C5A8 802B2F98 03E00008 */ jr $ra -/* 11C5AC 802B2F9C 00000000 */ nop diff --git a/asm/non_matchings/code_802B0210/func_802B30EC.s b/asm/non_matchings/code_802B0210/func_802B30EC.s deleted file mode 100644 index 7f244725d..000000000 --- a/asm/non_matchings/code_802B0210/func_802B30EC.s +++ /dev/null @@ -1,132 +0,0 @@ -glabel func_802B30EC -/* 11C6FC 802B30EC 27BDFFC0 */ addiu $sp, $sp, -0x40 -/* 11C700 802B30F0 AFBE0038 */ sw $fp, 0x38($sp) -/* 11C704 802B30F4 AFB60030 */ sw $s6, 0x30($sp) -/* 11C708 802B30F8 AFB5002C */ sw $s5, 0x2c($sp) -/* 11C70C 802B30FC AFB40028 */ sw $s4, 0x28($sp) -/* 11C710 802B3100 AFB20020 */ sw $s2, 0x20($sp) -/* 11C714 802B3104 AFB00018 */ sw $s0, 0x18($sp) -/* 11C718 802B3108 AFB70034 */ sw $s7, 0x34($sp) -/* 11C71C 802B310C AFB30024 */ sw $s3, 0x24($sp) -/* 11C720 802B3110 3C10800F */ lui $s0, %hi(gPlayers) # $s0, 0x800f -/* 11C724 802B3114 3C12800F */ lui $s2, %hi(gControllers) # $s2, 0x800f -/* 11C728 802B3118 3C14800F */ lui $s4, %hi(gControllers+0x40) # $s4, 0x800f -/* 11C72C 802B311C 3C15800E */ lui $s5, %hi(gPlayerTwo) # $s5, 0x800e -/* 11C730 802B3120 3C16800E */ lui $s6, %hi(gControllerSix) # $s6, 0x800e -/* 11C734 802B3124 3C1E800E */ lui $fp, %hi(gPlayerThree) # $fp, 0x800e -/* 11C738 802B3128 AFBF003C */ sw $ra, 0x3c($sp) -/* 11C73C 802B312C AFB1001C */ sw $s1, 0x1c($sp) -/* 11C740 802B3130 27DEC4E4 */ addiu $fp, %lo(gPlayerThree) # addiu $fp, $fp, -0x3b1c -/* 11C744 802B3134 26D6C4D0 */ addiu $s6, %lo(gControllerSix) # addiu $s6, $s6, -0x3b30 -/* 11C748 802B3138 26B5C4E0 */ addiu $s5, %lo(gPlayerTwo) # addiu $s5, $s5, -0x3b20 -/* 11C74C 802B313C 26946950 */ addiu $s4, %lo(gControllers+0x40) # addiu $s4, $s4, 0x6950 -/* 11C750 802B3140 26526910 */ addiu $s2, %lo(gControllers) # addiu $s2, $s2, 0x6910 -/* 11C754 802B3144 26106990 */ addiu $s0, %lo(gPlayers) # addiu $s0, $s0, 0x6990 -/* 11C758 802B3148 24130DD8 */ li $s3, 3544 -/* 11C75C 802B314C 2417DFFF */ li $s7, -8193 -.L802B3150: -/* 11C760 802B3150 02408825 */ move $s1, $s2 -/* 11C764 802B3154 0C024439 */ jal func_800910E4 -/* 11C768 802B3158 02002025 */ move $a0, $s0 -/* 11C76C 802B315C 5440004B */ bnel $v0, $zero, .L802B328C -/* 11C770 802B3160 26520010 */ addiu $s2, $s2, 0x10 -/* 11C774 802B3164 96020000 */ lhu $v0, ($s0) -/* 11C778 802B3168 304E0100 */ andi $t6, $v0, 0x100 -/* 11C77C 802B316C 51C00037 */ beql $t6, $zero, .L802B324C -/* 11C780 802B3170 304E4000 */ andi $t6, $v0, 0x4000 -/* 11C784 802B3174 8EAF0000 */ lw $t7, ($s5) -/* 11C788 802B3178 020FC023 */ subu $t8, $s0, $t7 -/* 11C78C 802B317C 0313001A */ div $zero, $t8, $s3 -/* 11C790 802B3180 0000C812 */ mflo $t9 -/* 11C794 802B3184 16600002 */ bnez $s3, .L802B3190 -/* 11C798 802B3188 00000000 */ nop -/* 11C79C 802B318C 0007000D */ break 7 -.L802B3190: -/* 11C7A0 802B3190 2401FFFF */ li $at, -1 -/* 11C7A4 802B3194 16610004 */ bne $s3, $at, .L802B31A8 -/* 11C7A8 802B3198 3C018000 */ lui $at, 0x8000 -/* 11C7AC 802B319C 17010002 */ bne $t8, $at, .L802B31A8 -/* 11C7B0 802B31A0 00000000 */ nop -/* 11C7B4 802B31A4 0006000D */ break 6 -.L802B31A8: -/* 11C7B8 802B31A8 57200004 */ bnel $t9, $zero, .L802B31BC -/* 11C7BC 802B31AC 8FC80000 */ lw $t0, ($fp) -/* 11C7C0 802B31B0 10000025 */ b .L802B3248 -/* 11C7C4 802B31B4 8ED10000 */ lw $s1, ($s6) -/* 11C7C8 802B31B8 8FC80000 */ lw $t0, ($fp) -.L802B31BC: -/* 11C7CC 802B31BC 3C0B800E */ lui $t3, %hi(gPlayerOne) # $t3, 0x800e -/* 11C7D0 802B31C0 02084823 */ subu $t1, $s0, $t0 -/* 11C7D4 802B31C4 0133001A */ div $zero, $t1, $s3 -/* 11C7D8 802B31C8 00005012 */ mflo $t2 -/* 11C7DC 802B31CC 16600002 */ bnez $s3, .L802B31D8 -/* 11C7E0 802B31D0 00000000 */ nop -/* 11C7E4 802B31D4 0007000D */ break 7 -.L802B31D8: -/* 11C7E8 802B31D8 2401FFFF */ li $at, -1 -/* 11C7EC 802B31DC 16610004 */ bne $s3, $at, .L802B31F0 -/* 11C7F0 802B31E0 3C018000 */ lui $at, 0x8000 -/* 11C7F4 802B31E4 15210002 */ bne $t1, $at, .L802B31F0 -/* 11C7F8 802B31E8 00000000 */ nop -/* 11C7FC 802B31EC 0006000D */ break 6 -.L802B31F0: -/* 11C800 802B31F0 15400004 */ bnez $t2, .L802B3204 -/* 11C804 802B31F4 00000000 */ nop -/* 11C808 802B31F8 3C11800E */ lui $s1, %hi(gControllerSeven) # $s1, 0x800e -/* 11C80C 802B31FC 10000012 */ b .L802B3248 -/* 11C810 802B3200 8E31C4D4 */ lw $s1, %lo(gControllerSeven)($s1) -.L802B3204: -/* 11C814 802B3204 8D6BC4DC */ lw $t3, %lo(gPlayerOne)($t3) -/* 11C818 802B3208 020B6023 */ subu $t4, $s0, $t3 -/* 11C81C 802B320C 0193001A */ div $zero, $t4, $s3 -/* 11C820 802B3210 00006812 */ mflo $t5 -/* 11C824 802B3214 16600002 */ bnez $s3, .L802B3220 -/* 11C828 802B3218 00000000 */ nop -/* 11C82C 802B321C 0007000D */ break 7 -.L802B3220: -/* 11C830 802B3220 2401FFFF */ li $at, -1 -/* 11C834 802B3224 16610004 */ bne $s3, $at, .L802B3238 -/* 11C838 802B3228 3C018000 */ lui $at, 0x8000 -/* 11C83C 802B322C 15810002 */ bne $t4, $at, .L802B3238 -/* 11C840 802B3230 00000000 */ nop -/* 11C844 802B3234 0006000D */ break 6 -.L802B3238: -/* 11C848 802B3238 55A00004 */ bnel $t5, $zero, .L802B324C -/* 11C84C 802B323C 304E4000 */ andi $t6, $v0, 0x4000 -/* 11C850 802B3240 3C11800E */ lui $s1, %hi(gControllerEight) # $s1, 0x800e -/* 11C854 802B3244 8E31C4D8 */ lw $s1, %lo(gControllerEight)($s1) -.L802B3248: -/* 11C858 802B3248 304E4000 */ andi $t6, $v0, 0x4000 -.L802B324C: -/* 11C85C 802B324C 51C0000F */ beql $t6, $zero, .L802B328C -/* 11C860 802B3250 26520010 */ addiu $s2, $s2, 0x10 -/* 11C864 802B3254 860F0010 */ lh $t7, 0x10($s0) -/* 11C868 802B3258 30582000 */ andi $t8, $v0, 0x2000 -/* 11C86C 802B325C 51E0000B */ beql $t7, $zero, .L802B328C -/* 11C870 802B3260 26520010 */ addiu $s2, $s2, 0x10 -/* 11C874 802B3264 57000009 */ bnel $t8, $zero, .L802B328C -/* 11C878 802B3268 26520010 */ addiu $s2, $s2, 0x10 -/* 11C87C 802B326C 96220006 */ lhu $v0, 6($s1) -/* 11C880 802B3270 02002025 */ move $a0, $s0 -/* 11C884 802B3274 30592000 */ andi $t9, $v0, 0x2000 -/* 11C888 802B3278 13200003 */ beqz $t9, .L802B3288 -/* 11C88C 802B327C 00574024 */ and $t0, $v0, $s7 -/* 11C890 802B3280 0C0ACBE8 */ jal func_802B2FA0 -/* 11C894 802B3284 A6280006 */ sh $t0, 6($s1) -.L802B3288: -/* 11C898 802B3288 26520010 */ addiu $s2, $s2, 0x10 -.L802B328C: -/* 11C89C 802B328C 1654FFB0 */ bne $s2, $s4, .L802B3150 -/* 11C8A0 802B3290 26100DD8 */ addiu $s0, $s0, 0xdd8 -/* 11C8A4 802B3294 8FBF003C */ lw $ra, 0x3c($sp) -/* 11C8A8 802B3298 8FB00018 */ lw $s0, 0x18($sp) -/* 11C8AC 802B329C 8FB1001C */ lw $s1, 0x1c($sp) -/* 11C8B0 802B32A0 8FB20020 */ lw $s2, 0x20($sp) -/* 11C8B4 802B32A4 8FB30024 */ lw $s3, 0x24($sp) -/* 11C8B8 802B32A8 8FB40028 */ lw $s4, 0x28($sp) -/* 11C8BC 802B32AC 8FB5002C */ lw $s5, 0x2c($sp) -/* 11C8C0 802B32B0 8FB60030 */ lw $s6, 0x30($sp) -/* 11C8C4 802B32B4 8FB70034 */ lw $s7, 0x34($sp) -/* 11C8C8 802B32B8 8FBE0038 */ lw $fp, 0x38($sp) -/* 11C8CC 802B32BC 03E00008 */ jr $ra -/* 11C8D0 802B32C0 27BD0040 */ addiu $sp, $sp, 0x40 diff --git a/asm/non_matchings/code_802B0210/func_802B4104.s b/asm/non_matchings/code_802B0210/func_802B4104.s deleted file mode 100644 index 4f47776e5..000000000 --- a/asm/non_matchings/code_802B0210/func_802B4104.s +++ /dev/null @@ -1,75 +0,0 @@ -glabel func_802B4104 -/* 11D714 802B4104 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 11D718 802B4108 AFBF001C */ sw $ra, 0x1c($sp) -/* 11D71C 802B410C AFB00018 */ sw $s0, 0x18($sp) -/* 11D720 802B4110 44801000 */ mtc1 $zero, $f2 -/* 11D724 802B4114 C484003C */ lwc1 $f4, 0x3c($a0) -/* 11D728 802B4118 00808025 */ move $s0, $a0 -/* 11D72C 802B411C 3C013E80 */ li $at, 0x3E800000 # 0.250000 -/* 11D730 802B4120 4602203C */ c.lt.s $f4, $f2 -/* 11D734 802B4124 00000000 */ nop -/* 11D738 802B4128 4502001A */ bc1fl .L802B4194 -/* 11D73C 802B412C C60A0040 */ lwc1 $f10, 0x40($s0) -/* 11D740 802B4130 C480004C */ lwc1 $f0, 0x4c($a0) -/* 11D744 802B4134 44813000 */ mtc1 $at, $f6 -/* 11D748 802B4138 3C01BE80 */ li $at, 0xBE800000 # -0.250000 -/* 11D74C 802B413C 4606003C */ c.lt.s $f0, $f6 -/* 11D750 802B4140 00000000 */ nop -/* 11D754 802B4144 45010007 */ bc1t .L802B4164 -/* 11D758 802B4148 00000000 */ nop -/* 11D75C 802B414C 44814000 */ mtc1 $at, $f8 -/* 11D760 802B4150 00000000 */ nop -/* 11D764 802B4154 4600403C */ c.lt.s $f8, $f0 -/* 11D768 802B4158 00000000 */ nop -/* 11D76C 802B415C 4502000D */ bc1fl .L802B4194 -/* 11D770 802B4160 C60A0040 */ lwc1 $f10, 0x40($s0) -.L802B4164: -/* 11D774 802B4164 0C0A7F72 */ jal func_8029FDC8 -/* 11D778 802B4168 02002025 */ move $a0, $s0 -/* 11D77C 802B416C 3C061900 */ lui $a2, (0x19008054 >> 16) # lui $a2, 0x1900 -/* 11D780 802B4170 34C68054 */ ori $a2, (0x19008054 & 0xFFFF) # ori $a2, $a2, 0x8054 -/* 11D784 802B4174 26040018 */ addiu $a0, $s0, 0x18 -/* 11D788 802B4178 0C03262E */ jal func_800C98B8 -/* 11D78C 802B417C 26050024 */ addiu $a1, $s0, 0x24 -/* 11D790 802B4180 860E0002 */ lh $t6, 2($s0) -/* 11D794 802B4184 35CF0080 */ ori $t7, $t6, 0x80 -/* 11D798 802B4188 1000001E */ b .L802B4204 -/* 11D79C 802B418C A60F0002 */ sh $t7, 2($s0) -/* 11D7A0 802B4190 C60A0040 */ lwc1 $f10, 0x40($s0) -.L802B4194: -/* 11D7A4 802B4194 3C013E80 */ li $at, 0x3E800000 # 0.250000 -/* 11D7A8 802B4198 4602503C */ c.lt.s $f10, $f2 -/* 11D7AC 802B419C 00000000 */ nop -/* 11D7B0 802B41A0 45020019 */ bc1fl .L802B4208 -/* 11D7B4 802B41A4 8FBF001C */ lw $ra, 0x1c($sp) -/* 11D7B8 802B41A8 C6000058 */ lwc1 $f0, 0x58($s0) -/* 11D7BC 802B41AC 44818000 */ mtc1 $at, $f16 -/* 11D7C0 802B41B0 3C01BE80 */ li $at, 0xBE800000 # -0.250000 -/* 11D7C4 802B41B4 4610003C */ c.lt.s $f0, $f16 -/* 11D7C8 802B41B8 00000000 */ nop -/* 11D7CC 802B41BC 45010007 */ bc1t .L802B41DC -/* 11D7D0 802B41C0 00000000 */ nop -/* 11D7D4 802B41C4 44819000 */ mtc1 $at, $f18 -/* 11D7D8 802B41C8 00000000 */ nop -/* 11D7DC 802B41CC 4612003C */ c.lt.s $f0, $f18 -/* 11D7E0 802B41D0 00000000 */ nop -/* 11D7E4 802B41D4 4502000C */ bc1fl .L802B4208 -/* 11D7E8 802B41D8 8FBF001C */ lw $ra, 0x1c($sp) -.L802B41DC: -/* 11D7EC 802B41DC 0C0A7F72 */ jal func_8029FDC8 -/* 11D7F0 802B41E0 02002025 */ move $a0, $s0 -/* 11D7F4 802B41E4 3C061900 */ lui $a2, (0x19008054 >> 16) # lui $a2, 0x1900 -/* 11D7F8 802B41E8 34C68054 */ ori $a2, (0x19008054 & 0xFFFF) # ori $a2, $a2, 0x8054 -/* 11D7FC 802B41EC 26040018 */ addiu $a0, $s0, 0x18 -/* 11D800 802B41F0 0C03262E */ jal func_800C98B8 -/* 11D804 802B41F4 26050024 */ addiu $a1, $s0, 0x24 -/* 11D808 802B41F8 86180002 */ lh $t8, 2($s0) -/* 11D80C 802B41FC 37190080 */ ori $t9, $t8, 0x80 -/* 11D810 802B4200 A6190002 */ sh $t9, 2($s0) -.L802B4204: -/* 11D814 802B4204 8FBF001C */ lw $ra, 0x1c($sp) -.L802B4208: -/* 11D818 802B4208 8FB00018 */ lw $s0, 0x18($sp) -/* 11D81C 802B420C 27BD0020 */ addiu $sp, $sp, 0x20 -/* 11D820 802B4210 03E00008 */ jr $ra -/* 11D824 802B4214 00000000 */ nop diff --git a/src/code_80296A50.h b/src/code_80296A50.h index ab1e1be39..131b20ec5 100644 --- a/src/code_80296A50.h +++ b/src/code_80296A50.h @@ -101,7 +101,7 @@ void update_simple_objects(); // audio/external.c extern void func_800C98B8(Vec3f, Vec3f, u32); -extern void func_800C9060(Player*, s32); +extern void func_800C9060(u8, s32); extern void func_800C90F4(u8, uintptr_t); extern void func_800C99E0(Vec3f, s32); extern void func_800C9D80(Vec3f*, Vec3f*, u32); diff --git a/src/code_802B0210.c b/src/code_802B0210.c index 0428e62ba..e5e302554 100644 --- a/src/code_802B0210.c +++ b/src/code_802B0210.c @@ -3,7 +3,9 @@ #include #include #include "math_util.h" +#include "memory.h" #include "code_802B0210.h" +#include "code_80296A50.h" void func_802B0210(UnkActorInner *arg0, UnkActorInner *arg1) { arg1->unk30 = arg0->unk30; @@ -82,8 +84,6 @@ GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B039C.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_802B039C(void *); // extern -extern ? gActorList; void func_802B0464(s16 arg0) { s16 temp_s0; @@ -134,7 +134,7 @@ void func_802B0570(struct BananaActor *banana) { func_802B0464(banana->youngerIndex); func_802B04E8(banana, banana->elderIndex); if ((gPlayers[banana->playerId].unk_000 & 0x4000) != 0) { - func_800C9060(banana->playerId & 0xFF, 0x19019053); + func_800C9060(banana->playerId, 0x19019053); } banana->flags = -0x8000; banana->unk_04 = 0x003C; @@ -149,7 +149,7 @@ void func_802B0570(struct BananaActor *banana) { } #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b void func_802B0648(struct BananaBunchParent *banana_bunch) { s16 temp_v0; s16 temp_v0_2; @@ -165,7 +165,7 @@ void func_802B0648(struct BananaBunchParent *banana_bunch) { void *phi_v1; temp_v0 = banana_bunch->bananaIndices[4]; - banana_bunch->bananasAvailable += -1; + banana_bunch->bananasAvailable -= 1; if (temp_v0 != -1) { temp_lo = temp_v0 * 0x70; banana_bunch->bananaIndices[4] = -1; @@ -201,8 +201,8 @@ void func_802B0648(struct BananaBunchParent *banana_bunch) { block_10: temp_v0_6 = phi_v1->unk12; phi_v1->unk6 = 1; - phi_v1->unk_04 = 0x00B4; - phi_v1->velocity = 0.0f; + phi_v1->unk4 = 0x00B4; + phi_v1->unk24 = 0.0f; phi_v1->unk2C = 0.0f; phi_v1->unk28 = 1.5f; if (temp_v0_6 != -1) { @@ -215,11 +215,10 @@ GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B0648.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b ? func_802B64C4(f32 *, s16); /* extern */ -? vec3f_set(f32, f32 *, ?, f32, f32); /* extern */ -void func_802B0788(s16 arg0, struct BananaBunchParent *banana_bunch, Player *player) { +void func_802B0788(s16 rawStickY, struct BananaBunchParent *banana_bunch, Player *player) { f32 sp34; void *sp30; f32 temp_f0; @@ -236,8 +235,8 @@ void func_802B0788(s16 arg0, struct BananaBunchParent *banana_bunch, Player *pla s32 temp_lo_4; s32 temp_lo_5; void *phi_v0; - f32 phi_f12; f32 phi_f0; + f32 phi_f12; temp_a3 = banana_bunch->bananaIndices[4]; banana_bunch->bananasAvailable += -1; @@ -276,23 +275,23 @@ void func_802B0788(s16 arg0, struct BananaBunchParent *banana_bunch, Player *pla block_10: temp_a1 = phi_v0->unk12; phi_v0->unk6 = 1; - phi_v0->unk_04 = 0x001E; + phi_v0->unk4 = 0x001E; if (temp_a1 != -1) { (gActorList + (temp_a1 * 0x70))->unk14 = -1; } temp_f2 = player->unk_094; if (temp_f2 < 2.0f) { + phi_f0 = (((f32) rawStickY - 30.0f) / 20.0f) + 1.5f; phi_f12 = 4.0f; - phi_f0 = (((f32) arg0 - 30.0f) / 20.0f) + 1.5f; } else { - temp_f0 = (((f32) arg0 - 30.0f) / 20.0f) + 1.5f; - phi_f12 = (temp_f2 * 0.75f) + 4.5f + temp_f0; + temp_f0 = (((f32) rawStickY - 30.0f) / 20.0f) + 1.5f; phi_f0 = temp_f0; + phi_f12 = (temp_f2 * 0.75f) + 4.5f + temp_f0; } sp30 = phi_v0; - vec3f_set(phi_f12, &sp34, 0, phi_f0, phi_f12); + vec3f_set(&sp34, 0.0f, phi_f0, phi_f12); func_802B64C4(&sp34, (s16) (player->unk_02E + player->unk_0C0)); - sp30->velocity = sp34; + sp30->unk24 = sp34; sp30->unk28 = sp38; sp30->unk2C = sp3C; } @@ -316,152 +315,104 @@ s32 func_802B09C0(s16 bananaId) { return 0; } -#ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -? func_800C9060(s32, ?); /* extern */ -? destroy_actor(struct BananaBunchParent *, s32); /* extern */ -? func_802B0648(struct BananaBunchParent *); /* extern */ -? func_802B0788(s16, struct BananaBunchParent *, Player *, Player *); /* extern */ -s32 func_802B09C0(s16, s32); /* extern */ -? func_802B2914(struct BananaBunchParent *, Player *, ?, Player *); /* extern */ +#ifdef NEEDS_RODATA +// Needs jpt_802B9E98, otherwise this matches void update_obj_banana_bunch(struct BananaBunchParent *banana_bunch) { - Player *sp2C; - struct Controller *sp28; - s32 sp24; - Player *temp_a3; - s16 temp_a0_2; - s16 temp_v1_2; - struct Controller *temp_v0; - struct BananaActor *temp_a0; - struct BananaActor *temp_a1; - struct BananaActor *temp_a2; - struct BananaActor *temp_a3_2; - struct BananaActor *temp_t0; - u16 temp_t9; - u16 temp_v1; - s32 phi_v1; - s32 phi_v1_2; - s32 phi_v1_3; - s32 phi_v1_4; - s32 phi_v1_5; + s32 pad[2]; + Player *owner; + struct Controller *controller; + s32 someCount; - temp_t9 = (u16) banana_bunch->state; - temp_a3 = &gPlayers[banana_bunch->playerId]; - switch (temp_t9) { + owner = &gPlayers[banana_bunch->playerId]; + switch (banana_bunch->state) { case 0: - func_802B2914(banana_bunch, temp_a3, 0, temp_a3); + func_802B2914(banana_bunch, owner, 0); banana_bunch->unk_04 = 4; banana_bunch->state = 1; banana_bunch->bananasAvailable = 1; - return; + break; case 1: - banana_bunch->unk_04 += -1; + banana_bunch->unk_04 -= 1; if (banana_bunch->unk_04 == 0) { - func_802B2914(banana_bunch, temp_a3, 1, temp_a3); + func_802B2914(banana_bunch, owner, 1); banana_bunch->unk_04 = 4; banana_bunch->state = 2; banana_bunch->bananasAvailable += 1; - return; } - default: - return; + break; case 2: - banana_bunch->unk_04 += -1; + banana_bunch->unk_04 -= 1; if (banana_bunch->unk_04 == 0) { - func_802B2914(banana_bunch, temp_a3, 2, temp_a3); + func_802B2914(banana_bunch, owner, 2); banana_bunch->unk_04 = 4; banana_bunch->state = 3; banana_bunch->bananasAvailable += 1; - return; } break; case 3: - banana_bunch->unk_04 += -1; + banana_bunch->unk_04 -= 1; if (banana_bunch->unk_04 == 0) { - func_802B2914(banana_bunch, temp_a3, 3, temp_a3); + func_802B2914(banana_bunch, owner, 3); banana_bunch->unk_04 = 4; banana_bunch->state = 4; banana_bunch->bananasAvailable += 1; - return; } break; case 4: - banana_bunch->unk_04 += -1; + banana_bunch->unk_04 -= 1; if (banana_bunch->unk_04 == 0) { - func_802B2914(banana_bunch, temp_a3, 4, temp_a3); + func_802B2914(banana_bunch, owner, 4); banana_bunch->unk_04 = 4; banana_bunch->state = 5; banana_bunch->bananasAvailable += 1; - return; } break; case 5: banana_bunch->state = 6; - temp_a0 = &gActorList[banana_bunch->bananaIndices[0]]; - temp_a0->flags |= 0x5000; - temp_a1 = &gActorList[banana_bunch->bananaIndices[1]]; - temp_a1->flags |= 0x5000; - temp_a2 = &gActorList[banana_bunch->bananaIndices[2]]; - temp_a2->flags |= 0x5000; - temp_a3_2 = &gActorList[banana_bunch->bananaIndices[3]]; - temp_a3_2->flags |= 0x5000; - temp_t0 = &gActorList[banana_bunch->bananaIndices[4]]; - temp_t0->flags |= 0x5000; - return; + // Unnecessary type-casting done here purely to help with understanding. + // We're setting the ->flags of BananaActors, not plain Actors. + ((struct BananaActor*)&gActorList[banana_bunch->bananaIndices[0]])->flags |= 0x5000; + ((struct BananaActor*)&gActorList[banana_bunch->bananaIndices[1]])->flags |= 0x5000; + ((struct BananaActor*)&gActorList[banana_bunch->bananaIndices[2]])->flags |= 0x5000; + ((struct BananaActor*)&gActorList[banana_bunch->bananaIndices[3]])->flags |= 0x5000; + ((struct BananaActor*)&gActorList[banana_bunch->bananaIndices[4]])->flags |= 0x5000; + break; case 6: - sp2C = temp_a3; - sp24 = 0; - phi_v1 = sp24; + someCount = 0; if (func_802B09C0(banana_bunch->bananaIndices[0]) == 1) { - phi_v1 = 1; + someCount = 1; } - sp2C = temp_a3; - sp24 = phi_v1; - phi_v1_2 = phi_v1; - if (func_802B09C0(banana_bunch->bananaIndices[1], 1) == 1) { - phi_v1_2 = phi_v1 + 1; + if (func_802B09C0(banana_bunch->bananaIndices[1]) == 1) { + someCount += 1; } - sp2C = temp_a3; - sp24 = phi_v1_2; - phi_v1_3 = phi_v1_2; - if (func_802B09C0(banana_bunch->bananaIndices[2], 1) == 1) { - phi_v1_3 = phi_v1_2 + 1; + if (func_802B09C0(banana_bunch->bananaIndices[2]) == 1) { + someCount += 1; } - sp2C = temp_a3; - sp24 = phi_v1_3; - phi_v1_4 = phi_v1_3; - if (func_802B09C0(banana_bunch->bananaIndices[3], 1) == 1) { - phi_v1_4 = phi_v1_3 + 1; + if (func_802B09C0(banana_bunch->bananaIndices[3]) == 1) { + someCount += 1; } - sp2C = temp_a3; - sp24 = phi_v1_4; - phi_v1_5 = phi_v1_4; - if (func_802B09C0(banana_bunch->bananaIndices[4], 1) == 1) { - phi_v1_5 = phi_v1_4 + 1; + if (func_802B09C0(banana_bunch->bananaIndices[4]) == 1) { + someCount += 1; } - if (phi_v1_5 == 0) { - sp2C = temp_a3; - destroy_actor(banana_bunch, 1); - temp_a3->unk_00C &= 0xFFFBFFFF; - return; - } - if (((temp_a3->unk_000 & 0x4000) != 0) && (temp_v0 = &gControllers[banana_bunch->playerId], temp_v1 = temp_v0->buttonPressed, ((temp_v1 & 0x2000) != 0))) { - temp_v0->buttonPressed = temp_v1 & 0xDFFF; - sp2C = temp_a3; - sp28 = temp_v0; - func_800C9060(((s32) (temp_a3 - gPlayerOne) / 3544) & 0xFF, 0x19008012); - temp_a0_2 = temp_v0->rawStickY; - if (temp_a0_2 >= 0x1F) { - temp_v1_2 = temp_v0->rawStickX; - if ((temp_v1_2 < 0x28) && (temp_v1_2 >= -0x27)) { - func_802B0788(temp_a0_2, banana_bunch, temp_a3, temp_a3); - return; + if (someCount == 0) { + destroy_actor(banana_bunch); + owner->unk_00C &= ~0x40000; + } else if ((owner->unk_000 & 0x4000) != 0) { + controller = &gControllers[banana_bunch->playerId]; + if ((controller->buttonPressed & 0x2000) != 0) { + controller->buttonPressed &= ~0x2000; + func_800C9060(owner - gPlayerOne, 0x19008012); + if ((controller->rawStickY >= 0x1F) && ((controller->rawStickX < 0x28) && (controller->rawStickX >= -0x27))) { + func_802B0788(controller->rawStickY, banana_bunch, owner); + } else { + func_802B0648(banana_bunch); } } - func_802B0648(banana_bunch); } break; + default: + break; } } #else @@ -474,7 +425,7 @@ s32 func_802B0E14(s16 arg0) { return 0; } temp = (struct ShellActor*) &gActorList[arg0]; - if (temp->type == 7) { + if (temp->type == ACTOR_GREEN_SHELL) { if (temp->state == 4) { return 1; } @@ -486,783 +437,575 @@ s32 func_802B0E14(s16 arg0) { return 0; } -#ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -? func_8000ED80(s32); /* extern */ -? func_8000EDC8(s32); /* extern */ -? func_800C9060(u8, ?); /* extern */ -? func_800C90F4(u8, s32); /* extern */ -? destroy_actor(struct TripleShellParent *); /* extern */ -s32 func_802B0E14(s16, s16); /* extern */ -s32 func_802B19EC(struct TripleShellParent *, Player *, s16, ?); /* extern */ -? func_802B64C4(f32 *, s16); /* extern */ +#ifdef NEEDS_RODATA +s32 func_8000ED80(s32); /* extern */ +s32 func_8000EDC8(s32); /* extern */ +void func_802B64C4(Vec3f, s16); /* extern */ -void update_obj_triple_shell(struct TripleShellParent *actor, s16 arg1) { - s16 sp4E; - struct ShellActor *sp44; - f32 sp40; - f32 sp3C; - f32 sp38; - s16 sp32; - Player *sp28; - Player *temp_v1_3; - Player *temp_v1_5; - Player *temp_v1_7; - f32 *temp_a0; - f32 *temp_a0_2; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f0_3; - s16 temp_t0; - s16 temp_t8; - s16 temp_v0; - s16 temp_v1_2; - s16 temp_v1_4; - s16 temp_v1_6; - s32 temp_v1; - struct Controller *temp_v0_5; - struct ShellActor *temp_v0_2; - struct ShellActor *temp_v0_3; - struct ShellActor *temp_v0_4; - struct ShellActor *temp_v0_6; - struct ShellActor *temp_v0_7; - struct ShellActor *temp_v0_8; - u16 temp_t9; - s16 phi_v1; - s16 phi_v1_2; - s16 phi_v1_3; +void update_obj_triple_shell(struct TripleShellParent *parent, s16 shellType) { + s32 pad4; + s32 pad3; + s16 playerId; + s16 pad0; + s32 pad1; + struct ShellActor *shell; + Vec3f someVelocity; + s32 pad2; + s16 someCount; + u16 someRotAngle; + Player *player; - temp_v0 = actor->rotVelocity; - temp_t9 = (u16) actor->state; - temp_t8 = actor->rotAngle + temp_v0; - temp_t0 = actor->playerId; - actor->rotAngle = temp_t8; - temp_v1 = temp_t8 & 0xFFFF; - switch (temp_t9) { + playerId = parent->playerId; + player = &gPlayers[playerId]; + parent->rotAngle += parent->rotVelocity; + someRotAngle = parent->rotAngle; + switch (parent->state) { case 0: - sp4E = temp_t0; - if (func_802B19EC(actor, &gPlayers[temp_t0], arg1, 0) != -1) { - func_800C9060(temp_t0 & 0xFF, 0x19008012); - actor->shellsAvailable += 1; + if (func_802B19EC(parent, &gPlayers[playerId], shellType, 0U) != -1) { + func_800C9060(playerId, 0x19008012); + parent->shellsAvailable += 1; } - actor->state = 1; - return; + parent->state = 1; + break; case 1: - if (temp_v0 > 0) { - if (temp_v1 >= 0xD556) { - sp4E = temp_t0; - if (func_802B19EC(actor, &gPlayers[temp_t0], arg1, 1) != -1) { - func_800C9060(temp_t0 & 0xFF, 0x19008012); - actor->shellsAvailable += 1; + if (parent->rotVelocity > 0) { + if (someRotAngle >= 0xD556) { + if (func_802B19EC(parent, &gPlayers[playerId], shellType, 1U) != -1) { + func_800C9060(playerId, 0x19008012); + parent->shellsAvailable += 1; } - actor->state = 2; - return; + parent->state = 2; } } else { - if (temp_v1 < 0x2AAA) { - sp4E = temp_t0; - if (func_802B19EC(actor, &gPlayers[temp_t0], arg1, 1) != -1) { - func_800C9060(temp_t0 & 0xFF, 0x19008012); - actor->shellsAvailable += 1; + if (someRotAngle < 0x2AAA) { + if (func_802B19EC(parent, &gPlayers[playerId], shellType, 1U) != -1) { + func_800C9060(playerId, 0x19008012); + parent->shellsAvailable += 1; } - actor->state = 2; - return; + parent->state = 2; } - default: - return; } break; case 2: - if (temp_v0 > 0) { - if ((temp_v1 >= 0x2AAB) && (temp_v1 < 0x31C7)) { - sp4E = temp_t0; - if (func_802B19EC(actor, &gPlayers[temp_t0], arg1, 2) != -1) { - func_800C9060(temp_t0 & 0xFF, 0x19008012); - actor->shellsAvailable += 1; + if (parent->rotVelocity > 0) { + if ((someRotAngle >= 0x2AAB) && (someRotAngle < 0x31C7)) { + if (func_802B19EC(parent, &gPlayers[playerId], shellType, 2U) != -1) { + func_800C9060(playerId, 0x19008012); + parent->shellsAvailable += 1; } - actor->state = 3; - return; + parent->state = 3; } - } else if ((temp_v1 < 0xD555) && (temp_v1 >= 0xCE39)) { - sp4E = temp_t0; - if (func_802B19EC(actor, &gPlayers[temp_t0], arg1, 2) != -1) { - func_800C9060(temp_t0 & 0xFF, 0x19008012); - actor->shellsAvailable += 1; + } else if ((someRotAngle < 0xD555) && (someRotAngle >= 0xCE39)) { + if (func_802B19EC(parent, &gPlayers[playerId], shellType, 2U) != -1) { + func_800C9060(playerId, 0x19008012); + parent->shellsAvailable += 1; } - actor->state = 3; - return; + parent->state = 3; } break; case 3: - actor->state = 4; - temp_v0_2 = &gActorList[(s16) (s32) actor->shellIndices[0]]; - temp_v0_2->flags |= 0x4000; - temp_v0_3 = &gActorList[(s16) (s32) actor->shellIndices[1]]; - temp_v0_3->flags |= 0x4000; - temp_v0_4 = &gActorList[(s16) (s32) actor->shellIndices[2]]; - temp_v0_4->flags |= 0x4000; - return; + parent->state = 4; + shell = (struct ShellActor*)&gActorList[(s16) parent->shellIndices[0]]; + shell->flags |= 0x4000; + shell = (struct ShellActor*)&gActorList[(s16) parent->shellIndices[1]]; + shell->flags |= 0x4000; + shell = (struct ShellActor*)&gActorList[(s16) parent->shellIndices[2]]; + shell->flags |= 0x4000; + break; case 4: - sp4E = temp_t0; - sp32 = 0; - phi_v1 = sp32; - if (func_802B0E14((s16) (s32) actor->shellIndices[0], arg1) == 1) { - phi_v1 = 1; + someCount = 0; + if (func_802B0E14(parent->shellIndices[0]) == 1) { + someCount = 1; } else { - actor->shellIndices[0] = -1.0f; + parent->shellIndices[0] = -1.0f; } - sp4E = temp_t0; - sp32 = phi_v1; - phi_v1_2 = phi_v1; - if (func_802B0E14((s16) (s32) actor->shellIndices[1]) == 1) { - phi_v1_2 = (s16) (phi_v1 + 1); + if (func_802B0E14(parent->shellIndices[1]) == 1) { + someCount++; } else { - actor->shellIndices[1] = -1.0f; + parent->shellIndices[1] = -1.0f; } - sp4E = temp_t0; - sp32 = phi_v1_2; - phi_v1_3 = phi_v1_2; - if (func_802B0E14((s16) (s32) actor->shellIndices[2]) == 1) { - phi_v1_3 = (s16) (phi_v1_2 + 1); + if (func_802B0E14(parent->shellIndices[2]) == 1) { + someCount++; } else { - actor->shellIndices[2] = -1.0f; + parent->shellIndices[2] = -1.0f; } - if (phi_v1_3 == 0) { - destroy_actor(actor); - return; + if (someCount == 0) { + destroy_actor((struct Actor *) parent); + break; } - temp_v0_5 = &gControllers[actor->playerId]; - if ((temp_v0_5->buttonPressed & 0x2000) != 0) { - actor->unk_08 += 1.0f; - temp_v0_5->buttonPressed &= 0xDFFF; + if ((gControllers[parent->playerId].buttonPressed & 0x2000) != 0) { + parent->unk_08 += 1.0f; + gControllers[parent->playerId].buttonPressed &= ~0x2000; } - if (actor->unk_08 > 0.0f) { - temp_f0 = actor->shellIndices[0]; - if ((temp_f0 > 0.0f) && ((temp_v0_6 = &gActorList[(s16) (s32) temp_f0], temp_v1_2 = temp_v0_6->rotAngle, temp_a0 = &sp38, ((temp_v1_2 < 0x38E) != 0)) || (temp_v1_2 >= -0x38D))) { - temp_v1_3 = &gPlayers[temp_t0]; - sp38 = 0.0f; - sp3C = 0.0f; - sp40 = 8.0f; - sp28 = temp_v1_3; - sp44 = temp_v0_6; - func_802B64C4(temp_a0, (s16) (temp_v1_3->unk_02E + temp_v1_3->unk_0C0)); - temp_v0_6->velocity[0] = sp38; - temp_v0_6->velocity[1] = sp3C; - temp_v0_6->state = 2; - temp_v0_6->parentIndex = 0x001E; - temp_v0_6->velocity[2] = sp40; - func_800C9060(actor->unk15, 0x19008004); - func_800C90F4(actor->unk15, (temp_v1_3->characterId * 0x10) + 0x29008000); - if (actor->type == 0x0016) { - func_8000ED80((s32) actor->shellIndices[0]); - } else { - func_8000EDC8((s32) actor->shellIndices[0]); + if (parent->unk_08 > 0.0f) { + if (parent->shellIndices[0] > 0.0f) { + shell = &gActorList[(s16)parent->shellIndices[0]]; + if((shell->rotAngle < 0x38E) || (shell->rotAngle >= -0x38D)) { + someVelocity[0] = 0; + someVelocity[1] = 0; + someVelocity[2] = 8; + func_802B64C4(someVelocity, player->unk_02E + player->unk_0C0); + shell->velocity[0] = someVelocity[0]; + shell->velocity[1] = someVelocity[1]; + shell->velocity[2] = someVelocity[2]; + shell->state = 2; + shell->someTimer = 0x001E; + func_800C9060(parent->playerId, 0x19008004); + func_800C90F4(parent->playerId, (player->characterId * 0x10) + 0x29008000); + if (parent->type == ACTOR_TRIPLE_RED_SHELL) { + func_8000ED80(parent->shellIndices[0]); + } else { + func_8000EDC8(parent->shellIndices[0]); + } + parent->shellIndices[0] = -1.0f; + parent->shellsAvailable -= 1; + parent->unk_08 -= 1.0f; + break; } - actor->shellIndices[0] = -1.0f; - actor->shellsAvailable += -1; - actor->unk_08 -= 1.0f; - return; } - temp_f0_2 = actor->shellIndices[1]; - if ((temp_f0_2 > 0.0f) && ((temp_v0_7 = &gActorList[(s16) (s32) temp_f0_2], temp_v1_4 = temp_v0_7->rotAngle, ((temp_v1_4 < 0xAA1) != 0)) || (temp_v1_4 >= 0x38F))) { - temp_v1_5 = &gPlayers[temp_t0]; - sp38 = 0.0f; - sp3C = 0.0f; - sp40 = 8.0f; - sp28 = temp_v1_5; - sp44 = temp_v0_7; - func_802B64C4(&sp38, (s16) (temp_v1_5->unk_02E + temp_v1_5->unk_0C0)); - sp44->velocity[0] = sp38; - sp44->velocity[1] = sp3C; - sp44->state = 2; - sp44->parentIndex = 0x001E; - sp44->velocity[2] = sp40; - func_800C90F4(actor->unk15, (sp28->characterId * 0x10) + 0x29008000); - func_800C9060(actor->unk15, 0x19008004); - if (actor->type == 0x0016) { - func_8000ED80((s32) actor->shellIndices[1]); - } else { - func_8000EDC8((s32) actor->shellIndices[1]); + if (parent->shellIndices[1] > 0.0f) { + shell = &gActorList[(s16)parent->shellIndices[1]]; + if((shell->rotAngle < 0xAA1) || (shell->rotAngle >= 0x38F)) { + someVelocity[0] = 0; + someVelocity[1] = 0; + someVelocity[2] = 8; + func_802B64C4(someVelocity, player->unk_02E + player->unk_0C0); + shell->velocity[0] = someVelocity[0]; + shell->velocity[1] = someVelocity[1]; + shell->velocity[2] = someVelocity[2]; + shell->state = 2; + shell->someTimer = 0x001E; + func_800C90F4(parent->playerId, (player->characterId * 0x10) + 0x29008000); + func_800C9060(parent->playerId, 0x19008004); + if (parent->type == ACTOR_TRIPLE_RED_SHELL) { + func_8000ED80(parent->shellIndices[1]); + } else { + func_8000EDC8(parent->shellIndices[1]); + } + parent->shellIndices[1] = -1.0f; + parent->shellsAvailable -= 1; + parent->unk_08 -= 1.0f; + break; } - actor->shellIndices[1] = -1.0f; - actor->shellsAvailable += -1; - actor->unk_08 -= 1.0f; - return; } - temp_f0_3 = actor->shellIndices[2]; - if ((temp_f0_3 > 0.0f) && ((temp_v0_8 = &gActorList[(s16) (s32) temp_f0_3], temp_v1_6 = temp_v0_8->rotAngle, temp_a0_2 = &sp38, ((temp_v1_6 < -0x38E) != 0)) || (temp_v1_6 >= -0x71B))) { - temp_v1_7 = &gPlayers[temp_t0]; - sp38 = 0.0f; - sp3C = 0.0f; - sp40 = 8.0f; - sp28 = temp_v1_7; - sp44 = temp_v0_8; - func_802B64C4(temp_a0_2, (s16) (temp_v1_7->unk_02E + temp_v1_7->unk_0C0)); - temp_v0_8->velocity[0] = sp38; - temp_v0_8->velocity[1] = sp3C; - temp_v0_8->state = 2; - temp_v0_8->parentIndex = 0x001E; - temp_v0_8->velocity[2] = sp40; - func_800C9060(actor->unk15, 0x19008004); - func_800C90F4(actor->unk15, (temp_v1_7->characterId * 0x10) + 0x29008000); - if (actor->type == 0x0016) { - func_8000ED80((s32) actor->shellIndices[2]); - } else { - func_8000EDC8((s32) actor->shellIndices[2]); + if (parent->shellIndices[2] > 0.0f) { + shell = &gActorList[(s16)parent->shellIndices[2]]; + if((shell->rotAngle < -0x38E) || (shell->rotAngle >= -0x71B)) { + someVelocity[0] = 0; + someVelocity[1] = 0; + someVelocity[2] = 8; + func_802B64C4(someVelocity, player->unk_02E + player->unk_0C0); + shell->velocity[0] = someVelocity[0]; + shell->velocity[1] = someVelocity[1]; + shell->velocity[2] = someVelocity[2]; + shell->state = 2; + shell->someTimer = 0x001E; + func_800C9060(parent->playerId, 0x19008004); + func_800C90F4(parent->playerId, (player->characterId * 0x10) + 0x29008000); + if (parent->type == ACTOR_TRIPLE_RED_SHELL) { + func_8000ED80(parent->shellIndices[2]); + } else { + func_8000EDC8(parent->shellIndices[2]); + } + parent->shellIndices[2] = -1.0f; + parent->shellsAvailable -= 1; + parent->unk_08 -= 1.0f; + break; } - actor->shellIndices[2] = -1.0f; - actor->shellsAvailable += -1; - actor->unk_08 -= 1.0f; } } break; + default: + break; } } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/update_obj_triple_shell.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s16 func_8029EC88(? *, ? *, ? *, ?); // extern -extern ? gActorList; -extern ? D_802B9140; -extern ? D_802B914C; -extern ? D_802B9154; +#ifdef NEEDS_RODATA +// The initial values for the starting* variables end up in D_802B9140, D_802B914C, and D_802B9154 +// This function could reasonably be called "spawn_banana_bunch" or something similar -s16 func_802B17F4(void *arg0) { - ? sp34; - ? sp2C; - ? sp20; - s16 temp_v0; - void *temp_v1; +s32 func_802B17F4(Player *player) { + Vec3f startingVelocity = {0.0f, 0.0f, 0.0f}; + Vec3s startingRot = {0, 0, 0}; + Vec3f startingPos = {0.0f, 0.0f, 0.0f}; + s16 actorIndex; + struct BananaBunchParent *bananaBunch; - sp34.unk0 = D_802B9140.unk0; - sp34.unk4 = D_802B9140.unk4; - sp34.unk8 = D_802B9140.unk8; - sp2C.unk0 = D_802B914C.unk0; - sp2C.unk4 = D_802B914C.unk4; - sp20.unk0 = D_802B9154.unk0; - sp20.unk4 = D_802B9154.unk4; - sp20.unk8 = D_802B9154.unk8; - temp_v0 = func_8029EC88(&sp20, &sp2C, &sp34, 0xE); - if (temp_v0 < 0) { - return temp_v0; + actorIndex = func_8029EC88(startingPos, startingRot, startingVelocity, ACTOR_BANANA_BUNCH); + if (actorIndex < 0) { + return actorIndex; } - temp_v1 = (temp_v0 * 0x70) + &gActorList; - temp_v1->unk6 = 0; - temp_v1->rot = (arg0 - gPlayerOne) / 0xDD8; - arg0->unkC = arg0->unkC | 0x40000; - return temp_v0; + bananaBunch = &gActorList[actorIndex]; + bananaBunch->state = 0; + bananaBunch->playerId = player - gPlayerOne; + player->unk_00C |= 0x40000; + return actorIndex; } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B17F4.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s16 func_8029EC88(? *, ? *, ? *, s16); // extern -extern ? gActorList; -extern ? D_802B9160; -extern ? D_802B916C; -extern ? D_802B9174; +#ifdef NEEDS_RODATA +// The initial values for the starting* variables end up in D_802B9160, D_802B916C, and D_802B9174 +// This function could reasonably be called "spawn_triple_shell" or something similar -s16 func_802B18E4(s32 arg0, s16 arg1) { - ? sp34; - ? sp2C; - ? sp20; - s16 temp_v0; - void *temp_v1; +s32 func_802B18E4(Player *player, s16 tripleShellType) { + Vec3f startingVelocity = {0.0f, 0.0f, 0.0f}; + Vec3s startingRot = {0, 0, 0}; + Vec3f startingPos = {0.0f, 0.0f, 0.0f}; + s16 actorIndex; + struct TripleShellParent *parent; - sp34.unk0 = D_802B9160.unk0; - sp34.unk4 = D_802B9160.unk4; - sp34.unk8 = D_802B9160.unk8; - sp2C.unk0 = D_802B916C.unk0; - sp2C.unk4 = D_802B916C.unk4; - sp20.unk0 = D_802B9174.unk0; - sp20.unk4 = D_802B9174.unk4; - sp20.unk8 = D_802B9174.unk8; - temp_v0 = func_8029EC88(&sp20, &sp2C, &sp34, arg1); - if (temp_v0 < 0) { - return temp_v0; + actorIndex = func_8029EC88(startingPos, startingRot, startingVelocity, tripleShellType); + if (actorIndex < 0) { + return actorIndex; } - temp_v1 = (temp_v0 * 0x70) + &gActorList; - temp_v1->unk6 = 0; - temp_v1->rot = 0x5B0; - temp_v1->unk12 = -0x8000; - temp_v1->unk14 = (arg0 - gPlayerOne) / 0xDD8; - temp_v1->unk_04 = 0; - temp_v1->unk_08 = 0.0f; - return temp_v0; + parent = &gActorList[actorIndex]; + parent->state = 0; + parent->rotVelocity = 0x05B0; + parent->rotAngle = -0x8000; + parent->playerId = player - gPlayerOne; + parent->shellsAvailable = 0; + parent->unk_08 = 0.0f; + return actorIndex; } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B18E4.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -s16 func_8029EC88(f32 *, ? *, ? *, s16); /* extern */ -? func_802AD950(void *, f32, s32, s32, f32, f32, f32, f32); /* extern */ -? func_802B4E30(void *); /* extern */ -? func_802B63B8(f32 *, f32 *); /* extern */ -static ? D_802B9180; /* unable to generate initializer */ -static ? D_802B918C; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// The initial values for the starting* variables end up in D_802B9180 and D_802B918C +// This function could reasonably be called "spawn_shell_for_triple_shell" or something similar -s32 func_802B19EC(struct TripleShellParent *arg0, Player *player, s16 arg2, u16 arg3) { - ? sp54; - ? sp4C; - f32 sp48; - f32 sp44; - f32 sp40; - f32 *temp_a0; - f32 *temp_a0_2; - f32 *temp_a1; - s16 temp_v0; - s32 temp_t3; - void *temp_s0; +s32 func_802B19EC(struct TripleShellParent *parent, Player *player, s16 shellType, u16 shellId) { + Vec3f startingVelocity = {0.0f, 0.0f, 0.0f}; + Vec3s startingRot = {0, 0, 0}; + Vec3f startingPos; + s16 actorIndex; + struct ShellActor *shell; - sp54.unk0 = (s32) D_802B9180.unk0; - sp54.unk4 = (s32) D_802B9180.unk4; - sp54.unk8 = (s32) D_802B9180.unk8; - temp_a1 = player->unk_174; - temp_a0 = &sp40; - sp4C.unk0 = (s32) D_802B918C.unk0; - sp4C.unk4 = (u16) D_802B918C.unk4; - sp40 = 0.0f; - sp44 = -temp_a1->unk-104; - sp48 = temp_a1->unk-104 - 4.0f; - func_802B63B8(temp_a0, temp_a1); - temp_a0_2 = &sp40; - sp40 = 0.0f + player->pos[0]; - sp44 += player->pos[1]; - sp48 += player->pos[2]; - temp_v0 = func_8029EC88(temp_a0_2, &sp4C, &sp54, arg2); - if (temp_v0 < 0) { - arg0->shellIndices[arg3] = -1.0f; + startingPos[0] = 0.0f; + startingPos[1] = -player->boundingBoxSize; + startingPos[2] = player->boundingBoxSize - 4.0f; + func_802B63B8(startingPos, player->unk_174); + startingPos[0] += player->pos[0]; + startingPos[1] += player->pos[1]; + startingPos[2] += player->pos[2]; + + actorIndex = func_8029EC88(startingPos, startingRot, startingVelocity, shellType); + if (actorIndex < 0) { + parent->shellIndices[shellId] = -1.0f; return -1; } - temp_t3 = temp_v0 * 7; - sp40 = player->pos[0]; - temp_s0 = (temp_t3 * 0x10) + gActorList; - sp44 = player->pos[1]; - sp48 = player->pos[2]; - func_802AD950(temp_s0 + 0x30, temp_s0->unkC + 1.0f, temp_s0->pos, temp_s0->unk1C, temp_s0->unk20, sp40, sp44, sp48); - func_802B4E30(temp_s0); - temp_s0->unk2 = -0x7000; - switch (arg2) { /* irregular */ - case 7: - temp_s0->unk6 = 4; + + shell = &gActorList[actorIndex]; + startingPos[0] = player->pos[0]; + startingPos[1] = player->pos[1]; + startingPos[2] = player->pos[2]; + func_802AD950(&shell->unk30, shell->boundingBoxSize + 1.0f, shell->pos[0], shell->pos[1], shell->pos[2], startingPos[0], startingPos[1], startingPos[2]); + func_802B4E30(shell); + shell->flags = 0x9000; + switch (shellType) { + case ACTOR_GREEN_SHELL: + shell->state = 4; break; - case 8: - temp_s0->unk6 = 6; + case ACTOR_RED_SHELL: + shell->state = 6; break; } - temp_s0->rot = 0; - temp_s0->unk12 = -0x8000; - temp_s0->unk14 = (s16) ((s32) (player - gPlayerOne) / 3544); - temp_s0->unk_04 = (s16) ((s32) (arg0 - gActorList) / 112); - temp_s0->unk_08 = (f32) arg3; - arg0->shellIndices[arg3] = (f32) ((s32) (temp_s0 - gActorList) / 112); + shell->rotVelocity = 0; + shell->rotAngle = -0x8000; + shell->playerId = player - gPlayerOne; + shell->parentIndex = (struct Actor*)parent - gActorList; + shell->shellId = shellId; + parent->shellIndices[shellId] = (struct Actor*)shell - gActorList; return 1; } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B19EC.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s16 func_8029EC88(f32 *, ? *, ? *, ?); // extern -? func_802AD950(void *, f32, s32, s32, f32, f32, f32, f32); // extern -? func_802B4E30(void *); // extern -? func_802B63B8(f32 *, s32); // extern -extern ? gActorList; -extern ? D_802B9194; -extern ? D_802B91A0; +#ifdef NEEDS_RODATA +// The initial values for the starting* variables end up in D_802B9194 and D_802B91A0 +// This function could reasonably be called "spawn_green_shell" or something similar -s16 func_802B1C9C(void *arg0) { - ? sp54; - ? sp4C; - f32 sp48; - f32 sp44; - f32 sp40; - s16 sp3E; - f32 *temp_a0; - s16 temp_v0; - s16 temp_v1; - s32 temp_t8; - void *temp_s0; +s32 func_802B1C9C(Player *player) { + Vec3f startingVelocity = {0.0f, 0.0f, 0.0f}; + Vec3s startingRot = {0, 0, 0}; + Vec3f startingPos; + s16 actorIndex; + struct ShellActor *shell; - sp54.unk0 = D_802B9194.unk0; - sp54.unk4 = D_802B9194.unk4; - sp54.unk8 = D_802B9194.unk8; - sp4C.unk0 = D_802B91A0.unk0; - sp4C.unk4 = D_802B91A0.unk4; - sp40 = 0.0f; - sp44 = -arg0->unk70; - sp48 = arg0->unk70 - 4.0f; - func_802B63B8(&sp40, arg0 + 0x174); - temp_a0 = &sp40; - sp40 = 0.0f + arg0->unk14; - sp44 += arg0->pos; - sp48 += arg0->unk1C; - temp_v0 = func_8029EC88(temp_a0, &sp4C, &sp54, 7); - temp_v1 = temp_v0; - if (temp_v0 < 0) { - return temp_v0; + startingPos[0] = 0.0f; + startingPos[1] = -player->boundingBoxSize; + startingPos[2] = player->boundingBoxSize - 4.0f; + func_802B63B8(startingPos, player->unk_174); + startingPos[0] += player->pos[0]; + startingPos[1] += player->pos[1]; + startingPos[2] += player->pos[2]; + actorIndex = func_8029EC88(startingPos, startingRot, startingVelocity, ACTOR_GREEN_SHELL); + if (actorIndex < 0) { + return actorIndex; } - temp_t8 = temp_v1 * 7; - sp40 = arg0->unk14; - temp_s0 = (temp_t8 * 0x10) + &gActorList; - sp44 = arg0->pos; - sp48 = arg0->unk1C; - sp3E = temp_v1; - func_802AD950(temp_s0 + 0x30, temp_s0->unkC + 1.0f, temp_s0->pos, temp_s0->unk1C, temp_s0->unk20, sp40, sp44, sp48); - func_802B4E30(temp_s0); - temp_s0->unk6 = 0; - temp_s0->rot = 0; - temp_s0->unk12 = -0x8000; - temp_s0->unk14 = (arg0 - gPlayerOne) / 0xDD8; - return sp3E; + + shell = &gActorList[actorIndex]; + startingPos[0] = player->pos[0]; + startingPos[1] = player->pos[1]; + startingPos[2] = player->pos[2]; + func_802AD950(&shell->unk30, shell->boundingBoxSize + 1.0f, shell->pos[0], shell->pos[1], shell->pos[2], startingPos[0], startingPos[1], startingPos[2]); + func_802B4E30(shell); + shell->state = 0; + shell->rotVelocity = 0; + shell->rotAngle = -0x8000; + shell->playerId = player - gPlayerOne; + return actorIndex; } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B1C9C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s16 func_8029EC88(f32 *, ? *, ? *, ?); // extern -? func_802AD950(void *, f32, s32, s32, f32, f32, f32, f32); // extern -? func_802B4E30(void *); // extern -? func_802B63B8(f32 *, s32); // extern -extern ? gActorList; -extern ? D_802B91A8; -extern ? D_802B91B4; +#if NEEDS_RODATA +// The initial values for the starting* variables end up in D_802B91A8 and D_802B91B4 +// This function could reasonably be called "spawn_red_blue_shell" or something similar -s16 func_802B1E48(void *arg0) { - ? sp54; - ? sp4C; - f32 sp48; - f32 sp44; - f32 sp40; - s16 sp3E; - f32 *temp_a0; - s16 temp_v0; - s16 temp_v1; - s32 temp_t8; - void *temp_s0; +s32 func_802B1E48(Player *player) { + Vec3f startingVelocity = {0.0f, 0.0f, 0.0f}; + Vec3s startingRot = {0, 0, 0}; + Vec3f startingPos; + s16 actorIndex; + struct ShellActor *shell; - sp54.unk0 = D_802B91A8.unk0; - sp54.unk4 = D_802B91A8.unk4; - sp54.unk8 = D_802B91A8.unk8; - sp4C.unk0 = D_802B91B4.unk0; - sp4C.unk4 = D_802B91B4.unk4; - sp40 = 0.0f; - sp44 = -arg0->unk70; - sp48 = arg0->unk70 - 4.0f; - func_802B63B8(&sp40, arg0 + 0x174); - temp_a0 = &sp40; - sp40 = 0.0f + arg0->unk14; - sp44 += arg0->pos; - sp48 += arg0->unk1C; - temp_v0 = func_8029EC88(temp_a0, &sp4C, &sp54, 8); - temp_v1 = temp_v0; - if (temp_v0 < 0) { - return temp_v0; + startingPos[0] = 0.0f; + startingPos[1] = -player->boundingBoxSize; + startingPos[2] = player->boundingBoxSize - 4.0f; + func_802B63B8(startingPos, player->unk_174); + startingPos[0] += player->pos[0]; + startingPos[1] += player->pos[1]; + startingPos[2] += player->pos[2]; + actorIndex = func_8029EC88(startingPos, startingRot, startingVelocity, ACTOR_RED_SHELL); + if (actorIndex < 0) { + return actorIndex; } - temp_t8 = temp_v1 * 7; - sp40 = arg0->unk14; - temp_s0 = (temp_t8 * 0x10) + &gActorList; - sp44 = arg0->pos; - sp48 = arg0->unk1C; - sp3E = temp_v1; - func_802AD950(temp_s0 + 0x30, temp_s0->unkC + 1.0f, temp_s0->pos, temp_s0->unk1C, temp_s0->unk20, sp40, sp44, sp48); - func_802B4E30(temp_s0); - temp_s0->unk6 = 0; - temp_s0->rot = 0; - temp_s0->unk12 = arg0->unk2E - 0x8000; - temp_s0->unk14 = (arg0 - gPlayerOne) / 0xDD8; - return sp3E; + + shell = &gActorList[actorIndex]; + startingPos[0] = player->pos[0]; + startingPos[1] = player->pos[1]; + startingPos[2] = player->pos[2]; + func_802AD950(&shell->unk30, shell->boundingBoxSize + 1.0f, shell->pos[0], shell->pos[1], shell->pos[2], startingPos[0], startingPos[1], startingPos[2]); + func_802B4E30(shell); + shell->state = 0; + shell->rotVelocity = 0; + shell->rotAngle = player->unk_02E - 0x8000; + shell->playerId = player - gPlayerOne; + return actorIndex; } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B1E48.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_802B1E48(); // extern -extern ? gActorList; - -void func_802B1FFC(void) { - *(&gActorList + (func_802B1E48() * 0x70)) = 0x2A; +// This function could reasonably be called "spawn_blue_shell" +// Interestingly blue shells start their life as a red shell, +// and then just change the type from red to blue shell +void func_802B1FFC(Player *player) { + gActorList[func_802B1E48(player)].type = ACTOR_BLUE_SPINY_SHELL; } -#else -GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B1FFC.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -? func_800C9060(s32, ?, u16); /* extern */ -? destroy_actor(struct BananaActor *); /* extern */ -? func_8029FDC8(f32, struct BananaActor *); /* extern */ -? func_802ADDC8(f32, UnkActorInner *, UnkActorInner *, f32, f32, f32, f32); /* extern */ -? func_802B4E30(struct BananaActor *); /* extern */ -? func_802B64C4(f32 *, s16); /* extern */ -? vec3f_set(f32, f32 *, ?, f32, f32); /* extern */ +#ifdef INCORRECT_REGALLOC +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b +void func_802B64C4(Vec3f, s16); /* extern */ +extern u16 D_800DC51C; extern s16 D_8015F6E8; extern s16 D_8015F6EA; -extern s16 D_8015F6EE; extern s16 D_8015F6F0; extern s16 D_8015F6F2; extern struct Controller *gControllerOne; -static f32 D_802B9EE0 = 0.2f; -static f32 D_802B9EE4 = 0.15f; -static f32 D_802B9EE8 = 0.2f; -static f32 D_802B9EEC = 0.2f; -static f32 D_802B9EF0 = 0.3f; +// NEED_RODATA +extern f32 D_802B9EE0;// = 0.2f; +extern f32 D_802B9EE4;// = 0.15f; +extern f32 D_802B9EE8;// = 0.2f; +extern f32 D_802B9EEC;// = 0.2f; +extern f32 D_802B9EF0;// = 0.3f; void update_obj_banana(struct BananaActor *banana) { - Player *sp88; - struct Actor *sp84; - struct Controller *sp80; - f32 sp7C; - f32 sp78; - f32 sp74; - f32 sp70; - f32 sp6C; - f32 sp68; - f32 sp48; - f32 sp44; - f32 sp40; - f32 sp3C; - f32 sp38; - f32 sp34; - Player *temp_v0; - f32 temp_f0; - f32 temp_f0_10; - f32 temp_f0_2; + f32 pad0; + Player *player; + struct BananaActor *elderBanana; + struct Controller *controller; + Vec3f someOtherVelocity; + Vec3f someVelocity; + f32 pad1; + f32 pad2; + f32 pad3; + f32 pad4; + f32 pad5; f32 temp_f0_3; - f32 temp_f0_4; - f32 temp_f0_5; - f32 temp_f0_6; - f32 temp_f0_7; - f32 temp_f0_8; - f32 temp_f0_9; - f32 temp_f10; f32 temp_f12; - f32 temp_f12_2; - f32 temp_f12_3; - f32 temp_f14; - f32 temp_f14_2; - f32 temp_f14_3; - f32 temp_f14_4; - f32 temp_f14_5; - f32 temp_f16; - f32 temp_f16_2; - f32 temp_f16_3; - f32 temp_f18; - f32 temp_f2; - f32 temp_f2_2; - f32 temp_f2_3; - f32 temp_f2_4; - f32 temp_f2_5; - s16 temp_a0; - s16 temp_v0_2; - struct Actor *temp_v0_3; - u16 temp_a2; - u16 temp_t9; - f32 phi_f6; - UnkActorInner *phi_f14; - struct Controller *phi_v1; - f32 phi_f12; - f32 phi_f8; - UnkActorInner *phi_f14_2; + f32 x_dist; + f32 y_dist; + f32 z_dist; + f32 x_pos; + f32 y_pos; + f32 z_pos; - temp_t9 = (u16) banana->state; - temp_v0 = &gPlayers[banana->playerId]; - switch (temp_t9) { + player = &gPlayers[banana->playerId]; + switch (banana->state) { case 0: - temp_f2 = temp_v0->pos[0] - banana->pos[0]; - temp_f14 = temp_v0->pos[1] - banana->pos[1]; - sp48 = temp_f2; - temp_f16 = temp_v0->pos[2] - banana->pos[2]; - sp44 = temp_f14; - sp88 = temp_v0; - sp40 = temp_f16; - temp_f12 = sqrtf((temp_f2 * temp_f2) + (temp_f14 * temp_f14) + (temp_f16 * temp_f16)) / 10.0f; - phi_f14 = (bitwise UnkActorInner *) temp_f14; + x_dist = player->pos[0] - banana->pos[0]; + y_dist = player->pos[1] - banana->pos[1]; + z_dist = player->pos[2] - banana->pos[2]; + temp_f12 = sqrtf((x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist)) / 10.0f; if (temp_f12 == 0.0f) { - temp_f0 = D_802B9EE0; - banana->pos[0] = temp_v0->pos[0] + temp_f0; - banana->pos[1] = temp_v0->pos[1] + temp_f0; - phi_f6 = temp_v0->pos[2] + temp_f0; + banana->pos[0] = player->pos[0] + 0.2f; + banana->pos[1] = player->pos[1] + 0.2f; + banana->pos[2] = player->pos[2] + 0.2f; } else { - temp_f14_2 = temp_f14 / temp_f12; - banana->pos[0] = temp_v0->pos[0] - (temp_f2 / temp_f12); - banana->pos[1] = (temp_v0->pos[1] - temp_f14_2) - 2.0f; - phi_f6 = temp_v0->pos[2] - (temp_f16 / temp_f12); - phi_f14 = (bitwise UnkActorInner *) temp_f14_2; + x_dist /= temp_f12; + y_dist /= temp_f12; + z_dist /= temp_f12; + banana->pos[0] = player->pos[0] - x_dist; + banana->pos[1] = (player->pos[1] - y_dist) - 2.0f; + banana->pos[2] = player->pos[2] - z_dist; } - banana->pos[2] = phi_f6; - sp88 = temp_v0; - func_802ADDC8(temp_f12, phi_f14, &banana->unk30, banana->boundingBoxSize + 1.0f, banana->pos[0], banana->pos[1], banana->pos[2]); - func_802B4E30(banana); - if ((temp_v0->unk_000 & 0x4000) != 0) { + func_802ADDC8(&banana->unk30, banana->boundingBoxSize + 1.0f, banana->pos[0], banana->pos[1], banana->pos[2]); + func_802B4E30((struct Actor *) banana); + if ((player->unk_000 & 0x4000) != 0) { if (D_800DC51C != 0) { - phi_v1 = gControllerOne; + controller = gControllerOne; } else { - phi_v1 = &gControllers[banana->playerId]; + controller = &gControllers[banana->playerId]; } - temp_a2 = phi_v1->buttonDepressed; - if ((temp_a2 & 0x2000) != 0) { - phi_v1->buttonDepressed = temp_a2 & 0xDFFF; + if ((controller->buttonDepressed & 0x2000) != 0) { + controller->buttonDepressed &= ~0x2000; banana->state = 1; banana->unk_04 = 0x00B4; - temp_v0->unk_00C &= 0xFFFBFFFF; - sp80 = phi_v1; - sp88 = temp_v0; - func_800C9060(((s32) (temp_v0 - gPlayerOne) / 3544) & 0xFF, 0x19008012, temp_a2); - temp_f0_2 = (f32) phi_v1->rawStickY; - if (temp_f0_2 > 30.0f) { - temp_a0 = phi_v1->rawStickX; - if ((temp_a0 < 0xA) && (temp_a0 >= -9)) { - temp_f2_2 = temp_v0->unk_094; - temp_f0_3 = ((temp_f0_2 - 30.0f) / 20.0f) + 0.5f; - if (temp_f2_2 < 2.0f) { - phi_f12 = 4.0f; + player->unk_00C &= ~0x40000; + func_800C9060(player - gPlayerOne, 0x19008012); + if (controller->rawStickY > 30.0f) { + if ((controller->rawStickX < 0xA) && (controller->rawStickX >= -9)) { + temp_f0_3 = ((controller->rawStickY - (f32)30) / 20.0f) + 0.5f; + if (player->unk_094 < 2.0f) { + temp_f12 = 4.0f; } else { - phi_f12 = (temp_f2_2 * 0.75f) + 3.5f + temp_f0_3; + temp_f12 = (player->unk_094 * 0.75f) + 3.5f + temp_f0_3; } - sp88 = temp_v0; - vec3f_set(phi_f12, &sp68, 0, temp_f0_3, phi_f12); - func_802B64C4(&sp68, (s16) (sp88->unk_02E + sp88->unk_0C0)); - banana->velocity[0] = sp68; - banana->velocity[1] = sp6C; - banana->velocity[2] = sp70; - return; + vec3f_set(someVelocity, 0, temp_f0_3, temp_f12); + func_802B64C4(someVelocity, player->unk_02E + player->unk_0C0); + banana->velocity[0] = someVelocity[0]; + banana->velocity[1] = someVelocity[1]; + banana->velocity[2] = someVelocity[2]; + break; } } - banana->velocity[0] = 0.0f; - banana->velocity[2] = 0.0f; + banana->velocity[0] = 0; + banana->velocity[2] = 0; banana->velocity[1] = 1.5f; - return; } - } else { - default: - return; } break; case 1: - temp_v0_2 = banana->unk_04; - if (temp_v0_2 != 0) { - banana->unk_04 = temp_v0_2 - 1; + if (banana->unk_04 != 0) { + banana->unk_04 -= 1; if (banana->unk_04 == 0) { - banana->flags &= 0xEFFF; + banana->flags &= ~0x1000; } } - temp_f0_4 = banana->velocity[1]; banana->pos[0] += banana->velocity[0]; banana->pos[2] += banana->velocity[2]; - if (temp_f0_4 > -1.0f) { - banana->velocity[1] = temp_f0_4 - D_802B9EE4; + if (banana->velocity[1] > -1.0f) { + banana->velocity[1] -= 0.15f; } - temp_f12_2 = banana->pos[2]; banana->pos[1] += banana->velocity[1]; - if ((temp_f12_2 < (f32) D_8015F6F2) || ((f32) D_8015F6F0 < temp_f12_2) || (temp_f0_5 = banana->pos[0], (temp_f0_5 < (f32) D_8015F6EA)) || ((f32) D_8015F6E8 < temp_f0_5) || (temp_f2_3 = banana->pos[1], (temp_f2_3 < (f32) D_8015F6EE))) { - func_8029FDC8(temp_f12_2, banana); - return; - } - func_802ADDC8(temp_f12_2, &banana->unk30, (bitwise UnkActorInner *) (banana->boundingBoxSize + 1.0f), temp_f0_5, temp_f2_3, temp_f12_2); - banana->unk30.unk34 = 1; - if (((1U & 0xFFFF) != 0) && (banana->unk30.unk44 < 0.0f)) { - sp74 = -banana->unk30.unk60[0]; - sp78 = -banana->unk30.unk60[1]; - sp7C = -banana->unk30.unk60[2]; - temp_f0_6 = banana->unk30.unk44; - banana->pos[0] += sp74 * temp_f0_6; - banana->pos[1] += sp78 * temp_f0_6; - banana->flags &= 0xEFFF; - banana->state = 4; - banana->pos[2] += sp7C * temp_f0_6; - return; + if ((banana->pos[2] < D_8015F6F2) || (D_8015F6F0 < banana->pos[2]) || + (banana->pos[0] < D_8015F6EA) || (D_8015F6E8 < banana->pos[0]) || + (banana->pos[1] < D_8015F6EE)) { + func_8029FDC8((struct Actor *) banana); + } else { + func_802ADDC8(&banana->unk30, banana->boundingBoxSize + 1.0f, banana->pos[0], banana->pos[1], banana->pos[2]); + banana->unk30.unk34 = 1; + if ((banana->unk30.unk34 != 0) && (banana->unk30.unk44 < 0.0f)) { + someOtherVelocity[0] = -banana->unk30.unk60[0]; + someOtherVelocity[1] = -banana->unk30.unk60[1]; + someOtherVelocity[2] = -banana->unk30.unk60[2]; + banana->pos[0] += someOtherVelocity[0] * banana->unk30.unk44; + banana->pos[1] += someOtherVelocity[1] * banana->unk30.unk44; + banana->pos[2] += someOtherVelocity[2] * banana->unk30.unk44; + banana->flags &= ~0x1000; + banana->state = 4; + } } break; case 2: - sp68 = 0.0f; - sp6C = 0.0f; - sp70 = -5.0f; - sp88 = temp_v0; - func_802B64C4(&sp68, (s16) (temp_v0->unk_02E + temp_v0->unk_0C0)); - temp_f18 = sp68 + sp88->pos[0]; - temp_f0_7 = sp6C + sp88->pos[1]; - temp_f10 = sp70 + sp88->pos[2]; - sp34 = temp_f10; - temp_f2_4 = temp_f18 - banana->pos[0]; - sp3C = temp_f18; - sp38 = temp_f0_7; - temp_f14_3 = temp_f0_7 - banana->pos[1]; - sp48 = temp_f2_4; - temp_f16_2 = temp_f10 - banana->pos[2]; - sp44 = temp_f14_3; - sp40 = temp_f16_2; - temp_f0_8 = sqrtf((temp_f2_4 * temp_f2_4) + (temp_f14_3 * temp_f14_3) + (temp_f16_2 * temp_f16_2)); - if (temp_f0_8 == 0.0f) { - temp_f0_9 = D_802B9EE8; - banana->pos[0] = sp88->pos[0] + temp_f0_9; - banana->pos[1] = sp88->pos[1] + temp_f0_9; - banana->pos[2] = sp88->pos[2] + temp_f0_9; + someVelocity[0] = 0.0f; + someVelocity[1] = 0.0f; + someVelocity[2] = -5.0f; + func_802B64C4(someVelocity, player->unk_02E + player->unk_0C0); + x_pos = someVelocity[0] + player->pos[0]; + y_pos = someVelocity[1] + player->pos[1]; + z_pos = someVelocity[2] + player->pos[2]; + x_dist = x_pos - banana->pos[0]; + y_dist = y_pos - banana->pos[1]; + z_dist = z_pos - banana->pos[2]; + // There lots of regalloc differences throughout this function, but it seems to + // originate with an extra line of assembly near this function call + temp_f12 = sqrtf((x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist)); + if (temp_f12 == 0.0f) { + banana->pos[0] = player->pos[0] + 0.2f; + banana->pos[1] = player->pos[1] + 0.2f; + banana->pos[2] = player->pos[2] + 0.2f; } else { - banana->pos[0] = sp68 + (temp_f18 - (temp_f2_4 / temp_f0_8)); - banana->pos[1] = (sp38 - (temp_f14_3 / temp_f0_8)) - 2.0f; - banana->pos[2] = sp34 - (temp_f16_2 / temp_f0_8); + x_dist /= temp_f12; + y_dist /= temp_f12; + z_dist /= temp_f12; + banana->pos[0] = someVelocity[0] + (x_pos - x_dist); + banana->pos[1] = (y_pos - y_dist) - 2.0f; + banana->pos[2] = z_pos - z_dist; } - func_802ADDC8((bitwise f32) &banana->unk30, (bitwise UnkActorInner *) (banana->boundingBoxSize + 1.0f), (bitwise UnkActorInner *) banana->pos[0], banana->pos[1], banana->pos[2]); - func_802B4E30(banana); - return; + func_802ADDC8(&banana->unk30, banana->boundingBoxSize + 1.0f, banana->pos[0], banana->pos[1], banana->pos[2]); + func_802B4E30((struct Actor *) banana); + break; case 3: - temp_v0_3 = &gActorList[banana->elderIndex]; - temp_f2_5 = temp_v0_3->pos[0] - banana->pos[0]; - temp_f14_4 = temp_v0_3->pos[1] - banana->pos[1]; - sp48 = temp_f2_5; - temp_f16_3 = temp_v0_3->pos[2] - banana->pos[2]; - sp44 = temp_f14_4; - sp84 = temp_v0_3; - sp40 = temp_f16_3; - temp_f12_3 = sqrtf((temp_f2_5 * temp_f2_5) + (temp_f14_4 * temp_f14_4) + (temp_f16_3 * temp_f16_3)) / 5.0f; - phi_f14_2 = (bitwise UnkActorInner *) temp_f14_4; - if (temp_f12_3 == 0.0f) { - temp_f0_10 = D_802B9EEC; - banana->pos[0] = temp_v0_3->pos[0] + temp_f0_10; - banana->pos[1] = temp_v0_3->pos[1] + temp_f0_10; - phi_f8 = temp_v0_3->pos[2] + temp_f0_10; + elderBanana = &gActorList[banana->elderIndex]; + x_dist = elderBanana->pos[0] - banana->pos[0]; + y_dist = elderBanana->pos[1] - banana->pos[1]; + z_dist = elderBanana->pos[2] - banana->pos[2]; + temp_f12 = sqrtf((x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist)) / 5.0f; + if (temp_f12 == 0.0f) { + banana->pos[0] = elderBanana->pos[0] + 0.2f; + banana->pos[1] = elderBanana->pos[1] + 0.2f; + banana->pos[2] = elderBanana->pos[2] + 0.2f; } else { - temp_f14_5 = temp_f14_4 / temp_f12_3; - banana->pos[0] = temp_v0_3->pos[0] - (temp_f2_5 / temp_f12_3); - banana->pos[1] = (temp_v0_3->pos[1] - temp_f14_5) - 2.0f; - phi_f8 = temp_v0_3->pos[2] - (temp_f16_3 / temp_f12_3); - phi_f14_2 = (bitwise UnkActorInner *) temp_f14_5; + x_dist /= temp_f12; + y_dist /= temp_f12; + z_dist /= temp_f12; + banana->pos[0] = elderBanana->pos[0] - x_dist; + banana->pos[1] = (elderBanana->pos[1] - y_dist) - 2.0f; + banana->pos[2] = elderBanana->pos[2] - z_dist; } - banana->pos[2] = phi_f8; - func_802ADDC8(temp_f12_3, phi_f14_2, &banana->unk30, banana->boundingBoxSize + 1.0f, banana->pos[0], banana->pos[1], banana->pos[2]); - func_802B4E30(banana); - return; + func_802ADDC8(&banana->unk30, banana->boundingBoxSize + 1.0f, banana->pos[0], banana->pos[1], banana->pos[2]); + func_802B4E30((struct Actor *) banana); + break; case 5: - banana->velocity[1] -= D_802B9EF0; + banana->velocity[1] -= 0.3f; if (banana->velocity[1] < -5.0f) { banana->velocity[1] = -5.0f; } banana->unk_04 += -1; banana->pos[1] += banana->velocity[1]; - banana->playerId += 0x16C; - banana->elderIndex += -0x5B0; - banana->youngerIndex += 0x38E; + banana->rot[0] += 0x16C; + banana->rot[1] -= 0x5B0; + banana->rot[2] += 0x38E; if (banana->unk_04 == 0) { - destroy_actor(banana); - return; + destroy_actor((struct Actor *) banana); } break; case 4: banana->flags |= 0xC000; - banana->flags &= 0xEFFF; + banana->flags &= ~0x1000; + break; + default: break; } } @@ -1270,102 +1013,79 @@ void update_obj_banana(struct BananaActor *banana) { GLOBAL_ASM("asm/non_matchings/code_802B0210/update_obj_banana.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -? func_800C9060(s32, ?, Player **, s32); /* extern */ -s16 func_8029EC88(f32 *, s16 *, f32 *, ?); /* extern */ -? func_802AD950(void *, f32, s32, s32, f32, f32, f32, f32); /* extern */ -? func_802B4E30(void *); /* extern */ -? func_802B63B8(f32 *, f32 *); /* extern */ +#ifdef INCORRECT_REGALLOC +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b void func_802B2914(struct BananaBunchParent *banana_bunch, Player *player, s16 bananaId) { - s16 sp6E; - f32 sp68; - f32 sp64; - f32 sp60; - s16 sp5C; - s16 sp5A; - s16 sp58; - f32 sp54; - f32 sp50; - f32 sp4C; - f32 *temp_a0; - f32 *temp_a2; - s16 *temp_a1; - s16 temp_t6; - s16 temp_v0; - s32 temp_lo; - void *temp_s0; - struct BananaActor *phi_v0; + s32 pad; + Vec3f startingVelocity; + Vec3s startingRot; + Vec3f startingPos; + s32 pad2; + s16 actorIndex; + struct BananaActor *newBanana; - sp4C = 0.0f; - sp50 = -player->boundingBoxSize; - sp54 = -(player->boundingBoxSize + 4.0f); - func_802B63B8(&sp4C, player->unk_174); - temp_a0 = &sp4C; - temp_a1 = &sp58; - temp_a2 = &sp60; - sp4C += player->pos[0]; - sp50 += player->pos[1]; - sp54 += player->pos[2]; - sp60 = player->unk_034[0]; - sp64 = player->unk_034[1]; - sp58 = 0; - sp5A = 0; - sp5C = 0; - sp68 = player->unk_034[2]; - temp_v0 = func_8029EC88(temp_a0, temp_a1, temp_a2, 6); - temp_t6 = temp_v0; - if (temp_v0 >= 0) { - temp_lo = temp_t6 * 0x70; - sp4C = player->pos[0]; - sp50 = player->pos[1]; - temp_s0 = gActorList + temp_lo; - sp54 = player->pos[2]; - sp6E = temp_t6; - func_802AD950(temp_s0 + 0x30, temp_s0->unkC + 1.0f, temp_s0->pos, temp_s0->unk1C, temp_s0->unk20, sp4C, sp50, sp54); - func_802B4E30(temp_s0); - temp_s0->unk2 = -0x7000; - temp_s0->rot = (s16) ((s32) (player - gPlayerOne) / 3544); - temp_s0->unk_08 = (s16) ((s32) (banana_bunch - gActorList) / 112); - temp_s0->unk14 = -1; - temp_s0->unk_04 = 0x0014; - temp_s0->unkA = bananaId; + startingPos[0] = 0.0f; + startingPos[1] = -player->boundingBoxSize; + startingPos[2] = -(player->boundingBoxSize + 4.0f); + func_802B63B8(startingPos, player->unk_174); + startingPos[0] += player->pos[0]; + startingPos[1] += player->pos[1]; + startingPos[2] += player->pos[2]; + startingVelocity[0] = player->unk_034[0]; + startingVelocity[1] = player->unk_034[1]; + startingVelocity[2] = player->unk_034[2]; + startingRot[0] = 0; + startingRot[1] = 0; + startingRot[2] = 0; + actorIndex = func_8029EC88(startingPos, startingRot, startingVelocity, ACTOR_BANANA); + if (actorIndex >= 0) { + newBanana = &gActorList[actorIndex]; + startingPos[0] = player->pos[0]; + startingPos[1] = player->pos[1]; + startingPos[2] = player->pos[2]; + // This should be functionally correct, but there's a lot of bad regalloc nonsense going on starting here >:( + func_802AD950(&newBanana->unk30, newBanana->boundingBoxSize + 1.0f, newBanana->pos[0], newBanana->pos[1], newBanana->pos[2], startingPos[0], startingPos[1], startingPos[2]); + func_802B4E30(newBanana); + newBanana->flags = 0x9000; + newBanana->playerId = player - gPlayerOne; + newBanana->parentIndex = (struct Actor*)banana_bunch - gActorList; + newBanana->youngerIndex = -1; + newBanana->unk_04 = 0x0014; + newBanana->bananaId = bananaId; switch (bananaId) { case 0: - temp_s0->unk6 = 2; - banana_bunch->bananaIndices[0] = sp6E; - temp_s0->unk12 = -1; + newBanana->state = 2; + banana_bunch->bananaIndices[0] = actorIndex; + newBanana->elderIndex = -1; break; case 1: - temp_s0->unk6 = 3; - banana_bunch->bananaIndices[1] = sp6E; - temp_s0->unk12 = (s16) banana_bunch->bananaIndices[0]; - phi_v0 = &gActorList[banana_bunch->bananaIndices[0]]; -block_8: - phi_v0->youngerIndex = sp6E; + newBanana->state = 3; + banana_bunch->bananaIndices[1] = actorIndex; + newBanana->elderIndex = banana_bunch->bananaIndices[0]; + ((struct BananaActor*)&gActorList[banana_bunch->bananaIndices[0]])->youngerIndex = actorIndex; break; case 2: - temp_s0->unk6 = 3; - banana_bunch->bananaIndices[2] = sp6E; - temp_s0->unk12 = (s16) banana_bunch->bananaIndices[1]; - phi_v0 = &gActorList[banana_bunch->bananaIndices[1]]; - goto block_8; + newBanana->state = 3; + banana_bunch->bananaIndices[2] = actorIndex; + newBanana->elderIndex = banana_bunch->bananaIndices[1]; + ((struct BananaActor*)&gActorList[banana_bunch->bananaIndices[1]])->youngerIndex = actorIndex; + break; case 3: - temp_s0->unk6 = 3; - banana_bunch->bananaIndices[3] = sp6E; - temp_s0->unk12 = (s16) banana_bunch->bananaIndices[2]; - phi_v0 = &gActorList[banana_bunch->bananaIndices[2]]; - goto block_8; + newBanana->state = 3; + banana_bunch->bananaIndices[3] = actorIndex; + newBanana->elderIndex = banana_bunch->bananaIndices[2]; + ((struct BananaActor*)&gActorList[banana_bunch->bananaIndices[2]])->youngerIndex = actorIndex; + break; case 4: - temp_s0->unk6 = 3; - banana_bunch->bananaIndices[4] = sp6E; - temp_s0->unk12 = (s16) banana_bunch->bananaIndices[3]; - phi_v0 = &gActorList[banana_bunch->bananaIndices[3]]; - goto block_8; + newBanana->state = 3; + banana_bunch->bananaIndices[4] = actorIndex; + newBanana->elderIndex = banana_bunch->bananaIndices[3]; + ((struct BananaActor*)&gActorList[banana_bunch->bananaIndices[3]])->youngerIndex = actorIndex; + break; } if ((player->unk_000 & 0x4000) != 0) { - func_800C9060(((s32) (player - gPlayerOne) / 3544) & 0xFF, 0x19008012, &gPlayerOne, 0xDD8); + func_800C9060(player - gPlayerOne, 0x19008012); } } } @@ -1373,309 +1093,204 @@ block_8: GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B2914.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s16 func_8029EC88(f32 *, s16 *, f32 *, ?); // extern -? func_802B63B8(f32 *, void *); // extern -extern ? gActorList; +#ifdef INCORRECT_REGALLOC +// This function could reasonably be called "spawn_fake_item_box" or similar -s16 func_802B2C40(void *arg0) { - f32 sp40; - f32 sp3C; - f32 sp38; - s16 sp34; - s16 sp32; - s16 sp30; - f32 sp2C; - f32 sp28; - f32 sp24; - f32 *temp_a0; - f32 *temp_a2; - s16 *temp_a1; - s16 temp_v0; - void *temp_v1; +s32 func_802B2C40(Player *player) { + struct FakeItemBox *itemBox; + s32 pad[4]; + s32 playerId; + s16 actorIndex; + Vec3f startingVelocity; + Vec3s startingRot; + Vec3f startingPos; - sp24 = 0.0f; - sp28 = -arg0->unk70; - sp2C = -(arg0->unk70 + 4.0f); - func_802B63B8(&sp24, arg0 + 0x174); - temp_a0 = &sp24; - temp_a1 = &sp30; - temp_a2 = &sp38; - sp24 += arg0->unk14; - sp28 += arg0->pos; - sp2C += arg0->unk1C; - sp38 = arg0->unk34; - sp3C = arg0->unk38; - sp30 = 0; - sp32 = 0; - sp34 = 0; - sp40 = arg0->unk3C; - temp_v0 = func_8029EC88(temp_a0, temp_a1, temp_a2, 0xD); - if (temp_v0 < 0) { - return temp_v0; + startingPos[0] = 0.0f; + startingPos[1] = -player->boundingBoxSize; + startingPos[2] = -(player->boundingBoxSize + 4.0f); + func_802B63B8(startingPos, player->unk_174); + startingPos[0] += player->pos[0]; + startingPos[1] += player->pos[1]; + startingPos[2] += player->pos[2]; + startingVelocity[0] = player->unk_034[0]; + startingVelocity[1] = player->unk_034[1]; + startingVelocity[2] = player->unk_034[2]; + startingRot[0] = 0; + startingRot[1] = 0; + startingRot[2] = 0; + actorIndex = func_8029EC88(startingPos, startingRot, startingVelocity, ACTOR_FAKE_ITEM_BOX); + if (actorIndex < 0) { + return actorIndex; } - temp_v1 = (temp_v0 * 0x70) + &gActorList; - temp_v1->unk6 = 0; - temp_v1->velocity = (arg0 - gPlayerOne) / 0xDD8; - arg0->unkC = arg0->unkC | 0x40000; - return temp_v0; + // Dumb regalloc differences starting here >:( + playerId = player - gPlayerOne; + itemBox = &gActorList[actorIndex]; + itemBox->state = 0; + itemBox->playerId = playerId; + player->unk_00C |= 0x40000; + return actorIndex; } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B2C40.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s16 func_8029EC88(f32 *, s16 *, f32 *, ?); // extern -? func_802B63B8(f32 *, void *); // extern -extern ? gActorList; +// This function could reasonably be called "spawn_banana" or similar +s32 func_802B2D70(Player *player) { + s32 pad[6]; + u16 playerId; + s16 actorIndex; + struct BananaActor *banana; + Vec3f startingVelocity; + Vec3s startingRot; + Vec3f startingPos; -s16 func_802B2D70(void *arg0) { - f32 sp44; - f32 sp40; - f32 sp3C; - s16 sp38; - s16 sp36; - s16 sp34; - f32 sp30; - f32 sp2C; - f32 sp28; - s32 sp20; - f32 *temp_a0; - f32 *temp_a2; - s16 *temp_a1; - s16 temp_v0; - s32 temp_t0; - void *temp_v1; - - temp_t0 = ((arg0 - gPlayerOne) / 0xDD8) & 0xFFFF; - if (temp_t0 >= 8) { + playerId = player - gPlayerOne; + if (playerId >= 8) { return -1; } - sp28 = 0.0f; - sp2C = -arg0->unk70; - sp20 = temp_t0; - sp30 = -(arg0->unk70 + 4.0f); - func_802B63B8(&sp28, arg0 + 0x174); - temp_a0 = &sp28; - temp_a1 = &sp34; - temp_a2 = &sp3C; - sp28 += arg0->unk14; - sp2C += arg0->pos; - sp30 += arg0->unk1C; - sp3C = arg0->unk34; - sp40 = arg0->unk38; - sp34 = 0; - sp36 = 0; - sp38 = 0; - sp44 = arg0->unk3C; - temp_v0 = func_8029EC88(temp_a0, temp_a1, temp_a2, 6); - if (temp_v0 < 0) { - return temp_v0; + // Extremely weird fake match to fix a tiny stack difference + startingPos[0, 0] = 0.0f; + startingPos[1] = -player->boundingBoxSize; + startingPos[2] = -(player->boundingBoxSize + 4.0f); + func_802B63B8(startingPos, player->unk_174); + startingPos[0] += player->pos[0]; + startingPos[1] += player->pos[1]; + startingPos[2] += player->pos[2]; + startingVelocity[0] = player->unk_034[0]; + startingVelocity[1] = player->unk_034[1]; + startingVelocity[2] = player->unk_034[2]; + startingRot[0] = 0; + startingRot[1] = 0; + startingRot[2] = 0; + actorIndex = func_8029EC88(startingPos, startingRot, startingVelocity, ACTOR_BANANA); + if (actorIndex < 0) { + return actorIndex; } - temp_v1 = (temp_v0 * 0x70) + &gActorList; - temp_v1->rot = temp_t0; - temp_v1->unk6 = 0; - temp_v1->unk_04 = 0x14; - arg0->unkC = arg0->unkC | 0x40000; - return temp_v0; + banana = &gActorList[actorIndex]; + banana->playerId = playerId; + banana->state = 0; + banana->unk_04 = 0x0014; + player->unk_00C |= 0x40000; + return actorIndex; } -#else -GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B2D70.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8009E5BC(); // extern -? func_800CAB4C(s32); // extern -extern ? gGfxPools; -extern ? gPlayers; - -void func_802B2EBC(u16 *arg0) { - u16 *temp_a2; - void *temp_v0; - u16 *phi_a2; - ? *phi_v1; - void *phi_a0; - void *phi_a1; - void *phi_v0; +// Something related to the thunderbolt item +void func_802B2EBC(Player *player) { + s32 playerIndex; + Player *otherPlayer; func_8009E5BC(); - temp_a2 = arg0; - phi_a2 = temp_a2; - if ((*temp_a2 & 0x4000) != 0) { - arg0 = temp_a2; - func_800CAB4C(((temp_a2 - gPlayerOne) / 0xDD8) & 0xFF); - phi_a2 = arg0; + if ((player->unk_000 & 0x4000) != 0) { + func_800CAB4C(player - gPlayerOne); } - phi_v1 = &gPlayers; - phi_a0 = &gPlayers + 0xDD8; - phi_a1 = &gPlayers + 0x1BB0; - phi_v0 = &gPlayers + 0x2988; - do { - if (phi_a2 != phi_v1) { - phi_v1->unkC = phi_v1->unkC | 0x4000; - } - phi_v1 += 0x3760; - if (phi_a2 != phi_a0) { - phi_a0->unkC = phi_a0->unkC | 0x4000; - } - phi_a0 += 0x3760; - if (phi_a2 != phi_a1) { - phi_a1->unkC = phi_a1->unkC | 0x4000; - } - if (phi_a2 != phi_v0) { - phi_v0->unkC = phi_v0->unkC | 0x4000; - } - temp_v0 = phi_v0 + 0x3760; - phi_a1 += 0x3760; - phi_v0 = temp_v0; - } while (temp_v0 != (&gGfxPools + 0x2978)); -} -#else -GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B2EBC.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8007AC9C(s32); /* extern */ -? func_802B17F4(); /* extern */ -? func_802B18E4(?); /* extern */ -? func_802B1C9C(); /* extern */ -? func_802B1E48(); /* extern */ -? func_802B1FFC(); /* extern */ -? func_802B2C40(); /* extern */ -? func_802B2D70(); /* extern */ -? func_802B2EBC(); /* extern */ + for (playerIndex = 0; playerIndex < 8; playerIndex++) { + otherPlayer = &gPlayers[playerIndex]; + if (player != otherPlayer) { + otherPlayer->unk_00C |= 0x4000; + } + } +} + +#ifdef NEEDS_RODATA +// Needs jpt_802B9F08, otherwise this matches void func_802B2FA0(Player *player) { - s32 sp1C; - s16 temp_t9; + s32 playerId = player - gPlayerOne; - sp1C = (player - gPlayerOne) / 3544; - temp_t9 = player->rot; - switch (temp_t9) { - case 3: - func_802B1C9C(); + switch (player->unk_010) { + case ITEM_GREEN_SHELL: + func_802B1C9C(player); break; - case 5: - func_802B1E48(); + case ITEM_RED_SHELL: + func_802B1E48(player); break; - case 7: - func_802B1FFC(); + case ITEM_BLUE_SPINY_SHELL: + func_802B1FFC(player); break; - case 1: - func_802B2D70(); + case ITEM_BANANA: + func_802B2D70(player); break; - case 2: - func_802B17F4(); + case ITEM_BANANA_BUNCH: + func_802B17F4(player); break; - case 12: + case ITEM_MUSHROOM: player->unk_00C |= 0x200; break; - case 13: + case ITEM_DOUBLE_MUSHROOM: player->unk_00C |= 0x200; break; - case 14: + case ITEM_TRIPLE_MUSHROOM: player->unk_00C |= 0x200; break; - case 15: + case ITEM_SUPER_MUSHROOM: player->unk_00C |= 0x200; break; - case 11: + case ITEM_BOO: player->unk_00C |= 0x800; break; - case 10: + case ITEM_STAR: player->unk_00C |= 0x2000; break; - case 8: - func_802B2EBC(); + case ITEM_THUNDERBOLT: + func_802B2EBC(player); break; - case 9: - func_802B2C40(); + case ITEM_FAKE_ITEM_BOX: + func_802B2C40(player); break; - case 4: - func_802B18E4(0x15); + case ITEM_TRIPLE_GREEN_SHELL: + func_802B18E4(player, ACTOR_TRIPLE_GREEN_SHELL); break; - case 6: - func_802B18E4(0x16); + case ITEM_TRIPLE_RED_SHELL: + func_802B18E4(player, ACTOR_TRIPLE_RED_SHELL); break; } - func_8007AC9C(sp1C); + func_8007AC9C(playerId); } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B2FA0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800910E4(? *); // extern -? func_802B2FA0(? *); // extern -extern ? *gControllerSix; -extern ? *gControllerSeven; -extern ? *gControllerEight; -extern ? gControllers; -extern ? gPlayers; - void func_802B30EC(void) { - ? *temp_s2; - u16 temp_v0; - u16 temp_v0_2; - ? *phi_s0; - ? *phi_s1; - ? *phi_s2; + Player *player; + struct Controller *target; + struct Controller *controller; + struct Controller *loopController; - phi_s0 = &gPlayers; - phi_s2 = &gControllers; - do { - phi_s1 = phi_s2; - if (func_800910E4(phi_s0) == 0) { - temp_v0 = phi_s0->unk0; - if ((temp_v0 & 0x100) != 0) { - if (((phi_s0 - gPlayerTwo) / 0xDD8) == 0) { - phi_s1 = gControllerSix; - } else if (((phi_s0 - gPlayerThree) / 0xDD8) == 0) { - phi_s1 = gControllerSeven; - } else if (((phi_s0 - gPlayerOne) / 0xDD8) == 0) { - phi_s1 = gControllerEight; + for (player = &gPlayers[0], loopController = &gControllers[0], target = &gControllers[4]; loopController != target; player++, loopController++) { + controller = loopController; + if (func_800910E4(player) == 0) { + if((player->unk_000 & 0x100) != 0){ + if ((player - gPlayerTwo) == 0) { + controller = gControllerSix; + } else if((player - gPlayerThree) == 0) { + controller = gControllerSeven; + } else { + if ((player - gPlayerOne) == 0) { + controller = gControllerEight; + } } } - if (((temp_v0 & 0x4000) != 0) && (phi_s0->rot != 0) && ((temp_v0 & 0x2000) == 0)) { - temp_v0_2 = phi_s1->unk6; - if ((temp_v0_2 & 0x2000) != 0) { - phi_s1->unk6 = temp_v0_2 & ~0x2000; - func_802B2FA0(phi_s0); + + if (((player->unk_000 & 0x4000) != 0) && (player->unk_010 != ITEM_NONE) && ((player->unk_000 & 0x2000) == 0)) { + if ((controller->buttonPressed & 0x2000) != 0) { + controller->buttonPressed &= ~0x2000; + func_802B2FA0(player); } } } - temp_s2 = phi_s2 + 0x10; - phi_s0 += 0xDD8; - phi_s2 = temp_s2; - } while (temp_s2 != (&gControllers + 0x40)); + } } -#else -GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B30EC.s") -#endif #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b ? func_8000EDC8(s32); /* extern */ -? func_800C9060(u8, ?); /* extern */ -? func_800C90F4(u8, s32); /* extern */ -? func_800C98B8(f32 *, f32 *, ?); /* extern */ -? destroy_actor(f32, struct ShellActor *); /* extern */ -? func_8029FDC8(f32, struct ShellActor *); /* extern */ -f32 func_802ABE30(f32, f32, f32, u16); /* extern */ ? func_802AC098(UnkActorInner *, f32 *); /* extern */ ? func_802AD950(UnkActorInner *, ?, f32, f32, f32, f32, f32, f32); /* extern */ -? func_802B0210(UnkActorInner *, UnkActorInner *); /* extern */ -? func_802B4E30(struct ShellActor *); /* extern */ ? func_802B63B8(f32 *, f32 *, f32 *); /* extern */ ? func_802B64C4(f32 *, s16); /* extern */ extern s16 D_8015F6E8; extern s16 D_8015F6EA; -extern s16 D_8015F6EE; extern s16 D_8015F6F0; extern s16 D_8015F6F2; static f32 D_802B9F5C = 1.2f; @@ -1700,7 +1315,6 @@ void update_obj_green_shell(struct ShellActor *shell) { f32 temp_f0_2; f32 temp_f0_3; f32 temp_f0_4; - f32 temp_f12; f32 temp_f14; f32 temp_f2; f32 temp_f2_2; @@ -1708,7 +1322,7 @@ void update_obj_green_shell(struct ShellActor *shell) { s16 temp_v0_2; s16 temp_v0_3; struct Controller *temp_v0; - struct ShellActor *temp_v0_4; + struct TripleShellParent *temp_v0_4; u16 temp_t3; u16 temp_v1; f32 phi_f2; @@ -1716,9 +1330,8 @@ void update_obj_green_shell(struct ShellActor *shell) { temp_f2 = shell->pos[2]; temp_f0 = shell->pos[0]; - temp_f12 = shell->pos[1]; - if ((temp_f2 < (f32) D_8015F6F2) || ((f32) D_8015F6F0 < temp_f2) || (temp_f0 < (f32) D_8015F6EA) || ((f32) D_8015F6E8 < temp_f0) || (temp_f12 < (f32) D_8015F6EE)) { - func_8029FDC8(temp_f12, shell); + if ((temp_f2 < (f32) D_8015F6F2) || ((f32) D_8015F6F0 < temp_f2) || (temp_f0 < (f32) D_8015F6EA) || ((f32) D_8015F6E8 < temp_f0) || (shell->pos[1] < (f32) D_8015F6EE)) { + func_8029FDC8((struct Actor *) shell); } temp_t3 = (u16) shell->state; shell->rotVelocity += 0x71C; @@ -1760,8 +1373,8 @@ void update_obj_green_shell(struct ShellActor *shell) { shell->velocity[1] = sp70; shell->state = 2; shell->velocity[2] = sp74; - func_800C9060(shell->unk15, 0x19008004); - func_800C90F4(shell->unk15, (temp_s1->characterId * 0x10) + 0x29008000); + func_800C9060((Player *) shell->unk15, 0x19008004); + func_800C90F4((Player *) shell->unk15, (temp_s1->characterId * 0x10) + 0x29008000); func_8000EDC8((s32) (shell - gActorList) / 112); return; } @@ -1784,8 +1397,8 @@ void update_obj_green_shell(struct ShellActor *shell) { if (shell->rotAngle < 0) { shell->state = 2; shell->parentIndex = 0x001E; - func_800C9060(shell->unk15, 0x19008004); - func_800C90F4(shell->unk15, (temp_s1_2->characterId * 0x10) + 0x29008000); + func_800C9060((Player *) shell->unk15, 0x19008004); + func_800C90F4((Player *) shell->unk15, (temp_s1_2->characterId * 0x10) + 0x29008000); func_8000EDC8((s32) (shell - gActorList) / 112); } } else { @@ -1793,8 +1406,8 @@ void update_obj_green_shell(struct ShellActor *shell) { if (shell->rotAngle > 0) { shell->state = 2; shell->parentIndex = 0x001E; - func_800C9060(shell->unk15, 0x19008004); - func_800C90F4(shell->unk15, (temp_s1_2->characterId * 0x10) + 0x29008000); + func_800C9060((Player *) shell->unk15, 0x19008004); + func_800C90F4((Player *) shell->unk15, (temp_s1_2->characterId * 0x10) + 0x29008000); func_8000EDC8((s32) (shell - gActorList) / 112); } } @@ -1842,11 +1455,11 @@ void update_obj_green_shell(struct ShellActor *shell) { shell->pos[2] += shell->velocity[2]; sp34 = temp_a0; func_802AD950(temp_a0, 0x40800000, shell->pos[0], shell->pos[1], shell->pos[2], sp78, sp7C, sp80); - func_802B4E30(shell); + func_802B4E30((struct Actor *) shell); temp_s1_3 = shell->velocity; if ((shell->unk30.unk3C < 0.0f) || (shell->unk30.unk40 < 0.0f)) { func_802AC098(temp_a0, temp_s1_3); - func_800C98B8(shell->pos, temp_s1_3, 0x19008054); + func_800C98B8(shell->pos, temp_s1_3, 0x19008054U); shell->flags |= 0x80; return; } @@ -1855,7 +1468,7 @@ void update_obj_green_shell(struct ShellActor *shell) { temp_v0_4 = &gActorList[shell->parentIndex]; temp_s1_4 = &gPlayers[shell->playerId]; if (temp_v0_4->type != 0x0015) { - func_8029FDC8((bitwise f32) shell); + func_8029FDC8((struct Actor *) shell); return; } temp_t4 = shell->rotAngle + temp_v0_4->rotVelocity; @@ -1871,18 +1484,18 @@ void update_obj_green_shell(struct ShellActor *shell) { shell->pos[1] = sp70 + temp_s1_4->pos[1]; shell->pos[2] = sp74 + temp_s1_4->pos[2]; func_802AD950(&shell->unk30, 0x40800000, shell->pos[0], shell->pos[1], shell->pos[2], sp78, sp7C, sp80); - func_802B4E30(shell); + func_802B4E30((struct Actor *) shell); return; case 5: shell->velocity[1] -= D_802B9F64; if (shell->velocity[1] < -5.0f) { shell->velocity[1] = -5.0f; } - shell->parentIndex += -1; + shell->parentIndex -= 1; shell->rotAngle += 0x5B0; shell->pos[1] += shell->velocity[1]; if (shell->parentIndex == 0) { - destroy_actor(-5.0f, shell); + destroy_actor((struct Actor *) shell); } break; } @@ -1892,9 +1505,8 @@ GLOBAL_ASM("asm/non_matchings/code_802B0210/update_obj_green_shell.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b ? func_802AD950(UnkActorInner *, f32, f32, f32, f32, f32, f32, f32); /* extern */ -? func_802B4E30(struct ShellActor *); /* extern */ extern u16 D_80164430; extern s32 D_80164490; @@ -1953,7 +1565,7 @@ void func_802B3B44(struct ShellActor *shell) { temp_a3 = temp_a1 & 0xFFFF; temp_f2 = (f32) temp_v0->unk0; temp_f12 = (f32) temp_v0->unk2; - temp_f28 = (f32) temp_v0->unk_04; + temp_f28 = (f32) temp_v0->unk4; phi_a2 = temp_a1 & 0xFFFF; if (temp_a3 >= (s32) temp_t0) { phi_a2 = (temp_a3 - temp_t0) & 0xFFFF; @@ -1972,7 +1584,7 @@ void func_802B3B44(struct ShellActor *shell) { if (temp_f14 > 400.0f) { temp_f0_2 = (f32) temp_v0_2->unk0 - sp60; temp_f2_2 = (f32) temp_v0_2->unk2 - sp5C; - temp_f12_2 = (f32) temp_v0_2->unk_04 - sp58; + temp_f12_2 = (f32) temp_v0_2->unk4 - sp58; if (((temp_f0_2 * temp_f0_2) + (temp_f2_2 * temp_f2_2) + (temp_f12_2 * temp_f12_2)) < temp_f14) { shell->rotAngle = phi_a2; return; @@ -2006,7 +1618,7 @@ void func_802B3B44(struct ShellActor *shell) { shell->pos[1] += phi_f14; shell->pos[2] += phi_f16; func_802AD950(&shell->unk30, 4.0f, shell->pos[0], shell->pos[1], shell->pos[2], sp68, sp6C, sp70); - func_802B4E30(shell); + func_802B4E30((struct Actor *) shell); return; } temp_v0_3 = temp_t1 + (phi_a2 * 8); @@ -2019,7 +1631,7 @@ void func_802B3B44(struct ShellActor *shell) { } temp_f16_3 = (f32) temp_v0_3->unk0; temp_f18_3 = (f32) temp_v0_3->unk2; - temp_f26 = (f32) temp_v0_3->unk_04; + temp_f26 = (f32) temp_v0_3->unk4; shell->pos[0] = (temp_f2 + temp_f16_3) * 0.5f; shell->pos[1] = ((temp_f12 + temp_f18_3) * 0.5f) + shell->boundingBoxSize; shell->pos[2] = (temp_f28 + temp_f26) * 0.5f; @@ -2031,141 +1643,105 @@ void func_802B3B44(struct ShellActor *shell) { GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B3B44.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -? func_8029FDC8(f32, f32, struct ShellActor *, ?); /* extern */ -? func_802AD950(f32, f32, UnkActorInner *, ?, f32, f32, f32, f32, f32, f32); /* extern */ -? func_802B4104(struct ShellActor *); /* extern */ -? func_802B4E30(struct ShellActor *); /* extern */ +#ifdef INCORRECT_REGALLOC +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b void func_802B3E7C(struct ShellActor *shell, Player *player) { - f32 sp44; - f32 sp40; - f32 sp38; - f32 sp34; - f32 sp30; - f32 temp_f12; - f32 temp_f14; - f32 temp_f2; - f32 phi_f2; - f32 phi_f14; + f32 x_dist; + f32 z_dist; + f32 xz_dist; + Vec3f oldPosition; + f32 x_velocity; + f32 z_velocity; - temp_f2 = player->pos[0] - shell->pos[0]; - temp_f14 = player->pos[2] - shell->pos[2]; - sp44 = temp_f2; - sp40 = temp_f14; - temp_f12 = sqrtf((temp_f2 * temp_f2) + (temp_f14 * temp_f14)) / 8.0f; - if (temp_f12 == 0.0f) { - phi_f2 = 0.0f; - phi_f14 = 0.0f; + x_dist = player->pos[0]; + x_dist -= shell->pos[0]; + z_dist = player->pos[2]; + z_dist -= shell->pos[2]; + // Dumb register allocation difference occuring here >:( + xz_dist = sqrtf((x_dist * x_dist) + (z_dist * z_dist)) / 8; + if (xz_dist == 0.0f) { + x_velocity = 0.0f; + z_velocity = 0.0f; } else { - phi_f2 = temp_f2 / temp_f12; - phi_f14 = temp_f14 / temp_f12; + x_velocity = x_dist / xz_dist; + // Weird fake match + if (1) {}; + z_velocity = z_dist / xz_dist; } - sp30 = shell->pos[0]; - sp34 = shell->pos[1]; - sp38 = shell->pos[2]; - shell->velocity[0] = phi_f2; - shell->velocity[2] = phi_f14; - shell->pos[0] += phi_f2; + oldPosition[0] = shell->pos[0]; + oldPosition[1] = shell->pos[1]; + oldPosition[2] = shell->pos[2]; + shell->pos[0] += x_velocity; shell->pos[1] -= 2.0f; + shell->pos[2] += z_velocity; + shell->velocity[0] = x_velocity; shell->velocity[1] = -2.0f; - shell->pos[2] += phi_f14; + shell->velocity[2] = z_velocity; if (player->unk_0BC & 0x80000000) { - func_8029FDC8(temp_f12, phi_f14, shell, 0x40800000); - return; + func_8029FDC8((struct Actor *) shell); + } else { + func_802AD950(&shell->unk30, 4.0f, shell->pos[0], shell->pos[1], shell->pos[2], oldPosition[0], oldPosition[1], oldPosition[2]); + func_802B4E30((struct Actor *) shell); + func_802B4104(shell); } - func_802AD950(temp_f12, phi_f14, &shell->unk30, 0x40800000, shell->pos[0], shell->pos[1], shell->pos[2], sp30, sp34, sp38); - func_802B4E30(shell); - func_802B4104(shell); } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B3E7C.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -f32 func_802B51E8(void *, f32 *); /* extern */ -extern ? gPlayerBalloonCount; -static f32 D_802B9F68 = 2.5e7f; +#ifdef INCORRECT_REGALLOC +// Something to do with red shells +// Only used in Battle mode +// Probably trying to find the player that is not the shell owner, is still alive and is closest to the shell -s16 func_802B3FD0(Player *player, struct ShellActor *shell) { - f32 temp_f0; - s32 temp_s1; - Player *phi_s0; - s32 phi_s1; - f32 phi_f20; - s16 phi_fp; +s16 func_802B3FD0(Player *owner, struct ShellActor *shell) { + Player *player; + s32 playerIndex; + f32 playerToShellDistance; + s16 playerId = -1; + f32 minimumDistance = D_802B9F68; // 2.5e7, so a really big starting number - phi_s0 = gPlayers; - phi_s1 = 0; - phi_f20 = D_802B9F68; - phi_fp = -1; - do { - if (((phi_s0->unk_000 & 0x8000) != 0) && (phi_s0 != player) && (*(&gPlayerBalloonCount + (phi_s1 * 2)) >= 0)) { - temp_f0 = func_802B51E8(phi_s0 + 0x14, shell->pos); - if (temp_f0 < phi_f20) { - phi_fp = (s16) ((s32) (phi_s0 - gPlayerOne) / 3544); - phi_f20 = temp_f0; + for (playerIndex = 0; playerIndex < 4; playerIndex++) { + player = &gPlayers[playerIndex]; + if (((player->unk_000 & 0x8000) != 0) && (player != owner) && (gPlayerBalloonCount[playerIndex] >= 0)) { + // func_802B51E8 is not quite a 3D distance function, it doubles (rather than squares) the Z difference of the positions + playerToShellDistance = func_802B51E8(player->pos, shell->pos); + if (playerToShellDistance < minimumDistance) { + playerId = player - gPlayerOne; + minimumDistance = playerToShellDistance; } } - temp_s1 = phi_s1 + 1; - phi_s0 += 0xDD8; - phi_s1 = temp_s1; - } while (temp_s1 != 4); - return phi_fp; + } + + return playerId; } #else GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B3FD0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800C98B8(void *, void *, ?); // extern -? func_8029FDC8(void *); // extern - -void func_802B4104(void *arg0) { - f32 temp_f0; - f32 temp_f0_2; - - if ((arg0->unk3C < 0.0f) && ((temp_f0 = arg0->unk_04C, (temp_f0 < 0.25f)) || (temp_f0 > -0.25f))) { - func_8029FDC8(arg0); - func_800C98B8(arg0 + 0x18, arg0 + 0x24, 0x19008054); - arg0->unk2 = arg0->unk2 | 0x80; - return; - } - if ((arg0->unk40 < 0.0f) && ((temp_f0_2 = arg0->unk58, (temp_f0_2 < 0.25f)) || (temp_f0_2 < -0.25f))) { - func_8029FDC8(arg0); - func_800C98B8(arg0 + 0x18, arg0 + 0x24, 0x19008054); - arg0->unk2 = arg0->unk2 | 0x80; +void func_802B4104(struct ShellActor *shell) { + if ((shell->unk30.unk3C < 0.0f) && ((shell->unk30.unk48[1] < 0.25f) || (shell->unk30.unk48[1] > -0.25f))) { + func_8029FDC8((struct Actor *) shell); + func_800C98B8(shell->pos, shell->velocity, 0x19008054U); + shell->flags |= 0x80; + } else if ((shell->unk30.unk40 < 0.0f) && ((shell->unk30.unk54[1] < 0.25f) || (shell->unk30.unk54[1] < -0.25f))) { + func_8029FDC8((struct Actor *) shell); + func_800C98B8(shell->pos, shell->velocity, 0x19008054U); + shell->flags |= 0x80; } } -#else -GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B4104.s") -#endif #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b ? func_8000ED80(s32); /* extern */ ? func_8000EE10(s32); /* extern */ -? func_800C9060(u8, ?); /* extern */ -? func_800C90F4(u8, s32); /* extern */ -? func_800C9D80(f32 *, f32 *, ?); /* extern */ -? destroy_actor(f32, struct ShellActor *); /* extern */ -? func_8029FDC8(f32, struct ShellActor *); /* extern */ -f32 func_802ABE30(f32, f32, f32, u16); /* extern */ -? func_802AD950(UnkActorInner *, ?, f32, f32, f32, f32, f32, f32); /* extern */ -? func_802B0210(UnkActorInner *, UnkActorInner *); /* extern */ -? func_802B3B44(struct ShellActor *); /* extern */ -? func_802B3E7C(struct ShellActor *, Player *); /* extern */ -s16 func_802B3FD0(Player *, struct ShellActor *); /* extern */ -? func_802B4104(struct ShellActor *); /* extern */ -? func_802B4E30(struct ShellActor *); /* extern */ +? func_802B3B44(struct ShellActor *); /* extern */ +s16 func_802B3FD0(Player *, struct ShellActor *); /* extern */ ? func_802B63B8(f32 *, f32 *); /* extern */ ? func_802B64C4(f32 *, s16); /* extern */ extern s16 D_8015F6E8; extern s16 D_8015F6EA; -extern s16 D_8015F6EE; extern s16 D_8015F6F0; extern s16 D_8015F6F2; extern u16 D_80164430; @@ -2192,12 +1768,10 @@ void update_obj_red_blue_shell(struct ShellActor *shell) { Player *temp_s1_4; Player *temp_s1_5; Player *temp_s1_6; - f32 *temp_a0; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; f32 temp_f0_4; - f32 temp_f12; f32 temp_f14; f32 temp_f2; f32 temp_f2_2; @@ -2225,10 +1799,9 @@ void update_obj_red_blue_shell(struct ShellActor *shell) { temp_f2 = shell->pos[2]; temp_f0 = shell->pos[0]; - temp_f12 = shell->pos[1]; sp56 = shell->type; - if ((temp_f2 < (f32) D_8015F6F2) || ((f32) D_8015F6F0 < temp_f2) || (temp_f0 < (f32) D_8015F6EA) || ((f32) D_8015F6E8 < temp_f0) || (temp_f12 < (f32) D_8015F6EE)) { - func_8029FDC8(temp_f12, shell); + if ((temp_f2 < (f32) D_8015F6F2) || ((f32) D_8015F6F0 < temp_f2) || (temp_f0 < (f32) D_8015F6EA) || ((f32) D_8015F6E8 < temp_f0) || (shell->pos[1] < (f32) D_8015F6EE)) { + func_8029FDC8((struct Actor *) shell); } temp_t4 = (u16) shell->state; shell->rotVelocity += 0x71C; @@ -2286,7 +1859,7 @@ block_16: func_8000ED80((s32) (shell - gActorList) / 112); } else { func_8000EE10((s32) (shell - gActorList) / 112); - func_800C9D80(shell->pos, shell->velocity, 0x51018008); + func_800C9D80((f32 (*)[3]) shell->pos, (f32 (*)[3]) shell->velocity, 0x51018008U); } } } else { @@ -2299,7 +1872,7 @@ block_16: func_8000ED80((s32) (shell - gActorList) / 112); } else { func_8000EE10((s32) (shell - gActorList) / 112); - func_800C9D80(shell->pos, shell->velocity, 0x51018008); + func_800C9D80((f32 (*)[3]) shell->pos, (f32 (*)[3]) shell->velocity, 0x51018008U); } } } @@ -2311,10 +1884,9 @@ block_16: phi_f0 = temp_f2_3 * D_802B9F94; } sp94 = phi_f0; - temp_a0 = &sp8C; sp8C = 0.0f; sp90 = 0.0f; - func_802B64C4(temp_a0, (s16) (temp_s1_2->unk_02E + temp_s1_2->unk_0C0)); + func_802B64C4(&sp8C, (s16) (temp_s1_2->unk_02E + temp_s1_2->unk_0C0)); shell->velocity[0] = sp8C; shell->velocity[1] = sp90; shell->velocity[2] = sp94; @@ -2336,7 +1908,7 @@ block_16: if (shell->type == 0x002A) { shell->state = 8; shell->parentIndex = gPlayerPositionLUT; - shell->unk_08 = 1000.0f; + shell->shellId = 1000.0f; temp_v1_2 = D_80164430; temp_v0_2 = *(&D_80164438 + (((s32) (temp_s1_3 - gPlayerOne) / 3544) * 2)) + 8; phi_v0_2 = temp_v0_2; @@ -2345,7 +1917,7 @@ block_16: } shell->rotAngle = phi_v0_2; } else if (gModeSelection == (s32) 3) { - shell->unk_08 = 1000.0f; + shell->shellId = 1000.0f; shell->parentIndex = func_802B3FD0(temp_s1_3, shell); if (shell->parentIndex < 0) { shell->flags = -0x8000; @@ -2370,7 +1942,7 @@ block_16: shell->rotAngle = phi_v0_3; } else if (temp_v0_3 >= 5) { shell->state = 5; - shell->unk_08 = 1000.0f; + shell->shellId = 1000.0f; temp_v1_4 = D_80164430; temp_v0_5 = *(&D_80164438 + (((s32) (temp_s1_3 - gPlayerOne) / 3544) * 2)) + 8; phi_v0_4 = temp_v0_5; @@ -2381,7 +1953,7 @@ block_16: shell->parentIndex = (&gPlayerPositionLUT)[temp_s1_3->currentRank].unk-2; } else { shell->state = 3; - shell->unk_08 = 1000.0f; + shell->shellId = 1000.0f; shell->parentIndex = (&gPlayerPositionLUT)[temp_s1_3->currentRank].unk-2; } } @@ -2396,8 +1968,8 @@ block_16: shell->pos[0] += shell->velocity[0]; shell->pos[1] += shell->velocity[1]; shell->pos[2] += shell->velocity[2]; - func_802AD950(&shell->unk30, 0x40800000, shell->pos[0], shell->pos[1], shell->pos[2], sp38, sp3C, sp40); - func_802B4E30(shell); + func_802AD950(&shell->unk30, 4.0f, shell->pos[0], shell->pos[1], shell->pos[2], sp38, sp3C, sp40); + func_802B4E30((struct Actor *) shell); func_802B4104(shell); return; case 3: @@ -2408,7 +1980,7 @@ block_16: temp_v0_6 = shell->parentIndex; if (temp_v0_6 == 0) { if ((shell->flags & 0xF) == 0) { - func_8029FDC8((bitwise f32) shell); + func_8029FDC8((struct Actor *) shell); return; } shell->parentIndex = temp_v0_6 - 1; @@ -2429,7 +2001,7 @@ block_16: temp_v0_7 = &gActorList[shell->parentIndex]; temp_s1_5 = &gPlayers[shell->playerId]; if (temp_v0_7->type != 0x0016) { - func_8029FDC8((bitwise f32) shell); + func_8029FDC8((struct Actor *) shell); return; } temp_t6 = shell->rotAngle + temp_v0_7->rotVelocity; @@ -2444,8 +2016,8 @@ block_16: shell->pos[0] = sp8C + temp_s1_5->pos[0]; shell->pos[1] = sp90 + temp_s1_5->pos[1]; shell->pos[2] = sp94 + temp_s1_5->pos[2]; - func_802AD950(&shell->unk30, 0x40800000, shell->pos[0], shell->pos[1], shell->pos[2], sp38, sp3C, sp40); - func_802B4E30(shell); + func_802AD950(&shell->unk30, 4.0f, shell->pos[0], shell->pos[1], shell->pos[2], sp38, sp3C, sp40); + func_802B4E30((struct Actor *) shell); return; case 7: shell->velocity[1] -= D_802B9F9C; @@ -2456,7 +2028,7 @@ block_16: shell->rotAngle += 0x5B0; shell->pos[1] += shell->velocity[1]; if (shell->parentIndex == 0) { - destroy_actor(-5.0f, shell); + destroy_actor((struct Actor *) shell); return; } break; diff --git a/src/code_802B0210.h b/src/code_802B0210.h index 316fa8c08..d5b745299 100644 --- a/src/code_802B0210.h +++ b/src/code_802B0210.h @@ -1,7 +1,7 @@ #ifndef CODE_802B0210_H #define CODE_802B0210_H -#include "types.h" +#include "common_structs.h" #include "actor_types.h" void func_802B0210(UnkActorInner*, UnkActorInner*); @@ -13,16 +13,44 @@ s32 func_802B09C0(s16); void update_obj_banana_bunch(struct BananaBunchParent*); s32 func_802B0E14(s16); void update_obj_triple_shell(struct TripleShellParent*, s16); +s32 func_802B17F4(Player*); +s32 func_802B18E4(Player*, s16); +s32 func_802B19EC(struct TripleShellParent*, Player*, s16, u16); +s32 func_802B1E48(Player*); +void func_802B1FFC(Player*); void update_obj_green_shell(struct ShellActor*); void update_obj_red_blue_shell(struct ShellActor*); void update_obj_banana(struct BananaActor*); +void func_802B2914(struct BananaBunchParent*, Player*, s16); +s32 func_802B2C40(Player*); +s32 func_802B2D70(Player*); +void func_802B2EBC(Player*); +void func_802B2FA0(Player*); void func_802B30EC(); +void func_802B3E7C(struct ShellActor*, Player*); +void func_802B4104(struct ShellActor*); void func_802B4E30(struct Actor*); +// src/code_80091750.c +void func_8009E5BC(); + // audio/external.c -extern void func_800C9060(Player*, s32); +extern void func_800C9060(u8, s32); +extern void func_800C90F4(u8, u32); +extern void func_800CAB4C(u8); + +extern f32 D_802B9F68; + +extern s16 gPlayerBalloonCount[]; extern struct Actor gActorList[]; extern Player gPlayers[]; +extern Player *gPlayerOne; +extern Player *gPlayerTwo; +extern Player *gPlayerThree; +extern struct Controller gControllers[]; +extern struct Controller *gControllerEight; +extern struct Controller *gControllerSeven; +extern struct Controller *gControllerSix; #endif diff --git a/src/memory.c b/src/memory.c index e393c42b2..3058e516f 100644 --- a/src/memory.c +++ b/src/memory.c @@ -3012,10 +3012,10 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AD278.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 -s32 func_802AC760(void *, f32, f32, f32, f32, f32, f32, f32, f32); /* extern */ -s32 func_802ACBA4(void *, void *, f32, f32, f32, s32, f32, f32, f32); /* extern */ -s32 func_802AD278(void *, void *, f32, f32, f32, s32, f32, f32, f32); /* extern */ +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b +s32 func_802AC760(f32, f32, f32, f32, f32, f32, f32, f32, f32); /* extern */ +s32 func_802ACBA4(UnkActorInner *, f32, f32, f32, f32, s32, f32, f32, f32); /* extern */ +s32 func_802AD278(UnkActorInner *, f32, f32, f32, f32, s32, f32, f32, f32); /* extern */ extern ? D_8014F110; extern s32 D_8015F584; extern s16 D_8015F6E8; @@ -3023,7 +3023,7 @@ extern s16 D_8015F6EA; extern s16 D_8015F6F0; extern s16 D_8015F6F2; -s32 func_802AD950(void *arg0, void *arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) { +s32 func_802AD950(UnkActorInner *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) { s16 temp_v0_4; s16 temp_v1; s32 temp_f10; @@ -3045,46 +3045,46 @@ s32 func_802AD950(void *arg0, void *arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5 s32 phi_s4_5; s32 phi_s4_6; - arg0->unk0 = 0; - arg0->unk2 = 0; - arg0->unk4 = 0; - arg0->unkC = 1000.0f; - arg0->unk10 = 1000.0f; - arg0->unk14 = 1000.0f; - temp_v0 = arg0->unkA; + arg0->unk30 = 0; + arg0->unk32 = 0; + arg0->unk34 = 0; + arg0->unk3C = 1000.0f; + arg0->unk40 = 1000.0f; + arg0->unk44 = 1000.0f; + temp_v0 = arg0->unk3A; phi_s4_6 = 0; if (((s32) temp_v0 < (s32) D_8015F588) && (func_802AC760(arg1, arg2, arg3, arg4, (bitwise f32) temp_v0, arg5, arg6, arg7) == 1)) { - phi_s4_6 = 0x4000; + phi_s4_6 = 0x00004000; } - temp_v0_2 = arg0->unk6; + temp_v0_2 = arg0->unk36; phi_s4_4 = phi_s4_6; if (((s32) temp_v0_2 < (s32) D_8015F588) && (func_802ACBA4(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_2, arg5, arg6, arg7) == 1)) { phi_s4_4 = (phi_s4_6 | 0x2000) & 0xFFFF; } - temp_v0_3 = arg0->unk8; + temp_v0_3 = arg0->unk38; phi_s4 = phi_s4_4; if (((s32) temp_v0_3 < (s32) D_8015F588) && (func_802AD278(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_3, arg5, arg6, arg7) == 1)) { phi_s4 = (phi_s4_4 | 0x8000) & 0xFFFF; } phi_s4_2 = phi_s4; phi_s4_3 = phi_s4; - if (phi_s4 == 0xE000) { + if (phi_s4 == 0x0000E000) { goto block_39; } temp_v0_4 = D_8015F6EA; temp_v1 = D_8015F6F2; temp_f10 = (s32) ((arg2 - (f32) temp_v0_4) / (f32) ((s32) (D_8015F6E8 - temp_v0_4) / 32)); temp_f16 = (s32) ((arg4 - (f32) temp_v1) / (f32) ((s32) (D_8015F6F0 - temp_v1) / 32)); - if ((s32) (s16) temp_f10 < 0) { + if ((s16) temp_f10 < 0) { return 0; } - if ((s32) (s16) temp_f16 < 0) { + if ((s16) temp_f16 < 0) { return 0; } - if ((s32) (s16) temp_f10 >= 0x20) { + if ((s16) temp_f10 >= 0x20) { return 0; } - if ((s32) (s16) temp_f16 >= 0x20) { + if ((s16) temp_f16 >= 0x20) { return 0; } temp_v1_2 = ((s16) ((s16) temp_f10 + ((s16) temp_f16 << 5)) * 4) + &D_8014F110; @@ -3098,20 +3098,20 @@ s32 func_802AD950(void *arg0, void *arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5 loop_22: phi_s4_3 = phi_s4_2; phi_s4_5 = phi_s4_2; - if (phi_s4_2 == 0xE000) { + if (phi_s4_2 == 0x0000E000) { } else { temp_v0_5 = *(D_8015F584 + (phi_s2 * 2)); - temp_v1_3 = (*D_8015F580)[temp_v0_5].flags; + temp_v1_3 = D_8015F580[temp_v0_5].flags; if ((temp_v1_3 & 0x4000) != 0) { - if (((phi_s4_2 & 0x4000) == 0) && (arg0->unkA != temp_v0_5) && (func_802AC760(arg0, (bitwise f32) arg1, arg2, arg3, arg4, (bitwise f32) temp_v0_5, arg5, arg6, arg7) == 1)) { + if (((phi_s4_2 & 0x4000) == 0) && (arg0->unk3A != temp_v0_5) && (func_802AC760((bitwise f32) arg0, arg1, arg2, arg3, arg4, (bitwise f32) temp_v0_5, arg5, arg6, arg7) == 1)) { phi_s4_5 = (phi_s4_2 | 0x4000) & 0xFFFF; } } else if ((temp_v1_3 & 0x8000) != 0) { - if (((phi_s4_2 & 0x8000) == 0) && (arg0->unk8 != temp_v0_5) && (func_802AD278(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_5, arg5, arg6, arg7) == 1)) { + if (((phi_s4_2 & 0x8000) == 0) && (arg0->unk38 != temp_v0_5) && (func_802AD278(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_5, arg5, arg6, arg7) == 1)) { phi_s4_5 = (phi_s4_2 | 0x8000) & 0xFFFF; } - } else if (((phi_s4_2 & 0x2000) == 0) && (arg0->unk6 != temp_v0_5) && (func_802ACBA4(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_5, arg5, arg6, arg7) == 1)) { + } else if (((phi_s4_2 & 0x2000) == 0) && (arg0->unk36 != temp_v0_5) && (func_802ACBA4(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_5, arg5, arg6, arg7) == 1)) { phi_s4_5 = (phi_s4_2 | 0x2000) & 0xFFFF; } temp_t7 = (phi_s3 + 1) & 0xFFFF; diff --git a/src/memory.h b/src/memory.h index 431d37e89..2b8be6d60 100644 --- a/src/memory.h +++ b/src/memory.h @@ -91,6 +91,7 @@ s16 func_802ABDB8(u16); s16 func_802ABDF4(u16); f32 func_802ABE30(f32, f32, f32, u16); f32 func_802ABEAC(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);