forked from teamnwah/openmw-tes3coop
[General] Implement PlayerAnimPlay packet
This commit is contained in:
parent
50d5fffb7f
commit
413893aa51
11 changed files with 52 additions and 5 deletions
|
@ -53,3 +53,18 @@ void DialogueFunctions::SendTopicChanges(unsigned short pid, bool toOthers) noex
|
|||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_TOPIC)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_TOPIC)->Send(toOthers);
|
||||
}
|
||||
|
||||
void DialogueFunctions::PlayAnimation(unsigned short pid, const char* groupname, int mode, int count, bool persist) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
player->animation.groupname = groupname;
|
||||
player->animation.mode = mode;
|
||||
player->animation.count = count;
|
||||
player->animation.persist = persist;
|
||||
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->Send(true);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
\
|
||||
{"GetTopicId", DialogueFunctions::GetTopicId},\
|
||||
\
|
||||
{"SendTopicChanges", DialogueFunctions::SendTopicChanges}
|
||||
{"SendTopicChanges", DialogueFunctions::SendTopicChanges},\
|
||||
\
|
||||
{"PlayAnimation", DialogueFunctions::PlayAnimation}
|
||||
|
||||
class DialogueFunctions
|
||||
{
|
||||
|
@ -61,6 +63,9 @@ public:
|
|||
* \return void
|
||||
*/
|
||||
static void SendTopicChanges(unsigned short pid, bool toOthers = false) noexcept;
|
||||
|
||||
static void PlayAnimation(unsigned short pid, const char* groupname, int mode = 0, int count = 1, bool persist = false) noexcept;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
\
|
||||
{"GetPreviousCellPosX", PositionFunctions::GetPreviousCellPosX},\
|
||||
{"GetPreviousCellPosY", PositionFunctions::GetPreviousCellPosY},\
|
||||
{"GetPreviousCellPosZ", PositionFunctions::GetPreviousCellPosZ},\
|
||||
{"GetPreviousCellPosZ", PositionFunctions::GetPreviousCellPosZ},\
|
||||
\
|
||||
{"GetRot", PositionFunctions::GetRot},\
|
||||
{"GetRotX", PositionFunctions::GetRotX},\
|
||||
|
|
|
@ -133,7 +133,7 @@ public:
|
|||
static void SetLevel(unsigned short pid, int value) noexcept;
|
||||
static void SetLevelProgress(unsigned short pid, int value) noexcept;
|
||||
|
||||
static void SetHealthBase(unsigned short pid, double value) noexcept;
|
||||
static void SetHealthBase(unsigned short pid, double value) noexcept;
|
||||
static void SetHealthCurrent(unsigned short pid, double value) noexcept;
|
||||
static void SetMagickaBase(unsigned short pid, double value) noexcept;
|
||||
static void SetMagickaCurrent(unsigned short pid, double value) noexcept;
|
||||
|
|
|
@ -283,6 +283,12 @@ void DedicatedPlayer::setMarkerState(bool state)
|
|||
removeMarker();
|
||||
}
|
||||
|
||||
void DedicatedPlayer::playAnimation()
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(getPtr(),
|
||||
animation.groupname, animation.mode, animation.count, animation.persist);
|
||||
}
|
||||
|
||||
MWWorld::Ptr DedicatedPlayer::getPtr()
|
||||
{
|
||||
return ptr;
|
||||
|
|
|
@ -43,6 +43,8 @@ namespace mwmp
|
|||
void removeMarker();
|
||||
void setMarkerState(bool state);
|
||||
|
||||
void playAnimation();
|
||||
|
||||
MWWorld::Ptr getPtr();
|
||||
MWWorld::Ptr getLiveCellPtr();
|
||||
MWWorld::ManualRef* getRef();
|
||||
|
|
|
@ -1446,3 +1446,9 @@ void LocalPlayer::storeCurrentContainer(const MWWorld::Ptr &container, bool loot
|
|||
currentContainer.mpNum = container.getCellRef().getMpNum();
|
||||
currentContainer.loot = loot;
|
||||
}
|
||||
|
||||
void LocalPlayer::playAnimation()
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(getPlayerPtr(),
|
||||
animation.groupname, animation.mode, animation.count, animation.persist);
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ namespace mwmp
|
|||
void storeCellState(ESM::Cell cell, int stateType);
|
||||
void storeCurrentContainer(const MWWorld::Ptr& container, bool loot);
|
||||
|
||||
void playAnimation();
|
||||
|
||||
private:
|
||||
Networking *getNetworking();
|
||||
MWWorld::Ptr getPlayerPtr();
|
||||
|
|
|
@ -15,7 +15,13 @@ namespace mwmp
|
|||
|
||||
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
||||
{
|
||||
// Placeholder to be filled in later
|
||||
if (isLocal())
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_ANIM_PLAY about LocalPlayer from server");
|
||||
static_cast<LocalPlayer*>(player)->playAnimation();
|
||||
}
|
||||
else if (player != 0)
|
||||
static_cast<DedicatedPlayer*>(player)->playAnimation();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -271,6 +271,8 @@ namespace mwmp
|
|||
CGStage charGenStage;
|
||||
std::string passw;
|
||||
|
||||
Animation animation;
|
||||
|
||||
bool isWerewolf;
|
||||
std::string creatureModel;
|
||||
bool useCreatureName;
|
||||
|
|
|
@ -10,5 +10,8 @@ void mwmp::PacketPlayerAnimPlay::Packet(RakNet::BitStream *bs, bool send)
|
|||
{
|
||||
PlayerPacket::Packet(bs, send);
|
||||
|
||||
// Placeholder to be filled in later
|
||||
RW(player->animation.groupname, send);
|
||||
RW(player->animation.mode, send);
|
||||
RW(player->animation.count, send);
|
||||
RW(player->animation.persist, send);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue