[General] Add placeholders for 7 new ActorPackets

pull/199/head
David Cernat 8 years ago
parent 9852076590
commit 0d196af685

@ -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"

@ -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<Script::CallbackIdentity("OnActorAnimPlay")>(player.getId(), actorList.cell.getDescription().c_str());
}
};
}
#endif //OPENMW_PROCESSORACTORANIMPLAY_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<Script::CallbackIdentity("OnActorAttack")>(player.getId(), actorList.cell.getDescription().c_str());
}
};
}
#endif //OPENMW_PROCESSORACTORATTACK_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

@ -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<Script::CallbackIdentity("OnActorDrawState")>(player.getId(), actorList.cell.getDescription().c_str());
}
};
}
#endif //OPENMW_PROCESSORACTORDRAWSTATE_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<Script::CallbackIdentity("OnActorDynamicStats")>(player.getId(), actorList.cell.getDescription().c_str());
}
};
}
#endif //OPENMW_PROCESSORACTORDYNAMICSTATS_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<Script::CallbackIdentity("OnActorHeadRotation")>(player.getId(), actorList.cell.getDescription().c_str());
}
};
}
#endif //OPENMW_PROCESSORACTORHEADROTATION_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<Script::CallbackIdentity("OnActorSpeech")>(player.getId(), actorList.cell.getDescription().c_str());
}
};
}
#endif //OPENMW_PROCESSORACTORSPEECH_HPP

@ -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:

@ -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

@ -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<PacketActorList>(&packets, peer);
AddPacket<PacketActorAuthority>(&packets, peer);
AddPacket<PacketActorPosition>(&packets, peer);
AddPacket<PacketActorTest>(&packets, peer);
AddPacket<PacketActorAnimPlay>(&packets, peer);
AddPacket<PacketActorAttack>(&packets, peer);
AddPacket<PacketActorCellChange>(&packets, peer);
AddPacket<PacketActorDrawState>(&packets, peer);
AddPacket<PacketActorDynamicStats>(&packets, peer);
AddPacket<PacketActorHeadRotation>(&packets, peer);
AddPacket<PacketActorPosition>(&packets, peer);
AddPacket<PacketActorSpeech>(&packets, peer);
}

@ -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,

@ -0,0 +1,48 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#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);
}
}
}

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETACTORANIMPLAY_HPP
#define OPENMW_PACKETACTORANIMPLAY_HPP
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
namespace mwmp
{
class PacketActorAnimPlay : public ActorPacket
{
public:
PacketActorAnimPlay(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETACTORANIMPLAY_HPP

@ -0,0 +1,48 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#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);
}
}
}

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETACTORATTACK_HPP
#define OPENMW_PACKETACTORATTACK_HPP
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
namespace mwmp
{
class PacketActorAttack : public ActorPacket
{
public:
PacketActorAttack(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETACTORATTACK_HPP

@ -0,0 +1,47 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#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);
}
}
}

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETACTORCELLCHANGE_HPP
#define OPENMW_PACKETACTORCELLCHANGE_HPP
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
namespace mwmp
{
class PacketActorCellChange : public ActorPacket
{
public:
PacketActorCellChange(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETACTORCELLCHANGE_HPP

@ -0,0 +1,48 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#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);
}
}
}

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETACTORDRAWSTATE_HPP
#define OPENMW_PACKETACTORDRAWSTATE_HPP
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
namespace mwmp
{
class PacketActorDrawState : public ActorPacket
{
public:
PacketActorDrawState(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETACTORDRAWSTATE_HPP

@ -0,0 +1,48 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#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);
}
}
}

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETACTORDYNAMICSTATS_HPP
#define OPENMW_PACKETACTORDYNAMICSTATS_HPP
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
namespace mwmp
{
class PacketActorDynamicStats : public ActorPacket
{
public:
PacketActorDynamicStats(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETACTORDYNAMICSTATS_HPP

@ -0,0 +1,48 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#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);
}
}
}

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETACTORHEADROTATION_HPP
#define OPENMW_PACKETACTORHEADROTATION_HPP
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
namespace mwmp
{
class PacketActorHeadRotation : public ActorPacket
{
public:
PacketActorHeadRotation(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETACTORHEADROTATION_HPP

@ -0,0 +1,48 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#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);
}
}
}

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETACTORSPEECH_HPP
#define OPENMW_PACKETACTORSPEECH_HPP
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
namespace mwmp
{
class PacketActorSpeech : public ActorPacket
{
public:
PacketActorSpeech(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETACTORSPEECH_HPP
Loading…
Cancel
Save