Fix UI window hotkey toggles and silent mount sound fallback

This commit is contained in:
Kelsi 2026-02-14 21:56:38 -08:00
parent 1a9bdfb64b
commit 09de52f310
6 changed files with 14 additions and 20 deletions

View file

@ -100,7 +100,7 @@ private:
}; };
std::unordered_map<MountFamily, FamilySounds, MountFamilyHash> familySounds_; std::unordered_map<MountFamily, FamilySounds, MountFamilyHash> familySounds_;
// Helper to get sounds for current family (falls back to HORSE) // Helper to get sounds for current family (unknown/unloaded -> silent)
const FamilySounds& getCurrentFamilySounds() const; const FamilySounds& getCurrentFamilySounds() const;
// Sound state tracking // Sound state tracking

View file

@ -320,12 +320,6 @@ const MountSoundManager::FamilySounds& MountSoundManager::getCurrentFamilySounds
return it->second; return it->second;
} }
// Fall back to horse for unknown families
it = familySounds_.find(MountFamily::HORSE);
if (it != familySounds_.end()) {
return it->second;
}
return empty; return empty;
} }
@ -537,7 +531,7 @@ MountFamily MountSoundManager::detectMountFamilyFromPath(const std::string& mode
lower.find("wyvern") != std::string::npos) lower.find("wyvern") != std::string::npos)
return MountFamily::DRAGON; return MountFamily::DRAGON;
return MountFamily::HORSE; // Default fallback return MountFamily::UNKNOWN; // Unknown family: stay silent
} }
MountFamily MountSoundManager::detectMountFamily(uint32_t creatureDisplayId) const { MountFamily MountSoundManager::detectMountFamily(uint32_t creatureDisplayId) const {
@ -605,8 +599,8 @@ MountFamily MountSoundManager::detectMountFamily(uint32_t creatureDisplayId) con
if (creatureDisplayId >= 25800 && creatureDisplayId <= 25900) if (creatureDisplayId >= 25800 && creatureDisplayId <= 25900)
return MountFamily::DRAGON; return MountFamily::DRAGON;
// Default to HORSE for unknown ground mounts (safe fallback) // Unknown family: stay silent (avoid incorrect horse sounds on custom mounts)
return MountFamily::HORSE; return MountFamily::UNKNOWN;
} }
void MountSoundManager::updateMountSounds() { void MountSoundManager::updateMountSounds() {

View file

@ -552,13 +552,13 @@ void InventoryScreen::closeAllBags() {
void InventoryScreen::render(game::Inventory& inventory, uint64_t moneyCopper) { void InventoryScreen::render(game::Inventory& inventory, uint64_t moneyCopper) {
// B key toggle (edge-triggered) // B key toggle (edge-triggered)
bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard; bool wantsTextInput = ImGui::GetIO().WantTextInput;
bool bDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_B); bool bDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_B);
bool bToggled = bDown && !bKeyWasDown; bool bToggled = bDown && !bKeyWasDown;
bKeyWasDown = bDown; bKeyWasDown = bDown;
// C key toggle for character screen (edge-triggered) // C key toggle for character screen (edge-triggered)
bool cDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_C); bool cDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_C);
if (cDown && !cKeyWasDown) { if (cDown && !cKeyWasDown) {
characterOpen = !characterOpen; characterOpen = !characterOpen;
} }
@ -582,7 +582,7 @@ void InventoryScreen::render(game::Inventory& inventory, uint64_t moneyCopper) {
} }
// Escape cancels held item // Escape cancels held item
if (holdingItem && !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_ESCAPE)) { if (holdingItem && !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_ESCAPE)) {
cancelPickup(inventory); cancelPickup(inventory);
} }

View file

@ -99,8 +99,8 @@ std::string replaceGenderPlaceholders(const std::string& text, game::GameHandler
void QuestLogScreen::render(game::GameHandler& gameHandler) { void QuestLogScreen::render(game::GameHandler& gameHandler) {
// L key toggle (edge-triggered) // L key toggle (edge-triggered)
bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard; bool wantsTextInput = ImGui::GetIO().WantTextInput;
bool lDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_L); bool lDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_L);
if (lDown && !lKeyWasDown) { if (lDown && !lKeyWasDown) {
open = !open; open = !open;
} }

View file

@ -221,8 +221,8 @@ const SpellInfo* SpellbookScreen::getSpellInfo(uint32_t spellId) const {
void SpellbookScreen::render(game::GameHandler& gameHandler, pipeline::AssetManager* assetManager) { void SpellbookScreen::render(game::GameHandler& gameHandler, pipeline::AssetManager* assetManager) {
// P key toggle (edge-triggered) // P key toggle (edge-triggered)
bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard; bool wantsTextInput = ImGui::GetIO().WantTextInput;
bool pDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_P); bool pDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_P);
if (pDown && !pKeyWasDown) { if (pDown && !pKeyWasDown) {
open = !open; open = !open;
} }

View file

@ -12,8 +12,8 @@ namespace wowee { namespace ui {
void TalentScreen::render(game::GameHandler& gameHandler) { void TalentScreen::render(game::GameHandler& gameHandler) {
// N key toggle (edge-triggered) // N key toggle (edge-triggered)
bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard; bool wantsTextInput = ImGui::GetIO().WantTextInput;
bool nDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_N); bool nDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_N);
if (nDown && !nKeyWasDown) { if (nDown && !nKeyWasDown) {
open = !open; open = !open;
} }