mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 14:52:08 +00:00
Moved Sys_Printf from sv_sys_win.c.
Added graph char translations to Sys_Printf (from sys_unix). Added "last message repeated xx times" to cut down repeat lines from Sys_Printf.
This commit is contained in:
parent
50529263fb
commit
da1b50442f
1 changed files with 73 additions and 1 deletions
|
@ -38,6 +38,44 @@
|
|||
/* This is unused in the client, but we need the symbol there too. */
|
||||
server_static_t svs;
|
||||
|
||||
/* The translation table between the graphical font and plain ASCII --KB */
|
||||
static char qfont_table[256] =
|
||||
{
|
||||
'\0', '#', '#', '#', '#', '.', '#', '#',
|
||||
'#', 9, 10, '#', ' ', 13, '.', '.',
|
||||
'[', ']', '0', '1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9', '.', '<', '=', '>',
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'',
|
||||
'(', ')', '*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', '{', '|', '}', '~', '<',
|
||||
|
||||
'<', '=', '>', '#', '#', '.', '#', '#',
|
||||
'#', '#', ' ', '#', ' ', '>', '.', '.',
|
||||
'[', ']', '0', '1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9', '.', '<', '=', '>',
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'',
|
||||
'(', ')', '*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', '{', '|', '}', '~', '<'
|
||||
};
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_DoubleTime
|
||||
|
@ -65,7 +103,41 @@ double Sys_DoubleTime (void)
|
|||
|
||||
return (now - starttime) / 1000.0;
|
||||
}
|
||||
#define MAXPRINTMSG 4096
|
||||
/*
|
||||
================
|
||||
Sys_Printf
|
||||
================
|
||||
*/
|
||||
void Sys_Printf (char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char msg[MAXPRINTMSG];
|
||||
static char lastmessage[MAXPRINTMSG];
|
||||
static int msgcount=0;
|
||||
unsigned char *p;
|
||||
|
||||
if (sys_nostdout->value)
|
||||
return;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (msg, sizeof(msg), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
if (strncmp(lastmessage,msg,MAXPRINTMSG)==0) {
|
||||
msgcount+=1;
|
||||
return;
|
||||
} else {
|
||||
if (msgcount>0) printf("Last message repeated %d times\n",msgcount);
|
||||
strncpy(lastmessage,msg,MAXPRINTMSG);
|
||||
msgcount=0;
|
||||
}
|
||||
|
||||
/* translate to ASCII instead of printing [xx] --KB */
|
||||
for (p = (unsigned char *)msg; *p; p++)
|
||||
putc(qfont_table[*p], stdout);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
|
|
Loading…
Reference in a new issue