Skip to content

Commit 9900349

Browse files
author
saml1er
authored
Merge pull request #1 from multitheftauto/master
Merge master into custom_ifp_animations
2 parents d38e68e + 9f4d3de commit 9900349

File tree

291 files changed

+9604
-1087
lines changed

Some content is hidden

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

291 files changed

+9604
-1087
lines changed

Client/cefweb/CWebCore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ eURLState CWebCore::GetDomainState(const SString& strURL, bool bOutputDebug)
219219
SString CWebCore::GetDomainFromURL(const SString& strURL)
220220
{
221221
CefURLParts urlParts;
222-
if (!CefParseURL(strURL, urlParts) || !urlParts.host.str)
222+
if (strURL.empty() || !CefParseURL(strURL, urlParts) || !urlParts.host.str)
223223
return "";
224224

225225
return UTF16ToMbUTF8(urlParts.host.str);

Client/cefweb/CWebView.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ bool CWebView::LoadURL(const SString& strURL, bool bFilterEnabled, const SString
9393
return false;
9494

9595
CefURLParts urlParts;
96-
if (!CefParseURL(strURL, urlParts))
96+
if (strURL.empty() || !CefParseURL(strURL, urlParts))
9797
return false; // Invalid URL
9898

9999
// Are we allowed to browse this website?
@@ -612,7 +612,7 @@ bool CWebView::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect)
612612
////////////////////////////////////////////////////////////////////
613613
void CWebView::OnPopupShow(CefRefPtr<CefBrowser> browser, bool show)
614614
{
615-
std::lock_guard<std::mutex>(m_RenderData.dataMutex);
615+
std::lock_guard<std::mutex> lock{m_RenderData.dataMutex};
616616
m_RenderData.popupShown = show;
617617

618618
// Free popup buffer memory if hidden
@@ -628,7 +628,7 @@ void CWebView::OnPopupShow(CefRefPtr<CefBrowser> browser, bool show)
628628
////////////////////////////////////////////////////////////////////
629629
void CWebView::OnPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect)
630630
{
631-
std::lock_guard<std::mutex>(m_RenderData.dataMutex);
631+
std::lock_guard<std::mutex> lock{m_RenderData.dataMutex};
632632

633633
// Update rect
634634
m_RenderData.popupRect = rect;

Client/core/CChat.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void CChat::LoadCVars(void)
145145
//
146146
// Draw
147147
//
148-
void CChat::Draw(bool bUseCacheTexture)
148+
void CChat::Draw(bool bUseCacheTexture, bool bAllowOutline)
149149
{
150150
// Are we visible?
151151
if (!m_bVisible)
@@ -159,9 +159,12 @@ void CChat::Draw(bool bUseCacheTexture)
159159
UpdateGUI();
160160
}
161161

162+
bool bUsingOutline = m_bTextBlackOutline && bAllowOutline && bUseCacheTexture;
163+
DrawInputLine(bUsingOutline);
164+
162165
// Get drawList for the chat box text
163166
SDrawList drawList;
164-
GetDrawList(drawList);
167+
GetDrawList(drawList, bUsingOutline);
165168

166169
// Calc some size info
167170
CVector2D chatTopLeft(drawList.renderBounds.fX1, drawList.renderBounds.fY1);
@@ -212,6 +215,7 @@ void CChat::Draw(bool bUseCacheTexture)
212215
// If we can't get a rendertarget for some reason, just render the text directly to the screen
213216
if (!m_pCacheTexture)
214217
{
218+
drawList.bOutline = false; // Outline too slow without cache texture
215219
DrawDrawList(drawList, chatTopLeft);
216220
return;
217221
}
@@ -270,15 +274,14 @@ void CChat::DrawDrawList(const SDrawList& drawList, const CVector2D& topLeftOffs
270274
//
271275
// Get list of text lines to draw
272276
//
273-
void CChat::GetDrawList(SDrawList& outDrawList)
277+
void CChat::GetDrawList(SDrawList& outDrawList, bool bUsingOutline)
274278
{
275279
float fLineDifference = CChat::GetFontHeight(m_vecScale.fY);
276280
CVector2D vecPosition(m_vecBackgroundPosition.fX + (5.0f * m_vecScale.fX), m_vecBackgroundPosition.fY + m_vecBackgroundSize.fY - (fLineDifference * 1.25f));
277281
float fMaxLineWidth = m_vecBackgroundSize.fX - (10.0f * m_vecScale.fX);
278282
unsigned long ulTime = GetTickCount32();
279283
float fRcpChatLineFadeOut = 1.0f / m_ulChatLineFadeOut;
280-
bool bShadow = (m_Color.A * m_fBackgroundAlpha == 0.f) && !m_bTextBlackOutline;
281-
bool bInputShadow = (m_InputColor.A * m_fInputBackgroundAlpha == 0.f) && !m_bTextBlackOutline;
284+
bool bShadow = (m_Color.A * m_fBackgroundAlpha == 0.f) && !bUsingOutline;
282285

283286
if (m_Color.A * m_fBackgroundAlpha > 0.f)
284287
{
@@ -304,7 +307,7 @@ void CChat::GetDrawList(SDrawList& outDrawList)
304307

305308
outDrawList.renderBounds = RenderBounds;
306309
outDrawList.bShadow = bShadow;
307-
outDrawList.bOutline = m_bTextBlackOutline;
310+
outDrawList.bOutline = bUsingOutline;
308311

309312
// Smooth scroll
310313
int iLineScroll;
@@ -351,7 +354,13 @@ void CChat::GetDrawList(SDrawList& outDrawList)
351354
if (uiLine == m_uiMostRecentLine) // Went through all lines?
352355
break;
353356
}
357+
}
354358

359+
//
360+
// CChat::DrawInputLine
361+
//
362+
void CChat::DrawInputLine(bool bUsingOutline)
363+
{
355364
if (m_InputColor.A * m_fInputBackgroundAlpha > 0.f)
356365
{
357366
if (m_pInput)
@@ -366,8 +375,10 @@ void CChat::GetDrawList(SDrawList& outDrawList)
366375

367376
if (m_bInputVisible)
368377
{
378+
float fLineDifference = CChat::GetFontHeight(m_vecScale.fY);
379+
bool bInputShadow = (m_InputColor.A * m_fInputBackgroundAlpha == 0.f) && !bUsingOutline;
369380
CVector2D vecPosition(m_vecInputPosition.fX + (5.0f * m_vecScale.fX), m_vecInputPosition.fY + (fLineDifference * 0.125f));
370-
m_InputLine.Draw(vecPosition, 255, bInputShadow, m_bTextBlackOutline);
381+
m_InputLine.Draw(vecPosition, 255, bInputShadow, bUsingOutline);
371382
}
372383
}
373384

Client/core/CChat.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class CChat
157157
CChat(CGUI* pManager, const CVector2D& vecPosition);
158158
~CChat(void);
159159

160-
virtual void Draw(bool bUseCacheTexture);
160+
virtual void Draw(bool bUseCacheTexture, bool bAllowOutline);
161161
virtual void Output(const char* szText, bool bColorCoded = true);
162162
void Clear(void);
163163
void ClearInput(void);
@@ -202,7 +202,8 @@ class CChat
202202
void UpdatePosition(void);
203203
void UpdateSmoothScroll(float* pfPixelScroll, int* piLineScroll);
204204
void DrawDrawList(const SDrawList& drawList, const CVector2D& topLeftOffset = CVector2D(0, 0));
205-
void GetDrawList(SDrawList& outDrawList);
205+
void GetDrawList(SDrawList& outDrawList, bool bUsingOutline);
206+
void DrawInputLine(bool bUsingOutline);
206207

207208
CChatLine m_Lines[CHAT_MAX_LINES]; // Circular buffer
208209
int m_iScrollState; // 1 up, 0 stop, -1 down

Client/core/CCommandFuncs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void CCommandFuncs::Ver(const char* szParameters)
7575
if (usNetRel > 0)
7676
strVersion += SString(".%03d", usNetRel);
7777
strVersion += "\n";
78-
strVersion += _(BLUE_COPYRIGHT_STRING);
78+
strVersion += g_pCore->GetBlueCopyrightString();
7979
CLocalGUI::GetSingleton().EchoConsole(strVersion);
8080
}
8181

Client/core/CCommands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
207207

208208
// Unknown command
209209
val = _("Unknown command or cvar: ") + szCommand;
210-
if (!bIsScriptedBind && !bIsNickCommand)
210+
if (!bIsScriptedBind && !bIsNickCommand && pEntry == nullptr)
211211
CCore::GetSingleton().GetConsole()->Print(val.c_str());
212212
return false;
213213
}

Client/core/CCore.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,12 +1870,12 @@ void CCore::OnDeviceRestore(void)
18701870
void CCore::OnPreFxRender(void)
18711871
{
18721872
// Don't do nothing if nothing won't be drawn
1873-
if (!CGraphics::GetSingleton().HasMaterialLine3DQueueItems())
1873+
if (!CGraphics::GetSingleton().HasLine3DPreGUIQueueItems())
18741874
return;
18751875

18761876
CGraphics::GetSingleton().EnteringMTARenderZone();
18771877

1878-
CGraphics::GetSingleton().DrawMaterialLine3DQueue();
1878+
CGraphics::GetSingleton().DrawLine3DPreGUIQueue();
18791879

18801880
CGraphics::GetSingleton().LeavingMTARenderZone();
18811881
}
@@ -2243,3 +2243,9 @@ bool CCore::GetRightSizeTxdEnabled(void)
22432243

22442244
return false;
22452245
}
2246+
2247+
SString CCore::GetBlueCopyrightString(void)
2248+
{
2249+
SString strCopyright = BLUE_COPYRIGHT_STRING;
2250+
return strCopyright.Replace("%BUILD_YEAR%", std::to_string(BUILD_YEAR).c_str());
2251+
}

Client/core/CCore.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CCore;
4646
#include <dinput.h>
4747

4848
#define BLUE_VERSION_STRING "Multi Theft Auto v" MTA_DM_BUILDTAG_LONG
49-
#define BLUE_COPYRIGHT_STRING _td("Copyright (C) 2003 - 2018 Multi Theft Auto")
49+
#define BLUE_COPYRIGHT_STRING "Copyright (C) 2003 - %BUILD_YEAR% Multi Theft Auto"
5050

5151
// Configuration file path (relative to MTA install directory)
5252
#define MTA_CONFIG_PATH "mta/config/coreconfig.xml"
@@ -272,6 +272,7 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
272272
const char* GetProductVersion(void) { return SharedUtil::GetProductVersion(); }
273273
void SetFakeLagCommandEnabled(bool bEnabled) { m_bFakeLagCommandEnabled = bEnabled; }
274274
bool IsFakeLagCommandEnabled(void) { return m_bFakeLagCommandEnabled; }
275+
SString GetBlueCopyrightString(void);
275276

276277
private:
277278
// Core devices.

Client/core/CCredits.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ CCredits::CCredits(void)
4747
L"Christian \"ChrML\" Myhre Lundheim\n"
4848
L"Arushan \"aru\" Raj\n"
4949
L"Frank \"Aim\" Spijkerman\n"
50-
L"Pascal \"sbx320\" Stücker\n"
50+
L"Pascal \"sbx320\" Stücker\n"
5151
L"Kevin \"Kevuwk\" Whiteside\n"
5252
L"Richard \"Cazomino05\" Whitlock\n"
5353
L"Gamesnert\n"
@@ -130,7 +130,7 @@ CCredits::CCredits(void)
130130
"W\n"
131131
"Fedor Sinev\n"
132132
"zneext\n"
133-
"ZRec\n"
133+
"ZReC\n"
134134
"Pawelo / 4O4\n"
135135
"Sergeanur\n"
136136
"AleksCore\n"

Client/core/CDebugView.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ CDebugView::CDebugView(CGUI* pManager, const CVector2D& vecPosition) : CChat()
7676
UpdateGUI();
7777
}
7878

79-
void CDebugView::Draw(bool bUseCacheTexture)
79+
void CDebugView::Draw(bool bUseCacheTexture, bool bAllowOutline)
8080
{
8181
// Are we visible?
8282
if (!m_bVisible)
@@ -91,9 +91,11 @@ void CDebugView::Draw(bool bUseCacheTexture)
9191
CVector2D vecResolution = m_pManager->GetResolution();
9292
float height = m_uiNumLines * GetFontHeight(1) * m_vecScale.fY;
9393
m_vecBackgroundPosition = vecPosition * vecResolution - CVector2D(0, height);
94+
m_vecBackgroundPosition.fX = Round(m_vecBackgroundPosition.fX);
95+
m_vecBackgroundPosition.fY = Round(m_vecBackgroundPosition.fY);
9496
m_pBackground->SetPosition(m_vecBackgroundPosition);
9597

96-
CChat::Draw(bUseCacheTexture);
98+
CChat::Draw(bUseCacheTexture, bAllowOutline);
9799
g_pChat = pChat;
98100
}
99101

0 commit comments

Comments
 (0)