summaryrefslogtreecommitdiffstats
path: root/src/menu.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-27 18:21:13 +0100
committersalmonik <salmonik@tuta.io>2026-10-27 18:21:13 +0100
commit304441c71997ee61e618146f4d4302c6d2b952ad (patch)
treee7a00d279b257f88e7a590da59023533cae6ae80 /src/menu.cpp
parentGUI: allow movement while open; freeze look and block bind capture (diff)
downloadhl2h-304441c71997ee61e618146f4d4302c6d2b952ad.tar.gz
hl2h-304441c71997ee61e618146f4d4302c6d2b952ad.zip
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.
Diffstat (limited to '')
-rw-r--r--src/menu.cpp9
1 files changed, 5 insertions, 4 deletions
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() {
467// --------------------------------------------------------------------------- 467// ---------------------------------------------------------------------------
468 468
469// SDL scancodes for navigation keys (matches the game's scancode set) 469// SDL scancodes for navigation keys (matches the game's scancode set)
470static constexpr int SCAN_INSERT = 73; 470static constexpr int SCAN_INSERT = 73; // reserved for the GUI
471static constexpr int SCAN_TEXT_MENU = 58; // F1 preview key for the old tree
471static constexpr int SCAN_UP = 82; // these are SDL scancodes 472static constexpr int SCAN_UP = 82; // these are SDL scancodes
472static constexpr int SCAN_DOWN = 81; 473static constexpr int SCAN_DOWN = 81;
473static constexpr int SCAN_LEFT = 80; 474static constexpr int SCAN_LEFT = 80;
@@ -637,7 +638,7 @@ static void menu_handle_input() {
637 // SDL state can be sampled several times per rendered frame (both ISurface 638 // SDL state can be sampled several times per rendered frame (both ISurface
638 // hooks call outer_draw). Use a physical-key latch instead of the one-poll 639 // hooks call outer_draw). Use a physical-key latch instead of the one-poll
639 // edge so one press cannot open and close the menu in the same frame. 640 // edge so one press cannot open and close the menu in the same frame.
640 bool insert_down = key_held(SCAN_INSERT); 641 bool insert_down = key_held(SCAN_TEXT_MENU);
641 bool insert_edge = insert_down && !g_insert_latch; 642 bool insert_edge = insert_down && !g_insert_latch;
642 if (insert_down) 643 if (insert_down)
643 g_insert_latch = true; 644 g_insert_latch = true;
@@ -662,8 +663,8 @@ static void menu_handle_input() {
662 for (int i = 0; i < MOUSE_BASE + 5; i++) { 663 for (int i = 0; i < MOUSE_BASE + 5; i++) {
663 if (!g_key_down[i]) 664 if (!g_key_down[i])
664 continue; 665 continue;
665 if (i == SCAN_INSERT || i == SCAN_UP || i == SCAN_DOWN || 666 if (i == SCAN_INSERT || i == SCAN_TEXT_MENU || i == SCAN_UP ||
666 i == SCAN_LEFT || i == SCAN_RIGHT) { 667 i == SCAN_DOWN || i == SCAN_LEFT || i == SCAN_RIGHT) {
667 g_bind_mode = false; 668 g_bind_mode = false;
668 return; // cancel bind select 669 return; // cancel bind select
669 } 670 }