forked from teamnwah/openmw-tes3coop
Add and implement ID_OBJECT_ANIM_PLAY
This commit is contained in:
parent
344f2b535a
commit
46397a7dac
8 changed files with 93 additions and 3 deletions
|
@ -495,6 +495,23 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
|
|||
break;
|
||||
}
|
||||
|
||||
case ID_OBJECT_ANIM_PLAY:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ANIM_PLAY from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
|
||||
event->cellRef.mRefID.c_str(),
|
||||
event->cellRef.mRefNum.mIndex,
|
||||
event->cell.getDescription().c_str());
|
||||
|
||||
myPacket->Send(event, true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ID_CONTAINER_ADD:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER_ADD from %s",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <apps/openmw/mwbase/world.hpp>
|
||||
#include <apps/openmw/mwbase/environment.hpp>
|
||||
#include <apps/openmw/mwbase/mechanicsmanager.hpp>
|
||||
#include <apps/openmw/mwbase/windowmanager.hpp>
|
||||
|
||||
#include <apps/openmw/mwworld/cellstore.hpp>
|
||||
|
@ -811,7 +812,8 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
|
|||
ptrFound.getCellRef().getRefId().c_str(),
|
||||
ptrFound.getCellRef().getRefNum());
|
||||
|
||||
MWBase::Environment::get().getWorld()->moveObject(ptrFound, event->pos.pos[0], event->pos.pos[1], event->pos.pos[2]);
|
||||
MWBase::Environment::get().getWorld()->moveObject(ptrFound,
|
||||
event->pos.pos[0], event->pos.pos[1], event->pos.pos[2]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -832,7 +834,30 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
|
|||
ptrFound.getCellRef().getRefId().c_str(),
|
||||
ptrFound.getCellRef().getRefNum());
|
||||
|
||||
MWBase::Environment::get().getWorld()->rotateObject(ptrFound, event->pos.rot[0], event->pos.rot[1], event->pos.rot[2]);
|
||||
MWBase::Environment::get().getWorld()->rotateObject(ptrFound,
|
||||
event->pos.rot[0], event->pos.rot[1], event->pos.rot[2]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ID_OBJECT_ANIM_PLAY:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_OBJECT_ANIM_PLAY");
|
||||
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
|
||||
event->cellRef.mRefID.c_str(),
|
||||
event->cellRef.mRefNum.mIndex,
|
||||
event->cell.getDescription().c_str());
|
||||
|
||||
MWWorld::Ptr ptrFound = ptrCellStore->searchByRefNum(event->cellRef.mRefNum);
|
||||
|
||||
if (ptrFound)
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Found %s, %i",
|
||||
ptrFound.getCellRef().getRefId().c_str(),
|
||||
ptrFound.getCellRef().getRefNum());
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(ptrFound,
|
||||
event->animGroup, event->animMode, std::numeric_limits<int>::max(), true);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -159,7 +159,7 @@ add_component_dir (openmw-mp
|
|||
|
||||
Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectLock
|
||||
Packets/World/PacketObjectUnlock Packets/World/PacketObjectScale Packets/World/PacketObjectMove
|
||||
Packets/World/PacketObjectRotate
|
||||
Packets/World/PacketObjectRotate Packets/World/PacketObjectAnimPlay
|
||||
|
||||
Packets/World/PacketContainerAdd Packets/World/PacketContainerRemove Packets/World/PacketDoorActivate
|
||||
Packets/World/PacketVideoPlay
|
||||
|
|
|
@ -35,6 +35,9 @@ namespace mwmp
|
|||
std::string video;
|
||||
bool allowSkipping;
|
||||
|
||||
std::string animGroup;
|
||||
int animMode;
|
||||
|
||||
int index;
|
||||
int shortVal;
|
||||
float floatVal;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../Packets/World/PacketObjectScale.hpp"
|
||||
#include "../Packets/World/PacketObjectMove.hpp"
|
||||
#include "../Packets/World/PacketObjectRotate.hpp"
|
||||
#include "../Packets/World/PacketObjectAnimPlay.hpp"
|
||||
|
||||
#include "../Packets/World/PacketContainerAdd.hpp"
|
||||
#include "../Packets/World/PacketContainerRemove.hpp"
|
||||
|
@ -39,6 +40,7 @@ mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *pee
|
|||
AddPacket<PacketObjectScale>(&packets, peer);
|
||||
AddPacket<PacketObjectMove>(&packets, peer);
|
||||
AddPacket<PacketObjectRotate>(&packets, peer);
|
||||
AddPacket<PacketObjectAnimPlay>(&packets, peer);
|
||||
|
||||
AddPacket<PacketContainerAdd>(&packets, peer);
|
||||
AddPacket<PacketContainerRemove>(&packets, peer);
|
||||
|
|
|
@ -40,6 +40,7 @@ enum GameMessages
|
|||
ID_OBJECT_SCALE,
|
||||
ID_OBJECT_MOVE,
|
||||
ID_OBJECT_ROTATE,
|
||||
ID_OBJECT_ANIM_PLAY,
|
||||
|
||||
ID_CONTAINER_ADD,
|
||||
ID_CONTAINER_REMOVE,
|
||||
|
|
25
components/openmw-mp/Packets/World/PacketObjectAnimPlay.cpp
Normal file
25
components/openmw-mp/Packets/World/PacketObjectAnimPlay.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketObjectAnimPlay.hpp"
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketObjectAnimPlay::PacketObjectAnimPlay(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
||||
{
|
||||
packetID = ID_OBJECT_ANIM_PLAY;
|
||||
}
|
||||
|
||||
void PacketObjectAnimPlay::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send)
|
||||
{
|
||||
WorldPacket::Packet(bs, event, send);
|
||||
|
||||
RW(event->cellRef.mRefID, send);
|
||||
RW(event->cellRef.mRefNum.mIndex, send);
|
||||
|
||||
RW(event->cell.mData.mFlags, send);
|
||||
RW(event->cell.mData.mX, send);
|
||||
RW(event->cell.mData.mY, send);
|
||||
RW(event->cell.mName, send);
|
||||
|
||||
RW(event->animGroup, send);
|
||||
RW(event->animMode, send);
|
||||
}
|
17
components/openmw-mp/Packets/World/PacketObjectAnimPlay.hpp
Normal file
17
components/openmw-mp/Packets/World/PacketObjectAnimPlay.hpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef OPENMW_PACKETOBJECTANIMPLAY_HPP
|
||||
#define OPENMW_PACKETOBJECTANIMPLAY_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketObjectAnimPlay : public WorldPacket
|
||||
{
|
||||
public:
|
||||
PacketObjectAnimPlay(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PACKETOBJECTANIMPLAY_HPP
|
Loading…
Reference in a new issue