aboutsummaryrefslogtreecommitdiffstats
path: root/code/client
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-09-16 21:05:22 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-09-16 21:05:22 +0000
commit660be5cc7d3989740b4e6fbd8ed8b1d9c46ebd20 (patch)
treec609227c4de7d3ea10310714c3262d58665b3ffa /code/client
parent134e4522a3a9eb3f3e2f8e3646eb3d3999d49694 (diff)
downloadioquake3-aero-660be5cc7d3989740b4e6fbd8ed8b1d9c46ebd20.tar.gz
ioquake3-aero-660be5cc7d3989740b4e6fbd8ed8b1d9c46ebd20.zip
* Move command argument completion from being hard coded to being associated
with the individual commands to be completed git-svn-id: svn://svn.icculus.org/quake3/trunk@1472 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client')
-rw-r--r--code/client/cl_console.c12
-rw-r--r--code/client/cl_keys.c46
-rw-r--r--code/client/cl_main.c35
3 files changed, 93 insertions, 0 deletions
diff --git a/code/client/cl_console.c b/code/client/cl_console.c
index 5aad766..80e4e43 100644
--- a/code/client/cl_console.c
+++ b/code/client/cl_console.c
@@ -302,6 +302,17 @@ void Con_CheckResize (void)
con.display = con.current;
}
+/*
+==================
+Cmd_CompleteTxtName
+==================
+*/
+void Cmd_CompleteTxtName( char *args, int argNum ) {
+ if( argNum == 2 ) {
+ Field_CompleteFilename( "", "txt", qfalse );
+ }
+}
+
/*
================
@@ -329,6 +340,7 @@ void Con_Init (void) {
Cmd_AddCommand ("messagemode4", Con_MessageMode4_f);
Cmd_AddCommand ("clear", Con_Clear_f);
Cmd_AddCommand ("condump", Con_Dump_f);
+ Cmd_SetCommandCompletionFunc( "condump", Cmd_CompleteTxtName );
}
diff --git a/code/client/cl_keys.c b/code/client/cl_keys.c
index 3097f54..f2932d9 100644
--- a/code/client/cl_keys.c
+++ b/code/client/cl_keys.c
@@ -1058,6 +1058,50 @@ void Key_KeynameCompletion( void(*callback)(const char *s) ) {
}
/*
+====================
+Key_CompleteUnbind
+====================
+*/
+static void Key_CompleteUnbind( char *args, int argNum )
+{
+ if( argNum == 2 )
+ {
+ // Skip "unbind "
+ char *p = Com_SkipTokens( args, 1, " " );
+
+ if( p > args )
+ Field_CompleteKeyname( );
+ }
+}
+
+/*
+====================
+Key_CompleteBind
+====================
+*/
+static void Key_CompleteBind( char *args, int argNum )
+{
+ char *p;
+
+ if( argNum == 2 )
+ {
+ // Skip "bind "
+ p = Com_SkipTokens( args, 1, " " );
+
+ if( p > args )
+ Field_CompleteKeyname( );
+ }
+ else if( argNum >= 3 )
+ {
+ // Skip "bind <key> "
+ p = Com_SkipTokens( args, 2, " " );
+
+ if( p > args )
+ Field_CompleteCommand( p, qtrue, qtrue );
+ }
+}
+
+/*
===================
CL_InitKeyCommands
===================
@@ -1065,7 +1109,9 @@ CL_InitKeyCommands
void CL_InitKeyCommands( void ) {
// register our functions
Cmd_AddCommand ("bind",Key_Bind_f);
+ Cmd_SetCommandCompletionFunc( "bind", Key_CompleteBind );
Cmd_AddCommand ("unbind",Key_Unbind_f);
+ Cmd_SetCommandCompletionFunc( "unbind", Key_CompleteUnbind );
Cmd_AddCommand ("unbindall",Key_Unbindall_f);
Cmd_AddCommand ("bindlist",Key_Bindlist_f);
}
diff --git a/code/client/cl_main.c b/code/client/cl_main.c
index 64c1cfb..01c044a 100644
--- a/code/client/cl_main.c
+++ b/code/client/cl_main.c
@@ -872,6 +872,22 @@ static void CL_WalkDemoExt(char *arg, char *name, int *demofile)
/*
====================
+CL_CompleteDemoName
+====================
+*/
+static void CL_CompleteDemoName( char *args, int argNum )
+{
+ if( argNum == 2 )
+ {
+ char demoExt[ 16 ];
+
+ Com_sprintf( demoExt, sizeof( demoExt ), ".dm_%d", PROTOCOL_VERSION );
+ Field_CompleteFilename( "demos", demoExt, qtrue );
+ }
+}
+
+/*
+====================
CL_PlayDemo_f
demo <demoname>
@@ -1566,6 +1582,23 @@ void CL_Connect_f( void ) {
#define MAX_RCON_MESSAGE 1024
/*
+==================
+CL_CompleteRcon
+==================
+*/
+static void CL_CompleteRcon( char *args, int argNum )
+{
+ if( argNum == 2 )
+ {
+ // Skip "rcon "
+ char *p = Com_SkipTokens( args, 1, " " );
+
+ if( p > args )
+ Field_CompleteCommand( p, qtrue, qtrue );
+ }
+}
+
+/*
=====================
CL_Rcon_f
@@ -3150,6 +3183,7 @@ void CL_Init( void ) {
Cmd_AddCommand ("disconnect", CL_Disconnect_f);
Cmd_AddCommand ("record", CL_Record_f);
Cmd_AddCommand ("demo", CL_PlayDemo_f);
+ Cmd_SetCommandCompletionFunc( "demo", CL_CompleteDemoName );
Cmd_AddCommand ("cinematic", CL_PlayCinematic_f);
Cmd_AddCommand ("stoprecord", CL_StopRecord_f);
Cmd_AddCommand ("connect", CL_Connect_f);
@@ -3157,6 +3191,7 @@ void CL_Init( void ) {
Cmd_AddCommand ("localservers", CL_LocalServers_f);
Cmd_AddCommand ("globalservers", CL_GlobalServers_f);
Cmd_AddCommand ("rcon", CL_Rcon_f);
+ Cmd_SetCommandCompletionFunc( "rcon", CL_CompleteRcon );
Cmd_AddCommand ("setenv", CL_Setenv_f );
Cmd_AddCommand ("ping", CL_Ping_f );
Cmd_AddCommand ("serverstatus", CL_ServerStatus_f );