Merge remote-tracking branch 'scrawl/master'

actorid
Marc Zinnschlag 11 years ago
commit 2c2106205d

@ -132,6 +132,7 @@ set(OENGINE_OGRE
set(OENGINE_GUI set(OENGINE_GUI
${LIBDIR}/openengine/gui/manager.cpp ${LIBDIR}/openengine/gui/manager.cpp
${LIBDIR}/openengine/gui/layout.hpp
) )
set(OENGINE_BULLET set(OENGINE_BULLET

@ -33,7 +33,7 @@ add_openmw_dir (mwgui
merchantrepair repair soulgemdialog companionwindow bookpage journalviewmodel journalbooks merchantrepair repair soulgemdialog companionwindow bookpage journalviewmodel journalbooks
keywordsearch itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview keywordsearch itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview
tradeitemmodel companionitemmodel pickpocketitemmodel fontloader controllers savegamedialog tradeitemmodel companionitemmodel pickpocketitemmodel fontloader controllers savegamedialog
recharge recharge mode videowidget
) )
add_openmw_dir (mwdialogue add_openmw_dir (mwdialogue

@ -339,6 +339,9 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
std::string aa = settings.getString("antialiasing", "Video"); std::string aa = settings.getString("antialiasing", "Video");
windowSettings.fsaa = (aa.substr(0, 4) == "MSAA") ? aa.substr(5, aa.size()-5) : "0"; windowSettings.fsaa = (aa.substr(0, 4) == "MSAA") ? aa.substr(5, aa.size()-5) : "0";
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS,
settings.getBool("minimize on focus loss", "Video") ? "1" : "0");
mOgre->createWindow("OpenMW", windowSettings); mOgre->createWindow("OpenMW", windowSettings);
Bsa::registerResources (mFileCollections, mArchives, true, mFSStrict); Bsa::registerResources (mFileCollections, mArchives, true, mFSStrict);
@ -356,6 +359,16 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
mCfgMgr.getCachePath ().string(), mScriptConsoleMode, mTranslationDataStorage, mEncoding); mCfgMgr.getCachePath ().string(), mScriptConsoleMode, mTranslationDataStorage, mEncoding);
mEnvironment.setWindowManager (window); mEnvironment.setWindowManager (window);
// Create sound system
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
if (!mSkipMenu)
{
std::string logo = mFallbackMap["Movies_Company_Logo"];
if (!logo.empty())
window->playVideo(logo, 1);
}
// Create the world // Create the world
mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mContentFiles, mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mContentFiles,
mResDir, mCfgMgr.getCachePath(), mEncoder, mFallbackMap, mResDir, mCfgMgr.getCachePath(), mEncoder, mFallbackMap,
@ -373,9 +386,6 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
Compiler::registerExtensions (mExtensions); Compiler::registerExtensions (mExtensions);
// Create sound system
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
// Create script system // Create script system
mScriptContext = new MWScript::CompilerContext (MWScript::CompilerContext::Type_Full); mScriptContext = new MWScript::CompilerContext (MWScript::CompilerContext::Type_Full);
mScriptContext->setExtensions (&mExtensions); mScriptContext->setExtensions (&mExtensions);
@ -434,7 +444,19 @@ void OMW::Engine::go()
// start in main menu // start in main menu
if (!mSkipMenu) if (!mSkipMenu)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu); MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
try
{
// Is there an ini setting for this filename or something?
MWBase::Environment::get().getSoundManager()->streamMusic("Special/morrowind title.mp3");
std::string logo = mFallbackMap["Movies_Morrowind_Logo"];
if (!logo.empty())
MWBase::Environment::get().getWindowManager()->playVideo(logo, true);
}
catch (...) {}
}
else else
MWBase::Environment::get().getStateManager()->newGame (true); MWBase::Environment::get().getStateManager()->newGame (true);

@ -25,7 +25,7 @@ namespace MWBase
virtual ~InputManager() {} virtual ~InputManager() {}
virtual void update(float dt, bool loading) = 0; virtual void update(float dt, bool disableControls, bool disableEvents=false) = 0;
virtual void changeInputMode(bool guiMode) = 0; virtual void changeInputMode(bool guiMode) = 0;

@ -156,7 +156,7 @@ namespace MWBase
/// paused we may want to do it manually (after equipping permanent enchantment) /// paused we may want to do it manually (after equipping permanent enchantment)
virtual void updateMagicEffects (const MWWorld::Ptr& ptr) = 0; virtual void updateMagicEffects (const MWWorld::Ptr& ptr) = 0;
virtual void toggleAI() = 0; virtual bool toggleAI() = 0;
virtual bool isAIActive() = 0; virtual bool isAIActive() = 0;
virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects) = 0; virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects) = 0;

@ -96,6 +96,10 @@ namespace MWBase
*/ */
virtual void update() = 0; virtual void update() = 0;
/// @note This method will block until the video finishes playing
/// (and will continually update the window while doing so)
virtual void playVideo(const std::string& name, bool allowSkipping) = 0;
virtual void setNewGame(bool newgame) = 0; virtual void setNewGame(bool newgame) = 0;
virtual void pushGuiMode (MWGui::GuiMode mode) = 0; virtual void pushGuiMode (MWGui::GuiMode mode) = 0;

@ -420,8 +420,6 @@ namespace MWBase
virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr) = 0; virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr) = 0;
/// \todo this does not belong here /// \todo this does not belong here
virtual void playVideo(const std::string& name, bool allowSkipping) = 0;
virtual void stopVideo() = 0;
virtual void frameStarted (float dt, bool paused) = 0; virtual void frameStarted (float dt, bool paused) = 0;
virtual void screenshot (Ogre::Image& image, int w, int h) = 0; virtual void screenshot (Ogre::Image& image, int w, int h) = 0;

@ -226,7 +226,7 @@ namespace MWGui
} }
mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE); mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE);
MWBase::Environment::get().getInputManager()->update(0, true); MWBase::Environment::get().getInputManager()->update(0, true, true);
// First, swap buffers from last draw, then, queue an update of the // First, swap buffers from last draw, then, queue an update of the
// window contents, but don't swap buffers (which would have // window contents, but don't swap buffers (which would have

@ -13,6 +13,7 @@
#include "../mwstate/character.hpp" #include "../mwstate/character.hpp"
#include "savegamedialog.hpp" #include "savegamedialog.hpp"
#include "confirmationdialog.hpp"
namespace MWGui namespace MWGui
{ {
@ -21,12 +22,13 @@ namespace MWGui
: OEngine::GUI::Layout("openmw_mainmenu.layout") : OEngine::GUI::Layout("openmw_mainmenu.layout")
, mButtonBox(0), mWidth (w), mHeight (h) , mButtonBox(0), mWidth (w), mHeight (h)
, mSaveGameDialog(NULL) , mSaveGameDialog(NULL)
, mBackground(NULL)
{ {
getWidget(mVersionText, "VersionText"); getWidget(mVersionText, "VersionText");
std::stringstream sstream; std::stringstream sstream;
sstream << "OpenMW version: " << OPENMW_VERSION; sstream << "OpenMW version: " << OPENMW_VERSION;
// adding info about git hash if availible // adding info about git hash if available
std::string rev = OPENMW_VERSION_COMMITHASH; std::string rev = OPENMW_VERSION_COMMITHASH;
std::string tag = OPENMW_VERSION_TAGHASH; std::string tag = OPENMW_VERSION_TAGHASH;
if (!rev.empty() && !tag.empty()) if (!rev.empty() && !tag.empty())
@ -58,10 +60,24 @@ namespace MWGui
{ {
if (visible) if (visible)
updateMenu(); updateMenu();
else
showBackground(
MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) &&
MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame);
OEngine::GUI::Layout::setVisible (visible); OEngine::GUI::Layout::setVisible (visible);
} }
void MainMenu::onNewGameConfirmed()
{
MWBase::Environment::get().getStateManager()->newGame();
}
void MainMenu::onExitConfirmed()
{
MWBase::Environment::get().getStateManager()->requestQuit();
}
void MainMenu::onButtonClicked(MyGUI::Widget *sender) void MainMenu::onButtonClicked(MyGUI::Widget *sender)
{ {
std::string name = *sender->getUserData<std::string>(); std::string name = *sender->getUserData<std::string>();
@ -73,11 +89,33 @@ namespace MWGui
} }
else if (name == "options") else if (name == "options")
MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings); MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings);
else if (name == "credits")
MWBase::Environment::get().getWindowManager()->playVideo("mw_credits.bik", true);
else if (name == "exitgame") else if (name == "exitgame")
MWBase::Environment::get().getStateManager()->requestQuit(); {
if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame)
onExitConfirmed();
else
{
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
dialog->open("#{sMessage2}");
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onExitConfirmed);
dialog->eventCancelClicked.clear();
}
}
else if (name == "newgame") else if (name == "newgame")
{ {
MWBase::Environment::get().getStateManager()->newGame(); if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame)
onNewGameConfirmed();
else
{
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
dialog->open("#{sNotifyMessage54}");
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onNewGameConfirmed);
dialog->eventCancelClicked.clear();
}
} }
else else
@ -92,11 +130,42 @@ namespace MWGui
} }
} }
void MainMenu::showBackground(bool show)
{
if (mBackground)
{
MyGUI::Gui::getInstance().destroyWidget(mBackground);
mBackground = NULL;
}
if (show)
{
if (!mBackground)
{
mBackground = MyGUI::Gui::getInstance().createWidgetReal<MyGUI::ImageBox>("ImageBox", 0,0,1,1,
MyGUI::Align::Stretch, "Menu");
mBackground->setImageTexture("black.png");
// Use black bars to correct aspect ratio. The video player also does it, so we need to do it
// for mw_logo.bik to align correctly with menu_morrowind.dds.
MyGUI::IntSize screenSize = MyGUI::RenderManager::getInstance().getViewSize();
// No way to un-hardcode this right now, menu_morrowind.dds is 1024x512 but was designed for 4:3
double imageaspect = 4.0/3.0;
int leftPadding = std::max(0.0, (screenSize.width - screenSize.height * imageaspect) / 2);
int topPadding = std::max(0.0, (screenSize.height - screenSize.width / imageaspect) / 2);
MyGUI::ImageBox* image = mBackground->createWidget<MyGUI::ImageBox>("ImageBox",
leftPadding, topPadding, screenSize.width - leftPadding*2, screenSize.height - topPadding*2, MyGUI::Align::Default);
image->setImageTexture("textures\\menu_morrowind.dds");
}
}
}
void MainMenu::updateMenu() void MainMenu::updateMenu()
{ {
setCoord(0,0, mWidth, mHeight); setCoord(0,0, mWidth, mHeight);
if (!mButtonBox) if (!mButtonBox)
mButtonBox = mMainWidget->createWidget<MyGUI::Widget>("", MyGUI::IntCoord(0, 0, 0, 0), MyGUI::Align::Default); mButtonBox = mMainWidget->createWidget<MyGUI::Widget>("", MyGUI::IntCoord(0, 0, 0, 0), MyGUI::Align::Default);
@ -104,6 +173,8 @@ namespace MWGui
MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState(); MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState();
showBackground(state == MWBase::StateManager::State_NoGame);
std::vector<std::string> buttons; std::vector<std::string> buttons;
if (state==MWBase::StateManager::State_Running) if (state==MWBase::StateManager::State_Running)
@ -120,7 +191,10 @@ namespace MWGui
buttons.push_back("savegame"); buttons.push_back("savegame");
buttons.push_back("options"); buttons.push_back("options");
//buttons.push_back("credits");
if (state==MWBase::StateManager::State_NoGame)
buttons.push_back("credits");
buttons.push_back("exitgame"); buttons.push_back("exitgame");
// Create new buttons if needed // Create new buttons if needed
@ -155,11 +229,26 @@ namespace MWGui
assert(mButtons.find(*it) != mButtons.end()); assert(mButtons.find(*it) != mButtons.end());
MWGui::ImageButton* button = mButtons[*it]; MWGui::ImageButton* button = mButtons[*it];
button->setVisible(true); button->setVisible(true);
MyGUI::IntSize requested = button->getRequestedSize(); MyGUI::IntSize requested = button->getRequestedSize();
button->setCoord((maxwidth-requested.width) / 2, curH, requested.width, requested.height);
curH += requested.height; // Trim off some of the excessive padding
// TODO: perhaps do this within ImageButton?
int trim = 8;
button->setImageCoord(MyGUI::IntCoord(0, trim, requested.width, requested.height-trim));
int height = requested.height-trim*2;
button->setImageTile(MyGUI::IntSize(requested.width, height));
button->setCoord((maxwidth-requested.width) / 2, curH, requested.width, height);
curH += height;
} }
if (state == MWBase::StateManager::State_NoGame)
{
// Align with the background image
int bottomPadding=48;
mButtonBox->setCoord (mWidth/2 - maxwidth/2, mHeight - curH - bottomPadding, maxwidth, curH);
}
else
mButtonBox->setCoord (mWidth/2 - maxwidth/2, mHeight/2 - curH/2, maxwidth, curH); mButtonBox->setCoord (mWidth/2 - maxwidth/2, mHeight/2 - curH/2, maxwidth, curH);
} }

