[General] Find actor speech captions instead of sending them in packets

0.6.2
David Cernat 7 years ago
parent 413893aa51
commit 605b06c303

@ -102,6 +102,16 @@ namespace MWBase
/*
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))
{
mwmp::LocalActor *localActor = mwmp::Main::get().getCellController()->getLocalActor(actor);
localActor->response = info->mResponse;
localActor->sound = info->mSound;
}
/*
@ -816,4 +815,32 @@ namespace MWDialogue
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
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)
{
DedicatedActor *actor = dedicatedActors[mapIndex];
actor->response = baseActor.response;
actor->sound = baseActor.sound;
}
}

@ -4,6 +4,8 @@
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwdialogue/dialoguemanagerimp.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/mechanicsmanagerimp.hpp"
#include "../mwmechanics/movement.hpp"
@ -217,7 +219,7 @@ void DedicatedActor::playSound()
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
if (winMgr->getSubtitlesEnabled())
winMgr->messageBox(response, MWGui::ShowInDialogueMode_Never);
winMgr->messageBox(MWBase::Environment::get().getDialogueManager()->getVoiceCaption(sound), MWGui::ShowInDialogueMode_Never);
sound.clear();
}

@ -32,7 +32,6 @@ namespace mwmp
char drawState;
bool isFlying;
std::string response;
std::string sound;
SimpleCreatureStats creatureStats;

@ -11,6 +11,5 @@ PacketActorSpeech::PacketActorSpeech(RakNet::RakPeerInterface *peer) : ActorPack
void PacketActorSpeech::Actor(BaseActor &actor, bool send)
{
RW(actor.response, send);
RW(actor.sound, send);
}

Loading…
Cancel
Save