diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index 0e1ad9c6e..388dc4af9 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -180,6 +180,7 @@ namespace MWBase virtual void unsetSelectedWeapon() = 0; virtual void showCrosshair(bool show) = 0; + virtual bool getSubtitlesEnabled() = 0; virtual void disallowMouse() = 0; virtual void allowMouse() = 0; diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 4039136a1..2599ea0b2 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -85,6 +85,8 @@ namespace MWGui WindowBase("openmw_settings_window.layout", parWindowManager) { getWidget(mOkButton, "OkButton"); + getWidget(mSubtitlesButton, "SubtitlesButton"); + getWidget(mCrosshairButton, "CrosshairButton"); getWidget(mResolutionList, "ResolutionList"); getWidget(mMenuTransparencySlider, "MenuTransparencySlider"); getWidget(mToolTipDelaySlider, "ToolTipDelaySlider"); @@ -121,6 +123,8 @@ namespace MWGui getWidget(mUISensitivitySlider, "UISensitivitySlider"); getWidget(mCameraSensitivitySlider, "CameraSensitivitySlider"); + mSubtitlesButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled); + mCrosshairButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled); mInvertYButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked); mUnderwaterButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled); @@ -192,6 +196,9 @@ namespace MWGui int tooltip_delay = (mToolTipDelaySlider->getScrollRange()-1) * Settings::Manager::getFloat("tooltip delay", "GUI"); mToolTipDelaySlider->setScrollPosition(tooltip_delay); + mSubtitlesButton->setCaptionWithReplacing(Settings::Manager::getBool("subtitles", "GUI") ? "#{sOn}" : "#{sOff}"); + mCrosshairButton->setCaptionWithReplacing(Settings::Manager::getBool("crosshair", "HUD") ? "#{sOn}" : "#{sOff}"); + float fovVal = (Settings::Manager::getFloat("field of view", "General")-sFovMin)/(sFovMax-sFovMin); mFOVSlider->setScrollPosition(fovVal * (mFOVSlider->getScrollRange()-1)); MyGUI::TextBox* fovText; @@ -403,6 +410,10 @@ namespace MWGui Settings::Manager::setBool("debug", "Shadows", newState); else if (_sender == mInvertYButton) Settings::Manager::setBool("invert y axis", "Input", newState); + else if (_sender == mCrosshairButton) + Settings::Manager::setBool("crosshair", "HUD", newState); + else if (_sender == mSubtitlesButton) + Settings::Manager::setBool("subtitles", "GUI", newState); apply(); } diff --git a/apps/openmw/mwgui/settingswindow.hpp b/apps/openmw/mwgui/settingswindow.hpp index 159d52bdc..d1f35ed71 100644 --- a/apps/openmw/mwgui/settingswindow.hpp +++ b/apps/openmw/mwgui/settingswindow.hpp @@ -30,6 +30,8 @@ namespace MWGui MyGUI::ScrollBar* mMenuTransparencySlider; MyGUI::ScrollBar* mToolTipDelaySlider; + MyGUI::Button* mSubtitlesButton; + MyGUI::Button* mCrosshairButton; // graphics MyGUI::ListBox* mResolutionList; diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 091d31bfe..a3d20ac9e 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -84,6 +84,8 @@ WindowManager::WindowManager( , mFPS(0.0f) , mTriangleCount(0) , mBatchCount(0) + , mCrosshairEnabled(Settings::Manager::getBool ("crosshair", "HUD")) + , mSubtitlesEnabled(Settings::Manager::getBool ("subtitles", "GUI")) { // Set up the GUI system @@ -644,6 +646,10 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector { changeRes = true; } + else if (it->first == "HUD" && it->second == "crosshair") + mCrosshairEnabled = Settings::Manager::getBool ("crosshair", "HUD"); + else if (it->first == "GUI" && it->second == "subtitles") + mSubtitlesEnabled = Settings::Manager::getBool ("subtitles", "GUI"); } if (changeRes) @@ -857,10 +863,15 @@ void WindowManager::notifyInputActionBound () void WindowManager::showCrosshair (bool show) { - mHud->setCrosshairVisible (show); + mHud->setCrosshairVisible (show && mCrosshairEnabled); } void WindowManager::activateQuickKey (int index) { mQuickKeysMenu->activateQuickKey(index); } + +bool WindowManager::getSubtitlesEnabled () +{ + return mSubtitlesEnabled; +} diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 91e9d44b5..dd8a3b006 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -161,6 +161,7 @@ namespace MWGui virtual void unsetSelectedWeapon(); virtual void showCrosshair(bool show); + virtual bool getSubtitlesEnabled(); virtual void disallowMouse(); virtual void allowMouse(); @@ -220,6 +221,9 @@ namespace MWGui MyGUI::Widget* mInputBlocker; + bool mCrosshairEnabled; + bool mSubtitlesEnabled; + /// \todo get rid of this stuff. Move it to the respective UI element classes, if needed. // Various stats about player as needed by window manager ESM::Class mPlayerClass; diff --git a/apps/openmw/mwscript/soundextensions.cpp b/apps/openmw/mwscript/soundextensions.cpp index 6dc8f3919..35e66241e 100644 --- a/apps/openmw/mwscript/soundextensions.cpp +++ b/apps/openmw/mwscript/soundextensions.cpp @@ -10,6 +10,7 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/soundmanager.hpp" +#include "../mwbase/windowmanager.hpp" #include "interpretercontext.hpp" #include "ref.hpp" @@ -37,7 +38,9 @@ namespace MWScript runtime.pop(); MWBase::Environment::get().getSoundManager()->say (ptr, file); - context.messageBox (text); + + if (MWBase::Environment::get().getWindowManager ()->getSubtitlesEnabled()) + context.messageBox (text); } }; diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout index ad906d2a1..c8eae518f 100644 --- a/files/mygui/openmw_settings_window.layout +++ b/files/mygui/openmw_settings_window.layout @@ -41,6 +41,18 @@ + + + + + + + + + + + + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index effd9f3da..8fab98da2 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -29,7 +29,9 @@ vsync = false menu transparency = 0.84 # 0 - instantly, 1 - max. delay -tooltip delay = 0.2 +tooltip delay = 0 + +subtitles = false [General] # Camera field of view @@ -85,6 +87,8 @@ debug = false # 2: advanced FPS display (batches, triangles) fps = 0 +crosshair = true + [Objects] shaders = true