Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++

Menus made for a controller or the mouse's, as what is used picks

pw-tf85c6acb3416e
diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp
index c204bbd..3bfe101 100644
--- a/apps/openmw/mwbase/windowmanager.hpp
+++ b/apps/openmw/mwbase/windowmanager.hpp
@@ -201,6 +201,8 @@ namespace MWBase
virtual void clearConsolePtr() = 0;
virtual void executeCommandInConsole(const std::string& command) = 0;
virtual void setCursorActive(bool active) = 0;
+ /// Isowind: a controller (true) or the mouse (false) was used; the menus become the ones made for it
+ virtual void onInputDeviceUsed(bool controller) = 0;
virtual void getMousePosition(int& x, int& y) = 0;
virtual void getMousePosition(float& x, float& y) = 0;
virtual void setDragDrop(bool dragDrop) = 0;
diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp
index 0f2232f..b301f7f 100644
--- a/apps/openmw/mwgui/alchemywindow.cpp
+++ b/apps/openmw/mwgui/alchemywindow.cpp
@@ -94,14 +94,11 @@ namespace MWGui
mFilterValue->eventEditTextChange += MyGUI::newDelegate(this, &AlchemyWindow::onFilterEdited);
mFilterType->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::switchFilterType);
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.mA = "#{Interface:Select}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- mControllerButtons.mX = "#{Interface:Create}";
- mControllerButtons.mY = "#{Interface:MagicEffects}";
- mControllerButtons.mR3 = "#{Interface:Info}";
- }
+ mControllerButtons.mA = "#{Interface:Select}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
+ mControllerButtons.mX = "#{Interface:Create}";
+ mControllerButtons.mY = "#{Interface:MagicEffects}";
+ mControllerButtons.mR3 = "#{Interface:Info}";
center();
}
diff --git a/apps/openmw/mwgui/confirmationdialog.cpp b/apps/openmw/mwgui/confirmationdialog.cpp
index d50c871..ce7fdf5 100644
--- a/apps/openmw/mwgui/confirmationdialog.cpp
+++ b/apps/openmw/mwgui/confirmationdialog.cpp
@@ -20,12 +20,9 @@ namespace MWGui
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ConfirmationDialog::onCancelButtonClicked);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ConfirmationDialog::onOkButtonClicked);
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.mA = "#{Interface:OK}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- }
+ mDisableGamepadCursor = true;
+ mControllerButtons.mA = "#{Interface:OK}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
}
void ConfirmationDialog::askForConfirmation(const std::string& message)
diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp
index 5731f60..3b90b1c 100644
--- a/apps/openmw/mwgui/container.cpp
+++ b/apps/openmw/mwgui/container.cpp
@@ -177,21 +177,7 @@ namespace MWGui
};
mPrevTabButton = makeArrow("<", &ContainerWindow::onPrevTabClicked);
mNextTabButton = makeArrow(">", &ContainerWindow::onNextTabClicked);
- if (Settings::gui().mControllerMenus)
- {
- // The triggers, as for the inventory's tabs (Isowind: the bumpers switch windows)
- auto makeImage = [&](SDL_GameControllerAxis axis) {
- MyGUI::ImageBox* image = mTabBar->createWidget<MyGUI::ImageBox>(
- "ImageBox", MyGUI::IntCoord(0, 0, sTabHeight, sTabHeight), MyGUI::Align::Left | MyGUI::Align::Top);
- image->setImageTexture(MWBase::Environment::get().getInputManager()->getControllerAxisIcon(axis));
- image->setColour(MyGUI::Colour::parse("#ccb589"));
- image->setAlpha(0.7f);
- image->setNeedMouseFocus(false);
- return image;
- };
- mPrevTabImage = makeImage(SDL_CONTROLLER_AXIS_TRIGGERLEFT);
- mNextTabImage = makeImage(SDL_CONTROLLER_AXIS_TRIGGERRIGHT);
- }
+ onControllerMenusChanged();
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord
+= MyGUI::newDelegate(this, &ContainerWindow::onWindowResize);
@@ -209,6 +195,35 @@ namespace MWGui
mControllerButtons.mL2 = "#{Interface:Inventory}";
}
+ void ContainerWindow::onControllerMenusChanged()
+ {
+ // With a controller, the triggers at either end of the tabs, as for the inventory's (Isowind: the bumpers switch
+ // windows); the tabs' layout takes them as there or not
+ const bool controller = Settings::gui().mControllerMenus;
+ if (controller && mPrevTabImage == nullptr)
+ {
+ auto makeImage = [&](SDL_GameControllerAxis axis) {
+ MyGUI::ImageBox* image = mTabBar->createWidget<MyGUI::ImageBox>(
+ "ImageBox", MyGUI::IntCoord(0, 0, sTabHeight, sTabHeight), MyGUI::Align::Left | MyGUI::Align::Top);
+ image->setImageTexture(MWBase::Environment::get().getInputManager()->getControllerAxisIcon(axis));
+ image->setColour(MyGUI::Colour::parse("#ccb589"));
+ image->setAlpha(0.7f);
+ image->setNeedMouseFocus(false);
+ return image;
+ };
+ mPrevTabImage = makeImage(SDL_CONTROLLER_AXIS_TRIGGERLEFT);
+ mNextTabImage = makeImage(SDL_CONTROLLER_AXIS_TRIGGERRIGHT);
+ }
+ else if (!controller && mPrevTabImage != nullptr)
+ {
+ MyGUI::Gui::getInstance().destroyWidget(mPrevTabImage);
+ MyGUI::Gui::getInstance().destroyWidget(mNextTabImage);
+ mPrevTabImage = nullptr;
+ mNextTabImage = nullptr;
+ }
+ WindowBase::onControllerMenusChanged();
+ }
+
void ContainerWindow::onItemSelected(int index)
{
if (mDragAndDrop->mIsOnDragAndDrop)
diff --git a/apps/openmw/mwgui/container.hpp b/apps/openmw/mwgui/container.hpp
index 401cc71..051ebe1 100644
--- a/apps/openmw/mwgui/container.hpp
+++ b/apps/openmw/mwgui/container.hpp
@@ -54,6 +54,7 @@ namespace MWGui
ControllerButtons* getControllerButtons() override;
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
void setActiveControllerWindow(bool active) override;
+ void onControllerMenusChanged() override;
bool stepTab(int delta) override;
MWGui::ItemView* getItemView() { return mItemView; }
diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp
index 44816a0..a1cb617 100644
--- a/apps/openmw/mwgui/dialogue.cpp
+++ b/apps/openmw/mwgui/dialogue.cpp
@@ -91,7 +91,7 @@ namespace MWGui
mBribe100Button->eventMouseButtonClick += MyGUI::newDelegate(this, &PersuasionDialog::onPersuade);
mBribe1000Button->eventMouseButtonClick += MyGUI::newDelegate(this, &PersuasionDialog::onPersuade);
- mDisableGamepadCursor = Settings::gui().mControllerMenus;
+ mDisableGamepadCursor = true;
mControllerButtons.mA = "#{Interface:Select}";
mControllerButtons.mB = "#{Interface:Cancel}";
}
diff --git a/apps/openmw/mwgui/inventorytabsoverlay.cpp b/apps/openmw/mwgui/inventorytabsoverlay.cpp
index fc6e32b..6d22708 100644
--- a/apps/openmw/mwgui/inventorytabsoverlay.cpp
+++ b/apps/openmw/mwgui/inventorytabsoverlay.cpp
@@ -38,22 +38,26 @@ namespace MWGui
image->setImageTexture(MWBase::Environment::get().getInputManager()->getControllerButtonIcon(
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER));
- // Isowind: and the keyboard's Q and E, which are shown without a controller (the bar is for the mouse and
- // keyboard too)
- if (!Settings::gui().mControllerMenus)
- {
- const auto show = [this](std::string_view id, bool shown) {
- MyGUI::Widget* widget;
- getWidget(widget, id);
- widget->setVisible(shown);
- widget->setUserString("Hidden", shown ? "false" : "true");
- };
- show("BtnL2Image", false);
- show("BtnR2Image", false);
- show("KeyPrevText", true);
- show("KeyNextText", true);
- mTabBox->notifyChildrenSizeChanged();
- }
+ onControllerMenusChanged();
+ }
+
+ void InventoryTabsOverlay::onControllerMenusChanged()
+ {
+ // Isowind: the controller's bumpers, or the keyboard's Q and E without a controller (the bar is for the mouse
+ // and keyboard too)
+ const bool controller = Settings::gui().mControllerMenus;
+ const auto show = [this](std::string_view id, bool shown) {
+ MyGUI::Widget* widget;
+ getWidget(widget, id);
+ widget->setVisible(shown);
+ widget->setUserString("Hidden", shown ? "false" : "true");
+ };
+ show("BtnL2Image", controller);
+ show("BtnR2Image", controller);
+ show("KeyPrevText", !controller);
+ show("KeyNextText", !controller);
+ mTabBox->notifyChildrenSizeChanged();
+ WindowBase::onControllerMenusChanged();
}
int InventoryTabsOverlay::getHeight()
diff --git a/apps/openmw/mwgui/inventorytabsoverlay.hpp b/apps/openmw/mwgui/inventorytabsoverlay.hpp
index 739b6dc..9f4448e 100644
--- a/apps/openmw/mwgui/inventorytabsoverlay.hpp
+++ b/apps/openmw/mwgui/inventorytabsoverlay.hpp
@@ -24,6 +24,7 @@ namespace MWGui
void setTab(size_t index);
/// Isowind: a tab only for a page open (character creation opens them one by one)
void setTabAvailable(size_t index, bool available);
+ void onControllerMenusChanged() override;
private:
std::vector<MyGUI::Button*> mTabs;
diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp
index 689fa3e..80a0011 100644
--- a/apps/openmw/mwgui/inventorywindow.cpp
+++ b/apps/openmw/mwgui/inventorywindow.cpp
@@ -140,26 +140,28 @@ namespace MWGui
// Isowind: the inventory screen's windows are pages, and only the map can be pinned
setPinButtonVisible(false);
- if (Settings::gui().mControllerMenus)
+ mControllerButtons.mR3 = "#{Interface:Info}";
+ onControllerMenusChanged();
+
+ adjustPanes();
+ }
+
+ void InventoryWindow::onControllerMenusChanged()
+ {
+ // With a controller, the buttons for the tabs next to them: the triggers (Isowind: the bumpers switch windows)
+ const bool controller = Settings::gui().mControllerMenus;
+ const std::pair<const char*, SDL_GameControllerAxis> images[]
+ = { { "BtnL1Image", SDL_CONTROLLER_AXIS_TRIGGERLEFT }, { "BtnR1Image", SDL_CONTROLLER_AXIS_TRIGGERRIGHT } };
+ for (const auto& [name, axis] : images)
{
- // Show the buttons for the tabs next to them: the triggers (Isowind: the bumpers switch windows)
MyGUI::ImageBox* image;
- getWidget(image, "BtnL1Image");
- image->setVisible(true);
- image->setUserString("Hidden", "false");
- image->setImageTexture(MWBase::Environment::get().getInputManager()->getControllerAxisIcon(
- SDL_CONTROLLER_AXIS_TRIGGERLEFT));
-
- getWidget(image, "BtnR1Image");
- image->setVisible(true);
- image->setUserString("Hidden", "false");
- image->setImageTexture(MWBase::Environment::get().getInputManager()->getControllerAxisIcon(
- SDL_CONTROLLER_AXIS_TRIGGERRIGHT));
-
- mControllerButtons.mR3 = "#{Interface:Info}";
+ getWidget(image, name);
+ image->setVisible(controller);
+ image->setUserString("Hidden", controller ? "false" : "true");
+ if (controller)
+ image->setImageTexture(MWBase::Environment::get().getInputManager()->getControllerAxisIcon(axis));
}
-
- adjustPanes();
+ WindowPinnableBase::onControllerMenusChanged();
}
void InventoryWindow::adjustPanes()
diff --git a/apps/openmw/mwgui/inventorywindow.hpp b/apps/openmw/mwgui/inventorywindow.hpp
index b46092d..e0283fb 100644
--- a/apps/openmw/mwgui/inventorywindow.hpp
+++ b/apps/openmw/mwgui/inventorywindow.hpp
@@ -81,6 +81,7 @@ namespace MWGui
void onTitleDoubleClicked() override;
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
void setActiveControllerWindow(bool active) override;
+ void onControllerMenusChanged() override;
void setInventoryPage(bool shown) override;
bool stepTab(int delta) override;
diff --git a/apps/openmw/mwgui/itemwidget.cpp b/apps/openmw/mwgui/itemwidget.cpp
index ea877e5..5349836 100644
--- a/apps/openmw/mwgui/itemwidget.cpp
+++ b/apps/openmw/mwgui/itemwidget.cpp
@@ -83,12 +83,9 @@ namespace MWGui
assignWidget(mText, "Text");
if (mText)
mText->setNeedMouseFocus(false);
- if (Settings::gui().mControllerMenus)
- {
- assignWidget(mControllerBorder, "ControllerBorder");
- if (mControllerBorder)
- mControllerBorder->setNeedMouseFocus(false);
- }
+ assignWidget(mControllerBorder, "ControllerBorder");
+ if (mControllerBorder)
+ mControllerBorder->setNeedMouseFocus(false);
Base::initialiseOverride();
}
diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp
index e4fa4fb..6356c97 100644
--- a/apps/openmw/mwgui/levelupdialog.cpp
+++ b/apps/openmw/mwgui/levelupdialog.cpp
@@ -3,6 +3,7 @@
#include <MyGUI_Button.h>
#include <MyGUI_EditBox.h>
#include <MyGUI_ImageBox.h>
+#include <MyGUI_LanguageManager.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_TextBox.h>
#include <MyGUI_UString.h>
@@ -91,14 +92,10 @@ namespace MWGui
mCoins.push_back(image);
}
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.mA = "#{Interface:Select}";
- mControllerButtons.mX = "#{Interface:Done}";
- mOkButton->setCaption(
- MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
- }
+ mDisableGamepadCursor = true;
+ mControllerButtons.mA = "#{Interface:Select}";
+ mControllerButtons.mX = "#{Interface:Done}";
+ onControllerMenusChanged();
center();
}
@@ -168,6 +165,14 @@ namespace MWGui
setAttributeValues();
}
+ void LevelupDialog::onControllerMenusChanged()
+ {
+ mOkButton->setCaption(Settings::gui().mControllerMenus
+ ? MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {}))
+ : MyGUI::LanguageManager::getInstance().replaceTags("#{Interface:OK}"));
+ WindowBase::onControllerMenusChanged();
+ }
+
void LevelupDialog::onOpen()
{
MWBase::World* world = MWBase::Environment::get().getWorld();
diff --git a/apps/openmw/mwgui/levelupdialog.hpp b/apps/openmw/mwgui/levelupdialog.hpp
index 5176d18..ea31d5c 100644
--- a/apps/openmw/mwgui/levelupdialog.hpp
+++ b/apps/openmw/mwgui/levelupdialog.hpp
@@ -14,6 +14,7 @@ namespace MWGui
LevelupDialog();
void onOpen() override;
+ void onControllerMenusChanged() override;
std::string_view getWindowIdForLua() const override { return "LevelUpDialog"; }
diff --git a/apps/openmw/mwgui/mainmenu.cpp b/apps/openmw/mwgui/mainmenu.cpp
index 9d4568c..78ec5ea 100644
--- a/apps/openmw/mwgui/mainmenu.cpp
+++ b/apps/openmw/mwgui/mainmenu.cpp
@@ -108,7 +108,7 @@ namespace MWGui
constexpr VFS::Path::NormalizedView menuBackgroundVideo("video/menu_background.bik");
mHasAnimatedMenu = mVFS->exists(menuBackgroundVideo);
- mDisableGamepadCursor = Settings::gui().mControllerMenus;
+ mDisableGamepadCursor = true;
updateMenu();
}
diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp
index fc1ec12..9e50941 100644
--- a/apps/openmw/mwgui/mapwindow.cpp
+++ b/apps/openmw/mwgui/mapwindow.cpp
@@ -891,7 +891,7 @@ namespace MWGui
mEditNoteDialog.eventOkClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditOk);
mEditNoteDialog.eventDeleteClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditDelete);
- mBigMarkers = Settings::gui().mControllerMenus;
+ mBigMarkers = Settings::gui().mControllerMenus; // (onControllerMenusChanged)
setCoord(500, 0, 320, 300);
getWidget(mLocalMap, "LocalMap");
@@ -940,14 +940,11 @@ namespace MWGui
mGlobalMap->setVisible(global);
mLocalMap->setVisible(!global);
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.mB = "#{Interface:Back}";
- mControllerButtons.mX = global ? "#{Interface:Local}" : "#{Interface:World}";
- mControllerButtons.mY = "#{Interface:Center}";
- if (!Settings::map().mAllowZooming)
- mControllerButtons.mDpad = "#{Interface:Move}";
- }
+ mControllerButtons.mB = "#{Interface:Back}";
+ mControllerButtons.mX = global ? "#{Interface:Local}" : "#{Interface:World}";
+ mControllerButtons.mY = "#{Interface:Center}";
+ if (!Settings::map().mAllowZooming)
+ mControllerButtons.mDpad = "#{Interface:Move}";
}
void MapWindow::onNoteEditOk()
@@ -1401,6 +1398,15 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Map);
}
+ void MapWindow::onControllerMenusChanged()
+ {
+ // Bigger markers with a controller, so its pointer lands on them
+ mBigMarkers = Settings::gui().mControllerMenus;
+ if (mActiveCell != nullptr)
+ updateLocalMap();
+ WindowPinnableBase::onControllerMenusChanged();
+ }
+
void MapWindow::onOpen()
{
ensureGlobalMapLoaded();
@@ -1625,11 +1631,8 @@ namespace MWGui
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNoteDialog::onOkButtonClicked);
mDeleteButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNoteDialog::onDeleteButtonClicked);
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.mA = "#{Interface:OK}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- }
+ mControllerButtons.mA = "#{Interface:OK}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
}
void EditNoteDialog::showDeleteButton(bool show)
diff --git a/apps/openmw/mwgui/mapwindow.hpp b/apps/openmw/mwgui/mapwindow.hpp
index 3219c22..b3ec47a 100644
--- a/apps/openmw/mwgui/mapwindow.hpp
+++ b/apps/openmw/mwgui/mapwindow.hpp
@@ -280,6 +280,7 @@ namespace MWGui
void ensureGlobalMapLoaded();
void onOpen() override;
+ void onControllerMenusChanged() override;
void onFrame(float dt) override;
diff --git a/apps/openmw/mwgui/merchantrepair.cpp b/apps/openmw/mwgui/merchantrepair.cpp
index 5f8f273..ea20dd2 100644
--- a/apps/openmw/mwgui/merchantrepair.cpp
+++ b/apps/openmw/mwgui/merchantrepair.cpp
@@ -32,12 +32,9 @@ namespace MWGui
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onOkButtonClick);
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.mA = "#{Interface:Repair}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- }
+ mDisableGamepadCursor = true;
+ mControllerButtons.mA = "#{Interface:Repair}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
}
void MerchantRepair::setPtr(const MWWorld::Ptr& actor)
diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp
index 5c48411..fd0d1e1 100644
--- a/apps/openmw/mwgui/quickkeysmenu.cpp
+++ b/apps/openmw/mwgui/quickkeysmenu.cpp
@@ -64,11 +64,8 @@ namespace MWGui
unassign(&mKey[i]);
}
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.mA = "#{Interface:Select}";
- mControllerButtons.mB = "#{Interface:OK}";
- }
+ mControllerButtons.mA = "#{Interface:Select}";
+ mControllerButtons.mB = "#{Interface:OK}";
}
void QuickKeysMenu::clear()
@@ -148,6 +145,14 @@ namespace MWGui
}
}
+ void QuickKeysMenu::onControllerMenusChanged()
+ {
+ // Its dialogs set themselves up for one menus or the other when they are made: they are made again
+ mAssignDialog.reset();
+ mMagicSelectionDialog.reset();
+ WindowBase::onControllerMenusChanged();
+ }
+
void QuickKeysMenu::onClose()
{
WindowBase::onClose();
@@ -919,11 +924,8 @@ namespace MWGui
mMagicList->setHighlightSelected(false);
mMagicList->eventSpellClicked += MyGUI::newDelegate(this, &MagicSelectionDialog::onModelIndexSelected);
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.mA = "#{Interface:Select}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- }
+ mControllerButtons.mA = "#{Interface:Select}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
center();
}
diff --git a/apps/openmw/mwgui/quickkeysmenu.hpp b/apps/openmw/mwgui/quickkeysmenu.hpp
index be6470c..ec425aa 100644
--- a/apps/openmw/mwgui/quickkeysmenu.hpp
+++ b/apps/openmw/mwgui/quickkeysmenu.hpp
@@ -40,6 +40,7 @@ namespace MWGui
void onAssignMagicCancel();
void onOpen() override;
void onClose() override;
+ void onControllerMenusChanged() override;
void activateQuickKey(int index);
/// Isowind: uses the next (1) or previous (-1) key that holds something, counting from the current one
diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp
index ce25d21..da4e3e6 100644
--- a/apps/openmw/mwgui/savegamedialog.cpp
+++ b/apps/openmw/mwgui/savegamedialog.cpp
@@ -63,11 +63,8 @@ namespace MWGui
mSaveList->eventKeyButtonPressed += MyGUI::newDelegate(this, &SaveGameDialog::onKeyButtonPressed);
mSaveNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &SaveGameDialog::onEditSelectAccept);
mSaveNameEdit->eventEditTextChange += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameChanged);
- if (Settings::gui().mControllerMenus)
- {
- mSaveNameEdit->eventKeySetFocus += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameFocus);
- mSaveNameEdit->eventKeyLostFocus += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameFocusLost);
- }
+ mSaveNameEdit->eventKeySetFocus += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameFocus);
+ mSaveNameEdit->eventKeyLostFocus += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameFocusLost);
// To avoid accidental deletions
mDeleteButton->setNeedKeyFocus(false);
@@ -534,7 +531,9 @@ namespace MWGui
void SaveGameDialog::onSaveNameFocus(MyGUI::Widget* /*sender*/, MyGUI::Widget* /*other*/)
{
- setTextFieldSelected(mSaveNameEdit, true);
+ // (Lit for the controller)
+ if (Settings::gui().mControllerMenus)
+ setTextFieldSelected(mSaveNameEdit, true);
}
void SaveGameDialog::onSaveNameFocusLost(MyGUI::Widget* /*sender*/, MyGUI::Widget* /*other*/)
diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp
index 99308ac..15382b0 100644
--- a/apps/openmw/mwgui/spellbuyingwindow.cpp
+++ b/apps/openmw/mwgui/spellbuyingwindow.cpp
@@ -39,13 +39,10 @@ namespace MWGui
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onCancelButtonClicked);
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.mA = "#{Interface:Buy}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- mControllerButtons.mR3 = "#{Interface:Info}";
- }
+ mDisableGamepadCursor = true;
+ mControllerButtons.mA = "#{Interface:Buy}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
+ mControllerButtons.mR3 = "#{Interface:Info}";
}
bool SpellBuyingWindow::sortSpells(const ESM::Spell* left, const ESM::Spell* right)
diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp
index a1d16f2..45a731f 100644
--- a/apps/openmw/mwgui/spellcreationdialog.cpp
+++ b/apps/openmw/mwgui/spellcreationdialog.cpp
@@ -99,12 +99,9 @@ namespace MWGui
mDurationSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &EditEffectDialog::onDurationChanged);
mAreaSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &EditEffectDialog::onAreaChanged);
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.mA = "#{Interface:Select}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- mControllerButtons.mX = "#{Interface:OK}";
- }
+ mControllerButtons.mA = "#{Interface:Select}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
+ mControllerButtons.mX = "#{Interface:OK}";
}
void EditEffectDialog::setConstantEffect(bool constant)
diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp
index 6f4d163..0debcc0 100644
--- a/apps/openmw/mwgui/spellwindow.cpp
+++ b/apps/openmw/mwgui/spellwindow.cpp
@@ -66,13 +66,10 @@ namespace MWGui
// Isowind: the inventory screen's windows are pages, and only the map can be pinned
setPinButtonVisible(false);
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.mA = "#{Interface:Select}";
- mControllerButtons.mB = "#{Interface:Back}";
- mControllerButtons.mY = "#{sQuickMenuTitle}";
- mControllerButtons.mR3 = "#{Interface:Info}";
- }
+ mControllerButtons.mA = "#{Interface:Select}";
+ mControllerButtons.mB = "#{Interface:Back}";
+ mControllerButtons.mY = "#{sQuickMenuTitle}";
+ mControllerButtons.mR3 = "#{Interface:Info}";
}
void SpellWindow::onPinToggled()
diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp
index 7497592..dbeaa9b 100644
--- a/apps/openmw/mwgui/statswindow.cpp
+++ b/apps/openmw/mwgui/statswindow.cpp
@@ -84,12 +84,9 @@ namespace MWGui
// Isowind: the inventory screen's windows are pages, and only the map can be pinned
setPinButtonVisible(false);
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.mLStick = "#{Interface:Mouse}";
- mControllerButtons.mRStick = "#{Interface:ScrollDown}";
- mControllerButtons.mB = "#{Interface:Back}";
- }
+ mControllerButtons.mLStick = "#{Interface:Mouse}";
+ mControllerButtons.mRStick = "#{Interface:ScrollDown}";
+ mControllerButtons.mB = "#{Interface:Back}";
onWindowResize(t);
}
diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp
index 1bc1b2a..f01fe82 100644
--- a/apps/openmw/mwgui/tradewindow.cpp
+++ b/apps/openmw/mwgui/tradewindow.cpp
@@ -175,28 +175,31 @@ namespace MWGui
setCoord(400, 0, 400, 300);
- if (Settings::gui().mControllerMenus)
+ mControllerButtons.mA = "#{Interface:Buy}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
+ mControllerButtons.mX = "#{Interface:Offer}";
+ mControllerButtons.mR3 = "#{Interface:Info}";
+ mControllerButtons.mL2 = "#{Interface:Inventory}";
+ onControllerMenusChanged();
+ }
+
+ void TradeWindow::onControllerMenusChanged()
+ {
+ // With a controller, L1 and R1 next to the tabs
+ const bool controller = Settings::gui().mControllerMenus;
+ const std::pair<const char*, SDL_GameControllerButton> images[]
+ = { { "BtnL1Image", SDL_CONTROLLER_BUTTON_LEFTSHOULDER },
+ { "BtnR1Image", SDL_CONTROLLER_BUTTON_RIGHTSHOULDER } };
+ for (const auto& [name, button] : images)
{
- // Show L1 and R1 buttons next to tabs
MyGUI::ImageBox* image;
- getWidget(image, "BtnL1Image");
- image->setVisible(true);
- image->setUserString("Hidden", "false");
- image->setImageTexture(MWBase::Environment::get().getInputManager()->getControllerButtonIcon(
- SDL_CONTROLLER_BUTTON_LEFTSHOULDER));
-
- getWidget(image, "BtnR1Image");
- image->setVisible(true);
- image->setUserString("Hidden", "false");
- image->setImageTexture(MWBase::Environment::get().getInputManager()->getControllerButtonIcon(
- SDL_CONTROLLER_BUTTON_RIGHTSHOULDER));
-
- mControllerButtons.mA = "#{Interface:Buy}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- mControllerButtons.mX = "#{Interface:Offer}";
- mControllerButtons.mR3 = "#{Interface:Info}";
- mControllerButtons.mL2 = "#{Interface:Inventory}";
+ getWidget(image, name);
+ image->setVisible(controller);
+ image->setUserString("Hidden", controller ? "false" : "true");
+ if (controller)
+ image->setImageTexture(MWBase::Environment::get().getInputManager()->getControllerButtonIcon(button));
}
+ WindowBase::onControllerMenusChanged();
}
void TradeWindow::setPtr(const MWWorld::Ptr& actor)
diff --git a/apps/openmw/mwgui/tradewindow.hpp b/apps/openmw/mwgui/tradewindow.hpp
index 0e1d108..29fc24c 100644
--- a/apps/openmw/mwgui/tradewindow.hpp
+++ b/apps/openmw/mwgui/tradewindow.hpp
@@ -48,6 +48,7 @@ namespace MWGui
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
void setActiveControllerWindow(bool active) override;
+ void onControllerMenusChanged() override;
bool stepTab(int delta) override;
private:
diff --git a/apps/openmw/mwgui/trainingwindow.cpp b/apps/openmw/mwgui/trainingwindow.cpp
index 95f1990..afcc81c 100644
--- a/apps/openmw/mwgui/trainingwindow.cpp
+++ b/apps/openmw/mwgui/trainingwindow.cpp
@@ -40,12 +40,9 @@ namespace MWGui
mTimeAdvancer.eventProgressChanged += MyGUI::newDelegate(this, &TrainingWindow::onTrainingProgressChanged);
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &TrainingWindow::onTrainingFinished);
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.mA = "#{Interface:Buy}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- }
+ mDisableGamepadCursor = true;
+ mControllerButtons.mA = "#{Interface:Buy}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
}
void TrainingWindow::onOpen()
diff --git a/apps/openmw/mwgui/travelwindow.cpp b/apps/openmw/mwgui/travelwindow.cpp
index 3e73856..d07ea61 100644
--- a/apps/openmw/mwgui/travelwindow.cpp
+++ b/apps/openmw/mwgui/travelwindow.cpp
@@ -41,12 +41,9 @@ namespace MWGui
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onCancelButtonClicked);
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.mA = "#{Interface:Travel}";
- mControllerButtons.mB = "#{Interface:Cancel}";
- }
+ mDisableGamepadCursor = true;
+ mControllerButtons.mA = "#{Interface:Travel}";
+ mControllerButtons.mB = "#{Interface:Cancel}";
}
void TravelWindow::addDestination(const ESM::RefId& name, const ESM::Position& pos, bool interior)
diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp
index 6ca7455..813067f 100644
--- a/apps/openmw/mwgui/waitdialog.cpp
+++ b/apps/openmw/mwgui/waitdialog.cpp
@@ -84,7 +84,7 @@ namespace MWGui
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &WaitDialog::onWaitingFinished);
mControllerButtons.mB = "#{Interface:Cancel}";
- mDisableGamepadCursor = Settings::gui().mControllerMenus;
+ mDisableGamepadCursor = true;
}
void WaitDialog::setPtr(const MWWorld::Ptr& ptr)
diff --git a/apps/openmw/mwgui/windowbase.cpp b/apps/openmw/mwgui/windowbase.cpp
index cab8cbe..151f203 100644
--- a/apps/openmw/mwgui/windowbase.cpp
+++ b/apps/openmw/mwgui/windowbase.cpp
@@ -35,6 +35,22 @@ void WindowBase::setActiveControllerWindow(bool active)
}
}
+bool WindowBase::isGamepadCursorAllowed() const
+{
+ return !(mDisableGamepadCursor && Settings::gui().mControllerMenus);
+}
+
+void WindowBase::onControllerMenusChanged()
+{
+ // Back from the menus made for a controller: no window stays dimmed (setActiveControllerWindow)
+ if (!Settings::gui().mControllerMenus && mMainWidget)
+ {
+ mMainWidget->setAlpha(1.f);
+ if (NoDrop* noDrop = dynamic_cast<NoDrop*>(this))
+ noDrop->setRestAlpha(1.f);
+ }
+}
+
size_t MWGui::wrap(size_t index, size_t max, int delta)
{
if (max == 0)
diff --git a/apps/openmw/mwgui/windowbase.hpp b/apps/openmw/mwgui/windowbase.hpp
index 772000b..53f3de7 100644
--- a/apps/openmw/mwgui/windowbase.hpp
+++ b/apps/openmw/mwgui/windowbase.hpp
@@ -93,7 +93,12 @@ namespace MWGui
virtual ControllerButtons* getControllerButtons() { return &mControllerButtons; }
MyGUI::Widget* getControllerScrollWidget() { return mControllerScrollWidget; }
- bool isGamepadCursorAllowed() { return !mDisableGamepadCursor; }
+ /// mDisableGamepadCursor holds only in the menus made for a controller
+ bool isGamepadCursorAllowed() const;
+ /// Isowind: the menus have switched between those made for a controller and the mouse's (the game picks by
+ /// what is used; never while this window is open, but for the main menu). What a window sets up differently
+ /// for each when it is made, it sets up again here.
+ virtual void onControllerMenusChanged();
/// Isowind: whether A goes to onControllerButtonEvent even while the pointer is shown (otherwise it is a click)
virtual bool handlesPointerSelect() const { return false; }
virtual bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) { return true; }
@@ -118,6 +123,7 @@ namespace MWGui
ControllerButtons mControllerButtons;
bool mActiveControllerWindow = false;
+ /// No pointer for the left stick in this window, in the menus made for a controller (it is worked with the D-pad)
bool mDisableGamepadCursor = false;
MyGUI::Widget* mControllerScrollWidget = nullptr;
diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp
index 145d384..3ada2d9 100644
--- a/apps/openmw/mwgui/windowmanagerimp.cpp
+++ b/apps/openmw/mwgui/windowmanagerimp.cpp
@@ -23,6 +23,7 @@
#include <LinearMath/btQuickprof.h>
#include <SDL_clipboard.h>
+#include <SDL_gamecontroller.h>
#include <SDL_keyboard.h>
#include <components/debug/debuglog.hpp>
@@ -194,6 +195,14 @@ namespace MWGui
, mWindowVisible(true)
, mCfgMgr(cfgMgr)
{
+ // Isowind: the menus made for a controller or the mouse's, as what is used picks (onInputDeviceUsed). To begin
+ // with, those of the last time, if a controller is connected; before any window is made, as they make
+ // themselves for one or the other.
+ bool controllerConnected = false;
+ for (int i = 0; i < SDL_NumJoysticks(); ++i)
+ controllerConnected = controllerConnected || SDL_IsGameController(i);
+ Settings::gui().mControllerMenus.set(Settings::gui().mControllerMenus.get() && controllerConnected);
+
int w, h;
SDL_GetWindowSize(window, &w, &h);
int dw, dh;
@@ -1493,6 +1502,10 @@ namespace MWGui
if (mode == GM_Inventory && mAllowed == GW_None)
return;
+ // The first menu to open opens as made for what was used last
+ if (mGuiModes.empty())
+ applyWantedControllerMenus();
+
if (mGuiModes.empty() || mGuiModes.back() != mode)
{
// If this mode already exists somewhere in the stack, just bring it to the front.
@@ -1611,6 +1624,50 @@ namespace MWGui
}
else
reapplyActiveControllerWindow();
+
+ // The last menu closed: what was used meanwhile picks the menus now
+ if (mGuiModes.empty())
+ applyWantedControllerMenus();
+ }
+
+ void WindowManager::onInputDeviceUsed(bool controller)
+ {
+ mWantedControllerMenus = controller;
+ // Never in the middle of a menu (it was laid out for the other), but for the main menu: a column of buttons,
+ // fine either way
+ if (mGuiModes.empty() || (mGuiModes.size() == 1 && mGuiModes.back() == GM_MainMenu))
+ applyWantedControllerMenus();
+ }
+
+ void WindowManager::applyWantedControllerMenus()
+ {
+ if (!mWantedControllerMenus.has_value() || *mWantedControllerMenus == Settings::gui().mControllerMenus.get())
+ return;
+ const bool controller = *mWantedControllerMenus;
+ Settings::gui().mControllerMenus.set(controller);
+ Log(Debug::Info) << "Menus made for " << (controller ? "a controller" : "the mouse and keyboard");
+
+ for (const auto& window : mWindows)
+ window->onControllerMenusChanged();
+
+ mControllerTooltipEnabled = Settings::gui().mControllerTooltips;
+ mControllerTooltipVisible = false;
+ if (controller)
+ {
+ // The main menu, if it is open, is worked with the D-pad: no pointer
+ if (isGuiMode())
+ setCursorVisible(false);
+ reapplyActiveControllerWindow();
+ updateControllerButtonsOverlay();
+ }
+ else
+ {
+ if (mControllerButtonsOverlay)
+ mControllerButtonsOverlay->setVisible(false);
+ updateInventoryTabs();
+ if (isGuiMode())
+ setCursorVisible(true);
+ }
}
void WindowManager::removeGuiMode(GuiMode mode)
diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp
index cb84b03..4dfa6b3 100644
--- a/apps/openmw/mwgui/windowmanagerimp.hpp
+++ b/apps/openmw/mwgui/windowmanagerimp.hpp
@@ -8,6 +8,7 @@
**/
#include <memory>
+#include <optional>
#include <vector>
#include <osg/ref_ptr>
@@ -335,6 +336,7 @@ namespace MWGui
/// Call when mouse cursor or buttons are used.
void setCursorActive(bool active) override;
+ void onInputDeviceUsed(bool controller) override;
/// Clear all savegame-specific data
void clear() override;
@@ -508,6 +510,9 @@ namespace MWGui
bool mHudEnabled;
bool mCursorVisible;
bool mCursorActive;
+ /// Isowind: the menus to switch to (made for a controller, or the mouse's) when it can be done
+ std::optional<bool> mWantedControllerMenus;
+ void applyWantedControllerMenus();
int mPlayerBounty;
diff --git a/apps/openmw/mwinput/controllermanager.cpp b/apps/openmw/mwinput/controllermanager.cpp
index c4912b6..db52d78 100644
--- a/apps/openmw/mwinput/controllermanager.cpp
+++ b/apps/openmw/mwinput/controllermanager.cpp
@@ -151,6 +151,10 @@ namespace MWInput
// Isowind: another button pressed stops a D-pad direction repeating
mGuiRepeatButton = SDL_CONTROLLER_BUTTON_INVALID;
useController(arg.which);
+ // Isowind: the menus become the ones made for a controller (when they can: see WindowManager)
+ if (!Settings::gui().mControllerMenus)
+ Log(Debug::Verbose) << "Controller used: button " << static_cast<int>(arg.button);
+ MWBase::Environment::get().getWindowManager()->onInputDeviceUsed(true);
if (!Settings::input().mEnableController || mBindingsManager->isDetectingBindingState())
return;
@@ -249,7 +253,12 @@ namespace MWInput
void ControllerManager::axisMoved(int deviceID, const SDL_ControllerAxisEvent& arg)
{
if (std::abs(arg.value) > sControllerUsedAxisValue)
+ {
useController(arg.which);
+ if (!Settings::gui().mControllerMenus)
+ Log(Debug::Verbose) << "Controller used: axis " << static_cast<int>(arg.axis) << " at " << arg.value;
+ MWBase::Environment::get().getWindowManager()->onInputDeviceUsed(true);
+ }
if (mBindingsManager->isDetectingBindingState())
{
diff --git a/apps/openmw/mwinput/mousemanager.cpp b/apps/openmw/mwinput/mousemanager.cpp
index 1150380..7ae00d0 100644
--- a/apps/openmw/mwinput/mousemanager.cpp
+++ b/apps/openmw/mwinput/mousemanager.cpp
@@ -4,6 +4,7 @@
#include <MyGUI_InputManager.h>
#include <MyGUI_RenderManager.h>
+#include <components/debug/debuglog.hpp>
#include <components/sdlutil/sdlinputwrapper.hpp>
#include <components/sdlutil/sdlmappings.hpp>
#include <components/settings/values.hpp>
@@ -81,6 +82,14 @@ namespace MWInput
input->setJoystickLastUsed(false);
input->resetIdleTime();
+ // Isowind: the menus become the mouse's (when they can: see WindowManager); not for a stray pixel of motion
+ // the window system sends by itself
+ if (std::abs(arg.xrel) > 1 || std::abs(arg.yrel) > 1)
+ {
+ if (Settings::gui().mControllerMenus)
+ Log(Debug::Verbose) << "Mouse used: moved " << arg.xrel << ", " << arg.yrel;
+ winMgr->onInputDeviceUsed(false);
+ }
if (mGuiCursorEnabled)
{
@@ -176,6 +185,7 @@ namespace MWInput
}
input->setJoystickLastUsed(false);
+ MWBase::Environment::get().getWindowManager()->onInputDeviceUsed(false);
MWBase::Environment::get().getLuaManager()->inputEvent({ MWBase::LuaManager::InputEvent::MouseWheel,
MWBase::LuaManager::InputEvent::WheelChange{ arg.x, arg.y } });
}
@@ -184,6 +194,7 @@ namespace MWInput
{
MWBase::InputManager* input = MWBase::Environment::get().getInputManager();
input->setJoystickLastUsed(false);
+ MWBase::Environment::get().getWindowManager()->onInputDeviceUsed(false);
bool guiMode = false;
if (id == SDL_BUTTON_LEFT || id == SDL_BUTTON_RIGHT) // MyGUI only uses these mouse events
diff --git a/isowind/linux/isowind-launcher.py b/isowind/linux/isowind-launcher.py
index 7881595..b19c823 100755
--- a/isowind/linux/isowind-launcher.py
+++ b/isowind/linux/isowind-launcher.py
@@ -4,7 +4,6 @@ isowind.sh gui opens it, as does isowind.sh started from a file manager. Playing
beside it (it sets Morrowind up the first time and builds the pixel art textures); hosting writes the server's
settings and starts the server, as Isowind.exe's "Host a server" does."""
-import glob
import os
import re
import shutil
@@ -62,10 +61,6 @@ def morrowind_configured():
return False
-def controller_plugged_in():
- return bool(glob.glob('/dev/input/js*'))
-
-
# "host", "host:port": the address and port to connect to, or None if it doesn't look like one (Isowind.cs)
def parse_server_address(text):
text = (text or '').strip()
@@ -284,7 +279,7 @@ def centre(window, width, height):
class Launcher(tk.Tk, Styled):
- WIDTH, HEIGHT = 460, 558 # Isowind.exe's 460 x 530, plus the controller line in the Look panel
+ WIDTH, HEIGHT = 460, 532
def __init__(self):
tk.Tk.__init__(self)
@@ -300,26 +295,23 @@ class Launcher(tk.Tk, Styled):
pass
self.look = tk.StringVar(value='normal' if read_file(MODE_FILE) == 'normal' else 'pixelart')
- self.controller = tk.BooleanVar(value=controller_plugged_in())
self.address = tk.StringVar(value=read_file(ADDRESS_FILE))
self.status = tk.StringVar(value='')
self.label(self, 'ISOWIND', 0, 18, 460, 54, fg=GOLD, font=self.title_font, anchor='center')
self.label(self, 'Morrowind, seen from above', 0, 72, 460, 22, fg=DIM, anchor='center')
- look = self.panel(self, 30, 110, 400, 146)
+ look = self.panel(self, 30, 110, 400, 120)
self.label(look, 'Look', 14, 8, 300, 22, fg=GOLD)
self.pixel_art = self.radio(look, 'Pixel art - low resolution, retro textures and lighting', self.look,
'pixelart', 14, 36, 380, 26)
self.normal = self.radio(look, "Normal - Morrowind's usual graphics", self.look, 'normal', 14, 66, 380, 26)
- self.check(look, 'Controller - menus made for a controller rather than a mouse', self.controller,
- 14, 96, 380, 26)
- self.label(look, 'The top-down camera works in both. The zoom (or F7) in game switches camera.', 14, 122,
+ self.label(look, 'The top-down camera works in both. The zoom (or F7) in game switches camera.', 14, 96,
380, 18, fg=DIM, font=self.tiny_font)
- self.play = self.button(self, 'Play', 30, 272, 400, 52, self.on_play, font=self.play_font)
+ self.play = self.button(self, 'Play', 30, 246, 400, 52, self.on_play, font=self.play_font)
- multiplayer = self.panel(self, 30, 336, 400, 122)
+ multiplayer = self.panel(self, 30, 310, 400, 122)
self.label(multiplayer, 'Multiplayer', 14, 8, 300, 22, fg=GOLD)
self.label(multiplayer, 'Server address', 14, 38, 110, 22)
entry = self.entry(multiplayer, self.address, 126, 37, 160, 24)
@@ -329,16 +321,16 @@ class Launcher(tk.Tk, Styled):
self.label(multiplayer, f'Friends need UDP port {DEFAULT_PORT}\nforwarded to you, or a shared VPN', 162, 72,
230, 34, fg=DIM, font=self.tiny_font)
- self.morrowind = self.button(self, 'Morrowind folder (where Morrowind is installed)', 30, 470, 300, 34,
+ self.morrowind = self.button(self, 'Morrowind folder (where Morrowind is installed)', 30, 444, 300, 34,
self.on_morrowind_folder, font=self.small_font)
- self.button(self, 'Licenses', 340, 470, 90, 34, self.show_licenses, font=self.small_font)
+ self.button(self, 'Licenses', 340, 444, 90, 34, self.show_licenses, font=self.small_font)
style = ttk.Style(self)
style.theme_use('default')
style.configure('Isowind.Horizontal.TProgressbar', troughcolor=PANEL, background=GOLD, bordercolor=PANEL,
lightcolor=GOLD, darkcolor=GOLD)
self.progress = ttk.Progressbar(self, style='Isowind.Horizontal.TProgressbar', mode='indeterminate')
- self.label(self, '', 30, 528, 400, 22, fg=DIM, font=self.small_font).configure(textvariable=self.status)
+ self.label(self, '', 30, 502, 400, 22, fg=DIM, font=self.small_font).configure(textvariable=self.status)
if not os.path.exists(SERVER) or not os.path.isdir(SERVER_DIR):
self.host.configure(state='disabled')
@@ -357,7 +349,7 @@ class Launcher(tk.Tk, Styled):
folder = read_file(MORROWIND_FILE)
if folder:
env['MORROWIND'] = folder
- args = [SCRIPT] + arguments + [look, '--controller' if self.controller.get() else '--no-controller']
+ args = [SCRIPT] + arguments + [look]
try:
log = open(LOG, 'w', encoding='utf-8')
process = subprocess.Popen(args, stdout=log, stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL,
@@ -367,7 +359,7 @@ class Launcher(tk.Tk, Styled):
return
for widget in (self.play, self.join, self.host, self.pixel_art, self.normal, self.morrowind):
widget.configure(state='disabled')
- self.progress.place(x=30, y=512, width=400, height=12)
+ self.progress.place(x=30, y=486, width=400, height=12)
self.progress.start(12)
first = not morrowind_configured()
textures = look == 'pixelart' and not os.path.exists(os.path.join(ROOT, 'pixelart', 'textures',
diff --git a/isowind/linux/isowind.sh b/isowind/linux/isowind.sh
index a24ccef..5fe02ae 100755
--- a/isowind/linux/isowind.sh
+++ b/isowind/linux/isowind.sh
@@ -6,11 +6,10 @@
# ./isowind.sh join ADDRESS play on a server, e.g. ./isowind.sh join 203.0.113.7:25565 (look optional after it)
# ./isowind.sh host run a server here, in this terminal, after asking its settings (others join
# with this computer's address)
-# ./isowind.sh gui the launcher window (look, controller, join, host), like Isowind.exe; also what
+# ./isowind.sh gui the launcher window (look, join, host), like Isowind.exe; also what
# isowind.sh opens when started from a file manager
-# --controller, --no-controller menus made for a controller, or Morrowind's own, with any of the above; otherwise
-# whichever fits what is plugged in (a controller that comes with a stream, as
-# Moonlight's does, wants --controller)
+#
+# The menus are made for a controller while one is used, and Morrowind's own while the mouse is: the game picks.
#
# The first time, it finds Morrowind (Steam's usual places; otherwise run it as MORROWIND=/path/to/Morrowind
# ./isowind.sh, the folder with "Data Files" and Morrowind.ini) and sets up OpenMW for it, like OpenMW's wizard.
@@ -152,12 +151,6 @@ play() {
echo "$LOOK" > "$LOOK_FILE"
setup_morrowind
[ "$LOOK" = pixelart ] && build_textures
- # Menus made for a controller when one is plugged in (or asked for with --controller), Morrowind's own (drag and
- # drop) otherwise
- if [ -z "$MENUS" ]; then
- if ls /dev/input/js* >/dev/null 2>&1; then MENUS=true; else MENUS=false; fi
- fi
- set_setting "$ROOT/profiles/$LOOK/settings.cfg" GUI "controller menus" "$MENUS"
# Xbox controllers through the kernel's driver, not SDL's own: SDL's skips one it can't open (a Bluetooth one,
# whose hidraw only root reads) when it has another with the same ids (Sunshine's virtual one, left after a stream)
export SDL_JOYSTICK_HIDAPI_XBOX=${SDL_JOYSTICK_HIDAPI_XBOX:-0}
@@ -171,13 +164,12 @@ launcher() {
exec python3 "$ROOT/isowind-launcher.py"
}
-# --controller / --no-controller, anywhere among the arguments (none of the others has spaces in it)
-MENUS=""
+# --controller / --no-controller, from before the game picked the menus by itself: taken and ignored (none of the
+# other arguments has spaces in it)
ARGS=""
for arg in "$@"; do
case $arg in
- --controller) MENUS=true ;;
- --no-controller) MENUS=false ;;
+ --controller | --no-controller) ;;
*) ARGS="$ARGS $arg" ;;
esac
done
diff --git a/isowind/mod/scripts/isowind/topdown.lua b/isowind/mod/scripts/isowind/topdown.lua
index fcf8bf4..7cd3676 100644
--- a/isowind/mod/scripts/isowind/topdown.lua
+++ b/isowind/mod/scripts/isowind/topdown.lua
@@ -32,7 +32,7 @@
-- onto the nearest hostile creature in front (X still uses what is nearest, not that creature); with no hostile one
-- there the ring and label stay on what X uses (friendly people, doors, containers and their locks), but the aim
-- never locks onto those. A lockpick or probe never locks on, and looks for doors and containers first.
--- The menus are the engine's controller menus ('controller menus' in the profile's settings.cfg): D-pad and A / B,
+-- The menus are the engine's controller menus while a controller is used (the engine switches): D-pad and A / B,
-- the bumpers switch the inventory screen's pages and the triggers the tabs inside a window, Y puts an item or spell
-- on a quick key, and X on a text field (moved onto with the D-pad) brings up a keyboard on the screen to type with;
-- it never comes up by itself. The inventory screen's map, inventory, magic and stats are pages, one at a time under a
diff --git a/isowind/profiles/normal/settings.cfg b/isowind/profiles/normal/settings.cfg
index 24c6e14..71b6d29 100644
--- a/isowind/profiles/normal/settings.cfg
+++ b/isowind/profiles/normal/settings.cfg
@@ -43,7 +43,7 @@ chain = HBAO,VAIO,godrays,DIVE,wetworld,tonemap,SMAA
scaling factor = 1.0
hud scaling factor = 1.5
# Item and spell info in the controller's menus without pressing the right stick in ('controller menus' itself
-# is set by isowind.sh / Isowind.exe each time, from whether a controller is plugged in or the --controller flag)
+# the game switches, by whether a controller or the mouse is used)
controller tooltips = true
[Terrain]
diff --git a/isowind/profiles/pixelart/settings.cfg b/isowind/profiles/pixelart/settings.cfg
index 4076aee..3182a65 100644
--- a/isowind/profiles/pixelart/settings.cfg
+++ b/isowind/profiles/pixelart/settings.cfg
@@ -57,7 +57,7 @@ chain = HBAO,VAIO,godrays,DIVE,wetworld,tonemap
scaling factor = 1.0
hud scaling factor = 1.5
# Item and spell info in the controller's menus without pressing the right stick in ('controller menus' itself
-# is set by isowind.sh / Isowind.exe each time, from whether a controller is plugged in or the --controller flag)
+# the game switches, by whether a controller or the mouse is used)
controller tooltips = true
[Terrain]