mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-23 03:12:38 +00:00
Add apropos console command
This commit is contained in:
parent
7962b243de
commit
13aed6ad25
1 changed files with 33 additions and 1 deletions
|
@ -51,9 +51,11 @@ static void COM_CEchoDuration_f(void);
|
|||
static void COM_Exec_f(void);
|
||||
static void COM_Wait_f(void);
|
||||
static void COM_Help_f(void);
|
||||
static void COM_Apropos_f(void);
|
||||
static void COM_Toggle_f(void);
|
||||
static void COM_Add_f(void);
|
||||
|
||||
|
||||
static void CV_EnforceExecVersion(void);
|
||||
static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
|
||||
static boolean CV_Command(void);
|
||||
|
@ -344,6 +346,7 @@ void COM_Init(void)
|
|||
COM_AddCommand("exec", COM_Exec_f, 0);
|
||||
COM_AddCommand("wait", COM_Wait_f, 0);
|
||||
COM_AddCommand("help", COM_Help_f, COM_LUA);
|
||||
COM_AddCommand("apropos", COM_Apropos_f, COM_LUA);
|
||||
COM_AddCommand("toggle", COM_Toggle_f, COM_LUA);
|
||||
COM_AddCommand("add", COM_Add_f, COM_LUA);
|
||||
RegisterNetXCmd(XD_NETVAR, Got_NetVar);
|
||||
|
@ -879,7 +882,7 @@ static void COM_Help_f(void)
|
|||
boolean floatmode = false;
|
||||
const char *cvalue = NULL;
|
||||
CONS_Printf("\x82""Variable %s:\n", cvar->name);
|
||||
CONS_Printf(M_GetText(" flags :"));
|
||||
CONS_Printf(M_GetText(" flags: "));
|
||||
if (cvar->flags & CV_SAVE)
|
||||
CONS_Printf("AUTOSAVE ");
|
||||
if (cvar->flags & CV_FLOAT)
|
||||
|
@ -1030,6 +1033,35 @@ static void COM_Help_f(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void COM_Apropos_f(void)
|
||||
{
|
||||
xcommand_t *cmd;
|
||||
consvar_t *cvar;
|
||||
|
||||
if (COM_Argc() != 2)
|
||||
{
|
||||
CONS_Printf(M_GetText("apropos <text>: Search for cvars and cmds containing text\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("\x82""Matching variables:\n");
|
||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
{
|
||||
if (cvar->flags & CV_NOSHOWHELP)
|
||||
continue;
|
||||
if (strstr(cvar->name, COM_Argv(1)) != NULL)
|
||||
CONS_Printf("%s ", cvar->name);
|
||||
}
|
||||
|
||||
CONS_Printf("\x82""\nMatching commands:\n");
|
||||
for (cmd = com_commands; cmd; cmd = cmd->next)
|
||||
{
|
||||
if (strstr(cmd->name, COM_Argv(1)) != NULL)
|
||||
CONS_Printf("%s ", cmd->name);
|
||||
}
|
||||
CONS_Printf("\n");
|
||||
}
|
||||
|
||||
/** Toggles a console variable. Useful for on/off values.
|
||||
*
|
||||
* This works on on/off, yes/no values only
|
||||
|
|
Loading…
Reference in a new issue