| 3 |
tristanc |
1 |
#ifndef _CONSOLECLIENT_H_
|
|
|
2 |
#define _CONSOLECLIENT_H_
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
#include <Engine/Base/RCString.hpp>
|
|
|
6 |
#include <Engine/Event/EvtApi.h>
|
|
|
7 |
|
|
|
8 |
enum COLOR_T
|
|
|
9 |
{
|
|
|
10 |
DEFAULT_COLOR = 0x0,
|
|
|
11 |
INPUT_COLOR = 0x1,
|
|
|
12 |
ECHO_COLOR = 0x2,
|
|
|
13 |
ERROR_COLOR = 0x3,
|
|
|
14 |
WARNING_COLOR = 0x4,
|
|
|
15 |
GLOBAL_COLOR = 0x5,
|
|
|
16 |
ADMIN_COLOR = 0x6,
|
|
|
17 |
HIGHLIGHT_COLOR = 0x7,
|
|
|
18 |
BACKGROUND_COLOR = 0x8,
|
|
|
19 |
NUM_COLORTYPES = 0x9
|
|
|
20 |
};
|
|
|
21 |
|
|
|
22 |
enum CATEGORY
|
|
|
23 |
{
|
|
|
24 |
DEBUG = 0x0,
|
|
|
25 |
GRAPHICS = 0x1,
|
|
|
26 |
CONSOLE = 0x2,
|
|
|
27 |
COMBAT = 0x3,
|
|
|
28 |
GAME = 0x4,
|
|
|
29 |
DEFAULT = 0x5,
|
|
|
30 |
NET = 0x6,
|
|
|
31 |
SOUND = 0x7,
|
|
|
32 |
GM = 0x8,
|
|
|
33 |
NONE = 0x9,
|
|
|
34 |
LAST = 0xA
|
|
|
35 |
};
|
|
|
36 |
|
|
|
37 |
#define NOHELP 0
|
|
|
38 |
|
|
|
39 |
enum EXECMODE
|
|
|
40 |
{
|
|
|
41 |
EM_PROMPTOVERWRITE = 0x0,
|
|
|
42 |
EM_RECORDING = 0x1,
|
|
|
43 |
EM_APPEND = 0x2,
|
|
|
44 |
EM_WRITEFILE = 0x3,
|
|
|
45 |
EM_NOTACTIVE = 0x4,
|
|
|
46 |
EM_NUM_EXECMODES = 0x5
|
|
|
47 |
};
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
/****************************************************************************
|
|
|
51 |
*
|
|
|
52 |
* Global variables
|
|
|
53 |
*
|
|
|
54 |
***/
|
|
|
55 |
|
|
|
56 |
extern EXECMODE& g_ExecCreateMode;
|
|
|
57 |
extern char* g_ExecBuffer;
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
/****************************************************************************
|
|
|
61 |
*
|
|
|
62 |
* CVAR FLAGS
|
|
|
63 |
*
|
|
|
64 |
***/
|
|
|
65 |
|
|
|
66 |
#define LATCH 0x2
|
|
|
67 |
#define READONLY 0x4
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
/****************************************************************************
|
|
|
71 |
*
|
|
|
72 |
* CVar struct
|
|
|
73 |
*
|
|
|
74 |
***/
|
|
|
75 |
|
|
|
76 |
struct CVar {
|
|
|
77 |
|
|
|
78 |
// TODO: TSHashObject
|
|
|
79 |
unsigned int m_hashval;
|
|
|
80 |
void* m_linktoslot[2];
|
|
|
81 |
void* m_linktofull[2];
|
|
|
82 |
char* m_key;
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
CATEGORY m_category;
|
|
|
86 |
unsigned int m_flags;
|
|
|
87 |
RCString m_stringValue;
|
|
|
88 |
float m_floatValue;
|
|
|
89 |
int m_intValue;
|
|
|
90 |
int m_modified;
|
|
|
91 |
RCString m_defaultValue;
|
|
|
92 |
RCString m_resetValue;
|
|
|
93 |
RCString m_latchedValue;
|
|
|
94 |
RCString m_helpText;
|
|
|
95 |
bool (*m_callback)(CVar *,LPCSTR,LPCSTR,void *);
|
|
|
96 |
void* m_arg;
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
//=======================================================================
|
|
|
100 |
static CVar* Register (LPCSTR name,
|
|
|
101 |
LPCSTR help,
|
|
|
102 |
unsigned int flags,
|
|
|
103 |
LPCSTR value,
|
|
|
104 |
bool (*fcn)(CVar *,LPCSTR,LPCSTR,void *),
|
|
|
105 |
CATEGORY category,
|
|
|
106 |
bool setCommand,
|
|
|
107 |
void* arg,
|
|
|
108 |
bool a9); // TODO
|
|
|
109 |
};
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
/****************************************************************************
|
|
|
113 |
*
|
|
|
114 |
* External functions
|
|
|
115 |
*
|
|
|
116 |
***/
|
|
|
117 |
|
|
|
118 |
//===========================================================================
|
|
|
119 |
extern void ConsoleAccessSetEnabled (BOOL enable);
|
|
|
120 |
|
|
|
121 |
//===========================================================================
|
|
|
122 |
extern BOOL ConsoleAccessGetEnabled ();
|
|
|
123 |
|
|
|
124 |
//===========================================================================
|
|
|
125 |
extern BOOL ConsoleIsActive ();
|
|
|
126 |
|
|
|
127 |
//===========================================================================
|
|
|
128 |
extern void ConsoleSetHotkey (KEY key);
|
|
|
129 |
|
|
|
130 |
//===========================================================================
|
|
|
131 |
extern void ConsoleSetTitle (LPSTR windowTitle);
|
|
|
132 |
|
|
|
133 |
//===========================================================================
|
|
|
134 |
extern void ConsoleWrite (LPCSTR str, COLOR_T color);
|
|
|
135 |
|
|
|
136 |
//===========================================================================
|
|
|
137 |
extern void ConsoleWriteA (LPCSTR str, COLOR_T color, ...);
|
|
|
138 |
|
|
|
139 |
//===========================================================================
|
|
|
140 |
extern void ConsoleCommandExecute (LPCSTR command, BOOL addToHistory);
|
|
|
141 |
|
|
|
142 |
//===========================================================================
|
|
|
143 |
extern void ConsoleCommandInitialize ();
|
|
|
144 |
|
|
|
145 |
//===========================================================================
|
|
|
146 |
extern BOOL ConsoleCommandRegister (LPCSTR command,
|
|
|
147 |
BOOL (*handler)(LPCSTR,LPCSTR),
|
|
|
148 |
CATEGORY category,
|
|
|
149 |
LPCSTR helpText);
|
|
|
150 |
|
|
|
151 |
//===========================================================================
|
|
|
152 |
extern void ConsoleCommandUnregister (LPCSTR command);
|
|
|
153 |
|
|
|
154 |
//===========================================================================
|
|
|
155 |
extern void ConsoleCommandWriteHelp (LPCSTR str);
|
|
|
156 |
|
| 29 |
tristanc |
157 |
//===========================================================================
|
|
|
158 |
extern void ConsolePrintf(char const* str, ...);
|
| 3 |
tristanc |
159 |
|
| 29 |
tristanc |
160 |
|
| 3 |
tristanc |
161 |
#endif // ifndef _CONSOLECLIENT_H_
|