Kelsidavis-WoWee/include/audio/combat_sound_manager.hpp
Kelsi 3a3e9f3c79 Add player character combat vocals with 60+ voice lines
Implemented player combat vocals for Blood Elf and Draenei races:

Player vocal types:
- Attack grunts: Multiple variations per race/gender
- Wound sounds: Pain reactions when hit
- Wound crits: Special sounds for critical hits taken
- Death cries: Final sounds when player dies

Race coverage (60+ voice lines):
- Blood Elf Male: 9 attacks, 8 wounds, 3 crit wounds, 2 deaths
- Blood Elf Female: 5 attacks, 7 wounds, 1 death
- Draenei Male: 7 attacks, 8 wounds, 3 crit wounds, 2 deaths
- Draenei Female: 7 attacks, 4 wounds, 3 crit wounds, 1 death

Technical details:
- Loads 60+ vocal sound files from Sound\Character\*PC folders
- Simple API: playPlayerAttackGrunt(race), playPlayerWound(race, crit), playPlayerDeath(race)
- Random variation selection for immersion
- Volume at 0.9-1.1 depending on sound type
- Crit wounds play 1.1x louder for emphasis
- Extensible design ready for other races
- Only BC races have dedicated PC vocal folders in WotLK 3.3.5a

Usage examples:
```cpp
combatSoundManager->playPlayerAttackGrunt(PlayerRace::BLOOD_ELF_MALE);
combatSoundManager->playPlayerWound(PlayerRace::DRAENEI_FEMALE, true);  // Crit
combatSoundManager->playPlayerDeath(PlayerRace::BLOOD_ELF_FEMALE);
```

This adds essential combat immersion with player character reactions!
2026-02-09 16:42:15 -08:00

129 lines
4.1 KiB
C++

#pragma once
#include <vector>
#include <memory>
#include <string>
#include <cstdint>
namespace wowee {
namespace pipeline {
class AssetManager;
}
namespace audio {
class CombatSoundManager {
public:
CombatSoundManager() = default;
~CombatSoundManager() = default;
// Initialization
bool initialize(pipeline::AssetManager* assets);
void shutdown();
// Volume control
void setVolumeScale(float scale);
// Weapon swing sounds (whoosh sounds before impact)
enum class WeaponSize {
SMALL, // 1H weapons (daggers, swords, maces)
MEDIUM, // 2H weapons (2H swords, axes)
LARGE // 2H heavy weapons (polearms, staves)
};
void playWeaponSwing(WeaponSize size, bool isCrit = false);
void playWeaponMiss(bool twoHanded = false);
// Impact sounds (when weapon hits target)
enum class ImpactType {
FLESH, // Hit unarmored/cloth
CHAIN, // Hit chain armor
PLATE, // Hit plate armor
SHIELD, // Hit shield
METAL_WEAPON, // Parry/weapon clash
WOOD, // Hit wooden objects
STONE // Hit stone/rock
};
void playImpact(WeaponSize weaponSize, ImpactType impactType, bool isCrit = false);
// Emote sounds
void playClap();
// Player character vocals
enum class PlayerRace {
BLOOD_ELF_MALE,
BLOOD_ELF_FEMALE,
DRAENEI_MALE,
DRAENEI_FEMALE
};
void playPlayerAttackGrunt(PlayerRace race);
void playPlayerWound(PlayerRace race, bool isCrit = false);
void playPlayerDeath(PlayerRace race);
private:
struct CombatSample {
std::string path;
std::vector<uint8_t> data;
bool loaded;
};
// Weapon swing sound libraries
std::vector<CombatSample> swingSmallSounds_;
std::vector<CombatSample> swingMediumSounds_;
std::vector<CombatSample> swingLargeSounds_;
std::vector<CombatSample> swingSmallCritSounds_;
std::vector<CombatSample> swingMediumCritSounds_;
std::vector<CombatSample> swingLargeCritSounds_;
std::vector<CombatSample> missWhoosh1HSounds_;
std::vector<CombatSample> missWhoosh2HSounds_;
// Impact sound libraries (using 1H axe as base - similar across weapon types)
std::vector<CombatSample> hitFleshSounds_;
std::vector<CombatSample> hitChainSounds_;
std::vector<CombatSample> hitPlateSounds_;
std::vector<CombatSample> hitShieldSounds_;
std::vector<CombatSample> hitMetalWeaponSounds_;
std::vector<CombatSample> hitWoodSounds_;
std::vector<CombatSample> hitStoneSounds_;
std::vector<CombatSample> hitFleshCritSounds_;
std::vector<CombatSample> hitChainCritSounds_;
std::vector<CombatSample> hitPlateCritSounds_;
std::vector<CombatSample> hitShieldCritSounds_;
// Emote sounds
std::vector<CombatSample> clapSounds_;
// Player character vocal libraries
std::vector<CombatSample> bloodElfMaleAttackSounds_;
std::vector<CombatSample> bloodElfMaleWoundSounds_;
std::vector<CombatSample> bloodElfMaleWoundCritSounds_;
std::vector<CombatSample> bloodElfMaleDeathSounds_;
std::vector<CombatSample> bloodElfFemaleAttackSounds_;
std::vector<CombatSample> bloodElfFemaleWoundSounds_;
std::vector<CombatSample> bloodElfFemaleDeathSounds_;
std::vector<CombatSample> draeneiMaleAttackSounds_;
std::vector<CombatSample> draeneiMaleWoundSounds_;
std::vector<CombatSample> draeneiMaleWoundCritSounds_;
std::vector<CombatSample> draeneiMaleDeathSounds_;
std::vector<CombatSample> draeneiFemaleAttackSounds_;
std::vector<CombatSample> draeneiFemaleWoundSounds_;
std::vector<CombatSample> draeneiFemaleWoundCritSounds_;
std::vector<CombatSample> draeneiFemaleDeathSounds_;
// State tracking
float volumeScale_ = 1.0f;
bool initialized_ = false;
// Helper methods
bool loadSound(const std::string& path, CombatSample& sample, pipeline::AssetManager* assets);
void playSound(const std::vector<CombatSample>& library, float volumeMultiplier = 1.0f);
void playRandomSound(const std::vector<CombatSample>& library, float volumeMultiplier = 1.0f);
};
} // namespace audio
} // namespace wowee