diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 12180ead0d..a2ff656565 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -2462,10 +2462,10 @@ void actInit(bool bSaveLoad) { #ifdef NOONE_EXTENSIONS if (!gModernMap) { - initprintf("> This map *does not* provide modern features.\n"); + LOG_F(INFO, "> This map *does not* provide modern features."); nnExtResetGlobals(); } else { - initprintf("> This map provides modern features.\n"); + LOG_F(INFO, "> This map provides modern features."); nnExtInitModernStuff(bSaveLoad); } #endif diff --git a/source/blood/src/barf.cpp b/source/blood/src/barf.cpp index f56363c66d..92bd783567 100644 --- a/source/blood/src/barf.cpp +++ b/source/blood/src/barf.cpp @@ -265,7 +265,7 @@ void RFS::ScriptError(const char *message) puts("^"); - initprintf("Error in %s line %d: %s\n\n", _fileName, _curLine, message); + LOG_F(ERROR, "Error in %s line %d: %s\n", _fileName, _curLine, message); } uint8_t RFS::GetNextTag() diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index a4a10c4aca..2328ebe702 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -524,7 +524,7 @@ int G_TryMapHack(const char* mhkfile) int const failure = engineLoadMHK(mhkfile); if (!failure) - initprintf("Loaded map hack file \"%s\"\n", mhkfile); + LOG_F(INFO, "Loaded map hack file \"%s\"", mhkfile); return failure; } @@ -1241,7 +1241,7 @@ void PrintHelp(void) Bsnprintf(tempbuf, sizeof(tempbuf), APPNAME " %s", s_buildRev); wm_msgbox(tempbuf, s); #else - initprintf("%s\n", s); + LOG_F(INFO, "%s", s); #endif #if 0 puts("Blood Command-line Options:"); @@ -1444,7 +1444,7 @@ void ParseOptions(void) { clearDefNamePtr(); g_defNamePtr = dup_filename(OptFull); - initprintf("Using DEF file \"%s\".\n", g_defNamePtr); + LOG_F(INFO, "Using DEF file \"%s\".", g_defNamePtr); continue; } } @@ -1460,7 +1460,7 @@ void ParseOptions(void) //bNoCDAudio = 1; break; case 32: - initprintf("Autoload disabled\n"); + LOG_F(INFO, "Autoload disabled"); bNoAutoLoad = true; break; case 33: @@ -1472,7 +1472,7 @@ void ParseOptions(void) ThrowError("Missing argument"); uint32_t j = strtoul(OptArgv[0], NULL, 0); MAXCACHE1DSIZE = j<<10; - initprintf("Cache size: %dkB\n", j); + LOG_F(INFO, "Cache size: %dkB", j); break; } case 35: @@ -1598,7 +1598,7 @@ int app_main(int argc, char const * const * argv) wm_setapptitle(APPNAME); - initprintf(APPNAME " %s\n", s_buildRev); + LOG_F(INFO, APPNAME " %s", s_buildRev); PrintBuildInfo(); memcpy(&gGameOptions, &gSingleGameOptions, sizeof(GAMEOPTIONS)); @@ -1639,7 +1639,7 @@ int app_main(int argc, char const * const * argv) } if (Bstrcmp(SetupFilename, SETUPFILENAME)) - initprintf("Using config file \"%s\".\n", SetupFilename); + LOG_F(INFO, "Using config file \"%s\".", SetupFilename); ScanINIFiles(); @@ -1659,7 +1659,7 @@ int app_main(int argc, char const * const * argv) //if (!g_useCwd) // G_CleanupSearchPaths(); - initprintf("Initializing OSD...\n"); + LOG_F(INFO, "Initializing OSD..."); //Bsprintf(tempbuf, HEAD2 " %s", s_buildRev); OSD_SetVersion("Blood", 10, 0); @@ -1682,13 +1682,13 @@ int app_main(int argc, char const * const * argv) HookReplaceFunctions(); - initprintf("Initializing Build 3D engine\n"); + LOG_F(INFO, "Initializing Build 3D engine"); scrInit(); - initprintf("Creating standard color lookups\n"); + LOG_F(INFO, "Creating standard color lookups"); scrCreateStdColors(); - initprintf("Loading tiles\n"); + LOG_F(INFO, "Loading tiles"); if (pUserTiles) { strcpy(buffer,pUserTiles); @@ -1712,28 +1712,29 @@ int app_main(int argc, char const * const * argv) loaddefinitionsfile(BLOODWIDESCREENDEF); loaddefinitions_game(BLOODWIDESCREENDEF, FALSE); - const char *defsfile = G_DefFile(); + const char *deffile = G_DefFile(); uint32_t stime = timerGetTicks(); - if (!loaddefinitionsfile(defsfile)) + if (!loaddefinitionsfile(deffile)) { uint32_t etime = timerGetTicks(); - initprintf("Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime-stime); + LOG_F(INFO, "Definitions file \"%s\" loaded in %d ms.", deffile, etime-stime); } - loaddefinitions_game(defsfile, FALSE); + loaddefinitions_game(deffile, FALSE); + powerupInit(); - initprintf("Loading cosine table\n"); + LOG_F(INFO, "Loading cosine table"); trigInit(gSysRes); - initprintf("Initializing view subsystem\n"); + LOG_F(INFO, "Initializing view subsystem"); viewInit(); - initprintf("Initializing dynamic fire\n"); + LOG_F(INFO, "Initializing dynamic fire"); FireInit(); - initprintf("Initializing weapon animations\n"); + LOG_F(INFO, "Initializing weapon animations"); WeaponInit(); LoadSaveSetup(); LoadSavedInfo(); gDemo.LoadDemoInfo(); - initprintf("There are %d demo(s) in the loop\n", gDemo.nDemosFound); - initprintf("Loading control setup\n"); + LOG_F(INFO, "There are %d demo(s) in the loop", gDemo.nDemosFound); + LOG_F(INFO, "Loading control setup"); ctrlInit(); timerInit(CLOCKTICKSPERSECOND); timerSetCallback(ClockStrobe); @@ -1770,13 +1771,13 @@ int app_main(int argc, char const * const * argv) // PORT-TODO: CD audio init - initprintf("Initializing network users\n"); + LOG_F(INFO, "Initializing network users"); netInitialize(true); scrSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp); scrSetGamma(gGamma); viewResizeView(gViewSize); vsync = videoSetVsync(vsync); - initprintf("Initializing sound system\n"); + LOG_F(INFO, "Initializing sound system"); sndInit(); sfxInit(); gChoke.Init(518, playerHandChoke); @@ -1800,7 +1801,7 @@ int app_main(int argc, char const * const * argv) gViewIndex = myconnectindex; gMe = gView = &gPlayer[myconnectindex]; netBroadcastPlayerInfo(myconnectindex); - initprintf("Waiting for network players!\n"); + LOG_F(INFO, "Waiting for network players!"); netWaitForEveryone(0); if (gRestartGame) { @@ -2055,25 +2056,11 @@ static int32_t S_DefineMusic(const char *ID, const char *name) static int parsedefinitions_game(scriptfile *, int); -static void parsedefinitions_game_include(const char *fileName, scriptfile *pScript, const char *cmdtokptr, int const firstPass) +static void parsedefinitions_game_include(const char * fileName, scriptfile * /*pScript*/, const char * /*cmdtokptr*/, int const firstPass) { scriptfile *included = scriptfile_fromfile(fileName); - if (!included) - { - if (!Bstrcasecmp(cmdtokptr,"null") || pScript == NULL) // this is a bit overboard to prevent unused parameter warnings - { - // initprintf("Warning: Failed including %s as module\n", fn); - } -/* - else - { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } -*/ - } - else + if (included) { parsedefinitions_game(included, firstPass); scriptfile_close(included); @@ -2117,16 +2104,15 @@ static void parsedefinitions_game_animsounds(scriptfile *pScript, const char * b // frame numbers start at 1 for us if (frameNum <= 0) { - initprintf("Error: frame number must be greater zero on line %s:%d\n", pScript->filename, - scriptfile_getlinum(pScript, pScript->ltextptr)); + LOG_F(ERROR, "%s:%d: error: frame number must be greater than zero", + pScript->filename, scriptfile_getlinum(pScript, pScript->ltextptr)); break; } if (frameNum < lastFrameNum) { - initprintf("Error: frame numbers must be in (not necessarily strictly)" - " ascending order (line %s:%d)\n", - pScript->filename, scriptfile_getlinum(pScript, pScript->ltextptr)); + LOG_F(ERROR, "%s:%d: error: frame numbers must be in (not necessarily strictly) ascending order", + pScript->filename, scriptfile_getlinum(pScript, pScript->ltextptr)); break; } @@ -2134,8 +2120,9 @@ static void parsedefinitions_game_animsounds(scriptfile *pScript, const char * b if ((unsigned)soundNum >= MAXSOUNDS && soundNum != -1) { - initprintf("Error: sound number #%d invalid on line %s:%d\n", soundNum, pScript->filename, - scriptfile_getlinum(pScript, pScript->ltextptr)); + LOG_F(ERROR, "%s:%d: error: sound number #%d invalid", + pScript->filename, scriptfile_getlinum(pScript, pScript->ltextptr), + soundNum); break; } @@ -2157,13 +2144,13 @@ static void parsedefinitions_game_animsounds(scriptfile *pScript, const char * b if (!defError) { animPtr->numsounds = numPairs; - // initprintf("Defined sound sequence for hi-anim \"%s\" with %d frame/sound pairs\n", + // LOG_F(ERROR, "Defined sound sequence for hi-anim \"%s\" with %d frame/sound pairs", // hardcoded_anim_tokens[animnum].text, numpairs); } else { DO_FREE_AND_NULL(animPtr->sounds); - initprintf("Failed defining sound sequence for anim \"%s\".\n", fileName); + LOG_F(ERROR, "Failed defining sound sequence for anim \"%s\".", fileName); } } @@ -2232,10 +2219,10 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) if (!scriptfile_getstring(pScript,&fileName) && firstPass) { if (initgroupfile(fileName) == -1) - initprintf("Could not find file \"%s\".\n", fileName); + LOG_F(WARNING, "Could not find file \"%s\".", fileName); else { - initprintf("Using file \"%s\" as game data.\n", fileName); + LOG_F(INFO, "Using file \"%s\" as game data.", fileName); if (!bNoAutoLoad && !gSetup.noautoload) G_DoAutoload(fileName); } @@ -2296,8 +2283,8 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) { if (musicID==NULL) { - initprintf("Error: missing ID for music definition near line %s:%d\n", - pScript->filename, scriptfile_getlinum(pScript,tokenPtr)); + LOG_F(ERROR, "%s:%d: error: missing ID for music definition", + pScript->filename, scriptfile_getlinum(pScript, tokenPtr)); break; } @@ -2305,7 +2292,8 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) break; if (S_DefineMusic(musicID, fileName) == -1) - initprintf("Error: invalid music ID on line %s:%d\n", pScript->filename, scriptfile_getlinum(pScript, tokenPtr)); + LOG_F(ERROR, "%s:%d: error: invalid music ID", + pScript->filename, scriptfile_getlinum(pScript, tokenPtr)); } } break; @@ -2424,8 +2412,8 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) { if (EDUKE32_PREDICT_FALSE((unsigned)tile >= MAXUSERTILES)) { - initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n", - pScript->filename, scriptfile_getlinum(pScript,texturetokptr)); + LOG_F(ERROR, "%s:%d: error: missing or invalid 'tile number' for texture definition", + pScript->filename, scriptfile_getlinum(pScript, texturetokptr)); break; } @@ -2434,7 +2422,7 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) int32_t const orig_crc32 = tileGetCRC32(tile); if (orig_crc32 != tile_crc32) { - // initprintf("CRC32 of tile %d doesn't match! CRC32: %d, Expected: %d\n", tile, orig_crc32, tile_crc32); + // LOG_F(INFO, "CRC32 of tile %d doesn't match! CRC32: %d, Expected: %d", tile, orig_crc32, tile_crc32); break; } } @@ -2444,7 +2432,7 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) vec2_16_t const orig_size = tileGetSize(tile); if (orig_size.x != tile_size.x && orig_size.y != tile_size.y) { - // initprintf("Size of tile %d doesn't match! Size: (%d, %d), Expected: (%d, %d)\n", tile, orig_size.x, orig_size.y, tile_size.x, tile_size.y); + // LOG_F(INFO, "Size of tile %d doesn't match! Size: (%d, %d), Expected: (%d, %d)", tile, orig_size.x, orig_size.y, tile_size.x, tile_size.y); break; } } @@ -2551,8 +2539,8 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) if (!animPtr) { - initprintf("Error: expected animation filename on line %s:%d\n", - pScript->filename, scriptfile_getlinum(pScript, tokenPtr)); + LOG_F(ERROR, "%s:%d: error: expected animation filename", + pScript->filename, scriptfile_getlinum(pScript, tokenPtr)); break; } @@ -2596,7 +2584,8 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) { if (soundNum==-1) { - initprintf("Error: missing ID for sound definition near line %s:%d\n", pScript->filename, scriptfile_getlinum(pScript,tokenPtr)); + LOG_F(ERROR, "%s:%d: error: missing ID for sound definition", + pScript->filename, scriptfile_getlinum(pScript, tokenPtr)); break; } @@ -2605,7 +2594,8 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) // maybe I should have just packed this into a sound_t and passed a reference... if (S_DefineSound(soundNum, fileName, minpitch, maxpitch, priority, type, distance, volume) == -1) - initprintf("Error: invalid sound ID on line %s:%d\n", pScript->filename, scriptfile_getlinum(pScript,tokenPtr)); + LOG_F(ERROR, "%s:%d: error: invalid sound ID", + pScript->filename, scriptfile_getlinum(pScript, tokenPtr)); } } break; @@ -2727,7 +2717,7 @@ bool LoadArtFile(const char *pzFile) int hFile = kopen4loadfrommod(pzFile, 0); if (hFile == -1) { - initprintf("Can't open extra art file:\"%s\"\n", pzFile); + LOG_F(ERROR, "Can't open extra art file:\"%s\"", pzFile); return false; } artheader_t artheader; @@ -2735,7 +2725,7 @@ bool LoadArtFile(const char *pzFile) if (nStatus != 0) { kclose(hFile); - initprintf("Error reading extra art file:\"%s\"\n", pzFile); + LOG_F(ERROR, "Error reading extra art file:\"%s\"", pzFile); return false; } for (int i = artheader.tilestart; i <= artheader.tileend; i++) diff --git a/source/blood/src/common.cpp b/source/blood/src/common.cpp index 0632da7396..09bd95b647 100644 --- a/source/blood/src/common.cpp +++ b/source/blood/src/common.cpp @@ -134,7 +134,7 @@ void G_ExtInit(void) i = addsearchpath(CommandPaths->str); if (i < 0) { - initprintf("Failed adding %s for game data: %s\n", CommandPaths->str, + LOG_F(ERROR, "Failed adding %s for game data: %s", CommandPaths->str, i==-1 ? "not a directory" : "no such directory"); } @@ -182,9 +182,9 @@ static int32_t G_TryLoadingGrp(char const * const grpfile) int32_t i; if ((i = initgroupfile(grpfile)) == -1) - initprintf("Warning: could not find main data file \"%s\"!\n", grpfile); + LOG_F(WARNING, "Could not find main data file \"%s\"!", grpfile); else - initprintf("Using \"%s\" as main game data file.\n", grpfile); + LOG_F(INFO, "Using \"%s\" as main game data file.", grpfile); return i; } @@ -238,7 +238,7 @@ void G_LoadGroups(int32_t autoload) { clearDefNamePtr(); g_defNamePtr = dup_filename(tmpptr); - initprintf("Using \"%s\" as definitions file\n", g_defNamePtr); + LOG_F(INFO, "Using \"%s\" as definitions file", g_defNamePtr); } } @@ -257,11 +257,11 @@ void G_LoadGroups(int32_t autoload) s = CommandGrps->next; if ((j = initgroupfile(CommandGrps->str)) == -1) - initprintf("Could not find file \"%s\".\n", CommandGrps->str); + LOG_F(WARNING, "Could not find file \"%s\".", CommandGrps->str); else { g_groupFileHandle = j; - initprintf("Using file \"%s\" as game data.\n", CommandGrps->str); + LOG_F(INFO, "Using file \"%s\" as game data.", CommandGrps->str); if (autoload) G_DoAutoload(CommandGrps->str); } @@ -467,7 +467,7 @@ void G_LoadGroupsInDir(const char *dirname) for (rec=fnlist.findfiles; rec; rec=rec->next) { Bsnprintf(buf, sizeof(buf), "%s/%s", dirname, rec->name); - initprintf("Using group file \"%s\".\n", buf); + LOG_F(INFO, "Using group file \"%s\".", buf); initgroupfile(buf); } diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index 4d53796405..882786bc97 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -220,7 +220,7 @@ void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN], bool lazy/*=fal { #if 0 // defined(DEBUGGINGAIDS) if (key[0] != 0xff) - initprintf("Skipping %s bound to %s\n", keyptr[i<<1], CONTROL_KeyBinds[default0].cmdstr); + LOG_F(INFO, "Skipping %s bound to %s", keyptr[i<<1], CONTROL_KeyBinds[default0].cmdstr); #endif continue; } @@ -759,7 +759,7 @@ int CONFIG_ReadSetup(void) { if ((st.st_mode & S_IFDIR) != S_IFDIR) { - initprintf("Invalid mod dir in cfg!\n"); + LOG_F(ERROR, "Invalid mod dir in cfg!"); Bsprintf(g_modDir,"/"); } } diff --git a/source/blood/src/db.cpp b/source/blood/src/db.cpp index 2d34046e40..baa4ee6d19 100644 --- a/source/blood/src/db.cpp +++ b/source/blood/src/db.cpp @@ -699,7 +699,7 @@ unsigned int dbReadMapCRC(const char *pPath) if (!pNode) { - initprintf("Error opening map file %s", pPath); + LOG_F(ERROR, "Error opening map file %s", pPath); pathsearchmode = bakpathsearchmode; return -1; } @@ -785,7 +785,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short if (!pNode) { - initprintf("Error opening map file %s", pPath); + LOG_F(ERROR, "Error opening map file %s", pPath); pathsearchmode = bakpathsearchmode; return -1; } @@ -800,7 +800,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short #endif if (memcmp(header.signature, "BLM\x1a", 4)) { - initprintf("Map file corrupted"); + LOG_F(ERROR, "Map file corrupted"); gSysRes.Unlock(pNode); return -1; } @@ -826,7 +826,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short #endif } else { - initprintf("Map file is wrong version"); + LOG_F(ERROR, "Map file is wrong version"); gSysRes.Unlock(pNode); return -1; } @@ -876,14 +876,14 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short } else { - initprintf("Corrupted Map file"); + LOG_F(ERROR, "Corrupted Map file"); gSysRes.Unlock(pNode); return -1; } } else if (mapHeader.at16) { - initprintf("Corrupted Map file"); + LOG_F(ERROR, "Corrupted Map file"); gSysRes.Unlock(pNode); return -1; } @@ -1266,7 +1266,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short md4once((unsigned char*)pData, nSize, g_loadedMapHack.md4); if (Bcrc32(pData, nSize-4, 0) != nCRC) { - initprintf("Map File does not match CRC"); + LOG_F(ERROR, "Map File does not match CRC"); gSysRes.Unlock(pNode); return -1; } @@ -1286,13 +1286,13 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short } else { - initprintf("Corrupted Map file"); + LOG_F(ERROR, "Corrupted Map file"); return -1; } } else if (gSongId != 0) { - initprintf("Corrupted Map file"); + LOG_F(ERROR, "Corrupted Map file"); return -1; } @@ -1704,13 +1704,13 @@ int dbSaveMap(const char *pPath, int nX, int nY, int nZ, short nAngle, short nSe int nHandle = Bopen(sMapExt, BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY, BS_IREAD|BS_IWRITE); if (nHandle == -1) { - initprintf("Couldn't open \"%s\" for writing: %s\n", sMapExt, strerror(errno)); + LOG_F(ERROR, "Couldn't open \"%s\" for writing: %s", sMapExt, strerror(errno)); Xfree(pData); return -1; } if (Bwrite(nHandle, pData, nSize) != nSize) { - initprintf("Couldn't write to \"%s\": %s\n", sMapExt, strerror(errno)); + LOG_F(ERROR, "Couldn't write to \"%s\": %s", sMapExt, strerror(errno)); Bclose(nHandle); Xfree(pData); return -1; diff --git a/source/blood/src/globals.cpp b/source/blood/src/globals.cpp index ce801ec3e3..1748d9f99b 100644 --- a/source/blood/src/globals.cpp +++ b/source/blood/src/globals.cpp @@ -59,7 +59,7 @@ void _ThrowError(const char *pzFormat, ...) va_list args; va_start(args, pzFormat); vsprintf(buffer, pzFormat, args); - initprintf("%s(%i): %s\n", _module, _line, buffer); + LOG_F(ERROR, "%s(%i): %s", _module, _line, buffer); #ifdef WM_MSGBOX_WINDOW char titlebuf[256]; @@ -84,7 +84,7 @@ void _consoleSysMsg(const char* pzFormat, ...) { void __dassert(const char * pzExpr, const char * pzFile, int nLine) { - initprintf("Assertion failed: %s in file %s at line %i\n", pzExpr, pzFile, nLine); + LOG_F(ERROR, "Assertion failed: %s in file %s at line %i", pzExpr, pzFile, nLine); #ifdef WM_MSGBOX_WINDOW char titlebuf[256]; diff --git a/source/blood/src/mapedit.cpp b/source/blood/src/mapedit.cpp index 866aca648a..a94d2e5eb7 100644 --- a/source/blood/src/mapedit.cpp +++ b/source/blood/src/mapedit.cpp @@ -3606,11 +3606,11 @@ static void ReadHelpFile(const char *name) helppage_t *hp; char skip=0; - initprintf("Loading \"%s\"\n",name); + LOG_F(INFO, "Loading \"%s\"",name); if ((fp=fopenfrompath(name,"rb")) == NULL) { - initprintf("Error initializing integrated help: file \"%s\" not found.\n", name); + LOG_F(ERROR, "Error initializing integrated help: file \"%s\" not found.", name); return; } @@ -8623,7 +8623,7 @@ static void Keys3d(void) dx = -dx; dx /= 1<<((picsiz[tile]&15) - !!(bits&8)); dy /= 1<<((picsiz[tile]>>4) - !!(bits&8)); -//initprintf("int=(%d,%d), dx=%.03f dy=%.03f\n", intx,inty, dx, dy); +//LOG_F(INFO, "int=(%d,%d), dx=%.03f dy=%.03f", intx,inty, dx, dy); CEILINGFLOOR(searchsector, xpanning) = CEILINGFLOOR(tempsectornum, xpanning) + (int32_t)dx; CEILINGFLOOR(searchsector, ypanning) = @@ -10101,7 +10101,7 @@ int32_t ExtPreSaveMap(void) if (wall[j].point2 < startwall) startwall = wall[j].point2; if (sector[i].wallptr != startwall) - initprintf("Warning: set sector %d's wallptr to %d (was %d)\n", i, + LOG_F(WARNING, "set sector %d's wallptr to %d (was %d)", i, TrackerCast(sector[i].wallptr), startwall); sector[i].wallptr = startwall; } @@ -10280,7 +10280,7 @@ static void G_CheckCommandLine(int32_t argc, char const * const * argv) if (sz >= 16<<10 && sz <= 1024<<10) { MAXCACHE1DSIZE = sz<<10; - initprintf("Cache size: %dkB\n",sz); + LOG_F(INFO, "Cache size: %dkB",sz); COPYARG(i); COPYARG(i+1); @@ -10422,21 +10422,21 @@ static void G_CheckCommandLine(int32_t argc, char const * const * argv) //} if (!Bstrcasecmp(c+1,"check")) { - initprintf("Map wall checking on save enabled\n"); + LOG_F(INFO, "Map wall checking on save enabled"); fixmaponsave_walls = 1; i++; continue; } if (!Bstrcasecmp(c+1,"nocheck")) { - initprintf("Map wall checking on save disabled\n"); + LOG_F(INFO, "Map wall checking on save disabled"); fixmaponsave_walls = 0; i++; continue; } if (!Bstrcasecmp(c+1,"noautoload")) { - initprintf("Autoload disabled\n"); + LOG_F(INFO, "Autoload disabled"); NoAutoLoad = 1; COPYARG(i); i++; @@ -10572,7 +10572,7 @@ int32_t ExtPreInit(int32_t argc,char const * const * argv) OSD_SetLogFile("nmapedit.log"); OSD_SetVersion("NMapedit",0,2); - initprintf("NMapedit %s\n", s_buildRev); + LOG_F(INFO, "NMapedit %s", s_buildRev); PrintBuildInfo(); G_CheckCommandLine(argc,argv); @@ -11368,10 +11368,11 @@ static void parsegroupfiles_include(const char *fn, scriptfile *script, const ch if (!included) { if (!Bstrcasecmp(cmdtokptr,"null")) - initprintf("Warning: Failed including %s as module\n", fn); + LOG_F(WARNING, "warning: failed including %s as module", fn); else - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); + LOG_F(WARNING, "%s:%d: warning: failed including %s", + script->filename, scriptfile_getlinum(script, cmdtokptr) + fn); } else { @@ -11413,10 +11414,10 @@ static int32_t parsegroupfiles(scriptfile *script) int32_t j = initgroupfile(fn); if (j == -1) - initprintf("Could not find group file \"%s\".\n",fn); + LOG_F(WARNING, "Could not find group file \"%s\".",fn); else { - initprintf("Using group file \"%s\".\n",fn); + LOG_F(INFO, "Using group file \"%s\".",fn); if (!NoAutoLoad) G_DoAutoload(fn); } @@ -11521,8 +11522,9 @@ int32_t parsetilegroups(scriptfile *script) included = scriptfile_fromfile(fn); if (!included) { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); + LOG_F(WARNING, "%s:%d: warning: failed including %s", + script->filename, scriptfile_getlinum(script, cmdtokptr) + fn); } else { @@ -11540,8 +11542,9 @@ int32_t parsetilegroups(scriptfile *script) if (scriptfile_getstring(script,&name)) break; if (scriptfile_getsymbol(script,&number)) break; if (scriptfile_addsymbolvalue(name,number) < 0) - initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", - name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); + LOG_F(WARNING, "%s:%d: warning: symbol %s was NOT redefined to %d", + script->filename, scriptfile_getlinum(script, cmdtokptr) + name, number); break; } case T_TILEGROUP: @@ -11848,7 +11851,7 @@ static void m32script_interrupt_handler(int signo) static void M32_HandleMemErr(int32_t line, const char *file, const char *func) { - initprintf("Out of memory in %s:%d (%s)\n", file, line, func); + LOG_F(ERROR, "Out of memory in %s:%d (%s)", file, line, func); osdcmd_quit(NULL); } @@ -11869,10 +11872,10 @@ int32_t ExtInit(void) //#ifdef USE_OPENGL if (Bstrcmp(setupfilename, SETUPFILENAME)) - initprintf("Using config file \"%s\".\n",setupfilename); + LOG_F(INFO, "Using config file \"%s\".",setupfilename); if (loadsetup(setupfilename) < 0) - initprintf("Configuration file not found, using defaults.\n"), rv = 1; + LOG_F(INFO, "Configuration file not found, using defaults."), rv = 1; //#endif Bmemcpy(buildkeys, default_buildkeys, NUMBUILDKEYS); //Trick to make build use setup.dat keys @@ -11965,7 +11968,7 @@ int32_t ExtPostStartupWindow(void) artLoadFiles("TILES%03i.ART", MAXCACHE1DSIZE); //if (engineInit()) //{ - // initprintf("There was a problem initializing the engine.\n"); + // LOG_F(ERROR, "There was a problem initializing the engine."); // return -1; //} @@ -11988,7 +11991,7 @@ int32_t ExtPostStartupWindow(void) if (i != 0) { Em_DestroyState(&g_EmState); - initprintf("Lunatic: Error preparing global Lua state (code %d)\n", i); + LOG_F(ERROR, "Lunatic: Error preparing global Lua state (code %d)", i); return -1; } } diff --git a/source/blood/src/network.cpp b/source/blood/src/network.cpp index a0792d0fed..f71ced99a8 100644 --- a/source/blood/src/network.cpp +++ b/source/blood/src/network.cpp @@ -901,7 +901,7 @@ void netInitialize(bool bConsole) } if (enet_initialize() != 0) { - initprintf("An error occurred while initializing ENet.\n"); + LOG_F(ERROR, "An error occurred while initializing ENet."); netResetToSinglePlayer(); return; } @@ -914,7 +914,7 @@ void netInitialize(bool bConsole) gNetENetServer = enet_host_create(&gNetENetAddress, 8, BLOOD_ENET_CHANNEL_MAX, 0, 0); if (!gNetENetServer) { - initprintf("An error occurred while trying to create an ENet server host.\n"); + LOG_F(ERROR, "An error occurred while trying to create an ENet server host."); netDeinitialize(); netResetToSinglePlayer(); return; @@ -954,7 +954,7 @@ void netInitialize(bool bConsole) char ipaddr[32]; enet_address_get_host_ip(&event.peer->address, ipaddr, sizeof(ipaddr)); - initprintf("Client connected: %s:%u\n", ipaddr, event.peer->address.port); + LOG_F(INFO, "Client connected: %s:%u", ipaddr, event.peer->address.port); numplayers++; for (int i = 1; i < kMaxPlayers; i++) { @@ -978,7 +978,7 @@ void netInitialize(bool bConsole) char ipaddr[32]; enet_address_get_host_ip(&event.peer->address, ipaddr, sizeof(ipaddr)); - initprintf("Client disconnected: %s:%u\n", ipaddr, event.peer->address.port); + LOG_F(INFO, "Client disconnected: %s:%u", ipaddr, event.peer->address.port); numplayers--; for (int i = 1; i < kMaxPlayers; i++) { @@ -1011,7 +1011,7 @@ void netInitialize(bool bConsole) } enet_host_service(gNetENetServer, NULL, 0); } - initprintf("All clients connected\n"); + LOG_F(INFO, "All clients connected"); dassert(numplayers >= 1); @@ -1059,7 +1059,7 @@ void netInitialize(bool bConsole) { ENetEvent event; sprintf(buffer, "Connecting to %s:%u", gNetAddress, gNetPort); - initprintf("%s\n", buffer); + LOG_F(INFO, "%s", buffer); if (!bConsole) { viewLoadingScreen(gMenuPicnum, "Network Game", NULL, buffer); @@ -1071,16 +1071,16 @@ void netInitialize(bool bConsole) gNetENetPeer = enet_host_connect(gNetENetClient, &gNetENetAddress, BLOOD_ENET_CHANNEL_MAX, 0); if (!gNetENetPeer) { - initprintf("No available peers for initiating an ENet connection.\n"); + LOG_F(ERROR, "No available peers for initiating an ENet connection."); netDeinitialize(); netResetToSinglePlayer(); return; } if (enet_host_service(gNetENetClient, &event, 5000) > 0 && event.type == ENET_EVENT_TYPE_CONNECT) - initprintf("Connected to %s:%i\n", gNetAddress, gNetPort); + LOG_F(INFO, "Connected to %s:%i", gNetAddress, gNetPort); else { - initprintf("Could not connect to %s:%i\n", gNetAddress, gNetPort); + LOG_F(ERROR, "Could not connect to %s:%i", gNetAddress, gNetPort); netDeinitialize(); netResetToSinglePlayer(); return; @@ -1112,12 +1112,12 @@ void netInitialize(bool bConsole) switch (event.type) { case ENET_EVENT_TYPE_DISCONNECT: - initprintf("Lost connection to server\n"); + LOG_F(ERROR, "Lost connection to server"); netDeinitialize(); netResetToSinglePlayer(); return; case ENET_EVENT_TYPE_RECEIVE: - //initprintf("NETEVENT\n"); + //LOG_F(INFO, "NETEVENT"); if (event.channelID == BLOOD_ENET_SERVICE) { char *pPacket = (char*)event.packet->data; @@ -1130,14 +1130,14 @@ void netInitialize(bool bConsole) connecthead = connectinfo->connecthead; for (int i = 0; i < numplayers; i++) connectpoint2[i] = connectinfo->connectpoint2[i]; - //initprintf("BLOOD_SERVICE_CONNECTINFO\n"); + //LOG_F(INFO, "BLOOD_SERVICE_CONNECTINFO"); break; } case BLOOD_SERVICE_CONNECTID: dassert(numplayers > 1); myconnectindex = GetPacketByte(pPacket); bWaitServer = false; - //initprintf("BLOOD_SERVICE_CONNECTID\n"); + //LOG_F(INFO, "BLOOD_SERVICE_CONNECTID"); break; } } @@ -1149,7 +1149,7 @@ void netInitialize(bool bConsole) } } enet_host_service(gNetENetClient, NULL, 0); - initprintf("Successfully connected to server\n"); + LOG_F(INFO, "Successfully connected to server"); } gNetENetInit = true; gGameOptions.nGameType = kGameTypeBloodBath; @@ -1184,7 +1184,7 @@ void netDeinitialize(void) void netPostEPacket(ENetPacket *pEPacket) { //static int number; - //initprintf("netPostEPacket %i\n", number++); + //LOG_F(INFO, "netPostEPacket %i", number++); gNetPacketFifo[gNetPacketHead] = pEPacket; gNetPacketHead = (gNetPacketHead+1)%kENetFifoSize; } @@ -1274,7 +1274,7 @@ void netUpdate(void) switch (event.type) { case ENET_EVENT_TYPE_DISCONNECT: - initprintf("Lost connection to server\n"); + LOG_F(ERROR, "Lost connection to server"); netDeinitialize(); netResetToSinglePlayer(); gQuitGame = gRestartGame = true; diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index 5c77a8d22d..c3348cda31 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -306,7 +306,7 @@ static int osdcmd_vidmode(osdcmdptr_t parm) if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor)) { - initprintf("vidmode: Mode change failed!\n"); + LOG_F(ERROR, "vidmode: Mode change failed!"); if (videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, upscalefactor)) ThrowError("vidmode: Reset failed!\n"); } diff --git a/source/blood/src/screen.cpp b/source/blood/src/screen.cpp index 8e956333f8..1ed4f96f36 100644 --- a/source/blood/src/screen.cpp +++ b/source/blood/src/screen.cpp @@ -207,7 +207,7 @@ void scrLoadPalette(void) paletteInitClosestColorScale(30, 59, 11); paletteInitClosestColorGrid(); paletteloaded = 0; - initprintf("Loading palettes\n"); + LOG_F(INFO, "Loading palettes"); for (int i = 0; i < 5; i++) { DICTNODE *pPal = gSysRes.Lookup(PAL[i].name, "PAL"); @@ -221,7 +221,7 @@ void scrLoadPalette(void) paletteloaded |= PALETTE_MAIN; scrLoadPLUs(); paletteloaded |= PALETTE_SHADE; - initprintf("Loading translucency table\n"); + LOG_F(INFO, "Loading translucency table"); DICTNODE *pTrans = gSysRes.Lookup("TRANS", "TLU"); if (!pTrans) ThrowError("TRANS.TLU not found"); @@ -299,14 +299,14 @@ void scrSetDac(void) void scrInit(void) { - initprintf("Initializing engine\n"); + LOG_F(INFO, "Initializing engine"); #ifdef USE_OPENGL glrendmode = REND_POLYMOST; #endif engineInit(); curPalette = 0; curGamma = 0; - initprintf("Loading gamma correction table\n"); + LOG_F(INFO, "Loading gamma correction table"); DICTNODE *pGamma = gSysRes.Lookup("gamma", "DAT"); if (!pGamma) ThrowError("Gamma table not found"); @@ -328,7 +328,7 @@ void scrSetGameMode(int vidMode, int XRes, int YRes, int nBits) //videoSetGameMode(vidMode, XRes, YRes, nBits, 0); if (videoSetGameMode(vidMode, XRes, YRes, nBits, 0) < 0) { - initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", XRes, YRes, + LOG_F(ERROR, "Failure setting video mode %dx%dx%d %s! Trying next mode...", XRes, YRes, nBits, vidMode ? "fullscreen" : "windowed"); int resIdx = 0; @@ -347,7 +347,7 @@ void scrSetGameMode(int vidMode, int XRes, int YRes, int nBits) while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, 0) < 0) { - initprintf("Failure setting video mode %dx%dx%d windowed! Trying next mode...\n", + LOG_F(ERROR, "Failure setting video mode %dx%dx%d windowed! Trying next mode...", validmode[resIdx].xdim, validmode[resIdx].ydim, bpp); if (++resIdx == validmodecnt) diff --git a/source/blood/src/sound.cpp b/source/blood/src/sound.cpp index dbadd22ec6..2ba199b89c 100644 --- a/source/blood/src/sound.cpp +++ b/source/blood/src/sound.cpp @@ -452,7 +452,7 @@ void InitSoundDevice(void) nStatus = FX_Init(NumVoices, NumChannels, MixRate, initdata); if (nStatus != 0) { - initprintf("InitSoundDevice: %s\n", FX_ErrorString(nStatus)); + LOG_F(ERROR, "InitSoundDevice: %s", FX_ErrorString(nStatus)); return; } #ifdef ASS_REVERSESTEREO @@ -507,7 +507,7 @@ void InitMusicDevice(void) } else if ((nStatus = MUSIC_Init(ASS_AutoDetect)) == MUSIC_Ok) { - initprintf("InitMusicDevice: %s\n", MUSIC_ErrorString(nStatus)); + LOG_F(ERROR, "InitMusicDevice: %s", MUSIC_ErrorString(nStatus)); return; } MUSIC_SetVolume(MusicVolume); diff --git a/source/blood/src/tile.cpp b/source/blood/src/tile.cpp index 3dfd6573e3..85f2d13c36 100644 --- a/source/blood/src/tile.cpp +++ b/source/blood/src/tile.cpp @@ -41,7 +41,7 @@ void qloadvoxel(int32_t nVoxel) static int nLastVoxel = 0; DICTNODE *hVox = gSysRes.Lookup(nVoxel, "KVX"); if (!hVox) { - initprintf("Missing voxel #%d (max voxels: %d)", nVoxel, kMaxVoxels); + LOG_F(ERROR, "Missing voxel #%d (max voxels: %d)", nVoxel, kMaxVoxels); return; } diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index cceec90ce6..64df33d410 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -1909,7 +1909,7 @@ int dword_172CE0[16][3]; void viewInit(void) { - initprintf("Initializing status bar\n"); + LOG_F(INFO, "Initializing status bar"); InitStatusBar(); FontSet(0, 4096, 0); FontSet(1, 4192, 1); diff --git a/source/blood/src/winbits.cpp b/source/blood/src/winbits.cpp index 235c861576..27ba0359df 100644 --- a/source/blood/src/winbits.cpp +++ b/source/blood/src/winbits.cpp @@ -57,7 +57,7 @@ int32_t G_GetVersionFromWebsite(char *buffer) if ((h = gethostbyname(host)) == NULL) { - initprintf("Couldn't resolve %s!\n", host); + LOG_F(ERROR, "Couldn't resolve %s!", host); return 0; } @@ -75,7 +75,7 @@ int32_t G_GetVersionFromWebsite(char *buffer) return 0; } - initprintf("Connecting to http://%s\n",host); + LOG_F(INFO, "Connecting to http://%s",host); if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) goto done; diff --git a/source/exhumed/src/common.cpp b/source/exhumed/src/common.cpp index 9794f2c813..50d1fd33a8 100644 --- a/source/exhumed/src/common.cpp +++ b/source/exhumed/src/common.cpp @@ -115,7 +115,7 @@ void G_ExtInit(void) i = addsearchpath(CommandPaths->str); if (i < 0) { - initprintf("Failed adding %s for game data: %s\n", CommandPaths->str, + LOG_F(ERROR, "Failed adding %s for game data: %s", CommandPaths->str, i == -1?"not a directory":"no such directory"); } @@ -184,9 +184,9 @@ static int32_t G_TryLoadingGrp(char const* const grpfile) int32_t i; if ((i = initgroupfile(grpfile)) == -1) - initprintf("Warning: could not find main data file \"%s\"!\n", grpfile); + LOG_F(WARNING, "could not find main data file \"%s\"!", grpfile); else - initprintf("Using \"%s\" as main game data file.\n", grpfile); + LOG_F(INFO, "Using \"%s\" as main game data file.", grpfile); return i; } @@ -282,11 +282,11 @@ void G_LoadGroups(int32_t autoload) s = CommandGrps->next; if ((j = initgroupfile(CommandGrps->str)) == -1) - initprintf("Could not find file \"%s\".\n", CommandGrps->str); + LOG_F(WARNING, "Could not find file \"%s\".", CommandGrps->str); else { g_groupFileHandle = j; - initprintf("Using file \"%s\" as game data.\n", CommandGrps->str); + LOG_F(INFO, "Using file \"%s\" as game data.", CommandGrps->str); if (autoload) G_DoAutoload(CommandGrps->str); } @@ -466,7 +466,7 @@ void G_LoadGroupsInDir(const char* dirname) for (rec = fnlist.findfiles; rec; rec = rec->next) { Bsnprintf(buf, sizeof(buf), "%s/%s", dirname, rec->name); - initprintf("Using group file \"%s\".\n", buf); + LOG_F(INFO, "Using group file \"%s\".", buf); initgroupfile(buf); } diff --git a/source/exhumed/src/config.cpp b/source/exhumed/src/config.cpp index b4b4dd2286..6b0ab87b99 100644 --- a/source/exhumed/src/config.cpp +++ b/source/exhumed/src/config.cpp @@ -417,7 +417,7 @@ void CONFIG_SetDefaultKeys(const char (*keyptr)[kMaxGameFuncLen], bool lazy/*=fa { #if 0 // defined(DEBUGGINGAIDS) if (key[0] != 0xff) - initprintf("Skipping %s bound to %s\n", keyptr[i<<1], CONTROL_KeyBinds[default0].cmdstr); + LOG_F(INFO, "Skipping %s bound to %s", keyptr[i<<1], CONTROL_KeyBinds[default0].cmdstr); #endif continue; } @@ -581,7 +581,7 @@ int CONFIG_ReadSetup() if (!buildvfs_isdir(g_modDir)) { - initprintf("Invalid mod dir in cfg!\n"); + LOG_F(ERROR, "Invalid mod dir in cfg!"); Bsprintf(g_modDir,"/"); } } diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 133ce826e0..f55b966a02 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -502,25 +502,11 @@ int exhumed_globalflags; static int parsedefinitions_game(scriptfile *, int); -static void parsedefinitions_game_include(const char *fileName, scriptfile *pScript, const char *cmdtokptr, int const firstPass) +static void parsedefinitions_game_include(const char * fileName, scriptfile * /*pScript*/, const char * /*cmdtokptr*/, int const firstPass) { scriptfile *included = scriptfile_fromfile(fileName); - if (!included) - { - if (!Bstrcasecmp(cmdtokptr,"null") || pScript == NULL) // this is a bit overboard to prevent unused parameter warnings - { - // initprintf("Warning: Failed including %s as module\n", fn); - } -/* - else - { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } -*/ - } - else + if (included) { parsedefinitions_game(included, firstPass); scriptfile_close(included); @@ -560,10 +546,10 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass) if (!scriptfile_getstring(pScript,&fileName) && firstPass) { if (initgroupfile(fileName) == -1) - initprintf("Could not find file \"%s\".\n", fileName); + LOG_F(WARNING, "Could not find file \"%s\".", fileName); else { - initprintf("Using file \"%s\" as game data.\n", fileName); + LOG_F(INFO, "Using file \"%s\" as game data.", fileName); if (!g_noAutoLoad && !gSetup.noautoload) G_DoAutoload(fileName); } @@ -767,7 +753,7 @@ void DebugOut(const char *fmt, ...) vsprintf(debugBuffer, fmt, args); - initprintf("%s", debugBuffer); + LOG_F(INFO, "%s", debugBuffer); fflush(stdout); va_end(args); @@ -802,7 +788,7 @@ void bail2dos(const char *fmt, ...) setvmode(3); #endif - initputs("bailed to dos\n"); + LOG_F(INFO, "bailed to dos"); va_list args; va_start(args, fmt); @@ -811,10 +797,10 @@ void bail2dos(const char *fmt, ...) va_end(args); - initputs(buf); - if (*buf != 0) { + LOG_F(INFO, "%s", buf); + if (!(buf[0] == ' ' && buf[1] == 0)) { char titlebuf[256]; @@ -1877,7 +1863,7 @@ int app_main(int argc, char const* const* argv) wm_setapptitle(APPNAME); - initprintf("Exhumed %s\n", s_buildRev); + LOG_F(INFO, "Exhumed %s", s_buildRev); PrintBuildInfo(); int i; @@ -1922,7 +1908,7 @@ int app_main(int argc, char const* const* argv) bRecord = kTrue; } else { - initprintf("Can't open demo file DATA.VCR for recording\n"); + LOG_F(ERROR, "Can't open demo file DATA.VCR for recording"); } } } @@ -1936,7 +1922,7 @@ int app_main(int argc, char const* const* argv) doTitle = kFalse; } else { - initprintf("Can't open demo file DATA.VCR for playback\n"); + LOG_F(ERROR, "Can't open demo file DATA.VCR for playback"); } } } @@ -2012,7 +1998,7 @@ int app_main(int argc, char const* const* argv) } else if (Bstrcasecmp(pChar, "noautoload") == 0) { - initprintf("Autoload disabled\n"); + LOG_F(INFO, "Autoload disabled"); g_noAutoLoad = 1; } else if (Bstrcasecmp(pChar, "cachesize") == 0) @@ -2021,7 +2007,7 @@ int app_main(int argc, char const* const* argv) { uint32_t j = Batol(argv[i + 1]); MAXCACHE1DSIZE = j << 10; - initprintf("Cache size: %dkB\n", j); + LOG_F(INFO, "Cache size: %dkB", j); i++; } } @@ -2081,7 +2067,7 @@ int app_main(int argc, char const* const* argv) doTitle = kFalse; - initprintf("Jumping to level %d...\n", levelnew); + LOG_F(INFO, "Jumping to level %d...", levelnew); } break; } @@ -2102,7 +2088,7 @@ int app_main(int argc, char const* const* argv) G_AddSearchPaths(); #if defined(RENDERTYPEWIN) && defined(USE_OPENGL) - if (forcegl) initprintf("GL driver blacklist disabled.\n"); + if (forcegl) LOG_F(INFO, "GL driver blacklist disabled."); #endif // used with binds for fast function lookup @@ -2129,7 +2115,7 @@ int app_main(int argc, char const* const* argv) } if (Bstrcmp(setupfilename, kSetupFilename)) - initprintf("Using config file \"%s\".\n",setupfilename); + LOG_F(INFO, "Using config file \"%s\".",setupfilename); G_ScanGroups(); @@ -2211,7 +2197,7 @@ int app_main(int argc, char const* const* argv) CONFIG_WriteSetup(1); CONFIG_ReadSetup(); - initprintf("Initializing OSD...\n"); + LOG_F(INFO, "Initializing OSD..."); Bsprintf(buffer, "Exhumed %s", s_buildRev); OSD_SetVersion(buffer, 10,0); @@ -2271,7 +2257,7 @@ int app_main(int argc, char const* const* argv) { AbortNetworkPlay(); DebugOut("Network play aborted\n"); - initprintf("Network play aborted\n"); + LOG_F(INFO, "Network play aborted"); nWaitTicks = 60; } @@ -2283,14 +2269,14 @@ int app_main(int argc, char const* const* argv) // temp - moving InstallEngine(); before FadeOut as we use nextpage() in FadeOut InstallEngine(); - const char *defsfile = G_DefFile(); + const char *deffile = G_DefFile(); uint32_t stime = timerGetTicks(); - if (!loaddefinitionsfile(defsfile)) + if (!loaddefinitionsfile(deffile)) { uint32_t etime = timerGetTicks(); - initprintf("Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime-stime); + LOG_F(INFO, "Definitions file \"%s\" loaded in %d ms.", deffile, etime-stime); } - loaddefinitions_game(defsfile, FALSE); + loaddefinitions_game(deffile, FALSE); if (enginePostInit()) @@ -3335,6 +3321,6 @@ void PrintHelp() Bsnprintf(tempbuf, sizeof(tempbuf), APPNAME " %s", s_buildRev); wm_msgbox(tempbuf, s); #else - initprintf("%s\n", s); + LOG_F(INFO, "%s", s); #endif } diff --git a/source/exhumed/src/grpscan.cpp b/source/exhumed/src/grpscan.cpp index 9e711f1c64..303b269766 100644 --- a/source/exhumed/src/grpscan.cpp +++ b/source/exhumed/src/grpscan.cpp @@ -365,7 +365,7 @@ static void ProcessGroups(BUILDVFS_FIND_REC *srch) } while (b == ReadSize); close(fh); - initprintf(" Done\n"); + LOG_F(INFO, " Done"); grpinfo_t const * const grptype = FindGrpInfo(crcval, st.st_size); if (grptype) @@ -396,7 +396,7 @@ int32_t ScanGroups(void) #ifndef USE_PHYSFS struct grpcache *fg, *fgg; - initprintf("Searching for game data...\n"); + LOG_F(INFO, "Searching for game data..."); LoadGameList(); LoadGroupsCache(); @@ -423,7 +423,7 @@ int32_t ScanGroups(void) { if (FindGroup(grp->type->dependency) == NULL) // couldn't find dependency { - //initprintf("removing %s\n", grp->name); + //LOG_F(INFO, "removing %s", grp->name); RemoveGroup(grp); grp = foundgrps; // start from the beginning so we can remove anything that depended on this grp @@ -447,12 +447,12 @@ int32_t ScanGroups(void) } buildvfs_fclose(fp); } -// initprintf("Found %d recognized GRP %s.\n",i,i>1?"files":"file"); +// LOG_F(INFO, "Found %d recognized GRP %s.",i,i>1?"files":"file"); return 0; } - initprintf("Found no recognized game data!\n"); + LOG_F(WARNING, "Found no recognized game data!"); #endif return 0; diff --git a/source/exhumed/src/init.cpp b/source/exhumed/src/init.cpp index 37443d1bb6..939fbb347b 100644 --- a/source/exhumed/src/init.cpp +++ b/source/exhumed/src/init.cpp @@ -479,7 +479,7 @@ void InstallEngine() } if (videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, 0) < 0) { - initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", gSetup.xdim, gSetup.ydim, + LOG_F(ERROR, "Failure setting video mode %dx%dx%d %s! Trying next mode...", gSetup.xdim, gSetup.ydim, gSetup.bpp, gSetup.fullscreen ? "fullscreen" : "windowed"); int resIdx = 0; @@ -498,7 +498,7 @@ void InstallEngine() while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, 0) < 0) { - initprintf("Failure setting video mode %dx%dx%d windowed! Trying next mode...\n", + LOG_F(ERROR, "Failure setting video mode %dx%dx%d windowed! Trying next mode...", validmode[resIdx].xdim, validmode[resIdx].ydim, bpp); if (++resIdx == validmodecnt) diff --git a/source/exhumed/src/light.cpp b/source/exhumed/src/light.cpp index 48df3ec25e..d0c23fff85 100644 --- a/source/exhumed/src/light.cpp +++ b/source/exhumed/src/light.cpp @@ -73,7 +73,7 @@ void MyLoadPalette() //int hFile = kopen4load("PALETTE.DAT", 1); //if (hFile == -1) //{ - // initprintf("Error reading palette 'PALETTE.DAT'\n"); + // LOG_F(ERROR, "Error reading palette 'PALETTE.DAT'"); // return; //} // @@ -93,7 +93,7 @@ int LoadPaletteLookups() int hFile = kopen4loadfrommod(GradList[i], 0); if (hFile == -1) { - initprintf("Error reading palette lookup '%s'\n", GradList[i]); + LOG_F(ERROR, "Error reading palette lookup '%s'", GradList[i]); return 0; } diff --git a/source/exhumed/src/osdcmds.cpp b/source/exhumed/src/osdcmds.cpp index 8ff574b006..e25a8cd333 100644 --- a/source/exhumed/src/osdcmds.cpp +++ b/source/exhumed/src/osdcmds.cpp @@ -152,7 +152,7 @@ static int osdcmd_vidmode(osdcmdptr_t parm) if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor)) { - initprintf("vidmode: Mode change failed!\n"); + LOG_F(ERROR, "vidmode: Mode change failed!"); if (videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, upscalefactor)) bail2dos("vidmode: Reset failed!\n"); } diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index 212dfd02a3..14d6fef727 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -1126,7 +1126,7 @@ void DoKenTest() int nSector = sprite[nPlayerSprite].sectnum; if ((unsigned int)nSector >= kMaxSectors) { - initprintf("DoKenTest: (unsigned int)nSector >= kMaxSectors\n"); + LOG_F(INFO, "DoKenTest: (unsigned int)nSector >= kMaxSectors"); return; } diff --git a/source/exhumed/src/sequence.cpp b/source/exhumed/src/sequence.cpp index c158cb6e1a..bd9d6304af 100644 --- a/source/exhumed/src/sequence.cpp +++ b/source/exhumed/src/sequence.cpp @@ -173,7 +173,7 @@ int seq_ReadSequence(const char *seqName) int hFile = kopen4loadfrommod(buffer, 0); if (hFile == -1) { - initprintf("Unable to open '%s'!\n", buffer); + LOG_F(ERROR, "Unable to open '%s'!", buffer); kclose(hFile); return 0; } @@ -185,7 +185,7 @@ int seq_ReadSequence(const char *seqName) #endif if (tag < 'HI' || tag > 'HI' && tag != 'SD') { - initprintf("Unsupported sequence version!\n"); + LOG_F(ERROR, "Unsupported sequence version!"); kclose(hFile); return 0; } @@ -205,7 +205,7 @@ int seq_ReadSequence(const char *seqName) { if (nSeqs < 0) { - initprintf("Invalid sequence count!\n"); + LOG_F(ERROR, "Invalid sequence count!"); kclose(hFile); return 0; } @@ -240,7 +240,7 @@ int seq_ReadSequence(const char *seqName) { if (nFrames < 0 ) { - initprintf("Invalid frame count!\n"); + LOG_F(ERROR, "Invalid frame count!"); kclose(hFile); return 0; } @@ -274,7 +274,7 @@ int seq_ReadSequence(const char *seqName) { if (nChunks < 0 ) { - initprintf("Invalid chunk count!\n"); + LOG_F(ERROR, "Invalid chunk count!"); kclose(hFile); return 0; } @@ -370,7 +370,7 @@ void seq_LoadSequences() SeqOffsets[i] = sequences; if (seq_ReadSequence(SeqNames[i]) == 0) { - initprintf("Error loading '%s'\n", SeqNames[i]); + LOG_F(ERROR, "Error loading '%s'", SeqNames[i]); } } diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp index ac34b4182c..10c212a4d8 100644 --- a/source/exhumed/src/sound.cpp +++ b/source/exhumed/src/sound.cpp @@ -341,7 +341,7 @@ void InitFX(void) if (FX_Init(NumVoices, NumChannels, MixRate, initdata) != FX_Ok) { DebugOut("Error initializing sound card!\n"); - initprintf("Error initializing sound card!\n"); + LOG_F(ERROR, "Error initializing sound card!"); DebugOut("ERROR: %s\n", FX_ErrorString(FX_Error)); return; } @@ -401,13 +401,13 @@ void InitMusic() mdi = AIL_install_MDI_INI(); if (!mdi) { - initprintf("AIL_install midi failed\n"); + LOG_F(ERROR, "AIL_install midi failed"); return; } S = AIL_allocate_sequence_handle(mdi); if (!S) { - initprintf("Midi handle failed"); + LOG_F(ERROR, "midi handle failed"); return; } } @@ -967,7 +967,7 @@ void PlaySound(int nSound) if (nSound < 0 || nSound >= kMaxSounds || !SoundBuf[nSound]) { - initprintf("PlaySound: Invalid sound nSound == %i\n", nSound); + LOG_F(ERROR, "PlaySound: Invalid sound nSound == %i", nSound); return; } @@ -1010,7 +1010,7 @@ void PlayLocalSound(int nSound, int nRate) if (nSound < 0 || nSound >= kMaxSounds || !SoundBuf[nSound]) { - initprintf("PlayLocalSound: Invalid sound nSound == %i, nRate == %i\n", nSound, nRate); + LOG_F(ERROR, "PlayLocalSound: Invalid sound nSound == %i, nRate == %i", nSound, nRate); return; } @@ -1088,7 +1088,7 @@ short PlayFX2(unsigned short nSound, short nSprite) if ((nSound&0x1ff) >= kMaxSounds || !SoundBuf[(nSound&0x1ff)]) { - initprintf("PlayFX2: Invalid sound nSound == %i, nSprite == %i\n", nSound, nSprite); + LOG_F(ERROR, "PlayFX2: Invalid sound nSound == %i, nSprite == %i", nSound, nSprite); return -1; } diff --git a/source/exhumed/src/winbits.cpp b/source/exhumed/src/winbits.cpp index 9cbdccf483..ea12d1a3a6 100644 --- a/source/exhumed/src/winbits.cpp +++ b/source/exhumed/src/winbits.cpp @@ -56,7 +56,7 @@ int32_t G_GetVersionFromWebsite(char *buffer) if ((h = gethostbyname(host)) == NULL) { - initprintf("Couldn't resolve %s!\n", host); + LOG_F(ERROR, "Couldn't resolve %s!", host); return 0; } @@ -74,7 +74,7 @@ int32_t G_GetVersionFromWebsite(char *buffer) return 0; } - initprintf("Connecting to http://%s\n",host); + LOG_F(INFO, "Connecting to http://%s",host); if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) goto done; diff --git a/source/libsmackerdec/src/SmackerDecoder.cpp b/source/libsmackerdec/src/SmackerDecoder.cpp index 9e4948be7c..74cf9eb423 100644 --- a/source/libsmackerdec/src/SmackerDecoder.cpp +++ b/source/libsmackerdec/src/SmackerDecoder.cpp @@ -301,7 +301,7 @@ bool SmackerDecoder::Open(const char *fileName) file.Open(fileName); if (!file.Is_Open()) { - buildprintf("SmackerDecoder::Open() - Can't open file %s\n", fileName); + LOG_F(ERROR, "SmackerDecoder::Open() - Can't open file %s", fileName); return false; } @@ -310,7 +310,7 @@ bool SmackerDecoder::Open(const char *fileName) if (memcmp(signature, kSMK2iD, 4) != 0 && memcmp(signature, kSMK4iD, 4) != 0) { - buildprintf("SmackerDecoder::Open() - Unknown Smacker signature\n"); + LOG_F(ERROR, "SmackerDecoder::Open() - Unknown Smacker signature"); return false; } @@ -358,7 +358,7 @@ bool SmackerDecoder::Open(const char *fileName) if (nFrames > 0xFFFFFF) { - buildprintf("SmackerDecoder::Open() - Too many frames\n"); + LOG_F(ERROR, "SmackerDecoder::Open() - Too many frames"); return false; } @@ -448,7 +448,7 @@ int SmackerDecoder::DecodeTree(SmackerCommon::BitReader &bits, HuffContext *hc, if (!bits.GetBit()) // Leaf { if (hc->current >= 256){ - buildprintf("SmackerDecoder::DecodeTree() - Tree size exceeded\n"); + LOG_F(ERROR, "SmackerDecoder::DecodeTree() - Tree size exceeded"); return -1; } if (length){ @@ -487,7 +487,7 @@ int SmackerDecoder::DecodeBigTree(SmackerCommon::BitReader &bits, HuffContext *h i2 = 0; if (hc->current >= hc->length){ - buildprintf("SmackerDecoder::DecodeBigTree() - Tree size exceeded"); + LOG_F(ERROR, "SmackerDecoder::DecodeBigTree() - Tree size exceeded"); return -1; } @@ -549,7 +549,7 @@ int SmackerDecoder::DecodeHeaderTree(SmackerCommon::BitReader &bits, std::vector if ((uint32_t)size >= UINT_MAX>>4) { - buildprintf("SmackerDecoder::DecodeHeaderTree() - Size too large\n"); + LOG_F(ERROR, "SmackerDecoder::DecodeHeaderTree() - Size too large"); return -1; } @@ -972,7 +972,7 @@ int SmackerDecoder::DecodeAudio(uint32_t size, SmackerAudioTrack &track) int buf_size = track.bufferSize; if (buf_size <= 4) { - buildprintf("SmackerDecoder::DecodeAudio() - Packet is too small\n"); + LOG_F(ERROR, "SmackerDecoder::DecodeAudio() - Packet is too small"); return -1; } @@ -989,7 +989,7 @@ int SmackerDecoder::DecodeAudio(uint32_t size, SmackerAudioTrack &track) sampleBits = bits.GetBit(); if (stereo ^ (track.nChannels != 1)) { - buildprintf("SmackerDecoder::DecodeAudio() - Channels mismatch\n"); + LOG_F(ERROR, "SmackerDecoder::DecodeAudio() - Channels mismatch"); return -1; } @@ -1113,7 +1113,7 @@ float SmackerDecoder::GetFrameRate() void SmackerDecoder::GotoFrame(uint32_t frameNum) { if (frameNum > nFrames) { - buildprintf("SmackerDecoder::GotoFrame() - Invalid frame number\n"); + LOG_F(ERROR, "SmackerDecoder::GotoFrame() - Invalid frame number"); return; }