diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index d2bf50bbd..e122a4b8a 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -171,6 +171,15 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } + case ID_PLAYER_CELL_LOAD: + { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_CELL_LOAD from %s", + player->Npc()->mName.c_str()); + + Script::Call(player->getId()); + + break; + } case ID_GAME_ATTRIBUTE: { diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index 50c973e69..1b85a79db 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -107,6 +107,7 @@ public: {"OnPlayerDeath", Function()}, {"OnPlayerResurrect", Function()}, {"OnPlayerChangeCell", Function()}, + {"OnPlayerCellLoad", Function()}, {"OnPlayerChangeAttributes", Function()}, {"OnPlayerChangeSkills", Function()}, {"OnPlayerChangeLevel", Function()}, diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 82bdfeeaf..d224e4e50 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -532,6 +532,10 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } + case ID_PLAYER_CELL_LOAD: + { + break; + } case ID_GAME_DRAWSTATE: { if (guid == myGuid) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 07f055495..48b6e8aa2 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -159,6 +159,7 @@ add_component_dir (openmw-mp Packets/Player/PacketGUIBoxes Packets/Player/PacketClass Packets/Player/PacketTime Packets/Player/PacketInventory Packets/Player/PacketSpellbook Packets/Player/PacketJournal Packets/Player/PacketActiveSkills Packets/Player/PacketPlayerCellChange + Packets/Player/PacketPlayerCellLoad Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectLock Packets/World/PacketObjectUnlock Packets/World/PacketObjectScale Packets/World/PacketObjectMove diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index 56c4477a6..613bd7266 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -4,6 +4,8 @@ #include "../Packets/Player/PacketClass.hpp" #include "../Packets/Player/PacketPosition.hpp" +#include "../Packets/Player/PacketPlayerCellChange.hpp" +#include "../Packets/Player/PacketPlayerCellLoad.hpp" #include "../Packets/Player/PacketBaseInfo.hpp" #include "../Packets/Player/PacketEquipment.hpp" #include "../Packets/Player/PacketAttack.hpp" @@ -27,7 +29,6 @@ #include "../Packets/Player/PacketJournal.hpp" #include "../Packets/Player/PacketConsole.hpp" #include "../Packets/Player/PacketActiveSkills.hpp" -#include "../Packets/Player/PacketPlayerCellChange.hpp" #include "PlayerPacketController.hpp" @@ -43,6 +44,8 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p { AddPacket(&packets, peer); AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); diff --git a/components/openmw-mp/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index e0c4afcaf..7134bdf3e 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -37,6 +37,7 @@ enum GameMessages ID_GAME_ACTIVESKILLS, ID_PLAYER_CELL_CHANGE, + ID_PLAYER_CELL_LOAD, ID_OBJECT_PLACE, ID_OBJECT_DELETE, diff --git a/components/openmw-mp/Packets/Player/PacketPlayerCellLoad.cpp b/components/openmw-mp/Packets/Player/PacketPlayerCellLoad.cpp new file mode 100644 index 000000000..8c1ea97bd --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerCellLoad.cpp @@ -0,0 +1,20 @@ +#include +#include "PacketPlayerCellLoad.hpp" + + +mwmp::PacketPlayerCellLoad::PacketPlayerCellLoad(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +{ + packetID = ID_PLAYER_CELL_CHANGE; + priority = IMMEDIATE_PRIORITY; + reliability = RELIABLE_ORDERED; +} + +void mwmp::PacketPlayerCellLoad::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) +{ + PlayerPacket::Packet(bs, player, send); + + RW(player->getCell()->mData.mFlags, send); + RW(player->getCell()->mData.mX, send); + RW(player->getCell()->mData.mY, send); + RW(player->getCell()->mName, send); +} diff --git a/components/openmw-mp/Packets/Player/PacketPlayerCellLoad.hpp b/components/openmw-mp/Packets/Player/PacketPlayerCellLoad.hpp new file mode 100644 index 000000000..6b60752da --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerCellLoad.hpp @@ -0,0 +1,20 @@ +#ifndef OPENMW_PACKETPLAYERCELLLOAD_HPP +#define OPENMW_PACKETPLAYERCELLLOAD_HPP + + +#include + +namespace mwmp +{ + class PacketPlayerCellLoad : public PlayerPacket + { + public: + PacketPlayerCellLoad(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); + }; +} + + + +#endif //OPENMW_PACKETPLAYERCELLLOAD_HPP