Skip to content

Commit aff1afd

Browse files
committed
Implement ValveSoftware#1155 with a ConVar
1 parent 6f8e92b commit aff1afd

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/game/client/hud_basechat.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ wchar_t* ReadLocalizedString( bf_read &msg, OUT_Z_BYTECAP(outSizeInBytes) wchar_
156156
return pOut;
157157
}
158158

159+
#ifdef BDSBASE
160+
extern ConVar mp_enable_coloredtext;
161+
#endif
162+
159163
//-----------------------------------------------------------------------------
160164
// Purpose: Reads a string from the current message, converts it to unicode, and strips out color codes
161165
//-----------------------------------------------------------------------------
@@ -178,10 +182,28 @@ wchar_t* ReadChatTextString( bf_read &msg, OUT_Z_BYTECAP(outSizeInBytes) wchar_t
178182
{
179183
// mark the next seven or nine characters. one for the control character and six or eight for the code itself.
180184
const int nSkip = ( *test == COLOR_HEXCODE ? 7 : 9 );
181-
for ( int i = 0; i < nSkip && *test != 0; i++, test++ )
185+
186+
#ifdef BDSBASE
187+
if (mp_enable_coloredtext.GetBool())
188+
{
189+
for (int i = 0; i < nSkip && *test != 0; i++, test++)
190+
{
191+
*test = COLOR_NORMAL;
192+
}
193+
}
194+
else
195+
{
196+
for (int i = 0; i < nSkip && *test != 0; i++)
197+
{
198+
*++test = COLOR_NORMAL;
199+
}
200+
}
201+
#else
202+
for (int i = 0; i < nSkip && *test != 0; i++, test++)
182203
{
183204
*test = COLOR_NORMAL;
184205
}
206+
#endif
185207

186208
// if we reached the end of the string first, then back up
187209
if ( *test == 0 )

0 commit comments

Comments
 (0)