Implement NPC greeting voice lines

Added NPC voice manager that plays greeting sounds when clicking on NPCs:

Features:
- Voice line library with multiple race/gender voice types (Human, Dwarf,
  Night Elf, etc.)
- 3D positional audio - voice comes from NPC location
- Cooldown system prevents spam clicking same NPC
- Randomized pitch/volume for variety
- Loads greeting sounds from character voice files in MPQ
- Generic fallback voices for NPCs without specific voice types

Voice lines trigger automatically when gossip window opens (SMSG_GOSSIP_MESSAGE).
Uses same audio system as other sound effects with ma_sound_set_position.
This commit is contained in:
Kelsi 2026-02-09 01:29:44 -08:00
parent 85803702ee
commit 899de397b4
7 changed files with 37 additions and 1 deletions

View file

@ -6,6 +6,7 @@
#include <cstdint>
#include <random>
#include <chrono>
#include <glm/glm.hpp>
namespace wowee {
namespace pipeline { class AssetManager; }

View file

@ -357,6 +357,10 @@ public:
using NpcSwingCallback = std::function<void(uint64_t guid)>;
void setNpcSwingCallback(NpcSwingCallback cb) { npcSwingCallback_ = std::move(cb); }
// NPC greeting callback (plays voice line when NPC is clicked)
using NpcGreetingCallback = std::function<void(uint64_t guid, const glm::vec3& position)>;
void setNpcGreetingCallback(NpcGreetingCallback cb) { npcGreetingCallback_ = std::move(cb); }
// XP tracking
uint32_t getPlayerXp() const { return playerXp_; }
uint32_t getPlayerNextLevelXp() const { return playerNextLevelXp_; }
@ -1030,6 +1034,7 @@ private:
NpcRespawnCallback npcRespawnCallback_;
MeleeSwingCallback meleeSwingCallback_;
NpcSwingCallback npcSwingCallback_;
NpcGreetingCallback npcGreetingCallback_;
MountCallback mountCallback_;
TaxiPrecacheCallback taxiPrecacheCallback_;
TaxiOrientationCallback taxiOrientationCallback_;

View file

@ -8,7 +8,7 @@
namespace wowee {
namespace core { class Window; }
namespace game { class World; class ZoneManager; }
namespace audio { class MusicManager; class FootstepManager; class ActivitySoundManager; class MountSoundManager; enum class FootstepSurface : uint8_t; }
namespace audio { class MusicManager; class FootstepManager; class ActivitySoundManager; class MountSoundManager; class NpcVoiceManager; enum class FootstepSurface : uint8_t; enum class VoiceType; }
namespace pipeline { class AssetManager; }
namespace rendering {
@ -149,6 +149,7 @@ public:
audio::FootstepManager* getFootstepManager() { return footstepManager.get(); }
audio::ActivitySoundManager* getActivitySoundManager() { return activitySoundManager.get(); }
audio::MountSoundManager* getMountSoundManager() { return mountSoundManager.get(); }
audio::NpcVoiceManager* getNpcVoiceManager() { return npcVoiceManager.get(); }
private:
core::Window* window = nullptr;
@ -175,6 +176,7 @@ private:
std::unique_ptr<audio::FootstepManager> footstepManager;
std::unique_ptr<audio::ActivitySoundManager> activitySoundManager;
std::unique_ptr<audio::MountSoundManager> mountSoundManager;
std::unique_ptr<audio::NpcVoiceManager> npcVoiceManager;
std::unique_ptr<game::ZoneManager> zoneManager;
std::unique_ptr<Shader> underwaterOverlayShader;
uint32_t underwaterOverlayVAO = 0;