summaryrefslogtreecommitdiff
path: root/source/gl_draw.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2008-04-04 20:45:13 +0000
committerAndrey Nazarov <skuller@skuller.net>2008-04-04 20:45:13 +0000
commit22fd6efeeb7ee918e0d1ffb75f6292077ce27816 (patch)
tree7b355fc4aa8a7c63aac93af54fb229f678ef552c /source/gl_draw.c
parent7ec50f12252b4dfb97f3249ccf05a771b98785c1 (diff)
Added support for drawing colored text via `draw' client command.
Cvar_Get now resets user defined cvar values for read-only cvars. Sever and game DLL features are now advertised via cvars instead of exports.
Diffstat (limited to 'source/gl_draw.c')
-rw-r--r--source/gl_draw.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/source/gl_draw.c b/source/gl_draw.c
index 9387a9e..f95f1f9 100644
--- a/source/gl_draw.c
+++ b/source/gl_draw.c
@@ -277,14 +277,14 @@ int Draw_String( int x, int y, int flags, size_t maxChars,
float s, t;
image_t *image;
color_t colors[2];
- int mask;
+ int mask, altmask = 0;
image = R_ImageForHandle( hFont );
- mask = 0;
if( flags & UI_ALTCOLOR ) {
- mask |= 128;
+ altmask |= 128;
}
+ mask = altmask;
*( uint32_t * )colors[0] = *( uint32_t * )draw.color;
*( uint32_t * )colors[1] = MakeColor( 255, 255, 255, draw.color[3] );
@@ -295,10 +295,7 @@ int Draw_String( int x, int y, int flags, size_t maxChars,
mask |= 128;
} else if( c == COLOR_RESET ) {
*( uint32_t * )colors[0] = *( uint32_t * )draw.color;
- mask = 0;
- if( flags & UI_ALTCOLOR ) {
- mask |= 128;
- }
+ mask = altmask;
} else {
VectorCopy( colorTable[ ColorIndex( c ) ], colors[0] );
mask = 0;
@@ -308,13 +305,12 @@ int Draw_String( int x, int y, int flags, size_t maxChars,
}
c = *string++;
- c |= mask;
-
if( ( c & 127 ) == 32 ) {
x += 8;
continue;
}
+ c |= mask;
s = ( c & 15 ) * 0.0625f;
t = ( c >> 4 ) * 0.0625f;