From 005331447be80e0e6d6dba2f062b833743028ad0 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 25 Apr 2016 20:15:39 +0200 Subject: [PATCH] Force to show the menu 1 second after you get disconnected (without a delay it pops up for an instant on map change) --- defaultXonotic.cfg | 1 + qcsrc/menu/menu.qc | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 2056f1511..6554bb1a7 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -809,6 +809,7 @@ seta menu_tooltips 1 "menu tooltips: 0 disabled, 1 enabled, 2 also shows cvar or set menu_picmip_bypass 0 "bypass texture quality enforcement based on system resources, not recommended and may cause crashes!" set menu_showboxes 0 "show item bounding boxes (debug)" set menu_cvarlist_onlymodified 0 "show only modified cvars in the cvar list" +set menu_force_on_disconnection 1 "force to show the menu this number of seconds after you get disconnected (0 to disable)" r_textbrightness 0.2 r_textcontrast 0.8 diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index bde7fbe28..b2b2d662a 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -669,9 +669,24 @@ void m_tooltip(vector pos) } } +float autocvar_menu_force_on_disconnection; void m_draw(float width, float height) { - if (clientstate() == CS_DISCONNECTED) m_toggle(true); + if (autocvar_menu_force_on_disconnection > 0) + { + static float connected_time; + if (clientstate() == CS_DISCONNECTED) + { + if (connected_time && time - connected_time > autocvar_menu_force_on_disconnection) + { + m_toggle(true); + connected_time = 0; + } + } + else + connected_time = time; + } + m_gamestatus(); execute_next_frame(); -- 2.39.2