diff --git a/src/rendering/world_map.cpp b/src/rendering/world_map.cpp index 138d39db..7ee4f43a 100644 --- a/src/rendering/world_map.cpp +++ b/src/rendering/world_map.cpp @@ -842,45 +842,47 @@ void WorldMap::render(const glm::vec3& playerRenderPos, int screenWidth, int scr if (!zones.empty()) updateExploration(playerRenderPos); - if (open) { - if (input.isKeyJustPressed(SDL_SCANCODE_M) || - input.isKeyJustPressed(SDL_SCANCODE_ESCAPE)) { - open = false; - return; + // game_screen owns the open/close toggle (via showWorldMap_ + TOGGLE_WORLD_MAP keybinding). + // render() is only called when showWorldMap_ is true, so treat each call as "should be open". + if (!open) { + // First time shown: load zones and navigate to player's location. + open = true; + if (zones.empty()) loadZonesFromDBC(); + + int bestContinent = findBestContinentForPlayer(playerRenderPos); + if (bestContinent >= 0 && bestContinent != continentIdx) { + continentIdx = bestContinent; + compositedIdx = -1; } + int playerZone = findZoneForPlayer(playerRenderPos); + if (playerZone >= 0 && continentIdx >= 0 && + zoneBelongsToContinent(playerZone, continentIdx)) { + loadZoneTextures(playerZone); + requestComposite(playerZone); + currentIdx = playerZone; + viewLevel = ViewLevel::ZONE; + } else if (continentIdx >= 0) { + loadZoneTextures(continentIdx); + requestComposite(continentIdx); + currentIdx = continentIdx; + viewLevel = ViewLevel::CONTINENT; + } + } + + // ESC closes the map; game_screen will sync showWorldMap_ via wm->isOpen() next frame. + if (input.isKeyJustPressed(SDL_SCANCODE_ESCAPE)) { + open = false; + return; + } + + { auto& io = ImGui::GetIO(); float wheelDelta = io.MouseWheel; if (std::abs(wheelDelta) < 0.001f) wheelDelta = input.getMouseWheelDelta(); if (wheelDelta > 0.0f) zoomIn(playerRenderPos); else if (wheelDelta < 0.0f) zoomOut(); - } else { - auto& io = ImGui::GetIO(); - if (!io.WantCaptureKeyboard && input.isKeyJustPressed(SDL_SCANCODE_M)) { - open = true; - if (zones.empty()) loadZonesFromDBC(); - - int bestContinent = findBestContinentForPlayer(playerRenderPos); - if (bestContinent >= 0 && bestContinent != continentIdx) { - continentIdx = bestContinent; - compositedIdx = -1; - } - - int playerZone = findZoneForPlayer(playerRenderPos); - if (playerZone >= 0 && continentIdx >= 0 && - zoneBelongsToContinent(playerZone, continentIdx)) { - loadZoneTextures(playerZone); - requestComposite(playerZone); - currentIdx = playerZone; - viewLevel = ViewLevel::ZONE; - } else if (continentIdx >= 0) { - loadZoneTextures(continentIdx); - requestComposite(continentIdx); - currentIdx = continentIdx; - viewLevel = ViewLevel::CONTINENT; - } - } } if (!open) return; diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 3a0194bc..4da386cb 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -2341,10 +2341,6 @@ void GameScreen::processTargetInput(game::GameHandler& gameHandler) { showTitlesWindow_ = !showTitlesWindow_; } - // Toggle Equipment Set Manager with ` (backtick / grave — unused in standard WoW) - if (input.isKeyJustPressed(SDL_SCANCODE_GRAVE) && !ImGui::GetIO().WantCaptureKeyboard) { - showEquipSetWindow_ = !showEquipSetWindow_; - } // Action bar keys (1-9, 0, -, =) static const SDL_Scancode actionBarKeys[] = { @@ -6387,6 +6383,9 @@ void GameScreen::renderWorldMap(game::GameHandler& gameHandler) { int screenW = window ? window->getWidth() : 1280; int screenH = window ? window->getHeight() : 720; wm->render(playerPos, screenW, screenH); + + // Sync showWorldMap_ if the map closed itself (e.g. ESC key inside the overlay). + if (!wm->isOpen()) showWorldMap_ = false; } // ============================================================ diff --git a/src/ui/keybinding_manager.cpp b/src/ui/keybinding_manager.cpp index 5ac79927..fbe70e33 100644 --- a/src/ui/keybinding_manager.cpp +++ b/src/ui/keybinding_manager.cpp @@ -22,15 +22,15 @@ void KeybindingManager::initializeDefaults() { bindings_[static_cast(Action::TOGGLE_SPELLBOOK)] = ImGuiKey_P; // WoW standard key bindings_[static_cast(Action::TOGGLE_TALENTS)] = ImGuiKey_N; // WoW standard key bindings_[static_cast(Action::TOGGLE_QUESTS)] = ImGuiKey_L; - bindings_[static_cast(Action::TOGGLE_MINIMAP)] = ImGuiKey_M; + bindings_[static_cast(Action::TOGGLE_MINIMAP)] = ImGuiKey_None; // minimap is always visible; no default toggle bindings_[static_cast(Action::TOGGLE_SETTINGS)] = ImGuiKey_Escape; bindings_[static_cast(Action::TOGGLE_CHAT)] = ImGuiKey_Enter; bindings_[static_cast(Action::TOGGLE_GUILD_ROSTER)] = ImGuiKey_O; bindings_[static_cast(Action::TOGGLE_DUNGEON_FINDER)] = ImGuiKey_J; // Originally I, reassigned to avoid conflict - bindings_[static_cast(Action::TOGGLE_WORLD_MAP)] = ImGuiKey_W; + bindings_[static_cast(Action::TOGGLE_WORLD_MAP)] = ImGuiKey_M; // WoW standard: M opens world map bindings_[static_cast(Action::TOGGLE_NAMEPLATES)] = ImGuiKey_V; bindings_[static_cast(Action::TOGGLE_RAID_FRAMES)] = ImGuiKey_F; // Reassigned from R (now camera reset) - bindings_[static_cast(Action::TOGGLE_QUEST_LOG)] = ImGuiKey_Q; + bindings_[static_cast(Action::TOGGLE_QUEST_LOG)] = ImGuiKey_None; // Q conflicts with strafe-left; quest log accessible via TOGGLE_QUESTS (L) bindings_[static_cast(Action::TOGGLE_ACHIEVEMENTS)] = ImGuiKey_Y; // WoW standard key (Shift+Y in retail) }