mirror of
https://github.com/zeldaret/ph
synced 2026-05-30 17:05:38 -04:00
Decomp ItemManager::HasAllPotions
This commit is contained in:
@@ -2,27 +2,6 @@
|
||||
.include "ov00/Item/ItemManager.inc"
|
||||
|
||||
.text
|
||||
|
||||
.global _ZNK11ItemManager13HasAllPotionsEv
|
||||
arm_func_start _ZNK11ItemManager13HasAllPotionsEv
|
||||
_ZNK11ItemManager13HasAllPotionsEv: ; 0x020ae598
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
mov r4, #0
|
||||
_020ae5a4:
|
||||
mov r0, r5
|
||||
mov r1, r4
|
||||
bl _ZNK11ItemManager9HasPotionEj
|
||||
cmp r0, #0
|
||||
moveq r0, #0
|
||||
ldmeqia sp!, {r3, r4, r5, pc}
|
||||
add r4, r4, #1
|
||||
cmp r4, #2
|
||||
blt _020ae5a4
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end _ZNK11ItemManager13HasAllPotionsEv
|
||||
|
||||
.global _ZNK11ItemManager15HasPurplePotionEv
|
||||
arm_func_start _ZNK11ItemManager15HasPurplePotionEv
|
||||
_ZNK11ItemManager15HasPurplePotionEv: ; 0x020ae5d0
|
||||
|
||||
@@ -21,6 +21,7 @@ extern "C" {
|
||||
#define MAX_HOURGLASS_SECONDS 1500 // 25 minutes
|
||||
#define MAX_AMMO_UPGRADE 2
|
||||
#define MAX_UNK_0BA 9
|
||||
#define MAX_POTIONS 2
|
||||
|
||||
typedef s32 FairyId;
|
||||
enum FairyId_ {
|
||||
@@ -207,7 +208,7 @@ private:
|
||||
/* 0b6 */ u16 mBombBagSize;
|
||||
/* 0b8 */ u16 mBombchuBagSize;
|
||||
/* 0ba */ u16 mUnk_0ba; // only between 0 and 9
|
||||
/* 0bc */ Potion mPotions[2];
|
||||
/* 0bc */ Potion mPotions[MAX_POTIONS];
|
||||
/* 0be */ unk8 mUnk_0be[2]; // padding?
|
||||
/* 0c0 */ ItemModel *mItemModels[ItemModelId_COUNT];
|
||||
/* 100 */ ItemModel *mDungeonItemModels[DungeonItemModelId_COUNT]; // non-null in dungeons/caves
|
||||
|
||||
@@ -653,7 +653,7 @@ THUMB void ItemManager::GiveItem(ItemId id) {
|
||||
} break;
|
||||
|
||||
case ItemId_RedPotion: {
|
||||
for (s32 i = 0; i < 2; ++i) {
|
||||
for (s32 i = 0; i < MAX_POTIONS; ++i) {
|
||||
if (mPotions[i] != Potion_None) continue;
|
||||
this->SetPotion(i, Potion_Red);
|
||||
break;
|
||||
@@ -661,7 +661,7 @@ THUMB void ItemManager::GiveItem(ItemId id) {
|
||||
} break;
|
||||
|
||||
case ItemId_PurplePotion: {
|
||||
for (s32 i = 0; i < 2; ++i) {
|
||||
for (s32 i = 0; i < MAX_POTIONS; ++i) {
|
||||
if (mPotions[i] != Potion_None) continue;
|
||||
this->SetPotion(i, Potion_Purple);
|
||||
break;
|
||||
@@ -669,7 +669,7 @@ THUMB void ItemManager::GiveItem(ItemId id) {
|
||||
} break;
|
||||
|
||||
case ItemId_YellowPotion: {
|
||||
for (s32 i = 0; i < 2; ++i) {
|
||||
for (s32 i = 0; i < MAX_POTIONS; ++i) {
|
||||
if (mPotions[i] != Potion_None) continue;
|
||||
this->SetPotion(i, Potion_Yellow);
|
||||
break;
|
||||
@@ -875,3 +875,10 @@ ARM bool ItemManager::HasPotion(u32 index) const {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ARM bool ItemManager::HasAllPotions() const {
|
||||
for (s32 i = 0; i < MAX_POTIONS; ++i) {
|
||||
if (!this->HasPotion(i)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user