From 80a2ef29ad06b4aa6fb1c2ba91c19dcc68e732fa Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sun, 24 Jul 2022 20:09:04 +0300 Subject: [PATCH 1/2] Allow activating quick keys menu in menus --- CHANGELOG.md | 1 + apps/openmw/mwinput/actionmanager.cpp | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da42274f49..2c91b7bf1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,6 +133,7 @@ Bug #6799: Game crashes if an NPC has no Class attached Bug #6849: ImageButton texture is not scaled properly Bug #6895: Removing a negative number of items from a script, makes the script terminate with an error + Bug #6898: Accessing the Quick Inventory menu does not work while in menu mode Bug #6901: Morrowind.exe soul gem usage discrepancy Feature #890: OpenMW-CS: Column filtering Feature #1465: "Reset" argument for AI functions diff --git a/apps/openmw/mwinput/actionmanager.cpp b/apps/openmw/mwinput/actionmanager.cpp index 4674ead688..488897ea72 100644 --- a/apps/openmw/mwinput/actionmanager.cpp +++ b/apps/openmw/mwinput/actionmanager.cpp @@ -477,22 +477,25 @@ namespace MWInput void ActionManager::showQuickKeysMenu() { - if (!MWBase::Environment::get().getWindowManager()->isGuiMode () - && MWBase::Environment::get().getWorld()->getGlobalFloat ("chargenstate")==-1) - { - if (!checkAllowedToUseItems()) - return; - - MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_QuickKeysMenu); - } - else if (MWBase::Environment::get().getWindowManager()->getMode () == MWGui::GM_QuickKeysMenu) + if (MWBase::Environment::get().getWindowManager()->getMode () == MWGui::GM_QuickKeysMenu) { + //Handle any open Modal windows while (MyGUI::InputManager::getInstance().isModalAny()) - { //Handle any open Modal windows + { MWBase::Environment::get().getWindowManager()->exitCurrentModal(); } - MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode(); //And handle the actual main window + //And handle the actual main window + MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode(); + return; } + + if (MWBase::Environment::get().getWorld()->getGlobalFloat ("chargenstate") != -1) + return; + + if (!checkAllowedToUseItems()) + return; + + MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_QuickKeysMenu); } void ActionManager::activate() From ae4df2e038c7dbb6f01b0aa12da6181fca6531c6 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Mon, 25 Jul 2022 01:00:07 +0300 Subject: [PATCH 2/2] Only close quick keys-related modals when the menu is closed --- apps/openmw/mwgui/quickkeysmenu.cpp | 12 ++++++++++++ apps/openmw/mwgui/quickkeysmenu.hpp | 1 + apps/openmw/mwinput/actionmanager.cpp | 6 ------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index aeadc88177..5608e8b767 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -123,6 +123,18 @@ namespace MWGui } } + void QuickKeysMenu::onClose() + { + WindowBase::onClose(); + + if (mAssignDialog) + mAssignDialog->setVisible(false); + if (mItemSelectionDialog) + mItemSelectionDialog->setVisible(false); + if (mMagicSelectionDialog) + mMagicSelectionDialog->setVisible(false); + } + void QuickKeysMenu::unassign(keyData* key) { key->button->clearUserStrings(); diff --git a/apps/openmw/mwgui/quickkeysmenu.hpp b/apps/openmw/mwgui/quickkeysmenu.hpp index 4761c98ceb..6343dfc879 100644 --- a/apps/openmw/mwgui/quickkeysmenu.hpp +++ b/apps/openmw/mwgui/quickkeysmenu.hpp @@ -33,6 +33,7 @@ namespace MWGui void onAssignMagic (const std::string& spellId); void onAssignMagicCancel (); void onOpen() override; + void onClose() override; void activateQuickKey(int index); void updateActivatedQuickKey(); diff --git a/apps/openmw/mwinput/actionmanager.cpp b/apps/openmw/mwinput/actionmanager.cpp index 488897ea72..75b53d47be 100644 --- a/apps/openmw/mwinput/actionmanager.cpp +++ b/apps/openmw/mwinput/actionmanager.cpp @@ -479,12 +479,6 @@ namespace MWInput { if (MWBase::Environment::get().getWindowManager()->getMode () == MWGui::GM_QuickKeysMenu) { - //Handle any open Modal windows - while (MyGUI::InputManager::getInstance().isModalAny()) - { - MWBase::Environment::get().getWindowManager()->exitCurrentModal(); - } - //And handle the actual main window MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode(); return; }