From a41ce23938423313ed0d5859dea6730a4e2915f1 Mon Sep 17 00:00:00 2001 From: Aetias Date: Tue, 30 Apr 2024 18:17:31 +0200 Subject: [PATCH] Decomp `ItemManager::SetPotion` --- asm/ov00/Item/ItemManager.s | 28 ---------------------------- src/00_Core/Item/ItemManager.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/asm/ov00/Item/ItemManager.s b/asm/ov00/Item/ItemManager.s index e8e5132b..b603e4e7 100644 --- a/asm/ov00/Item/ItemManager.s +++ b/asm/ov00/Item/ItemManager.s @@ -3,34 +3,6 @@ .text - .global _ZN11ItemManager9SetPotionEjh - arm_func_start _ZN11ItemManager9SetPotionEjh -_ZN11ItemManager9SetPotionEjh: ; 0x020ae50c - add r3, r0, r1 - strb r2, [r3, #0xbc] - cmp r2, #0 - add r1, r1, #9 - bne _020ae544 - add r3, r0, #0x128 - mov r2, r1, lsr #0x5 - and r0, r1, #0x1f - mov r1, #1 - mvn r0, r1, lsl r0 - ldr r1, [r3, r2, lsl #2] - and r0, r1, r0 - str r0, [r3, r2, lsl #2] - bx lr -_020ae544: - add ip, r0, #0x128 - mov r3, r1, lsr #0x5 - and r0, r1, #0x1f - ldr r2, [ip, r3, lsl #2] - mov r1, #1 - orr r0, r2, r1, lsl r0 - str r0, [ip, r3, lsl #2] - bx lr - arm_func_end _ZN11ItemManager9SetPotionEjh - .global _ZNK11ItemManager9HasPotionEj arm_func_start _ZNK11ItemManager9HasPotionEj _ZNK11ItemManager9HasPotionEj: ; 0x020ae564 diff --git a/src/00_Core/Item/ItemManager.cpp b/src/00_Core/Item/ItemManager.cpp index 617ec311..877d43de 100644 --- a/src/00_Core/Item/ItemManager.cpp +++ b/src/00_Core/Item/ItemManager.cpp @@ -853,3 +853,12 @@ ARM void ItemManager::func_ov00_020ae4dc(s32 param1) { mUnk_0ba = newValue; } } + +ARM void ItemManager::SetPotion(u32 index, Potion potion) { + mPotions[index] = potion; + if (potion == Potion_None) { + RESET_FLAG(mItemFlags.flags, index + ItemFlag_PotionA); + } else { + SET_FLAG(mItemFlags.flags, index + ItemFlag_PotionA); + } +}