diff --git a/asm/non_matchings/objects/func_80010994.s b/asm/non_matchings/objects/func_80010994.s index ae348c60..a26aae2a 100644 --- a/asm/non_matchings/objects/func_80010994.s +++ b/asm/non_matchings/objects/func_80010994.s @@ -354,7 +354,7 @@ glabel func_80010994 /* 011A9C 80010E9C 310A8000 */ andi $t2, $t0, 0x8000 /* 011AA0 80010EA0 11400005 */ beqz $t2, .L80010EB8 /* 011AA4 80010EA4 00000000 */ nop -/* 011AA8 80010EA8 0C02C8BF */ jal func_800B22FC +/* 011AA8 80010EA8 0C02C8BF */ jal handle_particle_movement /* 011AAC 80010EAC AFA20044 */ sw $v0, 0x44($sp) /* 011AB0 80010EB0 8FA20044 */ lw $v0, 0x44($sp) /* 011AB4 80010EB4 00000000 */ nop diff --git a/asm/non_matchings/objects/spawn_object.s b/asm/non_matchings/objects/spawn_object.s index 0f1deef8..de7dbebc 100644 --- a/asm/non_matchings/objects/spawn_object.s +++ b/asm/non_matchings/objects/spawn_object.s @@ -470,7 +470,7 @@ glabel L8000EDE0 /* 00FCF8 8000F0F8 02402025 */ move $a0, $s2 /* 00FCFC 8000F0FC 000A5880 */ sll $t3, $t2, 2 /* 00FD00 8000F100 032B2821 */ addu $a1, $t9, $t3 -/* 00FD04 8000F104 0C008D77 */ jal func_800235DC +/* 00FD04 8000F104 0C008D77 */ jal get_object_property_size /* 00FD08 8000F108 AFA50048 */ sw $a1, 0x48($sp) /* 00FD0C 8000F10C 8FAC0050 */ lw $t4, 0x50($sp) /* 00FD10 8000F110 3C018012 */ lui $at, %hi(D_8011AE50) # $at, 0x8012 diff --git a/asm/non_matchings/particles/func_800AE728.s b/asm/non_matchings/particles/func_800AE728.s index d5c4c1f2..39286fc4 100644 --- a/asm/non_matchings/particles/func_800AE728.s +++ b/asm/non_matchings/particles/func_800AE728.s @@ -193,7 +193,7 @@ glabel func_800AE728 /* 0AF5F8 800AE9F8 02602825 */ move $a1, $s3 /* 0AF5FC 800AE9FC 01F0C021 */ addu $t8, $t7, $s0 /* 0AF600 800AEA00 8F040044 */ lw $a0, 0x44($t8) -/* 0AF604 800AEA04 0C02BB85 */ jal func_800AEE14 +/* 0AF604 800AEA04 0C02BB85 */ jal generate_particle_shape_triangle /* 0AF608 800AEA08 02803025 */ move $a2, $s4 /* 0AF60C 800AEA0C 3C19800E */ lui $t9, %hi(D_800E2E4C) # $t9, 0x800e /* 0AF610 800AEA10 8F392E4C */ lw $t9, %lo(D_800E2E4C)($t9) @@ -225,7 +225,7 @@ glabel func_800AE728 /* 0AF670 800AEA70 02602825 */ move $a1, $s3 /* 0AF674 800AEA74 01F0C021 */ addu $t8, $t7, $s0 /* 0AF678 800AEA78 8F040044 */ lw $a0, 0x44($t8) -/* 0AF67C 800AEA7C 0C02BBAE */ jal func_800AEEB8 +/* 0AF67C 800AEA7C 0C02BBAE */ jal generate_particle_shape_quad /* 0AF680 800AEA80 02803025 */ move $a2, $s4 /* 0AF684 800AEA84 3C19800E */ lui $t9, %hi(D_800E2E50) # $t9, 0x800e /* 0AF688 800AEA88 8F392E50 */ lw $t9, %lo(D_800E2E50)($t9) diff --git a/asm/non_matchings/particles/func_800AF714.s b/asm/non_matchings/particles/func_800AF714.s index 98bd3390..9de92709 100644 --- a/asm/non_matchings/particles/func_800AF714.s +++ b/asm/non_matchings/particles/func_800AF714.s @@ -1,364 +1,364 @@ -glabel func_800AF714 -/* 0B0314 800AF714 27BDFF80 */ addiu $sp, $sp, -0x80 -/* 0B0318 800AF718 AFBF003C */ sw $ra, 0x3c($sp) -/* 0B031C 800AF71C AFBE0038 */ sw $fp, 0x38($sp) -/* 0B0320 800AF720 AFB70034 */ sw $s7, 0x34($sp) -/* 0B0324 800AF724 AFB60030 */ sw $s6, 0x30($sp) -/* 0B0328 800AF728 AFB5002C */ sw $s5, 0x2c($sp) -/* 0B032C 800AF72C AFB40028 */ sw $s4, 0x28($sp) -/* 0B0330 800AF730 AFB30024 */ sw $s3, 0x24($sp) -/* 0B0334 800AF734 AFB20020 */ sw $s2, 0x20($sp) -/* 0B0338 800AF738 AFB1001C */ sw $s1, 0x1c($sp) -/* 0B033C 800AF73C AFB00018 */ sw $s0, 0x18($sp) -/* 0B0340 800AF740 AFA50084 */ sw $a1, 0x84($sp) -/* 0B0344 800AF744 8C930064 */ lw $s3, 0x64($a0) -/* 0B0348 800AF748 8C970074 */ lw $s7, 0x74($a0) -/* 0B034C 800AF74C 827E01D6 */ lb $fp, 0x1d6($s3) -/* 0B0350 800AF750 00809025 */ move $s2, $a0 -/* 0B0354 800AF754 0C004B8A */ jal object_do_player_tumble -/* 0B0358 800AF758 00008025 */ move $s0, $zero -/* 0B035C 800AF75C 8E4E0040 */ lw $t6, 0x40($s2) -/* 0B0360 800AF760 24160002 */ li $s6, 2 -/* 0B0364 800AF764 81CF0057 */ lb $t7, 0x57($t6) -/* 0B0368 800AF768 241500FF */ li $s5, 255 -/* 0B036C 800AF76C 19E00125 */ blez $t7, .L800AFC04 -/* 0B0370 800AF770 3C14800E */ lui $s4, %hi(D_800E2E84) # $s4, 0x800e -/* 0B0374 800AF774 3C11800E */ lui $s1, %hi(D_800E2D00) # $s1, 0x800e -/* 0B0378 800AF778 26312D00 */ addiu $s1, %lo(D_800E2D00) # addiu $s1, $s1, 0x2d00 -/* 0B037C 800AF77C 26942E84 */ addiu $s4, %lo(D_800E2E84) # addiu $s4, $s4, 0x2e84 -.L800AF780: -/* 0B0380 800AF780 32F80001 */ andi $t8, $s7, 1 -/* 0B0384 800AF784 130000E8 */ beqz $t8, .L800AFB28 -/* 0B0388 800AF788 00000000 */ nop -/* 0B038C 800AF78C 13C00008 */ beqz $fp, .L800AF7B0 -/* 0B0390 800AF790 240B0001 */ li $t3, 1 -/* 0B0394 800AF794 24010001 */ li $at, 1 -/* 0B0398 800AF798 13C10099 */ beq $fp, $at, .L800AFA00 -/* 0B039C 800AF79C 00000000 */ nop -/* 0B03A0 800AF7A0 13D60083 */ beq $fp, $s6, .L800AF9B0 -/* 0B03A4 800AF7A4 00000000 */ nop -/* 0B03A8 800AF7A8 100000AA */ b .L800AFA54 -/* 0B03AC 800AF7AC 00000000 */ nop -.L800AF7B0: -/* 0B03B0 800AF7B0 0600004C */ bltz $s0, .L800AF8E4 -/* 0B03B4 800AF7B4 2A01000A */ slti $at, $s0, 0xa -/* 0B03B8 800AF7B8 1020004B */ beqz $at, .L800AF8E8 -/* 0B03BC 800AF7BC 2401000A */ li $at, 10 -/* 0B03C0 800AF7C0 8662016E */ lh $v0, 0x16e($s3) -/* 0B03C4 800AF7C4 00106140 */ sll $t4, $s0, 5 -/* 0B03C8 800AF7C8 04410002 */ bgez $v0, .L800AF7D4 -/* 0B03CC 800AF7CC 3C18800E */ lui $t8, %hi(gParticlesAssetTable) # $t8, 0x800e -/* 0B03D0 800AF7D0 00021023 */ negu $v0, $v0 -.L800AF7D4: -/* 0B03D4 800AF7D4 2442FFE8 */ addiu $v0, $v0, -0x18 -/* 0B03D8 800AF7D8 1840009E */ blez $v0, .L800AFA54 -/* 0B03DC 800AF7DC 28410021 */ slti $at, $v0, 0x21 -/* 0B03E0 800AF7E0 8E59006C */ lw $t9, 0x6c($s2) -/* 0B03E4 800AF7E4 8F182CF0 */ lw $t8, %lo(gParticlesAssetTable)($t8) -/* 0B03E8 800AF7E8 032C6821 */ addu $t5, $t9, $t4 -/* 0B03EC 800AF7EC 85AE0008 */ lh $t6, 8($t5) -/* 0B03F0 800AF7F0 3C0D800E */ lui $t5, %hi(D_800E2EC4) # $t5, 0x800e -/* 0B03F4 800AF7F4 000E7880 */ sll $t7, $t6, 2 -/* 0B03F8 800AF7F8 25AD2EC4 */ addiu $t5, %lo(D_800E2EC4) # addiu $t5, $t5, 0x2ec4 -/* 0B03FC 800AF7FC 00106080 */ sll $t4, $s0, 2 -/* 0B0400 800AF800 030FC821 */ addu $t9, $t8, $t7 -/* 0B0404 800AF804 8F270000 */ lw $a3, ($t9) -/* 0B0408 800AF808 018D4021 */ addu $t0, $t4, $t5 -/* 0B040C 800AF80C 14200002 */ bnez $at, .L800AF818 -/* 0B0410 800AF810 250A0003 */ addiu $t2, $t0, 3 -/* 0B0414 800AF814 24020020 */ li $v0, 32 -.L800AF818: -/* 0B0418 800AF818 00420019 */ multu $v0, $v0 -/* 0B041C 800AF81C 90E40014 */ lbu $a0, 0x14($a3) -/* 0B0420 800AF820 910F0000 */ lbu $t7, ($t0) -/* 0B0424 800AF824 00024900 */ sll $t1, $v0, 4 -/* 0B0428 800AF828 01E4C823 */ subu $t9, $t7, $a0 -/* 0B042C 800AF82C 28410011 */ slti $at, $v0, 0x11 -/* 0B0430 800AF830 00007012 */ mflo $t6 -/* 0B0434 800AF834 000EC083 */ sra $t8, $t6, 2 -/* 0B0438 800AF838 01381823 */ subu $v1, $t1, $t8 -/* 0B043C 800AF83C 03230019 */ multu $t9, $v1 -/* 0B0440 800AF840 91190001 */ lbu $t9, 1($t0) -/* 0B0444 800AF844 00006012 */ mflo $t4 -/* 0B0448 800AF848 000C6A03 */ sra $t5, $t4, 8 -/* 0B044C 800AF84C 01A47021 */ addu $t6, $t5, $a0 -/* 0B0450 800AF850 000E7E00 */ sll $t7, $t6, 0x18 -/* 0B0454 800AF854 AE2F0000 */ sw $t7, ($s1) -/* 0B0458 800AF858 90E50015 */ lbu $a1, 0x15($a3) -/* 0B045C 800AF85C 00000000 */ nop -/* 0B0460 800AF860 03256023 */ subu $t4, $t9, $a1 -/* 0B0464 800AF864 01830019 */ multu $t4, $v1 -/* 0B0468 800AF868 00006812 */ mflo $t5 -/* 0B046C 800AF86C 000D7203 */ sra $t6, $t5, 8 -/* 0B0470 800AF870 00AEC021 */ addu $t8, $a1, $t6 -/* 0B0474 800AF874 0018CC00 */ sll $t9, $t8, 0x10 -/* 0B0478 800AF878 01F96825 */ or $t5, $t7, $t9 -/* 0B047C 800AF87C AE2D0000 */ sw $t5, ($s1) -/* 0B0480 800AF880 90E60016 */ lbu $a2, 0x16($a3) -/* 0B0484 800AF884 910E0002 */ lbu $t6, 2($t0) -/* 0B0488 800AF888 00000000 */ nop -/* 0B048C 800AF88C 01C6C023 */ subu $t8, $t6, $a2 -/* 0B0490 800AF890 03030019 */ multu $t8, $v1 -/* 0B0494 800AF894 00007812 */ mflo $t7 -/* 0B0498 800AF898 000FCA03 */ sra $t9, $t7, 8 -/* 0B049C 800AF89C 00D96021 */ addu $t4, $a2, $t9 -/* 0B04A0 800AF8A0 000C7200 */ sll $t6, $t4, 8 -/* 0B04A4 800AF8A4 01AEC025 */ or $t8, $t5, $t6 -/* 0B04A8 800AF8A8 14200002 */ bnez $at, .L800AF8B4 -/* 0B04AC 800AF8AC AE380000 */ sw $t8, ($s1) -/* 0B04B0 800AF8B0 24090100 */ li $t1, 256 -.L800AF8B4: -/* 0B04B4 800AF8B4 90E20017 */ lbu $v0, 0x17($a3) -/* 0B04B8 800AF8B8 91590000 */ lbu $t9, ($t2) -/* 0B04BC 800AF8BC 8E2F0000 */ lw $t7, ($s1) -/* 0B04C0 800AF8C0 03226023 */ subu $t4, $t9, $v0 -/* 0B04C4 800AF8C4 01890019 */ multu $t4, $t1 -/* 0B04C8 800AF8C8 3C01800E */ lui $at, %hi(D_800E2D00) # $at, 0x800e -/* 0B04CC 800AF8CC 00006812 */ mflo $t5 -/* 0B04D0 800AF8D0 000D7203 */ sra $t6, $t5, 8 -/* 0B04D4 800AF8D4 004EC021 */ addu $t8, $v0, $t6 -/* 0B04D8 800AF8D8 01F8C825 */ or $t9, $t7, $t8 -/* 0B04DC 800AF8DC 1000005D */ b .L800AFA54 -/* 0B04E0 800AF8E0 AC392D00 */ sw $t9, %lo(D_800E2D00)($at) -.L800AF8E4: -/* 0B04E4 800AF8E4 2401000A */ li $at, 10 -.L800AF8E8: -/* 0B04E8 800AF8E8 12010009 */ beq $s0, $at, .L800AF910 -/* 0B04EC 800AF8EC 2401000B */ li $at, 11 -/* 0B04F0 800AF8F0 12010011 */ beq $s0, $at, .L800AF938 -/* 0B04F4 800AF8F4 2401000C */ li $at, 12 -/* 0B04F8 800AF8F8 12010019 */ beq $s0, $at, .L800AF960 -/* 0B04FC 800AF8FC 2401000D */ li $at, 13 -/* 0B0500 800AF900 12010021 */ beq $s0, $at, .L800AF988 -/* 0B0504 800AF904 00000000 */ nop -/* 0B0508 800AF908 10000052 */ b .L800AFA54 -/* 0B050C 800AF90C 00000000 */ nop -.L800AF910: -/* 0B0510 800AF910 926201DE */ lbu $v0, 0x1de($s3) -/* 0B0514 800AF914 00000000 */ nop -/* 0B0518 800AF918 16A20002 */ bne $s5, $v0, .L800AF924 -/* 0B051C 800AF91C 304C000F */ andi $t4, $v0, 0xf -/* 0B0520 800AF920 00005825 */ move $t3, $zero -.L800AF924: -/* 0B0524 800AF924 000C6880 */ sll $t5, $t4, 2 -/* 0B0528 800AF928 028D7021 */ addu $t6, $s4, $t5 -/* 0B052C 800AF92C 8DCF0000 */ lw $t7, ($t6) -/* 0B0530 800AF930 10000048 */ b .L800AFA54 -/* 0B0534 800AF934 AE2F0000 */ sw $t7, ($s1) -.L800AF938: -/* 0B0538 800AF938 926201DF */ lbu $v0, 0x1df($s3) -/* 0B053C 800AF93C 00000000 */ nop -/* 0B0540 800AF940 16A20002 */ bne $s5, $v0, .L800AF94C -/* 0B0544 800AF944 3058000F */ andi $t8, $v0, 0xf -/* 0B0548 800AF948 00005825 */ move $t3, $zero -.L800AF94C: -/* 0B054C 800AF94C 0018C880 */ sll $t9, $t8, 2 -/* 0B0550 800AF950 02996021 */ addu $t4, $s4, $t9 -/* 0B0554 800AF954 8D8D0000 */ lw $t5, ($t4) -/* 0B0558 800AF958 1000003E */ b .L800AFA54 -/* 0B055C 800AF95C AE2D0000 */ sw $t5, ($s1) -.L800AF960: -/* 0B0560 800AF960 926201DC */ lbu $v0, 0x1dc($s3) -/* 0B0564 800AF964 00000000 */ nop -/* 0B0568 800AF968 16A20002 */ bne $s5, $v0, .L800AF974 -/* 0B056C 800AF96C 304E000F */ andi $t6, $v0, 0xf -/* 0B0570 800AF970 00005825 */ move $t3, $zero -.L800AF974: -/* 0B0574 800AF974 000E7880 */ sll $t7, $t6, 2 -/* 0B0578 800AF978 028FC021 */ addu $t8, $s4, $t7 -/* 0B057C 800AF97C 8F190000 */ lw $t9, ($t8) -/* 0B0580 800AF980 10000034 */ b .L800AFA54 -/* 0B0584 800AF984 AE390000 */ sw $t9, ($s1) -.L800AF988: -/* 0B0588 800AF988 926201DD */ lbu $v0, 0x1dd($s3) -/* 0B058C 800AF98C 00000000 */ nop -/* 0B0590 800AF990 16A20002 */ bne $s5, $v0, .L800AF99C -/* 0B0594 800AF994 304C000F */ andi $t4, $v0, 0xf -/* 0B0598 800AF998 00005825 */ move $t3, $zero -.L800AF99C: -/* 0B059C 800AF99C 000C6880 */ sll $t5, $t4, 2 -/* 0B05A0 800AF9A0 028D7021 */ addu $t6, $s4, $t5 -/* 0B05A4 800AF9A4 8DCF0000 */ lw $t7, ($t6) -/* 0B05A8 800AF9A8 1000002A */ b .L800AFA54 -/* 0B05AC 800AF9AC AE2F0000 */ sw $t7, ($s1) -.L800AF9B0: -/* 0B05B0 800AF9B0 16000009 */ bnez $s0, .L800AF9D8 -/* 0B05B4 800AF9B4 24010001 */ li $at, 1 -/* 0B05B8 800AF9B8 927801DC */ lbu $t8, 0x1dc($s3) -/* 0B05BC 800AF9BC 00000000 */ nop -/* 0B05C0 800AF9C0 3319000F */ andi $t9, $t8, 0xf -/* 0B05C4 800AF9C4 00196080 */ sll $t4, $t9, 2 -/* 0B05C8 800AF9C8 028C6821 */ addu $t5, $s4, $t4 -/* 0B05CC 800AF9CC 8DAE0000 */ lw $t6, ($t5) -/* 0B05D0 800AF9D0 10000020 */ b .L800AFA54 -/* 0B05D4 800AF9D4 AE2E0000 */ sw $t6, ($s1) -.L800AF9D8: -/* 0B05D8 800AF9D8 1601001E */ bne $s0, $at, .L800AFA54 -/* 0B05DC 800AF9DC 00000000 */ nop -/* 0B05E0 800AF9E0 926F01DD */ lbu $t7, 0x1dd($s3) -/* 0B05E4 800AF9E4 00000000 */ nop -/* 0B05E8 800AF9E8 31F8000F */ andi $t8, $t7, 0xf -/* 0B05EC 800AF9EC 0018C880 */ sll $t9, $t8, 2 -/* 0B05F0 800AF9F0 02996021 */ addu $t4, $s4, $t9 -/* 0B05F4 800AF9F4 8D8D0000 */ lw $t5, ($t4) -/* 0B05F8 800AF9F8 10000016 */ b .L800AFA54 -/* 0B05FC 800AF9FC AE2D0000 */ sw $t5, ($s1) -.L800AFA00: -/* 0B0600 800AFA00 12160003 */ beq $s0, $s6, .L800AFA10 -/* 0B0604 800AFA04 24010003 */ li $at, 3 -/* 0B0608 800AFA08 16010012 */ bne $s0, $at, .L800AFA54 -/* 0B060C 800AFA0C 00000000 */ nop -.L800AFA10: -/* 0B0610 800AFA10 826E0002 */ lb $t6, 2($s3) -/* 0B0614 800AFA14 3C198012 */ lui $t9, %hi(D_80127C88) # $t9, 0x8012 -/* 0B0618 800AFA18 31CF0007 */ andi $t7, $t6, 7 -/* 0B061C 800AFA1C 000FC040 */ sll $t8, $t7, 1 -/* 0B0620 800AFA20 27397C88 */ addiu $t9, %lo(D_80127C88) # addiu $t9, $t9, 0x7c88 -/* 0B0624 800AFA24 8FAC0084 */ lw $t4, 0x84($sp) -/* 0B0628 800AFA28 03191821 */ addu $v1, $t8, $t9 -/* 0B062C 800AFA2C 84620000 */ lh $v0, ($v1) -/* 0B0630 800AFA30 000C6880 */ sll $t5, $t4, 2 -/* 0B0634 800AFA34 004D1021 */ addu $v0, $v0, $t5 -/* 0B0638 800AFA38 28410101 */ slti $at, $v0, 0x101 -/* 0B063C 800AFA3C 14200002 */ bnez $at, .L800AFA48 -/* 0B0640 800AFA40 00000000 */ nop -/* 0B0644 800AFA44 24020100 */ li $v0, 256 -.L800AFA48: -/* 0B0648 800AFA48 A4620000 */ sh $v0, ($v1) -/* 0B064C 800AFA4C 3C01800E */ lui $at, %hi(D_800E2EEC) # $at, 0x800e -/* 0B0650 800AFA50 AC222EEC */ sw $v0, %lo(D_800E2EEC)($at) -.L800AFA54: -/* 0B0654 800AFA54 11600060 */ beqz $t3, .L800AFBD8 -/* 0B0658 800AFA58 00000000 */ nop -/* 0B065C 800AFA5C 8E46006C */ lw $a2, 0x6c($s2) -/* 0B0660 800AFA60 00103940 */ sll $a3, $s0, 5 -/* 0B0664 800AFA64 00C71021 */ addu $v0, $a2, $a3 -/* 0B0668 800AFA68 84430004 */ lh $v1, 4($v0) -/* 0B066C 800AFA6C 02402025 */ move $a0, $s2 -/* 0B0670 800AFA70 306E8000 */ andi $t6, $v1, 0x8000 -/* 0B0674 800AFA74 15C00009 */ bnez $t6, .L800AFA9C -/* 0B0678 800AFA78 02002825 */ move $a1, $s0 -/* 0B067C 800AFA7C 0C02BD4B */ jal func_800AF52C -/* 0B0680 800AFA80 AFA70044 */ sw $a3, 0x44($sp) -/* 0B0684 800AFA84 8FA70044 */ lw $a3, 0x44($sp) -/* 0B0688 800AFA88 8E46006C */ lw $a2, 0x6c($s2) -/* 0B068C 800AFA8C 00000000 */ nop -/* 0B0690 800AFA90 00C71021 */ addu $v0, $a2, $a3 -/* 0B0694 800AFA94 84430004 */ lh $v1, 4($v0) -/* 0B0698 800AFA98 00000000 */ nop -.L800AFA9C: -/* 0B069C 800AFA9C 306F4000 */ andi $t7, $v1, 0x4000 -/* 0B06A0 800AFAA0 11E00007 */ beqz $t7, .L800AFAC0 -/* 0B06A4 800AFAA4 30790400 */ andi $t9, $v1, 0x400 -/* 0B06A8 800AFAA8 0010C140 */ sll $t8, $s0, 5 -/* 0B06AC 800AFAAC 00D82821 */ addu $a1, $a2, $t8 -/* 0B06B0 800AFAB0 0C02BF97 */ jal func_800AFE5C -/* 0B06B4 800AFAB4 02402025 */ move $a0, $s2 -/* 0B06B8 800AFAB8 10000048 */ b .L800AFBDC -/* 0B06BC 800AFABC AE200000 */ sw $zero, ($s1) -.L800AFAC0: -/* 0B06C0 800AFAC0 13200006 */ beqz $t9, .L800AFADC -/* 0B06C4 800AFAC4 02402025 */ move $a0, $s2 -/* 0B06C8 800AFAC8 00106140 */ sll $t4, $s0, 5 -/* 0B06CC 800AFACC 0C02BF97 */ jal func_800AFE5C -/* 0B06D0 800AFAD0 00CC2821 */ addu $a1, $a2, $t4 -/* 0B06D4 800AFAD4 10000041 */ b .L800AFBDC -/* 0B06D8 800AFAD8 AE200000 */ sw $zero, ($s1) -.L800AFADC: -/* 0B06DC 800AFADC 844D000A */ lh $t5, 0xa($v0) -/* 0B06E0 800AFAE0 8FAE0084 */ lw $t6, 0x84($sp) -/* 0B06E4 800AFAE4 02402025 */ move $a0, $s2 -/* 0B06E8 800AFAE8 01AE7821 */ addu $t7, $t5, $t6 -/* 0B06EC 800AFAEC A44F000A */ sh $t7, 0xa($v0) -/* 0B06F0 800AFAF0 8E46006C */ lw $a2, 0x6c($s2) -/* 0B06F4 800AFAF4 00106940 */ sll $t5, $s0, 5 -/* 0B06F8 800AFAF8 00C71021 */ addu $v0, $a2, $a3 -/* 0B06FC 800AFAFC 8C590000 */ lw $t9, ($v0) -/* 0B0700 800AFB00 8458000A */ lh $t8, 0xa($v0) -/* 0B0704 800AFB04 872C0040 */ lh $t4, 0x40($t9) -/* 0B0708 800AFB08 00000000 */ nop -/* 0B070C 800AFB0C 030C082A */ slt $at, $t8, $t4 -/* 0B0710 800AFB10 14200031 */ bnez $at, .L800AFBD8 -/* 0B0714 800AFB14 00000000 */ nop -/* 0B0718 800AFB18 0C02BF97 */ jal func_800AFE5C -/* 0B071C 800AFB1C 00CD2821 */ addu $a1, $a2, $t5 -/* 0B0720 800AFB20 1000002E */ b .L800AFBDC -/* 0B0724 800AFB24 AE200000 */ sw $zero, ($s1) -.L800AFB28: -/* 0B0728 800AFB28 8E46006C */ lw $a2, 0x6c($s2) -/* 0B072C 800AFB2C 00107140 */ sll $t6, $s0, 5 -/* 0B0730 800AFB30 00CE1021 */ addu $v0, $a2, $t6 -/* 0B0734 800AFB34 84430004 */ lh $v1, 4($v0) -/* 0B0738 800AFB38 00000000 */ nop -/* 0B073C 800AFB3C 306F8000 */ andi $t7, $v1, 0x8000 -/* 0B0740 800AFB40 11E00025 */ beqz $t7, .L800AFBD8 -/* 0B0744 800AFB44 30794000 */ andi $t9, $v1, 0x4000 -/* 0B0748 800AFB48 13200009 */ beqz $t9, .L800AFB70 -/* 0B074C 800AFB4C 306C0400 */ andi $t4, $v1, 0x400 -/* 0B0750 800AFB50 0010C140 */ sll $t8, $s0, 5 -/* 0B0754 800AFB54 00D81021 */ addu $v0, $a2, $t8 -/* 0B0758 800AFB58 A0400006 */ sb $zero, 6($v0) -/* 0B075C 800AFB5C 02402025 */ move $a0, $s2 -/* 0B0760 800AFB60 0C02BDB9 */ jal func_800AF6E4 -/* 0B0764 800AFB64 02002825 */ move $a1, $s0 -/* 0B0768 800AFB68 10000011 */ b .L800AFBB0 -/* 0B076C 800AFB6C 00000000 */ nop -.L800AFB70: -/* 0B0770 800AFB70 1180000D */ beqz $t4, .L800AFBA8 -/* 0B0774 800AFB74 02402025 */ move $a0, $s2 -/* 0B0778 800AFB78 00106940 */ sll $t5, $s0, 5 -/* 0B077C 800AFB7C 346E0200 */ ori $t6, $v1, 0x200 -/* 0B0780 800AFB80 00CD2021 */ addu $a0, $a2, $t5 -/* 0B0784 800AFB84 A44E0004 */ sh $t6, 4($v0) -/* 0B0788 800AFB88 908F0006 */ lbu $t7, 6($a0) -/* 0B078C 800AFB8C 02402025 */ move $a0, $s2 -/* 0B0790 800AFB90 15E00007 */ bnez $t7, .L800AFBB0 -/* 0B0794 800AFB94 00000000 */ nop -/* 0B0798 800AFB98 0C02BDB9 */ jal func_800AF6E4 -/* 0B079C 800AFB9C 02002825 */ move $a1, $s0 -/* 0B07A0 800AFBA0 10000003 */ b .L800AFBB0 -/* 0B07A4 800AFBA4 00000000 */ nop -.L800AFBA8: -/* 0B07A8 800AFBA8 0C02BDB9 */ jal func_800AF6E4 -/* 0B07AC 800AFBAC 02002825 */ move $a1, $s0 -.L800AFBB0: -/* 0B07B0 800AFBB0 12160003 */ beq $s0, $s6, .L800AFBC0 -/* 0B07B4 800AFBB4 24010003 */ li $at, 3 -/* 0B07B8 800AFBB8 16010007 */ bne $s0, $at, .L800AFBD8 -/* 0B07BC 800AFBBC 00000000 */ nop -.L800AFBC0: -/* 0B07C0 800AFBC0 82790002 */ lb $t9, 2($s3) -/* 0B07C4 800AFBC4 3C018012 */ lui $at, %hi(D_80127C88) # $at, 0x8012 -/* 0B07C8 800AFBC8 33380007 */ andi $t8, $t9, 7 -/* 0B07CC 800AFBCC 00186040 */ sll $t4, $t8, 1 -/* 0B07D0 800AFBD0 002C0821 */ addu $at, $at, $t4 -/* 0B07D4 800AFBD4 A4207C88 */ sh $zero, %lo(D_80127C88)($at) -.L800AFBD8: -/* 0B07D8 800AFBD8 AE200000 */ sw $zero, ($s1) -.L800AFBDC: -/* 0B07DC 800AFBDC 240E0100 */ li $t6, 256 -/* 0B07E0 800AFBE0 3C01800E */ lui $at, %hi(D_800E2EEC) # $at, 0x800e -/* 0B07E4 800AFBE4 AC2E2EEC */ sw $t6, %lo(D_800E2EEC)($at) -/* 0B07E8 800AFBE8 8E4F0040 */ lw $t7, 0x40($s2) -/* 0B07EC 800AFBEC 26100001 */ addiu $s0, $s0, 1 -/* 0B07F0 800AFBF0 81F90057 */ lb $t9, 0x57($t7) -/* 0B07F4 800AFBF4 00176842 */ srl $t5, $s7, 1 -/* 0B07F8 800AFBF8 0219082A */ slt $at, $s0, $t9 -/* 0B07FC 800AFBFC 1420FEE0 */ bnez $at, .L800AF780 -/* 0B0800 800AFC00 01A0B825 */ move $s7, $t5 -.L800AFC04: -/* 0B0804 800AFC04 0C004BCC */ jal object_undo_player_tumble -/* 0B0808 800AFC08 02402025 */ move $a0, $s2 -/* 0B080C 800AFC0C 8FBF003C */ lw $ra, 0x3c($sp) -/* 0B0810 800AFC10 8FB00018 */ lw $s0, 0x18($sp) -/* 0B0814 800AFC14 8FB1001C */ lw $s1, 0x1c($sp) -/* 0B0818 800AFC18 8FB20020 */ lw $s2, 0x20($sp) -/* 0B081C 800AFC1C 8FB30024 */ lw $s3, 0x24($sp) -/* 0B0820 800AFC20 8FB40028 */ lw $s4, 0x28($sp) -/* 0B0824 800AFC24 8FB5002C */ lw $s5, 0x2c($sp) -/* 0B0828 800AFC28 8FB60030 */ lw $s6, 0x30($sp) -/* 0B082C 800AFC2C 8FB70034 */ lw $s7, 0x34($sp) -/* 0B0830 800AFC30 8FBE0038 */ lw $fp, 0x38($sp) -/* 0B0834 800AFC34 03E00008 */ jr $ra -/* 0B0838 800AFC38 27BD0080 */ addiu $sp, $sp, 0x80 - +glabel func_800AF714 +/* 0B0314 800AF714 27BDFF80 */ addiu $sp, $sp, -0x80 +/* 0B0318 800AF718 AFBF003C */ sw $ra, 0x3c($sp) +/* 0B031C 800AF71C AFBE0038 */ sw $fp, 0x38($sp) +/* 0B0320 800AF720 AFB70034 */ sw $s7, 0x34($sp) +/* 0B0324 800AF724 AFB60030 */ sw $s6, 0x30($sp) +/* 0B0328 800AF728 AFB5002C */ sw $s5, 0x2c($sp) +/* 0B032C 800AF72C AFB40028 */ sw $s4, 0x28($sp) +/* 0B0330 800AF730 AFB30024 */ sw $s3, 0x24($sp) +/* 0B0334 800AF734 AFB20020 */ sw $s2, 0x20($sp) +/* 0B0338 800AF738 AFB1001C */ sw $s1, 0x1c($sp) +/* 0B033C 800AF73C AFB00018 */ sw $s0, 0x18($sp) +/* 0B0340 800AF740 AFA50084 */ sw $a1, 0x84($sp) +/* 0B0344 800AF744 8C930064 */ lw $s3, 0x64($a0) +/* 0B0348 800AF748 8C970074 */ lw $s7, 0x74($a0) +/* 0B034C 800AF74C 827E01D6 */ lb $fp, 0x1d6($s3) +/* 0B0350 800AF750 00809025 */ move $s2, $a0 +/* 0B0354 800AF754 0C004B8A */ jal object_do_player_tumble +/* 0B0358 800AF758 00008025 */ move $s0, $zero +/* 0B035C 800AF75C 8E4E0040 */ lw $t6, 0x40($s2) +/* 0B0360 800AF760 24160002 */ li $s6, 2 +/* 0B0364 800AF764 81CF0057 */ lb $t7, 0x57($t6) +/* 0B0368 800AF768 241500FF */ li $s5, 255 +/* 0B036C 800AF76C 19E00125 */ blez $t7, .L800AFC04 +/* 0B0370 800AF770 3C14800E */ lui $s4, %hi(D_800E2E84) # $s4, 0x800e +/* 0B0374 800AF774 3C11800E */ lui $s1, %hi(D_800E2D00) # $s1, 0x800e +/* 0B0378 800AF778 26312D00 */ addiu $s1, %lo(D_800E2D00) # addiu $s1, $s1, 0x2d00 +/* 0B037C 800AF77C 26942E84 */ addiu $s4, %lo(D_800E2E84) # addiu $s4, $s4, 0x2e84 +.L800AF780: +/* 0B0380 800AF780 32F80001 */ andi $t8, $s7, 1 +/* 0B0384 800AF784 130000E8 */ beqz $t8, .L800AFB28 +/* 0B0388 800AF788 00000000 */ nop +/* 0B038C 800AF78C 13C00008 */ beqz $fp, .L800AF7B0 +/* 0B0390 800AF790 240B0001 */ li $t3, 1 +/* 0B0394 800AF794 24010001 */ li $at, 1 +/* 0B0398 800AF798 13C10099 */ beq $fp, $at, .L800AFA00 +/* 0B039C 800AF79C 00000000 */ nop +/* 0B03A0 800AF7A0 13D60083 */ beq $fp, $s6, .L800AF9B0 +/* 0B03A4 800AF7A4 00000000 */ nop +/* 0B03A8 800AF7A8 100000AA */ b .L800AFA54 +/* 0B03AC 800AF7AC 00000000 */ nop +.L800AF7B0: +/* 0B03B0 800AF7B0 0600004C */ bltz $s0, .L800AF8E4 +/* 0B03B4 800AF7B4 2A01000A */ slti $at, $s0, 0xa +/* 0B03B8 800AF7B8 1020004B */ beqz $at, .L800AF8E8 +/* 0B03BC 800AF7BC 2401000A */ li $at, 10 +/* 0B03C0 800AF7C0 8662016E */ lh $v0, 0x16e($s3) +/* 0B03C4 800AF7C4 00106140 */ sll $t4, $s0, 5 +/* 0B03C8 800AF7C8 04410002 */ bgez $v0, .L800AF7D4 +/* 0B03CC 800AF7CC 3C18800E */ lui $t8, %hi(gParticlesAssetTable) # $t8, 0x800e +/* 0B03D0 800AF7D0 00021023 */ negu $v0, $v0 +.L800AF7D4: +/* 0B03D4 800AF7D4 2442FFE8 */ addiu $v0, $v0, -0x18 +/* 0B03D8 800AF7D8 1840009E */ blez $v0, .L800AFA54 +/* 0B03DC 800AF7DC 28410021 */ slti $at, $v0, 0x21 +/* 0B03E0 800AF7E0 8E59006C */ lw $t9, 0x6c($s2) +/* 0B03E4 800AF7E4 8F182CF0 */ lw $t8, %lo(gParticlesAssetTable)($t8) +/* 0B03E8 800AF7E8 032C6821 */ addu $t5, $t9, $t4 +/* 0B03EC 800AF7EC 85AE0008 */ lh $t6, 8($t5) +/* 0B03F0 800AF7F0 3C0D800E */ lui $t5, %hi(D_800E2EC4) # $t5, 0x800e +/* 0B03F4 800AF7F4 000E7880 */ sll $t7, $t6, 2 +/* 0B03F8 800AF7F8 25AD2EC4 */ addiu $t5, %lo(D_800E2EC4) # addiu $t5, $t5, 0x2ec4 +/* 0B03FC 800AF7FC 00106080 */ sll $t4, $s0, 2 +/* 0B0400 800AF800 030FC821 */ addu $t9, $t8, $t7 +/* 0B0404 800AF804 8F270000 */ lw $a3, ($t9) +/* 0B0408 800AF808 018D4021 */ addu $t0, $t4, $t5 +/* 0B040C 800AF80C 14200002 */ bnez $at, .L800AF818 +/* 0B0410 800AF810 250A0003 */ addiu $t2, $t0, 3 +/* 0B0414 800AF814 24020020 */ li $v0, 32 +.L800AF818: +/* 0B0418 800AF818 00420019 */ multu $v0, $v0 +/* 0B041C 800AF81C 90E40014 */ lbu $a0, 0x14($a3) +/* 0B0420 800AF820 910F0000 */ lbu $t7, ($t0) +/* 0B0424 800AF824 00024900 */ sll $t1, $v0, 4 +/* 0B0428 800AF828 01E4C823 */ subu $t9, $t7, $a0 +/* 0B042C 800AF82C 28410011 */ slti $at, $v0, 0x11 +/* 0B0430 800AF830 00007012 */ mflo $t6 +/* 0B0434 800AF834 000EC083 */ sra $t8, $t6, 2 +/* 0B0438 800AF838 01381823 */ subu $v1, $t1, $t8 +/* 0B043C 800AF83C 03230019 */ multu $t9, $v1 +/* 0B0440 800AF840 91190001 */ lbu $t9, 1($t0) +/* 0B0444 800AF844 00006012 */ mflo $t4 +/* 0B0448 800AF848 000C6A03 */ sra $t5, $t4, 8 +/* 0B044C 800AF84C 01A47021 */ addu $t6, $t5, $a0 +/* 0B0450 800AF850 000E7E00 */ sll $t7, $t6, 0x18 +/* 0B0454 800AF854 AE2F0000 */ sw $t7, ($s1) +/* 0B0458 800AF858 90E50015 */ lbu $a1, 0x15($a3) +/* 0B045C 800AF85C 00000000 */ nop +/* 0B0460 800AF860 03256023 */ subu $t4, $t9, $a1 +/* 0B0464 800AF864 01830019 */ multu $t4, $v1 +/* 0B0468 800AF868 00006812 */ mflo $t5 +/* 0B046C 800AF86C 000D7203 */ sra $t6, $t5, 8 +/* 0B0470 800AF870 00AEC021 */ addu $t8, $a1, $t6 +/* 0B0474 800AF874 0018CC00 */ sll $t9, $t8, 0x10 +/* 0B0478 800AF878 01F96825 */ or $t5, $t7, $t9 +/* 0B047C 800AF87C AE2D0000 */ sw $t5, ($s1) +/* 0B0480 800AF880 90E60016 */ lbu $a2, 0x16($a3) +/* 0B0484 800AF884 910E0002 */ lbu $t6, 2($t0) +/* 0B0488 800AF888 00000000 */ nop +/* 0B048C 800AF88C 01C6C023 */ subu $t8, $t6, $a2 +/* 0B0490 800AF890 03030019 */ multu $t8, $v1 +/* 0B0494 800AF894 00007812 */ mflo $t7 +/* 0B0498 800AF898 000FCA03 */ sra $t9, $t7, 8 +/* 0B049C 800AF89C 00D96021 */ addu $t4, $a2, $t9 +/* 0B04A0 800AF8A0 000C7200 */ sll $t6, $t4, 8 +/* 0B04A4 800AF8A4 01AEC025 */ or $t8, $t5, $t6 +/* 0B04A8 800AF8A8 14200002 */ bnez $at, .L800AF8B4 +/* 0B04AC 800AF8AC AE380000 */ sw $t8, ($s1) +/* 0B04B0 800AF8B0 24090100 */ li $t1, 256 +.L800AF8B4: +/* 0B04B4 800AF8B4 90E20017 */ lbu $v0, 0x17($a3) +/* 0B04B8 800AF8B8 91590000 */ lbu $t9, ($t2) +/* 0B04BC 800AF8BC 8E2F0000 */ lw $t7, ($s1) +/* 0B04C0 800AF8C0 03226023 */ subu $t4, $t9, $v0 +/* 0B04C4 800AF8C4 01890019 */ multu $t4, $t1 +/* 0B04C8 800AF8C8 3C01800E */ lui $at, %hi(D_800E2D00) # $at, 0x800e +/* 0B04CC 800AF8CC 00006812 */ mflo $t5 +/* 0B04D0 800AF8D0 000D7203 */ sra $t6, $t5, 8 +/* 0B04D4 800AF8D4 004EC021 */ addu $t8, $v0, $t6 +/* 0B04D8 800AF8D8 01F8C825 */ or $t9, $t7, $t8 +/* 0B04DC 800AF8DC 1000005D */ b .L800AFA54 +/* 0B04E0 800AF8E0 AC392D00 */ sw $t9, %lo(D_800E2D00)($at) +.L800AF8E4: +/* 0B04E4 800AF8E4 2401000A */ li $at, 10 +.L800AF8E8: +/* 0B04E8 800AF8E8 12010009 */ beq $s0, $at, .L800AF910 +/* 0B04EC 800AF8EC 2401000B */ li $at, 11 +/* 0B04F0 800AF8F0 12010011 */ beq $s0, $at, .L800AF938 +/* 0B04F4 800AF8F4 2401000C */ li $at, 12 +/* 0B04F8 800AF8F8 12010019 */ beq $s0, $at, .L800AF960 +/* 0B04FC 800AF8FC 2401000D */ li $at, 13 +/* 0B0500 800AF900 12010021 */ beq $s0, $at, .L800AF988 +/* 0B0504 800AF904 00000000 */ nop +/* 0B0508 800AF908 10000052 */ b .L800AFA54 +/* 0B050C 800AF90C 00000000 */ nop +.L800AF910: +/* 0B0510 800AF910 926201DE */ lbu $v0, 0x1de($s3) +/* 0B0514 800AF914 00000000 */ nop +/* 0B0518 800AF918 16A20002 */ bne $s5, $v0, .L800AF924 +/* 0B051C 800AF91C 304C000F */ andi $t4, $v0, 0xf +/* 0B0520 800AF920 00005825 */ move $t3, $zero +.L800AF924: +/* 0B0524 800AF924 000C6880 */ sll $t5, $t4, 2 +/* 0B0528 800AF928 028D7021 */ addu $t6, $s4, $t5 +/* 0B052C 800AF92C 8DCF0000 */ lw $t7, ($t6) +/* 0B0530 800AF930 10000048 */ b .L800AFA54 +/* 0B0534 800AF934 AE2F0000 */ sw $t7, ($s1) +.L800AF938: +/* 0B0538 800AF938 926201DF */ lbu $v0, 0x1df($s3) +/* 0B053C 800AF93C 00000000 */ nop +/* 0B0540 800AF940 16A20002 */ bne $s5, $v0, .L800AF94C +/* 0B0544 800AF944 3058000F */ andi $t8, $v0, 0xf +/* 0B0548 800AF948 00005825 */ move $t3, $zero +.L800AF94C: +/* 0B054C 800AF94C 0018C880 */ sll $t9, $t8, 2 +/* 0B0550 800AF950 02996021 */ addu $t4, $s4, $t9 +/* 0B0554 800AF954 8D8D0000 */ lw $t5, ($t4) +/* 0B0558 800AF958 1000003E */ b .L800AFA54 +/* 0B055C 800AF95C AE2D0000 */ sw $t5, ($s1) +.L800AF960: +/* 0B0560 800AF960 926201DC */ lbu $v0, 0x1dc($s3) +/* 0B0564 800AF964 00000000 */ nop +/* 0B0568 800AF968 16A20002 */ bne $s5, $v0, .L800AF974 +/* 0B056C 800AF96C 304E000F */ andi $t6, $v0, 0xf +/* 0B0570 800AF970 00005825 */ move $t3, $zero +.L800AF974: +/* 0B0574 800AF974 000E7880 */ sll $t7, $t6, 2 +/* 0B0578 800AF978 028FC021 */ addu $t8, $s4, $t7 +/* 0B057C 800AF97C 8F190000 */ lw $t9, ($t8) +/* 0B0580 800AF980 10000034 */ b .L800AFA54 +/* 0B0584 800AF984 AE390000 */ sw $t9, ($s1) +.L800AF988: +/* 0B0588 800AF988 926201DD */ lbu $v0, 0x1dd($s3) +/* 0B058C 800AF98C 00000000 */ nop +/* 0B0590 800AF990 16A20002 */ bne $s5, $v0, .L800AF99C +/* 0B0594 800AF994 304C000F */ andi $t4, $v0, 0xf +/* 0B0598 800AF998 00005825 */ move $t3, $zero +.L800AF99C: +/* 0B059C 800AF99C 000C6880 */ sll $t5, $t4, 2 +/* 0B05A0 800AF9A0 028D7021 */ addu $t6, $s4, $t5 +/* 0B05A4 800AF9A4 8DCF0000 */ lw $t7, ($t6) +/* 0B05A8 800AF9A8 1000002A */ b .L800AFA54 +/* 0B05AC 800AF9AC AE2F0000 */ sw $t7, ($s1) +.L800AF9B0: +/* 0B05B0 800AF9B0 16000009 */ bnez $s0, .L800AF9D8 +/* 0B05B4 800AF9B4 24010001 */ li $at, 1 +/* 0B05B8 800AF9B8 927801DC */ lbu $t8, 0x1dc($s3) +/* 0B05BC 800AF9BC 00000000 */ nop +/* 0B05C0 800AF9C0 3319000F */ andi $t9, $t8, 0xf +/* 0B05C4 800AF9C4 00196080 */ sll $t4, $t9, 2 +/* 0B05C8 800AF9C8 028C6821 */ addu $t5, $s4, $t4 +/* 0B05CC 800AF9CC 8DAE0000 */ lw $t6, ($t5) +/* 0B05D0 800AF9D0 10000020 */ b .L800AFA54 +/* 0B05D4 800AF9D4 AE2E0000 */ sw $t6, ($s1) +.L800AF9D8: +/* 0B05D8 800AF9D8 1601001E */ bne $s0, $at, .L800AFA54 +/* 0B05DC 800AF9DC 00000000 */ nop +/* 0B05E0 800AF9E0 926F01DD */ lbu $t7, 0x1dd($s3) +/* 0B05E4 800AF9E4 00000000 */ nop +/* 0B05E8 800AF9E8 31F8000F */ andi $t8, $t7, 0xf +/* 0B05EC 800AF9EC 0018C880 */ sll $t9, $t8, 2 +/* 0B05F0 800AF9F0 02996021 */ addu $t4, $s4, $t9 +/* 0B05F4 800AF9F4 8D8D0000 */ lw $t5, ($t4) +/* 0B05F8 800AF9F8 10000016 */ b .L800AFA54 +/* 0B05FC 800AF9FC AE2D0000 */ sw $t5, ($s1) +.L800AFA00: +/* 0B0600 800AFA00 12160003 */ beq $s0, $s6, .L800AFA10 +/* 0B0604 800AFA04 24010003 */ li $at, 3 +/* 0B0608 800AFA08 16010012 */ bne $s0, $at, .L800AFA54 +/* 0B060C 800AFA0C 00000000 */ nop +.L800AFA10: +/* 0B0610 800AFA10 826E0002 */ lb $t6, 2($s3) +/* 0B0614 800AFA14 3C198012 */ lui $t9, %hi(D_80127C88) # $t9, 0x8012 +/* 0B0618 800AFA18 31CF0007 */ andi $t7, $t6, 7 +/* 0B061C 800AFA1C 000FC040 */ sll $t8, $t7, 1 +/* 0B0620 800AFA20 27397C88 */ addiu $t9, %lo(D_80127C88) # addiu $t9, $t9, 0x7c88 +/* 0B0624 800AFA24 8FAC0084 */ lw $t4, 0x84($sp) +/* 0B0628 800AFA28 03191821 */ addu $v1, $t8, $t9 +/* 0B062C 800AFA2C 84620000 */ lh $v0, ($v1) +/* 0B0630 800AFA30 000C6880 */ sll $t5, $t4, 2 +/* 0B0634 800AFA34 004D1021 */ addu $v0, $v0, $t5 +/* 0B0638 800AFA38 28410101 */ slti $at, $v0, 0x101 +/* 0B063C 800AFA3C 14200002 */ bnez $at, .L800AFA48 +/* 0B0640 800AFA40 00000000 */ nop +/* 0B0644 800AFA44 24020100 */ li $v0, 256 +.L800AFA48: +/* 0B0648 800AFA48 A4620000 */ sh $v0, ($v1) +/* 0B064C 800AFA4C 3C01800E */ lui $at, %hi(gParticleOpacity) # $at, 0x800e +/* 0B0650 800AFA50 AC222EEC */ sw $v0, %lo(gParticleOpacity)($at) +.L800AFA54: +/* 0B0654 800AFA54 11600060 */ beqz $t3, .L800AFBD8 +/* 0B0658 800AFA58 00000000 */ nop +/* 0B065C 800AFA5C 8E46006C */ lw $a2, 0x6c($s2) +/* 0B0660 800AFA60 00103940 */ sll $a3, $s0, 5 +/* 0B0664 800AFA64 00C71021 */ addu $v0, $a2, $a3 +/* 0B0668 800AFA68 84430004 */ lh $v1, 4($v0) +/* 0B066C 800AFA6C 02402025 */ move $a0, $s2 +/* 0B0670 800AFA70 306E8000 */ andi $t6, $v1, 0x8000 +/* 0B0674 800AFA74 15C00009 */ bnez $t6, .L800AFA9C +/* 0B0678 800AFA78 02002825 */ move $a1, $s0 +/* 0B067C 800AFA7C 0C02BD4B */ jal func_800AF52C +/* 0B0680 800AFA80 AFA70044 */ sw $a3, 0x44($sp) +/* 0B0684 800AFA84 8FA70044 */ lw $a3, 0x44($sp) +/* 0B0688 800AFA88 8E46006C */ lw $a2, 0x6c($s2) +/* 0B068C 800AFA8C 00000000 */ nop +/* 0B0690 800AFA90 00C71021 */ addu $v0, $a2, $a3 +/* 0B0694 800AFA94 84430004 */ lh $v1, 4($v0) +/* 0B0698 800AFA98 00000000 */ nop +.L800AFA9C: +/* 0B069C 800AFA9C 306F4000 */ andi $t7, $v1, 0x4000 +/* 0B06A0 800AFAA0 11E00007 */ beqz $t7, .L800AFAC0 +/* 0B06A4 800AFAA4 30790400 */ andi $t9, $v1, 0x400 +/* 0B06A8 800AFAA8 0010C140 */ sll $t8, $s0, 5 +/* 0B06AC 800AFAAC 00D82821 */ addu $a1, $a2, $t8 +/* 0B06B0 800AFAB0 0C02BF97 */ jal func_800AFE5C +/* 0B06B4 800AFAB4 02402025 */ move $a0, $s2 +/* 0B06B8 800AFAB8 10000048 */ b .L800AFBDC +/* 0B06BC 800AFABC AE200000 */ sw $zero, ($s1) +.L800AFAC0: +/* 0B06C0 800AFAC0 13200006 */ beqz $t9, .L800AFADC +/* 0B06C4 800AFAC4 02402025 */ move $a0, $s2 +/* 0B06C8 800AFAC8 00106140 */ sll $t4, $s0, 5 +/* 0B06CC 800AFACC 0C02BF97 */ jal func_800AFE5C +/* 0B06D0 800AFAD0 00CC2821 */ addu $a1, $a2, $t4 +/* 0B06D4 800AFAD4 10000041 */ b .L800AFBDC +/* 0B06D8 800AFAD8 AE200000 */ sw $zero, ($s1) +.L800AFADC: +/* 0B06DC 800AFADC 844D000A */ lh $t5, 0xa($v0) +/* 0B06E0 800AFAE0 8FAE0084 */ lw $t6, 0x84($sp) +/* 0B06E4 800AFAE4 02402025 */ move $a0, $s2 +/* 0B06E8 800AFAE8 01AE7821 */ addu $t7, $t5, $t6 +/* 0B06EC 800AFAEC A44F000A */ sh $t7, 0xa($v0) +/* 0B06F0 800AFAF0 8E46006C */ lw $a2, 0x6c($s2) +/* 0B06F4 800AFAF4 00106940 */ sll $t5, $s0, 5 +/* 0B06F8 800AFAF8 00C71021 */ addu $v0, $a2, $a3 +/* 0B06FC 800AFAFC 8C590000 */ lw $t9, ($v0) +/* 0B0700 800AFB00 8458000A */ lh $t8, 0xa($v0) +/* 0B0704 800AFB04 872C0040 */ lh $t4, 0x40($t9) +/* 0B0708 800AFB08 00000000 */ nop +/* 0B070C 800AFB0C 030C082A */ slt $at, $t8, $t4 +/* 0B0710 800AFB10 14200031 */ bnez $at, .L800AFBD8 +/* 0B0714 800AFB14 00000000 */ nop +/* 0B0718 800AFB18 0C02BF97 */ jal func_800AFE5C +/* 0B071C 800AFB1C 00CD2821 */ addu $a1, $a2, $t5 +/* 0B0720 800AFB20 1000002E */ b .L800AFBDC +/* 0B0724 800AFB24 AE200000 */ sw $zero, ($s1) +.L800AFB28: +/* 0B0728 800AFB28 8E46006C */ lw $a2, 0x6c($s2) +/* 0B072C 800AFB2C 00107140 */ sll $t6, $s0, 5 +/* 0B0730 800AFB30 00CE1021 */ addu $v0, $a2, $t6 +/* 0B0734 800AFB34 84430004 */ lh $v1, 4($v0) +/* 0B0738 800AFB38 00000000 */ nop +/* 0B073C 800AFB3C 306F8000 */ andi $t7, $v1, 0x8000 +/* 0B0740 800AFB40 11E00025 */ beqz $t7, .L800AFBD8 +/* 0B0744 800AFB44 30794000 */ andi $t9, $v1, 0x4000 +/* 0B0748 800AFB48 13200009 */ beqz $t9, .L800AFB70 +/* 0B074C 800AFB4C 306C0400 */ andi $t4, $v1, 0x400 +/* 0B0750 800AFB50 0010C140 */ sll $t8, $s0, 5 +/* 0B0754 800AFB54 00D81021 */ addu $v0, $a2, $t8 +/* 0B0758 800AFB58 A0400006 */ sb $zero, 6($v0) +/* 0B075C 800AFB5C 02402025 */ move $a0, $s2 +/* 0B0760 800AFB60 0C02BDB9 */ jal func_800AF6E4 +/* 0B0764 800AFB64 02002825 */ move $a1, $s0 +/* 0B0768 800AFB68 10000011 */ b .L800AFBB0 +/* 0B076C 800AFB6C 00000000 */ nop +.L800AFB70: +/* 0B0770 800AFB70 1180000D */ beqz $t4, .L800AFBA8 +/* 0B0774 800AFB74 02402025 */ move $a0, $s2 +/* 0B0778 800AFB78 00106940 */ sll $t5, $s0, 5 +/* 0B077C 800AFB7C 346E0200 */ ori $t6, $v1, 0x200 +/* 0B0780 800AFB80 00CD2021 */ addu $a0, $a2, $t5 +/* 0B0784 800AFB84 A44E0004 */ sh $t6, 4($v0) +/* 0B0788 800AFB88 908F0006 */ lbu $t7, 6($a0) +/* 0B078C 800AFB8C 02402025 */ move $a0, $s2 +/* 0B0790 800AFB90 15E00007 */ bnez $t7, .L800AFBB0 +/* 0B0794 800AFB94 00000000 */ nop +/* 0B0798 800AFB98 0C02BDB9 */ jal func_800AF6E4 +/* 0B079C 800AFB9C 02002825 */ move $a1, $s0 +/* 0B07A0 800AFBA0 10000003 */ b .L800AFBB0 +/* 0B07A4 800AFBA4 00000000 */ nop +.L800AFBA8: +/* 0B07A8 800AFBA8 0C02BDB9 */ jal func_800AF6E4 +/* 0B07AC 800AFBAC 02002825 */ move $a1, $s0 +.L800AFBB0: +/* 0B07B0 800AFBB0 12160003 */ beq $s0, $s6, .L800AFBC0 +/* 0B07B4 800AFBB4 24010003 */ li $at, 3 +/* 0B07B8 800AFBB8 16010007 */ bne $s0, $at, .L800AFBD8 +/* 0B07BC 800AFBBC 00000000 */ nop +.L800AFBC0: +/* 0B07C0 800AFBC0 82790002 */ lb $t9, 2($s3) +/* 0B07C4 800AFBC4 3C018012 */ lui $at, %hi(D_80127C88) # $at, 0x8012 +/* 0B07C8 800AFBC8 33380007 */ andi $t8, $t9, 7 +/* 0B07CC 800AFBCC 00186040 */ sll $t4, $t8, 1 +/* 0B07D0 800AFBD0 002C0821 */ addu $at, $at, $t4 +/* 0B07D4 800AFBD4 A4207C88 */ sh $zero, %lo(D_80127C88)($at) +.L800AFBD8: +/* 0B07D8 800AFBD8 AE200000 */ sw $zero, ($s1) +.L800AFBDC: +/* 0B07DC 800AFBDC 240E0100 */ li $t6, 256 +/* 0B07E0 800AFBE0 3C01800E */ lui $at, %hi(gParticleOpacity) # $at, 0x800e +/* 0B07E4 800AFBE4 AC2E2EEC */ sw $t6, %lo(gParticleOpacity)($at) +/* 0B07E8 800AFBE8 8E4F0040 */ lw $t7, 0x40($s2) +/* 0B07EC 800AFBEC 26100001 */ addiu $s0, $s0, 1 +/* 0B07F0 800AFBF0 81F90057 */ lb $t9, 0x57($t7) +/* 0B07F4 800AFBF4 00176842 */ srl $t5, $s7, 1 +/* 0B07F8 800AFBF8 0219082A */ slt $at, $s0, $t9 +/* 0B07FC 800AFBFC 1420FEE0 */ bnez $at, .L800AF780 +/* 0B0800 800AFC00 01A0B825 */ move $s7, $t5 +.L800AFC04: +/* 0B0804 800AFC04 0C004BCC */ jal object_undo_player_tumble +/* 0B0808 800AFC08 02402025 */ move $a0, $s2 +/* 0B080C 800AFC0C 8FBF003C */ lw $ra, 0x3c($sp) +/* 0B0810 800AFC10 8FB00018 */ lw $s0, 0x18($sp) +/* 0B0814 800AFC14 8FB1001C */ lw $s1, 0x1c($sp) +/* 0B0818 800AFC18 8FB20020 */ lw $s2, 0x20($sp) +/* 0B081C 800AFC1C 8FB30024 */ lw $s3, 0x24($sp) +/* 0B0820 800AFC20 8FB40028 */ lw $s4, 0x28($sp) +/* 0B0824 800AFC24 8FB5002C */ lw $s5, 0x2c($sp) +/* 0B0828 800AFC28 8FB60030 */ lw $s6, 0x30($sp) +/* 0B082C 800AFC2C 8FB70034 */ lw $s7, 0x34($sp) +/* 0B0830 800AFC30 8FBE0038 */ lw $fp, 0x38($sp) +/* 0B0834 800AFC34 03E00008 */ jr $ra +/* 0B0838 800AFC38 27BD0080 */ addiu $sp, $sp, 0x80 + diff --git a/asm/non_matchings/particles/func_800B26E0.s b/asm/non_matchings/particles/func_800B26E0.s index 568b381e..31acd00a 100644 --- a/asm/non_matchings/particles/func_800B26E0.s +++ b/asm/non_matchings/particles/func_800B26E0.s @@ -27,7 +27,7 @@ glabel func_800B26E0 /* 0B3324 800B2724 8FA70030 */ lw $a3, 0x30($sp) /* 0B3328 800B2728 29010002 */ slti $at, $t0, 2 /* 0B332C 800B272C 102001CE */ beqz $at, .L800B2E68 -/* 0B3330 800B2730 3C058012 */ lui $a1, %hi(D_80127C80) # $a1, 0x8012 +/* 0B3330 800B2730 3C058012 */ lui $a1, %hi(gParticleUpdateRate) # $a1, 0x8012 /* 0B3334 800B2734 8FA90034 */ lw $t1, 0x34($sp) /* 0B3338 800B2738 00000000 */ nop /* 0B333C 800B273C 112001CA */ beqz $t1, .L800B2E68 @@ -166,7 +166,7 @@ glabel func_800B26E0 /* 0B3528 800B2928 E7AC004C */ swc1 $f12, 0x4c($sp) .L800B292C: /* 0B352C 800B292C 106000CE */ beqz $v1, .L800B2C68 -/* 0B3530 800B2930 3C058012 */ lui $a1, %hi(D_80127C80) # $a1, 0x8012 +/* 0B3530 800B2930 3C058012 */ lui $a1, %hi(gParticleUpdateRate) # $a1, 0x8012 /* 0B3534 800B2934 90D80068 */ lbu $t8, 0x68($a2) /* 0B3538 800B2938 C7A40044 */ lwc1 $f4, 0x44($sp) /* 0B353C 800B293C 170000CA */ bnez $t8, .L800B2C68 @@ -313,9 +313,9 @@ glabel func_800B26E0 /* 0B3768 800B2B68 C7A80044 */ lwc1 $f8, 0x44($sp) /* 0B376C 800B2B6C 8C6C0008 */ lw $t4, 8($v1) /* 0B3770 800B2B70 46082401 */ sub.s $f16, $f4, $f8 -/* 0B3774 800B2B74 3C058012 */ lui $a1, %hi(D_80127C80) # $a1, 0x8012 +/* 0B3774 800B2B74 3C058012 */ lui $a1, %hi(gParticleUpdateRate) # $a1, 0x8012 /* 0B3778 800B2B78 4448F800 */ cfc1 $t0, $31 -/* 0B377C 800B2B7C 24A57C80 */ addiu $a1, %lo(D_80127C80) # addiu $a1, $a1, 0x7c80 +/* 0B377C 800B2B7C 24A57C80 */ addiu $a1, %lo(gParticleUpdateRate) # addiu $a1, $a1, 0x7c80 /* 0B3780 800B2B80 35010003 */ ori $at, $t0, 3 /* 0B3784 800B2B84 38210002 */ xori $at, $at, 2 /* 0B3788 800B2B88 44C1F800 */ ctc1 $at, $31 @@ -503,9 +503,9 @@ glabel func_800B26E0 /* 0B3A5C 800B2E5C A0CB0068 */ sb $t3, 0x68($a2) .L800B2E60: /* 0B3A60 800B2E60 10000041 */ b .L800B2F68 -/* 0B3A64 800B2E64 24A57C80 */ addiu $a1, %lo(D_80127C80) # addiu $a1, $a1, 0x7c80 +/* 0B3A64 800B2E64 24A57C80 */ addiu $a1, %lo(gParticleUpdateRate) # addiu $a1, $a1, 0x7c80 .L800B2E68: -/* 0B3A68 800B2E68 24A57C80 */ addiu $a1, %lo(D_80127C80) # addiu $a1, $a1, 0x7c80 +/* 0B3A68 800B2E68 24A57C80 */ addiu $a1, %lo(gParticleUpdateRate) # addiu $a1, $a1, 0x7c80 /* 0B3A6C 800B2E6C 8CA90000 */ lw $t1, ($a1) /* 0B3A70 800B2E70 84CD003A */ lh $t5, 0x3a($a2) /* 0B3A74 800B2E74 00C02025 */ move $a0, $a2 @@ -519,10 +519,10 @@ glabel func_800B26E0 /* 0B3A94 800B2E94 0C003FEE */ jal gParticlePtrList_addObject /* 0B3A98 800B2E98 AFA60050 */ sw $a2, 0x50($sp) /* 0B3A9C 800B2E9C 8FA30038 */ lw $v1, 0x38($sp) -/* 0B3AA0 800B2EA0 3C058012 */ lui $a1, %hi(D_80127C80) # $a1, 0x8012 +/* 0B3AA0 800B2EA0 3C058012 */ lui $a1, %hi(gParticleUpdateRate) # $a1, 0x8012 /* 0B3AA4 800B2EA4 8FA60050 */ lw $a2, 0x50($sp) /* 0B3AA8 800B2EA8 1000002F */ b .L800B2F68 -/* 0B3AAC 800B2EAC 24A57C80 */ addiu $a1, %lo(D_80127C80) # addiu $a1, $a1, 0x7c80 +/* 0B3AAC 800B2EAC 24A57C80 */ addiu $a1, %lo(gParticleUpdateRate) # addiu $a1, $a1, 0x7c80 .L800B2EB0: /* 0B3AB0 800B2EB0 84C20060 */ lh $v0, 0x60($a2) /* 0B3AB4 800B2EB4 00000000 */ nop @@ -588,7 +588,7 @@ glabel func_800B26E0 /* 0B3B98 800B2F98 00000000 */ nop /* 0B3B9C 800B2F9C 1B000004 */ blez $t8, .L800B2FB0 /* 0B3BA0 800B2FA0 8FBF0014 */ lw $ra, 0x14($sp) -/* 0B3BA4 800B2FA4 0C02CBEF */ jal func_800B2FBC +/* 0B3BA4 800B2FA4 0C02CBEF */ jal set_particle_texture_frame /* 0B3BA8 800B2FA8 00C02025 */ move $a0, $a2 /* 0B3BAC 800B2FAC 8FBF0014 */ lw $ra, 0x14($sp) .L800B2FB0: diff --git a/include/level_object_entries.h b/include/level_object_entries.h index 2b068c78..c77a6ddc 100644 --- a/include/level_object_entries.h +++ b/include/level_object_entries.h @@ -467,8 +467,8 @@ typedef struct LevelObjectEntry_TrophyCab { typedef struct LevelObjectEntry_Bubbler { /* 0x00 */ LevelObjectEntryCommon common; - /* 0x08 */ u8 unk8; - /* 0x09 */ u8 unk9; + /* 0x08 */ u8 particlePropertyID; + /* 0x09 */ u8 particleBehaviourID; /* 0x0A */ u16 unkA; } LevelObjectEntry_Bubbler; diff --git a/include/structs.h b/include/structs.h index dbb099ec..4d04427d 100644 --- a/include/structs.h +++ b/include/structs.h @@ -792,7 +792,7 @@ typedef struct ObjectInteraction { /* 0x14 */ s16 flags; /* 0x16 */ s8 unk16; /* 0x17 */ s8 unk17; -/*0x18*/ s32 pad[4]; + /* 0x18 */ s32 pad[4]; } ObjectInteraction; typedef struct ShadowData { @@ -865,8 +865,6 @@ typedef struct Object_60 { s8 *unk2C; } Object_60; -struct Object; - typedef struct Object_LaserGun { /* 0x00 */ s32 unk0; /* 0x00 */ s32 unk4; @@ -935,6 +933,7 @@ typedef struct Object_Butterfly { /* 0x104 */ s16 unk104; /* 0x106 */ s16 unk106; /* 0x108 */ f32 unk108; + /* 0x10C */ f32 unk10C; } Object_Butterfly; typedef struct Object_Fish { @@ -949,6 +948,11 @@ typedef struct Object_Fish { /* 0x104 */ s16 unk104; /* 0x106 */ s16 unk106; /* 0x108 */ f32 unk108; + /* 0x10C */ f32 unk10C; + /* 0x110 */ f32 unk110; + /* 0x114 */ f32 unk114; + /* 0x118 */ f32 unk118; + /* 0x11c */ f32 unk11C; } Object_Fish; typedef struct Object_Boost { @@ -987,14 +991,6 @@ typedef struct Object_CharacterFlag { /* 0x24 */ TextureHeader *texture; } Object_CharacterFlag; -typedef struct Object_Snowball { - /* 0x00 */ u8 pad0[0x20]; - /* 0x20 */ u32 soundMask; - /* 0x24 */ s16 unk24; - /* 0x28 */ u8 pad28[0x12]; - /* 0x38 */ s8 unk38; -} Object_Snowball; - typedef struct Object_AnimCamera { /* 0x00 */ u8 pad0[0x30]; /* 0x30 */ s8 unk30; @@ -1016,6 +1012,7 @@ typedef struct Object_TTDoor { /* 0x10 */ u8 pad10[2]; /* 0x12 */ u8 unk12; /* 0x13 */ s8 unk13; + /* 0x14 */ s32 unk14; } Object_TTDoor; typedef struct Object_WorldKey { @@ -1453,7 +1450,15 @@ typedef struct Object_80021400_64 { } Object_80021400_64; typedef struct Object_Log { - s32 unk0; + /* 0x00 */ s16 unk0; + /* 0x02 */ u8 unk2; + /* 0x04 */ u8 unk3; + /* 0x04 */ u16 unk4; + /* 0x06 */ u16 unk6; + /* 0x08 */ u16 unk8; + /* 0x0A */ u16 unkA; + /* 0x0C */ u16 unkC; + /* 0x0E */ s8 unkE[2]; } Object_Log; typedef struct Object_Fireball_Octoweapon { @@ -1462,12 +1467,18 @@ typedef struct Object_Fireball_Octoweapon { } Object_Fireball_Octoweapon; typedef struct Object_AnimatedObject { - u8 pad0[0x28]; + u8 pad0[0x20]; + /* 0x20 */ u32 soundMask; + /* 0x24 */ s16 unk24; + /* 0x26 */ s16 unk26; s16 unk28; u8 pad2A[0xC]; s16 unk36; - u8 pad38[0x2]; + s8 unk38; + s8 unk39; s8 unk3A; + s8 unk3B; + s8 pad3C[0xC]; } Object_AnimatedObject; typedef struct Object_WizpigRocket { @@ -1493,18 +1504,6 @@ typedef struct Object_8001E89C_64 { /* 0x0C */ Object_8001E89C_64_C *unkC; } Object_8001E89C_64; -typedef struct Object_800BEEB4_64 { - /* 0x00 */ s16 unk0; - /* 0x02 */ u8 unk2; - /* 0x04 */ u8 unk3; - /* 0x04 */ u16 unk4; - /* 0x06 */ u16 unk6; - /* 0x08 */ u16 unk8; - /* 0x0A */ u16 unkA; - /* 0x0C */ u16 unkC; - /* 0x0E */ s8 unkE[2]; -} Object_800BEEB4_64; - typedef struct Object_64 { union { Object_Laser laser; @@ -1521,7 +1520,6 @@ typedef struct Object_64 { Object_CollectEgg egg; Object_UnkId58 unkid58; Object_CharacterFlag character_flag; - Object_Snowball snowball; Object_AnimCamera anim_camera; Object_InfoPoint info_point; Object_TTDoor tt_door; @@ -1551,7 +1549,6 @@ typedef struct Object_64 { Object_AnimatedObject animatedObject; Object_WizpigRocket wizpigRocket; Object_8001E89C_64 obj8001E89C_64; - Object_800BEEB4_64 obj800BEEB4_64; }; } Object_64; @@ -1590,9 +1587,9 @@ typedef struct Object_6C { /* Size: 0xA0 bytes */ typedef struct ParticleBehavior { s32 flags; - f32 unk4; - f32 unk8; - f32 unkC; + f32 velX; + f32 velY; + f32 velZ; f32 unk10; s16 unk14; s16 unk16; @@ -1614,17 +1611,16 @@ typedef struct ParticleBehavior { f32 unk3C; s16 unk40; s16 unk42; - // These names are pretty bad, but they're better than nothing. + s16 angleOffsetY; + s16 angleOffsetX; + s16 angleOffsetZ; s16 angleVelY; s16 angleVelX; s16 angleVelZ; - s16 unk4A; - s16 unk4C; - s16 unk4E; f32 unk50; f32 unk54; f32 forwardVel; - s32 unk5C; + s32 behaviourFlags; s32 gravityRange1; s16 angleRangeY1; s16 angleRangeX1; @@ -1660,15 +1656,6 @@ typedef struct unk800AF29C_C_400 { s16 unk16; } unk800AF29C_C_400; -typedef struct unk800AF29C_C { - s16 unkC; - s16 unkE; - s16 unk10; - s16 unk12; - s16 unk14; - s16 unk16; -} unk800AF29C_C; - typedef struct unk800B2260_C { s32 unk0; s32 unk4; @@ -1709,12 +1696,12 @@ typedef struct SegmentPropertiesObject { typedef struct SegmentPropertiesParticle { /* 0x002C */ s16 unk2C; - /* 0x002E */ s16 unk2E; + /* 0x002E */ s16 blockID; /* 0x0030 */ f32 unk30; /* 0x0034 */ f32 unk34; /* 0x0038 */ u8 unk38; - /* 0x0039 */ u8 unk39; - /* 0x003A */ s16 unk3A; + /* 0x0039 */ u8 movementType; + /* 0x003A */ s16 destroyTimer; } SegmentPropertiesParticle; typedef struct SegmentPropertiesCamera { @@ -1743,31 +1730,10 @@ typedef struct ObjectSegment { /* 0x0040 */ ObjectHeader *header; } ObjectSegment; -typedef struct unk800B0698_44_0 { - u8 pad0[0x3]; - /* 0x04 */ s16 unk4; - /* 0x06 */ s16 unk6; - /* 0x08 */ Vertex *unk8; - /* 0x0C */ Triangle *unkC; - /* 0x10 */ u16 unk10; - /* 0x12 */ u16 unk12; -} unk800B0698_44_0; - -typedef struct unk800B0698_44 { - union { - unk800B0698_44_0 *unk0Ptr; - s16 unk0; - struct unk800B0698_44_0 unk0struct; - }; -} unk800B0698_44; - /* Size: 0x0630 bytes */ typedef struct Object { /* 0x0000 */ ObjectSegment segment; - union { /* 0x0044 */ Vertex *unk44; - /* 0x0044 */ unk800B0698_44 *unk44_0; - }; /* 0x0048 */ s16 behaviorId; /* 0x004A */ s16 unk4A; // Upper byte is object ID, lower byte is object size. /* 0x004C */ ObjectInteraction *interactObj; //player + 0x318 diff --git a/src/game.c b/src/game.c index d301266a..3f2232ba 100644 --- a/src/game.c +++ b/src/game.c @@ -394,6 +394,7 @@ void load_level(s32 levelId, s32 numberOfPlayers, s32 entranceId, Vehicle vehicl for (i = 0; gTempAssetTable[i] != -1; i++) { } i--; if (levelId >= i) { + stubbed_printf("LOADLEVEL Error: Level out of range\n"); levelId = ASSET_LEVEL_CENTRALAREAHUB; } @@ -431,7 +432,9 @@ void load_level(s32 levelId, s32 numberOfPlayers, s32 entranceId, Vehicle vehicl for (var_s0 = 0; levelId != someAsset[var_s0]; var_s0 += 2) { } levelId = someAsset[var_s0 + 1]; entranceId = cutsceneId; - if (cutsceneId) {} // Fakematch + if (cutsceneId == CUTSCENE_NONE) { + stubbed_printf("BossLev problem\n"); + } } } if (gCurrentLevelHeader->race_type == RACETYPE_HUBWORLD) { @@ -640,6 +643,7 @@ char *get_level_name(s32 levelId) { u8 numberOfNullPointers = 0; if (levelId < 0 || levelId >= gNumberOfLevelHeaders) { + stubbed_printf("AITABLE Error: Table out of range\n"); return NULL; } diff --git a/src/object_functions.c b/src/object_functions.c index 803f8b73..dba7d275 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -1769,10 +1769,10 @@ void obj_init_snowball(Object *obj, UNUSED LevelObjectEntry_Snowball *entry) { } void obj_loop_snowball(Object *obj, s32 updateRate) { - Object_Snowball *obj64 = &obj->unk64->snowball; + Object_AnimatedObject *obj64 = &obj->unk64->animatedObject; if (obj64->unk24 == 0) { if (obj64->unk38 != 0) { - obj64->unk24 = (s16)(obj64->unk38 & 0xFF); + obj64->unk24 = (s16) (obj64->unk38 & 0xFF); } } if (obj64->unk24 != 0) { @@ -4603,7 +4603,7 @@ void obj_init_buoy_pirateship(Object *obj, UNUSED LevelObjectEntry_Buoy_PirateSh */ void obj_loop_buoy_pirateship(Object *obj, s32 updateRate) { if (obj->unk64 != NULL) { - obj->segment.trans.y_position = func_800BEEB4(obj->unk64, updateRate); + obj->segment.trans.y_position = get_wave_height((Object_Log *) obj->unk64, updateRate); } obj->segment.animFrame += updateRate * 8; } @@ -4643,7 +4643,7 @@ void obj_loop_log(Object *obj, s32 updateRate) { log = (Object_Log *) obj->unk64; if (log != NULL) { - obj->segment.trans.y_position = func_800BEEB4((Object_64 *) log, updateRate); + obj->segment.trans.y_position = get_wave_height(log, updateRate); } else { obj->segment.trans.y_position = ((LevelObjectEntryCommon *) obj->segment.level_entry)->y; } @@ -4879,7 +4879,7 @@ void obj_init_midichset(Object *obj, LevelObjectEntry_Midichset *entry) { /* Official name: bubblerInit */ void obj_init_bubbler(Object *obj, LevelObjectEntry_Bubbler *entry) { - func_800AF134((Particle *) obj->unk6C, entry->unk9, entry->unk8, 0, 0, 0); + func_800AF134((Particle *) obj->unk6C, entry->particleBehaviourID, entry->particlePropertyID, 0, 0, 0); obj->properties.common.unk0 = entry->unkA; } diff --git a/src/objects.c b/src/objects.c index 15b2e086..77555662 100644 --- a/src/objects.c +++ b/src/objects.c @@ -1094,7 +1094,7 @@ Object *spawn_object(LevelObjectEntryCommon *entry, s32 arg1) { return NULL; } address = (u32 *) &curObj->unk68[curObj->segment.header->numberOfModelIds]; - sizeOfobj = func_800235DC(curObj, (Object_64 *) address); + sizeOfobj = get_object_property_size(curObj, (Object_64 *) address); address = (u32 *) ((uintptr_t) address + sizeOfobj); D_8011AE50 = NULL; D_8011AE54 = NULL; @@ -1560,7 +1560,7 @@ void func_80010994(s32 updateRate) { obj = gObjPtrList[i]; if (obj->segment.trans.flags & 0x8000) { //Why is this object being treated as a Particle? - func_800B22FC((Particle *) obj, updateRate); + handle_particle_movement((Particle *) obj, updateRate); } } } @@ -2507,7 +2507,7 @@ GLOBAL_ASM("asm/non_matchings/objects/func_80012F94.s") void render_object_parts(Object *obj) { func_80012F94(obj); if (obj->segment.trans.flags & OBJ_FLAGS_DEACTIVATED) { - func_800B3740((Particle *) obj, &gObjectCurrDisplayList, &gObjectCurrMatrix, &gObjectCurrVertexList, 0x8000); + render_particle((Particle *) obj, &gObjectCurrDisplayList, &gObjectCurrMatrix, &gObjectCurrVertexList, 0x8000); } else { if (obj->segment.header->modelType == OBJECT_MODEL_TYPE_3D_MODEL) { render_3d_model(obj); @@ -4142,7 +4142,10 @@ void func_800235D0(s32 arg0) { D_8011ADD5 = arg0; } -s32 func_800235DC(Object *obj, Object_64 *obj64) { +/** + * Return the size of the object property struct intended to be used with the object. +*/ +s32 get_object_property_size(Object *obj, Object_64 *obj64) { s32 temp_v0; s32 ret = 0; @@ -4150,24 +4153,24 @@ s32 func_800235DC(Object *obj, Object_64 *obj64) { switch (obj->segment.header->behaviorId) { case BHV_RACER: - ret = 0x224; + ret = sizeof(Object_Racer); break; case BHV_DOOR: case BHV_TT_DOOR: - ret = 0x18; + ret = sizeof(Object_TTDoor); break; case BHV_EXIT: - ret = 0x18; + ret = sizeof(Object_Exit); break; case BHV_ANIMATOR: - ret = 0xC; + ret = sizeof(Object_Animator); break; case BHV_AUDIO: - ret = 0x10; + ret = sizeof(Object_Audio); break; case BHV_AUDIO_LINE: case BHV_AUDIO_LINE_2: - ret = 0x14; + ret = sizeof(Object_AudioLine); break; case BHV_AINODE: ret = 0x1C; @@ -4175,40 +4178,40 @@ s32 func_800235DC(Object *obj, Object_64 *obj64) { case BHV_MODECHANGE: case BHV_BONUS: case BHV_TRIGGER: - ret = 0x18; + ret = sizeof(Object_Trigger); break; case BHV_AUDIO_REVERB: - ret = 0x6; + ret = sizeof(Object_AudioReverb); break; case BHV_TEXTURE_SCROLL: - ret = 0xC; + ret = sizeof(Object_TexScroll); break; case BHV_WEAPON: case BHV_WEAPON_2: - ret = 0x20; + ret = sizeof(Object_Weapon); break; case BHV_WEAPON_BALLOON: - ret = 0x8; + ret = sizeof(Object_WeaponBalloon); break; case BHV_BANANA: - ret = 0xC; + ret = sizeof(Object_Banana); break; case BHV_BRIDGE_WHALE_RAMP: - ret = 0x8; + ret = sizeof(Object_Bridge_WhaleRamp); break; case BHV_SEA_MONSTER: ret = 0x18; break; case BHV_COLLECT_EGG: - ret = 0xC; + ret = sizeof(Object_CollectEgg); break; case BHV_STOPWATCH_MAN: case BHV_PARK_WARDEN: case BHV_GOLDEN_BALLOON: - ret = 0x38; + ret = sizeof(Object_NPC); break; case BHV_LASER_GUN: - ret = 0x14; + ret = sizeof(Object_LaserGun); break; case BHV_OVERRIDE_POS: ret = 0x10; @@ -4235,13 +4238,13 @@ s32 func_800235DC(Object *obj, Object_64 *obj64) { case BHV_DOOR_OPENER: case BHV_PIG_ROCKETEER: case BHV_WIZPIG_GHOSTS: - ret = 0x48; + ret = sizeof(Object_AnimatedObject); break; case BHV_MIDI_FADE: - ret = 0x44; + ret = sizeof(Object_MidiFade); break; case BHV_MIDI_FADE_POINT: - ret = 0x20; + ret = sizeof(Object_MidiFadePoint); break; case BHV_MIDI_CHANNEL_SET: ret = 0x4; @@ -4249,29 +4252,29 @@ s32 func_800235DC(Object *obj, Object_64 *obj64) { case BHV_BUTTERFLY: temp_v0 = 0x10 - ((s32) obj64 & 0xF); obj->unk64 = (Object_64 *) &obj64->butterfly.triangles[0].verticesArray[temp_v0]; - ret = (temp_v0 + 0x110); + ret = (temp_v0 + sizeof(Object_Butterfly)); break; case BHV_FISH: temp_v0 = 0x10 - ((s32) obj64 & 0xF); obj->unk64 = (Object_64 *) &obj64->fish.triangles[0].verticesArray[temp_v0]; - ret = (temp_v0 + 0x120); + ret = (temp_v0 + sizeof(Object_Fish)); break; case BHV_CHARACTER_FLAG: temp_v0 = 0x10 - ((s32) obj64 & 0xF); obj->unk64 = (Object_64 *) &obj64->character_flag.triangles[0].verticesArray[temp_v0]; - ret = (temp_v0 + 0x28); + ret = (temp_v0 + sizeof(Object_CharacterFlag)); break; case BHV_UNK_5E: ret = 0x60; break; case BHV_TROPHY_CABINET: - ret = 0x8; + ret = sizeof(Object_TrophyCabinet); break; case BHV_FROG: - ret = 0x34; + ret = sizeof(Object_Frog); break; case BHV_FIREBALL_OCTOWEAPON_2: - ret = 0x20; + ret = sizeof(Object_Fireball_Octoweapon); break; default: obj->unk64 = NULL; diff --git a/src/objects.h b/src/objects.h index 91897748..3573c7cf 100644 --- a/src/objects.h +++ b/src/objects.h @@ -440,7 +440,7 @@ s32 init_object_shading(Object *obj, ShadeProperties *shading); ObjectHeader *func_8000C718(s32 index); s32 func_8000F99C(Object *); void func_8000C844(s32 arg0); -s32 func_800235DC(Object *obj, Object_64 *obj64); +s32 get_object_property_size(Object *obj, Object_64 *obj64); void light_setup_light_sources(Object *obj); s32 init_object_interaction_data(Object *arg0, ObjectInteraction *arg1); s32 func_8000FAC4(Object *obj, Object_6C *arg1); diff --git a/src/particles.c b/src/particles.c index 7d2730ab..f072b50e 100644 --- a/src/particles.c +++ b/src/particles.c @@ -54,13 +54,13 @@ ParticleType *D_800E2CCC = NULL; s32 D_800E2CD0 = 0; s32 D_800E2CD4 = 0; Particle *D_800E2CD8 = NULL; -s32 D_800E2CDC = 0; +UNUSED s32 D_800E2CDC = 0; // Only ever and checked for being less than 512. s32 *D_800E2CE0 = NULL; s32 *D_800E2CE4 = NULL; s32 gParticlesAssetTableCount = 0; s32 *gParticlesAssets = NULL; -unk800E2CF0 **gParticlesAssetTable = NULL; +ParticleProperties **gParticlesAssetTable = NULL; s32 gParticleBehavioursAssetTableCount = 0; s32 *gParticleBehavioursAssets = NULL; ParticleBehavior **gParticleBehavioursAssetTable = NULL; @@ -108,7 +108,7 @@ Vec3s D_800E2DF8[8] = { s16 D_800E2E28 = 0; -f32 D_800E2E2C[8] = { +f32 gParticleGravityTable[8] = { 0.0f, 0.1, 0.2f, 0.3f, 0.45f, 0.525f, 0.6f, 0.8f }; @@ -120,13 +120,13 @@ s32 D_800E2E5C = 0; Sprite **D_800E2E60 = NULL; s32 D_800E2E64 = 0; -XYStruct D_800E2E68[3] = { +XYStruct gParticleCoordListTri[3] = { { 0, 8 }, { 7, -4 }, { -7, -4 }, }; -XYStruct D_800E2E74[4] = { +XYStruct gParticleCoordListQuad[4] = { { -6, 6 }, { 6, 6 }, { 6, -6 }, @@ -146,13 +146,13 @@ s32 D_800E2EC4[10] = { 0x404040FF, 0x404040FF }; -s32 D_800E2EEC = 0x100; +s32 gParticleOpacity = 256; /*******************************/ /************ .bss ************/ -s32 D_80127C80; +s32 gParticleUpdateRate; s32 D_80127C84; s32 D_80127C88[6]; //printf.c @@ -238,12 +238,10 @@ void func_800AE490(void) { } void init_particle_assets(void) { - s32 *new_var2; s32 i; - u32 new_var; func_800AE490(); - gParticlesAssetTable = (unk800E2CF0 **) load_asset_section_from_rom(ASSET_PARTICLES_TABLE); + gParticlesAssetTable = (ParticleProperties **) load_asset_section_from_rom(ASSET_PARTICLES_TABLE); gParticlesAssetTableCount = -1; while (((s32) gParticlesAssetTable[gParticlesAssetTableCount + 1]) != -1) { gParticlesAssetTableCount++; @@ -251,140 +249,146 @@ void init_particle_assets(void) { gParticlesAssets = (s32 *) load_asset_section_from_rom(ASSET_PARTICLES); for (i = 0; i < gParticlesAssetTableCount; i++) { - gParticlesAssetTable[i] = (unk800E2CF0 *) (((u8 *) gParticlesAssets) + ((s32) gParticlesAssetTable[i])); + gParticlesAssetTable[i] = (ParticleProperties *) (((u8 *) gParticlesAssets) + ((s32) gParticlesAssetTable[i])); } - gParticleBehavioursAssetTable = (ParticleBehavior **) load_asset_section_from_rom(ASSET_PARTICLE_BEHAVIORS_TABLE); - gParticleBehavioursAssetTableCount = -1; - while (((s32) gParticleBehavioursAssetTable[gParticleBehavioursAssetTableCount + 1]) != -1) { - gParticleBehavioursAssetTableCount++; - } + gParticleBehavioursAssetTable = (ParticleBehavior **) load_asset_section_from_rom(ASSET_PARTICLE_BEHAVIORS_TABLE); + gParticleBehavioursAssetTableCount = -1; + while (((s32) gParticleBehavioursAssetTable[gParticleBehavioursAssetTableCount + 1]) != -1) { + gParticleBehavioursAssetTableCount++; + } gParticleBehavioursAssets = (s32 *) load_asset_section_from_rom(ASSET_PARTICLE_BEHAVIORS); for (i = 0; i < gParticleBehavioursAssetTableCount; i++) { - new_var = -1; gParticleBehavioursAssetTable[i] = (ParticleBehavior *) (((u8 *) gParticleBehavioursAssets) + ((s32) gParticleBehavioursAssetTable[i])); - if (((u32) gParticleBehavioursAssetTable[i]->unk9C) != new_var) { - new_var2 = gParticleBehavioursAssetTable[i]->unk9C; - gParticleBehavioursAssetTable[i]->unk9C = (s32 *) get_misc_asset((s32) new_var2); + if (((u32) gParticleBehavioursAssetTable[i]->unk9C) != 0xFFFFFFFF) { + gParticleBehavioursAssetTable[i]->unk9C = (s32 *) get_misc_asset((s32) gParticleBehavioursAssetTable[i]->unk9C); } } } GLOBAL_ASM("asm/non_matchings/particles/func_800AE728.s") -void func_800AEE14(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) { +/** + * Generate a triangle shaped particle mesh. + * Use a lookup table to generate the vertices. +*/ +void generate_particle_shape_triangle(ParticleModel *model, Vertex **vtx, Triangle **triangles) { s16 i; - Vertex *temp; - Triangle *tri; - XYStruct *temp2; + Vertex *tempVtx; + Triangle *tempTri; + XYStruct *coordList; - arg0->unk4 = 3; - arg0->unk8 = *arg1; - temp = *arg1; - temp2 = &D_800E2E68[0]; + model->vertexCount = 3; + model->vertices = *vtx; + tempVtx = *vtx; + coordList = &gParticleCoordListTri[0]; for (i = 0; i < 3; i++) { - temp->x = temp2->x; - temp->y = temp2->y; - temp2 += 1; - temp->z = 0; - temp->r = 255; - temp->g = 255; - temp->b = 255; - temp->a = 255; - temp++; + tempVtx->x = coordList->x; + tempVtx->y = coordList->y; + coordList++; + tempVtx->z = 0; + tempVtx->r = 255; + tempVtx->g = 255; + tempVtx->b = 255; + tempVtx->a = 255; + tempVtx++; } - *arg1 = temp; - arg0->unk6 = 1; - arg0->unkC = *arg2; - tri = *arg2; - tri->flags = 0x40; - tri->vi0 = 2; - tri->vi1 = 1; - tri->vi2 = 0; - tri++; - *arg2 = tri; + *vtx = tempVtx; + model->triangleCount = 1; + model->triangles = *triangles; + tempTri = *triangles; + tempTri->flags = RENDER_UNK_0000040; + tempTri->vi0 = 2; + tempTri->vi1 = 1; + tempTri->vi2 = 0; + tempTri++; + *triangles = tempTri; } -void func_800AEEB8(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) { +/** + * Generate a square shaped particle mesh. + * Use a lookup table to generate the vertices. +*/ +void generate_particle_shape_quad(ParticleModel *model, Vertex **vtx, Triangle **triangles) { s16 i; - Vertex *temp; - Triangle *tri; - XYStruct *temp2; + Vertex *tempVtx; + Triangle *tempTri; + XYStruct *coordList; - arg0->unk4 = 4; - arg0->unk8 = *arg1; - temp = *arg1; - temp2 = &D_800E2E74[0]; + model->vertexCount = 4; + model->vertices = *vtx; + tempVtx = *vtx; + coordList = &gParticleCoordListQuad[0]; for (i = 0; i < 4; i++) { - temp->x = temp2->x; - temp->y = temp2->y; - temp2 += 1; - temp->z = 0; - temp->r = 255; - temp->g = 255; - temp->b = 255; - temp->a = 255; - temp++; + tempVtx->x = coordList->x; + tempVtx->y = coordList->y; + coordList++; + tempVtx->z = 0; + tempVtx->r = 255; + tempVtx->g = 255; + tempVtx->b = 255; + tempVtx->a = 255; + tempVtx++; } - *arg1 = temp; - arg0->unk6 = 2; - arg0->unkC = *arg2; - tri = *arg2; - tri[0].flags = 0x40; - tri[0].vi0 = 3; - tri[0].uv0.u = 0; - tri[0].vi1 = 1; - tri[0].uv1.v = 0; - tri[0].vi2 = 0; - tri[0].uv2.u = 0; - tri[0].uv2.v = 0; - tri[1].flags = 0x40; - tri[1].vi0 = 3; - tri[1].uv0.u = 0; - tri[1].vi1 = 2; - tri[1].vi2 = 1; - tri[1].uv2.v = 0; - tri += 2; - *arg2 = tri; + *vtx = tempVtx; + model->triangleCount = 2; + model->triangles = *triangles; + tempTri = *triangles; + tempTri[0].flags = RENDER_UNK_0000040; + tempTri[0].vi0 = 3; + tempTri[0].uv0.u = 0; + tempTri[0].vi1 = 1; + tempTri[0].uv1.v = 0; + tempTri[0].vi2 = 0; + tempTri[0].uv2.u = 0; + tempTri[0].uv2.v = 0; + tempTri[1].flags = RENDER_UNK_0000040; + tempTri[1].vi0 = 3; + tempTri[1].uv0.u = 0; + tempTri[1].vi1 = 2; + tempTri[1].vi2 = 1; + tempTri[1].uv2.v = 0; + tempTri += 2; + *triangles = tempTri; } -void func_800AEF88(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) { +void func_800AEF88(ParticleModel *model, Vertex **vtx, Triangle **triangles) { s32 i; - Vertex *temp; + Vertex *tempVtx; - arg0->unk4 = 6; - arg0->unk6 = 4; - arg0->unk8 = *arg1; - arg0->unkC = *arg2; - temp = *arg1; + model->vertexCount = 6; + model->triangleCount = 4; + model->vertices = *vtx; + model->triangles = *triangles; + tempVtx = *vtx; for (i = 0; i < 6; i++) { - temp->r = 255; - temp->g = 255; - temp->b = 255; - temp->a = 255; - temp++; + tempVtx->r = 255; + tempVtx->g = 255; + tempVtx->b = 255; + tempVtx->a = 255; + tempVtx++; } - *arg1 = temp; + *vtx = tempVtx; } -void func_800AF024(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) { +void func_800AF024(ParticleModel *model, Vertex **vtx, Triangle **triangles) { s32 i; - Vertex *temp; + Vertex *tempVtx; - arg0->unk4 = 8; - arg0->unk6 = 8; - arg0->unk8 = *arg1; - arg0->unkC = *arg2; - temp = *arg1; + model->vertexCount = 8; + model->triangleCount = 8; + model->vertices = *vtx; + model->triangles = *triangles; + tempVtx = *vtx; for (i = 0; i < 16; i++) { - temp->r = 255; - temp->g = 255; - temp->b = 255; - temp->a = 255; - temp++; + tempVtx->r = 255; + tempVtx->g = 255; + tempVtx->b = 255; + tempVtx->a = 255; + tempVtx++; } - *arg1 = temp; + *vtx = tempVtx; } void func_800AF0A4(Particle *particle) { @@ -393,7 +397,7 @@ void func_800AF0A4(Particle *particle) { s16 temp_t1, temp_t8_0; s32 temp_t8; - temp_v0 = (Object_44 *) particle->unk44; + temp_v0 = (Object_44 *) particle->modelData; temp_v1 = temp_v0->unkC; temp_t8_0 = (temp_v0->unk0->unk0 - 1) << 5; temp_t8 = (s32)temp_t8_0; @@ -411,7 +415,7 @@ void func_800AF0F0(Particle *particle) { Object_44_C *temp_v1; s16 temp_t8, temp_t1; - temp_v0 = (Object_44 *) particle->unk44; + temp_v0 = (Object_44 *) particle->modelData; temp_v1 = temp_v0->unkC; temp_t8 = (temp_v0->unk0->unk0 - 1) << 5; temp_t1 = (temp_v0->unk0->unk1 - 1) << 5; @@ -423,44 +427,43 @@ void func_800AF0F0(Particle *particle) { temp_v1->unk1C = temp_t8; } -void func_800AF134(Particle *arg0, s32 arg1, s32 arg2, s16 arg3, s16 arg4, s16 arg5) { - ParticleBehavior *temp; - if (arg2 >= gParticlesAssetTableCount) { - arg2 = 0; +void func_800AF134(Particle *particle, s32 behaviourID, s32 propertyID, s16 velX, s16 velY, s16 velZ) { + ParticleBehavior *behaviour; + if (propertyID >= gParticlesAssetTableCount) { + propertyID = 0; } - if (arg1 >= gParticleBehavioursAssetTableCount) { - arg1 = 0; + if (behaviourID >= gParticleBehavioursAssetTableCount) { + behaviourID = 0; } - temp = gParticleBehavioursAssetTable[arg1]; - if (arg0->data.unk8 != arg2 || temp != arg0->data.behaviour) { - func_800B2260(arg0); - func_800AF29C(arg0, arg1, arg2, arg3, arg4, arg5); + behaviour = gParticleBehavioursAssetTable[behaviourID]; + if (particle->data.propertyID != propertyID || behaviour != particle->data.behaviour) { + func_800B2260(particle); + func_800AF29C(particle, behaviourID, propertyID, velX, velY, velZ); } } -void partInitTrigger(Particle *arg0, s32 arg1, s32 arg2) { - ParticleBehavior *temp_v0; +void partInitTrigger(Particle *particle, s32 behaviourID, s32 propertyID) { + ParticleBehavior *behaviour; - if (arg1 < gParticleBehavioursAssetTableCount) { - temp_v0 = gParticleBehavioursAssetTable[arg1]; - func_800AF29C(arg0, arg1, arg2, temp_v0->unk4, temp_v0->unk8, temp_v0->unkC); + if (behaviourID < gParticleBehavioursAssetTableCount) { + behaviour = gParticleBehavioursAssetTable[behaviourID]; + func_800AF29C(particle, behaviourID, propertyID, behaviour->velX, behaviour->velY, behaviour->velZ); } } -void func_800AF29C(Particle *arg0, s32 arg1, s32 arg2, s16 arg3, s16 arg4, s16 arg5) { - ParticleBehavior *temp_v1; - s32 temp_v0_2; +void func_800AF29C(Particle *arg0, s32 behaviourID, s32 propertyID, s16 velX, s16 velY, s16 velZ) { + ParticleBehavior *behaviour; s32 flags; - temp_v1 = gParticleBehavioursAssetTable[arg1]; - arg0->data.unk8 = arg2; - arg0->data.unk18 = arg3; - arg0->data.behaviour = temp_v1; - arg0->data.unk1A = arg4; - arg0->data.unk1C = arg5; + behaviour = gParticleBehavioursAssetTable[behaviourID]; + arg0->data.propertyID = propertyID; + arg0->data.behaviour = behaviour; + arg0->data.baseVelX = velX; + arg0->data.baseVelY = velY; + arg0->data.baseVelZ = velZ; arg0->data.unk1E = 0; - flags = temp_v1->flags; + flags = behaviour->flags; if (flags & 0x4000) { arg0->data.flags = 0x4000; @@ -471,25 +474,24 @@ void func_800AF29C(Particle *arg0, s32 arg1, s32 arg2, s16 arg3, s16 arg4, s16 a } else if (flags & 0x400) { arg0->data.unk6 = 0; arg0->data.flags = 0x400; - temp_v0_2 = gParticlesAssetTable[arg2]->unk8; - if (temp_v0_2 < 0x100) { - arg0->data.unk7 = temp_v0_2; + if (gParticlesAssetTable[propertyID]->lifeTime <= 255) { + arg0->data.lifeTime = gParticlesAssetTable[propertyID]->lifeTime; } else { - arg0->data.unk7 = 0xFF; + arg0->data.lifeTime = 255; } - arg0->data.unkC_400.unkC = (s32 *) allocate_from_main_pool_safe(arg0->data.unk7 * 4, COLOUR_TAG_SEMITRANS_GREY); - arg0->data.unkC_400.unk10 = temp_v1->unk14; - arg0->data.unkC_400.unk12 = temp_v1->unk16; - arg0->data.unkC_400.unk14 = temp_v1->unk22; - arg0->data.unkC_400.unk16 = temp_v1->unk24; + arg0->data.unkC_400.unkC = (s32 *) allocate_from_main_pool_safe(arg0->data.lifeTime * sizeof(uintptr_t), COLOUR_TAG_SEMITRANS_GREY); + arg0->data.unkC_400.unk10 = behaviour->unk14; + arg0->data.unkC_400.unk12 = behaviour->unk16; + arg0->data.unkC_400.unk14 = behaviour->unk22; + arg0->data.unkC_400.unk16 = behaviour->unk24; } else { arg0->data.flags = 0; - arg0->data.unkC.unkC = temp_v1->unk14; - arg0->data.unkC.unkE = temp_v1->unk16; - arg0->data.unkC.unk10 = temp_v1->unk18; - arg0->data.unkC.unk12 = temp_v1->unk22; - arg0->data.unkC.unk14 = temp_v1->unk24; - arg0->data.unkC.unk16 = temp_v1->unk26; + arg0->data.angle.y_rotation = behaviour->unk14; + arg0->data.angle.x_rotation = behaviour->unk16; + arg0->data.angle.z_rotation = behaviour->unk18; + arg0->data.angle.y_direction = behaviour->unk22; + arg0->data.angle.x_direction = behaviour->unk24; + arg0->data.angle.z_direction = behaviour->unk26; } } @@ -519,45 +521,45 @@ GLOBAL_ASM("asm/non_matchings/particles/func_800AF404.s") void func_800AF52C(Object *obj, s32 arg1) { s32 i; Particle *temp_v0; - ParticleBehavior *temp_v1; + ParticleBehavior *behaviour; Particle *temp; temp_v0 = (Particle *) &obj->unk6C[arg1]; - temp_v1 = temp_v0->data.behaviour; - temp_v0->data.unkA = 0; + behaviour = temp_v0->data.behaviour; + temp_v0->data.opacity = 0; if (temp_v0->data.flags & 0x4000) { - ((ObjectSegment *) temp_v0)->trans.x_position = obj->segment.trans.x_position; - ((ObjectSegment *) temp_v0)->trans.y_position = obj->segment.trans.y_position; - ((ObjectSegment *) temp_v0)->trans.z_position = obj->segment.trans.z_position; + temp_v0->segment.trans.x_position = obj->segment.trans.x_position; + temp_v0->segment.trans.y_position = obj->segment.trans.y_position; + temp_v0->segment.trans.z_position = obj->segment.trans.z_position; } else if (temp_v0->data.flags & 0x400) { - temp_v0->data.unkA = gParticlesAssetTable[temp_v0->data.unk8]->colour.a << 8; + temp_v0->data.opacity = gParticlesAssetTable[temp_v0->data.propertyID]->colour.a << 8; if (temp_v0->data.unk6 > 0) { // Useless if statement, since the loop already does this. for (i = 0; i < temp_v0->data.unk6; i++){ temp = temp_v0->data.unkC_60[i]; - temp->segment.particle.unk3A = 0; + temp->segment.particle.destroyTimer = 0; } } - if (temp_v1->flags & 1) { - temp_v0->data.unkC.unk10 = temp_v1->unk14; - temp_v0->data.unkC.unk12 = temp_v1->unk16; + if (behaviour->flags & 1) { + temp_v0->data.angle.z_rotation = behaviour->unk14; + temp_v0->data.angle.y_direction = behaviour->unk16; } - if (temp_v1->flags & 4) { - temp_v0->data.unkC.unk14 = temp_v1->unk22; - temp_v0->data.unkC.unk16 = temp_v1->unk24; + if (behaviour->flags & 4) { + temp_v0->data.angle.x_direction = behaviour->unk22; + temp_v0->data.angle.z_direction = behaviour->unk24; } } else { - if (temp_v1->flags & 1) { + if (behaviour->flags & 1) { temp_v0->data.unk6 = 0; - temp_v0->data.unkC.unkC = temp_v1->unk14; - temp_v0->data.unkC.unkE = temp_v1->unk16; - temp_v0->data.unkC.unk10 = temp_v1->unk18; + temp_v0->data.angle.y_rotation = behaviour->unk14; + temp_v0->data.angle.x_rotation = behaviour->unk16; + temp_v0->data.angle.z_rotation = behaviour->unk18; } - if (temp_v1->flags & 4) { - temp_v0->data.unk7 = 0; - temp_v0->data.unkC.unk12 = temp_v1->unk22; - temp_v0->data.unkC.unk14 = temp_v1->unk24; - temp_v0->data.unkC.unk16 = temp_v1->unk26; + if (behaviour->flags & 4) { + temp_v0->data.lifeTime = 0; + temp_v0->data.angle.y_direction = behaviour->unk22; + temp_v0->data.angle.x_direction = behaviour->unk24; + temp_v0->data.angle.z_direction = behaviour->unk26; } } temp_v0->data.flags &= 0xFDFF; @@ -597,7 +599,7 @@ void func_800AFE5C(Particle *arg0, Particle *arg1) { arg1->data.unk6 += 64; } } else if (arg1->data.flags & 0x400) { - if (arg1->data.unk6 < arg1->data.unk7) { + if (arg1->data.unk6 < arg1->data.lifeTime) { temp_s0 = func_800B0698(arg0, arg1); arg1->data.flags &= 0xDFFF; if (temp_s0 != NULL) { @@ -609,13 +611,13 @@ void func_800AFE5C(Particle *arg0, Particle *arg1) { } } } else { - while (arg1->data.unkA >= temp_s4->unk40) { - arg1->data.unkA -= temp_s4->unk40; + while (arg1->data.opacity >= temp_s4->unk40) { + arg1->data.opacity -= temp_s4->unk40; for (i = 0; i < temp_s4->unk42; i++) { tempObj2 = func_800B1130(arg0, arg1); if (tempObj2 != NULL) { func_8000E9D0((Object *) tempObj2); - func_800B22FC(tempObj2, arg1->data.unkA); + handle_particle_movement(tempObj2, arg1->data.opacity); } arg1->data.flags &= ~0x2000; } @@ -637,15 +639,15 @@ void func_800B0010(Particle *arg0, Particle *arg1, Particle *arg2, ParticleBehav arg0->segment.y_velocity = 0.0f; arg0->segment.z_velocity = 0.0f; } - flags = arg3->unk5C & (0x400 | 0x200 | 0x100); + flags = arg3->behaviourFlags & (PARTICLE_VEL_Z | PARTICLE_VEL_Y | PARTICLE_VEL_X); if (flags) { - if (flags & 0x100) { + if (flags & PARTICLE_VEL_X) { arg0->segment.x_velocity += (f32) get_random_number_from_range(-arg3->velocityRangeX1, arg3->velocityRangeX1) * 0.00001525878906; } - if (flags & 0x200) { + if (flags & PARTICLE_VEL_Y) { arg0->segment.y_velocity += (f32) get_random_number_from_range(-arg3->velocityRangeY1, arg3->velocityRangeY1) * 0.00001525878906; } - if (flags & 0x400) { + if (flags & PARTICLE_VEL_Z) { arg0->segment.z_velocity += (f32) get_random_number_from_range(-arg3->velocityRangeZ1, arg3->velocityRangeZ1) * 0.00001525878906; } } @@ -665,22 +667,22 @@ void func_800B0010(Particle *arg0, Particle *arg1, Particle *arg2, ParticleBehav velocityPos.x = 0.0f; velocityPos.y = 0.0f; velocityPos.z = -arg3->unk3C; - flags = arg3->unk5C; - if (flags & 0x10) { + flags = arg3->behaviourFlags; + if (flags & PARTICLE_UNK00000010) { velocityPos.z += (f32) get_random_number_from_range(-arg3->gravityRange2, arg3->gravityRange2) * 0.00001525878906; } - if (flags & (0x40 | 0x20)) { - angle.y_rotation = arg2->data.angle.unk12; - if (flags & 0x20) { + if (flags & (PARTICLE_UNK00000040 | PARTICLE_UNK00000020)) { + angle.y_rotation = arg2->data.angle.y_direction; + if (flags & PARTICLE_UNK00000020) { angle.y_rotation += get_random_number_from_range(-arg3->angleRangeY2, arg3->angleRangeY2); } - angle.x_rotation = arg2->data.angle.unk14; - if (flags & 0x40) { + angle.x_rotation = arg2->data.angle.x_direction; + if (flags & PARTICLE_UNK00000040) { angle.x_rotation += get_random_number_from_range(-arg3->angleRangeX2, arg3->angleRangeX2); } f32_vec3_apply_object_rotation3((ObjectTransform* ) &angle, (f32*) &velocityPos); } else { - f32_vec3_apply_object_rotation3((ObjectTransform* ) &arg2->data.angle.unk12, (f32*) &velocityPos); + f32_vec3_apply_object_rotation3((ObjectTransform* ) &arg2->data.angle.y_direction, (f32*) &velocityPos); } f32_vec3_apply_object_rotation((ObjectTransform* ) arg0->segment.unk3C, (f32*) &velocityPos); arg0->segment.x_velocity += velocityPos.x; @@ -689,68 +691,68 @@ void func_800B0010(Particle *arg0, Particle *arg1, Particle *arg2, ParticleBehav } } -void func_800B03C0(Particle *arg0, Particle *arg1, Particle *arg2, ParticleBehavior *behaviour) { +void func_800B03C0(Particle *particle, Particle *arg1, Particle *arg2, ParticleBehavior *behaviour) { s32 flags; Vec3f posVel; Vec3s angle; - arg0->somePosX = arg2->data.unk18; - arg0->somePosY = arg2->data.unk1A; - arg0->somePosZ = arg2->data.unk1C; - arg0->forwardVel = behaviour->forwardVel; - if (behaviour->unk5C & 0x80000) { - arg0->forwardVel += (f32) get_random_number_from_range(-behaviour->velocityRange, behaviour->velocityRange) * 0.00001525878906; // 0.00001525878906 ~= 1.0/65536.0 + particle->baseVelX = arg2->data.baseVelX; + particle->baseVelY = arg2->data.baseVelY; + particle->baseVelZ = arg2->data.baseVelZ; + particle->forwardVel = behaviour->forwardVel; + if (behaviour->behaviourFlags & PARTICLE_FORWARDVEL) { + particle->forwardVel += (f32) get_random_number_from_range(-behaviour->velocityRange, behaviour->velocityRange) * 0.00001525878906; // 0.00001525878906 ~= 1.0/65536.0 } if (behaviour->flags & 1) { posVel.x = 0.0f; posVel.y = 0.0f; posVel.z = -behaviour->unk10; - flags = behaviour->unk5C; - if (flags & 1) { + flags = behaviour->behaviourFlags; + if (flags & PARTICLE_GRAVITY) { posVel.z += (f32) get_random_number_from_range(-behaviour->gravityRange1, behaviour->gravityRange1) * 0.00001525878906; } - if (flags & (4 | 2)) { + if (flags & (PARTICLE_UNK00000004 | PARTICLE_UNK00000002)) { angle.y_rotation = arg2->data.angle.y_rotation; - if (flags & 2) { + if (flags & PARTICLE_UNK00000002) { angle.y_rotation += get_random_number_from_range(-behaviour->angleRangeY1, behaviour->angleRangeY1); } angle.x_rotation = arg2->data.angle.x_rotation; - if (flags & 4) { + if (flags & PARTICLE_UNK00000004) { angle.x_rotation += get_random_number_from_range(-behaviour->angleRangeX1, behaviour->angleRangeX1); } f32_vec3_apply_object_rotation3((ObjectTransform* ) &angle, (f32 *) &posVel); } else { f32_vec3_apply_object_rotation((ObjectTransform* ) &arg2->data.angle.y_rotation, (f32 *) &posVel); } - arg0->somePosX += posVel.x; - arg0->somePosY += posVel.y; - arg0->somePosZ += posVel.z; + particle->baseVelX += posVel.x; + particle->baseVelY += posVel.y; + particle->baseVelZ += posVel.z; } - if (arg0->segment.particle.unk39 != 4) { - f32_vec3_apply_object_rotation((ObjectTransform *) arg1, &arg0->somePosX); + if (particle->segment.particle.movementType != PARTICLE_MOVEMENT_BASIC_PARENT) { + f32_vec3_apply_object_rotation((ObjectTransform *) arg1, &particle->baseVelX); } - arg0->segment.trans.x_position = arg0->somePosX; - arg0->segment.trans.y_position = arg0->somePosY; - arg0->segment.trans.z_position = arg0->somePosZ; - if (arg0->segment.particle.unk39 == 4) { - f32_vec3_apply_object_rotation((ObjectTransform *) arg1, &arg0->segment.trans.x_position); + particle->segment.trans.x_position = particle->baseVelX; + particle->segment.trans.y_position = particle->baseVelY; + particle->segment.trans.z_position = particle->baseVelZ; + if (particle->segment.particle.movementType == PARTICLE_MOVEMENT_BASIC_PARENT) { + f32_vec3_apply_object_rotation((ObjectTransform *) arg1, &particle->segment.trans.x_position); } - arg0->segment.trans.x_position += arg1->segment.trans.x_position; - arg0->segment.trans.y_position += arg1->segment.trans.y_position; - arg0->segment.trans.z_position += arg1->segment.trans.z_position; + particle->segment.trans.x_position += arg1->segment.trans.x_position; + particle->segment.trans.y_position += arg1->segment.trans.y_position; + particle->segment.trans.z_position += arg1->segment.trans.z_position; } Particle *func_800B0698(Particle *arg0, Particle *arg1) { - unk800E2CF0 *sp2C; + ParticleProperties *properties; Particle *var_v0; - TextureHeader **sp24; + TextureHeader **texture; ParticleBehavior *sp20; f32 temp_f0; f32 temp_f14; f32 temp_f2; - sp2C = gParticlesAssetTable[arg1->data.unk8]; - if (sp2C->unk0 != 4) { + properties = gParticlesAssetTable[arg1->data.propertyID]; + if (properties->unk0 != 4) { return NULL; } sp20 = arg1->data.behaviour; @@ -758,97 +760,97 @@ Particle *func_800B0698(Particle *arg0, Particle *arg1) { if (var_v0 == NULL) { return var_v0; } - var_v0->segment.particle.unk2E = arg0->segment.particle.unk2E; - var_v0->segment.trans.flags = -0x8000; - var_v0->segment.particle.unk39 = sp2C->unk1; - var_v0->segment.unk40 = sp2C->unk2; + var_v0->segment.particle.blockID = arg0->segment.particle.blockID; + var_v0->segment.trans.flags = -OBJ_FLAGS_DEACTIVATED; + var_v0->segment.particle.movementType = properties->movementType; + var_v0->segment.unk40 = properties->unk2; var_v0->segment.unk3C = arg0; var_v0->unk70 = arg1; - var_v0->segment.trans.scale = sp2C->scale * sp20->unk50; - var_v0->segment.unk28 = sp2C->scale * sp20->unk54; - var_v0->segment.particle.unk3A = sp2C->unk8; + var_v0->segment.trans.scale = properties->scale * sp20->unk50; + var_v0->segment.scaleVel = properties->scale * sp20->unk54; + var_v0->segment.particle.destroyTimer = properties->lifeTime; var_v0->segment.particle.unk34 = 0.0f; var_v0->segment.particle.unk38 = 0.0f; - var_v0->colour.r = sp2C->colour.r; - var_v0->colour.g = sp2C->colour.g; - var_v0->colour.b = sp2C->colour.b; - var_v0->colour.a = sp2C->colour.a; + var_v0->colour.r = properties->colour.r; + var_v0->colour.g = properties->colour.g; + var_v0->colour.b = properties->colour.b; + var_v0->colour.a = properties->colour.a; if (var_v0->segment.unk40 & 0x800 && arg0->unk54_ptr != NULL) { - var_v0->unk4A = *arg0->unk54_ptr * 255.0f; + var_v0->brightness = *arg0->unk54_ptr * 255.0f; } else { - var_v0->unk4A = 0xFF; + var_v0->brightness = 255; } - var_v0->unk60 = sp2C->unkE; + var_v0->opacityTimer = properties->opacityTimer; if (arg1->data.flags & 0x100) { - var_v0->unk5C = arg1->data.unkA; + var_v0->opacity = arg1->data.opacity; } else { - var_v0->unk5C = sp2C->unkC << 8; + var_v0->opacity = properties->opacity << 8; } - if (sp2C->unkC < 255) { + if (properties->opacity < 255) { if (var_v0->segment.unk40 & 0x1000) { var_v0->segment.trans.flags |= 0x100; } else { var_v0->segment.trans.flags |= 0x80; } } - if (var_v0->unk60 < var_v0->segment.particle.unk3A) { - var_v0->unk5E = ((sp2C->unkD << 8) - (var_v0->unk5C & 0xFFFF)) / (var_v0->segment.particle.unk3A - var_v0->unk60); + if (var_v0->opacityTimer < var_v0->segment.particle.destroyTimer) { + var_v0->opacityVel = ((properties->opacityVel << 8) - (var_v0->opacity & 0xFFFF)) / (var_v0->segment.particle.destroyTimer - var_v0->opacityTimer); } else { - var_v0->unk5E = 0; + var_v0->opacityVel = 0; } func_800B03C0(var_v0, arg0, arg1, sp20); if (sp20->flags & 0x80) { - var_v0->segment.trans.y_rotation = sp20->angleVelY; - var_v0->segment.trans.x_rotation = sp20->angleVelX; - var_v0->segment.trans.z_rotation = sp20->angleVelZ; + var_v0->segment.trans.y_rotation = sp20->angleOffsetY; + var_v0->segment.trans.x_rotation = sp20->angleOffsetX; + var_v0->segment.trans.z_rotation = sp20->angleOffsetZ; } else { - var_v0->segment.trans.y_rotation = arg0->segment.trans.y_rotation + sp20->angleVelY; - var_v0->segment.trans.x_rotation = arg0->segment.trans.x_rotation + sp20->angleVelX; - var_v0->segment.trans.z_rotation = arg0->segment.trans.z_rotation + sp20->angleVelZ; + var_v0->segment.trans.y_rotation = arg0->segment.trans.y_rotation + sp20->angleOffsetY; + var_v0->segment.trans.x_rotation = arg0->segment.trans.x_rotation + sp20->angleOffsetX; + var_v0->segment.trans.z_rotation = arg0->segment.trans.z_rotation + sp20->angleOffsetZ; } - var_v0->unk62 = sp20->unk4A; - var_v0->unk64 = sp20->unk4C; - var_v0->unk66 = sp20->unk4E; + var_v0->angleVelY = sp20->angleVelY; + var_v0->angleVelX = sp20->angleVelX; + var_v0->angleVelZ = sp20->angleVelZ; func_800B0010(var_v0, arg0, arg1, sp20); - var_v0->unk68f = D_800E2E2C[(var_v0->segment.unk40 >> 4) & 7]; - if (var_v0->segment.particle.unk39 == 5) { + var_v0->gravity = gParticleGravityTable[(var_v0->segment.unk40 >> 4) & 7]; + if (var_v0->segment.particle.movementType == PARTICLE_MOVEMENT_VELOCITY) { temp_f0 = var_v0->segment.x_velocity; temp_f2 = var_v0->segment.y_velocity; temp_f14 = var_v0->segment.z_velocity; var_v0->forwardVel = sqrtf((temp_f0 * temp_f0) + (temp_f2 * temp_f2) + (temp_f14 * temp_f14)); } if (sp20->flags & 2) { - arg1->data.unkC.unk10 += sp20->unk1C; - arg1->data.unkC.unk12 += sp20->unk1E; + arg1->data.angle.z_rotation += sp20->unk1C; + arg1->data.angle.y_direction += sp20->unk1E; } if (sp20->flags & 8) { - arg1->data.unkC.unk14 += sp20->unk2A; - arg1->data.unkC.unk16 += sp20->unk2C; + arg1->data.angle.x_direction += sp20->unk2A; + arg1->data.angle.z_direction += sp20->unk2C; } - var_v0->segment.unk1A = sp2C->unk6; - var_v0->segment.unk18 = 0; - sp24 = (TextureHeader **) var_v0->unk44; - if (sp2C->unk4 == -1) { - *sp24 = NULL; + var_v0->segment.unk1A = properties->unk6; + var_v0->segment.textureFrame = 0; + texture = &var_v0->modelData->texture; + if (properties->textureID == -1) { + *texture = NULL; } else { - *sp24 = load_texture(sp2C->unk4); - if ((*sp24) != NULL) { - if ((*sp24)->flags & 4) { + *texture = load_texture(properties->textureID); + if ((*texture) != NULL) { + if ((*texture)->flags & 4) { if (var_v0->segment.unk40 & 0x1000) { - var_v0->segment.trans.flags |= 0x100; + var_v0->segment.trans.flags |= OBJ_FLAGS_UNK_0100; } else { - var_v0->segment.trans.flags |= 0x80; + var_v0->segment.trans.flags |= OBJ_FLAGS_UNK_0080; } } if ((var_v0->segment.unk40 & 3) == 2) { - var_v0->segment.unk18 = (*sp24)->numOfTextures - 1; + var_v0->segment.textureFrame = (*texture)->numOfTextures - 1; } } } - var_v0->unk75 = 0; - var_v0->unk76 = ((u32) (u16) sp2C->unkA) >> 10; + var_v0->modelFrame = 0; + var_v0->unk76 = ((u32) (u16) properties->lifeTimeRange) >> 10; var_v0->unk77 = 0; - if (*sp24 == NULL) { + if (*texture == NULL) { func_800B2040(var_v0); return NULL; } @@ -858,51 +860,51 @@ Particle *func_800B0698(Particle *arg0, Particle *arg1) { GLOBAL_ASM("asm/non_matchings/particles/func_800B0BAC.s") Particle *func_800B1130(Particle *arg0, Particle *arg1) { - s32 sp3C; - unk800E2CF0 *sp38; + s32 flags; + ParticleProperties *properties; Particle* var_v0; - TextureHeader **sp30; - ParticleBehavior *partBeh; + TextureHeader **texture; + ParticleBehavior *behaviour; unk800B1130_SP28 *sp28; f32 sp24; s8 sp23; - sp38 = gParticlesAssetTable[arg1->data.unk8]; - if (sp38->unk0 == 3 || sp38->unk0 == 4) { + properties = gParticlesAssetTable[arg1->data.propertyID]; + if (properties->unk0 == 3 || properties->unk0 == 4) { return NULL; } - partBeh = arg1->data.behaviour; - sp28 = (unk800B1130_SP28 *) partBeh->unk9C; + behaviour = arg1->data.behaviour; + sp28 = (unk800B1130_SP28 *) behaviour->unk9C; - var_v0 = func_800B1CB8(sp38->unk0); + var_v0 = func_800B1CB8(properties->unk0); if (var_v0 == NULL) { return var_v0; } - var_v0->segment.particle.unk2E = arg0->segment.particle.unk2E; - var_v0->segment.trans.flags = -0x8000; - var_v0->segment.particle.unk39 = sp38->unk1; - var_v0->segment.unk40 = sp38->unk2; + var_v0->segment.particle.blockID = arg0->segment.particle.blockID; + var_v0->segment.trans.flags = -OBJ_FLAGS_DEACTIVATED; + var_v0->segment.particle.movementType = properties->movementType; + var_v0->segment.unk40 = properties->unk2; var_v0->segment.unk3C = arg0; if (var_v0->segment.unk40 & 0x800 && arg0->unk54_ptr != NULL) { - var_v0->unk4A = *arg0->unk54_ptr * 255.0f; + var_v0->brightness = *arg0->unk54_ptr * 255.0f; } else { - var_v0->unk4A = 255; + var_v0->brightness = 255; } - sp24 = partBeh->unk50; - if (partBeh->unk5C & 0x20000) { - sp24 += (f32) get_random_number_from_range(-partBeh->unk8C, partBeh->unk8C) * 0.00001525878906; + sp24 = behaviour->unk50; + if (behaviour->behaviourFlags & PARTICLE_UNK00020000) { + sp24 += (f32) get_random_number_from_range(-behaviour->unk8C, behaviour->unk8C) * 0.00001525878906; } - var_v0->segment.trans.scale = sp38->scale * sp24; - sp24 = partBeh->unk54; - if (partBeh->unk5C & 0x40000) { - sp24 += (f32) get_random_number_from_range(-partBeh->unk90, partBeh->unk90) * 0.00001525878906; + var_v0->segment.trans.scale = properties->scale * sp24; + sp24 = behaviour->unk54; + if (behaviour->behaviourFlags & PARTICLE_UNK00040000) { + sp24 += (f32) get_random_number_from_range(-behaviour->unk90, behaviour->unk90) * 0.00001525878906; } - if (partBeh->flags & 0x1000) { - var_v0->segment.unk28 = sqrtf((arg0->segment.x_velocity * arg0->segment.x_velocity) + (arg0->segment.y_velocity * arg0->segment.y_velocity) + (arg0->segment.z_velocity * arg0->segment.z_velocity)) * sp24 * 0.1f; + if (behaviour->flags & 0x1000) { + var_v0->segment.scaleVel = sqrtf((arg0->segment.x_velocity * arg0->segment.x_velocity) + (arg0->segment.y_velocity * arg0->segment.y_velocity) + (arg0->segment.z_velocity * arg0->segment.z_velocity)) * sp24 * 0.1f; } else { - var_v0->segment.unk28 = sp38->scale * sp24; + var_v0->segment.scaleVel = properties->scale * sp24; } - var_v0->segment.particle.unk3A = get_random_number_from_range(-sp38->unkA, sp38->unkA) + sp38->unk8; + var_v0->segment.particle.destroyTimer = get_random_number_from_range(-properties->lifeTimeRange, properties->lifeTimeRange) + properties->lifeTime; var_v0->segment.particle.unk38 = 0.0f; var_v0->segment.particle.unk34 = 0.0f; if (D_800E2D00[0].word != 0) { @@ -917,86 +919,86 @@ Particle *func_800B1130(Particle *arg0, Particle *arg1) { var_v0->colour.b = sp28[arg1->data.unk1E + 2].b; var_v0->colour.a = sp28[arg1->data.unk1E + 2].a; } else { - var_v0->colour.r = sp38->colour.r; - var_v0->colour.g = sp38->colour.g; - var_v0->colour.b = sp38->colour.b; - var_v0->colour.a = sp38->colour.a; + var_v0->colour.r = properties->colour.r; + var_v0->colour.g = properties->colour.g; + var_v0->colour.b = properties->colour.b; + var_v0->colour.a = properties->colour.a; } - sp3C = partBeh->unk5C & 0xF00000; - if (sp3C != 0) { - if (sp3C & 0x100000) { - var_v0->colour.r += get_random_number_from_range(-partBeh->colourRangeR, partBeh->colourRangeR); + flags = behaviour->behaviourFlags & (PARTICLE_COLOURVEL_ALPHA | PARTICLE_COLOURVEL_BLUE | PARTICLE_COLOURVEL_GREEN | PARTICLE_COLOURVEL_RED); + if (flags) { + if (flags & PARTICLE_COLOURVEL_RED) { + var_v0->colour.r += get_random_number_from_range(-behaviour->colourRangeR, behaviour->colourRangeR); } - if ((sp3C << 10) < 0) { - var_v0->colour.g += get_random_number_from_range(-partBeh->colourRangeG, partBeh->colourRangeG); + if (flags & PARTICLE_COLOURVEL_GREEN) { + var_v0->colour.g += get_random_number_from_range(-behaviour->colourRangeG, behaviour->colourRangeG); } - if ((sp3C << 9) < 0) { - var_v0->colour.b += get_random_number_from_range(-partBeh->colourRangeB, partBeh->colourRangeB); + if (flags & PARTICLE_COLOURVEL_BLUE) { + var_v0->colour.b += get_random_number_from_range(-behaviour->colourRangeB, behaviour->colourRangeB); } - if ((sp3C << 8) < 0) { - var_v0->colour.a += get_random_number_from_range(-partBeh->colourRangeA, partBeh->colourRangeA); + if (flags & PARTICLE_COLOURVEL_ALPHA) { + var_v0->colour.a += get_random_number_from_range(-behaviour->colourRangeA, behaviour->colourRangeA); } } - var_v0->unk60 = sp38->unkE; - var_v0->unk5C = sp38->unkC * D_800E2EEC; - if (sp38->unkC < 0xFF) { + var_v0->opacityTimer = properties->opacityTimer; + var_v0->opacity = properties->opacity * gParticleOpacity; + if (properties->opacity < 255) { if (var_v0->segment.unk40 & 0x1000) { - var_v0->segment.trans.flags |= 0x100; + var_v0->segment.trans.flags |= OBJ_FLAGS_UNK_0100; } else { - var_v0->segment.trans.flags |= 0x80; + var_v0->segment.trans.flags |= OBJ_FLAGS_UNK_0080; } } - if (var_v0->unk60 < var_v0->segment.particle.unk3A) { - var_v0->unk5E = (s16) (((sp38->unkD - sp38->unkC) * D_800E2EEC) / (var_v0->segment.particle.unk3A - var_v0->unk60)); + if (var_v0->opacityTimer < var_v0->segment.particle.destroyTimer) { + var_v0->opacityVel = (s16) (((properties->opacityVel - properties->opacity) * gParticleOpacity) / (var_v0->segment.particle.destroyTimer - var_v0->opacityTimer)); } else { - var_v0->unk5E = 0; + var_v0->opacityVel = 0; } sp23 = 0; - var_v0->segment.unk1A = sp38->unk6; + var_v0->segment.unk1A = properties->unk6; if (var_v0->segment.particle.unk2C == 0x80) { - var_v0->unk44 = (unk800B0698_44 *) func_8007C12C(sp38->unk4, 0); - if (var_v0->unk44 != 0) { - if ((*var_v0->unk44_2->unk8)->unk6 & 4) { + var_v0->modelData = (ParticleModel *) func_8007C12C(properties->textureID, 0); + if (var_v0->modelData) { + if ((*var_v0->unk44_1->unk8)->unk6 & 4) { if (var_v0->segment.unk40 & 0x1000) { var_v0->segment.trans.flags |= OBJ_FLAGS_UNK_0100; } else { var_v0->segment.trans.flags |= OBJ_FLAGS_UNK_0080; } } - if (partBeh->flags & 0x800) { - var_v0->segment.unk18 = get_random_number_from_range(0, var_v0->unk44->unk0 - 1) << 8; + if (behaviour->flags & PARTICLE_ANGLE_Y) { + var_v0->segment.textureFrame = get_random_number_from_range(0, var_v0->unk44_1->textureCount - 1) << 8; if ((var_v0->segment.unk40 & 3) == 2) { - var_v0->segment.unk18 |= 0xFF; + var_v0->segment.textureFrame |= 0xFF; } } else if ((var_v0->segment.unk40 & 3) == 2) { - var_v0->segment.unk18 = (var_v0->unk44->unk0 << 8) - 1; + var_v0->segment.textureFrame = (var_v0->unk44_1->textureCount << 8) - 1; } else { - var_v0->segment.unk18 = 0; + var_v0->segment.textureFrame = 0; } } else { sp23 = 1; } } else if ((var_v0->segment.particle.unk2C == 2) || (var_v0->segment.particle.unk2C == 1)) { - sp30 = (TextureHeader **) var_v0->unk44; - if (sp30 != 0) { - (*sp30) = load_texture(sp38->unk4); - if ((*sp30) != NULL) { - if ((*sp30)->flags & 4) { + texture = &var_v0->modelData->texture; + if (texture) { + *texture = load_texture(properties->textureID); + if (*texture != NULL) { + if ((*texture)->flags & 4) { if (var_v0->segment.unk40 & 0x1000) { var_v0->segment.trans.flags |= OBJ_FLAGS_UNK_0100; } else { var_v0->segment.trans.flags |= OBJ_FLAGS_UNK_0080; } } - if (partBeh->flags & 0x800) { - var_v0->segment.unk18 = get_random_number_from_range(0, ((*sp30)->numOfTextures >> 8) - 1) << 8; + if (behaviour->flags & 0x800) { + var_v0->segment.textureFrame = get_random_number_from_range(0, ((*texture)->numOfTextures >> 8) - 1) << 8; if ((var_v0->segment.unk40 & 3) == 2) { - var_v0->segment.unk18 |= 0xFF; + var_v0->segment.textureFrame |= 0xFF; } } else if ((var_v0->segment.unk40 & 3) == 2) { - var_v0->segment.unk18 = (*sp30)->numOfTextures - 1; + var_v0->segment.textureFrame = (*texture)->numOfTextures - 1; } else { - var_v0->segment.unk18 = 0; + var_v0->segment.textureFrame = 0; } } else { sp23 = 1; @@ -1011,67 +1013,67 @@ Particle *func_800B1130(Particle *arg0, Particle *arg1) { func_800AF0F0(var_v0); } } - func_800B03C0(var_v0, arg0, arg1, partBeh); - if (partBeh->flags & 0x80) { - var_v0->segment.trans.y_rotation = partBeh->angleVelY; - var_v0->segment.trans.x_rotation = partBeh->angleVelX; - var_v0->segment.trans.z_rotation = partBeh->angleVelZ; + func_800B03C0(var_v0, arg0, arg1, behaviour); + if (behaviour->flags & 0x80) { + var_v0->segment.trans.y_rotation = behaviour->angleOffsetY; + var_v0->segment.trans.x_rotation = behaviour->angleOffsetX; + var_v0->segment.trans.z_rotation = behaviour->angleOffsetZ; } else { - var_v0->segment.trans.y_rotation = arg0->segment.trans.y_rotation + partBeh->angleVelY; - var_v0->segment.trans.x_rotation = arg0->segment.trans.x_rotation + partBeh->angleVelX; - var_v0->segment.trans.z_rotation = arg0->segment.trans.z_rotation + partBeh->angleVelZ; + var_v0->segment.trans.y_rotation = arg0->segment.trans.y_rotation + behaviour->angleOffsetY; + var_v0->segment.trans.x_rotation = arg0->segment.trans.x_rotation + behaviour->angleOffsetX; + var_v0->segment.trans.z_rotation = arg0->segment.trans.z_rotation + behaviour->angleOffsetZ; } - sp3C = partBeh->unk5C & 0x3800; - if (sp3C != 0) { - if (sp3C & 0x800) { - var_v0->segment.trans.y_rotation += get_random_number_from_range(-partBeh->angleRangeY3, partBeh->angleRangeY3); + flags = behaviour->behaviourFlags & (PARTICLE_ANGLE_Z | PARTICLE_ANGLE_X | PARTICLE_ANGLE_Y); + if (flags != 0) { + if (flags & PARTICLE_ANGLE_Y) { + var_v0->segment.trans.y_rotation += get_random_number_from_range(-behaviour->angleRangeY3, behaviour->angleRangeY3); } - if (sp3C & 0x1000) { - var_v0->segment.trans.x_rotation += get_random_number_from_range(-partBeh->angleRangeX3, partBeh->angleRangeX3); + if (flags & PARTICLE_ANGLE_X) { + var_v0->segment.trans.x_rotation += get_random_number_from_range(-behaviour->angleRangeX3, behaviour->angleRangeX3); } - if (sp3C & 0x2000) { - var_v0->segment.trans.z_rotation += get_random_number_from_range(-partBeh->angleRangeZ3, partBeh->angleRangeZ3); + if (flags & PARTICLE_ANGLE_Z) { + var_v0->segment.trans.z_rotation += get_random_number_from_range(-behaviour->angleRangeZ3, behaviour->angleRangeZ3); } } - var_v0->unk62 = partBeh->unk4A; - var_v0->unk64 = partBeh->unk4C; - var_v0->unk66 = partBeh->unk4E; - sp3C = partBeh->unk5C & (0x10000 | 0x8000 | 0x4000); - if (sp3C != 0) { - if (sp3C & 0x4000) { - var_v0->unk62 += get_random_number_from_range(-partBeh->unk86, partBeh->unk86); + var_v0->angleVelY = behaviour->angleVelY; + var_v0->angleVelX = behaviour->angleVelX; + var_v0->angleVelZ = behaviour->angleVelZ; + flags = behaviour->behaviourFlags & (PARTICLE_ANGLEVEL_Z | PARTICLE_ANGLEVEL_X | PARTICLE_ANGLEVEL_Y); + if (flags) { + if (flags & PARTICLE_ANGLEVEL_Y) { + var_v0->angleVelY += get_random_number_from_range(-behaviour->unk86, behaviour->unk86); } - if (sp3C & 0x8000) { - var_v0->unk64 += get_random_number_from_range(-partBeh->unk88, partBeh->unk88); + if (flags & PARTICLE_ANGLEVEL_X) { + var_v0->angleVelX += get_random_number_from_range(-behaviour->unk88, behaviour->unk88); } - if ((sp3C << 0xF) < 0) { - var_v0->unk66 += get_random_number_from_range(-partBeh->unk8A, partBeh->unk8A); + if (flags & PARTICLE_ANGLEVEL_Z) { + var_v0->angleVelZ += get_random_number_from_range(-behaviour->unk8A, behaviour->unk8A); } } - func_800B0010(var_v0, arg0, arg1, partBeh); - var_v0->unk68f = D_800E2E2C[(var_v0->segment.unk40 >> 4) & 7]; - if (var_v0->segment.particle.unk39 == 5) { + func_800B0010(var_v0, arg0, arg1, behaviour); + var_v0->gravity = gParticleGravityTable[(var_v0->segment.unk40 >> 4) & 7]; + if (var_v0->segment.particle.movementType == PARTICLE_MOVEMENT_VELOCITY) { var_v0->forwardVel = sqrtf((var_v0->segment.x_velocity * var_v0->segment.x_velocity) + (var_v0->segment.y_velocity * var_v0->segment.y_velocity) + (var_v0->segment.z_velocity * var_v0->segment.z_velocity)); } - if (partBeh->flags & 2) { + if (behaviour->flags & 2) { arg1->data.unk6++; - if (arg1->data.unk6 >= partBeh->unk1A) { - arg1->data.unkC.unkC += partBeh->unk1C; - arg1->data.unkC.unkE += partBeh->unk1E; - arg1->data.unkC.unk10 += partBeh->unk18; - arg1->data.unk6 -= partBeh->unk1A; + if (arg1->data.unk6 >= behaviour->unk1A) { + arg1->data.angle.y_rotation += behaviour->unk1C; + arg1->data.angle.x_rotation += behaviour->unk1E; + arg1->data.angle.z_rotation += behaviour->unk18; + arg1->data.unk6 -= behaviour->unk1A; } } - if (partBeh->flags & 8) { - arg1->data.unk7++; - if (arg1->data.unk7 >= partBeh->unk28) { - arg1->data.unkC.unk12 += partBeh->unk2A; - arg1->data.unkC.unk14 += partBeh->unk2C; - arg1->data.unkC.unk16 += partBeh->unk2E; - arg1->data.unk7 -= partBeh->unk28; + if (behaviour->flags & 8) { + arg1->data.lifeTime++; + if (arg1->data.lifeTime >= behaviour->unk28) { + arg1->data.angle.y_direction += behaviour->unk2A; + arg1->data.angle.x_direction += behaviour->unk2C; + arg1->data.angle.z_direction += behaviour->unk2E; + arg1->data.lifeTime -= behaviour->unk28; } } - if (var_v0->unk44 == 0) { + if (var_v0->modelData == NULL) { func_800B2040(var_v0); return NULL; } else { @@ -1181,8 +1183,8 @@ void func_800B2040(Particle *arg0) { switch (arg0->segment.particle.unk2C) { case 0x80: if (D_800E2CB8 > 0) { - if (arg0->unk44 != NULL) { - free_sprite((Sprite *) arg0->unk44); + if (arg0->modelData) { + free_sprite((Sprite *) &arg0->modelData->texture); } D_800E2CB8--; arg0->segment.particle.unk2C = 0; @@ -1191,9 +1193,10 @@ void func_800B2040(Particle *arg0) { case 0: return; case 1: - if (D_800E2CA0 > 0) {\ - if (((unk800B2260_C_44 *) arg0->unk44)->texture != NULL) { - free_texture(arg0->unk44_1->texture); + if (D_800E2CA0 > 0) { + tex = arg0->modelData->texture; + if (tex != NULL) { + free_texture(tex); } D_800E2CA0--; arg0->segment.particle.unk2C = 0; @@ -1201,7 +1204,7 @@ void func_800B2040(Particle *arg0) { break; case 2: if (D_800E2CAC > 0) { - tex = arg0->unk44_1->texture; + tex = arg0->modelData->texture; if (tex != NULL) { free_texture(tex); } @@ -1211,7 +1214,7 @@ void func_800B2040(Particle *arg0) { break; case 3: if (D_800E2CC4 > 0) { - tex = arg0->unk44_1->texture; + tex = arg0->modelData->texture; if (tex != NULL) { free_texture(tex); } @@ -1222,7 +1225,7 @@ void func_800B2040(Particle *arg0) { case 4: if (D_800E2CD0 > 0) { func_800B263C(arg0); - tex = arg0->unk44_1->texture; + tex = arg0->modelData->texture; if (tex != NULL) { free_texture(tex); } @@ -1242,7 +1245,7 @@ void func_800B2260(Particle *arg0) { if (arg0->data.unkC_60 != NULL) { for (i = 0; i < arg0->data.unk6; i++) { temp_v0 = arg0->data.unkC_60[i]; - temp_v0->segment.particle.unk3A = 0; + temp_v0->segment.particle.destroyTimer = 0; temp_v0->unk70 = 0; } free_from_memory_pool(arg0->data.unkC_60); @@ -1251,68 +1254,70 @@ void func_800B2260(Particle *arg0) { } } -void func_800B22FC(Particle *arg0, s32 arg1) { - LevelModelSegmentBoundingBox *temp_v0_2; - Particle *sp20; +/** + * Call a function to update the current particle texture frame if applicable. + * Applies movement, gets block ID and then shifts the opacity. +*/ +void handle_particle_movement(Particle *particle, s32 updateRate) { + LevelModelSegmentBoundingBox *boundingBox; + Particle *tempParticle; - D_80127C80 = arg1; - sp20 = NULL; - if (arg0->segment.particle.unk2C == 3) { + gParticleUpdateRate = updateRate; + tempParticle = NULL; + if (particle->segment.particle.unk2C == 3) { func_800B26E0(); } else { - if (arg0->segment.unk40 & 3) { - if (D_80127C80 > 0) { - sp20 = NULL; - func_800B2FBC(arg0); - sp20 = NULL; + if (particle->segment.unk40 & 3) { + if (gParticleUpdateRate > 0) { + set_particle_texture_frame(particle); } } - if (arg0->segment.particle.unk2C == 4) { - sp20 = arg0; - arg0->unk75 = 1 - arg0->unk75; - arg0->unk77 = 0; + if (particle->segment.particle.unk2C == 4) { + tempParticle = particle; + particle->modelFrame = 1 - particle->modelFrame; + particle->unk77 = 0; } - if (sp20 == NULL || (sp20 != NULL && sp20->unk70 != 0)) { - if (arg0->segment.particle.unk39 == 2) { - func_800B3358(arg0); - } else if (arg0->segment.particle.unk39 == 3) { - func_800B3240(arg0); - } else if (arg0->segment.particle.unk39 == 4) { - func_800B3140(arg0); - } else if (arg0->segment.particle.unk39 == 5) { - func_800B3564(arg0); + if (tempParticle == NULL || (tempParticle && tempParticle->unk70)) { + if (particle->segment.particle.movementType == PARTICLE_MOVEMENT_VELOCITIES) { + move_particle_with_velocities(particle); + } else if (particle->segment.particle.movementType == PARTICLE_MOVEMENT_VELOCITY_PARENT) { + move_particle_velocity_parent(particle); + } else if (particle->segment.particle.movementType == PARTICLE_MOVEMENT_BASIC_PARENT) { + move_particle_basic_parent(particle); + } else if (particle->segment.particle.movementType == PARTICLE_MOVEMENT_VELOCITY) { + move_particle_with_velocity(particle); } else { - func_800B34B0(arg0); + move_particle_basic(particle); } } - temp_v0_2 = get_segment_bounding_box(arg0->segment.particle.unk2E); - if (temp_v0_2 != NULL) { - if (arg0->segment.trans.x_position < temp_v0_2->x1 || temp_v0_2->x2 < arg0->segment.trans.x_position || - arg0->segment.trans.y_position < temp_v0_2->y1 || temp_v0_2->y2 < arg0->segment.trans.y_position || - arg0->segment.trans.z_position < temp_v0_2->z1 || temp_v0_2->z2 < arg0->segment.trans.z_position) { - arg0->segment.particle.unk2E = get_level_segment_index_from_position(arg0->segment.trans.x_position, arg0->segment.trans.y_position, arg0->segment.trans.z_position); + boundingBox = get_segment_bounding_box(particle->segment.particle.blockID); + if (boundingBox != NULL) { + if (particle->segment.trans.x_position < boundingBox->x1 || boundingBox->x2 < particle->segment.trans.x_position || + particle->segment.trans.y_position < boundingBox->y1 || boundingBox->y2 < particle->segment.trans.y_position || + particle->segment.trans.z_position < boundingBox->z1 || boundingBox->z2 < particle->segment.trans.z_position) { + particle->segment.particle.blockID = get_level_segment_index_from_position(particle->segment.trans.x_position, particle->segment.trans.y_position, particle->segment.trans.z_position); } } else { - arg0->segment.particle.unk2E = get_level_segment_index_from_position(arg0->segment.trans.x_position, arg0->segment.trans.y_position, arg0->segment.trans.z_position); + particle->segment.particle.blockID = get_level_segment_index_from_position(particle->segment.trans.x_position, particle->segment.trans.y_position, particle->segment.trans.z_position); } - arg0->segment.particle.unk3A -= D_80127C80; - if (arg0->segment.particle.unk3A <= 0) { - gParticlePtrList_addObject((Object*) arg0); + particle->segment.particle.destroyTimer -= gParticleUpdateRate; + if (particle->segment.particle.destroyTimer <= 0) { + gParticlePtrList_addObject((Object*) particle); } else { - if (arg0->unk60 == 0) { - arg0->unk5C += D_80127C80 * arg0->unk5E; - if (arg0->unk5C < 0xFF) { - if (arg0->segment.unk40 & 0x1000) { - arg0->segment.trans.flags |= OBJ_FLAGS_UNK_0100; + if (particle->opacityTimer == 0) { + particle->opacity += gParticleUpdateRate * particle->opacityVel; + if (particle->opacity < 0xFF) { + if (particle->segment.unk40 & 0x1000) { + particle->segment.trans.flags |= OBJ_FLAGS_UNK_0100; } else { - arg0->segment.trans.flags |= OBJ_FLAGS_UNK_0080; + particle->segment.trans.flags |= OBJ_FLAGS_UNK_0080; } } } else { - arg0->unk60 -= D_80127C80; - if (arg0->unk60 < 0) { - arg0->unk5C -= (arg0->unk60 * arg0->unk5E); - arg0->unk60 = 0; + particle->opacityTimer -= gParticleUpdateRate; + if (particle->opacityTimer < 0) { + particle->opacity -= (particle->opacityTimer * particle->opacityVel); + particle->opacityTimer = 0; } } } @@ -1344,11 +1349,11 @@ void func_800B263C(Particle *arg0) { GLOBAL_ASM("asm/non_matchings/particles/func_800B26E0.s") -void func_800B2FBC(Particle *arg0) { +void set_particle_texture_frame(Particle *particle) { s32 someFlag; s32 keepGoing; s32 i; - s32 var_a1; + s32 textureCount; s32 someFlag2; s32 someFlag3; s32 someFlag4; @@ -1356,165 +1361,186 @@ void func_800B2FBC(Particle *arg0) { keepGoing = -1; i = 128; // This is needed to match. - if (arg0->segment.particle.unk2C == i) { - var_a1 = arg0->unk44->unk0 * 256; + if (particle->segment.particle.unk2C == i) { + textureCount = particle->unk44_1->textureCount * 256; } else { - var_a1 = arg0->unk44->unk0Ptr->unk12; + textureCount = particle->modelData->texture->numOfTextures; } - someFlag4 = arg0->segment.unk40 & 1; - someFlag2 = arg0->segment.unk40 & 2; - someFlag3 = arg0->segment.unk40 & 4; - someFlag = arg0->segment.unk40 & 8; - for (i = 0; (i++ < D_80127C80) && keepGoing;) { + someFlag4 = particle->segment.unk40 & 1; + someFlag2 = particle->segment.unk40 & 2; + someFlag3 = particle->segment.unk40 & 4; + someFlag = particle->segment.unk40 & 8; + for (i = 0; (i++ < gParticleUpdateRate) && keepGoing;) { if (!someFlag) { - arg0->segment.unk18 += arg0->segment.unk1A; - if (arg0->segment.unk18 >= var_a1) { + particle->segment.textureFrame += particle->segment.unk1A; + if (particle->segment.textureFrame >= textureCount) { if (someFlag2) { - arg0->segment.unk18 = ((var_a1 * 2) - arg0->segment.unk18) - 1; + particle->segment.textureFrame = ((textureCount * 2) - particle->segment.textureFrame) - 1; someFlag = TRUE; - arg0->segment.unk40 |= 8; + particle->segment.unk40 |= 8; } else if (someFlag3) { - arg0->segment.unk18 -= var_a1; + particle->segment.textureFrame -= textureCount; } else { - arg0->segment.unk18 = var_a1 - 1; + particle->segment.textureFrame = textureCount - 1; keepGoing = FALSE; - arg0->segment.unk40 &= ~3; + particle->segment.unk40 &= ~3; } } } else { - arg0->segment.unk18 -= arg0->segment.unk1A; - if (arg0->segment.unk18 < 0) { + particle->segment.textureFrame -= particle->segment.unk1A; + if (particle->segment.textureFrame < 0) { if (someFlag3) { if (someFlag4) { - arg0->segment.unk18 = -arg0->segment.unk18; + particle->segment.textureFrame = -particle->segment.textureFrame; someFlag = FALSE; - arg0->segment.unk40 &= ~8; + particle->segment.unk40 &= ~8; } else { - arg0->segment.unk18 += var_a1; + particle->segment.textureFrame += textureCount; } } else { - arg0->segment.unk18 = 0; + particle->segment.textureFrame = 0; keepGoing = FALSE; - arg0->segment.unk40 &= ~3; + particle->segment.unk40 &= ~3; } } } } } -void func_800B3140(Particle *arg0) { +/** + * Apply translation, rotation and scale based off the velocities of the particle. + * Applies further translation based on the position of the parent. +*/ +void move_particle_basic_parent(Particle *particle) { s32 i; - Object *temp_v0; + ObjectSegment *parent; - i = D_80127C80; - while ( i-- > 0) { - arg0->somePosX += arg0->segment.x_velocity; - arg0->somePosY += arg0->segment.y_velocity; - arg0->segment.y_velocity -= arg0->unk68f; - arg0->somePosZ += arg0->segment.z_velocity; - arg0->segment.trans.y_rotation += arg0->unk62; - arg0->segment.trans.x_rotation += arg0->unk64; - arg0->segment.trans.z_rotation += arg0->unk66; - arg0->segment.trans.scale += arg0->segment.unk28; + i = gParticleUpdateRate; + while (i-- > 0) { + particle->baseVelX += particle->segment.x_velocity; + particle->baseVelY += particle->segment.y_velocity; + particle->segment.y_velocity -= particle->gravity; + particle->baseVelZ += particle->segment.z_velocity; + particle->segment.trans.y_rotation += particle->angleVelY; + particle->segment.trans.x_rotation += particle->angleVelX; + particle->segment.trans.z_rotation += particle->angleVelZ; + particle->segment.trans.scale += particle->segment.scaleVel; } - arg0->segment.trans.x_position = arg0->somePosX; - arg0->segment.trans.y_position = arg0->somePosY; - arg0->segment.trans.z_position = arg0->somePosZ; - temp_v0 = arg0->segment.unk3C; - if (temp_v0 != NULL) { - arg0->segment.trans.x_position += temp_v0->segment.trans.x_position; - arg0->segment.trans.y_position += temp_v0->segment.trans.y_position; - arg0->segment.trans.z_position += temp_v0->segment.trans.z_position; + particle->segment.trans.x_position = particle->baseVelX; + particle->segment.trans.y_position = particle->baseVelY; + particle->segment.trans.z_position = particle->baseVelZ; + parent = particle->segment.unk3C; + if (parent) { + particle->segment.trans.x_position += parent->trans.x_position; + particle->segment.trans.y_position += parent->trans.y_position; + particle->segment.trans.z_position += parent->trans.z_position; } } -void func_800B3240(Particle *arg0) { - s32 i; - Object *temp_v0; - i = D_80127C80; - while ( i-- > 0) { - arg0->segment.trans.y_rotation += arg0->unk62; - arg0->segment.trans.x_rotation += arg0->unk64; - arg0->segment.trans.z_rotation += arg0->unk66; - arg0->segment.trans.scale += arg0->segment.unk28; +/** + * Apply translation, rotation and scale based off the velocities of the particle. + * Velocity is set from forward velocity. + * Applies further translation based on the position of the parent. +*/ +void move_particle_velocity_parent(Particle *particle) { + s32 i; + ObjectSegment *parent; + + i = gParticleUpdateRate; + while (i-- > 0) { + particle->segment.trans.y_rotation += particle->angleVelY; + particle->segment.trans.x_rotation += particle->angleVelX; + particle->segment.trans.z_rotation += particle->angleVelZ; + particle->segment.trans.scale += particle->segment.scaleVel; } - arg0->segment.trans.x_position = 0.0f; - arg0->segment.trans.y_position = -arg0->forwardVel; - arg0->segment.trans.z_position = 0.0f; - f32_vec3_apply_object_rotation(&arg0->segment.trans, &arg0->segment.trans.x_position); - arg0->segment.trans.x_position += arg0->somePosX; - arg0->segment.trans.y_position += arg0->somePosY; - arg0->segment.trans.z_position += arg0->somePosZ; - temp_v0 = arg0->segment.unk3C; - if (temp_v0 != NULL) { - arg0->segment.trans.x_position += temp_v0->segment.trans.x_position; - arg0->segment.trans.y_position += temp_v0->segment.trans.y_position; - arg0->segment.trans.z_position += temp_v0->segment.trans.z_position; + particle->segment.trans.x_position = 0.0f; + particle->segment.trans.y_position = -particle->forwardVel; + particle->segment.trans.z_position = 0.0f; + f32_vec3_apply_object_rotation(&particle->segment.trans, &particle->segment.trans.x_position); + particle->segment.trans.x_position += particle->baseVelX; + particle->segment.trans.y_position += particle->baseVelY; + particle->segment.trans.z_position += particle->baseVelZ; + parent = particle->segment.unk3C; + if (parent) { + particle->segment.trans.x_position += parent->trans.x_position; + particle->segment.trans.y_position += parent->trans.y_position; + particle->segment.trans.z_position += parent->trans.z_position; } } -void func_800B3358(Particle *arg0) { +/** + * Apply translation, rotation and scale based off the velocities of the particle. + * Uses base velocity, then applies additional velocity based off the forward moving direction. +*/ +void move_particle_with_velocities(Particle *particle) { s32 i; - Vec3f sp38; - i = 0; - while (i++ < D_80127C80) { - arg0->segment.trans.x_position += arg0->segment.x_velocity; - arg0->segment.trans.y_position += arg0->segment.y_velocity; - arg0->segment.trans.z_position += arg0->segment.z_velocity; - arg0->segment.trans.scale += arg0->segment.unk28; - arg0->segment.trans.y_rotation += arg0->unk62; - arg0->segment.trans.x_rotation += arg0->unk64; - arg0->segment.trans.z_rotation += arg0->unk66; - sp38.x = 0.0f; - sp38.y = -arg0->forwardVel; - sp38.z = 0.0f; - f32_vec3_apply_object_rotation(&arg0->segment.trans, sp38.f); - arg0->segment.x_velocity += sp38.x; - arg0->segment.y_velocity += sp38.y; - arg0->segment.y_velocity -= arg0->unk68f; - arg0->segment.z_velocity += sp38.z; + Vec3f vel; + + for (i = 0; gParticleUpdateRate > i++;) { + particle->segment.trans.x_position += particle->segment.x_velocity; + particle->segment.trans.y_position += particle->segment.y_velocity; + particle->segment.trans.z_position += particle->segment.z_velocity; + particle->segment.trans.scale += particle->segment.scaleVel; + particle->segment.trans.y_rotation += particle->angleVelY; + particle->segment.trans.x_rotation += particle->angleVelX; + particle->segment.trans.z_rotation += particle->angleVelZ; + vel.x = 0.0f; + vel.y = -particle->forwardVel; + vel.z = 0.0f; + f32_vec3_apply_object_rotation(&particle->segment.trans, vel.f); + particle->segment.x_velocity += vel.x; + particle->segment.y_velocity += vel.y; + particle->segment.y_velocity -= particle->gravity; + particle->segment.z_velocity += vel.z; } } -void func_800B34B0(Particle *arg0) { - f32 temp_f0; +/** + * Apply translation, rotation and scale based off the velocities of the particle. +*/ +void move_particle_basic(Particle *particle) { s32 i; - i = 0; - while (i++ < D_80127C80) { - temp_f0 = arg0->segment.y_velocity; - arg0->segment.trans.x_position += arg0->segment.x_velocity; - arg0->segment.trans.y_position += temp_f0; - arg0->segment.y_velocity = temp_f0 - arg0->unk68f; - arg0->segment.trans.z_position += arg0->segment.z_velocity; - arg0->segment.trans.scale += arg0->segment.unk28; - arg0->segment.trans.y_rotation += arg0->unk62; - arg0->segment.trans.x_rotation += arg0->unk64; - arg0->segment.trans.z_rotation += arg0->unk66; + for (i = 0; gParticleUpdateRate > i++;) { + particle->segment.trans.x_position += particle->segment.x_velocity; + particle->segment.trans.y_position += particle->segment.y_velocity; + particle->segment.y_velocity = particle->segment.y_velocity - particle->gravity; + particle->segment.trans.z_position += particle->segment.z_velocity; + particle->segment.trans.scale += particle->segment.scaleVel; + particle->segment.trans.y_rotation += particle->angleVelY; + particle->segment.trans.x_rotation += particle->angleVelX; + particle->segment.trans.z_rotation += particle->angleVelZ; } } -void func_800B3564(Particle *arg0) { - s32 var_s1; +/** + * Apply translation, rotation and scale based off the velocities of the particle. + * Velocity is set from forward velocity. +*/ +void move_particle_with_velocity(Particle *particle) { + s32 i; - for (var_s1 = 0; D_80127C80 > var_s1++;) { - arg0->segment.x_velocity = 0.0f; - arg0->segment.y_velocity = 0.0f; - arg0->segment.z_velocity = -arg0->forwardVel; - f32_vec3_apply_object_rotation3(&arg0->segment.trans, &arg0->segment.x_velocity); - arg0->segment.trans.x_position += arg0->segment.x_velocity; - arg0->segment.trans.y_position += arg0->segment.y_velocity - arg0->unk68f; - arg0->segment.trans.z_position += arg0->segment.z_velocity; - arg0->segment.trans.scale += arg0->segment.unk28; - arg0->segment.trans.y_rotation += arg0->unk62; - arg0->segment.trans.x_rotation += arg0->unk64; - arg0->segment.trans.z_rotation += arg0->unk66; + for (i = 0; gParticleUpdateRate > i++;) { + particle->segment.x_velocity = 0.0f; + particle->segment.y_velocity = 0.0f; + particle->segment.z_velocity = -particle->forwardVel; + f32_vec3_apply_object_rotation3(&particle->segment.trans, &particle->segment.x_velocity); + particle->segment.trans.x_position += particle->segment.x_velocity; + particle->segment.trans.y_position += particle->segment.y_velocity - particle->gravity; + particle->segment.trans.z_position += particle->segment.z_velocity; + particle->segment.trans.scale += particle->segment.scaleVel; + particle->segment.trans.y_rotation += particle->angleVelY; + particle->segment.trans.x_rotation += particle->angleVelX; + particle->segment.trans.z_rotation += particle->angleVelZ; } } -UNUSED void func_800B3678(Gfx **arg0, MatrixS **arg1, Vertex **arg2) { +/** + * Iterate through every object and render it as particle if applicable. +*/ +UNUSED void render_active_particles(Gfx **dList, MatrixS **arg1, Vertex **arg2) { UNUSED s32 pad; UNUSED s32 pad2; Object **objects; @@ -1525,93 +1551,97 @@ UNUSED void func_800B3678(Gfx **arg0, MatrixS **arg1, Vertex **arg2) { for (; iObj < nObjs; iObj++) { if (objects[iObj]->segment.trans.flags & OBJ_FLAGS_DEACTIVATED) { if ((s32) objects[iObj]->segment.header & 0x8000) { - func_800B3740((Particle *) objects[iObj], arg0, arg1, arg2, 0); + render_particle((Particle *) objects[iObj], dList, arg1, arg2, 0); } } } } -void func_800B3740(Particle *particle, Gfx **dlist, MatrixS **mtx, Vertex **vtx, s32 flags) { +/** + * Load a texture then render a sprite or a billboard. +*/ +void render_particle(Particle *particle, Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 flags) { s32 renderFlags; s32 alpha; s32 temp; - unk800B0698_44 *sp30; + ParticleModel *modelData; Vertex *tempvtx; renderFlags = (RENDER_FOG_ACTIVE | RENDER_Z_COMPARE); - if ((particle->segment.unk40 & flags) && (D_800E2CDC < 0x200)) { + // Never true + if (particle->segment.unk40 & flags && D_800E2CDC < 512) { return; } - alpha = (particle->unk5C >> 8) & 0xFF; - if(alpha <= 0) { + alpha = (particle->opacity >> 8) & 0xFF; + if (alpha <= 0) { return; } - if ((particle->segment.object.unk2C != 4) && (particle->segment.object.unk2C != 3)) { - gDPSetEnvColor((*dlist)++, particle->colour.r, particle->colour.g, particle->colour.b, particle->colour.a); + if (particle->segment.object.unk2C != 4 && particle->segment.object.unk2C != 3) { + gDPSetEnvColor((*dList)++, particle->colour.r, particle->colour.g, particle->colour.b, particle->colour.a); if (alpha != 255) { renderFlags = (RENDER_Z_UPDATE | RENDER_FOG_ACTIVE | RENDER_SEMI_TRANSPARENT | RENDER_Z_COMPARE); - gDPSetPrimColor((*dlist)++, 0, 0, particle->unk4A, particle->unk4A, particle->unk4A, alpha); + gDPSetPrimColor((*dList)++, 0, 0, particle->brightness, particle->brightness, particle->brightness, alpha); } else { - gDPSetPrimColor((*dlist)++, 0, 0, 255, 255, 255, 255); + gDPSetPrimColor((*dList)++, 0, 0, 255, 255, 255, 255); } if (particle->segment.object.unk2C == 0x80) { - temp = particle->segment.unk18; - particle->segment.unk18 >>= 8; - particle->segment.unk18 = (particle->segment.unk18 * 255) / (particle->unk44->unk0); - render_sprite_billboard(dlist, mtx, vtx, (Object *) particle, (unk80068514_arg4 *) particle->unk44, renderFlags); - particle->segment.unk18 = temp; + temp = particle->segment.textureFrame; + particle->segment.textureFrame >>= 8; + particle->segment.textureFrame = (particle->segment.textureFrame * 255) / (particle->unk44_1->textureCount); + render_sprite_billboard(dList, mtx, vtx, (Object *) particle, (unk80068514_arg4 *) particle->modelData, renderFlags); + particle->segment.textureFrame = temp; } else { - sp30 = particle->unk44; - if (sp30->unk0Ptr != 0) { - camera_push_model_mtx(dlist, mtx, &particle->segment.trans, 1.0f, 0.0f); - load_and_set_texture(dlist, (TextureHeader *) sp30->unk0Ptr, renderFlags, particle->segment.unk18 << 8); - gSPVertexDKR((*dlist)++, OS_K0_TO_PHYSICAL(sp30->unk0struct.unk8), sp30->unk0struct.unk4, 0); - gSPPolygon((*dlist)++, OS_K0_TO_PHYSICAL(sp30->unk0struct.unkC), sp30->unk0struct.unk6, 1); - func_80069A40(dlist); + modelData = particle->modelData; + if (modelData->texture) { + camera_push_model_mtx(dList, mtx, &particle->segment.trans, 1.0f, 0.0f); + load_and_set_texture(dList, (TextureHeader *) modelData->texture, renderFlags, particle->segment.textureFrame << 8); + gSPVertexDKR((*dList)++, OS_K0_TO_PHYSICAL(modelData->vertices), modelData->vertexCount, 0); + gSPPolygon((*dList)++, OS_K0_TO_PHYSICAL(modelData->triangles), modelData->triangleCount, TRIN_ENABLE_TEXTURE); + func_80069A40(dList); } } - if ((alpha != 255) || (particle->unk4A != 255)) { - gDPSetPrimColor((*dlist)++, 0, 0, 255, 255, 255, 255); + if (alpha != 255 || particle->brightness != 255) { + gDPSetPrimColor((*dList)++, 0, 0, 255, 255, 255, 255); } - if (particle->colour.a != 0) { - gDPSetEnvColor((*dlist)++, 255, 255, 255, 0); + if (particle->colour.a) { + gDPSetEnvColor((*dList)++, 255, 255, 255, 0); } } else { renderFlags = (RENDER_VTX_ALPHA | RENDER_Z_UPDATE | RENDER_FOG_ACTIVE | RENDER_Z_COMPARE | RENDER_ANTI_ALIASING); - gDPSetEnvColor((*dlist)++, 255, 255, 255, 0); + gDPSetEnvColor((*dList)++, 255, 255, 255, 0); if (particle->segment.object.unk2C == 4) { if (particle->segment.camera.unk3A > 0) { - gDPSetPrimColor((*dlist)++, 0, 0, particle->unk4A, particle->unk4A, particle->unk4A, 255); + gDPSetPrimColor((*dList)++, 0, 0, particle->brightness, particle->brightness, particle->brightness, 255); if (particle->unk77 == 0) { func_800B3E64((Object *) particle); } - sp30 = (unk800B0698_44 *) particle->unk44_0; - temp = particle->unk75; + modelData = particle->modelData; + temp = particle->modelFrame; temp <<= 3; - tempvtx = &sp30->unk0struct.unk8[temp]; - load_and_set_texture(dlist, (TextureHeader *) sp30->unk0Ptr, renderFlags, particle->segment.unk18 << 8); - gSPVertexDKR((*dlist)++, OS_K0_TO_PHYSICAL(tempvtx), sp30->unk0struct.unk4, 0); - gSPPolygon((*dlist)++, OS_K0_TO_PHYSICAL(sp30->unk0struct.unkC), sp30->unk0struct.unk6, 1); - if (particle->unk4A != 255) { - gDPSetPrimColor((*dlist)++, 0, 0, 255, 255, 255, 255); + tempvtx = &modelData->vertices[temp]; + load_and_set_texture(dList, modelData->texture, renderFlags, particle->segment.textureFrame << 8); + gSPVertexDKR((*dList)++, OS_K0_TO_PHYSICAL(tempvtx), modelData->vertexCount, 0); + gSPPolygon((*dList)++, OS_K0_TO_PHYSICAL(modelData->triangles), modelData->triangleCount, TRIN_ENABLE_TEXTURE); + if (particle->brightness != 255) { + gDPSetPrimColor((*dList)++, 0, 0, 255, 255, 255, 255); } } } else if (particle->segment.object.unk2C == 3) { - gDPSetPrimColor((*dlist)++, 0, 0, particle->unk4A, particle->unk4A, particle->unk4A, alpha); + gDPSetPrimColor((*dList)++, 0, 0, particle->brightness, particle->brightness, particle->brightness, alpha); if (particle->unk68b >= 2) { - sp30 = (unk800B0698_44 *) particle->unk44_0; - load_and_set_texture(dlist, (TextureHeader *) sp30->unk0Ptr, renderFlags, particle->segment.unk18 << 8); - gSPVertexDKR((*dlist)++, OS_K0_TO_PHYSICAL(sp30->unk0struct.unk8), sp30->unk0struct.unk4, 0); - gSPPolygon((*dlist)++, OS_K0_TO_PHYSICAL(sp30->unk0struct.unkC), sp30->unk0struct.unk6, 1); + modelData = particle->modelData; + load_and_set_texture(dList, modelData->texture, renderFlags, particle->segment.textureFrame << 8); + gSPVertexDKR((*dList)++, OS_K0_TO_PHYSICAL(modelData->vertices), modelData->vertexCount, 0); + gSPPolygon((*dList)++, OS_K0_TO_PHYSICAL(modelData->triangles), modelData->triangleCount, 1); } else if (particle->unk68b > 0) { - sp30 = (unk800B0698_44 *) particle->unk44_0; - load_and_set_texture(dlist, (TextureHeader *) sp30->unk0Ptr, renderFlags, particle->segment.unk18 << 8); - gSPVertexDKR((*dlist)++, OS_K0_TO_PHYSICAL(sp30->unk0struct.unk8), 4, 0); - gSPPolygon((*dlist)++, OS_K0_TO_PHYSICAL(&sp30->unk0struct.unkC[sp30->unk0struct.unk6]), 1, 1); + modelData = particle->modelData; + load_and_set_texture(dList, modelData->texture, renderFlags, particle->segment.textureFrame << 8); + gSPVertexDKR((*dList)++, OS_K0_TO_PHYSICAL(modelData->vertices), 4, 0); + gSPPolygon((*dList)++, OS_K0_TO_PHYSICAL(&modelData->triangles[modelData->triangleCount]), 1, TRIN_ENABLE_TEXTURE); } - if ((alpha != 255) || (particle->unk4A != 255)) { - gDPSetPrimColor((*dlist)++, 0, 0, 255, 255, 255, 255); + if (alpha != 255 || particle->brightness != 255) { + gDPSetPrimColor((*dList)++, 0, 0, 255, 255, 255, 255); } } } @@ -1619,14 +1649,21 @@ void func_800B3740(Particle *particle, Gfx **dlist, MatrixS **mtx, Vertex **vtx, GLOBAL_ASM("asm/non_matchings/particles/func_800B3E64.s") -UNUSED unk800E2CF0 *func_800B4488(s32 idx) { +/** + * Return a specific particle asset table from the main table. +*/ +UNUSED ParticleProperties *get_particle_asset_table(s32 idx) { if (idx < gParticlesAssetTableCount) { return gParticlesAssetTable[idx]; } return gParticlesAssetTable[gParticlesAssetTableCount - 1]; } -UNUSED unk800E2CF0 *func_800B44D4(s32 *idx) { +/** + * Return the next particle table after the index. + * Make sure the index is in range by wrapping it. +*/ +UNUSED ParticleProperties *get_next_particle_table(s32 *idx) { *idx = *idx + 1; while (*idx >= gParticlesAssetTableCount) { *idx = *idx - gParticlesAssetTableCount; @@ -1634,12 +1671,22 @@ UNUSED unk800E2CF0 *func_800B44D4(s32 *idx) { return gParticlesAssetTable[*idx]; } -UNUSED unk800E2CF0 *func_800B452C(s32 *arg0) { - for (*arg0 = *arg0 - 1; *arg0 < 0; *arg0 += gParticlesAssetTableCount); - return gParticlesAssetTable[*arg0]; +/** + * Return the previous particle table before the index. + * Make sure the index is in range by wrapping it. +*/ +UNUSED ParticleProperties *get_previous_particle_table(s32 *idx) { + *idx = *idx - 1; + while (*idx < 0) { + *idx += gParticlesAssetTableCount; + } + return gParticlesAssetTable[*idx]; } -UNUSED ParticleBehavior *func_800B4578(s32 idx) { +/** + * Return the particle behaviour ID from the behaviour table. +*/ +UNUSED ParticleBehavior *get_particle_behaviour(s32 idx) { if (idx < gParticleBehavioursAssetTableCount) { return gParticleBehavioursAssetTable[idx]; } diff --git a/src/particles.h b/src/particles.h index 574bf4b1..0c72b0a5 100644 --- a/src/particles.h +++ b/src/particles.h @@ -5,63 +5,79 @@ #include "structs.h" #include "libultra_internal.h" -typedef struct unk800E2CF0 { - u8 unk0; - u8 unk1; - u16 unk2; - s16 unk4; - s16 unk6; - s16 unk8; - s16 unkA; - u8 unkC; - u8 unkD; - s16 unkE; - f32 scale; - ColourRGBA colour; -} unk800E2CF0; +enum ParticleFlags { + PARTICLE_FLAGS_NONE, + PARTICLE_GRAVITY = (1 << 0), + PARTICLE_UNK00000002 = (1 << 1), + PARTICLE_UNK00000004 = (1 << 2), + PARTICLE_UNK00000008 = (1 << 3), + PARTICLE_UNK00000010 = (1 << 4), + PARTICLE_UNK00000020 = (1 << 5), + PARTICLE_UNK00000040 = (1 << 6), + PARTICLE_UNK00000080 = (1 << 7), + PARTICLE_VEL_X = (1 << 8), + PARTICLE_VEL_Y = (1 << 9), + PARTICLE_VEL_Z = (1 << 10), + PARTICLE_ANGLE_Y = (1 << 11), + PARTICLE_ANGLE_X = (1 << 12), + PARTICLE_ANGLE_Z = (1 << 13), + PARTICLE_ANGLEVEL_Y = (1 << 14), + PARTICLE_ANGLEVEL_X = (1 << 15), + PARTICLE_ANGLEVEL_Z = (1 << 16), + PARTICLE_UNK00020000 = (1 << 17), + PARTICLE_UNK00040000 = (1 << 18), + PARTICLE_FORWARDVEL = (1 << 19), + PARTICLE_COLOURVEL_RED = (1 << 20), + PARTICLE_COLOURVEL_GREEN = (1 << 21), + PARTICLE_COLOURVEL_BLUE = (1 << 22), + PARTICLE_COLOURVEL_ALPHA = (1 << 23), + PARTICLE_UNK01000000 = (1 << 24), + PARTICLE_UNK02000000 = (1 << 25), + PARTICLE_UNK04000000 = (1 << 26), + PARTICLE_UNK08000000 = (1 << 27), + PARTICLE_UNK10000000 = (1 << 28), + PARTICLE_UNK20000000 = (1 << 29), + PARTICLE_UNK40000000 = (1 << 30), + PARTICLE_UNK80000000 = (1 << 31), +}; + +enum ParticleMovement { + PARTICLE_MOVEMENT_0, + PARTICLE_MOVEMENT_1, + PARTICLE_MOVEMENT_VELOCITIES, + PARTICLE_MOVEMENT_VELOCITY_PARENT, + PARTICLE_MOVEMENT_BASIC_PARENT, + PARTICLE_MOVEMENT_VELOCITY, +}; + +typedef struct ParticleProperties { + /* 0x00 */ u8 unk0; + /* 0x01 */ u8 movementType; + /* 0x02 */ u16 unk2; + /* 0x04 */ s16 textureID; + /* 0x06 */ s16 unk6; + /* 0x08 */ s16 lifeTime; + /* 0x0A */ s16 lifeTimeRange; + /* 0x0C */ u8 opacity; + /* 0x0D */ u8 opacityVel; + /* 0x0E */ s16 opacityTimer; + /* 0x10 */ f32 scale; + /* 0x14 */ ColourRGBA colour; +} ParticleProperties; /* Size: 0x10 bytes */ typedef struct unk800E2D08 { s16 unk0, unk2, unk4, unk6, unk8, unkA, unkC, unkE; } unk800E2D08; -typedef struct unk800AF024 { - u8 pad0[4]; - s16 unk4; - s16 unk6; - Vertex *unk8; - Triangle *unkC; -} unk800AF024; - typedef struct XYStruct { s16 x, y; } XYStruct; -typedef struct unk800B2260_C_44 { - TextureHeader *texture; -} unk800B2260_C_44; - typedef struct unk800B1CB8_44_8 { u8 pad0[6]; s16 unk6; } unk800B1CB8_44_8; -typedef struct unk800B1CB8_44 { - s16 unk0; - u8 pad2[6]; - unk800B1CB8_44_8 **unk8; -} unk800B1CB8_44; - -typedef struct unk800B1130_8 { - u8 pad0[6]; - s16 unk6; -} unk800B1130_8; - -typedef struct unk800B1130 { - u8 pad0[8]; - unk800B1130_8 **unk8; - u8 padC[0x6]; - u16 unk12; -} unk800B1130; typedef struct unk800B1130_SP28 { s32 unk0; @@ -75,9 +91,9 @@ typedef struct ParticleAngle { s16 y_rotation; s16 x_rotation; s16 z_rotation; - s16 unk12; - s16 unk14; - s16 unk16; + s16 y_direction; + s16 x_direction; + s16 z_direction; } ParticleAngle; typedef struct ParticleData { @@ -87,19 +103,18 @@ typedef struct ParticleData { }; /* 0x0004 */ s16 flags; /* 0x0006 */ u8 unk6; - /* 0x0007 */ u8 unk7; - /* 0x0008 */ s16 unk8; - /* 0x000A */ s16 unkA; + /* 0x0007 */ u8 lifeTime; + /* 0x0008 */ s16 propertyID; + /* 0x000A */ s16 opacity; union { /* 0x000C */ Vec3f pos; /* 0x000C */ ParticleAngle angle; - /* 0x000C */ unk800AF29C_C unkC; /* 0x000C */ struct Particle **unkC_60; /* 0x000C */ unk800AF29C_C_400 unkC_400; }; - /* 0x0018 */ s16 unk18; - /* 0x0018 */ s16 unk1A; - /* 0x001C */ s16 unk1C; + /* 0x0018 */ s16 baseVelX; + /* 0x0018 */ s16 baseVelY; + /* 0x001C */ s16 baseVelZ; /* 0x001E */ s16 unk1E; /* 0x0020 */ s32 unk20; /* 0x0024 */ s32 unk24; @@ -110,12 +125,12 @@ typedef struct ParticleData { typedef struct ParticleSegment { /* 0x0000 */ ObjectTransform trans; - /* 0x0018 */ s16 unk18; + /* 0x0018 */ s16 textureFrame; /* 0x001A */ s16 unk1A; /* 0x001C */ f32 x_velocity; /* 0x0020 */ f32 y_velocity; /* 0x0024 */ f32 z_velocity; - /* 0x0028 */ f32 unk28; + /* 0x0028 */ f32 scaleVel; union { SegmentPropertiesObject object; SegmentPropertiesParticle particle; @@ -125,40 +140,54 @@ typedef struct ParticleSegment { /* 0x0040 */ s32 unk40; } ParticleSegment; +typedef struct ParticleModel { + /* 0x00 */ TextureHeader *texture; + /* 0x04 */ s16 vertexCount; + /* 0x06 */ s16 triangleCount; + /* 0x08 */ Vertex *vertices; + /* 0x0C */ Triangle *triangles; +} ParticleModel; + +typedef struct ParticleOtherSomething { + /* 0x00 */ s16 textureCount; + /* 0x02 */ s16 unk2; + /* 0x04 */ s16 unk4; + /* 0x06 */ s16 unk6; + /* 0x08 */ unk800B1CB8_44_8 **unk8; +} ParticleOtherSomething; + typedef struct Particle { union { /* 0x0000 */ ParticleSegment segment; /* 0x0000 */ ParticleData data; }; union { - /* 0x0044 */ unk800B0698_44 *unk44; - /* 0x0044 */ TextureHeader *unk44_0; - /* 0x0044 */ unk800B2260_C_44 *unk44_1; - /* 0x0044 */ struct unk800B1CB8_44 *unk44_2; + /* 0x0044 */ ParticleModel *modelData; + /* 0x0044 */ ParticleOtherSomething *unk44_1; }; /* 0x0048 */ s16 behaviorId; - /* 0x004A */ s16 unk4A; - /* 0x004C */ f32 somePosX; - /* 0x0050 */ f32 somePosY; + /* 0x004A */ s16 brightness; + /* 0x004C */ f32 baseVelX; + /* 0x0050 */ f32 baseVelY; union { - /* 0x0054 */ f32 somePosZ; + /* 0x0054 */ f32 baseVelZ; /* 0x0054 */ f32 *unk54_ptr; }; /* 0x0058 */ f32 forwardVel; - /* 0x005C */ s16 unk5C; - /* 0x005E */ s16 unk5E; - /* 0x0060 */ s16 unk60; - /* 0x0062 */ s16 unk62; - /* 0x0064 */ s16 unk64; - /* 0x0066 */ s16 unk66; + /* 0x005C */ s16 opacity; + /* 0x005E */ s16 opacityVel; + /* 0x0060 */ s16 opacityTimer; + /* 0x0062 */ s16 angleVelY; + /* 0x0064 */ s16 angleVelX; + /* 0x0066 */ s16 angleVelZ; union { /* 0x0068 */ u8 unk68b; - /* 0x0068 */ f32 unk68f; + /* 0x0068 */ f32 gravity; }; /* 0x006C */ ColourRGBA colour; /* 0x0070 */ struct Particle *unk70; /* 0x0074 */ u8 unk74; - /* 0x0075 */ u8 unk75; + /* 0x0075 */ u8 modelFrame; /* 0x0076 */ u8 unk76; /* 0x0077 */ s8 unk77; } Particle; @@ -176,10 +205,10 @@ void func_800AE2D8(void); void func_800AE374(void); void func_800AE438(void); void func_800AE490(void); -void func_800AEE14(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2); -void func_800AEEB8(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2); -void func_800AEF88(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2); -void func_800AF024(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2); +void generate_particle_shape_triangle(ParticleModel *arg0, Vertex **arg1, Triangle **arg2); +void generate_particle_shape_quad(ParticleModel *arg0, Vertex **arg1, Triangle **arg2); +void func_800AEF88(ParticleModel *arg0, Vertex **arg1, Triangle **arg2); +void func_800AF024(ParticleModel *arg0, Vertex **arg1, Triangle **arg2); void func_800AF0A4(Particle *particle); void func_800AF0F0(Particle *particle); void partInitTrigger(Particle *arg0, s32 arg1, s32 arg2); @@ -188,10 +217,10 @@ void func_800AF6E4(Object *obj, s32 arg1); void func_800B2260(Particle *arg0); void func_800B263C(Particle *arg0); void init_particle_assets(void); -void func_800B2FBC(Particle *arg0); +void set_particle_texture_frame(Particle *arg0); void func_800B03C0(Particle *arg0, Particle *arg1, Particle *arg2, ParticleBehavior *arg3); void func_800B2040(Particle *arg0); -void func_800B22FC(Particle *arg0, s32 arg1); +void handle_particle_movement(Particle *particle, s32 updateRate); void func_800B0010(Particle *arg0, Particle *arg1, Particle *arg2, ParticleBehavior *arg3); Particle *func_800B0698(Particle *arg0, Particle *arg1); Particle *func_800B1CB8(s32 arg0); @@ -199,7 +228,7 @@ void func_800AFE5C(Particle *arg0, Particle *arg1); Particle *func_800B1130(Particle *arg0, Particle *arg1); void func_800AF52C(Object *obj, s32 arg1); void func_800AF134(Particle *arg0, s32 arg1, s32 arg2, s16 arg3, s16 arg4, s16 arg5); -void func_800B3740(Particle *particle, Gfx **dlist, MatrixS **mtx, Vertex **vtx, s32 flags); +void render_particle(Particle *particle, Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 flags); void func_800B4668(Object *obj, s32 idx, s32 arg2, s32 arg3); void func_800B46BC(Object *obj, s32 idx, s32 arg2, s32 arg3); @@ -209,11 +238,11 @@ void func_800AE728(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5); void func_800AF714(Object*, s32); // Non matching Particle *func_800B0BAC(); void func_800B26E0(); -void func_800B3140(Particle *); -void func_800B3240(Particle *); -void func_800B3358(Particle *); -void func_800B34B0(Particle *); -void func_800B3564(Particle *); +void move_particle_basic_parent(Particle *); +void move_particle_velocity_parent(Particle *); +void move_particle_with_velocities(Particle *); +void move_particle_basic(Particle *); +void move_particle_with_velocity(Particle *); void func_800B3E64(Object *); // Non Matching #endif diff --git a/src/printf.c b/src/printf.c index f121b602..4b549dae 100644 --- a/src/printf.c +++ b/src/printf.c @@ -157,9 +157,7 @@ const char D_800E8C5C[] = "(nil)"; /************ .bss ************/ -TextureHeader *gTexture0; -TextureHeader *gTexture1; -TextureHeader *gTexture2; +TextureHeader *gTexture[3]; u16 D_80127CAC; u16 D_80127CAE; u16 D_80127CB0; @@ -198,9 +196,9 @@ UNUSED int sprintf(char *s, const char *format, ...) { GLOBAL_ASM("asm/non_matchings/printf/vsprintf.s") void diPrintfInit(void) { - gTexture0 = load_texture(0); - gTexture1 = load_texture(1); - gTexture2 = load_texture(2); + gTexture[0] = load_texture(0); + gTexture[1] = load_texture(1); + gTexture[2] = load_texture(2); gDebugPrintBufferEnd = gDebugPrintBufferStart; } @@ -357,7 +355,7 @@ s32 func_800B69FC(Gfx **dList, s32 asciiVal) { //Character is a symbol or number and not a letter if (gDebugFontTexture != 0) { if (D_80127CB8) { - gDPLoadTextureBlock((*dList)++, OS_PHYSICAL_TO_K0(gTexture0 + 1), G_IM_FMT_IA, G_IM_SIZ_8b, 192, 11, 0, 2, 2, 0, 0, 0, 0); + gDPLoadTextureBlock((*dList)++, OS_PHYSICAL_TO_K0(gTexture[0] + 1), G_IM_FMT_IA, G_IM_SIZ_8b, 192, 11, 0, 2, 2, 0, 0, 0, 0); } gDebugFontTexture = 0; } @@ -366,7 +364,7 @@ s32 func_800B69FC(Gfx **dList, s32 asciiVal) { //Character is a upper case letter if (gDebugFontTexture != 1) { if (D_80127CB8) { - gDPLoadTextureBlock((*dList)++, OS_PHYSICAL_TO_K0(gTexture1 + 1), G_IM_FMT_IA, G_IM_SIZ_8b, 248, 11, 0, 2, 2, 0, 0, 0, 0); + gDPLoadTextureBlock((*dList)++, OS_PHYSICAL_TO_K0(gTexture[1] + 1), G_IM_FMT_IA, G_IM_SIZ_8b, 248, 11, 0, 2, 2, 0, 0, 0, 0); } gDebugFontTexture = 1; } @@ -375,7 +373,7 @@ s32 func_800B69FC(Gfx **dList, s32 asciiVal) { //Character is a lower case letter if (gDebugFontTexture != 2) { if (D_80127CB8) { - gDPLoadTextureBlock((*dList)++, OS_PHYSICAL_TO_K0(gTexture2 + 1), G_IM_FMT_IA, G_IM_SIZ_8b, 192, 11, 0, 2, 2, 0, 0, 0, 0); + gDPLoadTextureBlock((*dList)++, OS_PHYSICAL_TO_K0(gTexture[2] + 1), G_IM_FMT_IA, G_IM_SIZ_8b, 192, 11, 0, 2, 2, 0, 0, 0, 0); } gDebugFontTexture = 2; } diff --git a/src/thread3_main.c b/src/thread3_main.c index 8f269f54..eaa41729 100644 --- a/src/thread3_main.c +++ b/src/thread3_main.c @@ -47,10 +47,6 @@ /************ .rodata ************/ -UNUSED const char sLevelErrorString[] = "LOADLEVEL Error: Level out of range\n"; -UNUSED const char sBossErrorString[] = "BossLev problem\n"; -UNUSED const char sAITableErrorString[] = "AITABLE Error: Table out of range\n"; - UNUSED char *sDebugRomBuildInfo[] = { "1.1605", "02/10/97 16:03", @@ -58,10 +54,6 @@ UNUSED char *sDebugRomBuildInfo[] = { }; const char D_800E7134[] = "BBB\n"; // Functionally unused. -UNUSED const char sDebugCarString[] = "CAR"; -UNUSED const char sDebugHovercraftString[] = "HOV"; -UNUSED const char sDebugPlaneString[] = "PLN"; -UNUSED const char sDebugVehicleSwapString[] = "Swapping\n"; /*********************************/ @@ -94,7 +86,7 @@ UNUSED FadeTransition D_800DD3FC = FADE_TRANSITION(FADE_FULLSCREEN, FADE_FLAG_NO s32 sLogicUpdateRate = LOGIC_5FPS; FadeTransition D_800DD408 = FADE_TRANSITION(FADE_FULLSCREEN, FADE_FLAG_NONE, FADE_COLOR_WHITE, 30, -1); UNUSED char *D_800DD410[3] = { - (char *)sDebugCarString, (char *)sDebugHovercraftString, (char *)sDebugPlaneString + "CAR", "HOV", "PLN" }; FadeTransition gLevelFadeOutTransition = FADE_TRANSITION(FADE_FULLSCREEN, FADE_FLAG_NONE, FADE_COLOR_BLACK, 30, -1); FadeTransition D_800DD424 = FADE_TRANSITION(FADE_FULLSCREEN, FADE_FLAG_NONE, FADE_COLOR_BLACK, 260, -1); @@ -183,6 +175,7 @@ void thread3_main(UNUSED void *unused) { void init_game(void) { s32 viMode; + stubbed_printf(sDebugRomBuildInfo); init_main_memory_pool(); init_rzip(); // Initialise gzip decompression related things sAntiPiracyTriggered = TRUE; @@ -844,6 +837,7 @@ void set_level_default_vehicle(Vehicle vehicleID) { } void func_8006DB20(Vehicle vehicleId) { + stubbed_printf("Swapping\n"); D_8012351C = vehicleId; } diff --git a/src/waves.c b/src/waves.c index 403c4669..915df7d6 100644 --- a/src/waves.c +++ b/src/waves.c @@ -309,34 +309,33 @@ GLOBAL_ASM("asm/non_matchings/waves/func_800BCC70.s") GLOBAL_ASM("asm/non_matchings/waves/func_800BDC80.s") GLOBAL_ASM("asm/non_matchings/waves/func_800BE654.s") -// Get water height probably. -f32 func_800BEEB4(Object_64 *arg0, s32 updateRate) { +f32 get_wave_height(Object_Log *log, s32 updateRate) { s32 var_t0; - f32 temp; + f32 y; - arg0->obj800BEEB4_64.unk4 += updateRate; - while (arg0->obj800BEEB4_64.unk4 >= arg0->obj800BEEB4_64.unk6) { - arg0->obj800BEEB4_64.unk4 -= arg0->obj800BEEB4_64.unk6; + log->unk4 += updateRate; + while (log->unk4 >= log->unk6) { + log->unk4 -= log->unk6; } - var_t0 = arg0->obj800BEEB4_64.unkE[arg0->obj800BEEB4_64.unk4 >> 1]; - if (arg0->obj800BEEB4_64.unk4 & 1) { - if ((arg0->obj800BEEB4_64.unk4 + 1) >= arg0->obj800BEEB4_64.unk6) { - var_t0 += arg0->obj800BEEB4_64.unkE[0]; + var_t0 = log->unkE[log->unk4 >> 1]; + if (log->unk4 & 1) { + if (log->unk4 + 1 >= log->unk6) { + var_t0 += log->unkE[0]; } else { - var_t0 += arg0->obj800BEEB4_64.unkE[(arg0->obj800BEEB4_64.unk4 >> 1) + 1]; + var_t0 += log->unkE[(log->unk4 >> 1) + 1]; } - if (arg0->obj800BEEB4_64.unk2 > 0) { - var_t0 <<= (arg0->obj800BEEB4_64.unk2 + 0x1F); + if (log->unk2 > 0) { + var_t0 <<= (log->unk2 + 0x1F); } else { var_t0 >>= 1; } } else { - var_t0 <<= arg0->obj800BEEB4_64.unk2; + var_t0 <<= log->unk2; } - temp = (((f32) var_t0 * 0.0625) + (f32) arg0->obj800BEEB4_64.unk0); - temp *= D_80129FC8->unk40; - temp += func_800BEFC4(arg0->obj800BEEB4_64.unkC, arg0->obj800BEEB4_64.unk8, arg0->obj800BEEB4_64.unkA); - return temp; + y = (((f32) var_t0 * 0.0625) + (f32) log->unk0); + y *= D_80129FC8->unk40; + y += func_800BEFC4(log->unkC, log->unk8, log->unkA); + return y; } #ifdef NON_EQUIVALENT diff --git a/src/waves.h b/src/waves.h index 0dc895eb..43d8f6fd 100644 --- a/src/waves.h +++ b/src/waves.h @@ -111,7 +111,7 @@ void func_800BBE08(LevelModel *level, unk800BBE08_arg1 *arg1); void obj_loop_wavepower(Object *obj); void func_800BFC54(unk800BFC54_arg0 *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4); void func_800BF3E4(s32 arg0); -f32 func_800BEEB4(Object_64 *, s32); +f32 get_wave_height(Object_Log *log, s32 updateRate); Object_64 *func_800BE654(s16, f32, f32); // Non Matching void func_800BBF78(LevelModel *arg0); // Non Matching