match PMDM autoEquip and unequipAll

This commit is contained in:
Pistonight 2025-05-01 21:07:34 -07:00
parent 7facffb1d6
commit 56ef34dc6b
2 changed files with 30 additions and 22 deletions

View File

@ -56389,8 +56389,8 @@ Address,Quality,Size,Name
0x0000007100970060,O,000248,_ZN5uking2ui16PauseMenuDataMgr11cookItemGetERKNS_8CookItemE 0x0000007100970060,O,000248,_ZN5uking2ui16PauseMenuDataMgr11cookItemGetERKNS_8CookItemE
0x0000007100970158,O,000268,_ZN5uking2ui16PauseMenuDataMgr26setCookDataOnLastAddedItemERKNS_8CookItemE 0x0000007100970158,O,000268,_ZN5uking2ui16PauseMenuDataMgr26setCookDataOnLastAddedItemERKNS_8CookItemE
0x0000007100970264,O,000116,_ZN5uking2ui16PauseMenuDataMgr22autoEquipLastAddedItemEv 0x0000007100970264,O,000116,_ZN5uking2ui16PauseMenuDataMgr22autoEquipLastAddedItemEv
0x00000071009702d8,m,000268,_ZN5uking2ui16PauseMenuDataMgr9autoEquipEPNS0_9PouchItemERKN4sead10OffsetListIS2_EE 0x00000071009702d8,O,000268,_ZN5uking2ui16PauseMenuDataMgr9autoEquipEPNS0_9PouchItemERKN4sead10OffsetListIS2_EE
0x00000071009703e4,m,000216,_ZN5uking2ui16PauseMenuDataMgr10unequipAllENS0_13PouchItemTypeE 0x00000071009703e4,O,000216,_ZN5uking2ui16PauseMenuDataMgr10unequipAllENS0_13PouchItemTypeE
0x00000071009704bc,O,001352,_ZN5uking2ui16PauseMenuDataMgr10removeItemERKN4sead14SafeStringBaseIcEE 0x00000071009704bc,O,001352,_ZN5uking2ui16PauseMenuDataMgr10removeItemERKN4sead14SafeStringBaseIcEE
0x0000007100970a04,O,000896,_ZN5uking2ui16PauseMenuDataMgr22removeWeaponIfEquippedERKN4sead14SafeStringBaseIcEE 0x0000007100970a04,O,000896,_ZN5uking2ui16PauseMenuDataMgr22removeWeaponIfEquippedERKN4sead14SafeStringBaseIcEE
0x0000007100970d84,O,000512,_ZN5uking2ui16PauseMenuDataMgr11removeArrowERKN4sead14SafeStringBaseIcEEi 0x0000007100970d84,O,000512,_ZN5uking2ui16PauseMenuDataMgr11removeArrowERKN4sead14SafeStringBaseIcEEi

Can't render this file because it is too large.

View File

@ -1054,7 +1054,6 @@ void PauseMenuDataMgr::autoEquipLastAddedItem() {
} }
} }
// NON_MATCHING: branching
const sead::SafeString& PauseMenuDataMgr::autoEquip(PouchItem* item, const sead::SafeString& PauseMenuDataMgr::autoEquip(PouchItem* item,
const sead::OffsetList<PouchItem>& list) { const sead::OffsetList<PouchItem>& list) {
const auto type = item->getType(); const auto type = item->getType();
@ -1064,20 +1063,30 @@ const sead::SafeString& PauseMenuDataMgr::autoEquip(PouchItem* item,
if (type >= PouchItemType::Material) if (type >= PouchItemType::Material)
return sead::SafeString::cEmptyString; return sead::SafeString::cEmptyString;
if (isPouchItemArmor(type)) { switch (type) {
for (auto& other : list) { case PouchItemType::Sword:
if (other.getType() > PouchItemType::ArmorLower) case PouchItemType::Bow:
break; case PouchItemType::Shield:
if (other.getType() == type) case PouchItemType::Arrow:
other.mEquipped = false;
}
} else if (isPouchItemWeapon(type)) {
for (auto& other : list) { for (auto& other : list) {
if (other.getType() > PouchItemType::Shield) if (other.getType() > PouchItemType::Shield)
break; break;
if (other.getType() == type) if (other.getType() == type)
other.mEquipped = false; other.mEquipped = false;
} }
break;
case PouchItemType::ArmorHead:
case PouchItemType::ArmorUpper:
case PouchItemType::ArmorLower:
for (auto& other : list) {
if (other.getType() > PouchItemType::ArmorLower)
break;
if (other.getType() == type)
other.mEquipped = false;
}
break;
default:
break;
} }
item->mEquipped = true; item->mEquipped = true;
@ -1086,7 +1095,6 @@ const sead::SafeString& PauseMenuDataMgr::autoEquip(PouchItem* item,
return sead::SafeString::cEmptyString; return sead::SafeString::cEmptyString;
} }
// NON_MATCHING: harmless reordering
void PauseMenuDataMgr::unequipAll(PouchItemType type) { void PauseMenuDataMgr::unequipAll(PouchItemType type) {
const auto lock = sead::makeScopedLock(mCritSection); const auto lock = sead::makeScopedLock(mCritSection);
@ -1094,19 +1102,18 @@ void PauseMenuDataMgr::unequipAll(PouchItemType type) {
return; return;
for (auto& item : getItems()) { for (auto& item : getItems()) {
if (type == PouchItemType::Invalid) { if (item.getType() > PouchItemType::ArmorLower)
if (item.getType() > PouchItemType::ArmorLower) break;
break; if (!item.isEquipped())
if (item.isEquipped() && item.getType() != PouchItemType::Arrow) continue;
item.mEquipped = false;
} else { if (type == PouchItemType::Invalid) {
if (item.getType() > PouchItemType::ArmorLower) if (item.getType() != PouchItemType::Arrow) {
break;
if (item.isEquipped() && item.getType() == type) {
item.mEquipped = false; item.mEquipped = false;
break;
} }
} else if (item.getType() == type) {
item.mEquipped = false;
break;
} }
} }
} }
@ -2207,6 +2214,7 @@ const sead::SafeString* PauseMenuDataMgr::getEquippedItemName(PouchItemType type
if (item->isEquipped() && item->getType() == type) if (item->isEquipped() && item->getType() == type)
return &item->getName(); return &item->getName();
} }
return nullptr; return nullptr;
} }