summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_draw.c22
-rw-r--r--src/cgame/cg_main.c2
-rw-r--r--src/ui/ui_shared.c2
-rw-r--r--src/ui/ui_shared.h1
4 files changed, 24 insertions, 3 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 );
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 4b20e742..81bc360d 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -1833,7 +1833,7 @@ void Script_playLooped( itemDef_t *item, char **args )
}
}
-static qboolean UI_Text_Emoticon( const char *s, qboolean *escaped,
+qboolean UI_Text_Emoticon( const char *s, qboolean *escaped,
int *length, qhandle_t *h, int *width )
{
char name[ MAX_EMOTICON_NAME_LEN ] = {""};
diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h
index d3d8f16f..a42d2c41 100644
--- a/src/ui/ui_shared.h
+++ b/src/ui/ui_shared.h
@@ -519,6 +519,7 @@ float UI_Text_Width( const char *text, float scale, int limit );
float UI_Text_Height( const char *text, float scale, int limit );
float UI_Text_EmWidth( float scale );
float UI_Text_EmHeight( float scale );
+qboolean UI_Text_Emoticon( const char *s, qboolean *escaped, int *length, qhandle_t *h, int *width );
int trap_Parse_AddGlobalDefine( char *define );
int trap_Parse_LoadSource( const char *filename );