mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-21 05:14:10 +00:00
[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)->setPlayer(player);
|
||||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_TOPIC)->Send(toOthers);
|
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},\
|
{"GetTopicId", DialogueFunctions::GetTopicId},\
|
||||||
\
|
\
|
||||||
{"SendTopicChanges", DialogueFunctions::SendTopicChanges}
|
{"SendTopicChanges", DialogueFunctions::SendTopicChanges},\
|
||||||
|
\
|
||||||
|
{"PlayAnimation", DialogueFunctions::PlayAnimation}
|
||||||
|
|
||||||
class DialogueFunctions
|
class DialogueFunctions
|
||||||
{
|
{
|
||||||
|
@ -61,6 +63,9 @@ public:
|
||||||
* \return void
|
* \return void
|
||||||
*/
|
*/
|
||||||
static void SendTopicChanges(unsigned short pid, bool toOthers = false) noexcept;
|
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:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -283,6 +283,12 @@ void DedicatedPlayer::setMarkerState(bool state)
|
||||||
removeMarker();
|
removeMarker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DedicatedPlayer::playAnimation()
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(getPtr(),
|
||||||
|
animation.groupname, animation.mode, animation.count, animation.persist);
|
||||||
|
}
|
||||||
|
|
||||||
MWWorld::Ptr DedicatedPlayer::getPtr()
|
MWWorld::Ptr DedicatedPlayer::getPtr()
|
||||||
{
|
{
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
|
@ -43,6 +43,8 @@ namespace mwmp
|
||||||
void removeMarker();
|
void removeMarker();
|
||||||
void setMarkerState(bool state);
|
void setMarkerState(bool state);
|
||||||
|
|
||||||
|
void playAnimation();
|
||||||
|
|
||||||
MWWorld::Ptr getPtr();
|
MWWorld::Ptr getPtr();
|
||||||
MWWorld::Ptr getLiveCellPtr();
|
MWWorld::Ptr getLiveCellPtr();
|
||||||
MWWorld::ManualRef* getRef();
|
MWWorld::ManualRef* getRef();
|
||||||
|
|
|
@ -1446,3 +1446,9 @@ void LocalPlayer::storeCurrentContainer(const MWWorld::Ptr &container, bool loot
|
||||||
currentContainer.mpNum = container.getCellRef().getMpNum();
|
currentContainer.mpNum = container.getCellRef().getMpNum();
|
||||||
currentContainer.loot = loot;
|
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 storeCellState(ESM::Cell cell, int stateType);
|
||||||
void storeCurrentContainer(const MWWorld::Ptr& container, bool loot);
|
void storeCurrentContainer(const MWWorld::Ptr& container, bool loot);
|
||||||
|
|
||||||
|
void playAnimation();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Networking *getNetworking();
|
Networking *getNetworking();
|
||||||
MWWorld::Ptr getPlayerPtr();
|
MWWorld::Ptr getPlayerPtr();
|
||||||
|
|
|
@ -15,7 +15,13 @@ namespace mwmp
|
||||||
|
|
||||||
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
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;
|
CGStage charGenStage;
|
||||||
std::string passw;
|
std::string passw;
|
||||||
|
|
||||||
|
Animation animation;
|
||||||
|
|
||||||
bool isWerewolf;
|
bool isWerewolf;
|
||||||
std::string creatureModel;
|
std::string creatureModel;
|
||||||
bool useCreatureName;
|
bool useCreatureName;
|
||||||
|
|
|
@ -10,5 +10,8 @@ void mwmp::PacketPlayerAnimPlay::Packet(RakNet::BitStream *bs, bool send)
|
||||||
{
|
{
|
||||||
PlayerPacket::Packet(bs, 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