@ -29,9 +29,15 @@ namespace MWGui
MyGUI::Widget* mButtonBox; MyGUI::Widget* mButtonBox;
MyGUI::TextBox* mVersionText; MyGUI::TextBox* mVersionText;
MyGUI::ImageBox* mBackground;
std::map<std::string, MWGui::ImageButton*> mButtons; std::map<std::string, MWGui::ImageButton*> mButtons;
void onButtonClicked (MyGUI::Widget* sender); void onButtonClicked (MyGUI::Widget* sender);
void onNewGameConfirmed();
void onExitConfirmed();
void showBackground(bool show);
void updateMenu(); void updateMenu();

@ -47,9 +47,7 @@ namespace MWGui
GM_Loading, GM_Loading,
GM_LoadingWallpaper, GM_LoadingWallpaper,
GM_QuickKeysMenu, GM_QuickKeysMenu
GM_Video
}; };
// Windows shown in inventory mode // Windows shown in inventory mode

@ -86,7 +86,21 @@ namespace MWGui
{ {
std::stringstream title; std::stringstream title;
title << it->getSignature().mPlayerName; title << it->getSignature().mPlayerName;
title << " (Level " << it->getSignature().mPlayerLevel << " " << it->getSignature().mPlayerClass << ")";
// For a custom class, we will not find it in the store (unless we loaded the savegame first).
// Fall back to name stored in savegame header in that case.
std::string className;
if (it->getSignature().mPlayerClassId.empty())
className = it->getSignature().mPlayerClassName;
else
{
// Find the localised name for this class from the store
const ESM::Class* class_ = MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(
it->getSignature().mPlayerClassId);
className = class_->mName;
}
title << " (Level " << it->getSignature().mPlayerLevel << " " << className << ")";
mCharacterSelection->addItem (title.str()); mCharacterSelection->addItem (title.str());
@ -169,7 +183,10 @@ namespace MWGui
else else
{ {
if (mCurrentCharacter && slot) if (mCurrentCharacter && slot)
{
MWBase::Environment::get().getStateManager()->loadGame (mCurrentCharacter, slot); MWBase::Environment::get().getStateManager()->loadGame (mCurrentCharacter, slot);
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_MainMenu);
}
} }
setVisible(false); setVisible(false);
@ -241,7 +258,13 @@ namespace MWGui
struct tm* timeinfo; struct tm* timeinfo;
timeinfo = localtime(&time); timeinfo = localtime(&time);
text << asctime(timeinfo) << "\n"; // Use system/environment locale settings for datetime formatting
std::setlocale(LC_TIME, "");
const int size=1024;
char buffer[size];
if (std::strftime(buffer, size, "%x %X", timeinfo) > 0)
text << buffer << "\n";
text << "Level " << slot->mProfile.mPlayerLevel << "\n"; text << "Level " << slot->mProfile.mPlayerLevel << "\n";
text << slot->mProfile.mPlayerCell << "\n"; text << slot->mProfile.mPlayerCell << "\n";
// text << "Time played: " << slot->mProfile.mTimePlayed << "\n"; // text << "Time played: " << slot->mProfile.mTimePlayed << "\n";

@ -83,91 +83,116 @@ namespace
} }
return false; return false;
} }
const char* checkButtonType = "CheckButton";
const char* sliderType = "Slider";
std::string getSettingType(MyGUI::Widget* widget)
{
return widget->getUserString("SettingType");
}
std::string getSettingName(MyGUI::Widget* widget)
{
return widget->getUserString("SettingName");
}
std::string getSettingCategory(MyGUI::Widget* widget)
{
return widget->getUserString("SettingCategory");
}
std::string getSettingValueType(MyGUI::Widget* widget)
{
return widget->getUserString("SettingValueType");
}
void getSettingMinMax(MyGUI::Widget* widget, float& min, float& max)
{
const char* settingMin = "SettingMin";
const char* settingMax = "SettingMax";
min = 0.f;
max = 1.f;
if (!widget->getUserString(settingMin).empty())
min = boost::lexical_cast<float>(widget->getUserString(settingMin));
if (!widget->getUserString(settingMax).empty())
max = boost::lexical_cast<float>(widget->getUserString(settingMax));
}
} }
namespace MWGui namespace MWGui
{ {
void SettingsWindow::configureWidgets(MyGUI::Widget* widget)
{
MyGUI::EnumeratorWidgetPtr widgets = widget->getEnumerator();
while (widgets.next())
{
MyGUI::Widget* current = widgets.current();
std::string type = getSettingType(current);
if (type == checkButtonType)
{
std::string initialValue = Settings::Manager::getBool(getSettingName(current),
getSettingCategory(current))
? "#{sOn}" : "#{sOff}";
current->castType<MyGUI::Button>()->setCaptionWithReplacing(initialValue);
current->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
}
if (type == sliderType)
{
MyGUI::ScrollBar* scroll = current->castType<MyGUI::ScrollBar>();
if (getSettingValueType(current) == "Float")
{
// TODO: ScrollBar isn't meant for this. should probably use a dedicated FloatSlider widget
float min,max;
getSettingMinMax(scroll, min, max);
float value = Settings::Manager::getFloat(getSettingName(current), getSettingCategory(current));
value = (value-min)/(max-min);
scroll->setScrollPosition( value * (scroll->getScrollRange()-1));
}
else
{
int value = Settings::Manager::getFloat(getSettingName(current), getSettingCategory(current));
scroll->setScrollPosition(value);
}
scroll->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
}
configureWidgets(current);
}
}
SettingsWindow::SettingsWindow() : SettingsWindow::SettingsWindow() :
WindowBase("openmw_settings_window.layout") WindowBase("openmw_settings_window.layout")
{ {
configureWidgets(mMainWidget);
getWidget(mOkButton, "OkButton"); getWidget(mOkButton, "OkButton");
getWidget(mBestAttackButton, "BestAttackButton");
getWidget(mGrabCursorButton, "GrabCursorButton");
getWidget(mSubtitlesButton, "SubtitlesButton");
getWidget(mCrosshairButton, "CrosshairButton");
getWidget(mResolutionList, "ResolutionList"); getWidget(mResolutionList, "ResolutionList");
getWidget(mMenuTransparencySlider, "MenuTransparencySlider");
getWidget(mToolTipDelaySlider, "ToolTipDelaySlider");
getWidget(mViewDistanceSlider, "ViewDistanceSlider");
getWidget(mFullscreenButton, "FullscreenButton"); getWidget(mFullscreenButton, "FullscreenButton");
getWidget(mVSyncButton, "VSyncButton"); getWidget(mVSyncButton, "VSyncButton");
getWidget(mFPSButton, "FPSButton"); getWidget(mFPSButton, "FPSButton");
getWidget(mFOVSlider, "FOVSlider"); getWidget(mFOVSlider, "FOVSlider");
getWidget(mMasterVolumeSlider, "MasterVolume");
getWidget(mVoiceVolumeSlider, "VoiceVolume");
getWidget(mEffectsVolumeSlider, "EffectsVolume");
getWidget(mFootstepsVolumeSlider, "FootstepsVolume");
getWidget(mMusicVolumeSlider, "MusicVolume");
getWidget(mAnisotropySlider, "AnisotropySlider"); getWidget(mAnisotropySlider, "AnisotropySlider");
getWidget(mTextureFilteringButton, "TextureFilteringButton"); getWidget(mTextureFilteringButton, "TextureFilteringButton");
getWidget(mAnisotropyLabel, "AnisotropyLabel"); getWidget(mAnisotropyLabel, "AnisotropyLabel");
getWidget(mAnisotropyBox, "AnisotropyBox"); getWidget(mAnisotropyBox, "AnisotropyBox");
getWidget(mWaterShaderButton, "WaterShaderButton");
getWidget(mReflectObjectsButton, "ReflectObjectsButton");
getWidget(mReflectActorsButton, "ReflectActorsButton");
getWidget(mReflectTerrainButton, "ReflectTerrainButton");
getWidget(mShadersButton, "ShadersButton"); getWidget(mShadersButton, "ShadersButton");
getWidget(mShaderModeButton, "ShaderModeButton"); getWidget(mShaderModeButton, "ShaderModeButton");
getWidget(mShadowsEnabledButton, "ShadowsEnabledButton"); getWidget(mShadowsEnabledButton, "ShadowsEnabledButton");
getWidget(mShadowsLargeDistance, "ShadowsLargeDistance");
getWidget(mShadowsTextureSize, "ShadowsTextureSize"); getWidget(mShadowsTextureSize, "ShadowsTextureSize");
getWidget(mActorShadows, "ActorShadows");
getWidget(mStaticsShadows, "StaticsShadows");
getWidget(mMiscShadows, "MiscShadows");
getWidget(mTerrainShadows, "TerrainShadows");
getWidget(mControlsBox, "ControlsBox"); getWidget(mControlsBox, "ControlsBox");
getWidget(mResetControlsButton, "ResetControlsButton"); getWidget(mResetControlsButton, "ResetControlsButton");
getWidget(mInvertYButton, "InvertYButton");
getWidget(mCameraSensitivitySlider, "CameraSensitivitySlider");
getWidget(mRefractionButton, "RefractionButton"); getWidget(mRefractionButton, "RefractionButton");
mSubtitlesButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mCrosshairButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mBestAttackButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mGrabCursorButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mInvertYButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked);
mShadersButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onShadersToggled);
mShaderModeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onShaderModeToggled); mShaderModeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onShaderModeToggled);
mFullscreenButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mWaterShaderButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mRefractionButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mReflectObjectsButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mReflectTerrainButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mReflectActorsButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mTextureFilteringButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureFilteringChanged); mTextureFilteringButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureFilteringChanged);
mVSyncButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mFPSButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onFpsToggled); mFPSButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onFpsToggled);
mMenuTransparencySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mFOVSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mToolTipDelaySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mViewDistanceSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected); mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected);
mAnisotropySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mShadowsEnabledButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mShadowsLargeDistance->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mShadowsTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onShadowTextureSizeChanged); mShadowsTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onShadowTextureSizeChanged);
mActorShadows->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mStaticsShadows->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mMiscShadows->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mTerrainShadows->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mMasterVolumeSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mVoiceVolumeSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mEffectsVolumeSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mFootstepsVolumeSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mMusicVolumeSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
center(); center();
@ -194,73 +219,25 @@ namespace MWGui
mResolutionList->addItem(str); mResolutionList->addItem(str);
} }
// read settings
int menu_transparency = (mMenuTransparencySlider->getScrollRange()-1) * Settings::Manager::getFloat("menu transparency", "GUI");
mMenuTransparencySlider->setScrollPosition(menu_transparency);
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}");
mBestAttackButton->setCaptionWithReplacing(Settings::Manager::getBool("best attack", "Game") ? "#{sOn}" : "#{sOff}");
mGrabCursorButton->setCaptionWithReplacing(Settings::Manager::getBool("grab cursor", "Input") ? "#{sOn}" : "#{sOff}");
float fovVal = (Settings::Manager::getFloat("field of view", "General")-sFovMin)/(sFovMax-sFovMin);
mFOVSlider->setScrollPosition(fovVal * (mFOVSlider->getScrollRange()-1));
MyGUI::TextBox* fovText;
getWidget(fovText, "FovText");
fovText->setCaption("Field of View (" + boost::lexical_cast<std::string>(int(Settings::Manager::getFloat("field of view", "General"))) + ")");
float anisotropyVal = Settings::Manager::getInt("anisotropy", "General") / 16.0;
mAnisotropySlider->setScrollPosition(anisotropyVal * (mAnisotropySlider->getScrollRange()-1));
std::string tf = Settings::Manager::getString("texture filtering", "General"); std::string tf = Settings::Manager::getString("texture filtering", "General");
mTextureFilteringButton->setCaption(textureFilteringToStr(tf)); mTextureFilteringButton->setCaption(textureFilteringToStr(tf));
mAnisotropyLabel->setCaption("Anisotropy (" + boost::lexical_cast<std::string>(Settings::Manager::getInt("anisotropy", "General")) + ")"); mAnisotropyLabel->setCaption("Anisotropy (" + boost::lexical_cast<std::string>(Settings::Manager::getInt("anisotropy", "General")) + ")");
float val = (Settings::Manager::getFloat("max viewing distance", "Viewing distance")-sViewDistMin)/(sViewDistMax-sViewDistMin);
int viewdist = (mViewDistanceSlider->getScrollRange()-1) * val;
mViewDistanceSlider->setScrollPosition(viewdist);
mMasterVolumeSlider->setScrollPosition(Settings::Manager::getFloat("master volume", "Sound") * (mMasterVolumeSlider->getScrollRange()-1));
mMusicVolumeSlider->setScrollPosition(Settings::Manager::getFloat("music volume", "Sound") * (mMusicVolumeSlider->getScrollRange()-1));
mEffectsVolumeSlider->setScrollPosition(Settings::Manager::getFloat("sfx volume", "Sound") * (mEffectsVolumeSlider->getScrollRange()-1));
mFootstepsVolumeSlider->setScrollPosition(Settings::Manager::getFloat("footsteps volume", "Sound") * (mFootstepsVolumeSlider->getScrollRange()-1));
mVoiceVolumeSlider->setScrollPosition(Settings::Manager::getFloat("voice volume", "Sound") * (mVoiceVolumeSlider->getScrollRange()-1));
mWaterShaderButton->setCaptionWithReplacing(Settings::Manager::getBool("shader", "Water") ? "#{sOn}" : "#{sOff}");
mReflectObjectsButton->setCaptionWithReplacing(Settings::Manager::getBool("reflect statics", "Water") ? "#{sOn}" : "#{sOff}");
mReflectActorsButton->setCaptionWithReplacing(Settings::Manager::getBool("reflect actors", "Water") ? "#{sOn}" : "#{sOff}");
mReflectTerrainButton->setCaptionWithReplacing(Settings::Manager::getBool("reflect terrain", "Water") ? "#{sOn}" : "#{sOff}");
mShadowsTextureSize->setCaption (Settings::Manager::getString ("texture size", "Shadows")); mShadowsTextureSize->setCaption (Settings::Manager::getString ("texture size", "Shadows"));
mShadowsLargeDistance->setCaptionWithReplacing(Settings::Manager::getBool("split", "Shadows") ? "#{sOn}" : "#{sOff}");
mShadowsEnabledButton->setCaptionWithReplacing(Settings::Manager::getBool("enabled", "Shadows") ? "#{sOn}" : "#{sOff}");
mActorShadows->setCaptionWithReplacing(Settings::Manager::getBool("actor shadows", "Shadows") ? "#{sOn}" : "#{sOff}");
mStaticsShadows->setCaptionWithReplacing(Settings::Manager::getBool("statics shadows", "Shadows") ? "#{sOn}" : "#{sOff}");
mMiscShadows->setCaptionWithReplacing(Settings::Manager::getBool("misc shadows", "Shadows") ? "#{sOn}" : "#{sOff}");
mTerrainShadows->setCaptionWithReplacing(Settings::Manager::getBool("terrain shadows", "Shadows") ? "#{sOn}" : "#{sOff}");
float cameraSens = (Settings::Manager::getFloat("camera sensitivity", "Input")-0.2)/(5.0-0.2);
mCameraSensitivitySlider->setScrollPosition (cameraSens * (mCameraSensitivitySlider->getScrollRange()-1));
mCameraSensitivitySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mInvertYButton->setCaptionWithReplacing(Settings::Manager::getBool("invert y axis", "Input") ? "#{sOn}" : "#{sOff}");
mShadersButton->setCaptionWithReplacing (Settings::Manager::getBool("shaders", "Objects") ? "#{sOn}" : "#{sOff}");
mShaderModeButton->setCaption (Settings::Manager::getString("shader mode", "General")); mShaderModeButton->setCaption (Settings::Manager::getString("shader mode", "General"));
mRefractionButton->setCaptionWithReplacing (Settings::Manager::getBool("refraction", "Water") ? "#{sOn}" : "#{sOff}");
if (!Settings::Manager::getBool("shaders", "Objects")) if (!Settings::Manager::getBool("shaders", "Objects"))
{ {
mRefractionButton->setEnabled(false); mRefractionButton->setEnabled(false);
mShadowsEnabledButton->setEnabled(false); mShadowsEnabledButton->setEnabled(false);
} }
mFullscreenButton->setCaptionWithReplacing(Settings::Manager::getBool("fullscreen", "Video") ? "#{sOn}" : "#{sOff}");
mVSyncButton->setCaptionWithReplacing(Settings::Manager::getBool("vsync", "Video") ? "#{sOn}": "#{sOff}");
mFPSButton->setCaptionWithReplacing(fpsLevelToStr(Settings::Manager::getInt("fps", "HUD"))); mFPSButton->setCaptionWithReplacing(fpsLevelToStr(Settings::Manager::getInt("fps", "HUD")));
MyGUI::TextBox* fovText;
getWidget(fovText, "FovText");
fovText->setCaption("Field of View (" + boost::lexical_cast<std::string>(int(Settings::Manager::getInt("field of view", "General"))) + ")");
} }
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender) void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
@ -320,6 +297,39 @@ namespace MWGui
newState = true; newState = true;
} }
if (_sender == mVSyncButton)
{
// Ogre::Window::setVSyncEnabled is bugged in 1.8
#if OGRE_VERSION < (1 << 16 | 9 << 8 | 0)
MWBase::Environment::get().getWindowManager()->
messageBox("VSync will be applied after a restart", std::vector<std::string>());
#endif
}
if (_sender == mShadersButton)
{
if (newState == false)
{
// refraction needs shaders to display underwater fog
mRefractionButton->setCaptionWithReplacing("#{sOff}");
mRefractionButton->setEnabled(false);
Settings::Manager::setBool("refraction", "Water", false);
// shadows not supported
mShadowsEnabledButton->setEnabled(false);
mShadowsEnabledButton->setCaptionWithReplacing("#{sOff}");
Settings::Manager::setBool("enabled", "Shadows", false);
}
else
{
// re-enable
mRefractionButton->setEnabled(true);
mShadowsEnabledButton->setEnabled(true);
}
}
if (_sender == mFullscreenButton) if (_sender == mFullscreenButton)
{ {
// check if this resolution is supported in fullscreen // check if this resolution is supported in fullscreen
@ -341,64 +351,15 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox(msg); messageBox(msg);
_sender->castType<MyGUI::Button>()->setCaption(off); _sender->castType<MyGUI::Button>()->setCaption(off);
return;
} }
else
{
Settings::Manager::setBool("fullscreen", "Video", newState);
apply();
}
}
else if (_sender == mVSyncButton)
{
Settings::Manager::setBool("vsync", "Video", newState);
// Ogre::Window::setVSyncEnabled is bugged in 1.8
#if OGRE_VERSION < (1 << 16 | 9 << 8 | 0)
MWBase::Environment::get().getWindowManager()->
messageBox("VSync will be applied after a restart", std::vector<std::string>());
#endif
apply();
} }
else
if (getSettingType(_sender) == checkButtonType)
{ {
if (_sender == mVSyncButton) Settings::Manager::setBool(getSettingName(_sender), getSettingCategory(_sender), newState);
Settings::Manager::setBool("vsync", "Video", newState);
if (_sender == mWaterShaderButton)
Settings::Manager::setBool("shader", "Water", newState);
else if (_sender == mRefractionButton)
Settings::Manager::setBool("refraction", "Water", newState);
else if (_sender == mReflectObjectsButton)
{
Settings::Manager::setBool("reflect misc", "Water", newState);
Settings::Manager::setBool("reflect statics", "Water", newState);
Settings::Manager::setBool("reflect statics small", "Water", newState);
}
else if (_sender == mReflectActorsButton)
Settings::Manager::setBool("reflect actors", "Water", newState);
else if (_sender == mReflectTerrainButton)
Settings::Manager::setBool("reflect terrain", "Water", newState);
else if (_sender == mShadowsEnabledButton)
Settings::Manager::setBool("enabled", "Shadows", newState);
else if (_sender == mShadowsLargeDistance)
Settings::Manager::setBool("split", "Shadows", newState);
else if (_sender == mActorShadows)
Settings::Manager::setBool("actor shadows", "Shadows", newState);
else if (_sender == mStaticsShadows)
Settings::Manager::setBool("statics shadows", "Shadows", newState);
else if (_sender == mMiscShadows)
Settings::Manager::setBool("misc shadows", "Shadows", newState);
else if (_sender == mTerrainShadows)
Settings::Manager::setBool("terrain shadows", "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);
else if (_sender == mBestAttackButton)
Settings::Manager::setBool("best attack", "Game", newState);
else if (_sender == mGrabCursorButton)
Settings::Manager::setBool("grab cursor", "Input", newState);
apply(); apply();
return;
} }
} }
@ -419,50 +380,6 @@ namespace MWGui
apply(); apply();
} }
void SettingsWindow::onShadersToggled(MyGUI::Widget* _sender)
{
std::string on = MWBase::Environment::get().getWindowManager()->getGameSettingString("sOn", "On");
std::string off = MWBase::Environment::get().getWindowManager()->getGameSettingString("sOff", "On");
std::string val = static_cast<MyGUI::Button*>(_sender)->getCaption();
if (val == off)
val = on;
else
val = off;
static_cast<MyGUI::Button*>(_sender)->setCaptionWithReplacing (val);
if (val == off)
{
Settings::Manager::setBool("shaders", "Objects", false);
// refraction needs shaders to display underwater fog
mRefractionButton->setCaptionWithReplacing("#{sOff}");
mRefractionButton->setEnabled(false);
Settings::Manager::setBool("refraction", "Water", false);
Settings::Manager::setBool("underwater effect", "Water", false);
// shadows not supported
mShadowsEnabledButton->setEnabled(false);
mShadowsEnabledButton->setCaptionWithReplacing("#{sOff}");
Settings::Manager::setBool("enabled", "Shadows", false);
}
else
{
Settings::Manager::setBool("shaders", "Objects", true);
// re-enable
mReflectObjectsButton->setEnabled(true);
mReflectActorsButton->setEnabled(true);
mReflectTerrainButton->setEnabled(true);
mRefractionButton->setEnabled(true);
mShadowsEnabledButton->setEnabled(true);
}
apply();
}
void SettingsWindow::onFpsToggled(MyGUI::Widget* _sender) void SettingsWindow::onFpsToggled(MyGUI::Widget* _sender)
{ {
int newLevel = (Settings::Manager::getInt("fps", "HUD") + 1) % 3; int newLevel = (Settings::Manager::getInt("fps", "HUD") + 1) % 3;
@ -479,40 +396,35 @@ namespace MWGui
void SettingsWindow::onSliderChangePosition(MyGUI::ScrollBar* scroller, size_t pos) void SettingsWindow::onSliderChangePosition(MyGUI::ScrollBar* scroller, size_t pos)
{ {
float val = pos / float(scroller->getScrollRange()-1); if (getSettingType(scroller) == "Slider")
if (scroller == mMenuTransparencySlider) {
Settings::Manager::setFloat("menu transparency", "GUI", val); if (getSettingValueType(scroller) == "Float")
else if (scroller == mToolTipDelaySlider) {
Settings::Manager::setFloat("tooltip delay", "GUI", val); float value = pos / float(scroller->getScrollRange()-1);
else if (scroller == mViewDistanceSlider)
Settings::Manager::setFloat("max viewing distance", "Viewing distance", (1-val) * sViewDistMin + val * sViewDistMax); float min,max;
else if (scroller == mFOVSlider) getSettingMinMax(scroller, min, max);
value = min + (max-min) * value;
Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), value);
if (scroller == mFOVSlider)
{ {
MyGUI::TextBox* fovText; MyGUI::TextBox* fovText;
getWidget(fovText, "FovText"); getWidget(fovText, "FovText");
fovText->setCaption("Field of View (" + boost::lexical_cast<std::string>(int((1-val) * sFovMin + val * sFovMax)) + ")"); fovText->setCaption("Field of View (" + boost::lexical_cast<std::string>(int(value)) + ")");
Settings::Manager::setFloat("field of view", "General", (1-val) * sFovMin + val * sFovMax); }
} }
else if (scroller == mAnisotropySlider) else
{ {
mAnisotropyLabel->setCaption("Anisotropy (" + boost::lexical_cast<std::string>(int(val*16)) + ")"); Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), pos);
Settings::Manager::setInt("anisotropy", "General", val * 16); if (scroller == mAnisotropySlider)
} {
else if (scroller == mMasterVolumeSlider) mAnisotropyLabel->setCaption("Anisotropy (" + boost::lexical_cast<std::string>(pos) + ")");
Settings::Manager::setFloat("master volume", "Sound", val); }
else if (scroller == mVoiceVolumeSlider) }
Settings::Manager::setFloat("voice volume", "Sound", val);
else if (scroller == mEffectsVolumeSlider)
Settings::Manager::setFloat("sfx volume", "Sound", val);
else if (scroller == mFootstepsVolumeSlider)
Settings::Manager::setFloat("footsteps volume", "Sound", val);
else if (scroller == mMusicVolumeSlider)
Settings::Manager::setFloat("music volume", "Sound", val);
else if (scroller == mCameraSensitivitySlider)
Settings::Manager::setFloat("camera sensitivity", "Input", (1-val) * 0.2 + val * 5.f);
apply(); apply();
} }
}
void SettingsWindow::apply() void SettingsWindow::apply()
{ {

@ -19,61 +19,29 @@ namespace MWGui
void updateControlsBox(); void updateControlsBox();
private:
static int const sFovMin = 30;
static int const sFovMax = 140;
static int const sViewDistMin = 2000;
static int const sViewDistMax = 5600;
protected: protected:
MyGUI::Button* mOkButton; MyGUI::Button* mOkButton;
MyGUI::ScrollBar* mMenuTransparencySlider;
MyGUI::ScrollBar* mToolTipDelaySlider;
MyGUI::Button* mSubtitlesButton;
MyGUI::Button* mCrosshairButton;
MyGUI::Button* mBestAttackButton;
MyGUI::Button* mGrabCursorButton;
// graphics // graphics
MyGUI::ListBox* mResolutionList; MyGUI::ListBox* mResolutionList;
MyGUI::Button* mFullscreenButton; MyGUI::Button* mFullscreenButton;
MyGUI::Button* mVSyncButton; MyGUI::Button* mVSyncButton;
MyGUI::Button* mFPSButton; MyGUI::Button* mFPSButton;
MyGUI::ScrollBar* mViewDistanceSlider;
MyGUI::ScrollBar* mFOVSlider; MyGUI::ScrollBar* mFOVSlider;
MyGUI::ScrollBar* mAnisotropySlider; MyGUI::ScrollBar* mAnisotropySlider;
MyGUI::ComboBox* mTextureFilteringButton; MyGUI::ComboBox* mTextureFilteringButton;
MyGUI::TextBox* mAnisotropyLabel; MyGUI::TextBox* mAnisotropyLabel;
MyGUI::Widget* mAnisotropyBox; MyGUI::Widget* mAnisotropyBox;
MyGUI::Button* mWaterShaderButton;
MyGUI::Button* mReflectObjectsButton;
MyGUI::Button* mReflectActorsButton;
MyGUI::Button* mReflectTerrainButton;
MyGUI::Button* mShadersButton; MyGUI::Button* mShadersButton;
MyGUI::Button* mShaderModeButton; MyGUI::Button* mShaderModeButton;
MyGUI::Button* mRefractionButton; MyGUI::Button* mRefractionButton;
MyGUI::Button* mShadowsEnabledButton; MyGUI::Button* mShadowsEnabledButton;
MyGUI::Button* mShadowsLargeDistance;
MyGUI::ComboBox* mShadowsTextureSize; MyGUI::ComboBox* mShadowsTextureSize;
MyGUI::Button* mActorShadows;
MyGUI::Button* mStaticsShadows;
MyGUI::Button* mMiscShadows;
MyGUI::Button* mTerrainShadows;
// audio
MyGUI::ScrollBar* mMasterVolumeSlider;
MyGUI::ScrollBar* mVoiceVolumeSlider;
MyGUI::ScrollBar* mEffectsVolumeSlider;
MyGUI::ScrollBar* mFootstepsVolumeSlider;
MyGUI::ScrollBar* mMusicVolumeSlider;
// controls // controls
MyGUI::ScrollView* mControlsBox; MyGUI::ScrollView* mControlsBox;
MyGUI::Button* mResetControlsButton; MyGUI::Button* mResetControlsButton;
MyGUI::Button* mInvertYButton;
MyGUI::ScrollBar* mCameraSensitivitySlider;
void onOkButtonClicked(MyGUI::Widget* _sender); void onOkButtonClicked(MyGUI::Widget* _sender);
void onFpsToggled(MyGUI::Widget* _sender); void onFpsToggled(MyGUI::Widget* _sender);
@ -84,7 +52,6 @@ namespace MWGui
void onResolutionAccept(); void onResolutionAccept();
void onResolutionCancel(); void onResolutionCancel();
void onShadersToggled(MyGUI::Widget* _sender);
void onShaderModeToggled(MyGUI::Widget* _sender); void onShaderModeToggled(MyGUI::Widget* _sender);
void onShadowTextureSizeChanged(MyGUI::ComboBox* _sender, size_t pos); void onShadowTextureSizeChanged(MyGUI::ComboBox* _sender, size_t pos);
@ -94,6 +61,8 @@ namespace MWGui
void onResetDefaultBindingsAccept (); void onResetDefaultBindingsAccept ();
void apply(); void apply();
void configureWidgets(MyGUI::Widget* widget);
}; };
} }

