Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
24 #include "shared/shared.h"
26 #include "common/bsp.h"
27 #include "common/cmd.h"
28 #include "common/cmodel.h"
29 #include "common/common.h"
30 #include "common/cvar.h"
31 #include "common/error.h"
32 #include "common/field.h"
33 #include "common/fifo.h"
34 #include "common/files.h"
35 #include "common/math.h"
36 #include "common/mdfour.h"
37 #include "common/msg.h"
38 #include "common/net/net.h"
39 #include "common/net/chan.h"
40 #include "common/pmove.h"
41 #include "common/prompt.h"
42 #include "common/protocol.h"
43 #include "common/tests.h"
44 #include "common/utils.h"
45 #include "common/x86/fpu.h"
46 #include "common/zone.h"
49 #include "client/keys.h"
51 #include "system/system.h"
101 cvar_t *com_debug_break;
119 APPLICATION
" " VERSION_STRING
" " __DATE__
" " BUILDSTRING
" " CPUSTRING;
131 unsigned time_before_game;
132 unsigned time_after_game;
133 unsigned time_before_ref;
134 unsigned time_after_ref;
153 if (
rd_target || !target || !buffer || !buffersize || !flush) {
210 Com_Printf(
"Closing console log.\n");
218 char buffer[MAX_OSPATH];
222 mode =
logfile_enable->integer > 1 ? FS_MODE_APPEND : FS_MODE_WRITE;
240 Com_Printf(
"Logging console to %s\n", buffer);
261 static struct tm cached_tm;
262 static time_t cached_time;
273 if (now == cached_time) {
277 tm = localtime(&now);
285 return strftime(buffer, size, fmt, tm);
290 char text[MAXPRINTMSG];
302 case PRINT_TALK: *p =
'T';
break;
303 case PRINT_DEVELOPER: *p =
'D';
break;
304 case PRINT_WARNING: *p =
'W';
break;
305 case PRINT_ERROR: *p =
'E';
break;
306 case PRINT_NOTICE: *p =
'N';
break;
307 default: *p =
'A';
break;
319 maxp = text +
sizeof(text) - 1;
322 if (len > 0 && p + len < maxp) {
351 Com_EPrintf(
"Couldn't write console log: %s\n",
Q_ErrorString(ret));
365 void Com_FlushLogs(
void)
379 Sys_SetConsoleColor(
color);
407 char msg[MAXPRINTMSG];
417 va_start(argptr, fmt);
445 case PRINT_DEVELOPER:
465 Sys_ConsoleOutput(
msg);
468 OutputDebugStringA(
msg);
498 char msg[MAXERRORMSG];
505 if (com_debug_break && com_debug_break->integer) {
514 va_start(argptr, fmt);
540 if (code == ERR_DISCONNECT || code == ERR_RECONNECT) {
548 if (com_debug_break && com_debug_break->integer) {
558 if (code == ERR_DROP) {
559 Com_EPrintf(
"********************\n"
609 void Com_Quit(
const char *reason, error_type_t type)
611 char buffer[MAX_STRING_CHARS];
612 char *what = type == ERR_RECONNECT ?
"restarted" :
"quit";
614 if (reason && *reason) {
616 "Server %s: %s\n", what, reason);
619 "Server %s\n", what);
674 return Q_scnprintf(buffer, size,
"%d", rand_byte() % 10);
682 size_t len, total = 0;
685 for (i = 0; i < numFiles; i++) {
690 if (total + len + 1 < size) {
691 memcpy(buffer + total, s, len);
692 buffer[total + len] =
' ';
709 static void Com_Setenv_f(
void)
715 }
else if (argc == 2) {
719 Com_Printf(
"%s=%s\n",
Cmd_Argv(1), env);
721 Com_Printf(
"%s undefined\n",
Cmd_Argv(1));
724 Com_Printf(
"Usage: %s <name> [value]\n",
Cmd_Argv(0));
734 for (i = 0; i < 1024; i++) {
739 if (!var->string[0]) {
764 ctx->ignoredups = qtrue;
771 }
else if (argnum == 1 && (var =
Cvar_FindVar(s)) != NULL) {
781 void Com_Color_g(genctx_t *ctx)
816 if (strcmp(s,
"+set")) {
820 Com_Printf(
"Usage: +set <variable> <value>\n");
849 qboolean ret = qfalse;
881 if (ret == Q_ERR_SUCCESS) {
883 }
else if (ret != Q_ERR_NOENT) {
884 Com_WPrintf(
"Couldn't exec %s: %s\n", name,
Q_ErrorString(ret));
923 host_speeds =
Cvar_Get(
"host_speeds",
"0", 0);
926 developer =
Cvar_Get(
"developer",
"0", 0);
937 cl_running =
Cvar_Get(
"cl_running",
"0", CVAR_ROM);
938 cl_paused =
Cvar_Get(
"cl_paused",
"0", CVAR_ROM);
952 com_debug_break =
Cvar_Get(
"com_debug_break",
"0", 0);
1035 char *cmd = COM_DEDICATED ?
"dedicated_start" :
"client_start";
1050 if (COM_DEDICATED ||
backdoor->integer) {
1056 Com_Printf(
"====== " PRODUCT
" initialized ======\n\n");
1057 Com_LPrintf(PRINT_NOTICE, APPLICATION
" " VERSION_STRING
", " __DATE__
"\n");
1062 if (!strstr(newgame,
"demo1"))
1064 Com_WPrintf(
"\nWARNING: It looks like you have mixed game data files (.pak) from the shareware demo and the full game. The game might not function properly.\n\n");
1081 unsigned time_before, time_event, time_between, time_after;
1084 unsigned oldtime, msec;
1085 static unsigned remaining;
1093 time_before = time_event = time_between = time_after = 0;
1095 if (host_speeds->integer)
1125 Com_DPrintf(
"Hitch warning: %u msec frame time\n", msec);
1144 if (host_speeds->integer)
1156 if (host_speeds->integer)
1160 if (remaining > clientrem) {
1161 remaining = clientrem;
1164 if (host_speeds->integer)
1167 if (host_speeds->integer) {
1168 int all, ev,
sv, gm,
cl, rf;
1170 all = time_after - time_before;
1171 ev = time_event - time_before;
1172 sv = time_between - time_event;
1173 cl = time_after - time_between;
1174 gm = time_after_game - time_before_game;
1175 rf = time_after_ref - time_before_ref;
1179 Com_Printf(
"all:%3i ev:%3i sv:%3i gm:%3i cl:%3i rf:%3i\n",
1180 all, ev,
sv, gm,
cl, rf);
void Cmd_Alias_g(genctx_t *ctx)
static size_t rd_buffersize
void SV_Shutdown(const char *finalmsg, error_type_t type)
qerror_t Cmd_ExecuteFile(const char *path, unsigned flags)
cvar_t * Cvar_Set(const char *var_name, const char *value)
qhandle_t FS_EasyOpenFile(char *buf, size_t size, unsigned mode, const char *dir, const char *name, const char *ext)
size_t Com_TimeDiff(char *buffer, size_t size, time_t *p, time_t now)
static qboolean com_errorEntered
static void Com_LastError_f(void)
cvar_t * allow_download_players
void Com_AddConfigFile(const char *name, unsigned flags)
void Com_AbortFrame(void)
size_t Q_snprintf(char *dest, size_t size, const char *fmt,...)
xcompleter_t Cmd_FindCompleter(const char *name)
qboolean CL_ProcessEvents(void)
void Cmd_AddCommand(const char *name, xcommand_t function)
void Cmd_Command_g(genctx_t *ctx)
static int com_printEntered
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags)
const char * Q_ErrorString(qerror_t error)
const char *const colorNames[10]
void Com_AbortFunc(void(*func)(void *), void *arg)
static void Com_Recycle_f(void)
ssize_t FS_FPrintf(qhandle_t f, const char *format,...)
static void(* com_abort_func)(void *)
size_t Com_Time_m(char *buffer, size_t size)
static char com_errorMsg[MAXERRORMSG]
void Q_setenv(const char *name, const char *value)
static void Com_Quit_f(void)
static void logfile_param_changed(cvar_t *self)
void Com_LPrintf(print_type_t type, const char *fmt,...)
void SCR_EndLoadingPlaque(void)
static void logfile_enable_changed(cvar_t *self)
void Sys_AddDefaultConfig(void)
unsigned Sys_Milliseconds(void)
void Sys_Error(const char *error,...)
void CL_Disconnect(error_type_t type)
qboolean Prompt_AddMatch(genctx_t *ctx, const char *s)
static void logfile_write(print_type_t type, const char *s)
void Com_Generic_c(genctx_t *ctx, int argnum)
char * Cmd_ArgsFrom(int from)
void Cvar_Variable_g(genctx_t *ctx)
cvar_t * allow_download_maps
cvar_t * allow_download_textures
void Com_Error(error_type_t code, const char *fmt,...)
void Com_EndRedirect(void)
void Cbuf_AddText(cmdbuf_t *buf, const char *text)
char * va(const char *format,...)
void Con_Print(const char *txt)
static size_t format_local_time(char *buffer, size_t size, const char *fmt)
static void logfile_close(void)
void ** FS_ListFiles(const char *path, const char *filter, unsigned flags, int *count_p)
void Com_Address_g(genctx_t *ctx)
static size_t Com_MapList_m(char *buffer, size_t size)
static qhandle_t com_logFile
size_t Com_TimeDiffLong(char *buffer, size_t size, time_t *p, time_t now)
void(APIENTRY *qwglDrawBuffer)(GLenum mode)
void NET_Config(netflag_t flag)
size_t Q_strlcpy(char *dst, const char *src, size_t size)
static size_t Com_Random_m(char *buffer, size_t size)
char * Com_GetLastError(void)
char * Cmd_AliasCommand(const char *name)
size_t Com_UptimeLong_m(char *buffer, size_t size)
ssize_t FS_Write(const void *buf, size_t len, qhandle_t f)
const char com_version_string[]
cvar_t * allow_download_sounds
unsigned CL_Frame(unsigned msec)
void FS_Flush(qhandle_t f)
cvar_t * allow_download_others
static void Com_AbortRedirect(void)
static size_t Com_Date_m(char *buffer, size_t size)
static qboolean com_logNewline
static rdflush_t rd_flush
void Com_Quit(const char *reason, error_type_t type)
int Cvar_ClampInteger(cvar_t *var, int min, int max)
static void * com_abort_arg
void Com_SetLastError(const char *msg)
size_t Com_Uptime_m(char *buffer, size_t size)
size_t Q_vscnprintf(char *dest, size_t size, const char *fmt, va_list argptr)
void Com_SetColor(color_index_t color)
cvar_t * allow_download_pics
void Cbuf_Execute(cmdbuf_t *buf)
static void Com_AddEarlyCommands(qboolean clear)
void Qcommon_Init(int argc, char **argv)
void Con_SetColor(color_index_t color)
void Com_BeginRedirect(int target, char *buffer, size_t buffersize, rdflush_t flush)
void Cmd_AddMacro(const char *name, xmacro_t function)
void NET_UpdateStats(void)
cvar_t * Cvar_FindVar(const char *var_name)
cvar_t * Cvar_SetEx(const char *var_name, const char *value, from_t from)
void FS_FCloseFile(qhandle_t f)
cvar_t * allow_download_models
static void Com_Redirect(const char *msg, size_t total)
char * COM_FileExtension(const char *in)
size_t Q_scnprintf(char *dest, size_t size, const char *fmt,...)
unsigned SV_Frame(unsigned msec)
static qboolean Com_AddLateCommands(void)
static jmp_buf com_abortframe
static void logfile_open(void)
void Sys_DebugBreak(void)