From 8b093ad00b0fc4239748389d613327f70bfd79e3 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Sat, 26 Aug 2023 09:24:43 +0200 Subject: [PATCH 01/14] names changed uiPauseMenuDataMgr.cpp --- src/Game/UI/uiPauseMenuDataMgr.cpp | 84 +++++++++++++++--------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.cpp b/src/Game/UI/uiPauseMenuDataMgr.cpp index 6416633bc..bfdbf74fc 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.cpp +++ b/src/Game/UI/uiPauseMenuDataMgr.cpp @@ -227,8 +227,8 @@ int pouchItemSortPredicateForArrow(const PouchItem* lhs, const PouchItem* rhs); PauseMenuDataMgr::PauseMenuDataMgr() { mListHeads.fill(nullptr); for (s32 i = 0; i < NumPouch50; ++i) { - mArray1[i] = nullptr; - mArray2[i] = PouchItemType::Invalid; + mArrayTabs[i] = nullptr; + mArrayTabsType[i] = PouchItemType::Invalid; } for (auto& x : mGrabbedItems) x = {}; @@ -248,7 +248,7 @@ void PauseMenuDataMgr::resetItem() { mNewlyAddedItem.mItemUse = ItemUse::Invalid; mNewlyAddedItem.mValue = 0; mNewlyAddedItem.mEquipped = false; - mNewlyAddedItem._25 = 0; + mNewlyAddedItem.mInInventory = false; mNewlyAddedItem.mName.clear(); mNewlyAddedItem.mData.cook = {}; mNewlyAddedItem.mData.cook.mCookEffect0 = sDummyCookEffect0; @@ -274,11 +274,11 @@ void PauseMenuDataMgr::initForNewSave() { mListHeads.fill(nullptr); for (s32 i = 0; i < NumPouch50; ++i) { - mArray1[i] = nullptr; - mArray2[i] = PouchItemType::Invalid; + mArrayTabs[i] = nullptr; + mArrayTabsType[i] = PouchItemType::Invalid; } - _44498 = {}; + mNumTab = 0; ksys::gdt::setFlag_KorokNutsNum(0); ksys::gdt::setFlag_DungeonClearSealNum(0); ksys::gdt::setFlag_FairyCountCheck(false); @@ -296,7 +296,7 @@ void PauseMenuDataMgr::initForNewSave() { mGoronSoulItem = {}; mZoraSoulItem = {}; mGerudoSoulItem = {}; - _44538 = false; + mCanSeeHealthBar = false; mEquippedWeapons.fill({}); auto* player = ksys::act::PlayerInfo::instance()->getPlayer(); @@ -338,8 +338,8 @@ void PauseMenuDataMgr::doLoadFromGameData() { mZoraSoulItem = nullptr; mGerudoSoulItem = nullptr; for (s32 i = 0; i < NumPouch50; ++i) { - mArray1[i] = nullptr; - mArray2[i] = PouchItemType::Invalid; + mArrayTabs[i] = nullptr; + mArrayTabsType[i] = PouchItemType::Invalid; } s32 num_food = 0; @@ -488,8 +488,8 @@ void PauseMenuDataMgr::doLoadFromGameData() { if (was_missing_hero_soul) updateDivineBeastClearFlags(num_cleared_beasts); - _44490 = -1; - _44494 = -1; + mLastAddedItemTab = 0xFFFFFFFF; + mLastAddedItemSlot= -1; } bool PauseMenuDataMgr::cannotGetItem(const sead::SafeString& name, int n) const { @@ -648,7 +648,7 @@ int PauseMenuDataMgr::countItems(PouchItemType type, bool count_any_weapon) cons int count = 0; for (auto* item = list.nth(0); item && item->getType() <= PouchItemType::Shield; item = list.next(item)) { - count += item->get25(); + count += item->isInInventory(); } return count; @@ -656,7 +656,7 @@ int PauseMenuDataMgr::countItems(PouchItemType type, bool count_any_weapon) cons int count = 0; for (auto* item = getItemHead(PouchCategory::Armor); item && item->getType() <= PouchItemType::ArmorLower; item = list.next(item)) { - count += item->get25(); + count += item->isInInventory(); } return count; @@ -684,7 +684,7 @@ int PauseMenuDataMgr::countItems(PouchItemType type, bool count_any_weapon) cons int count = 0; for (auto* item = *head; item && item->getType() == type; item = list.next(item)) { - count += item->get25(); + count += item->isInInventory(); } return count; } @@ -713,7 +713,7 @@ int PauseMenuDataMgr::countItems(PouchItemType type, bool count_any_weapon) cons int count = 0; for (auto* item = getItemHead(PouchCategory::Armor); item && item->getType() <= PouchItemType::ArmorLower; item = list.next(item)) { - count += item->get25(); + count += item->isInInventory(); } return count; @@ -732,7 +732,7 @@ int PauseMenuDataMgr::countItems(PouchItemType type, bool count_any_weapon) cons int count = 0; for (auto* item = first; item && item->getType() == type; item = list.next(item)) { - count += item->get25(); + count += item->isInInventory(); } return count; } @@ -750,7 +750,7 @@ bool PauseMenuDataMgr::isWeaponSectionFull(const sead::SafeString& weapon_type) for (auto item = getItemHead(category); item; item = nextItem(item)) { if (item->getType() != type) break; - num += item->_25; + num += item->mInInventory; } } @@ -784,7 +784,7 @@ void PauseMenuDataMgr::itemGet(const sead::SafeString& name, int value, mNewlyAddedItem.mType = type; mNewlyAddedItem.mValue = value; - mNewlyAddedItem._25 = 1; + mNewlyAddedItem.mInInventory = true; mNewlyAddedItem.mName = name; mNewlyAddedItem.mEquipped = false; @@ -825,14 +825,14 @@ void PauseMenuDataMgr::updateListHeads() { const auto set_if_null = [&](PouchCategory cat, s32 i) { if (!mListHeads[s32(cat)]) - mListHeads[s32(cat)] = &mArray1[i]; + mListHeads[s32(cat)] = &mArrayTabs[i]; }; for (s32 i = 0; i < NumPouch50; ++i) { - if (mArray2[i] == PouchItemType::Invalid) + if (mArrayTabsType[i] == PouchItemType::Invalid) continue; - switch (mArray2[i]) { + switch (mArrayTabsType[i]) { case PouchItemType::Sword: set_if_null(PouchCategory::Sword, i); break; @@ -875,7 +875,7 @@ void PauseMenuDataMgr::addToPouch(const sead::SafeString& name, PouchItemType ty if (!ksys::act::InfoData::instance()->hasTag(name.cstr(), ksys::act::tags::CanStack)) { for (auto* item = getItemHead(PouchCategory::KeyItem); item && item->getType() == PouchItemType::KeyItem; item = lists.list1.next(item)) { - if (item->get25() && item->getName() == name) + if (item->isInInventory() && item->getName() == name) return; } } @@ -885,7 +885,7 @@ void PauseMenuDataMgr::addToPouch(const sead::SafeString& name, PouchItemType ty // Adding a second Master Sword should just refresh the item value or equipped status. for (auto* item = getItemHead(PouchCategory::Sword); item && item->getType() == PouchItemType::Sword; item = lists.list1.next(item)) { - if (!item->get25() || item->getName() != name) + if (!item->isInInventory() || item->getName() != name) continue; if (ksys::gdt::getFlag_MasterSwordRecoverTime() <= sead::Mathf::epsilon()) { @@ -940,7 +940,7 @@ void PauseMenuDataMgr::saveToGameData(const sead::OffsetList& list) c continue; } - while (item && !item->get25()) { + while (item && !item->isInInventory()) { #ifdef MATCHING_HACK_NX_CLANG asm(""); // Prevent list.mOffset from being loaded too early #endif @@ -1251,11 +1251,11 @@ int PauseMenuDataMgr::getItemCount(const sead::SafeString& name, bool count_equi if (count_equipped) { for (auto* item = first; item; item = items.next(item)) { if (group_name == item->getName()) - count += item->get25(); + count += item->isInInventory(); } } else { for (auto* item = first; item; item = items.next(item)) { - if (group_name == item->getName() && item->get25()) + if (group_name == item->getName() && item->isInInventory()) count += !item->isEquipped(); } } @@ -1314,7 +1314,7 @@ PouchItem* PauseMenuDataMgr::getMasterSword() const { for (auto* item = getItemHead(PouchCategory::Sword); item; item = nextItem(item)) { if (item->getType() != PouchItemType::Sword) return nullptr; - if (item->_25 && item->getName() == "Weapon_Sword_070") + if (item->mInInventory && item->getName() == "Weapon_Sword_070") return item; } @@ -1382,7 +1382,7 @@ bool PauseMenuDataMgr::getEquippedArrowType(sead::BufferedSafeString* name, int* for (const auto* item = getItemHead(PouchCategory::Bow); item; item = nextItem(item)) { if (item->getType() > PouchItemType::Arrow) break; - if (item->getType() == PouchItemType::Arrow && item->get25() && item->isEquipped()) { + if (item->getType() == PouchItemType::Arrow && item->isInInventory() && item->isEquipped()) { if (name) name->copy(item->getName()); if (count) @@ -1398,7 +1398,7 @@ int PauseMenuDataMgr::getArrowCount(const sead::SafeString& name) const { for (auto item = getItemHead(PouchCategory::Bow); item; item = nextItem(item)) { if (item->getType() > PouchItemType::Arrow) break; - if (item->getType() == PouchItemType::Arrow && item->_25 && item->getName() == name) + if (item->getType() == PouchItemType::Arrow && item->mInInventory && item->getName() == name) return item->getCount(); } return 0; @@ -1593,7 +1593,7 @@ int PauseMenuDataMgr::countCookResults(const sead::SafeString& name, s32 effect_ for (auto* item = getItemHead(PouchCategory::Food); item; item = nextItem(item)) { if (item->getType() != PouchItemType::Food) break; - if (!item->get25()) + if (!item->isInInventory()) continue; if (!info->hasTag(item->getName().cstr(), ksys::act::tags::CookResult)) continue; @@ -1615,7 +1615,7 @@ int PauseMenuDataMgr::countItemsWithCategory(PouchCategory category) const { const auto type = item->getType(); if (getCategoryForType(type) != category) break; - count += item->get25(); + count += item->isInInventory(); } return count; } @@ -1668,7 +1668,7 @@ void PauseMenuDataMgr::removeCookResult(const sead::SafeString& name, s32 effect for (auto* item = getItemHead(PouchCategory::Food); item; item = items.next(item)) { if (item->getType() != PouchItemType::Food) break; - if (!item->get25()) + if (!item->isInInventory()) continue; if (!info->hasTag(item->getName().cstr(), ksys::act::tags::CookResult)) continue; @@ -1912,7 +1912,7 @@ int pouchItemSortPredicate(const PouchItem* lhs, const PouchItem* rhs) { return 0; auto* info_data = ksys::act::InfoData::instance(); - if (!info_data || !lhs->get25() || !rhs->get25()) + if (!info_data || !lhs->isInInventory() || !rhs->isInInventory()) return 0; const auto cat1 = getCategoryForTypeWithLookupTable(lhs->getType()); @@ -2172,7 +2172,7 @@ int pouchItemSortPredicateForArrow(const PouchItem* lhs, const PouchItem* rhs) { return 0; auto* info_data = ksys::act::InfoData::instance(); - if (!info_data || !lhs->get25() || !rhs->get25()) + if (!info_data || !lhs->isInInventory() || !rhs->isInInventory()) return 0; const auto cat1 = getCategoryForTypeWithLookupTable(lhs->getType()); @@ -2232,7 +2232,7 @@ int PauseMenuDataMgr::getItemValue(const sead::SafeString& name) const { if (ksys::act::InfoData::instance()->hasTag(group_name.cstr(), ksys::act::tags::CanStack)) { for (const auto& item : mItemLists.buffer) { - if (item.get25() && item.getType() == type && !group_name.comparen(item.getName(), 64)) + if (item.isInInventory() && item.getType() == type && !group_name.comparen(item.getName(), 64)) return item.getValue(); } return 0; @@ -2240,7 +2240,7 @@ int PauseMenuDataMgr::getItemValue(const sead::SafeString& name) const { s32 count = 0; for (const auto& item : mItemLists.buffer) { - if (item.get25() && item.getType() == type && !group_name.comparen(item.getName(), 64)) + if (item.isInInventory() && item.getType() == type && !group_name.comparen(item.getName(), 64)) count++; } return count; @@ -2278,7 +2278,7 @@ int PauseMenuDataMgr::countArmorDye() const { int count = 0; using namespace ksys::act; for (const auto& item : getItems()) { - if (item.get25() && InfoData::instance()->hasTag(item.getName().cstr(), tags::ArmorDye)) + if (item.isInInventory() && InfoData::instance()->hasTag(item.getName().cstr(), tags::ArmorDye)) ++count; } return count; @@ -2288,7 +2288,7 @@ int PauseMenuDataMgr::countAlreadyDyedArmor() const { int count = 0; using namespace ksys::act; for (const auto& item : getItems()) { - if (item.get25() && InfoData::instance()->hasTag(item.getName().cstr(), tags::ArmorDye) && + if (item.isInInventory() && InfoData::instance()->hasTag(item.getName().cstr(), tags::ArmorDye) && item.getValue() > 0) { ++count; } @@ -2470,7 +2470,7 @@ bool PauseMenuDataMgr::hasItemDye() const { for (const auto& item : getItems()) { auto* info = ksys::act::InfoData::instance(); const int color = ksys::act::getItemStainColor(info, item.getName().cstr()); - if (color >= FirstDyeColorIndex && color <= LastDyeColorIndex && item.get25()) { + if (color >= FirstDyeColorIndex && color <= LastDyeColorIndex && item.isInInventory()) { counts[color] += item.getValue(); if (counts[color] >= NumRequiredDyeItemsPerColor) return true; @@ -2483,7 +2483,7 @@ bool PauseMenuDataMgr::hasItemDye(int color) const { int count = 0; for (const auto& item : getItems()) { auto* info = ksys::act::InfoData::instance(); - if (ksys::act::getItemStainColor(info, item.getName().cstr()) == color && item.get25()) { + if (ksys::act::getItemStainColor(info, item.getName().cstr()) == color && item.isInInventory()) { count += item.getValue(); if (count >= NumRequiredDyeItemsPerColor) return true; @@ -2562,7 +2562,7 @@ int PauseMenuDataMgr::countArmors(const sead::SafeString& lowest_rank_armor_name for (auto* item = *mListHeads[u32(PouchCategory::Armor)]; item; item = nextItem(item)) { if (item->getType() > PouchItemType::ArmorLower) break; - if (item->get25() && armor_name == item->getName()) + if (item->isInInventory() && armor_name == item->getName()) ++count; } armor_name = ksys::act::getArmorNextRankName(info, armor_name.cstr()); @@ -2585,7 +2585,7 @@ void PauseMenuDataMgr::addNonDefaultItem(const sead::SafeString& name, int value void PauseMenuDataMgr::openItemCategoryIfNeeded() const { for (s32 i = 0; i < NumPouch50; ++i) { - const auto type = mArray2[i]; + const auto type = mArrayTabsType[i]; if (isPouchItemArmor(type)) { ksys::gdt::setFlag_IsOpenItemCategory(true, u32(PouchCategory::Armor)); } else { From d60bbc7bdc362f57ba0f016c385626251a932bb3 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Sat, 26 Aug 2023 09:32:35 +0200 Subject: [PATCH 02/14] name change uiPauseMenuDataMgr.h --- src/Game/UI/uiPauseMenuDataMgr.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.h b/src/Game/UI/uiPauseMenuDataMgr.h index f05df4716..9cc8fda2f 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.h +++ b/src/Game/UI/uiPauseMenuDataMgr.h @@ -50,7 +50,7 @@ static_assert(NumPouchItemsMax == 420, "NumPouchItemsMax must be 420 for now"); constexpr int ItemStackSizeMax = 999; // TODO: figure out what this is -constexpr int NumPouch50 = 50; +constexpr int NumTabMax = 50; constexpr int NumGrabbableItems = 5; @@ -174,7 +174,7 @@ class PouchItem { PouchItemType getType() const { return mType; } bool isEquipped() const { return mEquipped; } - u8 get25() const { return _25; } + bool isInInventory() const { return mInInventory; } const sead::SafeString& getName() const { return mName; } ItemUse getItemUse() const { return mItemUse; } @@ -236,7 +236,7 @@ class PouchItem { ItemUse mItemUse = ItemUse::Invalid; s32 mValue = 0; bool mEquipped = false; - u8 _25 = 1; + u8 mInInventory = 1; sead::FixedSafeString<64> mName; Data mData{}; sead::FixedObjArray, NumIngredientsMax> mIngredients; @@ -479,12 +479,12 @@ class PauseMenuDataMgr { mutable sead::CriticalSection mCritSection; Lists mItemLists; sead::SafeArray mListHeads; - sead::SafeArray mArray1; - sead::SafeArray mArray2; + sead::SafeArray mArrayTabs; + sead::SafeArray mArrayTabsType; PouchItem* mLastAddedItem{}; - s32 _44490 = -1; - s32 _44494 = -1; - s32 _44498{}; + u32 mLastAddedItemTab = 0xFFFFFFFF; + s32 mLastAddedItemSlot = -1; + s32 mNumSlot = 0; sead::SafeArray mGrabbedItems; PouchItem* mItem_444f0{}; s32 _444f8 = -1; @@ -499,7 +499,7 @@ class PauseMenuDataMgr { PouchItem* mGoronSoulItem{}; PouchItem* mZoraSoulItem{}; PouchItem* mGerudoSoulItem{}; - bool _44538 = false; + bool mCanSeeHealthBar = false; PouchItem mNewlyAddedItem; /// Indicates if a temporary inventory ("pouch for quest") is being used. From c8de13fa7bb6b1723e94c0944a3690332e93262d Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Sat, 26 Aug 2023 09:33:13 +0200 Subject: [PATCH 03/14] name change uiPauseMenuDataMgr.cpp --- src/Game/UI/uiPauseMenuDataMgr.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.cpp b/src/Game/UI/uiPauseMenuDataMgr.cpp index bfdbf74fc..09584dcfc 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.cpp +++ b/src/Game/UI/uiPauseMenuDataMgr.cpp @@ -226,7 +226,7 @@ int pouchItemSortPredicateForArrow(const PouchItem* lhs, const PouchItem* rhs); PauseMenuDataMgr::PauseMenuDataMgr() { mListHeads.fill(nullptr); - for (s32 i = 0; i < NumPouch50; ++i) { + for (s32 i = 0; i < NumTabMax; ++i) { mArrayTabs[i] = nullptr; mArrayTabsType[i] = PouchItemType::Invalid; } @@ -273,7 +273,7 @@ void PauseMenuDataMgr::initForNewSave() { destroyAndRecycleItem(item); mListHeads.fill(nullptr); - for (s32 i = 0; i < NumPouch50; ++i) { + for (s32 i = 0; i < NumTabMax; ++i) { mArrayTabs[i] = nullptr; mArrayTabsType[i] = PouchItemType::Invalid; } @@ -337,7 +337,7 @@ void PauseMenuDataMgr::doLoadFromGameData() { mGoronSoulItem = nullptr; mZoraSoulItem = nullptr; mGerudoSoulItem = nullptr; - for (s32 i = 0; i < NumPouch50; ++i) { + for (s32 i = 0; i < NumTabMax; ++i) { mArrayTabs[i] = nullptr; mArrayTabsType[i] = PouchItemType::Invalid; } @@ -828,7 +828,7 @@ void PauseMenuDataMgr::updateListHeads() { mListHeads[s32(cat)] = &mArrayTabs[i]; }; - for (s32 i = 0; i < NumPouch50; ++i) { + for (s32 i = 0; i < NumTabMax; ++i) { if (mArrayTabsType[i] == PouchItemType::Invalid) continue; @@ -2584,7 +2584,7 @@ void PauseMenuDataMgr::addNonDefaultItem(const sead::SafeString& name, int value } void PauseMenuDataMgr::openItemCategoryIfNeeded() const { - for (s32 i = 0; i < NumPouch50; ++i) { + for (s32 i = 0; i < NumTabMax; ++i) { const auto type = mArrayTabsType[i]; if (isPouchItemArmor(type)) { ksys::gdt::setFlag_IsOpenItemCategory(true, u32(PouchCategory::Armor)); From 1c6e73c768c9be58f142e714b1a0983963d7cb52 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Sat, 26 Aug 2023 09:36:32 +0200 Subject: [PATCH 04/14] name change queryCheckGetDemoTypeFromArg.cpp --- src/Game/AI/Query/queryCheckGetDemoTypeFromArg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/AI/Query/queryCheckGetDemoTypeFromArg.cpp b/src/Game/AI/Query/queryCheckGetDemoTypeFromArg.cpp index 38daac73b..8659ef445 100644 --- a/src/Game/AI/Query/queryCheckGetDemoTypeFromArg.cpp +++ b/src/Game/AI/Query/queryCheckGetDemoTypeFromArg.cpp @@ -21,7 +21,7 @@ CheckGetDemoTypeFromArg::~CheckGetDemoTypeFromArg() = default; int CheckGetDemoTypeFromArg::doQuery() { if (*mUseLastTryGetItemName && ui::PauseMenuDataMgr::instance()) { auto* item = ui::PauseMenuDataMgr::instance()->getLastAddedItem(); - if (item->get25()) { + if (item->isInInventory()) { if (ksys::act::hasTag(item->getName(), ksys::act::tags::ApplyHighGradeGetDemo)) return Result_HighGrade; if (ksys::act::hasTag(item->getName(), ksys::act::tags::ApplyDeluxeGetDemo)) From 7b625966d2747b92b53451de67a2809800f9e340 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Sat, 26 Aug 2023 09:45:52 +0200 Subject: [PATCH 05/14] name change oopsi uiPauseMenuDataMgr.h --- src/Game/UI/uiPauseMenuDataMgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.h b/src/Game/UI/uiPauseMenuDataMgr.h index 9cc8fda2f..782c12608 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.h +++ b/src/Game/UI/uiPauseMenuDataMgr.h @@ -484,7 +484,7 @@ class PauseMenuDataMgr { PouchItem* mLastAddedItem{}; u32 mLastAddedItemTab = 0xFFFFFFFF; s32 mLastAddedItemSlot = -1; - s32 mNumSlot = 0; + s32 mNumTab = 0; sead::SafeArray mGrabbedItems; PouchItem* mItem_444f0{}; s32 _444f8 = -1; From 7685bf164e6847daa71909538e15358776980db3 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Sat, 26 Aug 2023 09:56:11 +0200 Subject: [PATCH 06/14] Update uiPauseMenuDataMgr.h --- src/Game/UI/uiPauseMenuDataMgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.h b/src/Game/UI/uiPauseMenuDataMgr.h index 782c12608..6a9291390 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.h +++ b/src/Game/UI/uiPauseMenuDataMgr.h @@ -174,7 +174,7 @@ class PouchItem { PouchItemType getType() const { return mType; } bool isEquipped() const { return mEquipped; } - bool isInInventory() const { return mInInventory; } + u8 isInInventory() const { return mInInventory; } const sead::SafeString& getName() const { return mName; } ItemUse getItemUse() const { return mItemUse; } From f9397ed74f2fce3032caa952825999ba300f89b0 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Wed, 30 Aug 2023 08:54:10 +0200 Subject: [PATCH 07/14] Correction uiPauseMenuDataMgr.h --- src/Game/UI/uiPauseMenuDataMgr.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.h b/src/Game/UI/uiPauseMenuDataMgr.h index 6a9291390..a4e6edfe8 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.h +++ b/src/Game/UI/uiPauseMenuDataMgr.h @@ -49,7 +49,7 @@ static_assert(NumPouchItemsMax == 420, "NumPouchItemsMax must be 420 for now"); constexpr int ItemStackSizeMax = 999; -// TODO: figure out what this is +// maximum number of tab (pages with 20 items) you can have, more will be glitched constexpr int NumTabMax = 50; constexpr int NumGrabbableItems = 5; @@ -174,7 +174,7 @@ class PouchItem { PouchItemType getType() const { return mType; } bool isEquipped() const { return mEquipped; } - u8 isInInventory() const { return mInInventory; } + bool isInInventory() const { return mInInventory; } const sead::SafeString& getName() const { return mName; } ItemUse getItemUse() const { return mItemUse; } @@ -236,7 +236,7 @@ class PouchItem { ItemUse mItemUse = ItemUse::Invalid; s32 mValue = 0; bool mEquipped = false; - u8 mInInventory = 1; + bool mInInventory = true; sead::FixedSafeString<64> mName; Data mData{}; sead::FixedObjArray, NumIngredientsMax> mIngredients; @@ -484,7 +484,7 @@ class PauseMenuDataMgr { PouchItem* mLastAddedItem{}; u32 mLastAddedItemTab = 0xFFFFFFFF; s32 mLastAddedItemSlot = -1; - s32 mNumTab = 0; + s32 mNumTabs = 0; sead::SafeArray mGrabbedItems; PouchItem* mItem_444f0{}; s32 _444f8 = -1; @@ -499,6 +499,8 @@ class PauseMenuDataMgr { PouchItem* mGoronSoulItem{}; PouchItem* mZoraSoulItem{}; PouchItem* mGerudoSoulItem{}; + + // Indicates if you have the champion tunic or a divine helmet eqquiped and so if you can see enemy hp bool mCanSeeHealthBar = false; PouchItem mNewlyAddedItem; From c210a181026520ec1105a0a1ea82ae10f153a741 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:02:29 +0200 Subject: [PATCH 08/14] correction uiPauseMenuDataMgr.cpp --- src/Game/UI/uiPauseMenuDataMgr.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.cpp b/src/Game/UI/uiPauseMenuDataMgr.cpp index 09584dcfc..4388f3a26 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.cpp +++ b/src/Game/UI/uiPauseMenuDataMgr.cpp @@ -278,7 +278,7 @@ void PauseMenuDataMgr::initForNewSave() { mArrayTabsType[i] = PouchItemType::Invalid; } - mNumTab = 0; + mNumTabs = 0; ksys::gdt::setFlag_KorokNutsNum(0); ksys::gdt::setFlag_DungeonClearSealNum(0); ksys::gdt::setFlag_FairyCountCheck(false); @@ -489,7 +489,7 @@ void PauseMenuDataMgr::doLoadFromGameData() { updateDivineBeastClearFlags(num_cleared_beasts); mLastAddedItemTab = 0xFFFFFFFF; - mLastAddedItemSlot= -1; + mLastAddedItemSlot = -1; } bool PauseMenuDataMgr::cannotGetItem(const sead::SafeString& name, int n) const { @@ -1382,7 +1382,8 @@ bool PauseMenuDataMgr::getEquippedArrowType(sead::BufferedSafeString* name, int* for (const auto* item = getItemHead(PouchCategory::Bow); item; item = nextItem(item)) { if (item->getType() > PouchItemType::Arrow) break; - if (item->getType() == PouchItemType::Arrow && item->isInInventory() && item->isEquipped()) { + if (item->getType() == PouchItemType::Arrow && item->isInInventory() && + item->isEquipped()) { if (name) name->copy(item->getName()); if (count) @@ -1398,7 +1399,8 @@ int PauseMenuDataMgr::getArrowCount(const sead::SafeString& name) const { for (auto item = getItemHead(PouchCategory::Bow); item; item = nextItem(item)) { if (item->getType() > PouchItemType::Arrow) break; - if (item->getType() == PouchItemType::Arrow && item->mInInventory && item->getName() == name) + if (item->getType() == PouchItemType::Arrow && item->mInInventory && + item->getName() == name) return item->getCount(); } return 0; @@ -2232,7 +2234,8 @@ int PauseMenuDataMgr::getItemValue(const sead::SafeString& name) const { if (ksys::act::InfoData::instance()->hasTag(group_name.cstr(), ksys::act::tags::CanStack)) { for (const auto& item : mItemLists.buffer) { - if (item.isInInventory() && item.getType() == type && !group_name.comparen(item.getName(), 64)) + if (item.isInInventory() && item.getType() == type && + !group_name.comparen(item.getName(), 64)) return item.getValue(); } return 0; @@ -2240,7 +2243,8 @@ int PauseMenuDataMgr::getItemValue(const sead::SafeString& name) const { s32 count = 0; for (const auto& item : mItemLists.buffer) { - if (item.isInInventory() && item.getType() == type && !group_name.comparen(item.getName(), 64)) + if (item.isInInventory() && item.getType() == type && + !group_name.comparen(item.getName(), 64)) count++; } return count; @@ -2278,7 +2282,8 @@ int PauseMenuDataMgr::countArmorDye() const { int count = 0; using namespace ksys::act; for (const auto& item : getItems()) { - if (item.isInInventory() && InfoData::instance()->hasTag(item.getName().cstr(), tags::ArmorDye)) + if (item.isInInventory() && + InfoData::instance()->hasTag(item.getName().cstr(), tags::ArmorDye)) ++count; } return count; @@ -2288,7 +2293,8 @@ int PauseMenuDataMgr::countAlreadyDyedArmor() const { int count = 0; using namespace ksys::act; for (const auto& item : getItems()) { - if (item.isInInventory() && InfoData::instance()->hasTag(item.getName().cstr(), tags::ArmorDye) && + if (item.isInInventory() && + InfoData::instance()->hasTag(item.getName().cstr(), tags::ArmorDye) && item.getValue() > 0) { ++count; } @@ -2483,7 +2489,8 @@ bool PauseMenuDataMgr::hasItemDye(int color) const { int count = 0; for (const auto& item : getItems()) { auto* info = ksys::act::InfoData::instance(); - if (ksys::act::getItemStainColor(info, item.getName().cstr()) == color && item.isInInventory()) { + if (ksys::act::getItemStainColor(info, item.getName().cstr()) == color && + item.isInInventory()) { count += item.getValue(); if (count >= NumRequiredDyeItemsPerColor) return true; From 6ee4ef4bfe0bfb47c7ee11ae2a8053c542012d68 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:48:32 +0200 Subject: [PATCH 09/14] Update src/Game/UI/uiPauseMenuDataMgr.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Léo Lam --- src/Game/UI/uiPauseMenuDataMgr.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.h b/src/Game/UI/uiPauseMenuDataMgr.h index a4e6edfe8..fcfa1ff67 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.h +++ b/src/Game/UI/uiPauseMenuDataMgr.h @@ -49,7 +49,8 @@ static_assert(NumPouchItemsMax == 420, "NumPouchItemsMax must be 420 for now"); constexpr int ItemStackSizeMax = 999; -// maximum number of tab (pages with 20 items) you can have, more will be glitched +// Maximum number of tabs (pages with 20 items) you can have. +// Going beyond this limit will glitch the menu. constexpr int NumTabMax = 50; constexpr int NumGrabbableItems = 5; From cb7be751bfe6ce61722fdb2273eb7eb6e57be227 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:48:41 +0200 Subject: [PATCH 10/14] Update src/Game/UI/uiPauseMenuDataMgr.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Léo Lam --- src/Game/UI/uiPauseMenuDataMgr.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.h b/src/Game/UI/uiPauseMenuDataMgr.h index fcfa1ff67..4d7128308 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.h +++ b/src/Game/UI/uiPauseMenuDataMgr.h @@ -501,7 +501,8 @@ class PauseMenuDataMgr { PouchItem* mZoraSoulItem{}; PouchItem* mGerudoSoulItem{}; - // Indicates if you have the champion tunic or a divine helmet eqquiped and so if you can see enemy hp + // Indicates if the Champion's Tunic or a divine helm is equipped + // and whether the player can see enemy HP. bool mCanSeeHealthBar = false; PouchItem mNewlyAddedItem; From 2fb98b9b8df34f45291edbd96252d1983617c159 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:54:51 +0200 Subject: [PATCH 11/14] Update uiPauseMenuDataMgr.h --- src/Game/UI/uiPauseMenuDataMgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.h b/src/Game/UI/uiPauseMenuDataMgr.h index 4d7128308..517ce43f8 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.h +++ b/src/Game/UI/uiPauseMenuDataMgr.h @@ -483,7 +483,7 @@ class PauseMenuDataMgr { sead::SafeArray mArrayTabs; sead::SafeArray mArrayTabsType; PouchItem* mLastAddedItem{}; - u32 mLastAddedItemTab = 0xFFFFFFFF; + s32 mLastAddedItemTab = -1; s32 mLastAddedItemSlot = -1; s32 mNumTabs = 0; sead::SafeArray mGrabbedItems; From a5a5a9ca646fec2f9990e0fab77263a07f2ac7b9 Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:55:43 +0200 Subject: [PATCH 12/14] Update uiPauseMenuDataMgr.cpp --- src/Game/UI/uiPauseMenuDataMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.cpp b/src/Game/UI/uiPauseMenuDataMgr.cpp index 4388f3a26..cfd0408d7 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.cpp +++ b/src/Game/UI/uiPauseMenuDataMgr.cpp @@ -488,7 +488,7 @@ void PauseMenuDataMgr::doLoadFromGameData() { if (was_missing_hero_soul) updateDivineBeastClearFlags(num_cleared_beasts); - mLastAddedItemTab = 0xFFFFFFFF; + mLastAddedItemTab = -1; mLastAddedItemSlot = -1; } @@ -1399,7 +1399,7 @@ int PauseMenuDataMgr::getArrowCount(const sead::SafeString& name) const { for (auto item = getItemHead(PouchCategory::Bow); item; item = nextItem(item)) { if (item->getType() > PouchItemType::Arrow) break; - if (item->getType() == PouchItemType::Arrow && item->mInInventory && + if (item->getType() == PouchItemType::Arrow && item->mInInventory && item->getName() == name) return item->getCount(); } From 9fe47271209ca0eed35dcc764a5ce5d7c567583a Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Sun, 3 Sep 2023 12:08:38 +0200 Subject: [PATCH 13/14] Update uiPauseMenuDataMgr.h --- src/Game/UI/uiPauseMenuDataMgr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.h b/src/Game/UI/uiPauseMenuDataMgr.h index 517ce43f8..ebc3b3d17 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.h +++ b/src/Game/UI/uiPauseMenuDataMgr.h @@ -480,8 +480,8 @@ class PauseMenuDataMgr { mutable sead::CriticalSection mCritSection; Lists mItemLists; sead::SafeArray mListHeads; - sead::SafeArray mArrayTabs; - sead::SafeArray mArrayTabsType; + sead::SafeArray mTabs; + sead::SafeArray mTabsType; PouchItem* mLastAddedItem{}; s32 mLastAddedItemTab = -1; s32 mLastAddedItemSlot = -1; From babea8bb6b8b455d652b39cf2a614c809e37f2cd Mon Sep 17 00:00:00 2001 From: Kinak338 <77231406+Kinak338@users.noreply.github.com> Date: Sun, 3 Sep 2023 12:11:45 +0200 Subject: [PATCH 14/14] Update uiPauseMenuDataMgr.cpp Sure, no problem, mArrayTabs and mArrayTabsTypes becomes mTabs and mTabsTypes --- src/Game/UI/uiPauseMenuDataMgr.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Game/UI/uiPauseMenuDataMgr.cpp b/src/Game/UI/uiPauseMenuDataMgr.cpp index cfd0408d7..9ee8b83f6 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.cpp +++ b/src/Game/UI/uiPauseMenuDataMgr.cpp @@ -227,8 +227,8 @@ int pouchItemSortPredicateForArrow(const PouchItem* lhs, const PouchItem* rhs); PauseMenuDataMgr::PauseMenuDataMgr() { mListHeads.fill(nullptr); for (s32 i = 0; i < NumTabMax; ++i) { - mArrayTabs[i] = nullptr; - mArrayTabsType[i] = PouchItemType::Invalid; + mTabs[i] = nullptr; + mTabsType[i] = PouchItemType::Invalid; } for (auto& x : mGrabbedItems) x = {}; @@ -274,8 +274,8 @@ void PauseMenuDataMgr::initForNewSave() { mListHeads.fill(nullptr); for (s32 i = 0; i < NumTabMax; ++i) { - mArrayTabs[i] = nullptr; - mArrayTabsType[i] = PouchItemType::Invalid; + mTabs[i] = nullptr; + mTabsType[i] = PouchItemType::Invalid; } mNumTabs = 0; @@ -338,8 +338,8 @@ void PauseMenuDataMgr::doLoadFromGameData() { mZoraSoulItem = nullptr; mGerudoSoulItem = nullptr; for (s32 i = 0; i < NumTabMax; ++i) { - mArrayTabs[i] = nullptr; - mArrayTabsType[i] = PouchItemType::Invalid; + mTabs[i] = nullptr; + mTabsType[i] = PouchItemType::Invalid; } s32 num_food = 0; @@ -825,14 +825,14 @@ void PauseMenuDataMgr::updateListHeads() { const auto set_if_null = [&](PouchCategory cat, s32 i) { if (!mListHeads[s32(cat)]) - mListHeads[s32(cat)] = &mArrayTabs[i]; + mListHeads[s32(cat)] = &mTabs[i]; }; for (s32 i = 0; i < NumTabMax; ++i) { - if (mArrayTabsType[i] == PouchItemType::Invalid) + if (mTabsType[i] == PouchItemType::Invalid) continue; - switch (mArrayTabsType[i]) { + switch (mTabsType[i]) { case PouchItemType::Sword: set_if_null(PouchCategory::Sword, i); break; @@ -2592,7 +2592,7 @@ void PauseMenuDataMgr::addNonDefaultItem(const sead::SafeString& name, int value void PauseMenuDataMgr::openItemCategoryIfNeeded() const { for (s32 i = 0; i < NumTabMax; ++i) { - const auto type = mArrayTabsType[i]; + const auto type = mTabsType[i]; if (isPouchItemArmor(type)) { ksys::gdt::setFlag_IsOpenItemCategory(true, u32(PouchCategory::Armor)); } else {