Skip to content

Commit 0e7cd50

Browse files
author
Marek Kulik
committed
Merge branch 'master' into feature/chatbox-position
2 parents 8b68efd + fc411cd commit 0e7cd50

File tree

3,463 files changed

+478966
-53423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,463 files changed

+478966
-53423
lines changed

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
root = true
33

44
[*]
5-
end_of_line = crlf
65
insert_final_newline = true
6+
end_of_line = crlf
77

88
[*.{h,hpp,c,cpp,cc}]
99
indent_style = space
1010
indent_size = 4
11+
12+
[*.sh]
13+
end_of_line = lf

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,6 @@ _Pvt_Extensions
307307
Bin/
308308
Build/
309309
InstallFiles/
310+
utils/vswhere.exe
311+
utils/DXFiles.zip
312+
utils/DXFiles/

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ matrix:
2929
NIGHTLY_UPLOAD=0
3030

3131
before_script:
32-
- wget https://github.com/sbx320/premake5-travis/blob/master/premake5?raw=true -O ./premake5 &&
32+
- wget https://mirror.mtasa.com/bdata/premake5-travis -O ./premake5 &&
3333
chmod +x ./premake5 &&
3434
./premake5 gmake &&
3535
cd Build

Client/ceflauncher/premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ project "CEFLauncher"
77
includedirs { "../sdk" }
88

99
links { "CEFLauncher DLL"}
10-
flags { "WinMain" }
10+
entrypoint "WinMainCRTStartup"
1111

1212
vpaths {
1313
["Headers/*"] = "**.h",

Client/cefweb/CWebView.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ void CWebView::Initialise ()
6565
browserSettings.javascript = bEnabledJavascript ? cef_state_t::STATE_ENABLED : cef_state_t::STATE_DISABLED;
6666
}
6767

68+
// Set background color to opaque white if transparency is disabled
69+
if (!m_bIsTransparent)
70+
browserSettings.background_color = 0xffffffff;
71+
6872
CefWindowInfo windowInfo;
69-
windowInfo.SetAsWindowless ( g_pCore->GetHookedWindow (), m_bIsTransparent );
73+
windowInfo.SetAsWindowless ( g_pCore->GetHookedWindow () );
7074

7175
CefBrowserHost::CreateBrowser ( windowInfo, this, "", browserSettings, nullptr );
7276
}

Client/core/CChat.cpp

Lines changed: 20 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ void CChat::LoadCVars ( void )
124124
CVARS_GET ( "chat_text_color", m_TextColor );
125125
CVARS_GET ( "chat_scale", m_vecScale );
126126
CVARS_GET ( "chat_width", fWidth ); if( m_bCanChangeWidth ) m_fNativeWidth = fWidth * CHAT_WIDTH;
127+
CVARS_GET ( "chat_text_outline", m_bTextBlackOutline );
127128
CVARS_GET ( "chat_css_style_text", m_bCssStyleText );
128129
CVARS_GET ( "chat_css_style_background", m_bCssStyleBackground );
129130
CVARS_GET ( "chat_line_life", (unsigned int &)m_ulChatLineLife );
@@ -135,50 +136,6 @@ void CChat::LoadCVars ( void )
135136
CVARS_GET ( "chat_position_horizontal", (unsigned int &)m_ePositionHorizontal );
136137
CVARS_GET ( "chat_position_vertical", (unsigned int &)m_ePositionVertical );
137138
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-
}
182139
}
183140

184141

@@ -303,7 +260,7 @@ void CChat::DrawDrawList ( const SDrawList& drawList, const CVector2D& topLeftOf
303260

304261
for ( const auto & item : drawList.lineItemList )
305262
{
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 );
307264
}
308265

309266
CGraphics::GetSingleton ().EndDrawBatch ();
@@ -321,8 +278,8 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
321278
float fMaxLineWidth = m_vecBackgroundSize.fX - ( 10.0f * m_vecScale.fX );
322279
unsigned long ulTime = GetTickCount32 ();
323280
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;
326283

327284
if ( m_Color.A * m_fBackgroundAlpha > 0.f )
328285
{
@@ -347,6 +304,7 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
347304

348305
outDrawList.renderBounds = RenderBounds;
349306
outDrawList.bShadow = bShadow;
307+
outDrawList.bOutline = m_bTextBlackOutline;
350308

351309
// Smooth scroll
352310
int iLineScroll;
@@ -409,7 +367,7 @@ void CChat::GetDrawList ( SDrawList& outDrawList )
409367
if ( m_bInputVisible )
410368
{
411369
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 );
413371
}
414372
}
415373