@ -0,0 +1,45 @@
#include "videowidget.hpp"
namespace MWGui
{
VideoWidget::VideoWidget()
: mAllowSkipping(true)
{
eventKeyButtonPressed += MyGUI::newDelegate(this, &VideoWidget::onKeyPressed);
setNeedKeyFocus(true);
}
void VideoWidget::playVideo(const std::string &video, bool allowSkipping)
{
mAllowSkipping = allowSkipping;
mPlayer.playVideo(video);
setImageTexture(mPlayer.getTextureName());
}
int VideoWidget::getVideoWidth()
{
return mPlayer.getVideoWidth();
}
int VideoWidget::getVideoHeight()
{
return mPlayer.getVideoHeight();
}
void VideoWidget::onKeyPressed(MyGUI::Widget *_sender, MyGUI::KeyCode _key, MyGUI::Char _char)
{
if (_key == MyGUI::KeyCode::Escape && mAllowSkipping)
mPlayer.stopVideo();
}
bool VideoWidget::update()
{
mPlayer.update();
return mPlayer.isPlaying();
}
}

@ -0,0 +1,39 @@
#ifndef OPENMW_MWGUI_VIDEOWIDGET_H
#define OPENMW_MWGUI_VIDEOWIDGET_H
#include <MyGUI_ImageBox.h>
#include "../mwrender/videoplayer.hpp"
namespace MWGui
{
/**
* Widget that plays a video. Can be skipped by pressing Esc.
*/
class VideoWidget : public MyGUI::ImageBox
{
public:
MYGUI_RTTI_DERIVED(VideoWidget)
VideoWidget();
void playVideo (const std::string& video, bool allowSkipping);
int getVideoWidth();
int getVideoHeight();
/// @return Is the video still playing?
bool update();
private:
bool mAllowSkipping;
MWRender::VideoPlayer mPlayer;
void onKeyPressed(MyGUI::Widget *_sender, MyGUI::KeyCode _key, MyGUI::Char _char);
};
}
#endif

