From 7c95db3931eead61af270d4fa8c6ea3fb20c3159 Mon Sep 17 00:00:00 2001 From: Indev Date: Fri, 15 Aug 2025 21:51:58 +0300 Subject: [PATCH] Add option to center text in chat (chatcentertext) --- src/d_netcmd.c | 1 + src/g_game.c | 2 ++ src/g_game.h | 2 +- src/hu_stuff.c | 2 +- src/m_menudefs.c | 19 ++++++++++--------- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7a0ab193d..092bb85ad 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -941,6 +941,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_consolechat); CV_RegisterVar(&cv_chatnotifications); CV_RegisterVar(&cv_chatbacktint); + CV_RegisterVar(&cv_chatcentertext); CV_RegisterVar(&cv_songcredits); CV_RegisterVar(&cv_showfreeplay); CV_RegisterVar(&cv_skinselectspin); diff --git a/src/g_game.c b/src/g_game.c index 1f8a08c88..7f9f8ce7f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -311,6 +311,8 @@ consvar_t cv_chatbacktint = {"chatbacktint", "On", CV_SAVE, CV_OnOff, NULL, 0, N static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {2, "Window (Hidden)"}, {0, NULL}}; consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_chatcentertext = {"chatcentertext", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + // Pause game upon window losing focus consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/g_game.h b/src/g_game.h index 9d8b74144..43d9d14b2 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -49,7 +49,7 @@ extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard di extern INT16 rw_maximums[NUM_WEAPONS]; // used in game menu -extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection/*, cv_compactscoreboard*/; +extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_chatcentertext/*, cv_compactscoreboard*/; extern consvar_t cv_songcredits; extern consvar_t cv_showfreeplay; extern consvar_t cv_growmusic, cv_supermusic; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 3efae185b..d1b92aec3 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1658,7 +1658,7 @@ static void HU_drawMiniChat(void) if (cv_chatbacktint.value) // on request of wolfy V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); - V_DrawChatCharacter(x + dx + 2, y+dy, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap); + V_DrawChatCharacter(x + dx + 2, y+dy+cv_chatcentertext.value, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap); } dx += charwidth; diff --git a/src/m_menudefs.c b/src/m_menudefs.c index a3be98ac2..0179d267a 100644 --- a/src/m_menudefs.c +++ b/src/m_menudefs.c @@ -1404,18 +1404,19 @@ static menuitem_t OP_ChatOptionsMenu[] = NULL, "Chat Box Width", &cv_chatwidth, 20}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chat Box Height", &cv_chatheight, 30}, + {IT_STRING | IT_CVAR, NULL, "Center Text in Chat", &cv_chatcentertext, 40}, - {IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 45}, - {IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 55}, - {IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 65}, - {IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 75}, + {IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 55}, + {IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 65}, + {IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 75}, + {IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 85}, - {IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 95}, // shows ping above the framerate if we want to. - {IT_STRING | IT_CVAR, NULL, "Ping display style", &cv_pingstyle, 105}, - {IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 115}, - {IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 125}, + {IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 105}, // shows ping above the framerate if we want to. + {IT_STRING | IT_CVAR, NULL, "Ping display style", &cv_pingstyle, 115}, + {IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 125}, + {IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 135}, - {IT_STRING | IT_CVAR, NULL, "Show IP address in playerlist", &cv_shownodeip, 135}, + {IT_STRING | IT_CVAR, NULL, "Show IP address in playerlist", &cv_shownodeip, 145}, }; static const char* OP_ChatOptionsTooltips[] =