From 95ce7637f392119e592f8ae9d1ea59c7ec73a8d8 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 10 Apr 2017 10:18:00 +0400 Subject: [PATCH 01/13] Adds persisted pin (feature #2834, bug #2489) --- apps/openmw/mwgui/inventorywindow.cpp | 2 ++ apps/openmw/mwgui/mapwindow.cpp | 11 +++++++++-- apps/openmw/mwgui/spellwindow.cpp | 4 ++++ apps/openmw/mwgui/statswindow.cpp | 4 ++++ apps/openmw/mwgui/windowmanagerimp.cpp | 25 +++++++++++++++++++------ files/settings-default.cfg | 11 +++++++++++ 6 files changed, 49 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 21b90991c..3866c5a96 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -433,6 +433,8 @@ namespace MWGui void InventoryWindow::onPinToggled() { + Settings::Manager::setBool("inventory pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setWeaponVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index 8002dc48a..12d1237b0 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -629,7 +629,7 @@ namespace MWGui , mGlobalMap(0) , mGlobalMapImage(NULL) , mGlobalMapOverlay(NULL) - , mGlobal(false) + , mGlobal(Settings::Manager::getBool("global", "Map")) , mEventBoxGlobal(NULL) , mEventBoxLocal(NULL) , mGlobalMapRender(new MWRender::GlobalMap(localMapRender->getRoot(), workQueue)) @@ -667,7 +667,7 @@ namespace MWGui getWidget(mButton, "WorldButton"); mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked); - mButton->setCaptionWithReplacing("#{sWorld}"); + mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : "#{sWorld}"); getWidget(mEventBoxGlobal, "EventBoxGlobal"); mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag); @@ -680,6 +680,9 @@ namespace MWGui mEventBoxLocal->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onMapDoubleClicked); LocalMapBase::init(mLocalMap, mPlayerArrowLocal, Settings::Manager::getInt("local map widget size", "Map"), Settings::Manager::getInt("local map cell distance", "Map")); + + mGlobalMap->setVisible(mGlobal); + mLocalMap->setVisible(!mGlobal); } void MapWindow::onNoteEditOk() @@ -912,6 +915,8 @@ namespace MWGui mGlobalMap->setVisible(mGlobal); mLocalMap->setVisible(!mGlobal); + Settings::Manager::setBool("global", "Map", mGlobal); + mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : "#{sWorld}"); @@ -921,6 +926,8 @@ namespace MWGui void MapWindow::onPinToggled() { + Settings::Manager::setBool("map pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setMinimapVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index 7c12a8fc2..0c3485e6a 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -4,6 +4,8 @@ #include +#include + #include "../mwbase/windowmanager.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -48,6 +50,8 @@ namespace MWGui void SpellWindow::onPinToggled() { + Settings::Manager::setBool("spells pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setSpellVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index d68c1bcc5..780e4905e 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -6,6 +6,8 @@ #include #include +#include + #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" @@ -672,6 +674,8 @@ namespace MWGui void StatsWindow::onPinToggled() { + Settings::Manager::setBool("stats pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setHMSVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 16d1a9c6d..38aa142c4 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -400,6 +400,11 @@ namespace MWGui allow(GW_ALL); mRestAllowed = !newgame; + + mStatsWindow->setPinned(Settings::Manager::getBool("stats pin", "Windows")); + mMap->setPinned(Settings::Manager::getBool("map pin", "Windows")); + mSpellWindow->setPinned(Settings::Manager::getBool("spells pin", "Windows")); + mInventoryWindow->setPinned(Settings::Manager::getBool("inventory pin", "Windows")); } WindowManager::~WindowManager() @@ -550,15 +555,23 @@ namespace MWGui setSpellVisibility((mAllowed & GW_Magic) && (!mSpellWindow->pinned() || (mForceHidden & GW_Magic))); setHMSVisibility((mAllowed & GW_Stats) && (!mStatsWindow->pinned() || (mForceHidden & GW_Stats))); - // If in game mode, show only the pinned windows - if (gameMode) + // If in game mode (or interactive messagebox), show only the pinned windows + if (mGuiModes.empty()) { mInventoryWindow->setGuiMode(GM_None); - mMap->setVisible(mMap->pinned() && !(mForceHidden & GW_Map)); - mStatsWindow->setVisible(mStatsWindow->pinned() && !(mForceHidden & GW_Stats)); - mInventoryWindow->setVisible(mInventoryWindow->pinned() && !(mForceHidden & GW_Inventory)); - mSpellWindow->setVisible(mSpellWindow->pinned() && !(mForceHidden & GW_Magic)); + mMap->setVisible(mMap->pinned() && !(mForceHidden & GW_Map) && (mAllowed & GW_Map)); + mStatsWindow->setVisible(mStatsWindow->pinned() && !(mForceHidden & GW_Stats) && (mAllowed & GW_Stats)); + mInventoryWindow->setVisible(mInventoryWindow->pinned() && !(mForceHidden & GW_Inventory) && (mAllowed & GW_Inventory)); + mSpellWindow->setVisible(mSpellWindow->pinned() && !(mForceHidden & GW_Magic) && (mAllowed & GW_Magic)); + + return; + } + + // No need to check GUI if game mode + if (gameMode) + { + mInventoryWindow->setGuiMode(GM_None); return; } diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 55f550d5a..6756d0e7a 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -107,6 +107,9 @@ local map widget size = 512 # may result in longer loading times. local map cell distance = 1 +# If true, map in world mode, otherwise in local mode +global = false + [GUI] # Scales GUI window and widget size. (<1.0 is smaller, >1.0 is larger). @@ -365,18 +368,24 @@ stats x = 0.0 stats y = 0.0 stats w = 0.375 stats h = 0.4275 +# Stats window pin status +stats pin = false # Spells window displaying powers, spells, and magical items. spells x = 0.625 spells y = 0.5725 spells w = 0.375 spells h = 0.4275 +# Spells window pin status +spells pin = false # Local and world map window. map x = 0.625 map y = 0.0 map w = 0.375 map h = 0.5725 +# Map window pin status +map pin = false # Dialog window for talking with NPCs. dialogue x = 0.095 @@ -401,6 +410,8 @@ inventory x = 0.0 inventory y = 0.4275 inventory w = 0.6225 inventory h = 0.5725 +# Inventory window pin status +inventory pin = false # Player inventory window when searching a container. inventory container x = 0.0 From c3d49d5ca5737534c04acb62baf07cf8b03d17d9 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 12 Apr 2017 22:57:32 +0400 Subject: [PATCH 02/13] Fixed inventory crash and skipmenu launch --- apps/openmw/mwbase/windowmanager.hpp | 1 + apps/openmw/mwgui/mapwindow.cpp | 2 +- apps/openmw/mwgui/windowmanagerimp.cpp | 27 +++++++++++++++++++------ apps/openmw/mwgui/windowmanagerimp.hpp | 2 ++ apps/openmw/mwstate/statemanagerimp.cpp | 5 +++-- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index f103ce191..6a159ea7d 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -104,6 +104,7 @@ namespace MWBase * new dialogs. */ virtual void update() = 0; + virtual void updateVisible() = 0; /// @note This method will block until the video finishes playing /// (and will continually update the window while doing so) diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index 3d342db44..4d4efeecb 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -780,7 +780,7 @@ namespace MWGui void MapWindow::setVisible(bool visible) { WindowBase::setVisible(visible); - mButton->setVisible(visible && MWBase::Environment::get().getWindowManager()->isGuiMode()); + mButton->setVisible(visible && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_None); } void MapWindow::renderGlobalMap() diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 38aa142c4..119c9f551 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -368,6 +368,8 @@ namespace MWGui mPlayerSkillValues.insert(std::make_pair(ESM::Skill::sSkillIds[i], MWMechanics::SkillValue())); } + updatePinnedWindows(); + // Set up visibility updateVisible(); @@ -400,11 +402,6 @@ namespace MWGui allow(GW_ALL); mRestAllowed = !newgame; - - mStatsWindow->setPinned(Settings::Manager::getBool("stats pin", "Windows")); - mMap->setPinned(Settings::Manager::getBool("map pin", "Windows")); - mSpellWindow->setPinned(Settings::Manager::getBool("spells pin", "Windows")); - mInventoryWindow->setPinned(Settings::Manager::getBool("inventory pin", "Windows")); } WindowManager::~WindowManager() @@ -492,7 +489,6 @@ namespace MWGui void WindowManager::update() { cleanupGarbage(); - mHud->update(); } @@ -560,6 +556,12 @@ namespace MWGui { mInventoryWindow->setGuiMode(GM_None); + // If game is not running, we can't be sure that widgets are initialized properly + MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState(); + + if (state != MWBase::StateManager::State_Running) + return; + mMap->setVisible(mMap->pinned() && !(mForceHidden & GW_Map) && (mAllowed & GW_Map)); mStatsWindow->setVisible(mStatsWindow->pinned() && !(mForceHidden & GW_Stats) && (mAllowed & GW_Stats)); mInventoryWindow->setVisible(mInventoryWindow->pinned() && !(mForceHidden & GW_Inventory) && (mAllowed & GW_Inventory)); @@ -1709,6 +1711,8 @@ namespace MWGui mCompanionWindow->resetReference(); mConsole->resetReference(); + mInventoryWindow->rebuildAvatar(); + mSelectedSpell.clear(); mCustomMarkers.clear(); @@ -1868,6 +1872,17 @@ namespace MWGui mVideoWidget->stop(); } + void WindowManager::updatePinnedWindows() + { + mInventoryWindow->setPinned(Settings::Manager::getBool("inventory pin", "Windows")); + + mMap->setPinned(Settings::Manager::getBool("map pin", "Windows")); + + mSpellWindow->setPinned(Settings::Manager::getBool("spells pin", "Windows")); + + mStatsWindow->setPinned(Settings::Manager::getBool("stats pin", "Windows")); + } + void WindowManager::pinWindow(GuiWindow window) { switch (window) diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index a8f6263c2..40ebe8bbd 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -362,6 +362,8 @@ namespace MWGui virtual void pinWindow (MWGui::GuiWindow window); + virtual void updatePinnedWindows (); + /// Fade the screen in, over \a time seconds virtual void fadeScreenIn(const float time, bool clearQueue); /// Fade the screen out to black, over \a time seconds diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index 64c543fb1..067cf481f 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -139,8 +139,7 @@ void MWState::StateManager::newGame (bool bypass) { cleanup(); - if (!bypass) - MWBase::Environment::get().getWindowManager()->setNewGame (true); + MWBase::Environment::get().getWindowManager()->setNewGame (!bypass); try { @@ -149,6 +148,8 @@ void MWState::StateManager::newGame (bool bypass) MWBase::Environment::get().getWorld()->startNewGame (bypass); mState = State_Running; + + MWBase::Environment::get().getWindowManager()->updateVisible(); } catch (std::exception& e) { From 8581d68b8e05ef02d46d213704598c948b33ad99 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 14 Apr 2017 22:46:24 +0400 Subject: [PATCH 03/13] Updated documentation for windows settings --- .../source/reference/modding/settings/map.rst | 11 +++ .../reference/modding/settings/windows.rst | 81 ++++++++++++------- 2 files changed, 61 insertions(+), 31 deletions(-) diff --git a/docs/source/reference/modding/settings/map.rst b/docs/source/reference/modding/settings/map.rst index f3e0a1c53..c120cf020 100644 --- a/docs/source/reference/modding/settings/map.rst +++ b/docs/source/reference/modding/settings/map.rst @@ -51,3 +51,14 @@ local map widget size This setting controls the canvas size of the GUI mode local map window. Larger values result in a larger physical map size on screen, and typically require more panning to see all available portions of the map. This larger size also enables an overall greater level of detail if the local map resolution setting is also increased. The default value for this setting is 512. This setting can not be configured except by editing the settings configuration file. + +global +------ + +:Type: boolean +:Range: True/False +:Default: False + +If this setting is true, a world map on a map window will be displayed, otherwise a local map will be displayed. + +The default value is false. This setting can be toggled with the Local/World map switch button on the map window. diff --git a/docs/source/reference/modding/settings/windows.rst b/docs/source/reference/modding/settings/windows.rst index 8860de983..bafcac295 100644 --- a/docs/source/reference/modding/settings/windows.rst +++ b/docs/source/reference/modding/settings/windows.rst @@ -18,6 +18,21 @@ Each window in the GUI mode remembers it's previous location when exiting the ga .. note:: To scale the windows, making the widgets proportionally larger, see the scaling factor setting instead. +:Type: boolean +:Range: True/False + +This section controls the state of pinnable windows: pinned or not. For example, to pin only the map window, the actual settings will be:: + + inventory pin = false + map pin = true + stats pin = false + spells pin = false + +The pinnable window can be pinned/unpinned by clicking on a button in the right upper corner of the window. + +.. note:: + A world/local map switch button on the map window will be showed only in GUI mode. + stats ----- @@ -25,6 +40,7 @@ stats y = 0.0 h = 0.375 w = 0.4275 + pin = false The stats window, displaying level, race, class, skills and stats. Activated by clicking on any of the three bars in the lower left corner of the HUD. @@ -35,6 +51,7 @@ spells y = 0.5725 h = 0.375 w = 0.4275 + pin = false The spells window, displaying powers, spells, and magical items. Activated by clicking on the spells widget (third from left) in the bottom left corner of the HUD. @@ -45,39 +62,10 @@ map y = 0.0 h = 0.375 w = 0.5725 + pin = false The local and world map window. Activated by clicking on the map widget in the bottom right corner of the HUD. -dialogue --------- - -:Default: x = 0.095 - y = 0.095 - h = 0.810 - w = 0.810 - -The dialog window, for talking with NPCs. Activated by clicking on a NPC. - -alchemy -------- - -:Default: x = 0.25 - y = 0.25 - h = 0.5 - w = 0.5 - -The alchemy window, for crafting potions. Activated by dragging an alchemy tool on to the rag doll. Unlike most other windows, this window hides all other windows when opened. - -console -------- - -:Default: x = 0.0 - y = 0.0 - h = 1.0 - w = 0.5 - -The console command window. Activated by pressing the tilde (~) key. - inventory --------- @@ -85,6 +73,7 @@ inventory y = 0.4275 h = 0.6225 w = 0.5725 + pin = false The inventory window, displaying the paper doll and possessions, when activated by clicking on the inventory widget (second from left) in the bottom left corner of the HUD. @@ -146,4 +135,34 @@ companion h = 0.75 w = 0.375 -The NPC's inventory window while interacting with a companion. The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. \ No newline at end of file +The NPC's inventory window while interacting with a companion. The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. + +dialogue +-------- + +:Default: x = 0.095 + y = 0.095 + h = 0.810 + w = 0.810 + +The dialog window, for talking with NPCs. Activated by clicking on a NPC. + +alchemy +------- + +:Default: x = 0.25 + y = 0.25 + h = 0.5 + w = 0.5 + +The alchemy window, for crafting potions. Activated by dragging an alchemy tool on to the rag doll. Unlike most other windows, this window hides all other windows when opened. + +console +------- + +:Default: x = 0.0 + y = 0.0 + h = 1.0 + w = 0.5 + +The console command window. Activated by pressing the tilde (~) key. From 2e5fd74db0c3f0b6db9a4aafebcc86b9d991c273 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 19:09:38 +0900 Subject: [PATCH 04/13] Fix invalid iterator warning --- apps/openmw/mwmechanics/actors.cpp | 14 ++------------ apps/openmw/mwmechanics/aisequence.cpp | 8 ++++---- apps/openmw/mwmechanics/aisequence.hpp | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 1ae0e36a9..2e200d6c3 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -114,9 +114,7 @@ void adjustCommandedActor (const MWWorld::Ptr& actor) } if (!check.mCommanded && hasCommandPackage) - { stats.getAiSequence().erase(it); - } } void getRestorationPerHourOfSleep (const MWWorld::Ptr& ptr, float& health, float& magicka) @@ -707,16 +705,8 @@ namespace MWMechanics // any value of calm > 0 will stop the actor from fighting if ((effects.get(ESM::MagicEffect::CalmHumanoid).getMagnitude() > 0 && ptr.getClass().isNpc()) - || (effects.get(ESM::MagicEffect::CalmCreature).getMagnitude() > 0 && !ptr.getClass().isNpc())) - { - for (std::list::const_iterator it = creatureStats.getAiSequence().begin(); it != creatureStats.getAiSequence().end(); ) - { - if ((*it)->getTypeId() == AiPackage::TypeIdCombat) - it = creatureStats.getAiSequence().erase(it); - else - ++it; - } - } + || (effects.get(ESM::MagicEffect::CalmCreature).getMagnitude() > 0 && !ptr.getClass().isNpc())) + creatureStats.getAiSequence().stopCombat(); // Update bound effects // Note: in vanilla MW multiple bound items of the same type can be created by different spells. diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index 84c8eca49..125805507 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -96,16 +96,16 @@ std::list::const_iterator AiSequence::end() const return mPackages.end(); } -std::list::const_iterator AiSequence::erase(std::list::const_iterator package) +void AiSequence::erase(std::list::const_iterator package) { // Not sure if manually terminated packages should trigger mDone, probably not? for(std::list::iterator it = mPackages.begin(); it != mPackages.end(); ++it) { if (package == it) { - AiPackage* packagePtr = *it; - delete packagePtr; - return mPackages.erase(it); + delete *it; + mPackages.erase(it); + return; } } throw std::runtime_error("can't find package to erase"); diff --git a/apps/openmw/mwmechanics/aisequence.hpp b/apps/openmw/mwmechanics/aisequence.hpp index 4f8b542a4..4b6ec156a 100644 --- a/apps/openmw/mwmechanics/aisequence.hpp +++ b/apps/openmw/mwmechanics/aisequence.hpp @@ -64,7 +64,7 @@ namespace MWMechanics std::list::const_iterator begin() const; std::list::const_iterator end() const; - std::list::const_iterator erase (std::list::const_iterator package); + void erase (std::list::const_iterator package); /// Returns currently executing AiPackage type /** \see enum AiPackage::TypeId **/ From ff3e307059ace308c2aebb9fbf89329368472583 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 20:36:14 +0900 Subject: [PATCH 05/13] Pass parameters by const reference --- apps/openmw/mwmechanics/actors.cpp | 4 ++-- apps/openmw/mwmechanics/aiwander.cpp | 2 +- apps/openmw/mwmechanics/aiwander.hpp | 2 +- apps/openmw/mwmechanics/character.cpp | 2 +- apps/openmw/mwmechanics/character.hpp | 2 +- apps/openmw/mwmechanics/enchanting.cpp | 8 ++++---- apps/openmw/mwmechanics/enchanting.hpp | 8 ++++---- apps/openmw/mwmechanics/pathfinding.cpp | 2 +- apps/openmw/mwphysics/physicssystem.cpp | 6 +++--- apps/openmw/mwphysics/physicssystem.hpp | 2 +- apps/openmw/mwrender/animation.cpp | 6 +++--- apps/openmw/mwrender/animation.hpp | 2 +- apps/openmw/mwrender/characterpreview.cpp | 4 ++-- apps/openmw/mwrender/characterpreview.hpp | 4 ++-- apps/openmw/mwrender/npcanimation.cpp | 6 +++--- apps/openmw/mwrender/objects.hpp | 2 +- apps/openmw/mwrender/util.cpp | 2 +- apps/openmw/mwscript/interpretercontext.cpp | 2 +- apps/openmw/mwscript/interpretercontext.hpp | 2 +- apps/openmw/mwworld/player.cpp | 2 +- apps/openmw/mwworld/player.hpp | 2 +- apps/openmw/mwworld/worldimp.cpp | 2 +- components/esm/esmwriter.hpp | 2 +- components/nifosg/controller.cpp | 6 +++--- components/nifosg/controller.hpp | 6 +++--- 25 files changed, 44 insertions(+), 44 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 2e200d6c3..3e37408b2 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -78,7 +78,7 @@ class CheckActorCommanded : public MWMechanics::EffectSourceVisitor MWWorld::Ptr mActor; public: bool mCommanded; - CheckActorCommanded(MWWorld::Ptr actor) + CheckActorCommanded(const MWWorld::Ptr& actor) : mActor(actor) , mCommanded(false){} @@ -149,7 +149,7 @@ namespace MWMechanics MWWorld::Ptr mActor; bool mTrapped; public: - SoulTrap(MWWorld::Ptr trappedCreature) + SoulTrap(const MWWorld::Ptr& trappedCreature) : mCreature(trappedCreature) , mTrapped(false) { diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index 5396b5b39..eba37d7a7 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -893,7 +893,7 @@ namespace MWMechanics storage.mAllowedNodes.push_back(PathFinder::MakePathgridPoint(vectorStart + delta)); } - void AiWander::SetCurrentNodeToClosestAllowedNode(osg::Vec3f npcPos, AiWanderStorage& storage) + void AiWander::SetCurrentNodeToClosestAllowedNode(const osg::Vec3f& npcPos, AiWanderStorage& storage) { float distanceToClosestNode = std::numeric_limits::max(); unsigned int index = 0; diff --git a/apps/openmw/mwmechanics/aiwander.hpp b/apps/openmw/mwmechanics/aiwander.hpp index f9b03ca5e..13a4a1b4a 100644 --- a/apps/openmw/mwmechanics/aiwander.hpp +++ b/apps/openmw/mwmechanics/aiwander.hpp @@ -122,7 +122,7 @@ namespace MWMechanics /// convert point from local (i.e. cell) to world coordinates void ToWorldCoordinates(ESM::Pathgrid::Point& point, const ESM::Cell * cell); - void SetCurrentNodeToClosestAllowedNode(osg::Vec3f npcPos, AiWanderStorage& storage); + void SetCurrentNodeToClosestAllowedNode(const osg::Vec3f& npcPos, AiWanderStorage& storage); void AddNonPathGridAllowedPoints(osg::Vec3f npcPos, const ESM::Pathgrid * pathGrid, int pointIndex, AiWanderStorage& storage); diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 85749d947..b71f31550 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -2242,7 +2242,7 @@ void CharacterController::setAttackingOrSpell(bool attackingOrSpell) mAttackingOrSpell = attackingOrSpell; } -void CharacterController::setAIAttackType(std::string attackType) +void CharacterController::setAIAttackType(const std::string& attackType) { mAttackType = attackType; } diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index 9db127084..a3cdf097d 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -268,7 +268,7 @@ public: bool isSneaking() const; void setAttackingOrSpell(bool attackingOrSpell); - void setAIAttackType(std::string attackType); // set and used by AiCombat + void setAIAttackType(const std::string& attackType); static void setAttackTypeRandomly(std::string& attackType); bool readyToPrepareAttack() const; diff --git a/apps/openmw/mwmechanics/enchanting.cpp b/apps/openmw/mwmechanics/enchanting.cpp index 57ece6a79..714b5a09c 100644 --- a/apps/openmw/mwmechanics/enchanting.cpp +++ b/apps/openmw/mwmechanics/enchanting.cpp @@ -21,7 +21,7 @@ namespace MWMechanics , mSelfEnchanting(false) {} - void Enchanting::setOldItem(MWWorld::Ptr oldItem) + void Enchanting::setOldItem(const MWWorld::Ptr& oldItem) { mOldItemPtr=oldItem; if(!itemEmpty()) @@ -39,7 +39,7 @@ namespace MWMechanics mNewItemName=s; } - void Enchanting::setEffect(ESM::EffectList effectList) + void Enchanting::setEffect(const ESM::EffectList& effectList) { mEffectList=effectList; } @@ -49,7 +49,7 @@ namespace MWMechanics return mCastStyle; } - void Enchanting::setSoulGem(MWWorld::Ptr soulGem) + void Enchanting::setSoulGem(const MWWorld::Ptr& soulGem) { mSoulGemPtr=soulGem; } @@ -269,7 +269,7 @@ namespace MWMechanics mSelfEnchanting = selfEnchanting; } - void Enchanting::setEnchanter(MWWorld::Ptr enchanter) + void Enchanting::setEnchanter(const MWWorld::Ptr& enchanter) { mEnchanter = enchanter; } diff --git a/apps/openmw/mwmechanics/enchanting.hpp b/apps/openmw/mwmechanics/enchanting.hpp index a53027bb9..8e3b00e5a 100644 --- a/apps/openmw/mwmechanics/enchanting.hpp +++ b/apps/openmw/mwmechanics/enchanting.hpp @@ -29,14 +29,14 @@ namespace MWMechanics public: Enchanting(); - void setEnchanter(MWWorld::Ptr enchanter); + void setEnchanter(const MWWorld::Ptr& enchanter); void setSelfEnchanting(bool selfEnchanting); - void setOldItem(MWWorld::Ptr oldItem); + void setOldItem(const MWWorld::Ptr& oldItem); MWWorld::Ptr getOldItem() { return mOldItemPtr; } MWWorld::Ptr getGem() { return mSoulGemPtr; } void setNewItemName(const std::string& s); - void setEffect(ESM::EffectList effectList); - void setSoulGem(MWWorld::Ptr soulGem); + void setEffect(const ESM::EffectList& effectList); + void setSoulGem(const MWWorld::Ptr& soulGem); bool create(); //Return true if created, false if failed. void nextCastStyle(); //Set enchant type to next possible type (for mOldItemPtr object) int getCastStyle() const; diff --git a/apps/openmw/mwmechanics/pathfinding.cpp b/apps/openmw/mwmechanics/pathfinding.cpp index b0bdce8f1..5c0456096 100644 --- a/apps/openmw/mwmechanics/pathfinding.cpp +++ b/apps/openmw/mwmechanics/pathfinding.cpp @@ -15,7 +15,7 @@ namespace // Chooses a reachable end pathgrid point. start is assumed reachable. std::pair getClosestReachablePoint(const ESM::Pathgrid* grid, const MWWorld::CellStore *cell, - const osg::Vec3f pos, int start) + const osg::Vec3f& pos, int start) { assert(grid && !grid->mPoints.empty()); diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 40805a4b1..d209d0d95 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -794,7 +794,7 @@ namespace MWPhysics btVector3 mContactPoint; btScalar mLeastDistSqr; - DeepestNotMeContactTestResultCallback(const btCollisionObject* me, const std::vector targets, const btVector3 &origin) + DeepestNotMeContactTestResultCallback(const btCollisionObject* me, const std::vector& targets, const btVector3 &origin) : mMe(me), mTargets(targets), mOrigin(origin), mObject(NULL), mContactPoint(0,0,0), mLeastDistSqr(std::numeric_limits::max()) { } @@ -912,7 +912,7 @@ namespace MWPhysics class ClosestNotMeRayResultCallback : public btCollisionWorld::ClosestRayResultCallback { public: - ClosestNotMeRayResultCallback(const btCollisionObject* me, const std::vector targets, const btVector3& from, const btVector3& to) + ClosestNotMeRayResultCallback(const btCollisionObject* me, const std::vector& targets, const btVector3& from, const btVector3& to) : btCollisionWorld::ClosestRayResultCallback(from, to) , mMe(me), mTargets(targets) { @@ -938,7 +938,7 @@ namespace MWPhysics const std::vector mTargets; }; - PhysicsSystem::RayResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, MWWorld::ConstPtr ignore, std::vector targets, int mask, int group) const + PhysicsSystem::RayResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore, std::vector targets, int mask, int group) const { btVector3 btFrom = toBullet(from); btVector3 btTo = toBullet(to); diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index 81385d675..5351d99dd 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -114,7 +114,7 @@ namespace MWPhysics }; /// @param me Optional, a Ptr to ignore in the list of results. targets are actors to filter for, ignoring all other actors. - RayResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, MWWorld::ConstPtr ignore = MWWorld::ConstPtr(), + RayResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore = MWWorld::ConstPtr(), std::vector targets = std::vector(), int mask = CollisionType_World|CollisionType_HeightMap|CollisionType_Actor|CollisionType_Door, int group=0xff) const; diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index fe20ac437..c825e74f2 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -282,7 +282,7 @@ namespace MWRender class GlowUpdater : public SceneUtil::StateSetUpdater { public: - GlowUpdater(int texUnit, osg::Vec4f color, const std::vector >& textures, + GlowUpdater(int texUnit, const osg::Vec4f& color, const std::vector >& textures, osg::Node* node, float duration, Resource::ResourceSystem* resourcesystem) : mTexUnit(texUnit) , mColor(color) @@ -383,7 +383,7 @@ namespace MWRender return mDone; } - void setColor(osg::Vec4f color) + void setColor(const osg::Vec4f& color) { mColor = color; mColorChanged = true; @@ -1362,7 +1362,7 @@ namespace MWRender useQuadratic, quadraticValue, quadraticRadiusMult, useLinear, linearRadiusMult, linearValue); } - void Animation::addEffect (const std::string& model, int effectId, bool loop, const std::string& bonename, std::string texture) + void Animation::addEffect (const std::string& model, int effectId, bool loop, const std::string& bonename, const std::string& texture) { if (!mObjectRoot.get()) return; diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index 27572544f..202595182 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -362,7 +362,7 @@ public: * @param texture override the texture specified in the model's materials - if empty, do not override * @note Will not add an effect twice. */ - void addEffect (const std::string& model, int effectId, bool loop = false, const std::string& bonename = "", std::string texture = ""); + void addEffect (const std::string& model, int effectId, bool loop = false, const std::string& bonename = "", const std::string& texture = ""); void removeEffect (int effectId); void getLoopingEffects (std::vector& out) const; diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index dfb737d5e..db778e88d 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -105,7 +105,7 @@ namespace MWRender }; CharacterPreview::CharacterPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, - MWWorld::Ptr character, int sizeX, int sizeY, const osg::Vec3f& position, const osg::Vec3f& lookAt) + const MWWorld::Ptr& character, int sizeX, int sizeY, const osg::Vec3f& position, const osg::Vec3f& lookAt) : mParent(parent) , mResourceSystem(resourceSystem) , mPosition(position) @@ -244,7 +244,7 @@ namespace MWRender // -------------------------------------------------------------------------------------------------- - InventoryPreview::InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character) + InventoryPreview::InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, const MWWorld::Ptr& character) : CharacterPreview(parent, resourceSystem, character, 512, 1024, osg::Vec3f(0, 700, 71), osg::Vec3f(0,0,71)) { } diff --git a/apps/openmw/mwrender/characterpreview.hpp b/apps/openmw/mwrender/characterpreview.hpp index 273bacedb..f0d5ad0c9 100644 --- a/apps/openmw/mwrender/characterpreview.hpp +++ b/apps/openmw/mwrender/characterpreview.hpp @@ -28,7 +28,7 @@ namespace MWRender class CharacterPreview { public: - CharacterPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character, int sizeX, int sizeY, + CharacterPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, const MWWorld::Ptr& character, int sizeX, int sizeY, const osg::Vec3f& position, const osg::Vec3f& lookAt); virtual ~CharacterPreview(); @@ -73,7 +73,7 @@ namespace MWRender { public: - InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character); + InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, const MWWorld::Ptr& character); void updatePtr(const MWWorld::Ptr& ptr); diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 87b6ae2bc..6e95ce481 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -99,7 +99,7 @@ private: private: void resetBlinkTimer(); public: - HeadAnimationTime(MWWorld::Ptr reference); + HeadAnimationTime(const MWWorld::Ptr& reference); void updatePtr(const MWWorld::Ptr& updated); @@ -128,7 +128,7 @@ public: { } - void setOffset(osg::Vec3f offset) + void setOffset(const osg::Vec3f& offset) { mOffset = offset; } @@ -155,7 +155,7 @@ private: // -------------------------------------------------------------------------------------------------------------- -HeadAnimationTime::HeadAnimationTime(MWWorld::Ptr reference) +HeadAnimationTime::HeadAnimationTime(const MWWorld::Ptr& reference) : mReference(reference), mTalkStart(0), mTalkStop(0), mBlinkStart(0), mBlinkStop(0), mEnabled(true), mValue(0) { resetBlinkTimer(); diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index 8864e4483..659853763 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -37,7 +37,7 @@ class Animation; class PtrHolder : public osg::Object { public: - PtrHolder(MWWorld::Ptr ptr) + PtrHolder(const MWWorld::Ptr& ptr) : mPtr(ptr) { } diff --git a/apps/openmw/mwrender/util.cpp b/apps/openmw/mwrender/util.cpp index 74047b58b..ed10d86ac 100644 --- a/apps/openmw/mwrender/util.cpp +++ b/apps/openmw/mwrender/util.cpp @@ -14,7 +14,7 @@ namespace MWRender class TextureOverrideVisitor : public osg::NodeVisitor { public: - TextureOverrideVisitor(std::string texture, Resource::ResourceSystem* resourcesystem) + TextureOverrideVisitor(const std::string& texture, Resource::ResourceSystem* resourcesystem) : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) , mTexture(texture) , mResourcesystem(resourcesystem) diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 0c70b6996..2462d72ae 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -137,7 +137,7 @@ namespace MWScript InterpreterContext::InterpreterContext ( - MWScript::Locals *locals, MWWorld::Ptr reference, const std::string& targetId) + MWScript::Locals *locals, const MWWorld::Ptr& reference, const std::string& targetId) : mLocals (locals), mReference (reference), mTargetId (targetId) { // If we run on a reference (local script, dialogue script or console with object diff --git a/apps/openmw/mwscript/interpretercontext.hpp b/apps/openmw/mwscript/interpretercontext.hpp index fdd5aa55f..80861d1a7 100644 --- a/apps/openmw/mwscript/interpretercontext.hpp +++ b/apps/openmw/mwscript/interpretercontext.hpp @@ -51,7 +51,7 @@ namespace MWScript public: - InterpreterContext (MWScript::Locals *locals, MWWorld::Ptr reference, + InterpreterContext (MWScript::Locals *locals, const MWWorld::Ptr& reference, const std::string& targetId = ""); ///< The ownership of \a locals is not transferred. 0-pointer allowed. diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index fe13a4d60..d233fba6f 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -255,7 +255,7 @@ namespace MWWorld return MWBase::Environment::get().getMechanicsManager()->getEnemiesNearby(getPlayer()).size() != 0; } - void Player::markPosition(CellStore *markedCell, ESM::Position markedPosition) + void Player::markPosition(CellStore *markedCell, const ESM::Position& markedPosition) { mMarkedCell = markedCell; mMarkedPosition = markedPosition; diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 157501803..4ba66e37e 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -61,7 +61,7 @@ namespace MWWorld void setWerewolfSkillsAttributes(); // For mark/recall magic effects - void markPosition (CellStore* markedCell, ESM::Position markedPosition); + void markPosition (CellStore* markedCell, const ESM::Position& markedPosition); void getMarkedPosition (CellStore*& markedCell, ESM::Position& markedPosition) const; /// Interiors can not always be mapped to a world position. However diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 6ae348966..1d7e6efba 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2989,7 +2989,7 @@ namespace MWWorld struct AddDetectedReferenceVisitor { - AddDetectedReferenceVisitor(std::vector& out, Ptr detector, World::DetectionType type, float squaredDist) + AddDetectedReferenceVisitor(std::vector& out, const Ptr& detector, World::DetectionType type, float squaredDist) : mOut(out), mDetector(detector), mSquaredDist(squaredDist), mType(type) { } diff --git a/components/esm/esmwriter.hpp b/components/esm/esmwriter.hpp index d11b3c940..5d7aebaf9 100644 --- a/components/esm/esmwriter.hpp +++ b/components/esm/esmwriter.hpp @@ -86,7 +86,7 @@ private: // Prevent using writeHNT with strings. This already happened by accident and results in // state being discarded without any error on writing or reading it. :( // writeHNString and friends must be used instead. - void writeHNT(const std::string &name, std::string data) + void writeHNT(const std::string& name, const std::string& data) { } void writeT(const std::string& data) diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index 8d0c73bff..87a0b830e 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -218,7 +218,7 @@ UVController::UVController() { } -UVController::UVController(const Nif::NiUVData *data, std::set textureUnits) +UVController::UVController(const Nif::NiUVData *data, const std::set& textureUnits) : mUTrans(data->mKeyList[0], 0.f) , mVTrans(data->mKeyList[1], 0.f) , mUScale(data->mKeyList[2], 1.f) @@ -381,14 +381,14 @@ void MaterialColorController::apply(osg::StateSet *stateset, osg::NodeVisitor *n } } -FlipController::FlipController(const Nif::NiFlipController *ctrl, std::vector > textures) +FlipController::FlipController(const Nif::NiFlipController *ctrl, const std::vector >& textures) : mTexSlot(ctrl->mTexSlot) , mDelta(ctrl->mDelta) , mTextures(textures) { } -FlipController::FlipController(int texSlot, float delta, std::vector > textures) +FlipController::FlipController(int texSlot, float delta, const std::vector >& textures) : mTexSlot(texSlot) , mDelta(delta) , mTextures(textures) diff --git a/components/nifosg/controller.hpp b/components/nifosg/controller.hpp index ce268f587..e517f9189 100644 --- a/components/nifosg/controller.hpp +++ b/components/nifosg/controller.hpp @@ -223,7 +223,7 @@ namespace NifOsg public: UVController(); UVController(const UVController&,const osg::CopyOp&); - UVController(const Nif::NiUVData *data, std::set textureUnits); + UVController(const Nif::NiUVData *data, const std::set& textureUnits); META_Object(NifOsg,UVController) @@ -297,8 +297,8 @@ namespace NifOsg std::vector > mTextures; public: - FlipController(const Nif::NiFlipController* ctrl, std::vector > textures); - FlipController(int texSlot, float delta, std::vector > textures); + FlipController(const Nif::NiFlipController* ctrl, const std::vector >& textures); + FlipController(int texSlot, float delta, const std::vector >& textures); FlipController(); FlipController(const FlipController& copy, const osg::CopyOp& copyop); From 60c67bc327c24205afff66afe17d7ffafed32760 Mon Sep 17 00:00:00 2001 From: Allofich Date: Fri, 21 Apr 2017 03:55:28 +0900 Subject: [PATCH 06/13] Run scripts for voiced dialogue (Fixes #3787) --- apps/openmw/mwbase/dialoguemanager.hpp | 2 +- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 23 +++++++++++-------- apps/openmw/mwdialogue/dialoguemanagerimp.hpp | 6 ++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/apps/openmw/mwbase/dialoguemanager.hpp b/apps/openmw/mwbase/dialoguemanager.hpp index 1fe63e633..18f249e56 100644 --- a/apps/openmw/mwbase/dialoguemanager.hpp +++ b/apps/openmw/mwbase/dialoguemanager.hpp @@ -50,7 +50,7 @@ namespace MWBase virtual void goodbye() = 0; - virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const = 0; + virtual void say(const MWWorld::Ptr &actor, const std::string &topic) = 0; //calbacks for the GUI virtual void keywordSelected (const std::string& keyword) = 0; diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 254bc7d47..489d726e6 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -171,7 +171,7 @@ namespace MWDialogue MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor); win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext)); - executeScript (info->mResultScript); + executeScript (info->mResultScript, mActor); mLastTopic = Misc::StringUtils::lowerCase(it->mId); // update topics again to accommodate changes resulting from executeScript @@ -190,7 +190,7 @@ namespace MWDialogue MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor); } - bool DialogueManager::compile (const std::string& cmd,std::vector& code) + bool DialogueManager::compile (const std::string& cmd, std::vector& code, const MWWorld::Ptr& actor) { bool success = true; @@ -206,7 +206,7 @@ namespace MWDialogue Compiler::Locals locals; - std::string actorScript = mActor.getClass().getScript (mActor); + std::string actorScript = actor.getClass().getScript (actor); if (!actorScript.empty()) { @@ -246,14 +246,14 @@ namespace MWDialogue return success; } - void DialogueManager::executeScript (const std::string& script) + void DialogueManager::executeScript (const std::string& script, const MWWorld::Ptr& actor) { std::vector code; - if(compile(script,code)) + if(compile(script, code, actor)) { try { - MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor); + MWScript::InterpreterContext interpreterContext(&actor.getRefData().getLocals(), actor); Interpreter::Interpreter interpreter; MWScript::installOpcodes (interpreter); interpreter.run (&code[0], code.size(), interpreterContext); @@ -317,7 +317,7 @@ namespace MWDialogue } } - executeScript (info->mResultScript); + executeScript (info->mResultScript, mActor); mLastTopic = topic; } @@ -500,7 +500,7 @@ namespace MWDialogue } } - executeScript (info->mResultScript); + executeScript (info->mResultScript, mActor); } else { @@ -618,13 +618,13 @@ namespace MWDialogue win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext), gmsts.find ("sServiceRefusal")->getString()); - executeScript (info->mResultScript); + executeScript (info->mResultScript, mActor); return true; } return false; } - void DialogueManager::say(const MWWorld::Ptr &actor, const std::string &topic) const + void DialogueManager::say(const MWWorld::Ptr &actor, const std::string &topic) { MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); if(!sndMgr->sayDone(actor)) @@ -647,6 +647,9 @@ namespace MWDialogue if (!info->mSound.empty()) sndMgr->say(actor, info->mSound); } + + if (!info->mResultScript.empty()) + executeScript(info->mResultScript, actor); } int DialogueManager::countSavedGameRecords() const diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.hpp b/apps/openmw/mwdialogue/dialoguemanagerimp.hpp index bbe42975c..40a24a1f8 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.hpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.hpp @@ -51,8 +51,8 @@ namespace MWDialogue void updateTopics(); void updateGlobals(); - bool compile (const std::string& cmd,std::vector& code); - void executeScript (const std::string& script); + bool compile (const std::string& cmd, std::vector& code, const MWWorld::Ptr& actor); + void executeScript (const std::string& script, const MWWorld::Ptr& actor); void executeTopic (const std::string& topic); @@ -74,7 +74,7 @@ namespace MWDialogue virtual bool checkServiceRefused (); - virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const; + virtual void say(const MWWorld::Ptr &actor, const std::string &topic); //calbacks for the GUI virtual void keywordSelected (const std::string& keyword); From ff3cb18d4f8448f4de82d8de4e0611740e6ed244 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 20:44:42 +0900 Subject: [PATCH 07/13] Fix shadowing warnings --- apps/openmw/mwgui/charactercreation.cpp | 4 ++-- apps/openmw/mwmechanics/actors.cpp | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index b2c9f1038..2deb62215 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -246,8 +246,8 @@ namespace MWGui mReviewDialog->setBirthSign(player.getBirthSign()); { - MWWorld::Ptr player = MWMechanics::getPlayer(); - const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); + MWWorld::Ptr playerPtr = MWMechanics::getPlayer(); + const MWMechanics::CreatureStats& stats = playerPtr.getClass().getCreatureStats(playerPtr); mReviewDialog->setHealth ( stats.getHealth() ); mReviewDialog->setMagicka( stats.getMagicka() ); diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 3e37408b2..4916058f6 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -795,7 +795,7 @@ namespace MWMechanics NpcStats &stats = ptr.getClass().getNpcStats(ptr); // When npc stats are just initialized, mTimeToStartDrowning == -1 and we should get value from GMST - static const int fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get().find("fHoldBreathTime")->getFloat(); + static const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get().find("fHoldBreathTime")->getFloat(); if (stats.getTimeToStartDrowning() == -1.f) stats.setTimeToStartDrowning(fHoldBreathTime); @@ -835,10 +835,7 @@ namespace MWMechanics } } else - { - static const float fHoldBreathTime = world->getStore().get().find("fHoldBreathTime")->getFloat(); stats.setTimeToStartDrowning(fHoldBreathTime); - } } void Actors::updateEquippedLight (const MWWorld::Ptr& ptr, float duration) From f67ec9c9ce13ef0e743b25e8f7e67fc19ef69b26 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 21 Apr 2017 09:40:25 +0400 Subject: [PATCH 08/13] Use sLevel GMST instead of hardcoded text in load game menu --- apps/openmw/mwgui/savegamedialog.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index cbc95e808..ca4d9cdc4 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -168,9 +169,9 @@ namespace MWGui className = "?"; // From an older savegame format that did not support custom classes properly. } - title << " (Level " << it->getSignature().mPlayerLevel << " " << className << ")"; + title << " (#{sLevel} " << it->getSignature().mPlayerLevel << " " << className << ")"; - mCharacterSelection->addItem (title.str()); + mCharacterSelection->addItem (MyGUI::LanguageManager::getInstance().replaceTags(title.str())); if (mCurrentCharacter == &*it || (!mCurrentCharacter && !mSaving && directory==Misc::StringUtils::lowerCase ( From e717d046f24ad33534e7431546f2beed74b0313b Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 21 Apr 2017 17:21:57 +0400 Subject: [PATCH 09/13] Escaped class name string --- apps/openmw/mwgui/savegamedialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index ca4d9cdc4..84d4ca959 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -169,7 +169,7 @@ namespace MWGui className = "?"; // From an older savegame format that did not support custom classes properly. } - title << " (#{sLevel} " << it->getSignature().mPlayerLevel << " " << className << ")"; + title << " (#{sLevel} " << it->getSignature().mPlayerLevel << " " << MyGUI::TextIterator::toTagsString(className) << ")"; mCharacterSelection->addItem (MyGUI::LanguageManager::getInstance().replaceTags(title.str())); From e095817ac2a8c7f8ab7f9f585b4a2d4cb9dcb3e3 Mon Sep 17 00:00:00 2001 From: Allofich Date: Fri, 21 Apr 2017 19:57:30 +0900 Subject: [PATCH 10/13] Treat =< and => as == in scripts (Fixes #3744) --- components/compiler/scanner.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/compiler/scanner.cpp b/components/compiler/scanner.cpp index 720fde9f1..c2ec13b01 100644 --- a/components/compiler/scanner.cpp +++ b/components/compiler/scanner.cpp @@ -408,6 +408,11 @@ namespace Compiler special = S_cmpEQ; else if (c=='=') special = S_cmpEQ; + else if (c == '>' || c == '<') // Treat => and =< as == + { + special = S_cmpEQ; + mErrorHandler.warning (std::string("invalid operator =") + c + ", treating it as ==", mLoc); + } else { special = S_cmpEQ; From 143ee387cc1b820a7c711a8900ff11d848c8604e Mon Sep 17 00:00:00 2001 From: Allofich Date: Fri, 21 Apr 2017 23:22:55 +0900 Subject: [PATCH 11/13] Add enabled check to animation script commands (Fixes #3793) --- apps/openmw/mwscript/animationextensions.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/openmw/mwscript/animationextensions.cpp b/apps/openmw/mwscript/animationextensions.cpp index 347bbca56..e737d8ea1 100644 --- a/apps/openmw/mwscript/animationextensions.cpp +++ b/apps/openmw/mwscript/animationextensions.cpp @@ -42,6 +42,9 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); + if (!ptr.getRefData().isEnabled()) + return; + std::string group = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); @@ -69,6 +72,9 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); + if (!ptr.getRefData().isEnabled()) + return; + std::string group = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); From f986e3fafa63590ff5c4b836b688d336f2c5d45e Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 21 Apr 2017 18:03:23 +0400 Subject: [PATCH 12/13] Remove unused code --- apps/openmw/mwbase/windowmanager.hpp | 1 - apps/openmw/mwgui/windowmanagerimp.cpp | 8 +------- apps/openmw/mwgui/windowmanagerimp.hpp | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index 6a159ea7d..f103ce191 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -104,7 +104,6 @@ namespace MWBase * new dialogs. */ virtual void update() = 0; - virtual void updateVisible() = 0; /// @note This method will block until the video finishes playing /// (and will continually update the window while doing so) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 08d369250..e77281898 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -485,6 +485,7 @@ namespace MWGui void WindowManager::update() { cleanupGarbage(); + mHud->update(); } @@ -559,13 +560,6 @@ namespace MWGui return; } - // No need to check GUI if game mode - if (gameMode) - { - mInventoryWindow->setGuiMode(GM_None); - return; - } - if(mGuiModes.size() != 0) { GuiMode mode = mGuiModes.back(); diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 791ed602e..1b8ceecc2 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -361,7 +361,7 @@ namespace MWGui virtual void pinWindow (MWGui::GuiWindow window); - virtual void updatePinnedWindows (); + void updatePinnedWindows (); /// Fade the screen in, over \a time seconds virtual void fadeScreenIn(const float time, bool clearQueue); From 2b3b6d558fab78107f6cd04783d5348446f3890c Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 21 Apr 2017 19:37:09 +0400 Subject: [PATCH 13/13] Move updatePinnedWindows() function to private section --- apps/openmw/mwgui/windowmanagerimp.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 1b8ceecc2..787c88598 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -361,8 +361,6 @@ namespace MWGui virtual void pinWindow (MWGui::GuiWindow window); - void updatePinnedWindows (); - /// Fade the screen in, over \a time seconds virtual void fadeScreenIn(const float time, bool clearQueue); /// Fade the screen out to black, over \a time seconds @@ -541,6 +539,8 @@ namespace MWGui void createTextures(); void createCursors(); void setMenuTransparency(float value); + + void updatePinnedWindows(); }; }