@@ -239,8 +239,8 @@ void Con_CheckResize (void)
239239
240240 if (cls.glconfig .vidWidth <= 0 .0f ) // video hasn't been initialized yet
241241 {
242- con .xadjust = 1 ;
243- con .yadjust = 1 ;
242+ cls .xadjust = 1 ;
243+ cls .yadjust = 1 ;
244244 con.charWidth = SMALLCHAR_WIDTH;
245245 con.charHeight = SMALLCHAR_HEIGHT;
246246 con.linewidth = DEFAULT_CONSOLE_WIDTH;
@@ -254,21 +254,20 @@ void Con_CheckResize (void)
254254 }
255255 else
256256 {
257- float scale = (con_scale && con_scale->value > 0 .0f ) ? con_scale->value : 1 .0f ;
257+ float scale = (con_scale && con_scale->value > 0 .0f ) ? con_scale->value : 1 .0f ;
258+ int charWidth = scale * SMALLCHAR_WIDTH;
258259
259- // on wide screens, we will center the text
260- con.xadjust = 640 .0f / cls.glconfig .vidWidth ;
261- con.yadjust = 480 .0f / cls.glconfig .vidHeight ;
262-
263- width = (cls.glconfig .vidWidth / (scale * SMALLCHAR_WIDTH)) - 2 ;
260+ width = (cls.glconfig .vidWidth / charWidth) - 2 ;
264261
265262 if (width < 20 ) {
266- scale = cls.glconfig .vidWidth / (SMALLCHAR_WIDTH * (CON_MIN_WIDTH + 2 ));
267- width = (cls.glconfig .vidWidth / (scale * SMALLCHAR_WIDTH)) - 2 ;
263+ width = 20 ;
264+ charWidth = cls.glconfig .vidWidth / 22 ;
265+ scale = charWidth / SMALLCHAR_WIDTH;
268266 }
269- if ((int ) (scale * SMALLCHAR_WIDTH) == 0 ) {
270- scale = 1 .0f / SMALLCHAR_WIDTH + 0 .01f ;
271- width = (cls.glconfig .vidWidth / (scale * SMALLCHAR_WIDTH)) - 2 ;
267+ if (charWidth == 0 ) {
268+ charWidth = 1 ;
269+ width = cls.glconfig .vidWidth - 2 ;
270+ scale = 1 .0f / SMALLCHAR_WIDTH;
272271 }
273272
274273 if (con_timestamps->integer ) {
@@ -279,7 +278,7 @@ void Con_CheckResize (void)
279278 return ;
280279 }
281280
282- con.charWidth = scale * SMALLCHAR_WIDTH ;
281+ con.charWidth = charWidth ;
283282 con.charHeight = scale * SMALLCHAR_HEIGHT;
284283
285284 kg.g_consoleField .widthInChars = width - 1 ; // Command prompt
@@ -585,7 +584,7 @@ void Con_DrawNotify (void)
585584 int iPixelHeightToAdvance;
586585 if (re.Language_IsAsian ())
587586 {
588- fFontScale = con .xadjust * con.charWidth *
587+ fFontScale = cls .xadjust * con.charWidth *
589588 10 .0f / re.Font_StrLenPixels (" aaaaaaaaaa" , iFontIndex, 1 .0f );
590589 iPixelHeightToAdvance = 1.3 * re.Font_HeightPixels (iFontIndex, fFontScale );
591590 }
@@ -635,7 +634,7 @@ void Con_DrawNotify (void)
635634 //
636635 // and print...
637636 //
638- re.Font_DrawString (cl_conXOffset->integer + con .xadjust *con.charWidth ,
637+ re.Font_DrawString (cl_conXOffset->integer + cls .xadjust *con.charWidth ,
639638 v, sTemp , g_color_table[currentColor], iFontIndex, -1 , fFontScale );
640639
641640 v += iPixelHeightToAdvance;
@@ -765,9 +764,9 @@ void Con_DrawSolidConsole( float frac ) {
765764 int iPixelHeightToAdvance = con.charHeight ;
766765 if (re.Language_IsAsian ())
767766 {
768- fFontScale = con .xadjust * con.charWidth *
767+ fFontScale = cls .xadjust * con.charWidth *
769768 10 .0f / re.Font_StrLenPixels (" aaaaaaaaaa" , iFontIndex, 1 .0f );
770- y *= con .yadjust ;
769+ y *= cls .yadjust ;
771770 iPixelHeightToAdvance = 1.3 * re.Font_HeightPixels (iFontIndex, fFontScale );
772771 }
773772
@@ -804,7 +803,7 @@ void Con_DrawSolidConsole( float frac ) {
804803 //
805804 // and print...
806805 //
807- re.Font_DrawString (con .xadjust * con.charWidth , y, sTemp ,
806+ re.Font_DrawString (cls .xadjust * con.charWidth , y, sTemp ,
808807 g_color_table[currentColor], iFontIndex, -1 , fFontScale );
809808 }
810809 else
0 commit comments