Merge pull request #437 from TES3MP/0.6.3 while resolving conflicts

sol2-server-rewrite
David Cernat 7 years ago
commit 7083cb0359

@ -23,6 +23,7 @@ bool Launcher::AdvancedPage::loadSettings()
loadSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game"); loadSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
loadSettingBool(showMeleeInfoCheckBox, "show melee info", "Game"); loadSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
loadSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game"); loadSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
loadSettingBool(rebalanceSoulGemValuesCheckBox, "rebalance soul gem values", "Game");
// Expected values are (0, 1, 2, 3) // Expected values are (0, 1, 2, 3)
int showOwnedIndex = mEngineSettings.getInt("show owned", "Game"); int showOwnedIndex = mEngineSettings.getInt("show owned", "Game");
@ -61,6 +62,7 @@ void Launcher::AdvancedPage::saveSettings()
saveSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game"); saveSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
saveSettingBool(showMeleeInfoCheckBox, "show melee info", "Game"); saveSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
saveSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game"); saveSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
saveSettingBool(rebalanceSoulGemValuesCheckBox, "rebalance soul gem values", "Game");
int showOwnedCurrentIndex = showOwnedComboBox->currentIndex(); int showOwnedCurrentIndex = showOwnedComboBox->currentIndex();
if (showOwnedCurrentIndex != mEngineSettings.getInt("show owned", "Game")) if (showOwnedCurrentIndex != mEngineSettings.getInt("show owned", "Game"))

