diff options
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); +} |