From ac4dfd3b398e62e17976fc871bd4fae5b604ae85 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 18 Jul 2013 18:01:01 -0700 Subject: [PATCH] Play the appropriate foot sound based on footwear --- apps/openmw/mwclass/npc.cpp | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index eb100ff9a1..778120466f 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -673,7 +673,22 @@ namespace MWClass if(world->isUnderwater(ptr.getCell(), pos)) return "FootWaterLeft"; if(world->isOnGround(ptr)) - return "FootBareLeft"; + { + MWWorld::InventoryStore &inv = Npc::getInventoryStore(ptr); + MWWorld::ContainerStoreIterator boots = inv.getSlot(MWWorld::InventoryStore::Slot_Boots); + if(boots == inv.end() || boots->getTypeName() != typeid(ESM::Armor).name()) + return "FootBareLeft"; + + switch(Class::get(*boots).getEquipmentSkill(*boots)) + { + case ESM::Skill::LightArmor: + return "FootLightLeft"; + case ESM::Skill::MediumArmor: + return "FootMediumLeft"; + case ESM::Skill::HeavyArmor: + return "FootHeavyLeft"; + } + } return ""; } if(name == "right") @@ -683,7 +698,22 @@ namespace MWClass if(world->isUnderwater(ptr.getCell(), pos)) return "FootWaterRight"; if(world->isOnGround(ptr)) - return "FootBareRight"; + { + MWWorld::InventoryStore &inv = Npc::getInventoryStore(ptr); + MWWorld::ContainerStoreIterator boots = inv.getSlot(MWWorld::InventoryStore::Slot_Boots); + if(boots == inv.end() || boots->getTypeName() != typeid(ESM::Armor).name()) + return "FootBareRight"; + + switch(Class::get(*boots).getEquipmentSkill(*boots)) + { + case ESM::Skill::LightArmor: + return "FootLightRight"; + case ESM::Skill::MediumArmor: + return "FootMediumRight"; + case ESM::Skill::HeavyArmor: + return "FootHeavyRight"; + } + } return ""; } // TODO: I have no idea what these are supposed to do for NPCs since they use