From 25fdba90160d460f0dc4b3b974a2ad6302f3b016 Mon Sep 17 00:00:00 2001 From: Daggolin Date: Tue, 7 Nov 2023 00:27:20 +0800 Subject: [PATCH] [Shared] Add con_height cvar to set console height. Set to 0 to restore previous behaviour. (cherry picked from commit c007dfd5b82616dfd9bbffe50574c3734cc9fd1a) --- codemp/client/cl_console.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/codemp/client/cl_console.cpp b/codemp/client/cl_console.cpp index 71b8974aa6..133782a7f4 100644 --- a/codemp/client/cl_console.cpp +++ b/codemp/client/cl_console.cpp @@ -43,6 +43,7 @@ cvar_t *con_autoclear; cvar_t *con_notifywords; cvar_t *con_notifyconnect; cvar_t *con_notifyvote; +cvar_t *con_height; #define DEFAULT_CONSOLE_WIDTH 78 #define TIMESTAMP_LENGTH 9 @@ -452,19 +453,19 @@ void Con_CheckResize (void) else { float scale = (con_scale && con_scale->value > 0.0f) ? con_scale->value : 1.0f; - + width = (cls.glconfig.vidWidth / (scale * SMALLCHAR_WIDTH)) - 2; - + if (width == con.linewidth) return; - + con.charWidth = scale * SMALLCHAR_WIDTH; con.charHeight = scale * SMALLCHAR_HEIGHT; - + g_consoleField.widthInChars = width; for (i = 0; i < COMMAND_HISTORY; i++) { historyEditLines[i].widthInChars = width; - + } // on wide screens, we will center the text @@ -542,6 +543,7 @@ void Con_Init (void) { con_notifywords = Cvar_Get("con_notifywords", "0", CVAR_ARCHIVE, "Notifies you when defined words are mentioned"); con_notifyconnect = Cvar_Get("con_notifyconnect", "0", CVAR_ARCHIVE, "Notifies you when someone connects to the server"); con_notifyvote = Cvar_Get("con_notifyvote", "1", CVAR_ARCHIVE, "Notifies you when someone calls a vote"); + con_height = Cvar_Get ("con_height", "0.5", CVAR_ARCHIVE_ND); Field_Clear( &g_consoleField ); g_consoleField.widthInChars = DEFAULT_CONSOLE_WIDTH; @@ -1104,7 +1106,7 @@ Scroll it up or down void Con_RunConsole (void) { // decide on the destination height of the console if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) - con.finalFrac = con.tempFrac; // visibility + con.finalFrac = (con_height->value != 0) ? con_height->value : con.tempFrac; else con.finalFrac = 0; // none visible