From 4b1247597ea82c9c77cfe40ff2e88db885e84fe4 Mon Sep 17 00:00:00 2001 From: declan-millar Date: Sun, 20 May 2018 17:06:26 +0100 Subject: [PATCH 01/12] 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 02/12] 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 03/12] 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 04/12] 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 05/12] 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 06/12] 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 07/12] 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 08/12] 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 09/12] 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 From da66face25acf4474a5936240b00a599c4c59b2e Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 22 May 2018 08:53:33 +0300 Subject: [PATCH 10/12] [General] Rename GameTime packet into WorldTime --- apps/openmw-mp/Script/Functions/Worldstate.cpp | 12 ++++++------ apps/openmw-mp/Script/Functions/Worldstate.hpp | 6 +++--- apps/openmw/CMakeLists.txt | 2 +- .../mwmp/processors/ProcessorInitializer.cpp | 4 ++-- ...essorGameTime.hpp => ProcessorWorldTime.hpp} | 12 ++++++------ components/CMakeLists.txt | 2 +- .../Controllers/WorldstatePacketController.cpp | 4 ++-- components/openmw-mp/NetworkMessages.hpp | 2 +- .../Packets/Worldstate/PacketGameTime.hpp | 17 ----------------- .../{PacketGameTime.cpp => PacketWorldTime.cpp} | 8 ++++---- .../Packets/Worldstate/PacketWorldTime.hpp | 17 +++++++++++++++++ 11 files changed, 43 insertions(+), 43 deletions(-) rename apps/openmw/mwmp/processors/worldstate/{ProcessorGameTime.hpp => ProcessorWorldTime.hpp} (75%) delete mode 100644 components/openmw-mp/Packets/Worldstate/PacketGameTime.hpp rename components/openmw-mp/Packets/Worldstate/{PacketGameTime.cpp => PacketWorldTime.cpp} (54%) create mode 100644 components/openmw-mp/Packets/Worldstate/PacketWorldTime.hpp diff --git a/apps/openmw-mp/Script/Functions/Worldstate.cpp b/apps/openmw-mp/Script/Functions/Worldstate.cpp index 0460e3915..d8ee3d589 100644 --- a/apps/openmw-mp/Script/Functions/Worldstate.cpp +++ b/apps/openmw-mp/Script/Functions/Worldstate.cpp @@ -23,8 +23,8 @@ void WorldstateFunctions::SetHour(unsigned short pid, double hour) noexcept writeWorldstate.month = -1; writeWorldstate.day = -1; - mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->setWorldstate(&writeWorldstate); - mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->Send(false); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME)->setWorldstate(&writeWorldstate); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME)->Send(false); } void WorldstateFunctions::SetMonth(unsigned short pid, int month) noexcept @@ -38,8 +38,8 @@ void WorldstateFunctions::SetMonth(unsigned short pid, int month) noexcept writeWorldstate.month = month; writeWorldstate.day = -1; - mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->setWorldstate(&writeWorldstate); - mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->Send(false); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME)->setWorldstate(&writeWorldstate); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME)->Send(false); } @@ -54,6 +54,6 @@ void WorldstateFunctions::SetDay(unsigned short pid, int day) noexcept writeWorldstate.month = -1; writeWorldstate.day = day; - mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->setWorldstate(&writeWorldstate); - mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->Send(false); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME)->setWorldstate(&writeWorldstate); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME)->Send(false); } diff --git a/apps/openmw-mp/Script/Functions/Worldstate.hpp b/apps/openmw-mp/Script/Functions/Worldstate.hpp index 5a1f6ee8a..1078a38f8 100644 --- a/apps/openmw-mp/Script/Functions/Worldstate.hpp +++ b/apps/openmw-mp/Script/Functions/Worldstate.hpp @@ -13,7 +13,7 @@ class WorldstateFunctions public: /** - * \brief Set the game hour for a player and send a GameTime packet to that player. + * \brief Set the game hour for a player and send a WorldTime packet to that player. * * \param pid The player ID. * \param hour The hour. @@ -22,7 +22,7 @@ public: static void SetHour(unsigned short pid, double hour) noexcept; /** - * \brief Set the game month for a player and send a GameTime packet to that player. + * \brief Set the game month for a player and send a WorldTime packet to that player. * * \param pid The player ID. * \param month The month. @@ -31,7 +31,7 @@ public: static void SetMonth(unsigned short pid, int month) noexcept; /** - * \brief Set the game day for a player and send a GameTime packet to that player. + * \brief Set the game day for a player and send a WorldTime packet to that player. * * \param pid The player ID. * \param day The day. diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index ddea2b435..3d9b13cdf 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -133,7 +133,7 @@ add_openmw_dir (mwmp/processors/object BaseObjectProcessor ProcessorConsoleComma ProcessorScriptMemberFloat ProcessorScriptGlobalShort ProcessorScriptGlobalFloat ) -add_openmw_dir (mwmp/processors/worldstate ProcessorGameTime +add_openmw_dir (mwmp/processors/worldstate ProcessorWorldTime ) # Main executable diff --git a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp index 95d32842e..5e4e8f5d6 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -91,7 +91,7 @@ #include "actor/ProcessorActorTest.hpp" #include "WorldstateProcessor.hpp" -#include "worldstate/ProcessorGameTime.hpp" +#include "worldstate/ProcessorWorldTime.hpp" using namespace mwmp; @@ -184,5 +184,5 @@ void ProcessorInitializer() ActorProcessor::AddProcessor(new ProcessorActorStatsDynamic()); ActorProcessor::AddProcessor(new ProcessorActorTest()); - WorldstateProcessor::AddProcessor(new ProcessorGameTime()); + WorldstateProcessor::AddProcessor(new ProcessorWorldTime()); } diff --git a/apps/openmw/mwmp/processors/worldstate/ProcessorGameTime.hpp b/apps/openmw/mwmp/processors/worldstate/ProcessorWorldTime.hpp similarity index 75% rename from apps/openmw/mwmp/processors/worldstate/ProcessorGameTime.hpp rename to apps/openmw/mwmp/processors/worldstate/ProcessorWorldTime.hpp index ce0180536..965674e92 100644 --- a/apps/openmw/mwmp/processors/worldstate/ProcessorGameTime.hpp +++ b/apps/openmw/mwmp/processors/worldstate/ProcessorWorldTime.hpp @@ -1,5 +1,5 @@ -#ifndef OPENMW_PROCESSORGAMETIME_HPP -#define OPENMW_PROCESSORGAMETIME_HPP +#ifndef OPENMW_PROCESSORWORLDTIME_HPP +#define OPENMW_PROCESSORWORLDTIME_HPP #include @@ -8,12 +8,12 @@ namespace mwmp { - class ProcessorGameTime : public WorldstateProcessor + class ProcessorWorldTime : public WorldstateProcessor { public: - ProcessorGameTime() + ProcessorWorldTime() { - BPP_INIT(ID_GAME_TIME) + BPP_INIT(ID_WORLD_TIME) } virtual void Do(WorldstatePacket &packet, BaseWorldstate &worldstate) @@ -34,4 +34,4 @@ namespace mwmp -#endif //OPENMW_PROCESSORGAMETIME_HPP +#endif //OPENMW_PROCESSORWORLDTIME_HPP diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 6f6bfcc1f..7bf2535fc 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -198,7 +198,7 @@ add_component_dir (openmw-mp/Packets/Object add_component_dir (openmw-mp/Packets/Worldstate WorldstatePacket - PacketGameTime + PacketWorldTime ) add_component_dir (fallback diff --git a/components/openmw-mp/Controllers/WorldstatePacketController.cpp b/components/openmw-mp/Controllers/WorldstatePacketController.cpp index 667d29b08..d9d575119 100644 --- a/components/openmw-mp/Controllers/WorldstatePacketController.cpp +++ b/components/openmw-mp/Controllers/WorldstatePacketController.cpp @@ -1,4 +1,4 @@ -#include "../Packets/Worldstate/PacketGameTime.hpp" +#include "../Packets/Worldstate/PacketWorldTime.hpp" #include "WorldstatePacketController.hpp" @@ -12,7 +12,7 @@ inline void AddPacket(mwmp::WorldstatePacketController::packets_t *packets, RakN mwmp::WorldstatePacketController::WorldstatePacketController(RakNet::RakPeerInterface *peer) { - AddPacket(&packets, peer); + AddPacket(&packets, peer); } diff --git a/components/openmw-mp/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index 7bf23145b..143553a7f 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -18,7 +18,7 @@ enum GameMessages ID_LOADED, ID_GUI_MESSAGEBOX, - ID_GAME_TIME, + ID_WORLD_TIME, ID_GAME_WEATHER, ID_PLAYER_BASEINFO, diff --git a/components/openmw-mp/Packets/Worldstate/PacketGameTime.hpp b/components/openmw-mp/Packets/Worldstate/PacketGameTime.hpp deleted file mode 100644 index e081e1d0c..000000000 --- a/components/openmw-mp/Packets/Worldstate/PacketGameTime.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef OPENMW_PACKETGAMETIME_HPP -#define OPENMW_PACKETGAMETIME_HPP - -#include - -namespace mwmp -{ - class PacketGameTime : public WorldstatePacket - { - public: - PacketGameTime(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, bool send); - }; -} - -#endif //OPENMW_PACKETGAMETIME_HPP diff --git a/components/openmw-mp/Packets/Worldstate/PacketGameTime.cpp b/components/openmw-mp/Packets/Worldstate/PacketWorldTime.cpp similarity index 54% rename from components/openmw-mp/Packets/Worldstate/PacketGameTime.cpp rename to components/openmw-mp/Packets/Worldstate/PacketWorldTime.cpp index 8c1ff7ffc..af270be62 100644 --- a/components/openmw-mp/Packets/Worldstate/PacketGameTime.cpp +++ b/components/openmw-mp/Packets/Worldstate/PacketWorldTime.cpp @@ -1,15 +1,15 @@ -#include "PacketGameTime.hpp" +#include "PacketWorldTime.hpp" #include using namespace mwmp; -PacketGameTime::PacketGameTime(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer) +PacketWorldTime::PacketWorldTime(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer) { - packetID = ID_GAME_TIME; + packetID = ID_WORLD_TIME; orderChannel = CHANNEL_SYSTEM; } -void PacketGameTime::Packet(RakNet::BitStream *bs, bool send) +void PacketWorldTime::Packet(RakNet::BitStream *bs, bool send) { WorldstatePacket::Packet(bs, send); diff --git a/components/openmw-mp/Packets/Worldstate/PacketWorldTime.hpp b/components/openmw-mp/Packets/Worldstate/PacketWorldTime.hpp new file mode 100644 index 000000000..5a9e93723 --- /dev/null +++ b/components/openmw-mp/Packets/Worldstate/PacketWorldTime.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETWORLDTIME_HPP +#define OPENMW_PACKETWORLDTIME_HPP + +#include + +namespace mwmp +{ + class PacketWorldTime : public WorldstatePacket + { + public: + PacketWorldTime(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETWORLDTIME_HPP From 02ba641bef46874246a706bbed99ef2fd3101ee2 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Wed, 23 May 2018 05:48:28 +0300 Subject: [PATCH 11/12] [Server] Use correct index changes for dynamic stat script functions --- apps/openmw-mp/Script/Functions/Stats.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index 5195044e6..fe3d876e6 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -359,7 +359,7 @@ void StatsFunctions::SetHealthBase(unsigned short pid, double value) noexcept player->creatureStats.mDynamic[0].mBase = value; if (!Utils::vectorContains(&player->statsDynamicIndexChanges, 0)) - player->skillIndexChanges.push_back(0); + player->statsDynamicIndexChanges.push_back(0); } void StatsFunctions::SetHealthCurrent(unsigned short pid, double value) noexcept @@ -370,7 +370,7 @@ void StatsFunctions::SetHealthCurrent(unsigned short pid, double value) noexcept player->creatureStats.mDynamic[0].mCurrent = value; if (!Utils::vectorContains(&player->statsDynamicIndexChanges, 0)) - player->skillIndexChanges.push_back(0); + player->statsDynamicIndexChanges.push_back(0); } void StatsFunctions::SetMagickaBase(unsigned short pid, double value) noexcept @@ -381,7 +381,7 @@ void StatsFunctions::SetMagickaBase(unsigned short pid, double value) noexcept player->creatureStats.mDynamic[1].mBase = value; if (!Utils::vectorContains(&player->statsDynamicIndexChanges, 1)) - player->skillIndexChanges.push_back(1); + player->statsDynamicIndexChanges.push_back(1); } void StatsFunctions::SetMagickaCurrent(unsigned short pid, double value) noexcept @@ -392,7 +392,7 @@ void StatsFunctions::SetMagickaCurrent(unsigned short pid, double value) noexcep player->creatureStats.mDynamic[1].mCurrent = value; if (!Utils::vectorContains(&player->statsDynamicIndexChanges, 1)) - player->skillIndexChanges.push_back(1); + player->statsDynamicIndexChanges.push_back(1); } void StatsFunctions::SetFatigueBase(unsigned short pid, double value) noexcept @@ -403,7 +403,7 @@ void StatsFunctions::SetFatigueBase(unsigned short pid, double value) noexcept player->creatureStats.mDynamic[2].mBase = value; if (!Utils::vectorContains(&player->statsDynamicIndexChanges, 2)) - player->skillIndexChanges.push_back(2); + player->statsDynamicIndexChanges.push_back(2); } void StatsFunctions::SetFatigueCurrent(unsigned short pid, double value) noexcept @@ -414,7 +414,7 @@ void StatsFunctions::SetFatigueCurrent(unsigned short pid, double value) noexcep player->creatureStats.mDynamic[2].mCurrent = value; if (!Utils::vectorContains(&player->statsDynamicIndexChanges, 2)) - player->skillIndexChanges.push_back(2); + player->statsDynamicIndexChanges.push_back(2); } void StatsFunctions::SetAttributeBase(unsigned short pid, unsigned short attributeId, int value) noexcept From 031a80ed5a9caefa736d1f01e275b10252a412a1 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Wed, 23 May 2018 05:49:51 +0300 Subject: [PATCH 12/12] [Client] Don't advance time when waiting, traveling, training or jailed --- apps/openmw/mwgui/jailscreen.cpp | 11 ++++++++++- apps/openmw/mwgui/trainingwindow.cpp | 11 ++++++++++- apps/openmw/mwgui/travelwindow.cpp | 11 ++++++++++- apps/openmw/mwgui/waitdialog.cpp | 11 ++++++++++- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/jailscreen.cpp b/apps/openmw/mwgui/jailscreen.cpp index 7b3d87a7c..a86f9d176 100644 --- a/apps/openmw/mwgui/jailscreen.cpp +++ b/apps/openmw/mwgui/jailscreen.cpp @@ -124,7 +124,16 @@ namespace MWGui for (int i=0; irest(true); - MWBase::Environment::get().getWorld()->advanceTime(mDays * 24); + + /* + Start of tes3mp change (major) + + Multiplayer requires that time not get advanced here + */ + //MWBase::Environment::get().getWorld()->advanceTime(mDays * 24); + /* + End of tes3mp change (major) + */ std::set skills; for (int day=0; dayrest(false); MWBase::Environment::get().getMechanicsManager()->rest(false); - MWBase::Environment::get().getWorld ()->advanceTime (2); + + /* + Start of tes3mp change (major) + + Multiplayer requires that time not get advanced here + */ + //MWBase::Environment::get().getWorld ()->advanceTime (2); + /* + End of tes3mp change (major) + */ setVisible(false); mProgressBar.setVisible(true); diff --git a/apps/openmw/mwgui/travelwindow.cpp b/apps/openmw/mwgui/travelwindow.cpp index 7b65eb771..81c977bd0 100644 --- a/apps/openmw/mwgui/travelwindow.cpp +++ b/apps/openmw/mwgui/travelwindow.cpp @@ -177,7 +177,16 @@ namespace MWGui { MWBase::Environment::get().getMechanicsManager ()->rest (true); } - MWBase::Environment::get().getWorld()->advanceTime(hours); + + /* + Start of tes3mp change (major) + + Multiplayer requires that time not get advanced here + */ + //MWBase::Environment::get().getWorld()->advanceTime(hours); + /* + End of tes3mp change (major) + */ } MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel); diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp index 61febf315..24eedd6ac 100644 --- a/apps/openmw/mwgui/waitdialog.cpp +++ b/apps/openmw/mwgui/waitdialog.cpp @@ -228,7 +228,16 @@ namespace MWGui { mProgressBar.setProgress(cur, total); MWBase::Environment::get().getMechanicsManager()->rest(mSleeping); - MWBase::Environment::get().getWorld()->advanceTime(1); + + /* + Start of tes3mp change (major) + + Multiplayer requires that time not get advanced here + */ + //MWBase::Environment::get().getWorld()->advanceTime(1); + /* + End of tes3mp change (major) + */ MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); if (player.getClass().getCreatureStats(player).isDead())