forked from mirror/openmw-tes3mp
[General] Find actor speech captions instead of sending them in packets
This commit is contained in:
parent
413893aa51
commit
605b06c303
7 changed files with 51 additions and 5 deletions
|
@ -102,6 +102,16 @@ namespace MWBase
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Make it possible to get the caption of a voice dialogue
|
||||||
|
*/
|
||||||
|
virtual std::string getVoiceCaption(const std::string& sound) const = 0;
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -711,7 +711,6 @@ namespace MWDialogue
|
||||||
if (mwmp::Main::get().getCellController()->isLocalActor(actor))
|
if (mwmp::Main::get().getCellController()->isLocalActor(actor))
|
||||||
{
|
{
|
||||||
mwmp::LocalActor *localActor = mwmp::Main::get().getCellController()->getLocalActor(actor);
|
mwmp::LocalActor *localActor = mwmp::Main::get().getCellController()->getLocalActor(actor);
|
||||||
localActor->response = info->mResponse;
|
|
||||||
localActor->sound = info->mSound;
|
localActor->sound = info->mSound;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -816,4 +815,32 @@ namespace MWDialogue
|
||||||
mLastTopic, actor.getClass().getName(actor));
|
mLastTopic, actor.getClass().getName(actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Make it possible to get the caption of a voice dialogue
|
||||||
|
*/
|
||||||
|
std::string DialogueManager::getVoiceCaption(const std::string& sound) const
|
||||||
|
{
|
||||||
|
const MWWorld::Store<ESM::Dialogue>& dialogues = MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||||
|
|
||||||
|
for (MWWorld::Store<ESM::Dialogue>::iterator dialogueIter = dialogues.begin(); dialogueIter != dialogues.end(); ++dialogueIter)
|
||||||
|
{
|
||||||
|
if (dialogueIter->mType == ESM::Dialogue::Voice)
|
||||||
|
{
|
||||||
|
for (ESM::Dialogue::InfoContainer::const_iterator infoIter = dialogueIter->mInfo.begin();
|
||||||
|
infoIter != dialogueIter->mInfo.end(); ++infoIter)
|
||||||
|
{
|
||||||
|
if (!infoIter->mSound.empty() && Misc::StringUtils::ciEqual(sound, infoIter->mSound))
|
||||||
|
return infoIter->mResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "???";
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,16 @@ namespace MWDialogue
|
||||||
|
|
||||||
/// Removes the last added topic response for the given actor from the journal
|
/// Removes the last added topic response for the given actor from the journal
|
||||||
virtual void clearInfoActor (const MWWorld::Ptr& actor) const;
|
virtual void clearInfoActor (const MWWorld::Ptr& actor) const;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Make it possible to get the caption of a voice dialogue
|
||||||
|
*/
|
||||||
|
virtual std::string getVoiceCaption(const std::string& sound) const;
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,6 @@ void Cell::readSpeech(ActorList& actorList)
|
||||||
if (dedicatedActors.count(mapIndex) > 0)
|
if (dedicatedActors.count(mapIndex) > 0)
|
||||||
{
|
{
|
||||||
DedicatedActor *actor = dedicatedActors[mapIndex];
|
DedicatedActor *actor = dedicatedActors[mapIndex];
|
||||||
actor->response = baseActor.response;
|
|
||||||
actor->sound = baseActor.sound;
|
actor->sound = baseActor.sound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
|
#include "../mwdialogue/dialoguemanagerimp.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
#include "../mwmechanics/mechanicsmanagerimp.hpp"
|
#include "../mwmechanics/mechanicsmanagerimp.hpp"
|
||||||
#include "../mwmechanics/movement.hpp"
|
#include "../mwmechanics/movement.hpp"
|
||||||
|
@ -217,7 +219,7 @@ void DedicatedActor::playSound()
|
||||||
|
|
||||||
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
||||||
if (winMgr->getSubtitlesEnabled())
|
if (winMgr->getSubtitlesEnabled())
|
||||||
winMgr->messageBox(response, MWGui::ShowInDialogueMode_Never);
|
winMgr->messageBox(MWBase::Environment::get().getDialogueManager()->getVoiceCaption(sound), MWGui::ShowInDialogueMode_Never);
|
||||||
|
|
||||||
sound.clear();
|
sound.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ namespace mwmp
|
||||||
char drawState;
|
char drawState;
|
||||||
bool isFlying;
|
bool isFlying;
|
||||||
|
|
||||||
std::string response;
|
|
||||||
std::string sound;
|
std::string sound;
|
||||||
|
|
||||||
SimpleCreatureStats creatureStats;
|
SimpleCreatureStats creatureStats;
|
||||||
|
|
|
@ -11,6 +11,5 @@ PacketActorSpeech::PacketActorSpeech(RakNet::RakPeerInterface *peer) : ActorPack
|
||||||
|
|
||||||
void PacketActorSpeech::Actor(BaseActor &actor, bool send)
|
void PacketActorSpeech::Actor(BaseActor &actor, bool send)
|
||||||
{
|
{
|
||||||
RW(actor.response, send);
|
|
||||||
RW(actor.sound, send);
|
RW(actor.sound, send);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue