diff options
author | Andrey Nazarov <skuller@skuller.net> | 2008-03-06 15:05:38 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2008-03-06 15:05:38 +0000 |
commit | c9de9262ae2cbb799ff71d4d93dace22f33247aa (patch) | |
tree | a78ab16cc5e35eac0f897aebff01722ffa7f1aad | |
parent | bf0e48bb73e2d6846e15335e3625290d1f9ebc52 (diff) |
Updated revision to 194.
Calling `draw' command without arguments lists registered strings.
Fixed Windows compilation issues.
Fixed Ctrl+C in console.
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | source/cl_console.c | 2 | ||||
-rw-r--r-- | source/cl_draw.c | 35 | ||||
-rw-r--r-- | source/cvar.c | 4 |
4 files changed, 36 insertions, 7 deletions
@@ -63,7 +63,7 @@ histfile=".conhistory" democache=".democache" screenshots="screenshots" scoreshots="scoreshots" -revision="186" +revision="194" tmpc="/tmp/q2pro-${RANDOM}.c" tmpo="/tmp/q2pro-${RANDOM}.o" diff --git a/source/cl_console.c b/source/cl_console.c index 1eca052..304517a 100644 --- a/source/cl_console.c +++ b/source/cl_console.c @@ -986,7 +986,7 @@ void Key_Console( int key ) { return; } - if( ( key == 'd' || key == 'c' ) && Key_IsDown( K_CTRL ) ) { + if( key == 'd' && Key_IsDown( K_CTRL ) ) { con.mode = CON_DEFAULT; return; } diff --git a/source/cl_draw.c b/source/cl_draw.c index 1085d8d..de79f04 100644 --- a/source/cl_draw.c +++ b/source/cl_draw.c @@ -485,12 +485,27 @@ static void SCR_Draw_c( genctx_t *ctx, int argnum ) { // draw cl_fps -1 80 static void SCR_Draw_f( void ) { int x, y; - char *s; + const char *s; drawobj_t *obj; cmd_macro_t *macro; // int stat; + int argc = Cmd_Argc(); + + if( argc == 1 ) { + if( LIST_EMPTY( &scr_objects ) ) { + Com_Printf( "No draw strings registered.\n" ); + return; + } + Com_Printf( "Name X Y\n" + "--------------- ---- ----\n" ); + LIST_FOR_EACH( drawobj_t, obj, &scr_objects, entry ) { + s = obj->macro ? obj->macro->name : obj->cvar->name; + Com_Printf( "%-15s %4d %4d\n", s, obj->x, obj->y ); + } + return; + } - if( Cmd_Argc() != 4 ) { + if( argc < 4 ) { Com_Printf( "Usage: %s <name> <x> <y>\n", Cmd_Argv( 0 ) ); return; } @@ -531,6 +546,8 @@ static void SCR_Draw_f( void ) { static void SCR_Draw_g( genctx_t *ctx ) { drawobj_t *obj; const char *s; + + Prompt_AddMatch( ctx, "all" ); LIST_FOR_EACH( drawobj_t, obj, &scr_objects, entry ) { s = obj->macro ? obj->macro->name : obj->cvar->name; @@ -551,19 +568,25 @@ static void SCR_UnDraw_f( void ) { drawobj_t *obj, *next; cmd_macro_t *macro; cvar_t *cvar; + qboolean deleted; if( Cmd_Argc() != 2 ) { Com_Printf( "Usage: %s <name>\n", Cmd_Argv( 0 ) ); return; } + if( LIST_EMPTY( &scr_objects ) ) { + Com_Printf( "No draw strings registered.\n" ); + return; + } + s = Cmd_Argv( 1 ); if( !strcmp( s, "all" ) ) { LIST_FOR_EACH_SAFE( drawobj_t, obj, next, &scr_objects, entry ) { Z_Free( obj ); } List_Init( &scr_objects ); - Com_Printf( "Deleted all drawstrings.\n" ); + Com_Printf( "Deleted all draw strings.\n" ); return; } @@ -573,12 +596,18 @@ static void SCR_UnDraw_f( void ) { cvar = Cvar_Get( s, "", CVAR_USER_CREATED ); } + deleted = qfalse; LIST_FOR_EACH_SAFE( drawobj_t, obj, next, &scr_objects, entry ) { if( obj->macro == macro && obj->cvar == cvar ) { List_Remove( &obj->entry ); Z_Free( obj ); + deleted = qtrue; } } + + if( !deleted ) { + Com_Printf( "Draw string '%s' not found.\n", s ); + } } static void draw_objects( void ) { diff --git a/source/cvar.c b/source/cvar.c index 021afa5..d36d30a 100644 --- a/source/cvar.c +++ b/source/cvar.c @@ -289,7 +289,7 @@ void Cvar_SetByVar( cvar_t *var, const char *value, cvarSetSource_t source ) { if( var->flags & CVAR_INFOMASK ) { if( Info_SubValidate( value ) == -1 ) { - Com_WPrintf( "Invalid info cvar value.\n" ); + Com_WPrintf( "Invalid info cvar value '%s' for '%s'.\n", value, var->name ); return; } } @@ -779,7 +779,7 @@ static const cmd_option_t o_cvarlist[] = { }; static void Cvar_List_c( genctx_t *ctx, int argnum ) { - return Cmd_Option_c( o_cvarlist, NULL, ctx, argnum ); + Cmd_Option_c( o_cvarlist, NULL, ctx, argnum ); } static void Cvar_List_f( void ) { |