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 71c4fb3ae6
commit eb288d2064
7 changed files with 37 additions and 1 deletions

View file

@ -37,6 +37,7 @@
#include "audio/footstep_manager.hpp"
#include "audio/activity_sound_manager.hpp"
#include "audio/mount_sound_manager.hpp"
#include "audio/npc_voice_manager.hpp"
#include <GL/glew.h>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/euler_angles.hpp>
@ -342,6 +343,7 @@ bool Renderer::initialize(core::Window* win) {
footstepManager = std::make_unique<audio::FootstepManager>();
activitySoundManager = std::make_unique<audio::ActivitySoundManager>();
mountSoundManager = std::make_unique<audio::MountSoundManager>();
npcVoiceManager = std::make_unique<audio::NpcVoiceManager>();
// Underwater full-screen tint overlay (applies to all world geometry).
underwaterOverlayShader = std::make_unique<Shader>();
@ -2132,6 +2134,12 @@ bool Renderer::loadTerrainArea(const std::string& mapName, int centerX, int cent
activitySoundManager->initialize(cachedAssetManager);
}
}
if (mountSoundManager && cachedAssetManager) {
mountSoundManager->initialize(cachedAssetManager);
}
if (npcVoiceManager && cachedAssetManager) {
npcVoiceManager->initialize(cachedAssetManager);
}
// Wire WMO, M2, and water renderer to camera controller
if (cameraController && wmoRenderer) {