mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 20:49:41 +00:00
[General] Implement PlayerSpeech packet
This commit is contained in:
parent
605b06c303
commit
be25decee2
9 changed files with 50 additions and 5 deletions
|
@ -68,3 +68,15 @@ void DialogueFunctions::PlayAnimation(unsigned short pid, const char* groupname,
|
||||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->Send(false);
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->Send(false);
|
||||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->Send(true);
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->Send(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogueFunctions::PlaySpeech(unsigned short pid, const char* sound) noexcept
|
||||||
|
{
|
||||||
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
|
player->sound = sound;
|
||||||
|
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPEECH)->setPlayer(player);
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPEECH)->Send(false);
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPEECH)->Send(true);
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
\
|
\
|
||||||
{"SendTopicChanges", DialogueFunctions::SendTopicChanges},\
|
{"SendTopicChanges", DialogueFunctions::SendTopicChanges},\
|
||||||
\
|
\
|
||||||
{"PlayAnimation", DialogueFunctions::PlayAnimation}
|
{"PlayAnimation", DialogueFunctions::PlayAnimation},\
|
||||||
|
{"PlaySpeech", DialogueFunctions::PlaySpeech}
|
||||||
|
|
||||||
class DialogueFunctions
|
class DialogueFunctions
|
||||||
{
|
{
|
||||||
|
@ -65,6 +66,7 @@ public:
|
||||||
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;
|
static void PlayAnimation(unsigned short pid, const char* groupname, int mode = 0, int count = 1, bool persist = false) noexcept;
|
||||||
|
static void PlaySpeech(unsigned short pid, const char* sound) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,14 @@
|
||||||
#include <apps/openmw/mwmechanics/steering.hpp>
|
#include <apps/openmw/mwmechanics/steering.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/soundmanager.hpp"
|
||||||
#include "../mwgui/windowmanagerimp.hpp"
|
|
||||||
|
|
||||||
#include "../mwclass/npc.hpp"
|
#include "../mwclass/npc.hpp"
|
||||||
|
|
||||||
|
#include "../mwdialogue/dialoguemanagerimp.hpp"
|
||||||
|
|
||||||
|
#include "../mwgui/windowmanagerimp.hpp"
|
||||||
|
|
||||||
#include "../mwinput/inputmanagerimp.hpp"
|
#include "../mwinput/inputmanagerimp.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/actor.hpp"
|
#include "../mwmechanics/actor.hpp"
|
||||||
|
@ -289,6 +292,15 @@ void DedicatedPlayer::playAnimation()
|
||||||
animation.groupname, animation.mode, animation.count, animation.persist);
|
animation.groupname, animation.mode, animation.count, animation.persist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DedicatedPlayer::playSpeech()
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getSoundManager()->say(getPtr(), sound);
|
||||||
|
|
||||||
|
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
||||||
|
if (winMgr->getSubtitlesEnabled())
|
||||||
|
winMgr->messageBox(MWBase::Environment::get().getDialogueManager()->getVoiceCaption(sound), MWGui::ShowInDialogueMode_Never);
|
||||||
|
}
|
||||||
|
|
||||||
MWWorld::Ptr DedicatedPlayer::getPtr()
|
MWWorld::Ptr DedicatedPlayer::getPtr()
|
||||||
{
|
{
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
|
@ -44,6 +44,7 @@ namespace mwmp
|
||||||
void setMarkerState(bool state);
|
void setMarkerState(bool state);
|
||||||
|
|
||||||
void playAnimation();
|
void playAnimation();
|
||||||
|
void playSpeech();
|
||||||
|
|
||||||
MWWorld::Ptr getPtr();
|
MWWorld::Ptr getPtr();
|
||||||
MWWorld::Ptr getLiveCellPtr();
|
MWWorld::Ptr getLiveCellPtr();
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/journal.hpp"
|
#include "../mwbase/journal.hpp"
|
||||||
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
|
||||||
#include "../mwclass/creature.hpp"
|
#include "../mwclass/creature.hpp"
|
||||||
#include "../mwclass/npc.hpp"
|
#include "../mwclass/npc.hpp"
|
||||||
|
@ -1452,3 +1453,12 @@ void LocalPlayer::playAnimation()
|
||||||
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(getPlayerPtr(),
|
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(getPlayerPtr(),
|
||||||
animation.groupname, animation.mode, animation.count, animation.persist);
|
animation.groupname, animation.mode, animation.count, animation.persist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocalPlayer::playSpeech()
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getSoundManager()->say(getPlayerPtr(), sound);
|
||||||
|
|
||||||
|
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
||||||
|
if (winMgr->getSubtitlesEnabled())
|
||||||
|
winMgr->messageBox(MWBase::Environment::get().getDialogueManager()->getVoiceCaption(sound), MWGui::ShowInDialogueMode_Never);
|
||||||
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ namespace mwmp
|
||||||
void storeCurrentContainer(const MWWorld::Ptr& container, bool loot);
|
void storeCurrentContainer(const MWWorld::Ptr& container, bool loot);
|
||||||
|
|
||||||
void playAnimation();
|
void playAnimation();
|
||||||
|
void playSpeech();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Networking *getNetworking();
|
Networking *getNetworking();
|
||||||
|
|
|
@ -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_SPEECH about LocalPlayer from server");
|
||||||
|
static_cast<LocalPlayer*>(player)->playSpeech();
|
||||||
|
}
|
||||||
|
else if (player != 0)
|
||||||
|
static_cast<DedicatedPlayer*>(player)->playSpeech();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,6 +271,7 @@ namespace mwmp
|
||||||
CGStage charGenStage;
|
CGStage charGenStage;
|
||||||
std::string passw;
|
std::string passw;
|
||||||
|
|
||||||
|
std::string sound;
|
||||||
Animation animation;
|
Animation animation;
|
||||||
|
|
||||||
bool isWerewolf;
|
bool isWerewolf;
|
||||||
|
|
|
@ -10,5 +10,5 @@ void mwmp::PacketPlayerSpeech::Packet(RakNet::BitStream *bs, bool send)
|
||||||
{
|
{
|
||||||
PlayerPacket::Packet(bs, send);
|
PlayerPacket::Packet(bs, send);
|
||||||
|
|
||||||
// Placeholder to be filled in later
|
RW(player->sound, send);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue