2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-28 03:35:19 +01:00

engine: client: font: fix consecutive newlines skipped, add flag to reset color after a newline

This commit is contained in:
Alibek Omarov 2023-02-04 21:59:29 +03:00
parent c0fa91bec9
commit 6eae3471cf
3 changed files with 10 additions and 6 deletions

View File

@ -213,6 +213,10 @@ int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *fon
draw_len = 0;
y += font->charHeight;
}
if( FBitSet( flags, FONT_DRAW_RESETCOLORONLF ))
Vector4Copy( color, current_color );
continue;
}
if( IsColorString( s ))
@ -275,6 +279,7 @@ void CL_DrawStringLen( cl_font_t *font, const char *s, int *width, int *height,
if( height )
*height += font->charHeight;
}
continue;
}
if( IsColorString( s ))

View File

@ -150,8 +150,7 @@ same as r_speeds but for network channel
void SCR_NetSpeeds( void )
{
static char msg[MAX_SYSPATH];
int x, y, height;
char *p, *start, *end;
int x, y;
float time = cl.mtime[0];
static int min_svfps = 100;
static int max_svfps = 0;
@ -201,7 +200,7 @@ void SCR_NetSpeeds( void )
y = 384;
MakeRGBA( color, 255, 255, 255, 255 );
CL_DrawString( x, y, msg, color, font, 0 );
CL_DrawString( x, y, msg, color, font, FONT_DRAW_RESETCOLORONLF );
}
/*
@ -218,8 +217,7 @@ void SCR_RSpeeds( void )
if( ref.dllFuncs.R_SpeedsMessage( msg, sizeof( msg )))
{
int x, y, height;
char *p, *start, *end;
int x, y;
rgba_t color;
cl_font_t *font = Con_GetCurFont();
@ -227,7 +225,7 @@ void SCR_RSpeeds( void )
y = 64;
MakeRGBA( color, 255, 255, 255, 255 );
CL_DrawString( x, y, msg, color, font, 0 );
CL_DrawString( x, y, msg, color, font, FONT_DRAW_RESETCOLORONLF );
}
}

View File

@ -326,6 +326,7 @@ typedef struct
#define FONT_DRAW_FORCECOL BIT( 2 ) // ignore colorcodes
#define FONT_DRAW_NORENDERMODE BIT( 3 ) // ignore font's default rendermode
#define FONT_DRAW_NOLF BIT( 4 ) // ignore \n
#define FONT_DRAW_RESETCOLORONLF BIT( 5 ) // yet another flag to simulate consecutive Con_DrawString calls...
typedef struct
{