From a894481fd78cb6795236fa65adda3de2f4884879 Mon Sep 17 00:00:00 2001 From: Andrew Lanzone Date: Sun, 13 Jul 2025 15:12:33 -0700 Subject: [PATCH] Clean up controller logic to match item transfer logic --- apps/openmw/mwgui/inventorywindow.cpp | 11 +++++++++-- apps/openmw/mwgui/inventorywindow.hpp | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 85a7bd7da3..4aada181fa 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -336,7 +336,8 @@ namespace MWGui // Show a dialog to select a count of items, but not when using an item from the inventory // in controller mode. In that case, we skip the dialog and just use one item immediately. - if (count > 1 && !shift && mPendingControllerAction != ControllerAction::Use) + if (count > 1 && !shift && mPendingControllerAction != ControllerAction::Use + && mPendingControllerAction != ControllerAction::Unequip) { CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog(); std::string message = "#{sTake}"; @@ -373,6 +374,12 @@ namespace MWGui // stack of items; we only want to use the first item. onBackgroundSelected(); } + else if (mPendingControllerAction == ControllerAction::Unequip) + { + // Drop on inventory background to unequip + dragItem(nullptr, count); + onBackgroundSelected(); + } else if (mPendingControllerAction == ControllerAction::Drop) dropItem(nullptr, count); else if (mTrading || mPendingControllerAction == ControllerAction::Sell) @@ -1059,8 +1066,8 @@ namespace MWGui if (mGuiMode == MWGui::GM_Inventory) { // Unequip an item. + mPendingControllerAction = ControllerAction::Unequip; mItemView->onControllerButton(SDL_CONTROLLER_BUTTON_A); - onBackgroundSelected(); // Drop on inventory background to unequip } } else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) diff --git a/apps/openmw/mwgui/inventorywindow.hpp b/apps/openmw/mwgui/inventorywindow.hpp index 7be7155d03..d2272ec775 100644 --- a/apps/openmw/mwgui/inventorywindow.hpp +++ b/apps/openmw/mwgui/inventorywindow.hpp @@ -138,6 +138,7 @@ namespace MWGui Transfer, Sell, Drop, + Unequip, }; ControllerAction mPendingControllerAction;