diff options
| author | notyourav <65437533+notyourav@users.noreply.github.com> | 2022-02-23 17:30:11 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-23 17:30:11 -0800 |
| commit | 71af9de0acbf98cf0621a4ea1fbe89c01ea58a76 (patch) | |
| tree | 3bbccf1e9001ebc1c517a3b28385f7333e945b50 | |
| parent | 62b8e59af1726c8fdf3b479732f84bf9cf02c180 (diff) | |
| parent | e055809a3e631b634a1417d1d17ca02d7a325472 (diff) | |
Merge pull request #402 from hatal175/forceEquipItem
| -rw-r--r-- | src/code_0805436C.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/code_0805436C.c b/src/code_0805436C.c index c690e889..4f420dd8 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -42,7 +42,7 @@ extern u8 gUnk_080FE1C6[]; */ extern void (*const gUnk_080FE2A0[])(void); -void ForceEquipItem(u32, u8); +void ForceEquipItem(u32, u32); extern void sub_0807CAA0(u32, u32); /* @@ -95,7 +95,24 @@ void PutItemOnSlot(u32 itemID) { } } -ASM_FUNC("asm/non_matching/ForceEquipItem.inc", void ForceEquipItem(u32 itemID, u8 itemSlot)) +void ForceEquipItem(u32 itemID, u32 itemSlot) { + u32 otherItem; + u32 otherItemIndex; + u32 replacedItem; + + if ((itemID - 1 < 0x1f) && (itemSlot < 2)) { + otherItemIndex = itemSlot == 0; + replacedItem = gSave.stats.itemButtons[itemSlot]; + otherItem = gSave.stats.itemButtons[otherItemIndex]; + if (gItemMetaData[otherItem].menuSlot == gItemMetaData[itemID].menuSlot) { + otherItem = replacedItem; + } + gSave.stats.itemButtons[itemSlot] = itemID; + gSave.stats.itemButtons[otherItemIndex] = otherItem; + gUnk_0200AF00.filler0[0x13] = 0x7f; + gUnk_0200AF00.filler0[0x14] = 0x7f; + } +} u32 SetBottleContents(u32 itemID, u32 bottleIndex) { if (bottleIndex > 3) { |
