Subversion Repositories WoWGM

Rev

Rev 31 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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