mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-05 06:45:34 +00:00
Say something from the "hit" dialog topic when losing health
This commit is contained in:
parent
59f1bc7542
commit
d8ec813939
4 changed files with 32 additions and 0 deletions
|
@ -40,6 +40,8 @@ namespace MWBase
|
|||
virtual MWWorld::Ptr getActor() const = 0;
|
||||
///< Return the actor the player is currently talking to.
|
||||
|
||||
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const = 0;
|
||||
|
||||
//calbacks for the GUI
|
||||
virtual void keywordSelected (const std::string& keyword) = 0;
|
||||
virtual void goodbyeSelected() = 0;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
@ -343,6 +344,8 @@ namespace MWClass
|
|||
// 'ptr' is losing health. Play a 'hit' voiced dialog entry if not already saying
|
||||
// something, alert the character controller, scripts, etc.
|
||||
// NOTE: 'attacker' may be empty.
|
||||
|
||||
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
|
||||
}
|
||||
|
||||
bool wasDead = crstats.isDead();
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "../mwbase/scriptmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
@ -557,6 +558,30 @@ namespace MWDialogue
|
|||
return false;
|
||||
}
|
||||
|
||||
void DialogueManager::say(const MWWorld::Ptr &actor, const std::string &topic) const
|
||||
{
|
||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||
if(!sndMgr->sayDone(actor))
|
||||
{
|
||||
// Actor is already saying something.
|
||||
return;
|
||||
}
|
||||
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Dialogue *dial = store.get<ESM::Dialogue>().find(topic);
|
||||
|
||||
Filter filter(actor, 0, false);
|
||||
const ESM::DialInfo *info = filter.search(*dial, false);
|
||||
if(info != NULL)
|
||||
{
|
||||
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
||||
if(winMgr->getSubtitlesEnabled())
|
||||
winMgr->messageBox(info->mResponse);
|
||||
sndMgr->say(actor, info->mSound);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::vector<HyperTextToken> ParseHyperText(const std::string& text)
|
||||
{
|
||||
std::vector<HyperTextToken> result;
|
||||
|
|
|
@ -68,6 +68,8 @@ namespace MWDialogue
|
|||
|
||||
virtual bool checkServiceRefused ();
|
||||
|
||||
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const;
|
||||
|
||||
//calbacks for the GUI
|
||||
virtual void keywordSelected (const std::string& keyword);
|
||||
virtual void goodbyeSelected();
|
||||
|
|
Loading…
Reference in a new issue