diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-04 19:19:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-04 19:19:53 +0300 |
commit | db43ad3b72fe207e6cc03a1fd341ea598d123319 (patch) | |
tree | 6d338e9e0bff66e7751d6d0866f32388bdcfe59c /src/itemsoundmanager.cpp | |
parent | 65a88f27b994f7ade178368c569d466f6344ded6 (diff) | |
download | mv-db43ad3b72fe207e6cc03a1fd341ea598d123319.tar.gz mv-db43ad3b72fe207e6cc03a1fd341ea598d123319.tar.bz2 mv-db43ad3b72fe207e6cc03a1fd341ea598d123319.tar.xz mv-db43ad3b72fe207e6cc03a1fd341ea598d123319.zip |
add pickup and drop sound effects.
Works like equip/unequip effects.
Diffstat (limited to 'src/itemsoundmanager.cpp')
-rw-r--r-- | src/itemsoundmanager.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/itemsoundmanager.cpp b/src/itemsoundmanager.cpp index 0e8b33d11..c77f0a08f 100644 --- a/src/itemsoundmanager.cpp +++ b/src/itemsoundmanager.cpp @@ -20,6 +20,7 @@ #include "itemsoundmanager.h" +#include "flooritem.h" #include "item.h" #include "logger.h" #include "soundmanager.h" @@ -48,3 +49,20 @@ void ItemSoundManager::playSfx(const Item *const item, } soundManager.playGuiSfx(sfx); } + +void ItemSoundManager::playSfx(const FloorItem *const item, + const ItemSoundEvent sound) +{ + if (!item) + return; + const ItemInfo &info = ItemDB::get(item->getItemId()); + std::string sfx = info.getSound(sound).sound; + if (sfx.empty()) + { + // fallback to player race sound if no item sound. + const int id = -100 - player_node->getSubType(); + const ItemInfo &info2 = ItemDB::get(id); + sfx = info2.getSound(sound).sound; + } + soundManager.playGuiSfx(sfx); +} |