From: cloudwalk Date: Mon, 25 May 2020 15:59:13 +0000 (+0000) Subject: Implement Con_Error(f) and Con_Warn(f), error and warning, for prettier colors X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=1b5e3869f0fd3e2fe323680784610d48d6efddca;hp=38adc57602a2d9a03c6f6f8d2e5cc91c14a6bd9e;p=xonotic%2Fdarkplaces.git Implement Con_Error(f) and Con_Warn(f), error and warning, for prettier colors Replace Con_Print(f) for most of the obvious cases. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12575 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cap_avi.c b/cap_avi.c index fff2f7a5..063ee097 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_Printf("WARNING: invalid size hint %d when writing video data (actual size: %d)\n", (int) sizehint, x); + Con_Warnf("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 37ca912e..36fd3ad8 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_Print("ERROR: couldn't open.\n"); + 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_Printf("ERROR: couldn't open %s.\n", name); + Con_Errorf("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 2aede84a..d0c12fca 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2195,7 +2195,7 @@ static void CL_Locs_Save_f(cmd_state_t *cmd) if (VectorCompare(loc->mins, loc->maxs)) break; if (loc) - Con_Printf("Warning: writing loc file containing a mixture of qizmo-style points and proquake-style boxes may not work in qizmo or proquake!\n"); + 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"); } for (loc = cl.locnodes;loc;loc = loc->next) { diff --git a/cl_parse.c b/cl_parse.c index c0aab7c6..a29f0fea 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1945,7 +1945,7 @@ static void CL_ParseServerInfo (void) cls.demo_lastcsprogscrc = -1; } else - Con_Print ("ERROR: couldn't open.\n"); + Con_Error ("ERROR: couldn't open.\n"); } } cl.islocalgame = NetConn_IsLocalGame(); diff --git a/cl_screen.c b/cl_screen.c index 9ce2f577..f6ca6e1c 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_Printf("Unable to write %s\n", filename); + Con_Errorf("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 da8c37b0..5aebcd50 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_Printf("unable to open \"%s\", error: %s\n", video->filename, errorstring); + Con_Errorf("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_Printf("WARNING: CLVIDEO_MAX_SUBTITLES = %i reached when reading subtitles from '%s'\n", CLVIDEO_MAX_SUBTITLES, subtitlesfile); + Con_Warnf("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_Printf( "CL_OpenVideo: unable to open video \"%s\" - video limit reached\n", filename ); + Con_Errorf( "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 a5381e81..7fa50d81 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_Printf("LibAvW: %s\n", qLibAvW_ErrorString(errorcode)); + Con_Errorf("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_Printf("LibAvW: cannot determine pixel format for bpp %i\n", bytesperpixel); + Con_Errorf("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_Printf("LibAvW: %s\n", qLibAvW_ErrorString(qLibAvW_StreamGetError(s->stream))); + Con_Errorf("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_Printf("LibAvcodec warning: %s\n", message); + Con_Warnf("LibAvcodec warning: %s\n", message); else if (level == LIBAVW_PRINT_ERROR) - Con_Printf("LibAvcodec error: %s\n", message); + Con_Errorf("LibAvcodec error: %s\n", message); else if (level == LIBAVW_PRINT_FATAL) - Con_Printf("LibAvcodec fatal error: %s\n", message); + Con_Errorf("LibAvcodec fatal error: %s\n", message); else - Con_Printf("LibAvcodec panic: %s\n", message); + Con_Errorf("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_Printf("LibAvW failed to initialize: %s\n", qLibAvW_ErrorString(errorcode)); + Con_Errorf("LibAvW failed to initialize: %s\n", qLibAvW_ErrorString(errorcode)); Sys_UnloadLibrary(&libavw_dll); } diff --git a/clvm_cmds.c b/clvm_cmds.c index d2836b37..e6f754f4 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -1869,7 +1869,7 @@ static void VM_CL_copyentity (prvm_prog_t *prog) static void VM_CL_effect (prvm_prog_t *prog) { #if 1 - Con_Printf("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_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 #else vec3_t org; VM_SAFEPARMCOUNT(5, VM_CL_effect); diff --git a/cmd.c b/cmd.c index d19e96fa..83ff546c 100644 --- a/cmd.c +++ b/cmd.c @@ -328,7 +328,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_Printf("Warning: console input buffer had an overlong line. Ignored.\n"); + Con_Warnf("Warning: console input buffer had an overlong line. Ignored.\n"); line[0] = 0; } else @@ -1122,9 +1122,9 @@ static const char *Cmd_GetCvarValue(cmd_state_t *cmd, const char *var, size_t va { // empty cvar name? if(alias) - Con_Printf("Warning: Could not expand $ in alias %s\n", alias->name); + Con_Warnf("Warning: Could not expand $ in alias %s\n", alias->name); else - Con_Printf("Warning: Could not expand $\n"); + Con_Warnf("Warning: Could not expand $\n"); return "$"; } @@ -1170,9 +1170,9 @@ static const char *Cmd_GetCvarValue(cmd_state_t *cmd, const char *var, size_t va if(required) { if(alias) - Con_Printf("Error: Could not expand $%s in alias %s\n", varname, alias->name); + Con_Errorf("Error: Could not expand $%s in alias %s\n", varname, alias->name); else - Con_Printf("Error: Could not expand $%s\n", varname); + Con_Errorf("Error: Could not expand $%s\n", varname); return NULL; } else if(optional) @@ -1182,9 +1182,9 @@ static const char *Cmd_GetCvarValue(cmd_state_t *cmd, const char *var, size_t va else { if(alias) - Con_Printf("Warning: Could not expand $%s in alias %s\n", varname, alias->name); + Con_Warnf("Warning: Could not expand $%s in alias %s\n", varname, alias->name); else - Con_Printf("Warning: Could not expand $%s\n", varname); + Con_Warnf("Warning: Could not expand $%s\n", varname); dpsnprintf(varval, sizeof(varval), "$%s", varname); return varval; } diff --git a/console.c b/console.c index 5f14b83f..ea394a18 100644 --- a/console.c +++ b/console.c @@ -807,7 +807,7 @@ static void Con_ConDump_f(cmd_state_t *cmd) file = FS_OpenRealFile(Cmd_Argv(cmd, 1), "w", false); if (!file) { - Con_Printf("condump: unable to write file \"%s\"\n", Cmd_Argv(cmd, 1)); + Con_Errorf("condump: unable to write file \"%s\"\n", Cmd_Argv(cmd, 1)); return; } if (con_mutex) Thread_LockMutex(con_mutex); @@ -1458,6 +1458,61 @@ 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 35ce4dc1..8d1a64a5 100644 --- a/console.h +++ b/console.h @@ -51,6 +51,14 @@ 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); diff --git a/csprogs.c b/csprogs.c index fb37cba0..189c6bb1 100644 --- a/csprogs.c +++ b/csprogs.c @@ -1033,7 +1033,7 @@ void CL_VM_Init (void) { if (cls.demoplayback) { - Con_Printf("^1Warning: 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_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); // 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_Printf("^1Your %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_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); CL_Disconnect(); return; } @@ -1053,9 +1053,9 @@ void CL_VM_Init (void) if (requiredcrc >= 0) { if (cls.demoplayback) - Con_Printf("CL_VM_Init: demo requires CSQC, but \"%s\" wasn't found\n", csqc_progname.string); + Con_Errorf("CL_VM_Init: demo requires CSQC, but \"%s\" wasn't found\n", csqc_progname.string); else - Con_Printf("CL_VM_Init: server requires CSQC, but \"%s\" wasn't found\n", csqc_progname.string); + Con_Errorf("CL_VM_Init: server requires CSQC, but \"%s\" wasn't found\n", csqc_progname.string); CL_Disconnect(); } return; @@ -1093,7 +1093,7 @@ void CL_VM_Init (void) if (!prog->loaded) { - Host_Error("CSQC %s ^2failed to load\n", csprogsfn); + Host_Error("CSQC %s failed to load\n", csprogsfn); if(!sv.active) CL_Disconnect(); Mem_Free(csprogsdata); diff --git a/fs.c b/fs.c index 99f43e4a..590a336c 100644 --- a/fs.c +++ b/fs.c @@ -1212,7 +1212,7 @@ static qboolean FS_AddPack_Fullpath(const char *pakfile, const char *shortname, } else { - Con_Printf("unable to load pak \"%s\"\n", pakfile); + Con_Errorf("unable to load pak \"%s\"\n", pakfile); return false; } } @@ -2138,13 +2138,13 @@ void FS_Init (void) p = FS_CheckGameDir(gamedirname1); if(!p || p == fs_checkgamedir_missing) - Con_Printf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname1); + Con_Warnf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname1); if(gamedirname2) { p = FS_CheckGameDir(gamedirname2); if(!p || p == fs_checkgamedir_missing) - Con_Printf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname2); + Con_Warnf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname2); } // -game @@ -2161,7 +2161,7 @@ void FS_Init (void) if(!p) Sys_Error("Nasty -game name rejected: %s", com_argv[i]); if(p == fs_checkgamedir_missing) - Con_Printf("WARNING: -game %s%s/ not found!\n", fs_basedir, com_argv[i]); + Con_Warnf("WARNING: -game %s%s/ not found!\n", fs_basedir, com_argv[i]); // add the gamedir to the list of active gamedirs strlcpy (fs_gamedirs[fs_numgamedirs], com_argv[i], sizeof(fs_gamedirs[fs_numgamedirs])); fs_numgamedirs++; @@ -2243,7 +2243,7 @@ static filedesc_t FS_SysOpenFiledesc(const char *filepath, const char *mode, qbo opt = O_CREAT | O_APPEND; break; default: - Con_Printf ("FS_SysOpen(%s, %s): invalid mode\n", filepath, mode); + Con_Errorf ("FS_SysOpen(%s, %s): invalid mode\n", filepath, mode); return FILEDESC_INVALID; } for (ind = 1; mode[ind] != '\0'; ind++) @@ -2260,7 +2260,7 @@ static filedesc_t FS_SysOpenFiledesc(const char *filepath, const char *mode, qbo dolock = true; break; default: - Con_Printf ("FS_SysOpen(%s, %s): unknown character in mode (%c)\n", + Con_Errorf ("FS_SysOpen(%s, %s): unknown character in mode (%c)\n", filepath, mode, mode[ind]); } } @@ -2370,7 +2370,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_Printf("WARNING: can't open the compressed file %s\n" + Con_Warnf("WARNING: can't open the compressed file %s\n" "You need the Zlib DLL to use compressed files\n", pfile->name); return NULL; @@ -2842,7 +2842,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_Printf("WARNING: could not seek in %s.\n", file->filename); + Con_Warnf("WARNING: could not seek in %s.\n", file->filename); } } diff --git a/ft2.c b/ft2.c index 7e665b45..9eff4a2b 100644 --- a/ft2.c +++ b/ft2.c @@ -388,7 +388,7 @@ void font_start(void) if (qFT_Init_FreeType(&font_ft2lib)) { - Con_Print("ERROR: Failed to initialize the FreeType2 library!\n"); + 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_Print("ERROR: Failed to allocate FONT memory pool!\n"); + 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_Printf("Failed to allocate font for fallback %i of font %s\n", i, name); + Con_Errorf("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_Printf("Failed to load font %s for fallback %i of font %s\n", dpfnt->fallbacks[i], i, name); + Con_Errorf("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_Printf("Failed to allocate font for fallback %i of font %s\n", i, name); + Con_Errorf("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_Printf("WARNING: can't open load font %s\n" + Con_Warnf("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_Printf("WARNING: too long font name. Cannot load this.\n"); + Con_Warnf("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_Printf("Failed to load face %i of %s. Falling back to face 0\n", _face, name); + Con_Errorf("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_Printf("ERROR: can't create face for %s\n" + Con_Errorf("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_Printf("Failed to add attachment %u to %s\n", (unsigned)i, font->name); + Con_Errorf("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_Printf("ERROR: can't load the first character map for %s\n" + Con_Errorf("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_Printf("Failed to get kerning for %s\n", font->name); + Con_Errorf("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_Printf("ERROR: can't set size for font %s: %f ((%f))\n", font->name, size, intSize); + Con_Errorf("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_Printf("ERROR: no appropriate size found for font %s: %f\n", font->name, size); + Con_Errorf("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_Printf("ERROR: can't set sizes for font %s: %f\n", font->name, mapstart->size); + Con_Errorf("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_Printf("ERROR: Out of memory when loading fontmap for %s\n", font->name); + Con_Errorf("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_Printf("ERROR: Failed to allocate memory for font %s size %g\n", font->name, map->size); + Con_Errorf("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_Printf("WARNING: Glyph %lu is too big in font %s, size %g: %i x %i\n", ch, font->name, map->size, w, h); + Con_Warnf("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_Printf("ERROR: Unrecognized pixel mode for font %s size %f: %i\n", font->name, mapstart->size, bmp->pixel_mode); + Con_Errorf("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_Printf("ERROR: Failed to generate texture for font %s size %f map %lu\n", + Con_Errorf("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 4ad00bc2..409425b3 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_Printf("WARNING: gl_printcheckerror is on but gl_paranoid is off, turning it on...\n"); + Con_Warnf("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 cdd5b766..8104a9e3 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_Printf("Warning: specified more than %i different font sizes, exceding ones are ignored\n", MAX_FONT_SIZES); + Con_Warnf("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 2c6b96b2..d506dbe6 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -1458,7 +1458,7 @@ static void R_GLSL_DumpShader_f(cmd_state_t *cmd) Con_Printf("%s written\n", modeinfo[mode].filename); } else - Con_Printf("failed to write to %s\n", modeinfo[mode].filename); + Con_Errorf("failed to write to %s\n", modeinfo[mode].filename); } } } diff --git a/host.c b/host.c index a73cd73c..1b4f546d 100644 --- a/host.c +++ b/host.c @@ -129,7 +129,7 @@ void Host_Error (const char *error, ...) dpvsnprintf (hosterrorstring1,sizeof(hosterrorstring1),error,argptr); va_end (argptr); - Con_Printf("Host_Error: %s\n", hosterrorstring1); + Con_Errorf("Host_Error: %s\n", hosterrorstring1); // LadyHavoc: if crashing very early, or currently shutting down, do // Sys_Error instead @@ -290,7 +290,7 @@ static void Host_SaveConfig_to(const char *file) f = FS_OpenRealFile(file, "wb", false); if (!f) { - Con_Printf("Couldn't write %s.\n", file); + Con_Errorf("Couldn't write %s.\n", file); return; } @@ -696,12 +696,12 @@ void Host_Main(void) { // warn if it's significant if (deltacleantime < -0.01) - Con_Printf("Host_Mingled: time stepped backwards (went from %f to %f, difference %f)\n", olddirtytime, dirtytime, deltacleantime); + Con_Warnf("Host_Mingled: time stepped backwards (went from %f to %f, difference %f)\n", olddirtytime, dirtytime, deltacleantime); deltacleantime = 0; } else if (deltacleantime >= 1800) { - Con_Printf("Host_Mingled: time stepped forward (went from %f to %f, difference %f)\n", olddirtytime, dirtytime, deltacleantime); + Con_Warnf("Host_Mingled: time stepped forward (went from %f to %f, difference %f)\n", olddirtytime, dirtytime, deltacleantime); deltacleantime = 0; } realtime += deltacleantime; @@ -1141,7 +1141,7 @@ void Host_LockSession(void) { if(locksession.integer == 2) { - Con_Printf("WARNING: session lock %s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", p); + Con_Warnf("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/host_cmd.c b/host_cmd.c index ffbbdf27..4a190e98 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -730,7 +730,7 @@ static void Host_Savegame_f(cmd_state_t *cmd) } } else - Con_Print("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_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) { @@ -1041,7 +1041,7 @@ static void Host_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_Printf("failed to create stringbuffer %i\n", i); + Con_Errorf("failed to create stringbuffer %i\n", i); } else Con_Printf("unsupported stringbuffer index %i \"%s\"\n", i, com_token); @@ -1071,7 +1071,7 @@ static void Host_Loadgame_f(cmd_state_t *cmd) Con_Printf("unexpected end of line when parsing sv.bufstr (expected strindex)\n"); } else - Con_Printf("failed to create stringbuffer %i \"%s\"\n", i, com_token); + Con_Errorf("failed to create stringbuffer %i \"%s\"\n", i, com_token); } } // skip any trailing text or unrecognized commands diff --git a/image_png.c b/image_png.c index c542dfeb..967d6f73 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_Printf("PNG_LoadImage: error: %s\n", message); + Con_Errorf("PNG_LoadImage: error: %s\n", message); } static void PNG_warning_fn(void *png, const char *message) { - Con_Printf("PNG_LoadImage: warning: %s\n", message); + Con_Warnf("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 90b67ee5..40b5148b 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_Printf("LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_1149ONLY) returned error: %s\n", LHNETPRIVATE_StrError()); + Con_Errorf("LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_1149ONLY) returned error: %s\n", LHNETPRIVATE_StrError()); if(setsockopt(lhnetsocket->inetsocket, SOL_RFC1149, RFC1149_ENABLED, &rfc1149enabled)) - Con_Printf("LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_ENABLED) returned error: %s\n", LHNETPRIVATE_StrError()); + Con_Errorf("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 e37ba032..f7957977 100644 --- a/model_brush.c +++ b/model_brush.c @@ -3667,12 +3667,12 @@ static void Mod_Q1BSP_RecursiveNodePortals(mnode_t *node) if (nodeportal->numpoints < 3) { - Con_Print("Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal was clipped away\n"); + Con_Warn("Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal was clipped away\n"); nodeportal->numpoints = 0; } else if (nodeportal->numpoints >= MAX_PORTALPOINTS) { - Con_Print("Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal has too many points\n"); + Con_Warn("Mod_Q1BSP_RecursiveNodePortals: WARNING: new portal has too many points\n"); nodeportal->numpoints = 0; } @@ -4192,7 +4192,7 @@ void Mod_Q1BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) else { // LadyHavoc: empty submodel(lacrima.bsp has such a glitch) - Con_Printf("warning: empty submodel *%i in %s\n", i+1, loadmodel->name); + Con_Warnf("warning: empty submodel *%i in %s\n", i+1, loadmodel->name); } //mod->brushq1.num_visleafs = bm->visleafs; @@ -5168,7 +5168,7 @@ static void Mod_Q2BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) } else { - Con_Printf("warning: empty submodel *%i in %s\n", i+1, loadmodel->name); + Con_Warnf("warning: empty submodel *%i in %s\n", i+1, loadmodel->name); } //mod->brushq1.num_visleafs = bm->visleafs; @@ -6192,7 +6192,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) } if(xtess == -1) { - Con_Printf("ERROR: patch %d isn't preprocessed?!?\n", i); + Con_Errorf("ERROR: patch %d isn't preprocessed?!?\n", i); xtess = ytess = cxtess = cytess = 0; } @@ -6279,7 +6279,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) invalidelements++; if (invalidelements) { - Con_Printf("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_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); for (j = 0;j < out->num_triangles * 3;j++) { Con_Printf(" %i", (loadmodel->surfmesh.data_element3i + 3 * out->num_firsttriangle)[j] - out->num_firstvertex); @@ -6593,11 +6593,11 @@ static void Mod_Q3BSP_LoadLightGrid(lump_t *l) { if (l->filelen < count * (int)sizeof(*in)) { - Con_Printf("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_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]); return; // ignore the grid if we cannot understand it } if (l->filelen != count * (int)sizeof(*in)) - Con_Printf("Mod_Q3BSP_LoadLightGrid: Warning: calculated lightgrid size %i bytes does not match lump size %i\n", (int)(count * sizeof(*in)), l->filelen); + Con_Warnf("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 f066c84c..abf00190 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_Printf("Mod_IDS2_Load: failed to load %s", pinframe->name); + Con_Errorf("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 95b6a8a3..fc5c4d8c 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_Printf("Client failed to open a socket on address %s\n", addressstring2); + Con_Errorf("Client failed to open a socket on address %s\n", addressstring2); } } else - Con_Printf("Client unable to parse address %s\n", addressstring); + Con_Errorf("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_Printf("Server failed to open socket on address %s\n", addressstring2); + Con_Errorf("Server failed to open socket on address %s\n", addressstring2); } } else { - Con_Printf("Server unable to parse address %s\n", addressstring); + Con_Errorf("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; } @@ -2737,7 +2737,7 @@ static qboolean hmac_mdfour_time_matching(lhnetaddress_t *peeraddress, const cha long t1, t2; if (!password[0]) { - Con_Print("^4LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); + Con_Error("LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); return false; } @@ -2758,7 +2758,7 @@ static qboolean hmac_mdfour_challenge_matching(lhnetaddress_t *peeraddress, cons int i; if (!password[0]) { - Con_Print("^4LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); + Con_Error("LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); return false; } @@ -2789,7 +2789,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_Print("^4LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); + Con_Error("LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n"); return false; } @@ -2937,7 +2937,7 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat { int i, ret, clientnum, best; double besttime; - char *string, response[1400], addressstring2[128]; + char *string, response[2800], addressstring2[128]; static char stringbuf[16384]; // server only qboolean islocal = (LHNETADDRESS_GetAddressType(peeraddress) == LHNETADDRESSTYPE_LOOP); char senddata[NET_HEADERSIZE+NET_MAXMESSAGE+CRYPTO_HEADERSIZE]; @@ -3754,7 +3754,7 @@ void NetConn_QueryMasters(qboolean querydp, qboolean queryqw) } if (!masterquerycount) { - Con_Print("Unable to query master servers, no suitable network sockets active.\n"); + Con_Error("Unable to query master servers, no suitable network sockets active.\n"); M_Update_Return_Reason("No network"); } } @@ -3922,7 +3922,7 @@ void NetConn_Init(void) Cvar_SetQuick(&net_address, com_argv[i + 1]); } else - Con_Printf("-ip option used, but unable to parse the address \"%s\"\n", com_argv[i + 1]); + Con_Errorf("-ip option used, but unable to parse the address \"%s\"\n", com_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 < com_argc) @@ -3934,7 +3934,7 @@ void NetConn_Init(void) Cvar_SetValueQuick(&sv_netport, i); } else - Con_Printf("-port option used, but %i is not a valid port number\n", i); + Con_Errorf("-port option used, but %i is not a valid port number\n", i); } cl_numsockets = 0; sv_numsockets = 0; diff --git a/netconn.h b/netconn.h index acf35930..6f0d762e 100755 --- a/netconn.h +++ b/netconn.h @@ -282,7 +282,7 @@ typedef struct serverlist_info_s /// qc-defined short status string char qcstatus[128]; /// frags/ping/name list (if they fit in the packet) - char players[1400]; + char players[2800]; /// max client number int maxplayers; /// number of currently connected players (including bots) diff --git a/protocol.c b/protocol.c index bb0a482d..bdeebdd5 100644 --- a/protocol.c +++ b/protocol.c @@ -3364,7 +3364,7 @@ void EntityFrameQW_CL_ReadFrame(qboolean delta) if (newnum != oldnum && !delta && !invalid) { cl.qw_validsequence = 0; - Con_Printf("WARNING: U_REMOVE %i on full update\n", newnum); + Con_Warnf("WARNING: U_REMOVE %i on full update\n", newnum); } } else diff --git a/prvm_cmds.c b/prvm_cmds.c index b3c69175..73d0a89a 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_Print(msg); + Con_Warn(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 != 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_Printf("======%s ERROR in %s:\n%s\n", prog->name, PRVM_GetString(prog, prog->xfunction->s_name), string); + Con_Errorf("======%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_Printf("======OBJECT ERROR======\n"); // , prog->name, PRVM_GetString(prog->xfunction->s_name), string); // or include them? FIXME + Con_Errorf("======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_Printf("%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_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); } /* diff --git a/r_sky.c b/r_sky.c index 84b916e5..f0647f08 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_Printf("failed to load skybox %s\n", Cmd_Argv(cmd, 1)); + Con_Errorf("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 f7e0f472..2d1f94a6 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_Printf( "Failed to open the audio device! (%s)\n", SDL_GetError() ); + Con_Errorf( "Failed to open the audio device! (%s)\n", SDL_GetError() ); return false; } diff --git a/sv_demo.c b/sv_demo.c index 9a9cc164..a1bc51d5 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_Print("ERROR: couldn't open.\n"); + Con_Error("ERROR: couldn't open.\n"); return; } diff --git a/sys_linux.c b/sys_linux.c index d923021c..4f864ec1 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -39,7 +39,7 @@ void Sys_Error (const char *error, ...) dpvsnprintf (string, sizeof (string), error, argptr); va_end (argptr); - Con_Printf ("Engine Error: %s\n", string); + Con_Errorf ("Engine Error: %s\n", string); Host_Shutdown (); exit (1); diff --git a/sys_sdl.c b/sys_sdl.c index 88369e1f..b4698fb2 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -60,7 +60,7 @@ void Sys_Error (const char *error, ...) dpvsnprintf (string, sizeof (string), error, argptr); va_end (argptr); - Con_Printf ("Engine Error: %s\n", string); + Con_Errorf ("Engine Error: %s\n", string); #ifdef WIN32 MessageBox(NULL, string, "Engine Error", MB_OK | MB_SETFOREGROUND | MB_ICONSTOP); diff --git a/sys_shared.c b/sys_shared.c index d5276325..5171b34e 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -630,7 +630,7 @@ void Sys_MakeProcessNice (void) return; Con_DPrintf("Process is becoming 'nice'...\n"); if(setpriority(PRIO_PROCESS, 0, 19)) - Con_Printf("Failed to raise nice level to %d\n", 19); + Con_Errorf("Failed to raise nice level to %d\n", 19); isnice = true; } void Sys_MakeProcessMean (void) @@ -641,7 +641,7 @@ void Sys_MakeProcessMean (void) return; Con_DPrintf("Process is becoming 'mean'...\n"); if(setpriority(PRIO_PROCESS, 0, nicelevel)) - Con_Printf("Failed to lower nice level to %d\n", nicelevel); + Con_Errorf("Failed to lower nice level to %d\n", nicelevel); isnice = false; } #else diff --git a/sys_win.c b/sys_win.c index c02cdbb6..54a482ed 100644 --- a/sys_win.c +++ b/sys_win.c @@ -64,7 +64,7 @@ void Sys_Error (const char *error, ...) dpvsnprintf (text, sizeof (text), error, argptr); va_end (argptr); - Con_Printf ("Engine Error: %s\n", text); + Con_Errorf ("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 12214d2a..3db8b2b9 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_Printf("Failed to init SDL joystick subsystem: %s\n", SDL_GetError()); + Con_Errorf("Failed to init SDL joystick subsystem: %s\n", SDL_GetError()); vid_isfullscreen = false; } @@ -1392,7 +1392,7 @@ void VID_EnableJoystick(qboolean enable) } else { - Con_Printf("Joystick %i failed (SDL_JoystickOpen(%i) returned: %s)\n", index, sdlindex, SDL_GetError()); + Con_Errorf("Joystick %i failed (SDL_JoystickOpen(%i) returned: %s)\n", index, sdlindex, SDL_GetError()); sdlindex = -1; } } @@ -1487,7 +1487,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) drivername = com_argv[i + 1]; if (SDL_GL_LoadLibrary(drivername) < 0) { - Con_Printf("Unable to load GL driver \"%s\": %s\n", drivername, SDL_GetError()); + Con_Errorf("Unable to load GL driver \"%s\": %s\n", drivername, SDL_GetError()); return false; } #endif @@ -1556,7 +1556,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) window = SDL_CreateWindow(gamename, xPos, yPos, mode->width, mode->height, windowflags); if (window == NULL) { - Con_Printf("Failed to set video mode to %ix%i: %s\n", mode->width, mode->height, SDL_GetError()); + Con_Errorf("Failed to set video mode to %ix%i: %s\n", mode->width, mode->height, SDL_GetError()); VID_Shutdown(); return false; } @@ -1564,7 +1564,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) context = SDL_GL_CreateContext(window); if (context == NULL) { - Con_Printf("Failed to initialize OpenGL context: %s\n", SDL_GetError()); + Con_Errorf("Failed to initialize OpenGL context: %s\n", SDL_GetError()); VID_Shutdown(); return false; } diff --git a/wad.c b/wad.c index fabffc3b..b0522751 100644 --- a/wad.c +++ b/wad.c @@ -174,22 +174,22 @@ void W_LoadTextureWadFile (char *filename, int complain) if (!file) { if (complain) - Con_Printf("W_LoadTextureWadFile: couldn't find %s\n", filename); + Con_Errorf("W_LoadTextureWadFile: couldn't find %s\n", filename); return; } if (FS_Read(file, &header, sizeof(wadinfo_t)) != sizeof(wadinfo_t)) - {Con_Print("W_LoadTextureWadFile: unable to read wad header\n");FS_Close(file);file = NULL;return;} + {Con_Error("W_LoadTextureWadFile: unable to read wad header\n");FS_Close(file);file = NULL;return;} if(memcmp(header.identification, "WAD3", 4)) - {Con_Printf("W_LoadTextureWadFile: Wad file %s doesn't have WAD3 id\n",filename);FS_Close(file);file = NULL;return;} + {Con_Errorf("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_Printf("W_LoadTextureWadFile: invalid number of lumps (%i)\n", numlumps);FS_Close(file);file = NULL;return;} + {Con_Errorf("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_Print("W_LoadTextureWadFile: unable to seek to lump table\n");FS_Close(file);file = NULL;return;} + {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_Print("W_LoadTextureWadFile: unable to allocate temporary memory for lump table\n"); + 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_Print("W_LoadTextureWadFile: unable to read lump table\n"); + 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 6c94a429..fe3e0b60 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_Printf("WARNING: Polygon %d is not defined counterclockwise\n", i); + Con_Warnf("WARNING: Polygon %d is not defined counterclockwise\n", i); if (planesData[(i*4)+3] < 0) - Con_Printf("WARNING: Plane %d does not contain the origin\n", i); + Con_Warnf("WARNING: Plane %d does not contain the origin\n", i); polygons += (*polygons + 1); } // create geom