From 0d196af68549c057a2defd8923a2502849bbd90e Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 11 Apr 2017 11:37:38 +0300 Subject: [PATCH] [General] Add placeholders for 7 new ActorPackets --- apps/openmw-mp/ProcessorInitializer.cpp | 9 +++- .../actor/ProcessorActorAnimPlay.hpp | 29 +++++++++++ .../processors/actor/ProcessorActorAttack.hpp | 29 +++++++++++ .../actor/ProcessorActorCellChange.hpp | 24 ++++++++++ .../actor/ProcessorActorDrawState.hpp | 29 +++++++++++ .../actor/ProcessorActorDynamicStats.hpp | 29 +++++++++++ .../actor/ProcessorActorHeadRotation.hpp | 29 +++++++++++ .../processors/actor/ProcessorActorSpeech.hpp | 29 +++++++++++ apps/openmw/mwmp/Networking.cpp | 32 +++++++++++-- components/CMakeLists.txt | 6 ++- .../Controllers/ActorPacketController.cpp | 19 +++++++- components/openmw-mp/NetworkMessages.hpp | 9 +++- .../Packets/Actor/PacketActorAnimPlay.cpp | 48 +++++++++++++++++++ .../Packets/Actor/PacketActorAnimPlay.hpp | 17 +++++++ .../Packets/Actor/PacketActorAttack.cpp | 48 +++++++++++++++++++ .../Packets/Actor/PacketActorAttack.hpp | 17 +++++++ .../Packets/Actor/PacketActorCellChange.cpp | 47 ++++++++++++++++++ .../Packets/Actor/PacketActorCellChange.hpp | 17 +++++++ .../Packets/Actor/PacketActorDrawState.cpp | 48 +++++++++++++++++++ .../Packets/Actor/PacketActorDrawState.hpp | 17 +++++++ .../Packets/Actor/PacketActorDynamicStats.cpp | 48 +++++++++++++++++++ .../Packets/Actor/PacketActorDynamicStats.hpp | 17 +++++++ .../Packets/Actor/PacketActorHeadRotation.cpp | 48 +++++++++++++++++++ .../Packets/Actor/PacketActorHeadRotation.hpp | 17 +++++++ .../Packets/Actor/PacketActorSpeech.cpp | 48 +++++++++++++++++++ .../Packets/Actor/PacketActorSpeech.hpp | 17 +++++++ 26 files changed, 718 insertions(+), 9 deletions(-) create mode 100644 apps/openmw-mp/processors/actor/ProcessorActorAnimPlay.hpp create mode 100644 apps/openmw-mp/processors/actor/ProcessorActorAttack.hpp create mode 100644 apps/openmw-mp/processors/actor/ProcessorActorCellChange.hpp create mode 100644 apps/openmw-mp/processors/actor/ProcessorActorDrawState.hpp create mode 100644 apps/openmw-mp/processors/actor/ProcessorActorDynamicStats.hpp create mode 100644 apps/openmw-mp/processors/actor/ProcessorActorHeadRotation.hpp create mode 100644 apps/openmw-mp/processors/actor/ProcessorActorSpeech.hpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorAnimPlay.cpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorAnimPlay.hpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorAttack.cpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorAttack.hpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorCellChange.cpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorCellChange.hpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorDrawState.cpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorDrawState.hpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorDynamicStats.cpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorDynamicStats.hpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorHeadRotation.cpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorHeadRotation.hpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorSpeech.cpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorSpeech.hpp diff --git a/apps/openmw-mp/ProcessorInitializer.cpp b/apps/openmw-mp/ProcessorInitializer.cpp index 427625a70..4ff623e5f 100644 --- a/apps/openmw-mp/ProcessorInitializer.cpp +++ b/apps/openmw-mp/ProcessorInitializer.cpp @@ -27,8 +27,15 @@ #include "ActorProcessor.hpp" #include "processors/actor/ProcessorActorList.hpp" #include "processors/actor/ProcessorActorAuthority.hpp" -#include "processors/actor/ProcessorActorPosition.hpp" #include "processors/actor/ProcessorActorTest.hpp" +#include "processors/actor/ProcessorActorAnimPlay.hpp" +#include "processors/actor/ProcessorActorAttack.hpp" +#include "processors/actor/ProcessorActorCellChange.hpp" +#include "processors/actor/ProcessorActorDrawState.hpp" +#include "processors/actor/ProcessorActorDynamicStats.hpp" +#include "processors/actor/ProcessorActorHeadRotation.hpp" +#include "processors/actor/ProcessorActorPosition.hpp" +#include "processors/actor/ProcessorActorSpeech.hpp" #include "WorldProcessor.hpp" #include "processors/world/ProcessorContainer.hpp" #include "processors/world/ProcessorDoorState.hpp" diff --git a/apps/openmw-mp/processors/actor/ProcessorActorAnimPlay.hpp b/apps/openmw-mp/processors/actor/ProcessorActorAnimPlay.hpp new file mode 100644 index 000000000..d763982ab --- /dev/null +++ b/apps/openmw-mp/processors/actor/ProcessorActorAnimPlay.hpp @@ -0,0 +1,29 @@ +#ifndef OPENMW_PROCESSORACTORANIMPLAY_HPP +#define OPENMW_PROCESSORACTORANIMPLAY_HPP + +#include "apps/openmw-mp/ActorProcessor.hpp" + +namespace mwmp +{ + class ProcessorActorAnimPlay : public ActorProcessor + { + public: + ProcessorActorAnimPlay() + { + BPP_INIT(ID_ACTOR_ANIM_PLAY) + } + + void Do(ActorPacket &packet, Player &player, BaseActorList &actorList) override + { + // Send only to players who have the cell loaded + Cell *serverCell = CellController::get()->getCell(&actorList.cell); + + if (serverCell != nullptr) + serverCell->sendToLoaded(&packet, &actorList); + + //Script::Call(player.getId(), actorList.cell.getDescription().c_str()); + } + }; +} + +#endif //OPENMW_PROCESSORACTORANIMPLAY_HPP diff --git a/apps/openmw-mp/processors/actor/ProcessorActorAttack.hpp b/apps/openmw-mp/processors/actor/ProcessorActorAttack.hpp new file mode 100644 index 000000000..903434ec5 --- /dev/null +++ b/apps/openmw-mp/processors/actor/ProcessorActorAttack.hpp @@ -0,0 +1,29 @@ +#ifndef OPENMW_PROCESSORACTORATTACK_HPP +#define OPENMW_PROCESSORACTORATTACK_HPP + +#include "apps/openmw-mp/ActorProcessor.hpp" + +namespace mwmp +{ + class ProcessorActorAttack : public ActorProcessor + { + public: + ProcessorActorAttack() + { + BPP_INIT(ID_ACTOR_ATTACK) + } + + void Do(ActorPacket &packet, Player &player, BaseActorList &actorList) override + { + // Send only to players who have the cell loaded + Cell *serverCell = CellController::get()->getCell(&actorList.cell); + + if (serverCell != nullptr) + serverCell->sendToLoaded(&packet, &actorList); + + //Script::Call(player.getId(), actorList.cell.getDescription().c_str()); + } + }; +} + +#endif //OPENMW_PROCESSORACTORATTACK_HPP diff --git a/apps/openmw-mp/processors/actor/ProcessorActorCellChange.hpp b/apps/openmw-mp/processors/actor/ProcessorActorCellChange.hpp new file mode 100644 index 000000000..435e0e048 --- /dev/null +++ b/apps/openmw-mp/processors/actor/ProcessorActorCellChange.hpp @@ -0,0 +1,24 @@ +#ifndef OPENMW_PROCESSORACTORCELLCHANGE_HPP +#define OPENMW_PROCESSORACTORCELLCHANGE_HPP + +#include "apps/openmw-mp/ActorProcessor.hpp" + +namespace mwmp +{ + class ProcessorActorCellChange : public ActorProcessor + { + public: + ProcessorActorCellChange() + { + BPP_INIT(ID_ACTOR_CELL_CHANGE) + } + + void Do(ActorPacket &packet, Player &player, BaseActorList &actorList) override + { + // Send this to everyone + packet.Send(true); + } + }; +} + +#endif //OPENMW_PROCESSORACTORCELLCHANGE_HPP diff --git a/apps/openmw-mp/processors/actor/ProcessorActorDrawState.hpp b/apps/openmw-mp/processors/actor/ProcessorActorDrawState.hpp new file mode 100644 index 000000000..b870a0261 --- /dev/null +++ b/apps/openmw-mp/processors/actor/ProcessorActorDrawState.hpp @@ -0,0 +1,29 @@ +#ifndef OPENMW_PROCESSORACTORDRAWSTATE_HPP +#define OPENMW_PROCESSORACTORDRAWSTATE_HPP + +#include "apps/openmw-mp/ActorProcessor.hpp" + +namespace mwmp +{ + class ProcessorActorDrawState : public ActorProcessor + { + public: + ProcessorActorDrawState() + { + BPP_INIT(ID_ACTOR_DRAW_STATE) + } + + void Do(ActorPacket &packet, Player &player, BaseActorList &actorList) override + { + // Send only to players who have the cell loaded + Cell *serverCell = CellController::get()->getCell(&actorList.cell); + + if (serverCell != nullptr) + serverCell->sendToLoaded(&packet, &actorList); + + //Script::Call(player.getId(), actorList.cell.getDescription().c_str()); + } + }; +} + +#endif //OPENMW_PROCESSORACTORDRAWSTATE_HPP diff --git a/apps/openmw-mp/processors/actor/ProcessorActorDynamicStats.hpp b/apps/openmw-mp/processors/actor/ProcessorActorDynamicStats.hpp new file mode 100644 index 000000000..cbdf7b3f7 --- /dev/null +++ b/apps/openmw-mp/processors/actor/ProcessorActorDynamicStats.hpp @@ -0,0 +1,29 @@ +#ifndef OPENMW_PROCESSORACTORDYNAMICSTATS_HPP +#define OPENMW_PROCESSORACTORDYNAMICSTATS_HPP + +#include "apps/openmw-mp/ActorProcessor.hpp" + +namespace mwmp +{ + class ProcessorActorDynamicStats : public ActorProcessor + { + public: + ProcessorActorDynamicStats() + { + BPP_INIT(ID_ACTOR_DYNAMICSTATS) + } + + void Do(ActorPacket &packet, Player &player, BaseActorList &actorList) override + { + // Send only to players who have the cell loaded + Cell *serverCell = CellController::get()->getCell(&actorList.cell); + + if (serverCell != nullptr) + serverCell->sendToLoaded(&packet, &actorList); + + //Script::Call(player.getId(), actorList.cell.getDescription().c_str()); + } + }; +} + +#endif //OPENMW_PROCESSORACTORDYNAMICSTATS_HPP diff --git a/apps/openmw-mp/processors/actor/ProcessorActorHeadRotation.hpp b/apps/openmw-mp/processors/actor/ProcessorActorHeadRotation.hpp new file mode 100644 index 000000000..1c10850c1 --- /dev/null +++ b/apps/openmw-mp/processors/actor/ProcessorActorHeadRotation.hpp @@ -0,0 +1,29 @@ +#ifndef OPENMW_PROCESSORACTORHEADROTATION_HPP +#define OPENMW_PROCESSORACTORHEADROTATION_HPP + +#include "apps/openmw-mp/ActorProcessor.hpp" + +namespace mwmp +{ + class ProcessorActorHeadRotation : public ActorProcessor + { + public: + ProcessorActorHeadRotation() + { + BPP_INIT(ID_ACTOR_HEAD_ROTATION) + } + + void Do(ActorPacket &packet, Player &player, BaseActorList &actorList) override + { + // Send only to players who have the cell loaded + Cell *serverCell = CellController::get()->getCell(&actorList.cell); + + if (serverCell != nullptr) + serverCell->sendToLoaded(&packet, &actorList); + + //Script::Call(player.getId(), actorList.cell.getDescription().c_str()); + } + }; +} + +#endif //OPENMW_PROCESSORACTORHEADROTATION_HPP diff --git a/apps/openmw-mp/processors/actor/ProcessorActorSpeech.hpp b/apps/openmw-mp/processors/actor/ProcessorActorSpeech.hpp new file mode 100644 index 000000000..6028d76b3 --- /dev/null +++ b/apps/openmw-mp/processors/actor/ProcessorActorSpeech.hpp @@ -0,0 +1,29 @@ +#ifndef OPENMW_PROCESSORACTORSPEECH_HPP +#define OPENMW_PROCESSORACTORSPEECH_HPP + +#include "apps/openmw-mp/ActorProcessor.hpp" + +namespace mwmp +{ + class ProcessorActorSpeech : public ActorProcessor + { + public: + ProcessorActorSpeech() + { + BPP_INIT(ID_ACTOR_SPEECH) + } + + void Do(ActorPacket &packet, Player &player, BaseActorList &actorList) override + { + // Send only to players who have the cell loaded + Cell *serverCell = CellController::get()->getCell(&actorList.cell); + + if (serverCell != nullptr) + serverCell->sendToLoaded(&packet, &actorList); + + //Script::Call(player.getId(), actorList.cell.getDescription().c_str()); + } + }; +} + +#endif //OPENMW_PROCESSORACTORSPEECH_HPP diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index a6c6de7f1..26131aacf 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -865,16 +865,42 @@ void Networking::processActorPacket(RakNet::Packet *packet) break; } + case ID_ACTOR_TEST: + { + break; + } + case ID_ACTOR_ANIM_PLAY: + { + break; + } + case ID_ACTOR_ATTACK: + { + break; + } + case ID_ACTOR_CELL_CHANGE: + { + break; + } + case ID_ACTOR_DRAW_STATE: + { + break; + } + case ID_ACTOR_DYNAMICSTATS: + { + break; + } + case ID_ACTOR_HEAD_ROTATION: + { + break; + } case ID_ACTOR_POSITION: { //Main::get().getCellController()->readPositions(actorList); break; } - case ID_ACTOR_TEST: + case ID_ACTOR_SPEECH: { - //Main::get().getCellController()->readCellFrame(actorList); - break; } default: diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 2da12cfa3..c339fb353 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -167,8 +167,10 @@ add_component_dir (openmw-mp Packets/Player/PacketGUIBoxes Packets/Player/PacketTime - Packets/Actor/PacketActorList Packets/Actor/PacketActorAuthority Packets/Actor/PacketActorPosition - Packets/Actor/PacketActorTest + Packets/Actor/PacketActorList Packets/Actor/PacketActorAuthority Packets/Actor/PacketActorTest + Packets/Actor/PacketActorAnimPlay Packets/Actor/PacketActorAttack Packets/Actor/PacketActorCellChange + Packets/Actor/PacketActorDrawState Packets/Actor/PacketActorDynamicStats Packets/Actor/PacketActorHeadRotation + Packets/Actor/PacketActorPosition Packets/Actor/PacketActorSpeech Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectScale Packets/World/PacketObjectLock Packets/World/PacketObjectUnlock Packets/World/PacketObjectMove diff --git a/components/openmw-mp/Controllers/ActorPacketController.cpp b/components/openmw-mp/Controllers/ActorPacketController.cpp index dacbe7792..49d3ed05b 100644 --- a/components/openmw-mp/Controllers/ActorPacketController.cpp +++ b/components/openmw-mp/Controllers/ActorPacketController.cpp @@ -4,8 +4,16 @@ #include "../Packets/Actor/PacketActorList.hpp" #include "../Packets/Actor/PacketActorAuthority.hpp" -#include "../Packets/Actor/PacketActorPosition.hpp" #include "../Packets/Actor/PacketActorTest.hpp" +#include "../Packets/Actor/PacketActorAnimPlay.hpp" +#include "../Packets/Actor/PacketActorAttack.hpp" +#include "../Packets/Actor/PacketActorCellChange.hpp" +#include "../Packets/Actor/PacketActorDrawState.hpp" +#include "../Packets/Actor/PacketActorDynamicStats.hpp" +#include "../Packets/Actor/PacketActorHeadRotation.hpp" +#include "../Packets/Actor/PacketActorPosition.hpp" +#include "../Packets/Actor/PacketActorSpeech.hpp" + #include "ActorPacketController.hpp" @@ -21,8 +29,15 @@ mwmp::ActorPacketController::ActorPacketController(RakNet::RakPeerInterface *pee { AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + 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 ea91294d8..3db1c25d7 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -41,8 +41,15 @@ enum GameMessages ID_ACTOR_LIST, ID_ACTOR_AUTHORITY, - ID_ACTOR_POSITION, ID_ACTOR_TEST, + ID_ACTOR_ANIM_PLAY, + ID_ACTOR_ATTACK, + ID_ACTOR_CELL_CHANGE, + ID_ACTOR_DRAW_STATE, + ID_ACTOR_DYNAMICSTATS, + ID_ACTOR_HEAD_ROTATION, + ID_ACTOR_POSITION, + ID_ACTOR_SPEECH, ID_OBJECT_PLACE, ID_OBJECT_DELETE, diff --git a/components/openmw-mp/Packets/Actor/PacketActorAnimPlay.cpp b/components/openmw-mp/Packets/Actor/PacketActorAnimPlay.cpp new file mode 100644 index 000000000..e8e3fe8fc --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorAnimPlay.cpp @@ -0,0 +1,48 @@ +#include +#include +#include "PacketActorAnimPlay.hpp" + +using namespace mwmp; + +PacketActorAnimPlay::PacketActorAnimPlay(RakNet::RakPeerInterface *peer) : ActorPacket(peer) +{ + packetID = ID_ACTOR_ANIM_PLAY; +} + +void PacketActorAnimPlay::Packet(RakNet::BitStream *bs, bool send) +{ + ActorPacket::Packet(bs, send); + + if (!send) + actorList->baseActors.clear(); + else + actorList->count = (unsigned int)(actorList->baseActors.size()); + + RW(actorList->count, send); + + RW(actorList->cell.mData.mFlags, send); + RW(actorList->cell.mData.mX, send); + RW(actorList->cell.mData.mY, send); + RW(actorList->cell.mName, send); + + BaseActor actor; + + for (unsigned int i = 0; i < actorList->count; i++) + { + if (send) + { + actor = actorList->baseActors.at(i); + } + + RW(actor.refId, send); + RW(actor.refNumIndex, send); + RW(actor.mpNum, send); + + // TODO: Fill this in + + if (!send) + { + actorList->baseActors.push_back(actor); + } + } +} diff --git a/components/openmw-mp/Packets/Actor/PacketActorAnimPlay.hpp b/components/openmw-mp/Packets/Actor/PacketActorAnimPlay.hpp new file mode 100644 index 000000000..1fcc8b261 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorAnimPlay.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETACTORANIMPLAY_HPP +#define OPENMW_PACKETACTORANIMPLAY_HPP + +#include + +namespace mwmp +{ + class PacketActorAnimPlay : public ActorPacket + { + public: + PacketActorAnimPlay(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETACTORANIMPLAY_HPP diff --git a/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp b/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp new file mode 100644 index 000000000..a1d600814 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp @@ -0,0 +1,48 @@ +#include +#include +#include "PacketActorAttack.hpp" + +using namespace mwmp; + +PacketActorAttack::PacketActorAttack(RakNet::RakPeerInterface *peer) : ActorPacket(peer) +{ + packetID = ID_ACTOR_ATTACK; +} + +void PacketActorAttack::Packet(RakNet::BitStream *bs, bool send) +{ + ActorPacket::Packet(bs, send); + + if (!send) + actorList->baseActors.clear(); + else + actorList->count = (unsigned int)(actorList->baseActors.size()); + + RW(actorList->count, send); + + RW(actorList->cell.mData.mFlags, send); + RW(actorList->cell.mData.mX, send); + RW(actorList->cell.mData.mY, send); + RW(actorList->cell.mName, send); + + BaseActor actor; + + for (unsigned int i = 0; i < actorList->count; i++) + { + if (send) + { + actor = actorList->baseActors.at(i); + } + + RW(actor.refId, send); + RW(actor.refNumIndex, send); + RW(actor.mpNum, send); + + // TODO: Fill this in + + if (!send) + { + actorList->baseActors.push_back(actor); + } + } +} diff --git a/components/openmw-mp/Packets/Actor/PacketActorAttack.hpp b/components/openmw-mp/Packets/Actor/PacketActorAttack.hpp new file mode 100644 index 000000000..1dbcb9cea --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorAttack.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETACTORATTACK_HPP +#define OPENMW_PACKETACTORATTACK_HPP + +#include + +namespace mwmp +{ + class PacketActorAttack : public ActorPacket + { + public: + PacketActorAttack(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETACTORATTACK_HPP diff --git a/components/openmw-mp/Packets/Actor/PacketActorCellChange.cpp b/components/openmw-mp/Packets/Actor/PacketActorCellChange.cpp new file mode 100644 index 000000000..2a280f669 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorCellChange.cpp @@ -0,0 +1,47 @@ +#include +#include +#include "PacketActorCellChange.hpp" + +using namespace mwmp; + +PacketActorCellChange::PacketActorCellChange(RakNet::RakPeerInterface *peer) : ActorPacket(peer) +{ + packetID = ID_ACTOR_CELL_CHANGE; +} + +void PacketActorCellChange::Packet(RakNet::BitStream *bs, bool send) +{ + ActorPacket::Packet(bs, send); + + if (!send) + actorList->baseActors.clear(); + else + actorList->count = (unsigned int)(actorList->baseActors.size()); + + RW(actorList->count, send); + + RW(actorList->cell.mData.mFlags, send); + RW(actorList->cell.mData.mX, send); + RW(actorList->cell.mData.mY, send); + RW(actorList->cell.mName, send); + + BaseActor actor; + + for (unsigned int i = 0; i < actorList->count; i++) + { + if (send) + { + actor = actorList->baseActors.at(i); + } + + RW(actor.refId, send); + RW(actor.refNumIndex, send); + RW(actor.mpNum, send); + RW(actor.cell, send); + + if (!send) + { + actorList->baseActors.push_back(actor); + } + } +} diff --git a/components/openmw-mp/Packets/Actor/PacketActorCellChange.hpp b/components/openmw-mp/Packets/Actor/PacketActorCellChange.hpp new file mode 100644 index 000000000..6a2b05e79 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorCellChange.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETACTORCELLCHANGE_HPP +#define OPENMW_PACKETACTORCELLCHANGE_HPP + +#include + +namespace mwmp +{ + class PacketActorCellChange : public ActorPacket + { + public: + PacketActorCellChange(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETACTORCELLCHANGE_HPP diff --git a/components/openmw-mp/Packets/Actor/PacketActorDrawState.cpp b/components/openmw-mp/Packets/Actor/PacketActorDrawState.cpp new file mode 100644 index 000000000..8199826ce --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorDrawState.cpp @@ -0,0 +1,48 @@ +#include +#include +#include "PacketActorDrawState.hpp" + +using namespace mwmp; + +PacketActorDrawState::PacketActorDrawState(RakNet::RakPeerInterface *peer) : ActorPacket(peer) +{ + packetID = ID_ACTOR_DRAW_STATE; +} + +void PacketActorDrawState::Packet(RakNet::BitStream *bs, bool send) +{ + ActorPacket::Packet(bs, send); + + if (!send) + actorList->baseActors.clear(); + else + actorList->count = (unsigned int)(actorList->baseActors.size()); + + RW(actorList->count, send); + + RW(actorList->cell.mData.mFlags, send); + RW(actorList->cell.mData.mX, send); + RW(actorList->cell.mData.mY, send); + RW(actorList->cell.mName, send); + + BaseActor actor; + + for (unsigned int i = 0; i < actorList->count; i++) + { + if (send) + { + actor = actorList->baseActors.at(i); + } + + RW(actor.refId, send); + RW(actor.refNumIndex, send); + RW(actor.mpNum, send); + + // TODO: Fill this in + + if (!send) + { + actorList->baseActors.push_back(actor); + } + } +} diff --git a/components/openmw-mp/Packets/Actor/PacketActorDrawState.hpp b/components/openmw-mp/Packets/Actor/PacketActorDrawState.hpp new file mode 100644 index 000000000..9322f2846 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorDrawState.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETACTORDRAWSTATE_HPP +#define OPENMW_PACKETACTORDRAWSTATE_HPP + +#include + +namespace mwmp +{ + class PacketActorDrawState : public ActorPacket + { + public: + PacketActorDrawState(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETACTORDRAWSTATE_HPP diff --git a/components/openmw-mp/Packets/Actor/PacketActorDynamicStats.cpp b/components/openmw-mp/Packets/Actor/PacketActorDynamicStats.cpp new file mode 100644 index 000000000..a1bcc7688 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorDynamicStats.cpp @@ -0,0 +1,48 @@ +#include +#include +#include "PacketActorDynamicStats.hpp" + +using namespace mwmp; + +PacketActorDynamicStats::PacketActorDynamicStats(RakNet::RakPeerInterface *peer) : ActorPacket(peer) +{ + packetID = ID_ACTOR_DYNAMICSTATS; +} + +void PacketActorDynamicStats::Packet(RakNet::BitStream *bs, bool send) +{ + ActorPacket::Packet(bs, send); + + if (!send) + actorList->baseActors.clear(); + else + actorList->count = (unsigned int)(actorList->baseActors.size()); + + RW(actorList->count, send); + + RW(actorList->cell.mData.mFlags, send); + RW(actorList->cell.mData.mX, send); + RW(actorList->cell.mData.mY, send); + RW(actorList->cell.mName, send); + + BaseActor actor; + + for (unsigned int i = 0; i < actorList->count; i++) + { + if (send) + { + actor = actorList->baseActors.at(i); + } + + RW(actor.refId, send); + RW(actor.refNumIndex, send); + RW(actor.mpNum, send); + + // TODO: Fill this in + + if (!send) + { + actorList->baseActors.push_back(actor); + } + } +} diff --git a/components/openmw-mp/Packets/Actor/PacketActorDynamicStats.hpp b/components/openmw-mp/Packets/Actor/PacketActorDynamicStats.hpp new file mode 100644 index 000000000..72437a87c --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorDynamicStats.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETACTORDYNAMICSTATS_HPP +#define OPENMW_PACKETACTORDYNAMICSTATS_HPP + +#include + +namespace mwmp +{ + class PacketActorDynamicStats : public ActorPacket + { + public: + PacketActorDynamicStats(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETACTORDYNAMICSTATS_HPP diff --git a/components/openmw-mp/Packets/Actor/PacketActorHeadRotation.cpp b/components/openmw-mp/Packets/Actor/PacketActorHeadRotation.cpp new file mode 100644 index 000000000..abf94f847 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorHeadRotation.cpp @@ -0,0 +1,48 @@ +#include +#include +#include "PacketActorHeadRotation.hpp" + +using namespace mwmp; + +PacketActorHeadRotation::PacketActorHeadRotation(RakNet::RakPeerInterface *peer) : ActorPacket(peer) +{ + packetID = ID_ACTOR_HEAD_ROTATION; +} + +void PacketActorHeadRotation::Packet(RakNet::BitStream *bs, bool send) +{ + ActorPacket::Packet(bs, send); + + if (!send) + actorList->baseActors.clear(); + else + actorList->count = (unsigned int)(actorList->baseActors.size()); + + RW(actorList->count, send); + + RW(actorList->cell.mData.mFlags, send); + RW(actorList->cell.mData.mX, send); + RW(actorList->cell.mData.mY, send); + RW(actorList->cell.mName, send); + + BaseActor actor; + + for (unsigned int i = 0; i < actorList->count; i++) + { + if (send) + { + actor = actorList->baseActors.at(i); + } + + RW(actor.refId, send); + RW(actor.refNumIndex, send); + RW(actor.mpNum, send); + + // TODO: Fill this in + + if (!send) + { + actorList->baseActors.push_back(actor); + } + } +} diff --git a/components/openmw-mp/Packets/Actor/PacketActorHeadRotation.hpp b/components/openmw-mp/Packets/Actor/PacketActorHeadRotation.hpp new file mode 100644 index 000000000..a941c663a --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorHeadRotation.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETACTORHEADROTATION_HPP +#define OPENMW_PACKETACTORHEADROTATION_HPP + +#include + +namespace mwmp +{ + class PacketActorHeadRotation : public ActorPacket + { + public: + PacketActorHeadRotation(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETACTORHEADROTATION_HPP diff --git a/components/openmw-mp/Packets/Actor/PacketActorSpeech.cpp b/components/openmw-mp/Packets/Actor/PacketActorSpeech.cpp new file mode 100644 index 000000000..dd788ad4e --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorSpeech.cpp @@ -0,0 +1,48 @@ +#include +#include +#include "PacketActorSpeech.hpp" + +using namespace mwmp; + +PacketActorSpeech::PacketActorSpeech(RakNet::RakPeerInterface *peer) : ActorPacket(peer) +{ + packetID = ID_ACTOR_SPEECH; +} + +void PacketActorSpeech::Packet(RakNet::BitStream *bs, bool send) +{ + ActorPacket::Packet(bs, send); + + if (!send) + actorList->baseActors.clear(); + else + actorList->count = (unsigned int)(actorList->baseActors.size()); + + RW(actorList->count, send); + + RW(actorList->cell.mData.mFlags, send); + RW(actorList->cell.mData.mX, send); + RW(actorList->cell.mData.mY, send); + RW(actorList->cell.mName, send); + + BaseActor actor; + + for (unsigned int i = 0; i < actorList->count; i++) + { + if (send) + { + actor = actorList->baseActors.at(i); + } + + RW(actor.refId, send); + RW(actor.refNumIndex, send); + RW(actor.mpNum, send); + + // TODO: Fill this in + + if (!send) + { + actorList->baseActors.push_back(actor); + } + } +} diff --git a/components/openmw-mp/Packets/Actor/PacketActorSpeech.hpp b/components/openmw-mp/Packets/Actor/PacketActorSpeech.hpp new file mode 100644 index 000000000..2d0b693e7 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorSpeech.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETACTORSPEECH_HPP +#define OPENMW_PACKETACTORSPEECH_HPP + +#include + +namespace mwmp +{ + class PacketActorSpeech : public ActorPacket + { + public: + PacketActorSpeech(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETACTORSPEECH_HPP