void R_ClearScreen(void);
// color tag printing
-static vec4_t _draw_colors[] =
+static vec4_t string_colors[] =
{
// Quake3 colors
// LordHavoc: why on earth is cyan before magenta in Quake3?
//{0.1, 0.1, 0.1, 1.0}
};
-#define _draw_colors_count (sizeof(_draw_colors) / sizeof(vec4_t))
-#define _draw_color_tag '^'
-#define _draw_color_default 7
+#define STRING_COLORS_COUNT (sizeof(string_colors) / sizeof(vec4_t))
// color is read and changed in the end
void DrawQ_ColoredString( float x, float y, const char *text, int maxlen, float scalex, float scaley, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor )
const char *start, *current;
if( !outcolor || *outcolor == -1 ) {
- colorindex = _draw_color_default;
+ colorindex = STRING_COLOR_DEFAULT;
} else {
colorindex = *outcolor;
}
- color = _draw_colors[colorindex];
+ color = string_colors[colorindex];
if( maxlen < 1)
len = strlen( text );
start = current = text;
while( len > 0 ) {
// check for color control char
- if( *current == _draw_color_tag ) {
+ if( *current == STRING_COLOR_TAG ) {
// get next char
current++;
len--;
break;
}
// display the tag char?
- if( *current == _draw_color_tag ) {
+ if( *current == STRING_COLOR_TAG ) {
// only display one of the two
start = current;
// get the next char
do {
colorindex = colorindex * 10 + (*current - '0');
// only read as long as it makes a valid index
- if( colorindex >= _draw_colors_count ) {
+ if( colorindex >= STRING_COLORS_COUNT ) {
// undo the last operation
colorindex /= 10;
break;
len--;
} while( len > 0 && '0' <= *current && *current <= '9' );
// set the color
- color = _draw_colors[colorindex];
+ color = string_colors[colorindex];
// we jump over the color tag
start = current;
}
}
// go on and read normal text in until the next control char
- while( len > 0 && *current != _draw_color_tag ) {
+ while( len > 0 && *current != STRING_COLOR_TAG ) {
current++;
len--;
}
char *timestamp = timestamps.integer ? Sys_TimeString(timeformat.string) : "";
// reset the color
// FIXME: 1. perhaps we should use a terminal system 2. use a constant instead of 7!
- line[index++] = '^';
- line[index++] = '7';
+ line[index++] = STRING_COLOR_TAG;
+ // assert( STRING_COLOR_DEFAULT < 10 )
+ line[index++] = STRING_COLOR_DEFAULT + '0';
// special color codes for chat messages must always come first
// for Con_PrintToHistory to work properly
if (*msg <= 2)
// print the text
//DrawQ_String(x, y, va("%c%4i %s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
// FIXME: use a constant for this color tag instead
- DrawQ_ColoredString(x, y, va("%c%4i %s^7", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL );
+ DrawQ_ColoredString(x, y, va("%c%4i %s^" STRING_COLOR_DEFAULT_STR, (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0, NULL );
return 8;
}