@ -4,6 +4,7 @@
#include <iterator> #include <iterator>
#include <OgreTextureManager.h> #include <OgreTextureManager.h>
#include <OgreRenderWindow.h>
#include "MyGUI_UString.h" #include "MyGUI_UString.h"
#include "MyGUI_IPointer.h" #include "MyGUI_IPointer.h"
@ -59,6 +60,7 @@
#include "bookpage.hpp" #include "bookpage.hpp"
#include "itemview.hpp" #include "itemview.hpp"
#include "fontloader.hpp" #include "fontloader.hpp"
#include "videowidget.hpp"
namespace MWGui namespace MWGui
{ {
@ -104,6 +106,8 @@ namespace MWGui
, mRecharge(NULL) , mRecharge(NULL)
, mRepair(NULL) , mRepair(NULL)
, mCompanionWindow(NULL) , mCompanionWindow(NULL)
, mVideoBackground(NULL)
, mVideoWidget(NULL)
, mTranslationDataStorage (translationDataStorage) , mTranslationDataStorage (translationDataStorage)
, mCharGen(NULL) , mCharGen(NULL)
, mInputBlocker(NULL) , mInputBlocker(NULL)
@ -155,6 +159,7 @@ namespace MWGui
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ExposedWindow>("Widget"); MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ExposedWindow>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollView>("Widget"); MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollView>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollBar>("Widget"); MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollBar>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<VideoWidget>("Widget");
BookPage::registerMyGUIComponents (); BookPage::registerMyGUIComponents ();
ItemView::registerComponents(); ItemView::registerComponents();
@ -186,6 +191,13 @@ namespace MWGui
// hide mygui's pointer // hide mygui's pointer
MyGUI::PointerManager::getInstance().setVisible(false); MyGUI::PointerManager::getInstance().setVisible(false);
mVideoBackground = MyGUI::Gui::getInstance().createWidgetReal<MyGUI::ImageBox>("ImageBox", 0,0,1,1,
MyGUI::Align::Default, "Overlay");
mVideoBackground->setImageTexture("black.png");
mVideoBackground->setVisible(false);
mVideoWidget = mVideoBackground->createWidgetReal<VideoWidget>("ImageBox", 0,0,1,1, MyGUI::Align::Default);
} }
void WindowManager::initUI() void WindowManager::initUI()
@ -391,6 +403,7 @@ namespace MWGui
mCompanionWindow->setVisible(false); mCompanionWindow->setVisible(false);
mInventoryWindow->setTrading(false); mInventoryWindow->setTrading(false);
mRecharge->setVisible(false); mRecharge->setVisible(false);
mVideoBackground->setVisible(false);
mHud->setVisible(mHudEnabled); mHud->setVisible(mHudEnabled);
@ -539,10 +552,6 @@ namespace MWGui
setCursorVisible(false); setCursorVisible(false);
break; break;
case GM_Video:
setCursorVisible(false);
mHud->setVisible(false);
break;
default: default:
// Unsupported mode, switch back to game // Unsupported mode, switch back to game
break; break;
@ -894,6 +903,7 @@ namespace MWGui
void WindowManager::windowResized(int x, int y) void WindowManager::windowResized(int x, int y)
{ {
sizeVideo(x, y);
mGuiManager->windowResized(); mGuiManager->windowResized();
mLoadingScreen->onResChange (x,y); mLoadingScreen->onResChange (x,y);
if (!mHud) if (!mHud)
@ -1401,4 +1411,57 @@ namespace MWGui
mMap->readRecord(reader, type); mMap->readRecord(reader, type);
} }
void WindowManager::playVideo(const std::string &name, bool allowSkipping)
{
mVideoWidget->playVideo("video\\" + name, allowSkipping);
// Turn off all rendering except for the GUI
mRendering->getScene()->clearSpecialCaseRenderQueues();
// SCRQM_INCLUDE with RENDER_QUEUE_OVERLAY does not work?
for(int i = 0;i < Ogre::RENDER_QUEUE_MAX;++i)
{
if(i > 0 && i < 96)
mRendering->getScene()->addSpecialCaseRenderQueue(i);
}
mRendering->getScene()->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE);
MyGUI::IntSize screenSize = MyGUI::RenderManager::getInstance().getViewSize();
sizeVideo(screenSize.width, screenSize.height);
setKeyFocusWidget(mVideoWidget);
mVideoBackground->setVisible(true);
bool cursorWasVisible = mCursorVisible;
setCursorVisible(false);
while (mVideoWidget->update())
{
MWBase::Environment::get().getInputManager()->update(0, true, false);
mRendering->getWindow()->update();
}
setCursorVisible(cursorWasVisible);
// Restore normal rendering
mRendering->getScene()->clearSpecialCaseRenderQueues();
mRendering->getScene()->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE);
mVideoBackground->setVisible(false);
}
void WindowManager::sizeVideo(int screenWidth, int screenHeight)
{
// Use black bars to correct aspect ratio
mVideoBackground->setSize(screenWidth, screenHeight);
double imageaspect = static_cast<double>(mVideoWidget->getVideoWidth())/mVideoWidget->getVideoHeight();
int leftPadding = std::max(0.0, (screenWidth - screenHeight * imageaspect) / 2);
int topPadding = std::max(0.0, (screenHeight - screenWidth / imageaspect) / 2);
mVideoWidget->setCoord(leftPadding, topPadding,
screenWidth - leftPadding*2, screenHeight - topPadding*2);
}
} }

