/* ================== SCR_DrawSmallString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. Coordinates are at 640 by 480 virtual resolution ================== */ void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor ) { vec4_t color; const char *s; int xx; // draw the colored text s = string; xx = x; re.SetColor( setColor ); while ( *s ) { if ( Q_IsColorString( s ) ) { if ( !forceColor ) { Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) ); color[3] = setColor[3]; re.SetColor( color ); } s += 2; continue; } SCR_DrawSmallChar( xx, y, *s ); xx += SMALLCHAR_WIDTH; s++; } re.SetColor( NULL ); }
/* ================== SCR_DrawSmallString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. Coordinates are at 640 by 480 virtual resolution ================== */ void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor ) { vec4_t color; const char *s; int xx; // draw the colored text s = string; xx = x; re.SetColor( setColor ); while ( *s ) { if ( Q_IsColorString( s ) ) { if ( !forceColor ) { #if !defined RTCW_ET memcpy( color, g_color_table[ColorIndex( *( s + 1 ) )], sizeof( color ) ); color[3] = setColor[3]; #else if ( *( s + 1 ) == COLOR_NULL ) { memcpy( color, setColor, sizeof( color ) ); } else { memcpy( color, g_color_table[ColorIndex( *( s + 1 ) )], sizeof( color ) ); color[3] = setColor[3]; } #endif // RTCW_XX re.SetColor( color ); } s += 2; continue; } SCR_DrawSmallChar( xx, y, *s ); xx += SMALLCHAR_WIDTH; s++; } re.SetColor( NULL ); }
/* ================== SCR_DrawSmallString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. Coordinates are at 640 by 480 virtual resolution ================== */ void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor, qboolean noColorEscape ) { vec4_t color; const char *s; int xx; // draw the colored text s = string; xx = x; re->SetColor( setColor ); while ( *s ) { int colorLen = Q_parseColorString( s, color ); if ( colorLen ) { if ( !forceColor ) { color[3] = setColor[3]; re->SetColor( color ); } if ( !noColorEscape ) { s += colorLen; continue; } } SCR_DrawSmallChar( xx, y, *s ); xx += SMALLCHAR_WIDTH; s++; } re->SetColor( NULL ); }
void SCR_DrawConsoleFontChar( float x, float y, int ch ) { if( cls.useLegacyConsoleFont ) { SCR_DrawSmallChar( (int) x, (int) y, ch ); return; } if(ch==' ') return; fontInfo_t *font = &cls.consoleFont; glyphInfo_t *glyph = &font->glyphs[ch]; float yadj = glyph->top; float xadj = (SCR_ConsoleFontCharWidth( ch ) - glyph->xSkip) / 2.0; re.DrawStretchPic( x+xadj, y-yadj, glyph->imageWidth, glyph->imageHeight, glyph->s, glyph->t, glyph->s2, glyph->t2, glyph->glyph ); }
static void SCR_DrawSmallStringExt( int x, int y, const char* string, float* setColor, bool forceColor ) { // draw the colored text const char* s = string; int xx = x; R_SetColor( setColor ); while ( *s ) { if ( Q_IsColorString( s ) ) { if ( !forceColor ) { vec4_t color; if ( *( s + 1 ) == COLOR_NULL ) { Com_Memcpy( color, setColor, sizeof ( color ) ); } else { Com_Memcpy( color, g_color_table[ ColorIndex( *( s + 1 ) ) ], sizeof ( color ) ); color[ 3 ] = setColor[ 3 ]; } R_SetColor( color ); } s += 2; continue; } SCR_DrawSmallChar( xx, y, *s ); xx += SMALLCHAR_WIDTH; s++; } R_SetColor( NULL ); }
/* ================== SCR_DrawSmallString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. Coordinates are at 640 by 480 virtual resolution ================== */ void SCR_DrawSmallStringExt( int x, int y, const char *string, const vec4_t setColor, qboolean forceColor ) { vec4_t color; const char *s; int xx; const bool use102color = MV_USE102COLOR; // draw the colored text s = string; xx = x; re.SetColor( setColor ); while ( *s ) { if ( Q_IsColorString( s ) || (use102color && Q_IsColorString_1_02( s ))) { if ( !forceColor ) { Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) ); color[3] = setColor[3]; re.SetColor( color ); } s += 2; continue; } SCR_DrawSmallChar( xx, y, *s ); xx += con.charWidth; s++; } re.SetColor( NULL ); }
// Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. // Coordinates are 640x480 virtual values void SCR_DrawSmallStringExt( int x, int y, const char *string, vector4 *setColor, qboolean forceColor, qboolean noColorEscape ) { vector4 color; const char *s; int xx; // draw the colored text s = string; xx = x; re->SetColor( setColor ); while ( *s ) { if ( Q_IsColorString( s ) ) { if ( !forceColor ) { memcpy( &color, &g_color_table[ColorIndex(*(s+1))], sizeof( color ) ); color.a = setColor->a; re->SetColor( &color ); } if ( !noColorEscape ) { s += 2; continue; } } SCR_DrawSmallChar( xx, y, *s ); xx += SMALLCHAR_WIDTH; s++; } re->SetColor( NULL ); }
/* ================ Con_DrawInput Draw the editline after a ] prompt ================ */ void Con_DrawInput (void) { int y; if ( cls.state != CA_DISCONNECTED && !(Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) { return; } y = con.vislines - ( SMALLCHAR_HEIGHT * (re->Language_IsAsian() ? 1.5 : 2) ); re->SetColor( con.color ); SCR_DrawSmallChar( (int)(con.xadjust + 1 * SMALLCHAR_WIDTH), y, CONSOLE_PROMPT_CHAR ); Field_Draw( &g_consoleField, (int)(con.xadjust + 2 * SMALLCHAR_WIDTH), y, SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue, qtrue ); }
/* ================== SCR_DrawSmallString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. ================== */ void SCR_DrawSmallStringExt( int x, int y, const char *string, qboolean forceColor, qboolean noColorEscape ) { const char *s; int xx; // draw the colored text s = string; xx = x; re.SetColor(colorWhite); while (*s) { if ( Q_IsColorString( s ) ) { if (!forceColor) { re.SetColor(ColorFromChar(s[1])); } s += 2; continue; } SCR_DrawSmallChar( xx, y, *s ); xx += SMALLCHAR_WIDTH; s++; } re.SetColor( NULL ); }
/* =================== Field_Draw Handles horizontal scrolling and cursor blinking x, y, and width are in pixels =================== */ void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, qboolean showCursor, qboolean noColorEscape ) { int len; int drawLen; int prestep; int cursorChar; char str[MAX_STRING_CHARS], *s; int i; int curColor; drawLen = edit->widthInChars - 1; // - 1 so there is always a space for the cursor len = strlen( edit->buffer ); // guarantee that cursor will be visible if ( len <= drawLen ) { prestep = 0; } else { if ( edit->scroll + drawLen > len ) { edit->scroll = len - drawLen; if ( edit->scroll < 0 ) { edit->scroll = 0; } } prestep = edit->scroll; } if ( prestep + drawLen > len ) { drawLen = len - prestep; } // extract <drawLen> characters from the field at <prestep> if ( drawLen >= MAX_STRING_CHARS ) { Com_Error( ERR_DROP, "drawLen >= MAX_STRING_CHARS" ); } Com_Memcpy( str, edit->buffer + prestep, drawLen ); str[ drawLen ] = '\0'; // color tracking curColor = COLOR_WHITE; if ( prestep > 0 ) { // we need to track last actual color because we cut some text before s = edit->buffer; for ( i = 0; i < prestep + 1; i++, s++ ) { if ( *s == Q_COLOR_ESCAPE && *(s+1) != '\0' && *(s+1) != Q_COLOR_ESCAPE ) { curColor = *(s+1); s++; } } // scroll marker // FIXME: force white color? if ( str[0] ) { str[0] = '<'; } } // draw it if ( size == SMALLCHAR_WIDTH ) { SCR_DrawSmallStringExt( x, y, str, g_color_table[ ColorIndex( curColor ) ], qfalse, noColorEscape ); if ( len > drawLen + prestep ) { SCR_DrawSmallChar( x + ( edit->widthInChars - 1 ) * size, y, '>' ); } } else { if ( len > drawLen + prestep ) { SCR_DrawStringExt( x + ( edit->widthInChars - 1 ) * size, y, size, ">", g_color_table[ ColorIndex( COLOR_WHITE ) ], qfalse, noColorEscape ); } // draw big string with drop shadow SCR_DrawStringExt( x, y, size, str, g_color_table[ ColorIndex( curColor ) ], qfalse, noColorEscape ); } // draw the cursor if ( showCursor ) { if ( cls.realtime & 256 ) { return; // off blink } if ( key_overstrikeMode ) { cursorChar = 11; } else { cursorChar = 10; } i = drawLen - strlen( str ); if ( size == SMALLCHAR_WIDTH ) { SCR_DrawSmallChar( x + ( edit->cursor - prestep - i ) * size, y, cursorChar ); } else { str[0] = cursorChar; str[1] = '\0'; SCR_DrawBigString( x + ( edit->cursor - prestep - i ) * size, y, str, 1.0, qfalse ); } } }