diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-10-10 19:10:52 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:46 +0000 |
commit | a327db46a2d939633b6836de28251ae7d4dbbec5 (patch) | |
tree | a9e1a35bd8a2e956b08354cbe94f278488b1e32e /src/cgame | |
parent | 2b39517c2d6edb6f008150eaaebf5318029c8939 (diff) |
* (bug 3713) Scoreboard marquee causes text display problems
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 22 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 2 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index ba8aaacf..b7e966a1 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -1269,6 +1269,11 @@ static void CG_DrawKiller( rectDef_t *rect, float scale, vec4_t color, static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, int textvalign, vec4_t color, qhandle_t shader ) { float y; + qboolean isEmoticon; + qboolean emoticonEscaped; + char secondPart[ MAX_STRING_CHARS ] = ""; + int emoticonLen; + static char lastColorSeen = COLOR_WHITE; if( cg.spectatorLen ) { @@ -1298,9 +1303,20 @@ static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, int textvalign, { // skip colour directives if( Q_IsColorString( &cg.spectatorList[ cg.spectatorOffset ] ) ) + { + lastColorSeen = cg.spectatorList[ cg.spectatorOffset + 1 ]; cg.spectatorOffset += 2; + } else { + isEmoticon = UI_Text_Emoticon( &cg.spectatorList[ cg.spectatorOffset ], + &emoticonEscaped, &emoticonLen, NULL, NULL ); + if( isEmoticon ) + { + cg.spectatorOffset += emoticonLen; + if( emoticonEscaped ) cg.spectatorOffset++; // skip an extra char to not un-scape by eating the escaping [ + } + cg.spectatorPaintX += UI_Text_Width( &cg.spectatorList[ cg.spectatorOffset ], scale, 1 ) - 1; cg.spectatorOffset++; } @@ -1326,12 +1342,16 @@ static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, int textvalign, } } + secondPart[ 0 ] = Q_COLOR_ESCAPE; + secondPart[ 1 ] = lastColorSeen; + Q_strncpyz( secondPart+2, &cg.spectatorList[ cg.spectatorOffset ], sizeof( secondPart ) - 2 ); + maxX = rect->x + rect->w - 2; CG_AlignText( rect, NULL, 0.0f, 0.0f, UI_Text_EmHeight( scale ), ALIGN_LEFT, textvalign, NULL, &y ); UI_Text_Paint_Limit( &maxX, cg.spectatorPaintX, y, scale, color, - &cg.spectatorList[ cg.spectatorOffset ], 0, 0 ); + secondPart, 0, 0 ); if( cg.spectatorPaintX2 >= 0 ) { diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index e0a9e83c..3be1782f 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -877,7 +877,7 @@ void CG_BuildSpectatorString( void ) for( i = 0; i < MAX_CLIENTS; i++ ) { if( cgs.clientinfo[ i ].infoValid && cgs.clientinfo[ i ].team == TEAM_NONE ) - Q_strcat( cg.spectatorList, sizeof( cg.spectatorList ), va( "%s " S_COLOR_WHITE, cgs.clientinfo[ i ].name ) ); + Q_strcat( cg.spectatorList, sizeof( cg.spectatorList ), va( S_COLOR_WHITE "%s ", cgs.clientinfo[ i ].name ) ); } i = strlen( cg.spectatorList ); |