mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add MountSoundManager skeleton for mount audio
Implement framework for playing mount sounds (flapping, galloping) based on mount type and movement state. Actual sound playback to be implemented next.
This commit is contained in:
parent
83b364a417
commit
f9ba6aa1b0
5 changed files with 198 additions and 1 deletions
|
|
@ -103,6 +103,7 @@ set(WOWEE_SOURCES
|
|||
src/audio/music_manager.cpp
|
||||
src/audio/footstep_manager.cpp
|
||||
src/audio/activity_sound_manager.cpp
|
||||
src/audio/mount_sound_manager.cpp
|
||||
|
||||
# Pipeline (asset loaders)
|
||||
src/pipeline/mpq_manager.cpp
|
||||
|
|
@ -199,6 +200,7 @@ set(WOWEE_HEADERS
|
|||
include/audio/music_manager.hpp
|
||||
include/audio/footstep_manager.hpp
|
||||
include/audio/activity_sound_manager.hpp
|
||||
include/audio/mount_sound_manager.hpp
|
||||
|
||||
include/pipeline/mpq_manager.hpp
|
||||
include/pipeline/blp_loader.hpp
|
||||
|
|
|
|||
58
include/audio/mount_sound_manager.hpp
Normal file
58
include/audio/mount_sound_manager.hpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline { class AssetManager; }
|
||||
|
||||
namespace audio {
|
||||
|
||||
enum class MountType {
|
||||
NONE,
|
||||
GROUND, // Horse, wolf, raptor, etc.
|
||||
FLYING, // Griffin, wyvern, drake, etc.
|
||||
SWIMMING // Sea turtle, etc.
|
||||
};
|
||||
|
||||
class MountSoundManager {
|
||||
public:
|
||||
MountSoundManager();
|
||||
~MountSoundManager();
|
||||
|
||||
bool initialize(pipeline::AssetManager* assets);
|
||||
void shutdown();
|
||||
void update(float deltaTime);
|
||||
|
||||
// Called when mounting/dismounting
|
||||
void onMount(uint32_t creatureDisplayId, bool isFlying);
|
||||
void onDismount();
|
||||
|
||||
// Update movement state
|
||||
void setMoving(bool moving);
|
||||
void setFlying(bool flying);
|
||||
void setGrounded(bool grounded);
|
||||
|
||||
bool isMounted() const { return mounted_; }
|
||||
void setVolumeScale(float scale) { volumeScale_ = scale; }
|
||||
|
||||
private:
|
||||
MountType detectMountType(uint32_t creatureDisplayId) const;
|
||||
void updateMountSounds();
|
||||
void stopAllMountSounds();
|
||||
|
||||
pipeline::AssetManager* assetManager_ = nullptr;
|
||||
bool mounted_ = false;
|
||||
bool moving_ = false;
|
||||
bool flying_ = false;
|
||||
MountType currentMountType_ = MountType::NONE;
|
||||
uint32_t currentDisplayId_ = 0;
|
||||
float volumeScale_ = 1.0f;
|
||||
|
||||
// Sound state tracking
|
||||
bool playingMovementSound_ = false;
|
||||
bool playingIdleSound_ = false;
|
||||
};
|
||||
|
||||
} // namespace audio
|
||||
} // namespace wowee
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
namespace wowee {
|
||||
namespace core { class Window; }
|
||||
namespace game { class World; class ZoneManager; }
|
||||
namespace audio { class MusicManager; class FootstepManager; class ActivitySoundManager; enum class FootstepSurface : uint8_t; }
|
||||
namespace audio { class MusicManager; class FootstepManager; class ActivitySoundManager; class MountSoundManager; enum class FootstepSurface : uint8_t; }
|
||||
namespace pipeline { class AssetManager; }
|
||||
|
||||
namespace rendering {
|
||||
|
|
@ -147,6 +147,7 @@ public:
|
|||
audio::MusicManager* getMusicManager() { return musicManager.get(); }
|
||||
audio::FootstepManager* getFootstepManager() { return footstepManager.get(); }
|
||||
audio::ActivitySoundManager* getActivitySoundManager() { return activitySoundManager.get(); }
|
||||
audio::MountSoundManager* getMountSoundManager() { return mountSoundManager.get(); }
|
||||
|
||||
private:
|
||||
core::Window* window = nullptr;
|
||||
|
|
@ -171,6 +172,7 @@ private:
|
|||
std::unique_ptr<audio::MusicManager> musicManager;
|
||||
std::unique_ptr<audio::FootstepManager> footstepManager;
|
||||
std::unique_ptr<audio::ActivitySoundManager> activitySoundManager;
|
||||
std::unique_ptr<audio::MountSoundManager> mountSoundManager;
|
||||
std::unique_ptr<game::ZoneManager> zoneManager;
|
||||
std::unique_ptr<Shader> underwaterOverlayShader;
|
||||
uint32_t underwaterOverlayVAO = 0;
|
||||
|
|
|
|||
133
src/audio/mount_sound_manager.cpp
Normal file
133
src/audio/mount_sound_manager.cpp
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
#include "audio/mount_sound_manager.hpp"
|
||||
#include "audio/audio_engine.hpp"
|
||||
#include "pipeline/asset_manager.hpp"
|
||||
#include "core/logger.hpp"
|
||||
|
||||
namespace wowee {
|
||||
namespace audio {
|
||||
|
||||
MountSoundManager::MountSoundManager() = default;
|
||||
|
||||
MountSoundManager::~MountSoundManager() {
|
||||
shutdown();
|
||||
}
|
||||
|
||||
bool MountSoundManager::initialize(pipeline::AssetManager* assets) {
|
||||
assetManager_ = assets;
|
||||
LOG_INFO("Mount sound manager initialized");
|
||||
return true;
|
||||
}
|
||||
|
||||
void MountSoundManager::shutdown() {
|
||||
stopAllMountSounds();
|
||||
mounted_ = false;
|
||||
assetManager_ = nullptr;
|
||||
}
|
||||
|
||||
void MountSoundManager::update(float deltaTime) {
|
||||
(void)deltaTime;
|
||||
|
||||
if (!mounted_) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateMountSounds();
|
||||
}
|
||||
|
||||
void MountSoundManager::onMount(uint32_t creatureDisplayId, bool isFlying) {
|
||||
mounted_ = true;
|
||||
currentDisplayId_ = creatureDisplayId;
|
||||
currentMountType_ = detectMountType(creatureDisplayId);
|
||||
flying_ = isFlying;
|
||||
moving_ = false;
|
||||
|
||||
LOG_INFO("Mount sound: mounted on display ID ", creatureDisplayId,
|
||||
" type=", static_cast<int>(currentMountType_),
|
||||
" flying=", flying_);
|
||||
|
||||
updateMountSounds();
|
||||
}
|
||||
|
||||
void MountSoundManager::onDismount() {
|
||||
stopAllMountSounds();
|
||||
mounted_ = false;
|
||||
currentMountType_ = MountType::NONE;
|
||||
currentDisplayId_ = 0;
|
||||
flying_ = false;
|
||||
moving_ = false;
|
||||
}
|
||||
|
||||
void MountSoundManager::setMoving(bool moving) {
|
||||
if (moving_ != moving) {
|
||||
moving_ = moving;
|
||||
if (mounted_) {
|
||||
updateMountSounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MountSoundManager::setFlying(bool flying) {
|
||||
if (flying_ != flying) {
|
||||
flying_ = flying;
|
||||
if (mounted_) {
|
||||
updateMountSounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MountSoundManager::setGrounded(bool grounded) {
|
||||
setFlying(!grounded);
|
||||
}
|
||||
|
||||
MountType MountSoundManager::detectMountType(uint32_t creatureDisplayId) const {
|
||||
// TODO: Load from CreatureDisplayInfo.dbc or CreatureModelData.dbc
|
||||
// For now, use simple heuristics based on common display IDs
|
||||
// This is a placeholder - we'd need proper DBC parsing for accuracy
|
||||
|
||||
// Common flying mount display IDs (approximate ranges)
|
||||
// Gryphons: ~2300-2310
|
||||
// Wyverns: ~1566-1570
|
||||
// Drakes: ~25830-25870
|
||||
// Phoenixes: ~17890-17900
|
||||
|
||||
if (creatureDisplayId >= 2300 && creatureDisplayId <= 2320) return MountType::FLYING; // Gryphons
|
||||
if (creatureDisplayId >= 1560 && creatureDisplayId <= 1580) return MountType::FLYING; // Wyverns
|
||||
if (creatureDisplayId >= 25800 && creatureDisplayId <= 25900) return MountType::FLYING; // Drakes
|
||||
if (creatureDisplayId >= 17880 && creatureDisplayId <= 17910) return MountType::FLYING; // Phoenixes
|
||||
|
||||
// Most other mounts are ground
|
||||
return MountType::GROUND;
|
||||
}
|
||||
|
||||
void MountSoundManager::updateMountSounds() {
|
||||
if (!AudioEngine::instance().isInitialized() || !mounted_) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Implement actual mount sound playback
|
||||
// For now, just log state changes
|
||||
static bool lastMoving = false;
|
||||
static bool lastFlying = false;
|
||||
|
||||
if (moving_ != lastMoving || flying_ != lastFlying) {
|
||||
LOG_INFO("Mount sound state: moving=", moving_, " flying=", flying_,
|
||||
" type=", static_cast<int>(currentMountType_));
|
||||
lastMoving = moving_;
|
||||
lastFlying = flying_;
|
||||
}
|
||||
|
||||
// TODO: Load and play appropriate looping sounds:
|
||||
// - Flying + moving: wing flaps (fast loop)
|
||||
// - Flying + idle: wing flaps (slow loop) or hovering sound
|
||||
// - Ground + moving: galloping/hoofbeats (pace based on speed)
|
||||
// - Ground + idle: breathing, fidgeting sounds (occasional)
|
||||
}
|
||||
|
||||
void MountSoundManager::stopAllMountSounds() {
|
||||
// TODO: Stop any active looping mount sounds
|
||||
playingMovementSound_ = false;
|
||||
playingIdleSound_ = false;
|
||||
}
|
||||
|
||||
} // namespace audio
|
||||
} // namespace wowee
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
#include "audio/music_manager.hpp"
|
||||
#include "audio/footstep_manager.hpp"
|
||||
#include "audio/activity_sound_manager.hpp"
|
||||
#include "audio/mount_sound_manager.hpp"
|
||||
#include <GL/glew.h>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtx/euler_angles.hpp>
|
||||
|
|
@ -332,6 +333,7 @@ bool Renderer::initialize(core::Window* win) {
|
|||
musicManager = std::make_unique<audio::MusicManager>();
|
||||
footstepManager = std::make_unique<audio::FootstepManager>();
|
||||
activitySoundManager = std::make_unique<audio::ActivitySoundManager>();
|
||||
mountSoundManager = std::make_unique<audio::MountSoundManager>();
|
||||
|
||||
// Underwater full-screen tint overlay (applies to all world geometry).
|
||||
underwaterOverlayShader = std::make_unique<Shader>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue