23#if !defined(WIN32) || defined(__MINGW32__)
42#define CON_LINES(i) CONBUFFER_LINES(&con, i)
43#define CON_LINES_LAST CONBUFFER_LINES_LAST(&con)
44#define CON_LINES_COUNT CONBUFFER_LINES_COUNT(&con)
66cvar_t sys_colortranslation = {
CF_CLIENT |
CF_SERVER,
"sys_colortranslation",
"1",
"terminal console color translation (supported values: -1 = print codes without translation, 0 = strip color codes, 1 = translate to ANSI codes, 2 = translate DP RGB to 24-bit and Quake colors to ANSI, 3 = translate all colors to 24-bit RGB)"};
71 "0: add nothing after completion. "
72 "1: add the last color after completion. "
73 "2: add a quote when starting a quote instead of the color. "
74 "4: will replace 1, will force color, even after a quote. "
75 "8: ignore non-alphanumerics. "
76 "16: ignore spaces. "};
77#define NICKS_ADD_COLOR 1
78#define NICKS_ADD_QUOTE 2
79#define NICKS_FORCE_COLOR 4
80#define NICKS_ALPHANUMERICS_ONLY 8
81#define NICKS_NO_SPACES 16
89cvar_t rcon_password = {
CF_CLIENT |
CF_SERVER |
CF_PRIVATE,
"rcon_password",
"",
"password to authenticate rcon commands; NOTE: changing rcon_secure clears rcon_password, so set rcon_secure always before rcon_password; may be set to a string of the form user1:pass1 user2:pass2 user3:pass3 to allow multiple user accounts - the client then has to specify ONE of these combinations"};
90cvar_t rcon_secure = {
CF_CLIENT |
CF_SERVER,
"rcon_secure",
"0",
"force secure rcon authentication (1 = time based, 2 = challenge based); NOTE: changing rcon_secure clears rcon_password, so set rcon_secure always before rcon_password"};
111 buf->textsize = textsize;
113 buf->maxlines = maxlines;
115 buf->lines_first = 0;
116 buf->lines_count = 0;
121 '\0',
'#',
'#',
'#',
'#',
'.',
'#',
'#',
122 '#', 9, 10,
'#',
' ', 13,
'.',
'.',
123 '[',
']',
'0',
'1',
'2',
'3',
'4',
'5',
124 '6',
'7',
'8',
'9',
'.',
'<',
'=',
'>',
125 ' ',
'!',
'"',
'#',
'$',
'%',
'&',
'\'',
126 '(',
')',
'*',
'+',
',',
'-',
'.',
'/',
127 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
128 '8',
'9',
':',
';',
'<',
'=',
'>',
'?',
129 '@',
'A',
'B',
'C',
'D',
'E',
'F',
'G',
130 'H',
'I',
'J',
'K',
'L',
'M',
'N',
'O',
131 'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
132 'X',
'Y',
'Z',
'[',
'\\',
']',
'^',
'_',
133 '`',
'a',
'b',
'c',
'd',
'e',
'f',
'g',
134 'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
135 'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
136 'x',
'y',
'z',
'{',
'|',
'}',
'~',
'<',
138 '<',
'=',
'>',
'#',
'#',
'.',
'#',
'#',
139 '#',
'#',
' ',
'#',
' ',
'>',
'.',
'.',
140 '[',
']',
'0',
'1',
'2',
'3',
'4',
'5',
141 '6',
'7',
'8',
'9',
'.',
'<',
'=',
'>',
142 ' ',
'!',
'"',
'#',
'$',
'%',
'&',
'\'',
143 '(',
')',
'*',
'+',
',',
'-',
'.',
'/',
144 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
145 '8',
'9',
':',
';',
'<',
'=',
'>',
'?',
146 '@',
'A',
'B',
'C',
'D',
'E',
'F',
'G',
147 'H',
'I',
'J',
'K',
'L',
'M',
'N',
'O',
148 'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
149 'X',
'Y',
'Z',
'[',
'\\',
']',
'^',
'_',
150 '`',
'a',
'b',
'c',
'd',
'e',
'f',
'g',
151 'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
152 'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
153 'x',
'y',
'z',
'{',
'|',
'}',
'~',
'<'
173 else if (*in >=
'0' && *in <=
'9')
185 if ( isxdigit(in[1]) && isxdigit(in[2]) && isxdigit(in[3]) )
214 buf->lines_count = 0;
245 if(
buf->lines_count >= 1)
250 for(
i = 0;
i <
buf->lines_count; ++
i)
265 if(
buf->lines_count == 0)
268 buf->lines_first = (
buf->lines_first + 1) %
buf->maxlines;
280 if(
buf->lines_count == 0)
295 if(len >
buf->textsize)
297 if(
buf->lines_count == 0)
301 char *firstline_start =
buf->lines[
buf->lines_first].start;
304 if(firstline_start < lastline_onepastend)
307 if(len <= buf->text +
buf->textsize - lastline_onepastend)
308 return lastline_onepastend;
310 else if(len <= firstline_start - buf->text)
317 if(len <= firstline_start - lastline_onepastend)
318 return lastline_onepastend;
343 if(len >=
buf->textsize)
347 line += len -
buf->textsize + 1;
348 len =
buf->textsize - 1;
352 memcpy(putpos, line, len);
370 start =
buf->lines_count;
371 for(
i = start - 1;
i >= 0; --
i)
375 if((l->
mask & mask_must) != mask_must)
377 if(l->
mask & mask_mustnot)
407cvar_t log_dest_udp = {
CF_CLIENT |
CF_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"};
431 qbool have_opened_temp_sockets =
false;
439 have_opened_temp_sockets =
true;
453 if(have_opened_temp_sockets)
476 static char timestamp [128];
483 char timestring [64];
488 localtime_s (&crt_tm, &crt_time);
489 strftime (timestring,
sizeof (timestring),
"%a %b %d %H:%M:%S %Y", &crt_tm);
491 crt_tm = localtime (&crt_time);
492 strftime (timestring,
sizeof (timestring),
"%a %b %d %H:%M:%S %Y", crt_tm);
496 dpsnprintf (timestamp,
sizeof (timestamp),
"====== %s (%s) ======\n", desc, timestring);
498 dpsnprintf (timestamp,
sizeof (timestamp),
"====== %s ======\n", timestring);
586 static qbool inprogress =
false;
598 size_t len =
strlen (msg);
604 unsigned char* newqueue;
635 memcpy (sanitizedmsg, msg, len);
655void Log_Printf (
const char *logfilename,
const char *fmt, ...)
664 va_start (argptr, fmt);
825 memcpy (sanitizedmsg,
CON_LINES(
i).start, len);
875#if defined(__linux__)
965 static int cr_pending = 0;
967 static int bufpos = 0;
993 buf[bufpos++] = *txt;
1101 float r = ((
float)_r)/255.0;
1102 float g = ((
float)_g)/255.0;
1103 float b = ((
float)_b)/255.0;
1163 static unsigned mask = 0;
1164 static unsigned index = 0;
1183 if (*msg == 1 || *msg == 2 || *msg == 3)
1198 if (*msg == 1 || *msg == 3)
1202 line[
index++] =
'3';
1210 mask |= additionalmask;
1213 line[
index++] = *msg;
1216 if (*msg ==
'\n' ||
index >= (
int)
sizeof(line) / 2)
1239 if(ch >= 0xE000 && ch <= 0xE0FF && ((
unsigned char)
qfont_table[ch - 0xE000]) >= 0x20)
1243 memmove(p+1, q,
strlen(q)+1);
1259 char printline[
sizeof(line) * 11];
1265 for(in = line, out = printline; *in; ++in)
1274 for (
int i = 0;
i < 3; ++
i)
1276 if (isdigit(
rgb[
i]))
rgb[
i] -=
'0';
1277 else rgb[
i] = tolower(
rgb[
i]) - 87;
1289 if (lastcolor ==
color)
1295 for (
int i = 0;
i < 3; ++
i)
1300 memcpy(out,
"\x1B[1;38;2", 8);
1302 memcpy(out,
"\x1B[0;38;2", 8);
1304 for (
int i = 0;
i < 3; ++
i)
1307 p = out += ((
rgb[
i] > 99) ? 3 : (
rgb[
i] > 9) ? 2 : 1);
1308 do { *--p = (
rgb[
i] % 10) +
'0';
1309 }
while ((
rgb[
i] /= 10) > 0);
1342 if(lastcolor == 0)
break;
else lastcolor = 0;
1343 *out++ = 0x1B; *out++ =
'['; *out++ =
'm';
1348 if(lastcolor == 1)
break;
else lastcolor = 1;
1349 *out++ = 0x1B; *out++ =
'['; *out++ =
'1'; *out++ =
';'; *out++ =
'3'; *out++ =
'1'; *out++ =
'm';
1354 if(lastcolor == 2)
break;
else lastcolor = 2;
1355 *out++ = 0x1B; *out++ =
'['; *out++ =
'1'; *out++ =
';'; *out++ =
'3'; *out++ =
'2'; *out++ =
'm';
1360 if(lastcolor == 3)
break;
else lastcolor = 3;
1361 *out++ = 0x1B; *out++ =
'['; *out++ =
'1'; *out++ =
';'; *out++ =
'3'; *out++ =
'3'; *out++ =
'm';
1366 if(lastcolor == 4)
break;
else lastcolor = 4;
1367 *out++ = 0x1B; *out++ =
'['; *out++ =
'1'; *out++ =
';'; *out++ =
'3'; *out++ =
'4'; *out++ =
'm';
1372 if(lastcolor == 5)
break;
else lastcolor = 5;
1373 *out++ = 0x1B; *out++ =
'['; *out++ =
'1'; *out++ =
';'; *out++ =
'3'; *out++ =
'6'; *out++ =
'm';
1378 if(lastcolor == 6)
break;
else lastcolor = 6;
1379 *out++ = 0x1B; *out++ =
'['; *out++ =
'1'; *out++ =
';'; *out++ =
'3'; *out++ =
'5'; *out++ =
'm';
1386 if(lastcolor == 8)
break;
else lastcolor = 8;
1387 *out++ = 0x1B; *out++ =
'['; *out++ =
'0'; *out++ =
';'; *out++ =
'1'; *out++ =
'm';
1397 *out++ = 0x1B; *out++ =
'['; *out++ =
'm';
1425 for(in = line, out = printline; *in; ++in)
1433 if ( isxdigit(in[2]) && isxdigit(in[3]) && isxdigit(in[4]) )
1492 va_start(argptr,fmt);
1519 va_start(argptr,fmt);
1552 va_start(argptr,fmt);
1572 assert(barsize >= 5);
1574 len =
min(len, (
int)barsize - 2);
1578 memset(&bar[1],
'\36', len - 2);
1579 bar[len - 1] =
'\37';
1605 char *msgCursor, *lineEnding;
1606 int lineLength, msgLength;
1609 va_start(argptr, fmt);
1610 msgLength =
dpvsnprintf(msg,
sizeof (msg), fmt, argptr);
1621 for (msgCursor = msg; *msgCursor;)
1623 lineEnding = strchr(msgCursor,
'\n');
1626 lineLength = lineEnding - msgCursor;
1631 lineLength = msgLength;
1632 lineEnding = msgCursor + lineLength;
1635 if (lineLength < maxLineLength)
1637 indentSize =
min(
sizeof(spaces) - 1, (
size_t)(maxLineLength - lineLength) / 2);
1638 memset(spaces,
' ', indentSize);
1639 spaces[indentSize] = 0;
1644 msgLength -= lineEnding - msgCursor;
1645 msgCursor = lineEnding;
1686 int y,
i, col_out, linepos, text_start, prefix_start = 0;
1720 if(text[linepos] != 0)
1722 for(
i=1;
i < 5 && linepos -
i > 0; ++
i)
1725 int caret_pos,
ofs = 0;
1726 caret_pos = linepos -
i;
1729 else if(
i == 1 && isdigit(text[caret_pos+1]))
1731 else if(text[caret_pos+1] ==
STRING_COLOR_RGB_TAG_CHAR && isxdigit(text[caret_pos+2]) && isxdigit(text[caret_pos+3]) && isxdigit(text[caret_pos+4]))
1733 if(
ofs && (
size_t)(
y +
ofs + 1) <
sizeof(text))
1736 while(caret_pos - carets >= 1 && text[caret_pos - carets] ==
STRING_COLOR_TAG)
1742 memmove(&text[caret_pos +
ofs + 1], &text[caret_pos],
y - caret_pos);
1767 else if (!is_console)
1768 prefix_start -= (
x - text_start);
1771 DrawQ_String(prefix_start,
v,
prefix, 0, inputsize, inputsize, 1.0, 1.0, 1.0, 1.0, 0,
NULL,
false, fnt);
1773 DrawQ_String(text_start,
v, text,
y + 3, inputsize, inputsize, 1.0, 1.0, 1.0, 1.0, 0,
NULL,
false, fnt);
1789 memcpy(text, curbuf, len);
1792 DrawQ_String(text_start + xo,
v, text, 0, inputsize, inputsize, 1.0, 1.0, 1.0, 1.0, 0, &col_out,
false, fnt);
1822 else if(maxWidth == -1)
1826 Sys_Printf(
"Con_WordWidthFunc: can't get here (maxWidth should never be %f)\n", maxWidth);
1838 (
void) isContinuation;
1846 if(ti->
y < ti->
ymin - 0.001)
1854 x = (
int)
DrawQ_String(
x, ti->
y, ti->
continuationString,
strlen(ti->
continuationString), ti->
fontsize, ti->
fontsize, 1.0, 1.0, 1.0, 1.0, 0,
NULL,
false, ti->
font);
1856 DrawQ_String(
x, ti->
y, line,
length, ti->
fontsize, ti->
fontsize, 1.0, 1.0, 1.0, 1.0, 0, &(ti->
colorindex),
false, ti->
font);
1863static int Con_DrawNotifyRect(
unsigned mask_must,
unsigned mask_mustnot,
float maxage,
float x,
float y,
float width,
float height,
float fontsize,
float alignment_x,
float alignment_y,
const char *continuationString)
1870 int continuationWidth = 0;
1885 len =
strlen(continuationString);
1895 if((l->
mask & mask_must) != mask_must)
1897 if(l->
mask & mask_mustnot)
1899 if(maxage && (l->
addtime < t - maxage))
1905 if(lines + mylines >= maxlines)
1907 nskip = lines + mylines - maxlines;
1918 ti.
y =
y + alignment_y * (
height - lines * fontsize) - nskip * fontsize;
1925 if((l->
mask & mask_must) != mask_must)
1927 if(l->
mask & mask_mustnot)
1929 if(maxage && (l->
addtime < t - maxage))
1948 float chatstart, notifystart, inputsize,
height;
1983 else if(chatpos > 0)
2003 v = notifystart +
con_notifysize.
value *
Con_DrawNotifyRect(0,
CON_MASK_INPUT |
CON_MASK_HIDENOTIFY | (numChatlines ?
CON_MASK_CHAT : 0) |
CON_MASK_DEVELOPER,
con_notifytime.
value, 0, notifystart,
vid_conwidth.
value,
con_notify.
value *
con_notifysize.
value,
con_notifysize.
value, align, 0.0,
"");
2020 Con_DrawNotifyRect(
CON_MASK_CHAT,
CON_MASK_INPUT,
con_chattime.
value,
x,
v,
vid_conwidth.
value *
con_chatwidth.
value,
height,
con_chatsize.
value, 0.0, 1.0,
"^3 ... ");
2064static int Con_DrawConsoleLine(
unsigned mask_must,
unsigned mask_mustnot,
float y,
int lineno,
float ymin,
float ymax)
2070 if((li->
mask & mask_must) != mask_must)
2072 if((li->
mask & mask_mustnot) != 0)
2140 float alpha, alpha0;
2144 cachepic_t *conbackpic;
2145 unsigned int conbackflags;
2166 if (sx != 0 || sy != 0)
2211 DrawQ_String(
vid_conwidth.
integer -
DrawQ_TextWidth(
engineversion, 0,
con_textsize.
value,
con_textsize.
value,
false,
FONT_CONSOLE), lines -
con_textsize.
value,
engineversion, 0,
con_textsize.
value,
con_textsize.
value, 1, 0, 0, 1, 0,
NULL,
true,
FONT_CONSOLE);
2233 int i, last, limitlast;
2282 unsigned char buf[1024];
2306 int lumpofs = 0, lumplen = 0;
2307 char *entities =
NULL;
2319 memset(
buf, 0, 1024);
2321 if (!memcmp(
buf,
"IBSP", 4))
2329 dpsnprintf(desc,
sizeof(desc),
"Q3BSP%i", p);
2336 dpsnprintf(desc,
sizeof(desc),
"Q2BSP%i", p);
2353 else if (!memcmp(
buf,
"BSP2", 4))
2359 else if (!memcmp(
buf,
"2PSB", 4))
2365 else if(!memcmp(
buf,
"VBSP", 4))
2375 memcpy(entfilename +
strlen(entfilename) - 4,
".ent", 5);
2377 if (!entities && lumplen >= 10)
2380 entities = (
char *)
Z_Malloc(lumplen + 1);
2407 if (!strcmp(keyname,
"message"))
2434 if(p > o && completedname && completednamebufferlength > 0)
2436 memset(completedname, 0, completednamebufferlength);
2437 memcpy(completedname, (t->
filenames[0]+5),
min(p, completednamebufferlength - 1));
2455 const char **walk = list;
2467 if (pos + maxlen >=
width) {
2473 for (
i = 0;
i < (maxlen - len);
i++)
2497 if(tolower(*
a) == tolower(*
b))
2511 return (*
a < *
b) ? -1 : 1;
2515 return (*
a < *
b) ? -1 : 1;
2526 return strncasecmp(
a,
b, a_len);
2535 qbool alnum_a, alnum_b;
2537 if(tolower(*
a) == tolower(*
b))
2552 alnum_a = ( (*
a >=
'a' && *
a <=
'z') || (*
a >=
'A' && *
a <=
'Z') || (*
a >=
'0' && *
a <=
'9') || *
a == space_char);
2553 alnum_b = ( (*
b >=
'a' && *
b <=
'z') || (*
b >=
'A' && *
b <=
'Z') || (*
b >=
'0' && *
b <=
'9') || *
b == space_char);
2555 return (*
a < *
b) ? -1 : 1;
2560 return (*
a < *
b) ? -1 : 1;
2602 if(spos > 0 && line[spos-1] !=
' ' && line[spos-1] !=
';' && line[spos-1] !=
'\"' && line[spos-1] !=
'\'')
2604 if(!(isCon && spos == 1))
2610 if(isCon && spos == 0)
2655 for(l = 0; l <= c; ++l)
2671 if( (*s >=
'a' && *s <=
'z') ||
2672 (*s >=
'A' && *s <=
'Z') ||
2673 (*s >=
'0' && *s <=
'9') ||
2691 for(
i = 0, l = 0;
i < (
int)c; ++
i)
2715 if(tolower(*
a) == tolower(*
b))
2721 if( (*
b >=
'a' && *
b <=
'z') || (*
b >=
'A' && *
b <=
'Z') || (*
b >=
'0' && *
b <=
'9') || *
b == space_char)
2749 for(
i = 0, l = 0;
i < (
int)c; ++
i)
2771 if(tolower(*
a) == tolower(*
b))
2813 for(; bpos <
count; ++bpos)
2828 qbool quote_added =
false;
2831 char r = 0,
g = 0,
b = 0;
2848 if( isdigit(
buffer[match+1]) )
2855 if ( isxdigit(
buffer[match+2]) && isxdigit(
buffer[match+3]) && isxdigit(
buffer[match+4]) )
2900 const char *text =
"";
2902 const char **list[4] = {0, 0, 0, 0};
2905 int c,
v,
a,
i, cmd_len, pos, k;
2907 const char *space, *patterns;
2911 int linestart, linepos;
2912 unsigned int linesize;
2930 while(--pos >= linestart)
2933 if(k ==
'\"' || k ==
';' || k ==
' ' || k ==
'\'')
2942 c =
v =
a =
n = cmd_len = 0;
2946 space = strchr(line + 1,
' ');
2947 if(space && pos == (space - line) + 1)
2950 dp_ustr2stp(command,
sizeof(command), line + 1, space - (line + 1));
2953 if(patterns && !*patterns)
2956 if(!strcmp(command,
"map") || !strcmp(command,
"changelevel") || (patterns && !strcmp(patterns,
"map")))
2971 if(linepos > (
int)
strlen(line))
3013 const char *slash = strrchr(s,
'/');
3016 dp_strlcpy(t, s,
min(
sizeof(t), (
unsigned int)(slash - s + 2)));
3036 const char *slash = strrchr(s,
'/');
3039 dp_strlcpy(t, s,
min(
sizeof(t), (
unsigned int)(slash - s + 2)));
3058 unsigned int matchchars;
3080 matchchars =
sizeof(t) - 1;
3085 for(; *p && *p == *q; ++p, ++q);
3086 matchchars = (
unsigned int)(p - resultbuf.
strings[0]);
3092 for(; *p && *p == *q; ++p, ++q);
3093 matchchars =
min(matchchars, (
unsigned int)(p - dirbuf.
strings[0]));
3111 if(linepos > (
int)
strlen(line))
3126 Con_Printf(
"\n%i possible command%s\n", c, (c > 1) ?
"s: " :
":");
3132 Con_Printf(
"\n%i possible variable%s\n",
v, (
v > 1) ?
"s: " :
":");
3138 Con_Printf(
"\n%i possible alias%s\n",
a, (
a > 1) ?
"es: " :
":");
3146 Con_Printf(
"\n%i possible nick%s\n",
n, (
n > 1) ?
"s: " :
":");
3150 if (!(c +
v +
a +
n))
3153 dp_strlcpy(&line[linepos], s2, linesize - linepos);
3171 for (cmd_len = (
int)
strlen(s);;cmd_len++)
3174 for (
i = 0;
i < 3;
i++)
3176 for (l = list[
i];*l;l++)
3177 if ((*l)[cmd_len] != text[cmd_len])
3190 cmd_len =
min(cmd_len, (
int)linesize - 1 - pos);
3194 memcpy(&line[linepos], text, cmd_len);
3197 if (c +
v +
a +
n == 1 && linepos < (
int)linesize - 1)
3203 cmd_len =
min(cmd_len, (
int)linesize - 3 - pos);
3205 memcpy(&line[linepos] ,
Nicks_list[0], cmd_len);
3207 if(linepos < (
int)(linesize - 7))
3210 line[linepos++] =
' ';
3222 for (
i = 0;
i < 4;
i++)
cvar_t scr_conalphafactor
cvar_t scr_conalpha2factor
cvar_t scr_conalpha3factor
void Cmd_CompleteCommandPrint(cmd_state_t *cmd, const char *partial)
const char ** Cmd_CompleteBuildList(cmd_state_t *cmd, const char *partial)
int Cmd_CompleteCountPossible(cmd_state_t *cmd, const char *partial)
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
void Cmd_CompleteAliasPrint(cmd_state_t *cmd, const char *partial)
int Cmd_CompleteAliasCountPossible(cmd_state_t *cmd, const char *partial)
const char ** Cmd_CompleteAliasBuildList(cmd_state_t *cmd, const char *partial)
#define CF_SERVER
cvar/command that only the server can change/execute
static int Cmd_Argc(cmd_state_t *cmd)
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
#define CF_CLIENT
cvar/command that only the client can change/execute
static const char * Cmd_Args(cmd_state_t *cmd)
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
#define CF_PRIVATE
cvar should not be $ expanded or sent to the server under any circumstances (rcon_password,...
#define IS_OLDNEXUIZ_DERIVED(g)
int BuffLittleLong(const unsigned char *buffer)
Extract a little endian 32bit int from the given buffer.
void StoreBigLong(unsigned char *buffer, unsigned int i)
Encode a big endian 32bit int to the given buffer.
int dpvsnprintf(char *buffer, size_t buffersize, const char *format, va_list args)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
char * dp_ustr2stp(char *dst, size_t dsize, const char *src, size_t slen)
Copies a measured byte sequence (unterminated string) to a null-terminated string.
int COM_Wordwrap(const char *string, size_t length, float continuationWidth, float maxWidth, COM_WordWidthFunc_t wordWidth, void *passthroughCW, COM_LineProcessorFunc processLine, void *passthroughPL)
char com_token[MAX_INPUTLINE]
char * va(char *buf, size_t buflen, const char *format,...)
qbool COM_ParseToken_Console(const char **datapointer)
qbool COM_ParseToken_Simple(const char **datapointer, qbool returnnewline, qbool parsebackslash, qbool parsecomments)
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
#define dp_strlcat(dst, src, dsize)
#define dp_strlcpy(dst, src, dsize)
void Con_Clear_f(cmd_state_t *cmd)
cvar_t con_chatsound_team_file
static char Nicks_sanlist[MAX_SCOREBOARD][MAX_SCOREBOARDNAME]
static void Nicks_CutMatchesNoSpaces(int count)
const char * ConBuffer_GetLine(conbuffer_t *buf, int i)
static void Con_MessageMode_f(cmd_state_t *cmd)
void Con_CenterPrint(const char *str)
Prints a center-aligned message to the console.
cvar_t sys_specialcharactertranslation
static void Con_DrawInput(qbool is_console, float x, float v, float inputsize)
static void Con_CommandMode_f(cmd_state_t *cmd)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
static void Con_Rcon_AddChar(int c)
Adds a character to the rcon buffer.
void ConBuffer_FixTimes(conbuffer_t *buf)
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
static unsigned int Nicks_strcleanlen(const char *s)
static void Log_Open(void)
static void Con_ConDump_f(cmd_state_t *cmd)
static int Con_CountLineFunc(void *passthrough, const char *line, size_t length, float width, qbool isContinuation)
qbool GetMapList(const char *s, char *completedname, int completednamebufferlength)
void Con_MaskPrintf(unsigned mask, const char *fmt,...)
void ConBuffer_Clear(conbuffer_t *buf)
int rcon_redirect_bufferpos
void Con_DrawNotify(void)
static int Nicks_AddLastColor(char *buffer, int pos)
static void Con_MessageMode2_f(cmd_state_t *cmd)
cvar_t con_completion_exec
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
static int Nicks_strncasecmp(char *a, char *b, unsigned int a_len)
static char Sys_Con_NearestColor(const unsigned char _r, const unsigned char _g, const unsigned char _b)
Convert an RGB color to its nearest quake color.
void Con_DrawConsole(int lines, qbool forcedfullscreen)
void ConBuffer_Shutdown(conbuffer_t *buf)
#define NICKS_ALPHANUMERICS_ONLY
void ConBuffer_DeleteLine(conbuffer_t *buf)
Deletes the first line from the console history.
void Con_MaskPrint(unsigned additionalmask, const char *msg)
Prints to a chosen console target.
static int Nicks_CompleteCountPossible(char *line, int pos, char *s, qbool isCon)
int ConBuffer_FindPrevLine(conbuffer_t *buf, unsigned mask_must, unsigned mask_mustnot, int start)
static int Con_DrawConsoleLine(unsigned mask_must, unsigned mask_mustnot, float y, int lineno, float ymin, float ymax)
lhnetaddress_t * rcon_redirect_dest
char crt_log_file[MAX_OSPATH]
cvar_t condump_stripcolors
#define NICKS_FORCE_COLOR
static void Con_Maps_f(cmd_state_t *cmd)
cvar_t con_nickcompletion_flags
static void Con_LastVisibleLine(unsigned mask_must, unsigned mask_mustnot, int *last, int *limitlast)
void Con_CenterPrintf(int maxLineLength, const char *fmt,...)
Left-pad a string with spaces to make it appear centered.
static void Nicks_CutMatchesNormal(int count)
static void Con_RCon_ClearPassword_c(cvar_t *var)
void ConBuffer_DeleteLastLine(conbuffer_t *buf)
Deletes the last line from the console history.
static void Con_PrintToHistory(const char *txt, int mask)
cvar_t rcon_secure_challengetimeout
static const char * Log_Timestamp(const char *desc)
cvar_t con_completion_playdemo
static void Log_DestBuffer_Init(void)
void Con_ClearNotify(void)
Clear all notify lines.
static int Con_LineHeight(int lineno)
static int Con_DrawNotifyRect(unsigned mask_must, unsigned mask_mustnot, float maxage, float x, float y, float width, float height, float fontsize, float alignment_x, float alignment_y, const char *continuationString)
int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
wrapper function to attempt to either complete the command line or to list possible matches grouped b...
unsigned int log_dest_buffer_appending
void Con_Rcon_Redirect_Init(lhnetsocket_t *sock, lhnetaddress_t *dest, qbool proquakeprotocol)
size_t log_dest_buffer_pos
static void Nicks_CutMatches(int count)
void ConBuffer_AddLine(conbuffer_t *buf, const char *line, int len, unsigned mask)
Appends a given string as a new line to the console.
void Log_DestBuffer_Flush(void)
call this once per frame to send out replies to rcon streaming clients
void Con_DPrint(const char *msg)
A Con_Print that only shows up if the "developer" cvar is set.
static void Cmd_CompleteNicksPrint(int count)
cvar_t log_file_stripcolors
cvar_t con_nickcompletion
void Con_Rcon_Redirect_End(void)
static int Nicks_matchpos
char rcon_redirect_buffer[1400]
cvar_t con_chatsound_team_mask
static const char ** Nicks_CompleteBuildList(int count)
static int Nicks_strncasecmp_nospaces(char *a, char *b, unsigned int a_len)
static void Nicks_CutMatchesAlphaNumeric(int count)
static void Con_Rcon_Redirect_Flush(void)
static int Nicks_offset[MAX_SCOREBOARD]
static float Con_WordWidthFunc(void *passthrough, const char *w, size_t *length, float maxWidth)
void Con_Rcon_Redirect_Abort(void)
cvar_t con_completion_timedemo
void ConBuffer_Init(conbuffer_t *buf, int textsize, int maxlines, mempool_t *mempool)
static char Nicks_list[MAX_SCOREBOARD][MAX_SCOREBOARDNAME]
const char * Con_Quakebar(int len, char *bar, size_t barsize)
Returns a horizontal line.
cvar_t sys_colortranslation
void Con_CheckResize(void)
If the line width has changed, reformat the buffer.
static void SanitizeString(char *in, char *out)
lhnetsocket_t * rcon_redirect_sock
static char qfont_table[256]
cvar_t con_chatsound_file
char log_dest_buffer[1400]
static void Log_DestBuffer_Flush_NoLock(void)
void Con_DisplayList(const char **list)
Generic libs/util/console.c function to display a list formatted in columns on the console.
static void Con_MsgCmdMode(cmd_state_t *cmd, signed char mode)
static int Con_DisplayLineFunc(void *passthrough, const char *line, size_t length, float width, qbool isContinuation)
void Con_ToggleConsole_f(cmd_state_t *cmd)
qbool rcon_redirect_proquakeprotocol
static char * ConBuffer_BytesLeft(conbuffer_t *buf, int len)
void Log_Printf(const char *logfilename, const char *fmt,...)
void Log_ConPrint(const char *msg)
#define CONBUFFER_LINES(buf, i)
#define CON_MASK_HIDENOTIFY
#define CONBUFFER_LINES_LAST(buf)
#define CON_MASK_DEVELOPER
void Cvar_SetValueQuick(cvar_t *var, float value)
void Cvar_SetQuick(cvar_t *var, const char *value)
const char * Cvar_VariableString(cvar_state_t *cvars, const char *var_name, unsigned neededflags)
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
const char ** Cvar_CompleteBuildList(cvar_state_t *cvars, const char *partial, unsigned neededflags)
void Cvar_CompleteCvarPrint(cvar_state_t *cvars, const char *partial, unsigned neededflags)
int Cvar_CompleteCountPossible(cvar_state_t *cvars, const char *partial, unsigned neededflags)
void Cvar_RegisterCallback(cvar_t *variable, void(*callback)(cvar_t *))
char engineversion[128]
version string for the corner of the console, crash messages, status command, etc
@ CACHEPICFLAG_FAILONMISSING
float DrawQ_TextWidth_UntilWidth_TrackColors(const char *text, size_t *maxlen, float w, float h, int *outcolor, qbool ignorecolorcodes, const dp_font_t *fnt, float maxwidth)
void DrawQ_Fill(float x, float y, float width, float height, float red, float green, float blue, float alpha, int flags)
#define STRING_COLOR_RGB_TAG_CHAR
void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height, float s1, float t1, float r1, float g1, float b1, float a1, float s2, float t2, float r2, float g2, float b2, float a2, float s3, float t3, float r3, float g3, float b3, float a3, float s4, float t4, float r4, float g4, float b4, float a4, int flags)
float DrawQ_String(float x, float y, const char *text, size_t maxlen, float scalex, float scaley, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor, qbool ignorecolorcodes, const dp_font_t *fnt)
const vec4_t string_colors[]
color tag printing
cachepic_t * Draw_CachePic_Flags(const char *path, unsigned int cachepicflags)
float DrawQ_TextWidth(const char *text, size_t maxlen, float w, float h, qbool ignorecolorcodes, const dp_font_t *fnt)
float DrawQ_TextWidth_UntilWidth(const char *text, size_t *maxlen, float w, float h, qbool ignorecolorcodes, const dp_font_t *fnt, float maxWidth)
#define STRING_COLOR_DEFAULT
qbool Draw_IsPicLoaded(cachepic_t *pic)
void stringlistfreecontents(stringlist_t *list)
void stringlistinit(stringlist_t *list)
void stringlistsort(stringlist_t *list, qbool uniq)
void stringlistappend(stringlist_t *list, const char *text)
fs_offset_t FS_Read(qfile_t *file, void *buffer, size_t buffersize)
qfile_t * FS_OpenVirtualFile(const char *filepath, qbool quiet)
fs_offset_t FS_Write(qfile_t *file, const void *data, size_t datasize)
unsigned char * FS_LoadFile(const char *path, mempool_t *pool, qbool quiet, fs_offset_t *filesizepointer)
void FS_FreeSearch(fssearch_t *search)
fssearch_t * FS_Search(const char *pattern, int caseinsensitive, int quiet, const char *packfile)
int FS_VPrintf(qfile_t *file, const char *format, va_list ap)
int FS_Seek(qfile_t *file, fs_offset_t offset, int whence)
qfile_t * FS_OpenRealFile(const char *filepath, const char *mode, qbool quiet)
int FS_FileType(const char *filename)
Look for a file in the packages and in the filesystem.
static int(ZEXPORT *qz_inflate)(z_stream *strm
int FS_Close(qfile_t *file)
int FS_Print(qfile_t *file, const char *msg)
#define FS_FILETYPE_DIRECTORY
GLenum GLsizei GLsizei height
GLubyte GLubyte GLubyte GLubyte w
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei const GLfloat * value
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLenum GLint GLint y
GLsizeiptr const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
char chat_buffer[MAX_INPUTLINE]
char key_line[MAX_INPUTLINE]
#define KEY_CONSOLEACTIVE_USER
int LHNETADDRESS_FromString(lhnetaddress_t *vaddress, const char *string, int defaultport)
#define bound(min, num, max)
#define VectorCopy(in, out)
#define VectorScale(in, scale, out)
#define Q3BSPVERSION_LIVE
int NetConn_Write(lhnetsocket_t *mysocket, const void *data, int length, const lhnetaddress_t *peeraddress)
int NetConn_WriteString(lhnetsocket_t *mysocket, const char *string, const lhnetaddress_t *peeraddress)
lhnetsocket_t * NetConn_ChooseClientSocketForAddress(lhnetaddress_t *address)
qbool NetConn_HaveServerPorts(void)
lhnetsocket_t * NetConn_ChooseServerSocketForAddress(lhnetaddress_t *address)
qbool NetConn_HaveClientPorts(void)
void NetConn_OpenServerPorts(int opennetports)
void NetConn_CloseServerPorts(void)
#define NETFLAG_LENGTH_MASK
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
#define MAX_OSPATH
max length of a filesystem pathname
#define CON_TEXTSIZE
max scrollback buffer characters in console
#define MAX_SCOREBOARDNAME
max length of player name in game
#define MAX_QPATH
max length of a quake game pathname
#define CON_MAXLINES
max scrollback buffer lines in console
#define MAX_SCOREBOARD
max number of players in game at once (255 protocol limit)
qbool S_LocalSound(const char *sound)
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
double addtime
used only by console.c
int height
recalculated line height when needed (-1 to unset)
const char * continuationString
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
char name[MAX_SCOREBOARDNAME]
size_t Sys_TimeString(char buf[], size_t bufsize, const char *timeformat)
void Sys_Print(const char *text, size_t textlen)
(may) output text to terminal which launched program is POSIX async-signal-safe textlen excludes any ...
void Sys_Printf(const char *fmt,...)
used to report failures inside Con_Printf()
int Sys_CheckParm(const char *parm)
#define Thread_DestroyMutex(m)
qbool Thread_HasThreads(void)
#define Thread_CreateMutex()
#define Thread_LockMutex(m)
#define Thread_UnlockMutex(m)
char * u8_encodech(Uchar ch, size_t *l, char *buf16)
uses u8_fromchar on a static buffer
#define Mem_Alloc(pool, size)