#define CON_LINES_LAST CONBUFFER_LINES_LAST(&con)
#define CON_LINES_COUNT CONBUFFER_LINES_COUNT(&con)
-cvar_t con_notifytime = {CVAR_SAVE, "con_notifytime","3", "how long notify lines last, in seconds"};
-cvar_t con_notify = {CVAR_SAVE, "con_notify","4", "how many notify lines to show"};
-cvar_t con_notifyalign = {CVAR_SAVE, "con_notifyalign", "", "how to align notify lines: 0 = left, 0.5 = center, 1 = right, empty string = game default)"};
-
-cvar_t con_chattime = {CVAR_SAVE, "con_chattime","30", "how long chat lines last, in seconds"};
-cvar_t con_chat = {CVAR_SAVE, "con_chat","0", "how many chat lines to show in a dedicated chat area"};
-cvar_t con_chatpos = {CVAR_SAVE, "con_chatpos","0", "where to put chat (negative: lines from bottom of screen, positive: lines below notify, 0: at top)"};
-cvar_t con_chatrect = {CVAR_SAVE, "con_chatrect","0", "use con_chatrect_x and _y to position con_notify and con_chat freely instead of con_chatpos"};
-cvar_t con_chatrect_x = {CVAR_SAVE, "con_chatrect_x","", "where to put chat, relative x coordinate of left edge on screen (use con_chatwidth for width)"};
-cvar_t con_chatrect_y = {CVAR_SAVE, "con_chatrect_y","", "where to put chat, relative y coordinate of top edge on screen (use con_chat for line count)"};
-cvar_t con_chatwidth = {CVAR_SAVE, "con_chatwidth","1.0", "relative chat window width"};
-cvar_t con_textsize = {CVAR_SAVE, "con_textsize","8", "console text size in virtual 2D pixels"};
-cvar_t con_notifysize = {CVAR_SAVE, "con_notifysize","8", "notify text size in virtual 2D pixels"};
-cvar_t con_chatsize = {CVAR_SAVE, "con_chatsize","8", "chat text size in virtual 2D pixels (if con_chat is enabled)"};
-cvar_t con_chatsound = {CVAR_SAVE, "con_chatsound","1", "enables chat sound to play on message"};
-
-
-cvar_t sys_specialcharactertranslation = {0, "sys_specialcharactertranslation", "1", "terminal console conchars to ASCII translation (set to 0 if your conchars.tga is for an 8bit character set or if you want raw output)"};
+cvar_t con_notifytime = {CVAR_CLIENT | CVAR_SAVE, "con_notifytime","3", "how long notify lines last, in seconds"};
+cvar_t con_notify = {CVAR_CLIENT | CVAR_SAVE, "con_notify","4", "how many notify lines to show"};
+cvar_t con_notifyalign = {CVAR_CLIENT | CVAR_SAVE, "con_notifyalign", "", "how to align notify lines: 0 = left, 0.5 = center, 1 = right, empty string = game default)"};
+
+cvar_t con_chattime = {CVAR_CLIENT | CVAR_SAVE, "con_chattime","30", "how long chat lines last, in seconds"};
+cvar_t con_chat = {CVAR_CLIENT | CVAR_SAVE, "con_chat","0", "how many chat lines to show in a dedicated chat area"};
+cvar_t con_chatpos = {CVAR_CLIENT | CVAR_SAVE, "con_chatpos","0", "where to put chat (negative: lines from bottom of screen, positive: lines below notify, 0: at top)"};
+cvar_t con_chatrect = {CVAR_CLIENT | CVAR_SAVE, "con_chatrect","0", "use con_chatrect_x and _y to position con_notify and con_chat freely instead of con_chatpos"};
+cvar_t con_chatrect_x = {CVAR_CLIENT | CVAR_SAVE, "con_chatrect_x","", "where to put chat, relative x coordinate of left edge on screen (use con_chatwidth for width)"};
+cvar_t con_chatrect_y = {CVAR_CLIENT | CVAR_SAVE, "con_chatrect_y","", "where to put chat, relative y coordinate of top edge on screen (use con_chat for line count)"};
+cvar_t con_chatwidth = {CVAR_CLIENT | CVAR_SAVE, "con_chatwidth","1.0", "relative chat window width"};
+cvar_t con_textsize = {CVAR_CLIENT | CVAR_SAVE, "con_textsize","8", "console text size in virtual 2D pixels"};
+cvar_t con_notifysize = {CVAR_CLIENT | CVAR_SAVE, "con_notifysize","8", "notify text size in virtual 2D pixels"};
+cvar_t con_chatsize = {CVAR_CLIENT | CVAR_SAVE, "con_chatsize","8", "chat text size in virtual 2D pixels (if con_chat is enabled)"};
+cvar_t con_chatsound = {CVAR_CLIENT | CVAR_SAVE, "con_chatsound","1", "enables chat sound to play on message"};
+cvar_t con_chatsound_file = {CVAR_CLIENT, "con_chatsound_file","sound/misc/talk.wav", "The sound to play for chat messages"};
+cvar_t con_chatsound_team_file = {CVAR_CLIENT, "con_chatsound_team_file","sound/misc/talk2.wav", "The sound to play for team chat messages"};
+cvar_t con_chatsound_team_mask = {CVAR_CLIENT, "con_chatsound_team_mask","40","Magic ASCII code that denotes a team chat message"};
+
+cvar_t sys_specialcharactertranslation = {CVAR_CLIENT | CVAR_SERVER, "sys_specialcharactertranslation", "1", "terminal console conchars to ASCII translation (set to 0 if your conchars.tga is for an 8bit character set or if you want raw output)"};
#ifdef WIN32
-cvar_t sys_colortranslation = {0, "sys_colortranslation", "0", "terminal console color translation (supported values: 0 = strip color codes, 1 = translate to ANSI codes, 2 = no translation)"};
+cvar_t sys_colortranslation = {CVAR_CLIENT | CVAR_SERVER, "sys_colortranslation", "0", "terminal console color translation (supported values: 0 = strip color codes, 1 = translate to ANSI codes, 2 = no translation)"};
#else
-cvar_t sys_colortranslation = {0, "sys_colortranslation", "1", "terminal console color translation (supported values: 0 = strip color codes, 1 = translate to ANSI codes, 2 = no translation)"};
+cvar_t sys_colortranslation = {CVAR_CLIENT | CVAR_SERVER, "sys_colortranslation", "1", "terminal console color translation (supported values: 0 = strip color codes, 1 = translate to ANSI codes, 2 = no translation)"};
#endif
-cvar_t con_nickcompletion = {CVAR_SAVE, "con_nickcompletion", "1", "tab-complete nicks in console and message input"};
-cvar_t con_nickcompletion_flags = {CVAR_SAVE, "con_nickcompletion_flags", "11", "Bitfield: "
+cvar_t con_nickcompletion = {CVAR_CLIENT | CVAR_SAVE, "con_nickcompletion", "1", "tab-complete nicks in console and message input"};
+cvar_t con_nickcompletion_flags = {CVAR_CLIENT | CVAR_SAVE, "con_nickcompletion_flags", "11", "Bitfield: "
"0: add nothing after completion. "
"1: add the last color after completion. "
"2: add a quote when starting a quote instead of the color. "
#define NICKS_ALPHANUMERICS_ONLY 8
#define NICKS_NO_SPACES 16
-cvar_t con_completion_playdemo = {CVAR_SAVE, "con_completion_playdemo", "*.dem", "completion pattern for the playdemo command"};
-cvar_t con_completion_timedemo = {CVAR_SAVE, "con_completion_timedemo", "*.dem", "completion pattern for the timedemo command"};
-cvar_t con_completion_exec = {CVAR_SAVE, "con_completion_exec", "*.cfg", "completion pattern for the exec command"};
+cvar_t con_completion_playdemo = {CVAR_CLIENT | CVAR_SAVE, "con_completion_playdemo", "*.dem", "completion pattern for the playdemo command"};
+cvar_t con_completion_timedemo = {CVAR_CLIENT | CVAR_SAVE, "con_completion_timedemo", "*.dem", "completion pattern for the timedemo command"};
+cvar_t con_completion_exec = {CVAR_CLIENT | CVAR_SAVE, "con_completion_exec", "*.cfg", "completion pattern for the exec command"};
-cvar_t condump_stripcolors = {CVAR_SAVE, "condump_stripcolors", "0", "strip color codes from console dumps"};
+cvar_t condump_stripcolors = {CVAR_CLIENT | CVAR_SERVER| CVAR_SAVE, "condump_stripcolors", "0", "strip color codes from console dumps"};
int con_linewidth;
int con_vislines;
/// \name Logging
//@{
-cvar_t log_file = {0, "log_file", "", "filename to log messages to"};
-cvar_t log_file_stripcolors = {0, "log_file_stripcolors", "0", "strip color codes from log messages"};
-cvar_t log_dest_udp = {0, "log_dest_udp", "", "UDP address to log messages to (in QW rcon compatible format); multiple destinations can be separated by spaces; DO NOT SPECIFY DNS NAMES HERE"};
+cvar_t log_file = {CVAR_CLIENT | CVAR_SERVER, "log_file", "", "filename to log messages to"};
+cvar_t log_file_stripcolors = {CVAR_CLIENT | CVAR_SERVER, "log_file_stripcolors", "0", "strip color codes from log messages"};
+cvar_t log_dest_udp = {CVAR_CLIENT | CVAR_SERVER, "log_dest_udp", "", "UDP address to log messages to (in QW rcon compatible format); multiple destinations can be separated by spaces; DO NOT SPECIFY DNS NAMES HERE"};
char log_dest_buffer[1400]; // UDP packet
size_t log_dest_buffer_pos;
unsigned int log_dest_buffer_appending;
file = FS_OpenRealFile(Cmd_Argv(cmd, 1), "w", false);
if (!file)
{
- Con_Printf("condump: unable to write file \"%s\"\n", Cmd_Argv(cmd, 1));
+ Con_Printf(CON_ERROR "condump: unable to write file \"%s\"\n", Cmd_Argv(cmd, 1));
return;
}
if (con_mutex) Thread_LockMutex(con_mutex);
Cvar_RegisterVariable (&con_notifytime);
Cvar_RegisterVariable (&con_textsize);
Cvar_RegisterVariable (&con_chatsound);
+ Cvar_RegisterVariable (&con_chatsound_file);
+ Cvar_RegisterVariable (&con_chatsound_team_file);
+ Cvar_RegisterVariable (&con_chatsound_team_mask);
// --blub
Cvar_RegisterVariable (&con_nickcompletion);
Cvar_RegisterVariable (&condump_stripcolors);
// register our commands
- Cmd_AddCommand(&cmd_client, "toggleconsole", Con_ToggleConsole_f, "opens or closes the console");
- Cmd_AddCommand(&cmd_client, "messagemode", Con_MessageMode_f, "input a chat message to say to everyone");
- Cmd_AddCommand(&cmd_client, "messagemode2", Con_MessageMode2_f, "input a chat message to say to only your team");
- Cmd_AddCommand(&cmd_client, "commandmode", Con_CommandMode_f, "input a console command");
- Cmd_AddCommand(&cmd_client, "clear", Con_Clear_f, "clear console history");
- Cmd_AddCommand(&cmd_client, "maps", Con_Maps_f, "list information about available maps");
- Cmd_AddCommand(&cmd_client, "condump", Con_ConDump_f, "output console history to a file (see also log_file)");
-
- Cmd_AddCommand(&cmd_server, "maps", Con_Maps_f, "list information about available maps");
- Cmd_AddCommand(&cmd_server, "condump", Con_ConDump_f, "output console history to a file (see also log_file)");
+ Cmd_AddCommand(CMD_CLIENT, "toggleconsole", Con_ToggleConsole_f, "opens or closes the console");
+ Cmd_AddCommand(CMD_CLIENT, "messagemode", Con_MessageMode_f, "input a chat message to say to everyone");
+ Cmd_AddCommand(CMD_CLIENT, "messagemode2", Con_MessageMode2_f, "input a chat message to say to only your team");
+ Cmd_AddCommand(CMD_CLIENT, "commandmode", Con_CommandMode_f, "input a console command");
+ Cmd_AddCommand(CMD_SHARED, "clear", Con_Clear_f, "clear console history");
+ Cmd_AddCommand(CMD_SHARED, "maps", Con_Maps_f, "list information about available maps");
+ Cmd_AddCommand(CMD_SHARED, "condump", Con_ConDump_f, "output console history to a file (see also log_file)");
con_initialized = true;
+ // initialize console window (only used by sys_win.c)
+ Sys_InitConsole();
+
Con_DPrint("Console initialized.\n");
}
{
if (con_chatsound.value)
{
- if(IS_NEXUIZ_DERIVED(gamemode))
- {
- if(msg[1] == '\r' && cl.foundtalk2wav)
- S_LocalSound ("sound/misc/talk2.wav");
- else
- S_LocalSound ("sound/misc/talk.wav");
- }
+ if(msg[1] == con_chatsound_team_mask.integer && cl.foundteamchatsound)
+ S_LocalSound (con_chatsound_team_file.string);
else
- {
- if (msg[1] == '(' && cl.foundtalk2wav)
- S_LocalSound ("sound/misc/talk2.wav");
- else
- S_LocalSound ("sound/misc/talk.wav");
- }
+ S_LocalSound (con_chatsound_file.string);
}
}
-
// Send to chatbox for say/tell (1) and messages (3)
// 3 is just so that a message can be sent to the chatbox without a sound.
if (*msg == 1 || *msg == 3)
mask = CON_MASK_CHAT;
-
+
line[index++] = STRING_COLOR_TAG;
line[index++] = '3';
msg++;
DrawQ_String(x, con_vislines - con_textsize.value*2, text, y + 3, con_textsize.value, con_textsize.value, 1.0, 1.0, 1.0, 1.0, 0, NULL, false, FONT_CONSOLE );
// draw a cursor on top of this
- if ((int)(realtime*con_cursorspeed) & 1) // cursor is visible
+ if ((int)(host.realtime*con_cursorspeed) & 1) // cursor is visible
{
if (!utf8_enable.integer)
{
int colorindex = -1;
const char *cursor;
char charbuf16[16];
- cursor = u8_encodech(0xE00A + ((int)(realtime * con_cursorspeed)&1), NULL, charbuf16);
+ cursor = u8_encodech(0xE00A + ((int)(host.realtime * con_cursorspeed)&1), NULL, charbuf16);
// LadyHavoc: speedup, and other improvements
if (chat_mode < 0)
int mask_must = 0;
int mask_mustnot = (developer.integer>0) ? 0 : CON_MASK_DEVELOPER;
cachepic_t *conbackpic;
+ unsigned int conbackflags;
if (lines <= 0)
return;
{
sx = scr_conscroll_x.value;
sy = scr_conscroll_y.value;
- conbackpic = scr_conbrightness.value >= 0.01f ? Draw_CachePic_Flags("gfx/conback", (sx != 0 || sy != 0) ? CACHEPICFLAG_NOCLAMP : 0) : NULL;
- sx *= realtime; sy *= realtime;
+ conbackflags = CACHEPICFLAG_FAILONMISSING; // So console is readable when game content is missing
+ if (sx != 0 || sy != 0)
+ conbackflags &= CACHEPICFLAG_NOCLAMP;
+ conbackpic = scr_conbrightness.value >= 0.01f ? Draw_CachePic_Flags("gfx/conback", conbackflags) : NULL;
+ sx *= host.realtime; sy *= host.realtime;
sx -= floor(sx); sy -= floor(sy);
if (Draw_IsPicLoaded(conbackpic))
DrawQ_SuperPic(0, lines - vid_conheight.integer, conbackpic, vid_conwidth.integer, vid_conheight.integer,
sx = scr_conscroll2_x.value;
sy = scr_conscroll2_y.value;
conbackpic = Draw_CachePic_Flags("gfx/conback2", (sx != 0 || sy != 0) ? CACHEPICFLAG_NOCLAMP : 0);
- sx *= realtime; sy *= realtime;
+ sx *= host.realtime; sy *= host.realtime;
sx -= floor(sx); sy -= floor(sy);
if(Draw_IsPicLoaded(conbackpic))
DrawQ_SuperPic(0, lines - vid_conheight.integer, conbackpic, vid_conwidth.integer, vid_conheight.integer,
sx = scr_conscroll3_x.value;
sy = scr_conscroll3_y.value;
conbackpic = Draw_CachePic_Flags("gfx/conback3", (sx != 0 || sy != 0) ? CACHEPICFLAG_NOCLAMP : 0);
- sx *= realtime; sy *= realtime;
+ sx *= host.realtime; sy *= host.realtime;
sx -= floor(sx); sy -= floor(sy);
if(Draw_IsPicLoaded(conbackpic))
DrawQ_SuperPic(0, lines - vid_conheight.integer, conbackpic, vid_conwidth.integer, vid_conheight.integer,
*/
static int Nicks_CompleteCountPossible(char *line, int pos, char *s, qboolean isCon)
{
- char name[128];
+ char name[MAX_SCOREBOARDNAME];
int i, p;
int match;
int spos;
msg = Nicks_list[0];
len = min(size - Nicks_matchpos - 3, strlen(msg));
memcpy(&buffer[Nicks_matchpos], msg, len);
- if( len < (size - 7) ) // space for color (^[0-9] or ^xrgb) and space and \0
+ if(len < size - 7) // space for color code (^[0-9] or ^xrgb), space and \0
len = (int)Nicks_AddLastColor(buffer, Nicks_matchpos+(int)len);
buffer[len++] = ' ';
buffer[len] = 0;
{
strlcpy(command, key_line + 1, min(sizeof(command), (unsigned int)(space - key_line)));
- patterns = Cvar_VariableString(va(vabuf, sizeof(vabuf), "con_completion_%s", command)); // TODO maybe use a better place for this?
+ patterns = Cvar_VariableString(cmd->cvars, va(vabuf, sizeof(vabuf), "con_completion_%s", command), CVAR_CLIENT | CVAR_SERVER); // TODO maybe use a better place for this?
if(patterns && !*patterns)
patterns = NULL; // get rid of the empty string
Con_Printf("\n%i possible command%s\n", c, (c > 1) ? "s: " : ":");
Cmd_CompleteCommandPrint(cmd, s);
}
- v = Cvar_CompleteCountPossible(s);
+ v = Cvar_CompleteCountPossible(cmd->cvars, s, CVAR_CLIENT | CVAR_SERVER);
if (v)
{
Con_Printf("\n%i possible variable%s\n", v, (v > 1) ? "s: " : ":");
- Cvar_CompleteCvarPrint(s);
+ Cvar_CompleteCvarPrint(cmd->cvars, s, CVAR_CLIENT | CVAR_SERVER);
}
a = Cmd_CompleteAliasCountPossible(cmd, s);
if (a)
if (c)
text = *(list[0] = Cmd_CompleteBuildList(cmd, s));
if (v)
- text = *(list[1] = Cvar_CompleteBuildList(s));
+ text = *(list[1] = Cvar_CompleteBuildList(cmd->cvars, s, cmd->cvars_flagsmask));
if (a)
text = *(list[2] = Cmd_CompleteAliasBuildList(cmd, s));
if (n)
memcpy(&key_line[key_linepos] , Nicks_list[0], cmd_len);
key_linepos += cmd_len;
- if(key_linepos < (int)(sizeof(key_line)-4)) // space for ^, X and space and \0
+ if(key_linepos < (int)(sizeof(key_line) - 7)) // space for color code (^[0-9] or ^xrgb), space and \0
key_linepos = Nicks_AddLastColor(key_line, key_linepos);
}
key_line[key_linepos++] = ' ';