@ -261,7 +261,7 @@ LuaState::LuaState()
}); });
lua->set_function("setHour", [](double hour) { 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.hour = hour;
tempWorldstate.month = -1; tempWorldstate.month = -1;
@ -277,7 +277,7 @@ LuaState::LuaState()
lua->set_function("setMonth", [](int month) { 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.hour = -1;
tempWorldstate.month = month; tempWorldstate.month = month;
@ -292,7 +292,7 @@ LuaState::LuaState()
}); });
lua->set_function("setDay", [](int day) { 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.hour = -1;
tempWorldstate.month = -1; tempWorldstate.month = -1;

@ -133,7 +133,7 @@ add_openmw_dir (mwmp/processors/object BaseObjectProcessor ProcessorConsoleComma
ProcessorScriptMemberFloat ProcessorScriptGlobalShort ProcessorScriptGlobalFloat ProcessorScriptMemberFloat ProcessorScriptGlobalShort ProcessorScriptGlobalFloat
) )
add_openmw_dir (mwmp/processors/worldstate ProcessorGameTime add_openmw_dir (mwmp/processors/worldstate ProcessorWorldTime
) )
# Main executable # Main executable

@ -1,6 +1,7 @@
#include "misc.hpp" #include "misc.hpp"
#include <components/esm/loadmisc.hpp> #include <components/esm/loadmisc.hpp>
#include <components/settings/settings.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -85,7 +86,22 @@ namespace MWClass
{ {
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().search(ref->mRef.getSoul()); const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().search(ref->mRef.getSoul());
if (creature) 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; return value;

@ -124,7 +124,16 @@ namespace MWGui
for (int i=0; i<mDays*24; ++i) for (int i=0; i<mDays*24; ++i)
MWBase::Environment::get().getMechanicsManager()->rest(true); MWBase::Environment::get().getMechanicsManager()->rest(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<int> skills; std::set<int> skills;
for (int day=0; day<mDays; ++day) for (int day=0; day<mDays; ++day)

@ -194,7 +194,16 @@ namespace MWGui
// advance time // advance time
MWBase::Environment::get().getMechanicsManager()->rest(false); MWBase::Environment::get().getMechanicsManager()->rest(false);
MWBase::Environment::get().getMechanicsManager()->rest(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); setVisible(false);
mProgressBar.setVisible(true); mProgressBar.setVisible(true);

@ -177,7 +177,16 @@ namespace MWGui
{ {
MWBase::Environment::get().getMechanicsManager ()->rest (true); 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); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);

@ -238,7 +238,16 @@ namespace MWGui
{ {
mProgressBar.setProgress(cur, total); mProgressBar.setProgress(cur, total);
MWBase::Environment::get().getMechanicsManager()->rest(mSleeping); 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(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
if (player.getClass().getCreatureStats(player).isDead()) if (player.getClass().getCreatureStats(player).isDead())

@ -92,7 +92,7 @@
#include "actor/ProcessorActorTest.hpp" #include "actor/ProcessorActorTest.hpp"
#include "WorldstateProcessor.hpp" #include "WorldstateProcessor.hpp"
#include "worldstate/ProcessorGameTime.hpp" #include "worldstate/ProcessorWorldTime.hpp"
using namespace mwmp; using namespace mwmp;
@ -186,5 +186,5 @@ void ProcessorInitializer()
ActorProcessor::AddProcessor(new ProcessorActorStatsDynamic()); ActorProcessor::AddProcessor(new ProcessorActorStatsDynamic());
ActorProcessor::AddProcessor(new ProcessorActorTest()); ActorProcessor::AddProcessor(new ProcessorActorTest());
WorldstateProcessor::AddProcessor(new ProcessorGameTime()); WorldstateProcessor::AddProcessor(new ProcessorWorldTime());
} }

@ -1,5 +1,5 @@
#ifndef OPENMW_PROCESSORGAMETIME_HPP #ifndef OPENMW_PROCESSORWORLDTIME_HPP
#define OPENMW_PROCESSORGAMETIME_HPP #define OPENMW_PROCESSORWORLDTIME_HPP
#include <apps/openmw/mwbase/world.hpp> #include <apps/openmw/mwbase/world.hpp>
@ -8,12 +8,12 @@
namespace mwmp namespace mwmp
{ {
class ProcessorGameTime final : public WorldstateProcessor class ProcessorWorldTime final : public WorldstateProcessor
{ {
public: public:
ProcessorGameTime() ProcessorWorldTime()
{ {
BPP_INIT(ID_GAME_TIME) BPP_INIT(ID_WORLD_TIME)
} }
virtual void Do(WorldstatePacket &packet, BaseWorldstate &worldstate) virtual void Do(WorldstatePacket &packet, BaseWorldstate &worldstate)
@ -34,4 +34,4 @@ namespace mwmp
#endif //OPENMW_PROCESSORGAMETIME_HPP #endif //OPENMW_PROCESSORWORLDTIME_HPP

@ -198,7 +198,7 @@ add_component_dir (openmw-mp/Packets/Object
add_component_dir (openmw-mp/Packets/Worldstate add_component_dir (openmw-mp/Packets/Worldstate
WorldstatePacket WorldstatePacket
PacketGameTime PacketWorldTime
) )
add_component_dir (fallback add_component_dir (fallback

@ -1,8 +1,8 @@
#include "../Packets/Worldstate/PacketGameTime.hpp" #include "../Packets/Worldstate/PacketWorldTime.hpp"
#include "WorldstatePacketController.hpp" #include "WorldstatePacketController.hpp"
mwmp::WorldstatePacketController::WorldstatePacketController(RakNet::RakPeerInterface *peer) mwmp::WorldstatePacketController::WorldstatePacketController(RakNet::RakPeerInterface *peer)
{ {
AddPacket<PacketGameTime>(&packets, peer); AddPacket<PacketWorldTime>(&packets, peer);
} }

@ -19,7 +19,7 @@ enum GameMessages
ID_GUI_MESSAGEBOX, ID_GUI_MESSAGEBOX,
ID_GUI_WINDOW, ID_GUI_WINDOW,
ID_GAME_TIME, ID_WORLD_TIME,
ID_GAME_WEATHER, ID_GAME_WEATHER,
ID_PLAYER_BASEINFO, ID_PLAYER_BASEINFO,

@ -1,17 +0,0 @@
#ifndef OPENMW_PACKETGAMETIME_HPP
#define OPENMW_PACKETGAMETIME_HPP
#include <components/openmw-mp/Packets/Worldstate/WorldstatePacket.hpp>
namespace mwmp
{
class PacketGameTime final : public WorldstatePacket
{
public:
PacketGameTime(RakNet::RakPeerInterface *peer);
void Packet(RakNet::BitStream *bs, bool send) override;
};
}
#endif //OPENMW_PACKETGAMETIME_HPP

@ -1,15 +1,15 @@
#include "PacketGameTime.hpp" #include "PacketWorldTime.hpp"
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
using namespace mwmp; 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; orderChannel = CHANNEL_SYSTEM;
} }
void PacketGameTime::Packet(RakNet::BitStream *bs, bool send) void PacketWorldTime::Packet(RakNet::BitStream *bs, bool send)
{ {
WorldstatePacket::Packet(bs, send); WorldstatePacket::Packet(bs, send);

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETWORLDTIME_HPP
#define OPENMW_PACKETWORLDTIME_HPP
#include <components/openmw-mp/Packets/Worldstate/WorldstatePacket.hpp>
namespace mwmp
{
class PacketWorldTime : public WorldstatePacket
{
public:
PacketWorldTime(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETWORLDTIME_HPP

@ -189,36 +189,23 @@ public:
node->setViewDataMap(mViewDataMap); node->setViewDataMap(mViewDataMap);
parent->addChild(node); parent->addChild(node);
if (center.x() - size > mMaxX if (node->getSize() > mMinSize)
|| center.x() + size < mMinX {
|| center.y() - size > mMaxY addChildren(node);
|| 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; return node;
} }
if (node->getSize() <= mMinSize)
{
// We arrived at a leaf // We arrived at a leaf
float minZ, maxZ; float minZ, maxZ;
if (mStorage->getMinMaxHeights(size, center, minZ, maxZ)) mStorage->getMinMaxHeights(size, center, minZ, maxZ);
{
float cellWorldSize = mStorage->getCellWorldSize(); float cellWorldSize = mStorage->getCellWorldSize();
osg::BoundingBox boundingBox(osg::Vec3f((center.x()-size)*cellWorldSize, (center.y()-size)*cellWorldSize, minZ), 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)); osg::Vec3f((center.x()+size)*cellWorldSize, (center.y()+size)*cellWorldSize, maxZ));
node->setBoundingBox(boundingBox); node->setBoundingBox(boundingBox);
}
return node;
}
else
{
addChildren(node);
return node; return node;
} }
}
osg::ref_ptr<RootNode> getRootNode() osg::ref_ptr<RootNode> getRootNode()
{ {

@ -216,6 +216,9 @@ followers attack on sight = false
# Can loot non-fighting actors during death animation # Can loot non-fighting actors during death animation
can loot during death animation = true 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] [General]
# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16). # Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).

@ -109,6 +109,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="rebalanceSoulGemValuesCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, the value of filled soul gems is dependent only on soul magnitude.&lt;/p&gt;&lt;p&gt;The default value is true.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Rebalance soul gem values</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignLeft"> <item alignment="Qt::AlignLeft">
<widget class="QWidget" name="showOwnedGroup" native="true"> <widget class="QWidget" name="showOwnedGroup" native="true">
<property name="toolTip"> <property name="toolTip">

Loading…
Cancel
Save