From 95d164a6e6ab9cd246e5007f25b9c93be0621312 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Sat, 18 Mar 2017 07:49:46 -0400 Subject: [PATCH 01/13] Editor: use combo box when creating pathgrids Instead of using QLineEdit for user input, use a QComboBox populated with valid choices. This prevents user from being able to create a pathgrid for a non-existent cell. --- apps/opencs/view/world/pathgridcreator.cpp | 58 +++++++++++++++++++--- apps/opencs/view/world/pathgridcreator.hpp | 9 ++++ 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/apps/opencs/view/world/pathgridcreator.cpp b/apps/opencs/view/world/pathgridcreator.cpp index a305b1249..166acafd2 100644 --- a/apps/opencs/view/world/pathgridcreator.cpp +++ b/apps/opencs/view/world/pathgridcreator.cpp @@ -1,28 +1,74 @@ #include "pathgridcreator.hpp" +#include +#include +#include +#include + #include "../../model/world/data.hpp" +std::string CSVWorld::PathgridCreator::getId() const +{ + return mCell->currentText().toUtf8().constData(); +} + CSVWorld::PathgridCreator::PathgridCreator( CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id, bool relaxedIdRules ) : GenericCreator(data, undoStack, id, relaxedIdRules) -{} +{ + setManualEditing(false); + + QLabel *label = new QLabel("Cell ID", this); + insertBeforeButtons(label, false); + + // Create combo box with case-insensitive sorting. + mCell = new QComboBox(this); + QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel; + QStringListModel *listModel = new QStringListModel; + proxyModel->setSourceModel(listModel); + proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); + mCell->setModel(proxyModel); + insertBeforeButtons(mCell, true); + + // Populate combo box with cells that don't have a pathgrid yet. + const CSMWorld::IdCollection& pathgrids = getData().getPathgrids(); + const CSMWorld::IdCollection& cells = getData().getCells(); + const int cellCount = cells.getSize(); + for (int i = 0; i < cellCount; ++i) + { + std::string cellId = cells.getId(i); + if (pathgrids.searchId(cellId) == -1) + { + mCell->addItem(QString::fromStdString(cellId)); + } + } + + mCell->model()->sort(0); + mCell->setCurrentIndex(0); +} std::string CSVWorld::PathgridCreator::getErrors() const { - std::string pathgridId = getId(); + std::string cellId = getId(); // Check user input for any errors. + // The last two checks, cell with existing pathgrid and non-existent cell, + // shouldn't be needed but we absolutely want to make sure they never happen. std::string errors; - if (pathgridId.empty()) + if (cellId.empty()) + { + errors = "No cell ID selected"; + } + else if (getData().getPathgrids().searchId(cellId) > -1) { - errors = "No Pathgrid ID entered"; + errors = "Pathgrid for selected cell ID already exists"; } - else if (getData().getPathgrids().searchId(pathgridId) > -1) + else if (getData().getCells().searchId(cellId) == -1) { - errors = "Pathgrid with this ID already exists"; + errors = "Cell with selected cell ID does not exist"; } return errors; diff --git a/apps/opencs/view/world/pathgridcreator.hpp b/apps/opencs/view/world/pathgridcreator.hpp index 10f64a0a7..5508fadd7 100644 --- a/apps/opencs/view/world/pathgridcreator.hpp +++ b/apps/opencs/view/world/pathgridcreator.hpp @@ -1,6 +1,8 @@ #ifndef PATHGRIDCREATOR_HPP #define PATHGRIDCREATOR_HPP +class QComboBox; + #include "genericcreator.hpp" namespace CSVWorld @@ -10,6 +12,13 @@ namespace CSVWorld { Q_OBJECT + QComboBox *mCell; + + private: + + /// \return Cell ID selected by user. + virtual std::string getId() const; + public: PathgridCreator( From 491fd3d0be333efb4696448818b681e0e4fadb2c Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Sat, 18 Mar 2017 09:20:14 -0400 Subject: [PATCH 02/13] Editor: set combo box events for pathgrid creator - Handles when combo box should automatically gain or lose focus. - Checks user input when combo box selection changes. --- apps/opencs/view/world/pathgridcreator.cpp | 18 ++++++++++++++++++ apps/opencs/view/world/pathgridcreator.hpp | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/apps/opencs/view/world/pathgridcreator.cpp b/apps/opencs/view/world/pathgridcreator.cpp index 166acafd2..ae9ce7242 100644 --- a/apps/opencs/view/world/pathgridcreator.cpp +++ b/apps/opencs/view/world/pathgridcreator.cpp @@ -48,6 +48,8 @@ CSVWorld::PathgridCreator::PathgridCreator( mCell->model()->sort(0); mCell->setCurrentIndex(0); + + connect(mCell, SIGNAL (currentIndexChanged(const QString&)), this, SLOT (cellChanged())); } std::string CSVWorld::PathgridCreator::getErrors() const @@ -73,3 +75,19 @@ std::string CSVWorld::PathgridCreator::getErrors() const return errors; } + +void CSVWorld::PathgridCreator::focus() +{ + mCell->setFocus(); +} + +void CSVWorld::PathgridCreator::reset() +{ + CSVWorld::GenericCreator::reset(); + mCell->setCurrentIndex(0); +} + +void CSVWorld::PathgridCreator::cellChanged() +{ + update(); +} diff --git a/apps/opencs/view/world/pathgridcreator.hpp b/apps/opencs/view/world/pathgridcreator.hpp index 5508fadd7..6ed8004e2 100644 --- a/apps/opencs/view/world/pathgridcreator.hpp +++ b/apps/opencs/view/world/pathgridcreator.hpp @@ -29,6 +29,17 @@ namespace CSVWorld /// \return Error description for current user input. virtual std::string getErrors() const; + + /// \brief Set focus to cell ID input widget. + virtual void focus(); + + /// \brief Reset selected cell ID. + virtual void reset(); + + private slots: + + /// \brief Check user input for errors. + void cellChanged(); }; } From 0dcb6a9bd4b788964b84e42f25b9c687dc413612 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Sat, 18 Mar 2017 10:20:16 -0400 Subject: [PATCH 03/13] Editor: update pathgrid creator input on changes When data changes the cell input for pathgrid creator is repopulated with valid choices. This handles the case where a cell is added or removed, and also when a cell's pathgrid is added or completely removed. --- apps/opencs/view/world/pathgridcreator.cpp | 38 +++++++++++++--------- apps/opencs/view/world/pathgridcreator.hpp | 3 ++ 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/apps/opencs/view/world/pathgridcreator.cpp b/apps/opencs/view/world/pathgridcreator.cpp index ae9ce7242..980c031ca 100644 --- a/apps/opencs/view/world/pathgridcreator.cpp +++ b/apps/opencs/view/world/pathgridcreator.cpp @@ -33,22 +33,9 @@ CSVWorld::PathgridCreator::PathgridCreator( mCell->setModel(proxyModel); insertBeforeButtons(mCell, true); - // Populate combo box with cells that don't have a pathgrid yet. - const CSMWorld::IdCollection& pathgrids = getData().getPathgrids(); - const CSMWorld::IdCollection& cells = getData().getCells(); - const int cellCount = cells.getSize(); - for (int i = 0; i < cellCount; ++i) - { - std::string cellId = cells.getId(i); - if (pathgrids.searchId(cellId) == -1) - { - mCell->addItem(QString::fromStdString(cellId)); - } - } - - mCell->model()->sort(0); - mCell->setCurrentIndex(0); + setupCellsInput(); + connect(&getData(), SIGNAL (idListChanged()), this, SLOT (setupCellsInput())); connect(mCell, SIGNAL (currentIndexChanged(const QString&)), this, SLOT (cellChanged())); } @@ -91,3 +78,24 @@ void CSVWorld::PathgridCreator::cellChanged() { update(); } + +void CSVWorld::PathgridCreator::setupCellsInput() +{ + mCell->clear(); + + // Populate combo box with cells that don't have a pathgrid yet. + const CSMWorld::IdCollection& pathgrids = getData().getPathgrids(); + const CSMWorld::IdCollection& cells = getData().getCells(); + const int cellCount = cells.getSize(); + for (int i = 0; i < cellCount; ++i) + { + std::string cellId = cells.getId(i); + if (pathgrids.searchId(cellId) == -1) + { + mCell->addItem(QString::fromStdString(cellId)); + } + } + + mCell->model()->sort(0); + mCell->setCurrentIndex(0); +} diff --git a/apps/opencs/view/world/pathgridcreator.hpp b/apps/opencs/view/world/pathgridcreator.hpp index 6ed8004e2..7c4f7f705 100644 --- a/apps/opencs/view/world/pathgridcreator.hpp +++ b/apps/opencs/view/world/pathgridcreator.hpp @@ -40,6 +40,9 @@ namespace CSVWorld /// \brief Check user input for errors. void cellChanged(); + + /// \brief Setup cells in combo box. + void setupCellsInput(); }; } From 207695e094524db0f740b5c527eacb1708e79412 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Tue, 21 Mar 2017 07:58:01 -0400 Subject: [PATCH 04/13] Editor: switch input for pathgrid creator Switched from QComboBox to DropLineEdit for pathgrid creator input. This allows the input the use auto-complete and be a drop target from the cells table. --- apps/opencs/view/world/pathgridcreator.cpp | 76 ++++++++++++---------- apps/opencs/view/world/pathgridcreator.hpp | 48 ++++++++++++-- apps/opencs/view/world/subviews.cpp | 4 +- 3 files changed, 86 insertions(+), 42 deletions(-) diff --git a/apps/opencs/view/world/pathgridcreator.cpp b/apps/opencs/view/world/pathgridcreator.cpp index 980c031ca..d597254c6 100644 --- a/apps/opencs/view/world/pathgridcreator.cpp +++ b/apps/opencs/view/world/pathgridcreator.cpp @@ -1,21 +1,33 @@ #include "pathgridcreator.hpp" -#include #include -#include -#include +#include "../../model/doc/document.hpp" + +#include "../../model/world/columns.hpp" #include "../../model/world/data.hpp" +#include "../../model/world/idcompletionmanager.hpp" +#include "../../model/world/idtable.hpp" + +#include "../widget/droplineedit.hpp" std::string CSVWorld::PathgridCreator::getId() const { - return mCell->currentText().toUtf8().constData(); + return mCell->text().toUtf8().constData(); +} + +CSMWorld::IdTable& CSVWorld::PathgridCreator::getPathgridsTable() const +{ + return dynamic_cast ( + *getData().getTableModel(getCollectionId()) + ); } CSVWorld::PathgridCreator::PathgridCreator( CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id, + CSMWorld::IdCompletionManager& completionManager, bool relaxedIdRules ) : GenericCreator(data, undoStack, id, relaxedIdRules) { @@ -24,19 +36,26 @@ CSVWorld::PathgridCreator::PathgridCreator( QLabel *label = new QLabel("Cell ID", this); insertBeforeButtons(label, false); - // Create combo box with case-insensitive sorting. - mCell = new QComboBox(this); - QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel; - QStringListModel *listModel = new QStringListModel; - proxyModel->setSourceModel(listModel); - proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); - mCell->setModel(proxyModel); + // Add cell ID input with auto-completion. + CSMWorld::ColumnBase::Display displayType = CSMWorld::ColumnBase::Display_Cell; + mCell = new CSVWidget::DropLineEdit(displayType, this); + mCell->setCompleter(completionManager.getCompleter(displayType).get()); insertBeforeButtons(mCell, true); - setupCellsInput(); + connect(mCell, SIGNAL (textChanged(const QString&)), this, SLOT (cellChanged())); + connect(mCell, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); +} + +void CSVWorld::PathgridCreator::cloneMode( + const std::string& originId, + const CSMWorld::UniversalId::Type type) +{ + CSVWorld::GenericCreator::cloneMode(originId, type); - connect(&getData(), SIGNAL (idListChanged()), this, SLOT (setupCellsInput())); - connect(mCell, SIGNAL (currentIndexChanged(const QString&)), this, SLOT (cellChanged())); + // Look up cloned record in pathgrids table and set cell ID text. + CSMWorld::IdTable& table = getPathgridsTable(); + int column = table.findColumnIndex(CSMWorld::Columns::ColumnId_Id); + mCell->setText(table.data(table.getModelIndex(originId, column)).toString()); } std::string CSVWorld::PathgridCreator::getErrors() const @@ -71,7 +90,7 @@ void CSVWorld::PathgridCreator::focus() void CSVWorld::PathgridCreator::reset() { CSVWorld::GenericCreator::reset(); - mCell->setCurrentIndex(0); + mCell->setText(""); } void CSVWorld::PathgridCreator::cellChanged() @@ -79,23 +98,14 @@ void CSVWorld::PathgridCreator::cellChanged() update(); } -void CSVWorld::PathgridCreator::setupCellsInput() +CSVWorld::Creator *CSVWorld::PathgridCreatorFactory::makeCreator( + CSMDoc::Document& document, + const CSMWorld::UniversalId& id) const { - mCell->clear(); - - // Populate combo box with cells that don't have a pathgrid yet. - const CSMWorld::IdCollection& pathgrids = getData().getPathgrids(); - const CSMWorld::IdCollection& cells = getData().getCells(); - const int cellCount = cells.getSize(); - for (int i = 0; i < cellCount; ++i) - { - std::string cellId = cells.getId(i); - if (pathgrids.searchId(cellId) == -1) - { - mCell->addItem(QString::fromStdString(cellId)); - } - } - - mCell->model()->sort(0); - mCell->setCurrentIndex(0); + return new PathgridCreator( + document.getData(), + document.getUndoStack(), + id, + document.getIdCompletionManager() + ); } diff --git a/apps/opencs/view/world/pathgridcreator.hpp b/apps/opencs/view/world/pathgridcreator.hpp index 7c4f7f705..c2ae20fc0 100644 --- a/apps/opencs/view/world/pathgridcreator.hpp +++ b/apps/opencs/view/world/pathgridcreator.hpp @@ -1,10 +1,26 @@ #ifndef PATHGRIDCREATOR_HPP #define PATHGRIDCREATOR_HPP -class QComboBox; - #include "genericcreator.hpp" +namespace CSMDoc +{ + class Document; +} + +namespace CSMWorld +{ + class Data; + class IdCompletionManager; + class IdTable; + class UniversalId; +} + +namespace CSVWidget +{ + class DropLineEdit; +} + namespace CSVWorld { /// \brief Record creator for pathgrids. @@ -12,37 +28,55 @@ namespace CSVWorld { Q_OBJECT - QComboBox *mCell; + CSVWidget::DropLineEdit *mCell; private: - /// \return Cell ID selected by user. + /// \return Cell ID entered by user. virtual std::string getId() const; + /// \return reference to table containing pathgrids. + CSMWorld::IdTable& getPathgridsTable() const; + public: PathgridCreator( CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id, + CSMWorld::IdCompletionManager& completionManager, bool relaxedIdRules = false); + /// \brief Set cell ID input widget to ID of record to be cloned. + /// \param originId Cell ID to be cloned. + /// \param type Type of record to be cloned. + virtual void cloneMode( + const std::string& originId, + const CSMWorld::UniversalId::Type type); + /// \return Error description for current user input. virtual std::string getErrors() const; /// \brief Set focus to cell ID input widget. virtual void focus(); - /// \brief Reset selected cell ID. + /// \brief Clear cell ID input widget. virtual void reset(); private slots: /// \brief Check user input for errors. void cellChanged(); + }; + + /// \brief Creator factory for pathgrid record creator. + class PathgridCreatorFactory : public CreatorFactoryBase + { + public: - /// \brief Setup cells in combo box. - void setupCellsInput(); + virtual Creator *makeCreator( + CSMDoc::Document& document, + const CSMWorld::UniversalId& id) const; }; } diff --git a/apps/opencs/view/world/subviews.cpp b/apps/opencs/view/world/subviews.cpp index 32661ed93..93e105106 100644 --- a/apps/opencs/view/world/subviews.cpp +++ b/apps/opencs/view/world/subviews.cpp @@ -76,7 +76,7 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager) new CSVDoc::SubViewFactoryWithCreator); manager.add (CSMWorld::UniversalId::Type_Pathgrids, - new CSVDoc::SubViewFactoryWithCreator >); + new CSVDoc::SubViewFactoryWithCreator); manager.add (CSMWorld::UniversalId::Type_Globals, new CSVDoc::SubViewFactoryWithCreator >); @@ -174,7 +174,7 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager) new CSVDoc::SubViewFactoryWithCreator (false)); manager.add (CSMWorld::UniversalId::Type_Pathgrid, - new CSVDoc::SubViewFactoryWithCreator > (false)); + new CSVDoc::SubViewFactoryWithCreator (false)); manager.add (CSMWorld::UniversalId::Type_DebugProfile, new CSVDoc::SubViewFactoryWithCreator > (false)); From 3714c2a0f2ac96cab194837e14fa763e0b78109a Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Tue, 21 Mar 2017 08:14:04 -0400 Subject: [PATCH 05/13] Editor: add ID validator to pathgrid input --- apps/opencs/view/world/pathgridcreator.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/opencs/view/world/pathgridcreator.cpp b/apps/opencs/view/world/pathgridcreator.cpp index d597254c6..7d2f46b91 100644 --- a/apps/opencs/view/world/pathgridcreator.cpp +++ b/apps/opencs/view/world/pathgridcreator.cpp @@ -10,6 +10,7 @@ #include "../../model/world/idtable.hpp" #include "../widget/droplineedit.hpp" +#include "idvalidator.hpp" std::string CSVWorld::PathgridCreator::getId() const { @@ -40,6 +41,7 @@ CSVWorld::PathgridCreator::PathgridCreator( CSMWorld::ColumnBase::Display displayType = CSMWorld::ColumnBase::Display_Cell; mCell = new CSVWidget::DropLineEdit(displayType, this); mCell->setCompleter(completionManager.getCompleter(displayType).get()); + mCell->setValidator(new IdValidator(relaxedIdRules, this)); insertBeforeButtons(mCell, true); connect(mCell, SIGNAL (textChanged(const QString&)), this, SLOT (cellChanged())); From 6c686fa2422eae8e3d475d77df85117b28ada18a Mon Sep 17 00:00:00 2001 From: Allofich Date: Wed, 22 Mar 2017 11:10:57 +0900 Subject: [PATCH 06/13] Fix "curl: command not found" error Fixes (#3799) --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index e959792f5..d8f2bfc35 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -48,6 +48,9 @@ cache: clone_folder: C:\projects\openmw +install: + - set PATH=C:\Program Files\Git\mingw64\bin;%PATH% + before_build: - cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -u -p %PLATFORM% -v %msvc% From 57aeec59d5a2c51302404624f4f490896ca0f0d4 Mon Sep 17 00:00:00 2001 From: Allofich Date: Wed, 22 Mar 2017 14:27:30 +0900 Subject: [PATCH 07/13] Change bounds behavior of stat script commands Fixes (#3776) --- apps/openmw/mwmechanics/stat.cpp | 2 +- apps/openmw/mwscript/statsextensions.cpp | 39 +++++++++++++++++------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwmechanics/stat.cpp b/apps/openmw/mwmechanics/stat.cpp index cf1f228c0..41c5bac5a 100644 --- a/apps/openmw/mwmechanics/stat.cpp +++ b/apps/openmw/mwmechanics/stat.cpp @@ -189,7 +189,7 @@ namespace MWMechanics void AttributeValue::setBase(int base) { - mBase = std::max(0, base); + mBase = base; } void AttributeValue::setModifier(int mod) diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 19f2a035e..6b1953917 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -123,7 +123,7 @@ namespace MWScript runtime.pop(); MWMechanics::AttributeValue attribute = ptr.getClass().getCreatureStats(ptr).getAttribute(mIndex); - attribute.setBase (value - (attribute.getModified() - attribute.getBase())); + attribute.setBase (value); ptr.getClass().getCreatureStats(ptr).setAttribute(mIndex, attribute); } }; @@ -148,7 +148,18 @@ namespace MWScript .getCreatureStats(ptr) .getAttribute(mIndex); - attribute.setBase (std::min(100, attribute.getBase() + value)); + if (value == 0) + return; + + if (((attribute.getBase() <= 0) && (value < 0)) + || ((attribute.getBase() >= 100) && (value > 0))) + return; + + if (value < 0) + attribute.setBase(std::max(0, attribute.getBase() + value)); + else + attribute.setBase(std::min(100, attribute.getBase() + value)); + ptr.getClass().getCreatureStats(ptr).setAttribute(mIndex, attribute); } }; @@ -350,12 +361,7 @@ namespace MWScript MWMechanics::NpcStats& stats = ptr.getClass().getNpcStats (ptr); - int newLevel = value - (stats.getSkill(mIndex).getModified() - stats.getSkill(mIndex).getBase()); - - if (newLevel<0) - newLevel = 0; - - stats.getSkill (mIndex).setBase (newLevel); + stats.getSkill (mIndex).setBase (value); } }; @@ -375,10 +381,21 @@ namespace MWScript Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWMechanics::NpcStats& stats = ptr.getClass().getNpcStats(ptr); + MWMechanics::SkillValue &skill = ptr.getClass() + .getNpcStats(ptr) + .getSkill(mIndex); + + if (value == 0) + return; + + if (((skill.getBase() <= 0) && (value < 0)) + || ((skill.getBase() >= 100) && (value > 0))) + return; - stats.getSkill(mIndex). - setBase (std::min(100, stats.getSkill(mIndex).getBase() + value)); + if (value < 0) + skill.setBase(std::max(0, skill.getBase() + value)); + else + skill.setBase(std::min(100, skill.getBase() + value)); } }; From 5282556ae0eb706a6debe4708c9d0eba41e76529 Mon Sep 17 00:00:00 2001 From: Allofich Date: Wed, 22 Mar 2017 19:55:48 +0900 Subject: [PATCH 08/13] Show names on combat actors when RMB GUI is active Fixes (#3797) --- apps/openmw/mwclass/creature.cpp | 2 +- apps/openmw/mwclass/npc.cpp | 2 +- apps/openmw/mwworld/worldimp.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 8c663474f..51e0bdcce 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -546,7 +546,7 @@ namespace MWClass bool Creature::hasToolTip(const MWWorld::ConstPtr& ptr) const { - if (!ptr.getRefData().getCustomData()) + if (!ptr.getRefData().getCustomData() || MWBase::Environment::get().getWindowManager()->isGuiMode()) return true; const CreatureCustomData& customData = ptr.getRefData().getCustomData()->asCreatureCustomData(); diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 38d288062..3b7b24981 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -1007,7 +1007,7 @@ namespace MWClass bool Npc::hasToolTip(const MWWorld::ConstPtr& ptr) const { - if (!ptr.getRefData().getCustomData()) + if (!ptr.getRefData().getCustomData() || MWBase::Environment::get().getWindowManager()->isGuiMode()) return true; const NpcCustomData& customData = ptr.getRefData().getCustomData()->asNpcCustomData(); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 851b02ba8..4270a112c 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1039,7 +1039,7 @@ namespace MWWorld facedObject = getFacedObject(activationDistance, true); if (!facedObject.isEmpty() && !facedObject.getClass().allowTelekinesis(facedObject) - && mDistanceToFacedObject > getMaxActivationDistance()) + && mDistanceToFacedObject > getMaxActivationDistance() && !MWBase::Environment::get().getWindowManager()->isGuiMode()) return 0; } return facedObject; From 1a47b9727b08ca00ee60e9131230dd761a8d98fb Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 23 Mar 2017 14:31:01 +0400 Subject: [PATCH 09/13] Changed tooltip maximum width (bug #3800) --- apps/openmw/mwgui/tooltips.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index b3cc19a64..44ee6cac1 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -414,11 +414,11 @@ namespace MWGui const MyGUI::IntPoint padding(8, 8); - const int maximumWidth = 500; - const int imageCaptionHPadding = (caption != "" ? 8 : 0); const int imageCaptionVPadding = (caption != "" ? 4 : 0); + const int maximumWidth = MyGUI::RenderManager::getInstance().getViewSize().width - imageCaptionHPadding * 2; + std::string realImage = MWBase::Environment::get().getWindowManager()->correctIconPath(image); MyGUI::EditBox* captionWidget = mDynamicToolTipBox->createWidget("NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption"); From f676b62711ff5d2d1ba4355570977fd7a38e63be Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 8 Mar 2017 01:30:38 +0100 Subject: [PATCH 10/13] Remove unused variable --- components/resource/stats.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/components/resource/stats.hpp b/components/resource/stats.hpp index bd3890d9b..55b016602 100644 --- a/components/resource/stats.hpp +++ b/components/resource/stats.hpp @@ -47,7 +47,6 @@ namespace Resource float _statsHeight; std::string _font; - float _leftPos; float _characterSize; int _resourceStatsChildNum; From c611ddba8db5fa114cb50d12882332b6eaf9c8df Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 23 Mar 2017 20:01:38 +0100 Subject: [PATCH 11/13] Remove stray term --- apps/openmw/mwmechanics/trading.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/trading.cpp b/apps/openmw/mwmechanics/trading.cpp index 469b454df..08e4d097a 100644 --- a/apps/openmw/mwmechanics/trading.cpp +++ b/apps/openmw/mwmechanics/trading.cpp @@ -52,7 +52,7 @@ namespace MWMechanics float f1 = 0.2f * merchantStats.getAttribute(ESM::Attribute::Personality).getModified(); float dispositionTerm = gmst.find("fDispositionMod")->getFloat() * (clampedDisposition - 50); - float pcTerm = (dispositionTerm - 50 + a1 + b1 + c1) * playerStats.getFatigueTerm(); + float pcTerm = (dispositionTerm + a1 + b1 + c1) * playerStats.getFatigueTerm(); float npcTerm = (d1 + e1 + f1) * merchantStats.getFatigueTerm(); float x = gmst.find("fBargainOfferMulti")->getFloat() * d + gmst.find("fBargainOfferBase")->getFloat() From a5d7b36c28c706e7c52577991c5f180827a9cc8f Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 23 Mar 2017 19:36:34 +0100 Subject: [PATCH 12/13] Don't clear idle animation when movement ends (Bug #3581) This caused problems when AiWander tried to start an idle animation in the frame after movement stops. --- apps/openmw/mwmechanics/character.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 4b54098a1..62d481581 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -364,9 +364,11 @@ void CharacterController::refreshMovementAnims(const WeaponInfo* weap, Character { if(force || movement != mMovementState) { - mIdleState = CharState_None; mMovementState = movement; + if (movement != CharState_None) + mIdleState = CharState_None; + std::string movementAnimName; MWRender::Animation::BlendMask movemask = MWRender::Animation::BlendMask_All; const StateInfo *movestate = std::find_if(sMovementList, sMovementListEnd, FindCharState(mMovementState)); From 338592b99b7a9b6f38ec90829bf5d3df95a31d4a Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 23 Mar 2017 19:45:59 +0100 Subject: [PATCH 13/13] Don't clear the animation queue when turning (Bug #3581) Otherwise, the turnAnimationThreshold would make it difficult to estimate when we can start playing the animation. --- apps/openmw/mwmechanics/character.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 62d481581..a11aa586f 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1834,7 +1834,7 @@ void CharacterController::update(float duration) if (onground) cls.getCreatureStats(mPtr).land(); - if(movestate != CharState_None) + if(movestate != CharState_None && movestate != CharState_TurnLeft && movestate != CharState_TurnRight) clearAnimQueue(); if(mAnimQueue.empty() || inwater || sneak)