diff options
author | Michael Levin <risujin@fastmail.fm> | 2009-10-03 11:13:10 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:14:46 +0000 |
commit | d9d4a8c3cb1fb226738278923cf8d5ba2b74efdf (patch) | |
tree | 23637261238f8791a95e33eef077079608de4030 /src/ui | |
parent | ae1fb9aecf949fb7261b3e4b065a4bddd016de6b (diff) |
Added armour files to version control.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui_atoms.c | 4 | ||||
-rw-r--r-- | src/ui/ui_main.c | 15 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 29 |
3 files changed, 36 insertions, 12 deletions
diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c index ec1e1e73..90b70114 100644 --- a/src/ui/ui_atoms.c +++ b/src/ui/ui_atoms.c @@ -160,11 +160,11 @@ qboolean UI_ConsoleCommand( int realTime ) return qtrue; } - if( Q_strncmp( cmd, "messagemode", 11 ) == 0 ) + if( Q_strncmp( cmd, "ui_messagemode", 14 ) == 0 ) { trap_Cvar_Set( "ui_sayBuffer", "" ); - switch( cmd[ 11 ] ) + switch( cmd[ strlen(cmd) ] ) { default: case '\0': diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index fcc08e67..e8d6988c 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -2892,12 +2892,15 @@ static void UI_RunMenuScript( char **args ) char buffer[ MAX_CVAR_VALUE_STRING ]; trap_Cvar_VariableStringBuffer( "ui_sayBuffer", buffer, sizeof( buffer ) ); - if( uiInfo.chatTargetClientNum != -1 ) - trap_Cmd_ExecuteText( EXEC_APPEND, va( "tell %i \"%s\"\n", uiInfo.chatTargetClientNum, buffer ) ); - else if( uiInfo.chatTeam ) - trap_Cmd_ExecuteText( EXEC_APPEND, va( "say_team \"%s\"\n", buffer ) ); - else - trap_Cmd_ExecuteText( EXEC_APPEND, va( "say \"%s\"\n", buffer ) ); + if( buffer[ 0 ] ) + { + if( uiInfo.chatTargetClientNum != -1 ) + trap_Cmd_ExecuteText( EXEC_APPEND, va( "tell %i \"%s\"\n", uiInfo.chatTargetClientNum, buffer ) ); + else if( uiInfo.chatTeam ) + trap_Cmd_ExecuteText( EXEC_APPEND, va( "say_team \"%s\"\n", buffer ) ); + else + trap_Cmd_ExecuteText( EXEC_APPEND, va( "say \"%s\"\n", buffer ) ); + } } else if( Q_stricmp( name, "playMovie" ) == 0 ) { diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 108113ed..f59a7349 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -4638,6 +4638,7 @@ void Item_Text_Wrapped_Paint( itemDef_t *item ) int paintLines, totalLines, lineNum = 0; float paintY; int i; + char lastCode = 0, newCode = 0; UI_CreateCacheEntry( textPtr, &item->window.rect, item->textscale ); @@ -4688,6 +4689,10 @@ void Item_Text_Wrapped_Paint( itemDef_t *item ) { int lineLength = &textPtr[ i ] - p; + // track any color escape sequences + if( i && Q_IsColorString( textPtr + i - 1 ) ) + newCode = textPtr[ i ]; + if( lineLength >= sizeof( buff ) - 1 ) break; @@ -4696,8 +4701,24 @@ void Item_Text_Wrapped_Paint( itemDef_t *item ) itemDef_t lineItem; int width, height; - strncpy( buff, p, lineLength ); - buff[ lineLength ] = '\0'; + // if there was a color escape before we need to insert it on the + // start of every line again, otherwise don't insert a color escape + // in order to preserve the item's assigned color + if( lastCode ) + { + buff[ 0 ] = Q_COLOR_ESCAPE; + buff[ 1 ] = lastCode; + strncpy( buff + 2, p, lineLength ); + buff[ lineLength + 2 ] = '\0'; + } + else + { + strncpy( buff, p, lineLength ); + buff[ lineLength ] = '\0'; + } + + lastCode = newCode; + p = &textPtr[ i + 1 ]; lineItem.type = ITEM_TYPE_TEXT; @@ -5665,7 +5686,7 @@ void Item_ListBox_Paint( itemDef_t *item ) DC->drawHandlePic( x + columnPos, y + ( ( listPtr->elementHeight - height ) / 2.0f ), width, height, optionalImage ); } - else if( text ) + else if( text[ 0 ] ) { int alignOffset = 0.0f, tw; @@ -5717,7 +5738,7 @@ void Item_ListBox_Paint( itemDef_t *item ) if( optionalImage >= 0 ) DC->drawHandlePic( x + offset, y, listPtr->elementHeight, listPtr->elementHeight, optionalImage ); - else if( text ) + else if( text[ 0 ] ) { UI_Text_Paint( x + offset, y + m + ( ( listPtr->elementHeight - m ) / 2.0f ), item->textscale, item->window.foreColor, text, 0, |