@ -18,6 +18,7 @@ namespace MyGUI
class Widget; class Widget;
class Window; class Window;
class UString; class UString;
class ImageBox;
} }
namespace Compiler namespace Compiler
@ -80,6 +81,7 @@ namespace MWGui
class SoulgemDialog; class SoulgemDialog;
class Recharge; class Recharge;
class CompanionWindow; class CompanionWindow;
class VideoWidget;
class WindowManager : public MWBase::WindowManager class WindowManager : public MWBase::WindowManager
{ {
@ -98,6 +100,10 @@ namespace MWGui
virtual Loading::Listener* getLoadingScreen(); virtual Loading::Listener* getLoadingScreen();
/// @note This method will block until the video finishes playing
/// (and will continually update the window while doing so)
virtual void playVideo(const std::string& name, bool allowSkipping);
/** /**
* Should be called each frame to update windows/gui elements. * Should be called each frame to update windows/gui elements.
* This could mean updating sizes of gui elements or opening * This could mean updating sizes of gui elements or opening
@ -332,6 +338,8 @@ namespace MWGui
Repair* mRepair; Repair* mRepair;
Recharge* mRecharge; Recharge* mRecharge;
CompanionWindow* mCompanionWindow; CompanionWindow* mCompanionWindow;
MyGUI::ImageBox* mVideoBackground;
VideoWidget* mVideoWidget;
Translation::Storage& mTranslationDataStorage; Translation::Storage& mTranslationDataStorage;
Cursor* mSoftwareCursor; Cursor* mSoftwareCursor;
@ -390,6 +398,8 @@ namespace MWGui
void onCursorChange(const std::string& name); void onCursorChange(const std::string& name);
void onKeyFocusChanged(MyGUI::Widget* widget); void onKeyFocusChanged(MyGUI::Widget* widget);
void sizeVideo(int screenWidth, int screenHeight);
}; };
} }

@ -96,12 +96,12 @@ namespace MWInput
: mOgre(ogre) : mOgre(ogre)
, mPlayer(NULL) , mPlayer(NULL)
, mEngine(engine) , mEngine(engine)
, mMouseLookEnabled(true) , mMouseLookEnabled(false)
, mMouseX(ogre.getWindow()->getWidth ()/2.f) , mMouseX(ogre.getWindow()->getWidth ()/2.f)
, mMouseY(ogre.getWindow()->getHeight ()/2.f) , mMouseY(ogre.getWindow()->getHeight ()/2.f)
, mMouseWheel(0) , mMouseWheel(0)
, mDragDrop(false) , mDragDrop(false)
, mGuiCursorEnabled(false) , mGuiCursorEnabled(true)
, mUserFile(userFile) , mUserFile(userFile)
, mUserFileExists(userFileExists) , mUserFileExists(userFileExists)
, mInvertY (Settings::Manager::getBool("invert y axis", "Input")) , mInvertY (Settings::Manager::getBool("invert y axis", "Input"))
@ -256,18 +256,21 @@ namespace MWInput
} }
} }
void InputManager::update(float dt, bool loading) void InputManager::update(float dt, bool disableControls, bool disableEvents)
{ {
mInputManager->setMouseVisible(MWBase::Environment::get().getWindowManager()->getCursorVisible()); mInputManager->setMouseVisible(MWBase::Environment::get().getWindowManager()->getCursorVisible());
mInputManager->capture(loading); mInputManager->capture(disableEvents);
// inject some fake mouse movement to force updating MyGUI's widget states // inject some fake mouse movement to force updating MyGUI's widget states
MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), mMouseWheel); MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), mMouseWheel);
// update values of channels (as a result of pressed keys) // update values of channels (as a result of pressed keys)
if (!loading) if (!disableControls)
mInputBinder->update(dt); mInputBinder->update(dt);
if (disableControls)
return;
bool grab = !MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) bool grab = !MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu)
&& MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console; && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console;
@ -288,9 +291,6 @@ namespace MWInput
mInputManager->warpMouse(mMouseX, mMouseY); mInputManager->warpMouse(mMouseX, mMouseY);
} }
if (loading)
return;
// Disable movement in Gui mode // Disable movement in Gui mode
if (MWBase::Environment::get().getWindowManager()->isGuiMode() if (MWBase::Environment::get().getWindowManager()->isGuiMode()
|| MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_Running) || MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_Running)
@ -626,9 +626,7 @@ namespace MWInput
if (MyGUI::InputManager::getInstance ().isModalAny()) if (MyGUI::InputManager::getInstance ().isModalAny())
return; return;
if (MWBase::Environment::get().getWindowManager()->isGuiMode () && MWBase::Environment::get().getWindowManager()->getMode () == MWGui::GM_Video) if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu))
MWBase::Environment::get().getWorld ()->stopVideo ();
else if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu))
{ {
MWBase::Environment::get().getWindowManager()->popGuiMode(); MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getSoundManager()->resumeSounds (MWBase::SoundManager::Play_TypeSfx); MWBase::Environment::get().getSoundManager()->resumeSounds (MWBase::SoundManager::Play_TypeSfx);

@ -68,7 +68,7 @@ namespace MWInput
/// Clear all savegame-specific data /// Clear all savegame-specific data
virtual void clear(); virtual void clear();
virtual void update(float dt, bool loading); virtual void update(float dt, bool disableControls, bool disableEvents=false);
void setPlayer (MWWorld::Player* player) { mPlayer = player; } void setPlayer (MWWorld::Player* player) { mPlayer = player; }

@ -414,6 +414,16 @@ void CharacterController::playRandomDeath(float startpoint)
mDeathState = CharState_SwimDeath; mDeathState = CharState_SwimDeath;
mCurrentDeath = "swimdeath"; mCurrentDeath = "swimdeath";
} }
else if (mHitState == CharState_KnockDown)
{
mDeathState = CharState_DeathKnockDown;
mCurrentDeath = "deathknockdown";
}
else if (mHitState == CharState_KnockOut)
{
mDeathState = CharState_DeathKnockOut;
mCurrentDeath = "deathknockout";
}
else else
{ {
int selected=0; int selected=0;

@ -90,6 +90,8 @@ enum CharacterState {
CharState_Death4, CharState_Death4,
CharState_Death5, CharState_Death5,
CharState_SwimDeath, CharState_SwimDeath,
CharState_DeathKnockDown,
CharState_DeathKnockOut,
CharState_Hit, CharState_Hit,
CharState_KnockDown, CharState_KnockDown,

@ -750,9 +750,10 @@ namespace MWMechanics
mActors.updateMagicEffects(ptr); mActors.updateMagicEffects(ptr);
} }
void MechanicsManager::toggleAI() bool MechanicsManager::toggleAI()
{ {
mAI = !mAI; mAI = !mAI;
return mAI;
} }
bool MechanicsManager::isAIActive() bool MechanicsManager::isAIActive()

@ -137,7 +137,7 @@ namespace MWMechanics
virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor); virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor);
virtual void toggleAI(); virtual bool toggleAI();
virtual bool isAIActive(); virtual bool isAIActive();
virtual void playerLoaded(); virtual void playerLoaded();

@ -43,7 +43,6 @@
#include "water.hpp" #include "water.hpp"
#include "npcanimation.hpp" #include "npcanimation.hpp"
#include "globalmap.hpp" #include "globalmap.hpp"
#include "videoplayer.hpp"
#include "terrainstorage.hpp" #include "terrainstorage.hpp"
#include "effectmanager.hpp" #include "effectmanager.hpp"
@ -171,9 +170,6 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode()); mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode());
mVideoPlayer = new VideoPlayer(mRendering.getScene (), mRendering.getWindow());
mVideoPlayer->setResolution (Settings::Manager::getInt ("resolution x", "Video"), Settings::Manager::getInt ("resolution y", "Video"));
mSun = 0; mSun = 0;
mDebugging = new Debugging(mRootNode, engine); mDebugging = new Debugging(mRootNode, engine);
@ -197,7 +193,6 @@ RenderingManager::~RenderingManager ()
delete mLocalMap; delete mLocalMap;
delete mOcclusionQuery; delete mOcclusionQuery;
delete mWater; delete mWater;
delete mVideoPlayer;
delete mActors; delete mActors;
delete mObjects; delete mObjects;
delete mEffectManager; delete mEffectManager;
@ -333,8 +328,6 @@ void RenderingManager::rebuildPtr(const MWWorld::Ptr &ptr)
void RenderingManager::update (float duration, bool paused) void RenderingManager::update (float duration, bool paused)
{ {
mVideoPlayer->update ();
if (MWBase::Environment::get().getStateManager()->getState()== if (MWBase::Environment::get().getStateManager()->getState()==
MWBase::StateManager::State_NoGame) MWBase::StateManager::State_NoGame)
return; return;
@ -884,8 +877,6 @@ void RenderingManager::windowResized(int x, int y)
Settings::Manager::setInt("resolution y", "Video", y); Settings::Manager::setInt("resolution y", "Video", y);
mRendering.adjustViewport(); mRendering.adjustViewport();
mVideoPlayer->setResolution (x, y);
MWBase::Environment::get().getWindowManager()->windowResized(x,y); MWBase::Environment::get().getWindowManager()->windowResized(x,y);
} }
@ -1001,16 +992,6 @@ void RenderingManager::screenshot(Image &image, int w, int h)
mRendering.getCamera()->setAspectRatio(oldAspect); mRendering.getCamera()->setAspectRatio(oldAspect);
} }
void RenderingManager::playVideo(const std::string& name, bool allowSkipping)
{
mVideoPlayer->playVideo ("video/" + name, allowSkipping);
}
void RenderingManager::stopVideo()
{
mVideoPlayer->stopVideo ();
}
void RenderingManager::addWaterRippleEmitter (const MWWorld::Ptr& ptr, float scale, float force) void RenderingManager::addWaterRippleEmitter (const MWWorld::Ptr& ptr, float scale, float force)
{ {
mWater->addEmitter (ptr, scale, force); mWater->addEmitter (ptr, scale, force);

@ -46,7 +46,6 @@ namespace MWRender
class LocalMap; class LocalMap;
class Water; class Water;
class GlobalMap; class GlobalMap;
class VideoPlayer;
class Animation; class Animation;
class EffectManager; class EffectManager;
@ -209,8 +208,6 @@ public:
Animation* getAnimation(const MWWorld::Ptr &ptr); Animation* getAnimation(const MWWorld::Ptr &ptr);
void playVideo(const std::string& name, bool allowSkipping);
void stopVideo();
void frameStarted(float dt, bool paused); void frameStarted(float dt, bool paused);
void screenshot(Ogre::Image& image, int w, int h); void screenshot(Ogre::Image& image, int w, int h);
@ -271,8 +268,6 @@ private:
MWRender::LocalMap* mLocalMap; MWRender::LocalMap* mLocalMap;
MWRender::Shadows* mShadows; MWRender::Shadows* mShadows;
VideoPlayer* mVideoPlayer;
}; };
} }

@ -17,7 +17,6 @@
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwsound/sound_decoder.hpp" #include "../mwsound/sound_decoder.hpp"
@ -126,7 +125,7 @@ struct VideoState {
int stream_open(int stream_index, AVFormatContext *pFormatCtx); int stream_open(int stream_index, AVFormatContext *pFormatCtx);
bool update(Ogre::MaterialPtr &mat, Ogre::Rectangle2D *rect, int screen_width, int screen_height); bool update();
static void video_thread_loop(VideoState *is); static void video_thread_loop(VideoState *is);
static void decode_thread_loop(VideoState *is); static void decode_thread_loop(VideoState *is);
@ -163,6 +162,7 @@ struct VideoState {
static int OgreResource_Write(void *user_data, uint8_t *buf, int buf_size); static int OgreResource_Write(void *user_data, uint8_t *buf, int buf_size);
static int64_t OgreResource_Seek(void *user_data, int64_t offset, int whence); static int64_t OgreResource_Seek(void *user_data, int64_t offset, int whence);
Ogre::TexturePtr mTexture;
Ogre::DataStreamPtr stream; Ogre::DataStreamPtr stream;
AVFormatContext* format_ctx; AVFormatContext* format_ctx;
@ -599,22 +599,17 @@ void VideoState::video_display()
if((*this->video_st)->codec->width != 0 && (*this->video_st)->codec->height != 0) if((*this->video_st)->codec->width != 0 && (*this->video_st)->codec->height != 0)
{ {
Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().getByName("VideoTexture");
if(texture.isNull() || static_cast<int>(texture->getWidth()) != (*this->video_st)->codec->width if(static_cast<int>(mTexture->getWidth()) != (*this->video_st)->codec->width ||
|| static_cast<int>(texture->getHeight()) != (*this->video_st)->codec->height) static_cast<int>(mTexture->getHeight()) != (*this->video_st)->codec->height)
{ {
Ogre::TextureManager::getSingleton ().remove ("VideoTexture"); mTexture->unload();
texture = Ogre::TextureManager::getSingleton().createManual( mTexture->setWidth((*this->video_st)->codec->width);
"VideoTexture", mTexture->setHeight((*this->video_st)->codec->height);
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, mTexture->createInternalResources();
Ogre::TEX_TYPE_2D,
(*this->video_st)->codec->width, (*this->video_st)->codec->height,
0,
Ogre::PF_BYTE_RGBA,
Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
} }
Ogre::PixelBox pb((*this->video_st)->codec->width, (*this->video_st)->codec->height, 1, Ogre::PF_BYTE_RGBA, &vp->data[0]); Ogre::PixelBox pb((*this->video_st)->codec->width, (*this->video_st)->codec->height, 1, Ogre::PF_BYTE_RGBA, &vp->data[0]);
Ogre::HardwarePixelBufferSharedPtr buffer = texture->getBuffer(); Ogre::HardwarePixelBufferSharedPtr buffer = mTexture->getBuffer();
buffer->blitFromMemory(pb); buffer->blitFromMemory(pb);
this->display_ready = true; this->display_ready = true;
} }
@ -851,7 +846,7 @@ void VideoState::decode_thread_loop(VideoState *self)
} }
bool VideoState::update(Ogre::MaterialPtr &mat, Ogre::Rectangle2D *rect, int screen_width, int screen_height) bool VideoState::update()
{ {
if(this->quit) if(this->quit)
return false; return false;
@ -860,21 +855,6 @@ bool VideoState::update(Ogre::MaterialPtr &mat, Ogre::Rectangle2D *rect, int scr
{ {
this->refresh = false; this->refresh = false;
this->video_refresh_timer(); this->video_refresh_timer();
// Would be nice not to do this all the time...
if(this->display_ready)
mat->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("VideoTexture");
// Correct aspect ratio by adding black bars
double videoaspect = av_q2d((*this->video_st)->codec->sample_aspect_ratio);
if(videoaspect == 0.0)
videoaspect = 1.0;
videoaspect *= static_cast<double>((*this->video_st)->codec->width) / (*this->video_st)->codec->height;
double screenaspect = static_cast<double>(screen_width) / screen_height;
double aspect_correction = videoaspect / screenaspect;
rect->setCorners(std::max(-1.0, -1.0 * aspect_correction), std::min( 1.0, 1.0 / aspect_correction),
std::min( 1.0, 1.0 * aspect_correction), std::max(-1.0, -1.0 / aspect_correction));
} }
return true; return true;
} }
@ -994,12 +974,36 @@ void VideoState::init(const std::string& resourceName)
audio_index = i; audio_index = i;
} }
if (audio_index != -1)
MWBase::Environment::get().getSoundManager()->pauseSounds();
this->external_clock_base = av_gettime(); this->external_clock_base = av_gettime();
if(audio_index >= 0) if(audio_index >= 0)
this->stream_open(audio_index, this->format_ctx); this->stream_open(audio_index, this->format_ctx);
if(video_index >= 0) if(video_index >= 0)
{
this->stream_open(video_index, this->format_ctx); this->stream_open(video_index, this->format_ctx);
int width = (*this->video_st)->codec->width;
int height = (*this->video_st)->codec->height;
static int i = 0;
this->mTexture = Ogre::TextureManager::getSingleton().createManual(
"OpenMW/VideoTexture" + Ogre::StringConverter::toString(++i),
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
width, height, // TEST
0,
Ogre::PF_BYTE_RGBA,
Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
// initialize to (0,0,0,0)
std::vector<Ogre::uint32> buffer;
buffer.resize(width * height, 0);
Ogre::PixelBox pb(width, height, 1, Ogre::PF_BYTE_RGBA, &buffer[0]);
this->mTexture->getBuffer()->blitFromMemory(pb);
}
this->parse_thread = boost::thread(decode_thread_loop, this); this->parse_thread = boost::thread(decode_thread_loop, this);
} }
@ -1070,113 +1074,26 @@ public:
#endif // defined OPENMW_USE_FFMPEG #endif // defined OPENMW_USE_FFMPEG
VideoPlayer::VideoPlayer(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* window) VideoPlayer::VideoPlayer()
: mState(NULL) : mState(NULL)
, mSceneMgr(sceneMgr) {
, mRectangle(NULL)
, mNode(NULL)
, mAllowSkipping(false)
, mWindow(window)
, mWidth(0)
, mHeight(0)
{
mVideoMaterial = Ogre::MaterialManager::getSingleton().getByName("VideoMaterial", "General");
if (mVideoMaterial.isNull ())
{
mVideoMaterial = Ogre::MaterialManager::getSingleton().create("VideoMaterial", "General");
mVideoMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
mVideoMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
mVideoMaterial->getTechnique(0)->getPass(0)->setLightingEnabled(false);
mVideoMaterial->getTechnique(0)->getPass(0)->createTextureUnitState();
mVideoMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
}
mVideoMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("black.png");
Ogre::MaterialPtr blackMaterial = Ogre::MaterialManager::getSingleton().getByName("BlackBarsMaterial", "General");
if (blackMaterial.isNull ())
{
blackMaterial = Ogre::MaterialManager::getSingleton().create("BlackBarsMaterial", "General");
blackMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
blackMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
blackMaterial->getTechnique(0)->getPass(0)->setLightingEnabled(false);
blackMaterial->getTechnique(0)->getPass(0)->createTextureUnitState()->setTextureName("black.png");
}
mRectangle = new Ogre::Rectangle2D(true);
mRectangle->setCorners(-1.0, 1.0, 1.0, -1.0);
mRectangle->setMaterial("VideoMaterial");
mRectangle->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY+2);
mBackgroundRectangle = new Ogre::Rectangle2D(true);
mBackgroundRectangle->setCorners(-1.0, 1.0, 1.0, -1.0);
mBackgroundRectangle->setMaterial("BlackBarsMaterial");
mBackgroundRectangle->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY+1);
// Use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
mRectangle->setBoundingBox(aabInf);
mBackgroundRectangle->setBoundingBox(aabInf);
// Attach background to the scene
mNode = sceneMgr->getRootSceneNode()->createChildSceneNode();
mNode->attachObject(mRectangle);
mBackgroundNode = sceneMgr->getRootSceneNode()->createChildSceneNode();
mBackgroundNode->attachObject(mBackgroundRectangle);
mRectangle->setVisible(false);
mRectangle->setVisibilityFlags(RV_Overlay);
mBackgroundRectangle->setVisible(false);
mBackgroundRectangle->setVisibilityFlags(RV_Overlay);
} }
VideoPlayer::~VideoPlayer() VideoPlayer::~VideoPlayer()
{ {
if(mState) if(mState)
close(); close();
mSceneMgr->destroySceneNode(mNode);
mSceneMgr->destroySceneNode(mBackgroundNode);
delete mRectangle;
delete mBackgroundRectangle;
} }
void VideoPlayer::playVideo(const std::string &resourceName, bool allowSkipping) void VideoPlayer::playVideo(const std::string &resourceName)
{ {
mAllowSkipping = allowSkipping;
if(mState) if(mState)
close(); close();
mRectangle->setVisible(true);
mBackgroundRectangle->setVisible(true);
mVideoMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("black.png");
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Video);
// Turn off rendering except the GUI
mSceneMgr->clearSpecialCaseRenderQueues();
// SCRQM_INCLUDE with RENDER_QUEUE_OVERLAY does not work.
for(int i = 0;i < Ogre::RENDER_QUEUE_MAX;++i)
{
if(i > 0 && i < 96)
mSceneMgr->addSpecialCaseRenderQueue(i);
}
mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE);
MWBase::Environment::get().getSoundManager()->pauseSounds();
try { try {
mState = new VideoState; mState = new VideoState;
mState->init(resourceName); mState->init(resourceName);
while (isPlaying())
{
MWBase::Environment::get().getInputManager()->update(0, false);
update();
mWindow->update();
}
} }
catch(std::exception& e) { catch(std::exception& e) {
std::cerr<< "Failed to play video: "<<e.what() <<std::endl; std::cerr<< "Failed to play video: "<<e.what() <<std::endl;
@ -1188,14 +1105,37 @@ void VideoPlayer::update ()
{ {
if(mState) if(mState)
{ {
if(!mState->update(mVideoMaterial, mRectangle, mWidth, mHeight)) if(!mState->update())
close(); close();
} }
} }
std::string VideoPlayer::getTextureName()
{
std::string name;
if (mState)
name = mState->mTexture->getName();
return name;
}
int VideoPlayer::getVideoWidth()
{
int width=0;
if (mState)
width = mState->mTexture->getWidth();
return width;
}
int VideoPlayer::getVideoHeight()
{
int height=0;
if (mState)
height = mState->mTexture->getHeight();
return height;
}
void VideoPlayer::stopVideo () void VideoPlayer::stopVideo ()
{ {
if (mAllowSkipping)
close(); close();
} }
@ -1210,13 +1150,6 @@ void VideoPlayer::close()
} }
MWBase::Environment::get().getSoundManager()->resumeSounds(); MWBase::Environment::get().getSoundManager()->resumeSounds();
mRectangle->setVisible(false);
mBackgroundRectangle->setVisible(false);
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Video);
mSceneMgr->clearSpecialCaseRenderQueues();
mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE);
} }
bool VideoPlayer::isPlaying () bool VideoPlayer::isPlaying ()

@ -1,27 +1,22 @@
#ifndef VIDEOPLAYER_H #ifndef VIDEOPLAYER_H
#define VIDEOPLAYER_H #define VIDEOPLAYER_H
#include <OgreMaterial.h> #include <string>
namespace Ogre
{
class SceneManager;
class SceneNode;
class Rectangle2D;
class RenderWindow;
}
namespace MWRender namespace MWRender
{ {
struct VideoState; struct VideoState;
/**
* @brief Plays a video on an Ogre texture.
*/
class VideoPlayer class VideoPlayer
{ {
public: public:
VideoPlayer(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* window); VideoPlayer();
~VideoPlayer(); ~VideoPlayer();
void playVideo (const std::string& resourceName, bool allowSkipping); void playVideo (const std::string& resourceName);
void update(); void update();
@ -30,22 +25,14 @@ namespace MWRender
bool isPlaying(); bool isPlaying();
void setResolution (int w, int h) { mWidth = w; mHeight = h; } std::string getTextureName();
int getVideoWidth();
int getVideoHeight();
private: private:
VideoState* mState; VideoState* mState;
bool mAllowSkipping;
Ogre::SceneManager* mSceneMgr;
Ogre::MaterialPtr mVideoMaterial;
Ogre::Rectangle2D* mRectangle;
Ogre::Rectangle2D* mBackgroundRectangle;
Ogre::SceneNode* mNode;
Ogre::SceneNode* mBackgroundNode;
Ogre::RenderWindow* mWindow;
int mWidth; int mWidth;
int mHeight; int mHeight;
}; };

@ -418,10 +418,8 @@ void Water::applyRTT()
void Water::applyVisibilityMask() void Water::applyVisibilityMask()
{ {
mVisibilityFlags = RV_Terrain * Settings::Manager::getBool("reflect terrain", "Water") mVisibilityFlags = RV_Terrain * Settings::Manager::getBool("reflect terrain", "Water")
+ RV_Statics * Settings::Manager::getBool("reflect statics", "Water") + (RV_Statics + RV_StaticsSmall + RV_Misc) * Settings::Manager::getBool("reflect statics", "Water")
+ RV_StaticsSmall * Settings::Manager::getBool("reflect small statics", "Water")
+ RV_Actors * Settings::Manager::getBool("reflect actors", "Water") + RV_Actors * Settings::Manager::getBool("reflect actors", "Water")
+ RV_Misc * Settings::Manager::getBool("reflect misc", "Water")
+ RV_Sky; + RV_Sky;
if (mReflection) if (mReflection)
@ -444,8 +442,6 @@ void Water::processChangedSettings(const Settings::CategorySettingVector& settin
if ( it->first == "Water" && ( if ( it->first == "Water" && (
it->second == "reflect actors" it->second == "reflect actors"
|| it->second == "reflect terrain" || it->second == "reflect terrain"
|| it->second == "reflect misc"
|| it->second == "reflect small statics"
|| it->second == "reflect statics")) || it->second == "reflect statics"))
applyVisMask = true; applyVisMask = true;
} }

@ -464,7 +464,12 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime) virtual void execute (Interpreter::Runtime& runtime)
{ {
MWBase::Environment::get().getMechanicsManager()->toggleAI(); InterpreterContext& context
= static_cast<InterpreterContext&> (runtime.getContext());
bool enabled = MWBase::Environment::get().getMechanicsManager()->toggleAI();
context.report (enabled ? "AI -> On" : "AI -> Off");
} }
}; };

