diff options
author | Andrey Nazarov <skuller@skuller.net> | 2009-09-04 13:52:19 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2009-09-04 13:52:19 +0000 |
commit | b96aee6bda286ae78d7821a2dfd21582daa05ba3 (patch) | |
tree | f56f9ceeb4539cd300e821e407d30f7f8e2ce259 /source/sw_draw.c | |
parent | 12eaed2125875a436269f79481df251b598aefb5 (diff) |
Removed support for color escapes embedded in text (but still allow colored lines in console).
Moved color stuff from q_shared.c into the client code.
Diffstat (limited to 'source/sw_draw.c')
-rw-r--r-- | source/sw_draw.c | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/source/sw_draw.c b/source/sw_draw.c index d7d2311..eabdbd3 100644 --- a/source/sw_draw.c +++ b/source/sw_draw.c @@ -566,7 +566,8 @@ int R_DrawString( int x, int y, int flags, size_t maxChars, image_t *image; byte c, *data; int xx, yy; - int color, mask; + int color; + qboolean alt; if( !font ) { return x; @@ -576,48 +577,20 @@ int R_DrawString( int x, int y, int flags, size_t maxChars, return x; } - mask = 0; - if( flags & UI_ALTCOLOR ) { - mask |= 128; - } - + alt = ( flags & UI_ALTCOLOR ) ? qtrue : qfalse; color = draw.colorIndex; - while( *string ) { - if( Q_IsColorString( string ) ) { - string++; - c = *string++; - if( c == COLOR_ALT ) { - mask |= 128; - } else if( c == COLOR_RESET ) { - color = draw.colorIndex; - mask = 0; - if( flags & UI_ALTCOLOR ) { - mask |= 128; - } - } else if( !( flags & UI_IGNORECOLOR ) ) { - color = colorIndices[ ColorIndex( c ) ]; - } - continue; - } - - if( !maxChars-- ) { - break; - } - - if( !( c = *string++ ) ) { - break; - } - - c |= mask; - + while( maxChars-- && *string ) { + c = *string++; if( ( c & 127 ) == 32 ) { - x += 8; /* optimized case */ + x += 8; continue; } + c |= alt << 7; xx = ( c & 15 ) << 3; yy = ( c >> 4 ) << 3; + data = image->pixels[0] + yy * image->width + xx; if( color != -1 && !( c & 128 ) ) { R_DrawFixedDataAsMask( x, y, 8, 8, image->width, data, color ); |