Decomp ItemManager::GiveRupees

This commit is contained in:
Aetias
2024-04-18 20:16:18 +02:00
parent 02762ad472
commit 6f5483638e
19 changed files with 43 additions and 58 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
.extern Divide
.extern _ZN11ItemManager10GiveRupeesEsi
.extern _ZN11ItemManager10GiveRupeesEsb
.extern _ZN11ItemManager7AddItemEi
.extern _ZN11ItemManager8GiveKeysEj
.extern _ZN12ActorManager15FindActorByTypeEP8ActorRefPS_j
+1 -1
View File
@@ -76814,7 +76814,7 @@ _0203826c:
ldr r1, [r4, #4]
ldr r0, [r0]
mov r2, #1
bl _ZN11ItemManager10GiveRupeesEsi
bl _ZN11ItemManager10GiveRupeesEsb
add sp, sp, #0x18
mov r0, #2
ldmia sp!, {r3, r4, r5, pc}
-37
View File
@@ -3,43 +3,6 @@
.text
.global _ZN11ItemManager10GiveRupeesEsi
arm_func_start _ZN11ItemManager10GiveRupeesEsi
_ZN11ItemManager10GiveRupeesEsi: ; 0x020ae2e0
stmdb sp!, {r4, r5, r6, lr}
mov r6, r0
ldrh r3, [r6, #0x22]
mov r5, r2
add r4, r3, r1
bl _ZNK11ItemManager12GetMaxRupeesEv
cmp r4, r0
ble _020ae310
mov r0, r6
bl _ZNK11ItemManager12GetMaxRupeesEv
mov r4, r0
b _020ae318
_020ae310:
cmp r4, #0
movlt r4, #0
_020ae318:
ldr r0, _020ae34c ; =data_027e103c
mov r1, #1
ldr r0, [r0]
bl func_ov00_020cf374
cmp r5, #0
ldrneh r0, [r6, #0x22]
cmpne r0, r4
beq _020ae344
ldr r0, _020ae34c ; =data_027e103c
ldr r0, [r0]
bl func_ov05_02104004
_020ae344:
strh r4, [r6, #0x22]
ldmia sp!, {r4, r5, r6, pc}
.align 2, 0
arm_func_end _ZN11ItemManager10GiveRupeesEsi
_020ae34c: .word data_027e103c
.global _ZNK11ItemManager18func_ov00_020ae350Ev
arm_func_start _ZNK11ItemManager18func_ov00_020ae350Ev
_ZNK11ItemManager18func_ov00_020ae350Ev: ; 0x020ae350
+1 -1
View File
@@ -8,7 +8,7 @@
.extern _ZN10PlayerBase8TeleportEP5Vec3psibb
.extern _ZN10PlayerBase8vfunc_04Ev
.extern _ZN10PlayerBase9AddHealthEs
.extern _ZN11ItemManager10GiveRupeesEsi
.extern _ZN11ItemManager10GiveRupeesEsb
.extern _ZN11ItemManager12GetEquipItemEi
.extern _ZN11ItemManager12GetItemModelEj
.extern _ZN11ItemManager13UnequipPotionEv
+1 -1
View File
@@ -15332,7 +15332,7 @@ func_ov00_020bd510: ; 0x020bd510
ldmltia sp!, {r3, r4, r5, pc}
rsb r1, r2, #0
mov r2, #0
bl _ZN11ItemManager10GiveRupeesEsi
bl _ZN11ItemManager10GiveRupeesEsb
mvn lr, #0
mov r3, #0
str r3, [sp, #0xc]
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
.extern Divide
.extern _ZN11ItemManager10GiveRupeesEsi
.extern _ZN11ItemManager10GiveRupeesEsb
.extern _ZN11ItemManager13EquipShipPartEjj
.extern _ZN11ItemManager16SetShipPartCountEjjc
.extern _ZN11ItemManager16SetTreasureCountEjc
+2 -2
View File
@@ -17414,7 +17414,7 @@ func_ov09_0211c9a8: ; 0x0211c9a8
add r1, r0, #0
add r0, r6, #0
mov r2, #1
blx _ZN11ItemManager10GiveRupeesEsi
blx _ZN11ItemManager10GiveRupeesEsb
ldr r0, _0211c9e4 ; =gItemManager
add r1, r5, #0
ldr r6, [r0]
@@ -17445,7 +17445,7 @@ func_ov09_0211c9e8: ; 0x0211c9e8
add r1, r0, #0
add r0, r4, #0
mov r2, #1
blx _ZN11ItemManager10GiveRupeesEsi
blx _ZN11ItemManager10GiveRupeesEsb
ldr r0, _0211ca1c ; =gItemManager
add r1, r5, #0
ldr r4, [r0]
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
.extern _ZN11ItemManager10GiveRupeesEsi
.extern _ZN11ItemManager10GiveRupeesEsb
.extern _ZN5Actor10SetUnk_11bEv
.extern _ZN5Actor11SetVelocityEP5Vec3p
.extern _ZN5Actor12ApplyGravityEv
+1 -1
View File
@@ -371,7 +371,7 @@ _0213b2f8:
mov r1, r0
mov r0, r6
mov r2, #0
bl _ZN11ItemManager10GiveRupeesEsi
bl _ZN11ItemManager10GiveRupeesEsb
ldr r0, [r5, #0x158]
mvn r1, #0
cmp r0, #0
+1 -1
View File
@@ -10,7 +10,7 @@
.extern _ZN10PlayerBase8TeleportEP5Vec3psibb
.extern _ZN10PlayerBase8vfunc_04Ev
.extern _ZN10PlayerBase9AddHealthEs
.extern _ZN11ItemManager10GiveRupeesEsi
.extern _ZN11ItemManager10GiveRupeesEsb
.extern _ZN11ItemManager10SetUnk_09eEjt
.extern _ZN11ItemManager15LoadFanfareItemEi
.extern _ZN11ItemManager18func_ov00_020ad528Ev
+2 -2
View File
@@ -54185,7 +54185,7 @@ func_ov15_0214d358: ; 0x0214d358
mov r1, r0
mov r0, r5
mov r2, #0
bl _ZN11ItemManager10GiveRupeesEsi
bl _ZN11ItemManager10GiveRupeesEsb
ldr r1, [r4, #0x158]
ldr r0, _0214d3dc ; =data_ov00_020eec9c
add r1, r1, #0xfa
@@ -99853,7 +99853,7 @@ func_ov15_02174794: ; 0x02174794
mov r1, r0
mov r0, r5
mov r2, #0
bl _ZN11ItemManager10GiveRupeesEsi
bl _ZN11ItemManager10GiveRupeesEsb
ldr r1, [r4, #0x2c]
ldr r0, _02174878 ; =data_ov00_020eec9c
add r1, r1, #0xfa
+1 -1
View File
@@ -2,7 +2,7 @@
.extern Divide
.extern GiveShipPart
.extern LoadTreasureItemFanfare
.extern _ZN11ItemManager10GiveRupeesEsi
.extern _ZN11ItemManager10GiveRupeesEsb
.extern _ZN11ItemManager8GiveAmmoEit
.extern _ZN12ActorManager8GetActorEP8ActorRef
.extern _ZN14AdventureFlags3GetEj
+1 -1
View File
@@ -1049,7 +1049,7 @@ _0217cae4:
ldr r0, [r0]
rsb r1, r1, #0
mov r2, #1
bl _ZN11ItemManager10GiveRupeesEsi
bl _ZN11ItemManager10GiveRupeesEsb
bl func_ov31_0217cf1c
ldr r0, [r0, #0x470]
cmp r0, #0
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
.extern Approach_thunk
.extern _ZN11ItemManager10GiveRupeesEsi
.extern _ZN11ItemManager10GiveRupeesEsb
.extern _ZN11ItemManager16SetTreasureCountEjc
.extern _ZN12ActorManager15FindActorByTypeEP8ActorRefPS_j
.extern _ZN12ActorManager22FindNearestActorOfTypeEP8ActorRefPS_jP5Vec3p
+1 -1
View File
@@ -3035,7 +3035,7 @@ _02192754:
strb r2, [r5, #0x48b]
ldr r0, [r0]
mov r2, #1
bl _ZN11ItemManager10GiveRupeesEsi
bl _ZN11ItemManager10GiveRupeesEsb
ldrb r2, [r5, #0x48a]
ldr r0, _021927d0 ; =gItemManager
sub r1, r4, #1
+1 -1
View File
@@ -2,7 +2,7 @@
.extern Divide
.extern _ZN10ActorRupee18func_ov14_0213b5f4EjiP5Vec3pb
.extern _ZN10PlayerBase18func_ov00_020a7c1cEP8Cylinder
.extern _ZN11ItemManager10GiveRupeesEsi
.extern _ZN11ItemManager10GiveRupeesEsb
.extern _ZN11ItemManager10RemoveItemEi
.extern _ZN11ItemManager12GetItemModelEj
.extern _ZN14AdventureFlags18func_Ov00_02097810Ei
+1 -1
View File
@@ -894,7 +894,7 @@ _02196068:
mov r0, r5
rsb r1, r1, #0
mov r2, #0
bl _ZN11ItemManager10GiveRupeesEsi
bl _ZN11ItemManager10GiveRupeesEsb
ldrb r1, [r4, #0x5c9]
ldr r0, _021960f0 ; =gItemManager
add r1, r1, #1
+2 -2
View File
@@ -306,8 +306,8 @@ public:
void GiveEquipItem(ItemFlag item, u16 ammo);
// Rupees
u32 GetMaxRupees() const;
void GiveRupees(s16 amount, unk32 param2);
s32 GetMaxRupees() const;
void GiveRupees(s16 amount, bool param2);
// Potion
void SetPotion(u32 index, Potion potion);
+23 -1
View File
@@ -757,6 +757,28 @@ THUMB void ItemManager::UnequipPotion() {
}
}
ARM u32 ItemManager::GetMaxRupees() const {
ARM s32 ItemManager::GetMaxRupees() const {
return 9999;
}
extern void *data_027e103c;
extern "C" s32 func_ov00_020cf374(void *param1, bool param2);
extern "C" void func_ov05_02104004(void *param1);
ARM void ItemManager::GiveRupees(s16 amount, bool param2) {
s32 newRupees = mNumRupees + amount;
if (newRupees > this->GetMaxRupees()) {
newRupees = this->GetMaxRupees();
} else if (newRupees < 0) {
newRupees = 0;
}
s32 currRupees = func_ov00_020cf374(data_027e103c, true);
if (param2) {
currRupees = mNumRupees;
if (currRupees != newRupees) {
func_ov05_02104004(data_027e103c);
}
}
mNumRupees = newRupees;
}