Fix crash in mount dust: add null check for camera pointer

The mount dust code was calling camera->getForward() without checking if
camera was null first, causing a crash that prevented mounting/dismounting.
Added camera null check to the condition.
This commit is contained in:
Kelsi 2026-02-09 01:26:28 -08:00
parent c95c3db03a
commit 71c4fb3ae6
3 changed files with 287 additions and 1 deletions

View file

@ -0,0 +1,74 @@
#pragma once
#include <string>
#include <vector>
#include <unordered_map>
#include <cstdint>
#include <random>
#include <chrono>
namespace wowee {
namespace pipeline { class AssetManager; }
namespace audio {
struct VoiceSample {
std::string path;
std::vector<uint8_t> data;
};
// NPC voice types (based on creature model/gender)
enum class VoiceType {
HUMAN_MALE,
HUMAN_FEMALE,
DWARF_MALE,
DWARF_FEMALE,
NIGHTELF_MALE,
NIGHTELF_FEMALE,
ORC_MALE,
ORC_FEMALE,
TAUREN_MALE,
TAUREN_FEMALE,
TROLL_MALE,
TROLL_FEMALE,
UNDEAD_MALE,
UNDEAD_FEMALE,
GNOME_MALE,
GNOME_FEMALE,
GENERIC, // Fallback
};
class NpcVoiceManager {
public:
NpcVoiceManager();
~NpcVoiceManager();
bool initialize(pipeline::AssetManager* assets);
void shutdown();
// Play greeting sound for NPC at given position
void playGreeting(uint64_t npcGuid, VoiceType voiceType, const glm::vec3& position);
void setVolumeScale(float scale) { volumeScale_ = scale; }
float getVolumeScale() const { return volumeScale_; }
private:
void loadVoiceSounds();
bool loadSound(const std::string& path, VoiceSample& sample);
VoiceType detectVoiceType(uint32_t creatureEntry) const;
pipeline::AssetManager* assetManager_ = nullptr;
float volumeScale_ = 1.0f;
// Voice samples grouped by type
std::unordered_map<VoiceType, std::vector<VoiceSample>> voiceLibrary_;
// Cooldown tracking (prevent spam clicking same NPC)
std::unordered_map<uint64_t, std::chrono::steady_clock::time_point> lastPlayTime_;
static constexpr float GREETING_COOLDOWN = 2.0f; // seconds
std::mt19937 rng_;
};
} // namespace audio
} // namespace wowee