diff --git a/README.md b/README.md index ec8cb8ee..c97c7a00 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Some of the major features currently implemented are: is stored in "%APPDATA%\Quake3") * PNG support * Web support via Emscripten + * console scaling with con_scale * Many, many bug fixes The map editor and associated compiling tools are not included. We suggest you @@ -259,6 +260,8 @@ the above locations, if desired. at the beginning con_autoclear - Set to 0 to disable clearing console input text when console is closed + con_scale - Scales console text to make it legible at + high resolutions in_joystickUseAnalog - Do not translate joystick axis events to keyboard commands diff --git a/code/client/cl_console.c b/code/client/cl_console.c index 44dc7621..42ed3904 100644 --- a/code/client/cl_console.c +++ b/code/client/cl_console.c @@ -24,8 +24,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "client.h" -int g_console_field_width = 78; - +#define DEFAULT_CONSOLE_WIDTH 78 +int g_console_field_width = DEFAULT_CONSOLE_WIDTH; +int g_smallchar_width = SMALLCHAR_WIDTH; +int g_smallchar_height = SMALLCHAR_HEIGHT; #define NUM_CON_TIMES 4 @@ -58,8 +60,8 @@ console_t con; cvar_t *con_conspeed; cvar_t *con_autoclear; cvar_t *con_notifytime; +cvar_t *con_scale; -#define DEFAULT_CONSOLE_WIDTH 78 /* @@ -283,7 +285,13 @@ void Con_CheckResize (void) int i, j, width, oldwidth, oldtotallines, numlines, numchars; short tbuf[CON_TEXTSIZE]; - width = (cls.glconfig.vidWidth / SMALLCHAR_WIDTH) - 2; + if (con_scale != NULL) + { + g_smallchar_width = (int)((float)SMALLCHAR_WIDTH * con_scale->value); + g_smallchar_height = (int)((float)SMALLCHAR_HEIGHT * con_scale->value); + } + + width = (cls.glconfig.vidWidth / g_smallchar_width) - 2; if (width == con.linewidth) return; @@ -359,6 +367,8 @@ void Con_Init (void) { con_notifytime = Cvar_Get ("con_notifytime", "3", 0); con_conspeed = Cvar_Get ("scr_conspeed", "3", 0); con_autoclear = Cvar_Get("con_autoclear", "1", CVAR_ARCHIVE); + con_scale = Cvar_Get("con_scale", "1", CVAR_ARCHIVE); + Cvar_CheckRange(con_scale, 1.0f, 4.0f, qfalse); Field_Clear( &g_consoleField ); g_consoleField.widthInChars = g_console_field_width; @@ -543,14 +553,14 @@ void Con_DrawInput (void) { return; } - y = con.vislines - ( SMALLCHAR_HEIGHT * 2 ); + y = con.vislines - ( g_smallchar_height * 2 ); re.SetColor( con.color ); - SCR_DrawSmallChar( con.xadjust + 1 * SMALLCHAR_WIDTH, y, ']' ); + SCR_DrawSmallChar( con.xadjust + 1 * g_smallchar_width, y, ']' ); - Field_Draw( &g_consoleField, con.xadjust + 2 * SMALLCHAR_WIDTH, y, - SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue, qtrue ); + Field_Draw( &g_consoleField, con.xadjust + 2 * g_smallchar_width, y, + SCREEN_WIDTH - 3 * g_smallchar_width, qtrue, qtrue ); } @@ -598,10 +608,10 @@ void Con_DrawNotify (void) currentColor = ColorIndexForNumber( text[x]>>8 ); re.SetColor( g_color_table[currentColor] ); } - SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + (x+1)*SMALLCHAR_WIDTH, v, text[x] & 0xff ); + SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + (x+1)*g_smallchar_width, v, text[x] & 0xff ); } - v += SMALLCHAR_HEIGHT; + v += g_smallchar_height; } re.SetColor( NULL ); @@ -681,16 +691,16 @@ void Con_DrawSolidConsole( float frac ) { i = strlen( Q3_VERSION ); for (x=0 ; x>8 ); re.SetColor( g_color_table[currentColor] ); } - SCR_DrawSmallChar( con.xadjust + (x+1)*SMALLCHAR_WIDTH, y, text[x] & 0xff ); + SCR_DrawSmallChar( con.xadjust + (x+1)*g_smallchar_width, y, text[x] & 0xff ); } } diff --git a/code/client/cl_keys.c b/code/client/cl_keys.c index 9f9fd7d8..7aca5b62 100644 --- a/code/client/cl_keys.c +++ b/code/client/cl_keys.c @@ -343,8 +343,8 @@ 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 ) { +static void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, + qboolean drawSmall, qboolean showCursor, qboolean noColorEscape ) { int len; int drawLen; int prestep; @@ -381,7 +381,7 @@ void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, q str[ drawLen ] = 0; // draw it - if ( size == SMALLCHAR_WIDTH ) { + if ( drawSmall ) { float color[4]; color[0] = color[1] = color[2] = color[3] = 1.0; @@ -405,7 +405,7 @@ void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, q i = drawLen - strlen( str ); - if ( size == SMALLCHAR_WIDTH ) { + if ( drawSmall ) { SCR_DrawSmallChar( x + ( edit->cursor - prestep - i ) * size, y, cursorChar ); } else { str[0] = cursorChar; @@ -418,12 +418,12 @@ void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, q void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape ) { - Field_VariableSizeDraw( edit, x, y, width, SMALLCHAR_WIDTH, showCursor, noColorEscape ); + Field_VariableSizeDraw( edit, x, y, width, g_smallchar_width, qtrue, showCursor, noColorEscape ); } void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape ) { - Field_VariableSizeDraw( edit, x, y, width, BIGCHAR_WIDTH, showCursor, noColorEscape ); + Field_VariableSizeDraw( edit, x, y, width, BIGCHAR_WIDTH, qfalse, showCursor, noColorEscape ); } /* diff --git a/code/client/cl_main.c b/code/client/cl_main.c index d6c530a5..1fe312ef 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -3175,7 +3175,7 @@ void CL_InitRenderer( void ) { cls.charSetShader = re.RegisterShader( "gfx/2d/bigchars" ); cls.whiteShader = re.RegisterShader( "white" ); cls.consoleShader = re.RegisterShader( "console" ); - g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2; + g_console_field_width = cls.glconfig.vidWidth / g_smallchar_width - 2; g_consoleField.widthInChars = g_console_field_width; } diff --git a/code/client/cl_scrn.c b/code/client/cl_scrn.c index 831d5ef7..664a94a8 100644 --- a/code/client/cl_scrn.c +++ b/code/client/cl_scrn.c @@ -168,7 +168,7 @@ void SCR_DrawSmallChar( int x, int y, int ch ) { return; } - if ( y < -SMALLCHAR_HEIGHT ) { + if ( y < -g_smallchar_height ) { return; } @@ -179,7 +179,7 @@ void SCR_DrawSmallChar( int x, int y, int ch ) { fcol = col*0.0625; size = 0.0625; - re.DrawStretchPic( x, y, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, + re.DrawStretchPic( x, y, g_smallchar_width, g_smallchar_height, fcol, frow, fcol + size, frow + size, cls.charSetShader ); @@ -287,7 +287,7 @@ void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, } } SCR_DrawSmallChar( xx, y, *s ); - xx += SMALLCHAR_WIDTH; + xx += g_smallchar_width; s++; } re.SetColor( NULL ); diff --git a/code/client/client.h b/code/client/client.h index cb20c44f..b2954d50 100644 --- a/code/client/client.h +++ b/code/client/client.h @@ -536,6 +536,9 @@ qboolean CL_UpdateVisiblePings_f( int source ); // // console // +extern int g_smallchar_width; +extern int g_smallchar_height; + void Con_DrawCharacter (int cx, int line, int num); void Con_CheckResize (void);