]> icculus.org git repositories - btb/d2x.git/blob - main/cmd.h
close box is pretty ugly
[btb/d2x.git] / main / cmd.h
1 #ifndef _CMD_H_
2 #define _CMD_H_ 1
3
4
5 void cmd_init(void);
6
7 /* Maximum length for a single command */
8 #define CMD_MAX_LENGTH 2048
9 /* Maximum number of tokens per command */
10 #define CMD_MAX_TOKENS 64
11
12 /* Add some commands to the queue to be executed */
13 void cmd_enqueue(int insert, char *input);
14 void cmd_enqueuef(int insert, char *fmt, ...);
15 #define cmd_append(input) cmd_enqueue(0, (input))
16 #define cmd_appendf(...) cmd_enqueuef(0, __VA_ARGS__)
17 #define cmd_insert(input) cmd_enqueue(1, (input))
18 #define cmd_insertf(...) cmd_enqueuef(1, __VA_ARGS__)
19
20 /* Execute pending commands */
21 void cmd_queue_process(void);
22
23 /* Attempt to autocomplete an input string */
24 char *cmd_complete(char *input);
25
26 typedef void (*cmd_handler_t)(int argc, char *argv[]);
27
28 void cmd_addcommand(char *cmd_name, cmd_handler_t cmd_func);
29
30
31 /* +/- actions */
32
33 #define CMD_NUM_BUTTONS 2
34
35 typedef enum
36 {
37         CMD_ATTACK,  // Fire primary weapon
38         CMD_ATTACK2, // Fire secondary weapon
39 } cmd_button;
40
41 extern int Console_button_states[CMD_NUM_BUTTONS];
42
43
44 /* execute a bound key's command */
45 int cmd_handle_keybinding(unsigned char key);
46
47
48 #endif /* _CMD_H_ */