diff --git a/asm/nonmatchings/code_B9D60/clear_item_entity_flags.s b/asm/nonmatchings/code_B9D60/clear_item_entity_flags.s deleted file mode 100644 index ff40818637..0000000000 --- a/asm/nonmatchings/code_B9D60/clear_item_entity_flags.s +++ /dev/null @@ -1,14 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel clear_item_entity_flags -/* CA888 80134188 3C028015 */ lui $v0, %hi(D_801565A0) -/* CA88C 8013418C 8C4265A0 */ lw $v0, %lo(D_801565A0)($v0) -/* CA890 80134190 00042080 */ sll $a0, $a0, 2 -/* CA894 80134194 00822021 */ addu $a0, $a0, $v0 -/* CA898 80134198 8C830000 */ lw $v1, ($a0) -/* CA89C 8013419C 8C620000 */ lw $v0, ($v1) -/* CA8A0 801341A0 00052827 */ nor $a1, $zero, $a1 -/* CA8A4 801341A4 00451024 */ and $v0, $v0, $a1 -/* CA8A8 801341A8 03E00008 */ jr $ra -/* CA8AC 801341AC AC620000 */ sw $v0, ($v1) diff --git a/asm/nonmatchings/code_B9D60/func_80127B70.s b/asm/nonmatchings/code_B9D60/func_80127B70.s deleted file mode 100644 index 40b8960062..0000000000 --- a/asm/nonmatchings/code_B9D60/func_80127B70.s +++ /dev/null @@ -1,17 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80127B70 -/* BE270 80127B70 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* BE274 80127B74 24020004 */ addiu $v0, $zero, 4 -/* BE278 80127B78 0000282D */ daddu $a1, $zero, $zero -/* BE27C 80127B7C 00A0302D */ daddu $a2, $a1, $zero -/* BE280 80127B80 00A0382D */ daddu $a3, $a1, $zero -/* BE284 80127B84 AFBF0020 */ sw $ra, 0x20($sp) -/* BE288 80127B88 AFA00010 */ sw $zero, 0x10($sp) -/* BE28C 80127B8C AFA20014 */ sw $v0, 0x14($sp) -/* BE290 80127B90 0C049F64 */ jal func_80127D90 -/* BE294 80127B94 AFA00018 */ sw $zero, 0x18($sp) -/* BE298 80127B98 8FBF0020 */ lw $ra, 0x20($sp) -/* BE29C 80127B9C 03E00008 */ jr $ra -/* BE2A0 80127BA0 27BD0028 */ addiu $sp, $sp, 0x28 diff --git a/asm/nonmatchings/code_B9D60/func_801341B0.s b/asm/nonmatchings/code_B9D60/func_801341B0.s deleted file mode 100644 index 13d47e450a..0000000000 --- a/asm/nonmatchings/code_B9D60/func_801341B0.s +++ /dev/null @@ -1,18 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_801341B0 -/* CA8B0 801341B0 00042080 */ sll $a0, $a0, 2 -/* CA8B4 801341B4 3C028015 */ lui $v0, %hi(D_801565A0) -/* CA8B8 801341B8 8C4265A0 */ lw $v0, %lo(D_801565A0)($v0) -/* CA8BC 801341BC 3C05800A */ lui $a1, %hi(D_8009A650) -/* CA8C0 801341C0 24A5A650 */ addiu $a1, $a1, %lo(D_8009A650) -/* CA8C4 801341C4 00822021 */ addu $a0, $a0, $v0 -/* CA8C8 801341C8 8C840000 */ lw $a0, ($a0) -/* CA8CC 801341CC 8CA20000 */ lw $v0, ($a1) -/* CA8D0 801341D0 8C830000 */ lw $v1, ($a0) -/* CA8D4 801341D4 34420040 */ ori $v0, $v0, 0x40 -/* CA8D8 801341D8 ACA20000 */ sw $v0, ($a1) -/* CA8DC 801341DC 34630100 */ ori $v1, $v1, 0x100 -/* CA8E0 801341E0 03E00008 */ jr $ra -/* CA8E4 801341E4 AC830000 */ sw $v1, ($a0) diff --git a/asm/nonmatchings/code_B9D60/make_item_entity_delayed.s b/asm/nonmatchings/code_B9D60/make_item_entity_delayed.s deleted file mode 100644 index f5269b5b9a..0000000000 --- a/asm/nonmatchings/code_B9D60/make_item_entity_delayed.s +++ /dev/null @@ -1,18 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel make_item_entity_delayed -/* C81C8 80131AC8 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* C81CC 80131ACC 8FA30038 */ lw $v1, 0x38($sp) -/* C81D0 80131AD0 8FA8003C */ lw $t0, 0x3c($sp) -/* C81D4 80131AD4 8FA90040 */ lw $t1, 0x40($sp) -/* C81D8 80131AD8 2402FFFF */ addiu $v0, $zero, -1 -/* C81DC 80131ADC AFBF0020 */ sw $ra, 0x20($sp) -/* C81E0 80131AE0 AFA20018 */ sw $v0, 0x18($sp) -/* C81E4 80131AE4 AFA30010 */ sw $v1, 0x10($sp) -/* C81E8 80131AE8 AFA80014 */ sw $t0, 0x14($sp) -/* C81EC 80131AEC 0C04C4FD */ jal make_item_entity -/* C81F0 80131AF0 AFA9001C */ sw $t1, 0x1c($sp) -/* C81F4 80131AF4 8FBF0020 */ lw $ra, 0x20($sp) -/* C81F8 80131AF8 03E00008 */ jr $ra -/* C81FC 80131AFC 27BD0028 */ addiu $sp, $sp, 0x28 diff --git a/asm/nonmatchings/code_B9D60/make_item_entity_nodelay.s b/asm/nonmatchings/code_B9D60/make_item_entity_nodelay.s deleted file mode 100644 index b5a6b46ae4..0000000000 --- a/asm/nonmatchings/code_B9D60/make_item_entity_nodelay.s +++ /dev/null @@ -1,17 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel make_item_entity_nodelay -/* C8194 80131A94 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* C8198 80131A98 8FA20038 */ lw $v0, 0x38($sp) -/* C819C 80131A9C 8FA8003C */ lw $t0, 0x3c($sp) -/* C81A0 80131AA0 2403FFFF */ addiu $v1, $zero, -1 -/* C81A4 80131AA4 AFBF0020 */ sw $ra, 0x20($sp) -/* C81A8 80131AA8 AFA00014 */ sw $zero, 0x14($sp) -/* C81AC 80131AAC AFA30018 */ sw $v1, 0x18($sp) -/* C81B0 80131AB0 AFA20010 */ sw $v0, 0x10($sp) -/* C81B4 80131AB4 0C04C4FD */ jal make_item_entity -/* C81B8 80131AB8 AFA8001C */ sw $t0, 0x1c($sp) -/* C81BC 80131ABC 8FBF0020 */ lw $ra, 0x20($sp) -/* C81C0 80131AC0 03E00008 */ jr $ra -/* C81C4 80131AC4 27BD0028 */ addiu $sp, $sp, 0x28 diff --git a/asm/nonmatchings/code_B9D60/set_item_entity_flags.s b/asm/nonmatchings/code_B9D60/set_item_entity_flags.s deleted file mode 100644 index 627818c9d8..0000000000 --- a/asm/nonmatchings/code_B9D60/set_item_entity_flags.s +++ /dev/null @@ -1,21 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel set_item_entity_flags -/* CA848 80134148 3C028015 */ lui $v0, %hi(D_801565A0) -/* CA84C 8013414C 8C4265A0 */ lw $v0, %lo(D_801565A0)($v0) -/* CA850 80134150 00042080 */ sll $a0, $a0, 2 -/* CA854 80134154 00822021 */ addu $a0, $a0, $v0 -/* CA858 80134158 8C830000 */ lw $v1, ($a0) -/* CA85C 8013415C 8C620000 */ lw $v0, ($v1) -/* CA860 80134160 00451025 */ or $v0, $v0, $a1 -/* CA864 80134164 AC620000 */ sw $v0, ($v1) -/* CA868 80134168 3C030020 */ lui $v1, 0x20 -/* CA86C 8013416C 00431024 */ and $v0, $v0, $v1 -/* CA870 80134170 10400003 */ beqz $v0, .L80134180 -/* CA874 80134174 24020001 */ addiu $v0, $zero, 1 -/* CA878 80134178 3C018015 */ lui $at, %hi(D_801565A8) -/* CA87C 8013417C A42265A8 */ sh $v0, %lo(D_801565A8)($at) -.L80134180: -/* CA880 80134180 03E00008 */ jr $ra -/* CA884 80134184 00000000 */ nop diff --git a/include/functions.h b/include/functions.h index 28a255fd4f..47058afc7e 100644 --- a/include/functions.h +++ b/include/functions.h @@ -135,7 +135,7 @@ void sort_items(void); s32 is_ability_active(s32 arg0); f32 update_lerp(Easing easing, f32 start, f32 end, s32 elapsed, s32 duration); -void make_item_entity_delayed(s32 itemID, f32 x, f32 y, f32 z, s32 unk1, s32 unk2, s32 unk3); +s32 make_item_entity_delayed(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 pickupVar); void set_item_entity_position(s32 itemEntityIndex, f32 x, f32 y, f32 z); ItemEntity* get_item_entity(s32 itemEntityIndex); s32 make_item_entity_nodelay(s32 itemID, f32 x, f32 y, f32 z, ItemSpawnMode itemSpawnMode, s32 pickupVar); diff --git a/src/code_B9D60.c b/src/code_B9D60.c index 10d1f45995..596be3963d 100644 --- a/src/code_B9D60.c +++ b/src/code_B9D60.c @@ -86,7 +86,9 @@ INCLUDE_ASM(s32, "code_B9D60", draw_digit); INCLUDE_ASM(s32, "code_B9D60", draw_number); -INCLUDE_ASM(s32, "code_B9D60", func_80127B70); +void func_80127B70(s32 arg0) { + func_80127D90(arg0, 0, 0, 0, 0, 4, 0); +} INCLUDE_ASM(s32, "code_B9D60", func_80127BA4); @@ -140,14 +142,16 @@ INCLUDE_ASM(s32, "code_B9D60", init_item_entity_list); INCLUDE_ASM(s32, "code_B9D60", func_80131128); -INCLUDE_ASM(s32, "code_B9D60", make_item_entity); +s32 make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 facingAngleSign, s32 pickupVar); +INCLUDE_ASM(s32, "code_B9D60", make_item_entity, s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 facingAngleSign, s32 pickupVar); -INCLUDE_ASM(s32, "code_B9D60", make_item_entity_nodelay, s32 itemID, f32 x, f32 y, f32 z, - ItemSpawnMode itemSpawnMode, s32 pickupVar); +s32 make_item_entity_nodelay(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupVar) { + return make_item_entity(itemID, x, y, z, itemSpawnMode, 0, -1, pickupVar); +} -INCLUDE_ASM(void, "code_B9D60", make_item_entity_delayed, s32 itemID, f32 x, f32 y, f32 z, s32 unk1, - s32 unk2, - s32 unk3); +s32 make_item_entity_delayed(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 pickupVar) { + return make_item_entity(itemID, x, y, z, itemSpawnMode, pickupDelay, -1, pickupVar); +} INCLUDE_ASM(s32, "code_B9D60", init_got_item); @@ -173,11 +177,28 @@ INCLUDE_ASM(s32, "code_B9D60", test_item_player_collision); INCLUDE_ASM(s32, "code_B9D60", func_80133FC8); -INCLUDE_ASM(void, "code_B9D60", set_item_entity_flags, s32 itemEntityIndex, s32 flag); +void set_item_entity_flags(s32 index, s32 flags) { + ItemEntity* itemEntity = D_801565A0[index]; -INCLUDE_ASM(s32, "code_B9D60", clear_item_entity_flags); + itemEntity->flags |= flags; + if (itemEntity->flags & 0x200000) { + D_801565A8 = 1; + } +} -INCLUDE_ASM(s32, "code_B9D60", func_801341B0); +void clear_item_entity_flags(s32 index, s32 flags) { + ItemEntity* itemEntity = D_801565A0[index]; + + itemEntity->flags &= ~flags; +} + +void func_801341B0(s32 index) { + ItemEntity* itemEntity = D_801565A0[index]; + s32* sym = D_8009A650; + + sym[0] |= 0x40; + itemEntity->flags |= 0x100; +} s32 func_801341E8(void) { s32 ret = D_801565A8 != 0;