diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dragdrop.h | 4 | ||||
-rw-r--r-- | src/itemsoundmanager.cpp | 8 | ||||
-rw-r--r-- | src/itemsoundmanager.h | 3 | ||||
-rw-r--r-- | src/resources/db/itemdb.cpp | 2 |
4 files changed, 16 insertions, 1 deletions
diff --git a/src/dragdrop.h b/src/dragdrop.h index d282d82e3..72c39a766 100644 --- a/src/dragdrop.h +++ b/src/dragdrop.h @@ -22,6 +22,7 @@ #define DRAGDROP_H #include "item.h" +#include "itemsoundmanager.h" #include "textcommand.h" #include "gui/widgets/skilldata.h" @@ -103,6 +104,7 @@ class DragDrop final mItemImage->incRef(); mSource = source; mTag = tag; + ItemSoundManager::playSfx(item, SOUND_EVENT_TAKE); } else { @@ -180,6 +182,8 @@ class DragDrop final { if (mItemImage) mItemImage->decRef(); + if (mItem) + ItemSoundManager::playSfx(mItem, SOUND_EVENT_PUT); mItem = 0; mItemColor = 1; mItemImage = nullptr; diff --git a/src/itemsoundmanager.cpp b/src/itemsoundmanager.cpp index 9107a4048..5fdd09ccb 100644 --- a/src/itemsoundmanager.cpp +++ b/src/itemsoundmanager.cpp @@ -35,7 +35,13 @@ void ItemSoundManager::playSfx(const Item *const item, { if (!item) return; - const ItemInfo &info = ItemDB::get(item->getId()); + playSfx(item->getId(), sound); +} + +void ItemSoundManager::playSfx(const int itemId, + const ItemSoundEvent sound) +{ + const ItemInfo &info = ItemDB::get(itemId); std::string sfx = info.getSound(sound).sound; if (sfx.empty()) { diff --git a/src/itemsoundmanager.h b/src/itemsoundmanager.h index 77ef221c7..3341178ca 100644 --- a/src/itemsoundmanager.h +++ b/src/itemsoundmanager.h @@ -33,6 +33,9 @@ class ItemSoundManager final public: A_DELETE_COPY(ItemSoundManager) + static void playSfx(const int item, + const ItemSoundEvent sound); + static void playSfx(const Item *const item, const ItemSoundEvent sound); diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 8066eb40d..067ccc25c 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -172,6 +172,8 @@ static void initStatic() mSoundNames["unequip"] = SOUND_EVENT_UNEQUIP; mSoundNames["drop"] = SOUND_EVENT_DROP; mSoundNames["pickup"] = SOUND_EVENT_PICKUP; + mSoundNames["take"] = SOUND_EVENT_TAKE; + mSoundNames["put"] = SOUND_EVENT_PUT; } void ItemDB::load() |