1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-02 14:56:39 +00:00

Remove dedicated 'Unequip' button and just us 'A'

This commit is contained in:
Andrew Lanzone 2025-07-26 01:35:25 -07:00
parent defd1edb6f
commit ab03e01127
2 changed files with 14 additions and 27 deletions

View file

@ -337,8 +337,7 @@ 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
&& mPendingControllerAction != ControllerAction::Unequip)
if (count > 1 && !shift && mPendingControllerAction != ControllerAction::Use)
{
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
std::string message = "#{sTake}";
@ -370,18 +369,20 @@ namespace MWGui
sellItem(nullptr, count);
else if (mPendingControllerAction == ControllerAction::Use)
{
// Drag and drop the item on the avatar to activate it.
dragItem(nullptr, count);
onAvatarClicked(nullptr); // Equip or use
// Drop any remaining items back in inventory. This is needed when clicking on a
// 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();
if (item.mType == ItemStack::Type_Equipped)
{
// Drop the item on the inventory background to unequip it.
onBackgroundSelected();
}
else
{
// Drop the item on the avatar to activate or equip it.
onAvatarClicked(nullptr);
// Drop any remaining items back in inventory. This is needed when clicking on a
// stack of items; we only want to use the first item.
onBackgroundSelected();
}
}
else if (mPendingControllerAction == ControllerAction::Drop)
dropItem(nullptr, count);
@ -973,21 +974,18 @@ namespace MWGui
mControllerButtons.a = "#{OMWEngine:InventorySelect}";
mControllerButtons.b = "#{Interface:Close}";
mControllerButtons.x.clear();
mControllerButtons.y.clear();
mControllerButtons.r2 = "#{sCompanionShare}";
break;
case MWGui::GM_Container:
mControllerButtons.a = "#{OMWEngine:InventorySelect}";
mControllerButtons.b = "#{Interface:Close}";
mControllerButtons.x = "#{sTakeAll}";
mControllerButtons.y.clear();
mControllerButtons.r2 = "#{sContainer}";
break;
case MWGui::GM_Barter:
mControllerButtons.a = "#{sSell}";
mControllerButtons.b = "#{Interface:Cancel}";
mControllerButtons.x = "#{sOffer}";
mControllerButtons.y.clear();
mControllerButtons.r2 = "#{sBarter}";
break;
case MWGui::GM_Inventory:
@ -995,7 +993,6 @@ namespace MWGui
mControllerButtons.a = "#{sEquip}";
mControllerButtons.b = "#{sBack}";
mControllerButtons.x = "#{sDrop}";
mControllerButtons.y = "#{sUnequip}";
mControllerButtons.r2.clear();
break;
}
@ -1045,15 +1042,6 @@ namespace MWGui
tradeWindow->onControllerButtonEvent(arg);
}
}
else if (arg.button == SDL_CONTROLLER_BUTTON_Y)
{
if (mGuiMode == MWGui::GM_Inventory)
{
// Unequip an item.
mPendingControllerAction = ControllerAction::Unequip;
mItemView->onControllerButton(SDL_CONTROLLER_BUTTON_A);
}
}
else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
{
if (mFilterAll->getStateSelected())

View file

@ -137,7 +137,6 @@ namespace MWGui
Transfer,
Sell,
Drop,
Unequip,
};
ControllerAction mPendingControllerAction;