From 375858a20dcd36f9e2187af181228a9493d9f6e7 Mon Sep 17 00:00:00 2001 From: tma Date: Fri, 5 Sep 2008 23:38:35 +0000 Subject: * Add Com_HexStrToInt * Fixed some whacky indentation in q_shared.c * Allow single character keys e.g. 'c' to be used in cl_consoleKeys in addition to ASCII characters * Experimental code to ignore dead keys git-svn-id: svn://svn.icculus.org/quake3/trunk@1470 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/client/cl_keys.c | 25 ++++--------------------- code/client/cl_main.c | 4 ++-- 2 files changed, 6 insertions(+), 23 deletions(-) (limited to 'code/client') diff --git a/code/client/cl_keys.c b/code/client/cl_keys.c index fea1b74..3097f54 100644 --- a/code/client/cl_keys.c +++ b/code/client/cl_keys.c @@ -776,7 +776,6 @@ qboolean Key_IsDown( int keynum ) { return keys[keynum].down; } - /* =================== Key_StringToKeynum @@ -801,28 +800,12 @@ int Key_StringToKeynum( char *str ) { } // check for hex code - if ( str[0] == '0' && str[1] == 'x' && strlen( str ) == 4) { - int n1, n2; - - n1 = str[2]; - if ( n1 >= '0' && n1 <= '9' ) { - n1 -= '0'; - } else if ( n1 >= 'a' && n1 <= 'f' ) { - n1 = n1 - 'a' + 10; - } else { - n1 = 0; - } + if ( strlen( str ) == 4 ) { + int n = Com_HexStrToInt( str ); - n2 = str[3]; - if ( n2 >= '0' && n2 <= '9' ) { - n2 -= '0'; - } else if ( n2 >= 'a' && n2 <= 'f' ) { - n2 = n2 - 'a' + 10; - } else { - n2 = 0; + if ( n >= 0 ) { + return n; } - - return n1 * 16 + n2; } // scan for a text match diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 23a07d6..353d2b3 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -3079,8 +3079,8 @@ void CL_Init( void ) { cl_guidServerUniq = Cvar_Get ("cl_guidServerUniq", "1", CVAR_ARCHIVE); - // 0x7e = ~ and 0x60 = ` - cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "0x7e 0x60", CVAR_ARCHIVE); + // ~ and `, as keys and characters + cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE); // userinfo Cvar_Get ("name", "UnnamedPlayer", CVAR_USERINFO | CVAR_ARCHIVE ); -- cgit v1.2.3