mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +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
|
|
@ -948,6 +948,11 @@ public:
|
|||
using PlaySoundCallback = std::function<void(uint32_t soundId)>;
|
||||
void setPlaySoundCallback(PlaySoundCallback cb) { playSoundCallback_ = std::move(cb); }
|
||||
|
||||
// Server-triggered 3-D positional sound callback — fires for SMSG_PLAY_OBJECT_SOUND and
|
||||
// SMSG_PLAY_SPELL_IMPACT. Includes sourceGuid so the receiver can look up world position.
|
||||
using PlayPositionalSoundCallback = std::function<void(uint32_t soundId, uint64_t sourceGuid)>;
|
||||
void setPlayPositionalSoundCallback(PlayPositionalSoundCallback cb) { playPositionalSoundCallback_ = std::move(cb); }
|
||||
|
||||
// Mount state
|
||||
using MountCallback = std::function<void(uint32_t mountDisplayId)>; // 0 = dismount
|
||||
void setMountCallback(MountCallback cb) { mountCallback_ = std::move(cb); }
|
||||
|
|
@ -2103,6 +2108,7 @@ private:
|
|||
// ---- Server-triggered audio ----
|
||||
PlayMusicCallback playMusicCallback_;
|
||||
PlaySoundCallback playSoundCallback_;
|
||||
PlayPositionalSoundCallback playPositionalSoundCallback_;
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue