mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-23 11:39:41 +00:00
Use SoundGen with no creature field as fallback
This fixes the adorable "thump" sounds in the Scrib's idle animation not playing.
This commit is contained in:
parent
192626c6f5
commit
4acc25f59c
1 changed files with 5 additions and 0 deletions
|
@ -679,6 +679,7 @@ namespace MWClass
|
||||||
if(type >= 0)
|
if(type >= 0)
|
||||||
{
|
{
|
||||||
std::vector<const ESM::SoundGenerator*> sounds;
|
std::vector<const ESM::SoundGenerator*> sounds;
|
||||||
|
std::vector<const ESM::SoundGenerator*> fallbacksounds;
|
||||||
|
|
||||||
MWWorld::LiveCellRef<ESM::Creature>* ref = ptr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature>* ref = ptr.get<ESM::Creature>();
|
||||||
|
|
||||||
|
@ -689,10 +690,14 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
if (type == sound->mType && !sound->mCreature.empty() && (Misc::StringUtils::ciEqual(ourId, sound->mCreature)))
|
if (type == sound->mType && !sound->mCreature.empty() && (Misc::StringUtils::ciEqual(ourId, sound->mCreature)))
|
||||||
sounds.push_back(&*sound);
|
sounds.push_back(&*sound);
|
||||||
|
if (type == sound->mType && sound->mCreature.empty())
|
||||||
|
fallbacksounds.push_back(&*sound);
|
||||||
++sound;
|
++sound;
|
||||||
}
|
}
|
||||||
if(!sounds.empty())
|
if(!sounds.empty())
|
||||||
return sounds[(int)(rand()/(RAND_MAX+1.0)*sounds.size())]->mSound;
|
return sounds[(int)(rand()/(RAND_MAX+1.0)*sounds.size())]->mSound;
|
||||||
|
if (!fallbacksounds.empty())
|
||||||
|
return fallbacksounds[(int)(rand()/(RAND_MAX+1.0)*fallbacksounds.size())]->mSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Reference in a new issue