mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Implemented complete combat audio system with 40+ combat sounds: Weapon swing sounds (whooshes): - Small weapons (1H): 3 variations + crit - Medium weapons (2H): 3 variations + crit - Large weapons (heavy 2H): 3 variations + crit - Miss whooshes: separate 1H/2H sounds Impact sounds by armor type: - Flesh (unarmored/cloth): 3 variations + crit - Chain armor: 3 variations + crit - Plate armor: 3 variations + crit - Shield blocks: 3 variations + crit - Metal weapon parries: 1 sound - Wood impacts: 3 variations - Stone impacts: 3 variations Emote sounds: - Clap: 7 variations Technical details: - Loads 40+ sound files from Sound\Item\Weapons and Sound\Character - Simple API: playWeaponSwing(size, isCrit), playImpact(size, type, isCrit) - Random variation selection for non-crit sounds - Volume at 0.8 with global scale control - Crit sounds play 1.2x louder for emphasis - Uses 1H axe impact sounds as base (similar across weapon types) - Ready for integration with combat system Usage examples: ```cpp combatSoundManager->playWeaponSwing(WeaponSize::SMALL, false); combatSoundManager->playImpact(WeaponSize::MEDIUM, ImpactType::PLATE, true); combatSoundManager->playWeaponMiss(true); // 2H miss combatSoundManager->playClap(); ``` This adds essential combat audio feedback for melee combat!
97 lines
2.9 KiB
C++
97 lines
2.9 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();
|
|
|
|
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_;
|
|
|
|
// 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
|