strip leading newlines from warnings and take care they always get their own line (#1205)

* strip leading newlines from warnings

* warnings always get their own new line

* all prios but VB_INFO should start on their own line

* remove some more leading newlines

* finish progress line in R_InitTranMap()
This commit is contained in:
Fabian Greffrath 2023-09-14 10:12:30 +02:00 committed by GitHub
parent b048001622
commit 7dd0e39ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 11 deletions

View File

@ -119,6 +119,8 @@ void I_InitPrintf(void)
I_AtExit(I_ShutdownPrintf, true);
}
static boolean whole_line = true;
void I_Printf(verbosity_t prio, const char *msg, ...)
{
FILE *stream = stdout;
@ -161,6 +163,10 @@ void I_Printf(verbosity_t prio, const char *msg, ...)
color_suffix = "\033[0m"; // [FG] reset
}
// [FG] warnings always get their own new line
if (!whole_line && prio != VB_INFO)
fprintf(stream, "%s", "\n");
if (color_prefix)
fprintf(stream, "%s", color_prefix);
@ -173,11 +179,22 @@ void I_Printf(verbosity_t prio, const char *msg, ...)
// [FG] no newline if format string has trailing space
if (msglen && msg[msglen - 1] != ' ')
{
fprintf(stream, "%s", "\n");
whole_line = true;
}
else
{
whole_line = false;
}
}
void I_PutChar(verbosity_t prio, int c)
{
if (prio <= verbosity)
{
putchar(c);
whole_line = (c == '\n');
}
}

View File

@ -789,11 +789,11 @@ void NET_LANQuery(void)
{
if (NET_StartLANQuery())
{
I_Printf(VB_INFO, "\nSearching for servers on local LAN ...");
I_Printf(VB_INFO, "Searching for servers on local LAN ...");
NET_Query_QueryLoop(NET_QueryPrintCallback, NULL);
I_Printf(VB_INFO, "\n%i server(s) found.", GetNumResponses());
I_Printf(VB_INFO, "%i server(s) found.", GetNumResponses());
FreeTargets();
}
}
@ -802,11 +802,11 @@ void NET_MasterQuery(void)
{
if (NET_StartMasterQuery())
{
I_Printf(VB_INFO, "\nSearching for servers on Internet ...");
I_Printf(VB_INFO, "Searching for servers on Internet ...");
NET_Query_QueryLoop(NET_QueryPrintCallback, NULL);
I_Printf(VB_INFO, "\n%i server(s) found.", GetNumResponses());
I_Printf(VB_INFO, "%i server(s) found.", GetNumResponses());
FreeTargets();
}
}
@ -829,7 +829,7 @@ void NET_QueryAddress(const char *addr_str)
target = GetTargetForAddr(addr, true);
I_Printf(VB_INFO, "\nQuerying '%s'...", addr_str);
I_Printf(VB_INFO, "Querying '%s'...", addr_str);
// Run query loop.

View File

@ -395,7 +395,7 @@ static void R_GenerateLookup(int texnum, int *const errors)
if (badcol)
{
badcol = 0;
I_Printf(VB_DEBUG, "\nWarning: Texture %8.8s "
I_Printf(VB_DEBUG, "Warning: Texture %8.8s "
"(height %d) has bad column(s)"
" starting at x = %d.",
texture->name, texture->height, x);
@ -426,7 +426,7 @@ static void R_GenerateLookup(int texnum, int *const errors)
// if (devparm)
{
// killough 8/8/98
I_Printf(VB_DEBUG, "\nR_GenerateLookup:"
I_Printf(VB_DEBUG, "R_GenerateLookup:"
" Column %d is without a patch in texture %.8s",
x, texture->name);
// ++*errors;
@ -462,7 +462,7 @@ static void R_GenerateLookup(int texnum, int *const errors)
if (err) // killough 10/98: non-verbose output
{
I_Printf(VB_WARNING, "\nR_GenerateLookup: Column without a patch in texture %.8s",
I_Printf(VB_WARNING, "R_GenerateLookup: Column without a patch in texture %.8s",
texture->name);
++*errors;
}
@ -554,12 +554,12 @@ void R_InitTextures (void)
patchlookup[i] = (W_CheckNumForName)(name, ns_sprites);
if (patchlookup[i] == -1)
I_Printf(VB_DEBUG, "\nWarning: patch %.8s, index %d does not exist",name,i);
I_Printf(VB_DEBUG, "Warning: patch %.8s, index %d does not exist",name,i);
}
if (patchlookup[i] != -1 && !R_IsPatchLump(patchlookup[i]))
{
I_Printf(VB_WARNING, "\nR_InitTextures: patch %.8s, index %d is invalid", name, i);
I_Printf(VB_WARNING, "R_InitTextures: patch %.8s, index %d is invalid", name, i);
patchlookup[i] = (W_CheckNumForName)("TNT1A0", ns_sprites);
}
@ -681,7 +681,7 @@ void R_InitTextures (void)
}
if (patch->patch == -1)
{ // killough 8/8/98
I_Printf(VB_WARNING, "\nR_InitTextures: Missing patch %d in texture %.8s",
I_Printf(VB_WARNING, "R_InitTextures: Missing patch %d in texture %.8s",
SHORT(mpatch->patch), texture->name); // killough 4/17/98
// [FG] treat missing patches as non-fatal, substitute dummy patch
// ++errors;
@ -958,6 +958,9 @@ void R_InitTranMap(int progress)
while (--color >= 0);
}
}
// [FG] finish progress line
if (progress)
I_PutChar(VB_INFO, '\n');
}
if (cachefp && !force_rebuild) // write out the cached translucency map
{