From 167fe1122ea3fcfcc6b46af1ced55b2c7e44c170 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Mon, 27 Dec 2021 17:06:51 +0200 Subject: Fix nonmatching PutItemOnSlot --- src/code_0805436C.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/code_0805436C.c') diff --git a/src/code_0805436C.c b/src/code_0805436C.c index a2352185..f463aabb 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -44,13 +44,13 @@ u32 IsItemEquipped(u32 itemID) { return itemSlot; } -NONMATCH("asm/non_matching/PutItemOnSlot.inc", void PutItemOnSlot(u32 itemID)) { - // reg-alloc +void PutItemOnSlot(u32 itemID) { u32 itemSlot; - if (itemID < 0x47) { + register u32 itemID2 asm ("r5") = itemID; + if (itemID2 < 0x47) { sub_0807CAA0(0, 1); } - if (itemID - 1 < 0x1f) { + if (itemID2 - 1 < 0x1f) { itemSlot = 2; if (gSave.stats.itemOnA == 0) { itemSlot = 0; @@ -58,7 +58,7 @@ NONMATCH("asm/non_matching/PutItemOnSlot.inc", void PutItemOnSlot(u32 itemID)) { itemSlot = 1; } if (itemSlot == 2) { - u8 temp = gUnk_080FD5B4[itemID].unk; + u8 temp = gUnk_080FD5B4[itemID2].unk; if (temp == gUnk_080FD5B4[gSave.stats.itemOnA].unk) { itemSlot = 0; } else { @@ -70,10 +70,9 @@ NONMATCH("asm/non_matching/PutItemOnSlot.inc", void PutItemOnSlot(u32 itemID)) { return; } } - ForceEquipItem(itemID, itemSlot); + ForceEquipItem(itemID2, itemSlot); } } -END_NONMATCH ASM_FUNC("asm/non_matching/ForceEquipItem.inc", void ForceEquipItem(u32 itemID, u8 itemSlot)) -- cgit v1.2.3 From 1ace8abbc1a06ca7a6761f8b699c84c428c5a527 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Tue, 28 Dec 2021 00:12:25 +0200 Subject: clang format --- src/code_0805436C.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/code_0805436C.c') diff --git a/src/code_0805436C.c b/src/code_0805436C.c index f463aabb..62853444 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -46,7 +46,7 @@ u32 IsItemEquipped(u32 itemID) { void PutItemOnSlot(u32 itemID) { u32 itemSlot; - register u32 itemID2 asm ("r5") = itemID; + register u32 itemID2 asm("r5") = itemID; if (itemID2 < 0x47) { sub_0807CAA0(0, 1); } -- cgit v1.2.3