mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 16:10:14 +00:00
Upgrade SMSG_PLAY_OBJECT_SOUND/SPELL_IMPACT to 3D positional audio
Add PlayPositionalSoundCallback that carries both soundId and sourceGuid. In Application, look up the source entity position and play via AudioEngine::playSound3D(); fall back to playSound2D() when the entity is unknown. Also read the 8-byte sourceGuid field from the packet (previously the full 12-byte payload was ignored).
This commit is contained in:
parent
0913146f54
commit
97192ab2a4
3 changed files with 43 additions and 2 deletions
|
|
@ -4507,9 +4507,15 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
// ---- Play object/spell sounds ----
|
||||
case Opcode::SMSG_PLAY_OBJECT_SOUND:
|
||||
case Opcode::SMSG_PLAY_SPELL_IMPACT:
|
||||
if (packet.getSize() - packet.getReadPos() >= 4) {
|
||||
if (packet.getSize() - packet.getReadPos() >= 12) {
|
||||
// uint32 soundId + uint64 sourceGuid
|
||||
uint32_t soundId = packet.readUInt32();
|
||||
uint64_t srcGuid = packet.readUInt64();
|
||||
LOG_DEBUG("SMSG_PLAY_OBJECT_SOUND/SPELL_IMPACT id=", soundId, " src=0x", std::hex, srcGuid, std::dec);
|
||||
if (playPositionalSoundCallback_) playPositionalSoundCallback_(soundId, srcGuid);
|
||||
else if (playSoundCallback_) playSoundCallback_(soundId);
|
||||
} else if (packet.getSize() - packet.getReadPos() >= 4) {
|
||||
uint32_t soundId = packet.readUInt32();
|
||||
LOG_DEBUG("SMSG_PLAY_OBJECT_SOUND/SPELL_IMPACT id=", soundId);
|
||||
if (playSoundCallback_) playSoundCallback_(soundId);
|
||||
}
|
||||
packet.setReadPos(packet.getSize());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue