summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAetias <aetias@outlook.com>2024-04-30 18:17:31 +0200
committerAetias <aetias@outlook.com>2024-04-30 18:17:31 +0200
commita41ce23938423313ed0d5859dea6730a4e2915f1 (patch)
tree7f1e6fdeeeda450a4e69d60c107d315ef1ff78d0
parent81c5e92ebc5d43c30ac81b52a2c81c1b4b8f5d69 (diff)
Decomp `ItemManager::SetPotion`
-rw-r--r--asm/ov00/Item/ItemManager.s28
-rw-r--r--src/00_Core/Item/ItemManager.cpp9
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);
+ }
+}