Merge pull request #402 from hatal175/forceEquipItem

This commit is contained in:
notyourav 2022-02-23 17:30:11 -08:00 committed by GitHub
commit 71af9de0ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 2 deletions

View File

@ -42,7 +42,7 @@ extern u8 gUnk_080FE1C6[];
*/ */
extern void (*const gUnk_080FE2A0[])(void); extern void (*const gUnk_080FE2A0[])(void);
void ForceEquipItem(u32, u8); void ForceEquipItem(u32, u32);
extern void sub_0807CAA0(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) { u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
if (bottleIndex > 3) { if (bottleIndex > 3) {