diff options
| author | savage13 <savage13@gmail.com> | 2022-02-26 16:42:09 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-26 22:42:09 +0100 |
| commit | a5641860025aed373da045ef1ac43a6487529932 (patch) | |
| tree | 5002fa6110882d06136217f79380caf4e79489eb /src/Game/UI/uiPauseMenuDataMgr.cpp | |
| parent | 17750b52257bc9658fcb43b767247c7e45e637ea (diff) | |
Add PauseMenuDataMgr::grabbedItemStuff() (#88)
Diffstat (limited to 'src/Game/UI/uiPauseMenuDataMgr.cpp')
| -rw-r--r-- | src/Game/UI/uiPauseMenuDataMgr.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Game/UI/uiPauseMenuDataMgr.cpp b/src/Game/UI/uiPauseMenuDataMgr.cpp index 6570cff8..1f519c52 100644 --- a/src/Game/UI/uiPauseMenuDataMgr.cpp +++ b/src/Game/UI/uiPauseMenuDataMgr.cpp @@ -7,9 +7,11 @@ #include "Game/Actor/actWeapon.h" #include "Game/DLC/aocManager.h" #include "Game/UI/uiUtils.h" +#include "Game/gameItemUtils.h" #include "Game/gameScene.h" #include "KingSystem/ActorSystem/Profiles/actPlayerBase.h" #include "KingSystem/ActorSystem/actActorConstDataAccess.h" +#include "KingSystem/ActorSystem/actActorHeapUtil.h" #include "KingSystem/ActorSystem/actActorUtil.h" #include "KingSystem/ActorSystem/actBaseProcLink.h" #include "KingSystem/ActorSystem/actInfoCommon.h" @@ -2782,4 +2784,38 @@ bool PauseMenuDataMgr::useItemFromRecipeAndSave(void* unk, int multiplier, Pouch return true; } +void PauseMenuDataMgr::grabbedItemStuff(PouchItem* item) { + auto lock = sead::makeScopedLock(mCritSection); + + for (auto& cur : mItemLists.list1) { + if (&cur == item && item->mType == PouchItemType::Material) { + if (item->mValue > 1) { + item->mValue -= 1; + } else { + item->mEquipped = false; + item->mValue = 0; + } + + for (auto& info : mGrabbedItems) { + if (info.item) { + if (info.item == item) { + info._9 = true; + } + } else { + info.item = item; + info._8 = true; + info._9 = false; + spawnDroppedInventoryItem( + item->getName().cstr(), + ksys::act::ActorHeapUtil::instance()->getBaseProcHeap(), -1, + SleepAfterInit::No, nullptr, SpawnViaCarryBox::Yes, 0.8, -0.8); + break; + } + } + } + updateInventoryInfo(mItemLists.list1); + saveToGameData(mItemLists.list1); + } +} + } // namespace uking::ui |
