From 09de52f310211974a5ef8d1cea74397b36955094 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sat, 14 Feb 2026 21:56:38 -0800 Subject: [PATCH] Fix UI window hotkey toggles and silent mount sound fallback --- include/audio/mount_sound_manager.hpp | 2 +- src/audio/mount_sound_manager.cpp | 12 +++--------- src/ui/inventory_screen.cpp | 8 ++++---- src/ui/quest_log_screen.cpp | 4 ++-- src/ui/spellbook_screen.cpp | 4 ++-- src/ui/talent_screen.cpp | 4 ++-- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/include/audio/mount_sound_manager.hpp b/include/audio/mount_sound_manager.hpp index a02cb868..9a9f33af 100644 --- a/include/audio/mount_sound_manager.hpp +++ b/include/audio/mount_sound_manager.hpp @@ -100,7 +100,7 @@ private: }; std::unordered_map 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; // Sound state tracking diff --git a/src/audio/mount_sound_manager.cpp b/src/audio/mount_sound_manager.cpp index e7e1414a..0762ea26 100644 --- a/src/audio/mount_sound_manager.cpp +++ b/src/audio/mount_sound_manager.cpp @@ -320,12 +320,6 @@ const MountSoundManager::FamilySounds& MountSoundManager::getCurrentFamilySounds return it->second; } - // Fall back to horse for unknown families - it = familySounds_.find(MountFamily::HORSE); - if (it != familySounds_.end()) { - return it->second; - } - return empty; } @@ -537,7 +531,7 @@ MountFamily MountSoundManager::detectMountFamilyFromPath(const std::string& mode lower.find("wyvern") != std::string::npos) return MountFamily::DRAGON; - return MountFamily::HORSE; // Default fallback + return MountFamily::UNKNOWN; // Unknown family: stay silent } MountFamily MountSoundManager::detectMountFamily(uint32_t creatureDisplayId) const { @@ -605,8 +599,8 @@ MountFamily MountSoundManager::detectMountFamily(uint32_t creatureDisplayId) con if (creatureDisplayId >= 25800 && creatureDisplayId <= 25900) return MountFamily::DRAGON; - // Default to HORSE for unknown ground mounts (safe fallback) - return MountFamily::HORSE; + // Unknown family: stay silent (avoid incorrect horse sounds on custom mounts) + return MountFamily::UNKNOWN; } void MountSoundManager::updateMountSounds() { diff --git a/src/ui/inventory_screen.cpp b/src/ui/inventory_screen.cpp index 3fa66600..7dfd4bbe 100644 --- a/src/ui/inventory_screen.cpp +++ b/src/ui/inventory_screen.cpp @@ -552,13 +552,13 @@ void InventoryScreen::closeAllBags() { void InventoryScreen::render(game::Inventory& inventory, uint64_t moneyCopper) { // B key toggle (edge-triggered) - bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard; - bool bDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_B); + bool wantsTextInput = ImGui::GetIO().WantTextInput; + bool bDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_B); bool bToggled = bDown && !bKeyWasDown; bKeyWasDown = bDown; // 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) { characterOpen = !characterOpen; } @@ -582,7 +582,7 @@ void InventoryScreen::render(game::Inventory& inventory, uint64_t moneyCopper) { } // 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); } diff --git a/src/ui/quest_log_screen.cpp b/src/ui/quest_log_screen.cpp index c00bdd12..eead6b7e 100644 --- a/src/ui/quest_log_screen.cpp +++ b/src/ui/quest_log_screen.cpp @@ -99,8 +99,8 @@ std::string replaceGenderPlaceholders(const std::string& text, game::GameHandler void QuestLogScreen::render(game::GameHandler& gameHandler) { // L key toggle (edge-triggered) - bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard; - bool lDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_L); + bool wantsTextInput = ImGui::GetIO().WantTextInput; + bool lDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_L); if (lDown && !lKeyWasDown) { open = !open; } diff --git a/src/ui/spellbook_screen.cpp b/src/ui/spellbook_screen.cpp index 3bb9fd25..cf60bc2e 100644 --- a/src/ui/spellbook_screen.cpp +++ b/src/ui/spellbook_screen.cpp @@ -221,8 +221,8 @@ const SpellInfo* SpellbookScreen::getSpellInfo(uint32_t spellId) const { void SpellbookScreen::render(game::GameHandler& gameHandler, pipeline::AssetManager* assetManager) { // P key toggle (edge-triggered) - bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard; - bool pDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_P); + bool wantsTextInput = ImGui::GetIO().WantTextInput; + bool pDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_P); if (pDown && !pKeyWasDown) { open = !open; } diff --git a/src/ui/talent_screen.cpp b/src/ui/talent_screen.cpp index 9532a388..0275433d 100644 --- a/src/ui/talent_screen.cpp +++ b/src/ui/talent_screen.cpp @@ -12,8 +12,8 @@ namespace wowee { namespace ui { void TalentScreen::render(game::GameHandler& gameHandler) { // N key toggle (edge-triggered) - bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard; - bool nDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_N); + bool wantsTextInput = ImGui::GetIO().WantTextInput; + bool nDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_N); if (nDown && !nKeyWasDown) { open = !open; }