//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;
{
int i;
- for (i=0 ; i<NUM_CON_TIMES ; i++)
+ for (i=0 ; i<MAX_NOTIFYLINES ; i++)
con_times[i] = 0;
}
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;
// register our commands
//
Cvar_RegisterVariable (&con_notifytime);
+ Cvar_RegisterVariable (&con_notify);
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
Con_Linefeed ();
// mark time for transparent overlay
if (con_current >= 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)
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);
+ }
}
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;
if (cls.state == ca_dedicated)
return; // no graphics mode
-// write it to the scrollable buffer
+ // write it to the scrollable buffer
Con_Print (msg);
}
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;
}
}
- if (v > con_notifylines)
+ if (con_notifylines < v)
con_notifylines = v;
}