diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index 2305b286ed..5d353a0f38 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -79,11 +79,25 @@ namespace MWClass std::string Clothing::getUpSoundId (const MWWorld::Ptr& ptr) const { + ESMS::LiveCellRef *ref = + ptr.get(); + + if (ref->base->data.type == 8) + { + return std::string("Item Ring Up"); + } return std::string("Item Clothes Up"); } std::string Clothing::getDownSoundId (const MWWorld::Ptr& ptr) const { + ESMS::LiveCellRef *ref = + ptr.get(); + + if (ref->base->data.type == 8) + { + return std::string("Item Ring Down"); + } return std::string("Item Clothes Down"); } } diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index f9ec1c9569..9a5daf24d4 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -82,6 +82,8 @@ namespace MWClass if (!(ref->base->data.flags & ESM::Light::Carry)) return boost::shared_ptr (new MWWorld::NullAction); + environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, false, true); + return boost::shared_ptr ( new MWWorld::ActionTake (ptr)); } @@ -100,4 +102,14 @@ namespace MWClass registerClass (typeid (ESM::Light).name(), instance); } + + std::string Light::getUpSoundId (const MWWorld::Ptr& ptr) const + { + return std::string("Item Misc Up"); + } + + std::string Light::getDownSoundId (const MWWorld::Ptr& ptr) const + { + return std::string("Item Misc Down"); + } } diff --git a/apps/openmw/mwclass/light.hpp b/apps/openmw/mwclass/light.hpp index c9940d0a59..212c6dbf86 100644 --- a/apps/openmw/mwclass/light.hpp +++ b/apps/openmw/mwclass/light.hpp @@ -31,6 +31,12 @@ namespace MWClass ///< Return name of the script attached to ptr static void registerSelf(); + + virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const; + ///< Return the pick up sound Id + + virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const; + ///< Return the put down sound Id }; } diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 460470a966..20a0e5b4de 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -79,11 +79,25 @@ namespace MWClass std::string Miscellaneous::getUpSoundId (const MWWorld::Ptr& ptr) const { + ESMS::LiveCellRef *ref = + ptr.get(); + + if (ref->base->name =="Gold") + { + return std::string("Item Gold Up"); + } return std::string("Item Misc Up"); } std::string Miscellaneous::getDownSoundId (const MWWorld::Ptr& ptr) const { + ESMS::LiveCellRef *ref = + ptr.get(); + + if (ref->base->name =="Gold") + { + return std::string("Item Gold Down"); + } return std::string("Item Misc Down"); } } diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index c57c18fd1f..4eb62bbc7a 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -7,9 +7,12 @@ #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" +#include "../mwworld/environment.hpp" #include "../mwrender/objects.hpp" +#include "../mwsound/soundmanager.hpp" + namespace MWClass { void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const @@ -53,6 +56,8 @@ namespace MWClass boost::shared_ptr Potion::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const { + environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, false, true); + return boost::shared_ptr ( new MWWorld::ActionTake (ptr)); } @@ -71,4 +76,14 @@ namespace MWClass registerClass (typeid (ESM::Potion).name(), instance); } + + std::string Potion::getUpSoundId (const MWWorld::Ptr& ptr) const + { + return std::string("Item Potion Up"); + } + + std::string Potion::getDownSoundId (const MWWorld::Ptr& ptr) const + { + return std::string("Item Potion Down"); + } } diff --git a/apps/openmw/mwclass/potion.hpp b/apps/openmw/mwclass/potion.hpp index fd78bba539..191ef5b159 100644 --- a/apps/openmw/mwclass/potion.hpp +++ b/apps/openmw/mwclass/potion.hpp @@ -26,6 +26,12 @@ namespace MWClass ///< Return name of the script attached to ptr static void registerSelf(); + + virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const; + ///< Return the pick up sound Id + + virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const; + ///< Return the put down sound Id }; } diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp index f831b6b503..5053088147 100644 --- a/apps/openmw/mwclass/repair.cpp +++ b/apps/openmw/mwclass/repair.cpp @@ -7,9 +7,12 @@ #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" +#include "../mwworld/environment.hpp" #include "../mwrender/objects.hpp" +#include "../mwsound/soundmanager.hpp" + namespace MWClass { void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const @@ -53,6 +56,8 @@ namespace MWClass boost::shared_ptr Repair::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const { + environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, false, true); + return boost::shared_ptr ( new MWWorld::ActionTake (ptr)); } @@ -71,4 +76,14 @@ namespace MWClass registerClass (typeid (ESM::Repair).name(), instance); } + + std::string Repair::getUpSoundId (const MWWorld::Ptr& ptr) const + { + return std::string("Item Repair Up"); + } + + std::string Repair::getDownSoundId (const MWWorld::Ptr& ptr) const + { + return std::string("Item Repair Down"); + } } diff --git a/apps/openmw/mwclass/repair.hpp b/apps/openmw/mwclass/repair.hpp index a5864ab35a..eef35acc9b 100644 --- a/apps/openmw/mwclass/repair.hpp +++ b/apps/openmw/mwclass/repair.hpp @@ -26,6 +26,12 @@ namespace MWClass ///< Return name of the script attached to ptr static void registerSelf(); + + virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const; + ///< Return the pick up sound Id + + virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const; + ///< Return the put down sound Id }; }