diff --git a/asm/non_matchings/code_actors/func_80298C94.s b/asm/non_matchings/code_actors/func_80298C94.s deleted file mode 100644 index 7e08d366f..000000000 --- a/asm/non_matchings/code_actors/func_80298C94.s +++ /dev/null @@ -1,34 +0,0 @@ -glabel func_80298C94 -/* 1022A4 80298C94 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 1022A8 80298C98 AFB20020 */ sw $s2, 0x20($sp) -/* 1022AC 80298C9C AFB00018 */ sw $s0, 0x18($sp) -/* 1022B0 80298CA0 AFB1001C */ sw $s1, 0x1c($sp) -/* 1022B4 80298CA4 3C10800F */ lui $s0, %hi(gPlayers) # $s0, 0x800f -/* 1022B8 80298CA8 3C128010 */ lui $s2, %hi(gPlayers+0x3760) # $s2, 0x8010 -/* 1022BC 80298CAC AFBF0024 */ sw $ra, 0x24($sp) -/* 1022C0 80298CB0 2652A0F0 */ addiu $s2, %lo(gPlayers+0x3760) # addiu $s2, $s2, -0x5f10 -/* 1022C4 80298CB4 26106990 */ addiu $s0, %lo(gPlayers) # addiu $s0, $s0, 0x6990 -/* 1022C8 80298CB8 24110008 */ li $s1, 8 -/* 1022CC 80298CBC 960E0000 */ lhu $t6, ($s0) -.L80298CC0: -/* 1022D0 80298CC0 31CFC000 */ andi $t7, $t6, 0xc000 -/* 1022D4 80298CC4 51E0000A */ beql $t7, $zero, .L80298CF0 -/* 1022D8 80298CC8 26100DD8 */ addiu $s0, $s0, 0xdd8 -/* 1022DC 80298CCC 0C0AAF44 */ jal func_802ABD10 -/* 1022E0 80298CD0 9604011A */ lhu $a0, 0x11a($s0) -/* 1022E4 80298CD4 0002C600 */ sll $t8, $v0, 0x18 -/* 1022E8 80298CD8 0018CE03 */ sra $t9, $t8, 0x18 -/* 1022EC 80298CDC 56390004 */ bnel $s1, $t9, .L80298CF0 -/* 1022F0 80298CE0 26100DD8 */ addiu $s0, $s0, 0xdd8 -/* 1022F4 80298CE4 0C0A62B0 */ jal func_80298AC0 -/* 1022F8 80298CE8 02002025 */ move $a0, $s0 -/* 1022FC 80298CEC 26100DD8 */ addiu $s0, $s0, 0xdd8 -.L80298CF0: -/* 102300 80298CF0 5612FFF3 */ bnel $s0, $s2, .L80298CC0 -/* 102304 80298CF4 960E0000 */ lhu $t6, ($s0) -/* 102308 80298CF8 8FBF0024 */ lw $ra, 0x24($sp) -/* 10230C 80298CFC 8FB00018 */ lw $s0, 0x18($sp) -/* 102310 80298D00 8FB1001C */ lw $s1, 0x1c($sp) -/* 102314 80298D04 8FB20020 */ lw $s2, 0x20($sp) -/* 102318 80298D08 03E00008 */ jr $ra -/* 10231C 80298D0C 27BD0028 */ addiu $sp, $sp, 0x28 diff --git a/asm/non_matchings/code_actors/func_8029F408.s b/asm/non_matchings/code_actors/func_8029F408.s deleted file mode 100644 index d226d3f94..000000000 --- a/asm/non_matchings/code_actors/func_8029F408.s +++ /dev/null @@ -1,177 +0,0 @@ -glabel func_8029F408 -/* 108A18 8029F408 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 108A1C 8029F40C AFBF0014 */ sw $ra, 0x14($sp) -/* 108A20 8029F410 C4860014 */ lwc1 $f6, 0x14($a0) -/* 108A24 8029F414 C4A40018 */ lwc1 $f4, 0x18($a1) -/* 108A28 8029F418 44808000 */ mtc1 $zero, $f16 -/* 108A2C 8029F41C 00803825 */ move $a3, $a0 -/* 108A30 8029F420 46062081 */ sub.s $f2, $f4, $f6 -/* 108A34 8029F424 3C014270 */ lui $at, 0x4270 -/* 108A38 8029F428 4610103C */ c.lt.s $f2, $f16 -/* 108A3C 8029F42C 00000000 */ nop -/* 108A40 8029F430 4502000B */ bc1fl .L8029F460 -/* 108A44 8029F434 3C014270 */ li $at, 0x42700000 # 60.000000 -/* 108A48 8029F438 44817000 */ mtc1 $at, $f14 -/* 108A4C 8029F43C 00000000 */ nop -/* 108A50 8029F440 46007207 */ neg.s $f8, $f14 -/* 108A54 8029F444 4608103C */ c.lt.s $f2, $f8 -/* 108A58 8029F448 00000000 */ nop -/* 108A5C 8029F44C 45020004 */ bc1fl .L8029F460 -/* 108A60 8029F450 3C014270 */ lui $at, 0x4270 -/* 108A64 8029F454 1000008D */ b .L8029F68C -/* 108A68 8029F458 00001025 */ move $v0, $zero -/* 108A6C 8029F45C 3C014270 */ li $at, 0x42700000 # 60.000000 -.L8029F460: -/* 108A70 8029F460 44817000 */ mtc1 $at, $f14 -/* 108A74 8029F464 00000000 */ nop -/* 108A78 8029F468 4602703C */ c.lt.s $f14, $f2 -/* 108A7C 8029F46C 00000000 */ nop -/* 108A80 8029F470 45020004 */ bc1fl .L8029F484 -/* 108A84 8029F474 C4AA0020 */ lwc1 $f10, 0x20($a1) -/* 108A88 8029F478 10000084 */ b .L8029F68C -/* 108A8C 8029F47C 00001025 */ move $v0, $zero -/* 108A90 8029F480 C4AA0020 */ lwc1 $f10, 0x20($a1) -.L8029F484: -/* 108A94 8029F484 C4F2001C */ lwc1 $f18, 0x1c($a3) -/* 108A98 8029F488 46125001 */ sub.s $f0, $f10, $f18 -/* 108A9C 8029F48C 4610003C */ c.lt.s $f0, $f16 -/* 108AA0 8029F490 00000000 */ nop -/* 108AA4 8029F494 45020009 */ bc1fl .L8029F4BC -/* 108AA8 8029F498 4600703C */ c.lt.s $f14, $f0 -/* 108AAC 8029F49C 46007107 */ neg.s $f4, $f14 -/* 108AB0 8029F4A0 4604003C */ c.lt.s $f0, $f4 -/* 108AB4 8029F4A4 00000000 */ nop -/* 108AB8 8029F4A8 45020004 */ bc1fl .L8029F4BC -/* 108ABC 8029F4AC 4600703C */ c.lt.s $f14, $f0 -/* 108AC0 8029F4B0 10000076 */ b .L8029F68C -/* 108AC4 8029F4B4 00001025 */ move $v0, $zero -/* 108AC8 8029F4B8 4600703C */ c.lt.s $f14, $f0 -.L8029F4BC: -/* 108ACC 8029F4BC 00000000 */ nop -/* 108AD0 8029F4C0 45000003 */ bc1f .L8029F4D0 -/* 108AD4 8029F4C4 00000000 */ nop -/* 108AD8 8029F4C8 10000070 */ b .L8029F68C -/* 108ADC 8029F4CC 00001025 */ move $v0, $zero -.L8029F4D0: -/* 108AE0 8029F4D0 46021182 */ mul.s $f6, $f2, $f2 -/* 108AE4 8029F4D4 AFA5003C */ sw $a1, 0x3c($sp) -/* 108AE8 8029F4D8 AFA70038 */ sw $a3, 0x38($sp) -/* 108AEC 8029F4DC 46000202 */ mul.s $f8, $f0, $f0 -/* 108AF0 8029F4E0 0C033850 */ jal sqrtf -/* 108AF4 8029F4E4 46083300 */ add.s $f12, $f6, $f8 -/* 108AF8 8029F4E8 3C014270 */ li $at, 0x42700000 # 60.000000 -/* 108AFC 8029F4EC 44817000 */ mtc1 $at, $f14 -/* 108B00 8029F4F0 8FA70038 */ lw $a3, 0x38($sp) -/* 108B04 8029F4F4 46000086 */ mov.s $f2, $f0 -/* 108B08 8029F4F8 4600703C */ c.lt.s $f14, $f0 -/* 108B0C 8029F4FC 00E02025 */ move $a0, $a3 -/* 108B10 8029F500 45020004 */ bc1fl .L8029F514 -/* 108B14 8029F504 AFA70038 */ sw $a3, 0x38($sp) -/* 108B18 8029F508 10000060 */ b .L8029F68C -/* 108B1C 8029F50C 00001025 */ move $v0, $zero -/* 108B20 8029F510 AFA70038 */ sw $a3, 0x38($sp) -.L8029F514: -/* 108B24 8029F514 0C0A5DEC */ jal func_802977B0 -/* 108B28 8029F518 E7A2001C */ swc1 $f2, 0x1c($sp) -/* 108B2C 8029F51C 8FA2003C */ lw $v0, 0x3c($sp) -/* 108B30 8029F520 8FA70038 */ lw $a3, 0x38($sp) -/* 108B34 8029F524 44802000 */ mtc1 $zero, $f4 -/* 108B38 8029F528 C452001C */ lwc1 $f18, 0x1c($v0) -/* 108B3C 8029F52C C4EA0018 */ lwc1 $f10, 0x18($a3) -/* 108B40 8029F530 C7A2001C */ lwc1 $f2, 0x1c($sp) -/* 108B44 8029F534 46125001 */ sub.s $f0, $f10, $f18 -/* 108B48 8029F538 4604003C */ c.lt.s $f0, $f4 -/* 108B4C 8029F53C 00000000 */ nop -/* 108B50 8029F540 45020004 */ bc1fl .L8029F554 -/* 108B54 8029F544 C4E60070 */ lwc1 $f6, 0x70($a3) -/* 108B58 8029F548 10000050 */ b .L8029F68C -/* 108B5C 8029F54C 00001025 */ move $v0, $zero -/* 108B60 8029F550 C4E60070 */ lwc1 $f6, 0x70($a3) -.L8029F554: -/* 108B64 8029F554 C448000C */ lwc1 $f8, 0xc($v0) -/* 108B68 8029F558 46083000 */ add.s $f0, $f6, $f8 -/* 108B6C 8029F55C 4602003C */ c.lt.s $f0, $f2 -/* 108B70 8029F560 00000000 */ nop -/* 108B74 8029F564 45020004 */ bc1fl .L8029F578 -/* 108B78 8029F568 94EE0000 */ lhu $t6, ($a3) -/* 108B7C 8029F56C 10000047 */ b .L8029F68C -/* 108B80 8029F570 00001025 */ move $v0, $zero -/* 108B84 8029F574 94EE0000 */ lhu $t6, ($a3) -.L8029F578: -/* 108B88 8029F578 3C0B800E */ lui $t3, %hi(gPlayerOne) # $t3, 0x800e -/* 108B8C 8029F57C 31CF4000 */ andi $t7, $t6, 0x4000 -/* 108B90 8029F580 11E00038 */ beqz $t7, .L8029F664 -/* 108B94 8029F584 00000000 */ nop -/* 108B98 8029F588 8CF800BC */ lw $t8, 0xbc($a3) -/* 108B9C 8029F58C 3C014100 */ li $at, 0x41000000 # 8.000000 -/* 108BA0 8029F590 00E02025 */ move $a0, $a3 -/* 108BA4 8029F594 33190200 */ andi $t9, $t8, 0x200 -/* 108BA8 8029F598 1320001C */ beqz $t9, .L8029F60C -/* 108BAC 8029F59C 3C0E800E */ lui $t6, %hi(gPlayerOne) # $t6, 0x800e -/* 108BB0 8029F5A0 84480002 */ lh $t0, 2($v0) -/* 108BB4 8029F5A4 44815000 */ mtc1 $at, $f10 -/* 108BB8 8029F5A8 3C061901 */ lui $a2, (0x19018010 >> 16) # lui $a2, 0x1901 -/* 108BBC 8029F5AC 35090400 */ ori $t1, $t0, 0x400 -/* 108BC0 8029F5B0 A4490002 */ sh $t1, 2($v0) -/* 108BC4 8029F5B4 E44A0028 */ swc1 $f10, 0x28($v0) -/* 108BC8 8029F5B8 AFA70038 */ sw $a3, 0x38($sp) -/* 108BCC 8029F5BC 34C68010 */ ori $a2, (0x19018010 & 0xFFFF) # ori $a2, $a2, 0x8010 -/* 108BD0 8029F5C0 24E40014 */ addiu $a0, $a3, 0x14 -/* 108BD4 8029F5C4 0C03262E */ jal func_800C98B8 -/* 108BD8 8029F5C8 24E50034 */ addiu $a1, $a3, 0x34 -/* 108BDC 8029F5CC 3C0A800E */ lui $t2, %hi(gPlayerOne) # $t2, 0x800e -/* 108BE0 8029F5D0 8FA70038 */ lw $a3, 0x38($sp) -/* 108BE4 8029F5D4 8D4AC4DC */ lw $t2, %lo(gPlayerOne)($t2) -/* 108BE8 8029F5D8 24010DD8 */ li $at, 3544 -/* 108BEC 8029F5DC 94E50254 */ lhu $a1, 0x254($a3) -/* 108BF0 8029F5E0 00EA2023 */ subu $a0, $a3, $t2 -/* 108BF4 8029F5E4 0081001A */ div $zero, $a0, $at -/* 108BF8 8029F5E8 3C012900 */ lui $at, (0x2900800D >> 16) # lui $at, 0x2900 -/* 108BFC 8029F5EC 3421800D */ ori $at, (0x2900800D & 0xFFFF) # ori $at, $at, 0x800d -/* 108C00 8029F5F0 00005812 */ mflo $t3 -/* 108C04 8029F5F4 00056900 */ sll $t5, $a1, 4 -/* 108C08 8029F5F8 01A12821 */ addu $a1, $t5, $at -/* 108C0C 8029F5FC 0C03243D */ jal func_800C90F4 -/* 108C10 8029F600 316400FF */ andi $a0, $t3, 0xff -/* 108C14 8029F604 10000021 */ b .L8029F68C -/* 108C18 8029F608 24020001 */ li $v0, 1 -.L8029F60C: -/* 108C1C 8029F60C 8DCEC4DC */ lw $t6, %lo(gPlayerOne)($t6) -/* 108C20 8029F610 24010DD8 */ li $at, 3544 -/* 108C24 8029F614 AFA70038 */ sw $a3, 0x38($sp) -/* 108C28 8029F618 00EE2823 */ subu $a1, $a3, $t6 -/* 108C2C 8029F61C 00A1001A */ div $zero, $a1, $at -/* 108C30 8029F620 00007812 */ mflo $t7 -/* 108C34 8029F624 000FC600 */ sll $t8, $t7, 0x18 -/* 108C38 8029F628 0C0236AF */ jal func_8008DABC -/* 108C3C 8029F62C 00182E03 */ sra $a1, $t8, 0x18 -/* 108C40 8029F630 3C08800E */ lui $t0, %hi(gModeSelection) # $t0, 0x800e -/* 108C44 8029F634 8D08C53C */ lw $t0, %lo(gModeSelection)($t0) -/* 108C48 8029F638 24020001 */ li $v0, 1 -/* 108C4C 8029F63C 8FA70038 */ lw $a3, 0x38($sp) -/* 108C50 8029F640 54480012 */ bnel $v0, $t0, .L8029F68C -/* 108C54 8029F644 24020001 */ li $v0, 1 -/* 108C58 8029F648 94E90000 */ lhu $t1, ($a3) -/* 108C5C 8029F64C 3C018016 */ lui $at, %hi(D_80162DF8) # $at, 0x8016 -/* 108C60 8029F650 312A1000 */ andi $t2, $t1, 0x1000 -/* 108C64 8029F654 5540000D */ bnel $t2, $zero, .L8029F68C -/* 108C68 8029F658 24020001 */ li $v0, 1 -/* 108C6C 8029F65C 1000000A */ b .L8029F688 -/* 108C70 8029F660 AC222DF8 */ sw $v0, %lo(D_80162DF8)($at) -.L8029F664: -/* 108C74 8029F664 8D6BC4DC */ lw $t3, %lo(gPlayerOne)($t3) -/* 108C78 8029F668 24010DD8 */ li $at, 3544 -/* 108C7C 8029F66C 00E02025 */ move $a0, $a3 -/* 108C80 8029F670 00EB2823 */ subu $a1, $a3, $t3 -/* 108C84 8029F674 00A1001A */ div $zero, $a1, $at -/* 108C88 8029F678 00006012 */ mflo $t4 -/* 108C8C 8029F67C 000C6E00 */ sll $t5, $t4, 0x18 -/* 108C90 8029F680 0C0236AF */ jal func_8008DABC -/* 108C94 8029F684 000D2E03 */ sra $a1, $t5, 0x18 -.L8029F688: -/* 108C98 8029F688 24020001 */ li $v0, 1 -.L8029F68C: -/* 108C9C 8029F68C 8FBF0014 */ lw $ra, 0x14($sp) -/* 108CA0 8029F690 27BD0038 */ addiu $sp, $sp, 0x38 -/* 108CA4 8029F694 03E00008 */ jr $ra -/* 108CA8 8029F698 00000000 */ nop diff --git a/src/code_8008C1D0.h b/src/code_8008C1D0.h index e239d4c54..eff5b01bc 100644 --- a/src/code_8008C1D0.h +++ b/src/code_8008C1D0.h @@ -81,7 +81,7 @@ void func_80056A94(s32, Player*); // code_80057C60 void func_8006B8B4(Player*, s8); // audio/external.c -void func_800C90F4(u8, s32); +void func_800C90F4(u8, uintptr_t); void func_800C9060(u8, s32); void func_800C9250(u8); void func_800CA24C(u8); diff --git a/src/code_80296A50.c b/src/code_80296A50.c index 5ceb4fb97..7568ea289 100644 --- a/src/code_80296A50.c +++ b/src/code_80296A50.c @@ -19,17 +19,13 @@ s8 D_802BA060[512]; // tlut 256 u16 D_802BA260; extern u16 gNumActors; - #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8000EE58(u16, void *, u16, s32); /* extern */ -? destroy_actor(void *, void *); /* extern */ +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b +? func_8000EE58(u16, struct Actor *, u16, s16); /* extern */ extern u16 D_8015F6FE; -extern u16 gNumPermanentActors; -extern ? gActorList; -void func_80296A50(s32 arg0, s32 arg3) { - void *sp1C; +void func_80296A50(struct ShellActor *shell, s16 arg3) { + struct Actor *sp1C; s16 temp_t3; s16 temp_t7; s16 temp_v0; @@ -38,49 +34,49 @@ void func_80296A50(s32 arg0, s32 arg3) { s32 temp_a2_3; s32 temp_a2_4; u16 temp_t1; - void *phi_a1; + struct Actor *phi_a1; u16 phi_a2; - void *phi_a1_2; + struct Actor *phi_a1_2; u16 phi_a2_2; s32 phi_a2_3; - void *phi_a1_3; + struct Actor *phi_a1_3; u16 phi_a2_4; s32 phi_a2_5; - void *phi_a1_4; + struct Actor *phi_a1_4; u16 phi_a2_6; - s32 phi_a3; temp_t1 = gNumPermanentActors; phi_a2 = temp_t1; - phi_a3 = arg3; - if (temp_t1 < 0x64) { - phi_a1 = (temp_t1 * 0x70) + &gActorList; + phi_a2_3 = (s32) temp_t1; + phi_a2_5 = (s32) temp_t1; + if ((s32) temp_t1 < 0x64) { + phi_a1 = &gActorList[temp_t1]; loop_2: - if ((arg0 != phi_a1) && ((phi_a1->unk2 & 0xF) == 0) && (phi_a1->unk0 == 7)) { - if (phi_a1->unk6 == 2) { + if ((shell != phi_a1) && ((phi_a1->flags & 0xF) == 0) && (phi_a1->type == 7)) { + if (phi_a1->state == 2) { sp1C = phi_a1; func_8000EE58(phi_a2, phi_a1, phi_a2, 2); } D_8015F6FE += -1; - destroy_actor(phi_a1, phi_a1); + destroy_actor(phi_a1); return; } temp_a2 = phi_a2 + 1; phi_a1 += 0x70; - phi_a2 = temp_a2; + phi_a2 = (u16) temp_a2; if (temp_a2 >= 0x64) { goto block_10; } goto loop_2; } block_10: - phi_a2_2 = gNumPermanentActors; - phi_a2_3 = gNumPermanentActors; - if (gNumPermanentActors < 0x64) { - phi_a1_2 = (gNumPermanentActors * 0x70) + &gActorList; + phi_a2_2 = (u16) (s32) temp_t1; + phi_a2_3 = (s32) temp_t1; + if ((s32) temp_t1 < 0x64) { + phi_a1_2 = &gActorList[(s32) temp_t1]; loop_12: - if ((arg0 != phi_a1_2) && ((phi_a1_2->unk2 & 0xF) == 0) && (phi_a1_2->unk0 == 8)) { - temp_t3 = phi_a1_2->unk6; + if ((shell != phi_a1_2) && ((phi_a1_2->flags & 0xF) == 0) && (phi_a1_2->type == 8)) { + temp_t3 = phi_a1_2->state; switch (temp_t3) { /* switch 1 */ case 2: /* switch 1 */ case 3: /* switch 1 */ @@ -93,85 +89,81 @@ loop_12: /* fallthrough */ case 7: /* switch 1 */ D_8015F6FE += -1; - destroy_actor(phi_a1_2, phi_a1_2); + destroy_actor(phi_a1_2); return; } } else { default: /* switch 1 */ temp_a2_2 = phi_a2_2 + 1; phi_a1_2 += 0x70; - phi_a2_2 = temp_a2_2; + phi_a2_2 = (u16) temp_a2_2; if (temp_a2_2 >= 0x64) { - phi_a2_3 = temp_t1; goto block_21; } goto loop_12; } } else { block_21: - phi_a2_4 = phi_a2_3; + phi_a2_4 = (u16) phi_a2_3; phi_a2_5 = phi_a2_3; if (phi_a2_3 < 0x64) { - phi_a1_3 = (phi_a2_3 * 0x70) + &gActorList; - phi_a3 = 2; + phi_a1_3 = &gActorList[phi_a2_3]; loop_23: - if ((arg0 != phi_a1_3) && (phi_a1_3->unk0 == 7)) { - temp_v0 = phi_a1_3->unk6; - if (temp_v0 != 2) { - if (temp_v0 != 7) { - goto block_30; - } - goto block_29; - } - sp1C = phi_a1_3; - func_8000EE58(phi_a2_4, phi_a1_3, phi_a2_4, 2); -block_29: - D_8015F6FE += -1; - destroy_actor(phi_a1_3, phi_a1_3); - return; - } -block_30: - temp_a2_3 = phi_a2_4 + 1; - phi_a1_3 += 0x70; - phi_a2_4 = temp_a2_3; - if (temp_a2_3 >= 0x64) { - phi_a2_5 = temp_t1; - goto block_32; - } - goto loop_23; - } -block_32: - phi_a2_6 = phi_a2_5; - if (phi_a2_5 < 0x64) { - phi_a1_4 = (phi_a2_5 * 0x70) + &gActorList; -loop_34: - if ((arg0 != phi_a1_4) && (phi_a1_4->unk0 == 8)) { - temp_t7 = phi_a1_4->unk6; - switch (temp_t7) { /* switch 2 */ - case 2: /* switch 2 */ - case 3: /* switch 2 */ - case 4: /* switch 2 */ - case 5: /* switch 2 */ - case 8: /* switch 2 */ - case 9: /* switch 2 */ - sp1C = phi_a1_4; - func_8000EE58(phi_a2_6, phi_a1_4, phi_a2_6, phi_a3); + if ((shell != phi_a1_3) && (phi_a1_3->type == 7)) { + temp_v0 = phi_a1_3->state; + switch (temp_v0) { /* switch 3; irregular */ + case 2: /* switch 3 */ + sp1C = phi_a1_3; + func_8000EE58(phi_a2_4, phi_a1_3, phi_a2_4, 2); /* fallthrough */ - case 7: /* switch 2 */ + case 7: /* switch 3 */ D_8015F6FE += -1; - destroy_actor(phi_a1_4, phi_a1_4); + destroy_actor(phi_a1_3); return; } } else { - default: /* switch 2 */ - temp_a2_4 = phi_a2_6 + 1; - phi_a1_4 += 0x70; - phi_a2_6 = temp_a2_4; - if (temp_a2_4 >= 0x64) { - /* Duplicate return node #41. Try simplifying control flow for better match */ - return; + temp_a2_3 = phi_a2_4 + 1; + phi_a1_3 += 0x70; + phi_a2_4 = (u16) temp_a2_3; + if (temp_a2_3 >= 0x64) { + goto block_32; + } + goto loop_23; + } + } else { +block_32: + phi_a2_6 = (u16) phi_a2_5; + if (phi_a2_5 < 0x64) { + phi_a1_4 = &gActorList[phi_a2_5]; +loop_34: + if ((shell != phi_a1_4) && (phi_a1_4->type == 8)) { + temp_t7 = phi_a1_4->state; + switch (temp_t7) { /* switch 2 */ + case 2: /* switch 2 */ + case 3: /* switch 2 */ + case 4: /* switch 2 */ + case 5: /* switch 2 */ + case 8: /* switch 2 */ + case 9: /* switch 2 */ + sp1C = phi_a1_4; + func_8000EE58(phi_a2_6, phi_a1_4, phi_a2_6); + /* fallthrough */ + case 7: /* switch 2 */ + D_8015F6FE += -1; + destroy_actor(phi_a1_4); + return; + } + } else { + default: /* switch 2 */ + temp_a2_4 = phi_a2_6 + 1; + phi_a1_4 += 0x70; + phi_a2_6 = (u16) temp_a2_4; + if (temp_a2_4 >= 0x64) { + + } else { + goto loop_34; + } } - goto loop_34; } } } @@ -181,37 +173,35 @@ GLOBAL_ASM("asm/non_matchings/code_actors/func_80296A50.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b ? func_80296A50(struct Actor *); /* extern */ -? func_802AAAAC(UnkActorInner *); /* extern */ -? func_802ADDC8(UnkActorInner *, f32, f32, f32, f32); /* extern */ -? vec3s_copy(s16 *, s16 *); /* extern */ ? vec3f_copy(f32 *, f32 *); /* extern */ +? vec3s_copy(s16 *, s16 *); /* extern */ extern u16 D_8015F6FE; extern u16 D_802BA260; static f32 D_802B95F0 = 1.925f; static f32 D_802B95F4 = 0.35f; -void func_80296D10(struct Actor *actor, Vec3f arg1, Vec3s arg2, Vec3f arg3, s16 actorType) { +void func_80296D10(struct Actor *actor, Vec3f startingPos, Vec3s startingRot, Vec3f startingVelocity, s32 actorType) { UnkActorInner *sp2C; UnkActorInner *temp_a0; f32 temp_f0; u16 temp_v0; s16 phi_v0; - vec3f_copy(actor->pos, arg1); - vec3s_copy(actor->rot, arg2); - vec3f_copy(actor->velocity, arg3); + vec3f_copy(actor->pos, startingPos); + vec3s_copy(actor->rot, startingRot); + vec3f_copy(actor->velocity, startingVelocity); actor->flags = -0x8000; actor->unk_04 = 0; actor->state = 0; temp_a0 = &actor->unk30; - actor->type = actorType; + actor->type = (s16) actorType; actor->unk_08 = 0.0f; actor->boundingBoxSize = 0.0f; sp2C = temp_a0; func_802AAAAC(temp_a0); - switch (actorType) { + switch ((s16) actorType) { case 37: temp_v0 = D_802BA260; phi_v0 = (s16) temp_v0; @@ -224,11 +214,11 @@ void func_80296D10(struct Actor *actor, Vec3f arg1, Vec3s arg2, Vec3f arg3, s16 return; case ACTOR_YOSHI_VALLEY_EGG: actor->flags |= 0x4000; - actor->velocity[2] = actor->pos[2] + 70.0f; actor->unk_08 = 70.0f; actor->boundingBoxSize = 20.0f; actor->velocity[0] = actor->pos[0]; actor->velocity[1] = actor->pos[1]; + actor->velocity[2] = actor->pos[2] + 70.0f; return; case ACTOR_KIWANO_FRUIT: actor->state = 0; @@ -622,11 +612,10 @@ void update_obj_trees_cacti_shrubs(struct Actor *arg0) { } #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -? func_800C9060(f32, f32, s32, ?, struct KiwanoFruit *, Player **); /* extern */ +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b s32 func_802ABD10(u16); /* extern */ extern s32 D_80162DF8; -extern u16 D_80164438; +extern ? D_80164438; extern s32 D_80164490; static f32 D_802B9618 = 2.3f; static f32 D_802B961C = 0.7f; @@ -648,113 +637,13 @@ void update_obj_kiwano_fruit(struct KiwanoFruit *fruit) { f32 temp_f2; f32 temp_f2_2; s16 temp_a0; - s16 temp_t6; s32 temp_v0_2; - struct KiwanoFruit *temp_a2; void *temp_v0; - -/* old unfinished wip decomp - u32 temp_t7 = arg0->unk4; - Player *temp_v1 = &gPlayers[temp_t7]; - void *phi_a2; - s16 phi_a0; - void *phi_a2_2; - void *phi_a2_3; - - temp_a2 = arg0; - phi_a2 = temp_a2; - phi_a2_2 = temp_a2; - phi_a2_3 = temp_a2; - if (((temp_v1->unk_000 & 0x1000) != 0) || (temp_v1->unk_110.unk34 == 0)) { - arg0->unk6 = 0; - return; - } - - switch(arg0->unk6) { - case 0: - //sp24 = temp_v1; - //phi_a2 = arg0; - if ((func_802ABD10(temp_v1->unk_110.unk3A, arg0) & 0xFF) == 8) { - arg0->unk6 = 1; - arg0->unk24[0] = 80.0f; - break; - case 1: - temp_v0 = D_80164490 + D_80164438[(u16)(temp_v1 - gPlayerOne)]; - temp_f2 = temp_v1->pos - temp_v0->unk0; - arg0 = phi_a2; - sp20 = temp_f2; - //sp24 = temp_t7 + &gPlayers; - temp_f16 = (temp_t7 + &gPlayers)->unk18 - temp_v0->unk2; - sp1C = temp_f16; - temp_f14 = (temp_t7 + &gPlayers)->unk1C - temp_v0->unk4; - sp18 = temp_f14; - temp_a2_2 = arg0; - temp_f18 = temp_a2_2->unk24; - temp_f12 = temp_f18 / sqrtf((temp_f2 * temp_f2) + (temp_f16 * temp_f16) + (temp_f14 * temp_f14)); - temp_f2_2 = temp_f2 * temp_f12; - temp_f16_2 = temp_f16 * temp_f12; - temp_a2_2->unk18 = (temp_t7 + &gPlayers)->unk14 + temp_f2_2; - temp_f14_2 = temp_f14 * temp_f12; - temp_a2_2->unk1C = (temp_t7 + &gPlayers)->unk18 + temp_f16_2; - temp_a2_2->unk24 = temp_f18 - 2.0f; - temp_a2_2->unk20 = (temp_t7 + &gPlayers)->unk1C + temp_f14_2; - phi_a2_3 = temp_a2_2; - if (temp_a2_2->unk24 <= 0.0f) { - temp_a2_2->unk6 = 2; - temp_a2_2->unk8 = 30.0f; - temp_a2_2->unk24 = 0.0f; - temp_a2_2->unk28 = D_802B9618; - temp_a2_2->unk2C = 0.0f; - temp_v0_2 = (temp_t7 + &gPlayers)->unkBC; - if ((temp_v0_2 & 0x200) != 0) { - arg0 = temp_a2_2; - func_800C9060((u8)(temp_t7 - gPlayerOne), 0x1900A052); - phi_a2_3 = arg0; - } else { - temp_f12_2 = D_802B961C; - (temp_t7 + &gPlayers)->unkBC = temp_v0_2 | 0x8000; - (temp_t7 + &gPlayers)->unk14 = (temp_t7 + &gPlayers)->unk14 - (temp_f2_2 * 4.0f); - (temp_t7 + &gPlayers)->unk1C = (temp_t7 + &gPlayers)->unk1C - (temp_f14_2 * 4.0f); - (temp_t7 + &gPlayers)->unk34 = (temp_t7 + &gPlayers)->unk34 - (temp_f2_2 * temp_f12_2); - (temp_t7 + &gPlayers)->unk3C = (temp_t7 + &gPlayers)->unk3C - (temp_f14_2 * temp_f12_2); - arg0 = temp_a2_2; - func_800C9060((u8)(temp_t7 - gPlayerOne), 0x19007018); - phi_a2_3 = arg0; - if (gModeSelection != GRAND_PRIX) { - D_80162DF8 = 1; - } - } - } - break; - case 2: - arg0->unk24[1] -= D_802B9620; - arg0->unk18[0] += arg0->unk24[0]; - arg0->unk18[1] += arg0->unk24[1]; - arg0->unk18[2] += arg0->unk24[2]; - arg0->unk8 = arg0->unk8 - 1.0f; - if (arg0->unk8 < 0.0f) { - arg0->unk6 = 0; - } - goto block_17; - break; - } - phi_a0 = phi_a2_3->unk6; - phi_a2_2 = phi_a2_3; - - if (phi_a0 != 0) { - phi_a2_2->unk12 = phi_a2_2->unk12 + 1; - if (phi_a2_2->unk12 == 8) { - phi_a2_2->unk12 = 0; - phi_a2_2->unk10 = phi_a2_2->unk10 + 1; - if (phi_a2_2->unk10 == 3) { - phi_a2_2->unk10 = 0; -*/ s16 phi_a0; struct KiwanoFruit *phi_a2; struct KiwanoFruit *phi_a2_2; - temp_t6 = fruit->targetPlayer; - temp_v1 = &gPlayers[temp_t6]; + temp_v1 = &gPlayers[fruit->targetPlayer]; phi_a2 = fruit; phi_a2_2 = fruit; if (((temp_v1->unk_000 & 0x1000) != 0) || (temp_v1->unk_110.unk34 == 0)) { @@ -765,58 +654,52 @@ void update_obj_kiwano_fruit(struct KiwanoFruit *fruit) { phi_a0 = temp_a0; switch (temp_a0) { /* irregular */ case 0: - fruit = fruit; sp24 = temp_v1; if ((func_802ABD10(temp_v1->unk_110.unk3A) & 0xFF) == 8) { fruit->state = 1; fruit->velocity[0] = 80.0f; case 1: - temp_v0 = D_80164490 + (*(&D_80164438 + ((((s32) (&gPlayers[temp_t6] - gPlayerOne) / 3544) & 0xFFFF) * 2)) * 8); - temp_f2 = gPlayers[temp_t6].pos[0] - (f32) temp_v0->unk0; + temp_v0 = D_80164490 + (*(&D_80164438 + ((((s32) (temp_v1 - gPlayerOne) / 3544) & 0xFFFF) * 2)) * 8); + temp_f2 = temp_v1->pos[0] - (f32) temp_v0->unk0; fruit = fruit; sp20 = temp_f2; - sp24 = &gPlayers[temp_t6]; - temp_f16 = gPlayers[temp_t6].pos[1] - (f32) temp_v0->unk2; + sp24 = temp_v1; + temp_f16 = temp_v1->pos[1] - (f32) temp_v0->unk2; sp1C = temp_f16; - temp_f14 = gPlayers[temp_t6].pos[2] - (f32) temp_v0->unk_04; + temp_f14 = temp_v1->pos[2] - (f32) temp_v0->unk4; sp18 = temp_f14; - temp_a2 = fruit; - temp_f18 = temp_a2->velocity[0]; + temp_f18 = fruit->velocity[0]; temp_f12 = temp_f18 / sqrtf((temp_f2 * temp_f2) + (temp_f16 * temp_f16) + (temp_f14 * temp_f14)); temp_f2_2 = temp_f2 * temp_f12; temp_f16_2 = temp_f16 * temp_f12; - temp_a2->pos[0] = gPlayers[temp_t6].pos[0] + temp_f2_2; + fruit->pos[0] = temp_v1->pos[0] + temp_f2_2; temp_f14_2 = temp_f14 * temp_f12; - temp_a2->pos[1] = gPlayers[temp_t6].pos[1] + temp_f16_2; - temp_a2->velocity[0] = temp_f18 - 2.0f; - temp_a2->pos[2] = gPlayers[temp_t6].pos[2] + temp_f14_2; - phi_a2_2 = temp_a2; - if (temp_a2->velocity[0] <= 0.0f) { - temp_a2->state = 2; - temp_a2->bonkTimer = 30.0f; - temp_a2->velocity[0] = 0.0f; - temp_a2->velocity[1] = D_802B9618; - temp_a2->velocity[2] = 0.0f; - temp_v0_2 = gPlayers[temp_t6].unk_0BC; + fruit->pos[1] = temp_v1->pos[1] + temp_f16_2; + fruit->velocity[0] = temp_f18 - 2.0f; + fruit->pos[2] = temp_v1->pos[2] + temp_f14_2; + if (fruit->velocity[0] <= 0.0f) { + fruit->state = 2; + fruit->bonkTimer = 30.0f; + fruit->velocity[0] = 0.0f; + fruit->velocity[1] = D_802B9618; + fruit->velocity[2] = 0.0f; + temp_v0_2 = temp_v1->unk_0BC; if ((temp_v0_2 & 0x200) != 0) { - fruit = temp_a2; - func_800C9060(temp_f12, temp_f14_2, ((s32) (&gPlayers[temp_t6] - gPlayerOne) / 3544) & 0xFF, 0x1900A052, temp_a2, &gPlayerOne); - phi_a2_2 = fruit; + func_800C9060((Player *) (((s32) (temp_v1 - gPlayerOne) / 3544) & 0xFF), 0x1900A052); } else { temp_f12_2 = D_802B961C; - gPlayers[temp_t6].unk_0BC = temp_v0_2 | 0x8000; - gPlayers[temp_t6].pos[0] -= temp_f2_2 * 4.0f; - gPlayers[temp_t6].pos[2] -= temp_f14_2 * 4.0f; - gPlayers[temp_t6].unk_034 -= temp_f2_2 * temp_f12_2; - gPlayers[temp_t6].unk_03C -= temp_f14_2 * temp_f12_2; - fruit = temp_a2; - func_800C9060(temp_f12_2, temp_f14_2, ((s32) (&gPlayers[temp_t6] - gPlayerOne) / 3544) & 0xFF, 0x19007018, temp_a2, &gPlayerOne); - phi_a2_2 = fruit; + temp_v1->unk_0BC = temp_v0_2 | 0x8000; + temp_v1->pos[0] -= temp_f2_2 * 4.0f; + temp_v1->pos[2] -= temp_f14_2 * 4.0f; + temp_v1->unk_034[0] -= temp_f2_2 * temp_f12_2; + temp_v1->unk_034[2] -= temp_f14_2 * temp_f12_2; + func_800C9060((Player *) (((s32) (temp_v1 - gPlayerOne) / 3544) & 0xFF), 0x19007018); if (gModeSelection != 0) { D_80162DF8 = 1; } } } + phi_a2_2 = fruit; block_17: phi_a0 = phi_a2_2->state; phi_a2 = phi_a2_2; @@ -844,7 +727,6 @@ block_17: } goto block_17; } - } } #else GLOBAL_ASM("asm/non_matchings/code_actors/update_obj_kiwano_fruit.s") @@ -1025,30 +907,21 @@ void func_80298328(Camera *arg0, Mat4 arg1, struct PiranhaPlant *arg2) { } #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -? func_800C98B8(? *, ? *, ?); /* extern */ -? func_800C99E0(? *, ?); /* extern */ +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b s32 func_802B4FF8(f32 (*)[4], ?); /* extern */ f32 func_802B80D0(Camera *, f32 *, u16, f32, f32, f32); /* extern */ -extern ? D_06013C00; -extern ? D_06013CA0; -extern ? D_06013D20; -extern ? D_06013DA0; -extern ? D_06013E20; extern ? D_06014200; extern u16 D_80150112; -extern ? D_80150130; extern u16 D_8015F700; extern u16 D_8015F702; extern f32 D_8015F704; -extern ? D_8015F708; -extern f32 gCourseDirection; -static ? D_802B91C8; /* unable to generate initializer */ +extern f32 D_8015F708; +static f32 D_802B91C8[6] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; static f32 D_802B962C = 6.4e7f; static f32 D_802B9630 = 4000000.0f; static f32 D_802B9648 = 160000.0f; -void func_802986B4(Camera *camera, f32 (*arg1)[4], struct Actor *arg2) { +void func_802986B4(Camera *camera, Mat4 arg1, struct Actor *actor) { s16 *sp9C; f32 sp90; f32 sp8C; @@ -1061,7 +934,6 @@ void func_802986B4(Camera *camera, f32 (*arg1)[4], struct Actor *arg2) { Gfx *temp_v0_6; Gfx *temp_v0_7; Gfx *temp_v0_8; - f32 *temp_a1; f32 temp_f0; s16 *temp_t1; s16 temp_v0_9; @@ -1098,11 +970,10 @@ void func_802986B4(Camera *camera, f32 (*arg1)[4], struct Actor *arg2) { sp9C = temp_t1; phi_v0 = *temp_t1; loop_2: - temp_a1 = &sp88; sp88 = (f32) phi_v0 * gCourseDirection; sp8C = (f32) phi_s1->unk2; - sp90 = (f32) phi_s1->unk_04; - temp_f0 = func_802B80D0(camera, temp_a1, (u16) camera->rotX2, 0.0f, *(&D_80150130 + (((s32) (camera - camera1) / 184) * 4)), D_802B9630); + sp90 = (f32) phi_s1->unk4; + temp_f0 = func_802B80D0(camera, &sp88, (u16) camera->rotX2, 0.0f, D_80150130[(s32) (camera - camera1) / 184], D_802B9630); phi_s5_2 = phi_s5_3; phi_s5_2 = phi_s5_3; if (temp_f0 > 0.0f) { @@ -1119,7 +990,7 @@ loop_2: case 0: temp_v0_4 = gDisplayListHead; gDisplayListHead = temp_v0_4 + 8; - temp_v0_4->words.w1 = (u32) &D_06013C00; + temp_v0_4->words.w1 = (u32) D_06013C00; phi_v0_2 = temp_v0_4; block_14: phi_v0_2->words.w0 = 0x06000000; @@ -1127,25 +998,25 @@ block_14: case 1: temp_v0_5 = gDisplayListHead; gDisplayListHead = temp_v0_5 + 8; - temp_v0_5->words.w1 = (u32) &D_06013CA0; + temp_v0_5->words.w1 = (u32) D_06013CA0; phi_v0_2 = temp_v0_5; goto block_14; case 2: temp_v0_6 = gDisplayListHead; gDisplayListHead = temp_v0_6 + 8; - temp_v0_6->words.w1 = (u32) &D_06013D20; + temp_v0_6->words.w1 = (u32) D_06013D20; phi_v0_2 = temp_v0_6; goto block_14; case 3: temp_v0_7 = gDisplayListHead; gDisplayListHead = temp_v0_7 + 8; - temp_v0_7->words.w1 = (u32) &D_06013DA0; + temp_v0_7->words.w1 = (u32) D_06013DA0; phi_v0_2 = temp_v0_7; goto block_14; case 4: temp_v0_8 = gDisplayListHead; gDisplayListHead = temp_v0_8 + 8; - temp_v0_8->words.w1 = (u32) &D_06013E20; + temp_v0_8->words.w1 = (u32) D_06013E20; phi_v0_2 = temp_v0_8; goto block_14; } @@ -1153,7 +1024,7 @@ block_14: } } else { block_15: - temp_v0_9 = phi_s1->unk_08; + temp_v0_9 = phi_s1->unk8; phi_v0 = temp_v0_9; phi_s1 += 8; phi_s5 = phi_s5_2; @@ -1172,11 +1043,11 @@ block_17: temp_s1 = ((s32) (phi_s5 - phi_t1) >> 3) & 0xFFFF; if ((D_8015F702 != temp_s1) && (D_8015F704 < D_802B9648)) { func_800C99E0(&D_8015F708, 0x1901904D); - D_8015F708.unk0 = (f32) ((f32) phi_s5->unk0 * gCourseDirection); + D_8015F708.unk0 = (f32) phi_s5->unk0 * gCourseDirection; D_8015F708.unk4 = (f32) phi_s5->unk2; - D_8015F708.unk8 = (f32) phi_s5->unk_04; + D_8015F708.unk8 = (f32) phi_s5->unk4; D_8015F702 = temp_s1; - func_800C98B8(&D_8015F708, &D_802B91C8, 0x1901904D); + func_800C98B8(&D_8015F708, D_802B91C8, (u32) 0x1901904D); D_8015F700 = 0x00F0; } } else { @@ -1219,33 +1090,16 @@ void func_80298AC0(Player *player) { GLOBAL_ASM("asm/non_matchings/code_actors/func_80298AC0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80298AC0(Player *arg0); // extern -s8 func_802ABD10(u16); // extern -extern Player *gPlayers; - void func_80298C94(void) { - Player *phi_s0; - s32 i; - s8 temp_s0; - for (i = 0; i < 4; i++) { - phi_s0 = &gPlayers[i]; - if ((phi_s0->unk_000 & 0xC000) != 0) { + s32 index; - temp_s0 = (u8)func_802ABD10(phi_s0->unk_11A); - - if (temp_s0 == 8) { - func_80298AC0(phi_s0); - } + for (index = 0; index < 4; index++){ + // wtf is up with the << 0x18 >> 0x18? is it some weird type conversion? + if (((gPlayers[index].unk_000 & 0xC000) != 0) && (((func_802ABD10(gPlayers[index].unk_110.unk3A) << 0x18) >> 0x18) == 8)) { + func_80298AC0(&gPlayers[index]); } - //temp_s0 = phi_s0 + 0xDD8; - //phi_s0 = temp_s0; } } -#else -GLOBAL_ASM("asm/non_matchings/code_actors/func_80298C94.s") -#endif void func_80298D10(void) { s32 segment = SEGMENT_NUMBER2(D_06013F78); @@ -1836,7 +1690,7 @@ void func_8029ABD4(s16 arg1, s32 arg1) { GLOBAL_ASM("asm/non_matchings/code_actors/func_8029ABD4.s") #endif -#ifdef NON_MATCHING // needs jmpt table rodata aligned to match. +#ifdef NEEDS_RODATA // needs jmpt table rodata aligned to match. //generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 //s32 func_802B4FF8(void *, ?); /* extern */ //f32 func_802B80D0(void *, u16, ?, f32, f32); /* extern */ @@ -2541,17 +2395,16 @@ void update_obj_falling_rocks(struct FallingRock *rock) { s16 temp_v0; f32 phi_f12; - temp_v0 = rock->respawnTimer; - if (temp_v0 != 0) { - rock->respawnTimer = temp_v0 - 1; + if (rock->respawnTimer != 0) { + rock->respawnTimer -= 1; return; } + if (rock->pos[1] < D_8015F8E4) { func_8029CF0C(&D_06007230, rock); } - temp_f14 = D_802B9758; - rock->rot[0] += (s32) ((rock->velocity[2] * temp_f14) / 20.0f); - rock->rot[2] += (s32) ((rock->velocity[0] * temp_f14) / 20.0f); + rock->rot[0] += (s32) ((rock->velocity[2] * D_802B9758) / 20.0f); + rock->rot[2] += (s32) ((rock->velocity[0] * D_802B9758) / 20.0f); rock->velocity[1] = (f32) ((f64) rock->velocity[1] - D_802B9760); if (rock->velocity[1] < -2.0f) { rock->velocity[1] = -2.0f; @@ -2560,11 +2413,10 @@ void update_obj_falling_rocks(struct FallingRock *rock) { rock->pos[1] += rock->velocity[1]; rock->pos[2] += rock->velocity[2]; sp3C = rock->velocity[1]; - func_802ADDC8(rock->velocity[0], temp_f14, &rock->unk30, 0x41200000, rock->pos[0], rock->pos[1], rock->pos[2]); - temp_f2 = rock->unk30.unk44; + func_802ADDC8(rock->velocity[0], D_802B9758, &rock->unk30, 10.0f, rock->pos[0], rock->pos[1], rock->pos[2]); + temp_f2 = ; phi_f12 = 0.0f; - if (temp_f2 < 0.0f) { - temp_s1 = rock->velocity; + if (rock->unk30.unk44 < 0.0f) { sp44 = -rock->unk30.unk60[0]; sp48 = -rock->unk30.unk60[1]; sp4C = -rock->unk30.unk60[2]; @@ -2572,9 +2424,9 @@ void update_obj_falling_rocks(struct FallingRock *rock) { rock->pos[0] += sp44 * temp_f0; rock->pos[1] += sp48 * temp_f0; rock->pos[2] += sp4C * temp_f0; - func_802AC114(0.0f, &sp44, temp_f2, temp_s1, 0x40000000); + func_802AC114(0.0f, &sp44, rock->unk30.unk44, rock->velocity, 0x40000000); rock->velocity[1] = D_802B9768 * sp3C; - func_800C98B8(rock->pos, temp_s1, 0x1900800F); + func_800C98B8(rock->pos, rock->velocity, 0x1900800F); } temp_f2_2 = rock->unk30.unk3C; phi_f12 = 0.0f; @@ -3245,13 +3097,10 @@ void destroy_actor(struct Actor *actor) { } #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b ? func_8000EE58(s16, s16, s32, s32); /* extern */ -? func_80296D10(struct Actor *, s32, s16 *, f32 *, s32); /* extern */ -? func_8029E7DC(struct Actor *, s16, s32, s32); /* extern */ -extern u16 gNumPermanentActors; -s16 func_8029E890(s32 arg0, s16 *arg1, f32 *arg2, s16 actorType) { +s16 func_8029E890(f32 *pos, s16 *rot, f32 *velocity, s16 actorType) { s16 temp_s1; s16 temp_s1_2; s16 temp_t4; @@ -3291,7 +3140,7 @@ loop_2: /* fallthrough */ case 7: /* switch 1 */ func_8029E7DC(phi_s0); - func_80296D10(phi_s0, arg0, arg1, arg2, (s32) actorType); + func_80296D10(phi_s0, pos, rot, velocity, (s32) actorType); return phi_s1; } break; @@ -3303,23 +3152,23 @@ loop_2: /* fallthrough */ case 7: /* switch 6 */ func_8029E7DC(phi_s0); - func_80296D10(phi_s0, arg0, arg1, arg2, (s32) actorType); + func_80296D10(phi_s0, pos, rot, velocity, (s32) actorType); return phi_s1; } break; case ACTOR_BANANA: /* switch 5 */ temp_v0_3 = phi_s0->state; if ((temp_v0_3 == 1) || (temp_v0_3 == 4) || (temp_v0_3 == 5)) { - func_8029E7DC(phi_s0, 2, 6, 8); - func_80296D10(phi_s0, arg0, arg1, arg2, (s32) actorType); + func_8029E7DC(phi_s0); + func_80296D10(phi_s0, pos, rot, velocity, (s32) actorType); return phi_s1; } goto block_24; case ACTOR_FAKE_ITEM_BOX: /* switch 5 */ temp_v0_4 = phi_s0->state; if ((temp_v0_4 == 1) || (temp_v0_4 == 2)) { - func_8029E7DC(phi_s0, 2, 6, 8); - func_80296D10(phi_s0, arg0, arg1, arg2, (s32) actorType); + func_8029E7DC(phi_s0); + func_80296D10(phi_s0, pos, rot, velocity, (s32) actorType); return phi_s1; } goto block_24; @@ -3337,9 +3186,9 @@ block_24: } } else { block_26: - phi_s1_2 = (s16) gNumPermanentActors; - if ((s16) gNumPermanentActors < 0x64) { - phi_s0_2 = &gActorList[(s16) gNumPermanentActors]; + phi_s1_2 = (s16) temp_t3; + if ((s16) temp_t3 < 0x64) { + phi_s0_2 = &gActorList[(s16) temp_t3]; loop_28: temp_v0_5 = phi_s0_2->type; switch (temp_v0_5) { /* switch 3; irregular */ @@ -3356,7 +3205,7 @@ loop_28: /* fallthrough */ case 7: /* switch 2 */ func_8029E7DC(phi_s0_2); - func_80296D10(phi_s0_2, arg0, arg1, arg2, (s32) actorType); + func_80296D10(phi_s0_2, pos, rot, velocity, (s32) actorType); return phi_s1_2; default: /* switch 3 */ default: /* switch 2 */ @@ -3378,23 +3227,23 @@ block_49: /* fallthrough */ case 7: /* switch 4 */ func_8029E7DC(phi_s0_2); - func_80296D10(phi_s0_2, arg0, arg1, arg2, (s32) actorType); + func_80296D10(phi_s0_2, pos, rot, velocity, (s32) actorType); return phi_s1_2; } break; case ACTOR_BANANA: /* switch 3 */ temp_v0_7 = phi_s0_2->state; if ((temp_v0_7 == 1) || (temp_v0_7 == 4) || (temp_v0_7 == 5)) { - func_8029E7DC(phi_s0_2, 2, 6, 8); - func_80296D10(phi_s0_2, arg0, arg1, arg2, (s32) actorType); + func_8029E7DC(phi_s0_2); + func_80296D10(phi_s0_2, pos, rot, velocity, (s32) actorType); return phi_s1_2; } goto block_49; case ACTOR_FAKE_ITEM_BOX: /* switch 3 */ temp_v0_8 = phi_s0_2->state; if ((temp_v0_8 == 1) || (temp_v0_8 == 2)) { - func_8029E7DC(phi_s0_2, 2, 6, 8); - func_80296D10(phi_s0_2, arg0, arg1, arg2, (s32) actorType); + func_8029E7DC(phi_s0_2); + func_80296D10(phi_s0_2, pos, rot, velocity, (s32) actorType); return phi_s1_2; } goto block_49; @@ -3562,27 +3411,23 @@ GLOBAL_ASM("asm/non_matchings/code_actors/func_8029EEB8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800C9060(s32, ?); // extern -? func_800C90F4(s32, s32); // extern -? func_800C98B8(void *, void *, ?); // extern -s32 func_8029EEB8(s32, ?, ?, f32); // extern -extern f32 D_802B989C; +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b +static f32 D_802B989C = 0.8f; -? func_8029F1F8(void *arg0, void *arg1) { +s32 func_8029F1F8(Player *player, struct Actor *actor) { u16 temp_v0; - if (func_8029EEB8(arg1 + 0x18, 0x40E00000, 0x43480000, D_802B989C) == 1) { - temp_v0 = arg0->unk0; + if (func_8029EEB8(player, actor->pos, 7.0f, 200.0f, D_802B989C) == 1) { + temp_v0 = player->unk_000; if ((temp_v0 & 0x4000) != 0) { - if ((arg0->unkBC & 0x200) != 0) { - arg1->unk2 = arg1->unk2 | 0x400; - func_800C98B8(arg0 + 0x14, arg0 + 0x34, 0x19018010); - func_800C90F4(((arg0 - gPlayerOne) / 0xDD8) & 0xFF, (arg0->unk254 * 0x10) + 0x2900800D); + if ((player->unk_0BC & 0x200) != 0) { + actor->flags |= 0x400; + func_800C98B8(player->pos, player->unk_034, 0x19018010U); + func_800C90F4((Player *) (((s32) (player - gPlayerOne) / 3544) & 0xFF), (player->characterId * 0x10) + 0x2900800D); return 1; } if ((temp_v0 & 0x100) == 0) { - func_800C9060(((arg0 - gPlayerOne) / 0xDD8) & 0xFF, 0x1900701A); + func_800C9060((Player *) (((s32) (player - gPlayerOne) / 3544) & 0xFF), 0x1900701A); } goto block_6; } @@ -3596,28 +3441,23 @@ GLOBAL_ASM("asm/non_matchings/code_actors/func_8029F1F8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800C9060(s32, ?); // extern -? func_800C90F4(s32, s32); // extern -? func_800C98B8(void *, void *, ?); // extern -s32 func_8029EEB8(void *, f32, f32, f32); // extern - -? func_8029F2FC(void *arg0, void *arg1) { +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b +s32 func_8029F2FC(Player *player, struct PiranhaPlant *plant) { f32 temp_f0; u16 temp_v0; - temp_f0 = arg1->unkC; - if (func_8029EEB8(arg1 + 0x18, temp_f0, temp_f0, 2.5f) == 1) { - temp_v0 = arg0->unk0; + temp_f0 = plant->boundingBoxSize; + if (func_8029EEB8(player, plant->pos, temp_f0, temp_f0, 2.5f) == 1) { + temp_v0 = player->unk_000; if ((temp_v0 & 0x4000) != 0) { - if ((arg0->unkBC & 0x200) != 0) { - arg1->unk2 = arg1->unk2 | 0x400; - func_800C98B8(arg0 + 0x14, arg0 + 0x34, 0x1901A24A); - func_800C90F4(((arg0 - gPlayerOne) / 0xDD8) & 0xFF, (arg0->unk254 * 0x10) + 0x2900800D); + if ((player->unk_0BC & 0x200) != 0) { + plant->flags |= 0x400; + func_800C98B8(player->pos, player->unk_034, 0x1901A24AU); + func_800C90F4((Player *) (((s32) (player - gPlayerOne) / 3544) & 0xFF), (player->characterId * 0x10) + 0x2900800D); return 1; } if ((temp_v0 & 0x100) == 0) { - func_800C9060(((arg0 - gPlayerOne) / 0xDD8) & 0xFF, 0x1900A052); + func_800C9060((Player *) (((s32) (player - gPlayerOne) / 3544) & 0xFF), 0x1900A052); } goto block_6; } @@ -3630,88 +3470,70 @@ block_6: GLOBAL_ASM("asm/non_matchings/code_actors/func_8029F2FC.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd -? func_800C90F4(s32, s32); /* extern */ -? func_800C98B8(f32 *, f32 *, ?, Player *); /* extern */ -? func_802977B0(Player *); /* extern */ -extern s32 D_80162DF8; - s32 func_8029F408(Player *player, struct YoshiValleyEgg *egg) { - f32 sp1C; - Player *temp_a0; - Player *temp_a3; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f2; - f32 temp_f2_2; + f32 pad[5]; + f32 z_dist; + f32 xz_dist; + f32 x_dist; + f32 y_dist; + f32 totalBox; + f32 thing = 60.0f; + f32 thing2 = 0.0f; - temp_f2 = egg->pos[0] - player->pos[0]; - if ((temp_f2 < 0.0f) && (temp_f2 < -60.0f)) { + x_dist = egg->pos[0] - player->pos[0]; + if ((x_dist < thing2) && (x_dist < -thing)) { return 0; } - if (temp_f2 > 60.0f) { + if (x_dist > thing) { return 0; } - temp_f0 = egg->pos[2] - player->pos[2]; - if ((temp_f0 < 0.0f) && (temp_f0 < -60.0f)) { + z_dist = egg->pos[2] - player->pos[2]; + if ((z_dist < thing2) && (z_dist < -thing)) { return 0; } - if (temp_f0 > 60.0f) { + if (z_dist > thing) { return 0; } - player = player; - temp_f0_2 = sqrtf((temp_f2 * temp_f2) + (temp_f0 * temp_f0)); - temp_f2_2 = temp_f0_2; - temp_a0 = player; - if (temp_f0_2 > 60.0f) { + xz_dist = sqrtf((x_dist * x_dist) + (z_dist * z_dist)); + if (xz_dist > thing) { return 0; } - player = player; - sp1C = temp_f2_2; - func_802977B0(temp_a0); - temp_a3 = player; - if ((temp_a3->pos[1] - egg->pos[1]) < 0.0f) { + func_802977B0(player); + y_dist = player->pos[1] - egg->pos[1]; + if (y_dist < thing2) { return 0; } - if ((temp_a3->boundingBoxSize + egg->boundingBoxSize) < temp_f2_2) { + totalBox = player->boundingBoxSize + egg->boundingBoxSize; + if (totalBox < xz_dist) { return 0; } - if ((temp_a3->unk_000 & 0x4000) != 0) { - if ((temp_a3->unk_0BC & 0x200) != 0) { + if ((player->unk_000 & 0x4000) != 0) { + if ((player->unk_0BC & 0x200) != 0) { egg->flags |= 0x400; egg->pathCenter[1] = 8.0f; - player = temp_a3; - func_800C98B8(temp_a3->pos, &temp_a3->unk_034[0], 0x19018010, temp_a3); - func_800C90F4(((s32) (player - gPlayerOne) / 3544) & 0xFF, (player->characterId * 0x10) + 0x2900800D); + func_800C98B8(player->pos, player->unk_034, 0x19018010); + func_800C90F4(player - gPlayerOne, (player->characterId * 0x10) + 0x2900800D); } else { - player = temp_a3; - func_8008DABC(temp_a3, (s8) ((s32) (temp_a3 - gPlayerOne) / 3544)); - if ((gModeSelection == 1) && ((player->unk_000 & 0x1000) == 0)) { + func_8008DABC(player, ((player - gPlayerOne) << 0x18) >> 0x18); + if ((gModeSelection == TIME_TRIALS) && ((player->unk_000 & 0x1000) == 0)) { D_80162DF8 = 1; } } } else { - func_8008DABC(temp_a3, (s8) ((s32) (temp_a3 - gPlayerOne) / 3544)); + func_8008DABC(player, ((player - gPlayerOne) << 0x18) >> 0x18); } return 1; } -#else -GLOBAL_ASM("asm/non_matchings/code_actors/func_8029F408.s") -#endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80077AB0(f32 *, ?); // extern -? func_800C9060(s32, ?); // extern -? func_800C90F4(s32, s32); // extern -? func_800C98B8(void *, void *, ?, void *); // extern -? func_802977B0(void *); // extern -extern f32 D_802B98A0; -extern f32 D_802B98A4; -extern f32 D_802B98A8; +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b +? func_80077AB0(f32 *, ?); /* extern */ +static f32 D_802B98A0 = 0.1f; +static f32 D_802B98A4 = 1.2f; +static f32 D_802B98A8 = 1.2f; +s16 gCurrentCourseId; /* unable to generate initializer */ -? func_8029F69C(void *arg0, void *arg1) { +s32 func_8029F69C(Player *player, struct Actor *actor) { f32 sp54; f32 sp4C; f32 sp48; @@ -3726,7 +3548,6 @@ extern f32 D_802B98A8; f32 temp_f0_3; f32 temp_f0_4; f32 temp_f0_5; - f32 temp_f10; f32 temp_f12; f32 temp_f14; f32 temp_f14_2; @@ -3735,146 +3556,129 @@ extern f32 D_802B98A8; f32 temp_f18; f32 temp_f18_2; f32 temp_f2; - f32 temp_f4; - f32 temp_f4_2; - f32 temp_f4_3; - f32 temp_f6; - f32 temp_f6_2; s16 temp_v0_3; s32 temp_cond; s32 temp_v0_2; u16 temp_v0; - void *temp_a0; - void *temp_a0_2; - void *temp_a1; - void *temp_a3; - void *phi_a3; - void *phi_a3_2; + Player *phi_a3; + f32 phi_f14; + f32 phi_f16; + f32 phi_f18; - temp_f6 = arg0->unk14; - temp_f4 = arg1->pos; - temp_f18 = temp_f4 - temp_f6; - temp_f16 = arg1->unk_08; + temp_f18 = actor->pos[0] - player->pos[0]; + temp_f16 = actor->unk_08; + phi_a3 = player; if ((temp_f18 < 0.0f) && (temp_f18 < -temp_f16)) { return 0; } if (temp_f16 < temp_f18) { return 0; } - temp_f10 = arg1->unk20; - temp_f4_2 = arg0->unk1C; - temp_f14 = temp_f10 - temp_f4_2; + temp_f14 = actor->pos[2] - player->pos[2]; if ((temp_f14 < 0.0f) && (temp_f14 < -temp_f16)) { return 0; } if (temp_f16 < temp_f14) { return 0; } - temp_f0 = arg0->pos - arg1->unk1C; + temp_f0 = player->pos[1] - actor->pos[1]; if (temp_f0 < 0.0f) { return 0; } - if (arg1->unk6 < temp_f0) { + if ((f32) actor->state < temp_f0) { return 0; } - arg0 = arg0; sp4C = temp_f14; sp40 = temp_f16; sp54 = temp_f18; temp_f0_2 = sqrtf((temp_f18 * temp_f18) + (temp_f14 * temp_f14)); temp_cond = temp_f16 < temp_f0_2; sp3C = temp_f0_2; - temp_a0 = arg0; if (temp_cond) { return 0; } - arg0 = arg0; sp4C = temp_f14; sp54 = temp_f18; - func_802977B0(temp_a0); - temp_a3 = arg0; - temp_f6_2 = arg1->unkC; - temp_f4_3 = temp_a3->unk70; - temp_f16_2 = temp_f4_3 + temp_f6_2; - phi_a3 = temp_a3; + func_802977B0(player); + temp_f16_2 = player->boundingBoxSize + actor->boundingBoxSize; if (temp_f16_2 < sp3C) { return 0; } - sp48 = temp_a3->unk34; - sp44 = temp_a3->unk3C; - temp_v0 = temp_a3->unk0; + sp48 = player->unk_034[0]; + sp44 = player->unk_034[2]; + temp_v0 = player->unk_000; if ((temp_v0 & 0x4000) != 0) { - temp_a0_2 = temp_a3 + 0x14; - temp_a1 = temp_a3 + 0x34; - if ((temp_a3->unkBC & 0x200) != 0) { - arg1->unk2 = arg1->unk2 | 0x400; - arg0 = temp_a3; - func_800C98B8(temp_a0_2, temp_a1, 0x19018010, temp_a3); - func_800C90F4(((arg0 - gPlayerOne) / 0xDD8) & 0xFF, (arg0->unk254 * 0x10) + 0x2900800D); + if ((player->unk_0BC & 0x200) != 0) { + actor->flags |= 0x400; + func_800C98B8(player->pos, player->unk_034, 0x19018010U); + func_800C90F4((Player *) (((s32) (player - gPlayerOne) / 3544) & 0xFF), (player->characterId * 0x10) + 0x2900800D); goto block_36; } if ((temp_v0 & 0x100) == 0) { - arg0 = temp_a3; sp4C = temp_f14; sp40 = temp_f16_2; sp54 = temp_f18; - func_800C9060(((temp_a3 - gPlayerOne) / 0xDD8) & 0xFF, 0x19007018); - phi_a3 = arg0; + func_800C9060((Player *) (((s32) (player - gPlayerOne) / 3544) & 0xFF), 0x19007018); } goto block_23; } block_23: - temp_v0_2 = phi_a3->unkBC; - phi_a3_2 = phi_a3; + temp_v0_2 = player->unk_0BC; + phi_a3 = player; + phi_f14 = temp_f14; + phi_f16 = temp_f16_2; + phi_f18 = temp_f18; if ((temp_v0_2 & 0x200) == 0) { - phi_a3->unkBC = temp_v0_2 | 0x8000; + player->unk_0BC = temp_v0_2 | 0x8000; } temp_v0_3 = gCurrentCourseId; - sp20 = arg1->pos; - sp24 = arg1->unk1C; - sp28 = arg1->unk20; - if (((temp_v0_3 == 0) || (temp_v0_3 == 4) || (temp_v0_3 == 7) || (temp_v0_3 == 8)) && (phi_a3->unk94 > 1.0f)) { - arg0 = phi_a3; - sp4C = temp_f10 - temp_f4_2; - sp40 = temp_f4_3 + temp_f6_2; - sp54 = temp_f4 - temp_f6; + sp20 = actor->pos[0]; + sp24 = actor->pos[1]; + sp28 = actor->pos[2]; + if (((temp_v0_3 == 0) || (temp_v0_3 == 4) || (temp_v0_3 == 7) || (temp_v0_3 == 8)) && (player->unk_094 > 1.0f)) { + player = player; + sp4C = temp_f14; + sp40 = temp_f16_2; + sp54 = temp_f18; func_80077AB0(&sp20, 0); - phi_a3_2 = arg0; + phi_f14 = sp4C; + phi_f16 = sp40; + phi_f18 = sp54; } if (sp3C < D_802B98A0) { - arg0 = phi_a3_2; - sp4C = temp_f10 - temp_f4_2; - sp40 = temp_f4_3 + temp_f6_2; - sp54 = temp_f4 - temp_f6; + player = phi_a3; + sp4C = phi_f14; + sp40 = phi_f16; + sp54 = phi_f18; sqrtf((sp48 * sp48) + (sp44 * sp44)); temp_f0_3 = D_802B98A4; - arg0->unk34 = 0.0f; - arg0->unk3C = 0.0f; - arg0->unk14 = sp20 - ((temp_f4 - temp_f6) * (temp_f4_3 + temp_f6_2) * temp_f0_3); - arg0->unk1C = sp28 - ((temp_f10 - temp_f4_2) * (temp_f4_3 + temp_f6_2) * temp_f0_3); + player->unk_034[0] = 0.0f; + player->unk_034[2] = 0.0f; + player->pos[0] = sp20 - (phi_f18 * phi_f16 * temp_f0_3); + player->pos[2] = sp28 - (phi_f14 * phi_f16 * temp_f0_3); goto block_36; } - arg0 = phi_a3_2; - sp4C = temp_f10 - temp_f4_2; - sp40 = temp_f4_3 + temp_f6_2; - sp54 = temp_f4 - temp_f6; + player = phi_a3; + sp4C = phi_f14; + sp40 = phi_f16; + sp54 = phi_f18; temp_f0_4 = sqrtf((sp48 * sp48) + (sp44 * sp44)); - temp_f14_2 = (temp_f10 - temp_f4_2) / sp3C; - temp_f18_2 = (temp_f4 - temp_f6) / sp3C; + temp_f14_2 = phi_f14 / sp3C; + temp_f18_2 = phi_f18 / sp3C; if (temp_f0_4 < 0.25f) { temp_f0_5 = D_802B98A8; - arg0->unk14 = sp20 - (temp_f18_2 * (temp_f4_3 + temp_f6_2) * temp_f0_5); - arg0->unk34 = 0.0f; - arg0->unk3C = 0.0f; - arg0->unk1C = sp28 - (temp_f14_2 * (temp_f4_3 + temp_f6_2) * temp_f0_5); + player->pos[0] = sp20 - (temp_f18_2 * phi_f16 * temp_f0_5); + player->unk_034[0] = 0.0f; + player->unk_034[2] = 0.0f; + player->pos[2] = sp28 - (temp_f14_2 * phi_f16 * temp_f0_5); return 1; } temp_f12 = temp_f0_4 * (((temp_f18_2 * sp48) + (temp_f14_2 * sp44)) / temp_f0_4) * 1.5f; - arg0->unk34 = arg0->unk34 - (temp_f18_2 * temp_f12); - arg0->unk3C = arg0->unk3C - (temp_f14_2 * temp_f12); - temp_f2 = sp3C - (temp_f4_3 + temp_f6_2); - arg0->unk14 = arg0->unk14 + (temp_f18_2 * temp_f2 * 0.5f); - arg0->unk1C = arg0->unk1C + (temp_f14_2 * temp_f2 * 0.5f); + player->unk_034[0] -= temp_f18_2 * temp_f12; + player->unk_034[2] -= temp_f14_2 * temp_f12; + temp_f2 = sp3C - phi_f16; + player->pos[0] += temp_f18_2 * temp_f2 * 0.5f; + player->pos[2] += temp_f14_2 * temp_f2 * 0.5f; block_36: return 1; } @@ -4197,16 +4001,12 @@ void func_802A0350(struct Actor *arg0, struct Actor *arg1) { } #ifdef MIPS_TO_C -//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd +//generated by m2c commit a8f43e46d33dcb7e04d9cdc44a10b3daf4c92c3b ? func_8007ABFC(s32, ?); /* extern */ -? func_800C90F4(s32, s32); /* extern */ -? func_800C98B8(f32 *, f32 *, ?, Player *); /* extern */ ? func_8029F1F8(Player *, struct Actor *); /* extern */ ? func_8029F2FC(Player *, struct Actor *); /* extern */ ? func_8029F408(Player *, struct Actor *); /* extern */ ? func_8029F69C(Player *, struct Actor *); /* extern */ -s16 func_8029FB80(Player *, struct Actor *); /* extern */ -? func_8029FDC8(struct Actor *); /* extern */ extern s32 D_80162DF8; static f32 D_802B99C4 = 360000.0f; static f32 D_802B99C8 = 360000.0f; @@ -4215,15 +4015,6 @@ void func_802A0450(Player *player, struct Actor *actor) { s16 sp42; s16 sp36; Player *sp24; - Player *temp_a0; - Player *temp_a0_2; - Player *temp_a0_3; - Player *temp_a0_4; - Player *temp_a0_5; - Player *temp_a0_6; - Player *temp_a0_7; - Player *temp_a0_8; - Player *temp_a3; Player *temp_v0; Player *temp_v0_2; Player *temp_v0_3; @@ -4233,17 +4024,17 @@ void func_802A0450(Player *player, struct Actor *actor) { f32 temp_f0_2; f32 temp_f2; f32 temp_f2_2; - s16 temp_t0; s16 temp_t2; s16 temp_v1; s16 temp_v1_2; s16 temp_v1_3; s16 temp_v1_4; s32 temp_f16; + s32 temp_lo; Player *phi_v0; + temp_lo = (s32) (player - gPlayerOne) / 3544; temp_t2 = actor->type; - temp_t0 = (s16) ((s32) (player - gPlayerOne) / 3544); switch (temp_t2) { case ACTOR_YOSHI_VALLEY_EGG: if (((player->unk_0BC << 0) >= 0) && ((player->unk_000 & 0x100) == 0)) { @@ -4253,23 +4044,22 @@ void func_802A0450(Player *player, struct Actor *actor) { default: return; case ACTOR_BANANA: - if (((player->unk_0BC & 0x800008C0) == 0) && ((player->unk_00C & 1) == 0) && ((temp_v1 = actor->rot[0], temp_a0 = player, (temp_t0 != temp_v1)) || ((actor->flags & 0x1000) == 0))) { + if (((player->unk_0BC & 0x800008C0) == 0) && ((player->unk_00C & 1) == 0) && ((temp_v1 = actor->rot[0], ((s16) temp_lo != temp_v1)) || ((actor->flags & 0x1000) == 0))) { sp36 = temp_v1; - player = player; - sp42 = temp_t0; - if (func_8029FB80(temp_a0, actor) == 1) { + sp42 = (s16) temp_lo; + if (func_8029FB80(player, actor) == 1) { player->unk_00C |= 1; temp_v0 = &gPlayers[temp_v1]; if ((temp_v0->unk_000 & 0x4000) != 0) { if ((actor->flags & 0xF) != 0) { - if (temp_t0 != temp_v1) { - func_800C90F4(temp_v1 & 0xFF, (temp_v0->characterId * 0x10) + 0x29008006); + if ((s16) temp_lo != temp_v1) { + func_800C90F4((Player *) (temp_v1 & 0xFF), (temp_v0->characterId * 0x10) + 0x29008006); } } else { temp_f0 = actor->pos[0] - temp_v0->pos[0]; temp_f2 = actor->pos[2] - temp_v0->pos[2]; - if ((((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) < D_802B99C4) && (temp_t0 != temp_v1)) { - func_800C90F4(temp_v1 & 0xFF, (temp_v0->characterId * 0x10) + 0x29008006); + if ((((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) < D_802B99C4) && ((s16) temp_lo != temp_v1)) { + func_800C90F4((Player *) (temp_v1 & 0xFF), (temp_v0->characterId * 0x10) + 0x29008006); } } } @@ -4279,18 +4069,17 @@ void func_802A0450(Player *player, struct Actor *actor) { } break; case ACTOR_GREEN_SHELL: - if (((player->unk_0BC & 0x80000400) == 0) && ((player->unk_00C & 4) == 0) && ((temp_v1_2 = actor->rot[2], temp_a0_2 = player, (temp_t0 != temp_v1_2)) || ((actor->flags & 0x1000) == 0))) { + if (((player->unk_0BC & 0x80000400) == 0) && ((player->unk_00C & 4) == 0) && ((temp_v1_2 = actor->rot[2], ((s16) temp_lo != temp_v1_2)) || ((actor->flags & 0x1000) == 0))) { sp36 = temp_v1_2; - player = player; - sp42 = temp_t0; - if (func_8029FB80(temp_a0_2, actor) == 1) { + sp42 = (s16) temp_lo; + if (func_8029FB80(player, actor) == 1) { player->unk_00C |= 4; - sp42 = temp_t0; + sp42 = (s16) temp_lo; sp36 = temp_v1_2; - func_800C98B8(player->pos, &player->unk_034[0], 0x19018010, player); + func_800C98B8(player->pos, player->unk_034, 0x19018010U); temp_v0_2 = &gPlayers[temp_v1_2]; - if (((temp_v0_2->unk_000 & 0x4000) != 0) && (temp_t0 != temp_v1_2)) { - func_800C90F4(temp_v1_2 & 0xFF, (temp_v0_2->characterId * 0x10) + 0x29008006); + if (((temp_v0_2->unk_000 & 0x4000) != 0) && ((s16) temp_lo != temp_v1_2)) { + func_800C90F4((Player *) (temp_v1_2 & 0xFF), (temp_v0_2->characterId * 0x10) + 0x29008006); } func_8029FDC8(actor); return; @@ -4298,39 +4087,38 @@ void func_802A0450(Player *player, struct Actor *actor) { } break; case ACTOR_BLUE_SPINY_SHELL: - if (((player->unk_00C & 2) == 0) && ((temp_v1_3 = actor->rot[2], temp_a0_3 = player, (temp_t0 != temp_v1_3)) || ((actor->flags & 0x1000) == 0)) && (sp36 = temp_v1_3, player = player, sp42 = temp_t0, (func_8029FB80(temp_a0_3, actor) == 1))) { + if (((player->unk_00C & 2) == 0) && ((temp_v1_3 = actor->rot[2], ((s16) temp_lo != temp_v1_3)) || ((actor->flags & 0x1000) == 0)) && (sp36 = temp_v1_3, sp42 = (s16) temp_lo, (func_8029FB80(player, actor) == 1))) { if ((player->unk_0BC << 0) >= 0) { player->unk_00C |= 2; - sp42 = temp_t0; + sp42 = (s16) temp_lo; sp36 = temp_v1_3; - func_800C98B8(player->pos, &player->unk_034[0], 0x19018010, player); + func_800C98B8(player->pos, player->unk_034, 0x19018010U); } - temp_v0_3 = &gPlayers[actor->rot[2]]; - if (((temp_v0_3->unk_000 & 0x4000) != 0) && (temp_t0 != actor->rot[2])) { - sp42 = temp_t0; - func_800C90F4(actor->rot[2] & 0xFF, (temp_v0_3->characterId * 0x10) + 0x29008006); + temp_v0_3 = &gPlayers[temp_v1_3]; + if (((temp_v0_3->unk_000 & 0x4000) != 0) && ((s16) temp_lo != temp_v1_3)) { + sp42 = (s16) temp_lo; + func_800C90F4((Player *) (temp_v1_3 & 0xFF), (temp_v0_3->characterId * 0x10) + 0x29008006); } - if (temp_t0 == actor->unk_04) { + if ((s16) temp_lo == actor->unk_04) { func_8029FDC8(actor); return; } } break; case ACTOR_RED_SHELL: - if (((player->unk_0BC << 7) >= 0) && ((player->unk_00C & 2) == 0) && ((temp_v1_4 = actor->rot[2], temp_a0_4 = player, (temp_t0 != temp_v1_4)) || ((actor->flags & 0x1000) == 0))) { + if (((player->unk_0BC << 7) >= 0) && ((player->unk_00C & 2) == 0) && ((temp_v1_4 = actor->rot[2], ((s16) temp_lo != temp_v1_4)) || ((actor->flags & 0x1000) == 0))) { sp36 = temp_v1_4; - player = player; - sp42 = temp_t0; - if (func_8029FB80(temp_a0_4, actor) == 1) { + sp42 = (s16) temp_lo; + if (func_8029FB80(player, actor) == 1) { if ((player->unk_0BC << 0) >= 0) { player->unk_00C |= 2; - sp42 = temp_t0; + sp42 = (s16) temp_lo; sp36 = temp_v1_4; - func_800C98B8(player->pos, &player->unk_034[0], 0x19018010, player); + func_800C98B8(player->pos, player->unk_034, 0x19018010U); } - temp_v0_4 = &gPlayers[actor->rot[2]]; - if (((temp_v0_4->unk_000 & 0x4000) != 0) && (temp_t0 != actor->rot[2])) { - func_800C90F4(actor->rot[2] & 0xFF, (temp_v0_4->characterId * 0x10) + 0x29008006); + temp_v0_4 = &gPlayers[temp_v1_4]; + if (((temp_v0_4->unk_000 & 0x4000) != 0) && ((s16) temp_lo != temp_v1_4)) { + func_800C90F4((Player *) (temp_v1_4 & 0xFF), (temp_v0_4->characterId * 0x10) + 0x29008006); } func_8029FDC8(actor); return; @@ -4367,49 +4155,40 @@ void func_802A0450(Player *player, struct Actor *actor) { } break; case ACTOR_FALLING_ROCK: - if ((player->unk_0BC << 0) >= 0) { - temp_a0_5 = player; - if ((player->unk_000 & 0x100) == 0) { - player = player; - temp_a3 = player; - if (func_8029FB80(temp_a0_5, actor) == 1) { - player = temp_a3; - func_800C98B8(actor->pos, actor->velocity, 0x19009005, temp_a3); - if ((gModeSelection == 1) && ((player->unk_000 & 0x1000) == 0)) { - D_80162DF8 = 1; - } - if ((player->unk_0BC & 0x200) != 0) { - actor->velocity[1] = 10.0f; - return; - } - func_8008DABC(player, (s8) ((s32) (player - gPlayerOne) / 3544)); - return; - } + if (((player->unk_0BC << 0) >= 0) && ((player->unk_000 & 0x100) == 0) && (func_8029FB80(player, actor) == 1)) { + func_800C98B8(actor->pos, actor->velocity, 0x19009005U); + if ((gModeSelection == 1) && ((player->unk_000 & 0x1000) == 0)) { + D_80162DF8 = 1; } + if ((player->unk_0BC & 0x200) != 0) { + actor->velocity[1] = 10.0f; + return; + } + func_8008DABC(player, (s8) ((s32) (player - gPlayerOne) / 3544)); + return; } break; case ACTOR_FAKE_ITEM_BOX: - if (((player->unk_0BC << 0) >= 0) && ((temp_a0_6 = player, temp_f16 = (s32) actor->velocity[0], (temp_t0 != (s16) temp_f16)) || ((actor->flags & 0x1000) == 0))) { + if (((player->unk_0BC << 0) >= 0) && ((temp_f16 = (s32) actor->velocity[0], ((s16) temp_lo != (s16) temp_f16)) || ((actor->flags & 0x1000) == 0))) { sp36 = (s16) temp_f16; - player = player; - sp42 = temp_t0; - if (func_8029FB80(temp_a0_6, actor) == 1) { + sp42 = (s16) temp_lo; + if (func_8029FB80(player, actor) == 1) { player->unk_00C |= 0x400000; temp_v0_5 = &gPlayers[(s16) temp_f16]; phi_v0 = temp_v0_5; if ((temp_v0_5->unk_000 & 0x4000) != 0) { if ((actor->flags & 0xF) != 0) { - if (temp_t0 != (s16) temp_f16) { + if ((s16) temp_lo != (s16) temp_f16) { sp24 = temp_v0_5; - func_800C90F4((s16) temp_f16 & 0xFF, (temp_v0_5->characterId * 0x10) + 0x29008006); + func_800C90F4((Player *) ((s16) temp_f16 & 0xFF), (temp_v0_5->characterId * 0x10) + 0x29008006); phi_v0 = sp24; } } else { temp_f0_2 = actor->pos[0] - temp_v0_5->pos[0]; temp_f2_2 = actor->pos[2] - temp_v0_5->pos[2]; - if ((((temp_f0_2 * temp_f0_2) + (temp_f2_2 * temp_f2_2)) < D_802B99C8) && (temp_t0 != (s16) temp_f16)) { + if ((((temp_f0_2 * temp_f0_2) + (temp_f2_2 * temp_f2_2)) < D_802B99C8) && ((s16) temp_lo != (s16) temp_f16)) { sp24 = temp_v0_5; - func_800C90F4((s16) temp_f16 & 0xFF, (temp_v0_5->characterId * 0x10) + 0x29008006); + func_800C90F4((Player *) ((s16) temp_f16 & 0xFF), (temp_v0_5->characterId * 0x10) + 0x29008006); phi_v0 = sp24; } } @@ -4425,9 +4204,7 @@ void func_802A0450(Player *player, struct Actor *actor) { } break; case ACTOR_HOT_AIR_BALLOON_ITEM_BOX: - temp_a0_7 = player; - player = player; - if (func_8029FB80(temp_a0_7, actor) == 1) { + if (func_8029FB80(player, actor) == (s32) 1) { actor->state = 3; actor->flags = -0x8000; actor->unk_04 = 0; @@ -4441,9 +4218,7 @@ void func_802A0450(Player *player, struct Actor *actor) { } break; case ACTOR_ITEM_BOX: - temp_a0_8 = player; - player = player; - if (func_8029FB80(temp_a0_8, actor) == 1) { + if (func_8029FB80(player, actor) == (s32) 1) { actor->state = 3; actor->flags = -0x8000; actor->unk_04 = 0; diff --git a/src/code_80296A50.h b/src/code_80296A50.h index 76fec38b0..ab1e1be39 100644 --- a/src/code_80296A50.h +++ b/src/code_80296A50.h @@ -29,6 +29,7 @@ void update_obj_train_car2(struct TrainCar*); void update_obj_piranha_plant(struct PiranhaPlant*); void func_80298328(Camera*, Mat4, struct PiranhaPlant*); void func_802986B4(Camera*, Mat4, struct Actor*); +void func_80298AC0(Player*); void func_80298D7C(Camera*, Mat4, struct Actor*); void func_80299144(Camera*, Mat4, struct Actor*); void func_8029930C(Camera*, Mat4, struct Actor*); @@ -73,6 +74,7 @@ void destroy_actor(struct Actor*); s16 func_8029E890(f32 *, s16 *, f32 *, s16); s16 func_8029EC88(Vec3f, Vec3s, Vec3f, s16); s32 func_8029EEB8(Player*, Vec3f, f32, f32, f32); +s32 func_8029F408(Player*, struct YoshiValleyEgg*); s32 func_8029FB80(Player*, struct Actor*); s32 func_8029FCA4(struct Actor*, struct Actor*); void func_8029FDC8(struct Actor*); @@ -100,7 +102,7 @@ void update_simple_objects(); // audio/external.c extern void func_800C98B8(Vec3f, Vec3f, u32); extern void func_800C9060(Player*, s32); -extern void func_800C90F4(Player*, s32); +extern void func_800C90F4(u8, uintptr_t); extern void func_800C99E0(Vec3f, s32); extern void func_800C9D80(Vec3f*, Vec3f*, u32); @@ -266,6 +268,7 @@ extern s32 D_8015F8E0; extern s32 D_801625EC; extern s32 D_801625F0; extern s32 D_801625F4; +extern s32 D_80162DF8; extern s32 D_802BA058; extern s8 D_06006990[];