mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Play 'Idle' voiced dialogue entries in AIWander. Tweak voice max distance.
This commit is contained in:
parent
2836c7c927
commit
e410eb5273
2 changed files with 10 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
#include <OgreVector3.h>
|
#include <OgreVector3.h>
|
||||||
|
@ -185,6 +186,14 @@ namespace MWMechanics
|
||||||
playIdle(actor, mPlayedIdle);
|
playIdle(actor, mPlayedIdle);
|
||||||
mChooseAction = false;
|
mChooseAction = false;
|
||||||
mIdleNow = true;
|
mIdleNow = true;
|
||||||
|
|
||||||
|
// Play idle voiced dialogue entries randomly
|
||||||
|
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
float chance = store.get<ESM::GameSetting>().find("fVoiceIdleOdds")->getFloat();
|
||||||
|
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||||
|
// TODO: do not show subtitle messagebox if player is too far away? or do not say at all?
|
||||||
|
if (roll < chance)
|
||||||
|
MWBase::Environment::get().getDialogueManager()->say(actor, "idle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,14 +248,13 @@ namespace MWSound
|
||||||
return;
|
return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// The range values are not tested
|
|
||||||
float basevol = volumeFromType(Play_TypeVoice);
|
float basevol = volumeFromType(Play_TypeVoice);
|
||||||
std::string filePath = "Sound/"+filename;
|
std::string filePath = "Sound/"+filename;
|
||||||
const ESM::Position &pos = ptr.getRefData().getPosition();
|
const ESM::Position &pos = ptr.getRefData().getPosition();
|
||||||
const Ogre::Vector3 objpos(pos.pos);
|
const Ogre::Vector3 objpos(pos.pos);
|
||||||
|
|
||||||
MWBase::SoundPtr sound = mOutput->playSound3D(filePath, objpos, 1.0f, basevol, 1.0f,
|
MWBase::SoundPtr sound = mOutput->playSound3D(filePath, objpos, 1.0f, basevol, 1.0f,
|
||||||
20.0f, 12750.0f, Play_Normal|Play_TypeVoice, 0);
|
20.0f, 1500.0f, Play_Normal|Play_TypeVoice, 0);
|
||||||
mActiveSounds[sound] = std::make_pair(ptr, std::string("_say_sound"));
|
mActiveSounds[sound] = std::make_pair(ptr, std::string("_say_sound"));
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
|
|
Loading…
Reference in a new issue