From 25fef1a7b88e6d1ae81cc56961b3acb47cf9a802 Mon Sep 17 00:00:00 2001 From: Koncord Date: Tue, 18 Apr 2017 12:17:58 +0800 Subject: [PATCH] [Client] FIx conflicts --- apps/openmw/mwmp/Networking.cpp | 1 - apps/openmw/mwmp/PlayerProcessor.cpp | 2 +- .../player/ProcessorPlayerAttack.hpp | 58 +------------------ .../player/ProcessorPlayerBaseInfo.hpp | 4 +- .../player/ProcessorPlayerDrawState.hpp | 6 +- .../player/ProcessorPlayerDynamicStats.hpp | 4 +- .../player/ProcessorPlayerResurrect.hpp | 6 +- .../player/ProcessorUserDisconnected.hpp | 2 +- .../processors/world/BaseObjectProcessor.hpp | 4 +- 9 files changed, 17 insertions(+), 70 deletions(-) diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 502af5ebb..20354af2c 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -39,7 +39,6 @@ #include "DedicatedPlayer.hpp" #include "LocalPlayer.hpp" #include "GUIController.hpp" -#include "WorldController.hpp" #include "Main.hpp" #include "PlayerProcessor.hpp" #include "ProcessorInitializer.hpp" diff --git a/apps/openmw/mwmp/PlayerProcessor.cpp b/apps/openmw/mwmp/PlayerProcessor.cpp index a8b790ce4..209b473cc 100644 --- a/apps/openmw/mwmp/PlayerProcessor.cpp +++ b/apps/openmw/mwmp/PlayerProcessor.cpp @@ -50,7 +50,7 @@ bool PlayerProcessor::Process(RakNet::Packet &packet) BasePlayer *player = 0; if (guid != myGuid) - player = Players::getPlayer(guid); + player = PlayerList::getPlayer(guid); else player = Main::get().getLocalPlayer(); diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerAttack.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerAttack.hpp index 437b98b3e..5503aac96 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerAttack.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerAttack.hpp @@ -5,8 +5,9 @@ #ifndef OPENMW_PROCESSORPLAYERATTACK_HPP #define OPENMW_PROCESSORPLAYERATTACK_HPP - +#include "apps/openmw/mwmp/Main.hpp" #include "apps/openmw/mwmp/PlayerProcessor.hpp" +#include "apps/openmw/mwmp/MechanicsHelper.hpp" #include "apps/openmw/mwbase/world.hpp" #include "apps/openmw/mwworld/containerstore.hpp" #include "apps/openmw/mwworld/inventorystore.hpp" @@ -26,60 +27,7 @@ namespace mwmp virtual void Do(PlayerPacket &packet, BasePlayer *player) { - DedicatedPlayer &dedicatedPlayer = static_cast(*player); - //cout << "Player: " << dedicatedPlayer.Npc()->mName << " pressed: " << (dedicatedPlayer.getAttack()->pressed == 1) << endl; - if (dedicatedPlayer.attack.pressed == 0) - { - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Attack success: %s", dedicatedPlayer.attack.success ? "true" : "false"); - - if (dedicatedPlayer.attack.success == 1) - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Damage: %f",dedicatedPlayer.attack.damage); - } - - MWMechanics::CreatureStats &stats = dedicatedPlayer.getPtr().getClass().getNpcStats(dedicatedPlayer.getPtr()); - stats.getSpells().setSelectedSpell(dedicatedPlayer.attack.refid); - - MWWorld::Ptr victim; - if (dedicatedPlayer.attack.target == getLocalPlayer()->guid) - victim = MWBase::Environment::get().getWorld()->getPlayerPtr(); - else if (Players::getPlayer(dedicatedPlayer.attack.target) != 0) - victim = Players::getPlayer(dedicatedPlayer.attack.target)->getPtr(); - - MWWorld::Ptr attacker; - attacker = dedicatedPlayer.getPtr(); - - // Get the weapon used (if hand-to-hand, weapon = inv.end()) - if (dedicatedPlayer.drawState == 1) - { - MWWorld::InventoryStore &inv = attacker.getClass().getInventoryStore(attacker); - MWWorld::ContainerStoreIterator weaponslot = inv.getSlot( - MWWorld::InventoryStore::Slot_CarriedRight); - MWWorld::Ptr weapon = ((weaponslot != inv.end()) ? *weaponslot : MWWorld::Ptr()); - if (!weapon.isEmpty() && weapon.getTypeName() != typeid(ESM::Weapon).name()) - weapon = MWWorld::Ptr(); - - if (victim.mRef != 0) - { - bool healthdmg; - if (!weapon.isEmpty()) - healthdmg = true; - else - { - MWMechanics::CreatureStats &otherstats = victim.getClass().getCreatureStats(victim); - healthdmg = otherstats.isParalyzed() || otherstats.getKnockedDown(); - } - - if (!weapon.isEmpty()) - MWMechanics::blockMeleeAttack(attacker, victim, weapon, dedicatedPlayer.attack.damage, 1); - dedicatedPlayer.getPtr().getClass().onHit(victim, dedicatedPlayer.attack.damage, healthdmg, weapon, attacker, osg::Vec3f(), - dedicatedPlayer.attack.success); - } - } - else - { - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "SpellId: %s", dedicatedPlayer.attack.refid.c_str()); - LOG_APPEND(Log::LOG_VERBOSE, " - success: %d", dedicatedPlayer.attack.success); - } + Main::get().getMechanicsHelper()->processAttack(static_cast(player)->getPtr(), player->attack); } }; } diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerBaseInfo.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerBaseInfo.hpp index 4504c80ee..110d96029 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerBaseInfo.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerBaseInfo.hpp @@ -43,13 +43,13 @@ namespace mwmp if (player == 0) { LOG_APPEND(Log::LOG_INFO, "- Exchanging data with new player"); - player = Players::newPlayer(guid); + player = PlayerList::newPlayer(guid); packet.setPlayer(player); packet.Read(); } - Players::createPlayer(guid); + PlayerList::createPlayer(guid); } } }; diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerDrawState.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerDrawState.hpp index aeba23b50..6aff8f968 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerDrawState.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerDrawState.hpp @@ -15,7 +15,7 @@ namespace mwmp public: ProcessorPlayerDrawState() { - BPP_INIT(ID_PLAYER_DRAWSTATE) + BPP_INIT(ID_PLAYER_ANIM_FLAGS) } virtual void Do(PlayerPacket &packet, BasePlayer *player) @@ -23,10 +23,10 @@ namespace mwmp if (isLocal()) { if(isRequest()) - static_cast(player)->updateDrawStateAndFlags(true); + static_cast(player)->updateAnimFlags(true); } else - static_cast(player)->updateDrawState(); + static_cast(player)->updateAnimFlags(); } }; } diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerDynamicStats.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerDynamicStats.hpp index 7dd33eadb..bf4a79704 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerDynamicStats.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerDynamicStats.hpp @@ -15,7 +15,7 @@ namespace mwmp public: ProcessorPlayerDynamicStats() { - BPP_INIT(ID_PLAYER_DYNAMICSTATS) + BPP_INIT(ID_PLAYER_STATS_DYNAMIC) } virtual void Do(PlayerPacket &packet, BasePlayer *player) @@ -23,7 +23,7 @@ namespace mwmp if (isLocal()) { if (isRequest()) - static_cast(player)->updateDynamicStats(true); + static_cast(player)->updateStatsDynamic(true); else static_cast(player)->setDynamicStats(); } diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp index 4122bed58..05d0c0c58 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp @@ -39,9 +39,9 @@ namespace mwmp packet.setPlayer(player); packet.Send(serverAddr); - static_cast(player)->updateDynamicStats(true); - Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(player); - Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_DYNAMICSTATS)->Send(serverAddr); + static_cast(player)->updateStatsDynamic(true); + Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_STATS_DYNAMIC)->setPlayer(player); + Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_STATS_DYNAMIC)->Send(serverAddr); } else { diff --git a/apps/openmw/mwmp/processors/player/ProcessorUserDisconnected.hpp b/apps/openmw/mwmp/processors/player/ProcessorUserDisconnected.hpp index bccb1eb20..eb3b38e7d 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorUserDisconnected.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorUserDisconnected.hpp @@ -25,7 +25,7 @@ namespace mwmp if (isLocal()) MWBase::Environment::get().getStateManager()->requestQuit(); else - Players::disconnectPlayer(guid); + PlayerList::disconnectPlayer(guid); } }; } diff --git a/apps/openmw/mwmp/processors/world/BaseObjectProcessor.hpp b/apps/openmw/mwmp/processors/world/BaseObjectProcessor.hpp index 0e7e5356a..d3092f5bd 100644 --- a/apps/openmw/mwmp/processors/world/BaseObjectProcessor.hpp +++ b/apps/openmw/mwmp/processors/world/BaseObjectProcessor.hpp @@ -7,7 +7,7 @@ #include "apps/openmw/mwmp/WorldProcessor.hpp" #include "apps/openmw/mwmp/Main.hpp" -#include "apps/openmw/mwmp/WorldController.hpp" +#include "apps/openmw/mwmp/CellController.hpp" #include "apps/openmw/mwworld/cellstore.hpp" namespace mwmp @@ -17,7 +17,7 @@ namespace mwmp public: virtual void Do(WorldPacket &packet, WorldEvent &event) { - MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(event.cell); + MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(event.cell); if (!ptrCellStore) return;