From ff46d6ff516fda192c5adc55a5c9b82007545bd2 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 10 Mar 2004 03:28:04 +0000 Subject: [PATCH] added Print versions of Printf functions and made all calls that do not need formating use the Print versions; yes this is a cosmetic cleanup, prints are too rare to have any performance improvements. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3991 d7cf8633-e32d-0410-b094-e92efae38249 --- cd_bsd.c | 20 +++---- cd_linux.c | 20 +++---- cd_shared.c | 6 +- cd_win.c | 16 +++--- cl_demo.c | 30 +++++----- cl_input.c | 4 +- cl_main.c | 14 ++--- cl_parse.c | 33 +++++------ cl_particles.c | 6 +- cl_screen.c | 14 ++--- cl_video.c | 2 +- cmd.c | 38 ++++++------- cmd.h | 2 +- collision.c | 38 ++++++------- common.c | 10 ++-- common.h | 2 +- conproc.c | 6 +- console.c | 138 +++++++++++++++++++++++++++++++-------------- console.h | 12 ++-- cvar.c | 29 +++++----- fs.c | 38 ++++++++----- fs.h | 3 +- gl_backend.c | 16 +++--- gl_draw.c | 2 +- gl_rmain.c | 4 +- gl_textures.c | 10 ++-- host.c | 74 ++++++++++++++++-------- host_cmd.c | 150 ++++++++++++++++++++++++------------------------- image.c | 42 +++++++------- jpeg.c | 2 +- keys.c | 40 ++++++------- lhnet.c | 10 ++-- mathlib.c | 2 +- menu.c | 150 ++++++++++++++++++++++++------------------------- model_brush.c | 30 +++++----- model_shared.c | 8 +-- netconn.c | 36 ++++++------ ogg.c | 6 +- palette.c | 2 +- portals.c | 4 +- pr_cmds.c | 28 ++++----- pr_edict.c | 72 ++++++++++++------------ pr_exec.c | 32 +++++------ progs.h | 2 +- progsvm.h | 2 +- protocol.c | 10 ++-- prvm_cmds.c | 38 ++++++------- prvm_edict.c | 76 ++++++++++++------------- prvm_exec.c | 32 +++++------ r_lerpanim.c | 4 +- r_modules.c | 2 +- r_shadow.c | 38 ++++++------- r_sky.c | 8 +-- screen.h | 2 +- server.h | 6 +- snd_alsa_0_5.c | 6 +- snd_alsa_0_9.c | 18 +++--- snd_bsd.c | 10 ++-- snd_dma.c | 20 +++---- snd_mem.c | 12 ++-- snd_mix.c | 2 +- snd_oss.c | 28 ++++----- snd_win.c | 66 +++++++++++----------- sv_main.c | 14 ++--- sv_phys.c | 18 +++--- sv_user.c | 4 +- sys.h | 5 +- sys_linux.c | 2 +- sys_sdl.c | 2 +- sys_shared.c | 49 ++++++++-------- sys_win.c | 2 +- vid_glx.c | 6 +- vid_sdl.c | 4 +- vid_shared.c | 24 ++++---- vid_wgl.c | 36 ++++++------ wad.c | 20 +++---- zone.c | 8 +-- 77 files changed, 935 insertions(+), 842 deletions(-) diff --git a/cd_bsd.c b/cd_bsd.c index 14bb3172..bdb6f751 100644 --- a/cd_bsd.c +++ b/cd_bsd.c @@ -44,7 +44,7 @@ void CDAudio_SysEject (void) ioctl(cdfile, CDIOCALLOW); if (ioctl(cdfile, CDIOCEJECT) == -1) - Con_DPrintf("ioctl CDIOCEJECT failed\n"); + Con_DPrint("ioctl CDIOCEJECT failed\n"); } @@ -55,7 +55,7 @@ void CDAudio_SysCloseDoor (void) ioctl(cdfile, CDIOCALLOW); if (ioctl(cdfile, CDIOCCLOSE) == -1) - Con_DPrintf("ioctl CDIOCCLOSE failed\n"); + Con_DPrint("ioctl CDIOCCLOSE failed\n"); } int CDAudio_SysGetAudioDiskInfo (void) @@ -64,13 +64,13 @@ int CDAudio_SysGetAudioDiskInfo (void) if (ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1) { - Con_DPrintf("ioctl CDIOREADTOCHEADER failed\n"); + Con_DPrint("ioctl CDIOREADTOCHEADER failed\n"); return -1; } if (tochdr.starting_track < 1) { - Con_DPrintf("CDAudio: no music tracks\n"); + Con_DPrint("CDAudio: no music tracks\n"); return -1; } @@ -94,7 +94,7 @@ int CDAudio_SysPlay (qbyte track) rte.data = &entry; if (ioctl(cdfile, CDIOREADTOCENTRYS, &rte) == -1) { - Con_DPrintf("ioctl CDIOREADTOCENTRYS failed\n"); + Con_DPrint("ioctl CDIOREADTOCENTRYS failed\n"); return -1; } if (entry.control & 4) // if it's a data track @@ -113,13 +113,13 @@ int CDAudio_SysPlay (qbyte track) if (ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1) { - Con_DPrintf("ioctl CDIOCPLAYTRACKS failed\n"); + Con_DPrint("ioctl CDIOCPLAYTRACKS failed\n"); return -1; } if (ioctl(cdfile, CDIOCRESUME) == -1) { - Con_DPrintf("ioctl CDIOCRESUME failed\n"); + Con_DPrint("ioctl CDIOCRESUME failed\n"); return -1; } @@ -149,7 +149,7 @@ int CDAudio_SysPause (void) if (ioctl(cdfile, CDIOCPAUSE) == -1) { - Con_DPrintf("ioctl CDIOCPAUSE failed\n"); + Con_DPrint("ioctl CDIOCPAUSE failed\n"); return -1; } @@ -163,7 +163,7 @@ int CDAudio_SysResume (void) return -1; if (ioctl(cdfile, CDIOCRESUME) == -1) - Con_DPrintf("ioctl CDIOCRESUME failed\n"); + Con_DPrint("ioctl CDIOCRESUME failed\n"); return 0; } @@ -186,7 +186,7 @@ int CDAudio_SysUpdate (void) if (ioctl(cdfile, CDIOCREADSUBCHANNEL, &subchnl) == -1) { - Con_DPrintf("ioctl CDIOCREADSUBCHANNEL failed\n"); + Con_DPrint("ioctl CDIOCREADSUBCHANNEL failed\n"); cdPlaying = false; return -1; } diff --git a/cd_linux.c b/cd_linux.c index 32c0c3f0..6331c00e 100644 --- a/cd_linux.c +++ b/cd_linux.c @@ -41,7 +41,7 @@ void CDAudio_SysEject (void) return; if (ioctl(cdfile, CDROMEJECT) == -1) - Con_DPrintf("ioctl CDROMEJECT failed\n"); + Con_DPrint("ioctl CDROMEJECT failed\n"); } @@ -51,7 +51,7 @@ void CDAudio_SysCloseDoor (void) return; if (ioctl(cdfile, CDROMCLOSETRAY) == -1) - Con_DPrintf("ioctl CDROMCLOSETRAY failed\n"); + Con_DPrint("ioctl CDROMCLOSETRAY failed\n"); } int CDAudio_SysGetAudioDiskInfo (void) @@ -60,13 +60,13 @@ int CDAudio_SysGetAudioDiskInfo (void) if (ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1) { - Con_DPrintf("ioctl CDROMREADTOCHDR failed\n"); + Con_DPrint("ioctl CDROMREADTOCHDR failed\n"); return -1; } if (tochdr.cdth_trk0 < 1) { - Con_DPrintf("CDAudio: no music tracks\n"); + Con_DPrint("CDAudio: no music tracks\n"); return -1; } @@ -87,7 +87,7 @@ int CDAudio_SysPlay (qbyte track) entry.cdte_format = CDROM_MSF; if (ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1) { - Con_DPrintf("ioctl CDROMREADTOCENTRY failed\n"); + Con_DPrint("ioctl CDROMREADTOCENTRY failed\n"); return -1; } if (entry.cdte_ctrl == CDROM_DATA_TRACK) @@ -106,13 +106,13 @@ int CDAudio_SysPlay (qbyte track) if (ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1) { - Con_DPrintf("ioctl CDROMPLAYTRKIND failed\n"); + Con_DPrint("ioctl CDROMPLAYTRKIND failed\n"); return -1; } if (ioctl(cdfile, CDROMRESUME) == -1) { - Con_DPrintf("ioctl CDROMRESUME failed\n"); + Con_DPrint("ioctl CDROMRESUME failed\n"); return -1; } @@ -141,7 +141,7 @@ int CDAudio_SysPause (void) if (ioctl(cdfile, CDROMPAUSE) == -1) { - Con_DPrintf("ioctl CDROMPAUSE failed\n"); + Con_DPrint("ioctl CDROMPAUSE failed\n"); return -1; } @@ -155,7 +155,7 @@ int CDAudio_SysResume (void) return -1; if (ioctl(cdfile, CDROMRESUME) == -1) - Con_DPrintf("ioctl CDROMRESUME failed\n"); + Con_DPrint("ioctl CDROMRESUME failed\n"); return 0; } @@ -171,7 +171,7 @@ int CDAudio_SysUpdate (void) subchnl.cdsc_format = CDROM_MSF; if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1) { - Con_DPrintf("ioctl CDROMSUBCHNL failed\n"); + Con_DPrint("ioctl CDROMSUBCHNL failed\n"); cdPlaying = false; return -1; } diff --git a/cd_shared.c b/cd_shared.c index bd2727f8..fd5ee0ed 100644 --- a/cd_shared.c +++ b/cd_shared.c @@ -217,7 +217,7 @@ static void CD_f (void) CDAudio_GetAudioDiskInfo(); if (!cdValid) { - Con_Printf("No CD in player.\n"); + Con_Print("No CD in player.\n"); return; } } @@ -328,13 +328,13 @@ int CDAudio_Startup (void) if (CDAudio_GetAudioDiskInfo()) { - Con_DPrintf("CDAudio_Init: No CD in player.\n"); + Con_DPrint("CDAudio_Init: No CD in player.\n"); cdValid = false; } initialized = true; - Con_DPrintf("CD Audio Initialized\n"); + Con_DPrint("CD Audio Initialized\n"); return 0; } diff --git a/cd_win.c b/cd_win.c index b6b5fac0..dee8ef63 100644 --- a/cd_win.c +++ b/cd_win.c @@ -55,12 +55,12 @@ int CDAudio_SysGetAudioDiskInfo(void) dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); if (dwReturn) { - Con_DPrintf("CDAudio: drive ready test - get status failed\n"); + Con_DPrint("CDAudio: drive ready test - get status failed\n"); return -1; } if (!mciStatusParms.dwReturn) { - Con_DPrintf("CDAudio: drive not ready\n"); + Con_DPrint("CDAudio: drive not ready\n"); return -1; } @@ -68,12 +68,12 @@ int CDAudio_SysGetAudioDiskInfo(void) dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); if (dwReturn) { - Con_DPrintf("CDAudio: get tracks - status failed\n"); + Con_DPrint("CDAudio: get tracks - status failed\n"); return -1; } if (mciStatusParms.dwReturn < 1) { - Con_DPrintf("CDAudio: no music tracks\n"); + Con_DPrint("CDAudio: no music tracks\n"); return -1; } @@ -135,7 +135,7 @@ int CDAudio_SysStop (void) if ((dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (DWORD)NULL))) { - Con_DPrintf("MCI_STOP failed (%i)", dwReturn); + Con_DPrintf("MCI_STOP failed (%i)\n", dwReturn); return -1; } return 0; @@ -149,7 +149,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)", dwReturn); + Con_DPrintf("MCI_PAUSE failed (%i)\n", dwReturn); return -1; } return 0; @@ -194,7 +194,7 @@ LONG CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) break; case MCI_NOTIFY_FAILURE: - Con_DPrintf("MCI_NOTIFY_FAILURE\n"); + Con_DPrint("MCI_NOTIFY_FAILURE\n"); CDAudio_Stop (); cdValid = false; break; @@ -246,5 +246,5 @@ int CDAudio_SysStartup (void) void CDAudio_SysShutdown (void) { if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL)) - Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n"); + Con_DPrint("CDAudio_Shutdown: MCI_CLOSE failed\n"); } diff --git a/cl_demo.c b/cl_demo.c index 69169758..c6402413 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -54,7 +54,7 @@ void CL_NextDemo (void) cls.demonum = 0; if (!cls.demos[cls.demonum][0]) { - Con_Printf ("No demos listed with startdemos\n"); + Con_Print("No demos listed with startdemos\n"); cls.demonum = -1; return; } @@ -212,7 +212,7 @@ void CL_Stop_f (void) if (!cls.demorecording) { - Con_Printf ("Not recording a demo.\n"); + Con_Print("Not recording a demo.\n"); return; } @@ -225,7 +225,7 @@ void CL_Stop_f (void) FS_Close (cls.demofile); cls.demofile = NULL; cls.demorecording = false; - Con_Printf ("Completed demo\n"); + Con_Print("Completed demo\n"); } /* @@ -246,19 +246,19 @@ void CL_Record_f (void) c = Cmd_Argc(); if (c != 2 && c != 3 && c != 4) { - Con_Printf ("record [ [cd track]]\n"); + Con_Print("record [ [cd track]]\n"); return; } if (strstr(Cmd_Argv(1), "..")) { - Con_Printf ("Relative pathnames are not allowed.\n"); + Con_Print("Relative pathnames are not allowed.\n"); return; } if (c == 2 && cls.state == ca_connected) { - Con_Printf("Can not record - already connected to server\nClient demo recording must be started before connecting\n"); + Con_Print("Can not record - already connected to server\nClient demo recording must be started before connecting\n"); return; } @@ -266,7 +266,7 @@ void CL_Record_f (void) if (c == 4) { track = atoi(Cmd_Argv(3)); - Con_Printf ("Forcing CD track to %i\n", cls.forcetrack); + Con_Printf("Forcing CD track to %i\n", cls.forcetrack); } else track = -1; @@ -280,16 +280,16 @@ void CL_Record_f (void) Cmd_ExecuteString ( va("map %s", Cmd_Argv(2)), src_command); // open the demo file - Con_Printf ("recording to %s.\n", name); + Con_Printf("recording to %s.\n", name); cls.demofile = FS_Open (name, "wb", false); if (!cls.demofile) { - Con_Printf ("ERROR: couldn't open.\n"); + Con_Print("ERROR: couldn't open.\n"); return; } cls.forcetrack = track; - FS_Printf (cls.demofile, "%i\n", cls.forcetrack); + FS_Printf(cls.demofile, "%i\n", cls.forcetrack); cls.demorecording = true; } @@ -313,7 +313,7 @@ void CL_PlayDemo_f (void) if (Cmd_Argc() != 2) { - Con_Printf ("play : plays a demo\n"); + Con_Print("play : plays a demo\n"); return; } @@ -327,11 +327,11 @@ void CL_PlayDemo_f (void) strlcpy (name, Cmd_Argv(1), sizeof (name)); FS_DefaultExtension (name, ".dem", sizeof (name)); - Con_Printf ("Playing demo from %s.\n", name); + Con_Printf("Playing demo from %s.\n", name); cls.demofile = FS_Open (name, "rb", false); if (!cls.demofile) { - Con_Printf ("ERROR: couldn't open.\n"); + Con_Print("ERROR: couldn't open.\n"); cls.demonum = -1; // stop demo loop return; } @@ -373,7 +373,7 @@ void CL_FinishTimeDemo (void) fpsavg = time > 0 ? frames / time : 0; fpsmax = cls.td_minframetime > 0 ? 1.0 / cls.td_minframetime : 0; // LordHavoc: timedemo now prints out 7 digits of fraction, and min/avg/max - Con_Printf ("%i frames %5.7f seconds %5.7f fps\nmin/avg/max: %5.7f/%5.7f/%5.7f\n", frames, time, fpsavg, fpsmin, fpsavg, fpsmax); + Con_Printf("%i frames %5.7f seconds %5.7f fps\nmin/avg/max: %5.7f/%5.7f/%5.7f\n", frames, time, fpsavg, fpsmin, fpsavg, fpsmax); } /* @@ -390,7 +390,7 @@ void CL_TimeDemo_f (void) if (Cmd_Argc() != 2) { - Con_Printf ("timedemo : gets demo speeds\n"); + Con_Print("timedemo : gets demo speeds\n"); return; } diff --git a/cl_input.c b/cl_input.c index c3fef756..fac600f9 100644 --- a/cl_input.c +++ b/cl_input.c @@ -77,7 +77,7 @@ void KeyDown (kbutton_t *b) b->down[1] = k; else { - Con_Printf ("Three keys down for a button!\n"); + Con_Print("Three keys down for a button!\n"); return; } @@ -463,7 +463,7 @@ void CL_SendMove(usercmd_t *cmd) if (NetConn_SendUnreliableMessage(cls.netcon, &buf) == -1) { - Con_Printf("CL_SendMove: lost server connection\n"); + Con_Print("CL_SendMove: lost server connection\n"); CL_Disconnect(); } } diff --git a/cl_main.c b/cl_main.c index f934ef3a..e98a9321 100644 --- a/cl_main.c +++ b/cl_main.c @@ -177,7 +177,7 @@ void CL_Disconnect(void) if (cls.demorecording) CL_Stop_f(); - Con_DPrintf("Sending clc_disconnect\n"); + Con_DPrint("Sending clc_disconnect\n"); SZ_Clear(&cls.message); MSG_WriteByte(&cls.message, clc_disconnect); NetConn_SendUnreliableMessage(cls.netcon, &cls.message); @@ -248,7 +248,7 @@ void CL_EstablishConnection(const char *host) } else { - Con_Printf("Unable to find a suitable network socket to connect to server.\n"); + Con_Print("Unable to find a suitable network socket to connect to server.\n"); strcpy(m_return_reason, "No network"); } } @@ -275,7 +275,7 @@ static void CL_PrintEntities_f(void) strcpy(name, "--no model--"); for (j = strlen(name);j < 25;j++) name[j] = ' '; - Con_Printf ("%3i: %s:%04i (%5i %5i %5i) [%3i %3i %3i] %4.2f %5.3f\n", i, name, ent->render.frame, (int) ent->render.origin[0], (int) ent->render.origin[1], (int) ent->render.origin[2], (int) ent->render.angles[0] % 360, (int) ent->render.angles[1] % 360, (int) ent->render.angles[2] % 360, ent->render.scale, ent->render.alpha); + Con_Printf("%3i: %s:%04i (%5i %5i %5i) [%3i %3i %3i] %4.2f %5.3f\n", i, name, ent->render.frame, (int) ent->render.origin[0], (int) ent->render.origin[1], (int) ent->render.origin[2], (int) ent->render.angles[0] % 360, (int) ent->render.angles[1] % 360, (int) ent->render.angles[2] % 360, ent->render.scale, ent->render.alpha); } } @@ -1179,7 +1179,7 @@ void CL_SendCmd(usercmd_t *cmd) { if (developer.integer) { - Con_Printf("CL_SendCmd: sending reliable message:\n"); + Con_Print("CL_SendCmd: sending reliable message:\n"); SZ_HexDumpToConsole(&cls.message); } if (NetConn_SendReliableMessage(cls.netcon, &cls.message) == -1) @@ -1193,9 +1193,9 @@ static void CL_PauseDemo_f (void) { cls.demopaused = !cls.demopaused; if (cls.demopaused) - Con_Printf("Demo paused\n"); + Con_Print("Demo paused\n"); else - Con_Printf("Demo unpaused\n"); + Con_Print("Demo unpaused\n"); } /* @@ -1207,7 +1207,7 @@ static void CL_Fog_f (void) { if (Cmd_Argc () == 1) { - Con_Printf ("\"fog\" is \"%f %f %f %f\"\n", fog_density, fog_red, fog_green, fog_blue); + Con_Printf("\"fog\" is \"%f %f %f %f\"\n", fog_density, fog_red, fog_green, fog_blue); return; } fog_density = atof(Cmd_Argv(1)); diff --git a/cl_parse.c b/cl_parse.c index 7accccbe..46065b14 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -197,7 +197,7 @@ void CL_KeepaliveMessage (void) lastmsg = time; // write out a nop // LordHavoc: must use unreliable because reliable could kill the sigon message! - Con_Printf("--> client to server keepalive\n"); + Con_Print("--> client to server keepalive\n"); msg.data = buf; msg.maxsize = sizeof(buf); msg.cursize = 0; @@ -267,7 +267,7 @@ static void CL_SignonReply (void) { //char str[8192]; -Con_DPrintf ("CL_SignonReply: %i\n", cls.signon); +Con_DPrintf("CL_SignonReply: %i\n", cls.signon); switch (cls.signon) { @@ -323,7 +323,7 @@ void CL_ParseServerInfo (void) int nummodels, numsounds; entity_t *ent; - Con_DPrintf ("Serverinfo packet received.\n"); + Con_DPrint("Serverinfo packet received.\n"); // // wipe the client_state_t struct // @@ -360,10 +360,7 @@ void CL_ParseServerInfo (void) // seperate the printfs so the server message can have a color if (cl.protocol != PROTOCOL_NEHAHRAMOVIE) // no messages when playing the Nehahra movie - { - Con_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n"); - Con_Printf("%c%s\n", 2, str); - } + Con_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n\2%s", str); // check memory integrity Mem_CheckSentinelsGlobal(); @@ -1016,7 +1013,7 @@ void CL_ParseBeam (model_t *m, int lightning) return; } } - Con_Printf ("beam list overflow!\n"); + Con_Print("beam list overflow!\n"); } void CL_ParseTempEntity(void) @@ -1404,7 +1401,7 @@ void CL_ParseTempEntity(void) } } -#define SHOWNET(x) if(cl_shownet.integer==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x); +#define SHOWNET(x) if(cl_shownet.integer==2)Con_Printf("%3i:%s\n", msg_readcount-1, x); static qbyte cgamenetbuffer[65536]; @@ -1431,9 +1428,9 @@ void CL_ParseServerMessage(void) // if recording demos, copy the message out // if (cl_shownet.integer == 1) - Con_Printf ("%f %i\n", realtime, net_message.cursize); + Con_Printf("%f %i\n", realtime, net_message.cursize); else if (cl_shownet.integer == 2) - Con_Printf ("------------------\n"); + Con_Print("------------------\n"); cl.onground = false; // unless the server says otherwise // @@ -1510,14 +1507,14 @@ void CL_ParseServerMessage(void) i &= 31; } description[strlen(description)-1] = '\n'; // replace the last space with a newline - Con_Printf("%s", description); + Con_Print(description); Host_Error ("CL_ParseServerMessage: Illegible server message\n"); } break; case svc_nop: if (cls.signon < SIGNONS) - Con_Printf("<-- server to client keepalive\n"); + Con_Print("<-- server to client keepalive\n"); break; case svc_time: @@ -1551,11 +1548,11 @@ void CL_ParseServerMessage(void) Host_EndGame ("Server disconnected\n"); case svc_print: - Con_Printf ("%s", MSG_ReadString ()); + Con_Print(MSG_ReadString()); break; case svc_centerprint: - SCR_CenterPrint (MSG_ReadString ()); + SCR_CenterPrint(MSG_ReadString ()); break; case svc_stufftext: @@ -1717,13 +1714,13 @@ void CL_ParseServerMessage(void) case svc_finale: cl.intermission = 2; cl.completed_time = cl.time; - SCR_CenterPrint (MSG_ReadString ()); + SCR_CenterPrint(MSG_ReadString ()); break; case svc_cutscene: cl.intermission = 3; cl.completed_time = cl.time; - SCR_CenterPrint (MSG_ReadString ()); + SCR_CenterPrint(MSG_ReadString ()); break; case svc_sellscreen: @@ -1795,7 +1792,7 @@ void CL_Parse_DumpPacket(void) { if (!parsingerror) return; - Con_Printf("Packet dump:\n"); + Con_Print("Packet dump:\n"); SZ_HexDumpToConsole(&net_message); parsingerror = false; } diff --git a/cl_particles.c b/cl_particles.c index 1b0d3edd..3129fa55 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -546,11 +546,11 @@ void CL_ReadPointFile_f (void) #endif if (!pointfile) { - Con_Printf ("Could not open %s\n", name); + Con_Printf("Could not open %s\n", name); return; } - Con_Printf ("Reading %s...\n", name); + Con_Printf("Reading %s...\n", name); c = 0; s = 0; pointfilepos = pointfile; @@ -584,7 +584,7 @@ void CL_ReadPointFile_f (void) Mem_Free(pointfile); #endif VectorCopy(leakorg, org); - Con_Printf ("%i points read (%i particles spawned)\nLeak at %f %f %f\n", c, s, org[0], org[1], org[2]); + Con_Printf("%i points read (%i particles spawned)\nLeak at %f %f %f\n", c, s, org[0], org[1], org[2]); particle(pt_static, PARTICLE_BEAM, 0xFF0000, 0xFF0000, tex_beam, false, PBLEND_ALPHA, 64, 64, 255, 0, 99999, 0, 0, org[0] - 4096, org[1], org[2], 0, 0, 0, 0, org[0] + 4096, org[1], org[2], 0, 0); particle(pt_static, PARTICLE_BEAM, 0x00FF00, 0x00FF00, tex_beam, false, PBLEND_ALPHA, 64, 64, 255, 0, 99999, 0, 0, org[0], org[1] - 4096, org[2], 0, 0, 0, 0, org[0], org[1] + 4096, org[2], 0, 0); diff --git a/cl_screen.c b/cl_screen.c index 595808a9..0d2ce23f 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -63,7 +63,7 @@ Called for important messages that should stay in the center of the screen for a few moments ============== */ -void SCR_CenterPrint (char *str) +void SCR_CenterPrint(char *str) { strlcpy (scr_centerstring, str, sizeof (scr_centerstring)); scr_centertime_off = scr_centertime.value; @@ -614,7 +614,7 @@ void DrawQ_SetClipArea(float x, float y, float width, float height) drawqueue_t * dq; if(r_refdef.drawqueuesize + (int)sizeof(*dq) > r_refdef.maxdrawqueuesize) { - Con_DPrintf("DrawQueue full !\n"); + Con_DPrint("DrawQueue full !\n"); return; } dq = (void*) (r_refdef.drawqueue + r_refdef.drawqueuesize); @@ -635,7 +635,7 @@ void DrawQ_ResetClipArea(void) drawqueue_t *dq; if(r_refdef.drawqueuesize + (int)sizeof(*dq) > r_refdef.maxdrawqueuesize) { - Con_DPrintf("DrawQueue full !\n"); + Con_DPrint("DrawQueue full !\n"); return; } dq = (void*) (r_refdef.drawqueue + r_refdef.drawqueuesize); @@ -673,7 +673,7 @@ void SCR_ScreenShot_f (void) break; if (shotnumber >= 1000000) { - Con_Printf("SCR_ScreenShot_f: Couldn't create the image file\n"); + Con_Print("SCR_ScreenShot_f: Couldn't create the image file\n"); return; } @@ -740,7 +740,7 @@ static void R_Envmap_f (void) if (Cmd_Argc() != 3) { - Con_Printf ("envmap : save out 6 cubic environment map images, usable with loadsky, note that size must one of 128, 256, 512, or 1024 and can't be bigger than your current resolution\n"); + Con_Print("envmap : save out 6 cubic environment map images, usable with loadsky, note that size must one of 128, 256, 512, or 1024 and can't be bigger than your current resolution\n"); return; } @@ -748,12 +748,12 @@ static void R_Envmap_f (void) size = atoi(Cmd_Argv(2)); if (size != 128 && size != 256 && size != 512 && size != 1024) { - Con_Printf("envmap: size must be one of 128, 256, 512, or 1024\n"); + Con_Print("envmap: size must be one of 128, 256, 512, or 1024\n"); return; } if (size > vid.realwidth || size > vid.realheight) { - Con_Printf("envmap: your resolution is not big enough to render that size\n"); + Con_Print("envmap: your resolution is not big enough to render that size\n"); return; } diff --git a/cl_video.c b/cl_video.c index b9b215d1..c6c094c3 100644 --- a/cl_video.c +++ b/cl_video.c @@ -189,7 +189,7 @@ static void CL_PlayVideo_f(void) if (Cmd_Argc() != 2) { - Con_Printf ("usage: playvideo \nplays video named video/.dpv\n"); + Con_Print("usage: playvideo \nplays video named video/.dpv\n"); return; } diff --git a/cmd.c b/cmd.c index 79168528..5d6121d1 100644 --- a/cmd.c +++ b/cmd.c @@ -93,7 +93,7 @@ void Cbuf_AddText (const char *text) if (cmd_text.cursize + l >= cmd_text.maxsize) { - Con_Printf ("Cbuf_AddText: overflow\n"); + Con_Print("Cbuf_AddText: overflow\n"); return; } @@ -224,7 +224,7 @@ void Cmd_StuffCmds_f (void) if (Cmd_Argc () != 1) { - Con_Printf ("stuffcmds : execute command line parameters\n"); + Con_Print("stuffcmds : execute command line parameters\n"); return; } @@ -292,17 +292,17 @@ static void Cmd_Exec_f (void) if (Cmd_Argc () != 2) { - Con_Printf ("exec : execute a script file\n"); + Con_Print("exec : execute a script file\n"); return; } f = (char *)FS_LoadFile (Cmd_Argv(1), false); if (!f) { - Con_Printf ("couldn't exec %s\n",Cmd_Argv(1)); + Con_Printf("couldn't exec %s\n",Cmd_Argv(1)); return; } - Con_DPrintf ("execing %s\n",Cmd_Argv(1)); + Con_DPrintf("execing %s\n",Cmd_Argv(1)); Cbuf_InsertText (f); Mem_Free(f); @@ -321,8 +321,8 @@ static void Cmd_Echo_f (void) int i; for (i=1 ; inext) - Con_Printf ("%s : %s\n", a->name, a->value); + Con_Printf("%s : %s\n", a->name, a->value); return; } s = Cmd_Argv(1); if (strlen(s) >= MAX_ALIAS_NAME) { - Con_Printf ("Alias name is too long\n"); + Con_Print("Alias name is too long\n"); return; } @@ -454,15 +454,15 @@ static void Cmd_List_f (void) { if (partial && strncmp(partial, cmd->name, len)) continue; - Con_Printf ("%s\n", cmd->name); + Con_Printf("%s\n", cmd->name); count++; } - Con_Printf ("%i Command%s", count, (count > 1) ? "s" : ""); + Con_Printf("%i Command%s", count, (count > 1) ? "s" : ""); if (partial) Con_Printf(" beginning with \"%s\"", partial); - Con_Printf ("\n\n"); + Con_Print("\n\n"); } /* @@ -584,7 +584,7 @@ void Cmd_AddCommand (const char *cmd_name, xcommand_t function) // fail if the command is a variable name if (Cvar_VariableString(cmd_name)[0]) { - Con_Printf ("Cmd_AddCommand: %s already defined as a var\n", cmd_name); + Con_Printf("Cmd_AddCommand: %s already defined as a var\n", cmd_name); return; } @@ -593,7 +593,7 @@ void Cmd_AddCommand (const char *cmd_name, xcommand_t function) { if (!strcmp (cmd_name, cmd->name)) { - Con_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name); + Con_Printf("Cmd_AddCommand: %s already defined\n", cmd_name); return; } } @@ -841,7 +841,7 @@ void Cmd_ExecuteString (const char *text, cmd_source_t src) // check cvars (always) if (!Cvar_Command () && host_initialized) - Con_Printf ("Unknown command \"%s\"\n", Cmd_Argv(0)); + Con_Printf("Unknown command \"%s\"\n", Cmd_Argv(0)); cmd_tokenizebufferpos = oldpos; } @@ -856,10 +856,10 @@ Sends the entire command line over to the server */ void Cmd_ForwardToServer (void) { - char *s; + const char *s; if (cls.state != ca_connected) { - Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0)); + Con_Printf("Can't \"%s\", not connected\n", Cmd_Argv(0)); return; } @@ -872,7 +872,7 @@ void Cmd_ForwardToServer (void) if (strcasecmp(Cmd_Argv(0), "cmd") != 0) s = va("%s %s", Cmd_Argv(0), Cmd_Argc() > 1 ? Cmd_Args() : "\n"); else - s = va("%s", Cmd_Argc() > 1 ? Cmd_Args() : "\n"); + s = Cmd_Argc() > 1 ? Cmd_Args() : "\n"; MSG_WriteByte(&cls.message, clc_stringcmd); SZ_Write(&cls.message, s, strlen(s) + 1); } diff --git a/cmd.h b/cmd.h index bc74058f..04e44e27 100644 --- a/cmd.h +++ b/cmd.h @@ -131,7 +131,7 @@ void Cmd_ForwardToServer (void); // things like godmode, noclip, etc, are commands directed to the server, // so when they are typed in at the console, they will need to be forwarded. -void Cmd_Print (const char *text); +void Cmd_Print(const char *text); // used by command functions to send output to either the graphics console or // passed as a print message to the client diff --git a/collision.c b/collision.c index 983dc09f..f7279c72 100644 --- a/collision.c +++ b/collision.c @@ -71,7 +71,7 @@ loc0: if (t->trace->allsolid) t->trace->startsolid = true; #if COLLISIONPARANOID >= 3 - Con_Printf("S"); + Con_Print("S"); #endif return HULLCHECKSTATE_SOLID; } @@ -79,7 +79,7 @@ loc0: { t->trace->allsolid = false; #if COLLISIONPARANOID >= 3 - Con_Printf("E"); + Con_Print("E"); #endif return HULLCHECKSTATE_EMPTY; } @@ -105,7 +105,7 @@ loc0: if (t2 < 0) { #if COLLISIONPARANOID >= 3 - Con_Printf("<"); + Con_Print("<"); #endif num = node->children[1]; goto loc0; @@ -117,7 +117,7 @@ loc0: if (t2 >= 0) { #if COLLISIONPARANOID >= 3 - Con_Printf(">"); + Con_Print(">"); #endif num = node->children[0]; goto loc0; @@ -128,7 +128,7 @@ loc0: // the line intersects, find intersection point // LordHavoc: this uses the original trace for maximum accuracy #if COLLISIONPARANOID >= 3 - Con_Printf("M"); + Con_Print("M"); #endif if (plane->type < 3) { @@ -179,7 +179,7 @@ loc0: t->trace->fraction = bound(0, midf, 1); #if COLLISIONPARANOID >= 3 - Con_Printf("D"); + Con_Print("D"); #endif return HULLCHECKSTATE_DONE; } @@ -333,14 +333,14 @@ void Collision_ValidateBrush(colbrushf_t *brush) printbrush = false; if (!brush->numpoints) { - Con_Printf("Collision_ValidateBrush: brush with no points!\n"); + Con_Print("Collision_ValidateBrush: brush with no points!\n"); printbrush = true; } #if 0 // it's ok for a brush to have one point and no planes... if (brush->numplanes == 0 && brush->numpoints != 1) { - Con_Printf("Collision_ValidateBrush: brush with no planes and more than one point!\n"); + Con_Print("Collision_ValidateBrush: brush with no planes and more than one point!\n"); printbrush = true; } #endif @@ -365,7 +365,7 @@ void Collision_ValidateBrush(colbrushf_t *brush) } if (pointsoffplanes == 0) // all points are on all planes { - Con_Printf("Collision_ValidateBrush: all points lie on all planes (degenerate, no brush volume!)\n"); + Con_Print("Collision_ValidateBrush: all points lie on all planes (degenerate, no brush volume!)\n"); printbrush = true; } } @@ -432,7 +432,7 @@ colbrushf_t *Collision_NewBrushFromPlanes(mempool_t *mempool, int numoriginalpla // check if there are too many and skip the brush if (numplanes >= 256) { - Con_Printf("Mod_Q3BSP_LoadBrushes: failed to build collision brush: too many planes for buffer\n"); + Con_Print("Mod_Q3BSP_LoadBrushes: failed to build collision brush: too many planes for buffer\n"); return NULL; } @@ -463,14 +463,14 @@ colbrushf_t *Collision_NewBrushFromPlanes(mempool_t *mempool, int numoriginalpla // check if there are too many polygon vertices for buffer if (numpolypoints > maxpolypoints) { - Con_Printf("Collision_NewBrushFromPlanes: failed to build collision brush: too many points for buffer\n"); + Con_Print("Collision_NewBrushFromPlanes: failed to build collision brush: too many points for buffer\n"); return NULL; } // check if there are too many triangle elements for buffer if (numelements + (w->numpoints - 2) * 3 > maxelements) { - Con_Printf("Collision_NewBrushFromPlanes: failed to build collision brush: too many triangle elements for buffer\n"); + Con_Print("Collision_NewBrushFromPlanes: failed to build collision brush: too many triangle elements for buffer\n"); return NULL; } @@ -487,7 +487,7 @@ colbrushf_t *Collision_NewBrushFromPlanes(mempool_t *mempool, int numoriginalpla // check if there are too many and skip the brush if (numpoints >= 256) { - Con_Printf("Collision_NewBrushFromPlanes: failed to build collision brush: too many points for buffer\n"); + Con_Print("Collision_NewBrushFromPlanes: failed to build collision brush: too many points for buffer\n"); Winding_Free(w); return NULL; } @@ -771,7 +771,7 @@ void Collision_TraceBrushBrushFloat(trace_t *trace, const colbrushf_t *thisbrush // any brush with degenerate planes is not worth handling if (DotProduct(startplane->normal, startplane->normal) < 0.9f || DotProduct(endplane->normal, endplane->normal) < 0.9f) { - Con_Printf("Collision_TraceBrushBrushFloat: degenerate thisbrush plane!\n"); + Con_Print("Collision_TraceBrushBrushFloat: degenerate thisbrush plane!\n"); return; } f = furthestplanedist_float(startplane->normal, thisbrush_start->points, thisbrush_start->numpoints); @@ -790,7 +790,7 @@ void Collision_TraceBrushBrushFloat(trace_t *trace, const colbrushf_t *thisbrush // any brush with degenerate planes is not worth handling if (DotProduct(startplane->normal, startplane->normal) < 0.9f || DotProduct(endplane->normal, endplane->normal) < 0.9f) { - Con_Printf("Collision_TraceBrushBrushFloat: degenerate thatbrush plane!\n"); + Con_Print("Collision_TraceBrushBrushFloat: degenerate thatbrush plane!\n"); return; } f = furthestplanedist_float(startplane->normal, thatbrush_start->points, thatbrush_start->numpoints); @@ -917,7 +917,7 @@ void Collision_TraceLineBrushFloat(trace_t *trace, const vec3_t linestart, const // any brush with degenerate planes is not worth handling if (DotProduct(startplane->normal, startplane->normal) < 0.9f || DotProduct(endplane->normal, endplane->normal) < 0.9f) { - Con_Printf("Collision_TraceLineBrushFloat: degenerate plane!\n"); + Con_Print("Collision_TraceLineBrushFloat: degenerate plane!\n"); return; } if (thatbrush_start->numpoints) @@ -1045,7 +1045,7 @@ void Collision_TraceBrushPolygonFloat(trace_t *trace, const colbrushf_t *thisbru { if (numpoints > 256) { - Con_Printf("Polygon with more than 256 points not supported yet (fixme!)\n"); + Con_Print("Polygon with more than 256 points not supported yet (fixme!)\n"); return; } polyf_brush.numpoints = numpoints; @@ -1094,7 +1094,7 @@ void Collision_TraceLinePolygonFloat(trace_t *trace, const vec3_t linestart, con { if (numpoints > 256) { - Con_Printf("Polygon with more than 256 points not supported yet (fixme!)\n"); + Con_Print("Polygon with more than 256 points not supported yet (fixme!)\n"); return; } polyf_brush.numpoints = numpoints; @@ -1155,7 +1155,7 @@ void Collision_TraceBrushPolygonTransformFloat(trace_t *trace, const colbrushf_t int i; if (numpoints > 256) { - Con_Printf("Polygon with more than 256 points not supported yet (fixme!)\n"); + Con_Print("Polygon with more than 256 points not supported yet (fixme!)\n"); return; } polyf_brushstart.numpoints = numpoints; diff --git a/common.c b/common.c index a1f1b405..03f4b450 100644 --- a/common.c +++ b/common.c @@ -404,7 +404,7 @@ void *SZ_GetSpace (sizebuf_t *buf, int length) Host_Error ("SZ_GetSpace: %i is > full buffer size\n", length); buf->overflowed = true; - Con_Printf ("SZ_GetSpace: overflow\n"); + Con_Print("SZ_GetSpace: overflow\n"); SZ_Clear (buf); } @@ -470,7 +470,7 @@ void Com_HexDumpToConsole(const qbyte *data, int size) if (cur >= flushpointer || i >= size) { *cur++ = 0; - Con_Printf("%s", text); + Con_Print(text); cur = text; } } @@ -695,14 +695,14 @@ void COM_CheckRegistered (void) if (!FS_FileExists("gfx/pop.lmp")) { if (fs_modified) - Con_Printf ("Playing shareware version, with modification.\nwarning: most mods require full quake data.\n"); + Con_Print("Playing shareware version, with modification.\nwarning: most mods require full quake data.\n"); else - Con_Printf ("Playing shareware version.\n"); + Con_Print("Playing shareware version.\n"); return; } Cvar_Set ("registered", "1"); - Con_Printf ("Playing registered version.\n"); + Con_Print("Playing registered version.\n"); } diff --git a/common.h b/common.h index 150f3136..3602065c 100644 --- a/common.h +++ b/common.h @@ -47,7 +47,7 @@ void SZ_Free (sizebuf_t *buf); void SZ_Clear (sizebuf_t *buf); void *SZ_GetSpace (sizebuf_t *buf, int length); void SZ_Write (sizebuf_t *buf, const void *data, int length); -void SZ_Print (sizebuf_t *buf, const char *data); // strcats onto the sizebuf +void SZ_Print(sizebuf_t *buf, const char *data); // strcats onto the sizebuf void SZ_HexDumpToConsole(const sizebuf_t *buf); void Com_HexDumpToConsole(const qbyte *data, int size); diff --git a/conproc.c b/conproc.c index 30ac3339..a991fe5d 100644 --- a/conproc.c +++ b/conproc.c @@ -59,7 +59,7 @@ void InitConProc (HANDLE hFile, HANDLE heventParent, HANDLE heventChild) if (!heventDone) { - Con_SafePrintf ("Couldn't create heventDone\n"); + Con_SafePrint("Couldn't create heventDone\n"); return; } @@ -71,7 +71,7 @@ void InitConProc (HANDLE hFile, HANDLE heventParent, HANDLE heventChild) &dwID)) { CloseHandle (heventDone); - Con_SafePrintf ("Couldn't create QHOST thread\n"); + Con_SafePrint("Couldn't create QHOST thread\n"); return; } @@ -114,7 +114,7 @@ DWORD RequestProc (DWORD dwNichts) // hfileBuffer is invalid. Just leave. if (!pBuffer) { - Con_SafePrintf ("Invalid hfileBuffer\n"); + Con_SafePrint("Invalid hfileBuffer\n"); break; } diff --git a/console.c b/console.c index a30796b1..087915ba 100644 --- a/console.c +++ b/console.c @@ -231,7 +231,7 @@ void Con_Init (void) con_linewidth = -1; Con_CheckResize (); - Con_Printf ("Console initialized.\n"); + Con_Print("Console initialized.\n"); // // register our commands @@ -261,14 +261,14 @@ void Con_Linefeed (void) /* ================ -Con_Print +Con_PrintToHistory Handles cursor positioning, line wrapping, etc All console printing must go through this in order to be displayed If no console is visible, the notify window will pop up. ================ */ -void Con_Print (const char *txt) +void Con_PrintToHistory(const char *txt) { int y, c, l, mask; static int cr; @@ -349,50 +349,57 @@ void Con_Print (const char *txt) } } +// LordHavoc: increased from 4096 to 16384 +#define MAXPRINTMSG 16384 /* ================ -Con_DebugLog +Con_LogPrint ================ */ -void Con_DebugLog (const char *msg) +void Con_LogPrint(const char *logfilename, const char *msg) { - qfile_t* file; - - file = FS_Open ("qconsole.log", "at", true); + qfile_t *file; + file = FS_Open(logfilename, "at", true); if (file) { - FS_Printf (file, "%s", msg); - FS_Close (file); + FS_Print(file, msg); + FS_Close(file); } } - /* ================ -Con_Printf - -Handles cursor positioning, line wrapping, etc +Con_LogPrintf ================ */ -// LordHavoc: increased from 4096 to 16384 -#define MAXPRINTMSG 16384 -// FIXME: make a buffer size safe vsprintf? -void Con_Printf (const char *fmt, ...) +void Con_LogPrintf(const char *logfilename, const char *fmt, ...) { va_list argptr; char msg[MAXPRINTMSG]; - va_start (argptr,fmt); - vsprintf (msg,fmt,argptr); - va_end (argptr); + va_start(argptr,fmt); + vsprintf(msg,fmt,argptr); + va_end(argptr); + Con_LogPrint(logfilename, msg); +} + +/* +================ +Con_Print + +Prints to all appropriate console targets +================ +*/ +void Con_Print(const char *msg) +{ // also echo to debugging console - Sys_Printf ("%s", msg); + Sys_Print(msg); // log all messages to file if (con_debuglog) - Con_DebugLog (msg); + Con_LogPrint("qconsole.log", msg); if (!con_initialized) return; @@ -401,7 +408,40 @@ void Con_Printf (const char *fmt, ...) return; // no graphics mode // write it to the scrollable buffer - Con_Print (msg); + Con_PrintToHistory(msg); +} + +/* +================ +Con_Printf + +Prints to all appropriate console targets +================ +*/ +void Con_Printf(const char *fmt, ...) +{ + va_list argptr; + char msg[MAXPRINTMSG]; + + va_start(argptr,fmt); + vsprintf(msg,fmt,argptr); + va_end(argptr); + + Con_Print(msg); +} + +/* +================ +Con_DPrint + +A Con_Print that only shows up if the "developer" cvar is set +================ +*/ +void Con_DPrint(const char *msg) +{ + if (!developer.integer) + return; // don't confuse non-developers with techie stuff... + Con_Print(msg); } /* @@ -411,7 +451,7 @@ Con_DPrintf A Con_Printf that only shows up if the "developer" cvar is set ================ */ -void Con_DPrintf (const char *fmt, ...) +void Con_DPrintf(const char *fmt, ...) { va_list argptr; char msg[MAXPRINTMSG]; @@ -419,14 +459,26 @@ void Con_DPrintf (const char *fmt, ...) if (!developer.integer) return; // don't confuse non-developers with techie stuff... - va_start (argptr,fmt); - vsprintf (msg,fmt,argptr); - va_end (argptr); + va_start(argptr,fmt); + vsprintf(msg,fmt,argptr); + va_end(argptr); - Con_Printf ("%s", msg); + Con_Print(msg); } +/* +================ +Con_SafePrint + +Okay to call even when the screen can't be updated +================== +*/ +void Con_SafePrint(const char *msg) +{ + Con_Print(msg); +} + /* ================== Con_SafePrintf @@ -434,16 +486,16 @@ Con_SafePrintf Okay to call even when the screen can't be updated ================== */ -void Con_SafePrintf (const char *fmt, ...) +void Con_SafePrintf(const char *fmt, ...) { - va_list argptr; - char msg[1024]; + va_list argptr; + char msg[MAXPRINTMSG]; - va_start (argptr,fmt); - vsprintf (msg,fmt,argptr); - va_end (argptr); + va_start(argptr,fmt); + vsprintf(msg,fmt,argptr); + va_end(argptr); - Con_Printf ("%s", msg); + Con_Print(msg); } @@ -629,20 +681,20 @@ void Con_DisplayList(const char **list) while (*list) { len = strlen(*list); if (pos + maxlen >= width) { - Con_Printf("\n"); + Con_Print("\n"); pos = 0; } - Con_Printf("%s", *list); + Con_Print(*list); for (i = 0; i < (maxlen - len); i++) - Con_Printf(" "); + Con_Print(" "); pos += maxlen; list++; } if (pos) - Con_Printf("\n\n"); + Con_Print("\n\n"); } /* @@ -702,10 +754,10 @@ void Con_CompleteCommandLine (void) cmd_len++; } while (i == 3); // 'quakebar' - Con_Printf("\n\35"); + Con_Print("\n\35"); for (i = 0; i < con_linewidth - 4; i++) - Con_Printf("\36"); - Con_Printf("\37\n"); + Con_Print("\36"); + Con_Print("\37\n"); // Print Possible Commands if (c) { diff --git a/console.h b/console.h index 780082b0..d8b56ed3 100644 --- a/console.h +++ b/console.h @@ -33,10 +33,14 @@ void Con_CheckResize (void); void Con_InitLogging (void); void Con_Init (void); void Con_DrawConsole (int lines); -void Con_Print (const char *txt); -void Con_Printf (const char *fmt, ...); -void Con_DPrintf (const char *fmt, ...); -void Con_SafePrintf (const char *fmt, ...); +void Con_Print(const char *txt); +void Con_Printf(const char *fmt, ...); +void Con_DPrint(const char *msg); +void Con_DPrintf(const char *fmt, ...); +void Con_SafePrint(const char *msg); +void Con_SafePrintf(const char *fmt, ...); +void Con_LogPrint(const char *logfilename, const char *msg); +void Con_LogPrintf(const char *logfilename, const char *fmt, ...); void Con_Clear_f (void); void Con_DrawNotify (void); void Con_ClearNotify (void); diff --git a/cvar.c b/cvar.c index db209739..98a7207e 100644 --- a/cvar.c +++ b/cvar.c @@ -187,7 +187,7 @@ void Cvar_SetQuick (cvar_t *var, const char *value) if (var == NULL) { - Con_Printf("Cvar_SetQuick: var == NULL\n"); + Con_Print("Cvar_SetQuick: var == NULL\n"); return; } @@ -206,11 +206,8 @@ void Cvar_SetQuick (cvar_t *var, const char *value) strcpy (var->string, value); var->value = atof (var->string); var->integer = (int) var->value; - if ((var->flags & CVAR_NOTIFY) && changed) - { - if (sv.active) - SV_BroadcastPrintf ("\"%s\" changed to \"%s\"\n", var->name, var->string); - } + if ((var->flags & CVAR_NOTIFY) && changed && sv.active) + SV_BroadcastPrintf("\"%s\" changed to \"%s\"\n", var->name, var->string); } void Cvar_Set (const char *var_name, const char *value) @@ -220,12 +217,12 @@ void Cvar_Set (const char *var_name, const char *value) if (var == NULL) { // there is an error in C code if this happens - Con_Printf ("Cvar_Set: variable %s not found\n", var_name); + Con_Printf("Cvar_Set: variable %s not found\n", var_name); return; } if (var->flags & CVAR_READONLY) { - Con_Printf ("Cvar_Set: %s is read-only\n", var_name); + Con_Printf("Cvar_Set: %s is read-only\n", var_name); return; } @@ -273,14 +270,14 @@ void Cvar_RegisterVariable (cvar_t *variable) // first check to see if it has already been defined if (Cvar_FindVar (variable->name)) { - Con_Printf ("Can't register variable %s, already defined\n", variable->name); + Con_Printf("Can't register variable %s, already defined\n", variable->name); return; } // check for overlap with a command if (Cmd_Exists (variable->name)) { - Con_Printf ("Cvar_RegisterVariable: %s is a command\n", variable->name); + Con_Printf("Cvar_RegisterVariable: %s is a command\n", variable->name); return; } @@ -317,7 +314,7 @@ qboolean Cvar_Command (void) { // only print if host_initialized (otherwise it could print twice if this is in a script) if (host_initialized) - Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string); + Con_Printf("\"%s\" is \"%s\"\n", v->name, v->string); return true; } @@ -340,7 +337,7 @@ void Cvar_WriteVariables (qfile_t *f) for (var = cvar_vars ; var ; var = var->next) if (var->flags & CVAR_SAVE) - FS_Printf (f, "%s \"%s\"\n", var->name, var->string); + FS_Printf(f, "%s \"%s\"\n", var->name, var->string); } @@ -374,14 +371,14 @@ void Cvar_List_f (void) if (partial && strncmp (partial,cvar->name,len)) continue; - Con_Printf ("%s is \"%s\"\n", cvar->name, cvar->string); + Con_Printf("%s is \"%s\"\n", cvar->name, cvar->string); count++; } - Con_Printf ("%i cvar(s)", count); + Con_Printf("%i cvar(s)", count); if (partial) - Con_Printf (" beginning with \"%s\"", partial); - Con_Printf ("\n"); + Con_Printf(" beginning with \"%s\"", partial); + Con_Print("\n"); } // 2000-01-09 CvarList command by Maddes diff --git a/fs.c b/fs.c index 4c8befc5..cebf3e4c 100644 --- a/fs.c +++ b/fs.c @@ -579,7 +579,7 @@ pack_t *FS_LoadPackPK3 (const char *packfile) if (real_nb_files <= 0) Sys_Error ("%s is not a valid PK3 file", packfile); - Con_Printf ("Added packfile %s (%i files)\n", packfile, real_nb_files); + Con_Printf("Added packfile %s (%i files)\n", packfile, real_nb_files); return pack; } @@ -710,15 +710,15 @@ void FS_Path_f (void) { searchpath_t *s; - Con_Printf ("Current search path:\n"); + Con_Print("Current search path:\n"); for (s=fs_searchpaths ; s ; s=s->next) { if (s->pack) { - Con_Printf ("%s (%i files)\n", s->pack->filename, s->pack->numfiles); + Con_Printf("%s (%i files)\n", s->pack->filename, s->pack->numfiles); } else - Con_Printf ("%s\n", s->filename); + Con_Printf("%s\n", s->filename); } } @@ -784,7 +784,7 @@ pack_t *FS_LoadPackPAK (const char *packfile) Mem_Free(info); - Con_Printf ("Added packfile %s (%i files)\n", packfile, numpackfiles); + Con_Printf("Added packfile %s (%i files)\n", packfile, numpackfiles); return pack; } @@ -1086,7 +1086,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", + Sys_Printf("FS_FindFile: %s in %s\n", pak->files[middle].name, pak->filename); if (index != NULL) @@ -1108,7 +1108,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); + Sys_Printf("FS_FindFile: %s\n", netpath); if (index != NULL) *index = -1; @@ -1118,7 +1118,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); + Sys_Printf("FS_FindFile: can't find %s\n", name); if (index != NULL) *index = -1; @@ -1170,7 +1170,7 @@ qfile_t *FS_FOpenFile (const char *filename, qboolean quiet) // No Zlib DLL = no compressed files if (!zlib_dll && (packfile->flags & FILE_FLAG_DEFLATED)) { - Con_Printf ("WARNING: can't open the compressed file %s\n" + Con_Printf("WARNING: can't open the compressed file %s\n" "You need the Zlib DLL to use compressed files\n", filename); fs_filesize = -1; @@ -1431,6 +1431,18 @@ int FS_Flush (qfile_t* file) } +/* +==================== +FS_Print + +Print a string into a file +==================== +*/ +int FS_Print(qfile_t* file, const char *msg) +{ + return FS_Write(file, msg, strlen(msg)); +} + /* ==================== FS_Printf @@ -1438,7 +1450,7 @@ FS_Printf Print a string into a file ==================== */ -int FS_Printf (qfile_t* file, const char* format, ...) +int FS_Printf(qfile_t* file, const char* format, ...) { int result; va_list args; @@ -1744,11 +1756,11 @@ qboolean FS_WriteFile (const char *filename, void *data, int len) handle = FS_Open (filename, "wb", false); if (!handle) { - Con_Printf ("FS_WriteFile: failed on %s\n", filename); + Con_Printf("FS_WriteFile: failed on %s\n", filename); return false; } - Con_DPrintf ("FS_WriteFile: %s\n", filename); + Con_DPrintf("FS_WriteFile: %s\n", filename); FS_Write (handle, data, len); FS_Close (handle); return true; @@ -2101,7 +2113,7 @@ static void FS_ListDirectoryCmd (const char* cmdname, int oneperline) else pattern = "*"; if (!FS_ListDirectory(pattern, oneperline)) - Con_Printf("No files found.\n"); + Con_Print("No files found.\n"); } void FS_Dir_f(void) diff --git a/fs.h b/fs.h index 97ef0301..da3b6a00 100644 --- a/fs.h +++ b/fs.h @@ -49,7 +49,8 @@ int FS_Close (qfile_t* file); size_t FS_Write (qfile_t* file, const void* data, size_t datasize); size_t FS_Read (qfile_t* file, void* buffer, size_t buffersize); int FS_Flush (qfile_t* file); -int FS_Printf (qfile_t* file, const char* format, ...); +int FS_Print(qfile_t* file, const char *msg); +int FS_Printf(qfile_t* file, const char* format, ...); int FS_Getc (qfile_t* file); int FS_Seek (qfile_t* file, long offset, int whence); long FS_Tell (qfile_t* file); diff --git a/gl_backend.c b/gl_backend.c index 5531944c..003ccfe1 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -155,7 +155,7 @@ void GL_Backend_FreeArrays(void) static void gl_backend_start(void) { - Con_DPrintf("OpenGL Backend started\n"); + Con_DPrint("OpenGL Backend started\n"); if (qglDrawRangeElements != NULL) { CHECKGLERROR @@ -178,7 +178,7 @@ static void gl_backend_shutdown(void) backendunits = 0; backendactive = false; - Con_DPrintf("OpenGL Backend shutting down\n"); + Con_DPrint("OpenGL Backend shutting down\n"); GL_Backend_FreeArrays(); } @@ -729,13 +729,13 @@ void R_Mesh_Draw(int numverts, int numtriangles, const int *elements) int i, j, size; const int *p; if (!qglIsEnabled(GL_VERTEX_ARRAY)) - Con_Printf("R_Mesh_Draw: vertex array not enabled\n"); + Con_Print("R_Mesh_Draw: vertex array not enabled\n"); for (j = 0, size = numverts * (int)sizeof(float[3]), p = gl_state.pointer_vertex;j < size;j += sizeof(int), p++) paranoidblah += *p; if (gl_state.pointer_color) { if (!qglIsEnabled(GL_COLOR_ARRAY)) - Con_Printf("R_Mesh_Draw: color array set but not enabled\n"); + Con_Print("R_Mesh_Draw: color array set but not enabled\n"); for (j = 0, size = numverts * (int)sizeof(float[4]), p = gl_state.pointer_color;j < size;j += sizeof(int), p++) paranoidblah += *p; } @@ -744,10 +744,10 @@ void R_Mesh_Draw(int numverts, int numtriangles, const int *elements) if (gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap || gl_state.units[i].arrayenabled) { if (gl_state.units[i].arrayenabled && !(gl_state.units[i].t1d || gl_state.units[i].t2d || gl_state.units[i].t3d || gl_state.units[i].tcubemap)) - Con_Printf("R_Mesh_Draw: array enabled but no texture bound\n"); + Con_Print("R_Mesh_Draw: array enabled but no texture bound\n"); GL_ActiveTexture(i); if (!qglIsEnabled(GL_TEXTURE_COORD_ARRAY)) - Con_Printf("R_Mesh_Draw: texcoord array set but not enabled\n"); + Con_Print("R_Mesh_Draw: texcoord array set but not enabled\n"); for (j = 0, size = numverts * ((gl_state.units[i].t3d || gl_state.units[i].tcubemap) ? (int)sizeof(float[3]) : (int)sizeof(float[2])), p = gl_state.units[i].pointer_texcoord;j < size;j += sizeof(int), p++) paranoidblah += *p; } @@ -1509,13 +1509,13 @@ int R_Mesh_CacheArray(rcachearrayrequest_t *r) l->prev = l->next->prev; while (l->next->data && l->data && l->next->data->offset <= d->offset) { - //Con_Printf(">\n"); + //Con_Print(">\n"); l->next = l->next->next; l->prev = l->prev->next; } while (l->prev->data && l->data && l->prev->data->offset >= d->offset) { - //Con_Printf("<\n"); + //Con_Print("<\n"); l->prev = l->prev->prev; l->next = l->next->prev; } diff --git a/gl_draw.c b/gl_draw.c index 83852180..f2aa8920 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -282,7 +282,7 @@ cachepic_t *Draw_CachePic (char *path) pic->tex = draw_generateditherpattern(); if (pic->tex == NULL) { - Con_Printf ("Draw_CachePic: failed to load %s\n", path); + Con_Printf("Draw_CachePic: failed to load %s\n", path); pic->tex = r_notexture; } diff --git a/gl_rmain.c b/gl_rmain.c index 61971ea1..a7da2025 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -144,7 +144,7 @@ static void R_TimeRefresh_f (void) VectorCopy(oldangles, cl.viewangles); intimerefresh = 0; - Con_Printf ("%f seconds (%f fps)\n", timedelta, 128/timedelta); + Con_Printf("%f seconds (%f fps)\n", timedelta, 128/timedelta); } vec3_t fogcolor; @@ -585,7 +585,7 @@ void R_UpdateWorld(void) if (r_shadow_realtime_world.integer && !gl_stencil) { - Con_Printf("Realtime world lighting requires 32bit color; turning off r_shadow_realtime_world, please type vid_bitsperpixel 32;vid_restart and try again\n"); + Con_Print("Realtime world lighting requires 32bit color; turning off r_shadow_realtime_world, please type vid_bitsperpixel 32;vid_restart and try again\n"); Cvar_SetValueQuick(&r_shadow_realtime_world, 0); } diff --git a/gl_textures.c b/gl_textures.c index cc43c8d3..ad9a4ca9 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -338,11 +338,11 @@ static void GL_TextureMode_f (void) { if (gl_filter_min == modes[i].minification) { - Con_Printf ("%s\n", modes[i].name); + Con_Printf("%s\n", modes[i].name); return; } } - Con_Printf ("current filter is unknown???\n"); + Con_Print("current filter is unknown???\n"); return; } @@ -351,7 +351,7 @@ static void GL_TextureMode_f (void) break; if (i == 6) { - Con_Printf ("bad filter name\n"); + Con_Print("bad filter name\n"); return; } @@ -452,7 +452,7 @@ static void R_TextureStats_f(void) int loaded; gltexture_t *glt; gltexturepool_t *pool; - Con_Printf("glsize input loaded mip alpha name\n"); + Con_Print("glsize input loaded mip alpha name\n"); for (pool = gltexturepoolchain;pool;pool = pool->next) { for (glt = pool->gltchain;glt;glt = glt->chain) @@ -631,7 +631,7 @@ static void R_Upload(gltexture_t *glt, qbyte *data) if (glt->image->flags & GLTEXF_UPLOAD) { glt->image->flags &= ~GLTEXF_UPLOAD; - Con_DPrintf("uploaded new fragments image\n"); + Con_DPrint("uploaded new fragments image\n"); R_MakeResizeBufferBigger(glt->image->width * glt->image->height * glt->image->depth * glt->image->bytesperpixel); memset(resizebuffer, 255, glt->image->width * glt->image->height * glt->image->depth * glt->image->bytesperpixel); switch(glt->image->texturetype) diff --git a/host.c b/host.c index c1657d10..e48efcc8 100644 --- a/host.c +++ b/host.c @@ -109,7 +109,7 @@ void Host_EndGame (const char *format, ...) va_start (argptr,format); vsprintf (string,format,argptr); va_end (argptr); - Con_DPrintf ("Host_EndGame: %s\n",string); + Con_DPrintf("Host_EndGame: %s\n",string); if (sv.active) Host_ShutdownServer (false); @@ -144,7 +144,7 @@ void Host_Error (const char *error, ...) vsprintf (hosterrorstring1,error,argptr); va_end (argptr); - Con_Printf ("Host_Error: %s\n", hosterrorstring1); + Con_Printf("Host_Error: %s\n", hosterrorstring1); // LordHavoc: if first frame has not been shown, or currently shutting // down, do Sys_Error instead @@ -312,7 +312,7 @@ void Host_SaveConfig_f(void) f = FS_Open ("config.cfg", "w", false); if (!f) { - Con_Printf ("Couldn't write config.cfg.\n"); + Con_Print("Couldn't write config.cfg.\n"); return; } @@ -324,6 +324,20 @@ void Host_SaveConfig_f(void) } +/* +================= +SV_ClientPrint + +Sends text across to be displayed +FIXME: make this just a stuffed echo? +================= +*/ +void SV_ClientPrint(const char *msg) +{ + MSG_WriteByte(&host_client->message, svc_print); + MSG_WriteString(&host_client->message, msg); +} + /* ================= SV_ClientPrintf @@ -335,45 +349,57 @@ FIXME: make this just a stuffed echo? void SV_ClientPrintf(const char *fmt, ...) { va_list argptr; - char string[1024]; + char msg[4096]; - va_start (argptr,fmt); - vsprintf (string, fmt,argptr); - va_end (argptr); + va_start(argptr,fmt); + vsnprintf(msg,sizeof(msg),fmt,argptr); + va_end(argptr); - MSG_WriteByte (&host_client->message, svc_print); - MSG_WriteString (&host_client->message, string); + SV_ClientPrint(msg); } /* ================= -SV_BroadcastPrintf +SV_BroadcastPrint Sends text to all active clients ================= */ -void SV_BroadcastPrintf(const char *fmt, ...) +void SV_BroadcastPrint(const char *msg) { - va_list argptr; - char string[4096]; int i; client_t *client; - va_start(argptr,fmt); - vsnprintf(string, sizeof(string), fmt,argptr); - va_end(argptr); - for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++) { if (client->spawned) { MSG_WriteByte(&client->message, svc_print); - MSG_WriteString(&client->message, string); + MSG_WriteString(&client->message, msg); } } if (sv_echobprint.integer && cls.state == ca_dedicated) - Sys_Printf("%s", string); + Sys_Print(msg); +} + +/* +================= +SV_BroadcastPrintf + +Sends text to all active clients +================= +*/ +void SV_BroadcastPrintf(const char *fmt, ...) +{ + va_list argptr; + char msg[4096]; + + va_start(argptr,fmt); + vsnprintf(msg,sizeof(msg),fmt,argptr); + va_end(argptr); + + SV_BroadcastPrint(msg); } /* @@ -525,7 +551,7 @@ not reinitialize anything. */ void Host_ClearMemory (void) { - Con_DPrintf ("Clearing memory\n"); + Con_DPrint("Clearing memory\n"); Mod_ClearAll (); cls.signon = 0; @@ -824,7 +850,7 @@ void Host_Frame (float time) c++; } - Con_Printf ("serverprofile: %2i clients %2i msec\n", c, m); + Con_Printf("serverprofile: %2i clients %2i msec\n", c, m); } //============================================================================ @@ -864,7 +890,7 @@ void Host_Init (void) NetConn_Init(); SV_Init(); - Con_Printf ("Builddate: %s\n", buildstring); + Con_Printf("Builddate: %s\n", buildstring); if (cls.state != ca_dedicated) { @@ -887,7 +913,7 @@ void Host_Init (void) host_initialized = true; - Con_DPrintf ("========Initialized=========\n"); + Con_DPrint("========Initialized=========\n"); if (cls.state != ca_dedicated) { @@ -920,7 +946,7 @@ void Host_Shutdown(void) if (isdown) { - Con_Printf ("recursive shutdown\n"); + Con_Print("recursive shutdown\n"); return; } isdown = true; diff --git a/host_cmd.c b/host_cmd.c index 3e74ef72..0552aff8 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -114,15 +114,15 @@ void Host_God_f (void) if (!allowcheats) { - SV_ClientPrintf("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); + SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); return; } sv_player->v->flags = (int)sv_player->v->flags ^ FL_GODMODE; if (!((int)sv_player->v->flags & FL_GODMODE) ) - SV_ClientPrintf ("godmode OFF\n"); + SV_ClientPrint("godmode OFF\n"); else - SV_ClientPrintf ("godmode ON\n"); + SV_ClientPrint("godmode ON\n"); } void Host_Notarget_f (void) @@ -138,15 +138,15 @@ void Host_Notarget_f (void) if (!allowcheats) { - SV_ClientPrintf("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); + SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); return; } sv_player->v->flags = (int)sv_player->v->flags ^ FL_NOTARGET; if (!((int)sv_player->v->flags & FL_NOTARGET) ) - SV_ClientPrintf ("notarget OFF\n"); + SV_ClientPrint("notarget OFF\n"); else - SV_ClientPrintf ("notarget ON\n"); + SV_ClientPrint("notarget ON\n"); } qboolean noclip_anglehack; @@ -164,7 +164,7 @@ void Host_Noclip_f (void) if (!allowcheats) { - SV_ClientPrintf("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); + SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); return; } @@ -172,13 +172,13 @@ void Host_Noclip_f (void) { noclip_anglehack = true; sv_player->v->movetype = MOVETYPE_NOCLIP; - SV_ClientPrintf ("noclip ON\n"); + SV_ClientPrint("noclip ON\n"); } else { noclip_anglehack = false; sv_player->v->movetype = MOVETYPE_WALK; - SV_ClientPrintf ("noclip OFF\n"); + SV_ClientPrint("noclip OFF\n"); } } @@ -202,19 +202,19 @@ void Host_Fly_f (void) if (!allowcheats) { - SV_ClientPrintf("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); + SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); return; } if (sv_player->v->movetype != MOVETYPE_FLY) { sv_player->v->movetype = MOVETYPE_FLY; - SV_ClientPrintf ("flymode ON\n"); + SV_ClientPrint("flymode ON\n"); } else { sv_player->v->movetype = MOVETYPE_WALK; - SV_ClientPrintf ("flymode OFF\n"); + SV_ClientPrint("flymode OFF\n"); } } @@ -237,7 +237,7 @@ void Host_Ping_f (void) return; } - SV_ClientPrintf ("Client ping times:\n"); + SV_ClientPrint("Client ping times:\n"); for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++) { if (!client->active) @@ -246,7 +246,7 @@ void Host_Ping_f (void) for (j=0 ; jping_times[j]; total /= NUM_PING_TIMES; - SV_ClientPrintf ("%4i %s\n", (int)(total*1000), client->name); + SV_ClientPrintf("%4i %s\n", (int)(total*1000), client->name); } } @@ -303,12 +303,12 @@ void Host_Changelevel_f (void) if (Cmd_Argc() != 2) { - Con_Printf ("changelevel : continue game on a new level\n"); + Con_Print("changelevel : continue game on a new level\n"); return; } if (!sv.active || cls.demoplayback) { - Con_Printf ("Only the server may changelevel\n"); + Con_Print("Only the server may changelevel\n"); return; } SV_SaveSpawnparms (); @@ -421,13 +421,13 @@ void Host_Savegame_f (void) if (cls.state != ca_connected || !sv.active) { - Con_Printf ("Not playing a local game.\n"); + Con_Print("Not playing a local game.\n"); return; } if (cl.intermission) { - Con_Printf ("Can't save in intermission.\n"); + Con_Print("Can't save in intermission.\n"); return; } @@ -437,12 +437,12 @@ void Host_Savegame_f (void) { if (i > 0) { - Con_Printf("Can't save multiplayer games.\n"); + Con_Print("Can't save multiplayer games.\n"); return; } if (svs.clients[i].edict->v->deadflag) { - Con_Printf("Can't savegame with a dead player\n"); + Con_Print("Can't savegame with a dead player\n"); return; } } @@ -450,44 +450,44 @@ void Host_Savegame_f (void) if (Cmd_Argc() != 2) { - Con_Printf ("save : save a game\n"); + Con_Print("save : save a game\n"); return; } if (strstr(Cmd_Argv(1), "..")) { - Con_Printf ("Relative pathnames are not allowed.\n"); + Con_Print("Relative pathnames are not allowed.\n"); return; } strlcpy (name, Cmd_Argv(1), sizeof (name)); FS_DefaultExtension (name, ".sav", sizeof (name)); - Con_Printf ("Saving game to %s...\n", name); + Con_Printf("Saving game to %s...\n", name); f = FS_Open (name, "w", false); if (!f) { - Con_Printf ("ERROR: couldn't open.\n"); + Con_Print("ERROR: couldn't open.\n"); return; } - FS_Printf (f, "%i\n", SAVEGAME_VERSION); + FS_Printf(f, "%i\n", SAVEGAME_VERSION); Host_SavegameComment (comment); - FS_Printf (f, "%s\n", comment); + FS_Printf(f, "%s\n", comment); for (i=0 ; i : load a game\n"); + Con_Print("load : load a game\n"); return; } strcpy (filename, Cmd_Argv(1)); FS_DefaultExtension (filename, ".sav", sizeof (filename)); - Con_Printf ("Loading game from %s...\n", filename); + Con_Printf("Loading game from %s...\n", filename); cls.demonum = -1; // stop demo loop in case this fails f = FS_Open (filename, "r", false); if (!f) { - Con_Printf ("ERROR: couldn't open.\n"); + Con_Print("ERROR: couldn't open.\n"); return; } @@ -552,7 +552,7 @@ void Host_Loadgame_f (void) if (version != SAVEGAME_VERSION) { FS_Close (f); - Con_Printf ("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION); + Con_Printf("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION); return; } @@ -579,7 +579,7 @@ void Host_Loadgame_f (void) SV_SpawnServer (mapname); if (!sv.active) { - Con_Printf ("Couldn't load map\n"); + Con_Print("Couldn't load map\n"); return; } sv.paused = true; // pause until all clients connect @@ -675,7 +675,7 @@ void Host_Name_f (void) if (Cmd_Argc () == 1) { - Con_Printf ("\"name\" is \"%s\"\n", cl_name.string); + Con_Printf("\"name\" is \"%s\"\n", cl_name.string); return; } @@ -712,7 +712,7 @@ void Host_Name_f (void) void Host_Version_f (void) { - Con_Printf ("Version: %s build %s\n", gamename, buildstring); + Con_Printf("Version: %s build %s\n", gamename, buildstring); } void Host_Say(qboolean teamonly) @@ -761,9 +761,9 @@ void Host_Say(qboolean teamonly) if (p2[-1] == '"') p2--; else if (fromServer) - Con_Printf("Host_Say: missing end quote\n"); + Con_Print("Host_Say: missing end quote\n"); else - SV_ClientPrintf("Host_Say: missing end quote\n"); + SV_ClientPrint("Host_Say: missing end quote\n"); } while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r')) p2--; @@ -774,10 +774,10 @@ void Host_Say(qboolean teamonly) for (j = 0, host_client = svs.clients;j < svs.maxclients;j++, host_client++) if (host_client->spawned && (!teamplay.integer || host_client->edict->v->team == save->edict->v->team)) - SV_ClientPrintf("%s", text); + SV_ClientPrint(text); host_client = save; - Sys_Printf("%s", &text[1]); + Sys_Print(&text[1]); } @@ -837,9 +837,9 @@ void Host_Tell_f(void) if (p2[-1] == '"') p2--; else if (fromServer) - Con_Printf("Host_Tell: missing end quote\n"); + Con_Print("Host_Tell: missing end quote\n"); else - SV_ClientPrintf("Host_Tell: missing end quote\n"); + SV_ClientPrint("Host_Tell: missing end quote\n"); } while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r')) p2--; @@ -851,7 +851,7 @@ void Host_Tell_f(void) save = host_client; for (j = 0, host_client = svs.clients;j < svs.maxclients;j++, host_client++) if (host_client->spawned && !strcasecmp(host_client->name, Cmd_Argv(1))) - SV_ClientPrintf("%s", text); + SV_ClientPrint(text); host_client = save; } @@ -871,8 +871,8 @@ void Host_Color_f(void) if (Cmd_Argc() == 1) { - Con_Printf ("\"color\" is \"%i %i\"\n", cl_color.integer >> 4, cl_color.integer & 15); - Con_Printf ("color <0-15> [0-15]\n"); + Con_Printf("\"color\" is \"%i %i\"\n", cl_color.integer >> 4, cl_color.integer & 15); + Con_Print("color <0-15> [0-15]\n"); return; } @@ -905,7 +905,7 @@ void Host_Color_f(void) if (sv_player && (f = ED_FindFunction ("SV_ChangeTeam")) && (SV_ChangeTeam = (func_t)(f - pr_functions))) { - Con_DPrintf("Calling SV_ChangeTeam\n"); + Con_DPrint("Calling SV_ChangeTeam\n"); pr_global_struct->time = sv.time; pr_globals[OFS_PARM0] = playercolor; pr_global_struct->self = EDICT_TO_PROG(sv_player); @@ -938,8 +938,8 @@ void Host_Rate_f(void) if (Cmd_Argc() != 2) { - Con_Printf ("\"rate\" is \"%i\"\n", cl_rate.integer); - Con_Printf ("rate <500-25000>\n"); + Con_Printf("\"rate\" is \"%i\"\n", cl_rate.integer); + Con_Print("rate <500-25000>\n"); return; } @@ -976,7 +976,7 @@ void Host_Kill_f (void) if (!sv_player || sv_player->v->health <= 0) { - SV_ClientPrintf ("Can't suicide -- already dead!\n"); + SV_ClientPrint("Can't suicide -- already dead!\n"); return; } @@ -1000,14 +1000,14 @@ void Host_Pause_f (void) return; } if (!pausable.integer) - SV_ClientPrintf ("Pause not allowed.\n"); + SV_ClientPrint("Pause not allowed.\n"); else { sv.paused ^= 1; - SV_BroadcastPrintf ("%s %spaused the game\n", host_client->name, sv.paused ? "" : "un"); + SV_BroadcastPrintf("%s %spaused the game\n", host_client->name, sv.paused ? "" : "un"); // send notification to all clients - MSG_WriteByte (&sv.reliable_datagram, svc_setpause); - MSG_WriteByte (&sv.reliable_datagram, sv.paused); + MSG_WriteByte(&sv.reliable_datagram, svc_setpause); + MSG_WriteByte(&sv.reliable_datagram, sv.paused); } } @@ -1025,7 +1025,7 @@ static void Host_PModel_f (void) if (Cmd_Argc () == 1) { - Con_Printf ("\"pmodel\" is \"%s\"\n", cl_pmodel.string); + Con_Printf("\"pmodel\" is \"%s\"\n", cl_pmodel.string); return; } i = atoi(Cmd_Argv(1)); @@ -1057,13 +1057,13 @@ void Host_PreSpawn_f (void) { if (cmd_source == src_command) { - Con_Printf ("prespawn is not valid from the console\n"); + Con_Print("prespawn is not valid from the console\n"); return; } if (host_client->spawned) { - Con_Printf ("prespawn not valid -- already spawned\n"); + Con_Print("prespawn not valid -- already spawned\n"); return; } @@ -1087,19 +1087,19 @@ void Host_Spawn_f (void) if (cmd_source == src_command) { - Con_Printf("spawn is not valid from the console\n"); + Con_Print("spawn is not valid from the console\n"); return; } if (host_client->spawned) { - Con_Printf("Spawn not valid -- already spawned\n"); + Con_Print("Spawn not valid -- already spawned\n"); return; } if (!sv_player) { - Con_Printf("Host_Spawn: no edict??\n"); + Con_Print("Host_Spawn: no edict??\n"); return; } @@ -1117,7 +1117,7 @@ void Host_Spawn_f (void) if ((f = ED_FindFunction ("RestoreGame"))) if ((RestoreGame = (func_t)(f - pr_functions))) { - Con_DPrintf("Calling RestoreGame\n"); + Con_DPrint("Calling RestoreGame\n"); pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(sv_player); PR_ExecuteProgram (RestoreGame, ""); @@ -1140,7 +1140,7 @@ void Host_Spawn_f (void) PR_ExecuteProgram (pr_global_struct->ClientConnect, "QC function ClientConnect is missing"); if ((Sys_DoubleTime() - host_client->netconnection->connecttime) <= sv.time) - Sys_Printf ("%s entered the game\n", host_client->name); + Sys_Printf("%s entered the game\n", host_client->name); PR_ExecuteProgram (pr_global_struct->PutClientInServer, "QC function PutClientInServer is missing"); } @@ -1216,7 +1216,7 @@ void Host_Begin_f (void) { if (cmd_source == src_command) { - Con_Printf ("begin is not valid from the console\n"); + Con_Print("begin is not valid from the console\n"); return; } @@ -1295,9 +1295,9 @@ void Host_Kick_f (void) message++; } if (message) - SV_ClientPrintf ("Kicked by %s: %s\n", who, message); + SV_ClientPrintf("Kicked by %s: %s\n", who, message); else - SV_ClientPrintf ("Kicked by %s\n", who); + SV_ClientPrintf("Kicked by %s\n", who); SV_DropClient (false); // kicked } @@ -1334,7 +1334,7 @@ void Host_Give_f (void) if (!allowcheats) { - SV_ClientPrintf("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); + SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); return; } @@ -1483,7 +1483,7 @@ edict_t *FindViewthing (void) if (!strcmp (PR_GetString(e->v->classname), "viewthing")) return e; } - Con_Printf ("No viewthing on map\n"); + Con_Print("No viewthing on map\n"); return NULL; } @@ -1504,7 +1504,7 @@ void Host_Viewmodel_f (void) m = Mod_ForName (Cmd_Argv(1), false, true, false); if (!m) { - Con_Printf ("Can't load %s\n", Cmd_Argv(1)); + Con_Printf("Can't load %s\n", Cmd_Argv(1)); return; } @@ -1622,10 +1622,10 @@ void Host_Startdemos_f (void) c = Cmd_Argc() - 1; if (c > MAX_DEMOS) { - Con_Printf ("Max %i demos in demoloop\n", MAX_DEMOS); + Con_Printf("Max %i demos in demoloop\n", MAX_DEMOS); c = MAX_DEMOS; } - Con_DPrintf ("%i demo(s) in loop\n", c); + Con_DPrintf("%i demo(s) in loop\n", c); for (i=1 ; i 4096 || image_height > 4096 || image_width <= 0 || image_height <= 0) { - Con_Printf ("Bad pcx file\n"); + Con_Print("Bad pcx file\n"); return NULL; } if ((matchwidth && image_width != matchwidth) || (matchheight && image_height != matchheight)) @@ -233,7 +233,7 @@ TargaHeader; void PrintTargaHeader(TargaHeader *t) { - Con_Printf("TargaHeader:\n"); + Con_Print("TargaHeader:\n"); Con_Printf("uint8 id_length = %i;\n", t->id_length); Con_Printf("uint8 colormap_type = %i;\n", t->colormap_type); Con_Printf("uint8 image_type = %i;\n", t->image_type); @@ -279,7 +279,7 @@ qbyte *LoadTGA (qbyte *f, int matchwidth, int matchheight) targa_header.height = image_height = f[14] + f[15] * 256; if (image_width > 4096 || image_height > 4096 || image_width <= 0 || image_height <= 0) { - Con_Printf("LoadTGA: invalid size\n"); + Con_Print("LoadTGA: invalid size\n"); PrintTargaHeader(&targa_header); return NULL; } @@ -295,7 +295,7 @@ qbyte *LoadTGA (qbyte *f, int matchwidth, int matchheight) { if (targa_header.pixel_size != 24 && targa_header.pixel_size != 32) { - Con_Printf ("LoadTGA: only 24bit and 32bit pixel sizes supported for type 2 and type 10 images\n"); + Con_Print("LoadTGA: only 24bit and 32bit pixel sizes supported for type 2 and type 10 images\n"); PrintTargaHeader(&targa_header); return NULL; } @@ -304,19 +304,19 @@ qbyte *LoadTGA (qbyte *f, int matchwidth, int matchheight) { if (targa_header.pixel_size != 8) { - Con_Printf ("LoadTGA: only 8bit pixel size for type 1, 3, 9, and 11 images supported\n"); + Con_Print("LoadTGA: only 8bit pixel size for type 1, 3, 9, and 11 images supported\n"); PrintTargaHeader(&targa_header); return NULL; } if (targa_header.colormap_length > 256) { - Con_Printf ("LoadTGA: only up to 256 colormap_length supported\n"); + Con_Print("LoadTGA: only up to 256 colormap_length supported\n"); PrintTargaHeader(&targa_header); return NULL; } if (targa_header.colormap_index) { - Con_Printf ("LoadTGA: colormap_index not supported\n"); + Con_Print("LoadTGA: colormap_index not supported\n"); PrintTargaHeader(&targa_header); return NULL; } @@ -342,7 +342,7 @@ qbyte *LoadTGA (qbyte *f, int matchwidth, int matchheight) } else { - Con_Printf ("LoadTGA: Only 32 and 24 bit colormap_size supported\n"); + Con_Print("LoadTGA: Only 32 and 24 bit colormap_size supported\n"); PrintTargaHeader(&targa_header); return NULL; } @@ -351,28 +351,28 @@ qbyte *LoadTGA (qbyte *f, int matchwidth, int matchheight) { if (targa_header.pixel_size != 8) { - Con_Printf ("LoadTGA: only 8bit pixel size for type 1, 3, 9, and 11 images supported\n"); + Con_Print("LoadTGA: only 8bit pixel size for type 1, 3, 9, and 11 images supported\n"); PrintTargaHeader(&targa_header); return NULL; } } else { - Con_Printf ("LoadTGA: Only type 1, 2, 3, 9, 10, and 11 targa RGB images supported, image_type = %i\n", targa_header.image_type); + Con_Printf("LoadTGA: Only type 1, 2, 3, 9, 10, and 11 targa RGB images supported, image_type = %i\n", targa_header.image_type); PrintTargaHeader(&targa_header); return NULL; } if (targa_header.attributes & 0x10) { - Con_Printf ("LoadTGA: origin must be in top left or bottom left, top right and bottom right are not supported\n"); + Con_Print("LoadTGA: origin must be in top left or bottom left, top right and bottom right are not supported\n"); return NULL; } image_rgba = Mem_Alloc(tempmempool, image_width * image_height * 4); if (!image_rgba) { - Con_Printf ("LoadTGA: not enough memory for %i by %i image\n", image_width, image_height); + Con_Printf("LoadTGA: not enough memory for %i by %i image\n", image_width, image_height); return NULL; } @@ -476,7 +476,7 @@ qbyte *LoadLMP (qbyte *f, int matchwidth, int matchheight) if (fs_filesize < 9) { - Con_Printf("LoadLMP: invalid LMP file\n"); + Con_Print("LoadLMP: invalid LMP file\n"); return NULL; } @@ -493,7 +493,7 @@ qbyte *LoadLMP (qbyte *f, int matchwidth, int matchheight) if (fs_filesize < 8 + image_width * image_height) { - Con_Printf("LoadLMP: invalid LMP file\n"); + Con_Print("LoadLMP: invalid LMP file\n"); return NULL; } @@ -525,7 +525,7 @@ qbyte *LoadWAL (qbyte *f, int matchwidth, int matchheight) if (fs_filesize < (int) sizeof(q2wal_t)) { - Con_Printf("LoadWAL: invalid WAL file\n"); + Con_Print("LoadWAL: invalid WAL file\n"); return NULL; } @@ -541,7 +541,7 @@ qbyte *LoadWAL (qbyte *f, int matchwidth, int matchheight) if ((int) fs_filesize < (int) sizeof(q2wal_t) + (int) LittleLong(inwal->offsets[0]) + image_width * image_height) { - Con_Printf("LoadWAL: invalid WAL file\n"); + Con_Print("LoadWAL: invalid WAL file\n"); return NULL; } @@ -568,7 +568,7 @@ qbyte *LoadLMPAs8Bit (qbyte *f, int matchwidth, int matchheight) if (fs_filesize < 9) { - Con_Printf("LoadLMPAs8Bit: invalid LMP file\n"); + Con_Print("LoadLMPAs8Bit: invalid LMP file\n"); return NULL; } @@ -585,7 +585,7 @@ qbyte *LoadLMPAs8Bit (qbyte *f, int matchwidth, int matchheight) if (fs_filesize < 8 + image_width * image_height) { - Con_Printf("LoadLMPAs8Bit: invalid LMP file\n"); + Con_Print("LoadLMPAs8Bit: invalid LMP file\n"); return NULL; } @@ -666,11 +666,11 @@ qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, } if (complain) { - Con_Printf ("Couldn't load %s using ", filename); + Con_Printf("Couldn't load %s using ", filename); for (i = 0;imageformats[i].formatstring;i++) { sprintf (name, imageformats[i].formatstring, basename); - Con_Printf (i == 0 ? "\"%s\"" : (imageformats[i+1].formatstring ? ", \"%s\"" : " or \"%s\".\n"), imageformats[i].formatstring); + Con_Printf(i == 0 ? "\"%s\"" : (imageformats[i+1].formatstring ? ", \"%s\"" : " or \"%s\".\n"), imageformats[i].formatstring); } } if (developer_memorydebug.integer) diff --git a/jpeg.c b/jpeg.c index 0d332812..c979fb14 100644 --- a/jpeg.c +++ b/jpeg.c @@ -678,7 +678,7 @@ qboolean JPEG_SaveImage_preflipped (const char *filename, int width, int height, // No DLL = no JPEGs if (!jpeg_dll) { - Con_Printf ("You need the libjpeg library to save JPEG images\n"); + Con_Print("You need the libjpeg library to save JPEG images\n"); return false; } diff --git a/keys.c b/keys.c index d350717a..922ef11e 100644 --- a/keys.c +++ b/keys.c @@ -309,7 +309,7 @@ Key_Console (int key, char ascii) { Cbuf_AddText (key_lines[edit_line]+1); // skip the ] Cbuf_AddText ("\n"); - Con_Printf ("%s\n",key_lines[edit_line]); + Con_Printf("%s\n",key_lines[edit_line]); edit_line = (edit_line + 1) & 31; history_line = edit_line; key_lines[edit_line][0] = ']'; @@ -619,19 +619,19 @@ Key_In_Unbind_f (void) int b, m; if (Cmd_Argc () != 3) { - Con_Printf ("in_unbind : remove commands from a key\n"); + Con_Print("in_unbind : remove commands from a key\n"); return; } m = strtol(Cmd_Argv (1), NULL, 0); if ((m < 0) || (m >= 8)) { - Con_Printf ("%d isn't a valid bindmap\n", m); + Con_Printf("%d isn't a valid bindmap\n", m); return; } b = Key_StringToKeynum (Cmd_Argv (2)); if (b == -1) { - Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv (2)); + Con_Printf("\"%s\" isn't a valid key\n", Cmd_Argv (2)); return; } @@ -647,27 +647,27 @@ Key_In_Bind_f (void) c = Cmd_Argc (); if (c != 3 && c != 4) { - Con_Printf ("in_bind [command] : attach a command to a key\n"); + Con_Print("in_bind [command] : attach a command to a key\n"); return; } m = strtol(Cmd_Argv (1), NULL, 0); if ((m < 0) || (m >= 8)) { - Con_Printf ("%d isn't a valid bindmap\n", m); + Con_Printf("%d isn't a valid bindmap\n", m); return; } b = Key_StringToKeynum (Cmd_Argv (2)); if (b == -1) { - Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv (2)); + Con_Printf("\"%s\" isn't a valid key\n", Cmd_Argv (2)); return; } if (c == 3) { if (keybindings[m][b]) - Con_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv (2), keybindings[m][b]); + Con_Printf("\"%s\" = \"%s\"\n", Cmd_Argv (2), keybindings[m][b]); else - Con_Printf ("\"%s\" is not bound\n", Cmd_Argv (2)); + Con_Printf("\"%s\" is not bound\n", Cmd_Argv (2)); return; } // copy the rest of the command line @@ -689,19 +689,19 @@ Key_In_Bindmap_f (void) c = Cmd_Argc (); if (c != 3) { - Con_Printf ("in_bindmap : set current bindmap and fallback\n"); + Con_Print("in_bindmap : set current bindmap and fallback\n"); return; } m1 = strtol(Cmd_Argv (1), NULL, 0); if ((m1 < 0) || (m1 >= 8)) { - Con_Printf ("%d isn't a valid bindmap\n", m1); + Con_Printf("%d isn't a valid bindmap\n", m1); return; } m2 = strtol(Cmd_Argv (2), NULL, 0); if ((m2 < 0) || (m2 >= 8)) { - Con_Printf ("%d isn't a valid bindmap\n", m2); + Con_Printf("%d isn't a valid bindmap\n", m2); return; } @@ -715,13 +715,13 @@ Key_Unbind_f (void) int b; if (Cmd_Argc () != 2) { - Con_Printf ("unbind : remove commands from a key\n"); + Con_Print("unbind : remove commands from a key\n"); return; } b = Key_StringToKeynum (Cmd_Argv (1)); if (b == -1) { - Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv (1)); + Con_Printf("\"%s\" isn't a valid key\n", Cmd_Argv (1)); return; } @@ -749,20 +749,20 @@ Key_Bind_f (void) c = Cmd_Argc (); if (c != 2 && c != 3) { - Con_Printf ("bind [command] : attach a command to a key\n"); + Con_Print("bind [command] : attach a command to a key\n"); return; } b = Key_StringToKeynum (Cmd_Argv (1)); if (b == -1) { - Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv (1)); + Con_Printf("\"%s\" isn't a valid key\n", Cmd_Argv (1)); return; } if (c == 2) { if (keybindings[0][b]) - Con_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv (1), keybindings[0][b]); + Con_Printf("\"%s\" = \"%s\"\n", Cmd_Argv (1), keybindings[0][b]); else - Con_Printf ("\"%s\" is not bound\n", Cmd_Argv (1)); + Con_Printf("\"%s\" is not bound\n", Cmd_Argv (1)); return; } // copy the rest of the command line @@ -788,12 +788,12 @@ Key_WriteBindings (qfile_t *f) for (i = 0; i < (int)(sizeof(keybindings[0])/sizeof(keybindings[0][0])); i++) if (keybindings[0][i]) - FS_Printf (f, "bind %s \"%s\"\n", + FS_Printf(f, "bind %s \"%s\"\n", Key_KeynumToString (i), keybindings[0][i]); for (j = 1; j < 8; j++) for (i = 0; i < (int)(sizeof(keybindings[0])/sizeof(keybindings[0][0])); i++) if (keybindings[j][i]) - FS_Printf (f, "in_bind %d %s \"%s\"\n", + FS_Printf(f, "in_bind %d %s \"%s\"\n", j, Key_KeynumToString (i), keybindings[j][i]); } diff --git a/lhnet.c b/lhnet.c index 50dc06f3..58033bac 100644 --- a/lhnet.c +++ b/lhnet.c @@ -481,7 +481,7 @@ lhnetsocket_t *LHNET_OpenSocket_Connectionless(lhnetaddress_t *address) #ifdef WIN32 } else - Con_Printf("LHNET_OpenSocket_Connectionless: WSAStartup failed\n"); + Con_Print("LHNET_OpenSocket_Connectionless: WSAStartup failed\n"); #endif break; default: @@ -597,7 +597,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength, switch (e) { case WSAECONNREFUSED: - Con_Printf("Connection refused\n"); + Con_Print("Connection refused\n"); return 0; } #else @@ -606,7 +606,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength, switch (errno) { case ECONNREFUSED: - Con_Printf("Connection refused\n"); + Con_Print("Connection refused\n"); return 0; } #endif @@ -632,7 +632,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength, switch (e) { case WSAECONNREFUSED: - Con_Printf("Connection refused\n"); + Con_Print("Connection refused\n"); return 0; } #else @@ -641,7 +641,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength, switch (errno) { case ECONNREFUSED: - Con_Printf("Connection refused\n"); + Con_Print("Connection refused\n"); return 0; } #endif diff --git a/mathlib.c b/mathlib.c index 8fb29b21..22112734 100644 --- a/mathlib.c +++ b/mathlib.c @@ -591,7 +591,7 @@ void Mathlib_Init(void) #include "matrixlib.h" -void Matrix4x4_Print (const matrix4x4_t *in) +void Matrix4x4_Print(const matrix4x4_t *in) { Con_Printf("%f %f %f %f\n%f %f %f %f\n%f %f %f %f\n%f %f %f %f\n" , in->m[0][0], in->m[0][1], in->m[0][2], in->m[0][3] diff --git a/menu.c b/menu.c index d7c30033..a56f4365 100644 --- a/menu.c +++ b/menu.c @@ -164,7 +164,7 @@ void M_DrawCharacter (float cx, float cy, int num) DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0); } -void M_Print (float cx, float cy, const char *str) +void M_Print(float cx, float cy, const char *str) { DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0); } @@ -174,7 +174,7 @@ void M_PrintRed (float cx, float cy, const char *str) DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 0, 0, 1, 0); } -void M_ItemPrint (float cx, float cy, char *str, int unghosted) +void M_ItemPrint(float cx, float cy, char *str, int unghosted) { if (unghosted) DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0); @@ -294,7 +294,7 @@ void M_Demo_Draw (void) M_Background(320, 200); for (i = 0;i < NumberOfNehahraDemos;i++) - M_Print (16, 16 + 8*i, NehahraDemos[i].desc); + M_Print(16, 16 + 8*i, NehahraDemos[i].desc); // line cursor M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1)); @@ -577,14 +577,14 @@ void M_SinglePlayer_Draw (void) M_DrawTextBox (60, 8 * 8, 23, 4); if (gamemode == GAME_NEXUIZ) - M_Print (95, 10 * 8, "Nexuiz is for"); + M_Print(95, 10 * 8, "Nexuiz is for"); else if (gamemode == GAME_GOODVSBAD2) - M_Print (95, 10 * 8, "Good Vs Bad 2 is for"); + M_Print(95, 10 * 8, "Good Vs Bad 2 is for"); else if (gamemode == GAME_BATTLEMECH) - M_Print (95, 10 * 8, "Battlemech is for"); + M_Print(95, 10 * 8, "Battlemech is for"); else - M_Print (95, 10 * 8, "Transfusion is for"); - M_Print (83, 11 * 8, "multiplayer play only"); + M_Print(95, 10 * 8, "Transfusion is for"); + M_Print(83, 11 * 8, "multiplayer play only"); } else { @@ -730,7 +730,7 @@ void M_Load_Draw (void) M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp"); for (i=0 ; i< MAX_SAVEGAMES; i++) - M_Print (16, 32 + 8*i, m_filenames[i]); + M_Print(16, 32 + 8*i, m_filenames[i]); // line cursor M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1)); @@ -748,7 +748,7 @@ void M_Save_Draw (void) M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp"); for (i=0 ; iwidth)/2, 4, "gfx/p_multi.lmp"); - M_Print (64, 40, "Your name"); + M_Print(64, 40, "Your name"); M_DrawTextBox (160, 32, 16, 1); - M_Print (168, 40, setup_myname); + M_Print(168, 40, setup_myname); if (gamemode != GAME_GOODVSBAD2) { - M_Print (64, 64, "Shirt color"); - M_Print (64, 88, "Pants color"); + M_Print(64, 64, "Shirt color"); + M_Print(64, 88, "Pants color"); } - M_Print (64, 124-8, "Network speed limit"); - M_Print (168, 124, va("%i (%s)", setup_rate, setup_ratetable[setup_rateindex(setup_rate)].name)); + M_Print(64, 124-8, "Network speed limit"); + M_Print(168, 124, va("%i (%s)", setup_rate, setup_ratetable[setup_rateindex(setup_rate)].name)); M_DrawTextBox (64, 140-8, 14, 1); - M_Print (72, 140, "Accept Changes"); + M_Print(72, 140, "Accept Changes"); // LordHavoc: rewrote this code greatly if (menuplyr_load) @@ -1158,9 +1158,9 @@ void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax) void M_DrawCheckbox (int x, int y, int on) { if (on) - M_Print (x, y, "on"); + M_Print(x, y, "on"); else - M_Print (x, y, "off"); + M_Print(x, y, "off"); } @@ -2059,9 +2059,9 @@ void M_Keys_Draw (void) M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp"); if (bind_grab) - M_Print (12, 32, "Press a key or button for this action"); + M_Print(12, 32, "Press a key or button for this action"); else - M_Print (18, 32, "Enter to change, backspace to clear"); + M_Print(18, 32, "Enter to change, backspace to clear"); // search for known bindings for (i=0 ; iwidth)/2, 4, "gfx/p_multi.lmp"); M_DrawTextBox (152, 32, 10, 1); - M_Print (160, 40, "begin game"); + M_Print(160, 40, "begin game"); - M_Print (0, 56, " Max players"); - M_Print (160, 56, va("%i", maxplayers) ); + M_Print(0, 56, " Max players"); + M_Print(160, 56, va("%i", maxplayers) ); if (gamemode != GAME_GOODVSBAD2) { - M_Print (0, 64, " Game Type"); + M_Print(0, 64, " Game Type"); if (gamemode == GAME_TRANSFUSION) { if (!deathmatch.integer) Cvar_SetValue("deathmatch", 1); if (deathmatch.integer == 2) - M_Print (160, 64, "Capture the Flag"); + M_Print(160, 64, "Capture the Flag"); else - M_Print (160, 64, "Blood Bath"); + M_Print(160, 64, "Blood Bath"); } else if (gamemode == GAME_BATTLEMECH) { if (!deathmatch.integer) Cvar_SetValue("deathmatch", 1); if (deathmatch.integer == 2) - M_Print (160, 64, "Rambo Match"); + M_Print(160, 64, "Rambo Match"); else - M_Print (160, 64, "Deathmatch"); + M_Print(160, 64, "Deathmatch"); } else { if (!coop.integer && !deathmatch.integer) Cvar_SetValue("deathmatch", 1); if (coop.integer) - M_Print (160, 64, "Cooperative"); + M_Print(160, 64, "Cooperative"); else - M_Print (160, 64, "Deathmatch"); + M_Print(160, 64, "Deathmatch"); } - M_Print (0, 72, " Teamplay"); + M_Print(0, 72, " Teamplay"); if (gamemode == GAME_ROGUE) { char *msg; @@ -3126,7 +3126,7 @@ void M_GameOptions_Draw (void) case 6: msg = "Three Team CTF"; break; default: msg = "Off"; break; } - M_Print (160, 72, msg); + M_Print(160, 72, msg); } else { @@ -3138,50 +3138,50 @@ void M_GameOptions_Draw (void) case 2: msg = "Friendly Fire"; break; default: msg = "No Friendly Fire"; break; } - M_Print (160, 72, msg); + M_Print(160, 72, msg); } - M_Print (0, 80, " Skill"); + M_Print(0, 80, " Skill"); if (skill.integer == 0) - M_Print (160, 80, "Easy difficulty"); + M_Print(160, 80, "Easy difficulty"); else if (skill.integer == 1) - M_Print (160, 80, "Normal difficulty"); + M_Print(160, 80, "Normal difficulty"); else if (skill.integer == 2) - M_Print (160, 80, "Hard difficulty"); + M_Print(160, 80, "Hard difficulty"); else - M_Print (160, 80, "Nightmare difficulty"); + M_Print(160, 80, "Nightmare difficulty"); - M_Print (0, 88, " Frag Limit"); + M_Print(0, 88, " Frag Limit"); if (fraglimit.integer == 0) - M_Print (160, 88, "none"); + M_Print(160, 88, "none"); else - M_Print (160, 88, va("%i frags", fraglimit.integer)); + M_Print(160, 88, va("%i frags", fraglimit.integer)); - M_Print (0, 96, " Time Limit"); + M_Print(0, 96, " Time Limit"); if (timelimit.integer == 0) - M_Print (160, 96, "none"); + M_Print(160, 96, "none"); else - M_Print (160, 96, va("%i minutes", timelimit.integer)); + M_Print(160, 96, va("%i minutes", timelimit.integer)); } - M_Print (0, 104, " Public server"); - M_Print (160, 104, (sv_public.integer == 0) ? "no" : "yes"); + M_Print(0, 104, " Public server"); + M_Print(160, 104, (sv_public.integer == 0) ? "no" : "yes"); - M_Print (0, 120, " Server name"); + M_Print(0, 120, " Server name"); M_DrawTextBox (0, 124, 38, 1); - M_Print (8, 132, hostname.string); + M_Print(8, 132, hostname.string); g = lookupgameinfo(); if (gamemode != GAME_GOODVSBAD2) { - M_Print (0, 152, " Episode"); - M_Print (160, 152, g->episodes[startepisode].description); + M_Print(0, 152, " Episode"); + M_Print(160, 152, g->episodes[startepisode].description); } - M_Print (0, 160, " Level"); - M_Print (160, 160, g->levels[g->episodes[startepisode].firstLevel + startlevel].description); - M_Print (160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].name); + M_Print(0, 160, " Level"); + M_Print(160, 160, g->levels[g->episodes[startepisode].firstLevel + startlevel].description); + M_Print(160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].name); // line cursor if (gameoptions_cursor == 8) @@ -3196,10 +3196,10 @@ void M_GameOptions_Draw (void) x = (320-26*8)/2; M_DrawTextBox (x, 138, 24, 4); x += 8; - M_Print (x, 146, " More than 64 players?? "); - M_Print (x, 154, " First, question your "); - M_Print (x, 162, " sanity, then email "); - M_Print (x, 170, " havoc@telefragged.com "); + M_Print(x, 146, " More than 64 players?? "); + M_Print(x, 154, " First, question your "); + M_Print(x, 162, " sanity, then email "); + M_Print(x, 170, " havoc@telefragged.com "); } else m_serverInfoMessage = false; @@ -3582,12 +3582,12 @@ void M_Init (void) { if (FS_FileExists("hearing.dem")) { - Con_Printf("Nehahra movie and game detected.\n"); + Con_Print("Nehahra movie and game detected.\n"); NehGameType = TYPE_BOTH; } else { - Con_Printf("Nehahra game detected.\n"); + Con_Print("Nehahra game detected.\n"); NehGameType = TYPE_GAME; } } @@ -3595,12 +3595,12 @@ void M_Init (void) { if (FS_FileExists("hearing.dem")) { - Con_Printf("Nehahra movie detected.\n"); + Con_Print("Nehahra movie detected.\n"); NehGameType = TYPE_DEMO; } else { - Con_Printf("Nehahra not found.\n"); + Con_Print("Nehahra not found.\n"); NehGameType = TYPE_GAME; // could just complain, but... } } @@ -3815,7 +3815,7 @@ void MP_Error(void) // fall back to the normal menu // say it - Con_Printf("Falling back to normal menu\n"); + Con_Print("Falling back to normal menu\n"); key_dest = key_game; diff --git a/model_brush.c b/model_brush.c index 4dfd6a8d..3d15e6ff 100644 --- a/model_brush.c +++ b/model_brush.c @@ -441,7 +441,7 @@ loc0: if (t->trace->allsolid) t->trace->startsolid = true; #if COLLISIONPARANOID >= 3 - Con_Printf("S"); + Con_Print("S"); #endif return HULLCHECKSTATE_SOLID; } @@ -449,7 +449,7 @@ loc0: { t->trace->allsolid = false; #if COLLISIONPARANOID >= 3 - Con_Printf("E"); + Con_Print("E"); #endif return HULLCHECKSTATE_EMPTY; } @@ -475,7 +475,7 @@ loc0: if (t2 < 0) { #if COLLISIONPARANOID >= 3 - Con_Printf("<"); + Con_Print("<"); #endif num = node->children[1]; goto loc0; @@ -487,7 +487,7 @@ loc0: if (t2 >= 0) { #if COLLISIONPARANOID >= 3 - Con_Printf(">"); + Con_Print(">"); #endif num = node->children[0]; goto loc0; @@ -498,7 +498,7 @@ loc0: // the line intersects, find intersection point // LordHavoc: this uses the original trace for maximum accuracy #if COLLISIONPARANOID >= 3 - Con_Printf("M"); + Con_Print("M"); #endif if (plane->type < 3) { @@ -549,7 +549,7 @@ loc0: t->trace->fraction = bound(0, midf, 1); #if COLLISIONPARANOID >= 3 - Con_Printf("D"); + Con_Print("D"); #endif return HULLCHECKSTATE_DONE; } @@ -623,7 +623,7 @@ static void Mod_Q1BSP_TraceBox(struct model_s *model, int frame, trace_t *trace, #if COLLISIONPARANOID >= 2 Con_Printf("t(%f %f %f,%f %f %f,%i %f %f %f)", rhc.start[0], rhc.start[1], rhc.start[2], rhc.end[0], rhc.end[1], rhc.end[2], rhc.hull - model->brushq1.hulls, rhc.hull->clip_mins[0], rhc.hull->clip_mins[1], rhc.hull->clip_mins[2]); Mod_Q1BSP_RecursiveHullCheck(&rhc, rhc.hull->firstclipnode, 0, 1, rhc.start, rhc.end); - Con_Printf("\n"); + Con_Print("\n"); #else if (DotProduct(rhc.dist, rhc.dist)) Mod_Q1BSP_RecursiveHullCheck(&rhc, rhc.hull->firstclipnode, 0, 1, rhc.start, rhc.end); @@ -983,7 +983,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) } if ((mtwidth & 15) || (mtheight & 15)) - Con_Printf("warning: texture \"%s\" in \"%s\" is not 16 aligned", dmiptex->name, loadmodel->name); + Con_Printf("warning: texture \"%s\" in \"%s\" is not 16 aligned\n", dmiptex->name, loadmodel->name); // LordHavoc: force all names to lowercase for (j = 0;name[j];j++) @@ -1247,9 +1247,9 @@ static void Mod_Q1BSP_LoadLighting(lump_t *l) else { if (fs_filesize == 8) - Con_Printf("Empty .lit file, ignoring\n"); + Con_Print("Empty .lit file, ignoring\n"); else - Con_Printf("Corrupt .lit file (old version?), ignoring\n"); + Con_Print("Corrupt .lit file (old version?), ignoring\n"); Mem_Free(data); } } @@ -1642,7 +1642,7 @@ static void SubdividePolygon(int numverts, float *verts) { if (subdivpolytriangles >= MAX_SUBDIVPOLYTRIANGLES) { - Con_Printf("SubdividePolygon: ran out of triangles in buffer, please increase your r_subdivide_size\n"); + Con_Print("SubdividePolygon: ran out of triangles in buffer, please increase your r_subdivide_size\n"); return; } @@ -2029,7 +2029,7 @@ static void Mod_Q1BSP_LoadLeafs(lump_t *l) if (p >= 0 && out->clusterindex >= 0) { if (p >= loadmodel->brushq1.num_compressedpvs) - Con_Printf("Mod_Q1BSP_LoadLeafs: invalid visofs\n"); + Con_Print("Mod_Q1BSP_LoadLeafs: invalid visofs\n"); else Mod_Q1BSP_DecompressVis(loadmodel->brushq1.data_compressedpvs + p, loadmodel->brushq1.data_compressedpvs + loadmodel->brushq1.num_compressedpvs, loadmodel->brush.data_pvsclusters + out->clusterindex * loadmodel->brush.num_pvsclusterbytes, loadmodel->brush.data_pvsclusters + (out->clusterindex + 1) * loadmodel->brush.num_pvsclusterbytes); } @@ -2522,7 +2522,7 @@ static void Mod_Q1BSP_RecursiveNodePortals(mnode_t *node) nodeportalwinding = Winding_Clip(nodeportalwinding, clipplane.normal[0], clipplane.normal[1], clipplane.normal[2], clipplane.dist, true); if (!nodeportalwinding) { - Con_Printf("Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal was clipped away\n"); + Con_Print("Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal was clipped away\n"); break; } } @@ -3605,7 +3605,7 @@ static void Mod_Q3BSP_LoadTextures(lump_t *l) text = f; while (COM_ParseToken(&text, false)) { - snprintf(shadername, sizeof(shadername), "%s", com_token); + strncpy(shadername, com_token, sizeof(shadername)); flags = 0; sky[0] = 0; if (COM_ParseToken(&text, false) && !strcasecmp(com_token, "{")) @@ -4279,7 +4279,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) if (out->data_element3i[j] < 0 || out->data_element3i[j] >= out->num_vertices) out->data_element3i[j] = 0; } - Con_Printf("\n"); + Con_Print("\n"); } // for shadow volumes Mod_BuildTriangleNeighbors(out->data_neighbor3i, out->data_element3i, out->num_triangles); diff --git a/model_shared.c b/model_shared.c index 1eb8d34e..c3943a3b 100644 --- a/model_shared.c +++ b/model_shared.c @@ -201,7 +201,7 @@ static void mod_newmap(void) Mod_Init =============== */ -static void Mod_Print (void); +static void Mod_Print(void); static void Mod_Precache (void); void Mod_Init (void) { @@ -476,10 +476,10 @@ static void Mod_Print(void) int i; model_t *mod; - Con_Printf ("Loaded models:\n"); + Con_Print("Loaded models:\n"); for (i = 0, mod = mod_known;i < MAX_MOD_KNOWN;i++, mod++) if (mod->name[0]) - Con_Printf ("%4iK %s\n", mod->mempool ? (mod->mempool->totalsize + 1023) / 1024 : 0, mod->name); + Con_Printf("%4iK %s\n", mod->mempool ? (mod->mempool->totalsize + 1023) / 1024 : 0, mod->name); } /* @@ -492,7 +492,7 @@ static void Mod_Precache(void) if (Cmd_Argc() == 2) Mod_ForName(Cmd_Argv(1), false, true, cl.worldmodel && !strcasecmp(Cmd_Argv(1), cl.worldmodel->name)); else - Con_Printf("usage: modelprecache \n"); + Con_Print("usage: modelprecache \n"); } #if 1 diff --git a/netconn.c b/netconn.c index a9c1963d..721b9a02 100755 --- a/netconn.c +++ b/netconn.c @@ -483,7 +483,7 @@ static void NetConn_UpdateServerStuff(void) { clientport2 = cl_netport.integer; if (cls.state == ca_connected) - Con_Printf("Changing \"cl_port\" will not take effect until you reconnect.\n"); + Con_Print("Changing \"cl_port\" will not take effect until you reconnect.\n"); } if (cls.state == ca_disconnected && clientport != clientport2) { @@ -498,7 +498,7 @@ static void NetConn_UpdateServerStuff(void) { hostport = sv_netport.integer; if (sv.active) - Con_Printf("Changing \"port\" will not take effect until \"map\" command is executed.\n"); + Con_Print("Changing \"port\" will not take effect until \"map\" command is executed.\n"); } } @@ -543,7 +543,7 @@ int NetConn_ReceivedMessage(netconn_t *conn, qbyte *data, int length) } } else - Con_DPrintf("Got a stale datagram\n"); + Con_DPrint("Got a stale datagram\n"); return 1; } else if (flags & NETFLAG_ACK) @@ -554,7 +554,7 @@ int NetConn_ReceivedMessage(netconn_t *conn, qbyte *data, int length) { conn->ackSequence++; if (conn->ackSequence != conn->sendSequence) - Con_DPrintf("ack sequencing error\n"); + Con_DPrint("ack sequencing error\n"); conn->lastMessageTime = realtime; conn->timeout = realtime + net_messagetimeout.value; conn->sendMessageLength -= MAX_PACKETFRAGMENT; @@ -571,10 +571,10 @@ int NetConn_ReceivedMessage(netconn_t *conn, qbyte *data, int length) } } else - Con_DPrintf("Duplicate ACK received\n"); + Con_DPrint("Duplicate ACK received\n"); } else - Con_DPrintf("Stale ACK received\n"); + Con_DPrint("Stale ACK received\n"); return 1; } else if (flags & NETFLAG_DATA) @@ -765,7 +765,7 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, length -= 18; masterreplycount++; if (m_state != m_slist) - Con_Printf("received server list...\n"); + Con_Print("received server list...\n"); while (length >= 7 && data[0] == '\\' && (data[1] != 0xFF || data[2] != 0xFF || data[3] != 0xFF || data[4] != 0xFF) && data[5] * 256 + data[6] != 0) { snprintf (ipstring, sizeof (ipstring), "%u.%u.%u.%u:%u", data[1], data[2], data[3], data[4], (data[5] << 8) | data[6]); @@ -800,8 +800,8 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, hostcache[n].ping = 100000; hostcache[n].querytime = realtime; // build description strings for the things users care about - snprintf(hostcache[n].line1, sizeof(hostcache[n].line1), "?"); - snprintf(hostcache[n].line2, sizeof(hostcache[n].line2), "%s", ipstring); + strncpy(hostcache[n].line1, "?", sizeof(hostcache[n].line1)); + strncpy(hostcache[n].line2, ipstring, sizeof(hostcache[n].line2)); // if not in the slist menu we should print the server to console if (m_state != m_slist) Con_Printf("querying %s\n", ipstring); @@ -947,7 +947,7 @@ void NetConn_ClientFrame(void) if (m_state == m_slist) strcpy (m_return_reason, "Connect: Failed"); else - Con_Printf("Connect failed\n"); + Con_Print("Connect failed\n"); return; } if (cls.connect_nextsendtime) @@ -955,14 +955,14 @@ void NetConn_ClientFrame(void) if (m_state == m_slist) strcpy (m_return_reason, "Connect: Still trying"); else - Con_Printf("Still trying...\n"); + Con_Print("Still trying...\n"); } else { if (m_state == m_slist) strcpy (m_return_reason, "Connect: Trying"); else - Con_Printf("Trying...\n"); + Con_Print("Trying...\n"); } cls.connect_nextsendtime = realtime + 1; cls.connect_remainingtries--; @@ -984,7 +984,7 @@ void NetConn_ClientFrame(void) NetConn_ClientParsePacket(cl_sockets[i], readbuffer, length, &peeraddress); if (cls.netcon && realtime > cls.netcon->timeout) { - Con_Printf("Connection timed out\n"); + Con_Print("Connection timed out\n"); CL_Disconnect(); } for (conn = netconn_list;conn;conn = conn->next) @@ -1469,7 +1469,7 @@ void NetConn_QueryMasters(void) } if (!masterquerycount) { - Con_Printf("Unable to query master servers, no suitable network sockets active.\n"); + Con_Print("Unable to query master servers, no suitable network sockets active.\n"); strcpy(m_return_reason, "No network"); } } @@ -1547,7 +1547,7 @@ static void Net_Heartbeat_f(void) if (sv.active) NetConn_Heartbeat(2); else - Con_Printf("No server running, can not heartbeat to master server.\n"); + Con_Print("No server running, can not heartbeat to master server.\n"); } void PrintStats(netconn_t *conn) @@ -1567,7 +1567,7 @@ void Net_Stats_f(void) Con_Printf("packetsReceived = %i\n", packetsReceived); Con_Printf("receivedDuplicateCount = %i\n", receivedDuplicateCount); Con_Printf("droppedDatagrams = %i\n", droppedDatagrams); - Con_Printf("connections =\n"); + Con_Print("connections =\n"); for (conn = netconn_list;conn;conn = conn->next) PrintStats(conn); } @@ -1582,10 +1582,10 @@ void Net_Slist_f(void) hostCacheCount = 0; memset(&pingcache, 0, sizeof(pingcache)); if (m_state != m_slist) - Con_Printf("Sending requests to master servers\n"); + Con_Print("Sending requests to master servers\n"); NetConn_QueryMasters(); if (m_state != m_slist) - Con_Printf("Listening for replies...\n"); + Con_Print("Listening for replies...\n"); } void NetConn_Init(void) diff --git a/ogg.c b/ogg.c index c3bc1af8..293226d0 100644 --- a/ogg.c +++ b/ogg.c @@ -390,7 +390,7 @@ sfxcache_t *OGG_LoadVorbisFile (const char *filename, sfx_t *s) ov_decode.buffsize = fs_filesize; if (qov_open_callbacks (&ov_decode, &vf, NULL, 0, callbacks) < 0) { - Con_Printf ("error while opening Ogg Vorbis file \"%s\"\n", filename); + Con_Printf("error while opening Ogg Vorbis file \"%s\"\n", filename); Mem_Free (data); return NULL; } @@ -399,7 +399,7 @@ sfxcache_t *OGG_LoadVorbisFile (const char *filename, sfx_t *s) vi = qov_info (&vf, -1); if (vi->channels < 1 || vi->channels > 2) { - Con_Printf ("%s has an unsupported number of channels (%i)\n", + Con_Printf("%s has an unsupported number of channels (%i)\n", s->name, vi->channels); qov_clear (&vf); Mem_Free (data); @@ -433,7 +433,7 @@ sfxcache_t *OGG_LoadVorbisFile (const char *filename, sfx_t *s) } else { - Con_Printf ("failed to allocate memory for sound \"%s\"\n", s->name); + Con_Printf("failed to allocate memory for sound \"%s\"\n", s->name); Mem_FreePool (&s->mempool); } diff --git a/palette.c b/palette.c index fc642acb..0f76f372 100644 --- a/palette.c +++ b/palette.c @@ -189,7 +189,7 @@ void Palette_Init(void) } else { - Con_DPrintf("Couldn't load gfx/palette.lmp, falling back on internal palette\n"); + Con_DPrint("Couldn't load gfx/palette.lmp, falling back on internal palette\n"); memcpy(host_basepal, host_quakepal, 765); } host_basepal[765] = host_basepal[766] = host_basepal[767] = 0; // LordHavoc: force the transparent color to black diff --git a/portals.c b/portals.c index bf6f2744..fdc4ecb9 100644 --- a/portals.c +++ b/portals.c @@ -483,7 +483,7 @@ void Portal_Visibility(model_t *model, const vec3_t eye, qbyte *leafmark, qbyte // if there is no model, it can not block visibility if (model == NULL) { - Con_Printf("Portal_Visibility: NULL model\n"); + Con_Print("Portal_Visibility: NULL model\n"); return; } @@ -491,7 +491,7 @@ void Portal_Visibility(model_t *model, const vec3_t eye, qbyte *leafmark, qbyte if (!model->brushq1.numportals) { - Con_Printf("Portal_Visibility: not a brush model\n"); + Con_Print("Portal_Visibility: not a brush model\n"); return; } diff --git a/pr_cmds.c b/pr_cmds.c index d2b39692..3f33113b 100644 --- a/pr_cmds.c +++ b/pr_cmds.c @@ -200,9 +200,9 @@ void PF_error (void) char string[STRINGTEMP_LENGTH]; PF_VarString(0, string, sizeof(string)); - Con_Printf ("======SERVER ERROR in %s:\n%s\n", PR_GetString(pr_xfunction->s_name), string); + Con_Printf("======SERVER ERROR in %s:\n%s\n", PR_GetString(pr_xfunction->s_name), string); ed = PROG_TO_EDICT(pr_global_struct->self); - ED_Print (ed); + ED_Print(ed); PF_ERROR("Program error"); } @@ -223,9 +223,9 @@ void PF_objerror (void) char string[STRINGTEMP_LENGTH]; PF_VarString(0, string, sizeof(string)); - Con_Printf ("======OBJECT ERROR in %s:\n%s\n", PR_GetString(pr_xfunction->s_name), string); + Con_Printf("======OBJECT ERROR in %s:\n%s\n", PR_GetString(pr_xfunction->s_name), string); ed = PROG_TO_EDICT(pr_global_struct->self); - ED_Print (ed); + ED_Print(ed); ED_Free (ed); } @@ -378,7 +378,7 @@ void PF_bprint (void) { char string[STRINGTEMP_LENGTH]; PF_VarString(0, string, sizeof(string)); - SV_BroadcastPrintf("%s", string); + SV_BroadcastPrint(string); } /* @@ -400,7 +400,7 @@ void PF_sprint (void) if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active) { - Con_Printf ("tried to sprint to a non-client\n"); + Con_Print("tried to sprint to a non-client\n"); return; } @@ -432,7 +432,7 @@ void PF_centerprint (void) if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active) { - Con_Printf ("tried to sprint to a non-client\n"); + Con_Print("tried to sprint to a non-client\n"); return; } @@ -636,7 +636,7 @@ void PF_ambientsound (void) if (!*check) { - Con_Printf ("no precache: %s\n", samp); + Con_Printf("no precache: %s\n", samp); return; } @@ -965,7 +965,7 @@ void PF_stuffcmd (void) entnum = G_EDICTNUM(OFS_PARM0); if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active) { - Con_Printf("Can't stuffcmd to a non-client"); + Con_Print("Can't stuffcmd to a non-client\n"); return; } str = G_STRING(OFS_PARM1); @@ -1074,7 +1074,7 @@ void PF_dprint (void) if (developer.integer) { PF_VarString(0, string, sizeof(string)); - Con_Printf("%s",string); + Con_Print(string); } } @@ -1889,7 +1889,7 @@ void PF_setspawnparms (void) i = NUM_FOR_EDICT(ent); if (i < 1 || i > svs.maxclients || !svs.clients[i-1].active) { - Con_Printf("tried to setspawnparms on a non-client\n"); + Con_Print("tried to setspawnparms on a non-client\n"); return; } @@ -1997,7 +1997,7 @@ void PF_registercvar (void) // check for overlap with a command if (Cmd_Exists (name)) { - Con_Printf ("PF_registercvar: %s is a command\n", name); + Con_Printf("PF_registercvar: %s is a command\n", name); return; } @@ -2149,7 +2149,7 @@ void PF_setcolor (void) if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active) { - Con_Printf ("tried to setcolor a non-client\n"); + Con_Print("tried to setcolor a non-client\n"); return; } @@ -2958,7 +2958,7 @@ void PF_clientcommand (void) i = (NUM_FOR_EDICT(G_EDICT(OFS_PARM0)) - 1); if (i < 0 || i >= svs.maxclients || !svs.clients[i].active) { - Con_Printf("PF_clientcommand: entity is not a client"); + Con_Print("PF_clientcommand: entity is not a client\n"); return; } diff --git a/pr_edict.c b/pr_edict.c index c3595f71..151e62f0 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -401,7 +401,7 @@ char *PR_ValueString (etype_t type, eval_t *val) switch (type) { case ev_string: - snprintf (line, sizeof (line), "%s", PR_GetString(val->string)); + strncpy(line, PR_GetString(val->string), sizeof(line)); break; case ev_entity: //n = NoCrash_NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)); @@ -489,7 +489,7 @@ char *PR_UglyValueString (etype_t type, eval_t *val) break; case ev_function: f = pr_functions + val->function; - snprintf (line, sizeof (line), "%s", PR_GetString(f->s_name)); + strncpy(line, PR_GetString(f->s_name), sizeof(line)); break; case ev_field: def = ED_FieldAtOfs ( val->_int ); @@ -576,7 +576,7 @@ For debugging */ // LordHavoc: optimized this to print out much more quickly (tempstring) // LordHavoc: changed to print out every 4096 characters (incase there are a lot of fields to print) -void ED_Print (edict_t *ed) +void ED_Print(edict_t *ed) { int l; ddef_t *d; @@ -588,7 +588,7 @@ void ED_Print (edict_t *ed) if (ed->e->free) { - Con_Printf ("FREE\n"); + Con_Print("FREE\n"); return; } @@ -636,12 +636,12 @@ void ED_Print (edict_t *ed) strlcat (tempstring, "\n", sizeof (tempstring)); if (strlen(tempstring) >= 4096) { - Con_Printf("%s", tempstring); + Con_Print(tempstring); tempstring[0] = 0; } } if (tempstring[0]) - Con_Printf("%s", tempstring); + Con_Print(tempstring); } /* @@ -659,11 +659,11 @@ void ED_Write (qfile_t *f, edict_t *ed) char *name; int type; - FS_Printf (f, "{\n"); + FS_Print(f, "{\n"); if (ed->e->free) { - FS_Printf (f, "}\n"); + FS_Print(f, "}\n"); return; } @@ -684,16 +684,16 @@ void ED_Write (qfile_t *f, edict_t *ed) if (j == type_size[type]) continue; - FS_Printf (f,"\"%s\" ",name); - FS_Printf (f,"\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v)); + FS_Printf(f,"\"%s\" ",name); + FS_Printf(f,"\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v)); } - FS_Printf (f, "}\n"); + FS_Print(f, "}\n"); } void ED_PrintNum (int ent) { - ED_Print (EDICT_NUM(ent)); + ED_Print(EDICT_NUM(ent)); } /* @@ -707,7 +707,7 @@ void ED_PrintEdicts (void) { int i; - Con_Printf ("%i entities\n", sv.num_edicts); + Con_Printf("%i entities\n", sv.num_edicts); for (i=0 ; i= sv.num_edicts) { - Con_Printf("Bad edict number\n"); + Con_Print("Bad edict number\n"); return; } ED_PrintNum (i); @@ -760,11 +760,11 @@ void ED_Count (void) step++; } - Con_Printf ("num_edicts:%3i\n", sv.num_edicts); - Con_Printf ("active :%3i\n", active); - Con_Printf ("view :%3i\n", models); - Con_Printf ("touch :%3i\n", solid); - Con_Printf ("step :%3i\n", step); + Con_Printf("num_edicts:%3i\n", sv.num_edicts); + Con_Printf("active :%3i\n", active); + Con_Printf("view :%3i\n", models); + Con_Printf("touch :%3i\n", solid); + Con_Printf("step :%3i\n", step); } @@ -789,7 +789,7 @@ void ED_WriteGlobals (qfile_t *f) char *name; int type; - FS_Printf (f,"{\n"); + FS_Print(f,"{\n"); for (i=0 ; inumglobaldefs ; i++) { def = &pr_globaldefs[i]; @@ -802,10 +802,10 @@ void ED_WriteGlobals (qfile_t *f) continue; name = PR_GetString(def->s_name); - FS_Printf (f,"\"%s\" ", name); - FS_Printf (f,"\"%s\"\n", PR_UglyValueString(type, (eval_t *)&pr_globals[def->ofs])); + FS_Printf(f,"\"%s\" ", name); + FS_Printf(f,"\"%s\"\n", PR_UglyValueString(type, (eval_t *)&pr_globals[def->ofs])); } - FS_Printf (f,"}\n"); + FS_Print(f,"}\n"); } /* @@ -822,7 +822,7 @@ void ED_EdictSet_f(void) if(Cmd_Argc() != 4) { - Con_Printf("edictset \n"); + Con_Print("edictset \n"); return; } ed = EDICT_NUM(atoi(Cmd_Argv(1))); @@ -866,7 +866,7 @@ void ED_ParseGlobals (const char *data) key = ED_FindGlobal (keyname); if (!key) { - Con_DPrintf ("'%s' is not a global\n", keyname); + Con_DPrintf("'%s' is not a global\n", keyname); continue; } @@ -984,7 +984,7 @@ qboolean ED_ParseEpair(edict_t *ent, ddef_t *key, const char *s) func = ED_FindFunction(s); if (!func) { - Con_Printf ("ED_ParseEpair: Can't find function %s\n", s); + Con_Printf("ED_ParseEpair: Can't find function %s\n", s); return false; } val->function = func - pr_functions; @@ -1066,7 +1066,7 @@ const char *ED_ParseEdict (const char *data, edict_t *ent) key = ED_FindField (keyname); if (!key) { - Con_DPrintf ("'%s' is not a field\n", keyname); + Con_DPrintf("'%s' is not a field\n", keyname); continue; } @@ -1156,8 +1156,8 @@ void ED_LoadFromFile (const char *data) // if (!ent->v->classname) { - Con_Printf ("No classname for:\n"); - ED_Print (ent); + Con_Print("No classname for:\n"); + ED_Print(ent); ED_Free (ent); continue; } @@ -1169,8 +1169,8 @@ void ED_LoadFromFile (const char *data) { if (developer.integer) // don't confuse non-developers with errors { - Con_Printf ("No spawn function for:\n"); - ED_Print (ent); + Con_Print("No spawn function for:\n"); + ED_Print(ent); } ED_Free (ent); continue; @@ -1183,7 +1183,7 @@ void ED_LoadFromFile (const char *data) died++; } - Con_DPrintf ("%i entities parsed, %i inhibited, %i spawned (%i removed self, %i stayed)\n", parsed, inhibited, spawned, died, spawned - died); + Con_DPrintf("%i entities parsed, %i inhibited, %i spawned (%i removed self, %i stayed)\n", parsed, inhibited, spawned, died, spawned - died); } @@ -1270,7 +1270,7 @@ void PR_LoadProgs (void) memcpy(progs, temp, fs_filesize); Mem_Free(temp); - Con_DPrintf ("Programs occupy %iK.\n", fs_filesize/1024); + Con_DPrintf("Programs occupy %iK.\n", fs_filesize/1024); pr_crc = CRC_Block((qbyte *)progs, fs_filesize); @@ -1474,7 +1474,7 @@ void PR_Fields_f (void) int *v; if (!sv.active) { - Con_Printf("no progs loaded\n"); + Con_Print("no progs loaded\n"); return; } counts = Mem_Alloc(tempmempool, progs->numfielddefs * sizeof(int)); @@ -1556,7 +1556,7 @@ void PR_Fields_f (void) strlcat (tempstring, "\n", sizeof (tempstring)); if (strlen(tempstring) >= 4096) { - Con_Printf("%s", tempstring); + Con_Print(tempstring); tempstring[0] = 0; } if (counts[i]) @@ -1574,7 +1574,7 @@ void PR_Globals_f (void) int i; if (!sv.active) { - Con_Printf("no progs loaded\n"); + Con_Print("no progs loaded\n"); return; } for (i = 0;i < progs->numglobaldefs;i++) diff --git a/pr_exec.c b/pr_exec.c index c2f13019..5a5243e9 100644 --- a/pr_exec.c +++ b/pr_exec.c @@ -151,33 +151,33 @@ void PR_PrintStatement (dstatement_t *s) if ( (unsigned)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0])) { - Con_Printf ("%s ", pr_opnames[s->op]); + Con_Printf("%s ", pr_opnames[s->op]); i = strlen(pr_opnames[s->op]); for ( ; i<10 ; i++) - Con_Printf (" "); + Con_Print(" "); } if (s->op == OP_IF || s->op == OP_IFNOT) - Con_Printf ("%sbranch %i",PR_GlobalString((unsigned short) s->a),s->b); + Con_Printf("%sbranch %i",PR_GlobalString((unsigned short) s->a),s->b); else if (s->op == OP_GOTO) { - Con_Printf ("branch %i",s->a); + Con_Printf("branch %i",s->a); } else if ( (unsigned)(s->op - OP_STORE_F) < 6) { - Con_Printf ("%s", PR_GlobalString((unsigned short) s->a)); - Con_Printf ("%s", PR_GlobalStringNoContents((unsigned short) s->b)); + Con_Print(PR_GlobalString((unsigned short) s->a)); + Con_Print(PR_GlobalStringNoContents((unsigned short) s->b)); } else { if (s->a) - Con_Printf ("%s", PR_GlobalString((unsigned short) s->a)); + Con_Print(PR_GlobalString((unsigned short) s->a)); if (s->b) - Con_Printf ("%s", PR_GlobalString((unsigned short) s->b)); + Con_Print(PR_GlobalString((unsigned short) s->b)); if (s->c) - Con_Printf ("%s", PR_GlobalStringNoContents((unsigned short) s->c)); + Con_Print(PR_GlobalStringNoContents((unsigned short) s->c)); } - Con_Printf ("\n"); + Con_Print("\n"); } /* @@ -197,9 +197,9 @@ void PR_StackTrace (void) f = pr_stack[i].f; if (!f) - Con_Printf ("\n"); + Con_Print("\n"); else - Con_Printf ("%12s : %s : statement %i\n", PR_GetString(f->s_file), PR_GetString(f->s_name), pr_stack[i].s - f->first_statement); + Con_Printf("%12s : %s : statement %i\n", PR_GetString(f->s_file), PR_GetString(f->s_name), pr_stack[i].s - f->first_statement); } } @@ -235,7 +235,7 @@ void PR_Profile_f (void) if (best) { //if (num < howmany) - Con_Printf ("%7i %7i %s\n", best->profile, best->builtinsprofile, PR_GetString(best->s_name)); + Con_Printf("%7i %7i %s\n", best->profile, best->builtinsprofile, PR_GetString(best->s_name)); num++; best->profile = 0; best->builtinsprofile = 0; @@ -253,7 +253,7 @@ void PR_PrintState(void) PR_PrintStatement (pr_statements + pr_xstatement + i); } else - Con_Printf("null function executing??\n"); + Con_Print("null function executing??\n"); PR_StackTrace (); } @@ -261,7 +261,7 @@ void PR_Crash(void) { if (pr_depth > 0) { - Con_Printf("QuakeC crash report:\n"); + Con_Print("QuakeC crash report:\n"); PR_PrintState(); } @@ -383,7 +383,7 @@ void PR_ExecuteProgram (func_t fnum, const char *errormessage) if (!fnum || fnum >= progs->numfunctions) { if (pr_global_struct->self) - ED_Print (PROG_TO_EDICT(pr_global_struct->self)); + ED_Print(PROG_TO_EDICT(pr_global_struct->self)); Host_Error ("PR_ExecuteProgram: %s", errormessage); } diff --git a/progs.h b/progs.h index 394fc880..18d15884 100644 --- a/progs.h +++ b/progs.h @@ -171,7 +171,7 @@ void ED_ClearEdict (edict_t *e); char *ED_NewString (const char *string); // returns a copy of the string allocated from the server's string heap -void ED_Print (edict_t *ed); +void ED_Print(edict_t *ed); void ED_Write (qfile_t *f, edict_t *ed); const char *ED_ParseEdict (const char *data, edict_t *ent); diff --git a/progsvm.h b/progsvm.h index 2bd376a4..d461da31 100644 --- a/progsvm.h +++ b/progsvm.h @@ -375,7 +375,7 @@ void PRVM_ED_ClearEdict (prvm_edict_t *e); char *PRVM_ED_NewString (const char *string); // returns a copy of the string allocated from the server's string heap -void PRVM_ED_Print (prvm_edict_t *ed); +void PRVM_ED_Print(prvm_edict_t *ed); void PRVM_ED_Write (qfile_t *f, prvm_edict_t *ed); const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent); diff --git a/protocol.c b/protocol.c index 87a1816d..3278be05 100644 --- a/protocol.c +++ b/protocol.c @@ -391,7 +391,7 @@ void EntityState_ReadUpdate(entity_state_t *e, int number) Con_Printf(" E_TAGATTACHMENT e%i:%i", e->tagentity, e->tagindex); if (bits & E_LIGHTSTYLE) Con_Printf(" E_LIGHTSTYLE %i", e->lightstyle); - Con_Printf("\n"); + Con_Print("\n"); } } @@ -491,9 +491,9 @@ void EntityFrame_AddFrame(entity_database_t *d, entity_frame_t *f) if (e >= d->frames[n].framenum) { if (e == f->framenum) - Con_Printf("EntityFrame_AddFrame: tried to add out of sequence frame to database\n"); + Con_Print("EntityFrame_AddFrame: tried to add out of sequence frame to database\n"); else - Con_Printf("EntityFrame_AddFrame: out of sequence frames in database\n"); + Con_Print("EntityFrame_AddFrame: out of sequence frames in database\n"); return; } e = d->frames[n].framenum; @@ -816,11 +816,11 @@ void EntityFrame4_CL_ReadFrame(entity_database4_t *d) for (i = 0;i < MAX_ENTITY_HISTORY;i++) if (d->commit[i].numentities) Con_Printf(" %i", d->commit[i].framenum); - Con_Printf("\n"); + Con_Print("\n"); } if (!EntityFrame4_AckFrame(d, referenceframenum)) { - Con_Printf("EntityFrame4_CL_ReadFrame: reference frame invalid (VERY BAD ERROR), this update will be skipped\n"); + Con_Print("EntityFrame4_CL_ReadFrame: reference frame invalid (VERY BAD ERROR), this update will be skipped\n"); skip = true; d->ackframenum = -1; EntityFrame4_ResetDatabase(d); diff --git a/prvm_cmds.c b/prvm_cmds.c index 5a8b49ff..bfc904d3 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -290,11 +290,11 @@ void VM_error (void) char string[VM_STRINGTEMP_LENGTH]; VM_VarString(0, string, sizeof(string)); - Con_Printf ("======%S ERROR in %s:\n%s\n", PRVM_NAME, PRVM_GetString(prog->xfunction->s_name), string); + Con_Printf("======%S ERROR in %s:\n%s\n", PRVM_NAME, PRVM_GetString(prog->xfunction->s_name), string); if(prog->self) { ed = PRVM_G_EDICT(prog->self->ofs); - PRVM_ED_Print (ed); + PRVM_ED_Print(ed); } PRVM_ERROR ("%s: Program error", PRVM_NAME); @@ -316,11 +316,11 @@ void VM_objerror (void) char string[VM_STRINGTEMP_LENGTH]; VM_VarString(0, string, sizeof(string)); - Con_Printf ("======%s OBJECT ERROR in %s:\n%s\n", PRVM_NAME, PRVM_GetString(prog->xfunction->s_name), string); + Con_Printf("======%s OBJECT ERROR in %s:\n%s\n", PRVM_NAME, PRVM_GetString(prog->xfunction->s_name), string); if(prog->self) { ed = PRVM_G_EDICT (prog->self->ofs); - PRVM_ED_Print (ed); + PRVM_ED_Print(ed); PRVM_ED_Free (ed); } @@ -343,7 +343,7 @@ void VM_print (void) char string[VM_STRINGTEMP_LENGTH]; VM_VarString(0, string, sizeof(string)); - Con_Printf(string); + Con_Print(string); } /* @@ -361,12 +361,12 @@ void VM_bprint (void) if(!sv.active) { - Con_Printf("VM_bprint: game is not server(%s) !", PRVM_NAME); + Con_Printf("VM_bprint: game is not server(%s) !\n", PRVM_NAME); return; } VM_VarString(0, string, sizeof(string)); - SV_BroadcastPrintf("%s", string); + SV_BroadcastPrint(string); } /* @@ -388,7 +388,7 @@ void VM_sprint (void) clientnum = PRVM_G_FLOAT(OFS_PARM0); if (!sv.active || clientnum < 0 || clientnum >= svs.maxclients || !svs.clients[clientnum].active) { - Con_Printf("VM_sprint: %s: invalid client or server is not active !", PRVM_NAME); + Con_Printf("VM_sprint: %s: invalid client or server is not active !\n", PRVM_NAME); return; } @@ -1516,7 +1516,7 @@ void VM_registercvar (void) // check for overlap with a command if (Cmd_Exists (name)) { - Con_Printf ("VM_registercvar: %s is a command\n", name); + Con_Printf("VM_registercvar: %s is a command\n", name); return; } @@ -1658,7 +1658,7 @@ setcolor(clientent, value) if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active) { - Con_Printf ("tried to setcolor a non-client\n"); + Con_Print("tried to setcolor a non-client\n"); return; } @@ -1730,7 +1730,7 @@ void VM_fopen(void) modestring = "wb"; break; default: - Con_Printf ("VM_fopen: %s no such mode %i (valid: 0 = read, 1 = append, 2 = write)\n", PRVM_NAME, mode); + Con_Printf("VM_fopen: %s no such mode %i (valid: 0 = read, 1 = append, 2 = write)\n", PRVM_NAME, mode); PRVM_G_FLOAT(OFS_RETURN) = -3; return; } @@ -2007,7 +2007,7 @@ void VM_clcommand (void) i = PRVM_G_FLOAT(OFS_PARM0); if (!sv.active || i < 0 || i >= svs.maxclients || !svs.clients[i].active) { - Con_Printf("VM_clientcommand: %s: invalid client/server is not active !", PRVM_NAME); + Con_Printf("VM_clientcommand: %s: invalid client/server is not active !\n", PRVM_NAME); return; } @@ -2564,7 +2564,7 @@ void VM_drawcharacter(void) } if(pos[2] || scale[2]) - Con_Printf("VM_drawcharacter: z value%c from %s discarded",(pos[2] && scale[2]) ? 's' : 0,((pos[2] && scale[2]) ? "pos and scale" : (pos[2] ? "pos" : "scale"))); + Con_Printf("VM_drawcharacter: z value%c from %s discarded\n",(pos[2] && scale[2]) ? 's' : 0,((pos[2] && scale[2]) ? "pos and scale" : (pos[2] ? "pos" : "scale"))); if(!scale[0] || !scale[1]) { @@ -2621,7 +2621,7 @@ void VM_drawstring(void) } if(pos[2] || scale[2]) - Con_Printf("VM_drawstring: z value%c from %s discarded",(pos[2] && scale[2]) ? 's' : 0,((pos[2] && scale[2]) ? "pos and scale" : (pos[2] ? "pos" : "scale"))); + Con_Printf("VM_drawstring: z value%c from %s discarded\n",(pos[2] && scale[2]) ? 's' : 0,((pos[2] && scale[2]) ? "pos and scale" : (pos[2] ? "pos" : "scale"))); DrawQ_String (pos[0], pos[1], string, 0, scale[0], scale[1], rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM4), flag); PRVM_G_FLOAT(OFS_RETURN) = 1; @@ -2673,7 +2673,7 @@ void VM_drawpic(void) } if(pos[2] || size[2]) - Con_Printf("VM_drawstring: z value%c from %s discarded",(pos[2] && size[2]) ? 's' : 0,((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size"))); + Con_Printf("VM_drawstring: z value%c from %s discarded\n",(pos[2] && size[2]) ? 's' : 0,((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size"))); DrawQ_Pic(pos[0], pos[1], pic, size[0], size[1], rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM4), flag); PRVM_G_FLOAT(OFS_RETURN) = 1; @@ -2707,7 +2707,7 @@ void VM_drawfill(void) } if(pos[2] || size[2]) - Con_Printf("VM_drawstring: z value%c from %s discarded",(pos[2] && size[2]) ? 's' : 0,((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size"))); + Con_Printf("VM_drawstring: z value%c from %s discarded\n",(pos[2] && size[2]) ? 's' : 0,((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size"))); DrawQ_Pic(pos[0], pos[1], 0, size[0], size[1], rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM3), flag); PRVM_G_FLOAT(OFS_RETURN) = 1; @@ -3151,7 +3151,7 @@ void VM_M_gethostcachevalue( void ) type = PRVM_G_FLOAT( OFS_PARM0 ); if( type < 0 || type > 4 ) - Con_Printf ( "VM_M_gethostcachevalue: bad type %i!\n", type ); + Con_Printf( "VM_M_gethostcachevalue: bad type %i!\n", type ); else switch(type) { case 0: @@ -3197,7 +3197,7 @@ void VM_M_gethostcachestring(void) if(type < 0 || type > 2) { - Con_Printf("VM_M_gethostcachestring: bad string type requested!\n"); + Con_Print("VM_M_gethostcachestring: bad string type requested!\n"); return; } @@ -3205,7 +3205,7 @@ void VM_M_gethostcachestring(void) if(hostnr < 0 || hostnr >= hostCacheCount) { - Con_Printf("VM_M_gethostcachestring: bad hostnr passed!\n"); + Con_Print("VM_M_gethostcachestring: bad hostnr passed!\n"); return; } diff --git a/prvm_edict.c b/prvm_edict.c index daa322d0..4baf85d5 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -383,7 +383,7 @@ char *PRVM_ValueString (etype_t type, prvm_eval_t *val) switch (type) { case ev_string: - sprintf (line, "%s", PRVM_GetString(val->string)); + strncpy(line, PRVM_GetString(val->string), sizeof(line)); break; case ev_entity: n = val->edict; @@ -470,7 +470,7 @@ char *PRVM_UglyValueString (etype_t type, prvm_eval_t *val) break; case ev_function: f = pr_functions + val->function; - snprintf (line, sizeof (line), "%s", PRVM_GetString(f->s_name)); + strncpy(line, PRVM_GetString(f->s_name), sizeof(line)); break; case ev_field: def = PRVM_ED_FieldAtOfs ( val->_int ); @@ -557,7 +557,7 @@ For debugging */ // LordHavoc: optimized this to print out much more quickly (tempstring) // LordHavoc: changed to print out every 4096 characters (incase there are a lot of fields to print) -void PRVM_ED_Print (prvm_edict_t *ed) +void PRVM_ED_Print(prvm_edict_t *ed) { int l; ddef_t *d; @@ -569,7 +569,7 @@ void PRVM_ED_Print (prvm_edict_t *ed) if (ed->e->free) { - Con_Printf ("%s: FREE\n",PRVM_NAME); + Con_Printf("%s: FREE\n",PRVM_NAME); return; } @@ -617,12 +617,12 @@ void PRVM_ED_Print (prvm_edict_t *ed) strcat(tempstring, "\n"); if (strlen(tempstring) >= 4096) { - Con_Printf("%s", tempstring); + Con_Print(tempstring); tempstring[0] = 0; } } if (tempstring[0]) - Con_Printf("%s", tempstring); + Con_Print(tempstring); } /* @@ -640,11 +640,11 @@ void PRVM_ED_Write (qfile_t *f, prvm_edict_t *ed) char *name; int type; - FS_Printf (f, "{\n"); + FS_Print(f, "{\n"); if (ed->e->free) { - FS_Printf (f, "}\n"); + FS_Print(f, "}\n"); return; } @@ -665,16 +665,16 @@ void PRVM_ED_Write (qfile_t *f, prvm_edict_t *ed) if (j == prvm_type_size[type]) continue; - FS_Printf (f,"\"%s\" ",name); - FS_Printf (f,"\"%s\"\n", PRVM_UglyValueString(d->type, (prvm_eval_t *)v)); + FS_Printf(f,"\"%s\" ",name); + FS_Printf(f,"\"%s\"\n", PRVM_UglyValueString(d->type, (prvm_eval_t *)v)); } - FS_Printf (f, "}\n"); + FS_Print(f, "}\n"); } void PRVM_ED_PrintNum (int ent) { - PRVM_ED_Print (PRVM_EDICT_NUM(ent)); + PRVM_ED_Print(PRVM_EDICT_NUM(ent)); } /* @@ -690,7 +690,7 @@ void PRVM_ED_PrintEdicts_f (void) if(Cmd_Argc() != 2) { - Con_Printf("prvm_edicts \n"); + Con_Print("prvm_edicts \n"); return; } @@ -698,7 +698,7 @@ void PRVM_ED_PrintEdicts_f (void) if(!PRVM_SetProgFromString(Cmd_Argv(1))) return; - Con_Printf ("%s: %i entities\n", PRVM_NAME, prog->num_edicts); + Con_Printf("%s: %i entities\n", PRVM_NAME, prog->num_edicts); for (i=0 ; inum_edicts ; i++) PRVM_ED_PrintNum (i); @@ -718,7 +718,7 @@ void PRVM_ED_PrintEdict_f (void) if(Cmd_Argc() != 3) { - Con_Printf("prvm_edict \n"); + Con_Print("prvm_edict \n"); return; } @@ -729,7 +729,7 @@ void PRVM_ED_PrintEdict_f (void) i = atoi (Cmd_Argv(2)); if (i >= prog->num_edicts) { - Con_Printf("Bad edict number\n"); + Con_Print("Bad edict number\n"); PRVM_End; return; } @@ -755,7 +755,7 @@ void PRVM_ED_Count_f (void) if(Cmd_Argc() != 2) { - Con_Printf("prvm_count \n"); + Con_Print("prvm_count \n"); return; } @@ -776,8 +776,8 @@ void PRVM_ED_Count_f (void) active++; } - Con_Printf ("num_edicts:%3i\n", prog->num_edicts); - Con_Printf ("active :%3i\n", active); + Con_Printf("num_edicts:%3i\n", prog->num_edicts); + Con_Printf("active :%3i\n", active); } PRVM_End; @@ -804,7 +804,7 @@ void PRVM_ED_WriteGlobals (qfile_t *f) char *name; int type; - FS_Printf (f,"{\n"); + FS_Print(f,"{\n"); for (i=0 ; iprogs->numglobaldefs ; i++) { def = &prog->globaldefs[i]; @@ -817,10 +817,10 @@ void PRVM_ED_WriteGlobals (qfile_t *f) continue; name = PRVM_GetString(def->s_name); - FS_Printf (f,"\"%s\" ", name); - FS_Printf (f,"\"%s\"\n", PRVM_UglyValueString(type, (prvm_eval_t *)&prog->globals[def->ofs])); + FS_Printf(f,"\"%s\" ", name); + FS_Printf(f,"\"%s\"\n", PRVM_UglyValueString(type, (prvm_eval_t *)&prog->globals[def->ofs])); } - FS_Printf (f,"}\n"); + FS_Print(f,"}\n"); } /* @@ -853,7 +853,7 @@ void PRVM_ED_ParseGlobals (const char *data) key = PRVM_ED_FindGlobal (keyname); if (!key) { - Con_DPrintf ("'%s' is not a global on %s\n", keyname, PRVM_NAME); + Con_DPrintf("'%s' is not a global on %s\n", keyname, PRVM_NAME); continue; } @@ -971,7 +971,7 @@ qboolean PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s) func = PRVM_ED_FindFunction(s); if (!func) { - Con_Printf ("PRVM_ED_ParseEpair: Can't find function %s in %s\n", s, PRVM_NAME); + Con_Printf("PRVM_ED_ParseEpair: Can't find function %s in %s\n", s, PRVM_NAME); return false; } val->function = func - prog->functions; @@ -998,7 +998,7 @@ void PRVM_ED_EdictSet_f(void) if(Cmd_Argc() != 5) { - Con_Printf("prvm_edictset \n"); + Con_Print("prvm_edictset \n"); return; } @@ -1095,7 +1095,7 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent) key = PRVM_ED_FindField (keyname); if (!key) { - Con_DPrintf ("%s: '%s' is not a field\n", PRVM_NAME, keyname); + Con_DPrintf("%s: '%s' is not a field\n", PRVM_NAME, keyname); continue; } @@ -1178,8 +1178,8 @@ void PRVM_ED_LoadFromFile (const char *data) string_t handle = *(string_t*)&((float*)ent->v)[PRVM_ED_FindFieldOffset("classname")]; if (!handle) { - Con_Printf ("No classname for:\n"); - PRVM_ED_Print (ent); + Con_Print("No classname for:\n"); + PRVM_ED_Print(ent); PRVM_ED_Free (ent); continue; } @@ -1191,8 +1191,8 @@ void PRVM_ED_LoadFromFile (const char *data) { if (developer.integer) // don't confuse non-developers with errors { - Con_Printf ("No spawn function for:\n"); - PRVM_ED_Print (ent); + Con_Print("No spawn function for:\n"); + PRVM_ED_Print(ent); } PRVM_ED_Free (ent); continue; @@ -1208,7 +1208,7 @@ void PRVM_ED_LoadFromFile (const char *data) died++; } - Con_DPrintf ("%s: %i new entities parsed, %i new inhibited, %i (%i new) spawned (whereas %i removed self, %i stayed)\n", PRVM_NAME, parsed, inhibited, prog->num_edicts, spawned, died, spawned - died); + Con_DPrintf("%s: %i new entities parsed, %i new inhibited, %i (%i new) spawned (whereas %i removed self, %i stayed)\n", PRVM_NAME, parsed, inhibited, prog->num_edicts, spawned, died, spawned - died); } // not used @@ -1284,7 +1284,7 @@ void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required memcpy(prog->progs, temp, fs_filesize); Mem_Free(temp); - Con_DPrintf ("%s programs occupy %iK.\n", PRVM_NAME, fs_filesize/1024); + Con_DPrintf("%s programs occupy %iK.\n", PRVM_NAME, fs_filesize/1024); pr_crc = CRC_Block((qbyte *)prog->progs, fs_filesize); @@ -1522,14 +1522,14 @@ void PRVM_Fields_f (void) /* if (!sv.active) { - Con_Printf("no progs loaded\n"); + Con_Print("no progs loaded\n"); return; } */ if(Cmd_Argc() != 2) { - Con_Printf("prvm_fields \n"); + Con_Print("prvm_fields \n"); return; } @@ -1616,7 +1616,7 @@ void PRVM_Fields_f (void) strcat(tempstring, "\n"); if (strlen(tempstring) >= 4096) { - Con_Printf("%s", tempstring); + Con_Print(tempstring); tempstring[0] = 0; } if (counts[i]) @@ -1637,12 +1637,12 @@ void PRVM_Globals_f (void) // TODO /*if (!sv.active) { - Con_Printf("no progs loaded\n"); + Con_Print("no progs loaded\n"); return; }*/ if(Cmd_Argc () != 2) { - Con_Printf("prvm_globals \n"); + Con_Print("prvm_globals \n"); return; } diff --git a/prvm_exec.c b/prvm_exec.c index 9816450c..6ef71c3c 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -126,33 +126,33 @@ void PRVM_PrintStatement (dstatement_t *s) if ( (unsigned)s->op < sizeof(prvm_opnames)/sizeof(prvm_opnames[0])) { - Con_Printf ("%s ", prvm_opnames[s->op]); + Con_Printf("%s ", prvm_opnames[s->op]); i = strlen(prvm_opnames[s->op]); for ( ; i<10 ; i++) - Con_Printf (" "); + Con_Print(" "); } if (s->op == OP_IF || s->op == OP_IFNOT) - Con_Printf ("%sbranch %i",PRVM_GlobalString((unsigned short) s->a),s->b); + Con_Printf("%sbranch %i",PRVM_GlobalString((unsigned short) s->a),s->b); else if (s->op == OP_GOTO) { - Con_Printf ("branch %i",s->a); + Con_Printf("branch %i",s->a); } else if ( (unsigned)(s->op - OP_STORE_F) < 6) { - Con_Printf ("%s", PRVM_GlobalString((unsigned short) s->a)); - Con_Printf ("%s", PRVM_GlobalStringNoContents((unsigned short) s->b)); + Con_Print(PRVM_GlobalString((unsigned short) s->a)); + Con_Print(PRVM_GlobalStringNoContents((unsigned short) s->b)); } else { if (s->a) - Con_Printf ("%s", PRVM_GlobalString((unsigned short) s->a)); + Con_Print(PRVM_GlobalString((unsigned short) s->a)); if (s->b) - Con_Printf ("%s", PRVM_GlobalString((unsigned short) s->b)); + Con_Print(PRVM_GlobalString((unsigned short) s->b)); if (s->c) - Con_Printf ("%s", PRVM_GlobalStringNoContents((unsigned short) s->c)); + Con_Print(PRVM_GlobalStringNoContents((unsigned short) s->c)); } - Con_Printf ("\n"); + Con_Print("\n"); } /* @@ -172,9 +172,9 @@ void PRVM_StackTrace (void) f = prog->stack[i].f; if (!f) - Con_Printf ("\n"); + Con_Print("\n"); else - Con_Printf ("%12s : %s : statement %i\n", PRVM_GetString(f->s_file), PRVM_GetString(f->s_name), prog->stack[i].s - f->first_statement); + Con_Printf("%12s : %s : statement %i\n", PRVM_GetString(f->s_file), PRVM_GetString(f->s_name), prog->stack[i].s - f->first_statement); } } @@ -195,7 +195,7 @@ void PRVM_Profile_f (void) // howmany = atoi(Cmd_Argv(1)); if(Cmd_Argc() != 2) { - Con_Printf("prvm_profile \n"); + Con_Print("prvm_profile \n"); return; } @@ -220,7 +220,7 @@ void PRVM_Profile_f (void) if (best) { //if (num < howmany) - Con_Printf ("%s: %7i %7i %s\n", PRVM_NAME, best->profile, best->builtinsprofile, PRVM_GetString(best->s_name)); + Con_Printf("%s: %7i %7i %s\n", PRVM_NAME, best->profile, best->builtinsprofile, PRVM_GetString(best->s_name)); num++; best->profile = 0; best->builtinsprofile = 0; @@ -256,7 +256,7 @@ void PRVM_PrintState(void) PRVM_PrintStatement (prog->statements + prog->xstatement + i); } else - Con_Printf("null function executing??\n"); + Con_Print("null function executing??\n"); PRVM_StackTrace (); } @@ -393,7 +393,7 @@ void PRVM_ExecuteProgram (func_t fnum, const char *errormessage) if (!fnum || fnum >= prog->progs->numfunctions) { if (prog->self && PRVM_G_INT(prog->self->ofs)) - PRVM_ED_Print (PRVM_PROG_TO_EDICT(PRVM_G_INT(prog->self->ofs))); + PRVM_ED_Print(PRVM_PROG_TO_EDICT(PRVM_G_INT(prog->self->ofs))); PRVM_ERROR ("PR_ExecuteProgram: %s", errormessage); } diff --git a/r_lerpanim.c b/r_lerpanim.c index 0a91e813..b9f30a7f 100644 --- a/r_lerpanim.c +++ b/r_lerpanim.c @@ -20,13 +20,13 @@ void R_LerpAnimation(entity_render_t *r) if (r->frame1 >= numframes) { - Con_DPrintf ("CL_LerpAnimation: no such frame %d\n", r->frame1); + Con_DPrintf("CL_LerpAnimation: no such frame %d\n", r->frame1); r->frame1 = 0; } if (r->frame2 >= numframes) { - Con_DPrintf ("CL_LerpAnimation: no such frame %d\n", r->frame2); + Con_DPrintf("CL_LerpAnimation: no such frame %d\n", r->frame2); r->frame2 = 0; } diff --git a/r_modules.c b/r_modules.c index a4e046eb..0899b880 100644 --- a/r_modules.c +++ b/r_modules.c @@ -73,7 +73,7 @@ void R_Modules_Shutdown(void) void R_Modules_Restart(void) { - Con_Printf("restarting renderer\n"); + Con_Print("restarting renderer\n"); R_Modules_Shutdown(); R_Modules_Start(); } diff --git a/r_shadow.c b/r_shadow.c index 58f203e6..1e0352f1 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -2293,7 +2293,7 @@ rtexture_t *R_Shadow_LoadCubemap(const char *basename) for (j = 0;j < 3;j++) for (i = 0;i < 6;i++) Con_Printf("%s\"%s%s.tga\"", j + i > 0 ? ", " : "", basename, suffix[j][i].suffix); - Con_Printf(" and was unable to find any of them.\n"); + Con_Print(" and was unable to find any of them.\n"); } return cubemaptexture; } @@ -2324,7 +2324,7 @@ void R_Shadow_NewWorldLight(vec3_t origin, vec3_t angles, vec3_t color, vec_t ra if (radius < 15 || DotProduct(color, color) < 0.03) { - Con_Printf("R_Shadow_NewWorldLight: refusing to create a light too small/dim\n"); + Con_Print("R_Shadow_NewWorldLight: refusing to create a light too small/dim\n"); return; } @@ -2449,7 +2449,7 @@ void R_Shadow_LoadWorldLights(void) float origin[3], radius, color[3], angles[3], corona; if (cl.worldmodel == NULL) { - Con_Printf("No map loaded.\n"); + Con_Print("No map loaded.\n"); return; } FS_StripExtension (cl.worldmodel->name, name, sizeof (name)); @@ -2526,7 +2526,7 @@ void R_Shadow_SaveWorldLights(void) return; if (cl.worldmodel == NULL) { - Con_Printf("No map loaded.\n"); + Con_Print("No map loaded.\n"); return; } FS_StripExtension (cl.worldmodel->name, name, sizeof (name)); @@ -2567,7 +2567,7 @@ void R_Shadow_LoadLightsFile(void) float origin[3], radius, color[3], subtract, spotdir[3], spotcone, falloff, distbias; if (cl.worldmodel == NULL) { - Con_Printf("No map loaded.\n"); + Con_Print("No map loaded.\n"); return; } FS_StripExtension (cl.worldmodel->name, name, sizeof (name)); @@ -2614,7 +2614,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void) if (cl.worldmodel == NULL) { - Con_Printf("No map loaded.\n"); + Con_Print("No map loaded.\n"); return; } data = cl.worldmodel->brush.entities; @@ -2842,12 +2842,12 @@ void R_Shadow_EditLights_Spawn_f(void) vec3_t color; if (!r_editlights.integer) { - Con_Printf("Cannot spawn light when not in editing mode. Set r_editlights to 1.\n"); + Con_Print("Cannot spawn light when not in editing mode. Set r_editlights to 1.\n"); return; } if (Cmd_Argc() != 1) { - Con_Printf("r_editlights_spawn does not take parameters\n"); + Con_Print("r_editlights_spawn does not take parameters\n"); return; } color[0] = color[1] = color[2] = 1; @@ -2862,12 +2862,12 @@ void R_Shadow_EditLights_Edit_f(void) char cubemapname[1024]; if (!r_editlights.integer) { - Con_Printf("Cannot spawn light when not in editing mode. Set r_editlights to 1.\n"); + Con_Print("Cannot spawn light when not in editing mode. Set r_editlights to 1.\n"); return; } if (!r_shadow_selectedlight) { - Con_Printf("No selected light.\n"); + Con_Print("No selected light.\n"); return; } VectorCopy(r_shadow_selectedlight->origin, origin); @@ -3056,8 +3056,8 @@ void R_Shadow_EditLights_Edit_f(void) } else { - Con_Printf("usage: r_editlights_edit [property] [value]\n"); - Con_Printf("Selected light's properties:\n"); + Con_Print("usage: r_editlights_edit [property] [value]\n"); + Con_Print("Selected light's properties:\n"); Con_Printf("Origin : %f %f %f\n", r_shadow_selectedlight->origin[0], r_shadow_selectedlight->origin[1], r_shadow_selectedlight->origin[2]); Con_Printf("Angles : %f %f %f\n", r_shadow_selectedlight->angles[0], r_shadow_selectedlight->angles[1], r_shadow_selectedlight->angles[2]); Con_Printf("Color : %f %f %f\n", r_shadow_selectedlight->color[0], r_shadow_selectedlight->color[1], r_shadow_selectedlight->color[2]); @@ -3097,12 +3097,12 @@ void R_Shadow_EditLights_ToggleShadow_f(void) { if (!r_editlights.integer) { - Con_Printf("Cannot spawn light when not in editing mode. Set r_editlights to 1.\n"); + Con_Print("Cannot spawn light when not in editing mode. Set r_editlights to 1.\n"); return; } if (!r_shadow_selectedlight) { - Con_Printf("No selected light.\n"); + Con_Print("No selected light.\n"); return; } R_Shadow_NewWorldLight(r_shadow_selectedlight->origin, r_shadow_selectedlight->angles, r_shadow_selectedlight->color, r_shadow_selectedlight->radius, r_shadow_selectedlight->corona, r_shadow_selectedlight->style, !r_shadow_selectedlight->shadow, r_shadow_selectedlight->cubemapname); @@ -3114,12 +3114,12 @@ void R_Shadow_EditLights_ToggleCorona_f(void) { if (!r_editlights.integer) { - Con_Printf("Cannot spawn light when not in editing mode. Set r_editlights to 1.\n"); + Con_Print("Cannot spawn light when not in editing mode. Set r_editlights to 1.\n"); return; } if (!r_shadow_selectedlight) { - Con_Printf("No selected light.\n"); + Con_Print("No selected light.\n"); return; } R_Shadow_NewWorldLight(r_shadow_selectedlight->origin, r_shadow_selectedlight->angles, r_shadow_selectedlight->color, r_shadow_selectedlight->radius, !r_shadow_selectedlight->corona, r_shadow_selectedlight->style, r_shadow_selectedlight->shadow, r_shadow_selectedlight->cubemapname); @@ -3131,12 +3131,12 @@ void R_Shadow_EditLights_Remove_f(void) { if (!r_editlights.integer) { - Con_Printf("Cannot remove light when not in editing mode. Set r_editlights to 1.\n"); + Con_Print("Cannot remove light when not in editing mode. Set r_editlights to 1.\n"); return; } if (!r_shadow_selectedlight) { - Con_Printf("No selected light.\n"); + Con_Print("No selected light.\n"); return; } R_Shadow_FreeWorldLight(r_shadow_selectedlight); @@ -3145,7 +3145,7 @@ void R_Shadow_EditLights_Remove_f(void) void R_Shadow_EditLights_Help_f(void) { - Con_Printf( + Con_Print( "Documentation on r_editlights system:\n" "Settings:\n" "r_editlights : enable/disable editing mode\n" diff --git a/r_sky.c b/r_sky.c index 4bc07d89..a1e41df8 100644 --- a/r_sky.c +++ b/r_sky.c @@ -88,7 +88,7 @@ int R_SetSkyBox(const char *sky) if (strlen(sky) > 1000) { - Con_Printf ("sky name too long (%i, max is 1000)\n", strlen(sky)); + Con_Printf("sky name too long (%i, max is 1000)\n", strlen(sky)); return false; } @@ -118,7 +118,7 @@ void LoadSky_f (void) if (skyname[0]) Con_Printf("current sky: %s\n", skyname); else - Con_Printf("no skybox has been set\n"); + Con_Print("no skybox has been set\n"); break; case 2: if (R_SetSkyBox(Cmd_Argv(1))) @@ -126,13 +126,13 @@ void LoadSky_f (void) if (skyname[0]) Con_Printf("skybox set to %s\n", skyname); else - Con_Printf("skybox disabled\n"); + Con_Print("skybox disabled\n"); } else Con_Printf("failed to load skybox %s\n", Cmd_Argv(1)); break; default: - Con_Printf("usage: loadsky skyname\n"); + Con_Print("usage: loadsky skyname\n"); break; } } diff --git a/screen.h b/screen.h index a4b1b931..b970e0f8 100644 --- a/screen.h +++ b/screen.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CL_Screen_Init (void); void CL_UpdateScreen (void); -void SCR_CenterPrint (char *str); +void SCR_CenterPrint(char *str); void SCR_BeginLoadingPlaque (void); diff --git a/server.h b/server.h index 90c42bbc..e520b600 100644 --- a/server.h +++ b/server.h @@ -290,8 +290,10 @@ void SV_AddUpdates (void); void SV_ClientThink (void); -void SV_ClientPrintf (const char *fmt, ...); -void SV_BroadcastPrintf (const char *fmt, ...); +void SV_ClientPrint(const char *msg); +void SV_ClientPrintf(const char *fmt, ...); +void SV_BroadcastPrint(const char *msg); +void SV_BroadcastPrintf(const char *fmt, ...); void SV_Physics (void); diff --git a/snd_alsa_0_5.c b/snd_alsa_0_5.c index 9947af0b..a0289862 100644 --- a/snd_alsa_0_5.c +++ b/snd_alsa_0_5.c @@ -117,7 +117,7 @@ qboolean SNDDMA_Init(void) mask = snd_cards_mask(); if (!mask) { - Con_Printf("No sound cards detected\n"); + Con_Print("No sound cards detected\n"); return 0; } if ((i=COM_CheckParm("-sndcard"))!=0) { @@ -193,7 +193,7 @@ qboolean SNDDMA_Init(void) rate=11025; frag_size=128; /* assuming stereo 8 bit */ } else { - Con_Printf("ALSA: desired rates not supported\n"); + Con_Print("ALSA: desired rates not supported\n"); goto error_2; } if ((format==-1 || format==SND_PCM_SFMT_S16_LE) && cinfo.formats & SND_PCM_FMT_S16_LE) { @@ -204,7 +204,7 @@ qboolean SNDDMA_Init(void) format=SND_PCM_SFMT_U8; bps=8; } else { - Con_Printf("ALSA: desired formats not supported\n"); + Con_Print("ALSA: desired formats not supported\n"); goto error_2; } if (stereo && cinfo.max_voices>=2) { diff --git a/snd_alsa_0_9.c b/snd_alsa_0_9.c index 7b70c990..dbcdcb0a 100644 --- a/snd_alsa_0_9.c +++ b/snd_alsa_0_9.c @@ -102,7 +102,7 @@ qboolean SNDDMA_Init(void) frag_size = 64; /* assuming stereo 8 bit */ rate = 11025; } else { - Con_Printf("ALSA: no useable rates\n"); + Con_Print("ALSA: no useable rates\n"); goto error; } break; @@ -115,7 +115,7 @@ qboolean SNDDMA_Init(void) } /* Fall through */ default: - Con_Printf("ALSA: desired rate not supported\n"); + Con_Print("ALSA: desired rate not supported\n"); goto error; } @@ -126,7 +126,7 @@ qboolean SNDDMA_Init(void) } else if (snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_U8) >= 0) { bps = 8; } else { - Con_Printf("ALSA: no useable formats\n"); + Con_Print("ALSA: no useable formats\n"); goto error; } break; @@ -139,13 +139,13 @@ qboolean SNDDMA_Init(void) } /* Fall through */ default: - Con_Printf("ALSA: desired format not supported\n"); + Con_Print("ALSA: desired format not supported\n"); goto error; } if (snd_pcm_hw_params_set_access(pcm, hw, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) { - Con_Printf("ALSA: interleaved is not supported\n"); + Con_Print("ALSA: interleaved is not supported\n"); goto error; } @@ -156,7 +156,7 @@ qboolean SNDDMA_Init(void) } else if (snd_pcm_hw_params_set_channels(pcm, hw, 1) >= 0) { stereo = 0; } else { - Con_Printf("ALSA: no useable channels\n"); + Con_Print("ALSA: no useable channels\n"); goto error; } break; @@ -166,7 +166,7 @@ qboolean SNDDMA_Init(void) break; /* Fall through */ default: - Con_Printf("ALSA: desired channels not supported\n"); + Con_Print("ALSA: desired channels not supported\n"); goto error; } @@ -174,7 +174,7 @@ qboolean SNDDMA_Init(void) err = snd_pcm_hw_params(pcm, hw); if (err < 0) { - Con_Printf("ALSA: unable to install hw params\n"); + Con_Print("ALSA: unable to install hw params\n"); goto error; } @@ -184,7 +184,7 @@ qboolean SNDDMA_Init(void) err = snd_pcm_sw_params(pcm, sw); if (err < 0) { - Con_Printf("ALSA: unable to install sw params\n"); + Con_Print("ALSA: unable to install sw params\n"); goto error; } diff --git a/snd_bsd.c b/snd_bsd.c index a771b4c5..1c39404c 100644 --- a/snd_bsd.c +++ b/snd_bsd.c @@ -54,7 +54,7 @@ qboolean SNDDMA_Init (void) audio_fd = open (snddev, O_WRONLY | O_NDELAY | O_NONBLOCK); if (audio_fd < 0) { - Con_Printf ("Can't open the sound device (%s)\n", snddev); + Con_Printf("Can't open the sound device (%s)\n", snddev); return false; } @@ -82,13 +82,13 @@ qboolean SNDDMA_Init (void) } if (i == sizeof (tryrates) / sizeof (tryrates[0])) { - Con_Printf ("Can't select an appropriate sound output format\n"); + Con_Print("Can't select an appropriate sound output format\n"); close (audio_fd); return false; } // Print some information - Con_Printf ("%d bit %s sound initialized (rate: %dHz)\n", + Con_Printf("%d bit %s sound initialized (rate: %dHz)\n", info.play.precision, (info.play.channels == 2) ? "stereo" : "mono", info.play.sample_rate); @@ -110,7 +110,7 @@ int SNDDMA_GetDMAPos (void) if (ioctl (audio_fd, AUDIO_GETINFO, &info) < 0) { - Con_Printf ("Error: can't get audio info\n"); + Con_Print("Error: can't get audio info\n"); SNDDMA_Shutdown (); return 0; } @@ -173,7 +173,7 @@ void SNDDMA_Submit (void) } if (write (audio_fd, writebuf, bytes) < bytes) - Con_Printf ("audio can't keep up!\n"); + Con_Print("audio can't keep up!\n"); wbufp = stop; } diff --git a/snd_dma.c b/snd_dma.c index e3b4a09b..cb9e11cf 100644 --- a/snd_dma.c +++ b/snd_dma.c @@ -122,7 +122,7 @@ void S_SoundInfo_f(void) { if (!sound_started || !shm) { - Con_Printf ("sound system not started\n"); + Con_Print("sound system not started\n"); return; } @@ -172,7 +172,7 @@ void S_Startup(void) { if (!SNDDMA_Init()) { - Con_Printf("S_Startup: SNDDMA_Init failed.\n"); + Con_Print("S_Startup: SNDDMA_Init failed.\n"); sound_started = 0; shm = NULL; return; @@ -217,7 +217,7 @@ S_Init */ void S_Init(void) { - Con_DPrintf("\nSound Initialization\n"); + Con_DPrint("\nSound Initialization\n"); S_RawSamples_ClearQueue(); @@ -329,7 +329,7 @@ sfx_t *S_FindName (char *name) sfx = &known_sfx[num_sfx++]; memset(sfx, 0, sizeof(*sfx)); - snprintf(sfx->name, sizeof(sfx->name), "%s", name); + strncpy(sfx->name, name, sizeof(sfx->name)); return sfx; } @@ -635,14 +635,14 @@ void S_ClearBuffer(void) { if (hresult != DSERR_BUFFERLOST) { - Con_Printf ("S_ClearBuffer: DS::Lock Sound Buffer Failed\n"); + Con_Print("S_ClearBuffer: DS::Lock Sound Buffer Failed\n"); S_Shutdown (); return; } if (++reps > 10000) { - Con_Printf ("S_ClearBuffer: DS: couldn't restore buffer\n"); + Con_Print("S_ClearBuffer: DS: couldn't restore buffer\n"); S_Shutdown (); return; } @@ -686,7 +686,7 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) if (total_channels == MAX_CHANNELS) { - Con_Printf ("total_channels == MAX_CHANNELS\n"); + Con_Print("total_channels == MAX_CHANNELS\n"); return; } @@ -848,7 +848,7 @@ void S_Update(vec3_t origin, vec3_t forward, vec3_t left, vec3_t up) if (ch->sfx && (ch->leftvol || ch->rightvol) ) total++; - Con_Printf ("----(%i)----\n", total); + Con_Printf("----(%i)----\n", total); } // mix some sound @@ -927,7 +927,7 @@ void S_Update_(void) if (pDSBuf) { if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DS_OK) - Con_Printf ("Couldn't get sound buffer status\n"); + Con_Print("Couldn't get sound buffer status\n"); if (dwStatus & DSBSTATUS_BUFFERLOST) pDSBuf->lpVtbl->Restore (pDSBuf); @@ -1026,7 +1026,7 @@ void S_LocalSound (char *sound) sfx = S_PrecacheSound (sound, true); if (!sfx) { - Con_Printf ("S_LocalSound: can't precache %s\n", sound); + Con_Printf("S_LocalSound: can't precache %s\n", sound); return; } S_StartSound (cl.viewentity, -1, sfx, vec3_origin, 1, 1); diff --git a/snd_mem.c b/snd_mem.c index c620d236..f735a38d 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -312,7 +312,7 @@ sfxcache_t *S_LoadSound (sfx_t *s, int complain) { if (modified_name) strcpy (namebuffer + len - 3, "wav"); - Con_Printf ("Couldn't load %s\n", namebuffer); + Con_Printf("Couldn't load %s\n", namebuffer); } return NULL; } @@ -407,7 +407,7 @@ void DumpChunks(void) memcpy (str, data_p, 4); data_p += 4; iff_chunk_len = GetLittleLong(); - Con_Printf ("0x%x : %s (%d)\n", (int)(data_p - 4), str, iff_chunk_len); + Con_Printf("0x%x : %s (%d)\n", (int)(data_p - 4), str, iff_chunk_len); data_p += (iff_chunk_len + 1) & ~1; } while (data_p < iff_end); } @@ -436,7 +436,7 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) FindChunk("RIFF"); if (!(data_p && !strncmp(data_p+8, "WAVE", 4))) { - Con_Printf("Missing RIFF/WAVE chunks\n"); + Con_Print("Missing RIFF/WAVE chunks\n"); return info; } @@ -447,14 +447,14 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) FindChunk("fmt "); if (!data_p) { - Con_Printf("Missing fmt chunk\n"); + Con_Print("Missing fmt chunk\n"); return info; } data_p += 8; format = GetLittleShort(); if (format != 1) { - Con_Printf("Microsoft PCM format only\n"); + Con_Print("Microsoft PCM format only\n"); return info; } @@ -489,7 +489,7 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) FindChunk("data"); if (!data_p) { - Con_Printf("Missing data chunk\n"); + Con_Print("Missing data chunk\n"); return info; } diff --git a/snd_mix.c b/snd_mix.c index 3f9f01b6..e27b97dd 100644 --- a/snd_mix.c +++ b/snd_mix.c @@ -61,7 +61,7 @@ void S_CaptureAVISound(portable_samplepair_t *buf, int length) if (fwrite(out, 4, length, cl_avidemo_soundfile) < length) { Cvar_SetValueQuick(&cl_avidemo, 0); - Con_Printf("avi saving sound failed, out of disk space? stopping avi demo capture.\n"); + Con_Print("avi saving sound failed, out of disk space? stopping avi demo capture.\n"); } } else if (cl_avidemo_soundfile) diff --git a/snd_oss.c b/snd_oss.c index 51607278..4aa51039 100644 --- a/snd_oss.c +++ b/snd_oss.c @@ -64,14 +64,14 @@ qboolean SNDDMA_Init(void) if (audio_fd < 0) { perror("/dev/dsp"); - Con_Printf("Could not open /dev/dsp\n"); + Con_Print("Could not open /dev/dsp\n"); return 0; } if (ioctl(audio_fd, SNDCTL_DSP_RESET, 0) < 0) { perror("/dev/dsp"); - Con_Printf("Could not reset /dev/dsp\n"); + Con_Print("Could not reset /dev/dsp\n"); close(audio_fd); return 0; } @@ -79,14 +79,14 @@ qboolean SNDDMA_Init(void) if (ioctl(audio_fd, SNDCTL_DSP_GETCAPS, &caps)==-1) { perror("/dev/dsp"); - Con_Printf("Sound driver too old\n"); + Con_Print("Sound driver too old\n"); close(audio_fd); return 0; } if (!(caps & DSP_CAP_TRIGGER) || !(caps & DSP_CAP_MMAP)) { - Con_Printf("Sorry but your soundcard can't do this\n"); + Con_Print("Sorry but your soundcard can't do this\n"); close(audio_fd); return 0; } @@ -94,7 +94,7 @@ qboolean SNDDMA_Init(void) if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1) { perror("GETOSPACE"); - Con_Printf("Um, can't do GETOSPACE?\n"); + Con_Print("Um, can't do GETOSPACE?\n"); close(audio_fd); return 0; } @@ -147,7 +147,7 @@ qboolean SNDDMA_Init(void) if (!shm->buffer || shm->buffer == (unsigned char *)-1) { perror("/dev/dsp"); - Con_Printf("Could not mmap /dev/dsp\n"); + Con_Print("Could not mmap /dev/dsp\n"); close(audio_fd); return 0; } @@ -160,7 +160,7 @@ qboolean SNDDMA_Init(void) if (rc < 0) { perror("/dev/dsp"); - Con_Printf("Could not set /dev/dsp to stereo=%d", shm->channels); + Con_Printf("Could not set /dev/dsp to stereo=%d\n", shm->channels); close(audio_fd); return 0; } @@ -173,7 +173,7 @@ qboolean SNDDMA_Init(void) if (rc < 0) { perror("/dev/dsp"); - Con_Printf("Could not set /dev/dsp speed to %d", shm->speed); + Con_Printf("Could not set /dev/dsp speed to %d\n", shm->speed); close(audio_fd); return 0; } @@ -185,7 +185,7 @@ qboolean SNDDMA_Init(void) if (rc < 0) { perror("/dev/dsp"); - Con_Printf("Could not support 16-bit data. Try 8-bit.\n"); + Con_Print("Could not support 16-bit data. Try 8-bit.\n"); close(audio_fd); return 0; } @@ -197,7 +197,7 @@ qboolean SNDDMA_Init(void) if (rc < 0) { perror("/dev/dsp"); - Con_Printf("Could not support 8-bit data.\n"); + Con_Print("Could not support 8-bit data.\n"); close(audio_fd); return 0; } @@ -205,7 +205,7 @@ qboolean SNDDMA_Init(void) else { perror("/dev/dsp"); - Con_Printf("%d-bit sound not supported.", shm->samplebits); + Con_Printf("%d-bit sound not supported.\n", shm->samplebits); close(audio_fd); return 0; } @@ -216,7 +216,7 @@ qboolean SNDDMA_Init(void) if (rc < 0) { perror("/dev/dsp"); - Con_Printf("Could not toggle.\n"); + Con_Print("Could not toggle.\n"); close(audio_fd); return 0; } @@ -225,7 +225,7 @@ qboolean SNDDMA_Init(void) if (rc < 0) { perror("/dev/dsp"); - Con_Printf("Could not toggle.\n"); + Con_Print("Could not toggle.\n"); close(audio_fd); return 0; } @@ -246,7 +246,7 @@ int SNDDMA_GetDMAPos(void) if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &count)==-1) { perror("/dev/dsp"); - Con_Printf("Uh, sound dead.\n"); + Con_Print("Uh, sound dead.\n"); close(audio_fd); snd_inited = 0; return 0; diff --git a/snd_win.c b/snd_win.c index 83506379..9806adaa 100644 --- a/snd_win.c +++ b/snd_win.c @@ -217,7 +217,7 @@ sndinitstat SNDDMA_InitDirect (void) if (hInstDS == NULL) { - Con_SafePrintf ("Couldn't load dsound.dll\n"); + Con_SafePrint("Couldn't load dsound.dll\n"); return SIS_FAILURE; } @@ -225,7 +225,7 @@ sndinitstat SNDDMA_InitDirect (void) if (!pDirectSoundCreate) { - Con_SafePrintf ("Couldn't get DS proc addr\n"); + Con_SafePrint("Couldn't get DS proc addr\n"); return SIS_FAILURE; } } @@ -234,7 +234,7 @@ sndinitstat SNDDMA_InitDirect (void) { if (hresult != DSERR_ALLOCATED) { - Con_SafePrintf ("DirectSound create failed\n"); + Con_SafePrint("DirectSound create failed\n"); return SIS_FAILURE; } @@ -244,8 +244,7 @@ sndinitstat SNDDMA_InitDirect (void) "Sound not available", MB_RETRYCANCEL | MB_SETFOREGROUND | MB_ICONEXCLAMATION) != IDRETRY) { - Con_SafePrintf ("DirectSoundCreate failure\n" - " hardware already in use\n"); + Con_SafePrint("DirectSoundCreate failure\n hardware already in use\n"); return SIS_NOTAVAIL; } } @@ -254,19 +253,19 @@ sndinitstat SNDDMA_InitDirect (void) if (DS_OK != pDS->lpVtbl->GetCaps (pDS, &dscaps)) { - Con_SafePrintf ("Couldn't get DS caps\n"); + Con_SafePrint("Couldn't get DS caps\n"); } if (dscaps.dwFlags & DSCAPS_EMULDRIVER) { - Con_SafePrintf ("No DirectSound driver installed\n"); + Con_SafePrint("No DirectSound driver installed\n"); FreeSound (); return SIS_FAILURE; } if (DS_OK != pDS->lpVtbl->SetCooperativeLevel (pDS, mainwindow, DSSCL_EXCLUSIVE)) { - Con_SafePrintf ("Set coop level failed\n"); + Con_SafePrint("Set coop level failed\n"); FreeSound (); return SIS_FAILURE; } @@ -292,12 +291,12 @@ sndinitstat SNDDMA_InitDirect (void) if (DS_OK != pDSPBuf->lpVtbl->SetFormat (pDSPBuf, &pformat)) { if (snd_firsttime) - Con_SafePrintf ("Set primary sound buffer format: no\n"); + Con_SafePrint("Set primary sound buffer format: no\n"); } else { if (snd_firsttime) - Con_SafePrintf ("Set primary sound buffer format: yes\n"); + Con_SafePrint("Set primary sound buffer format: yes\n"); primary_format_set = true; } @@ -318,7 +317,7 @@ sndinitstat SNDDMA_InitDirect (void) if (DS_OK != pDS->lpVtbl->CreateSoundBuffer(pDS, &dsbuf, &pDSBuf, NULL)) { - Con_SafePrintf ("DS:CreateSoundBuffer Failed"); + Con_SafePrint("DS:CreateSoundBuffer Failed\n"); FreeSound (); return SIS_FAILURE; } @@ -329,31 +328,31 @@ sndinitstat SNDDMA_InitDirect (void) if (DS_OK != pDSBuf->lpVtbl->GetCaps (pDSBuf, &dsbcaps)) { - Con_SafePrintf ("DS:GetCaps failed\n"); + Con_SafePrint("DS:GetCaps failed\n"); FreeSound (); return SIS_FAILURE; } if (snd_firsttime) - Con_SafePrintf ("Using secondary sound buffer\n"); + Con_SafePrint("Using secondary sound buffer\n"); } else { if (DS_OK != pDS->lpVtbl->SetCooperativeLevel (pDS, mainwindow, DSSCL_WRITEPRIMARY)) { - Con_SafePrintf ("Set coop level failed\n"); + Con_SafePrint("Set coop level failed\n"); FreeSound (); return SIS_FAILURE; } if (DS_OK != pDSPBuf->lpVtbl->GetCaps (pDSPBuf, &dsbcaps)) { - Con_Printf ("DS:GetCaps failed\n"); + Con_Print("DS:GetCaps failed\n"); return SIS_FAILURE; } pDSBuf = pDSPBuf; - Con_SafePrintf ("Using primary sound buffer\n"); + Con_SafePrint("Using primary sound buffer\n"); } // Make sure mixer is active @@ -374,14 +373,14 @@ sndinitstat SNDDMA_InitDirect (void) { if (hresult != DSERR_BUFFERLOST) { - Con_SafePrintf ("SNDDMA_InitDirect: DS::Lock Sound Buffer Failed\n"); + Con_SafePrint("SNDDMA_InitDirect: DS::Lock Sound Buffer Failed\n"); FreeSound (); return SIS_FAILURE; } if (++reps > 10000) { - Con_SafePrintf ("SNDDMA_InitDirect: DS: couldn't restore buffer\n"); + Con_SafePrint("SNDDMA_InitDirect: DS: couldn't restore buffer\n"); FreeSound (); return SIS_FAILURE; } @@ -453,7 +452,7 @@ qboolean SNDDMA_InitWav (void) { if (hr != MMSYSERR_ALLOCATED) { - Con_SafePrintf ("waveOutOpen failed\n"); + Con_SafePrint("waveOutOpen failed\n"); return false; } @@ -463,8 +462,7 @@ qboolean SNDDMA_InitWav (void) "Sound not available", MB_RETRYCANCEL | MB_SETFOREGROUND | MB_ICONEXCLAMATION) != IDRETRY) { - Con_SafePrintf ("waveOutOpen failure;\n" - " hardware already in use\n"); + Con_SafePrint("waveOutOpen failure;\n hardware already in use\n"); return false; } } @@ -479,14 +477,14 @@ qboolean SNDDMA_InitWav (void) hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, gSndBufSize); if (!hData) { - Con_SafePrintf ("Sound: Out of memory.\n"); + Con_SafePrint("Sound: Out of memory.\n"); FreeSound (); return false; } lpData = GlobalLock(hData); if (!lpData) { - Con_SafePrintf ("Sound: Failed to lock.\n"); + Con_SafePrint("Sound: Failed to lock.\n"); FreeSound (); return false; } @@ -502,7 +500,7 @@ qboolean SNDDMA_InitWav (void) if (hWaveHdr == NULL) { - Con_SafePrintf ("Sound: Failed to Alloc header.\n"); + Con_SafePrint("Sound: Failed to Alloc header.\n"); FreeSound (); return false; } @@ -511,7 +509,7 @@ qboolean SNDDMA_InitWav (void) if (lpWaveHdr == NULL) { - Con_SafePrintf ("Sound: Failed to lock header.\n"); + Con_SafePrint("Sound: Failed to lock header.\n"); FreeSound (); return false; } @@ -527,7 +525,7 @@ qboolean SNDDMA_InitWav (void) if (waveOutPrepareHeader(hWaveOut, lpWaveHdr+i, sizeof(WAVEHDR)) != MMSYSERR_NOERROR) { - Con_SafePrintf ("Sound: failed to prepare wave headers\n"); + Con_SafePrint("Sound: failed to prepare wave headers\n"); FreeSound (); return false; } @@ -575,12 +573,12 @@ qboolean SNDDMA_Init(void) snd_isdirect = true; if (snd_firsttime) - Con_SafePrintf ("DirectSound initialized\n"); + Con_SafePrint("DirectSound initialized\n"); } else { snd_isdirect = false; - Con_SafePrintf ("DirectSound failed to init\n"); + Con_SafePrint("DirectSound failed to init\n"); } } } @@ -599,11 +597,11 @@ qboolean SNDDMA_Init(void) if (snd_iswave) { if (snd_firsttime) - Con_SafePrintf ("Wave sound initialized\n"); + Con_SafePrint("Wave sound initialized\n"); } else { - Con_SafePrintf ("Wave sound failed to init\n"); + Con_SafePrint("Wave sound failed to init\n"); } } } @@ -674,7 +672,7 @@ void SNDDMA_Submit(void) { if ( snd_completed == snd_sent ) { - Con_DPrintf ("Sound overrun\n"); + Con_DPrint("Sound overrun\n"); break; } @@ -703,7 +701,7 @@ void SNDDMA_Submit(void) if (wResult != MMSYSERR_NOERROR) { - Con_SafePrintf ("Failed to write block to device\n"); + Con_SafePrint("Failed to write block to device\n"); FreeSound (); return; } @@ -739,7 +737,7 @@ void *S_LockBuffer(void) { if (hresult != DSERR_BUFFERLOST) { - Con_Printf ("S_LockBuffer: DS::Lock Sound Buffer Failed\n"); + Con_Print("S_LockBuffer: DS::Lock Sound Buffer Failed\n"); S_Shutdown (); S_Startup (); return NULL; @@ -747,7 +745,7 @@ void *S_LockBuffer(void) if (++reps > 10000) { - Con_Printf ("S_LockBuffer: DS: couldn't restore buffer\n"); + Con_Print("S_LockBuffer: DS: couldn't restore buffer\n"); S_Shutdown (); S_Startup (); return NULL; diff --git a/sv_main.c b/sv_main.c index 97669a55..d5b05b5d 100644 --- a/sv_main.c +++ b/sv_main.c @@ -79,7 +79,7 @@ static void SV_SaveEntFile_f(void) char basename[MAX_QPATH]; if (!sv.active || !sv.worldmodel) { - Con_Printf("Not running a server\n"); + Con_Print("Not running a server\n"); return; } FS_StripExtension(sv.worldmodel->name, basename, sizeof(basename)); @@ -199,7 +199,7 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume, floa if ( sound_num == MAX_SOUNDS || !sv.sound_precache[sound_num] ) { - Con_Printf ("SV_StartSound: %s not precached\n", sample); + Con_Printf("SV_StartSound: %s not precached\n", sample); return; } @@ -597,7 +597,7 @@ void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg) if (msg->maxsize - msg->cursize < 32) // LordHavoc: increased check from 16 to 32 { - Con_Printf ("packet overflow\n"); + Con_Print("packet overflow\n"); // mark the rest of the entities so they can't be delta compressed against this frame for (;e < sv.num_edicts;e++) { @@ -1094,7 +1094,7 @@ void SV_WriteEntitiesToClient(client_t *client, edict_t *clent, sizebuf_t *msg) for (i = 0;i < MAX_ENTITY_HISTORY;i++) if (d->commit[i].numentities) Con_Printf(" %i", d->commit[i].framenum); - Con_Printf(")\n"); + Con_Print(")\n"); } if (d->currententitynumber >= sv.max_edicts) startnumber = 1; @@ -1797,7 +1797,7 @@ void SV_SpawnServer (const char *server) Cvar_Set ("hostname", "UNNAMED"); scr_centertime_off = 0; - Con_DPrintf ("SpawnServer: %s\n",server); + Con_DPrintf("SpawnServer: %s\n",server); svs.changelevel_issued = false; // now safe to issue another // @@ -1882,7 +1882,7 @@ void SV_SpawnServer (const char *server) sv.worldmodel = Mod_ForName(sv.modelname, false, true, true); if (!sv.worldmodel) { - Con_Printf ("Couldn't spawn server %s\n", sv.modelname); + Con_Printf("Couldn't spawn server %s\n", sv.modelname); sv.active = false; return; } @@ -1965,7 +1965,7 @@ void SV_SpawnServer (const char *server) if (host_client->netconnection) SV_SendServerinfo(host_client); - Con_DPrintf ("Server spawned.\n"); + Con_DPrint("Server spawned.\n"); NetConn_Heartbeat (2); } diff --git a/sv_phys.c b/sv_phys.c index 3ed40134..628591e2 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -86,7 +86,7 @@ void SV_CheckAllEnts (void) continue; if (SV_TestEntityPosition (check)) - Con_Printf ("entity in invalid position\n"); + Con_Print("entity in invalid position\n"); } } @@ -107,12 +107,12 @@ void SV_CheckVelocity (edict_t *ent) { if (IS_NAN(ent->v->velocity[i])) { - Con_Printf ("Got a NaN velocity on %s\n", PR_GetString(ent->v->classname)); + Con_Printf("Got a NaN velocity on %s\n", PR_GetString(ent->v->classname)); ent->v->velocity[i] = 0; } if (IS_NAN(ent->v->origin[i])) { - Con_Printf ("Got a NaN origin on %s\n", PR_GetString(ent->v->classname)); + Con_Printf("Got a NaN origin on %s\n", PR_GetString(ent->v->classname)); ent->v->origin[i] = 0; } } @@ -294,7 +294,7 @@ int SV_FlyMove (edict_t *ent, float time, float *stepnormal) Con_Printf("entity %i bump %i: velocity %f %f %f trace %f", ent - sv.edicts, bumpcount, ent->v->velocity[0], ent->v->velocity[1], ent->v->velocity[2], trace.fraction); if (trace.fraction < 1) Con_Printf(" : %f %f %f", trace.plane.normal[0], trace.plane.normal[1], trace.plane.normal[2]); - Con_Printf("\n"); + Con_Print("\n"); #endif /* @@ -825,7 +825,7 @@ void SV_CheckStuck (edict_t *ent) VectorCopy (ent->v->oldorigin, ent->v->origin); if (!SV_TestEntityPosition(ent)) { - Con_DPrintf ("Unstuck.\n"); + Con_DPrint("Unstuck.\n"); SV_LinkEdict (ent, true); return; } @@ -839,14 +839,14 @@ void SV_CheckStuck (edict_t *ent) ent->v->origin[2] = org[2] + z; if (!SV_TestEntityPosition(ent)) { - Con_DPrintf ("Unstuck.\n"); + Con_DPrint("Unstuck.\n"); SV_LinkEdict (ent, true); return; } } VectorCopy (org, ent->v->origin); - Con_DPrintf ("player is stuck.\n"); + Con_DPrint("player is stuck.\n"); } @@ -955,7 +955,7 @@ int SV_TryUnstick (edict_t *ent, vec3_t oldvel) if (fabs(oldorg[1] - ent->v->origin[1]) > 4 || fabs(oldorg[0] - ent->v->origin[0]) > 4) { - Con_DPrintf("TryUnstick - success.\n"); + Con_DPrint("TryUnstick - success.\n"); return clip; } @@ -965,7 +965,7 @@ int SV_TryUnstick (edict_t *ent, vec3_t oldvel) // still not moving VectorClear (ent->v->velocity); - Con_DPrintf("TryUnstick - failure.\n"); + Con_DPrint("TryUnstick - failure.\n"); return 7; } diff --git a/sv_user.c b/sv_user.c index 9a06211c..ada7f28a 100644 --- a/sv_user.c +++ b/sv_user.c @@ -681,7 +681,7 @@ void SV_ReadClientMessage(void) if (msg_badread) { - Con_Printf ("SV_ReadClientMessage: badread\n"); + Con_Print("SV_ReadClientMessage: badread\n"); SV_DropClient (false); return; } @@ -696,7 +696,7 @@ void SV_ReadClientMessage(void) switch (cmd) { default: - Con_Printf ("SV_ReadClientMessage: unknown command char %i\n", cmd); + Con_Printf("SV_ReadClientMessage: unknown command char %i\n", cmd); SV_DropClient (false); return; diff --git a/sys.h b/sys.h index 73e2da0d..f42d2771 100644 --- a/sys.h +++ b/sys.h @@ -55,10 +55,11 @@ void* Sys_GetProcAddress (dllhandle_t handle, const char* name); void Sys_Error (const char *error, ...); // an error will cause the entire program to exit -void Sys_Printf (const char *fmt, ...); +void Sys_Print(const char *msg); +void Sys_Printf(const char *fmt, ...); // send text to the quake console (and possibly to terminal) -void Sys_Print(const char *text); +void Sys_PrintToTerminal(const char *text); // (may) output text to terminal which launched program void Sys_Quit (void); diff --git a/sys_linux.c b/sys_linux.c index c61e01b7..9e8b155c 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -51,7 +51,7 @@ void Sys_Error (const char *error, ...) exit (1); } -void Sys_Print(const char *text) +void Sys_PrintToTerminal(const char *text) { printf("%s", text); } diff --git a/sys_sdl.c b/sys_sdl.c index 9c757167..fd3642f1 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -52,7 +52,7 @@ void Sys_Error (const char *error, ...) exit (1); } -void Sys_Print(const char *text) +void Sys_PrintToTerminal(const char *text) { printf("%s", text); } diff --git a/sys_shared.c b/sys_shared.c index 881c560e..d1bc7fe6 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -49,42 +49,45 @@ static char qfont_table[256] = { }; -#define MAX_PRINT_MSG 16384 -void Sys_Printf (const char *fmt, ...) -{ - va_list argptr; - char start[MAX_PRINT_MSG]; // String we started with - char stamp[MAX_PRINT_MSG]; // Time stamp - char final[MAX_PRINT_MSG]; // String we print - - time_t mytime = 0; - struct tm *local = NULL; - - unsigned char *p; +#define MAXPRINTMSG 16384 - va_start (argptr, fmt); - vsnprintf (start, sizeof(start), fmt, argptr); - va_end (argptr); +void Sys_Print(const char *msg) +{ + unsigned char *p; + // Time stamp + char stamp[128]; + // String we print + char final[MAXPRINTMSG]; if (sys_nostdout) return; if (timestamps.integer) { - mytime = time (NULL); - local = localtime (&mytime); - strftime (stamp, sizeof (stamp), timeformat.string, local); - - snprintf (final, sizeof (final), "%s%s", stamp, start); + time_t mytime = time(NULL); + strftime(stamp, sizeof(stamp), timeformat.string, localtime(&mytime)); + snprintf(final, sizeof(final), "%s%s", stamp, msg); } else - snprintf (final, sizeof (final), "%s", start); + strncpy(final, msg, sizeof(final)); // LordHavoc: make sure the string is terminated - final[MAX_PRINT_MSG - 1] = 0; + final[MAXPRINTMSG-1] = 0; for (p = (unsigned char *) final;*p; p++) *p = qfont_table[*p]; - Sys_Print(final); + 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); } diff --git a/sys_win.c b/sys_win.c index 391f9c5a..d839902d 100644 --- a/sys_win.c +++ b/sys_win.c @@ -109,7 +109,7 @@ void Sys_Quit (void) exit (0); } -void Sys_Print(const char *text) +void Sys_PrintToTerminal(const char *text) { DWORD dummy; extern HANDLE houtput; diff --git a/vid_glx.c b/vid_glx.c index 6aeb5922..c05f0d3b 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -267,7 +267,7 @@ static void install_grabs(void) if (!XF86DGAQueryVersion(vidx11_display, &MajorVersion, &MinorVersion)) { // unable to query, probalby not supported - Con_Printf( "Failed to detect XF86DGA Mouse\n" ); + Con_Print( "Failed to detect XF86DGA Mouse\n" ); vid_dga.integer = 0; } else @@ -700,7 +700,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) if (!(vidx11_display = XOpenDisplay(NULL))) { - Con_Printf("Couldn't open the X display\n"); + Con_Print("Couldn't open the X display\n"); return false; } @@ -731,7 +731,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) visinfo = qglXChooseVisual(vidx11_display, vidx11_screen, attrib); if (!visinfo) { - Con_Printf("Couldn't get an RGB, Double-buffered, Depth visual\n"); + Con_Print("Couldn't get an RGB, Double-buffered, Depth visual\n"); return false; } diff --git a/vid_sdl.c b/vid_sdl.c index 0c83c410..25252a94 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -59,7 +59,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) drivername = com_argv[i + 1]; if (!SDL_GL_LoadLibrary(drivername)) { - Con_Printf("Unable to load GL driver \"%s\"\n: ", drivername, SDL_GetError()); + Con_Printf("Unable to load GL driver \"%s\": ", drivername, SDL_GetError()); return false; } @@ -70,7 +70,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) if (qglGetString == NULL) { VID_Shutdown(); - Con_Printf("Required OpenGL function glGetString not found\n"); + Con_Print("Required OpenGL function glGetString not found\n"); return false; } diff --git a/vid_shared.c b/vid_shared.c index b0568601..5b5d40c1 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -243,7 +243,7 @@ int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char * if (disableparm && (COM_CheckParm(disableparm) || COM_CheckParm("-safe"))) { - Con_DPrintf("disabled by commandline\n"); + Con_DPrint("disabled by commandline\n"); return false; } @@ -262,12 +262,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_DPrintf("enabled\n"); + Con_DPrint("enabled\n"); return true; } else { - Con_DPrintf("not detected\n"); + Con_DPrint("not detected\n"); return false; } } @@ -430,13 +430,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_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_DPrintf("Checking OpenGL extensions...\n"); + Con_DPrint("Checking OpenGL extensions...\n"); if (!GL_CheckExtension("glDrawRangeElements", drawrangeelementsfuncs, "-nodrawrangeelements", true)) GL_CheckExtension("GL_EXT_draw_range_elements", drawrangeelementsextfuncs, "-nodrawrangeelements", false); @@ -809,7 +809,7 @@ void VID_Restart_f(void) VID_Close(); if (!VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer)) { - Con_Printf("Video mode change failed\n"); + Con_Print("Video mode change failed\n"); if (!VID_Mode(current_vid_fullscreen, current_vid_width, current_vid_height, current_vid_bitsperpixel)) Sys_Error("Unable to restore to last working video mode\n"); } @@ -845,11 +845,11 @@ void VID_Open(void) Cvar_SetQuick(&vid_bitsperpixel, com_argv[i+1]); } - Con_DPrintf("Starting video system\n"); + Con_DPrint("Starting video system\n"); success = VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer); if (!success) { - Con_Printf("Desired video mode fail, trying fallbacks...\n"); + Con_Print("Desired video mode fail, trying fallbacks...\n"); if (!success && vid_bitsperpixel.integer > 16) success = VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, 16); if (!success && (vid_width.integer > 640 || vid_height.integer > 480)) diff --git a/vid_wgl.c b/vid_wgl.c index 30a08e84..da0bee76 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -821,13 +821,13 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) if (i & RC_PALETTE) { VID_Shutdown(); - Con_Printf ("Can't run in non-RGB mode\n"); + Con_Print("Can't run in non-RGB mode\n"); return false; } if (bpp > depth) { VID_Shutdown(); - Con_Printf ("A higher desktop depth is required to run this video mode\n"); + Con_Print("A higher desktop depth is required to run this video mode\n"); return false; } @@ -924,7 +924,7 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) if (!GL_CheckExtension("wgl", wglfuncs, NULL, false)) { VID_Shutdown(); - Con_Printf("wgl functions not found\n"); + Con_Print("wgl functions not found\n"); return false; } @@ -932,7 +932,7 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) if (!baseRC) { VID_Shutdown(); - Con_Printf("Could not initialize GL (wglCreateContext failed).\n\nMake sure you are in 65536 color mode, and try running -window.\n"); + Con_Print("Could not initialize GL (wglCreateContext failed).\n\nMake sure you are in 65536 color mode, and try running -window.\n"); return false; } if (!qwglMakeCurrent(hdc, baseRC)) @@ -947,7 +947,7 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) if (qglGetString == NULL) { VID_Shutdown(); - Con_Printf("glGetString not found\n"); + Con_Print("glGetString not found\n"); return false; } gl_renderer = qglGetString(GL_RENDERER); @@ -1159,7 +1159,7 @@ qboolean IN_InitDInput (void) if (hInstDI == NULL) { - Con_SafePrintf ("Couldn't load dinput.dll\n"); + Con_SafePrint("Couldn't load dinput.dll\n"); return false; } } @@ -1170,7 +1170,7 @@ qboolean IN_InitDInput (void) if (!pDirectInputCreate) { - Con_SafePrintf ("Couldn't get DI proc addr\n"); + Con_SafePrint("Couldn't get DI proc addr\n"); return false; } } @@ -1188,7 +1188,7 @@ qboolean IN_InitDInput (void) if (FAILED(hr)) { - Con_SafePrintf ("Couldn't open DI mouse device\n"); + Con_SafePrint("Couldn't open DI mouse device\n"); return false; } @@ -1197,7 +1197,7 @@ qboolean IN_InitDInput (void) if (FAILED(hr)) { - Con_SafePrintf ("Couldn't set DI mouse format\n"); + Con_SafePrint("Couldn't set DI mouse format\n"); return false; } @@ -1207,7 +1207,7 @@ qboolean IN_InitDInput (void) if (FAILED(hr)) { - Con_SafePrintf ("Couldn't set DI coop level\n"); + Con_SafePrint("Couldn't set DI coop level\n"); return false; } @@ -1218,7 +1218,7 @@ qboolean IN_InitDInput (void) if (FAILED(hr)) { - Con_SafePrintf ("Couldn't set DI buffersize\n"); + Con_SafePrint("Couldn't set DI buffersize\n"); return false; } @@ -1244,11 +1244,11 @@ void IN_StartupMouse (void) if (dinput) { - Con_SafePrintf ("DirectInput initialized\n"); + Con_SafePrint("DirectInput initialized\n"); } else { - Con_SafePrintf ("DirectInput not initialized\n"); + Con_SafePrint("DirectInput not initialized\n"); } } @@ -1506,7 +1506,7 @@ void IN_StartupJoystick (void) // verify joystick driver is present if ((numdevs = joyGetNumDevs ()) == 0) { - Con_Printf ("\njoystick not found -- driver not present\n\n"); + Con_Print("\njoystick not found -- driver not present\n\n"); return; } @@ -1524,7 +1524,7 @@ void IN_StartupJoystick (void) // abort startup if we didn't find a valid joystick if (mmr != JOYERR_NOERROR) { - Con_Printf ("\njoystick not found -- no valid joysticks (%x)\n\n", mmr); + Con_Printf("\njoystick not found -- no valid joysticks (%x)\n\n", mmr); return; } @@ -1533,7 +1533,7 @@ void IN_StartupJoystick (void) memset (&jc, 0, sizeof(jc)); if ((mmr = joyGetDevCaps (joy_id, &jc, sizeof(jc))) != JOYERR_NOERROR) { - Con_Printf ("\njoystick not found -- invalid joystick capabilities (%x)\n\n", mmr); + Con_Printf("\njoystick not found -- invalid joystick capabilities (%x)\n\n", mmr); return; } @@ -1550,7 +1550,7 @@ void IN_StartupJoystick (void) joy_avail = true; joy_advancedinit = false; - Con_Printf ("\njoystick detected\n\n"); + Con_Print("\njoystick detected\n\n"); } @@ -1615,7 +1615,7 @@ void Joy_AdvancedUpdate_f (void) if (strcmp (joy_name.string, "joystick") != 0) { // notify user of advanced controller - Con_Printf ("\n%s configured\n\n", joy_name.string); + Con_Printf("\n%s configured\n\n", joy_name.string); } // advanced initialization here diff --git a/wad.c b/wad.c index 23bb8bce..c1ceb126 100644 --- a/wad.c +++ b/wad.c @@ -76,7 +76,7 @@ void *W_GetLumpName(char *name) if ((temp = FS_LoadFile ("gfx.wad", false))) { if (memcmp(temp, "WAD2", 4)) - Con_Printf("gfx.wad doesn't have WAD2 id\n"); + Con_Print("gfx.wad doesn't have WAD2 id\n"); else { wad_mempool = Mem_AllocPool("gfx.wad"); @@ -157,27 +157,27 @@ void W_LoadTextureWadFile (char *filename, int complain) if (!file) { if (complain) - Con_Printf ("W_LoadTextureWadFile: couldn't find %s", filename); + Con_Printf("W_LoadTextureWadFile: couldn't find %s\n", filename); return; } if (FS_Read(file, &header, sizeof(wadinfo_t)) != sizeof(wadinfo_t)) - {Con_Printf ("W_LoadTextureWadFile: unable to read wad header");return;} + {Con_Print("W_LoadTextureWadFile: unable to read wad header\n");return;} if(memcmp(header.identification, "WAD3", 4)) - {Con_Printf ("W_LoadTextureWadFile: Wad file %s doesn't have WAD3 id\n",filename);return;} + {Con_Printf("W_LoadTextureWadFile: Wad file %s doesn't have WAD3 id\n",filename);return;} numlumps = LittleLong(header.numlumps); if (numlumps < 1 || numlumps > TEXWAD_MAXIMAGES) - {Con_Printf ("W_LoadTextureWadFile: invalid number of lumps (%i)\n", numlumps);return;} + {Con_Printf("W_LoadTextureWadFile: invalid number of lumps (%i)\n", numlumps);return;} infotableofs = LittleLong(header.infotableofs); if (FS_Seek (file, infotableofs, SEEK_SET)) - {Con_Printf ("W_LoadTextureWadFile: unable to seek to lump table");return;} + {Con_Print("W_LoadTextureWadFile: unable to seek to lump table\n");return;} if (!(lumps = Mem_Alloc(tempmempool, sizeof(lumpinfo_t)*numlumps))) - {Con_Printf ("W_LoadTextureWadFile: unable to allocate temporary memory for lump table");return;} + {Con_Print("W_LoadTextureWadFile: unable to allocate temporary memory for lump table\n");return;} if (FS_Read(file, lumps, sizeof(lumpinfo_t) * numlumps) != sizeof(lumpinfo_t) * (size_t)numlumps) - {Con_Printf ("W_LoadTextureWadFile: unable to read lump table");return;} + {Con_Print("W_LoadTextureWadFile: unable to read lump table\n");return;} for (i=0, lump_p = lumps ; iwidth = LittleLong(tex->width); tex->height = LittleLong(tex->height); diff --git a/zone.c b/zone.c index da473178..5c4c5a92 100644 --- a/zone.c +++ b/zone.c @@ -348,11 +348,11 @@ void Mem_PrintStats(void) } Con_Printf("%i memory pools, totalling %i bytes (%.3fMB)\n", count, size, size / 1048576.0); if (tempmempool == NULL) - Con_Printf("Error: no tempmempool allocated\n"); + Con_Print("Error: no tempmempool allocated\n"); else if (tempmempool->chain) { Con_Printf("%i bytes (%.3fMB) of temporary memory still allocated (Leak!)\n", tempmempool->totalsize, tempmempool->totalsize / 1048576.0); - Con_Printf("listing temporary memory allocations:\n"); + Con_Print("listing temporary memory allocations:\n"); for (mem = tempmempool->chain;mem;mem = mem->next) Con_Printf("%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline); } @@ -363,7 +363,7 @@ void Mem_PrintList(int listallocations) mempool_t *pool; memheader_t *mem; Mem_CheckSentinelsGlobal(); - Con_Printf("memory pool list:\n" + Con_Print("memory pool list:\n" "size name\n"); for (pool = poolchain;pool;pool = pool->next) { @@ -395,7 +395,7 @@ void MemList_f(void) } // drop through default: - Con_Printf("MemList_f: unrecognized options\nusage: memlist [all]\n"); + Con_Print("MemList_f: unrecognized options\nusage: memlist [all]\n"); break; } } -- 2.39.2