engine/EngineConsole.c
/*	If the line width has changed, reformat the buffer.
*/
If the line width has changed, reformat the buffer.
If the line width has changed reformat the buffer .
void Con_CheckResize(void)
{
	int		i, j, width, oldwidth, oldtotallines, numlines, numchars;
	char	*tbuf; 
	int 	mark; 
	width = (vid.conwidth >> 3)-2;  -- use vid.conwidth instead of vid.width
	if(width == con_linewidth)
		return;
	oldwidth 		= con_linewidth;
	con_linewidth 	= width;
	oldtotallines 	= con_totallines;
	if (con_linewidth <= 0)
		con_totallines = 0;
	else
		con_totallines 	= con_buffersize / con_linewidth;  -- con_buffersize replaces CON_TEXTSIZE
	numlines 		= oldtotallines;
	if(con_totallines < numlines)
		numlines = con_totallines;
	numchars = oldwidth;
	if(con_linewidth < numchars)
		numchars = con_linewidth;
	mark = Hunk_LowMark(); 
	tbuf = (char*)Hunk_Alloc(con_buffersize); 
	memcpy(tbuf, con_text, con_buffersize); -- con_buffersize replaces CON_TEXTSIZE
	memset(con_text, ' ', con_buffersize); -- con_buffersize replaces CON_TEXTSIZE
	for(i = 0; i < numlines; i++)
		for (j = 0; j < numchars; j++)
		{
			con_text[(con_totallines-1-i)*con_linewidth+j] =
					tbuf[((con_current-i+oldtotallines)%oldtotallines)*oldwidth+j];
		}
	Hunk_FreeToLowMark (mark); 
	Con_ClearNotify ();
	con_backscroll = 0;
	con_current = con_totallines - 1;
}
void Con_CheckResize ( void ) { int i , j , width , oldwidth , oldtotallines , numlines , numchars ; char * tbuf ; int mark ; width = ( vid . conwidth >> 3 ) - 2 ; if ( width == con_linewidth ) return ; oldwidth = con_linewidth ; con_linewidth = width ; oldtotallines = con_totallines ; if ( con_linewidth <= 0 ) con_totallines = 0 ; else con_totallines = con_buffersize / con_linewidth ; numlines = oldtotallines ; if ( con_totallines < numlines ) numlines = con_totallines ; numchars = oldwidth ; if ( con_linewidth < numchars ) numchars = con_linewidth ; mark = Hunk_LowMark ( ) ; tbuf = ( char * ) Hunk_Alloc ( con_buffersize ) ; memcpy ( tbuf , con_text , con_buffersize ) ; memset ( con_text , ' ' , con_buffersize ) ; for ( i = 0 ; i < numlines ; i ++ ) for ( j = 0 ; j < numchars ; j ++ ) { con_text [ ( con_totallines - 1 - i ) * con_linewidth + j ] = tbuf [ ( ( con_current - i + oldtotallines ) % oldtotallines ) * oldwidth + j ] ; } Hunk_FreeToLowMark ( mark ) ; Con_ClearNotify ( ) ; con_backscroll = 0 ; con_current = con_totallines - 1 ; }
If the line width has changed, reformat the buffer.
If the line width has changed reformat the buffer .
//johnfitz -- tbuf no longer a static array //johnfitz //johnfitz -- use vid.conwidth instead of vid.width // Can't rely on this massively if we're embedded anymore :( //johnfitz -- con_buffersize replaces CON_TEXTSIZE //johnfitz //johnfitz //johnfitz -- con_buffersize replaces CON_TEXTSIZE //johnfitz -- con_buffersize replaces CON_TEXTSIZE //johnfitz