Merge pull request #2330 from Capostrophic/spells

Only collect every unique magic bolt sound once (bug #4964)
pull/541/head
Andrei Kortunov 6 years ago committed by GitHub
commit 8cb4898ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -61,6 +61,7 @@
Bug #4947: Player character doesn't use lip animation
Bug #4948: Footstep sounds while levitating on ground level
Bug #4963: Enchant skill progress is incorrect
Bug #4964: Multiple effect spell projectile sounds play louder than vanilla
Bug #4965: Global light attenuation settings setup is lacking
Bug #4969: "Miss" sound plays for any actor
Bug #4972: Player is able to use quickkeys while disableplayerfighting is active

@ -44,7 +44,7 @@
namespace
{
ESM::EffectList getMagicBoltData(std::vector<std::string>& projectileIDs, std::vector<std::string>& sounds, float& speed, std::string& texture, std::string& sourceName, const std::string& id)
ESM::EffectList getMagicBoltData(std::vector<std::string>& projectileIDs, std::set<std::string>& sounds, float& speed, std::string& texture, std::string& sourceName, const std::string& id)
{
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const ESM::EffectList* effects;
@ -88,9 +88,9 @@ namespace
"alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration"
};
if (!magicEffect->mBoltSound.empty())
sounds.push_back(magicEffect->mBoltSound);
sounds.emplace(magicEffect->mBoltSound);
else
sounds.push_back(schools[magicEffect->mData.mSchool] + " bolt");
sounds.emplace(schools[magicEffect->mData.mSchool] + " bolt");
projectileEffects.mList.push_back(*iter);
}
@ -297,9 +297,9 @@ namespace MWWorld
createModel(state, ptr.getClass().getModel(ptr), pos, orient, true, true, lightDiffuseColor, texture);
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
for (size_t it = 0; it != state.mSoundIds.size(); it++)
for (const std::string &soundid : state.mSoundIds)
{
MWBase::Sound *sound = sndMgr->playSound3D(pos, state.mSoundIds.at(it), 1.0f, 1.0f,
MWBase::Sound *sound = sndMgr->playSound3D(pos, soundid, 1.0f, 1.0f,
MWSound::Type::Sfx, MWSound::PlayMode::Loop);
if (sound)
state.mSounds.push_back(sound);
@ -656,9 +656,9 @@ namespace MWWorld
createModel(state, model, osg::Vec3f(esm.mPosition), osg::Quat(esm.mOrientation), true, true, lightDiffuseColor, texture);
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
for (size_t soundIter = 0; soundIter != state.mSoundIds.size(); soundIter++)
for (const std::string &soundid : state.mSoundIds)
{
MWBase::Sound *sound = sndMgr->playSound3D(esm.mPosition, state.mSoundIds.at(soundIter), 1.0f, 1.0f,
MWBase::Sound *sound = sndMgr->playSound3D(esm.mPosition, soundid, 1.0f, 1.0f,
MWSound::Type::Sfx, MWSound::PlayMode::Loop);
if (sound)
state.mSounds.push_back(sound);

@ -102,7 +102,7 @@ namespace MWWorld
float mSpeed;
std::vector<MWBase::Sound*> mSounds;
std::vector<std::string> mSoundIds;
std::set<std::string> mSoundIds;
};
struct ProjectileState : public State

Loading…
Cancel
Save