2017-04-05 01:06:45 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
2017-04-08 05:59:21 +00:00
|
|
|
#include <components/openmw-mp/Log.hpp>
|
2017-04-05 01:06:45 +00:00
|
|
|
#include "PacketActorFrame.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2017-04-09 05:51:28 +00:00
|
|
|
PacketActorFrame::PacketActorFrame(RakNet::RakPeerInterface *peer) : ActorPacket(peer)
|
2017-04-05 01:06:45 +00:00
|
|
|
{
|
|
|
|
packetID = ID_ACTOR_FRAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PacketActorFrame::Packet(RakNet::BitStream *bs, bool send)
|
|
|
|
{
|
2017-04-09 05:51:28 +00:00
|
|
|
ActorPacket::Packet(bs, send);
|
2017-04-05 01:06:45 +00:00
|
|
|
|
|
|
|
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);
|
2017-04-06 12:11:51 +00:00
|
|
|
RW(worldObject.drawState, send);
|
|
|
|
|
|
|
|
RW(worldObject.headPitch, send);
|
|
|
|
RW(worldObject.headYaw, send);
|
2017-04-05 01:06:45 +00:00
|
|
|
|
2017-04-08 05:59:21 +00:00
|
|
|
RW(worldObject.hasAnimation, send);
|
|
|
|
RW(worldObject.hasAnimStates, send);
|
|
|
|
RW(worldObject.hasMovement, send);
|
|
|
|
|
|
|
|
if (worldObject.hasAnimation)
|
|
|
|
{
|
|
|
|
RW(worldObject.animation.groupname, send);
|
|
|
|
RW(worldObject.animation.mode, send);
|
|
|
|
RW(worldObject.animation.count, send);
|
|
|
|
RW(worldObject.animation.persist, send);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (worldObject.hasAnimStates)
|
|
|
|
{
|
|
|
|
RW(worldObject.animStates.idlestate, send);
|
|
|
|
RW(worldObject.animStates.movestate, send);
|
|
|
|
RW(worldObject.animStates.jumpstate, send);
|
|
|
|
RW(worldObject.animStates.forcestateupdate, send);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (worldObject.hasMovement)
|
|
|
|
{
|
|
|
|
RW(worldObject.movement.x, send);
|
|
|
|
RW(worldObject.movement.y, send);
|
|
|
|
RW(worldObject.movement.y, send);
|
|
|
|
}
|
|
|
|
|
2017-04-05 01:06:45 +00:00
|
|
|
if (!send)
|
|
|
|
{
|
|
|
|
event->objectChanges.objects.push_back(worldObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|