|
|
|
@ -616,6 +616,13 @@ bool Animation::reset(AnimState &state, const NifOgre::TextKeyMap &keys, const s
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void split(const std::string &s, char delim, std::vector<std::string> &elems) {
|
|
|
|
|
std::stringstream ss(s);
|
|
|
|
|
std::string item;
|
|
|
|
|
while (std::getline(ss, item, delim)) {
|
|
|
|
|
elems.push_back(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Animation::handleTextKey(AnimState &state, const std::string &groupname, const NifOgre::TextKeyMap::const_iterator &key)
|
|
|
|
|
{
|
|
|
|
@ -630,14 +637,29 @@ void Animation::handleTextKey(AnimState &state, const std::string &groupname, co
|
|
|
|
|
}
|
|
|
|
|
if(evt.compare(0, 10, "soundgen: ") == 0)
|
|
|
|
|
{
|
|
|
|
|
std::string sound = MWWorld::Class::get(mPtr).getSoundIdFromSndGen(mPtr, evt.substr(10));
|
|
|
|
|
std::string soundgen = evt.substr(10);
|
|
|
|
|
|
|
|
|
|
// The event can optionally contain volume and pitch modifiers
|
|
|
|
|
float volume=1.f, pitch=1.f;
|
|
|
|
|
if (soundgen.find(" ") != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> tokens;
|
|
|
|
|
split(soundgen, ' ', tokens);
|
|
|
|
|
soundgen = tokens[0];
|
|
|
|
|
if (tokens.size() >= 2)
|
|
|
|
|
volume = Ogre::StringConverter::parseReal(tokens[1]);
|
|
|
|
|
if (tokens.size() >= 3)
|
|
|
|
|
pitch = Ogre::StringConverter::parseReal(tokens[2]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string sound = mPtr.getClass().getSoundIdFromSndGen(mPtr, soundgen);
|
|
|
|
|
if(!sound.empty())
|
|
|
|
|
{
|
|
|
|
|
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
|
|
|
|
MWBase::SoundManager::PlayType type = MWBase::SoundManager::Play_TypeSfx;
|
|
|
|
|
if(evt.compare(10, evt.size()-10, "left") == 0 || evt.compare(10, evt.size()-10, "right") == 0)
|
|
|
|
|
type = MWBase::SoundManager::Play_TypeFoot;
|
|
|
|
|
sndMgr->playSound3D(mPtr, sound, 1.0f, 1.0f, type);
|
|
|
|
|
sndMgr->playSound3D(mPtr, sound, volume, pitch, type);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|