From 4b1247597ea82c9c77cfe40ff2e88db885e84fe4 Mon Sep 17 00:00:00 2001 From: declan-millar Date: Sun, 20 May 2018 17:06:26 +0100 Subject: [PATCH 1/9] Use soulgem value rebalance formula from morrowind code patch --- apps/openmw/mwclass/misc.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 5a933d535..4b1a8844d 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -84,8 +84,19 @@ namespace MWClass if (ptr.getCellRef().getSoul() != "") { const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get().search(ref->mRef.getSoul()); - if (creature) - value *= creature->mData.mSoul; + if (creature) { + // value *= creature->mData.mSoul; + + // use soulgem value rebalance formula from morrowind code patch + int soul = creature->mData.mSoul; + float soul_value = 0.0001 * pow(soul, 3) + 2 * soul; + + // for Azura's star add the unfilled value + if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "Misc_SoulGem_Azura")) + value += soul_value; + else + value = soul_value; + } } return value; From 78e79d577535098c0be8747257ab7a7aabf28b5c Mon Sep 17 00:00:00 2001 From: declan-millar Date: Mon, 21 May 2018 13:33:42 +0100 Subject: [PATCH 2/9] Add advanced option to Rebalance soulgem values to the launcher --- apps/launcher/advancedpage.cpp | 2 ++ apps/openmw/mwclass/misc.cpp | 6 +++--- files/settings-default.cfg | 3 +++ files/ui/advancedpage.ui | 10 ++++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index 9b6e5fa8c..dcf376362 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -23,6 +23,7 @@ bool Launcher::AdvancedPage::loadSettings() loadSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game"); loadSettingBool(showMeleeInfoCheckBox, "show melee info", "Game"); loadSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game"); + loadSettingBool(rebalanceSoulgemValuesCheckBox, "rebalance soulgem values", "Game"); // Expected values are (0, 1, 2, 3) int showOwnedIndex = mEngineSettings.getInt("show owned", "Game"); @@ -61,6 +62,7 @@ void Launcher::AdvancedPage::saveSettings() saveSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game"); saveSettingBool(showMeleeInfoCheckBox, "show melee info", "Game"); saveSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game"); + saveSettingBool(rebalanceSoulgemValuesCheckBox, "rebalance soulgem values", "Game"); int showOwnedCurrentIndex = showOwnedComboBox->currentIndex(); if (showOwnedCurrentIndex != mEngineSettings.getInt("show owned", "Game")) diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 4b1a8844d..d2f5d35ba 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -89,13 +89,13 @@ namespace MWClass // use soulgem value rebalance formula from morrowind code patch int soul = creature->mData.mSoul; - float soul_value = 0.0001 * pow(soul, 3) + 2 * soul; + float soulValue = 0.0001 * pow(soul, 3) + 2 * soul; // for Azura's star add the unfilled value if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "Misc_SoulGem_Azura")) - value += soul_value; + value += soulValue; else - value = soul_value; + value = soulValue; } } diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 87443ff1a..a2524ff17 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -216,6 +216,9 @@ followers attack on sight = false # Can loot non-fighting actors during death animation can loot during death animation = true +# Makes the value of filled soulgems dependent only on soul magnitude (with formula from the Morrowind Code Patch) +rebalance soulgem values = false + [General] # Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16). diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui index 6832b86df..28d0f0543 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -109,6 +109,16 @@ + + + + <html><head/><body><p>If this setting is true, the value of filled soulgems is dependent only on soul magnitude.</p><p>The default value is false.</p></body></html> + + + Rebalance soulgem values + + + From 9346a552fa1808372899602b1f3eb7125bcde6b3 Mon Sep 17 00:00:00 2001 From: declan-millar Date: Mon, 21 May 2018 13:59:20 +0100 Subject: [PATCH 3/9] Use Rebalance soulgem values option to set soulgem value --- apps/openmw/mwclass/misc.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index d2f5d35ba..8e39b44e9 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -1,6 +1,7 @@ #include "misc.hpp" #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -84,18 +85,22 @@ namespace MWClass if (ptr.getCellRef().getSoul() != "") { const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get().search(ref->mRef.getSoul()); - if (creature) { - // value *= creature->mData.mSoul; - - // use soulgem value rebalance formula from morrowind code patch - int soul = creature->mData.mSoul; - float soulValue = 0.0001 * pow(soul, 3) + 2 * soul; - - // for Azura's star add the unfilled value - if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "Misc_SoulGem_Azura")) - value += soulValue; + if (creature) + { + if (Settings::Manager::getBool("rebalance soulgem values", "Game")) + { + // use soulgem value rebalance formula from morrowind code patch + int soul = creature->mData.mSoul; + float soulValue = 0.0001 * pow(soul, 3) + 2 * soul; + + // for Azura's star add the unfilled value + if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "Misc_SoulGem_Azura")) + value += soulValue; + else + value = soulValue; + } else - value = soulValue; + value *= creature->mData.mSoul; } } From 028b528c0bc253ac2446173bfd52406935f2526a Mon Sep 17 00:00:00 2001 From: declan-millar Date: Mon, 21 May 2018 18:16:04 +0100 Subject: [PATCH 4/9] Get soul magnitude before checking the rebalance setting --- apps/openmw/mwclass/misc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 8e39b44e9..c7e0796d5 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -87,10 +87,10 @@ namespace MWClass const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get().search(ref->mRef.getSoul()); if (creature) { + int soul = creature->mData.mSoul; if (Settings::Manager::getBool("rebalance soulgem values", "Game")) { // use soulgem value rebalance formula from morrowind code patch - int soul = creature->mData.mSoul; float soulValue = 0.0001 * pow(soul, 3) + 2 * soul; // for Azura's star add the unfilled value @@ -100,7 +100,7 @@ namespace MWClass value = soulValue; } else - value *= creature->mData.mSoul; + value *= soul; } } From 9ed4f330488342834e0301d3d50e223dcf889045 Mon Sep 17 00:00:00 2001 From: declan-millar Date: Mon, 21 May 2018 19:10:24 +0100 Subject: [PATCH 5/9] Replace spelling: soulgem -> soul gem --- apps/launcher/advancedpage.cpp | 4 ++-- apps/openmw/mwclass/misc.cpp | 2 +- files/settings-default.cfg | 4 ++-- files/ui/advancedpage.ui | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index dcf376362..9ae83419d 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -23,7 +23,7 @@ bool Launcher::AdvancedPage::loadSettings() loadSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game"); loadSettingBool(showMeleeInfoCheckBox, "show melee info", "Game"); loadSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game"); - loadSettingBool(rebalanceSoulgemValuesCheckBox, "rebalance soulgem values", "Game"); + loadSettingBool(rebalanceSoulGemValuesCheckBox, "rebalance soul gem values", "Game"); // Expected values are (0, 1, 2, 3) int showOwnedIndex = mEngineSettings.getInt("show owned", "Game"); @@ -62,7 +62,7 @@ void Launcher::AdvancedPage::saveSettings() saveSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game"); saveSettingBool(showMeleeInfoCheckBox, "show melee info", "Game"); saveSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game"); - saveSettingBool(rebalanceSoulgemValuesCheckBox, "rebalance soulgem values", "Game"); + saveSettingBool(rebalanceSoulGemValuesCheckBox, "rebalance soul gem values", "Game"); int showOwnedCurrentIndex = showOwnedComboBox->currentIndex(); if (showOwnedCurrentIndex != mEngineSettings.getInt("show owned", "Game")) diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index c7e0796d5..091bb3120 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -88,7 +88,7 @@ namespace MWClass if (creature) { int soul = creature->mData.mSoul; - if (Settings::Manager::getBool("rebalance soulgem values", "Game")) + if (Settings::Manager::getBool("rebalance soul gem values", "Game")) { // use soulgem value rebalance formula from morrowind code patch float soulValue = 0.0001 * pow(soul, 3) + 2 * soul; diff --git a/files/settings-default.cfg b/files/settings-default.cfg index a2524ff17..b10b91eb1 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -216,8 +216,8 @@ followers attack on sight = false # Can loot non-fighting actors during death animation can loot during death animation = true -# Makes the value of filled soulgems dependent only on soul magnitude (with formula from the Morrowind Code Patch) -rebalance soulgem values = false +# Makes the value of filled soul gems dependent only on soul magnitude (with formula from the Morrowind Code Patch) +rebalance soul gem values = false [General] diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui index 28d0f0543..f436b4db3 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -110,12 +110,12 @@ - + - <html><head/><body><p>If this setting is true, the value of filled soulgems is dependent only on soul magnitude.</p><p>The default value is false.</p></body></html> + <html><head/><body><p>If this setting is true, the value of filled soul gems is dependent only on soul magnitude.</p><p>The default value is false.</p></body></html> - Rebalance soulgem values + Rebalance soul gem values From 844aef85f33a31c8ad6c0f51d037cd53c18a8c0b Mon Sep 17 00:00:00 2001 From: declan-millar Date: Mon, 21 May 2018 22:12:19 +0100 Subject: [PATCH 6/9] Replace spelling: soulgem -> soul gem in code comment --- apps/openmw/mwclass/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 091bb3120..4188cf222 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -90,7 +90,7 @@ namespace MWClass int soul = creature->mData.mSoul; if (Settings::Manager::getBool("rebalance soul gem values", "Game")) { - // use soulgem value rebalance formula from morrowind code patch + // use the 'Soul gem value rebalance' formula from morrowind code patch float soulValue = 0.0001 * pow(soul, 3) + 2 * soul; // for Azura's star add the unfilled value From b8df4b7c5a3b0e4e9702fdf3eebe438cedc8ab7d Mon Sep 17 00:00:00 2001 From: declan-millar Date: Mon, 21 May 2018 22:14:23 +0100 Subject: [PATCH 7/9] Tidy in-code comment --- apps/openmw/mwclass/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 4188cf222..62b15bc86 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -90,7 +90,7 @@ namespace MWClass int soul = creature->mData.mSoul; if (Settings::Manager::getBool("rebalance soul gem values", "Game")) { - // use the 'Soul gem value rebalance' formula from morrowind code patch + // use the 'soul gem value rebalance' formula from the Morrowind Code Patch float soulValue = 0.0001 * pow(soul, 3) + 2 * soul; // for Azura's star add the unfilled value From 888c2d9a33c27b764e55793ecc5cee7a4364d446 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 22 May 2018 12:40:01 +0400 Subject: [PATCH 8/9] Render default land texture for Wilderness cells with distant terrain --- components/terrain/quadtreeworld.cpp | 37 +++++++++------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/components/terrain/quadtreeworld.cpp b/components/terrain/quadtreeworld.cpp index f31064805..bc26e084e 100644 --- a/components/terrain/quadtreeworld.cpp +++ b/components/terrain/quadtreeworld.cpp @@ -189,35 +189,22 @@ public: node->setViewDataMap(mViewDataMap); parent->addChild(node); - if (center.x() - size > mMaxX - || center.x() + size < mMinX - || center.y() - size > mMaxY - || center.y() + size < mMinY ) - // Out of bounds of the actual terrain - this will happen because - // we rounded the size up to the next power of two - { - // Still create and return an empty node so as to not break the assumption that each QuadTreeNode has either 4 or 0 children. - return node; - } - - if (node->getSize() <= mMinSize) - { - // We arrived at a leaf - float minZ,maxZ; - if (mStorage->getMinMaxHeights(size, center, minZ, maxZ)) - { - float cellWorldSize = mStorage->getCellWorldSize(); - osg::BoundingBox boundingBox(osg::Vec3f((center.x()-size)*cellWorldSize, (center.y()-size)*cellWorldSize, minZ), - osg::Vec3f((center.x()+size)*cellWorldSize, (center.y()+size)*cellWorldSize, maxZ)); - node->setBoundingBox(boundingBox); - } - return node; - } - else + if (node->getSize() > mMinSize) { addChildren(node); return node; } + + // We arrived at a leaf + float minZ, maxZ; + mStorage->getMinMaxHeights(size, center, minZ, maxZ); + + float cellWorldSize = mStorage->getCellWorldSize(); + osg::BoundingBox boundingBox(osg::Vec3f((center.x()-size)*cellWorldSize, (center.y()-size)*cellWorldSize, minZ), + osg::Vec3f((center.x()+size)*cellWorldSize, (center.y()+size)*cellWorldSize, maxZ)); + node->setBoundingBox(boundingBox); + + return node; } osg::ref_ptr getRootNode() From 2963524a013e679f2c48d0929ac8065a3840aedc Mon Sep 17 00:00:00 2001 From: declan-millar Date: Tue, 22 May 2018 12:59:27 +0100 Subject: [PATCH 9/9] set rebalance soul gem values to true by default --- files/settings-default.cfg | 2 +- files/ui/advancedpage.ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/settings-default.cfg b/files/settings-default.cfg index b10b91eb1..4483e3d9d 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -217,7 +217,7 @@ followers attack on sight = false can loot during death animation = true # Makes the value of filled soul gems dependent only on soul magnitude (with formula from the Morrowind Code Patch) -rebalance soul gem values = false +rebalance soul gem values = true [General] diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui index f436b4db3..4e0234e2e 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -112,7 +112,7 @@ - <html><head/><body><p>If this setting is true, the value of filled soul gems is dependent only on soul magnitude.</p><p>The default value is false.</p></body></html> + <html><head/><body><p>If this setting is true, the value of filled soul gems is dependent only on soul magnitude.</p><p>The default value is true.</p></body></html> Rebalance soul gem values