forked from mirror/openmw-tes3mp
[General] Add placeholder ActorList, ActorAuthority & ActorFrame packets
This commit is contained in:
parent
316720e710
commit
8c2469bf6d
15 changed files with 298 additions and 1 deletions
|
@ -25,14 +25,17 @@
|
||||||
#include "processors/player/ProcessorGUIMessageBox.hpp"
|
#include "processors/player/ProcessorGUIMessageBox.hpp"
|
||||||
#include "processors/player/ProcessorPlayerCharClass.hpp"
|
#include "processors/player/ProcessorPlayerCharClass.hpp"
|
||||||
#include "WorldProcessor.hpp"
|
#include "WorldProcessor.hpp"
|
||||||
|
#include "processors/world/ProcessorActorList.hpp"
|
||||||
|
#include "processors/world/ProcessorActorAuthority.hpp"
|
||||||
|
#include "processors/world/ProcessorActorFrame.hpp"
|
||||||
#include "processors/world/ProcessorContainer.hpp"
|
#include "processors/world/ProcessorContainer.hpp"
|
||||||
#include "processors/world/ProcessorDoorState.hpp"
|
#include "processors/world/ProcessorDoorState.hpp"
|
||||||
#include "processors/world/ProcessorMusicPlay.hpp"
|
#include "processors/world/ProcessorMusicPlay.hpp"
|
||||||
#include "processors/world/ProcessorObjectAnimPlay.hpp"
|
#include "processors/world/ProcessorObjectAnimPlay.hpp"
|
||||||
#include "processors/world/ProcessorObjectDelete.hpp"
|
#include "processors/world/ProcessorObjectDelete.hpp"
|
||||||
|
#include "processors/world/ProcessorObjectPlace.hpp"
|
||||||
#include "processors/world/ProcessorObjectLock.hpp"
|
#include "processors/world/ProcessorObjectLock.hpp"
|
||||||
#include "processors/world/ProcessorObjectMove.hpp"
|
#include "processors/world/ProcessorObjectMove.hpp"
|
||||||
#include "processors/world/ProcessorObjectPlace.hpp"
|
|
||||||
#include "processors/world/ProcessorObjectRotate.hpp"
|
#include "processors/world/ProcessorObjectRotate.hpp"
|
||||||
#include "processors/world/ProcessorObjectScale.hpp"
|
#include "processors/world/ProcessorObjectScale.hpp"
|
||||||
#include "processors/world/ProcessorObjectUnlock.hpp"
|
#include "processors/world/ProcessorObjectUnlock.hpp"
|
||||||
|
@ -67,6 +70,9 @@ void ProcessorInitializer()
|
||||||
PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox());
|
PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox());
|
||||||
PlayerProcessor::AddProcessor(new ProcessorPlayerCharClass());
|
PlayerProcessor::AddProcessor(new ProcessorPlayerCharClass());
|
||||||
|
|
||||||
|
WorldProcessor::AddProcessor(new ProcessorActorList());
|
||||||
|
WorldProcessor::AddProcessor(new ProcessorActorAuthority());
|
||||||
|
WorldProcessor::AddProcessor(new ProcessorActorFrame());
|
||||||
WorldProcessor::AddProcessor(new ProcessorContainer());
|
WorldProcessor::AddProcessor(new ProcessorContainer());
|
||||||
WorldProcessor::AddProcessor(new ProcessorDoorState());
|
WorldProcessor::AddProcessor(new ProcessorDoorState());
|
||||||
WorldProcessor::AddProcessor(new ProcessorMusicPlay());
|
WorldProcessor::AddProcessor(new ProcessorMusicPlay());
|
||||||
|
|
|
@ -121,6 +121,8 @@ public:
|
||||||
{"OnPlayerInventoryChange", Function<void, unsigned short>()},
|
{"OnPlayerInventoryChange", Function<void, unsigned short>()},
|
||||||
{"OnPlayerSpellbookChange", Function<void, unsigned short>()},
|
{"OnPlayerSpellbookChange", Function<void, unsigned short>()},
|
||||||
{"OnPlayerJournalChange", Function<void, unsigned short>()},
|
{"OnPlayerJournalChange", Function<void, unsigned short>()},
|
||||||
|
{"OnActorList", Function<void, unsigned short, const char*>()},
|
||||||
|
{"OnActorFrame", Function<void, unsigned short, const char*>()},
|
||||||
{"OnObjectPlace", Function<void, unsigned short, const char*>()},
|
{"OnObjectPlace", Function<void, unsigned short, const char*>()},
|
||||||
{"OnObjectDelete", Function<void, unsigned short, const char*>()},
|
{"OnObjectDelete", Function<void, unsigned short, const char*>()},
|
||||||
{"OnObjectScale", Function<void, unsigned short, const char*>()},
|
{"OnObjectScale", Function<void, unsigned short, const char*>()},
|
||||||
|
|
23
apps/openmw-mp/processors/world/ProcessorActorAuthority.hpp
Normal file
23
apps/openmw-mp/processors/world/ProcessorActorAuthority.hpp
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef OPENMW_PROCESSORACTORAUTHORITY_HPP
|
||||||
|
#define OPENMW_PROCESSORACTORAUTHORITY_HPP
|
||||||
|
|
||||||
|
#include "apps/openmw-mp/WorldProcessor.hpp"
|
||||||
|
|
||||||
|
namespace mwmp
|
||||||
|
{
|
||||||
|
class ProcessorActorAuthority : public WorldProcessor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ProcessorActorAuthority()
|
||||||
|
{
|
||||||
|
BPP_INIT(ID_ACTOR_AUTHORITY)
|
||||||
|
}
|
||||||
|
|
||||||
|
void Do(WorldPacket &packet, Player &player, BaseEvent &event) override
|
||||||
|
{
|
||||||
|
packet.Send(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //OPENMW_PROCESSORACTORAUTHORITY_HPP
|
25
apps/openmw-mp/processors/world/ProcessorActorFrame.hpp
Normal file
25
apps/openmw-mp/processors/world/ProcessorActorFrame.hpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef OPENMW_PROCESSORACTORFRAME_HPP
|
||||||
|
#define OPENMW_PROCESSORACTORFRAME_HPP
|
||||||
|
|
||||||
|
#include "apps/openmw-mp/WorldProcessor.hpp"
|
||||||
|
|
||||||
|
namespace mwmp
|
||||||
|
{
|
||||||
|
class ProcessorActorFrame : public WorldProcessor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ProcessorActorFrame()
|
||||||
|
{
|
||||||
|
BPP_INIT(ID_ACTOR_FRAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
void Do(WorldPacket &packet, Player &player, BaseEvent &event) override
|
||||||
|
{
|
||||||
|
packet.Send(true);
|
||||||
|
|
||||||
|
Script::Call<Script::CallbackIdentity("OnActorFrame")>(player.getId(), event.cell.getDescription().c_str());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //OPENMW_PROCESSORACTORFRAME_HPP
|
25
apps/openmw-mp/processors/world/ProcessorActorList.hpp
Normal file
25
apps/openmw-mp/processors/world/ProcessorActorList.hpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef OPENMW_PROCESSORACTORLIST_HPP
|
||||||
|
#define OPENMW_PROCESSORACTORLIST_HPP
|
||||||
|
|
||||||
|
#include "apps/openmw-mp/WorldProcessor.hpp"
|
||||||
|
|
||||||
|
namespace mwmp
|
||||||
|
{
|
||||||
|
class ProcessorActorList : public WorldProcessor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ProcessorActorList()
|
||||||
|
{
|
||||||
|
BPP_INIT(ID_ACTOR_LIST)
|
||||||
|
}
|
||||||
|
|
||||||
|
void Do(WorldPacket &packet, Player &player, BaseEvent &event) override
|
||||||
|
{
|
||||||
|
packet.Send(true);
|
||||||
|
|
||||||
|
Script::Call<Script::CallbackIdentity("OnActorList")>(player.getId(), event.cell.getDescription().c_str());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //OPENMW_PROCESSORACTORLIST_HPP
|
|
@ -840,6 +840,21 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
|
|
||||||
switch (packet->data[0])
|
switch (packet->data[0])
|
||||||
{
|
{
|
||||||
|
case ID_ACTOR_LIST:
|
||||||
|
{
|
||||||
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received ID_ACTOR_LIST about %s", worldEvent.cell.getDescription().c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ID_ACTOR_AUTHORITY:
|
||||||
|
{
|
||||||
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received ID_ACTOR_AUTHORITY about %s", worldEvent.cell.getDescription().c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ID_ACTOR_FRAME:
|
||||||
|
{
|
||||||
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received ID_ACTOR_FRAME about %s", worldEvent.cell.getDescription().c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ID_CONTAINER:
|
case ID_CONTAINER:
|
||||||
{
|
{
|
||||||
MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell);
|
MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(worldEvent.cell);
|
||||||
|
|
|
@ -165,6 +165,8 @@ add_component_dir (openmw-mp
|
||||||
|
|
||||||
Packets/Player/PacketGUIBoxes Packets/Player/PacketTime
|
Packets/Player/PacketGUIBoxes Packets/Player/PacketTime
|
||||||
|
|
||||||
|
Packets/World/PacketActorList Packets/World/PacketActorAuthority Packets/World/PacketActorFrame
|
||||||
|
|
||||||
Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectScale
|
Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectScale
|
||||||
Packets/World/PacketObjectLock Packets/World/PacketObjectUnlock Packets/World/PacketObjectMove
|
Packets/World/PacketObjectLock Packets/World/PacketObjectUnlock Packets/World/PacketObjectMove
|
||||||
Packets/World/PacketObjectRotate Packets/World/PacketObjectAnimPlay
|
Packets/World/PacketObjectRotate Packets/World/PacketObjectAnimPlay
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
|
|
||||||
|
#include "../Packets/World/PacketActorList.hpp"
|
||||||
|
#include "../Packets/World/PacketActorAuthority.hpp"
|
||||||
|
#include "../Packets/World/PacketActorFrame.hpp"
|
||||||
|
|
||||||
#include "../Packets/World/PacketObjectDelete.hpp"
|
#include "../Packets/World/PacketObjectDelete.hpp"
|
||||||
#include "../Packets/World/PacketObjectPlace.hpp"
|
#include "../Packets/World/PacketObjectPlace.hpp"
|
||||||
#include "../Packets/World/PacketObjectScale.hpp"
|
#include "../Packets/World/PacketObjectScale.hpp"
|
||||||
|
@ -33,6 +37,10 @@ inline void AddPacket(mwmp::WorldPacketController::packets_t *packets, RakNet::R
|
||||||
|
|
||||||
mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *peer)
|
mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *peer)
|
||||||
{
|
{
|
||||||
|
AddPacket<PacketActorList>(&packets, peer);
|
||||||
|
AddPacket<PacketActorAuthority>(&packets, peer);
|
||||||
|
AddPacket<PacketActorFrame>(&packets, peer);
|
||||||
|
|
||||||
AddPacket<PacketObjectDelete>(&packets, peer);
|
AddPacket<PacketObjectDelete>(&packets, peer);
|
||||||
AddPacket<PacketObjectPlace>(&packets, peer);
|
AddPacket<PacketObjectPlace>(&packets, peer);
|
||||||
AddPacket<PacketObjectScale>(&packets, peer);
|
AddPacket<PacketObjectScale>(&packets, peer);
|
||||||
|
|
|
@ -39,6 +39,10 @@ enum GameMessages
|
||||||
ID_PLAYER_CELL_CHANGE,
|
ID_PLAYER_CELL_CHANGE,
|
||||||
ID_PLAYER_CELL_STATE,
|
ID_PLAYER_CELL_STATE,
|
||||||
|
|
||||||
|
ID_ACTOR_LIST,
|
||||||
|
ID_ACTOR_AUTHORITY,
|
||||||
|
ID_ACTOR_FRAME,
|
||||||
|
|
||||||
ID_OBJECT_PLACE,
|
ID_OBJECT_PLACE,
|
||||||
ID_OBJECT_DELETE,
|
ID_OBJECT_DELETE,
|
||||||
ID_OBJECT_SCALE,
|
ID_OBJECT_SCALE,
|
||||||
|
|
45
components/openmw-mp/Packets/World/PacketActorAuthority.cpp
Normal file
45
components/openmw-mp/Packets/World/PacketActorAuthority.cpp
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
|
#include "PacketActorAuthority.hpp"
|
||||||
|
|
||||||
|
using namespace mwmp;
|
||||||
|
|
||||||
|
PacketActorAuthority::PacketActorAuthority(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
||||||
|
{
|
||||||
|
packetID = ID_ACTOR_AUTHORITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PacketActorAuthority::Packet(RakNet::BitStream *bs, bool send)
|
||||||
|
{
|
||||||
|
WorldPacket::Packet(bs, send);
|
||||||
|
|
||||||
|
if (!send)
|
||||||
|
event->objectChanges.objects.clear();
|
||||||
|
else
|
||||||
|
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size());
|
||||||
|
|
||||||
|
RW(event->objectChanges.count, send);
|
||||||
|
|
||||||
|
RW(event->cell.mData.mFlags, send);
|
||||||
|
RW(event->cell.mData.mX, send);
|
||||||
|
RW(event->cell.mData.mY, send);
|
||||||
|
RW(event->cell.mName, send);
|
||||||
|
|
||||||
|
WorldObject worldObject;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < event->objectChanges.count; i++)
|
||||||
|
{
|
||||||
|
if (send)
|
||||||
|
{
|
||||||
|
worldObject = event->objectChanges.objects.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
RW(worldObject.refId, send);
|
||||||
|
RW(worldObject.refNumIndex, send);
|
||||||
|
RW(worldObject.mpNum, send);
|
||||||
|
|
||||||
|
if (!send)
|
||||||
|
{
|
||||||
|
event->objectChanges.objects.push_back(worldObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
components/openmw-mp/Packets/World/PacketActorAuthority.hpp
Normal file
17
components/openmw-mp/Packets/World/PacketActorAuthority.hpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef OPENMW_PACKETACTORAUTHORITY_HPP
|
||||||
|
#define OPENMW_PACKETACTORAUTHORITY_HPP
|
||||||
|
|
||||||
|
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||||
|
|
||||||
|
namespace mwmp
|
||||||
|
{
|
||||||
|
class PacketActorAuthority : public WorldPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PacketActorAuthority(RakNet::RakPeerInterface *peer);
|
||||||
|
|
||||||
|
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //OPENMW_PACKETACTORAUTHORITY_HPP
|
46
components/openmw-mp/Packets/World/PacketActorFrame.cpp
Normal file
46
components/openmw-mp/Packets/World/PacketActorFrame.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
|
#include "PacketActorFrame.hpp"
|
||||||
|
|
||||||
|
using namespace mwmp;
|
||||||
|
|
||||||
|
PacketActorFrame::PacketActorFrame(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
||||||
|
{
|
||||||
|
packetID = ID_ACTOR_FRAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PacketActorFrame::Packet(RakNet::BitStream *bs, bool send)
|
||||||
|
{
|
||||||
|
WorldPacket::Packet(bs, send);
|
||||||
|
|
||||||
|
if (!send)
|
||||||
|
event->objectChanges.objects.clear();
|
||||||
|
else
|
||||||
|
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size());
|
||||||
|
|
||||||
|
RW(event->objectChanges.count, send);
|
||||||
|
|
||||||
|
RW(event->cell.mData.mFlags, send);
|
||||||
|
RW(event->cell.mData.mX, send);
|
||||||
|
RW(event->cell.mData.mY, send);
|
||||||
|
RW(event->cell.mName, send);
|
||||||
|
|
||||||
|
WorldObject worldObject;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < event->objectChanges.count; i++)
|
||||||
|
{
|
||||||
|
if (send)
|
||||||
|
{
|
||||||
|
worldObject = event->objectChanges.objects.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
RW(worldObject.refId, send);
|
||||||
|
RW(worldObject.refNumIndex, send);
|
||||||
|
RW(worldObject.mpNum, send);
|
||||||
|
RW(worldObject.pos, send);
|
||||||
|
|
||||||
|
if (!send)
|
||||||
|
{
|
||||||
|
event->objectChanges.objects.push_back(worldObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
components/openmw-mp/Packets/World/PacketActorFrame.hpp
Normal file
17
components/openmw-mp/Packets/World/PacketActorFrame.hpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef OPENMW_PACKETACTORFRAME_HPP
|
||||||
|
#define OPENMW_PACKETACTORFRAME_HPP
|
||||||
|
|
||||||
|
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||||
|
|
||||||
|
namespace mwmp
|
||||||
|
{
|
||||||
|
class PacketActorFrame : public WorldPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PacketActorFrame(RakNet::RakPeerInterface *peer);
|
||||||
|
|
||||||
|
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //OPENMW_PACKETACTORFRAME_HPP
|
45
components/openmw-mp/Packets/World/PacketActorList.cpp
Normal file
45
components/openmw-mp/Packets/World/PacketActorList.cpp
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
|
#include "PacketActorList.hpp"
|
||||||
|
|
||||||
|
using namespace mwmp;
|
||||||
|
|
||||||
|
PacketActorList::PacketActorList(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
||||||
|
{
|
||||||
|
packetID = ID_ACTOR_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PacketActorList::Packet(RakNet::BitStream *bs, bool send)
|
||||||
|
{
|
||||||
|
WorldPacket::Packet(bs, send);
|
||||||
|
|
||||||
|
if (!send)
|
||||||
|
event->objectChanges.objects.clear();
|
||||||
|
else
|
||||||
|
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size());
|
||||||
|
|
||||||
|
RW(event->objectChanges.count, send);
|
||||||
|
|
||||||
|
RW(event->cell.mData.mFlags, send);
|
||||||
|
RW(event->cell.mData.mX, send);
|
||||||
|
RW(event->cell.mData.mY, send);
|
||||||
|
RW(event->cell.mName, send);
|
||||||
|
|
||||||
|
WorldObject worldObject;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < event->objectChanges.count; i++)
|
||||||
|
{
|
||||||
|
if (send)
|
||||||
|
{
|
||||||
|
worldObject = event->objectChanges.objects.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
RW(worldObject.refId, send);
|
||||||
|
RW(worldObject.refNumIndex, send);
|
||||||
|
RW(worldObject.mpNum, send);
|
||||||
|
|
||||||
|
if (!send)
|
||||||
|
{
|
||||||
|
event->objectChanges.objects.push_back(worldObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
components/openmw-mp/Packets/World/PacketActorList.hpp
Normal file
17
components/openmw-mp/Packets/World/PacketActorList.hpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef OPENMW_PACKETACTORLIST_HPP
|
||||||
|
#define OPENMW_PACKETACTORLIST_HPP
|
||||||
|
|
||||||
|
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||||
|
|
||||||
|
namespace mwmp
|
||||||
|
{
|
||||||
|
class PacketActorList : public WorldPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PacketActorList(RakNet::RakPeerInterface *peer);
|
||||||
|
|
||||||
|
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //OPENMW_PACKETACTORLIST_HPP
|
Loading…
Reference in a new issue