diff options
Diffstat (limited to 'src/cgame/cg_drawtools.c')
-rw-r--r-- | src/cgame/cg_drawtools.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/cgame/cg_drawtools.c b/src/cgame/cg_drawtools.c index 3151f66f..06ae0713 100644 --- a/src/cgame/cg_drawtools.c +++ b/src/cgame/cg_drawtools.c @@ -346,3 +346,33 @@ qboolean CG_WorldToScreen( vec3_t point, float *x, float *y ) return qtrue; } + +/* +================ +CG_KeyBinding +================ +*/ +char *CG_KeyBinding( const char *bind ) +{ + static char key[ 32 ]; + char bindbuff[ MAX_CVAR_VALUE_STRING ]; + int i; + + key[ 0 ] = '\0'; + // NOTE: change K_LAST_KEY to MAX_KEYS for full key support (eventually) + for( i = 0; i < K_LAST_KEY; i++ ) + { + trap_Key_GetBindingBuf( i, bindbuff, sizeof( bindbuff ) ); + if( !Q_stricmp( bindbuff, bind ) ) + { + trap_Key_KeynumToStringBuf( i, key, sizeof( key ) ); + break; + } + } + if( !key[ 0 ] ) + { + Q_strncpyz( key, "\\", sizeof( key ) ); + Q_strcat( key, sizeof( key ), bind ); + } + return key; +} |