forked from teamnwah/openmw-tes3coop
[Client] Send and read ActorAttack packets
This commit is contained in:
parent
2e8714afaa
commit
6aa0fa85ab
7 changed files with 59 additions and 2 deletions
|
@ -32,6 +32,7 @@ void ActorList::reset()
|
||||||
animPlayActors.clear();
|
animPlayActors.clear();
|
||||||
speechActors.clear();
|
speechActors.clear();
|
||||||
statsDynamicActors.clear();
|
statsDynamicActors.clear();
|
||||||
|
attackActors.clear();
|
||||||
guid = mwmp::Main::get().getNetworking()->getLocalPlayer()->guid;
|
guid = mwmp::Main::get().getNetworking()->getLocalPlayer()->guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +71,11 @@ void ActorList::addStatsDynamicActor(LocalActor localActor)
|
||||||
statsDynamicActors.push_back(localActor);
|
statsDynamicActors.push_back(localActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActorList::addAttackActor(LocalActor localActor)
|
||||||
|
{
|
||||||
|
attackActors.push_back(localActor);
|
||||||
|
}
|
||||||
|
|
||||||
void ActorList::sendPositionActors()
|
void ActorList::sendPositionActors()
|
||||||
{
|
{
|
||||||
if (positionActors.size() > 0)
|
if (positionActors.size() > 0)
|
||||||
|
@ -120,6 +126,16 @@ void ActorList::sendStatsDynamicActors()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActorList::sendAttackActors()
|
||||||
|
{
|
||||||
|
if (attackActors.size() > 0)
|
||||||
|
{
|
||||||
|
baseActors = attackActors;
|
||||||
|
Main::get().getNetworking()->getActorPacket(ID_ACTOR_ATTACK)->setActorList(this);
|
||||||
|
Main::get().getNetworking()->getActorPacket(ID_ACTOR_ATTACK)->Send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Finish this
|
// TODO: Finish this
|
||||||
void ActorList::editActorsInCell(MWWorld::CellStore* cellStore)
|
void ActorList::editActorsInCell(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,12 +26,14 @@ namespace mwmp
|
||||||
void addAnimPlayActor(LocalActor localActor);
|
void addAnimPlayActor(LocalActor localActor);
|
||||||
void addSpeechActor(LocalActor localActor);
|
void addSpeechActor(LocalActor localActor);
|
||||||
void addStatsDynamicActor(LocalActor localActor);
|
void addStatsDynamicActor(LocalActor localActor);
|
||||||
|
void addAttackActor(LocalActor localActor);
|
||||||
|
|
||||||
void sendPositionActors();
|
void sendPositionActors();
|
||||||
void sendAnimFlagsActors();
|
void sendAnimFlagsActors();
|
||||||
void sendAnimPlayActors();
|
void sendAnimPlayActors();
|
||||||
void sendSpeechActors();
|
void sendSpeechActors();
|
||||||
void sendStatsDynamicActors();
|
void sendStatsDynamicActors();
|
||||||
|
void sendAttackActors();
|
||||||
|
|
||||||
void editActorsInCell(MWWorld::CellStore* cellStore);
|
void editActorsInCell(MWWorld::CellStore* cellStore);
|
||||||
|
|
||||||
|
@ -45,6 +47,7 @@ namespace mwmp
|
||||||
std::vector<BaseActor> animPlayActors;
|
std::vector<BaseActor> animPlayActors;
|
||||||
std::vector<BaseActor> speechActors;
|
std::vector<BaseActor> speechActors;
|
||||||
std::vector<BaseActor> statsDynamicActors;
|
std::vector<BaseActor> statsDynamicActors;
|
||||||
|
std::vector<BaseActor> attackActors;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,12 @@
|
||||||
#include "../mwworld/worldimp.hpp"
|
#include "../mwworld/worldimp.hpp"
|
||||||
|
|
||||||
#include "Cell.hpp"
|
#include "Cell.hpp"
|
||||||
#include "CellController.hpp"
|
|
||||||
#include "Main.hpp"
|
#include "Main.hpp"
|
||||||
#include "Networking.hpp"
|
#include "Networking.hpp"
|
||||||
#include "LocalPlayer.hpp"
|
#include "LocalPlayer.hpp"
|
||||||
|
#include "CellController.hpp"
|
||||||
|
#include "MechanicsHelper.hpp"
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
mwmp::Cell::Cell(MWWorld::CellStore* cellStore)
|
mwmp::Cell::Cell(MWWorld::CellStore* cellStore)
|
||||||
|
@ -58,6 +60,7 @@ void Cell::updateLocal(bool forceUpdate)
|
||||||
actorList->sendAnimPlayActors();
|
actorList->sendAnimPlayActors();
|
||||||
actorList->sendSpeechActors();
|
actorList->sendSpeechActors();
|
||||||
actorList->sendStatsDynamicActors();
|
actorList->sendStatsDynamicActors();
|
||||||
|
actorList->sendAttackActors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cell::updateDedicated(float dt)
|
void Cell::updateDedicated(float dt)
|
||||||
|
@ -174,6 +177,26 @@ void Cell::readSpeech(ActorList& actorList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Cell::readAttack(ActorList& actorList)
|
||||||
|
{
|
||||||
|
initializeDedicatedActors(actorList);
|
||||||
|
|
||||||
|
BaseActor baseActor;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < actorList.count; i++)
|
||||||
|
{
|
||||||
|
baseActor = actorList.baseActors.at(i);
|
||||||
|
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
|
||||||
|
|
||||||
|
if (dedicatedActors.count(mapIndex) > 0)
|
||||||
|
{
|
||||||
|
DedicatedActor *actor = dedicatedActors[mapIndex];
|
||||||
|
actor->attack = baseActor.attack;
|
||||||
|
mwmp::Main::get().getMechanicsHelper()->processAttack(actor->attack, actor->getPtr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Cell::initializeLocalActors()
|
void Cell::initializeLocalActors()
|
||||||
{
|
{
|
||||||
ESM::Cell esmCell = *store->getCell();
|
ESM::Cell esmCell = *store->getCell();
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace mwmp
|
||||||
void readAnimPlay(ActorList& actorList);
|
void readAnimPlay(ActorList& actorList);
|
||||||
void readStatsDynamic(ActorList& actorList);
|
void readStatsDynamic(ActorList& actorList);
|
||||||
void readSpeech(ActorList& actorList);
|
void readSpeech(ActorList& actorList);
|
||||||
|
void readAttack(ActorList& actorList);
|
||||||
|
|
||||||
void initializeLocalActors();
|
void initializeLocalActors();
|
||||||
void initializeDedicatedActors(ActorList& actorList);
|
void initializeDedicatedActors(ActorList& actorList);
|
||||||
|
|
|
@ -154,6 +154,19 @@ void CellController::readSpeech(ActorList& actorList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CellController::readAttack(ActorList& actorList)
|
||||||
|
{
|
||||||
|
std::string mapIndex = actorList.cell.getDescription();
|
||||||
|
|
||||||
|
initializeCell(actorList.cell);
|
||||||
|
|
||||||
|
// If this now exists, send it the data
|
||||||
|
if (cellsActive.count(mapIndex) > 0)
|
||||||
|
{
|
||||||
|
cellsActive[mapIndex]->readAttack(actorList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CellController::setLocalActorRecord(std::string actorIndex, std::string cellIndex)
|
void CellController::setLocalActorRecord(std::string actorIndex, std::string cellIndex)
|
||||||
{
|
{
|
||||||
localActorsToCells[actorIndex] = cellIndex;
|
localActorsToCells[actorIndex] = cellIndex;
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace mwmp
|
||||||
void readAnimPlay(mwmp::ActorList& actorList);
|
void readAnimPlay(mwmp::ActorList& actorList);
|
||||||
void readStatsDynamic(mwmp::ActorList& actorList);
|
void readStatsDynamic(mwmp::ActorList& actorList);
|
||||||
void readSpeech(mwmp::ActorList& actorList);
|
void readSpeech(mwmp::ActorList& actorList);
|
||||||
|
void readAttack(mwmp::ActorList& actorList);
|
||||||
|
|
||||||
void setLocalActorRecord(std::string actorIndex, std::string cellIndex);
|
void setLocalActorRecord(std::string actorIndex, std::string cellIndex);
|
||||||
void removeLocalActorRecord(std::string actorIndex);
|
void removeLocalActorRecord(std::string actorIndex);
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace mwmp
|
||||||
|
|
||||||
virtual void Do(ActorPacket &packet, ActorList &actorList)
|
virtual void Do(ActorPacket &packet, ActorList &actorList)
|
||||||
{
|
{
|
||||||
|
//Main::get().getCellController()->readAttack(actorList);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue