From d1c3f1065fde02ed39b7eecc2d9b9a637388d091 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Sat, 27 Jun 2020 04:29:43 +0000 Subject: [PATCH] Remove Con_Warnf and Errorf. Use macros to change color and identify the message git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12744 d7cf8633-e32d-0410-b094-e92efae38249 --- cap_avi.c | 2 +- cl_demo.c | 4 ++-- cl_main.c | 2 +- cl_parse.c | 2 +- cl_screen.c | 2 +- cl_video.c | 6 ++--- cl_video_libavw.c | 16 ++++++------- clvm_cmds.c | 2 +- cmd.c | 14 ++++++------ console.c | 57 +---------------------------------------------- console.h | 11 +++------ csprogs.c | 8 +++---- fs.c | 16 ++++++------- ft2.c | 40 ++++++++++++++++----------------- gl_backend.c | 2 +- gl_draw.c | 2 +- gl_rmain.c | 2 +- host.c | 10 ++++----- image_png.c | 4 ++-- lhnet.c | 4 ++-- model_brush.c | 16 ++++++------- model_sprite.c | 2 +- netconn.c | 20 ++++++++--------- protocol.c | 2 +- prvm_cmds.c | 8 +++---- r_sky.c | 2 +- snd_sdl.c | 2 +- sv_demo.c | 2 +- sv_save.c | 6 ++--- sys_linux.c | 2 +- sys_sdl.c | 2 +- sys_shared.c | 4 ++-- sys_win.c | 2 +- vid_sdl.c | 10 ++++----- wad.c | 14 ++++++------ world.c | 4 ++-- 36 files changed, 122 insertions(+), 182 deletions(-) diff --git a/cap_avi.c b/cap_avi.c index 063ee097..029e4e19 100644 --- a/cap_avi.c +++ b/cap_avi.c @@ -147,7 +147,7 @@ static void SCR_CaptureVideo_RIFF_Pop(void) if(sizehint != -1) { int i; - Con_Warnf("WARNING: invalid size hint %d when writing video data (actual size: %d)\n", (int) sizehint, x); + Con_Printf(CON_WARN "WARNING: invalid size hint %d when writing video data (actual size: %d)\n", (int) sizehint, x); for(i = 0; i <= format->riffstacklevel; ++i) { Con_Printf(" RIFF level %d = %s\n", i, format->riffstackfourcc[i]); diff --git a/cl_demo.c b/cl_demo.c index 1d14f718..e3e2eecb 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -389,7 +389,7 @@ void CL_Record_f(cmd_state_t *cmd) cls.demofile = FS_OpenRealFile(name, "wb", false); if (!cls.demofile) { - Con_Error("ERROR: couldn't open.\n"); + Con_Print(CON_ERROR "ERROR: couldn't open.\n"); return; } strlcpy(cls.demoname, name, sizeof(cls.demoname)); @@ -429,7 +429,7 @@ void CL_PlayDemo_f(cmd_state_t *cmd) f = FS_OpenVirtualFile(name, false); if (!f) { - Con_Errorf("ERROR: couldn't open %s.\n", name); + Con_Printf(CON_ERROR "ERROR: couldn't open %s.\n", name); cls.demonum = -1; // stop demo loop return; } diff --git a/cl_main.c b/cl_main.c index 77467bfb..1f079bb7 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2268,7 +2268,7 @@ static void CL_Locs_Save_f(cmd_state_t *cmd) if (VectorCompare(loc->mins, loc->maxs)) break; if (loc) - Con_Warnf("Warning: writing loc file containing a mixture of qizmo-style points and proquake-style boxes may not work in qizmo or proquake!\n"); + Con_Printf(CON_WARN "Warning: writing loc file containing a mixture of qizmo-style points and proquake-style boxes may not work in qizmo or proquake!\n"); } for (loc = cl.locnodes;loc;loc = loc->next) { diff --git a/cl_parse.c b/cl_parse.c index d3b0ea8a..0ecfb693 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1948,7 +1948,7 @@ static void CL_ParseServerInfo (void) cls.demo_lastcsprogscrc = -1; } else - Con_Error ("ERROR: couldn't open.\n"); + Con_Print(CON_ERROR "ERROR: couldn't open.\n"); } } cl.islocalgame = NetConn_IsLocalGame(); diff --git a/cl_screen.c b/cl_screen.c index 312c68e2..01a6fbdd 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -1489,7 +1489,7 @@ void SCR_ScreenShot_f(cmd_state_t *cmd) Con_Printf("Wrote %s\n", filename); else { - Con_Errorf("Unable to write %s\n", filename); + Con_Printf(CON_ERROR "Unable to write %s\n", filename); if(jpeg || png) { if(SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, false, false, true, scr_screenshot_alpha.integer != 0)) diff --git a/cl_video.c b/cl_video.c index 286f0d9f..dd29ee7d 100644 --- a/cl_video.c +++ b/cl_video.c @@ -64,7 +64,7 @@ static qboolean OpenStream( clvideo_t * video ) if (video->stream) return true; - Con_Errorf("unable to open \"%s\", error: %s\n", video->filename, errorstring); + Con_Printf(CON_ERROR "unable to open \"%s\", error: %s\n", video->filename, errorstring); return false; } @@ -178,7 +178,7 @@ static void LoadSubtitles( clvideo_t *video, const char *subtitlesfile ) // check limits if (video->subtitles == CLVIDEO_MAX_SUBTITLES) { - Con_Warnf("WARNING: CLVIDEO_MAX_SUBTITLES = %i reached when reading subtitles from '%s'\n", CLVIDEO_MAX_SUBTITLES, subtitlesfile); + Con_Printf(CON_WARN "WARNING: CLVIDEO_MAX_SUBTITLES = %i reached when reading subtitles from '%s'\n", CLVIDEO_MAX_SUBTITLES, subtitlesfile); break; } // add a sub @@ -253,7 +253,7 @@ clvideo_t* CL_OpenVideo( const char *filename, const char *name, int owner, cons video = FindUnusedVid(); if( !video ) { - Con_Errorf( "CL_OpenVideo: unable to open video \"%s\" - video limit reached\n", filename ); + Con_Printf(CON_ERROR "CL_OpenVideo: unable to open video \"%s\" - video limit reached\n", filename ); return NULL; } video = OpenVideo( video, filename, name, owner, subtitlesfile ); diff --git a/cl_video_libavw.c b/cl_video_libavw.c index 7fa50d81..422af8a9 100644 --- a/cl_video_libavw.c +++ b/cl_video_libavw.c @@ -175,7 +175,7 @@ static int libavw_decodeframe(void *stream, void *imagedata, unsigned int Rmask, // got error or file end errorcode = qLibAvW_StreamGetError(s->stream); if (errorcode) - Con_Errorf("LibAvW: %s\n", qLibAvW_ErrorString(errorcode)); + Con_Printf(CON_ERROR "LibAvW: %s\n", qLibAvW_ErrorString(errorcode)); return 1; } @@ -186,11 +186,11 @@ static int libavw_decodeframe(void *stream, void *imagedata, unsigned int Rmask, pixel_format = LIBAVW_PIXEL_FORMAT_BGR; else { - Con_Errorf("LibAvW: cannot determine pixel format for bpp %i\n", bytesperpixel); + Con_Printf(CON_ERROR "LibAvW: cannot determine pixel format for bpp %i\n", bytesperpixel); return 1; } if (!qLibAvW_PlayGetFrameImage(s->stream, pixel_format, imagedata, s->info_imagewidth, s->info_imageheight, min(9, max(0, cl_video_libavw_scaler.integer)))) - Con_Errorf("LibAvW: %s\n", qLibAvW_ErrorString(qLibAvW_StreamGetError(s->stream))); + Con_Printf(CON_ERROR "LibAvW: %s\n", qLibAvW_ErrorString(qLibAvW_StreamGetError(s->stream))); return 0; } @@ -343,13 +343,13 @@ static void *LibAvW_OpenVideo(clvideo_t *video, char *filename, const char **err static void libavw_message(int level, const char *message) { if (level == LIBAVW_PRINT_WARNING) - Con_Warnf("LibAvcodec warning: %s\n", message); + Con_Printf(CON_WARN "LibAvcodec warning: %s\n", message); else if (level == LIBAVW_PRINT_ERROR) - Con_Errorf("LibAvcodec error: %s\n", message); + Con_Printf(CON_ERROR "LibAvcodec error: %s\n", message); else if (level == LIBAVW_PRINT_FATAL) - Con_Errorf("LibAvcodec fatal error: %s\n", message); + Con_Printf(CON_ERROR "LibAvcodec fatal error: %s\n", message); else - Con_Errorf("LibAvcodec panic: %s\n", message); + Con_Printf(CON_ERROR "LibAvcodec panic: %s\n", message); } static qboolean LibAvW_OpenLibrary(void) @@ -368,7 +368,7 @@ static qboolean LibAvW_OpenLibrary(void) // initialize libav wrapper if ((errorcode = qLibAvW_Init(&libavw_message))) { - Con_Errorf("LibAvW failed to initialize: %s\n", qLibAvW_ErrorString(errorcode)); + Con_Printf(CON_ERROR "LibAvW failed to initialize: %s\n", qLibAvW_ErrorString(errorcode)); Sys_UnloadLibrary(&libavw_dll); } diff --git a/clvm_cmds.c b/clvm_cmds.c index 727af941..dd8842df 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -1872,7 +1872,7 @@ static void VM_CL_copyentity (prvm_prog_t *prog) static void VM_CL_effect (prvm_prog_t *prog) { #if 1 - Con_Warnf("WARNING: VM_CL_effect not implemented\n"); // FIXME: this needs to take modelname not modelindex, the csqc defs has it as string and so it shall be + Con_Printf(CON_WARN "WARNING: VM_CL_effect not implemented\n"); // FIXME: this needs to take modelname not modelindex, the csqc defs has it as string and so it shall be #else vec3_t org; VM_SAFEPARMCOUNT(5, VM_CL_effect); diff --git a/cmd.c b/cmd.c index ea0b608e..64a90e26 100644 --- a/cmd.c +++ b/cmd.c @@ -325,7 +325,7 @@ void Cbuf_Execute (cmd_state_t *cmd) // better than CRASHING on overlong input lines that may SOMEHOW enter the buffer if(i >= MAX_INPUTLINE) { - Con_Warnf("Warning: console input buffer had an overlong line. Ignored.\n"); + Con_Printf(CON_WARN "Warning: console input buffer had an overlong line. Ignored.\n"); line[0] = 0; } else @@ -1126,9 +1126,9 @@ static const char *Cmd_GetCvarValue(cmd_state_t *cmd, const char *var, size_t va { // empty cvar name? if(alias) - Con_Warnf("Warning: Could not expand $ in alias %s\n", alias->name); + Con_Printf(CON_WARN "Warning: Could not expand $ in alias %s\n", alias->name); else - Con_Warnf("Warning: Could not expand $\n"); + Con_Printf(CON_WARN "Warning: Could not expand $\n"); return "$"; } @@ -1174,9 +1174,9 @@ static const char *Cmd_GetCvarValue(cmd_state_t *cmd, const char *var, size_t va if(required) { if(alias) - Con_Errorf("Error: Could not expand $%s in alias %s\n", varname, alias->name); + Con_Printf(CON_ERROR "Error: Could not expand $%s in alias %s\n", varname, alias->name); else - Con_Errorf("Error: Could not expand $%s\n", varname); + Con_Printf(CON_ERROR "Error: Could not expand $%s\n", varname); return NULL; } else if(optional) @@ -1186,9 +1186,9 @@ static const char *Cmd_GetCvarValue(cmd_state_t *cmd, const char *var, size_t va else { if(alias) - Con_Warnf("Warning: Could not expand $%s in alias %s\n", varname, alias->name); + Con_Printf(CON_WARN "Warning: Could not expand $%s in alias %s\n", varname, alias->name); else - Con_Warnf("Warning: Could not expand $%s\n", varname); + Con_Printf(CON_WARN "Warning: Could not expand $%s\n", varname); dpsnprintf(varval, sizeof(varval), "$%s", varname); return varval; } diff --git a/console.c b/console.c index 95aaa5a1..5bbf112c 100644 --- a/console.c +++ b/console.c @@ -809,7 +809,7 @@ static void Con_ConDump_f(cmd_state_t *cmd) file = FS_OpenRealFile(Cmd_Argv(cmd, 1), "w", false); if (!file) { - Con_Errorf("condump: unable to write file \"%s\"\n", Cmd_Argv(cmd, 1)); + Con_Printf(CON_ERROR "condump: unable to write file \"%s\"\n", Cmd_Argv(cmd, 1)); return; } if (con_mutex) Thread_LockMutex(con_mutex); @@ -1452,61 +1452,6 @@ void Con_Printf(const char *fmt, ...) Con_MaskPrint(CON_MASK_PRINT, msg); } -/* -================ -Con_Warn -================ -*/ -void Con_Warn(const char *msg) -{ - Con_Printf("^3%s",msg); -} - -/* -================ -Con_Warnf -================ -*/ -void Con_Warnf(const char *fmt, ...) -{ - va_list argptr; - char msg[MAX_INPUTLINE]; - - va_start(argptr,fmt); - dpvsnprintf(msg,sizeof(msg),fmt,argptr); - va_end(argptr); - - Con_Printf("^3%s",msg); -} - -/* -================ -Con_Error -================ -*/ -void Con_Error(const char *msg) -{ - Con_Printf("^1%s",msg); -} - -/* -================ -Con_Errorf -================ -*/ -void Con_Errorf(const char *fmt, ...) -{ - va_list argptr; - char msg[MAX_INPUTLINE]; - - va_start(argptr,fmt); - dpvsnprintf(msg,sizeof(msg),fmt,argptr); - va_end(argptr); - - Con_Printf("^1%s",msg); - -} - /* ================ Con_DPrint diff --git a/console.h b/console.h index 8d1a64a5..033c2754 100644 --- a/console.h +++ b/console.h @@ -51,14 +51,6 @@ void Con_Print(const char *txt); /// Prints to all appropriate console targets. void Con_Printf(const char *fmt, ...) DP_FUNC_PRINTF(1); -/// Prints warnings -void Con_Warn(const char *msg); -void Con_Warnf(const char *fmt, ...); - -/// Prints errors -void Con_Error(const char *msg); -void Con_Errorf(const char *fmt, ...); - /// A Con_Print that only shows up if the "developer" cvar is set. void Con_DPrint(const char *msg); @@ -97,6 +89,9 @@ void Log_DestBuffer_Flush (void); ///< call this once per frame to send out repl void Log_Printf(const char *logfilename, const char *fmt, ...) DP_FUNC_PRINTF(2); //@} +#define CON_WARN "^3" +#define CON_ERROR "^1" + // CON_MASK_PRINT is the default (Con_Print/Con_Printf) // CON_MASK_DEVELOPER is used by Con_DPrint/Con_DPrintf #define CON_MASK_HIDENOTIFY 128 diff --git a/csprogs.c b/csprogs.c index 23135e0b..07087c97 100644 --- a/csprogs.c +++ b/csprogs.c @@ -1033,7 +1033,7 @@ void CL_VM_Init (void) { if (cls.demoplayback) { - Con_Warnf("Warning: Your %s is not the same version as the demo was recorded with (CRC/size are %i/%i but should be %i/%i)\n", csqc_progname.string, csprogsdatacrc, (int)csprogsdatasize, requiredcrc, requiredsize); + Con_Printf(CON_WARN "Warning: Your %s is not the same version as the demo was recorded with (CRC/size are %i/%i but should be %i/%i)\n", csqc_progname.string, csprogsdatacrc, (int)csprogsdatasize, requiredcrc, requiredsize); // Mem_Free(csprogsdata); // return; // We WANT to continue here, and play the demo with different csprogs! @@ -1042,7 +1042,7 @@ void CL_VM_Init (void) else { Mem_Free(csprogsdata); - Con_Errorf("Your %s is not the same version as the server (CRC is %i/%i but should be %i/%i)\n", csqc_progname.string, csprogsdatacrc, (int)csprogsdatasize, requiredcrc, requiredsize); + Con_Printf(CON_ERROR "Your %s is not the same version as the server (CRC is %i/%i but should be %i/%i)\n", csqc_progname.string, csprogsdatacrc, (int)csprogsdatasize, requiredcrc, requiredsize); CL_Disconnect(); return; } @@ -1053,9 +1053,9 @@ void CL_VM_Init (void) if (requiredcrc >= 0) { if (cls.demoplayback) - Con_Errorf("CL_VM_Init: demo requires CSQC, but \"%s\" wasn't found\n", csqc_progname.string); + Con_Printf(CON_ERROR "CL_VM_Init: demo requires CSQC, but \"%s\" wasn't found\n", csqc_progname.string); else - Con_Errorf("CL_VM_Init: server requires CSQC, but \"%s\" wasn't found\n", csqc_progname.string); + Con_Printf(CON_ERROR "CL_VM_Init: server requires CSQC, but \"%s\" wasn't found\n", csqc_progname.string); CL_Disconnect(); } return; diff --git a/fs.c b/fs.c index 34ed6525..a5130fbb 100644 --- a/fs.c +++ b/fs.c @@ -1212,7 +1212,7 @@ static qboolean FS_AddPack_Fullpath(const char *pakfile, const char *shortname, } else { - Con_Errorf("unable to load pak \"%s\"\n", pakfile); + Con_Printf(CON_ERROR "unable to load pak \"%s\"\n", pakfile); return false; } } @@ -2101,13 +2101,13 @@ static void FS_Init_Dir (void) p = FS_CheckGameDir(gamedirname1); if(!p || p == fs_checkgamedir_missing) - Con_Warnf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname1); + Con_Printf(CON_WARN "WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname1); if(gamedirname2) { p = FS_CheckGameDir(gamedirname2); if(!p || p == fs_checkgamedir_missing) - Con_Warnf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname2); + Con_Printf(CON_WARN "WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname2); } // -game @@ -2124,7 +2124,7 @@ static void FS_Init_Dir (void) if(!p) Sys_Error("Nasty -game name rejected: %s", sys.argv[i]); if(p == fs_checkgamedir_missing) - Con_Warnf("WARNING: -game %s%s/ not found!\n", fs_basedir, sys.argv[i]); + Con_Printf(CON_WARN "WARNING: -game %s%s/ not found!\n", fs_basedir, sys.argv[i]); // add the gamedir to the list of active gamedirs strlcpy (fs_gamedirs[fs_numgamedirs], sys.argv[i], sizeof(fs_gamedirs[fs_numgamedirs])); fs_numgamedirs++; @@ -2250,7 +2250,7 @@ static filedesc_t FS_SysOpenFiledesc(const char *filepath, const char *mode, qbo opt = O_CREAT | O_APPEND; break; default: - Con_Errorf ("FS_SysOpen(%s, %s): invalid mode\n", filepath, mode); + Con_Printf(CON_ERROR "FS_SysOpen(%s, %s): invalid mode\n", filepath, mode); return FILEDESC_INVALID; } for (ind = 1; mode[ind] != '\0'; ind++) @@ -2267,7 +2267,7 @@ static filedesc_t FS_SysOpenFiledesc(const char *filepath, const char *mode, qbo dolock = true; break; default: - Con_Errorf ("FS_SysOpen(%s, %s): unknown character in mode (%c)\n", + Con_Printf(CON_ERROR "FS_SysOpen(%s, %s): unknown character in mode (%c)\n", filepath, mode, mode[ind]); } } @@ -2377,7 +2377,7 @@ static qfile_t *FS_OpenPackedFile (pack_t* pack, int pack_ind) // No Zlib DLL = no compressed files if (!zlib_dll && (pfile->flags & PACKFILE_FLAG_DEFLATED)) { - Con_Warnf("WARNING: can't open the compressed file %s\n" + Con_Printf(CON_WARN "WARNING: can't open the compressed file %s\n" "You need the Zlib DLL to use compressed files\n", pfile->name); return NULL; @@ -2849,7 +2849,7 @@ fs_offset_t FS_Write (qfile_t* file, const void* data, size_t datasize) { if (FILEDESC_SEEK (file->handle, file->buff_ind - file->buff_len, SEEK_CUR) == -1) { - Con_Warnf("WARNING: could not seek in %s.\n", file->filename); + Con_Printf(CON_WARN "WARNING: could not seek in %s.\n", file->filename); } } diff --git a/ft2.c b/ft2.c index 906ad70c..d4f9e07a 100644 --- a/ft2.c +++ b/ft2.c @@ -388,7 +388,7 @@ void font_start(void) if (qFT_Init_FreeType(&font_ft2lib)) { - Con_Error("ERROR: Failed to initialize the FreeType2 library!\n"); + Con_Print(CON_ERROR "ERROR: Failed to initialize the FreeType2 library!\n"); Font_CloseLibrary(); return; } @@ -396,7 +396,7 @@ void font_start(void) font_mempool = Mem_AllocPool("FONT", 0, NULL); if (!font_mempool) { - Con_Error("ERROR: Failed to allocate FONT memory pool!\n"); + Con_Print(CON_ERROR "ERROR: Failed to allocate FONT memory pool!\n"); Font_CloseLibrary(); return; } @@ -543,7 +543,7 @@ qboolean Font_LoadFont(const char *name, dp_font_t *dpfnt) break; if (! (fb = Font_Alloc()) ) { - Con_Errorf("Failed to allocate font for fallback %i of font %s\n", i, name); + Con_Printf(CON_ERROR "Failed to allocate font for fallback %i of font %s\n", i, name); break; } @@ -553,7 +553,7 @@ qboolean Font_LoadFont(const char *name, dp_font_t *dpfnt) if(!FS_FileExists(va(vabuf, sizeof(vabuf), "%s.png", dpfnt->fallbacks[i]))) if(!FS_FileExists(va(vabuf, sizeof(vabuf), "%s.jpg", dpfnt->fallbacks[i]))) if(!FS_FileExists(va(vabuf, sizeof(vabuf), "%s.pcx", dpfnt->fallbacks[i]))) - Con_Errorf("Failed to load font %s for fallback %i of font %s\n", dpfnt->fallbacks[i], i, name); + Con_Printf(CON_ERROR "Failed to load font %s for fallback %i of font %s\n", dpfnt->fallbacks[i], i, name); Mem_Free(fb); continue; } @@ -565,7 +565,7 @@ qboolean Font_LoadFont(const char *name, dp_font_t *dpfnt) } if (!count) { - Con_Errorf("Failed to allocate font for fallback %i of font %s\n", i, name); + Con_Printf(CON_ERROR "Failed to allocate font for fallback %i of font %s\n", i, name); Font_UnloadFont(fb); Mem_Free(fb); break; @@ -619,7 +619,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti { if (!r_font_disable_freetype.integer) { - Con_Warnf("WARNING: can't open load font %s\n" + Con_Printf(CON_WARN "WARNING: can't open load font %s\n" "You need the FreeType2 DLL to load font files\n", name); } @@ -631,7 +631,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti namelen = strlen(name); if (namelen + 5 > sizeof(filename)) { - Con_Warnf("WARNING: too long font name. Cannot load this.\n"); + Con_Printf(CON_WARN "WARNING: too long font name. Cannot load this.\n"); return false; } @@ -677,14 +677,14 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti status = qFT_New_Memory_Face(font_ft2lib, (FT_Bytes)data, datasize, _face, (FT_Face*)&font->face); if (status && _face != 0) { - Con_Errorf("Failed to load face %i of %s. Falling back to face 0\n", _face, name); + Con_Printf(CON_ERROR "Failed to load face %i of %s. Falling back to face 0\n", _face, name); _face = 0; status = qFT_New_Memory_Face(font_ft2lib, (FT_Bytes)data, datasize, _face, (FT_Face*)&font->face); } font->data = data; if (status) { - Con_Errorf("ERROR: can't create face for %s\n" + Con_Printf(CON_ERROR "ERROR: can't create face for %s\n" "Error %i\n", // TODO: error strings name, status); Font_UnloadFont(font); @@ -700,7 +700,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti args.memory_base = (const FT_Byte*)font->attachments[i].data; args.memory_size = font->attachments[i].size; if (qFT_Attach_Stream((FT_Face)font->face, &args)) - Con_Errorf("Failed to add attachment %u to %s\n", (unsigned)i, font->name); + Con_Printf(CON_ERROR "Failed to add attachment %u to %s\n", (unsigned)i, font->name); } strlcpy(font->name, name, sizeof(font->name)); @@ -935,7 +935,7 @@ static qboolean Font_LoadSize(ft2_font_t *font, float size, qboolean check_only) temp.intSize = -1; // negative value: LoadMap must search now :) if (!Font_LoadMap(font, &temp, 0, &fmap)) { - Con_Errorf("ERROR: can't load the first character map for %s\n" + Con_Printf(CON_ERROR "ERROR: can't load the first character map for %s\n" "This is fatal\n", font->name); Font_UnloadFont(font); @@ -1103,7 +1103,7 @@ qboolean Font_GetKerningForMap(ft2_font_t *font, int map_index, float w, float h if (!Font_SetSize(font, fmap->intSize, fmap->intSize)) { // this deserves an error message - Con_Errorf("Failed to get kerning for %s\n", font->name); + Con_Printf(CON_ERROR "Failed to get kerning for %s\n", font->name); return false; } ul = qFT_Get_Char_Index((FT_Face)font->face, left); @@ -1186,14 +1186,14 @@ static float Font_SearchSize(ft2_font_t *font, FT_Face fontface, float size) { if (!Font_SetSize(font, intSize, intSize)) { - Con_Errorf("ERROR: can't set size for font %s: %f ((%f))\n", font->name, size, intSize); + Con_Printf(CON_ERROR "ERROR: can't set size for font %s: %f ((%f))\n", font->name, size, intSize); return -1; } if ((fontface->size->metrics.height>>6) <= size) return intSize; if (intSize < 2) { - Con_Errorf("ERROR: no appropriate size found for font %s: %f\n", font->name, size); + Con_Printf(CON_ERROR "ERROR: no appropriate size found for font %s: %f\n", font->name, size); return -1; } --intSize; @@ -1304,14 +1304,14 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ if (!font->image_font && !Font_SetSize(font, mapstart->intSize, mapstart->intSize)) { - Con_Errorf("ERROR: can't set sizes for font %s: %f\n", font->name, mapstart->size); + Con_Printf(CON_ERROR "ERROR: can't set sizes for font %s: %f\n", font->name, mapstart->size); return false; } map = (ft2_font_map_t *)Mem_Alloc(font_mempool, sizeof(ft2_font_map_t)); if (!map) { - Con_Errorf("ERROR: Out of memory when loading fontmap for %s\n", font->name); + Con_Printf(CON_ERROR "ERROR: Out of memory when loading fontmap for %s\n", font->name); return false; } @@ -1345,7 +1345,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ data = (unsigned char *)Mem_Alloc(font_mempool, (FONT_CHAR_LINES * map->glyphSize) * pitch); if (!data) { - Con_Errorf("ERROR: Failed to allocate memory for font %s size %g\n", font->name, map->size); + Con_Printf(CON_ERROR "ERROR: Failed to allocate memory for font %s size %g\n", font->name, map->size); Mem_Free(map); return false; } @@ -1461,7 +1461,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ h = bmp->rows; if (w > (map->glyphSize - gpad_l - gpad_r) || h > (map->glyphSize - gpad_t - gpad_b)) { - Con_Warnf("WARNING: Glyph %lu is too big in font %s, size %g: %i x %i\n", ch, font->name, map->size, w, h); + Con_Printf(CON_WARN "WARNING: Glyph %lu is too big in font %s, size %g: %i x %i\n", ch, font->name, map->size, w, h); if (w > map->glyphSize) w = map->glyphSize - gpad_l - gpad_r; if (h > map->glyphSize) @@ -1492,7 +1492,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ if (developer_font.integer) Con_DPrintf("glyphinfo: Pixel Mode: Unknown: %i\n", bmp->pixel_mode); Mem_Free(data); - Con_Errorf("ERROR: Unrecognized pixel mode for font %s size %f: %i\n", font->name, mapstart->size, bmp->pixel_mode); + Con_Printf(CON_ERROR "ERROR: Unrecognized pixel mode for font %s size %f: %i\n", font->name, mapstart->size, bmp->pixel_mode); return false; } for (y = 0; y < h; ++y) @@ -1650,7 +1650,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ // otherwise we retry to load it every single frame where ft2 rendering is used // this would be bad... // only `data' must be freed - Con_Errorf("ERROR: Failed to generate texture for font %s size %f map %lu\n", + Con_Printf(CON_ERROR "ERROR: Failed to generate texture for font %s size %f map %lu\n", font->name, mapstart->size, mapidx); return false; } diff --git a/gl_backend.c b/gl_backend.c index abc7f794..b16916a7 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1551,7 +1551,7 @@ void R_Mesh_Start(void) R_Mesh_SetRenderTargets(0, NULL, NULL, NULL, NULL, NULL); if (gl_printcheckerror.integer && !gl_paranoid.integer) { - Con_Warnf("WARNING: gl_printcheckerror is on but gl_paranoid is off, turning it on...\n"); + Con_Printf(CON_WARN "WARNING: gl_printcheckerror is on but gl_paranoid is off, turning it on...\n"); Cvar_SetValueQuick(&gl_paranoid, 1); } } diff --git a/gl_draw.c b/gl_draw.c index 8b800c2a..ac5c98b9 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -670,7 +670,7 @@ static void LoadFont_f(cmd_state_t *cmd) if (sizes == MAX_FONT_SIZES) { - Con_Warnf("Warning: specified more than %i different font sizes, exceding ones are ignored\n", MAX_FONT_SIZES); + Con_Printf(CON_WARN "Warning: specified more than %i different font sizes, exceding ones are ignored\n", MAX_FONT_SIZES); sizes = -1; continue; } diff --git a/gl_rmain.c b/gl_rmain.c index b36f2466..0a0f1b36 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -1469,7 +1469,7 @@ static void R_GLSL_DumpShader_f(cmd_state_t *cmd) Con_Printf("%s written\n", modeinfo[mode].filename); } else - Con_Errorf("failed to write to %s\n", modeinfo[mode].filename); + Con_Printf(CON_ERROR "failed to write to %s\n", modeinfo[mode].filename); } } } diff --git a/host.c b/host.c index 51f3bd32..bd843943 100644 --- a/host.c +++ b/host.c @@ -118,7 +118,7 @@ void Host_Error (const char *error, ...) dpvsnprintf (hosterrorstring1,sizeof(hosterrorstring1),error,argptr); va_end (argptr); - Con_Errorf("Host_Error: %s\n", hosterrorstring1); + Con_Printf(CON_ERROR "Host_Error: %s\n", hosterrorstring1); // LadyHavoc: if crashing very early, or currently shutting down, do // Sys_Error instead @@ -296,7 +296,7 @@ static void Host_SaveConfig_to(const char *file) f = FS_OpenRealFile(file, "wb", false); if (!f) { - Con_Errorf("Couldn't write %s.\n", file); + Con_Printf(CON_ERROR "Couldn't write %s.\n", file); return; } @@ -430,12 +430,12 @@ void Host_Main(void) { // warn if it's significant if (time < -0.01) - Con_Warnf("Host_Mingled: time stepped backwards (went from %f to %f, difference %f)\n", oldtime, newtime, time); + Con_Printf(CON_WARN "Host_Mingled: time stepped backwards (went from %f to %f, difference %f)\n", oldtime, newtime, time); time = 0; } else if (time >= 1800) { - Con_Warnf("Host_Mingled: time stepped forward (went from %f to %f, difference %f)\n", oldtime, newtime, time); + Con_Printf(CON_WARN "Host_Mingled: time stepped forward (went from %f to %f, difference %f)\n", oldtime, newtime, time); time = 0; } host.realtime += time; @@ -871,7 +871,7 @@ void Host_LockSession(void) { if(locksession.integer == 2) { - Con_Warnf("WARNING: session lock %s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", p); + Con_Printf(CON_WARN "WARNING: session lock %s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", p); } else { diff --git a/image_png.c b/image_png.c index 967d6f73..da327de2 100644 --- a/image_png.c +++ b/image_png.c @@ -283,12 +283,12 @@ static void PNG_fFlushData(void *png) static void PNG_error_fn(void *png, const char *message) { - Con_Errorf("PNG_LoadImage: error: %s\n", message); + Con_Printf(CON_ERROR "PNG_LoadImage: error: %s\n", message); } static void PNG_warning_fn(void *png, const char *message) { - Con_Warnf("PNG_LoadImage: warning: %s\n", message); + Con_Printf(CON_WARN "PNG_LoadImage: warning: %s\n", message); } unsigned char *PNG_LoadImage_BGRA (const unsigned char *raw, int filesize, int *miplevel) diff --git a/lhnet.c b/lhnet.c index 21087857..71b9cef5 100644 --- a/lhnet.c +++ b/lhnet.c @@ -969,9 +969,9 @@ lhnetsocket_t *LHNET_OpenSocket_Connectionless(lhnetaddress_t *address) int rfc1149only = 0; int rfc1149enabled = 0; if(setsockopt(lhnetsocket->inetsocket, SOL_RFC1149, RFC1149_1149ONLY, &rfc1149only)) - Con_Errorf("LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_1149ONLY) returned error: %s\n", LHNETPRIVATE_StrError()); + Con_Printf(CON_ERROR "LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_1149ONLY) returned error: %s\n", LHNETPRIVATE_StrError()); if(setsockopt(lhnetsocket->inetsocket, SOL_RFC1149, RFC1149_ENABLED, &rfc1149enabled)) - Con_Errorf("LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_ENABLED) returned error: %s\n", LHNETPRIVATE_StrError()); + Con_Printf(CON_ERROR "LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_ENABLED) returned error: %s\n", LHNETPRIVATE_StrError()); } #endif diff --git a/model_brush.c b/model_brush.c index 8fb07d00..c7f66b60 100644 --- a/model_brush.c +++ b/model_brush.c @@ -3649,12 +3649,12 @@ static void Mod_Q1BSP_RecursiveNodePortals(mnode_t *node) if (nodeportal->numpoints < 3) { - Con_Warn("Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal was clipped away\n"); + Con_Print(CON_WARN "Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal was clipped away\n"); nodeportal->numpoints = 0; } else if (nodeportal->numpoints >= MAX_PORTALPOINTS) { - Con_Warn("Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal has too many points\n"); + Con_Print(CON_WARN "Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal has too many points\n"); nodeportal->numpoints = 0; } @@ -4174,7 +4174,7 @@ void Mod_Q1BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) else { // LadyHavoc: empty submodel(lacrima.bsp has such a glitch) - Con_Warnf("warning: empty submodel *%i in %s\n", i+1, loadmodel->name); + Con_Printf(CON_WARN "warning: empty submodel *%i in %s\n", i+1, loadmodel->name); } //mod->brushq1.num_visleafs = bm->visleafs; @@ -5150,7 +5150,7 @@ static void Mod_Q2BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) } else { - Con_Warnf("warning: empty submodel *%i in %s\n", i+1, loadmodel->name); + Con_Printf(CON_WARN "warning: empty submodel *%i in %s\n", i+1, loadmodel->name); } //mod->brushq1.num_visleafs = bm->visleafs; @@ -6123,7 +6123,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) } if(xtess == -1) { - Con_Errorf("ERROR: patch %d isn't preprocessed?!?\n", i); + Con_Printf(CON_ERROR "ERROR: patch %d isn't preprocessed?!?\n", i); xtess = ytess = cxtess = cytess = 0; } @@ -6183,7 +6183,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) invalidelements++; if (invalidelements) { - Con_Warnf("Mod_Q3BSP_LoadFaces: Warning: face #%i has %i invalid elements, type = %i, texture->name = \"%s\", texture->surfaceflags = %i, firstvertex = %i, numvertices = %i, firstelement = %i, numelements = %i, elements list:\n", i, invalidelements, type, out->texture->name, out->texture->surfaceflags, firstvertex, out->num_vertices, firstelement, out->num_triangles * 3); + Con_Printf(CON_WARN "Mod_Q3BSP_LoadFaces: Warning: face #%i has %i invalid elements, type = %i, texture->name = \"%s\", texture->surfaceflags = %i, firstvertex = %i, numvertices = %i, firstelement = %i, numelements = %i, elements list:\n", i, invalidelements, type, out->texture->name, out->texture->surfaceflags, firstvertex, out->num_vertices, firstelement, out->num_triangles * 3); for (j = 0;j < out->num_triangles * 3;j++) { Con_Printf(" %i", (loadmodel->surfmesh.data_element3i + 3 * out->num_firsttriangle)[j] - out->num_firstvertex); @@ -6500,11 +6500,11 @@ static void Mod_Q3BSP_LoadLightGrid(lump_t *l) { if (l->filelen < count * (int)sizeof(*in)) { - Con_Errorf("Mod_Q3BSP_LoadLightGrid: invalid lightgrid lump size %i bytes, should be %i bytes (%ix%ix%i)", l->filelen, (int)(count * sizeof(*in)), loadmodel->brushq3.num_lightgrid_isize[0], loadmodel->brushq3.num_lightgrid_isize[1], loadmodel->brushq3.num_lightgrid_isize[2]); + Con_Printf(CON_ERROR "Mod_Q3BSP_LoadLightGrid: invalid lightgrid lump size %i bytes, should be %i bytes (%ix%ix%i)", l->filelen, (int)(count * sizeof(*in)), loadmodel->brushq3.num_lightgrid_isize[0], loadmodel->brushq3.num_lightgrid_isize[1], loadmodel->brushq3.num_lightgrid_isize[2]); return; // ignore the grid if we cannot understand it } if (l->filelen != count * (int)sizeof(*in)) - Con_Warnf("Mod_Q3BSP_LoadLightGrid: Warning: calculated lightgrid size %i bytes does not match lump size %i\n", (int)(count * sizeof(*in)), l->filelen); + Con_Printf(CON_WARN "Mod_Q3BSP_LoadLightGrid: Warning: calculated lightgrid size %i bytes does not match lump size %i\n", (int)(count * sizeof(*in)), l->filelen); out = (q3dlightgrid_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out)); loadmodel->brushq3.data_lightgrid = out; loadmodel->brushq3.num_lightgrid = count; diff --git a/model_sprite.c b/model_sprite.c index abf00190..acfac9f5 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -462,7 +462,7 @@ void Mod_IDS2_Load(dp_model_t *mod, void *buffer, void *bufferend) pinframe = &pinqsprite->frames[i]; if (!(skinframe = R_SkinFrame_LoadExternal(pinframe->name, texflags, false, false))) { - Con_Errorf("Mod_IDS2_Load: failed to load %s", pinframe->name); + Con_Printf(CON_ERROR "Mod_IDS2_Load: failed to load %s", pinframe->name); skinframe = R_SkinFrame_LoadMissing(); } Mod_SpriteSetupTexture(&loadmodel->data_textures[i], skinframe, fullbright, false); diff --git a/netconn.c b/netconn.c index a5235afa..71c1a1e6 100755 --- a/netconn.c +++ b/netconn.c @@ -970,11 +970,11 @@ static void NetConn_OpenClientPort(const char *addressstring, lhnetaddresstype_t else { LHNETADDRESS_ToString(&address, addressstring2, sizeof(addressstring2), true); - Con_Errorf("Client failed to open a socket on address %s\n", addressstring2); + Con_Printf(CON_ERROR "Client failed to open a socket on address %s\n", addressstring2); } } else - Con_Errorf("Client unable to parse address %s\n", addressstring); + Con_Printf(CON_ERROR "Client unable to parse address %s\n", addressstring); } void NetConn_OpenClientPorts(void) @@ -1034,12 +1034,12 @@ static qboolean NetConn_OpenServerPort(const char *addressstring, lhnetaddressty else { LHNETADDRESS_ToString(&address, addressstring2, sizeof(addressstring2), true); - Con_Errorf("Server failed to open socket on address %s\n", addressstring2); + Con_Printf(CON_ERROR "Server failed to open socket on address %s\n", addressstring2); } } else { - Con_Errorf("Server unable to parse address %s\n", addressstring); + Con_Printf(CON_ERROR "Server unable to parse address %s\n", addressstring); // if it cant parse one address, it wont be able to parse another for sure return false; } @@ -2740,7 +2740,7 @@ static qboolean hmac_mdfour_time_matching(lhnetaddress_t *peeraddress, const cha long t1, t2; if (!password[0]) { - Con_Error("LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); + Con_Print(CON_ERROR "LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); return false; } @@ -2761,7 +2761,7 @@ static qboolean hmac_mdfour_challenge_matching(lhnetaddress_t *peeraddress, cons int i; if (!password[0]) { - Con_Error("LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); + Con_Print(CON_ERROR "LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); return false; } @@ -2792,7 +2792,7 @@ static qboolean hmac_mdfour_challenge_matching(lhnetaddress_t *peeraddress, cons static qboolean plaintext_matching(lhnetaddress_t *peeraddress, const char *password, const char *hash, const char *s, int slen) { if (!password[0]) { - Con_Error("LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); + Con_Print(CON_ERROR "LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); return false; } @@ -3757,7 +3757,7 @@ void NetConn_QueryMasters(qboolean querydp, qboolean queryqw) } if (!masterquerycount) { - Con_Error("Unable to query master servers, no suitable network sockets active.\n"); + Con_Print(CON_ERROR "Unable to query master servers, no suitable network sockets active.\n"); M_Update_Return_Reason("No network"); } } @@ -3930,7 +3930,7 @@ void NetConn_Init(void) Cvar_SetQuick(&net_address, sys.argv[i + 1]); } else - Con_Errorf("-ip option used, but unable to parse the address \"%s\"\n", sys.argv[i + 1]); + Con_Printf(CON_ERROR "-ip option used, but unable to parse the address \"%s\"\n", sys.argv[i + 1]); } // COMMANDLINEOPTION: Server: -port sets the port to use for a server (default 26000, the same port as QUAKE itself), useful if you host multiple servers on your machine if (((i = COM_CheckParm("-port")) || (i = COM_CheckParm("-ipport")) || (i = COM_CheckParm("-udpport"))) && i + 1 < sys.argc) @@ -3942,7 +3942,7 @@ void NetConn_Init(void) Cvar_SetValueQuick(&sv_netport, i); } else - Con_Errorf("-port option used, but %i is not a valid port number\n", i); + Con_Printf(CON_ERROR "-port option used, but %i is not a valid port number\n", i); } cl_numsockets = 0; sv_numsockets = 0; diff --git a/protocol.c b/protocol.c index 0fa00971..073828ee 100644 --- a/protocol.c +++ b/protocol.c @@ -3366,7 +3366,7 @@ void EntityFrameQW_CL_ReadFrame(qboolean delta) if (newnum != oldnum && !delta && !invalid) { cl.qw_validsequence = 0; - Con_Warnf("WARNING: U_REMOVE %i on full update\n", newnum); + Con_Printf(CON_WARN "WARNING: U_REMOVE %i on full update\n", newnum); } } else diff --git a/prvm_cmds.c b/prvm_cmds.c index 81898814..65fc3a18 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -32,7 +32,7 @@ void VM_Warning(prvm_prog_t *prog, const char *fmt, ...) dpvsnprintf(msg,sizeof(msg),fmt,argptr); va_end(argptr); - Con_Warn(msg); + Con_Printf(CON_WARN "%s", msg); // TODO: either add a cvar/cmd to control the state dumping or replace some of the calls with Con_Printf [9/13/2006 Black] if(prvm_backtraceforwarnings.integer && recursive != host.realtime) // NOTE: this compares to the time, just in case if PRVM_PrintState causes a Host_Error and keeps recursive set @@ -331,7 +331,7 @@ void VM_error(prvm_prog_t *prog) char string[VM_STRINGTEMP_LENGTH]; VM_VarString(prog, 0, string, sizeof(string)); - Con_Errorf("======%s ERROR in %s:\n%s\n", prog->name, PRVM_GetString(prog, prog->xfunction->s_name), string); + Con_Printf(CON_ERROR "======%s ERROR in %s:\n%s\n", prog->name, PRVM_GetString(prog, prog->xfunction->s_name), string); ed = PRVM_PROG_TO_EDICT(PRVM_allglobaledict(self)); PRVM_ED_Print(prog, ed, NULL); @@ -354,11 +354,11 @@ void VM_objerror(prvm_prog_t *prog) char string[VM_STRINGTEMP_LENGTH]; VM_VarString(prog, 0, string, sizeof(string)); - Con_Errorf("======OBJECT ERROR======\n"); // , prog->name, PRVM_GetString(prog->xfunction->s_name), string); // or include them? FIXME + Con_Printf(CON_ERROR "======OBJECT ERROR======\n"); // , prog->name, PRVM_GetString(prog->xfunction->s_name), string); // or include them? FIXME ed = PRVM_PROG_TO_EDICT(PRVM_allglobaledict(self)); PRVM_ED_Print(prog, ed, NULL); PRVM_ED_Free (prog, ed); - Con_Errorf("%s OBJECT ERROR in %s:\n%s\nTip: read above for entity information\n", prog->name, PRVM_GetString(prog, prog->xfunction->s_name), string); + Con_Printf(CON_ERROR "%s OBJECT ERROR in %s:\n%s\nTip: read above for entity information\n", prog->name, PRVM_GetString(prog, prog->xfunction->s_name), string); } /* diff --git a/r_sky.c b/r_sky.c index 38a974f4..43d60a37 100644 --- a/r_sky.c +++ b/r_sky.c @@ -182,7 +182,7 @@ static void LoadSky_f(cmd_state_t *cmd) Con_Print("skybox disabled\n"); } else - Con_Errorf("failed to load skybox %s\n", Cmd_Argv(cmd, 1)); + Con_Printf(CON_ERROR "failed to load skybox %s\n", Cmd_Argv(cmd, 1)); break; default: Con_Print("usage: loadsky skyname\n"); diff --git a/snd_sdl.c b/snd_sdl.c index 98169a06..68c84cdb 100644 --- a/snd_sdl.c +++ b/snd_sdl.c @@ -138,7 +138,7 @@ qboolean SndSys_Init (snd_format_t* fmt) if ((audio_device = SDL_OpenAudioDevice(NULL, 0, &wantspec, &obtainspec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE)) == 0) { - Con_Errorf( "Failed to open the audio device! (%s)\n", SDL_GetError() ); + Con_Printf(CON_ERROR "Failed to open the audio device! (%s)\n", SDL_GetError() ); return false; } diff --git a/sv_demo.c b/sv_demo.c index a1bc51d5..ad3e509f 100644 --- a/sv_demo.c +++ b/sv_demo.c @@ -22,7 +22,7 @@ void SV_StartDemoRecording(client_t *client, const char *filename, int forcetrac client->sv_demo_file = FS_OpenRealFile(name, "wb", false); if(!client->sv_demo_file) { - Con_Error("ERROR: couldn't open.\n"); + Con_Print(CON_ERROR "ERROR: couldn't open.\n"); return; } diff --git a/sv_save.c b/sv_save.c index f7f26d69..b32cd9c6 100644 --- a/sv_save.c +++ b/sv_save.c @@ -211,7 +211,7 @@ void SV_Savegame_f(cmd_state_t *cmd) } } else - Con_Warn("Warning: saving a multiplayer game may have strange results when restored (to properly resume, all players must join in the same player slots and then the game can be reloaded).\n"); + Con_Print(CON_WARN "Warning: saving a multiplayer game may have strange results when restored (to properly resume, all players must join in the same player slots and then the game can be reloaded).\n"); if (Cmd_Argc(cmd) != 2) { @@ -518,7 +518,7 @@ void SV_Loadgame_f(cmd_state_t *cmd) if (COM_ParseToken_Simple(&t, false, false, true)) k |= atoi(com_token); if (!BufStr_FindCreateReplace(prog, i, k, "string")) - Con_Errorf("failed to create stringbuffer %i\n", i); + Con_Printf(CON_ERROR "failed to create stringbuffer %i\n", i); } else Con_Printf("unsupported stringbuffer index %i \"%s\"\n", i, com_token); @@ -548,7 +548,7 @@ void SV_Loadgame_f(cmd_state_t *cmd) Con_Printf("unexpected end of line when parsing sv.bufstr (expected strindex)\n"); } else - Con_Errorf("failed to create stringbuffer %i \"%s\"\n", i, com_token); + Con_Printf(CON_ERROR "failed to create stringbuffer %i \"%s\"\n", i, com_token); } } // skip any trailing text or unrecognized commands diff --git a/sys_linux.c b/sys_linux.c index a61b79e7..127f2bf3 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -41,7 +41,7 @@ void Sys_Error (const char *error, ...) dpvsnprintf (string, sizeof (string), error, argptr); va_end (argptr); - Con_Errorf ("Engine Error: %s\n", string); + Con_Printf(CON_ERROR "Engine Error: %s\n", string); Host_Shutdown (); exit (1); diff --git a/sys_sdl.c b/sys_sdl.c index 9a91c155..06d72ae9 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -62,7 +62,7 @@ void Sys_Error (const char *error, ...) dpvsnprintf (string, sizeof (string), error, argptr); va_end (argptr); - Con_Errorf ("Engine Error: %s\n", string); + Con_Printf(CON_ERROR "Engine Error: %s\n", string); if(!nocrashdialog) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Engine Error", string, NULL); diff --git a/sys_shared.c b/sys_shared.c index 84e210aa..d6081605 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -635,7 +635,7 @@ void Sys_MakeProcessNice (void) return; Con_DPrintf("Process is becoming 'nice'...\n"); if(setpriority(PRIO_PROCESS, 0, 19)) - Con_Errorf("Failed to raise nice level to %d\n", 19); + Con_Printf(CON_ERROR "Failed to raise nice level to %d\n", 19); sys.isnice = true; } void Sys_MakeProcessMean (void) @@ -646,7 +646,7 @@ void Sys_MakeProcessMean (void) return; Con_DPrintf("Process is becoming 'mean'...\n"); if(setpriority(PRIO_PROCESS, 0, sys.nicelevel)) - Con_Errorf("Failed to lower nice level to %d\n", sys.nicelevel); + Con_Printf(CON_ERROR "Failed to lower nice level to %d\n", sys.nicelevel); sys.isnice = false; } #else diff --git a/sys_win.c b/sys_win.c index aa04130a..de8e266a 100644 --- a/sys_win.c +++ b/sys_win.c @@ -65,7 +65,7 @@ void Sys_Error (const char *error, ...) dpvsnprintf (text, sizeof (text), error, argptr); va_end (argptr); - Con_Errorf ("Engine Error: %s\n", text); + Con_Printf(CON_ERROR "Engine Error: %s\n", text); // close video so the message box is visible, unless we already tried that if (!in_sys_error0 && cls.state != ca_dedicated) diff --git a/vid_sdl.c b/vid_sdl.c index 4179d640..b88e6ecb 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -1338,7 +1338,7 @@ void VID_Init (void) Sys_Error ("Failed to init SDL video subsystem: %s", SDL_GetError()); vid_sdl_initjoysticksystem = SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0; if (!vid_sdl_initjoysticksystem) - Con_Errorf("Failed to init SDL joystick subsystem: %s\n", SDL_GetError()); + Con_Printf(CON_ERROR "Failed to init SDL joystick subsystem: %s\n", SDL_GetError()); vid_isfullscreen = false; } @@ -1392,7 +1392,7 @@ void VID_EnableJoystick(qboolean enable) } else { - Con_Errorf("Joystick %i failed (SDL_JoystickOpen(%i) returned: %s)\n", index, sdlindex, SDL_GetError()); + Con_Printf(CON_ERROR "Joystick %i failed (SDL_JoystickOpen(%i) returned: %s)\n", index, sdlindex, SDL_GetError()); sdlindex = -1; } } @@ -1498,7 +1498,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) drivername = sys.argv[i + 1]; if (SDL_GL_LoadLibrary(drivername) < 0) { - Con_Errorf("Unable to load GL driver \"%s\": %s\n", drivername, SDL_GetError()); + Con_Printf(CON_ERROR "Unable to load GL driver \"%s\": %s\n", drivername, SDL_GetError()); return false; } #endif @@ -1578,7 +1578,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) window = SDL_CreateWindow(gamename, xPos, yPos, mode->width, mode->height, windowflags); if (window == NULL) { - Con_Errorf("Failed to set video mode to %ix%i: %s\n", mode->width, mode->height, SDL_GetError()); + Con_Printf(CON_ERROR "Failed to set video mode to %ix%i: %s\n", mode->width, mode->height, SDL_GetError()); VID_Shutdown(); return false; } @@ -1586,7 +1586,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) context = SDL_GL_CreateContext(window); if (context == NULL) { - Con_Errorf("Failed to initialize OpenGL context: %s\n", SDL_GetError()); + Con_Printf(CON_ERROR "Failed to initialize OpenGL context: %s\n", SDL_GetError()); VID_Shutdown(); return false; } diff --git a/wad.c b/wad.c index b0522751..55da4996 100644 --- a/wad.c +++ b/wad.c @@ -174,22 +174,22 @@ void W_LoadTextureWadFile (char *filename, int complain) if (!file) { if (complain) - Con_Errorf("W_LoadTextureWadFile: couldn't find %s\n", filename); + Con_Printf(CON_ERROR "W_LoadTextureWadFile: couldn't find %s\n", filename); return; } if (FS_Read(file, &header, sizeof(wadinfo_t)) != sizeof(wadinfo_t)) - {Con_Error("W_LoadTextureWadFile: unable to read wad header\n");FS_Close(file);file = NULL;return;} + {Con_Print(CON_ERROR "W_LoadTextureWadFile: unable to read wad header\n");FS_Close(file);file = NULL;return;} if(memcmp(header.identification, "WAD3", 4)) - {Con_Errorf("W_LoadTextureWadFile: Wad file %s doesn't have WAD3 id\n",filename);FS_Close(file);file = NULL;return;} + {Con_Printf(CON_ERROR "W_LoadTextureWadFile: Wad file %s doesn't have WAD3 id\n",filename);FS_Close(file);file = NULL;return;} numlumps = LittleLong(header.numlumps); if (numlumps < 1 || numlumps > 65536) - {Con_Errorf("W_LoadTextureWadFile: invalid number of lumps (%i)\n", numlumps);FS_Close(file);file = NULL;return;} + {Con_Printf(CON_ERROR "W_LoadTextureWadFile: invalid number of lumps (%i)\n", numlumps);FS_Close(file);file = NULL;return;} infotableofs = LittleLong(header.infotableofs); if (FS_Seek (file, infotableofs, SEEK_SET)) - {Con_Error("W_LoadTextureWadFile: unable to seek to lump table\n");FS_Close(file);file = NULL;return;} + {Con_Print(CON_ERROR "W_LoadTextureWadFile: unable to seek to lump table\n");FS_Close(file);file = NULL;return;} if (!wad.hlwads.mempool) Mem_ExpandableArray_NewArray(&wad.hlwads, cls.permanentmempool, sizeof(mwad_t), 16); @@ -200,7 +200,7 @@ void W_LoadTextureWadFile (char *filename, int complain) if (!w->lumps) { - Con_Error("W_LoadTextureWadFile: unable to allocate temporary memory for lump table\n"); + Con_Print(CON_ERROR "W_LoadTextureWadFile: unable to allocate temporary memory for lump table\n"); FS_Close(w->file); w->file = NULL; w->numlumps = 0; @@ -209,7 +209,7 @@ void W_LoadTextureWadFile (char *filename, int complain) if (FS_Read(file, w->lumps, sizeof(lumpinfo_t) * w->numlumps) != (fs_offset_t)sizeof(lumpinfo_t) * numlumps) { - Con_Error("W_LoadTextureWadFile: unable to read lump table\n"); + Con_Print(CON_ERROR "W_LoadTextureWadFile: unable to read lump table\n"); FS_Close(w->file); w->file = NULL; w->numlumps = 0; diff --git a/world.c b/world.c index fe3e0b60..e460ed6f 100644 --- a/world.c +++ b/world.c @@ -2479,9 +2479,9 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, prvm_edict_t *ed) pointsData[(polygons[1]*3)+2]*pointsData[(polygons[2]*3)+1]*pointsData[(polygons[3]*3)+0] - pointsData[(polygons[1]*3)+1]*pointsData[(polygons[2]*3)+0]*pointsData[(polygons[3]*3)+2] - pointsData[(polygons[1]*3)+0]*pointsData[(polygons[2]*3)+2]*pointsData[(polygons[3]*3)+1]) < 0) - Con_Warnf("WARNING: Polygon %d is not defined counterclockwise\n", i); + Con_Printf(CON_WARN "WARNING: Polygon %d is not defined counterclockwise\n", i); if (planesData[(i*4)+3] < 0) - Con_Warnf("WARNING: Plane %d does not contain the origin\n", i); + Con_Printf(CON_WARN "WARNING: Plane %d does not contain the origin\n", i); polygons += (*polygons + 1); } // create geom -- 2.39.2