mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-30 08:44:31 +00:00
engine: client: fix multiline CenterPrint
This commit is contained in:
parent
b6347d17c9
commit
7e9d46689c
@ -308,10 +308,9 @@ void CL_CenterPrint( const char *text, float y )
|
|||||||
{
|
{
|
||||||
cl_font_t *font = Con_GetCurFont();
|
cl_font_t *font = Con_GetCurFont();
|
||||||
|
|
||||||
if( !COM_CheckString( text ))
|
if( !COM_CheckString( text ) || !font || !font->valid )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
clgame.centerPrint.lines = 1;
|
|
||||||
clgame.centerPrint.totalWidth = 0;
|
clgame.centerPrint.totalWidth = 0;
|
||||||
clgame.centerPrint.time = cl.mtime[0]; // allow pause for centerprint
|
clgame.centerPrint.time = cl.mtime[0]; // allow pause for centerprint
|
||||||
Q_strncpy( clgame.centerPrint.message, text, sizeof( clgame.centerPrint.message ));
|
Q_strncpy( clgame.centerPrint.message, text, sizeof( clgame.centerPrint.message ));
|
||||||
@ -322,6 +321,10 @@ void CL_CenterPrint( const char *text, float y )
|
|||||||
&clgame.centerPrint.totalHeight,
|
&clgame.centerPrint.totalHeight,
|
||||||
FONT_DRAW_HUD | FONT_DRAW_UTF8 );
|
FONT_DRAW_HUD | FONT_DRAW_UTF8 );
|
||||||
|
|
||||||
|
if( font->charHeight )
|
||||||
|
clgame.centerPrint.lines = clgame.centerPrint.totalHeight / font->charHeight;
|
||||||
|
else clgame.centerPrint.lines = 1;
|
||||||
|
|
||||||
clgame.centerPrint.y = CL_AdjustYPos( y, clgame.centerPrint.totalHeight );
|
clgame.centerPrint.y = CL_AdjustYPos( y, clgame.centerPrint.totalHeight );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user