@@ -124,6 +124,7 @@ void CChat::LoadCVars ( void )
124
124
CVARS_GET ( " chat_text_color" , m_TextColor );
125
125
CVARS_GET ( " chat_scale" , m_vecScale );
126
126
CVARS_GET ( " chat_width" , fWidth ); if ( m_bCanChangeWidth ) m_fNativeWidth = fWidth * CHAT_WIDTH;
127
+ CVARS_GET ( " chat_text_outline" , m_bTextBlackOutline );
127
128
CVARS_GET ( " chat_css_style_text" , m_bCssStyleText );
128
129
CVARS_GET ( " chat_css_style_background" , m_bCssStyleBackground );
129
130
CVARS_GET ( " chat_line_life" , (unsigned int &)m_ulChatLineLife );
@@ -135,50 +136,6 @@ void CChat::LoadCVars ( void )
135
136
CVARS_GET ( " chat_position_horizontal" , (unsigned int &)m_ePositionHorizontal );
136
137
CVARS_GET ( " chat_position_vertical" , (unsigned int &)m_ePositionVertical );
137
138
CVARS_GET ( " chat_text_alignment" , (unsigned int &)m_eTextAlign );
138
-
139
- // Modify default chat box to be like 'Transparent' preset
140
- SString strFlags;
141
- CVARS_GET ( " fixup_flags" , strFlags );
142
- if ( strFlags.find ( " -cb" ) == std::string::npos )
143
- {
144
- CVARS_SET ( " fixup_flags" , strFlags + " -cb" );
145
-
146
- if ( Font == 0 // chat_font
147
- && m_uiNumLines == 7 // chat_lines
148
- && m_Color == CColor (0 ,0 ,128 ,100 ) // chat_color
149
- && m_InputColor == CColor (0 ,0 ,191 ,110 ) // chat_input_color
150
- && m_InputTextColor == CColor (172 ,213 ,254 ,255 ) // chat_input_text_color
151
- && m_vecScale == CVector2D ( 1 .0f , 1 .0f ) // chat_scale
152
- && fWidth == 1 .0f // chat_width
153
- && m_bCssStyleText == false // chat_css_style_text
154
- && m_bCssStyleBackground == false // chat_css_style_background
155
- && m_ulChatLineLife == 12000 // chat_line_life
156
- && m_ulChatLineFadeOut == 3000 // chat_line_fade_out
157
- )
158
- {
159
- CVARS_SET ( " chat_font" , (unsigned int )2 );
160
- CVARS_SET ( " chat_color" , CColor (0 ,0 ,0 ,0 ) );
161
- CVARS_SET ( " chat_input_color" , CColor (0 ,0 ,0 ,0 ) );
162
- CVARS_SET ( " chat_lines" , 10 );
163
- CVARS_SET ( " chat_width" , 1 .5f );
164
- LoadCVars ();
165
- }
166
- }
167
-
168
- // Fix mapalpha being set incorrectly in 1.0.4-9.1752.1
169
- CVARS_GET ( " fixup_flags" , strFlags );
170
- if ( strFlags.find ( " -ma" ) == std::string::npos )
171
- {
172
- CVARS_SET ( " fixup_flags" , strFlags + " -ma" );
173
-
174
- int iVar = -1 ;
175
- CVARS_GET ( " mapalpha" , iVar );
176
- if ( iVar < 3 )
177
- {
178
- iVar = 155 ;
179
- CVARS_SET ( " mapalpha" , iVar );
180
- }
181
- }
182
139
}
183
140
184
141
@@ -303,7 +260,7 @@ void CChat::DrawDrawList ( const SDrawList& drawList, const CVector2D& topLeftOf
303
260
304
261
for ( const auto & item : drawList.lineItemList )
305
262
{
306
- m_Lines [ item.uiLine ].Draw ( item.vecPosition - chatTopLeft + topLeftOffset, item.ucAlpha , drawList.bShadow , chatBounds );
263
+ m_Lines [ item.uiLine ].Draw ( item.vecPosition - chatTopLeft + topLeftOffset, item.ucAlpha , drawList.bShadow , drawList. bOutline , chatBounds );
307
264
}
308
265
309
266
CGraphics::GetSingleton ().EndDrawBatch ();
@@ -321,8 +278,8 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
321
278
float fMaxLineWidth = m_vecBackgroundSize.fX - ( 10 .0f * m_vecScale.fX );
322
279
unsigned long ulTime = GetTickCount32 ();
323
280
float fRcpChatLineFadeOut = 1 .0f / m_ulChatLineFadeOut;
324
- bool bShadow = ( m_Color.A * m_fBackgroundAlpha == 0 .f );
325
- bool bInputShadow = ( m_InputColor.A * m_fInputBackgroundAlpha == 0 .f );
281
+ bool bShadow = ( m_Color.A * m_fBackgroundAlpha == 0 .f ) && !m_bTextBlackOutline ;
282
+ bool bInputShadow = ( m_InputColor.A * m_fInputBackgroundAlpha == 0 .f ) && !m_bTextBlackOutline ;
326
283
327
284
if ( m_Color.A * m_fBackgroundAlpha > 0 .f )
328
285
{
@@ -347,6 +304,7 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
347
304
348
305
outDrawList.renderBounds = RenderBounds;
349
306
outDrawList.bShadow = bShadow;
307
+ outDrawList.bOutline = m_bTextBlackOutline;
350
308
351
309
// Smooth scroll
352
310
int iLineScroll;
@@ -409,7 +367,7 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
409
367
if ( m_bInputVisible )
410
368
{
411
369
CVector2D vecPosition ( m_vecInputPosition.fX + ( 5 .0f * m_vecScale.fX ), m_vecInputPosition.fY + ( fLineDifference * 0 .125f ) );
412
- m_InputLine.Draw ( vecPosition, 255 , bInputShadow );
370
+ m_InputLine.Draw ( vecPosition, 255 , bInputShadow, m_bTextBlackOutline );
413
371
}
414
372
}
415
373
@@ -1028,7 +986,7 @@ float CChat::GetTextExtent ( const char * szText, float fScale )
1028
986
}
1029
987
1030
988
1031
- void CChat::DrawTextString ( const char * szText, CRect2D DrawArea, float fZ , CRect2D ClipRect, unsigned long ulFormat, unsigned long ulColor, float fScaleX , float fScaleY , const CRect2D& RenderBounds )
989
+ void CChat::DrawTextString ( const char * szText, CRect2D DrawArea, float fZ , CRect2D ClipRect, unsigned long ulFormat, unsigned long ulColor, float fScaleX , float fScaleY , bool bOutline, const CRect2D& RenderBounds )
1032
990
{
1033
991
if ( !g_pChat )
1034
992
return ;
@@ -1047,18 +1005,18 @@ void CChat::DrawTextString ( const char * szText, CRect2D DrawArea, float fZ, CR
1047
1005
{
1048
1006
// Clip text at the top
1049
1007
if ( DrawArea.fY1 + fLineHeight - RenderBounds.fY1 > 1 )
1050
- g_pCore->GetGraphics ()->DrawText ( ( int ) DrawArea.fX1 , ( int ) RenderBounds.fY1 , ( int ) DrawArea.fX2 , ( int ) DrawArea.fY1 + fLineHeight , ulColor, szText, fScaleX , fScaleY , DT_LEFT | DT_BOTTOM | DT_SINGLELINE , g_pChat->m_pDXFont );
1008
+ g_pCore->GetGraphics ()->DrawString ( ( int ) DrawArea.fX1 , ( int ) RenderBounds.fY1 , ( int ) DrawArea.fX2 , ( int ) DrawArea.fY1 + fLineHeight , ulColor, szText, fScaleX , fScaleY , DT_LEFT | DT_BOTTOM | DT_SINGLELINE , g_pChat->m_pDXFont , bOutline );
1051
1009
}
1052
1010
else if ( DrawArea.fY1 + fLineHeight > RenderBounds.fY2 )
1053
1011
{
1054
1012
// Clip text at the bottom
1055
1013
if ( RenderBounds.fY2 - DrawArea.fY1 > 1 )
1056
- g_pCore->GetGraphics ()->DrawText ( ( int ) DrawArea.fX1 , ( int ) DrawArea.fY1 , ( int ) DrawArea.fX2 , ( int ) RenderBounds.fY2 , ulColor, szText, fScaleX , fScaleY , DT_LEFT | DT_TOP | DT_SINGLELINE , g_pChat->m_pDXFont );
1014
+ g_pCore->GetGraphics ()->DrawString ( ( int ) DrawArea.fX1 , ( int ) DrawArea.fY1 , ( int ) DrawArea.fX2 , ( int ) RenderBounds.fY2 , ulColor, szText, fScaleX , fScaleY , DT_LEFT | DT_TOP | DT_SINGLELINE , g_pChat->m_pDXFont , bOutline );
1057
1015
}
1058
1016
else
1059
1017
{
1060
1018
// Text not clipped
1061
- g_pCore->GetGraphics ()->DrawText ( ( int ) DrawArea.fX1 , ( int ) DrawArea.fY1 , ( int ) DrawArea.fX1 , ( int ) DrawArea.fY1 , ulColor, szText, fScaleX , fScaleY , DT_LEFT | DT_TOP | DT_NOCLIP, g_pChat->m_pDXFont );
1019
+ g_pCore->GetGraphics ()->DrawString ( ( int ) DrawArea.fX1 , ( int ) DrawArea.fY1 , ( int ) DrawArea.fX1 , ( int ) DrawArea.fY1 , ulColor, szText, fScaleX , fScaleY , DT_LEFT | DT_TOP | DT_NOCLIP, g_pChat->m_pDXFont , bOutline );
1062
1020
}
1063
1021
}
1064
1022
}
@@ -1180,13 +1138,13 @@ const char* CChatLine::Format ( const char* szStringAnsi, float fWidth, CColor&
1180
1138
}
1181
1139
1182
1140
1183
- void CChatLine::Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, const CRect2D& RenderBounds )
1141
+ void CChatLine::Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline, const CRect2D& RenderBounds )
1184
1142
{
1185
1143
float fCurrentX = vecPosition.fX ;
1186
1144
std::vector < CChatLineSection >::iterator iter = m_Sections.begin ();
1187
1145
for ( ; iter != m_Sections.end () ; iter++ )
1188
1146
{
1189
- (*iter).Draw ( CVector2D ( fCurrentX , vecPosition.fY ), ucAlpha, bShadow, RenderBounds );
1147
+ (*iter).Draw ( CVector2D ( fCurrentX , vecPosition.fY ), ucAlpha, bShadow, bOutline, RenderBounds );
1190
1148
fCurrentX += (*iter).GetWidth ();
1191
1149
}
1192
1150
}
@@ -1204,27 +1162,27 @@ float CChatLine::GetWidth ()
1204
1162
}
1205
1163
1206
1164
1207
- void CChatInputLine::Draw ( CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow )
1165
+ void CChatInputLine::Draw ( CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline )
1208
1166
{
1209
1167
CRect2D RenderBounds ( 0 , 0 , 9999 , 9999 );
1210
1168
1211
1169
CColor colPrefix;
1212
1170
m_Prefix.GetColor ( colPrefix );
1213
1171
if ( colPrefix.A > 0 )
1214
- m_Prefix.Draw ( vecPosition, colPrefix.A , bShadow, RenderBounds );
1215
-
1172
+ m_Prefix.Draw ( vecPosition, colPrefix.A , bShadow, bOutline, RenderBounds );
1173
+
1216
1174
if ( g_pChat->m_InputTextColor .A > 0 && m_Sections.size () > 0 )
1217
1175
{
1218
1176
m_Sections [ 0 ].Draw ( CVector2D ( vecPosition.fX + m_Prefix.GetWidth (), vecPosition.fY ),
1219
- g_pChat->m_InputTextColor .A , bShadow, RenderBounds );
1177
+ g_pChat->m_InputTextColor .A , bShadow, bOutline, RenderBounds );
1220
1178
1221
1179
float fLineDifference = CChat::GetFontHeight ( g_pChat->m_vecScale .fY );
1222
1180
1223
1181
vector < CChatLine >::iterator iter = m_ExtraLines.begin ();
1224
1182
for ( ; iter != m_ExtraLines.end () ; iter++ )
1225
1183
{
1226
1184
vecPosition.fY += fLineDifference ;
1227
- (*iter).Draw ( vecPosition, g_pChat->m_InputTextColor .A , bShadow, RenderBounds );
1185
+ (*iter).Draw ( vecPosition, g_pChat->m_InputTextColor .A , bShadow, bOutline, RenderBounds );
1228
1186
}
1229
1187
}
1230
1188
}
@@ -1256,17 +1214,17 @@ CChatLineSection& CChatLineSection::operator = ( const CChatLineSection& other )
1256
1214
return *this ;
1257
1215
}
1258
1216
1259
- void CChatLineSection::Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, const CRect2D& RenderBounds )
1217
+ void CChatLineSection::Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline, const CRect2D& RenderBounds )
1260
1218
{
1261
1219
if ( !m_strText.empty () && ucAlpha > 0 )
1262
1220
{
1263
1221
if ( bShadow )
1264
1222
{
1265
1223
CRect2D drawShadowAt ( vecPosition.fX + 1 .0f , vecPosition.fY + 1 .0f , vecPosition.fX + 1000 .0f , vecPosition.fY + 1000 .0f );
1266
- CChat::DrawTextString ( m_strText.c_str (), drawShadowAt, 0 .0f , drawShadowAt, 0 , COLOR_ARGB ( ucAlpha, 0 , 0 , 0 ), g_pChat->m_vecScale .fX , g_pChat->m_vecScale .fY , RenderBounds );
1224
+ CChat::DrawTextString ( m_strText.c_str (), drawShadowAt, 0 .0f , drawShadowAt, 0 , COLOR_ARGB ( ucAlpha, 0 , 0 , 0 ), g_pChat->m_vecScale .fX , g_pChat->m_vecScale .fY , bOutline, RenderBounds );
1267
1225
}
1268
1226
CRect2D drawAt ( vecPosition.fX , vecPosition.fY , vecPosition.fX + 1000 .0f , vecPosition.fY + 1000 .0f );
1269
- CChat::DrawTextString ( m_strText.c_str (), drawAt, 0 .0f , drawAt, 0 , COLOR_ARGB ( ucAlpha, m_Color.R , m_Color.G , m_Color.B ), g_pChat->m_vecScale .fX , g_pChat->m_vecScale .fY , RenderBounds );
1227
+ CChat::DrawTextString ( m_strText.c_str (), drawAt, 0 .0f , drawAt, 0 , COLOR_ARGB ( ucAlpha, m_Color.R , m_Color.G , m_Color.B ), g_pChat->m_vecScale .fX , g_pChat->m_vecScale .fY , bOutline, RenderBounds );
1270
1228
}
1271
1229
}
1272
1230
0 commit comments