mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 07:45:36 +00:00
Make SayDone return 1 on the frame speech is started (bug #4879)
This commit is contained in:
parent
e0fb411fc8
commit
4c2b694b29
3 changed files with 44 additions and 5 deletions
|
@ -58,6 +58,7 @@
|
|||
Bug #4867: Arbitrary text after local variable declarations breaks script compilation
|
||||
Bug #4876: AI ratings handling inconsistencies
|
||||
Bug #4877: Startup script executes only on a new game start
|
||||
Bug #4879: SayDone returns 0 on the frame Say is called
|
||||
Bug #4888: Global variable stray explicit reference calls break script compilation
|
||||
Bug #4896: Title screen music doesn't loop
|
||||
Bug #4902: Using scrollbars in settings causes resolution to change
|
||||
|
|
|
@ -520,7 +520,7 @@ namespace MWSound
|
|||
Stream *sound = playVoice(decoder, pos, (ptr == MWMechanics::getPlayer()));
|
||||
if(!sound) return;
|
||||
|
||||
mActiveSaySounds.insert(std::make_pair(ptr, sound));
|
||||
mSaySoundsQueue.emplace(ptr, sound);
|
||||
}
|
||||
|
||||
float SoundManager::getSaySoundLoudness(const MWWorld::ConstPtr &ptr) const
|
||||
|
@ -568,7 +568,15 @@ namespace MWSound
|
|||
|
||||
void SoundManager::stopSay(const MWWorld::ConstPtr &ptr)
|
||||
{
|
||||
SaySoundMap::iterator snditer = mActiveSaySounds.find(ptr);
|
||||
SaySoundMap::iterator snditer = mSaySoundsQueue.find(ptr);
|
||||
if(snditer != mSaySoundsQueue.end())
|
||||
{
|
||||
mOutput->finishStream(snditer->second);
|
||||
mUnusedStreams.push_back(snditer->second);
|
||||
mSaySoundsQueue.erase(snditer);
|
||||
}
|
||||
|
||||
snditer = mActiveSaySounds.find(ptr);
|
||||
if(snditer != mActiveSaySounds.end())
|
||||
{
|
||||
mOutput->finishStream(snditer->second);
|
||||
|
@ -1068,8 +1076,15 @@ namespace MWSound
|
|||
++snditer;
|
||||
}
|
||||
|
||||
SaySoundMap::iterator sayiter = mActiveSaySounds.begin();
|
||||
while(sayiter != mActiveSaySounds.end())
|
||||
SaySoundMap::iterator sayiter = mSaySoundsQueue.begin();
|
||||
while (sayiter != mSaySoundsQueue.end())
|
||||
{
|
||||
mActiveSaySounds[sayiter->first] = sayiter->second;
|
||||
mSaySoundsQueue.erase(sayiter++);
|
||||
}
|
||||
|
||||
sayiter = mActiveSaySounds.begin();
|
||||
while (sayiter != mActiveSaySounds.end())
|
||||
{
|
||||
MWWorld::ConstPtr ptr = sayiter->first;
|
||||
Stream *sound = sayiter->second;
|
||||
|
@ -1187,6 +1202,12 @@ namespace MWSound
|
|||
sound->setBaseVolume(volumeFromType(sound->getPlayType()));
|
||||
mOutput->updateStream(sound);
|
||||
}
|
||||
for(SaySoundMap::value_type &snd : mSaySoundsQueue)
|
||||
{
|
||||
Stream *sound = snd.second;
|
||||
sound->setBaseVolume(volumeFromType(sound->getPlayType()));
|
||||
mOutput->updateStream(sound);
|
||||
}
|
||||
for(Stream *sound : mActiveTracks)
|
||||
{
|
||||
sound->setBaseVolume(volumeFromType(sound->getPlayType()));
|
||||
|
@ -1218,7 +1239,16 @@ namespace MWSound
|
|||
mActiveSounds.erase(snditer);
|
||||
mActiveSounds.emplace(updated, std::move(sndlist));
|
||||
}
|
||||
SaySoundMap::iterator sayiter = mActiveSaySounds.find(old);
|
||||
|
||||
SaySoundMap::iterator sayiter = mSaySoundsQueue.find(old);
|
||||
if(sayiter != mSaySoundsQueue.end())
|
||||
{
|
||||
Stream *stream = sayiter->second;
|
||||
mSaySoundsQueue.erase(sayiter);
|
||||
mSaySoundsQueue.emplace(updated, stream);
|
||||
}
|
||||
|
||||
sayiter = mActiveSaySounds.find(old);
|
||||
if(sayiter != mActiveSaySounds.end())
|
||||
{
|
||||
Stream *stream = sayiter->second;
|
||||
|
@ -1311,6 +1341,13 @@ namespace MWSound
|
|||
mUnderwaterSound = nullptr;
|
||||
mNearWaterSound = nullptr;
|
||||
|
||||
for(SaySoundMap::value_type &snd : mSaySoundsQueue)
|
||||
{
|
||||
mOutput->finishStream(snd.second);
|
||||
mUnusedStreams.push_back(snd.second);
|
||||
}
|
||||
mSaySoundsQueue.clear();
|
||||
|
||||
for(SaySoundMap::value_type &snd : mActiveSaySounds)
|
||||
{
|
||||
mOutput->finishStream(snd.second);
|
||||
|
|
|
@ -93,6 +93,7 @@ namespace MWSound
|
|||
SoundMap mActiveSounds;
|
||||
|
||||
typedef std::map<MWWorld::ConstPtr,Stream*> SaySoundMap;
|
||||
SaySoundMap mSaySoundsQueue;
|
||||
SaySoundMap mActiveSaySounds;
|
||||
|
||||
typedef std::vector<Stream*> TrackList;
|
||||
|
|
Loading…
Reference in a new issue