diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-09-05 23:38:35 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-09-05 23:38:35 +0000 |
commit | 375858a20dcd36f9e2187af181228a9493d9f6e7 (patch) | |
tree | 3e32110ca8f4c0a7e5859aeeb01f577ad9ce44bb /code/client | |
parent | b82742d4f392aa26ecb761ccbfbbb24f8e08fbb6 (diff) | |
download | ioquake3-aero-375858a20dcd36f9e2187af181228a9493d9f6e7.tar.gz ioquake3-aero-375858a20dcd36f9e2187af181228a9493d9f6e7.zip |
* 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
Diffstat (limited to 'code/client')
-rw-r--r-- | code/client/cl_keys.c | 25 | ||||
-rw-r--r-- | code/client/cl_main.c | 4 |
2 files changed, 6 insertions, 23 deletions
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 ); |