fix: resolve keybinding conflicts for Q, M, and grave keys

- TOGGLE_QUEST_LOG: change default from Q to None — Q conflicts with
  strafe-left in camera_controller; quest log already accessible via
  TOGGLE_QUESTS (L, the standard WoW binding)
- Equipment Set Manager: remove hardcoded SDL_SCANCODE_GRAVE shortcut
  (~` should not be used for this)
- World map M key: remove duplicate SDL_SCANCODE_M self-handler from
  world_map.cpp::render() that was desync-ing with game_screen's
  TOGGLE_WORLD_MAP binding; game_screen now owns open/close, render()
  handles initial zone load and ESC-close signalling via isOpen()
This commit is contained in:
Kelsi 2026-03-13 01:27:30 -07:00
parent 1108aa9ae6
commit 13c096f3e9
3 changed files with 39 additions and 38 deletions

View file

@ -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;

View file

@ -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;
}
// ============================================================

View file

@ -22,15 +22,15 @@ void KeybindingManager::initializeDefaults() {
bindings_[static_cast<int>(Action::TOGGLE_SPELLBOOK)] = ImGuiKey_P; // WoW standard key
bindings_[static_cast<int>(Action::TOGGLE_TALENTS)] = ImGuiKey_N; // WoW standard key
bindings_[static_cast<int>(Action::TOGGLE_QUESTS)] = ImGuiKey_L;
bindings_[static_cast<int>(Action::TOGGLE_MINIMAP)] = ImGuiKey_M;
bindings_[static_cast<int>(Action::TOGGLE_MINIMAP)] = ImGuiKey_None; // minimap is always visible; no default toggle
bindings_[static_cast<int>(Action::TOGGLE_SETTINGS)] = ImGuiKey_Escape;
bindings_[static_cast<int>(Action::TOGGLE_CHAT)] = ImGuiKey_Enter;
bindings_[static_cast<int>(Action::TOGGLE_GUILD_ROSTER)] = ImGuiKey_O;
bindings_[static_cast<int>(Action::TOGGLE_DUNGEON_FINDER)] = ImGuiKey_J; // Originally I, reassigned to avoid conflict
bindings_[static_cast<int>(Action::TOGGLE_WORLD_MAP)] = ImGuiKey_W;
bindings_[static_cast<int>(Action::TOGGLE_WORLD_MAP)] = ImGuiKey_M; // WoW standard: M opens world map
bindings_[static_cast<int>(Action::TOGGLE_NAMEPLATES)] = ImGuiKey_V;
bindings_[static_cast<int>(Action::TOGGLE_RAID_FRAMES)] = ImGuiKey_F; // Reassigned from R (now camera reset)
bindings_[static_cast<int>(Action::TOGGLE_QUEST_LOG)] = ImGuiKey_Q;
bindings_[static_cast<int>(Action::TOGGLE_QUEST_LOG)] = ImGuiKey_None; // Q conflicts with strafe-left; quest log accessible via TOGGLE_QUESTS (L)
bindings_[static_cast<int>(Action::TOGGLE_ACHIEVEMENTS)] = ImGuiKey_Y; // WoW standard key (Shift+Y in retail)
}