diff options
Diffstat (limited to '')
| -rw-r--r-- | src/menu.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/menu.cpp b/src/menu.cpp index 9dffc9e..56fe6fa 100644 --- a/src/menu.cpp +++ b/src/menu.cpp | |||
| @@ -625,9 +625,15 @@ int silentaim_fov() { return g_silent_fov; } | |||
| 625 | 625 | ||
| 626 | bool aimbot_fov_circle() { return g_aim_fov_circle; } | 626 | bool aimbot_fov_circle() { return g_aim_fov_circle; } |
| 627 | 627 | ||
| 628 | void menu_force_close() { | ||
| 629 | g_menu_open = false; | ||
| 630 | g_bind_mode = false; | ||
| 631 | g_insert_latch = false; | ||
| 632 | g_menu_draw_logged = false; | ||
| 633 | } | ||
| 634 | |||
| 628 | static void menu_handle_input() { | 635 | static void menu_handle_input() { |
| 629 | poll_keyboard(); | 636 | poll_keyboard(); |
| 630 | |||
| 631 | // SDL state can be sampled several times per rendered frame (both ISurface | 637 | // SDL state can be sampled several times per rendered frame (both ISurface |
| 632 | // hooks call outer_draw). Use a physical-key latch instead of the one-poll | 638 | // hooks call outer_draw). Use a physical-key latch instead of the one-poll |
| 633 | // edge so one press cannot open and close the menu in the same frame. | 639 | // edge so one press cannot open and close the menu in the same frame. |
| @@ -838,11 +844,13 @@ void draw_text_col(int x, int y, const char *text, int r, int g, int b) { | |||
| 838 | // (see hkdDrawPrintText hook in hl2h.cpp): we wrap our draws in | 844 | // (see hkdDrawPrintText hook in hl2h.cpp): we wrap our draws in |
| 839 | // PushMakeCurrent/PopMakeCurrent so they are submitted with a clean clip. | 845 | // PushMakeCurrent/PopMakeCurrent so they are submitted with a clean clip. |
| 840 | void outer_draw() { | 846 | void outer_draw() { |
| 841 | menu_handle_input(); | 847 | gui_handle_input(); |
| 848 | if (!gui_is_open()) | ||
| 849 | menu_handle_input(); | ||
| 842 | // HL2H_DRAW_TEST=1 draws a probe rect without needing the menu open | 850 | // HL2H_DRAW_TEST=1 draws a probe rect without needing the menu open |
| 843 | static bool draw_test = getenv("HL2H_DRAW_TEST") != nullptr; | 851 | static bool draw_test = getenv("HL2H_DRAW_TEST") != nullptr; |
| 844 | bool esp_on = feature_active(FEAT_ESP); | 852 | bool esp_on = feature_active(FEAT_ESP); |
| 845 | if (!g_surface || (!g_menu_open && !draw_test && !esp_on)) | 853 | if (!g_surface || (!g_menu_open && !gui_is_open() && !draw_test && !esp_on)) |
| 846 | return; | 854 | return; |
| 847 | 855 | ||
| 848 | // Level/menu -> game transitions can invalidate the VGUI font handle. | 856 | // Level/menu -> game transitions can invalidate the VGUI font handle. |
| @@ -896,6 +904,11 @@ void outer_draw() { | |||
| 896 | surf_draw_set_color(255, 255, 255, 255); | 904 | surf_draw_set_color(255, 255, 255, 255); |
| 897 | draw_text(28, 36, "HL2H DRAW TEST"); | 905 | draw_text(28, 36, "HL2H DRAW TEST"); |
| 898 | } | 906 | } |
| 907 | if (gui_is_open()) { | ||
| 908 | gui_draw(); | ||
| 909 | surf_pop_make_current(panel); | ||
| 910 | return; | ||
| 911 | } | ||
| 899 | if (!g_menu_open) { | 912 | if (!g_menu_open) { |
| 900 | surf_pop_make_current(panel); | 913 | surf_pop_make_current(panel); |
| 901 | return; | 914 | return; |
