From: havoc Date: Wed, 1 Dec 2004 23:14:07 +0000 (+0000) Subject: changed a lot of Con_DPrint/Con_DPrintf calls to Con_Print/Con_Printf (non-technical... X-Git-Tag: xonotic-v0.1.0preview~5321 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=5bdc0879026939f551a3ff217064732d59731be2 changed a lot of Con_DPrint/Con_DPrintf calls to Con_Print/Con_Printf (non-technical things like device errors which should be seen even without developer on) merged Sys_Print code into Con_Print and changed all other Sys_Print/Sys_Printf calls to calling Con_Print/Con_Printf or Con_DPrint/Con_DPrintf instead rewrote Con_Print so that timestamps are printed only at the start of each line (or just after the 0x01 or 0x02 characters used for chat messages), not during partial line prints, and timestamps now apply to all output destinations (log, console, terminal) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4816 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cd_bsd.c b/cd_bsd.c index 0608297f..83ae1a74 100644 --- a/cd_bsd.c +++ b/cd_bsd.c @@ -52,7 +52,7 @@ void CDAudio_SysEject (void) ioctl(cdfile, CDIOCALLOW); if (ioctl(cdfile, CDIOCEJECT) == -1) - Con_DPrint("ioctl CDIOCEJECT failed\n"); + Con_Print("ioctl CDIOCEJECT failed\n"); } @@ -63,7 +63,7 @@ void CDAudio_SysCloseDoor (void) ioctl(cdfile, CDIOCALLOW); if (ioctl(cdfile, CDIOCCLOSE) == -1) - Con_DPrint("ioctl CDIOCCLOSE failed\n"); + Con_Print("ioctl CDIOCCLOSE failed\n"); } int CDAudio_SysGetAudioDiskInfo (void) @@ -75,13 +75,13 @@ int CDAudio_SysGetAudioDiskInfo (void) if (ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1) { - Con_DPrint("ioctl CDIOREADTOCHEADER failed\n"); + Con_Print("ioctl CDIOREADTOCHEADER failed\n"); return -1; } if (tochdr.starting_track < 1) { - Con_DPrint("CDAudio: no music tracks\n"); + Con_Print("CDAudio: no music tracks\n"); return -1; } @@ -98,7 +98,7 @@ float CDAudio_SysGetVolume (void) if (ioctl (cdfile, CDIOCGETVOL, &vol) == -1) { - Con_DPrint("ioctl CDIOCGETVOL failed\n"); + Con_Print("ioctl CDIOCGETVOL failed\n"); return -1.0f; } @@ -117,7 +117,7 @@ void CDAudio_SysSetVolume (float volume) vol.vol[2] = vol.vol[3] = 0; if (ioctl (cdfile, CDIOCSETVOL, &vol) == -1) - Con_DPrintf ("ioctl CDIOCSETVOL failed\n"); + Con_Printf ("ioctl CDIOCSETVOL failed\n"); } @@ -137,7 +137,7 @@ int CDAudio_SysPlay (qbyte track) rte.data = &entry; if (ioctl(cdfile, CDIOREADTOCENTRYS, &rte) == -1) { - Con_DPrint("ioctl CDIOREADTOCENTRYS failed\n"); + Con_Print("ioctl CDIOREADTOCENTRYS failed\n"); return -1; } if (entry.control & 4) // if it's a data track @@ -156,13 +156,13 @@ int CDAudio_SysPlay (qbyte track) if (ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1) { - Con_DPrint("ioctl CDIOCPLAYTRACKS failed\n"); + Con_Print("ioctl CDIOCPLAYTRACKS failed\n"); return -1; } if (ioctl(cdfile, CDIOCRESUME) == -1) { - Con_DPrint("ioctl CDIOCRESUME failed\n"); + Con_Print("ioctl CDIOCRESUME failed\n"); return -1; } @@ -177,7 +177,7 @@ int CDAudio_SysStop (void) if (ioctl(cdfile, CDIOCSTOP) == -1) { - Con_DPrintf("ioctl CDIOCSTOP failed (%d)\n", errno); + Con_Printf("ioctl CDIOCSTOP failed (%d)\n", errno); return -1; } ioctl(cdfile, CDIOCALLOW); @@ -192,7 +192,7 @@ int CDAudio_SysPause (void) if (ioctl(cdfile, CDIOCPAUSE) == -1) { - Con_DPrint("ioctl CDIOCPAUSE failed\n"); + Con_Print("ioctl CDIOCPAUSE failed\n"); return -1; } @@ -206,7 +206,7 @@ int CDAudio_SysResume (void) return -1; if (ioctl(cdfile, CDIOCRESUME) == -1) - Con_DPrint("ioctl CDIOCRESUME failed\n"); + Con_Print("ioctl CDIOCRESUME failed\n"); return 0; } @@ -229,7 +229,7 @@ int CDAudio_SysUpdate (void) if (ioctl(cdfile, CDIOCREADSUBCHANNEL, &subchnl) == -1) { - Con_DPrint("ioctl CDIOCREADSUBCHANNEL failed\n"); + Con_Print("ioctl CDIOCREADSUBCHANNEL failed\n"); cdPlaying = false; return -1; } @@ -266,7 +266,7 @@ int CDAudio_SysStartup (void) if ((cdfile = open(cd_dev, O_RDONLY)) < 0) #endif { - Con_DPrintf("CDAudio_SysStartup: open of \"%s\" failed (%i)\n", + Con_Printf("CDAudio_SysStartup: open of \"%s\" failed (%i)\n", cd_dev, errno); cdfile = -1; return -1; diff --git a/cd_linux.c b/cd_linux.c index 9d428f50..05bf5c7e 100644 --- a/cd_linux.c +++ b/cd_linux.c @@ -42,7 +42,7 @@ void CDAudio_SysEject (void) return; if (ioctl(cdfile, CDROMEJECT) == -1) - Con_DPrint("ioctl CDROMEJECT failed\n"); + Con_Print("ioctl CDROMEJECT failed\n"); } @@ -52,7 +52,7 @@ void CDAudio_SysCloseDoor (void) return; if (ioctl(cdfile, CDROMCLOSETRAY) == -1) - Con_DPrint("ioctl CDROMCLOSETRAY failed\n"); + Con_Print("ioctl CDROMCLOSETRAY failed\n"); } int CDAudio_SysGetAudioDiskInfo (void) @@ -64,13 +64,13 @@ int CDAudio_SysGetAudioDiskInfo (void) if (ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1) { - Con_DPrint("ioctl CDROMREADTOCHDR failed\n"); + Con_Print("ioctl CDROMREADTOCHDR failed\n"); return -1; } if (tochdr.cdth_trk0 < 1) { - Con_DPrint("CDAudio: no music tracks\n"); + Con_Print("CDAudio: no music tracks\n"); return -1; } @@ -87,7 +87,7 @@ float CDAudio_SysGetVolume (void) if (ioctl (cdfile, CDROMVOLREAD, &vol) == -1) { - Con_DPrint("ioctl CDROMVOLREAD failed\n"); + Con_Print("ioctl CDROMVOLREAD failed\n"); return -1.0f; } @@ -106,7 +106,7 @@ void CDAudio_SysSetVolume (float volume) vol.channel2 = vol.channel3 = 0; if (ioctl (cdfile, CDROMVOLCTRL, &vol) == -1) - Con_DPrint("ioctl CDROMVOLCTRL failed\n"); + Con_Print("ioctl CDROMVOLCTRL failed\n"); } @@ -123,7 +123,7 @@ int CDAudio_SysPlay (qbyte track) entry.cdte_format = CDROM_MSF; if (ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1) { - Con_DPrint("ioctl CDROMREADTOCENTRY failed\n"); + Con_Print("ioctl CDROMREADTOCENTRY failed\n"); return -1; } if (entry.cdte_ctrl == CDROM_DATA_TRACK) @@ -142,13 +142,13 @@ int CDAudio_SysPlay (qbyte track) if (ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1) { - Con_DPrint("ioctl CDROMPLAYTRKIND failed\n"); + Con_Print("ioctl CDROMPLAYTRKIND failed\n"); return -1; } if (ioctl(cdfile, CDROMRESUME) == -1) { - Con_DPrint("ioctl CDROMRESUME failed\n"); + Con_Print("ioctl CDROMRESUME failed\n"); return -1; } @@ -163,7 +163,7 @@ int CDAudio_SysStop (void) if (ioctl(cdfile, CDROMSTOP) == -1) { - Con_DPrintf("ioctl CDROMSTOP failed (%d)\n", errno); + Con_Printf("ioctl CDROMSTOP failed (%d)\n", errno); return -1; } @@ -177,7 +177,7 @@ int CDAudio_SysPause (void) if (ioctl(cdfile, CDROMPAUSE) == -1) { - Con_DPrint("ioctl CDROMPAUSE failed\n"); + Con_Print("ioctl CDROMPAUSE failed\n"); return -1; } @@ -191,7 +191,7 @@ int CDAudio_SysResume (void) return -1; if (ioctl(cdfile, CDROMRESUME) == -1) - Con_DPrint("ioctl CDROMRESUME failed\n"); + Con_Print("ioctl CDROMRESUME failed\n"); return 0; } @@ -207,7 +207,7 @@ int CDAudio_SysUpdate (void) subchnl.cdsc_format = CDROM_MSF; if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1) { - Con_DPrint("ioctl CDROMSUBCHNL failed\n"); + Con_Print("ioctl CDROMSUBCHNL failed\n"); cdPlaying = false; return -1; } @@ -238,7 +238,7 @@ int CDAudio_SysStartup (void) { if ((cdfile = open(cd_dev, O_RDONLY | O_NONBLOCK)) == -1) { - Con_DPrintf("CDAudio_SysStartup: open of \"%s\" failed (%i)\n", + Con_Printf("CDAudio_SysStartup: open of \"%s\" failed (%i)\n", cd_dev, errno); cdfile = -1; return -1; diff --git a/cd_sdl.c b/cd_sdl.c index fd75fec0..11eb01ea 100644 --- a/cd_sdl.c +++ b/cd_sdl.c @@ -153,12 +153,12 @@ int CDAudio_SysStartup (void) if( numdrives == -1 ) // was the CDROM system initialized correctly? return -1; - Con_DPrintf( "Found %i cdrom drives.\n", numdrives ); + Con_Printf( "Found %i cdrom drives.\n", numdrives ); for( i = 0 ; i < numdrives ; i++, cd = NULL ) { cd = SDL_CDOpen( i ); if( !cd ) { - Con_DPrintf( "CD drive %i is invalid.\n", i ); + Con_Printf( "CD drive %i is invalid.\n", i ); continue; } @@ -166,9 +166,9 @@ int CDAudio_SysStartup (void) if( IsAudioCD() ) break; else - Con_DPrintf( "The CD in drive %i is not an audio cd.\n", i ); + Con_Printf( "The CD in drive %i is not an audio cd.\n", i ); else - Con_DPrintf( "No CD in drive %i.\n", i ); + Con_Printf( "No CD in drive %i.\n", i ); SDL_CDClose( cd ); } diff --git a/cd_shared.c b/cd_shared.c index 70a446ca..48dc4990 100644 --- a/cd_shared.c +++ b/cd_shared.c @@ -105,7 +105,7 @@ void CDAudio_Play (qbyte track, qboolean looping) track = remap[track]; if (track < 1) { - Con_DPrintf("CDAudio: Bad track number %u.\n", track); + Con_Printf("CDAudio: Bad track number %u.\n", track); return; } @@ -125,7 +125,7 @@ void CDAudio_Play (qbyte track, qboolean looping) if (looping) S_SetChannelFlag (faketrack, CHANNELFLAG_FORCELOOP, true); S_SetChannelFlag (faketrack, CHANNELFLAG_FULLVOLUME, true); - Con_DPrintf ("Fake CD track %u playing...\n", track); + Con_Printf ("Fake CD track %u playing...\n", track); } } @@ -382,22 +382,22 @@ int CDAudio_Startup (void) if (CDAudio_GetAudioDiskInfo()) { - Con_DPrint("CDAudio_Init: No CD in player.\n"); + Con_Print("CDAudio_Init: No CD in player.\n"); cdValid = false; } saved_vol = CDAudio_SysGetVolume (); if (saved_vol < 0.0f) { - Con_DPrint ("Can't get initial CD volume\n"); + Con_Print ("Can't get initial CD volume\n"); saved_vol = 1.0f; } else - Con_DPrintf ("Initial CD volume: %g\n", saved_vol); + Con_Printf ("Initial CD volume: %g\n", saved_vol); initialized = true; - Con_DPrint("CD Audio Initialized\n"); + Con_Print("CD Audio Initialized\n"); return 0; } diff --git a/cd_win.c b/cd_win.c index 16f08c68..a79a24d4 100644 --- a/cd_win.c +++ b/cd_win.c @@ -35,7 +35,7 @@ void CDAudio_SysEject(void) DWORD dwReturn; if ((dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD)NULL))) - Con_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); + Con_Printf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); } @@ -44,7 +44,7 @@ void CDAudio_SysCloseDoor(void) DWORD dwReturn; if ((dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD)NULL))) - Con_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); + Con_Printf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); } int CDAudio_SysGetAudioDiskInfo(void) @@ -56,12 +56,12 @@ int CDAudio_SysGetAudioDiskInfo(void) dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); if (dwReturn) { - Con_DPrint("CDAudio: drive ready test - get status failed\n"); + Con_Print("CDAudio: drive ready test - get status failed\n"); return -1; } if (!mciStatusParms.dwReturn) { - Con_DPrint("CDAudio: drive not ready\n"); + Con_Print("CDAudio: drive not ready\n"); return -1; } @@ -69,12 +69,12 @@ int CDAudio_SysGetAudioDiskInfo(void) dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); if (dwReturn) { - Con_DPrint("CDAudio: get tracks - status failed\n"); + Con_Print("CDAudio: get tracks - status failed\n"); return -1; } if (mciStatusParms.dwReturn < 1) { - Con_DPrint("CDAudio: no music tracks\n"); + Con_Print("CDAudio: no music tracks\n"); return -1; } @@ -107,7 +107,7 @@ int CDAudio_SysPlay (qbyte track) dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); if (dwReturn) { - Con_DPrintf("MCI_STATUS failed (%i)\n", dwReturn); + Con_Printf("MCI_STATUS failed (%i)\n", dwReturn); return -1; } if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) @@ -125,7 +125,7 @@ int CDAudio_SysPlay (qbyte track) dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); if (dwReturn) { - Con_DPrintf("MCI_STATUS failed (%i)\n", dwReturn); + Con_Printf("MCI_STATUS failed (%i)\n", dwReturn); return -1; } @@ -135,7 +135,7 @@ int CDAudio_SysPlay (qbyte track) dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD)(LPVOID) &mciPlayParms); if (dwReturn) { - Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); + Con_Printf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); return -1; } @@ -149,7 +149,7 @@ int CDAudio_SysStop (void) if ((dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (DWORD)NULL))) { - Con_DPrintf("MCI_STOP failed (%i)\n", dwReturn); + Con_Printf("MCI_STOP failed (%i)\n", dwReturn); return -1; } return 0; @@ -163,7 +163,7 @@ int CDAudio_SysPause (void) mciGenericParms.dwCallback = (DWORD)mainwindow; if ((dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (DWORD)(LPVOID) &mciGenericParms))) { - Con_DPrintf("MCI_PAUSE failed (%i)\n", dwReturn); + Con_Printf("MCI_PAUSE failed (%i)\n", dwReturn); return -1; } return 0; @@ -181,7 +181,7 @@ int CDAudio_SysResume (void) dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD)(LPVOID) &mciPlayParms); if (dwReturn) { - Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); + Con_Printf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); return -1; } return 0; @@ -208,13 +208,13 @@ LONG CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) break; case MCI_NOTIFY_FAILURE: - Con_DPrint("MCI_NOTIFY_FAILURE\n"); + Con_Print("MCI_NOTIFY_FAILURE\n"); CDAudio_Stop (); cdValid = false; break; default: - Con_DPrintf("Unexpected MM_MCINOTIFY type (%i)\n", wParam); + Con_Printf("Unexpected MM_MCINOTIFY type (%i)\n", wParam); return 1; } @@ -260,5 +260,5 @@ int CDAudio_SysStartup (void) void CDAudio_SysShutdown (void) { if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL)) - Con_DPrint("CDAudio_Shutdown: MCI_CLOSE failed\n"); + Con_Print("CDAudio_Shutdown: MCI_CLOSE failed\n"); } diff --git a/cl_parse.c b/cl_parse.c index eb1437c9..4f509d7c 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -338,7 +338,7 @@ void CL_ParseServerInfo (void) return; } cl.protocol = i; - Con_DPrintf("Protocol %i\n", cl.protocol); + Con_DPrintf("Server protocol is %i\n", cl.protocol); // parse maxclients cl.maxclients = MSG_ReadByte (); diff --git a/console.c b/console.c index d49bcd6a..592e338e 100644 --- a/console.c +++ b/console.c @@ -551,29 +551,97 @@ void Con_PrintToHistory(const char *txt) } } +/* 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', '{', '|', '}', '~', '<' +}; + /* ================ Con_Print -Prints to all appropriate console targets +Prints to all appropriate console targets, and adds timestamps ================ */ +extern cvar_t timestamps; +extern cvar_t timeformat; +extern qboolean sys_nostdout; void Con_Print(const char *msg) { - // also echo to debugging console - Sys_Print(msg); + static int index = 0; + static char line[16384]; - // log all messages to file - Log_ConPrint (msg); - - if (!con_initialized) - return; - - if (cls.state == ca_dedicated) - return; // no graphics mode - - // write it to the scrollable buffer - Con_PrintToHistory(msg); + for (;*msg;msg++) + { + if (index == 0) + { + // if this is the beginning of a new line, print timestamp + char *timestamp = timestamps.integer ? Sys_TimeString(timeformat.string) : ""; + // special color codes for chat messages must always come first + // for Con_PrintToHistory to work properly + if (*msg <= 2) + line[index++] = *msg++; + // store timestamp + for (;*timestamp;index++, timestamp++) + if (index < sizeof(line) - 2) + line[index] = *timestamp; + } + // append the character + line[index++] = *msg; + // if this is a newline character, we have a complete line to print + if (*msg == '\n' || index >= 16000) + { + // terminate the line + line[index] = 0; + // send to log file + Log_ConPrint(line); + // send to scrollable buffer + if (con_initialized && cls.state != ca_dedicated) + Con_PrintToHistory(line); + // send to terminal or dedicated server window + if (!sys_nostdout) + { + unsigned char *p; + for (p = (unsigned char *) line;*p; p++) + *p = qfont_table[*p]; + Sys_PrintToTerminal(line); + } + // empty the line buffer + index = 0; + } + } } diff --git a/fs.c b/fs.c index 6544ff76..8298a5e9 100644 --- a/fs.c +++ b/fs.c @@ -1164,7 +1164,7 @@ static searchpath_t *FS_FindFile (const char *name, int* index, qboolean quiet) if (!diff) { if (!quiet) - Sys_Printf("FS_FindFile: %s in %s\n", + Con_DPrintf("FS_FindFile: %s in %s\n", pak->files[middle].name, pak->filename); if (index != NULL) @@ -1186,7 +1186,7 @@ static searchpath_t *FS_FindFile (const char *name, int* index, qboolean quiet) if (FS_SysFileExists (netpath)) { if (!quiet) - Sys_Printf("FS_FindFile: %s\n", netpath); + Con_DPrintf("FS_FindFile: %s\n", netpath); if (index != NULL) *index = -1; @@ -1196,7 +1196,7 @@ static searchpath_t *FS_FindFile (const char *name, int* index, qboolean quiet) } if (!quiet) - Sys_Printf("FS_FindFile: can't find %s\n", name); + Con_DPrintf("FS_FindFile: can't find %s\n", name); if (index != NULL) *index = -1; @@ -2110,7 +2110,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet) if (liststart == NULL) liststart = listcurrent; if (!quiet) - Sys_Printf("SearchPackFile: %s : %s\n", pak->filename, temp); + Con_DPrintf("SearchPackFile: %s : %s\n", pak->filename, temp); } } // strip off one path element at a time until empty @@ -2149,7 +2149,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet) if (liststart == NULL) liststart = listcurrent; if (!quiet) - Sys_Printf("SearchDirFile: %s\n", temp); + Con_DPrintf("SearchDirFile: %s\n", temp); } } } diff --git a/gl_backend.c b/gl_backend.c index 3d356737..915abade 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -161,7 +161,7 @@ void GL_Backend_FreeArrays(void) static void gl_backend_start(void) { - Con_DPrint("OpenGL Backend started\n"); + Con_Print("OpenGL Backend started\n"); if (qglDrawRangeElements != NULL) { CHECKGLERROR @@ -169,7 +169,7 @@ static void gl_backend_start(void) CHECKGLERROR qglGetIntegerv(GL_MAX_ELEMENTS_INDICES, &gl_maxdrawrangeelementsindices); CHECKGLERROR - Con_DPrintf("glDrawRangeElements detected (max vertices %i, max indices %i)\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices); + Con_Printf("glDrawRangeElements detected (max vertices %i, max indices %i)\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices); } backendunits = min(MAX_TEXTUREUNITS, gl_textureunits); @@ -184,7 +184,7 @@ static void gl_backend_shutdown(void) backendunits = 0; backendactive = false; - Con_DPrint("OpenGL Backend shutting down\n"); + Con_Print("OpenGL Backend shutting down\n"); GL_Backend_FreeArrays(); } diff --git a/host.c b/host.c index 49cc616a..e6b20840 100644 --- a/host.c +++ b/host.c @@ -351,7 +351,7 @@ void SV_BroadcastPrint(const char *msg) } if (sv_echobprint.integer && cls.state == ca_dedicated) - Sys_Print(msg); + Con_Print(msg); } /* diff --git a/host_cmd.c b/host_cmd.c index 8a616af2..80b62d1c 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -829,7 +829,7 @@ void Host_Say(qboolean teamonly) SV_ClientPrint(text); host_client = save; - Sys_Print(&text[1]); + //Con_Print(&text[1]); } @@ -1189,7 +1189,7 @@ void Host_Spawn_f (void) PR_ExecuteProgram (pr_global_struct->ClientConnect, "QC function ClientConnect is missing"); if ((Sys_DoubleTime() - host_client->connecttime) <= sv.time) - Sys_Printf("%s entered the game\n", host_client->name); + Con_Printf("%s entered the game\n", host_client->name); PR_ExecuteProgram (pr_global_struct->PutClientInServer, "QC function PutClientInServer is missing"); } @@ -1662,7 +1662,7 @@ void Host_Startdemos_f (void) Con_Printf("Max %i demos in demoloop\n", MAX_DEMOS); c = MAX_DEMOS; } - Con_DPrintf("%i demo(s) in loop\n", c); + Con_Printf("%i demo(s) in loop\n", c); for (i=1 ; iname, out - outstart, outend - outstart); + Con_Printf("Mod_Q1BSP_DecompressVis: input underrun on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart); return; } c = *in++; @@ -890,14 +890,14 @@ static void Mod_Q1BSP_DecompressVis(const qbyte *in, const qbyte *inend, qbyte * { if (in == inend) { - Con_DPrintf("Mod_Q1BSP_DecompressVis: input underrun (during zero-run) on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart); + Con_Printf("Mod_Q1BSP_DecompressVis: input underrun (during zero-run) on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart); return; } for (c = *in++;c > 0;c--) { if (out == outend) { - Con_DPrintf("Mod_Q1BSP_DecompressVis: output overrun on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart); + Con_Printf("Mod_Q1BSP_DecompressVis: output overrun on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart); return; } *out++ = 0; diff --git a/snd_alsa.c b/snd_alsa.c index 031185b6..67a9ed60 100644 --- a/snd_alsa.c +++ b/snd_alsa.c @@ -86,14 +86,14 @@ qboolean SNDDMA_Init (void) err = snd_pcm_open (&pcm, pcmname, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); if (0 > err) { - Sys_Printf ("Error: audio open error: %s\n", snd_strerror (err)); + Con_Printf ("Error: audio open error: %s\n", snd_strerror (err)); return 0; } - Sys_Printf ("ALSA: Using PCM %s.\n", pcmname); + Con_Printf ("ALSA: Using PCM %s.\n", pcmname); err = snd_pcm_hw_params_any (pcm, hw); if (0 > err) { - Sys_Printf ("ALSA: error setting hw_params_any. %s\n", + Con_Printf ("ALSA: error setting hw_params_any. %s\n", snd_strerror (err)); goto error; } @@ -101,7 +101,7 @@ qboolean SNDDMA_Init (void) err = snd_pcm_hw_params_set_access (pcm, hw, SND_PCM_ACCESS_MMAP_INTERLEAVED); if (0 > err) { - Sys_Printf ("ALSA: Failure to set noninterleaved PCM access. %s\n" + Con_Printf ("ALSA: Failure to set noninterleaved PCM access. %s\n" "Note: Interleaved is not supported\n", snd_strerror (err)); goto error; @@ -117,7 +117,7 @@ qboolean SNDDMA_Init (void) SND_PCM_FORMAT_U8))) { bps = 8; } else { - Sys_Printf ("ALSA: no useable formats. %s\n", + Con_Printf ("ALSA: no useable formats. %s\n", snd_strerror (err)); goto error; } @@ -128,13 +128,13 @@ qboolean SNDDMA_Init (void) SND_PCM_FORMAT_U8 : SND_PCM_FORMAT_S16); if (0 > err) { - Sys_Printf ("ALSA: no usable formats. %s\n", + Con_Printf ("ALSA: no usable formats. %s\n", snd_strerror (err)); goto error; } break; default: - Sys_Printf ("ALSA: desired format not supported\n"); + Con_Printf ("ALSA: desired format not supported\n"); goto error; } @@ -147,7 +147,7 @@ qboolean SNDDMA_Init (void) 1))) { stereo = 0; } else { - Sys_Printf ("ALSA: no usable channels. %s\n", + Con_Printf ("ALSA: no usable channels. %s\n", snd_strerror (err)); goto error; } @@ -156,13 +156,13 @@ qboolean SNDDMA_Init (void) case 1: err = snd_pcm_hw_params_set_channels (pcm, hw, stereo ? 2 : 1); if (0 > err) { - Sys_Printf ("ALSA: no usable channels. %s\n", + Con_Printf ("ALSA: no usable channels. %s\n", snd_strerror (err)); goto error; } break; default: - Sys_Printf ("ALSA: desired channels not supported\n"); + Con_Printf ("ALSA: desired channels not supported\n"); goto error; } @@ -184,7 +184,7 @@ qboolean SNDDMA_Init (void) if (0 <= err) { frag_size = 8 * bps; } else { - Sys_Printf ("ALSA: no usable rates. %s\n", + Con_Printf ("ALSA: no usable rates. %s\n", snd_strerror (err)); goto error; } @@ -196,50 +196,50 @@ qboolean SNDDMA_Init (void) case 44100: err = snd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0); if (0 > err) { - Sys_Printf ("ALSA: desired rate %i not supported. %s\n", rate, + Con_Printf ("ALSA: desired rate %i not supported. %s\n", rate, snd_strerror (err)); goto error; } frag_size = 8 * bps * rate / 11025; break; default: - Sys_Printf ("ALSA: desired rate %i not supported.\n", rate); + Con_Printf ("ALSA: desired rate %i not supported.\n", rate); goto error; } err = snd_pcm_hw_params_set_period_size_near (pcm, hw, &frag_size, 0); if (0 > err) { - Sys_Printf ("ALSA: unable to set period size near %i. %s\n", + Con_Printf ("ALSA: unable to set period size near %i. %s\n", (int) frag_size, snd_strerror (err)); goto error; } err = snd_pcm_hw_params (pcm, hw); if (0 > err) { - Sys_Printf ("ALSA: unable to install hw params: %s\n", + Con_Printf ("ALSA: unable to install hw params: %s\n", snd_strerror (err)); goto error; } err = snd_pcm_sw_params_current (pcm, sw); if (0 > err) { - Sys_Printf ("ALSA: unable to determine current sw params. %s\n", + Con_Printf ("ALSA: unable to determine current sw params. %s\n", snd_strerror (err)); goto error; } err = snd_pcm_sw_params_set_start_threshold (pcm, sw, ~0U); if (0 > err) { - Sys_Printf ("ALSA: unable to set playback threshold. %s\n", + Con_Printf ("ALSA: unable to set playback threshold. %s\n", snd_strerror (err)); goto error; } err = snd_pcm_sw_params_set_stop_threshold (pcm, sw, ~0U); if (0 > err) { - Sys_Printf ("ALSA: unable to set playback stop threshold. %s\n", + Con_Printf ("ALSA: unable to set playback stop threshold. %s\n", snd_strerror (err)); goto error; } err = snd_pcm_sw_params (pcm, sw); if (0 > err) { - Sys_Printf ("ALSA: unable to install sw params. %s\n", + Con_Printf ("ALSA: unable to install sw params. %s\n", snd_strerror (err)); goto error; } @@ -250,7 +250,7 @@ qboolean SNDDMA_Init (void) err = snd_pcm_hw_params_get_buffer_size (hw, &buffer_size); if (0 > err) { - Sys_Printf ("ALSA: unable to get buffer size. %s\n", + Con_Printf ("ALSA: unable to get buffer size. %s\n", snd_strerror (err)); goto error; } diff --git a/snd_mem.c b/snd_mem.c index f152120e..7422a01b 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -38,8 +38,8 @@ size_t ResampleSfx (const qbyte *in_data, size_t in_length, const snd_format_t* srclength = in_length * in_format->channels; outcount = (double)in_length * shm->format.speed / in_format->speed; - Con_DPrintf("ResampleSfx(%s): %d samples @ %dHz -> %d samples @ %dHz\n", - sfxname, in_length, in_format->speed, outcount, shm->format.speed); + //Con_DPrintf("ResampleSfx(%s): %d samples @ %dHz -> %d samples @ %dHz\n", + // sfxname, in_length, in_format->speed, outcount, shm->format.speed); // Trivial case (direct transfer) if (in_format->speed == shm->format.speed) @@ -178,7 +178,7 @@ qboolean S_LoadSound (sfx_t *s, qboolean complain) if (len >= sizeof (namebuffer)) { // name too long - Con_DPrintf("S_LoadSound: name \"%s\" is too long\n", s->name); + Con_Printf("S_LoadSound: name \"%s\" is too long\n", s->name); return false; } if (S_LoadWavFile (namebuffer, s)) @@ -194,7 +194,7 @@ qboolean S_LoadSound (sfx_t *s, qboolean complain) if (len >= sizeof (namebuffer)) { // name too long - Con_DPrintf("S_LoadSound: name \"%s\" is too long\n", s->name); + Con_Printf("S_LoadSound: name \"%s\" is too long\n", s->name); return false; } if (S_LoadWavFile (namebuffer, s)) diff --git a/sv_phys.c b/sv_phys.c index b5427832..ee023908 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -592,13 +592,13 @@ void SV_PushMove (edict_t *pusher, float movetime) SV_LinkEdict (pusher, false); return; default: - Con_DPrintf("SV_PushMove: unrecognized solid type %f\n", pusher->v->solid); + Con_Printf("SV_PushMove: unrecognized solid type %f\n", pusher->v->solid); return; } index = (int) pusher->v->modelindex; if (index < 1 || index >= MAX_MODELS) { - Con_DPrintf("SV_PushMove: invalid modelindex %f\n", pusher->v->modelindex); + Con_Printf("SV_PushMove: invalid modelindex %f\n", pusher->v->modelindex); return; } pushermodel = sv.models[index]; diff --git a/sys.h b/sys.h index 2644d074..1890fce2 100644 --- a/sys.h +++ b/sys.h @@ -48,10 +48,6 @@ qboolean Sys_LoadLibrary (const char* dllname, dllhandle_t* handle, const dllfun void Sys_UnloadLibrary (dllhandle_t* handle); void* Sys_GetProcAddress (dllhandle_t handle, const char* name); -void Sys_Print(const char *msg); -void Sys_Printf(const char *fmt, ...); -// send text to the quake console (and possibly to terminal) - // called after Com_InitArgv void Sys_Shared_EarlyInit (void); // called after Host_init diff --git a/sys_shared.c b/sys_shared.c index 1893c219..ff897498 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -7,47 +7,7 @@ # include #endif -extern cvar_t timestamps; -extern cvar_t timeformat; - -static int sys_nostdout = false; - -/* 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', '{', '|', '}', '~', '<' -}; +qboolean sys_nostdout = false; static char sys_timestring[128]; char *Sys_TimeString(const char *timeformat) @@ -58,41 +18,6 @@ char *Sys_TimeString(const char *timeformat) } -#define MAXPRINTMSG 16384 - -void Sys_Print(const char *msg) -{ - unsigned char *p; - // String we print - char final[MAXPRINTMSG]; - - if (sys_nostdout) - return; - - if (timestamps.integer) - snprintf(final, sizeof(final), "%s%s", Sys_TimeString(timeformat.string), msg); - else - strlcpy (final, msg, sizeof (final)); - - // LordHavoc: make sure the string is terminated - final[MAXPRINTMSG-1] = 0; - for (p = (unsigned char *) final;*p; p++) - *p = qfont_table[*p]; - Sys_PrintToTerminal(final); -} - -void Sys_Printf(const char *fmt, ...) -{ - va_list argptr; - char msg[MAXPRINTMSG]; // String we started with - - va_start(argptr,fmt); - vsnprintf(msg,sizeof(msg),fmt,argptr); - va_end(argptr); - - Sys_Print(msg); -} - extern qboolean host_shuttingdown; void Sys_Quit (void) { @@ -180,7 +105,7 @@ qboolean Sys_LoadLibrary (const char* dllname, dllhandle_t* handle, const dllfun } *handle = dllhandle; - Con_DPrintf("\"%s\" loaded.\n", dllname); + Con_Printf("\"%s\" loaded.\n", dllname); return true; } diff --git a/vid_sdl.c b/vid_sdl.c index 4dc4d13b..ce9f0f6e 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -359,7 +359,7 @@ static void VID_OutputVersion() { const SDL_version *version; version = SDL_Linked_Version(); - Con_DPrintf( "Linked against SDL version %d.%d.%d\n" + Con_Printf( "Linked against SDL version %d.%d.%d\n" "Using SDL library version %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL, version->major, version->minor, version->patch ); diff --git a/vid_shared.c b/vid_shared.c index 76cc73d9..788b03e9 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -335,14 +335,14 @@ int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char * int failed = false; const dllfunction_t *func; - Con_DPrintf("checking for %s... ", name); + Con_Printf("checking for %s... ", name); for (func = funcs;func && func->name;func++) *func->funcvariable = NULL; if (disableparm && (COM_CheckParm(disableparm) || COM_CheckParm("-safe"))) { - Con_DPrint("disabled by commandline\n"); + Con_Print("disabled by commandline\n"); return false; } @@ -361,12 +361,12 @@ int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char * // delay the return so it prints all missing functions if (failed) return false; - Con_DPrint("enabled\n"); + Con_Print("enabled\n"); return true; } else { - Con_DPrint("not detected\n"); + Con_Print("not detected\n"); return false; } } @@ -623,13 +623,13 @@ void VID_CheckExtensions(void) if (!GL_CheckExtension("OpenGL 1.1.0", opengl110funcs, NULL, false)) Sys_Error("OpenGL 1.1.0 functions not found\n"); - Con_DPrintf("GL_VENDOR: %s\n", gl_vendor); - Con_DPrintf("GL_RENDERER: %s\n", gl_renderer); - Con_DPrintf("GL_VERSION: %s\n", gl_version); - Con_DPrintf("GL_EXTENSIONS: %s\n", gl_extensions); - Con_DPrintf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions); + Con_Printf("GL_VENDOR: %s\n", gl_vendor); + Con_Printf("GL_RENDERER: %s\n", gl_renderer); + Con_Printf("GL_VERSION: %s\n", gl_version); + Con_Printf("GL_EXTENSIONS: %s\n", gl_extensions); + Con_Printf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions); - Con_DPrint("Checking OpenGL extensions...\n"); + Con_Print("Checking OpenGL extensions...\n"); // COMMANDLINEOPTION: GL: -nodrawrangeelements disables GL_EXT_draw_range_elements (renders faster) if (!GL_CheckExtension("glDrawRangeElements", drawrangeelementsfuncs, "-nodrawrangeelements", true)) @@ -1069,7 +1069,7 @@ void VID_Open(void) Cvar_SetQuick(&vid_bitsperpixel, com_argv[i+1]); } - Con_DPrint("Starting video system\n"); + Con_Print("Starting video system\n"); success = VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer); if (!success) { diff --git a/world.c b/world.c index 488546a4..cdf94518 100644 --- a/world.c +++ b/world.c @@ -320,7 +320,7 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers) int modelindex = ent->v->modelindex; if (modelindex < 0 || modelindex > MAX_MODELS) { - Con_DPrintf("edict %i: SOLID_BSP with invalid modelindex!\n", NUM_FOR_EDICT(ent)); + Con_Printf("edict %i: SOLID_BSP with invalid modelindex!\n", NUM_FOR_EDICT(ent)); modelindex = 0; } model = sv.models[modelindex]; @@ -328,7 +328,7 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers) { Mod_CheckLoaded(model); if (!model->TraceBox) - Con_DPrintf("edict %i: SOLID_BSP with non-collidable model\n", NUM_FOR_EDICT(ent)); + Con_Printf("edict %i: SOLID_BSP with non-collidable model\n", NUM_FOR_EDICT(ent)); if (ent->v->angles[0] || ent->v->angles[2] || ent->v->avelocity[0] || ent->v->avelocity[2]) { @@ -451,18 +451,18 @@ trace_t SV_ClipMoveToEntity(edict_t *ent, const vec3_t start, const vec3_t mins, // if the modelindex is 0, it shouldn't be SOLID_BSP! if (modelindex == 0) { - Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with no model\n", NUM_FOR_EDICT(ent)); + Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with no model\n", NUM_FOR_EDICT(ent)); return trace; } if (modelindex >= MAX_MODELS) { - Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent)); + Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent)); return trace; } model = sv.models[modelindex]; if (modelindex != 0 && model == NULL) { - Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent)); + Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent)); return trace; } @@ -471,12 +471,12 @@ trace_t SV_ClipMoveToEntity(edict_t *ent, const vec3_t start, const vec3_t mins, { if (!model->TraceBox) { - Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with a non-collidable model\n", NUM_FOR_EDICT(ent)); + Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with a non-collidable model\n", NUM_FOR_EDICT(ent)); return trace; } //if (ent->v->movetype != MOVETYPE_PUSH) //{ - // Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP without MOVETYPE_PUSH\n", NUM_FOR_EDICT(ent)); + // Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP without MOVETYPE_PUSH\n", NUM_FOR_EDICT(ent)); // return trace; //} }