summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler McGavran <tyler.taggerung@gmail.com>2022-05-07 00:56:43 -0400
committerGitHub <noreply@github.com>2022-05-06 21:56:43 -0700
commitecb085b2915cef23b18ddc65a9141b448aedcd4e (patch)
treebd98efa55b87293f50b3c58ca79282b0dad9b6b7
parentd4a0f7ab8f64d74408c4f1df9ae312bb360cc5dd (diff)
Add some more actor types, match a function (#191)
* Add some more actor types, match a function * Identify the boundBox member of the Player struct Note that while the `flag` members are signed, they should be understood as just a group of bits. Based on some googling around (see https://stackoverflow.com/a/11644749) the operation `thing.flag |= 0x8000` is NOT undefined behaviour, even though that is setting the sign bit. The numerical interpretation of the result as a signed number is implementation defined, while the actual operation acts on the bit representation of the number. Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
-rw-r--r--asm/non_matchings/code_8008C1D0/code_8008C1D0.s16
-rw-r--r--asm/non_matchings/code_8008C1D0/func_8008E118.s356
-rw-r--r--asm/non_matchings/code_802B0210/func_802B09C0.s33
-rw-r--r--include/actor_types.h101
-rw-r--r--include/common_structs.h2
-rw-r--r--include/kart_attributes.h2
-rw-r--r--src/code_80027D00.c12
-rw-r--r--src/code_800393C0.c4
-rw-r--r--src/code_80057C60.c8
-rw-r--r--src/code_8008C1D0.c10
-rw-r--r--src/code_80296A50.c332
-rw-r--r--src/code_802B0210.c719
-rw-r--r--src/kart_attributes.inc.c2
-rw-r--r--src/memory.c2
14 files changed, 805 insertions, 794 deletions
diff --git a/asm/non_matchings/code_8008C1D0/code_8008C1D0.s b/asm/non_matchings/code_8008C1D0/code_8008C1D0.s
index 78ba91145..c388b3b4f 100644
--- a/asm/non_matchings/code_8008C1D0/code_8008C1D0.s
+++ b/asm/non_matchings/code_8008C1D0/code_8008C1D0.s
@@ -1469,14 +1469,14 @@ glabel func_8008DC08
/* 08EB0C 8008DF0C 3C013F80 */ li $at, 0x3F800000 # 1.000000
/* 08EB10 8008DF10 44819000 */ mtc1 $at, $f18
/* 08EB14 8008DF14 ACC800BC */ sw $t0, 0xbc($a2)
-/* 08EB18 8008DF18 3C01800E */ lui $at, %hi(gKartBoundingBoxTable)
+/* 08EB18 8008DF18 3C01800E */ lui $at, %hi(gKartBoundingBoxSizeTable)
/* 08EB1C 8008DF1C 000B6080 */ sll $t4, $t3, 2
/* 08EB20 8008DF20 A4C00DB6 */ sh $zero, 0xdb6($a2)
/* 08EB24 8008DF24 ACCA00BC */ sw $t2, 0xbc($a2)
/* 08EB28 8008DF28 002C0821 */ addu $at, $at, $t4
/* 08EB2C 8008DF2C E4D00DC4 */ swc1 $f16, 0xdc4($a2)
/* 08EB30 8008DF30 E4D20224 */ swc1 $f18, 0x224($a2)
-/* 08EB34 8008DF34 C42426B0 */ lwc1 $f4, %lo(gKartBoundingBoxTable)($at)
+/* 08EB34 8008DF34 C42426B0 */ lwc1 $f4, %lo(gKartBoundingBoxSizeTable)($at)
/* 08EB38 8008DF38 3C0E8016 */ lui $t6, %hi(D_80165190) # $t6, 0x8016
/* 08EB3C 8008DF3C 25CE5190 */ addiu $t6, %lo(D_80165190) # addiu $t6, $t6, 0x5190
/* 08EB40 8008DF40 00076840 */ sll $t5, $a3, 1
@@ -1741,11 +1741,11 @@ glabel func_8008E118
/* 08EF18 8008E318 0C008973 */ jal move_f32_towards
/* 08EF1C 8008E31C 34A53333 */ ori $a1, (0x3F333333 & 0xFFFF) # ori $a1, $a1, 0x3333
/* 08EF20 8008E320 960E0254 */ lhu $t6, 0x254($s0)
-/* 08EF24 8008E324 3C01800E */ lui $at, %hi(gKartBoundingBoxTable)
+/* 08EF24 8008E324 3C01800E */ lui $at, %hi(gKartBoundingBoxSizeTable)
/* 08EF28 8008E328 3C063DCC */ lui $a2, (0x3DCCCCCD >> 16) # lui $a2, 0x3dcc
/* 08EF2C 8008E32C 000E7880 */ sll $t7, $t6, 2
/* 08EF30 8008E330 002F0821 */ addu $at, $at, $t7
-/* 08EF34 8008E334 C43226B0 */ lwc1 $f18, %lo(gKartBoundingBoxTable)($at)
+/* 08EF34 8008E334 C43226B0 */ lwc1 $f18, %lo(gKartBoundingBoxSizeTable)($at)
/* 08EF38 8008E338 3C01800F */ lui $at, %hi(D_800EF598)
/* 08EF3C 8008E33C D426F598 */ ldc1 $f6, %lo(D_800EF598)($at)
/* 08EF40 8008E340 46009121 */ cvt.d.s $f4, $f18
@@ -1796,7 +1796,7 @@ glabel func_8008E3C0
/* 08EFE0 8008E3E0 0C008973 */ jal move_f32_towards
/* 08EFE4 8008E3E4 3C053F80 */ lui $a1, 0x3f80
/* 08EFE8 8008E3E8 8FA70018 */ lw $a3, 0x18($sp)
-/* 08EFEC 8008E3EC 3C05800E */ lui $a1, %hi(gKartBoundingBoxTable) # 0x800e
+/* 08EFEC 8008E3EC 3C05800E */ lui $a1, %hi(gKartBoundingBoxSizeTable) # 0x800e
/* 08EFF0 8008E3F0 3C063DCC */ lui $a2, (0x3DCCCCCD >> 16) # lui $a2, 0x3dcc
/* 08EFF4 8008E3F4 94EE0254 */ lhu $t6, 0x254($a3)
/* 08EFF8 8008E3F8 34C6CCCD */ ori $a2, (0x3DCCCCCD & 0xFFFF) # ori $a2, $a2, 0xcccd
@@ -1804,7 +1804,7 @@ glabel func_8008E3C0
/* 08F000 8008E400 000E7880 */ sll $t7, $t6, 2
/* 08F004 8008E404 00AF2821 */ addu $a1, $a1, $t7
/* 08F008 8008E408 0C008973 */ jal move_f32_towards
-/* 08F00C 8008E40C 8CA526B0 */ lw $a1, %lo(gKartBoundingBoxTable)($a1) # 0x26b0($a1)
+/* 08F00C 8008E40C 8CA526B0 */ lw $a1, %lo(gKartBoundingBoxSizeTable)($a1) # 0x26b0($a1)
/* 08F010 8008E410 8FA70018 */ lw $a3, 0x18($sp)
/* 08F014 8008E414 3C01BFFF */ lui $at, (0xBFFFFFFF >> 16) # lui $at, 0xbfff
/* 08F018 8008E418 3421FFFF */ ori $at, (0xBFFFFFFF & 0xFFFF) # ori $at, $at, 0xffff
@@ -1814,12 +1814,12 @@ glabel func_8008E3C0
/* 08F028 8008E428 0301C824 */ and $t9, $t8, $at
/* 08F02C 8008E42C 3C013F80 */ li $at, 0x3F800000 # 1.000000
/* 08F030 8008E430 44812000 */ mtc1 $at, $f4
-/* 08F034 8008E434 3C01800E */ lui $at, %hi(gKartBoundingBoxTable)
+/* 08F034 8008E434 3C01800E */ lui $at, %hi(gKartBoundingBoxSizeTable)
/* 08F038 8008E438 00084880 */ sll $t1, $t0, 2
/* 08F03C 8008E43C 00290821 */ addu $at, $at, $t1
/* 08F040 8008E440 ACF900BC */ sw $t9, 0xbc($a3)
/* 08F044 8008E444 E4E40224 */ swc1 $f4, 0x224($a3)
-/* 08F048 8008E448 C42626B0 */ lwc1 $f6, %lo(gKartBoundingBoxTable)($at)
+/* 08F048 8008E448 C42626B0 */ lwc1 $f6, %lo(gKartBoundingBoxSizeTable)($at)
/* 08F04C 8008E44C 3C014040 */ li $at, 0x40400000 # 3.000000
/* 08F050 8008E450 44814000 */ mtc1 $at, $f8
/* 08F054 8008E454 3C010800 */ lui $at, 0x800
diff --git a/asm/non_matchings/code_8008C1D0/func_8008E118.s b/asm/non_matchings/code_8008C1D0/func_8008E118.s
index 4b4be560f..1824e7d65 100644
--- a/asm/non_matchings/code_8008C1D0/func_8008E118.s
+++ b/asm/non_matchings/code_8008C1D0/func_8008E118.s
@@ -1,178 +1,178 @@
-glabel func_8008E118
-/* 08ED18 8008E118 27BDFFE0 */ addiu $sp, $sp, -0x20
-/* 08ED1C 8008E11C AFBF001C */ sw $ra, 0x1c($sp)
-/* 08ED20 8008E120 AFB00018 */ sw $s0, 0x18($sp)
-/* 08ED24 8008E124 AFA50024 */ sw $a1, 0x24($sp)
-/* 08ED28 8008E128 8C8200BC */ lw $v0, 0xbc($a0)
-/* 08ED2C 8008E12C 00053600 */ sll $a2, $a1, 0x18
-/* 08ED30 8008E130 00067603 */ sra $t6, $a2, 0x18
-/* 08ED34 8008E134 34018000 */ li $at, 32768
-/* 08ED38 8008E138 304F8000 */ andi $t7, $v0, 0x8000
-/* 08ED3C 8008E13C 01C03025 */ move $a2, $t6
-/* 08ED40 8008E140 15E10023 */ bne $t7, $at, .L8008E1D0
-/* 08ED44 8008E144 00808025 */ move $s0, $a0
-/* 08ED48 8008E148 3C030400 */ lui $v1, 0x400
-/* 08ED4C 8008E14C 0043C024 */ and $t8, $v0, $v1
-/* 08ED50 8008E150 1078001F */ beq $v1, $t8, .L8008E1D0
-/* 08ED54 8008E154 3C01FFFD */ lui $at, (0xFFFDFFFF >> 16) # lui $at, 0xfffd
-/* 08ED58 8008E158 848800AE */ lh $t0, 0xae($a0)
-/* 08ED5C 8008E15C 3421FFFF */ ori $at, (0xFFFDFFFF & 0xFFFF) # ori $at, $at, 0xffff
-/* 08ED60 8008E160 0041C824 */ and $t9, $v0, $at
-/* 08ED64 8008E164 000E2E00 */ sll $a1, $t6, 0x18
-/* 08ED68 8008E168 AC9900BC */ sw $t9, 0xbc($a0)
-/* 08ED6C 8008E16C A48000A8 */ sh $zero, 0xa8($a0)
-/* 08ED70 8008E170 AC80007C */ sw $zero, 0x7c($a0)
-/* 08ED74 8008E174 A48000C0 */ sh $zero, 0xc0($a0)
-/* 08ED78 8008E178 00054E03 */ sra $t1, $a1, 0x18
-/* 08ED7C 8008E17C A488002E */ sh $t0, 0x2e($a0)
-/* 08ED80 8008E180 A3AE0027 */ sb $t6, 0x27($sp)
-/* 08ED84 8008E184 0C0238F0 */ jal func_8008E3C0
-/* 08ED88 8008E188 01202825 */ move $a1, $t1
-/* 08ED8C 8008E18C 83A60027 */ lb $a2, 0x27($sp)
-/* 08ED90 8008E190 3C0B8016 */ lui $t3, %hi(D_80165190) # $t3, 0x8016
-/* 08ED94 8008E194 256B5190 */ addiu $t3, %lo(D_80165190) # addiu $t3, $t3, 0x5190
-/* 08ED98 8008E198 00065040 */ sll $t2, $a2, 1
-/* 08ED9C 8008E19C 24030001 */ li $v1, 1
-/* 08EDA0 8008E1A0 014B1021 */ addu $v0, $t2, $t3
-/* 08EDA4 8008E1A4 00062E00 */ sll $a1, $a2, 0x18
-/* 08EDA8 8008E1A8 00056603 */ sra $t4, $a1, 0x18
-/* 08EDAC 8008E1AC A4430000 */ sh $v1, ($v0)
-/* 08EDB0 8008E1B0 A4430010 */ sh $v1, 0x10($v0)
-/* 08EDB4 8008E1B4 A4430020 */ sh $v1, 0x20($v0)
-/* 08EDB8 8008E1B8 A4430030 */ sh $v1, 0x30($v0)
-/* 08EDBC 8008E1BC 01802825 */ move $a1, $t4
-/* 08EDC0 8008E1C0 0C0236AF */ jal func_8008DABC
-/* 08EDC4 8008E1C4 02002025 */ move $a0, $s0
-/* 08EDC8 8008E1C8 10000079 */ b .L8008E3B0
-/* 08EDCC 8008E1CC 8FBF001C */ lw $ra, 0x1c($sp)
-.L8008E1D0:
-/* 08EDD0 8008E1D0 3C030002 */ lui $v1, 2
-/* 08EDD4 8008E1D4 00436824 */ and $t5, $v0, $v1
-/* 08EDD8 8008E1D8 146D002D */ bne $v1, $t5, .L8008E290
-/* 08EDDC 8008E1DC 00062040 */ sll $a0, $a2, 1
-/* 08EDE0 8008E1E0 860E002E */ lh $t6, 0x2e($s0)
-/* 08EDE4 8008E1E4 3C188019 */ lui $t8, %hi(D_8018D920) # $t8, 0x8019
-/* 08EDE8 8008E1E8 2718D920 */ addiu $t8, %lo(D_8018D920) # addiu $t8, $t8, -0x26e0
-/* 08EDEC 8008E1EC 25CFFA50 */ addiu $t7, $t6, -0x5b0
-/* 08EDF0 8008E1F0 A60F002E */ sh $t7, 0x2e($s0)
-/* 08EDF4 8008E1F4 00981021 */ addu $v0, $a0, $t8
-/* 08EDF8 8008E1F8 84590000 */ lh $t9, ($v0)
-/* 08EDFC 8008E1FC 240105B0 */ li $at, 1456
-/* 08EE00 8008E200 3C053F80 */ lui $a1, 0x3f80
-/* 08EE04 8008E204 2728FA50 */ addiu $t0, $t9, -0x5b0
-/* 08EE08 8008E208 3103FFFF */ andi $v1, $t0, 0xffff
-/* 08EE0C 8008E20C 0061001A */ div $zero, $v1, $at
-/* 08EE10 8008E210 00004812 */ mflo $t1
-/* 08EE14 8008E214 00095400 */ sll $t2, $t1, 0x10
-/* 08EE18 8008E218 000A5C03 */ sra $t3, $t2, 0x10
-/* 08EE1C 8008E21C 15600018 */ bnez $t3, .L8008E280
-/* 08EE20 8008E220 A4480000 */ sh $t0, ($v0)
-/* 08EE24 8008E224 860C00B2 */ lh $t4, 0xb2($s0)
-/* 08EE28 8008E228 3C01FFFD */ lui $at, (0xFFFDFFFF >> 16) # lui $at, 0xfffd
-/* 08EE2C 8008E22C 3C088016 */ lui $t0, %hi(D_80165190) # $t0, 0x8016
-/* 08EE30 8008E230 258DFFFF */ addiu $t5, $t4, -1
-/* 08EE34 8008E234 A60D00B2 */ sh $t5, 0xb2($s0)
-/* 08EE38 8008E238 860E00B2 */ lh $t6, 0xb2($s0)
-/* 08EE3C 8008E23C 24030001 */ li $v1, 1
-/* 08EE40 8008E240 3421FFFF */ ori $at, (0xFFFDFFFF & 0xFFFF) # ori $at, $at, 0xffff
-/* 08EE44 8008E244 1DC0000E */ bgtz $t6, .L8008E280
-/* 08EE48 8008E248 25085190 */ addiu $t0, %lo(D_80165190) # addiu $t0, $t0, 0x5190
-/* 08EE4C 8008E24C 8E0F00BC */ lw $t7, 0xbc($s0)
-/* 08EE50 8008E250 861900AE */ lh $t9, 0xae($s0)
-/* 08EE54 8008E254 A60000A8 */ sh $zero, 0xa8($s0)
-/* 08EE58 8008E258 01E1C024 */ and $t8, $t7, $at
-/* 08EE5C 8008E25C AE1800BC */ sw $t8, 0xbc($s0)
-/* 08EE60 8008E260 AE00007C */ sw $zero, 0x7c($s0)
-/* 08EE64 8008E264 A60000C0 */ sh $zero, 0xc0($s0)
-/* 08EE68 8008E268 00881021 */ addu $v0, $a0, $t0
-/* 08EE6C 8008E26C A619002E */ sh $t9, 0x2e($s0)
-/* 08EE70 8008E270 A4430000 */ sh $v1, ($v0)
-/* 08EE74 8008E274 A4430010 */ sh $v1, 0x10($v0)
-/* 08EE78 8008E278 A4430020 */ sh $v1, 0x20($v0)
-/* 08EE7C 8008E27C A4430030 */ sh $v1, 0x30($v0)
-.L8008E280:
-/* 08EE80 8008E280 0C00C7D2 */ jal func_80031F48
-/* 08EE84 8008E284 02002025 */ move $a0, $s0
-/* 08EE88 8008E288 10000049 */ b .L8008E3B0
-/* 08EE8C 8008E28C 8FBF001C */ lw $ra, 0x1c($sp)
-.L8008E290:
-/* 08EE90 8008E290 860900B0 */ lh $t1, 0xb0($s0)
-/* 08EE94 8008E294 C604008C */ lwc1 $f4, 0x8c($s0)
-/* 08EE98 8008E298 3C01800F */ lui $at, %hi(D_800EF590)
-/* 08EE9C 8008E29C 252A0001 */ addiu $t2, $t1, 1
-/* 08EEA0 8008E2A0 A60A00B0 */ sh $t2, 0xb0($s0)
-/* 08EEA4 8008E2A4 D428F590 */ ldc1 $f8, %lo(D_800EF590)($at)
-/* 08EEA8 8008E2A8 460021A1 */ cvt.d.s $f6, $f4
-/* 08EEAC 8008E2AC 860200B0 */ lh $v0, 0xb0($s0)
-/* 08EEB0 8008E2B0 46283282 */ mul.d $f10, $f6, $f8
-/* 08EEB4 8008E2B4 24030001 */ li $v1, 1
-/* 08EEB8 8008E2B8 46205420 */ cvt.s.d $f16, $f10
-/* 08EEBC 8008E2BC 1462000F */ bne $v1, $v0, .L8008E2FC
-/* 08EEC0 8008E2C0 E610008C */ swc1 $f16, 0x8c($s0)
-/* 08EEC4 8008E2C4 960B0000 */ lhu $t3, ($s0)
-/* 08EEC8 8008E2C8 30C400FF */ andi $a0, $a2, 0xff
-/* 08EECC 8008E2CC 3C012900 */ lui $at, (0x29008005 >> 16) # lui $at, 0x2900
-/* 08EED0 8008E2D0 316C4000 */ andi $t4, $t3, 0x4000
-/* 08EED4 8008E2D4 11800009 */ beqz $t4, .L8008E2FC
-/* 08EED8 8008E2D8 00000000 */ nop
-/* 08EEDC 8008E2DC 96050254 */ lhu $a1, 0x254($s0)
-/* 08EEE0 8008E2E0 34218005 */ ori $at, (0x29008005 & 0xFFFF) # ori $at, $at, 0x8005
-/* 08EEE4 8008E2E4 A3A60027 */ sb $a2, 0x27($sp)
-/* 08EEE8 8008E2E8 00056900 */ sll $t5, $a1, 4
-/* 08EEEC 8008E2EC 0C03243D */ jal func_800C90F4
-/* 08EEF0 8008E2F0 01A12821 */ addu $a1, $t5, $at
-/* 08EEF4 8008E2F4 83A60027 */ lb $a2, 0x27($sp)
-/* 08EEF8 8008E2F8 860200B0 */ lh $v0, 0xb0($s0)
-.L8008E2FC:
-/* 08EEFC 8008E2FC 0440001A */ bltz $v0, .L8008E368
-/* 08EF00 8008E300 284101CC */ slti $at, $v0, 0x1cc
-/* 08EF04 8008E304 10200018 */ beqz $at, .L8008E368
-/* 08EF08 8008E308 26040224 */ addiu $a0, $s0, 0x224
-/* 08EF0C 8008E30C 3C053F33 */ lui $a1, (0x3F333333 >> 16) # lui $a1, 0x3f33
-/* 08EF10 8008E310 3C063DCC */ lui $a2, (0x3DCCCCCD >> 16) # lui $a2, 0x3dcc
-/* 08EF14 8008E314 34C6CCCD */ ori $a2, (0x3DCCCCCD & 0xFFFF) # ori $a2, $a2, 0xcccd
-/* 08EF18 8008E318 0C008973 */ jal move_f32_towards
-/* 08EF1C 8008E31C 34A53333 */ ori $a1, (0x3F333333 & 0xFFFF) # ori $a1, $a1, 0x3333
-/* 08EF20 8008E320 960E0254 */ lhu $t6, 0x254($s0)
-/* 08EF24 8008E324 3C01800E */ lui $at, %hi(gKartBoundingBoxTable)
-/* 08EF28 8008E328 3C063DCC */ lui $a2, (0x3DCCCCCD >> 16) # lui $a2, 0x3dcc
-/* 08EF2C 8008E32C 000E7880 */ sll $t7, $t6, 2
-/* 08EF30 8008E330 002F0821 */ addu $at, $at, $t7
-/* 08EF34 8008E334 C43226B0 */ lwc1 $f18, %lo(gKartBoundingBoxTable)($at)
-/* 08EF38 8008E338 3C01800F */ lui $at, %hi(D_800EF598)
-/* 08EF3C 8008E33C D426F598 */ ldc1 $f6, %lo(D_800EF598)($at)
-/* 08EF40 8008E340 46009121 */ cvt.d.s $f4, $f18
-/* 08EF44 8008E344 34C6CCCD */ ori $a2, (0x3DCCCCCD & 0xFFFF) # ori $a2, $a2, 0xcccd
-/* 08EF48 8008E348 46262202 */ mul.d $f8, $f4, $f6
-/* 08EF4C 8008E34C 26040070 */ addiu $a0, $s0, 0x70
-/* 08EF50 8008E350 462042A0 */ cvt.s.d $f10, $f8
-/* 08EF54 8008E354 44055000 */ mfc1 $a1, $f10
-/* 08EF58 8008E358 0C008973 */ jal move_f32_towards
-/* 08EF5C 8008E35C 00000000 */ nop
-/* 08EF60 8008E360 10000013 */ b .L8008E3B0
-/* 08EF64 8008E364 8FBF001C */ lw $ra, 0x1c($sp)
-.L8008E368:
-/* 08EF68 8008E368 00062E00 */ sll $a1, $a2, 0x18
-/* 08EF6C 8008E36C 0005C603 */ sra $t8, $a1, 0x18
-/* 08EF70 8008E370 03002825 */ move $a1, $t8
-/* 08EF74 8008E374 02002025 */ move $a0, $s0
-/* 08EF78 8008E378 0C0238F0 */ jal func_8008E3C0
-/* 08EF7C 8008E37C A3A60027 */ sb $a2, 0x27($sp)
-/* 08EF80 8008E380 96190000 */ lhu $t9, ($s0)
-/* 08EF84 8008E384 83A60027 */ lb $a2, 0x27($sp)
-/* 08EF88 8008E388 33284000 */ andi $t0, $t9, 0x4000
-/* 08EF8C 8008E38C 11000007 */ beqz $t0, .L8008E3AC
-/* 08EF90 8008E390 30C400FF */ andi $a0, $a2, 0xff
-/* 08EF94 8008E394 96050254 */ lhu $a1, 0x254($s0)
-/* 08EF98 8008E398 3C012900 */ lui $at, (0x29008008 >> 16) # lui $at, 0x2900
-/* 08EF9C 8008E39C 34218008 */ ori $at, (0x29008008 & 0xFFFF) # ori $at, $at, 0x8008
-/* 08EFA0 8008E3A0 00054900 */ sll $t1, $a1, 4
-/* 08EFA4 8008E3A4 0C03243D */ jal func_800C90F4
-/* 08EFA8 8008E3A8 01212821 */ addu $a1, $t1, $at
-.L8008E3AC:
-/* 08EFAC 8008E3AC 8FBF001C */ lw $ra, 0x1c($sp)
-.L8008E3B0:
-/* 08EFB0 8008E3B0 8FB00018 */ lw $s0, 0x18($sp)
-/* 08EFB4 8008E3B4 27BD0020 */ addiu $sp, $sp, 0x20
-/* 08EFB8 8008E3B8 03E00008 */ jr $ra
-/* 08EFBC 8008E3BC 00000000 */ nop
+glabel func_8008E118
+/* 08ED18 8008E118 27BDFFE0 */ addiu $sp, $sp, -0x20
+/* 08ED1C 8008E11C AFBF001C */ sw $ra, 0x1c($sp)
+/* 08ED20 8008E120 AFB00018 */ sw $s0, 0x18($sp)
+/* 08ED24 8008E124 AFA50024 */ sw $a1, 0x24($sp)
+/* 08ED28 8008E128 8C8200BC */ lw $v0, 0xbc($a0)
+/* 08ED2C 8008E12C 00053600 */ sll $a2, $a1, 0x18
+/* 08ED30 8008E130 00067603 */ sra $t6, $a2, 0x18
+/* 08ED34 8008E134 34018000 */ li $at, 32768
+/* 08ED38 8008E138 304F8000 */ andi $t7, $v0, 0x8000
+/* 08ED3C 8008E13C 01C03025 */ move $a2, $t6
+/* 08ED40 8008E140 15E10023 */ bne $t7, $at, .L8008E1D0
+/* 08ED44 8008E144 00808025 */ move $s0, $a0
+/* 08ED48 8008E148 3C030400 */ lui $v1, 0x400
+/* 08ED4C 8008E14C 0043C024 */ and $t8, $v0, $v1
+/* 08ED50 8008E150 1078001F */ beq $v1, $t8, .L8008E1D0
+/* 08ED54 8008E154 3C01FFFD */ lui $at, (0xFFFDFFFF >> 16) # lui $at, 0xfffd
+/* 08ED58 8008E158 848800AE */ lh $t0, 0xae($a0)
+/* 08ED5C 8008E15C 3421FFFF */ ori $at, (0xFFFDFFFF & 0xFFFF) # ori $at, $at, 0xffff
+/* 08ED60 8008E160 0041C824 */ and $t9, $v0, $at
+/* 08ED64 8008E164 000E2E00 */ sll $a1, $t6, 0x18
+/* 08ED68 8008E168 AC9900BC */ sw $t9, 0xbc($a0)
+/* 08ED6C 8008E16C A48000A8 */ sh $zero, 0xa8($a0)
+/* 08ED70 8008E170 AC80007C */ sw $zero, 0x7c($a0)
+/* 08ED74 8008E174 A48000C0 */ sh $zero, 0xc0($a0)
+/* 08ED78 8008E178 00054E03 */ sra $t1, $a1, 0x18
+/* 08ED7C 8008E17C A488002E */ sh $t0, 0x2e($a0)
+/* 08ED80 8008E180 A3AE0027 */ sb $t6, 0x27($sp)
+/* 08ED84 8008E184 0C0238F0 */ jal func_8008E3C0
+/* 08ED88 8008E188 01202825 */ move $a1, $t1
+/* 08ED8C 8008E18C 83A60027 */ lb $a2, 0x27($sp)
+/* 08ED90 8008E190 3C0B8016 */ lui $t3, %hi(D_80165190) # $t3, 0x8016
+/* 08ED94 8008E194 256B5190 */ addiu $t3, %lo(D_80165190) # addiu $t3, $t3, 0x5190
+/* 08ED98 8008E198 00065040 */ sll $t2, $a2, 1
+/* 08ED9C 8008E19C 24030001 */ li $v1, 1
+/* 08EDA0 8008E1A0 014B1021 */ addu $v0, $t2, $t3
+/* 08EDA4 8008E1A4 00062E00 */ sll $a1, $a2, 0x18
+/* 08EDA8 8008E1A8 00056603 */ sra $t4, $a1, 0x18
+/* 08EDAC 8008E1AC A4430000 */ sh $v1, ($v0)
+/* 08EDB0 8008E1B0 A4430010 */ sh $v1, 0x10($v0)
+/* 08EDB4 8008E1B4 A4430020 */ sh $v1, 0x20($v0)
+/* 08EDB8 8008E1B8 A4430030 */ sh $v1, 0x30($v0)
+/* 08EDBC 8008E1BC 01802825 */ move $a1, $t4
+/* 08EDC0 8008E1C0 0C0236AF */ jal func_8008DABC
+/* 08EDC4 8008E1C4 02002025 */ move $a0, $s0
+/* 08EDC8 8008E1C8 10000079 */ b .L8008E3B0
+/* 08EDCC 8008E1CC 8FBF001C */ lw $ra, 0x1c($sp)
+.L8008E1D0:
+/* 08EDD0 8008E1D0 3C030002 */ lui $v1, 2
+/* 08EDD4 8008E1D4 00436824 */ and $t5, $v0, $v1
+/* 08EDD8 8008E1D8 146D002D */ bne $v1, $t5, .L8008E290
+/* 08EDDC 8008E1DC 00062040 */ sll $a0, $a2, 1
+/* 08EDE0 8008E1E0 860E002E */ lh $t6, 0x2e($s0)
+/* 08EDE4 8008E1E4 3C188019 */ lui $t8, %hi(D_8018D920) # $t8, 0x8019
+/* 08EDE8 8008E1E8 2718D920 */ addiu $t8, %lo(D_8018D920) # addiu $t8, $t8, -0x26e0
+/* 08EDEC 8008E1EC 25CFFA50 */ addiu $t7, $t6, -0x5b0
+/* 08EDF0 8008E1F0 A60F002E */ sh $t7, 0x2e($s0)
+/* 08EDF4 8008E1F4 00981021 */ addu $v0, $a0, $t8
+/* 08EDF8 8008E1F8 84590000 */ lh $t9, ($v0)
+/* 08EDFC 8008E1FC 240105B0 */ li $at, 1456
+/* 08EE00 8008E200 3C053F80 */ lui $a1, 0x3f80
+/* 08EE04 8008E204 2728FA50 */ addiu $t0, $t9, -0x5b0
+/* 08EE08 8008E208 3103FFFF */ andi $v1, $t0, 0xffff
+/* 08EE0C 8008E20C 0061001A */ div $zero, $v1, $at
+/* 08EE10 8008E210 00004812 */ mflo $t1
+/* 08EE14 8008E214 00095400 */ sll $t2, $t1, 0x10
+/* 08EE18 8008E218 000A5C03 */ sra $t3, $t2, 0x10
+/* 08EE1C 8008E21C 15600018 */ bnez $t3, .L8008E280
+/* 08EE20 8008E220 A4480000 */ sh $t0, ($v0)
+/* 08EE24 8008E224 860C00B2 */ lh $t4, 0xb2($s0)
+/* 08EE28 8008E228 3C01FFFD */ lui $at, (0xFFFDFFFF >> 16) # lui $at, 0xfffd
+/* 08EE2C 8008E22C 3C088016 */ lui $t0, %hi(D_80165190) # $t0, 0x8016
+/* 08EE30 8008E230 258DFFFF */ addiu $t5, $t4, -1
+/* 08EE34 8008E234 A60D00B2 */ sh $t5, 0xb2($s0)
+/* 08EE38 8008E238 860E00B2 */ lh $t6, 0xb2($s0)
+/* 08EE3C 8008E23C 24030001 */ li $v1, 1
+/* 08EE40 8008E240 3421FFFF */ ori $at, (0xFFFDFFFF & 0xFFFF) # ori $at, $at, 0xffff
+/* 08EE44 8008E244 1DC0000E */ bgtz $t6, .L8008E280
+/* 08EE48 8008E248 25085190 */ addiu $t0, %lo(D_80165190) # addiu $t0, $t0, 0x5190
+/* 08EE4C 8008E24C 8E0F00BC */ lw $t7, 0xbc($s0)
+/* 08EE50 8008E250 861900AE */ lh $t9, 0xae($s0)
+/* 08EE54 8008E254 A60000A8 */ sh $zero, 0xa8($s0)
+/* 08EE58 8008E258 01E1C024 */ and $t8, $t7, $at
+/* 08EE5C 8008E25C AE1800BC */ sw $t8, 0xbc($s0)
+/* 08EE60 8008E260 AE00007C */ sw $zero, 0x7c($s0)
+/* 08EE64 8008E264 A60000C0 */ sh $zero, 0xc0($s0)
+/* 08EE68 8008E268 00881021 */ addu $v0, $a0, $t0
+/* 08EE6C 8008E26C A619002E */ sh $t9, 0x2e($s0)
+/* 08EE70 8008E270 A4430000 */ sh $v1, ($v0)
+/* 08EE74 8008E274 A4430010 */ sh $v1, 0x10($v0)
+/* 08EE78 8008E278 A4430020 */ sh $v1, 0x20($v0)
+/* 08EE7C 8008E27C A4430030 */ sh $v1, 0x30($v0)
+.L8008E280:
+/* 08EE80 8008E280 0C00C7D2 */ jal func_80031F48
+/* 08EE84 8008E284 02002025 */ move $a0, $s0
+/* 08EE88 8008E288 10000049 */ b .L8008E3B0
+/* 08EE8C 8008E28C 8FBF001C */ lw $ra, 0x1c($sp)
+.L8008E290:
+/* 08EE90 8008E290 860900B0 */ lh $t1, 0xb0($s0)
+/* 08EE94 8008E294 C604008C */ lwc1 $f4, 0x8c($s0)
+/* 08EE98 8008E298 3C01800F */ lui $at, %hi(D_800EF590)
+/* 08EE9C 8008E29C 252A0001 */ addiu $t2, $t1, 1
+/* 08EEA0 8008E2A0 A60A00B0 */ sh $t2, 0xb0($s0)
+/* 08EEA4 8008E2A4 D428F590 */ ldc1 $f8, %lo(D_800EF590)($at)
+/* 08EEA8 8008E2A8 460021A1 */ cvt.d.s $f6, $f4
+/* 08EEAC 8008E2AC 860200B0 */ lh $v0, 0xb0($s0)
+/* 08EEB0 8008E2B0 46283282 */ mul.d $f10, $f6, $f8
+/* 08EEB4 8008E2B4 24030001 */ li $v1, 1
+/* 08EEB8 8008E2B8 46205420 */ cvt.s.d $f16, $f10
+/* 08EEBC 8008E2BC 1462000F */ bne $v1, $v0, .L8008E2FC
+/* 08EEC0 8008E2C0 E610008C */ swc1 $f16, 0x8c($s0)
+/* 08EEC4 8008E2C4 960B0000 */ lhu $t3, ($s0)
+/* 08EEC8 8008E2C8 30C400FF */ andi $a0, $a2, 0xff
+/* 08EECC 8008E2CC 3C012900 */ lui $at, (0x29008005 >> 16) # lui $at, 0x2900
+/* 08EED0 8008E2D0 316C4000 */ andi $t4, $t3, 0x4000
+/* 08EED4 8008E2D4 11800009 */ beqz $t4, .L8008E2FC
+/* 08EED8 8008E2D8 00000000 */ nop
+/* 08EEDC 8008E2DC 96050254 */ lhu $a1, 0x254($s0)
+/* 08EEE0 8008E2E0 34218005 */ ori $at, (0x29008005 & 0xFFFF) # ori $at, $at, 0x8005
+/* 08EEE4 8008E2E4 A3A60027 */ sb $a2, 0x27($sp)
+/* 08EEE8 8008E2E8 00056900 */ sll $t5, $a1, 4
+/* 08EEEC 8008E2EC 0C03243D */ jal func_800C90F4
+/* 08EEF0 8008E2F0 01A12821 */ addu $a1, $t5, $at
+/* 08EEF4 8008E2F4 83A60027 */ lb $a2, 0x27($sp)
+/* 08EEF8 8008E2F8 860200B0 */ lh $v0, 0xb0($s0)
+.L8008E2FC:
+/* 08EEFC 8008E2FC 0440001A */ bltz $v0, .L8008E368
+/* 08EF00 8008E300 284101CC */ slti $at, $v0, 0x1cc
+/* 08EF04 8008E304 10200018 */ beqz $at, .L8008E368
+/* 08EF08 8008E308 26040224 */ addiu $a0, $s0, 0x224
+/* 08EF0C 8008E30C 3C053F33 */ lui $a1, (0x3F333333 >> 16) # lui $a1, 0x3f33
+/* 08EF10 8008E310 3C063DCC */ lui $a2, (0x3DCCCCCD >> 16) # lui $a2, 0x3dcc
+/* 08EF14 8008E314 34C6CCCD */ ori $a2, (0x3DCCCCCD & 0xFFFF) # ori $a2, $a2, 0xcccd
+/* 08EF18 8008E318 0C008973 */ jal move_f32_towards
+/* 08EF1C 8008E31C 34A53333 */ ori $a1, (0x3F333333 & 0xFFFF) # ori $a1, $a1, 0x3333
+/* 08EF20 8008E320 960E0254 */ lhu $t6, 0x254($s0)
+/* 08EF24 8008E324 3C01800E */ lui $at, %hi(gKartBoundingBoxSizeTable)
+/* 08EF28 8008E328 3C063DCC */ lui $a2, (0x3DCCCCCD >> 16) # lui $a2, 0x3dcc
+/* 08EF2C 8008E32C 000E7880 */ sll $t7, $t6, 2
+/* 08EF30 8008E330 002F0821 */ addu $at, $at, $t7
+/* 08EF34 8008E334 C43226B0 */ lwc1 $f18, %lo(gKartBoundingBoxSizeTable)($at)
+/* 08EF38 8008E338 3C01800F */ lui $at, %hi(D_800EF598)
+/* 08EF3C 8008E33C D426F598 */ ldc1 $f6, %lo(D_800EF598)($at)
+/* 08EF40 8008E340 46009121 */ cvt.d.s $f4, $f18
+/* 08EF44 8008E344 34C6CCCD */ ori $a2, (0x3DCCCCCD & 0xFFFF) # ori $a2, $a2, 0xcccd
+/* 08EF48 8008E348 46262202 */ mul.d $f8, $f4, $f6
+/* 08EF4C 8008E34C 26040070 */ addiu $a0, $s0, 0x70
+/* 08EF50 8008E350 462042A0 */ cvt.s.d $f10, $f8
+/* 08EF54 8008E354 44055000 */ mfc1 $a1, $f10
+/* 08EF58 8008E358 0C008973 */ jal move_f32_towards
+/* 08EF5C 8008E35C 00000000 */ nop
+/* 08EF60 8008E360 10000013 */ b .L8008E3B0
+/* 08EF64 8008E364 8FBF001C */ lw $ra, 0x1c($sp)
+.L8008E368:
+/* 08EF68 8008E368 00062E00 */ sll $a1, $a2, 0x18
+/* 08EF6C 8008E36C 0005C603 */ sra $t8, $a1, 0x18
+/* 08EF70 8008E370 03002825 */ move $a1, $t8
+/* 08EF74 8008E374 02002025 */ move $a0, $s0
+/* 08EF78 8008E378 0C0238F0 */ jal func_8008E3C0
+/* 08EF7C 8008E37C A3A60027 */ sb $a2, 0x27($sp)
+/* 08EF80 8008E380 96190000 */ lhu $t9, ($s0)
+/* 08EF84 8008E384 83A60027 */ lb $a2, 0x27($sp)
+/* 08EF88 8008E388 33284000 */ andi $t0, $t9, 0x4000
+/* 08EF8C 8008E38C 11000007 */ beqz $t0, .L8008E3AC
+/* 08EF90 8008E390 30C400FF */ andi $a0, $a2, 0xff
+/* 08EF94 8008E394 96050254 */ lhu $a1, 0x254($s0)
+/* 08EF98 8008E398 3C012900 */ lui $at, (0x29008008 >> 16) # lui $at, 0x2900
+/* 08EF9C 8008E39C 34218008 */ ori $at, (0x29008008 & 0xFFFF) # ori $at, $at, 0x8008
+/* 08EFA0 8008E3A0 00054900 */ sll $t1, $a1, 4
+/* 08EFA4 8008E3A4 0C03243D */ jal func_800C90F4
+/* 08EFA8 8008E3A8 01212821 */ addu $a1, $t1, $at
+.L8008E3AC:
+/* 08EFAC 8008E3AC 8FBF001C */ lw $ra, 0x1c($sp)
+.L8008E3B0:
+/* 08EFB0 8008E3B0 8FB00018 */ lw $s0, 0x18($sp)
+/* 08EFB4 8008E3B4 27BD0020 */ addiu $sp, $sp, 0x20
+/* 08EFB8 8008E3B8 03E00008 */ jr $ra
+/* 08EFBC 8008E3BC 00000000 */ nop
diff --git a/asm/non_matchings/code_802B0210/func_802B09C0.s b/asm/non_matchings/code_802B0210/func_802B09C0.s
deleted file mode 100644
index 1cdf18731..000000000
--- a/asm/non_matchings/code_802B0210/func_802B09C0.s
+++ /dev/null
@@ -1,33 +0,0 @@
-glabel func_802B09C0
-/* 119FD0 802B09C0 AFA40000 */ sw $a0, ($sp)
-/* 119FD4 802B09C4 00047400 */ sll $t6, $a0, 0x10
-/* 119FD8 802B09C8 000E2403 */ sra $a0, $t6, 0x10
-/* 119FDC 802B09CC 2401FFFF */ li $at, -1
-/* 119FE0 802B09D0 14810003 */ bne $a0, $at, .L802B09E0
-/* 119FE4 802B09D4 0004C0C0 */ sll $t8, $a0, 3
-/* 119FE8 802B09D8 03E00008 */ jr $ra
-/* 119FEC 802B09DC 00001025 */ move $v0, $zero
-
-.L802B09E0:
-/* 119FF0 802B09E0 0304C023 */ subu $t8, $t8, $a0
-/* 119FF4 802B09E4 0018C100 */ sll $t8, $t8, 4
-/* 119FF8 802B09E8 3C028016 */ lui $v0, %hi(D_8015F9BE) # 0x8016
-/* 119FFC 802B09EC 00581021 */ addu $v0, $v0, $t8
-/* 11A000 802B09F0 8442F9BE */ lh $v0, %lo(D_8015F9BE)($v0)
-/* 11A004 802B09F4 24010002 */ li $at, 2
-/* 11A008 802B09F8 54410004 */ bnel $v0, $at, .L802B0A0C
-/* 11A00C 802B09FC 24010003 */ li $at, 3
-/* 11A010 802B0A00 03E00008 */ jr $ra
-/* 11A014 802B0A04 24020001 */ li $v0, 1
-
-/* 11A018 802B0A08 24010003 */ li $at, 3
-.L802B0A0C:
-/* 11A01C 802B0A0C 54410004 */ bnel $v0, $at, .L802B0A20
-/* 11A020 802B0A10 00001025 */ move $v0, $zero
-/* 11A024 802B0A14 03E00008 */ jr $ra
-/* 11A028 802B0A18 24020001 */ li $v0, 1
-
-/* 11A02C 802B0A1C 00001025 */ move $v0, $zero
-.L802B0A20:
-/* 11A030 802B0A20 03E00008 */ jr $ra
-/* 11A034 802B0A24 00000000 */ nop
diff --git a/include/actor_types.h b/include/actor_types.h
index 829498b3f..57d81f427 100644
--- a/include/actor_types.h
+++ b/include/actor_types.h
@@ -6,31 +6,20 @@
// This keeps the other files cleaner.
struct piranha_plant {
- /* 0x00 */ s16 unk0; // 0xC, 0xD, or 0x2B
- #ifdef AVOID_UB
- /* 0x02 */ u16 unk2;
- #else
- s16 unk2; // bitflag
- #endif
- /* 0x04 */ s16 unk4; // Timer?
- /* 0x06 */ s16 unk6; // 1
- /* 0x08 */ s16 unk8;
- /* 0x0A */ s16 unkA;
- /* 0x0C */ f32 unkC;
- /* 0x10 */ Vec3s unk10; // Actor rotation
- /* 0x18 */ s32 unk18;
- /* 0x1C */ f32 unk1C;
- /* 0x20 */ s16 unk20;
- /* 0x22 */ s16 unk22;
- /* 0x24 */ s16 unk24;
- /* 0x26 */ s16 unk26;
- /* 0x28 */ s16 unk28;
- /* 0x2A */ s16 unk2A;
+ /* 0x00 */ s16 type;
+ /* 0x02 */ s16 flags;
+ /* 0x04 */ Vec4s visibilityStates; // A per-camera visibilty state tracker
+ /* 0x0C */ f32 boundingBoxSize;
+ /* 0x10 */ Vec4s unk10;
+ /* 0x18 */ Vec3f pos;
+ /* 0x24 */ Vec4s timers; // A per-camera timer. Might be more appropriate to call this state
+ /* 0x2C */ f32 unk_02C;
+ /* 0x30 */ UnkActorInner unk30;
};
struct triple_shell_parent {
/* 0x00 */ s16 type;
- /* 0x02 */ s16 unk_02;
+ /* 0x02 */ s16 flags;
/* 0x04 */ s16 shellsAvailable;
/* 0x06 */ s16 state;
/* 0x08 */ f32 unk_08;
@@ -46,13 +35,13 @@ struct triple_shell_parent {
struct shell_actor {
/* 0x00 */ s16 type;
- /* 0x02 */ s16 unk_02;
+ /* 0x02 */ s16 flags;
// Index in D_8015F9B8 for the parent actor of this shell
// Seems to pull double duty as a timer
/* 0x04 */ s16 parentIndex;
/* 0x06 */ s16 state;
/* 0x08 */ f32 unk_08;
- /* 0x0C */ f32 unk_0C;
+ /* 0x0C */ f32 boundingBoxSize;
/* 0x10 */ s16 rotVelocity; // Change in rotAngle on a per-update basis
/* 0x12 */ s16 rotAngle; // Angle of rotation around player (or parent?), not the rotation of the shell itself
/* 0x14 */ s16 playerId; // Id of the player that "owns" the shell
@@ -62,6 +51,72 @@ struct shell_actor {
/* 0x30 */ UnkActorInner unk30;
}; // size = 0x70
+struct item_box {
+ /* 0x00 */ s16 type;
+ /* 0x02 */ s16 flags;
+ /* 0x04 */ s16 someTimer;
+ /* 0x06 */ s16 state;
+ /* 0x08 */ f32 resetDistance; // Value added to the Y position when box is touched. Expected to be negative
+ // Distance at which a player can activate the item box
+ // Named "bounding box" to match the name used for the "size" of a kart
+ /* 0x0C */ f32 boundingBoxSize;
+ /* 0x10 */ Vec3s rot;
+ /* 0x16 */ s16 unk_16;
+ /* 0x18 */ Vec3f pos;
+ /* 0x24 */ f32 origY; // Original Y position. Basically the Y position the box will reset to after being touched
+ /* 0x28 */ f32 unk_028;
+ /* 0x2C */ f32 unk_02C;
+ /* 0x30 */ UnkActorInner unk30;
+}; // size = 0x70
+
+struct fake_item_box {
+ /* 0x00 */ s16 type;
+ /* 0x02 */ s16 flags;
+ /* 0x04 */ s16 someTimer;
+ /* 0x06 */ s16 state;
+ /* 0x08 */ f32 sizeScaling; // Controls the size of the box
+ /* 0x0C */ f32 boundingBoxSize;
+ /* 0x10 */ Vec3s rot;
+ /* 0x16 */ s16 unk_16;
+ /* 0x18 */ Vec3f pos;
+ /* 0x24 */ f32 playerId;
+ /* 0x28 */ f32 targetY;
+ /* 0x2C */ f32 unk_02C;
+ /* 0x30 */ UnkActorInner unk30;
+}; // size = 0x70
+
+struct banana_bunch_parent {
+ /* 0x00 */ s16 type;
+ /* 0x02 */ s16 flags;
+ /* 0x04 */ s16 unk_04;
+ /* 0x06 */ s16 state;
+ /* 0x08 */ f32 unk_08;
+ /* 0x0C */ f32 unk_0C;
+ /* 0x10 */ s16 playerId; // Player that own the bananas
+ /* 0x12 */ s16 bananaIndices[5]; // Indices in D_8015F9B8 for the bananas owned by this parent
+ /* 0x1C */ s16 bananasAvailable;
+ /* 0x1E */ s16 unk_1E;
+ /* 0x20 */ f32 unk_20[4];
+ /* 0x30 */ UnkActorInner unk30;
+}; // size = 0x70
+
+struct banana_actor {
+ /* 0x00 */ s16 type;
+ /* 0x02 */ s16 flags;
+ /* 0x04 */ s16 unk_04;
+ /* 0x06 */ s16 state;
+ /* 0x08 */ s16 parentIndex;
+ /* 0x0A */ s16 bananaId; // ? Appears to indiciate which banana of the bunch this one is
+ /* 0x0C */ f32 boundingBoxSize;
+ /* 0x10 */ s16 playerId; // Player that owns this particular banana
+ /* 0x12 */ s16 elderIndex; // Index of the next-oldest banana in the bunch
+ /* 0x14 */ s16 youngerIndex; // Index of the next-youngest banana in the bunch. -1 if this banana is the youngest
+ /* 0x16 */ s16 unk_16; // Index of the next-youngest banana in the bunch. -1 if this banana is the youngest
+ /* 0x18 */ Vec3f pos;
+ /* 0x24 */ Vec3f velocity;
+ /* 0x30 */ UnkActorInner unk30;
+}; // size = 0x70
+
struct Actor {
/* 0x00 */ s16 unk0; // 0xC, 0xD, or 0x2B
#ifdef AVOID_UB
diff --git a/include/common_structs.h b/include/common_structs.h
index 1429e36ba..3e849b654 100644
--- a/include/common_structs.h
+++ b/include/common_structs.h
@@ -297,7 +297,7 @@ typedef struct {
/* 0x0064 */ f32 unk_064;
/* 0x0068 */ f32 unk_068;
/* 0x006C */ f32 unk_06C;
- /* 0x0070 */ f32 unk_070;
+ /* 0x0070 */ f32 boundingBoxSize;
/* 0x0074 */ f32 unk_074;
/* 0x0078 */ s16 unk_078;
/* 0x007A */ s16 unk_07A;
diff --git a/include/kart_attributes.h b/include/kart_attributes.h
index 20364a0f9..f32cd79b4 100644
--- a/include/kart_attributes.h
+++ b/include/kart_attributes.h
@@ -35,7 +35,7 @@ extern f32 gKartFrictionTable[8];
extern f32 gKartGravityTable[8];
extern f32 D_800E2670[8];
extern f32 gKartTopSpeedTable[8];
-extern f32 gKartBoundingBoxTable[8];
+extern f32 gKartBoundingBoxSizeTable[8];
extern f32 D_800E26D0[15];
extern f32 D_800E270C[15];
diff --git a/src/code_80027D00.c b/src/code_80027D00.c
index 10525b42b..3056cf19f 100644
--- a/src/code_80027D00.c
+++ b/src/code_80027D00.c
@@ -1119,7 +1119,7 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) {
sp38 = temp_f0;
sp94 = temp_f2;
sp40 = temp_f2;
- sp90 = -player->unk_070;
+ sp90 = -player->boundingBoxSize;
func_802B63B8(sp48, temp_a0, &sp5C);
sp80 = player->boundingBoxCorners[0].cornerX;
sp84 = player->boundingBoxCorners[0].cornerY;
@@ -1135,7 +1135,7 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) {
sp34 = temp_f14;
sp28 = temp_f2_2;
sp94 = sp40;
- sp90 = -player->unk_070;
+ sp90 = -player->boundingBoxSize;
func_802B63B8(sp48, (bitwise f32 *) temp_f14, temp_a0_2, &sp5C);
sp80 = player->boundingBoxCorners[1].cornerX;
sp84 = player->boundingBoxCorners[1].cornerY;
@@ -1149,7 +1149,7 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) {
sp8C = (f32) (sp38 - 2.6);
sp94 = temp_f12;
sp40 = temp_f12;
- sp90 = -player->unk_070;
+ sp90 = -player->boundingBoxSize;
func_802B63B8(temp_f12, temp_a0_3, &sp5C);
sp80 = player->boundingBoxCorners[2].cornerX;
sp84 = player->boundingBoxCorners[2].cornerY;
@@ -1161,7 +1161,7 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) {
temp_a0_4 = &sp8C;
sp8C = (f32) (sp28 + 2.6);
sp94 = sp40;
- sp90 = -player->unk_070;
+ sp90 = -player->boundingBoxSize;
func_802B63B8((bitwise f32) temp_a0_4, &sp5C);
sp80 = player->boundingBoxCorners[3].cornerX;
sp84 = player->boundingBoxCorners[3].cornerY;
@@ -3228,7 +3228,7 @@ void func_8002D268(Player *player, s32 arg1, s8 arg2, s8 arg3) {
spF8 = temp_f4;
spF8 = temp_f8 - D_800ED830;
}
- func_802AD950(&player->unk_110, player->unk_070, spFC, spF8, spF4, player->rotX, player->rotY, player->rotZ);
+ func_802AD950(&player->unk_110, player->boundingBoxSize, spFC, spF8, spF4, player->rotX, player->rotY, player->rotZ);
player->unk_058 = 0.0f;
player->unk_060 = 0.0f;
player->unk_05C = 1.0f;
@@ -3404,7 +3404,7 @@ void func_8002E4C4(Player *player) {
player->kartHopJerk = 0.0f;
player->kartHopAcceleration = 0.0f;
player->kartHopVelocity = 0.0f;
- player->pos[1] = func_802AE1C0(player->pos[0], D_80164510[player_index] + 10.0f, player->pos[2]) + player->unk_070;
+ player->pos[1] = func_802AE1C0(player->pos[0], D_80164510[player_index] + 10.0f, player->pos[2]) + player->boundingBoxSize;
if (((player->pos[1] - D_80164510[player_index]) > 1200.0f) || ((player->pos[1] - D_80164510[player_index]) < -1200.0f)) {
player->pos[1] = player->rotY;
}
diff --git a/src/code_800393C0.c b/src/code_800393C0.c
index 6f83a2718..0f236ccc6 100644
--- a/src/code_800393C0.c
+++ b/src/code_800393C0.c
@@ -21,7 +21,7 @@ void spawn_player(Player *player, s8 playerIndex, f32 arg2, f32 arg3, f32 arg4,
player->characterId = arg6;
player->unk_0B6 = 0;
player->unk_0FC = gKartFrictionTable[player->characterId];
- player->unk_070 = gKartBoundingBoxTable[player->characterId];
+ player->boundingBoxSize = gKartBoundingBoxSizeTable[player->characterId];
player->unk_100 = gKartGravityTable[player->characterId];
switch (gModeSelection) {
@@ -50,7 +50,7 @@ void spawn_player(Player *player, s8 playerIndex, f32 arg2, f32 arg3, f32 arg4,
}
player->pos[0] = arg2;
- ret = func_802AE1C0(arg2, arg4 + 50.0f, arg3) + player->unk_070;
+ ret = func_802AE1C0(arg2, arg4 + 50.0f, arg3) + player->boundingBoxSize;
player->pos[2] = arg3;
player->pos[1] = ret;
player->rotX = arg2;
diff --git a/src/code_80057C60.c b/src/code_80057C60.c
index 570e950ed..eeaacd65f 100644
--- a/src/code_80057C60.c
+++ b/src/code_80057C60.c
@@ -4146,13 +4146,13 @@ void func_8005F90C(Player *player, s16 arg1, s32 arg2, s32 arg3) {
phi_v0 = (s32) player->boundingBoxCorners[2].surfaceType;
phi_f12 = player->pos[2];
phi_f0 = player->pos[0];
- phi_f2 = player->pos[1] - player->unk_070;
+ phi_f2 = player->pos[1] - player->boundingBoxSize;
phi_t1 = 1;
} else {
phi_v0 = (s32) player->boundingBoxCorners[3].surfaceType;
phi_f12 = player->pos[2];
phi_f0 = player->pos[0];
- phi_f2 = player->pos[1] - player->unk_070;
+ phi_f2 = player->pos[1] - player->boundingBoxSize;
}
switch (phi_v0) {
case 2:
@@ -5421,7 +5421,7 @@ void func_80062AA8(Player* arg0, UNUSED s8 arg1, UNUSED s8 arg2, s8 arg3) {
arg0->unk_258[20 + arg3].unk_012 = 5;
arg0->unk_258[20 + arg3].unk_00C = D_800EE60C;
arg0->unk_258[20 + arg3].unk_01E = 0;
- arg0->unk_258[20 + arg3].unk_000[1] = (arg0->pos[1] + arg0->unk_070) - 2.5;
+ arg0->unk_258[20 + arg3].unk_000[1] = (arg0->pos[1] + arg0->boundingBoxSize) - 2.5;
}
void func_80062B18(f32 *arg0, f32 *arg1, f32 *arg2, f32 arg3, f32 arg4, f32 arg5, u16 arg6, u16 arg7) {
@@ -5850,7 +5850,7 @@ void func_80064184(Player* arg0, s16 arg1, s8 arg2, UNUSED s8 arg3) {
arg0->unk_258[arg1].unk_000[2] = arg0->pos[2] + sp3C;
arg0->unk_258[arg1].unk_000[1] = arg0->pos[1] + sp40;
++arg0->unk_258[arg1].unk_01E;
- if ((arg0->unk_258[arg1].unk_01E == 12) || (D_801652A0[arg2] <= (arg0->pos[1] - arg0->unk_070))) {
+ if ((arg0->unk_258[arg1].unk_01E == 12) || (D_801652A0[arg2] <= (arg0->pos[1] - arg0->boundingBoxSize))) {
arg0->unk_258[arg1].unk_01C = 0;
arg0->unk_258[arg1].unk_01E = 0;
arg0->unk_258[arg1].unk_012 = 0;
diff --git a/src/code_8008C1D0.c b/src/code_8008C1D0.c
index 16f976896..fce1e8fe7 100644
--- a/src/code_8008C1D0.c
+++ b/src/code_8008C1D0.c
@@ -940,7 +940,7 @@ void func_8008DC08(Player* player, s8 arg1) {
player->unk_DB6 = 0;
player->unk_0BC |= 0x08000000;
player->unk_224 = 1.0f;
- player->unk_070 = gKartBoundingBoxTable[player->characterId];
+ player->boundingBoxSize = gKartBoundingBoxSizeTable[player->characterId];
D_80165190[0][arg1] = 1;
D_80165190[1][arg1] = 1;
D_80165190[2][arg1] = 1;
@@ -995,7 +995,7 @@ void func_8008DF98(Player* player, s8 arg1) {
? func_800C90F4(s32, s32, s8); /* extern */
extern ? D_80165190;
extern ? D_8018D920;
-extern ? gKartBoundingBoxTable;
+extern ? gKartBoundingBoxSizeTable;
void func_8008E118(void *arg0, s8 arg1) {
s16 *temp_v0_3;
@@ -1061,7 +1061,7 @@ void func_8008E118(void *arg0, s8 arg1) {
}
if ((arg0->unkB0 >= 0) && (arg0->unkB0 < 0x1CC)) {
move_f32_towards(arg0 + 0x224, 0.7f, 0x3DCCCCCD);
- move_f32_towards(arg0 + 0x70, *(&gKartBoundingBoxTable + (arg0->unk254 * 4)) * 0.9, 0x3DCCCCCD);
+ move_f32_towards(arg0 + 0x70, *(&gKartBoundingBoxSizeTable + (arg0->unk254 * 4)) * 0.9, 0x3DCCCCCD);
return;
}
arg1 = phi_a2;
@@ -1076,11 +1076,11 @@ GLOBAL_ASM("asm/non_matchings/code_8008C1D0/func_8008E118.s")
void func_8008E3C0(Player* player, UNUSED s8 arg1) {
move_f32_towards(&player->unk_224, 1.0f, 0.1f);
- move_f32_towards(&player->unk_070, gKartBoundingBoxTable[player->characterId], 0.1f);
+ move_f32_towards(&player->boundingBoxSize, gKartBoundingBoxSizeTable[player->characterId], 0.1f);
player->unk_0BC &= ~0x40000000;
player->unk_224 = 1.0f;
- player->unk_070 = gKartBoundingBoxTable[player->characterId];
+ player->boundingBoxSize = gKartBoundingBoxSizeTable[player->characterId];
player->unk_DC4 = 3.0f;
player->unk_DB6 = 0;
player->unk_0BC |= 0x08000000;
diff --git a/src/code_80296A50.c b/src/code_80296A50.c
index 65ee85b7e..c73c4a904 100644
--- a/src/code_80296A50.c
+++ b/src/code_80296A50.c
@@ -894,48 +894,46 @@ void update_obj_train_car2(struct Actor *arg0) {
arg0->unk6 -= 0x666;
}
-void update_obj_piranha_plant(void *data) {
- struct piranha_plant *arg0 = (struct piranha_plant *) data;
- s16 temp_v0 = arg0->unk2;
-
- if ((temp_v0 & 0x800) == 0) {
- if ((temp_v0 & 0x400) != 0) {
- arg0->unk1C += 4.0f;
- if (arg0->unk1C > 800.0f) {
- arg0->unk2 |= 0x800;
+void update_obj_piranha_plant(struct piranha_plant *arg0) {
+ if ((arg0->flags & 0x800) == 0) {
+ if ((arg0->flags & 0x400) != 0) {
+ arg0->pos[1] += 4.0f;
+ if (arg0->pos[1] > 800.0f) {
+ arg0->flags |= 0x800;
}
} else {
- if (arg0->unk4 == 1) {
- arg0->unk24++;
- if (arg0->unk24 > 60) {
- arg0->unk24 = 6;
+ // This has to be an unrolled loop
+ if (arg0->visibilityStates[0] == 1) {
+ arg0->timers[0]++;
+ if (arg0->timers[0] > 60) {
+ arg0->timers[0] = 6;
}
} else {
- arg0->unk24 = 0;
+ arg0->timers[0] = 0;
}
- if (arg0->unk6 == 1) {
- arg0->unk26++;
- if (arg0->unk26 > 60) {
- arg0->unk26 = 6;
+ if (arg0->visibilityStates[1] == 1) {
+ arg0->timers[1]++;
+ if (arg0->timers[1] > 60) {
+ arg0->timers[1] = 6;
}
} else {
- arg0->unk26 = 0;
+ arg0->timers[1] = 0;
}
- if (arg0->unk8 == 1) {
- arg0->unk28++;
- if (arg0->unk28 > 60) {
- arg0->unk28 = 6;
+ if (arg0->visibilityStates[2] == 1) {
+ arg0->timers[2]++;
+ if (arg0->timers[2] > 60) {
+ arg0->timers[2] = 6;
}
} else {
- arg0->unk28 = 0;
+ arg0->timers[2] = 0;
}
- if (arg0->unkA == 1) {
- arg0->unk2A++;
- if (arg0->unk2A > 60) {
- arg0->unk2A = 6;
+ if (arg0->visibilityStates[3] == 1) {
+ arg0->timers[3]++;
+ if (arg0->timers[3] > 60) {
+ arg0->timers[3] = 6;
}
} else {
- arg0->unk2A = 0;
+ arg0->timers[3] = 0;
}
}
}
@@ -2291,115 +2289,112 @@ GLOBAL_ASM("asm/non_matchings/code_actors/func_8029A23C.s")
#endif
#ifdef MIPS_TO_C
-/*
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_80297230(void *, void *); // extern
-void func_802972B8(void *, void *); // extern
-void func_802979F8(void *, ?, void *); // extern
-s32 func_802B4FF8(void *, ?, void *); // extern
-f32 func_802B80D0(s32, u16, ?, f32, f32); // extern
+//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd
+? func_80297230(Camera *, struct shell_actor *); /* extern */
+? func_802972B8(Camera *, struct shell_actor *); /* extern */
+? func_802979F8(struct shell_actor *, ?, f32 (*)[4]); /* extern */
+s32 func_802B4FF8(f32 (*)[4], ?, f32 (*)[4]); /* extern */
+f32 func_802B80D0(f32 *, u16, ?, f32, f32); /* extern */
extern ? D_0D005338;
extern ? D_0D005368;
-extern ? D_802B87E8;
-extern f32 D_802B96AC;
-extern f32 D_802B96B0;
+extern ? D_80150130;
extern s32 D_802BA050;
extern s32 D_802BA054;
+static ? D_802B87E8; /* unable to generate initializer */
+static f32 D_802B96AC = 490000.0f;
+static f32 D_802B96B0 = 40000.0f;
-
-void func_8029A3AC(void *arg0, void *arg1, void *arg2) {
+void func_8029A3AC(Camera *camera, Mat4 arg1, struct shell_actor *shell) {
u16 sp7C;
? sp58;
s32 sp54;
f32 sp50;
+ Gfx *temp_v0;
+ Gfx *temp_v0_2;
+ Gfx *temp_v0_3;
+ Gfx *temp_v0_4;
+ Gfx *temp_v0_5;
+ Gfx *temp_v0_6;
+ Gfx *temp_v0_7;
+ Gfx *temp_v0_8;
+ Gfx *temp_v0_9;
f32 temp_f0;
s32 temp_t3;
u16 temp_t8;
- void *temp_v0;
- void *temp_v0_2;
- void *temp_v0_3;
- void *temp_v0_4;
- void *temp_v0_5;
- void *temp_v0_6;
- void *temp_v0_7;
- void *temp_v0_8;
- void *temp_v0_9;
s32 phi_t3;
- sp58.unk0 = D_802B87E8.unk0;
- sp58.unk4 = D_802B87E8.unk4;
- sp58.unk8 = D_802B87E8.unk8;
- sp58.unkC = D_802B87E8.unkC;
- sp58.unk10 = D_802B87E8.unk10;
- sp58.unk14 = D_802B87E8.unk14;
- sp58.unk18 = D_802B87E8.unk18;
- sp58.unk1C = D_802B87E8.unk1C;
- temp_f0 = func_802B80D0(arg2 + 0x18, arg0->unk26, 0, (&D_80150130)[(arg0 - camera1) / 0xB8], D_802B96AC);
+ sp58.unk0 = (s32) D_802B87E8.unk0;
+ sp58.unk4 = (s32) D_802B87E8.unk4;
+ sp58.unk8 = (s32) D_802B87E8.unk8;
+ sp58.unkC = (s32) D_802B87E8.unkC;
+ sp58.unk10 = (s32) D_802B87E8.unk10;
+ sp58.unk14 = (s32) D_802B87E8.unk14;
+ sp58.unk18 = (s32) D_802B87E8.unk18;
+ sp58.unk1C = (u16) D_802B87E8.unk1C;
+ temp_f0 = func_802B80D0(shell->pos, (u16) camera->rotX2, 0, *(&D_80150130 + (((s32) (camera - camera1) / 184) * 4)), D_802B96AC);
if (temp_f0 < 0.0f) {
- func_80297230(arg0, arg2);
+ func_80297230(camera, shell);
return;
}
sp50 = temp_f0;
- func_802972B8(arg0, arg2);
+ func_802972B8(camera, shell);
if (temp_f0 < D_802B96B0) {
- func_802979F8(arg2, 0x4059999A, arg1);
+ func_802979F8(shell, 0x4059999A, arg1);
}
- if (arg2->unk0 == 0x2A) {
+ if (shell->type == 0x002A) {
phi_t3 = D_802BA054;
} else {
phi_t3 = D_802BA050;
}
- temp_t8 = (arg2->unk10 / 0x1111) & 0xFFFF;
- arg1->unk30 = arg2->unk18;
+ temp_t8 = ((s32) (u16) shell->rotVelocity / 4369) & 0xFFFF;
+ arg1->unk30 = (f32) shell->pos[0];
temp_t3 = phi_t3 + (sp + (temp_t8 * 2))->unk58;
- arg1->unk34 = (arg2->unk1C - arg2->unkC) + 1.0f;
- arg1->unk38 = arg2->unk20;
+ arg1->unk34 = (f32) ((shell->pos[1] - shell->boundingBoxSize) + 1.0f);
+ arg1->unk38 = (f32) shell->pos[2];
sp7C = temp_t8;
sp54 = temp_t3;
if (func_802B4FF8(arg1, 0, arg1) != 0) {
temp_v0 = gDisplayListHead;
gDisplayListHead = temp_v0 + 8;
- temp_v0->unk0 = 0xFD500000;
- temp_v0->unk4 = temp_t3 & 0x1FFFFFFF;
+ temp_v0->words.w0 = 0xFD500000;
+ temp_v0->words.w1 = temp_t3 & 0x1FFFFFFF;
temp_v0_2 = gDisplayListHead;
gDisplayListHead = temp_v0_2 + 8;
- temp_v0_2->unk0 = 0xF5500000;
- temp_v0_2->unk4 = 0x7080200;
+ temp_v0_2->words.w0 = 0xF5500000;
+ temp_v0_2->words.w1 = 0x07080200;
temp_v0_3 = gDisplayListHead;
gDisplayListHead = temp_v0_3 + 8;
- temp_v0_3->unk4 = 0;
- temp_v0_3->unk0 = 0xE6000000;
+ temp_v0_3->words.w1 = 0;
+ temp_v0_3->words.w0 = 0xE6000000;
temp_v0_4 = gDisplayListHead;
gDisplayListHead = temp_v0_4 + 8;
- temp_v0_4->unk4 = 0x71FF200;
- temp_v0_4->unk0 = 0xF3000000;
+ temp_v0_4->words.w1 = 0x071FF200;
+ temp_v0_4->words.w0 = 0xF3000000;
temp_v0_5 = gDisplayListHead;
gDisplayListHead = temp_v0_5 + 8;
- temp_v0_5->unk4 = 0;
- temp_v0_5->unk0 = 0xE7000000;
+ temp_v0_5->words.w1 = 0;
+ temp_v0_5->words.w0 = 0xE7000000;
temp_v0_6 = gDisplayListHead;
gDisplayListHead = temp_v0_6 + 8;
- temp_v0_6->unk0 = 0xF5480800;
- temp_v0_6->unk4 = 0x80200;
+ temp_v0_6->words.w0 = 0xF5480800;
+ temp_v0_6->words.w1 = 0x00080200;
temp_v0_7 = gDisplayListHead;
gDisplayListHead = temp_v0_7 + 8;
- temp_v0_7->unk0 = 0xF2000000;
- temp_v0_7->unk4 = 0x7C07C;
- if (sp7C < 8) {
+ temp_v0_7->words.w0 = 0xF2000000;
+ temp_v0_7->words.w1 = 0x0007C07C;
+ if ((s32) sp7C < 8) {
temp_v0_8 = gDisplayListHead;
gDisplayListHead = temp_v0_8 + 8;
- temp_v0_8->unk0 = 0x6000000;
- temp_v0_8->unk4 = &D_0D005338;
+ temp_v0_8->words.w0 = 0x06000000;
+ temp_v0_8->words.w1 = (u32) &D_0D005338;
return;
}
temp_v0_9 = gDisplayListHead;
gDisplayListHead = temp_v0_9 + 8;
- temp_v0_9->unk0 = 0x6000000;
- temp_v0_9->unk4 = &D_0D005368;
- // Duplicate return node #11. Try simplifying control flow for better match
+ temp_v0_9->words.w0 = 0x06000000;
+ temp_v0_9->words.w1 = (u32) &D_0D005368;
}
}
-*/
#else
GLOBAL_ASM("asm/non_matchings/code_actors/func_8029A3AC.s")
#endif
@@ -4931,7 +4926,7 @@ s32 func_8029F408(Player *arg0, Player *arg1) {
if ((temp_a3->posY - arg1->posZ) < 0.0f) {
return 0;
}
- if ((temp_a3->unk_070 + (bitwise f32) arg1->unk_00C) < temp_f2_2) {
+ if ((temp_a3->boundingBoxSize + (bitwise f32) arg1->unk_00C) < temp_f2_2) {
return 0;
}
if ((temp_a3->unk_000 & 0x4000) != 0) {
@@ -5148,7 +5143,7 @@ s32 func_8029FB80(Player *arg0, struct Actor *arg1) {
f32 temp_f16;
f32 temp_f2;
- temp_f0 = arg0->unk_070 + arg1->unkC;
+ temp_f0 = arg0->boundingBoxSize + arg1->unkC;
temp_f2 = arg1->unk18[0] - arg0->pos[0];
if (temp_f0 < temp_f2) {
return 0;
@@ -5817,14 +5812,14 @@ void func_802A0E44(void) {
f32 func_802ABEAC(UnkActorInner*, Vec3f);
extern f32 D_802B99CC;
-void func_802A1064(struct Actor *arg0) {
- if (arg0 - &D_8015F9B8[0] > 100u) { return; }
- if ((arg0->unk2 & 0x8000) == 0) { return; }
+void func_802A1064(struct fake_item_box *fake_item_box) {
+ if (fake_item_box - (struct fake_item_box*)D_8015F9B8 > 100u) { return; }
+ if ((fake_item_box->flags & 0x8000) == 0) { return; }
- if (arg0->unk0 == 13) {
- arg0->unk6 = 1;
- arg0->unk24[1] = func_802ABEAC(&arg0->unk30, arg0->unk18) + D_802B99CC;
- arg0->unk4 = 100;
+ if (fake_item_box->type == 13) {
+ fake_item_box->state = 1;
+ fake_item_box->targetY = func_802ABEAC(&fake_item_box->unk30, fake_item_box->pos) + D_802B99CC;
+ fake_item_box->someTimer = 100;
}
}
@@ -5832,8 +5827,8 @@ extern f32 D_802B99D0;
extern f32 D_802B99D4;
void func_802ADDC8(UnkActorInner*, f32, f32, f32, f32);
void func_802B4E30(struct Actor*);
-void update_obj_fake_item_box(struct Actor *arg0) {
- u32 temp_v1 = arg0->unk24[0];
+void update_obj_fake_item_box(struct fake_item_box *fake_item_box) {
+ u32 temp_v1 = fake_item_box->playerId;
Player *temp_v0_4 = &gPlayers[temp_v1];
struct Controller *temp_v1_3;
@@ -5844,75 +5839,75 @@ void update_obj_fake_item_box(struct Actor *arg0) {
f32 temp_f18;
s32 pad2[3];
- switch(arg0->unk6) {
+ switch(fake_item_box->state) {
case 0:
- arg0->unkC = arg0->unk8 * 5.5f;
- arg0->unk10[0] -= 0xB6;
- arg0->unk10[1] += 0x16C;
- arg0->unk10[2] -= 0xB6;
+ fake_item_box->boundingBoxSize = fake_item_box->sizeScaling * 5.5f;
+ fake_item_box->rot[0] -= 0xB6;
+ fake_item_box->rot[1] += 0x16C;
+ fake_item_box->rot[2] -= 0xB6;
- temp_f14 = temp_v0_4->pos[0] - arg0->unk18[0];
- temp_f16 = temp_v0_4->pos[1] - arg0->unk18[1];
- temp_f18 = temp_v0_4->pos[2] - arg0->unk18[2];
+ temp_f14 = temp_v0_4->pos[0] - fake_item_box->pos[0];
+ temp_f16 = temp_v0_4->pos[1] - fake_item_box->pos[1];
+ temp_f18 = temp_v0_4->pos[2] - fake_item_box->pos[2];
temp_f2_2 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f18 * temp_f18)) / 10.0f;
temp_f14 /= temp_f2_2;
temp_f16 /= temp_f2_2;
temp_f18 /= temp_f2_2;
- arg0->unk18[0] = temp_v0_4->pos[0] - temp_f14;
- arg0->unk18[1] = (temp_v0_4->pos[1] - temp_f16) - 1.0f;
- arg0->unk18[2] = temp_v0_4->pos[2] - temp_f18;
- func_802ADDC8(&arg0->unk30, arg0->unkC, arg0->unk18[0], arg0->unk18[1], arg0->unk18[2]);
- func_802B4E30(arg0);
+ fake_item_box->pos[0] = temp_v0_4->pos[0] - temp_f14;
+ fake_item_box->pos[1] = (temp_v0_4->pos[1] - temp_f16) - 1.0f;
+ fake_item_box->pos[2] = temp_v0_4->pos[2] - temp_f18;
+ func_802ADDC8(&fake_item_box->unk30, fake_item_box->boundingBoxSize, fake_item_box->pos[0], fake_item_box->pos[1], fake_item_box->pos[2]);
+ func_802B4E30(fake_item_box);
temp_v1_3 = &gControllers[temp_v1];
if ((temp_v0_4->unk_000 & 0x4000) != 0) {
if ((temp_v1_3->buttonDepressed & Z_TRIG) != 0) {
temp_v1_3->buttonDepressed &= 0xDFFF;
- func_802A1064(arg0);
+ func_802A1064(fake_item_box);
temp_v0_4->unk_00C &= 0xFFFBFFFF;
func_800C9060(((temp_v0_4 - gPlayerOne)) & 0xFF, 0x19008012);
}
}
break;
case 1:
- if (arg0->unk8 < 1.0f) {
- arg0->unk8 += D_802B99D0;
- } else if (arg0->unk8 >= 1.0f) {
- arg0->unk8 = 1.0f;
+ if (fake_item_box->sizeScaling < 1.0f) {
+ fake_item_box->sizeScaling += D_802B99D0;
+ } else if (fake_item_box->sizeScaling >= 1.0f) {
+ fake_item_box->sizeScaling = 1.0f;
}
- arg0->unkC = arg0->unk8 * 5.5f;
- if (arg0->unk24[1] <= arg0->unk18[1]) {
- arg0->unk18[1] = arg0->unk24[1];
+ fake_item_box->boundingBoxSize = fake_item_box->sizeScaling * 5.5f;
+ if (fake_item_box->targetY <= fake_item_box->pos[1]) {
+ fake_item_box->pos[1] = fake_item_box->targetY;
} else {
- arg0->unk18[1] += D_802B99D4;
+ fake_item_box->pos[1] += D_802B99D4;
}
- if ((arg0->unk2 & 0x1000) != 0) {
- if ((arg0->unk4 <= 0) || (arg0->unk4 >= 0x12D)) {
- arg0->unk2 &= 0xEFFF;
- arg0->unk4 = 0;
+ if ((fake_item_box->flags & 0x1000) != 0) {
+ if ((fake_item_box->someTimer <= 0) || (fake_item_box->someTimer >= 0x12D)) {
+ fake_item_box->flags &= 0xEFFF;
+ fake_item_box->someTimer = 0;
} else {
- arg0->unk4--;
+ fake_item_box->someTimer--;
}
}
- arg0->unk10[0] -= 0xB6;
- arg0->unk10[1] += 0x16C;
- arg0->unk10[2] -= 0xB6;
+ fake_item_box->rot[0] -= 0xB6;
+ fake_item_box->rot[1] += 0x16C;
+ fake_item_box->rot[2] -= 0xB6;
break;
case 2:
- if ((arg0->unk4 >= 0x14) || (arg0->unk4 < 0)) {
- func_8029E854(arg0);
+ if ((fake_item_box->someTimer >= 0x14) || (fake_item_box->someTimer < 0)) {
+ func_8029E854(fake_item_box);
} else {
- arg0->unk4++;
- arg0->unk10[0] += 0x444;
- arg0->unk10[1] -= 0x2D8;
- arg0->unk10[2] += 0x16C;
+ fake_item_box->someTimer++;
+ fake_item_box->rot[0] += 0x444;
+ fake_item_box->rot[1] -= 0x2D8;
+ fake_item_box->rot[2] += 0x16C;
}
break;
default:
- func_8029E854(arg0);
+ func_8029E854(fake_item_box);
break;
}
}
@@ -5934,60 +5929,59 @@ void func_802A14BC(f32 arg0, f32 arg1, f32 arg2) {
}
}
-void update_obj_item_box_hot_air_balloon(struct Actor *arg0) {
- switch(arg0->unk6) {
+void update_obj_item_box_hot_air_balloon(struct item_box *itemBox) {
+ switch(itemBox->state) {
case 5:
- arg0->unk10[0] += 0xB6;
- arg0->unk10[1] -= 0x16C;
- arg0->unk10[2] += 0xB6;
+ itemBox->rot[0] += 0xB6;
+ itemBox->rot[1] -= 0x16C;
+ itemBox->rot[2] += 0xB6;
break;
case 3:
- if (arg0->unk4 == 0x14) {
- arg0->unk6 = 5;
- arg0->unk2 = -0x4000;
- return;
+ if (itemBox->someTimer == 0x14) {
+ itemBox->state = 5;
+ itemBox->flags = -0x4000;
+ } else {
+ itemBox->someTimer++;
+ itemBox->rot[0] += 0x444;
+ itemBox->rot[1] -= 0x2D8;
+ itemBox->rot[2] += 0x16C;
}
- arg0->unk4++;
- arg0->unk10[0] += 0x444;
- arg0->unk10[1] -= 0x2D8;
- arg0->unk10[2] += 0x16C;
break;
-
}
}
extern f32 D_802B99D8;
extern f32 D_802B99DC;
-void update_obj_item_box(struct Actor *arg0) {
- switch (arg0->unk6) {
+void update_obj_item_box(struct item_box *itemBox) {
+ switch (itemBox->state) {
case 0:
- arg0->unk6 = 1;
+ itemBox->state = 1;
break;
case 1:
- if ((arg0->unk18[1] - arg0->unk24[0]) < D_802B99D8) {
- arg0->unk18[1] += D_802B99DC;
+ if ((itemBox->pos[1] - itemBox->origY) < D_802B99D8) {
+ itemBox->pos[1] += D_802B99DC;
} else {
- arg0->unk18[1] = arg0->unk24[0] + D_802B99D8;
- arg0->unk6 = 2;
- arg0->unk2 = 0xC000;
+ itemBox->pos[1] = itemBox->origY + D_802B99D8;
+ itemBox->state = 2;
+ itemBox->flags = 0xC000;
}
break;
case 2:
- arg0->unk10[0] += 0xB6;
- arg0->unk10[1] -= 0x16C;
- arg0->unk10[2] += 0xB6;
+ itemBox->rot[0] += 0xB6;
+ itemBox->rot[1] -= 0x16C;
+ itemBox->rot[2] += 0xB6;
break;
case 3:
- if (arg0->unk4 == 20) {
- arg0->unk6 = 0;
- arg0->unk18[1] = arg0->unk8 - 20.0f;
- arg0->unk2 = 0xC000;
+ if (itemBox->someTimer == 20) {
+ itemBox->state = 0;
+ itemBox->pos[1] = itemBox->resetDistance - 20.0f;
+ itemBox->flags = 0xC000;
} else {
- arg0->unk4++;
- arg0->unk10[0] += 0x444;
- arg0->unk10[1] -= 0x2D8;
- arg0->unk10[2] += 0x16C;
+ itemBox->someTimer++;
+ itemBox->rot[0] += 0x444;
+ itemBox->rot[1] -= 0x2D8;
+ itemBox->rot[2] += 0x16C;
}
break;
}
diff --git a/src/code_802B0210.c b/src/code_802B0210.c
index f7cf6cbaa..2bbb901a1 100644
--- a/src/code_802B0210.c
+++ b/src/code_802B0210.c
@@ -166,10 +166,8 @@ GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B0570.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_8015F9B8;
-
-void func_802B0648(void *arg0) {
+//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd
+void func_802B0648(struct banana_bunch_parent *banana_bunch) {
s16 temp_v0;
s16 temp_v0_2;
s16 temp_v0_3;
@@ -183,49 +181,49 @@ void func_802B0648(void *arg0) {
s32 temp_lo_5;
void *phi_v1;
- temp_v0 = arg0->unk1A;
- arg0->unk1C = arg0->unk1C - 1;
+ temp_v0 = banana_bunch->bananaIndices[4];
+ banana_bunch->bananasAvailable += -1;
if (temp_v0 != -1) {
temp_lo = temp_v0 * 0x70;
- arg0->unk1A = -1;
- phi_v1 = &D_8015F9B8 + temp_lo;
+ banana_bunch->bananaIndices[4] = -1;
+ phi_v1 = D_8015F9B8 + temp_lo;
goto block_10;
}
- temp_v0_2 = arg0->unk18;
+ temp_v0_2 = banana_bunch->bananaIndices[3];
if (temp_v0_2 != -1) {
temp_lo_2 = temp_v0_2 * 0x70;
- arg0->unk18 = -1;
- phi_v1 = &D_8015F9B8 + temp_lo_2;
+ banana_bunch->bananaIndices[3] = -1;
+ phi_v1 = D_8015F9B8 + temp_lo_2;
goto block_10;
}
- temp_v0_3 = arg0->unk16;
+ temp_v0_3 = banana_bunch->bananaIndices[2];
if (temp_v0_3 != -1) {
temp_lo_3 = temp_v0_3 * 0x70;
- arg0->unk16 = -1;
- phi_v1 = &D_8015F9B8 + temp_lo_3;
+ banana_bunch->bananaIndices[2] = -1;
+ phi_v1 = D_8015F9B8 + temp_lo_3;
goto block_10;
}
- temp_v0_4 = arg0->unk14;
+ temp_v0_4 = banana_bunch->bananaIndices[1];
if (temp_v0_4 != -1) {
temp_lo_4 = temp_v0_4 * 0x70;
- arg0->unk14 = -1;
- phi_v1 = &D_8015F9B8 + temp_lo_4;
+ banana_bunch->bananaIndices[1] = -1;
+ phi_v1 = D_8015F9B8 + temp_lo_4;
goto block_10;
}
- temp_v0_5 = arg0->unk12;
+ temp_v0_5 = banana_bunch->bananaIndices[0];
if (temp_v0_5 != -1) {
temp_lo_5 = temp_v0_5 * 0x70;
- arg0->unk12 = -1;
- phi_v1 = &D_8015F9B8 + temp_lo_5;
+ banana_bunch->bananaIndices[0] = -1;
+ phi_v1 = D_8015F9B8 + temp_lo_5;
block_10:
temp_v0_6 = phi_v1->unk12;
phi_v1->unk6 = 1;
- phi_v1->unk4 = 0xB4;
+ phi_v1->unk4 = 0x00B4;
phi_v1->unk24 = 0.0f;
phi_v1->unk2C = 0.0f;
phi_v1->unk28 = 1.5f;
if (temp_v0_6 != -1) {
- (&D_8015F9B8 + (temp_v0_6 * 0x70))->unk14 = -1;
+ (D_8015F9B8 + (temp_v0_6 * 0x70))->unk14 = -1;
}
}
}
@@ -234,12 +232,11 @@ GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B0648.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_802B64C4(f32 *, s16); // extern
-? load_giant_egg(f32, f32 *, ?, f32, f32); // extern
-extern ? D_8015F9B8;
+//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd
+? func_802B64C4(f32 *, s16); /* extern */
+? load_giant_egg(f32, f32 *, ?, f32, f32); /* extern */
-void func_802B0788(s16 arg0, void *arg1, void *arg2) {
+void func_802B0788(s16 arg0, struct banana_bunch_parent *banana_bunch, Player *player) {
f32 sp34;
void *sp30;
f32 temp_f0;
@@ -259,240 +256,229 @@ void func_802B0788(s16 arg0, void *arg1, void *arg2) {
f32 phi_f12;
f32 phi_f0;
- temp_a3 = arg1->unk1A;
- arg1->unk1C = arg1->unk1C - 1;
+ temp_a3 = banana_bunch->bananaIndices[4];
+ banana_bunch->bananasAvailable += -1;
if (temp_a3 != -1) {
temp_lo = temp_a3 * 0x70;
- arg1->unk1A = -1;
- phi_v0 = &D_8015F9B8 + temp_lo;
+ banana_bunch->bananaIndices[4] = -1;
+ phi_v0 = D_8015F9B8 + temp_lo;
goto block_10;
}
- temp_a0 = arg1->unk18;
+ temp_a0 = banana_bunch->bananaIndices[3];
if (temp_a0 != -1) {
temp_lo_2 = temp_a0 * 0x70;
- arg1->unk18 = -1;
- phi_v0 = &D_8015F9B8 + temp_lo_2;
+ banana_bunch->bananaIndices[3] = -1;
+ phi_v0 = D_8015F9B8 + temp_lo_2;
goto block_10;
}
- temp_a0_2 = arg1->unk16;
+ temp_a0_2 = banana_bunch->bananaIndices[2];
if (temp_a0_2 != -1) {
temp_lo_3 = temp_a0_2 * 0x70;
- arg1->unk16 = -1;
- phi_v0 = &D_8015F9B8 + temp_lo_3;
+ banana_bunch->bananaIndices[2] = -1;
+ phi_v0 = D_8015F9B8 + temp_lo_3;
goto block_10;
}
- temp_a0_3 = arg1->unk14;
+ temp_a0_3 = banana_bunch->bananaIndices[1];
if (temp_a0_3 != -1) {
temp_lo_4 = temp_a0_3 * 0x70;
- arg1->unk14 = -1;
- phi_v0 = &D_8015F9B8 + temp_lo_4;
+ banana_bunch->bananaIndices[1] = -1;
+ phi_v0 = D_8015F9B8 + temp_lo_4;
goto block_10;
}
- temp_a0_4 = arg1->unk12;
+ temp_a0_4 = banana_bunch->bananaIndices[0];
if (temp_a0_4 != -1) {
temp_lo_5 = temp_a0_4 * 0x70;
- arg1->unk12 = -1;
- phi_v0 = &D_8015F9B8 + temp_lo_5;
+ banana_bunch->bananaIndices[0] = -1;
+ phi_v0 = D_8015F9B8 + temp_lo_5;
block_10:
temp_a1 = phi_v0->unk12;
phi_v0->unk6 = 1;
- phi_v0->unk4 = 0x1E;
+ phi_v0->unk4 = 0x001E;
if (temp_a1 != -1) {
- (&D_8015F9B8 + (temp_a1 * 0x70))->unk14 = -1;
+ (D_8015F9B8 + (temp_a1 * 0x70))->unk14 = -1;
}
- temp_f2 = arg2->unk94;
+ temp_f2 = player->unk_094;
if (temp_f2 < 2.0f) {
phi_f12 = 4.0f;
- phi_f0 = ((arg0 - 30.0f) / 20.0f) + 1.5f;
+ phi_f0 = (((f32) arg0 - 30.0f) / 20.0f) + 1.5f;
} else {
- temp_f0 = ((arg0 - 30.0f) / 20.0f) + 1.5f;
+ temp_f0 = (((f32) arg0 - 30.0f) / 20.0f) + 1.5f;
phi_f12 = (temp_f2 * 0.75f) + 4.5f + temp_f0;
phi_f0 = temp_f0;
}
sp30 = phi_v0;
load_giant_egg(phi_f12, &sp34, 0, phi_f0, phi_f12);
- func_802B64C4(&sp34, arg2->unk2E + arg2->unkC0);
- phi_v0->unk24 = sp34;
- phi_v0->unk28 = sp38;
- phi_v0->unk2C = sp3C;
+ func_802B64C4(&sp34, (s16) (player->unk_02E + player->unk_0C0));
+ sp30->unk24 = sp34;
+ sp30->unk28 = sp38;
+ sp30->unk2C = sp3C;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B0788.s")
#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern s16 D_8015F9BE[];
-
-s32 func_802B09C0(s16 arg0) {
- s16 temp_v0;
-
- if (arg0 == -1) {
+s32 func_802B09C0(s16 bananaId) {
+ struct banana_actor *banana;
+ if (bananaId == -1) {
return 0;
}
- temp_v0 = &D_8015F9BE[arg0];
- if (temp_v0 == 2) {
+ banana = (struct banana_actor*) &D_8015F9B8[bananaId];
+ if (banana->state == 2) {
return 1;
}
- if (temp_v0 == 3) {
+ if (banana->state == 3) {
return 1;
}
return 0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B09C0.s")
-#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
+//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd
? func_800C9060(s32, ?); /* extern */
-? func_8029E854(void *, s32); /* extern */
-? func_802B0648(void *); /* extern */
-? func_802B0788(s16, void *, Player *, Player *); /* extern */
-? func_802B2914(void *, Player *, ?, Player *); /* extern */
-extern ? D_8015F9B8;
-
-void update_obj_banana_bunch(void *arg0) {
- void *sp2C;
- void *sp28;
- void *sp24;
+? func_8029E854(struct banana_bunch_parent *, s32); /* extern */
+? func_802B0648(struct banana_bunch_parent *); /* extern */
+? func_802B0788(s16, struct banana_bunch_parent *, Player *, Player *); /* extern */
+s32 func_802B09C0(s16, s32); /* extern */
+? func_802B2914(struct banana_bunch_parent *, Player *, ?, Player *); /* extern */
+
+void update_obj_banana_bunch(struct banana_bunch_parent *banana_bunch) {
+ Player *sp2C;
+ struct Controller *sp28;
+ s32 sp24;
+ Player *temp_a3;
s16 temp_a0_2;
- s16 temp_t4;
- s16 temp_t6;
s16 temp_v1_2;
+ struct Controller *temp_v0;
+ struct banana_actor *temp_a0;
+ struct banana_actor *temp_a1;
+ struct banana_actor *temp_a2;
+ struct banana_actor *temp_a3_2;
+ struct banana_actor *temp_t0;
u16 temp_t9;
u16 temp_v1;
- void *temp_a0;
- void *temp_a1;
- void *temp_a2;
- void *temp_a3;
- void *temp_t0;
- void *phi_v1;
- void *phi_v1_2;
- void *phi_v1_3;
- void *phi_v1_4;
- void *phi_v1_5;
-
- temp_t6 = arg0->unk10;
- temp_t9 = arg0->unk6;
+ s32 phi_v1;
+ s32 phi_v1_2;
+ s32 phi_v1_3;
+ s32 phi_v1_4;
+ s32 phi_v1_5;
+
+ temp_t9 = (u16) banana_bunch->state;
+ temp_a3 = &gPlayers[banana_bunch->playerId];
switch (temp_t9) {
case 0:
- func_802B2914(arg0, &gPlayers[temp_t6], 0, &gPlayers[temp_t6]);
- arg0->unk4 = 4;
- arg0->unk6 = 1;
- arg0->unk1C = 1;
+ func_802B2914(banana_bunch, temp_a3, 0, temp_a3);
+ banana_bunch->unk_04 = 4;
+ banana_bunch->state = 1;
+ banana_bunch->bananasAvailable = 1;
return;
case 1:
- arg0->unk4 = arg0->unk4 - 1;
- if (arg0->unk4 == 0) {
- func_802B2914(arg0, &gPlayers[temp_t6], 1, &gPlayers[temp_t6]);
- arg0->unk4 = 4;
- arg0->unk6 = 2;
- arg0->unk1C = arg0->unk1C + 1;
+ banana_bunch->unk_04 += -1;
+ if (banana_bunch->unk_04 == 0) {
+ func_802B2914(banana_bunch, temp_a3, 1, temp_a3);
+ banana_bunch->unk_04 = 4;
+ banana_bunch->state = 2;
+ banana_bunch->bananasAvailable += 1;
return;
}
default:
return;
case 2:
- arg0->unk4 = arg0->unk4 - 1;
- if (arg0->unk4 == 0) {
- func_802B2914(arg0, &gPlayers[temp_t6], 2, &gPlayers[temp_t6]);
- arg0->unk4 = 4;
- arg0->unk6 = 3;
- arg0->unk1C = arg0->unk1C + 1;
+ banana_bunch->unk_04 += -1;
+ if (banana_bunch->unk_04 == 0) {
+ func_802B2914(banana_bunch, temp_a3, 2, temp_a3);
+ banana_bunch->unk_04 = 4;
+ banana_bunch->state = 3;
+ banana_bunch->bananasAvailable += 1;
return;
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
case 3:
- arg0->unk4 = arg0->unk4 - 1;
- if (arg0->unk4 == 0) {
- func_802B2914(arg0, &gPlayers[temp_t6], 3, &gPlayers[temp_t6]);
- arg0->unk4 = 4;
- arg0->unk6 = 4;
- arg0->unk1C = arg0->unk1C + 1;
+ banana_bunch->unk_04 += -1;
+ if (banana_bunch->unk_04 == 0) {
+ func_802B2914(banana_bunch, temp_a3, 3, temp_a3);
+ banana_bunch->unk_04 = 4;
+ banana_bunch->state = 4;
+ banana_bunch->bananasAvailable += 1;
return;
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
case 4:
- arg0->unk4 = arg0->unk4 - 1;
- if (arg0->unk4 == 0) {
- func_802B2914(arg0, &gPlayers[temp_t6], 4, &gPlayers[temp_t6]);
- arg0->unk4 = 4;
- arg0->unk6 = 5;
- arg0->unk1C = arg0->unk1C + 1;
+ banana_bunch->unk_04 += -1;
+ if (banana_bunch->unk_04 == 0) {
+ func_802B2914(banana_bunch, temp_a3, 4, temp_a3);
+ banana_bunch->unk_04 = 4;
+ banana_bunch->state = 5;
+ banana_bunch->bananasAvailable += 1;
return;
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
case 5:
- arg0->unk6 = 6;
- temp_a0 = &D_8015F9B8 + (arg0->unk12 * 0x70);
- temp_a0->unk2 = temp_a0->unk2 | 0x5000;
- temp_a1 = &D_8015F9B8 + (arg0->unk14 * 0x70);
- temp_a1->unk2 = temp_a1->unk2 | 0x5000;
- temp_a2 = &D_8015F9B8 + (arg0->unk16 * 0x70);
- temp_a2->unk2 = temp_a2->unk2 | 0x5000;
- temp_a3 = &D_8015F9B8 + (arg0->unk18 * 0x70);
- temp_a3->unk2 = temp_a3->unk2 | 0x5000;
- temp_t0 = &D_8015F9B8 + (arg0->unk1A * 0x70);
- temp_t0->unk2 = temp_t0->unk2 | 0x5000;
+ banana_bunch->state = 6;
+ temp_a0 = &D_8015F9B8[banana_bunch->bananaIndices[0]];
+ temp_a0->flags |= 0x5000;
+ temp_a1 = &D_8015F9B8[banana_bunch->bananaIndices[1]];
+ temp_a1->flags |= 0x5000;
+ temp_a2 = &D_8015F9B8[banana_bunch->bananaIndices[2]];
+ temp_a2->flags |= 0x5000;
+ temp_a3_2 = &D_8015F9B8[banana_bunch->bananaIndices[3]];
+ temp_a3_2->flags |= 0x5000;
+ temp_t0 = &D_8015F9B8[banana_bunch->bananaIndices[4]];
+ temp_t0->flags |= 0x5000;
return;
case 6:
- sp2C = &gPlayers[temp_t6];
- sp24 = NULL;
+ sp2C = temp_a3;
+ sp24 = 0;
phi_v1 = sp24;
- if (func_802B09C0(arg0->unk12, MIPS2C_ERROR(Read from unset register $a1)) == 1) {
+ if (func_802B09C0(banana_bunch->bananaIndices[0]) == 1) {
phi_v1 = 1;
}
- sp2C = &gPlayers[temp_t6];
+ sp2C = temp_a3;
sp24 = phi_v1;
phi_v1_2 = phi_v1;
- if (func_802B09C0(arg0->unk14, 1) == 1) {
+ if (func_802B09C0(banana_bunch->bananaIndices[1], 1) == 1) {
phi_v1_2 = phi_v1 + 1;
}
- sp2C = &gPlayers[temp_t6];
+ sp2C = temp_a3;
sp24 = phi_v1_2;
phi_v1_3 = phi_v1_2;
- if (func_802B09C0(arg0->unk16, 1) == 1) {
+ if (func_802B09C0(banana_bunch->bananaIndices[2], 1) == 1) {
phi_v1_3 = phi_v1_2 + 1;
}
- sp2C = &gPlayers[temp_t6];
+ sp2C = temp_a3;
sp24 = phi_v1_3;
phi_v1_4 = phi_v1_3;
- if (func_802B09C0(arg0->unk18, 1) == 1) {
+ if (func_802B09C0(banana_bunch->bananaIndices[3], 1) == 1) {
phi_v1_4 = phi_v1_3 + 1;
}
- sp2C = &gPlayers[temp_t6];
+ sp2C = temp_a3;
sp24 = phi_v1_4;
phi_v1_5 = phi_v1_4;
- if (func_802B09C0(arg0->unk1A, 1) == 1) {
+ if (func_802B09C0(banana_bunch->bananaIndices[4], 1) == 1) {
phi_v1_5 = phi_v1_4 + 1;
}
if (phi_v1_5 == 0) {
- sp2C = &gPlayers[temp_t6];
- func_8029E854(arg0, 1);
- gPlayers[temp_t6].unk_00C &= 0xFFFBFFFF;
+ sp2C = temp_a3;
+ func_8029E854(banana_bunch, 1);
+ temp_a3->unk_00C &= 0xFFFBFFFF;
return;
}
- if (((gPlayers[temp_t6].unk_000 & PLAYER_HUMAN) != 0) && (temp_t4 = arg0->unk10, temp_v1 = gControllers[temp_t4].buttonPressed, ((temp_v1 & 0x2000) != 0))) {
- gControllers[temp_t4].buttonPressed = temp_v1 & 0xDFFF;
- sp2C = &gPlayers[temp_t6];
- sp28 = &gControllers[temp_t4];
- func_800C9060(((&gPlayers[temp_t6] - gPlayerOne) / 3544) & 0xFF, 0x19008012);
- temp_a0_2 = gControllers[temp_t4].rawStickY;
- if ((temp_a0_2 >= 0x1F) && (temp_v1_2 = gControllers[temp_t4].rawStickX, ((temp_v1_2 < 0x28) != 0)) && (temp_v1_2 >= -0x27)) {
- func_802B0788(temp_a0_2, arg0, &gPlayers[temp_t6], &gPlayers[temp_t6]);
- 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;
+ }
}
- func_802B0648(arg0);
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ func_802B0648(banana_bunch);
}
- /* Duplicate return node #31. Try simplifying control flow for better match */
- return;
+ break;
}
}
#else
@@ -627,11 +613,11 @@ void update_obj_triple_shell(struct triple_shell_parent *actor, s16 arg1) {
case 3:
actor->state = 4;
temp_v0_2 = &D_8015F9B8[(s16) (s32) actor->shellIndices[0]];
- temp_v0_2->unk_02 |= 0x4000;
+ temp_v0_2->flags |= 0x4000;
temp_v0_3 = &D_8015F9B8[(s16) (s32) actor->shellIndices[1]];
- temp_v0_3->unk_02 |= 0x4000;
+ temp_v0_3->flags |= 0x4000;
temp_v0_4 = &D_8015F9B8[(s16) (s32) actor->shellIndices[2]];
- temp_v0_4->unk_02 |= 0x4000;
+ temp_v0_4->flags |= 0x4000;
return;
case 4:
sp4E = temp_t0;
@@ -1031,20 +1017,30 @@ GLOBAL_ASM("asm/non_matchings/code_802B0210/func_802B1FFC.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
+//generated by m2c commit 685418adfeb3794409e47b45ac5cab60b17d23fd
? func_800C9060(s32, ?, u16); /* extern */
-? func_8029E854(void *); /* extern */
-? func_8029FDC8(f32, void *); /* extern */
-? func_802ADDC8(f32, void *, void *, f32, f32, f32, f32); /* extern */
-? func_802B4E30(void *); /* extern */
+? func_8029E854(struct banana_actor *); /* extern */
+? func_8029FDC8(f32, struct banana_actor *); /* extern */
+? func_802ADDC8(f32, UnkActorInner *, UnkActorInner *, f32, f32, f32, f32); /* extern */
+? func_802B4E30(struct banana_actor *); /* extern */
? func_802B64C4(f32 *, s16); /* extern */
? load_giant_egg(f32, f32 *, ?, f32, f32); /* extern */
-extern ? D_8015F9B8;
-
-void update_obj_banana(void *arg0) {
- void *sp88;
- void *sp84;
- void *sp80;
+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;
+
+void update_obj_banana(struct banana_actor *banana) {
+ Player *sp88;
+ struct Actor *sp84;
+ struct Controller *sp80;
f32 sp7C;
f32 sp78;
f32 sp74;
@@ -1057,6 +1053,7 @@ void update_obj_banana(void *arg0) {
f32 sp3C;
f32 sp38;
f32 sp34;
+ Player *temp_v0;
f32 temp_f0;
f32 temp_f0_10;
f32 temp_f0_2;
@@ -1086,205 +1083,204 @@ void update_obj_banana(void *arg0) {
f32 temp_f2_4;
f32 temp_f2_5;
s16 temp_a0;
- s16 temp_t6;
- s16 temp_v0;
+ s16 temp_v0_2;
+ struct Actor *temp_v0_3;
u16 temp_a2;
u16 temp_t9;
- void *temp_v0_2;
f32 phi_f6;
- void *phi_f14;
- void *phi_v1;
+ UnkActorInner *phi_f14;
+ struct Controller *phi_v1;
f32 phi_f12;
f32 phi_f8;
- void *phi_f14_2;
+ UnkActorInner *phi_f14_2;
- temp_t6 = arg0->unk10;
- temp_t9 = arg0->unk6;
+ temp_t9 = (u16) banana->state;
+ temp_v0 = &gPlayers[banana->playerId];
switch (temp_t9) {
case 0:
- temp_f2 = gPlayers[temp_t6].pos[0] - arg0->unk18;
- temp_f14 = gPlayers[temp_t6].pos[1] - arg0->unk1C;
+ temp_f2 = temp_v0->pos[0] - banana->pos[0];
+ temp_f14 = temp_v0->pos[1] - banana->pos[1];
sp48 = temp_f2;
- temp_f16 = gPlayers[temp_t6].pos[2] - arg0->unk20;
+ temp_f16 = temp_v0->pos[2] - banana->pos[2];
sp44 = temp_f14;
- sp88 = &gPlayers[temp_t6];
+ sp88 = temp_v0;
sp40 = temp_f16;
- temp_f12 = sqrtf((temp_f2 * temp_f2) + (temp_f14 * temp_f14) + (temp_f16 * temp_f16), temp_f14) / 10.0f;
- phi_f14 = (bitwise void *) temp_f14;
+ temp_f12 = sqrtf((temp_f2 * temp_f2) + (temp_f14 * temp_f14) + (temp_f16 * temp_f16)) / 10.0f;
+ phi_f14 = (bitwise UnkActorInner *) temp_f14;
if (temp_f12 == 0.0f) {
temp_f0 = D_802B9EE0;
- arg0->unk18 = gPlayers[temp_t6].pos[0] + temp_f0;
- arg0->unk1C = gPlayers[temp_t6].pos[1] + temp_f0;
- phi_f6 = gPlayers[temp_t6].posZ + temp_f0;
+ 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;
} else {
temp_f14_2 = temp_f14 / temp_f12;
- arg0->unk18 = gPlayers[temp_t6].pos[0] - (temp_f2 / temp_f12);
- arg0->unk1C = (gPlayers[temp_t6].pos[1] - temp_f14_2) - 2.0f;
- phi_f6 = gPlayers[temp_t6].posZ - (temp_f16 / temp_f12);
- phi_f14 = (bitwise void *) temp_f14_2;
- }
- arg0->unk20 = phi_f6;
- sp88 = &gPlayers[temp_t6];
- func_802ADDC8(temp_f12, phi_f14, arg0 + 0x30, arg0->unkC + 1.0f, arg0->unk18, arg0->unk1C, arg0->unk20);
- func_802B4E30(arg0);
- if ((gPlayers[temp_t6].unk_000 & PLAYER_HUMAN) != 0) {
+ 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;
+ }
+ 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) {
if (D_800DC51C != 0) {
phi_v1 = gControllerOne;
} else {
- phi_v1 = &gControllers[arg0->unk10];
+ phi_v1 = &gControllers[banana->playerId];
}
- temp_a2 = phi_v1->unk8;
+ temp_a2 = phi_v1->buttonDepressed;
if ((temp_a2 & 0x2000) != 0) {
- phi_v1->unk8 = temp_a2 & 0xDFFF;
- arg0->unk6 = 1;
- arg0->unk4 = 0xB4;
- gPlayers[temp_t6].unk_00C &= 0xFFFBFFFF;
+ phi_v1->buttonDepressed = temp_a2 & 0xDFFF;
+ banana->state = 1;
+ banana->unk_04 = 0x00B4;
+ temp_v0->unk_00C &= 0xFFFBFFFF;
sp80 = phi_v1;
- sp88 = &gPlayers[temp_t6];
- func_800C9060(((&gPlayers[temp_t6] - gPlayerOne) / 3544) & 0xFF, 0x19008012, temp_a2);
- temp_f0_2 = phi_v1->unk2;
- if ((temp_f0_2 > 30.0f) && (temp_a0 = phi_v1->unk0, ((temp_a0 < 0xA) != 0)) && (temp_a0 >= -9)) {
- temp_f2_2 = gPlayers[temp_t6].unk_094;
- temp_f0_3 = ((temp_f0_2 - 30.0f) / 20.0f) + 0.5f;
- if (temp_f2_2 < 2.0f) {
- phi_f12 = 4.0f;
- } else {
- phi_f12 = (temp_f2_2 * 0.75f) + 3.5f + temp_f0_3;
+ 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;
+ } else {
+ phi_f12 = (temp_f2_2 * 0.75f) + 3.5f + temp_f0_3;
+ }
+ sp88 = temp_v0;
+ load_giant_egg(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;
}
- sp88 = &gPlayers[temp_t6];
- load_giant_egg(phi_f12, &sp68, 0, temp_f0_3, phi_f12);
- func_802B64C4(&sp68, gPlayers[temp_t6].unk_02E + gPlayers[temp_t6].unk_0C0);
- arg0->unk24 = sp68;
- arg0->unk28 = sp6C;
- arg0->unk2C = sp70;
- return;
}
- arg0->unk24 = 0.0f;
- arg0->unk2C = 0.0f;
- arg0->unk28 = 1.5f;
+ banana->velocity[0] = 0.0f;
+ banana->velocity[2] = 0.0f;
+ banana->velocity[1] = 1.5f;
return;
}
- /* Duplicate return node #45. Try simplifying control flow for better match */
+ } else {
+ default:
return;
}
- default:
- return;
+ break;
case 1:
- temp_v0 = arg0->unk4;
- if (temp_v0 != 0) {
- arg0->unk4 = temp_v0 - 1;
- if (arg0->unk4 == 0) {
- arg0->unk2 = arg0->unk2 & 0xEFFF;
+ temp_v0_2 = banana->unk_04;
+ if (temp_v0_2 != 0) {
+ banana->unk_04 = temp_v0_2 - 1;
+ if (banana->unk_04 == 0) {
+ banana->flags &= 0xEFFF;
}
}
- temp_f0_4 = arg0->unk28;
- arg0->unk18 = arg0->unk18 + arg0->unk24;
- arg0->unk20 = arg0->unk20 + arg0->unk2C;
+ temp_f0_4 = banana->velocity[1];
+ banana->pos[0] += banana->velocity[0];
+ banana->pos[2] += banana->velocity[2];
if (temp_f0_4 > -1.0f) {
- arg0->unk28 = temp_f0_4 - D_802B9EE4;
+ banana->velocity[1] = temp_f0_4 - D_802B9EE4;
}
- temp_f12_2 = arg0->unk20;
- arg0->unk1C = arg0->unk1C + arg0->unk28;
- if ((temp_f12_2 < D_8015F6F2) || (D_8015F6F0 < temp_f12_2) || (temp_f0_5 = arg0->unk18, (temp_f0_5 < D_8015F6EA)) || (D_8015F6E8 < temp_f0_5) || (temp_f2_3 = arg0->unk1C, (temp_f2_3 < D_8015F6EE))) {
- func_8029FDC8(temp_f12_2, arg0);
+ 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, arg0 + 0x30, (bitwise void *) (arg0->unkC + 1.0f), temp_f0_5, temp_f2_3, temp_f12_2);
- arg0->unk34 = 1;
- if (((1 & 0xFFFF) != 0) && (arg0->unk44 < 0.0f)) {
- sp74 = -arg0->unk60;
- sp78 = -arg0->unk64;
- sp7C = -arg0->unk68;
- temp_f0_6 = arg0->unk44;
- arg0->unk18 = arg0->unk18 + (sp74 * temp_f0_6);
- arg0->unk1C = arg0->unk1C + (sp78 * temp_f0_6);
- arg0->unk2 = arg0->unk2 & 0xEFFF;
- arg0->unk6 = 4;
- arg0->unk20 = arg0->unk20 + (sp7C * temp_f0_6);
+ 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;
}
- /* Duplicate return node #45. Try simplifying control flow for better match */
- return;
+ break;
case 2:
sp68 = 0.0f;
sp6C = 0.0f;
sp70 = -5.0f;
- sp88 = &gPlayers[temp_t6];
- func_802B64C4(&sp68, gPlayers[temp_t6].unk_02E + gPlayers[temp_t6].unk_0C0);
- temp_f18 = sp68 + gPlayers[temp_t6].pos[0];
- temp_f0_7 = sp6C + gPlayers[temp_t6].pos[1];
- temp_f10 = sp70 + gPlayers[temp_t6].pos[2];
+ 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 - arg0->unk18;
+ temp_f2_4 = temp_f18 - banana->pos[0];
sp3C = temp_f18;
sp38 = temp_f0_7;
- temp_f14_3 = temp_f0_7 - arg0->unk1C;
+ temp_f14_3 = temp_f0_7 - banana->pos[1];
sp48 = temp_f2_4;
- temp_f16_2 = temp_f10 - arg0->unk20;
+ 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), temp_f14_3);
+ 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;
- arg0->unk18 = gPlayers[temp_t6].pos[0] + temp_f0_9;
- arg0->unk1C = gPlayers[temp_t6].pos[1] + temp_f0_9;
- arg0->unk20 = gPlayers[temp_t6].pos[2] + temp_f0_9;
+ 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;
} else {
- arg0->unk18 = sp68 + (temp_f18 - (temp_f2_4 / temp_f0_8));
- arg0->unk1C = (sp38 - (temp_f14_3 / temp_f0_8)) - 2.0f;
- arg0->unk20 = sp34 - (temp_f16_2 / temp_f0_8);
+ 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);
}
- func_802ADDC8((bitwise f32) (arg0 + 0x30), (bitwise void *) (arg0->unkC + 1.0f), (bitwise void *) arg0->unk18, arg0->unk1C, arg0->unk20);
- func_802B4E30(arg0);
+ 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;
case 3:
- temp_v0_2 = (arg0->unk12 * 0x70) + &D_8015F9B8;
- temp_f2_5 = temp_v0_2->unk18 - arg0->unk18;
- temp_f14_4 = temp_v0_2->unk1C - arg0->unk1C;
+ temp_v0_3 = &D_8015F9B8[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_2->unk20 - arg0->unk20;
+ temp_f16_3 = temp_v0_3->pos[2] - banana->pos[2];
sp44 = temp_f14_4;
- sp84 = temp_v0_2;
+ 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), temp_f14_4) / 5.0f;
- phi_f14_2 = (bitwise void *) temp_f14_4;
+ 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;
- arg0->unk18 = temp_v0_2->unk18 + temp_f0_10;
- arg0->unk1C = temp_v0_2->unk1C + temp_f0_10;
- phi_f8 = temp_v0_2->unk20 + temp_f0_10;
+ 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;
} else {
temp_f14_5 = temp_f14_4 / temp_f12_3;
- arg0->unk18 = temp_v0_2->unk18 - (temp_f2_5 / temp_f12_3);
- arg0->unk1C = (temp_v0_2->unk1C - temp_f14_5) - 2.0f;
- phi_f8 = temp_v0_2->unk20 - (temp_f16_3 / temp_f12_3);
- phi_f14_2 = (bitwise void *) temp_f14_5;
- }
- arg0->unk20 = phi_f8;
- func_802ADDC8(temp_f12_3, phi_f14_2, arg0 + 0x30, arg0->unkC + 1.0f, arg0->unk18, arg0->unk1C, arg0->unk20);
- func_802B4E30(arg0);
+ 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;
+ }
+ 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;
case 5:
- arg0->unk28 = arg0->unk28 - D_802B9EF0;
- if (arg0->unk28 < -5.0f) {
- arg0->unk28 = -5.0f;
- }
- arg0->unk4 = arg0->unk4 - 1;
- arg0->unk1C = arg0->unk1C + arg0->unk28;
- arg0->unk10 = arg0->unk10 + 0x16C;
- arg0->unk12 = arg0->unk12 - 0x5B0;
- arg0->unk14 = arg0->unk14 + 0x38E;
- if (arg0->unk4 == 0) {
- func_8029E854(arg0);
+ banana->velocity[1] -= D_802B9EF0;
+ 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;
+ if (banana->unk_04 == 0) {
+ func_8029E854(banana);
return;
}
- /* Duplicate return node #45. Try simplifying control flow for better match */
- return;
+ break;
case 4:
- arg0->unk2 = arg0->unk2 | 0xC000;
- arg0->unk2 = arg0->unk2 & 0xEFFF;
- /* Duplicate return node #45. Try simplifying control flow for better match */
- return;
+ banana->flags |= 0xC000;
+ banana->flags &= 0xEFFF;
+ break;
}
}
#else
@@ -1292,15 +1288,14 @@ GLOBAL_ASM("asm/non_matchings/code_802B0210/update_obj_banana.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
-? func_800C9060(s32, ?, s32 *, s32); /* extern */
-s32 func_8029EC88(f32 *, s16 *, f32 *, ?); /* extern */
+//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 */
-extern ? D_8015F9B8;
-void func_802B2914(void *arg0, Player *player, s16 arg2) {
+void func_802B2914(struct banana_bunch_parent *banana_bunch, Player *player, s16 bananaId) {
s16 sp6E;
f32 sp68;
f32 sp64;
@@ -1315,14 +1310,14 @@ void func_802B2914(void *arg0, Player *player, s16 arg2) {
f32 *temp_a2;
s16 *temp_a1;
s16 temp_t6;
+ s16 temp_v0;
s32 temp_lo;
- s32 temp_v0;
void *temp_s0;
- void *phi_v0;
+ struct banana_actor *phi_v0;
sp4C = 0.0f;
- sp50 = -player->unk_070;
- sp54 = -(player->unk_070 + 4.0f);
+ sp50 = -player->boundingBoxSize;
+ sp54 = -(player->boundingBoxSize + 4.0f);
func_802B63B8(&sp4C, player->unk_174);
temp_a0 = &sp4C;
temp_a1 = &sp58;
@@ -1342,52 +1337,52 @@ void func_802B2914(void *arg0, Player *player, s16 arg2) {
temp_lo = temp_t6 * 0x70;
sp4C = player->pos[0];
sp50 = player->pos[1];
- temp_s0 = &D_8015F9B8 + temp_lo;
+ temp_s0 = D_8015F9B8 + temp_lo;
sp54 = player->pos[2];
sp6E = temp_t6;
func_802AD950(temp_s0 + 0x30, temp_s0->unkC + 1.0f, temp_s0->unk18, temp_s0->unk1C, temp_s0->unk20, sp4C, sp50, sp54);
func_802B4E30(temp_s0);
temp_s0->unk2 = -0x7000;
- temp_s0->unk10 = (player - gPlayerOne) / 3544;
- temp_s0->unk8 = (arg0 - &D_8015F9B8) / 112;
+ temp_s0->unk10 = (s16) ((s32) (player - gPlayerOne) / 3544);
+ temp_s0->unk8 = (s16) ((s32) (banana_bunch - D_8015F9B8) / 112);
temp_s0->unk14 = -1;
- temp_s0->unk4 = 0x14;
- temp_s0->unkA = arg2;
- switch (arg2) {
+ temp_s0->unk4 = 0x0014;
+ temp_s0->unkA = bananaId;
+ switch (bananaId) {
case 0:
temp_s0->unk6 = 2;
- arg0->unk12 = sp6E;
+ banana_bunch->bananaIndices[0] = sp6E;
temp_s0->unk12 = -1;
break;
case 1:
temp_s0->unk6 = 3;
- arg0->unk14 = sp6E;
- temp_s0->unk12 = arg0->unk12;
- phi_v0 = &D_8015F9B8 + (arg0->unk12 * 0x70);
+ banana_bunch->bananaIndices[1] = sp6E;
+ temp_s0->unk12 = (s16) banana_bunch->bananaIndices[0];
+ phi_v0 = &D_8015F9B8[banana_bunch->bananaIndices[0]];
block_8:
- phi_v0->unk14 = sp6E;
+ phi_v0->youngerIndex = sp6E;
break;
case 2:
temp_s0->unk6 = 3;
- arg0->unk16 = sp6E;
- temp_s0->unk12 = arg0->unk14;
- phi_v0 = &D_8015F9B8 + (arg0->unk14 * 0x70);
+ banana_bunch->bananaIndices[2] = sp6E;
+ temp_s0->unk12 = (s16) banana_bunch->bananaIndices[1];
+ phi_v0 = &D_8015F9B8[banana_bunch->bananaIndices[1]];
goto block_8;
case 3:
temp_s0->unk6 = 3;
- arg0->unk18 = sp6E;
- temp_s0->unk12 = arg0->unk16;
- phi_v0 = &D_8015F9B8 + (arg0->unk16 * 0x70);
+ banana_bunch->bananaIndices[3] = sp6E;
+ temp_s0->unk12 = (s16) banana_bunch->bananaIndices[2];
+ phi_v0 = &D_8015F9B8[banana_bunch->bananaIndices[2]];
goto block_8;
case 4:
temp_s0->unk6 = 3;
- arg0->unk1A = sp6E;
- temp_s0->unk12 = arg0->unk18;
- phi_v0 = &D_8015F9B8 + (arg0->unk18 * 0x70);
+ banana_bunch->bananaIndices[4] = sp6E;
+ temp_s0->unk12 = (s16) banana_bunch->bananaIndices[3];
+ phi_v0 = &D_8015F9B8[banana_bunch->bananaIndices[3]];
goto block_8;
}
- if ((player->unk_000 & PLAYER_HUMAN) != 0) {
- func_800C9060(((player - gPlayerOne) / 3544) & 0xFF, 0x19008012, &gPlayerOne, 0xDD8);
+ if ((player->unk_000 & 0x4000) != 0) {
+ func_800C9060(((s32) (player - gPlayerOne) / 3544) & 0xFF, 0x19008012, &gPlayerOne, 0xDD8);
}
}
}
@@ -1749,8 +1744,8 @@ void update_obj_green_shell(struct shell_actor *shell) {
temp_s1 = &gPlayers[shell->playerId];
func_802B0210(&temp_s1->unk_110, &shell->unk30);
sp6C = 0.0f;
- sp70 = temp_s1->unk_070;
- sp74 = -(temp_s1->unk_070 + shell->unk_0C + 2.0f);
+ sp70 = temp_s1->boundingBoxSize;
+ sp74 = -(temp_s1->boundingBoxSize + shell->boundingBoxSize + 2.0f);
func_802B63B8(&sp6C, temp_s1->unk_174);
shell->pos[0] = sp6C + temp_s1->pos[0];
temp_f14 = temp_s1->pos[1] - sp70;
@@ -1759,7 +1754,7 @@ void update_obj_green_shell(struct shell_actor *shell) {
temp_f0_2 = func_802ABE30(shell->pos[0], temp_f14, shell->pos[2], temp_s1->unk_110.unk3A);
temp_f2_2 = temp_f14 - temp_f0_2;
if ((temp_f2_2 < 5.0f) && (temp_f2_2 > -5.0f)) {
- shell->pos[1] = shell->unk_0C + temp_f0_2;
+ shell->pos[1] = shell->boundingBoxSize + temp_f0_2;
} else {
shell->pos[1] = temp_f14;
}
@@ -1836,7 +1831,7 @@ void update_obj_green_shell(struct shell_actor *shell) {
return;
}
sp6C = sins((u16) shell->rotAngle) * 6.0f;
- sp70 = shell->unk_0C - temp_s1_2->unk_070;
+ sp70 = shell->boundingBoxSize - temp_s1_2->boundingBoxSize;
sp74 = coss((u16) shell->rotAngle) * 6.0f;
func_802B63B8(&sp6C, temp_s1_2->unk_174);
shell->pos[0] = sp6C + temp_s1_2->pos[0];
@@ -1848,7 +1843,7 @@ void update_obj_green_shell(struct shell_actor *shell) {
if (temp_v0_3 > 0) {
shell->parentIndex = temp_v0_3 - 1;
if (shell->parentIndex == 0) {
- shell->unk_02 &= 0xEFFF;
+ shell->flags &= 0xEFFF;
}
}
shell->velocity[1] -= 0.5f;
@@ -1869,7 +1864,7 @@ void update_obj_green_shell(struct shell_actor *shell) {
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);
- shell->unk_02 |= 0x80;
+ shell->flags |= 0x80;
return;
}
break;
@@ -1883,7 +1878,7 @@ void update_obj_green_shell(struct shell_actor *shell) {
temp_t4 = shell->rotAngle + temp_v0_4->rotVelocity;
shell->rotAngle = temp_t4;
sp6C = sins(temp_t4 & 0xFFFF) * 8.0f;
- sp70 = shell->unk_0C - temp_s1_4->unk_070;
+ sp70 = shell->boundingBoxSize - temp_s1_4->boundingBoxSize;
sp74 = coss((u16) shell->rotAngle) * 8.0f;
func_802B63B8((bitwise f32 *) 8.0f, &sp6C, temp_s1_4->unk_174);
sp78 = shell->pos[0];
@@ -2036,14 +2031,14 @@ void func_802B3B44(struct shell_actor *shell) {
shell->pos[0] = temp_f2;
shell->pos[2] = temp_f28;
shell->rotAngle = phi_a2;
- shell->pos[1] = shell->unk_0C + temp_f12;
+ shell->pos[1] = shell->boundingBoxSize + temp_f12;
return;
}
temp_f16_3 = (f32) temp_v0_3->unk0;
temp_f18_3 = (f32) temp_v0_3->unk2;
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->unk_0C;
+ shell->pos[1] = ((temp_f12 + temp_f18_3) * 0.5f) + shell->boundingBoxSize;
shell->pos[2] = (temp_f28 + temp_f26) * 0.5f;
shell->velocity[0] = (temp_f16_3 - temp_f2) * 0.5f;
shell->velocity[1] = (temp_f18_3 - temp_f12) * 0.5f;
@@ -2259,8 +2254,8 @@ void update_obj_red_blue_shell(struct shell_actor *shell) {
temp_s1 = &gPlayers[shell->playerId];
func_802B0210(&temp_s1->unk_110, &shell->unk30);
sp8C = 0.0f;
- sp90 = temp_s1->unk_070;
- sp94 = -(temp_s1->unk_070 + shell->unk_0C + 2.0f);
+ sp90 = temp_s1->boundingBoxSize;
+ sp94 = -(temp_s1->boundingBoxSize + shell->boundingBoxSize + 2.0f);
func_802B63B8(&sp8C, temp_s1->unk_174);
shell->pos[0] = sp8C + temp_s1->pos[0];
temp_f14 = temp_s1->pos[1] - sp90;
@@ -2269,7 +2264,7 @@ void update_obj_red_blue_shell(struct shell_actor *shell) {
temp_f0_2 = func_802ABE30(shell->pos[0], temp_f14, shell->pos[2], temp_s1->unk_110.unk3A);
temp_f2_2 = temp_f14 - temp_f0_2;
if ((temp_f2_2 < 5.0f) && (temp_f2_2 > -5.0f)) {
- shell->pos[1] = shell->unk_0C + temp_f0_2;
+ shell->pos[1] = shell->boundingBoxSize + temp_f0_2;
} else {
shell->pos[1] = temp_f14;
}
@@ -2343,7 +2338,7 @@ block_16:
return;
}
sp8C = sins((u16) shell->rotAngle) * 8.0f;
- sp90 = shell->unk_0C - temp_s1_2->unk_070;
+ sp90 = shell->boundingBoxSize - temp_s1_2->boundingBoxSize;
sp94 = coss((u16) shell->rotAngle) * 8.0f;
func_802B63B8(&sp8C, temp_s1_2->unk_174);
shell->pos[0] = sp8C + temp_s1_2->pos[0];
@@ -2354,7 +2349,7 @@ block_16:
shell->parentIndex += -1;
temp_s1_3 = &gPlayers[shell->playerId];
if (shell->parentIndex == 0) {
- shell->unk_02 &= 0xEFFF;
+ shell->flags &= 0xEFFF;
if (shell->type == 0x002A) {
shell->state = 8;
shell->parentIndex = gPlayerPositionLUT;
@@ -2370,7 +2365,7 @@ block_16:
shell->unk_08 = 1000.0f;
shell->parentIndex = func_802B3FD0(temp_s1_3, shell);
if (shell->parentIndex < 0) {
- shell->unk_02 = -0x8000;
+ shell->flags = -0x8000;
shell->rotAngle = 0;
shell->parentIndex = 0x003C;
shell->state = 7;
@@ -2429,7 +2424,7 @@ block_16:
func_802B3B44(shell);
temp_v0_6 = shell->parentIndex;
if (temp_v0_6 == 0) {
- if ((shell->unk_02 & 0xF) == 0) {
+ if ((shell->flags & 0xF) == 0) {
func_8029FDC8((bitwise f32) shell);
return;
}
@@ -2457,7 +2452,7 @@ block_16:
temp_t6 = shell->rotAngle + temp_v0_7->rotVelocity;
shell->rotAngle = temp_t6;
sp8C = sins(temp_t6 & 0xFFFF) * 8.0f;
- sp90 = shell->unk_0C - temp_s1_5->unk_070;
+ sp90 = shell->boundingBoxSize - temp_s1_5->boundingBoxSize;
sp94 = coss((u16) shell->rotAngle) * 8.0f;
func_802B63B8(&sp8C, temp_s1_5->unk_174);
sp38 = shell->pos[0];
diff --git a/src/kart_attributes.inc.c b/src/kart_attributes.inc.c
index 12a30fef4..220a4aafe 100644
--- a/src/kart_attributes.inc.c
+++ b/src/kart_attributes.inc.c
@@ -93,7 +93,7 @@ f32 D_800E2670[] = {
f32 gKartTopSpeedTable[] = {
9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0,
};
-f32 gKartBoundingBoxTable[] = {
+f32 gKartBoundingBoxSizeTable[] = {
5.5, 5.5, 5.5, 5.5, 5.5, 6.0, 5.5, 6.0,
};
diff --git a/src/memory.c b/src/memory.c
index c10ad0cca..ad0bce1f8 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -4475,7 +4475,7 @@ s32 func_802AFA34(Player *player, kartBoundingBoxCorner *corner, f32 cornerX, f3
sp104 = 0x447A0000;
sp108 = 0x447A0000;
sp10C = 0x447A0000;
- temp_f20 = player->unk_070;
+ temp_f20 = player->boundingBoxSize;
spFE = 0x1388;
sp100 = 0x1388;
sp102 = 0x1388;