@@ -1028,7 +986,7 @@ float CChat::GetTextExtent ( const char * szText, float fScale )
1028986
}
1029987

1030988

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 )
1032990
{
1033991
if ( !g_pChat )
1034992
return;
@@ -1047,18 +1005,18 @@ void CChat::DrawTextString ( const char * szText, CRect2D DrawArea, float fZ, CR
10471005
{
10481006
// Clip text at the top
10491007
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 );
10511009
}
10521010
else if ( DrawArea.fY1 + fLineHeight > RenderBounds.fY2 )
10531011
{
10541012
// Clip text at the bottom
10551013
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 );
10571015
}
10581016
else
10591017
{
10601018
// 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 );
10621020
}
10631021
}
10641022
}
@@ -1180,13 +1138,13 @@ const char* CChatLine::Format ( const char* szStringAnsi, float fWidth, CColor&
11801138
}
11811139

11821140

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 )
11841142
{
11851143
float fCurrentX = vecPosition.fX;
11861144
std::vector < CChatLineSection >::iterator iter = m_Sections.begin ();
11871145
for ( ; iter != m_Sections.end () ; iter++ )
11881146
{
1189-
(*iter).Draw ( CVector2D ( fCurrentX, vecPosition.fY ), ucAlpha, bShadow, RenderBounds );
1147+
(*iter).Draw ( CVector2D ( fCurrentX, vecPosition.fY ), ucAlpha, bShadow, bOutline, RenderBounds );
11901148
fCurrentX += (*iter).GetWidth ();
11911149
}
11921150
}
@@ -1204,27 +1162,27 @@ float CChatLine::GetWidth ()
12041162
}
12051163

12061164

1207-
void CChatInputLine::Draw ( CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow )
1165+
void CChatInputLine::Draw ( CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline )
12081166
{
12091167
CRect2D RenderBounds ( 0, 0, 9999, 9999 );
12101168

12111169
CColor colPrefix;
12121170
m_Prefix.GetColor ( colPrefix );
12131171
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+
12161174
if ( g_pChat->m_InputTextColor.A > 0 && m_Sections.size () > 0 )
12171175
{
12181176
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 );
12201178

12211179
float fLineDifference = CChat::GetFontHeight ( g_pChat->m_vecScale.fY );
12221180

12231181
vector < CChatLine >::iterator iter = m_ExtraLines.begin ();
12241182
for ( ; iter != m_ExtraLines.end () ; iter++ )
12251183
{
12261184
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 );
12281186
}
12291187
}
12301188
}
@@ -1256,17 +1214,17 @@ CChatLineSection& CChatLineSection::operator = ( const CChatLineSection& other )
12561214
return *this;
12571215
}
12581216

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 )
12601218
{
12611219
if ( !m_strText.empty () && ucAlpha > 0 )
12621220
{
12631221
if ( bShadow )
12641222
{
12651223
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 );
12671225
}
12681226
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 );
12701228
}
12711229
}
12721230

Client/core/CChat.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class CChatLineSection
8181

8282
CChatLineSection& operator = ( const CChatLineSection& other );
8383

84-
void Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, const CRect2D& RenderBounds );
84+
void Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline, const CRect2D& RenderBounds );
8585
float GetWidth ( void );
8686
inline const char* GetText ( void ) { return m_strText.c_str (); }
8787
void SetText ( const char* szText ) { m_strText = szText; }
@@ -101,7 +101,7 @@ class CChatLine
101101
CChatLine ( void );
102102

103103
virtual const char* Format ( const char* szText, float fWidth, CColor& color, bool bColorCoded );
104-
virtual void Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, const CRect2D& RenderBounds );
104+
virtual void Draw ( const CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline, const CRect2D& RenderBounds );
105105
virtual float GetWidth ( void );
106106
bool IsActive ( void ) { return m_bActive; }
107107
void SetActive ( bool bActive ) { m_bActive = bActive; }
@@ -119,7 +119,7 @@ class CChatLine
119119
class CChatInputLine : public CChatLine
120120
{
121121
public:
122-
void Draw ( CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow );
122+
void Draw ( CVector2D& vecPosition, unsigned char ucAlpha, bool bShadow, bool bOutline );
123123
void Clear ( void );
124124

125125
CChatLineSection m_Prefix;
@@ -156,6 +156,7 @@ struct SDrawList
156156
{
157157
CRect2D renderBounds;
158158
bool bShadow;
159+
bool bOutline;
159160
std::vector < SDrawListLineItem > lineItemList;
160161

161162
bool operator!= ( const SDrawList& other ) const
@@ -166,6 +167,7 @@ struct SDrawList
166167
{
167168
if ( lineItemList.size () != other.lineItemList.size ()
168169
|| bShadow != other.bShadow
170+
|| bOutline != other.bOutline
169171
|| renderBounds != other.renderBounds )
170172
return false;
171173

@@ -212,7 +214,7 @@ class CChat
212214

213215
static float GetFontHeight ( float fScale = 1.0f );
214216
static float GetTextExtent ( const char * szText, float fScale = 1.0f );
215-
static void DrawTextString ( const char * szText, CRect2D DrawArea, float fZ, CRect2D ClipRect, unsigned long ulFormat, unsigned long ulColor, float fScaleX, float fScaleY, const CRect2D& RenderBounds );
217+
static void 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 );
216218

217219
void SetColor ( const CColor& Color );
218220
void SetInputColor ( const CColor& Color );
@@ -286,6 +288,7 @@ class CChat
286288
CColor m_InputTextColor;
287289
bool m_bCssStyleText;
288290
bool m_bCssStyleBackground;
291+
bool m_bTextBlackOutline;
289292
unsigned long m_ulChatLineLife;
290293
unsigned long m_ulChatLineFadeOut;
291294
bool m_bUseCEGUI;

Client/core/CClientVariables.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,17 @@ void CClientVariables::LoadDefaults ( void )
289289
DEFAULT ( "console_size", CVector2D ( 200, 200 ) ); // console size
290290
DEFAULT ( "serverbrowser_size", CVector2D ( 720.0f, 495.0f ) ); // serverbrowser size
291291
DEFAULT ( "fps_limit", 100 ); // frame limiter
292-
DEFAULT ( "chat_font", 0 ); // chatbox font type
293-
DEFAULT ( "chat_lines", 7 ); // chatbox lines
294-
DEFAULT ( "chat_color", CColor (0,0,128,100) ); // chatbox color
292+
DEFAULT ( "chat_font", 2 ); // chatbox font type
293+
DEFAULT ( "chat_lines", 10 ); // chatbox lines
294+
DEFAULT ( "chat_color", CColor (0,0,0,0) ); // chatbox background color
295295
DEFAULT ( "chat_text_color", CColor (172,213,254,255) ); // chatbox text color
296-
DEFAULT ( "chat_input_color", CColor (0,0,191,110) ); // chatbox input color
297-
DEFAULT ( "chat_input_prefix_color", CColor (172,213,254,255) ); // chatbox prefix input color
298-
DEFAULT ( "chat_input_text_color", CColor (172,213,254,255) ); // chatbox text input color
296+
DEFAULT ( "chat_text_outline", false );
297+
DEFAULT ( "chat_input_color", CColor (0,0,0,0) ); // chatbox input background color
298+
DEFAULT ( "chat_input_prefix_color", CColor (172,213,254,255) ); // chatbox input prefix color
299+
DEFAULT ( "chat_input_text_color", CColor (172,213,254,255) ); // chatbox input text color
299300
DEFAULT ( "chat_scale", CVector2D ( 1.0f, 1.0f ) ); // chatbox scale
300-
DEFAULT ( "chat_width", 1.0f ); // chatbox width
301+
DEFAULT ( "chat_width", 1.5f ); // chatbox width
302+
301303
DEFAULT ( "chat_css_style_text", false ); // chatbox css/hl style text
302304
DEFAULT ( "chat_css_style_background", false ); // chatbox css/hl style background
303305
DEFAULT ( "chat_line_life", 12000 ); // chatbox line life time

Client/core/CClientVariables.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
*
3-
* PROJECT: Multi Theft Auto v1.0
3+
* PROJECT: Multi Theft Auto
44
* LICENSE: See LICENSE in the top level directory
55
* FILE: core/CClientVariables.h
66
* PURPOSE: Header file for client variable class
@@ -11,8 +11,7 @@
1111
*
1212
*****************************************************************************/
1313

14-
#ifndef __CCLIENTVARIABLES_H
15-
#define __CCLIENTVARIABLES_H
14+
#pragma once
1615

1716
#include <string>
1817
#include "CSingleton.h"
@@ -78,5 +77,3 @@ class CClientVariables : public CCVarsInterface, public CSingleton < CClientVari
7877
CXMLNode *m_pStorage;
7978
int m_iRevision;
8079
};
81-
82-
#endif

0 commit comments

Comments
 (0)