From 304441c71997ee61e618146f4d4302c6d2b952ad Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 18:21:13 +0100 Subject: GUI: Insert-only close, freeze mouse look at the source Feedback pass: - Insert now toggles the GUI; the old text tree moved to F1. - Remove the title-bar X. Insert is the only close path; Esc only cancels bind capture. - Discard accumulated mouse deltas in CInput::CreateMove before the game can apply them (CInput::ClearStates), so the camera no longer moves for a frame and snaps back. Also skip ExtraMouseSample and zero relative mouse state while the GUI is open. - Strip attack/use/impulse/weapon selection from the command while open; keep jump, duck and walk. Skip combat command edits (spread seed) too. - Widen System page buttons so "Reload config" and "Reset defaults" fit. - Update CONTEXT/ADR for the Insert-only close behavior. --- src/menu.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/menu.cpp') diff --git a/src/menu.cpp b/src/menu.cpp index 56fe6fa..a0cf323 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -467,7 +467,8 @@ static void config_load() { // --------------------------------------------------------------------------- // SDL scancodes for navigation keys (matches the game's scancode set) -static constexpr int SCAN_INSERT = 73; +static constexpr int SCAN_INSERT = 73; // reserved for the GUI +static constexpr int SCAN_TEXT_MENU = 58; // F1 preview key for the old tree static constexpr int SCAN_UP = 82; // these are SDL scancodes static constexpr int SCAN_DOWN = 81; static constexpr int SCAN_LEFT = 80; @@ -637,7 +638,7 @@ static void menu_handle_input() { // SDL state can be sampled several times per rendered frame (both ISurface // hooks call outer_draw). Use a physical-key latch instead of the one-poll // edge so one press cannot open and close the menu in the same frame. - bool insert_down = key_held(SCAN_INSERT); + bool insert_down = key_held(SCAN_TEXT_MENU); bool insert_edge = insert_down && !g_insert_latch; if (insert_down) g_insert_latch = true; @@ -662,8 +663,8 @@ static void menu_handle_input() { for (int i = 0; i < MOUSE_BASE + 5; i++) { if (!g_key_down[i]) continue; - if (i == SCAN_INSERT || i == SCAN_UP || i == SCAN_DOWN || - i == SCAN_LEFT || i == SCAN_RIGHT) { + if (i == SCAN_INSERT || i == SCAN_TEXT_MENU || i == SCAN_UP || + i == SCAN_DOWN || i == SCAN_LEFT || i == SCAN_RIGHT) { g_bind_mode = false; return; // cancel bind select } -- cgit v1.2.3