From db9f33e5981eff6c023a7f652c65841de9c226b4 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 20 Jan 2014 14:15:54 +0100 Subject: [PATCH] hud_panel_quickmenu_time 5 "quickmenu expires after this number of seconds in the same page" --- _hud_common.cfg | 1 + qcsrc/client/autocvars.qh | 1 + qcsrc/client/hud.qc | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/_hud_common.cfg b/_hud_common.cfg index 6541f0ea3..6371e7b80 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -39,6 +39,7 @@ seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_ch seta hud_panel_quickmenu_file "" "load the quick menu from this file (empty or 0 to disable)" seta hud_panel_quickmenu_translatecommands 0 "when the game is translated, translate strings inside commands too (useful for chat commands)" +seta hud_panel_quickmenu_time 5 "quickmenu expires after this number of seconds in the same page" // hud panel aliases alias hud_panel_radar_rotate "toggle hud_panel_radar_rotation 0 1 2 3 4" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 0844628ed..4656c7867 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -299,6 +299,7 @@ float autocvar_hud_panel_pressedkeys_aspect; float autocvar_hud_panel_pressedkeys_attack; float autocvar_hud_panel_quickmenu_translatecommands; string autocvar_hud_panel_quickmenu_file; +float autocvar_hud_panel_quickmenu_time; float autocvar_hud_panel_racetimer; float autocvar_hud_panel_radar; float autocvar_hud_panel_radar_foreground_alpha; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 0906b624d..4b07b9935 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -4410,6 +4410,7 @@ float QuickMenu_Buffer_Index; string QuickMenu_CurrentSubMenu; float QuickMenu_CurrentPage_FirstEntry; var float QuickMenu_Entries; +float QuickMenu_TimeOut; void HUD_QuickMenu_load_entry(float i, string s, string s1) { //printf("^xc80 entry %d: %s, %s\n", i, s, s1); @@ -4444,6 +4445,7 @@ float HUD_QuickMenu_Buffer_Init() if(QuickMenu_Buffer < 0) return false; HUD_QuickMenu_Load_DefaultEntries(); + QuickMenu_TimeOut = time + autocvar_hud_panel_quickmenu_time; return true; } @@ -4476,6 +4478,7 @@ float HUD_QuickMenu_Buffer_Init() bufstr_set(QuickMenu_Buffer, QuickMenu_Buffer_Size, argv(1)); // command } ++QuickMenu_Buffer_Size; + QuickMenu_TimeOut = time + autocvar_hud_panel_quickmenu_time; } if (QuickMenu_Buffer_Size <= 0) @@ -4621,6 +4624,7 @@ float HUD_QuickMenu_Page(string target_submenu, float new_page) HUD_QuickMenu_Close(); return 0; } + QuickMenu_TimeOut = time + autocvar_hud_panel_quickmenu_time; return 1; } @@ -4824,6 +4828,12 @@ void HUD_QuickMenu(void) if(mv_active) return; //if(!autocvar_hud_panel_quickmenu) return; if(!hud_panel_quickmenu) return; + + if(time > QuickMenu_TimeOut) + { + HUD_QuickMenu_Close(); + return; + } } else { -- 2.39.2