X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=console.c;h=a991bad28fbe09ce50a3e758be9d082ea2f9d455;hb=020ac448eb9f40a6e13ea4b4ed611ab5cdefa7ea;hp=941e6124bbb59200cb660c5a2f4c2a7a048165a8;hpb=d9e87187d5f42201c03e94b8ca60db374282b3e7;p=xonotic%2Fdarkplaces.git diff --git a/console.c b/console.c index 941e6124..a991bad2 100644 --- a/console.c +++ b/console.c @@ -51,11 +51,12 @@ char *con_text = 0; //seconds cvar_t con_notifytime = {CVAR_SAVE, "con_notifytime","3"}; +cvar_t con_notify = {CVAR_SAVE, "con_notify","4"}; cvar_t logfile = {0, "logfile","0"}; -#define NUM_CON_TIMES 4 +#define MAX_NOTIFYLINES 32 // realtime time the line was generated for transparent notify lines -float con_times[NUM_CON_TIMES]; +float con_times[MAX_NOTIFYLINES]; int con_vislines; @@ -110,7 +111,7 @@ void Con_ClearNotify (void) { int i; - for (i=0 ; i= 0) - con_times[con_current % NUM_CON_TIMES] = realtime; + { + if (con_notify.integer < 0) + Cvar_SetValueQuick(&con_notify, 0); + if (con_notifylines > MAX_NOTIFYLINES) + Cvar_SetValueQuick(&con_notify, MAX_NOTIFYLINES); + if (con_notify.integer > 0) + con_times[con_current % con_notify.integer] = realtime; + } } switch (c) @@ -348,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); + } } @@ -380,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; @@ -398,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); } @@ -511,12 +516,16 @@ void Con_DrawNotify (void) extern char chat_buffer[]; char temptext[256]; + if (con_notify.integer < 0) + Cvar_SetValueQuick(&con_notify, 0); + if (con_notifylines > MAX_NOTIFYLINES) + Cvar_SetValueQuick(&con_notify, MAX_NOTIFYLINES); v = 0; - for (i= con_current-NUM_CON_TIMES+1 ; i<=con_current ; i++) + for (i= con_current-con_notify.integer+1 ; i<=con_current ; i++) { if (i < 0) continue; - time = con_times[i % NUM_CON_TIMES]; + time = con_times[i % con_notify.integer]; if (time == 0) continue; time = realtime - time; @@ -539,11 +548,11 @@ void Con_DrawNotify (void) x = 0; // LordHavoc: speedup, and other improvements - if (team_message) + if (chat_team) sprintf(temptext, "say_team:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1)); else sprintf(temptext, "say:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1)); - while (strlen(temptext) >= con_linewidth) + while (strlen(temptext) >= (size_t) con_linewidth) { DrawQ_String (0, v, temptext, con_linewidth, 8, 8, 1, 1, 1, 1, 0); strcpy(temptext, &temptext[con_linewidth]); @@ -556,7 +565,7 @@ void Con_DrawNotify (void) } } - if (v > con_notifylines) + if (con_notifylines < v) con_notifylines = v; } @@ -568,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) { @@ -579,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