summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAetias <aetias@outlook.com>2024-02-18 11:42:51 +0100
committerAetias <aetias@outlook.com>2024-02-18 11:42:51 +0100
commit1485d2f5eee7c573e791d07e36274e90dd235e8a (patch)
treec9408121f5ba733ea17438181723616398934e00
parent64aea4ed325147a4d66b95b1eb514aad08c3e734 (diff)
Decomp `ITemManager::SetTreasureCount`
-rw-r--r--asm/include/ov09.inc6
-rw-r--r--asm/include/ov45.inc2
-rw-r--r--asm/include/ov46.inc2
-rw-r--r--asm/ov00/ItemManager/ItemManager.s14
-rw-r--r--asm/ov09.s6
-rw-r--r--asm/ov45.s2
-rw-r--r--asm/ov46.s2
-rw-r--r--src/ItemManager.cpp5
8 files changed, 15 insertions, 24 deletions
diff --git a/asm/include/ov09.inc b/asm/include/ov09.inc
index f7ebf067..ef0f176e 100644
--- a/asm/include/ov09.inc
+++ b/asm/include/ov09.inc
@@ -931,7 +931,7 @@
.extern gItemManager
.extern _ZN11ItemManager10GiveRupeesEjj
.extern _ZNK11ItemManager16GetTreasureCountEj
-.extern _ZN11ItemManager16SetTreasureCountEjj
+.extern _ZN11ItemManager16SetTreasureCountEjc
.extern gItemManager
.extern _ZNK11ItemManager16GetShipPartCountEjj
.extern _ZN11ItemManager16SetShipPartCountEjjc
@@ -941,9 +941,9 @@
.extern gOverlayManager
.extern data_027e1058
.extern _ZNK11ItemManager16GetTreasureCountEj
-.extern _ZN11ItemManager16SetTreasureCountEjj
+.extern _ZN11ItemManager16SetTreasureCountEjc
.extern _ZNK11ItemManager16GetTreasureCountEj
-.extern _ZN11ItemManager16SetTreasureCountEjj
+.extern _ZN11ItemManager16SetTreasureCountEjc
.extern gItemManager
.extern gOverlayManager
.extern data_027e105c
diff --git a/asm/include/ov45.inc b/asm/include/ov45.inc
index 3eb0ef62..7cfdf065 100644
--- a/asm/include/ov45.inc
+++ b/asm/include/ov45.inc
@@ -130,7 +130,7 @@
.extern func_ov09_0211cb5c
.extern func_020328a8
.extern _ZNK11ItemManager16GetTreasureCountEj
-.extern _ZN11ItemManager16SetTreasureCountEjj
+.extern _ZN11ItemManager16SetTreasureCountEjc
.extern gItemManager
.extern func_ov09_02113f40
.extern func_ov02_020f37e8
diff --git a/asm/include/ov46.inc b/asm/include/ov46.inc
index 1ea80dfd..7987f891 100644
--- a/asm/include/ov46.inc
+++ b/asm/include/ov46.inc
@@ -223,7 +223,7 @@
.extern _ZNK11ItemManager16GetTreasureCountEj
.extern func_ov03_020f3d80
.extern _ZN11ItemManager10GiveRupeesEjj
-.extern _ZN11ItemManager16SetTreasureCountEjj
+.extern _ZN11ItemManager16SetTreasureCountEjc
.extern gItemManager
.extern data_027e0dbc
.extern _ZNK11ItemManager16GetTreasureCountEj
diff --git a/asm/ov00/ItemManager/ItemManager.s b/asm/ov00/ItemManager/ItemManager.s
index 67e344b3..af3f79d1 100644
--- a/asm/ov00/ItemManager/ItemManager.s
+++ b/asm/ov00/ItemManager/ItemManager.s
@@ -3,20 +3,6 @@
.text
- .global _ZN11ItemManager16SetTreasureCountEjj
- thumb_func_start _ZN11ItemManager16SetTreasureCountEjj
-_ZN11ItemManager16SetTreasureCountEjj: ; 0x020ad920
- cmp r2, #0x63
- ble _020ad926
- mov r2, #0x63
-_020ad926:
- add r0, r0, r1
- add r0, #0x90
- strb r2, [r0]
- bx lr
- .align 2, 0
- thumb_func_end _ZN11ItemManager16SetTreasureCountEjj
-
.global _ZNK11ItemManager10GetUnk_098Ej
thumb_func_start _ZNK11ItemManager10GetUnk_098Ej
_ZNK11ItemManager10GetUnk_098Ej: ; 0x020ad930
diff --git a/asm/ov09.s b/asm/ov09.s
index 3961d617..5833a191 100644
--- a/asm/ov09.s
+++ b/asm/ov09.s
@@ -17457,7 +17457,7 @@ func_ov09_0211c9e8: ; 0x0211c9e8
add r0, r4, #0
add r1, r5, #0
asr r2, r2, #0x18
- bl _ZN11ItemManager16SetTreasureCountEjj
+ bl _ZN11ItemManager16SetTreasureCountEjc
pop {r3, r4, r5, pc}
.align 2, 0
thumb_func_end func_ov09_0211c9e8
@@ -17567,7 +17567,7 @@ _0211cacc:
add r1, r5, #0
ldr r0, [r0]
mov r2, #1
- bl _ZN11ItemManager16SetTreasureCountEjj
+ bl _ZN11ItemManager16SetTreasureCountEjc
b _0211cb04
_0211cae8:
ldr r0, _0211cb28 ; =gItemManager
@@ -17581,7 +17581,7 @@ _0211cae8:
add r0, r4, #0
add r1, r5, #0
asr r2, r2, #0x18
- bl _ZN11ItemManager16SetTreasureCountEjj
+ bl _ZN11ItemManager16SetTreasureCountEjc
_0211cb04:
ldr r0, _0211cb2c ; =data_ov09_0211f308
str r5, [r0]
diff --git a/asm/ov45.s b/asm/ov45.s
index 816379ee..3ad1e404 100644
--- a/asm/ov45.s
+++ b/asm/ov45.s
@@ -1373,7 +1373,7 @@ func_ov45_0218a6ac: ; 0x0218a6ac
ldr r1, [r5, #0x1c]
mov r0, r4
mov r2, r2, asr #0x18
- blx _ZN11ItemManager16SetTreasureCountEjj
+ blx _ZN11ItemManager16SetTreasureCountEjc
ldmia sp!, {r3, r4, r5, pc}
.align 2, 0
arm_func_end func_ov45_0218a6ac
diff --git a/asm/ov46.s b/asm/ov46.s
index 872f3ca6..7a2f985b 100644
--- a/asm/ov46.s
+++ b/asm/ov46.s
@@ -3044,7 +3044,7 @@ _02192754:
ldr r0, [r0]
mov r1, r3, lsr #0x1c
mov r2, r2, asr #0x18
- blx _ZN11ItemManager16SetTreasureCountEjj
+ blx _ZN11ItemManager16SetTreasureCountEjc
_021927c4:
mov r0, #1
ldmia sp!, {r3, r4, r5, pc}
diff --git a/src/ItemManager.cpp b/src/ItemManager.cpp
index 480e96cd..1a4495f6 100644
--- a/src/ItemManager.cpp
+++ b/src/ItemManager.cpp
@@ -292,3 +292,8 @@ THUMB void ItemManager::SetShipPartCount(ShipPart part, ShipType type, s8 count)
THUMB s8 ItemManager::GetTreasureCount(Treasure treasure) const {
return this->mTreasure[treasure];
}
+
+THUMB void ItemManager::SetTreasureCount(Treasure treasure, s8 count) {
+ if (count > 99) count = 99;
+ this->mTreasure[treasure] = count;
+}