@ -47,7 +47,7 @@ namespace MWScript
bool allowSkipping = runtime[0].mInteger; bool allowSkipping = runtime[0].mInteger;
runtime.pop(); runtime.pop();
MWBase::Environment::get().getWorld ()->playVideo (name, allowSkipping); MWBase::Environment::get().getWindowManager()->playVideo (name, allowSkipping);
} }
}; };

@ -156,7 +156,12 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
profile.mPlayerName = player.getClass().getName (player); profile.mPlayerName = player.getClass().getName (player);
profile.mPlayerLevel = player.getClass().getNpcStats (player).getLevel(); profile.mPlayerLevel = player.getClass().getNpcStats (player).getLevel();
profile.mPlayerClass = player.get<ESM::NPC>()->mBase->mClass;
std::string classId = player.get<ESM::NPC>()->mBase->mClass;
if (world.getStore().get<ESM::Class>().isDynamic(classId))
profile.mPlayerClassName = world.getStore().get<ESM::Class>().find(classId)->mName;
else
profile.mPlayerClassId = classId;
profile.mPlayerCell = world.getCellName(); profile.mPlayerCell = world.getCellName();

@ -157,6 +157,14 @@ namespace MWWorld
return 0; return 0;
} }
/**
* Does the record with this ID come from the dynamic store?
*/
bool isDynamic(const std::string &id) const {
typename Dynamic::const_iterator dit = mDynamic.find(id);
return (dit != mDynamic.end());
}
/** Returns a random record that starts with the named ID, or NULL if not found. */ /** Returns a random record that starts with the named ID, or NULL if not found. */
const T *searchRandom(const std::string &id) const const T *searchRandom(const std::string &id) const
{ {

@ -1305,7 +1305,7 @@ namespace MWWorld
{ {
--mPlayIntro; --mPlayIntro;
if (mPlayIntro == 0) if (mPlayIntro == 0)
mRendering->playVideo(mFallback.getFallbackString("Movies_New_Game"), true); MWBase::Environment::get().getWindowManager()->playVideo(mFallback.getFallbackString("Movies_New_Game"), true);
} }
if (mGoToJail && !paused) if (mGoToJail && !paused)
@ -1776,16 +1776,6 @@ namespace MWWorld
return mRendering->getAnimation(ptr); return mRendering->getAnimation(ptr);
} }
void World::playVideo (const std::string &name, bool allowSkipping)
{
mRendering->playVideo(name, allowSkipping);
}
void World::stopVideo ()
{
mRendering->stopVideo();
}
void World::frameStarted (float dt, bool paused) void World::frameStarted (float dt, bool paused)
{ {
mRendering->frameStarted(dt, paused); mRendering->frameStarted(dt, paused);

@ -523,8 +523,6 @@ namespace MWWorld
virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr); virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr);
/// \todo this does not belong here /// \todo this does not belong here
virtual void playVideo(const std::string& name, bool allowSkipping);
virtual void stopVideo();
virtual void frameStarted (float dt, bool paused); virtual void frameStarted (float dt, bool paused);
virtual void screenshot (Ogre::Image& image, int w, int h); virtual void screenshot (Ogre::Image& image, int w, int h);

