From 3d80e2db6222fd6c32f36fdf2d9fb23f8a91c61c Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 30 Jan 2018 16:01:33 +0200 Subject: [PATCH] [General] Add placeholders for new packet types, part 2 --- apps/openmw/CMakeLists.txt | 11 ++++--- .../mwmp/processors/ProcessorInitializer.cpp | 6 ++++ .../player/ProcessorPlayerMomentum.hpp | 32 +++++++++++++++++++ .../world/ProcessorObjectAttach.hpp | 26 +++++++++++++++ .../world/ProcessorObjectCollision.hpp | 26 +++++++++++++++ components/CMakeLists.txt | 22 ++++++------- .../Controllers/PlayerPacketController.cpp | 2 ++ .../Controllers/WorldPacketController.cpp | 4 +++ components/openmw-mp/NetworkMessages.hpp | 3 ++ .../Packets/Player/PacketPlayerMomentum.cpp | 16 ++++++++++ .../Packets/Player/PacketPlayerMomentum.hpp | 17 ++++++++++ .../Packets/World/PacketObjectAttach.cpp | 16 ++++++++++ .../Packets/World/PacketObjectAttach.hpp | 17 ++++++++++ .../Packets/World/PacketObjectCollision.cpp | 16 ++++++++++ .../Packets/World/PacketObjectCollision.hpp | 17 ++++++++++ 15 files changed, 215 insertions(+), 16 deletions(-) create mode 100644 apps/openmw/mwmp/processors/player/ProcessorPlayerMomentum.hpp create mode 100644 apps/openmw/mwmp/processors/world/ProcessorObjectAttach.hpp create mode 100644 apps/openmw/mwmp/processors/world/ProcessorObjectCollision.hpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerMomentum.cpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerMomentum.hpp create mode 100644 components/openmw-mp/Packets/World/PacketObjectAttach.cpp create mode 100644 components/openmw-mp/Packets/World/PacketObjectAttach.hpp create mode 100644 components/openmw-mp/Packets/World/PacketObjectCollision.cpp create mode 100644 components/openmw-mp/Packets/World/PacketObjectCollision.hpp diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 582e6c0fe..7d6eced91 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -119,16 +119,17 @@ add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageB ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction ProcessorPlayerInteraction ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorPlayerKillCount ProcessorPlayerLevel - ProcessorPlayerMap ProcessorPlayerMiscellaneous ProcessorPlayerPosition ProcessorPlayerQuickKeys + ProcessorPlayerMap ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic ) add_openmw_dir (mwmp/processors/world BaseObjectProcessor ProcessorConsoleCommand ProcessorContainer ProcessorDoorState - ProcessorMusicPlay ProcessorVideoPlay ProcessorObjectAnimPlay ProcessorObjectDelete ProcessorObjectLock - ProcessorObjectMove ProcessorObjectPlace ProcessorObjectReset ProcessorObjectRotate ProcessorObjectScale - ProcessorObjectSpawn ProcessorObjectState ProcessorObjectTrap ProcessorScriptLocalShort ProcessorScriptLocalFloat - ProcessorScriptMemberShort ProcessorScriptMemberFloat ProcessorScriptGlobalShort ProcessorScriptGlobalFloat + ProcessorMusicPlay ProcessorVideoPlay ProcessorObjectAnimPlay ProcessorObjectAttach ProcessorObjectCollision + ProcessorObjectDelete ProcessorObjectLock ProcessorObjectMove ProcessorObjectPlace ProcessorObjectReset + ProcessorObjectRotate ProcessorObjectScale ProcessorObjectSpawn ProcessorObjectState ProcessorObjectTrap + ProcessorScriptLocalShort ProcessorScriptLocalFloat ProcessorScriptMemberShort ProcessorScriptMemberFloat + ProcessorScriptGlobalShort ProcessorScriptGlobalFloat ) # Main executable diff --git a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp index c2774c5a8..196b35eea 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -39,6 +39,7 @@ #include "player/ProcessorPlayerLevel.hpp" #include "player/ProcessorPlayerMap.hpp" #include "player/ProcessorPlayerMiscellaneous.hpp" +#include "player/ProcessorPlayerMomentum.hpp" #include "player/ProcessorPlayerPosition.hpp" #include "player/ProcessorPlayerQuickKeys.hpp" #include "player/ProcessorPlayerRegionAuthority.hpp" @@ -59,6 +60,8 @@ #include "world/ProcessorDoorState.hpp" #include "world/ProcessorMusicPlay.hpp" #include "world/ProcessorObjectAnimPlay.hpp" +#include "world/ProcessorObjectAttach.hpp" +#include "world/ProcessorObjectCollision.hpp" #include "world/ProcessorObjectDelete.hpp" #include "world/ProcessorObjectLock.hpp" #include "world/ProcessorObjectMove.hpp" @@ -129,6 +132,7 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); PlayerProcessor::AddProcessor(new ProcessorPlayerMap()); PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous()); + PlayerProcessor::AddProcessor(new ProcessorPlayerMomentum()); PlayerProcessor::AddProcessor(new ProcessorPlayerPosition()); PlayerProcessor::AddProcessor(new ProcessorPlayerQuickKeys()); PlayerProcessor::AddProcessor(new ProcessorPlayerRegionAuthority()); @@ -148,6 +152,8 @@ void ProcessorInitializer() WorldProcessor::AddProcessor(new ProcessorDoorState()); WorldProcessor::AddProcessor(new ProcessorMusicPlay()); WorldProcessor::AddProcessor(new ProcessorObjectAnimPlay()); + WorldProcessor::AddProcessor(new ProcessorObjectAttach()); + WorldProcessor::AddProcessor(new ProcessorObjectCollision()); WorldProcessor::AddProcessor(new ProcessorObjectDelete()); WorldProcessor::AddProcessor(new ProcessorObjectLock()); WorldProcessor::AddProcessor(new ProcessorObjectMove()); diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerMomentum.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerMomentum.hpp new file mode 100644 index 000000000..6d1aa4820 --- /dev/null +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerMomentum.hpp @@ -0,0 +1,32 @@ +#ifndef OPENMW_PROCESSORPLAYERMOMENTUM_HPP +#define OPENMW_PROCESSORPLAYERMOMENTUM_HPP + + +#include "../PlayerProcessor.hpp" + +namespace mwmp +{ + class ProcessorPlayerMomentum : public PlayerProcessor + { + public: + ProcessorPlayerMomentum() + { + BPP_INIT(ID_PLAYER_MOMENTUM) + } + + virtual void Do(PlayerPacket &packet, BasePlayer *player) + { + if (!isLocal()) return; + + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_MOMENTUM about LocalPlayer from server"); + + if (!isRequest()) + { + LocalPlayer &localPlayer = static_cast(*player); + //localPlayer.setMomentum(); + } + } + }; +} + +#endif //OPENMW_PROCESSORPLAYERMOMENTUM_HPP diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectAttach.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectAttach.hpp new file mode 100644 index 000000000..0554af1ee --- /dev/null +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectAttach.hpp @@ -0,0 +1,26 @@ +#ifndef OPENMW_PROCESSOROBJECTATTACH_HPP +#define OPENMW_PROCESSOROBJECTATTACH_HPP + +#include "BaseObjectProcessor.hpp" + +namespace mwmp +{ + class ProcessorObjectAttach : public BaseObjectProcessor + { + public: + ProcessorObjectAttach() + { + BPP_INIT(ID_OBJECT_ATTACH) + } + + virtual void Do(WorldPacket &packet, WorldEvent &event) + { + BaseObjectProcessor::Do(packet, event); + + //event.attachObjects(ptrCellStore); + } + + }; +} + +#endif //OPENMW_PROCESSOROBJECTATTACH_HPP diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectCollision.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectCollision.hpp new file mode 100644 index 000000000..b14d83430 --- /dev/null +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectCollision.hpp @@ -0,0 +1,26 @@ +#ifndef OPENMW_PROCESSOROBJECTCOLLISION_HPP +#define OPENMW_PROCESSOROBJECTCOLLISION_HPP + +#include "BaseObjectProcessor.hpp" + +namespace mwmp +{ + class ProcessorObjectCollision : public BaseObjectProcessor + { + public: + ProcessorObjectCollision() + { + BPP_INIT(ID_OBJECT_COLLISION) + } + + virtual void Do(WorldPacket &packet, WorldEvent &event) + { + BaseObjectProcessor::Do(packet, event); + + //event.setObjectCollisions(ptrCellStore); + } + + }; +} + +#endif //OPENMW_PROCESSOROBJECTCOLLISION_HPP diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 8cc272c63..56373cdab 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -187,21 +187,21 @@ add_component_dir (openmw-mp/Packets/Player PacketCellCreate PacketRecordDynamic PacketPlayerBaseInfo PacketPlayerCharGen PacketPlayerActiveSkills PacketPlayerAnimFlags PacketPlayerAnimPlay - PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook PacketPlayerBounty PacketPlayerCellChange - PacketPlayerCellState PacketPlayerClass PacketPlayerDeath PacketPlayerEquipment PacketPlayerFaction - PacketPlayerInteraction PacketPlayerInventory PacketPlayerJail PacketPlayerJournal PacketPlayerKillCount PacketPlayerLevel - PacketPlayerMap PacketPlayerMiscellaneous PacketPlayerPosition PacketPlayerQuickKeys PacketPlayerRegionAuthority - PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech - PacketPlayerSpellbook PacketPlayerStatsDynamic PacketPlayerTopic + PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook PacketPlayerBounty + PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath PacketPlayerEquipment + PacketPlayerFaction PacketPlayerInteraction PacketPlayerInventory PacketPlayerJail PacketPlayerJournal + PacketPlayerKillCount PacketPlayerLevel PacketPlayerMap PacketPlayerMiscellaneous PacketPlayerMomentum + PacketPlayerPosition PacketPlayerQuickKeys PacketPlayerRegionAuthority PacketPlayerReputation PacketPlayerRest + PacketPlayerResurrect PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic PacketPlayerTopic ) add_component_dir (openmw-mp/Packets/World WorldPacket - PacketConsoleCommand PacketContainer PacketObjectAnimPlay PacketObjectDelete PacketDoorDestination - PacketDoorState PacketObjectLock PacketObjectMove PacketObjectPlace PacketObjectReset PacketObjectRotate - PacketObjectScale PacketObjectSpawn PacketObjectState PacketObjectTrap PacketMusicPlay PacketVideoPlay - PacketScriptLocalShort PacketScriptLocalFloat PacketScriptMemberShort PacketScriptMemberFloat PacketScriptGlobalShort - PacketScriptGlobalFloat + PacketConsoleCommand PacketContainer PacketObjectAnimPlay PacketObjectAttach PacketObjectCollision + PacketObjectDelete PacketDoorDestination PacketDoorState PacketObjectLock PacketObjectMove PacketObjectPlace + PacketObjectReset PacketObjectRotate PacketObjectScale PacketObjectSpawn PacketObjectState PacketObjectTrap + PacketMusicPlay PacketVideoPlay PacketScriptLocalShort PacketScriptLocalFloat PacketScriptMemberShort + PacketScriptMemberFloat PacketScriptGlobalShort PacketScriptGlobalFloat ) add_component_dir (fallback diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index 76333b6b0..a9579e779 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -32,6 +32,7 @@ #include "../Packets/Player/PacketPlayerLevel.hpp" #include "../Packets/Player/PacketPlayerMap.hpp" #include "../Packets/Player/PacketPlayerMiscellaneous.hpp" +#include "../Packets/Player/PacketPlayerMomentum.hpp" #include "../Packets/Player/PacketPlayerPosition.hpp" #include "../Packets/Player/PacketPlayerQuickKeys.hpp" #include "../Packets/Player/PacketPlayerRegionAuthority.hpp" @@ -92,6 +93,7 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p 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/Controllers/WorldPacketController.cpp b/components/openmw-mp/Controllers/WorldPacketController.cpp index 5905d92b6..0d11f8de4 100644 --- a/components/openmw-mp/Controllers/WorldPacketController.cpp +++ b/components/openmw-mp/Controllers/WorldPacketController.cpp @@ -1,4 +1,6 @@ #include "../Packets/World/PacketObjectAnimPlay.hpp" +#include "../Packets/World/PacketObjectAttach.hpp" +#include "../Packets/World/PacketObjectCollision.hpp" #include "../Packets/World/PacketObjectDelete.hpp" #include "../Packets/World/PacketObjectLock.hpp" #include "../Packets/World/PacketObjectMove.hpp" @@ -37,6 +39,8 @@ inline void AddPacket(mwmp::WorldPacketController::packets_t *packets, RakNet::R mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *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 f63d2d2f3..925b245db 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -46,6 +46,7 @@ enum GameMessages ID_PLAYER_LEVEL, ID_PLAYER_MAP, ID_PLAYER_MISCELLANEOUS, + ID_PLAYER_MOMENTUM, ID_PLAYER_POSITION, ID_PLAYER_QUICKKEYS, ID_PLAYER_REGION_AUTHORITY, @@ -75,6 +76,8 @@ enum GameMessages ID_ACTOR_STATS_DYNAMIC, ID_OBJECT_ANIM_PLAY, + ID_OBJECT_ATTACH, + ID_OBJECT_COLLISION, ID_OBJECT_DELETE, ID_OBJECT_LOCK, ID_OBJECT_MOVE, diff --git a/components/openmw-mp/Packets/Player/PacketPlayerMomentum.cpp b/components/openmw-mp/Packets/Player/PacketPlayerMomentum.cpp new file mode 100644 index 000000000..ceaebc0be --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerMomentum.cpp @@ -0,0 +1,16 @@ +#include "PacketPlayerMomentum.hpp" +#include + +using namespace mwmp; + +PacketPlayerMomentum::PacketPlayerMomentum(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +{ + packetID = ID_PLAYER_MOMENTUM; + priority = MEDIUM_PRIORITY; +} + +void PacketPlayerMomentum::Packet(RakNet::BitStream *bs, bool send) +{ + PlayerPacket::Packet(bs, send); + // Placeholder +} diff --git a/components/openmw-mp/Packets/Player/PacketPlayerMomentum.hpp b/components/openmw-mp/Packets/Player/PacketPlayerMomentum.hpp new file mode 100644 index 000000000..36062b744 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerMomentum.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETPLAYERMOMENTUM_HPP +#define OPENMW_PACKETPLAYERMOMENTUM_HPP + +#include + +namespace mwmp +{ + class PacketPlayerMomentum : public PlayerPacket + { + public: + PacketPlayerMomentum(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETPLAYERMOMENTUM_HPP diff --git a/components/openmw-mp/Packets/World/PacketObjectAttach.cpp b/components/openmw-mp/Packets/World/PacketObjectAttach.cpp new file mode 100644 index 000000000..7404e72f0 --- /dev/null +++ b/components/openmw-mp/Packets/World/PacketObjectAttach.cpp @@ -0,0 +1,16 @@ +#include +#include "PacketObjectAttach.hpp" + +using namespace mwmp; + +PacketObjectAttach::PacketObjectAttach(RakNet::RakPeerInterface *peer) : WorldPacket(peer) +{ + packetID = ID_OBJECT_ATTACH; + hasCellData = true; +} + +void PacketObjectAttach::Object(WorldObject &worldObject, bool send) +{ + WorldPacket::Object(worldObject, send); + // Placeholder +} diff --git a/components/openmw-mp/Packets/World/PacketObjectAttach.hpp b/components/openmw-mp/Packets/World/PacketObjectAttach.hpp new file mode 100644 index 000000000..98e1b53d2 --- /dev/null +++ b/components/openmw-mp/Packets/World/PacketObjectAttach.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETOBJECTATTACH_HPP +#define OPENMW_PACKETOBJECTATTACH_HPP + +#include + +namespace mwmp +{ + class PacketObjectAttach : public WorldPacket + { + public: + PacketObjectAttach(RakNet::RakPeerInterface *peer); + + virtual void Object(WorldObject &worldObject, bool send); + }; +} + +#endif //OPENMW_PACKETOBJECTATTACH_HPP diff --git a/components/openmw-mp/Packets/World/PacketObjectCollision.cpp b/components/openmw-mp/Packets/World/PacketObjectCollision.cpp new file mode 100644 index 000000000..deeb6b5a6 --- /dev/null +++ b/components/openmw-mp/Packets/World/PacketObjectCollision.cpp @@ -0,0 +1,16 @@ +#include +#include "PacketObjectCollision.hpp" + +using namespace mwmp; + +PacketObjectCollision::PacketObjectCollision(RakNet::RakPeerInterface *peer) : WorldPacket(peer) +{ + packetID = ID_OBJECT_COLLISION; + hasCellData = true; +} + +void PacketObjectCollision::Object(WorldObject &worldObject, bool send) +{ + WorldPacket::Object(worldObject, send); + // Placeholder +} diff --git a/components/openmw-mp/Packets/World/PacketObjectCollision.hpp b/components/openmw-mp/Packets/World/PacketObjectCollision.hpp new file mode 100644 index 000000000..63c6a9129 --- /dev/null +++ b/components/openmw-mp/Packets/World/PacketObjectCollision.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETOBJECTCOLLISION_HPP +#define OPENMW_PACKETOBJECTCOLLISION_HPP + +#include + +namespace mwmp +{ + class PacketObjectCollision : public WorldPacket + { + public: + PacketObjectCollision(RakNet::RakPeerInterface *peer); + + virtual void Object(WorldObject &worldObject, bool send); + }; +} + +#endif //OPENMW_PACKETOBJECTCOLLISION_HPP