diff --git a/CHANGELOG.md b/CHANGELOG.md index b61cf944b5..38cd1efca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ Bug #6174: Spellmaking and Enchanting sliders differences from vanilla Bug #6177: Followers of player follower stop following after waiting for a day Bug #6184: Command and Calm and Demoralize and Frenzy and Rally magic effects inconsistencies with vanilla + Bug #6191: Encumbrance messagebox timer works incorrectly Bug #6197: Infinite Casting Loop Bug #6253: Multiple instances of Reflect stack additively Bug #6255: Reflect is different from vanilla diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index 958bb466ab..0d1ace3f0b 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -69,6 +69,7 @@ namespace MWGui class DialogueWindow; class WindowModal; class JailScreen; + class MessageBox; enum ShowInDialogueMode { ShowInDialogueMode_IfPossible, @@ -145,6 +146,7 @@ namespace MWBase virtual MWGui::CountDialog* getCountDialog() = 0; virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0; virtual MWGui::TradeWindow* getTradeWindow() = 0; + virtual const std::vector getActiveMessageBoxes() = 0; /// Make the player use an item, while updating GUI state accordingly virtual void useItem(const MWWorld::Ptr& item, bool force=false) = 0; diff --git a/apps/openmw/mwgui/messagebox.cpp b/apps/openmw/mwgui/messagebox.cpp index ed6633c983..890406cd12 100644 --- a/apps/openmw/mwgui/messagebox.cpp +++ b/apps/openmw/mwgui/messagebox.cpp @@ -145,7 +145,6 @@ namespace MWGui return mInterMessageBoxe != nullptr; } - bool MessageBoxManager::removeMessageBox (MessageBox *msgbox) { std::vector::iterator it; @@ -161,6 +160,11 @@ namespace MWGui return false; } + const std::vector MessageBoxManager::getActiveMessageBoxes() + { + return mMessageBoxes; + } + int MessageBoxManager::readPressedButton (bool reset) { int pressed = mLastButtonPressed; diff --git a/apps/openmw/mwgui/messagebox.hpp b/apps/openmw/mwgui/messagebox.hpp index 26d26bac56..d46d31d938 100644 --- a/apps/openmw/mwgui/messagebox.hpp +++ b/apps/openmw/mwgui/messagebox.hpp @@ -49,6 +49,8 @@ namespace MWGui void setVisible(bool value); + const std::vector getActiveMessageBoxes(); + private: std::vector mMessageBoxes; InteractiveMessageBox* mInterMessageBoxe; @@ -63,6 +65,7 @@ namespace MWGui public: MessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message); void setMessage (const std::string& message); + const std::string& getMessage() { return mMessage; }; int getHeight (); void update (int height); void setVisible(bool value); @@ -72,7 +75,7 @@ namespace MWGui protected: MessageBoxManager& mMessageBoxManager; - const std::string& mMessage; + std::string mMessage; MyGUI::EditBox* mMessageWidget; int mBottomPadding; int mNextBoxPadding; diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index b3f0187699..8e7951667b 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -773,6 +773,11 @@ namespace MWGui mMessageBoxManager->removeStaticMessageBox(); } + const std::vector WindowManager::getActiveMessageBoxes() + { + return mMessageBoxManager->getActiveMessageBoxes(); + } + int WindowManager::readPressedButton () { return mMessageBoxManager->readPressedButton(); diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index f68592cb5d..ef19329cdf 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -187,6 +187,7 @@ namespace MWGui MWGui::CountDialog* getCountDialog() override; MWGui::ConfirmationDialog* getConfirmationDialog() override; MWGui::TradeWindow* getTradeWindow() override; + const std::vector getActiveMessageBoxes() override; /// Make the player use an item, while updating GUI state accordingly void useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions=false) override; diff --git a/apps/openmw/mwinput/actionmanager.cpp b/apps/openmw/mwinput/actionmanager.cpp index 59bdc37bb8..63b0a197a7 100644 --- a/apps/openmw/mwinput/actionmanager.cpp +++ b/apps/openmw/mwinput/actionmanager.cpp @@ -22,6 +22,8 @@ #include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/actorutil.hpp" +#include "../mwgui/messagebox.hpp" + #include "actions.hpp" #include "bindingsmanager.hpp" @@ -39,7 +41,6 @@ namespace MWInput , mAlwaysRunActive(Settings::Manager::getBool("always run", "Input")) , mSneaking(false) , mAttemptJump(false) - , mOverencumberedMessageDelay(0.f) , mTimeIdle(0.f) { } @@ -88,22 +89,26 @@ namespace MWInput { player.setUpDown(1); triedToMove = true; - mOverencumberedMessageDelay = 0.f; } // if player tried to start moving, but can't (due to being overencumbered), display a notification. if (triedToMove) { MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - mOverencumberedMessageDelay -= dt; if (playerPtr.getClass().getEncumbrance(playerPtr) > playerPtr.getClass().getCapacity(playerPtr)) { player.setAutoMove (false); - if (mOverencumberedMessageDelay <= 0) + std::vector msgboxs = MWBase::Environment::get().getWindowManager()->getActiveMessageBoxes(); + const std::vector::iterator it = std::find_if(msgboxs.begin(), msgboxs.end(), [](MWGui::MessageBox*& msgbox) { + return (msgbox->getMessage() == "#{sNotifyMessage59}"); + }); + + // if an overencumbered messagebox is already present, reset its expiry timer, otherwise create new one. + if (it != msgboxs.end()) + (*it)->mCurrentTime = 0; + else MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage59}"); - mOverencumberedMessageDelay = 1.0; - } } } diff --git a/apps/openmw/mwinput/actionmanager.hpp b/apps/openmw/mwinput/actionmanager.hpp index 4141767bcc..4c51139d46 100644 --- a/apps/openmw/mwinput/actionmanager.hpp +++ b/apps/openmw/mwinput/actionmanager.hpp @@ -67,7 +67,6 @@ namespace MWInput bool mSneaking; bool mAttemptJump; - float mOverencumberedMessageDelay; float mTimeIdle; }; }