shithub: qk1

Download patch

ref: a7651d851e9dd1e52c15da46a55be5d7d2e50178
parent: 8bdd3d9e4aa13a417a04cecf1556371702789168
author: qwx <qwx@sciops.net>
date: Mon Jul 19 03:21:16 EDT 2021

qw: fix console autorepeat when disconnected

when in the console, key_dest is set to key_game when disconnected,
but to key_console when connected, so autorepeat only works ingame.
instead, make key_console the default state and always set key_dest
to that from menu if the client is disconnected.

--- a/qw/keys.c
+++ b/qw/keys.c
@@ -15,7 +15,7 @@
 int		edit_line=0;
 int		history_line=0;
 
-keydest_t	key_dest;
+keydest_t	key_dest = key_console;
 
 int		key_count;			// incremented every key event
 
--- a/qw/menu.c
+++ b/qw/menu.c
@@ -233,7 +233,7 @@
 			M_Menu_Main_f ();
 			return;
 		}
-		key_dest = key_game;
+		key_dest = cls.state == ca_active ? key_game : key_console;
 		m_state = m_none;
 		return;
 	}
@@ -240,6 +240,8 @@
 	if (key_dest == key_console)
 	{
 		Con_ToggleConsole_f ();
+		if(key_dest == key_console && cls.state != ca_active)
+			M_Menu_Main_f();
 	}
 	else
 	{
@@ -290,7 +292,7 @@
 	switch (key)
 	{
 	case K_ESCAPE:
-		key_dest = key_game;
+		key_dest = cls.state == ca_active ? key_game : key_console;
 		m_state = m_none;
 		cls.demonum = m_save_demonum;
 		if (cls.demonum != -1 && !cls.demoplayback && cls.state == ca_disconnected)
@@ -901,7 +903,7 @@
 		}
 		else
 		{
-			key_dest = key_game;
+			key_dest = cls.state == ca_active ? key_game : key_console;
 			m_state = m_none;
 		}
 		break;