void FConsoleBuffer::AddMidText(const char *string, bool bold, FILE *Logfile) { Linefeed(Logfile); AddText (-1, bold? bar2 : bar1, Logfile); AddText (-1, string, Logfile); Linefeed(Logfile); AddText(-1, bar3, Logfile); }
/* ================ Print Handles cursor positioning, line wrapping, etc ================ */ void idConsoleLocal::Print( const char* txt ) { int y; int c, l; int color; if( TOTAL_LINES == 0 ) { // not yet initialized return; } color = idStr::ColorIndex( C_COLOR_CYAN ); while( ( c = *( const unsigned char* )txt ) != 0 ) { if( idStr::IsColor( txt ) ) { if( *( txt + 1 ) == C_COLOR_DEFAULT ) { color = idStr::ColorIndex( C_COLOR_CYAN ); } else { color = idStr::ColorIndex( *( txt + 1 ) ); } txt += 2; continue; } y = current % TOTAL_LINES; // if we are about to print a new word, check to see // if we should wrap to the new line if( c > ' ' && ( x == 0 || text[y * LINE_WIDTH + x - 1] <= ' ' ) ) { // count word length for( l = 0 ; l < LINE_WIDTH ; l++ ) { if( txt[l] <= ' ' ) { break; } } // word wrap if( l != LINE_WIDTH && ( x + l >= LINE_WIDTH ) ) { Linefeed(); } } txt++; switch( c ) { case '\n': Linefeed(); break; case '\t': do { text[y * LINE_WIDTH + x] = ( color << 8 ) | ' '; x++; if( x >= LINE_WIDTH ) { Linefeed(); x = 0; } } while( x & 3 ); break; case '\r': x = 0; break; default: // display character and advance text[y * LINE_WIDTH + x] = ( color << 8 ) | c; x++; if( x >= LINE_WIDTH ) { Linefeed(); x = 0; } break; } } // mark time for transparent overlay if( current >= 0 ) { times[current % NUM_CON_TIMES] = Sys_Milliseconds(); } }