@ -86,7 +86,7 @@ namespace Compiler
{ {
if (mState==PotentialEndState) if (mState==PotentialEndState)
{ {
getErrorHandler().warning ("stay string argument (ignoring it)", loc); getErrorHandler().warning ("stray string argument (ignoring it)", loc);
mState = EndState; mState = EndState;
return true; return true;
} }
@ -377,19 +377,19 @@ namespace Compiler
case Scanner::K_else: case Scanner::K_else:
getErrorHandler().warning ("stay else (ignoring it)", loc); getErrorHandler().warning ("stray else (ignoring it)", loc);
mState = EndState; mState = EndState;
return true; return true;
case Scanner::K_endif: case Scanner::K_endif:
getErrorHandler().warning ("stay endif (ignoring it)", loc); getErrorHandler().warning ("stray endif (ignoring it)", loc);
mState = EndState; mState = EndState;
return true; return true;
case Scanner::K_begin: case Scanner::K_begin:
getErrorHandler().warning ("stay begin (ignoring it)", loc); getErrorHandler().warning ("stray begin (ignoring it)", loc);
mState = EndState; mState = EndState;
return true; return true;
} }

@ -11,7 +11,10 @@ void ESM::SavedGame::load (ESMReader &esm)
{ {
mPlayerName = esm.getHNString("PLNA"); mPlayerName = esm.getHNString("PLNA");
esm.getHNOT (mPlayerLevel, "PLLE"); esm.getHNOT (mPlayerLevel, "PLLE");
mPlayerClass = esm.getHNString("PLCL");
mPlayerClassId = esm.getHNOString("PLCL");
mPlayerClassName = esm.getHNOString("PLCN");
mPlayerCell = esm.getHNString("PLCE"); mPlayerCell = esm.getHNString("PLCE");
esm.getHNT (mInGameTime, "TSTM", 16); esm.getHNT (mInGameTime, "TSTM", 16);
esm.getHNT (mTimePlayed, "TIME"); esm.getHNT (mTimePlayed, "TIME");
@ -30,7 +33,12 @@ void ESM::SavedGame::save (ESMWriter &esm) const
{ {
esm.writeHNString ("PLNA", mPlayerName); esm.writeHNString ("PLNA", mPlayerName);
esm.writeHNT ("PLLE", mPlayerLevel); esm.writeHNT ("PLLE", mPlayerLevel);
esm.writeHNString ("PLCL", mPlayerClass);
if (!mPlayerClassId.empty())
esm.writeHNString ("PLCL", mPlayerClassId);
else
esm.writeHNString ("PLCN", mPlayerClassName);
esm.writeHNString ("PLCE", mPlayerCell); esm.writeHNString ("PLCE", mPlayerCell);
esm.writeHNT ("TSTM", mInGameTime, 16); esm.writeHNT ("TSTM", mInGameTime, 16);
esm.writeHNT ("TIME", mTimePlayed); esm.writeHNT ("TIME", mTimePlayed);

@ -26,7 +26,13 @@ namespace ESM
std::vector<std::string> mContentFiles; std::vector<std::string> mContentFiles;
std::string mPlayerName; std::string mPlayerName;
int mPlayerLevel; int mPlayerLevel;
std::string mPlayerClass; // this is the ID and not the name of the class
// ID of class
std::string mPlayerClassId;
// Name of the class. When using a custom class, the ID is not really meaningful prior
// to loading the savegame, so the name is stored separately.
std::string mPlayerClassName;
std::string mPlayerCell; std::string mPlayerCell;
TimeStamp mInGameTime; TimeStamp mInGameTime;
double mTimePlayed; double mTimePlayed;

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layer"> <MyGUI type="Layer">
<Layer name="Scene" overlapped="false" peek="true"/>
<Layer name="HUD" overlapped="false" peek="true"/> <Layer name="HUD" overlapped="false" peek="true"/>
<Layer name="Menu" overlapped="false" peek="false"/>
<Layer name="Windows" overlapped="true" peek="true"/> <Layer name="Windows" overlapped="true" peek="true"/>
<Layer name="Console" overlapped="false" peek="true"/> <Layer name="Console" overlapped="false" peek="true"/>
<Layer name="Notification" overlapped="false" peek="false"/> <Layer name="Notification" overlapped="false" peek="false"/>
<Layer name="Popup" overlapped="true" peek="true"/> <Layer name="Popup" overlapped="true" peek="true"/>
<Layer name="DragAndDrop" overlapped="false" peek="false"/> <Layer name="DragAndDrop" overlapped="false" peek="false"/>
<Layer name="LoadingScreen" overlapped="false" peek="true"/> <Layer name="LoadingScreen" overlapped="false" peek="true"/>
<Layer name="Overlay" overlapped="false" peek="true"/>
<Layer name="Pointer" overlapped="false" peek="false"/> <Layer name="Pointer" overlapped="false" peek="false"/>
</MyGUI> </MyGUI>

@ -18,6 +18,10 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 28 352 18" align="Left Top" name="MenuTransparencySlider"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 28 352 18" align="Left Top" name="MenuTransparencySlider">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="GUI"/>
<UserString key="SettingName" value="menu transparency"/>
<UserString key="SettingValueType" value="Float"/>
</Widget> </Widget>
<Widget type="TextBox" skin="SandText" position="4 52 352 18" align="Left Top"> <Widget type="TextBox" skin="SandText" position="4 52 352 18" align="Left Top">
<Property key="Caption" value="#{sFull}"/> <Property key="Caption" value="#{sFull}"/>
@ -34,6 +38,10 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 102 352 18" align="Left Top" name="ToolTipDelaySlider"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 102 352 18" align="Left Top" name="ToolTipDelaySlider">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="GUI"/>
<UserString key="SettingName" value="tooltip delay"/>
<UserString key="SettingValueType" value="Float"/>
</Widget> </Widget>
<Widget type="TextBox" skin="SandText" position="4 126 352 18" align="Left Top"> <Widget type="TextBox" skin="SandText" position="4 126 352 18" align="Left Top">
<Property key="Caption" value="#{sFast}"/> <Property key="Caption" value="#{sFast}"/>
@ -45,28 +53,44 @@
</Widget> </Widget>
<Widget type="HBox" skin="" position="4 170 260 24"> <Widget type="HBox" skin="" position="4 170 260 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="BestAttackButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="BestAttackButton">
<UserString key="SettingCategory" value="Game"/>
<UserString key="SettingName" value="best attack"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="#{sBestAttack}"/> <Property key="Caption" value="#{sBestAttack}"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" skin="" position="4 200 260 24"> <Widget type="HBox" skin="" position="4 200 260 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="SubtitlesButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="SubtitlesButton">
<UserString key="SettingCategory" value="GUI"/>
<UserString key="SettingName" value="subtitles"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="#{sSubtitles}"/> <Property key="Caption" value="#{sSubtitles}"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" skin="" position="4 230 260 24"> <Widget type="HBox" skin="" position="4 230 260 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="CrosshairButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="CrosshairButton">
<UserString key="SettingCategory" value="HUD"/>
<UserString key="SettingName" value="crosshair"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="#{sCursorOff}"/> <Property key="Caption" value="#{sCursorOff}"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" skin="" position="4 260 260 24"> <Widget type="HBox" skin="" position="4 260 260 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="GrabCursorButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="GrabCursorButton">
<UserString key="SettingCategory" value="Input"/>
<UserString key="SettingName" value="grab cursor"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Grab cursor"/> <Property key="Caption" value="Grab cursor"/>
</Widget> </Widget>
@ -81,6 +105,10 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 28 352 18" align="Left Top" name="MasterVolume"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 28 352 18" align="Left Top" name="MasterVolume">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Sound"/>
<UserString key="SettingName" value="master volume"/>
<UserString key="SettingValueType" value="Float"/>
</Widget> </Widget>
<Widget type="TextBox" skin="NormalText" position="4 54 352 18" align="Left Top"> <Widget type="TextBox" skin="NormalText" position="4 54 352 18" align="Left Top">
@ -89,6 +117,10 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 78 352 18" align="Left Top" name="VoiceVolume"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 78 352 18" align="Left Top" name="VoiceVolume">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Sound"/>
<UserString key="SettingName" value="voice volume"/>
<UserString key="SettingValueType" value="Float"/>
</Widget> </Widget>
<Widget type="TextBox" skin="NormalText" position="4 104 352 18" align="Left Top"> <Widget type="TextBox" skin="NormalText" position="4 104 352 18" align="Left Top">
@ -97,6 +129,10 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 128 352 18" align="Left Top" name="EffectsVolume"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 128 352 18" align="Left Top" name="EffectsVolume">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Sound"/>
<UserString key="SettingName" value="sfx volume"/>
<UserString key="SettingValueType" value="Float"/>
</Widget> </Widget>
<Widget type="TextBox" skin="NormalText" position="4 154 352 18" align="Left Top"> <Widget type="TextBox" skin="NormalText" position="4 154 352 18" align="Left Top">
@ -105,6 +141,10 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 178 352 18" align="Left Top" name="FootstepsVolume"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 178 352 18" align="Left Top" name="FootstepsVolume">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Sound"/>
<UserString key="SettingName" value="footsteps volume"/>
<UserString key="SettingValueType" value="Float"/>
</Widget> </Widget>
<Widget type="TextBox" skin="NormalText" position="4 204 352 18" align="Left Top"> <Widget type="TextBox" skin="NormalText" position="4 204 352 18" align="Left Top">
@ -113,6 +153,10 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 228 352 18" align="Left Top" name="MusicVolume"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 228 352 18" align="Left Top" name="MusicVolume">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Sound"/>
<UserString key="SettingName" value="music volume"/>
<UserString key="SettingValueType" value="Float"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="TabItem" skin="" position="4 28 360 312"> <Widget type="TabItem" skin="" position="4 28 360 312">
@ -127,7 +171,11 @@
</Widget> </Widget>
<Widget type="HBox" position="4 192 300 24"> <Widget type="HBox" position="4 192 300 24">
<Widget type="AutoSizedButton" skin="MW_Button" name="InvertYButton"/> <Widget type="AutoSizedButton" skin="MW_Button" name="InvertYButton">
<UserString key="SettingCategory" value="Input"/>
<UserString key="SettingName" value="invert y axis"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText"> <Widget type="AutoSizedTextBox" skin="SandText">
<Property key="Caption" value="#{sMouseFlip}"/> <Property key="Caption" value="#{sMouseFlip}"/>
</Widget> </Widget>
@ -139,6 +187,12 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 252 336 18" align="Left Top" name="CameraSensitivitySlider"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 252 336 18" align="Left Top" name="CameraSensitivitySlider">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Input"/>
<UserString key="SettingName" value="camera sensitivity"/>
<UserString key="SettingValueType" value="Float"/>
<UserString key="SettingMin" value="0.2"/>
<UserString key="SettingMax" value="5.0"/>
</Widget> </Widget>
<Widget type="TextBox" skin="SandText" position="4 276 336 18" align="Left Top"> <Widget type="TextBox" skin="SandText" position="4 276 336 18" align="Left Top">
<Property key="Caption" value="#{sLow}"/> <Property key="Caption" value="#{sLow}"/>
@ -149,8 +203,6 @@
<Property key="TextAlign" value="Right"/> <Property key="TextAlign" value="Right"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="TabItem" skin="" position="4 28 360 312"> <Widget type="TabItem" skin="" position="4 28 360 312">
<Property key="Caption" value=" #{sVideo} "/> <Property key="Caption" value=" #{sVideo} "/>
@ -163,16 +215,23 @@
<Widget type="ListBox" skin="MW_List" position="0 4 170 170" align="Left Top" name="ResolutionList"/> <Widget type="ListBox" skin="MW_List" position="0 4 170 170" align="Left Top" name="ResolutionList"/>
<Widget type="HBox" position="182 4 300 24"> <Widget type="HBox" position="182 4 300 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="FullscreenButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="FullscreenButton">
<UserString key="SettingCategory" value="Video"/>
<UserString key="SettingName" value="fullscreen"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Fullscreen"/> <Property key="Caption" value="Fullscreen"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="182 34 300 24"> <Widget type="HBox" position="182 34 300 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="VSyncButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="VSyncButton">
<UserString key="SettingCategory" value="Video"/>
<UserString key="SettingName" value="vsync"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="VSync"/> <Property key="Caption" value="VSync"/>
</Widget> </Widget>
@ -186,7 +245,11 @@
</Widget> </Widget>
<Widget type="HBox" position="182 94 300 24"> <Widget type="HBox" position="182 94 300 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ShadersButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ShadersButton">
<UserString key="SettingCategory" value="Objects"/>
<UserString key="SettingName" value="shaders"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Object shaders"/> <Property key="Caption" value="Object shaders"/>
</Widget> </Widget>
@ -205,6 +268,12 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="0 222 329 18" align="Left Top" name="FOVSlider"> <Widget type="MWScrollBar" skin="MW_HScroll" position="0 222 329 18" align="Left Top" name="FOVSlider">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="General"/>
<UserString key="SettingName" value="field of view"/>
<UserString key="SettingValueType" value="Float"/>
<UserString key="SettingMin" value="30"/>
<UserString key="SettingMax" value="110"/>
</Widget> </Widget>
<Widget type="TextBox" skin="SandText" position="0 246 329 18" align="Left Top"> <Widget type="TextBox" skin="SandText" position="0 246 329 18" align="Left Top">
<Property key="Caption" value="#{sLow}"/> <Property key="Caption" value="#{sLow}"/>
@ -233,8 +302,10 @@
<Property key="Caption" value="Anisotropy"/> <Property key="Caption" value="Anisotropy"/>
</Widget> </Widget>
<Widget type="MWScrollBar" skin="MW_HScroll" position="0 28 150 18" align="Left Top" name="AnisotropySlider"> <Widget type="MWScrollBar" skin="MW_HScroll" position="0 28 150 18" align="Left Top" name="AnisotropySlider">
<Property key="Range" value="10000"/> <Property key="Range" value="17"/>
<Property key="Page" value="300"/> <UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="General"/>
<UserString key="SettingName" value="anisotropy"/>
</Widget> </Widget>
</Widget> </Widget>
@ -244,6 +315,12 @@
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 154 322 18" align="Left Top" name="ViewDistanceSlider"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 154 322 18" align="Left Top" name="ViewDistanceSlider">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Viewing distance"/>
<UserString key="SettingName" value="max viewing distance"/>
<UserString key="SettingValueType" value="Float"/>
<UserString key="SettingMin" value="2000"/>
<UserString key="SettingMax" value="5600"/>
</Widget> </Widget>
<Widget type="TextBox" skin="SandText" position="4 178 332 18" align="Left Top"> <Widget type="TextBox" skin="SandText" position="4 178 332 18" align="Left Top">
<Property key="Caption" value="#{sNear}"/> <Property key="Caption" value="#{sNear}"/>
@ -260,7 +337,11 @@
<Widget type="HBox" position="4 4 350 24"> <Widget type="HBox" position="4 4 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" position="4 4 34 24" align="Left Top" name="WaterShaderButton"/> <Widget type="AutoSizedButton" skin="MW_Button" position="4 4 34 24" align="Left Top" name="WaterShaderButton">
<UserString key="SettingCategory" value="Water"/>
<UserString key="SettingName" value="shader"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" position="42 4 120 24" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" position="42 4 120 24" align="Left Top">
<Property key="Caption" value="Reflection"/> <Property key="Caption" value="Reflection"/>
</Widget> </Widget>
@ -269,21 +350,33 @@
<Widget type="Widget" skin="" position="24 32 300 230"> <Widget type="Widget" skin="" position="24 32 300 230">
<Widget type="HBox" position="4 0 350 24"> <Widget type="HBox" position="4 0 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ReflectActorsButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ReflectActorsButton">
<UserString key="SettingCategory" value="Water"/>
<UserString key="SettingName" value="reflect actors"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Reflect actors"/> <Property key="Caption" value="Reflect actors"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="4 28 350 24"> <Widget type="HBox" position="4 28 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ReflectObjectsButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ReflectObjectsButton">
<UserString key="SettingCategory" value="Water"/>
<UserString key="SettingName" value="reflect statics"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Reflect objects"/> <Property key="Caption" value="Reflect objects"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="4 56 350 24"> <Widget type="HBox" position="4 56 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ReflectTerrainButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ReflectTerrainButton">
<UserString key="SettingCategory" value="Water"/>
<UserString key="SettingName" value="reflect terrain"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Reflect terrain"/> <Property key="Caption" value="Reflect terrain"/>
</Widget> </Widget>
@ -291,7 +384,11 @@
</Widget> </Widget>
<Widget type="HBox" position="4 135 350 24"> <Widget type="HBox" position="4 135 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="RefractionButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="RefractionButton">
<UserString key="SettingCategory" value="Water"/>
<UserString key="SettingName" value="refraction"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Refraction"/> <Property key="Caption" value="Refraction"/>
</Widget> </Widget>
@ -302,7 +399,11 @@
<Property key="Caption" value=" Shadows "/> <Property key="Caption" value=" Shadows "/>
<Widget type="HBox" position="4 4 350 24"> <Widget type="HBox" position="4 4 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ShadowsEnabledButton"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ShadowsEnabledButton">
<UserString key="SettingCategory" value="Shadows"/>
<UserString key="SettingName" value="enabled"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Enabled"/> <Property key="Caption" value="Enabled"/>
</Widget> </Widget>
@ -311,35 +412,52 @@
<Widget type="Widget" skin="" position="24 32 300 230"> <Widget type="Widget" skin="" position="24 32 300 230">
<Widget type="HBox" position="4 0 350 24"> <Widget type="HBox" position="4 0 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ShadowsLargeDistance"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ShadowsLargeDistance">
<UserString key="SettingCategory" value="Shadows"/>
<UserString key="SettingName" value="split"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Large distance (PSSM3)"/> <Property key="Caption" value="Large distance (PSSM3)"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="4 28 350 24"> <Widget type="HBox" position="4 28 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="TerrainShadows"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="TerrainShadows">
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <UserString key="SettingCategory" value="Shadows"/>
<Property key="Caption" value="Terrain shadows"/> <UserString key="SettingName" value="terrain shadows"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="4 56 350 24"> <Widget type="HBox" position="4 56 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ActorShadows"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="ActorShadows">
<UserString key="SettingCategory" value="Shadows"/>
<UserString key="SettingName" value="actor shadows"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Actor shadows"/> <Property key="Caption" value="Actor shadows"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="4 84 350 24"> <Widget type="HBox" position="4 84 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="StaticsShadows"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="StaticsShadows">
<UserString key="SettingCategory" value="Shadows"/>
<UserString key="SettingName" value="statics shadows"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="World shadows"/> <Property key="Caption" value="World shadows"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="4 112 350 24"> <Widget type="HBox" position="4 112 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="MiscShadows"/> <Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="MiscShadows">
<UserString key="SettingCategory" value="Shadows"/>
<UserString key="SettingName" value="misc shadows"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Misc shadows"/> <Property key="Caption" value="Misc shadows"/>
</Widget> </Widget>

@ -8,6 +8,9 @@ resolution y = 600
fullscreen = false fullscreen = false
screen = 0 screen = 0
# Minimize the window if it loses key focus?
minimize on focus loss = true
# Render system # Render system
# blank means default # blank means default
# Valid values: # Valid values:
@ -137,9 +140,7 @@ refraction = true
rtt size = 512 rtt size = 512
reflect terrain = true reflect terrain = true
reflect statics = false reflect statics = false
reflect small statics = false
reflect actors = false reflect actors = false
reflect misc = false
[Sound] [Sound]
# Device name. Blank means default # Device name. Blank means default

@ -157,5 +157,6 @@ void OgreRenderer::setFov(float fov)
void OgreRenderer::windowResized(int x, int y) void OgreRenderer::windowResized(int x, int y)
{ {
if (mWindowListener)
mWindowListener->windowResized(x,y); mWindowListener->windowResized(x,y);
} }

Loading…
Cancel
Save