From bc60421615177ac15893e58d53e2cca2307704ae Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 16 Feb 2017 22:41:19 +0900 Subject: [PATCH 1/4] Change NPC equip logic to be more like original (Bug #3754) --- apps/openmw/mwworld/inventorystore.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index 54b32d600..f33ddc94f 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -291,9 +291,15 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor) { if (old.getTypeName() == typeid(ESM::Armor).name()) { - if (old.getClass().getEffectiveArmorRating(old, actor) >= test.getClass().getEffectiveArmorRating(test, actor)) - // old armor had better armor rating + if (old.get()->mBase->mData.mType < test.get()->mBase->mData.mType) continue; + + if (old.get()->mBase->mData.mType == test.get()->mBase->mData.mType) + { + if (old.getClass().getEffectiveArmorRating(old, actor) >= test.getClass().getEffectiveArmorRating(test, actor)) + // old armor had better armor rating + continue; + } } // suitable armor should replace already equipped clothing } From fb8a2093cd1a40762cc823c827d292dda02c2f1c Mon Sep 17 00:00:00 2001 From: MAtahualpa Date: Sat, 18 Feb 2017 15:40:07 +0100 Subject: [PATCH 2/4] Replace "Female" check box with a combo box, part 2/2 (fixes #3757) Replaces the "Female" check box in BodyPart records with a "Gender" combo box. This is the second of two related fixes, the first one covering NPC records. Related issue: - Fixes #3757: Editor: Replace "Female" check box in BodyPart records with "Gender" combo box (https://bugs.openmw.org/issues/3757) Tests: The changes were successfully tested in OpenMW-CS by manipulating several BodyPart records. --- apps/opencs/model/world/columnimp.hpp | 35 +++++++++++++++++++++++++++ apps/opencs/model/world/data.cpp | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/apps/opencs/model/world/columnimp.hpp b/apps/opencs/model/world/columnimp.hpp index 4e608dbbd..33a71e97a 100644 --- a/apps/opencs/model/world/columnimp.hpp +++ b/apps/opencs/model/world/columnimp.hpp @@ -1757,6 +1757,41 @@ namespace CSMWorld return true; } }; + + template + struct GenderNpcColumn : public Column + { + GenderNpcColumn() + : Column(Columns::ColumnId_GenderNpc, ColumnBase::Display_GenderNpc) + {} + + virtual QVariant get(const Record& record) const + { + // Implemented this way to allow additional gender types in the future. + if ((record.get().mData.mFlags & ESM::BodyPart::BPF_Female) == ESM::BodyPart::BPF_Female) + return 1; + + return 0; + } + + virtual void set(Record& record, const QVariant& data) + { + ESXRecordT record2 = record.get(); + + // Implemented this way to allow additional gender types in the future. + if (data.toInt() == 1) + record2.mData.mFlags = (record2.mData.mFlags & ~ESM::BodyPart::BPF_Female) | ESM::BodyPart::BPF_Female; + else + record2.mData.mFlags = record2.mData.mFlags & ~ESM::BodyPart::BPF_Female; + + record.setModified(record2); + } + + virtual bool isEditable() const + { + return true; + } + }; template struct EnchantmentTypeColumn : public Column diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index da4942eec..5a59f19f7 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -363,7 +363,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc mBodyParts.addColumn (new FixedRecordTypeColumn (UniversalId::Type_BodyPart)); mBodyParts.addColumn (new BodyPartTypeColumn); mBodyParts.addColumn (new VampireColumn); - mBodyParts.addColumn (new FlagColumn (Columns::ColumnId_Female, ESM::BodyPart::BPF_Female)); + mBodyParts.addColumn(new GenderNpcColumn); mBodyParts.addColumn (new FlagColumn (Columns::ColumnId_Playable, ESM::BodyPart::BPF_NotPlayable, ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, true)); From 481c4406985f87290347086ad55fc2c165e6073d Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 18 Feb 2017 03:15:15 +0100 Subject: [PATCH 3/4] Print OSG version on startup --- apps/openmw/engine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index e8730a4e8..8723483f7 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -623,6 +623,8 @@ void OMW::Engine::go() { assert (!mContentFiles.empty()); + std::cout << "OSG version: " << osgGetVersion() << std::endl; + mViewer = new osgViewer::Viewer; mViewer->setReleaseContextAtEndOfFrameHint(false); From 3b24bb9a5e370471eb41f2923256cbbabd460411 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 19 Feb 2017 13:38:38 +0100 Subject: [PATCH 4/4] Use OS X cursor workaround for GL_VENDOR ATI and add an environment variable for control --- components/sdlutil/sdlcursormanager.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/sdlutil/sdlcursormanager.cpp b/components/sdlutil/sdlcursormanager.cpp index ad03083de..411fb3694 100644 --- a/components/sdlutil/sdlcursormanager.cpp +++ b/components/sdlutil/sdlcursormanager.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -81,6 +82,8 @@ namespace osg::ref_ptr decompress (osg::ref_ptr source, float rotDegrees) { + // TODO: use software decompression once S3TC patent expires + int width = source->s(); int height = source->t(); @@ -130,9 +133,13 @@ namespace osg::ref_ptr geom; #if defined(__APPLE__) - // Extra flip needed on Intel graphics OS X systems due to a driver bug + // Extra flip needed on OS X systems due to a driver bug + const char* envval = getenv("OPENMW_CURSOR_WORKAROUND"); + bool workaround = !envval || envval == std::string("1"); std::string vendorString = (const char*)glGetString(GL_VENDOR); - if (vendorString.find("Intel") != std::string::npos) + if (!envval) + workaround = vendorString.find("Intel") != std::string::npos || vendorString.find("ATI") != std::string::npos || vendorString.find("AMD") != std::string::npos; + if (workaround) geom = osg::createTexturedQuadGeometry(osg::Vec3(-1,1,0), osg::Vec3(2,0,0), osg::Vec3(0,-2,0)); else #endif