summaryrefslogtreecommitdiff
path: root/src/code_0805436C.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/code_0805436C.c')
-rw-r--r--src/code_0805436C.c21
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) {