X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=console.c;h=a991bad28fbe09ce50a3e758be9d082ea2f9d455;hb=e7ef373ea245bbf09343cae82f2af0ae3d2cd815;hp=bb971ad4d46e9062e5447d559f9d9dc2f39d3316;hpb=7139b3ada26cb263795aa7f965197428c4c7ea7d;p=xonotic%2Fdarkplaces.git diff --git a/console.c b/console.c index bb971ad4..a991bad2 100644 --- a/console.c +++ b/console.c @@ -201,29 +201,32 @@ void Con_CheckResize (void) } -/* -================ -Con_Init -================ -*/ -void Con_Init (void) +void Con_InitLogging (void) { #define MAXGAMEDIRLEN 1000 char temp[MAXGAMEDIRLEN+1]; char *t2 = "/qconsole.log"; - Cvar_RegisterVariable(&logfile); con_debuglog = COM_CheckParm("-condebug"); - if (con_debuglog) { - if (strlen (com_gamedir) < (MAXGAMEDIRLEN - strlen (t2))) + if (strlen (fs_gamedir) < (MAXGAMEDIRLEN - strlen (t2))) { - sprintf (temp, "%s%s", com_gamedir, t2); + sprintf (temp, "%s%s", fs_gamedir, t2); unlink (temp); } logfile.integer = 1; } +} + +/* +================ +Con_Init +================ +*/ +void Con_Init (void) +{ + Cvar_RegisterVariable(&logfile); console_mempool = Mem_AllocPool("console"); con_text = Mem_Alloc(console_mempool, CON_TEXTSIZE); @@ -355,16 +358,16 @@ void Con_Print (const char *txt) Con_DebugLog ================ */ -void Con_DebugLog(const char *file, const char *fmt, ...) +void Con_DebugLog (const char *msg) { - va_list argptr; - FILE* fd; - - fd = fopen(file, "at"); - va_start(argptr, fmt); - vfprintf (fd, fmt, argptr); - va_end(argptr); - fclose(fd); + qfile_t* file; + + file = FS_Open ("qconsole.log", "at", true); + if (file) + { + FS_Printf (file, "%s", msg); + FS_Close (file); + } } @@ -387,17 +390,12 @@ void Con_Printf (const char *fmt, ...) vsprintf (msg,fmt,argptr); va_end (argptr); -// also echo to debugging console + // also echo to debugging console Sys_Printf ("%s", msg); -// log all messages to file + // log all messages to file if (con_debuglog) - { - // can't use va() here because it might overwrite other important things - char logname[MAX_OSPATH]; - sprintf(logname, "%s/qconsole.log", com_gamedir); - Con_DebugLog(logname, "%s", msg); - } + Con_DebugLog (msg); if (!con_initialized) return; @@ -405,7 +403,7 @@ void Con_Printf (const char *fmt, ...) if (cls.state == ca_dedicated) return; // no graphics mode -// write it to the scrollable buffer + // write it to the scrollable buffer Con_Print (msg); } @@ -579,7 +577,6 @@ Draws the console with the solid background The typing input line at the bottom should only be drawn if typing is allowed ================ */ -extern cvar_t scr_conalpha; extern char engineversion[40]; void Con_DrawConsole (int lines) { @@ -590,7 +587,10 @@ void Con_DrawConsole (int lines) return; // draw the background - DrawQ_Pic(0, lines - vid.conheight, "gfx/conback", vid.conwidth, vid.conheight, 1, 1, 1, scr_conalpha.value * lines / vid.conheight, 0); + if (scr_conbrightness.value >= 0.01f) + DrawQ_Pic(0, lines - vid.conheight, "gfx/conback", vid.conwidth, vid.conheight, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, scr_conalpha.value, 0); + else + DrawQ_Fill(0, lines - vid.conheight, vid.conwidth, vid.conheight, 0, 0, 0, scr_conalpha.value, 0); DrawQ_String(vid.conwidth - strlen(engineversion) * 8 - 8, lines - 8, engineversion, 0, 8, 8, 1, 0, 0, 1, 0); // draw the text