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++

Options: a frame around the control the controller is on; the pointer warp at the window's scale

Alan Saunders4798d7b48141
diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp
index b0b5eb9..718b832 100644
--- a/apps/openmw/mwgui/settingswindow.cpp
+++ b/apps/openmw/mwgui/settingswindow.cpp
@@ -232,6 +232,12 @@ namespace MWGui
void SettingsWindow::onFrame(float duration)
{
+ // Isowind: with a controller the control the pointer is on is framed, however the pointer got there
+ if (Settings::gui().mControllerMenus && MWBase::Environment::get().getInputManager()->joystickLastUsed())
+ frameControl(controlUnderPointer(collectControls()));
+ else if (mControllerFrame)
+ frameControl(nullptr);
+
if (mScriptView->getVisible())
{
const auto scriptsSize = mScriptAdapter->getSize();
@@ -816,6 +822,7 @@ namespace MWGui
void SettingsWindow::updateControlsBox()
{
+ frameControl(nullptr); // (it may be among the rows about to go)
while (mControlsBox->getChildCount())
MyGUI::Gui::getInstance().destroyWidget(mControlsBox->getChildAt(0));
@@ -1089,6 +1096,7 @@ namespace MWGui
void SettingsWindow::onClose()
{
+ frameControl(nullptr);
// Save user settings
Settings::Manager::saveUser(mCfgMgr.getUserConfigPath() / "settings.cfg");
MWBase::Environment::get().getLuaManager()->savePermanentStorage(mCfgMgr.getUserConfigPath());
@@ -1309,6 +1317,33 @@ namespace MWGui
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
winMgr->setCursorVisible(true);
winMgr->setCursorActive(true);
+ frameControl(control);
+ }
+
+ // Morrowind's gold box frame around the control, drawn beside it in its own parent so it scrolls along
+ void SettingsWindow::frameControl(MyGUI::Widget* control)
+ {
+ constexpr int margin = 3;
+ if (control != mFramedControl || !control)
+ {
+ if (mControllerFrame)
+ {
+ MyGUI::Gui::getInstance().destroyWidget(mControllerFrame);
+ mControllerFrame = nullptr;
+ }
+ mFramedControl = control;
+ if (!control || !control->getParent())
+ return;
+ mControllerFrame = control->getParent()->createWidget<MyGUI::Widget>(
+ "MW_Box_Overlay", MyGUI::IntCoord(), MyGUI::Align::Default);
+ mControllerFrame->setNeedMouseFocus(false);
+ }
+ if (mControllerFrame)
+ {
+ MyGUI::IntCoord coord = control->getCoord();
+ mControllerFrame->setCoord(
+ coord.left - margin, coord.top - margin, coord.width + 2 * margin, coord.height + 2 * margin);
+ }
}
void SettingsWindow::pointAtFirstControl()
diff --git a/apps/openmw/mwgui/settingswindow.hpp b/apps/openmw/mwgui/settingswindow.hpp
index 7eefe52..d005b28 100644
--- a/apps/openmw/mwgui/settingswindow.hpp
+++ b/apps/openmw/mwgui/settingswindow.hpp
@@ -136,6 +136,10 @@ namespace MWGui
void stepControl(int delta);
void adjustControl(int delta);
void selectControl();
+ /// A frame around the control the pointer is on (nullptr: none)
+ void frameControl(MyGUI::Widget* control);
+ MyGUI::Widget* mControllerFrame = nullptr;
+ MyGUI::Widget* mFramedControl = nullptr;
private:
void resetScrollbars();
diff --git a/apps/openmw/mwinput/mousemanager.cpp b/apps/openmw/mwinput/mousemanager.cpp
index 677b611..9c0399a 100644
--- a/apps/openmw/mwinput/mousemanager.cpp
+++ b/apps/openmw/mwinput/mousemanager.cpp
@@ -283,7 +283,9 @@ namespace MWInput
void MouseManager::warpMouse()
{
- float guiUiScale = Settings::gui().mScalingFactor;
+ // Isowind: the scale the window reports (the setting times the drawable to window ratio), the same one
+ // mouseMoved divides by, or the warp lands off target where the compositor scales
+ float guiUiScale = MWBase::Environment::get().getWindowManager()->getScalingFactor();
mInputWrapper->warpMouse(
static_cast<int>(mGuiCursorX * guiUiScale), static_cast<int>(mGuiCursorY * guiUiScale));
}