mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
Wire SMSG_PLAY_SOUND to AudioEngine via SoundEntries.dbc lookup
Add PlaySoundCallback to GameHandler (same pattern as PlayMusicCallback). When SMSG_PLAY_SOUND arrives, resolve the soundId through SoundEntries.dbc (fields 3-12 = files, field 23 = DirectoryBase) and play the first found file as a 2-D sound effect via AudioEngine::playSound2D(). Previously the opcode was parsed and dropped.
This commit is contained in:
parent
55082a0925
commit
a2c2675039
3 changed files with 29 additions and 1 deletions
|
|
@ -2121,6 +2121,27 @@ void Application::setupUICallbacks() {
|
|||
}
|
||||
});
|
||||
|
||||
// SMSG_PLAY_SOUND: look up SoundEntries.dbc and play 2-D sound effect
|
||||
gameHandler->setPlaySoundCallback([this](uint32_t soundId) {
|
||||
if (!assetManager) return;
|
||||
|
||||
auto dbc = assetManager->loadDBC("SoundEntries.dbc");
|
||||
if (!dbc || !dbc->isLoaded()) return;
|
||||
|
||||
int32_t idx = dbc->findRecordById(soundId);
|
||||
if (idx < 0) return;
|
||||
|
||||
const uint32_t row = static_cast<uint32_t>(idx);
|
||||
std::string dir = dbc->getString(row, 23);
|
||||
for (uint32_t f = 3; f <= 12; ++f) {
|
||||
std::string name = dbc->getString(row, f);
|
||||
if (name.empty()) continue;
|
||||
std::string path = dir.empty() ? name : dir + "\\" + name;
|
||||
audio::AudioEngine::instance().playSound2D(path);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
// Other player level-up callback — trigger 3D effect + chat notification
|
||||
gameHandler->setOtherPlayerLevelUpCallback([this](uint64_t guid, uint32_t newLevel) {
|
||||
if (!gameHandler || !renderer) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue