@@ -119,6 +119,7 @@ void CChat::LoadCVars ( void )
119
119
CVARS_GET ( " chat_text_color" , m_TextColor );
120
120
CVARS_GET ( " chat_scale" , m_vecScale );
121
121
CVARS_GET ( " chat_width" , fWidth ); if ( m_bCanChangeWidth ) m_fNativeWidth = fWidth * CHAT_WIDTH;
122
+ CVARS_GET ( " chat_text_outline" , m_bTextBlackOutline );
122
123
CVARS_GET ( " chat_css_style_text" , m_bCssStyleText );
123
124
CVARS_GET ( " chat_css_style_background" , m_bCssStyleBackground );
124
125
CVARS_GET ( " chat_line_life" , (unsigned int &)m_ulChatLineLife );
@@ -248,7 +249,7 @@ void CChat::DrawDrawList ( const SDrawList& drawList, const CVector2D& topLeftOf
248
249
for ( uint i = 0 ; i < drawList.lineItemList .size () ; i++ )
249
250
{
250
251
const SDrawListLineItem& item = drawList.lineItemList [i];
251
- m_Lines [ item.uiLine ].Draw ( item.vecPosition - chatTopLeft + topLeftOffset, item.ucAlpha , drawList.bShadow , chatBounds );
252
+ m_Lines [ item.uiLine ].Draw ( item.vecPosition - chatTopLeft + topLeftOffset, item.ucAlpha , drawList.bShadow , drawList. bOutline , chatBounds );
252
253
}
253
254
254
255
CGraphics::GetSingleton ().EndDrawBatch ();
@@ -265,8 +266,8 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
265
266
CVector2D vecPosition ( m_vecBackgroundPosition.fX + ( 5 .0f * m_vecScale.fX ), m_vecBackgroundPosition.fY + m_vecBackgroundSize.fY - ( fLineDifference * 1 .25f ) );
266
267
unsigned long ulTime = GetTickCount32 ();
267
268
float fRcpChatLineFadeOut = 1 .0f / m_ulChatLineFadeOut;
268
- bool bShadow = ( m_Color.A * m_fBackgroundAlpha == 0 .f );
269
- bool bInputShadow = ( m_InputColor.A * m_fInputBackgroundAlpha == 0 .f );
269
+ bool bShadow = ( m_Color.A * m_fBackgroundAlpha == 0 .f ) && !m_bTextBlackOutline ;
270
+ bool bInputShadow = ( m_InputColor.A * m_fInputBackgroundAlpha == 0 .f ) && !m_bTextBlackOutline ;
270
271
271
272
if ( m_Color.A * m_fBackgroundAlpha > 0 .f )
272
273
{
@@ -291,6 +292,7 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
291
292
292
293
outDrawList.renderBounds = RenderBounds;
293
294
outDrawList.bShadow = bShadow;
295
+ outDrawList.bOutline = m_bTextBlackOutline;
294
296
295
297
// Smooth scroll
296
298
int iLineScroll;
@@ -346,7 +348,7 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
346
348
if ( m_bInputVisible )
347
349
{
348
350
CVector2D vecPosition ( m_vecInputPosition.fX + ( 5 .0f * m_vecScale.fX ), m_vecInputPosition.fY + ( fLineDifference * 0 .125f ) );
349
- m_InputLine.Draw ( vecPosition, 255 , bInputShadow );
351
+ m_InputLine.Draw ( vecPosition, 255 , bInputShadow, m_bTextBlackOutline );
350
352
}
351
353
}
352
354
@@ -905,7 +907,7 @@ float CChat::GetTextExtent ( const char * szText, float fScale )
905
907
}
906
908
907
909
908
- 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 )
910
+ 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 )
909
911
{
910
912
if ( !g_pChat )
911
913
return ;
@@ -924,19 +926,19 @@ void CChat::DrawTextString ( const char * szText, CRect2D DrawArea, float fZ, CR
924
926
{
925
927
// Clip text at the top
926
928
if ( DrawArea.fY1 + fLineHeight - RenderBounds.fY1 > 1 )
927
- 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 );
929
+ 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 );
928
930
}
929
931
else
930
932
if ( DrawArea.fY1 + fLineHeight > RenderBounds.fY2 )
931
933
{
932
934
// Clip text at the bottom
933
935
if ( RenderBounds.fY2 - DrawArea.fY1 > 1 )
934
- 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 );
936
+ 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 );
935
937
}
936
938
else
937
939
{
938
940
// Text not clipped
939
- 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 );
941
+ 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 );
940
942
}
941
943
}
942
944
}
@@ -1058,13 +1060,13 @@ const char* CChatLine::Format ( const char* szStringAnsi, float fWidth, CColor&
1058
1060
}
1059
1061
1060
1062
1061
- void CChatLine::Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, const CRect2D& RenderBounds )
1063
+ void CChatLine::Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline, const CRect2D& RenderBounds )
1062
1064
{
1063
1065
float fCurrentX = vecPosition.fX ;
1064
1066
std::vector < CChatLineSection >::iterator iter = m_Sections.begin ();
1065
1067
for ( ; iter != m_Sections.end () ; iter++ )
1066
1068
{
1067
- (*iter).Draw ( CVector2D ( fCurrentX , vecPosition.fY ), ucAlpha, bShadow, RenderBounds );
1069
+ (*iter).Draw ( CVector2D ( fCurrentX , vecPosition.fY ), ucAlpha, bShadow, bOutline, RenderBounds );
1068
1070
fCurrentX += (*iter).GetWidth ();
1069
1071
}
1070
1072
}
@@ -1082,27 +1084,27 @@ float CChatLine::GetWidth ()
1082
1084
}
1083
1085
1084
1086
1085
- void CChatInputLine::Draw ( CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow )
1087
+ void CChatInputLine::Draw ( CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline )
1086
1088
{
1087
1089
CRect2D RenderBounds ( 0 , 0 , 9999 , 9999 );
1088
1090
1089
1091
CColor colPrefix;
1090
1092
m_Prefix.GetColor ( colPrefix );
1091
1093
if ( colPrefix.A > 0 )
1092
- m_Prefix.Draw ( vecPosition, colPrefix.A , bShadow, RenderBounds );
1094
+ m_Prefix.Draw ( vecPosition, colPrefix.A , bShadow, bOutline, RenderBounds );
1093
1095
1094
1096
if ( g_pChat->m_InputTextColor .A > 0 && m_Sections.size () > 0 )
1095
1097
{
1096
1098
m_Sections [ 0 ].Draw ( CVector2D ( vecPosition.fX + m_Prefix.GetWidth (), vecPosition.fY ),
1097
- g_pChat->m_InputTextColor .A , bShadow, RenderBounds );
1099
+ g_pChat->m_InputTextColor .A , bShadow, bOutline, RenderBounds );
1098
1100
1099
1101
float fLineDifference = CChat::GetFontHeight ( g_pChat->m_vecScale .fY );
1100
1102
1101
1103
vector < CChatLine >::iterator iter = m_ExtraLines.begin ();
1102
1104
for ( ; iter != m_ExtraLines.end () ; iter++ )
1103
1105
{
1104
1106
vecPosition.fY += fLineDifference ;
1105
- (*iter).Draw ( vecPosition, g_pChat->m_InputTextColor .A , bShadow, RenderBounds );
1107
+ (*iter).Draw ( vecPosition, g_pChat->m_InputTextColor .A , bShadow, bOutline, RenderBounds );
1106
1108
}
1107
1109
}
1108
1110
}
@@ -1134,17 +1136,17 @@ CChatLineSection& CChatLineSection::operator = ( const CChatLineSection& other )
1134
1136
return *this ;
1135
1137
}
1136
1138
1137
- void CChatLineSection::Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, const CRect2D& RenderBounds )
1139
+ void CChatLineSection::Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline, const CRect2D& RenderBounds )
1138
1140
{
1139
1141
if ( !m_strText.empty () && ucAlpha > 0 )
1140
1142
{
1141
1143
if ( bShadow )
1142
1144
{
1143
1145
CRect2D drawShadowAt ( vecPosition.fX + 1 .0f , vecPosition.fY + 1 .0f , vecPosition.fX + 1000 .0f , vecPosition.fY + 1000 .0f );
1144
- 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 );
1146
+ 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 );
1145
1147
}
1146
1148
CRect2D drawAt ( vecPosition.fX , vecPosition.fY , vecPosition.fX + 1000 .0f , vecPosition.fY + 1000 .0f );
1147
- 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 );
1149
+ 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 );
1148
1150
}
1149
1151
}
1150
1152
0 commit comments