diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index 9b6e5fa8c..9ae83419d 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 soul gem 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 soul gem values", "Game"); int showOwnedCurrentIndex = showOwnedComboBox->currentIndex(); if (showOwnedCurrentIndex != mEngineSettings.getInt("show owned", "Game")) diff --git a/apps/openmw-mp/Script/LuaState.cpp b/apps/openmw-mp/Script/LuaState.cpp index da253573a..a57372cc6 100644 --- a/apps/openmw-mp/Script/LuaState.cpp +++ b/apps/openmw-mp/Script/LuaState.cpp @@ -261,7 +261,7 @@ LuaState::LuaState() }); lua->set_function("setHour", [](double hour) { - auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME); + auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME); tempWorldstate.hour = hour; tempWorldstate.month = -1; @@ -277,7 +277,7 @@ LuaState::LuaState() lua->set_function("setMonth", [](int month) { - auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME); + auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME); tempWorldstate.hour = -1; tempWorldstate.month = month; @@ -292,7 +292,7 @@ LuaState::LuaState() }); lua->set_function("setDay", [](int day) { - auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME); + auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME); tempWorldstate.hour = -1; tempWorldstate.month = -1; diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 1f5251f43..25e638a63 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/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 5a933d535..62b15bc86 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" @@ -85,7 +86,22 @@ namespace MWClass { const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get().search(ref->mRef.getSoul()); if (creature) - value *= creature->mData.mSoul; + { + int soul = creature->mData.mSoul; + if (Settings::Manager::getBool("rebalance soul gem values", "Game")) + { + // 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 + if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "Misc_SoulGem_Azura")) + value += soulValue; + else + value = soulValue; + } + else + value *= soul; + } } return value; 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 25542cc1d..adff4ea8e 100644 --- a/apps/openmw/mwgui/waitdialog.cpp +++ b/apps/openmw/mwgui/waitdialog.cpp @@ -238,7 +238,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()) diff --git a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp index e9f1f5f0c..57984d67a 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -92,7 +92,7 @@ #include "actor/ProcessorActorTest.hpp" #include "WorldstateProcessor.hpp" -#include "worldstate/ProcessorGameTime.hpp" +#include "worldstate/ProcessorWorldTime.hpp" using namespace mwmp; @@ -186,5 +186,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 74% rename from apps/openmw/mwmp/processors/worldstate/ProcessorGameTime.hpp rename to apps/openmw/mwmp/processors/worldstate/ProcessorWorldTime.hpp index f7730d8a7..9cc7d902b 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 final : public WorldstateProcessor + class ProcessorWorldTime final : 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 b3a9ba940..d41ec2d83 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 71f20ad43..f5f28f16a 100644 --- a/components/openmw-mp/Controllers/WorldstatePacketController.cpp +++ b/components/openmw-mp/Controllers/WorldstatePacketController.cpp @@ -1,8 +1,8 @@ -#include "../Packets/Worldstate/PacketGameTime.hpp" +#include "../Packets/Worldstate/PacketWorldTime.hpp" #include "WorldstatePacketController.hpp" 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 a51d3cb5c..655016a25 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -19,7 +19,7 @@ enum GameMessages ID_GUI_MESSAGEBOX, ID_GUI_WINDOW, - 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 d1c505cb8..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 final : public WorldstatePacket - { - public: - PacketGameTime(RakNet::RakPeerInterface *peer); - - void Packet(RakNet::BitStream *bs, bool send) override; - }; -} - -#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 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() diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 87443ff1a..4483e3d9d 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 soul gems dependent only on soul magnitude (with formula from the Morrowind Code Patch) +rebalance soul gem values = true + [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..4e0234e2e 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 soul gems is dependent only on soul magnitude.</p><p>The default value is true.</p></body></html> + + + Rebalance soul gem values + + +