[util] Support commands with a data parameter

Useful for avoiding a pile of wrapper functions that merely pass on
command-specific data to the actual implementation. Used to clean up the
wrappers in nq and qw cl_input.c
This commit is contained in:
Bill Currie 2021-03-20 03:56:16 +09:00
parent dc7cb97481
commit 0ace799b27
4 changed files with 207 additions and 554 deletions

View file

@ -37,6 +37,7 @@
#include "QF/cbuf.h" #include "QF/cbuf.h"
typedef void (*xcommand_t) (void); typedef void (*xcommand_t) (void);
typedef void (*xdatacmd_t) (void *data);
typedef enum { typedef enum {
src_client, // came in over a net connection as a clc_stringcmd src_client, // came in over a net connection as a clc_stringcmd
@ -48,6 +49,8 @@ typedef struct cmd_function_s {
struct cmd_function_s *next; struct cmd_function_s *next;
const char *name; const char *name;
xcommand_t function; xcommand_t function;
xdatacmd_t datafunc;
void *data;
const char *description; const char *description;
} cmd_function_t; } cmd_function_t;
@ -56,7 +59,10 @@ extern cmd_source_t cmd_source;
void Cmd_Init_Hash (void); void Cmd_Init_Hash (void);
void Cmd_Init (void); void Cmd_Init (void);
int Cmd_AddCommand (const char *cmd_name, xcommand_t function, const char *description); int Cmd_AddCommand (const char *cmd_name, xcommand_t function,
const char *description);
int Cmd_AddDataCommand (const char *cmd_name, xdatacmd_t function,
void *data, const char *description);
int Cmd_RemoveCommand (const char *cmd_name); int Cmd_RemoveCommand (const char *cmd_name);
qboolean Cmd_Exists (const char *cmd_name); qboolean Cmd_Exists (const char *cmd_name);

View file

@ -118,6 +118,8 @@ Cmd_Command (cbuf_args_t *args)
if (cmd) { if (cmd) {
if (cmd->function) { if (cmd->function) {
cmd->function (); cmd->function ();
} else if (cmd->datafunc) {
cmd->datafunc (cmd->data);
} }
return 0; return 0;
} }
@ -133,10 +135,9 @@ Cmd_Command (cbuf_args_t *args)
return 0; return 0;
} }
/* Registers a command and handler function */ static int
VISIBLE int add_command (const char *cmd_name, xcommand_t func, xdatacmd_t datafunc,
Cmd_AddCommand (const char *cmd_name, xcommand_t function, void *data, const char *description)
const char *description)
{ {
cmd_function_t *cmd; cmd_function_t *cmd;
cmd_function_t **c; cmd_function_t **c;
@ -152,7 +153,9 @@ Cmd_AddCommand (const char *cmd_name, xcommand_t function,
cmd = calloc (1, sizeof (cmd_function_t)); cmd = calloc (1, sizeof (cmd_function_t));
SYS_CHECKMEM (cmd); SYS_CHECKMEM (cmd);
cmd->name = cmd_name; cmd->name = cmd_name;
cmd->function = function; cmd->function = func;
cmd->datafunc = datafunc;
cmd->data = data;
cmd->description = description; cmd->description = description;
Hash_Add (cmd_hash, cmd); Hash_Add (cmd_hash, cmd);
for (c = &cmd_functions; *c; c = &(*c)->next) for (c = &cmd_functions; *c; c = &(*c)->next)
@ -163,6 +166,22 @@ Cmd_AddCommand (const char *cmd_name, xcommand_t function,
return 1; return 1;
} }
/* Registers a command and handler function */
VISIBLE int
Cmd_AddCommand (const char *cmd_name, xcommand_t function,
const char *description)
{
return add_command (cmd_name, function, 0, 0, description);
}
/* Registers a command and handler function with data */
VISIBLE int
Cmd_AddDataCommand (const char *cmd_name, xdatacmd_t function,
void *data, const char *description)
{
return add_command (cmd_name, 0, function, data, description);
}
/* Unregisters a command */ /* Unregisters a command */
VISIBLE int VISIBLE int
Cmd_RemoveCommand (const char *name) Cmd_RemoveCommand (const char *name)

View file

@ -77,8 +77,9 @@ int in_impulse;
void (*write_angles) (sizebuf_t *sb, const vec3_t angles); void (*write_angles) (sizebuf_t *sb, const vec3_t angles);
static void static void
KeyPress (kbutton_t *b) KeyPress (void *_b)
{ {
kbutton_t *b = _b;
const char *c; const char *c;
int k; int k;
@ -107,8 +108,9 @@ KeyPress (kbutton_t *b)
} }
static void static void
KeyRelease (kbutton_t *b) KeyRelease (void *_b)
{ {
kbutton_t *b = _b;
const char *c; const char *c;
int k; int k;
@ -141,25 +143,7 @@ KeyRelease (kbutton_t *b)
} }
static void static void
IN_KLookPress (void) IN_MLookRelease (void *data)
{
KeyPress (&in_klook);
}
static void
IN_KLookRelease (void)
{
KeyRelease (&in_klook);
}
static void
IN_MLookPress (void)
{
KeyPress (&in_mlook);
}
static void
IN_MLookRelease (void)
{ {
KeyRelease (&in_mlook); KeyRelease (&in_mlook);
if (!freelook && lookspring->int_val) if (!freelook && lookspring->int_val)
@ -167,187 +151,7 @@ IN_MLookRelease (void)
} }
static void static void
IN_UpPress (void) IN_Impulse (void *data)
{
KeyPress (&in_up);
}
static void
IN_UpRelease (void)
{
KeyRelease (&in_up);
}
static void
IN_DownPress (void)
{
KeyPress (&in_down);
}
static void
IN_DownRelease (void)
{
KeyRelease (&in_down);
}
static void
IN_LeftPress (void)
{
KeyPress (&in_left);
}
static void
IN_LeftRelease (void)
{
KeyRelease (&in_left);
}
static void
IN_RightPress (void)
{
KeyPress (&in_right);
}
static void
IN_RightRelease (void)
{
KeyRelease (&in_right);
}
static void
IN_ForwardPress (void)
{
KeyPress (&in_forward);
}
static void
IN_ForwardRelease (void)
{
KeyRelease (&in_forward);
}
static void
IN_BackPress (void)
{
KeyPress (&in_back);
}
static void
IN_BackRelease (void)
{
KeyRelease (&in_back);
}
static void
IN_LookupPress (void)
{
KeyPress (&in_lookup);
}
static void
IN_LookupRelease (void)
{
KeyRelease (&in_lookup);
}
static void
IN_LookdownPress (void)
{
KeyPress (&in_lookdown);
}
static void
IN_LookdownRelease (void)
{
KeyRelease (&in_lookdown);
}
static void
IN_MoveleftPress (void)
{
KeyPress (&in_moveleft);
}
static void
IN_MoveleftRelease (void)
{
KeyRelease (&in_moveleft);
}
static void
IN_MoverightPress (void)
{
KeyPress (&in_moveright);
}
static void
IN_MoverightRelease (void)
{
KeyRelease (&in_moveright);
}
static void
IN_SpeedPress (void)
{
KeyPress (&in_speed);
}
static void
IN_SpeedRelease (void)
{
KeyRelease (&in_speed);
}
static void
IN_StrafePress (void)
{
KeyPress (&in_strafe);
}
static void
IN_StrafeRelease (void)
{
KeyRelease (&in_strafe);
}
static void
IN_AttackPress (void)
{
KeyPress (&in_attack);
}
static void
IN_AttackRelease (void)
{
KeyRelease (&in_attack);
}
static void
IN_UsePress (void)
{
KeyPress (&in_use);
}
static void
IN_UseRelease (void)
{
KeyRelease (&in_use);
}
static void
IN_JumpPress (void)
{
KeyPress (&in_jump);
}
static void
IN_JumpRelease (void)
{
KeyRelease (&in_jump);
}
static void
IN_Impulse (void)
{ {
in_impulse = atoi (Cmd_Argv (1)); in_impulse = atoi (Cmd_Argv (1));
} }
@ -608,76 +412,86 @@ CL_SendMove (usercmd_t *cmd)
void void
CL_Input_Init (void) CL_Input_Init (void)
{ {
Cmd_AddCommand ("+moveup", IN_UpPress, "When active the player is " Cmd_AddDataCommand ("+moveup", KeyPress, &in_up,
"swimming up in a liquid"); "When active the player is swimming up in a liquid");
Cmd_AddCommand ("-moveup", IN_UpRelease, "When active the player is not " Cmd_AddDataCommand ("-moveup", KeyRelease, &in_up,
"swimming up in a liquid"); "When active the player is not swimming up in a "
Cmd_AddCommand ("+movedown", IN_DownPress, "When active the player is " "liquid");
"swimming down in a liquid"); Cmd_AddDataCommand ("+movedown", KeyPress, &in_down,
Cmd_AddCommand ("-movedown", IN_DownRelease, "When active the player is " "When active the player is swimming down in a liquid");
"not swimming down in a liquid"); Cmd_AddDataCommand ("-movedown", KeyRelease, &in_down,
Cmd_AddCommand ("+left", IN_LeftPress, "When active the player is turning " "When active the player is not swimming down in a "
"left"); "liquid");
Cmd_AddCommand ("-left", IN_LeftRelease, "When active the player is not " Cmd_AddDataCommand ("+left", KeyPress, &in_left,
"turning left"); "When active the player is turning left");
Cmd_AddCommand ("+right", IN_RightPress, "When active the player is " Cmd_AddDataCommand ("-left", KeyRelease, &in_left,
"turning right"); "When active the player is not turning left");
Cmd_AddCommand ("-right", IN_RightRelease, "When active the player is not " Cmd_AddDataCommand ("+right", KeyPress, &in_right,
"turning right"); "When active the player is turning right");
Cmd_AddCommand ("+forward", IN_ForwardPress, "When active the player is " Cmd_AddDataCommand ("-right", KeyRelease, &in_right,
"moving forward"); "When active the player is not turning right");
Cmd_AddCommand ("-forward", IN_ForwardRelease, "When active the player is " Cmd_AddDataCommand ("+forward", KeyPress, &in_forward,
"not moving forward"); "When active the player is moving forward");
Cmd_AddCommand ("+back", IN_BackPress, "When active the player is moving " Cmd_AddDataCommand ("-forward", KeyRelease, &in_forward,
"backwards"); "When active the player is not moving forward");
Cmd_AddCommand ("-back", IN_BackRelease, "When active the player is not " Cmd_AddDataCommand ("+back", KeyPress, &in_back,
"moving backwards"); "When active the player is moving backwards");
Cmd_AddCommand ("+lookup", IN_LookupPress, "When active the player's view " Cmd_AddDataCommand ("-back", KeyRelease, &in_back,
"is looking up"); "When active the player is not moving backwards");
Cmd_AddCommand ("-lookup", IN_LookupRelease, "When active the player's " Cmd_AddDataCommand ("+lookup", KeyPress, &in_lookup,
"view is not looking up"); "When active the player's view is looking up");
Cmd_AddCommand ("+lookdown", IN_LookdownPress, "When active the player's " Cmd_AddDataCommand ("-lookup", KeyRelease, &in_lookup,
"view is looking down"); "When active the player's view is not looking up");
Cmd_AddCommand ("-lookdown", IN_LookdownRelease, "When active the " Cmd_AddDataCommand ("+lookdown", KeyPress, &in_lookdown,
"player's view is not looking up"); "When active the player's view is looking down");
Cmd_AddCommand ("+strafe", IN_StrafePress, "When active, +left and +right " Cmd_AddDataCommand ("-lookdown", KeyRelease, &in_lookdown,
"function like +moveleft and +moveright"); "When active the player's view is not looking up");
Cmd_AddCommand ("-strafe", IN_StrafeRelease, "When active, +left and " Cmd_AddDataCommand ("+strafe", KeyPress, &in_strafe,
"+right stop functioning like +moveleft and +moveright"); "When active, +left and +right function like "
Cmd_AddCommand ("+moveleft", IN_MoveleftPress, "When active the player is " "+moveleft and +moveright");
"strafing left"); Cmd_AddDataCommand ("-strafe", KeyRelease, &in_strafe,
Cmd_AddCommand ("-moveleft", IN_MoveleftRelease, "When active the player " "When active, +left and +right stop functioning like "
"is not strafing left"); "+moveleft and +moveright");
Cmd_AddCommand ("+moveright", IN_MoverightPress, "When active the player " Cmd_AddDataCommand ("+moveleft", KeyPress, &in_moveleft,
"is strafing right"); "When active the player is strafing left");
Cmd_AddCommand ("-moveright", IN_MoverightRelease, "When active the " Cmd_AddDataCommand ("-moveleft", KeyRelease, &in_moveleft,
"player is not strafing right"); "When active the player is not strafing left");
Cmd_AddCommand ("+speed", IN_SpeedPress, "When active the player is " Cmd_AddDataCommand ("+moveright", KeyPress, &in_moveright,
"running"); "When active the player is strafing right");
Cmd_AddCommand ("-speed", IN_SpeedRelease, "When active the player is not " Cmd_AddDataCommand ("-moveright", KeyRelease, &in_moveright,
"running"); "When active the player is not strafing right");
Cmd_AddCommand ("+attack", IN_AttackPress, "When active player is " Cmd_AddDataCommand ("+speed", KeyPress, &in_speed,
"firing/using current weapon"); "When active the player is running");
Cmd_AddCommand ("-attack", IN_AttackRelease, "When active player is not " Cmd_AddDataCommand ("-speed", KeyRelease, &in_speed,
"firing/using current weapon"); "When active the player is not running");
Cmd_AddCommand ("+use", IN_UsePress, "Non-functional. Left over command " Cmd_AddDataCommand ("+attack", KeyPress, &in_attack,
"for opening doors and triggering switches"); "When active player is firing/using current weapon");
Cmd_AddCommand ("-use", IN_UseRelease, "Non-functional. Left over command " Cmd_AddDataCommand ("-attack", KeyRelease, &in_attack,
"for opening doors and triggering switches"); "When active player is not firing/using current "
Cmd_AddCommand ("+jump", IN_JumpPress, "When active the player is " "weapon");
"jumping"); Cmd_AddDataCommand ("+use", KeyPress, &in_use,
Cmd_AddCommand ("-jump", IN_JumpRelease, "When active the player is not " "Non-functional. Left over command for opening doors "
"jumping"); "and triggering switches");
Cmd_AddCommand ("impulse", IN_Impulse, "Call a game function or QuakeC " Cmd_AddDataCommand ("-use", KeyRelease, &in_use,
"function."); "Non-functional. Left over command for opening doors "
Cmd_AddCommand ("+klook", IN_KLookPress, "When active, +forward and +back " "and triggering switches");
"perform +lookup and +lookdown"); Cmd_AddDataCommand ("+jump", KeyPress, &in_jump,
Cmd_AddCommand ("-klook", IN_KLookRelease, "When active, +forward and " "When active the player is jumping");
"+back don't perform +lookup and +lookdown"); Cmd_AddDataCommand ("-jump", KeyRelease, &in_jump,
Cmd_AddCommand ("+mlook", IN_MLookPress, "When active moving the mouse or " "When active the player is not jumping");
"joystick forwards and backwards performs +lookup and " Cmd_AddDataCommand ("impulse", IN_Impulse, 0,
"+lookdown"); "Call a game function or QuakeC function.");
Cmd_AddCommand ("-mlook", IN_MLookRelease, "When active moving the mouse " Cmd_AddDataCommand ("+klook", KeyPress, &in_klook,
"or joystick forwards and backwards doesn't perform " "When active, +forward and +back perform +lookup and "
"+lookup and +lookdown"); "+lookdown");
Cmd_AddDataCommand ("-klook", KeyRelease, &in_klook,
"When active, +forward and +back don't perform "
"+lookup and +lookdown");
Cmd_AddDataCommand ("+mlook", KeyPress, &in_mlook,
"When active moving the mouse or joystick forwards "
"and backwards performs +lookup and "
"+lookdown");
Cmd_AddDataCommand ("-mlook", IN_MLookRelease, &in_mlook,
"When active moving the mouse or joystick forwards "
"and backwards doesn't perform +lookup and +lookdown");
} }

View file

@ -89,8 +89,9 @@ int in_impulse;
static void static void
KeyPress (kbutton_t *b) KeyPress (void *_b)
{ {
kbutton_t *b = _b;
const char *c; const char *c;
int k; int k;
@ -119,8 +120,9 @@ KeyPress (kbutton_t *b)
} }
static void static void
KeyRelease (kbutton_t *b) KeyRelease (void *_b)
{ {
kbutton_t *b = _b;
const char *c; const char *c;
int k; int k;
@ -153,25 +155,7 @@ KeyRelease (kbutton_t *b)
} }
static void static void
IN_KLookPress (void) IN_MLookRelease (void *data)
{
KeyPress (&in_klook);
}
static void
IN_KLookRelease (void)
{
KeyRelease (&in_klook);
}
static void
IN_MLookPress (void)
{
KeyPress (&in_mlook);
}
static void
IN_MLookRelease (void)
{ {
KeyRelease (&in_mlook); KeyRelease (&in_mlook);
if (!freelook && lookspring->int_val) if (!freelook && lookspring->int_val)
@ -179,187 +163,7 @@ IN_MLookRelease (void)
} }
static void static void
IN_UpPress (void) IN_Impulse (void *data)
{
KeyPress (&in_up);
}
static void
IN_UpRelease (void)
{
KeyRelease (&in_up);
}
static void
IN_DownPress (void)
{
KeyPress (&in_down);
}
static void
IN_DownRelease (void)
{
KeyRelease (&in_down);
}
static void
IN_LeftPress (void)
{
KeyPress (&in_left);
}
static void
IN_LeftRelease (void)
{
KeyRelease (&in_left);
}
static void
IN_RightPress (void)
{
KeyPress (&in_right);
}
static void
IN_RightRelease (void)
{
KeyRelease (&in_right);
}
static void
IN_ForwardPress (void)
{
KeyPress (&in_forward);
}
static void
IN_ForwardRelease (void)
{
KeyRelease (&in_forward);
}
static void
IN_BackPress (void)
{
KeyPress (&in_back);
}
static void
IN_BackRelease (void)
{
KeyRelease (&in_back);
}
static void
IN_LookupPress (void)
{
KeyPress (&in_lookup);
}
static void
IN_LookupRelease (void)
{
KeyRelease (&in_lookup);
}
static void
IN_LookdownPress (void)
{
KeyPress (&in_lookdown);
}
static void
IN_LookdownRelease (void)
{
KeyRelease (&in_lookdown);
}
static void
IN_MoveleftPress (void)
{
KeyPress (&in_moveleft);
}
static void
IN_MoveleftRelease (void)
{
KeyRelease (&in_moveleft);
}
static void
IN_MoverightPress (void)
{
KeyPress (&in_moveright);
}
static void
IN_MoverightRelease (void)
{
KeyRelease (&in_moveright);
}
static void
IN_SpeedPress (void)
{
KeyPress (&in_speed);
}
static void
IN_SpeedRelease (void)
{
KeyRelease (&in_speed);
}
static void
IN_StrafePress (void)
{
KeyPress (&in_strafe);
}
static void
IN_StrafeRelease (void)
{
KeyRelease (&in_strafe);
}
static void
IN_AttackPress (void)
{
KeyPress (&in_attack);
}
static void
IN_AttackRelease (void)
{
KeyRelease (&in_attack);
}
static void
IN_UsePress (void)
{
KeyPress (&in_use);
}
static void
IN_UseRelease (void)
{
KeyRelease (&in_use);
}
static void
IN_JumpPress (void)
{
KeyPress (&in_jump);
}
static void
IN_JumpRelease (void)
{
KeyRelease (&in_jump);
}
static void
IN_Impulse (void)
{ {
in_impulse = atoi (Cmd_Argv (1)); in_impulse = atoi (Cmd_Argv (1));
if (Cmd_Argc () <= 2) if (Cmd_Argc () <= 2)
@ -772,78 +576,88 @@ CL_SendCmd (void)
void void
CL_Input_Init (void) CL_Input_Init (void)
{ {
Cmd_AddCommand ("+moveup", IN_UpPress, "When active the player is " Cmd_AddDataCommand ("+moveup", KeyPress, &in_up,
"swimming up in a liquid"); "When active the player is swimming up in a liquid");
Cmd_AddCommand ("-moveup", IN_UpRelease, "When active the player is not " Cmd_AddDataCommand ("-moveup", KeyRelease, &in_up,
"swimming up in a liquid"); "When active the player is not swimming up in a "
Cmd_AddCommand ("+movedown", IN_DownPress, "When active the player is " "liquid");
"swimming down in a liquid"); Cmd_AddDataCommand ("+movedown", KeyPress, &in_down,
Cmd_AddCommand ("-movedown", IN_DownRelease, "When active the player is " "When active the player is swimming down in a liquid");
"not swimming down in a liquid"); Cmd_AddDataCommand ("-movedown", KeyRelease, &in_down,
Cmd_AddCommand ("+left", IN_LeftPress, "When active the player is turning " "When active the player is not swimming down in a "
"left"); "liquid");
Cmd_AddCommand ("-left", IN_LeftRelease, "When active the player is not " Cmd_AddDataCommand ("+left", KeyPress, &in_left,
"turning left"); "When active the player is turning left");
Cmd_AddCommand ("+right", IN_RightPress, "When active the player is " Cmd_AddDataCommand ("-left", KeyRelease, &in_left,
"turning right"); "When active the player is not turning left");
Cmd_AddCommand ("-right", IN_RightRelease, "When active the player is not " Cmd_AddDataCommand ("+right", KeyPress, &in_right,
"turning right"); "When active the player is turning right");
Cmd_AddCommand ("+forward", IN_ForwardPress, "When active the player is " Cmd_AddDataCommand ("-right", KeyRelease, &in_right,
"moving forward"); "When active the player is not turning right");
Cmd_AddCommand ("-forward", IN_ForwardRelease, "When active the player is " Cmd_AddDataCommand ("+forward", KeyPress, &in_forward,
"not moving forward"); "When active the player is moving forward");
Cmd_AddCommand ("+back", IN_BackPress, "When active the player is moving " Cmd_AddDataCommand ("-forward", KeyRelease, &in_forward,
"backwards"); "When active the player is not moving forward");
Cmd_AddCommand ("-back", IN_BackRelease, "When active the player is not " Cmd_AddDataCommand ("+back", KeyPress, &in_back,
"moving backwards"); "When active the player is moving backwards");
Cmd_AddCommand ("+lookup", IN_LookupPress, "When active the player's view " Cmd_AddDataCommand ("-back", KeyRelease, &in_back,
"is looking up"); "When active the player is not moving backwards");
Cmd_AddCommand ("-lookup", IN_LookupRelease, "When active the player's " Cmd_AddDataCommand ("+lookup", KeyPress, &in_lookup,
"view is not looking up"); "When active the player's view is looking up");
Cmd_AddCommand ("+lookdown", IN_LookdownPress, "When active the player's " Cmd_AddDataCommand ("-lookup", KeyRelease, &in_lookup,
"view is looking down"); "When active the player's view is not looking up");
Cmd_AddCommand ("-lookdown", IN_LookdownRelease, "When active the " Cmd_AddDataCommand ("+lookdown", KeyPress, &in_lookdown,
"player's view is not looking up"); "When active the player's view is looking down");
Cmd_AddCommand ("+strafe", IN_StrafePress, "When active, +left and +right " Cmd_AddDataCommand ("-lookdown", KeyRelease, &in_lookdown,
"function like +moveleft and +moveright"); "When active the player's view is not looking up");
Cmd_AddCommand ("-strafe", IN_StrafeRelease, "When active, +left and " Cmd_AddDataCommand ("+strafe", KeyPress, &in_strafe,
"+right stop functioning like +moveleft and +moveright"); "When active, +left and +right function like "
Cmd_AddCommand ("+moveleft", IN_MoveleftPress, "When active the player is " "+moveleft and +moveright");
"strafing left"); Cmd_AddDataCommand ("-strafe", KeyRelease, &in_strafe,
Cmd_AddCommand ("-moveleft", IN_MoveleftRelease, "When active the player " "When active, +left and +right stop functioning like "
"is not strafing left"); "+moveleft and +moveright");
Cmd_AddCommand ("+moveright", IN_MoverightPress, "When active the player " Cmd_AddDataCommand ("+moveleft", KeyPress, &in_moveleft,
"is strafing right"); "When active the player is strafing left");
Cmd_AddCommand ("-moveright", IN_MoverightRelease, "When active the " Cmd_AddDataCommand ("-moveleft", KeyRelease, &in_moveleft,
"player is not strafing right"); "When active the player is not strafing left");
Cmd_AddCommand ("+speed", IN_SpeedPress, "When active the player is " Cmd_AddDataCommand ("+moveright", KeyPress, &in_moveright,
"running"); "When active the player is strafing right");
Cmd_AddCommand ("-speed", IN_SpeedRelease, "When active the player is not " Cmd_AddDataCommand ("-moveright", KeyRelease, &in_moveright,
"running"); "When active the player is not strafing right");
Cmd_AddCommand ("+attack", IN_AttackPress, "When active player is " Cmd_AddDataCommand ("+speed", KeyPress, &in_speed,
"firing/using current weapon"); "When active the player is running");
Cmd_AddCommand ("-attack", IN_AttackRelease, "When active player is not " Cmd_AddDataCommand ("-speed", KeyRelease, &in_speed,
"firing/using current weapon"); "When active the player is not running");
Cmd_AddCommand ("+use", IN_UsePress, "Non-functional. Left over command " Cmd_AddDataCommand ("+attack", KeyPress, &in_attack,
"for opening doors and triggering switches"); "When active player is firing/using current weapon");
Cmd_AddCommand ("-use", IN_UseRelease, "Non-functional. Left over command " Cmd_AddDataCommand ("-attack", KeyRelease, &in_attack,
"for opening doors and triggering switches"); "When active player is not firing/using current "
Cmd_AddCommand ("+jump", IN_JumpPress, "When active the player is " "weapon");
"jumping"); Cmd_AddDataCommand ("+use", KeyPress, &in_use,
Cmd_AddCommand ("-jump", IN_JumpRelease, "When active the player is not " "Non-functional. Left over command for opening doors "
"jumping"); "and triggering switches");
Cmd_AddCommand ("impulse", IN_Impulse, "Call a game function or QuakeC " Cmd_AddDataCommand ("-use", KeyRelease, &in_use,
"function."); "Non-functional. Left over command for opening doors "
Cmd_AddCommand ("+klook", IN_KLookPress, "When active, +forward and +back " "and triggering switches");
"perform +lookup and +lookdown"); Cmd_AddDataCommand ("+jump", KeyPress, &in_jump,
Cmd_AddCommand ("-klook", IN_KLookRelease, "When active, +forward and " "When active the player is jumping");
"+back don't perform +lookup and +lookdown"); Cmd_AddDataCommand ("-jump", KeyRelease, &in_jump,
Cmd_AddCommand ("+mlook", IN_MLookPress, "When active moving the mouse or " "When active the player is not jumping");
"joystick forwards and backwards performs +lookup and " Cmd_AddDataCommand ("impulse", IN_Impulse, 0,
"+lookdown"); "Call a game function or QuakeC function.");
Cmd_AddCommand ("-mlook", IN_MLookRelease, "When active moving the mouse " Cmd_AddDataCommand ("+klook", KeyPress, &in_klook,
"or joystick forwards and backwards doesn't perform " "When active, +forward and +back perform +lookup and "
"+lookup and +lookdown"); "+lookdown");
Cmd_AddDataCommand ("-klook", KeyRelease, &in_klook,
"When active, +forward and +back don't perform "
"+lookup and +lookdown");
Cmd_AddDataCommand ("+mlook", KeyPress, &in_mlook,
"When active moving the mouse or joystick forwards "
"and backwards performs +lookup and "
"+lookdown");
Cmd_AddDataCommand ("-mlook", IN_MLookRelease, &in_mlook,
"When active moving the mouse or joystick forwards "
"and backwards doesn't perform +lookup and +lookdown");
} }
void void