From 3b9cfba03cef103ab02b11b3bbf76e4cd8e7a5ae Mon Sep 17 00:00:00 2001 From: Lukasz Gromanowski Date: Sat, 11 Oct 2014 22:21:59 +0200 Subject: [PATCH] Issue #1887: Equipped items do not emit sounds Sounds are played only when actors draw state is equal to MWMechanics::DrawState_Nothing Signed-off-by: Lukasz Gromanowski --- apps/openmw/mwrender/npcanimation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 0b1dcc270..37e9e14ad 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -664,12 +664,13 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g std::string soundId; MWWorld::ContainerStoreIterator csi = mInv.getSlot(group < 0 ? MWWorld::InventoryStore::Slot_Helmet : group); + if (csi != mInv.end() && csi->getTypeName() == typeid(ESM::Light).name()) { soundId = csi->get()->mBase->mSound; } mObjectParts[type] = std::make_pair(insertBoundedPart(mesh, group, sPartList.at(type), enchantedGlow, glowColor), soundId); - if (!soundId.empty()) + if (!soundId.empty() && mPtr.getClass().getCreatureStats(mPtr).getDrawState() == MWMechanics::DrawState_Nothing) { MWBase::Environment::get().getSoundManager()->playSound3D(mPtr, soundId, 1.0f, 1.0f, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Loop);