/* ================ Sys_Print print into window console ================ */ void Sys_Print( const char *pMsg ) { const char *msg; char buffer[32768]; char logbuf[32768]; char *b = buffer; char *c = logbuf; int i = 0; if( host.type == HOST_NORMAL ) Con_Print( pMsg ); // if the message is REALLY long, use just the last portion of it if( Q_strlen( pMsg ) > sizeof( buffer ) - 1 ) msg = pMsg + Q_strlen( pMsg ) - sizeof( buffer ) + 1; else msg = pMsg; // copy into an intermediate buffer while( msg[i] && (( b - buffer ) < sizeof( buffer ) - 1 )) { if( msg[i] == '\n' && msg[i+1] == '\r' ) { b[0] = '\r'; b[1] = c[0] = '\n'; b += 2, c++; i++; } else if( msg[i] == '\r' ) { b[0] = c[0] = '\r'; b[1] = '\n'; b += 2, c++; } else if( msg[i] == '\n' ) { b[0] = '\r'; b[1] = c[0] = '\n'; b += 2, c++; } else if( msg[i] == '\35' || msg[i] == '\36' || msg[i] == '\37' ) { i++; // skip console pseudo graph } else if( IsColorString( &msg[i] )) { i++; // skip color prefix } else { *b = *c = msg[i]; b++, c++; } i++; } *b = *c = 0; // cutoff garbage Sys_PrintLog( logbuf ); Con_WinPrint( buffer ); }
/* ================ Sys_Print print into window console ================ */ void Sys_Print( const char *pMsg ) { const char *msg; char buffer[32768]; char logbuf[32768]; char *b = buffer; char *c = logbuf; int i = 0; if( host.type == HOST_NORMAL ) Con_Print( pMsg ); #ifdef _WIN32 // if the message is REALLY long, use just the last portion of it if( Q_strlen( pMsg ) > sizeof( buffer ) - 1 ) msg = pMsg + Q_strlen( pMsg ) - sizeof( buffer ) + 1; else msg = pMsg; // copy into an intermediate buffer while( msg[i] && (( b - buffer ) < sizeof( buffer ) - 1 )) { if( msg[i] == '\n' && msg[i+1] == '\r' ) { b[0] = '\r'; b[1] = '\n'; c[0] = '\n'; b += 2, c++; i++; } else if( msg[i] == '\r' ) { b[0] = '\r'; b[1] = '\n'; b += 2; } else if( msg[i] == '\n' ) { b[0] = '\r'; b[1] = '\n'; c[0] = '\n'; b += 2, c++; } else if( msg[i] == '\35' || msg[i] == '\36' || msg[i] == '\37' ) { i++; // skip console pseudo graph } else if( IsColorString( &msg[i] )) { i++; // skip color prefix } else { *b = *c = msg[i]; b++, c++; } i++; } *b = *c = 0; // cutoff garbage Sys_PrintLog( logbuf ); Con_WinPrint( buffer ); #else Sys_PrintLog( pMsg ); #endif if( host.rd.target ) { if(( Q_strlen( pMsg ) + Q_strlen( host.rd.buffer )) > ( host.rd.buffersize - 1 )) { if( host.rd.flush ) { host.rd.flush( host.rd.address, host.rd.target, host.rd.buffer ); *host.rd.buffer = 0; } } Q_strcat( host.rd.buffer, pMsg ); return; } }
/* ================= UI_DrawString ================= */ void UI_DrawString( int x, int y, int w, int h, const char *string, const int color, int forceColor, int charW, int charH, int justify, int shadow ) { int modulate, shadowModulate; char line[1024], *l; int xx, yy, ofsX, ofsY, len, ch; if( !string || !string[0] ) return; #if 0 // g-cont. disabled 29/06/2011 // this code do a bad things with prompt dialogues // vertically centered if( !strchr( string, '\n' )) y = y + (( h - charH ) / 2 ); #endif if( shadow ) { shadowModulate = PackAlpha( uiColorBlack, UnpackAlpha( color )); ofsX = charW / 8; ofsY = charH / 8; } modulate = color; yy = y; while( *string ) { // get a line of text len = 0; while( *string ) { if( *string == '\n' ) { string++; break; } line[len++] = *string++; if( len == sizeof( line ) - 1 ) break; } line[len] = 0; // align the text as appropriate if( justify == 0 ) xx = x; if( justify == 1 ) xx = x + ((w - (ColorStrlen( line ) * charW )) / 2); if( justify == 2 ) xx = x + (w - (ColorStrlen( line ) * charW )); // draw it l = line; while( *l ) { if( IsColorString( l )) { if( !forceColor ) { int colorNum = ColorIndex( *(l+1) ); modulate = PackAlpha( g_iColorTable[colorNum], UnpackAlpha( color )); } l += 2; continue; } ch = *l++; ch &= 255; // fix for letter ¸ if( ch == 0xB8 ) ch = (byte)'å'; if( ch == 0xA8 ) ch = (byte)'Å'; if( ch != ' ' ) { if( shadow ) TextMessageDrawChar( xx + ofsX, yy + ofsY, charW, charH, ch, shadowModulate, uiStatic.hFont ); TextMessageDrawChar( xx, yy, charW, charH, ch, modulate, uiStatic.hFont ); } xx += charW; } yy += charH; } }