mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add debug logging for tavern music and NPC voices
Added extensive logging to diagnose issues: - Logs WMO model IDs when entering WMOs (to identify correct tavern IDs) - Logs when tavern music should be playing - Logs NPC voice playGreeting calls and their results - Logs which sound files are being played - Added more emote variations (Hello, Yes) for NPC voices This will help identify why tavern music and NPC voices aren't working.
This commit is contained in:
parent
e1ecd13bcd
commit
ee52732350
2 changed files with 28 additions and 1 deletions
|
|
@ -39,17 +39,25 @@ void NpcVoiceManager::shutdown() {
|
|||
void NpcVoiceManager::loadVoiceSounds() {
|
||||
if (!assetManager_) return;
|
||||
|
||||
// Generic NPC greetings using Hello emote (more reliable than Greeting)
|
||||
// Generic NPC greetings using various emotes (Hello, Yes, Thanks)
|
||||
std::vector<std::string> genericPaths = {
|
||||
"Sound\\Character\\Human\\HumanMaleHello01.wav",
|
||||
"Sound\\Character\\Human\\HumanMaleHello02.wav",
|
||||
"Sound\\Character\\Human\\HumanMaleHello03.wav",
|
||||
"Sound\\Character\\Human\\HumanMaleYes01.wav",
|
||||
"Sound\\Character\\Human\\HumanMaleYes02.wav",
|
||||
"Sound\\Character\\Human\\HumanMaleYes03.wav",
|
||||
"Sound\\Character\\Human\\HumanFemaleHello01.wav",
|
||||
"Sound\\Character\\Human\\HumanFemaleHello02.wav",
|
||||
"Sound\\Character\\Human\\HumanFemaleYes01.wav",
|
||||
"Sound\\Character\\Human\\HumanFemaleYes02.wav",
|
||||
"Sound\\Character\\Dwarf\\DwarfMaleHello01.wav",
|
||||
"Sound\\Character\\Dwarf\\DwarfMaleHello02.wav",
|
||||
"Sound\\Character\\Dwarf\\DwarfMaleYes01.wav",
|
||||
"Sound\\Character\\NightElf\\NightElfMaleHello01.wav",
|
||||
"Sound\\Character\\NightElf\\NightElfMaleYes01.wav",
|
||||
"Sound\\Character\\NightElf\\NightElfFemaleHello01.wav",
|
||||
"Sound\\Character\\NightElf\\NightElfFemaleYes01.wav",
|
||||
};
|
||||
|
||||
auto& genericVoices = voiceLibrary_[VoiceType::GENERIC];
|
||||
|
|
@ -160,7 +168,10 @@ bool NpcVoiceManager::loadSound(const std::string& path, VoiceSample& sample) {
|
|||
}
|
||||
|
||||
void NpcVoiceManager::playGreeting(uint64_t npcGuid, VoiceType voiceType, const glm::vec3& position) {
|
||||
LOG_INFO("NPC voice: playGreeting called for GUID ", npcGuid);
|
||||
|
||||
if (!AudioEngine::instance().isInitialized()) {
|
||||
LOG_WARNING("NPC voice: AudioEngine not initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -170,6 +181,7 @@ void NpcVoiceManager::playGreeting(uint64_t npcGuid, VoiceType voiceType, const
|
|||
if (it != lastPlayTime_.end()) {
|
||||
float elapsed = std::chrono::duration<float>(now - it->second).count();
|
||||
if (elapsed < GREETING_COOLDOWN) {
|
||||
LOG_INFO("NPC voice: on cooldown (", elapsed, "s elapsed)");
|
||||
return; // Still on cooldown
|
||||
}
|
||||
}
|
||||
|
|
@ -177,9 +189,11 @@ void NpcVoiceManager::playGreeting(uint64_t npcGuid, VoiceType voiceType, const
|
|||
// Find voice library for this type
|
||||
auto libIt = voiceLibrary_.find(voiceType);
|
||||
if (libIt == voiceLibrary_.end() || libIt->second.empty()) {
|
||||
LOG_INFO("NPC voice: No samples for type ", static_cast<int>(voiceType), ", falling back to GENERIC");
|
||||
// Fall back to generic
|
||||
libIt = voiceLibrary_.find(VoiceType::GENERIC);
|
||||
if (libIt == voiceLibrary_.end() || libIt->second.empty()) {
|
||||
LOG_WARNING("NPC voice: No voice samples available (library empty)");
|
||||
return; // No voice samples available
|
||||
}
|
||||
}
|
||||
|
|
@ -190,6 +204,8 @@ void NpcVoiceManager::playGreeting(uint64_t npcGuid, VoiceType voiceType, const
|
|||
std::uniform_int_distribution<size_t> dist(0, samples.size() - 1);
|
||||
const auto& sample = samples[dist(rng_)];
|
||||
|
||||
LOG_INFO("NPC voice: Playing sound from: ", sample.path);
|
||||
|
||||
// Play with 3D positioning
|
||||
std::uniform_real_distribution<float> volumeDist(0.85f, 1.0f);
|
||||
std::uniform_real_distribution<float> pitchDist(0.98f, 1.02f);
|
||||
|
|
@ -203,7 +219,10 @@ void NpcVoiceManager::playGreeting(uint64_t npcGuid, VoiceType voiceType, const
|
|||
);
|
||||
|
||||
if (success) {
|
||||
LOG_INFO("NPC voice: Sound played successfully");
|
||||
lastPlayTime_[npcGuid] = now;
|
||||
} else {
|
||||
LOG_WARNING("NPC voice: Failed to play sound");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1430,6 +1430,13 @@ void Renderer::update(float deltaTime) {
|
|||
}
|
||||
|
||||
// Detect taverns/inns by WMO model ID (common inn WMOs)
|
||||
// Log WMO ID for debugging
|
||||
static uint32_t lastLoggedWmoId = 0;
|
||||
if (wmoModelId != lastLoggedWmoId) {
|
||||
LOG_INFO("Inside WMO model ID: ", wmoModelId);
|
||||
lastLoggedWmoId = wmoModelId;
|
||||
}
|
||||
|
||||
// These IDs represent typical Alliance and Horde inn buildings
|
||||
if (wmoModelId == 191 || // Goldshire inn
|
||||
wmoModelId == 190 || // Small inn (common)
|
||||
|
|
@ -1447,6 +1454,7 @@ void Renderer::update(float deltaTime) {
|
|||
};
|
||||
static int tavernTrackIndex = 0;
|
||||
tavernMusic = tavernTracks[tavernTrackIndex % tavernTracks.size()];
|
||||
LOG_INFO("Detected tavern WMO, playing: ", tavernMusic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue