Skip to content

Commit 4d6cf82

Browse files
committed
Merge branch 'master' into issue-9608
2 parents 490efa5 + f9919a3 commit 4d6cf82

File tree

1,843 files changed

+97287
-76384
lines changed

Some content is hidden

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

1,843 files changed

+97287
-76384
lines changed

.github/ISSUE_TEMPLATE/security-report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ about: Submit cheat or security vulnerability
44

55
---
66

7+
STOP RIGHT THERE!
8+
79
Please submit your cheats or security vulnerabilities to @ccw on forum.mtasa.com. Please do not submit them here.
810

911
@ccw can be found here: https://forum.mtasa.com/profile/7264-ccw/

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,9 @@ __pycache__/
410410
Bin/
411411
Build/
412412
InstallFiles/
413-
utils/vswhere.exe
414413
utils/DXFiles.zip
415414
utils/DXFiles/
416415
!*.so
417416
!*.dll
418417
!*.exe
418+
utils/vswhere.exe

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ language: cpp
22
sudo: false
33
dist: trusty
44

5+
git:
6+
depth: 1
7+
58
matrix:
69
include:
710
- compiler: gcc

Client/cefweb/CWebView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ void CWebView::OnLoadError(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> fr
752752
// //
753753
// //
754754
////////////////////////////////////////////////////////////////////
755-
bool CWebView::OnBeforeBrowse(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, bool isRedirect)
755+
bool CWebView::OnBeforeBrowse(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, bool userGesture, bool isRedirect)
756756
{
757757
/*
758758
From documentation:

Client/cefweb/CWebView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class CWebView : public CWebViewInterface,
129129
const CefString& failedURL) override;
130130

131131
// CefRequestHandler methods
132-
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, bool isRedirect) override;
132+
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, bool userGesture, bool isRedirect) override;
133133
virtual CefRequestHandler::ReturnValue OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request,
134134
CefRefPtr<CefRequestCallback> callback) override;
135135

Client/core/CCommandFuncs.cpp

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -234,62 +234,63 @@ void CCommandFuncs::Unload(const char* szParameters)
234234

235235
void CCommandFuncs::Connect(const char* szParameters)
236236
{
237-
CModManager::GetSingleton().Unload();
237+
// Parse the arguments (host port nick pass)
238+
char szBuffer[256] = "";
239+
if (szParameters)
240+
STRNCPY(szBuffer, szParameters, NUMELMS(szBuffer));
238241

239-
// Any mod loaded?
240-
if (!CModManager::GetSingleton().GetCurrentMod())
242+
if (!strncmp(szBuffer, "mtasa://", 8))
241243
{
242-
// Parse the arguments (host port nick pass)
243-
char szBuffer[256] = "";
244-
if (szParameters)
245-
STRNCPY(szBuffer, szParameters, NUMELMS(szBuffer));
244+
// Using a mtasa:// URI to connect
245+
SString strArguments = g_pCore->GetConnectCommandFromURI(szBuffer);
246246

247-
if (!strncmp(szBuffer, "mtasa://", 8))
247+
if (strArguments.length() > 0 && g_pCore->GetCommands()->Execute(strArguments))
248248
{
249-
// Using a mtasa:// URI to connect
250-
SString strArguments = g_pCore->GetConnectCommandFromURI(szBuffer);
251-
252-
if (strArguments.length() > 0 && g_pCore->GetCommands()->Execute(strArguments))
253-
{
254-
return;
255-
}
249+
return;
256250
}
251+
}
257252

258-
char* szHost = strtok(szBuffer, " ");
259-
char* szPort = strtok(NULL, " ");
260-
char* szNick = strtok(NULL, " ");
261-
char* szPass = strtok(NULL, " ");
253+
char* szHost = strtok(szBuffer, " ");
254+
char* szPort = strtok(NULL, " ");
255+
char* szNick = strtok(NULL, " ");
256+
char* szPass = strtok(NULL, " ");
262257

263-
std::string strNick;
264-
if (!szNick)
265-
CVARS_GET("nick", strNick);
266-
else
267-
strNick = szNick;
258+
std::string strNick;
259+
if (!szNick)
260+
CVARS_GET("nick", strNick);
261+
else
262+
strNick = szNick;
268263

269-
// Got all required arguments?
270-
if (!szHost || !szPort || strNick.empty())
271-
{
272-
CCore::GetSingleton().GetConsole()->Print(_("connect: Syntax is 'connect <host> <port> [<nick> <pass>]'"));
273-
return;
274-
}
264+
// Got all required arguments?
265+
if (!szHost || strNick.empty())
266+
{
267+
CCore::GetSingleton().GetConsole()->Print(_("connect: Syntax is 'connect <host> [<port> <nick> <pass>]'"));
268+
return;
269+
}
275270

276-
// Verify and convert the port number
277-
int iPort = atoi(szPort);
278-
if (iPort <= 0 || iPort > 0xFFFF)
279-
{
280-
CCore::GetSingleton().GetConsole()->Print(_("connect: Bad port number"));
281-
return;
282-
}
271+
// Verify and convert the port number
272+
int iPort = szPort ? atoi(szPort) : 22003;
273+
if (iPort <= 0 || iPort > 0xFFFF)
274+
{
275+
CCore::GetSingleton().GetConsole()->Print(_("connect: Bad port number"));
276+
return;
277+
}
283278

284-
unsigned short usPort = static_cast<unsigned short>(iPort);
279+
unsigned short usPort = static_cast<unsigned short>(iPort);
285280

286-
// Got a password?
287-
char emptyPass = 0;
288-
if (!szPass)
289-
{
290-
szPass = &emptyPass;
291-
}
281+
// Got a password?
282+
char emptyPass = 0;
283+
if (!szPass)
284+
{
285+
szPass = &emptyPass;
286+
}
292287

288+
// Unload any mod before connecting to a server
289+
CModManager::GetSingleton().Unload();
290+
291+
// Only connect if there is no mod loaded
292+
if (!CModManager::GetSingleton().GetCurrentMod())
293+
{
293294
// Start the connect
294295
if (CCore::GetSingleton().GetConnectManager()->Connect(szHost, usPort, strNick.c_str(), szPass))
295296
{

Client/core/CCredits.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ CCredits::CCredits(void)
4545
L"Raphael \"Mr.Hankey\" Leiteritz\n"
4646
L"Ed \"eAi\" Lyons\n"
4747
L"Christian \"ChrML\" Myhre Lundheim\n"
48+
L"Qais \"qaisjp\" Patankar\n"
4849
L"Arushan \"aru\" Raj\n"
4950
L"Frank \"Aim\" Spijkerman\n"
5051
L"Pascal \"sbx320\" Stücker\n"
5152
L"Kevin \"Kevuwk\" Whiteside\n"
5253
L"Richard \"Cazomino05\" Whitlock\n"
5354
L"Gamesnert\n"
5455
L"Jusonex\n"
55-
L"Qais \"qaisjp\" Patankar\n"
5656
L"\n"
5757
L"\n");
5858

@@ -61,14 +61,15 @@ CCredits::CCredits(void)
6161
"\n\n"
6262

6363
"Arran\n"
64-
"Remp\n"
65-
"MX_Master\n"
64+
"Dutchman101\n"
6665
"Iztas\n"
6766
"impulze\n"
6867
"JoeBullet\n"
6968
"lopezloo\n"
69+
"MX_Master\n"
7070
"Marek \"Necktrox\" Kulik\n"
71-
"Dutchman101\n"
71+
"Remp\n"
72+
"Danish \"Saml1er\" Khan\n"
7273
"\n";
7374

7475
m_strCredits += _("Game Design / Scripting");
@@ -94,10 +95,12 @@ CCredits::CCredits(void)
9495

9596
"Lukasz \"W\" Biegaj\n"
9697
"Florian \"Flobu\" Busse\n"
98+
"Callum \"Callum\" Dawson\n"
9799
"Philip \"Fenix\" Farquharson\n"
98100
"Robin \"robhol\" Holm\n"
101+
"Patrik \"myonlake\" Juvonen\n"
102+
"Gabrielius \"Dezash\" Laurinavicius\n"
99103
"Adam \"50p\" Telega\n"
100-
"Callum \"Callum\" Dawson\n"
101104
"Ilya \"Kenix\" Volkov\n"
102105
"Gothem\n"
103106
"rafalh\n"
@@ -142,6 +145,9 @@ CCredits::CCredits(void)
142145
"JR10\n"
143146
"PhrozenByte\n"
144147
"AboShanab\n"
148+
"GTX / Timic3\n"
149+
"FileEX\n"
150+
"Pirulax\n"
145151
"\n";
146152
"\n";
147153

@@ -162,6 +168,7 @@ CCredits::CCredits(void)
162168
"Oliver \"Oli\" Brown\n"
163169
"Wojciech \"Wojjie\" Hlibowicki\n"
164170
"Chris \"Cray\" McArthur\n"
171+
"Rob 'Sugar Daddy' Pooley\n"
165172
"Hans \"Blokker\" Roes\n"
166173
"Kent \"Kent747\" Simon\n"
167174
"Matthew \"Towncivilian\" Wolfe\n"
@@ -172,7 +179,6 @@ CCredits::CCredits(void)
172179
"Phatlooser\n"
173180
"Dwayne 'The 'Woovie' Rock' Johnson\n"
174181
"max 'Hobo Pie' Power\n"
175-
"Rob 'Sugar Daddy' Pooley\n"
176182
"diegofkda\n"
177183
"Ren712\n"
178184
"\n"

Client/core/CGUI.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "StdInc.h"
1313
#include <game/CGame.h>
14+
#include <windowsx.h>
1415

1516
using std::string;
1617

@@ -541,7 +542,7 @@ bool CLocalGUI::ProcessMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara
541542
return true;
542543

543544
case WM_MOUSEMOVE:
544-
pGUI->ProcessMouseInput(CGUI_MI_MOUSEPOS, LOWORD(lParam), HIWORD(lParam));
545+
pGUI->ProcessMouseInput(CGUI_MI_MOUSEPOS, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
545546
return true;
546547

547548
case WM_LBUTTONDOWN:

Client/core/CMouseControl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "StdInc.h"
1313
#include "CMouseControl.h"
14+
#include <windowsx.h>
1415
#include <game/CGame.h>
1516

1617
#define MOUSE_CONTROL_MULTIPLIER 35
@@ -78,7 +79,7 @@ bool CMouseControl::ProcessMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
7879

7980
// Let's calculate our mouse movement directions
8081
CVector2D resolution = g_pCore->GetGUI()->GetResolution();
81-
int iX = LOWORD(lParam), iY = HIWORD(lParam);
82+
int iX = GET_X_LPARAM(lParam), iY = GET_Y_LPARAM(lParam);
8283
float fX = (iX - resolution.fX * 0.5f) / resolution.fX;
8384

8485
fX *= MOUSE_CONTROL_MULTIPLIER;
@@ -137,4 +138,4 @@ void CMouseControl::ApplyAxes(CControllerState& cs)
137138

138139
cs.LeftStickX = m_usLeftStickX;
139140
cs.LeftStickY = m_usLeftStickY;
140-
}
141+
}

Client/core/Graphics/CGraphics.cpp

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,94 @@ void CGraphics::DrawRectQueued(float fX, float fY, float fWidth, float fHeight,
807807
AddQueueItem(Item, bPostGUI);
808808
}
809809

810+
void CGraphics::DrawCircleQueued(float fX, float fY, float fRadius, float fStartAngle, float fStopAngle, unsigned long ulColor, unsigned long ulColorCenter, ushort fSegments, float fRatio, bool bPostGUI)
811+
{
812+
if (g_pCore->IsWindowMinimized())
813+
return;
814+
815+
BeginDrawBatch();
816+
CheckModes(EDrawMode::DX_SPRITE, m_ActiveBlendMode);
817+
818+
// Set up a queue item
819+
sDrawQueueItem Item;
820+
Item.eType = QUEUE_CIRCLE;
821+
Item.blendMode = m_ActiveBlendMode;
822+
Item.Circle.fX = fX;
823+
Item.Circle.fY = fY;
824+
Item.Circle.fRadius = fRadius;
825+
Item.Circle.fStartAngle = fStartAngle;
826+
Item.Circle.fStopAngle = fStopAngle;
827+
Item.Circle.bPostGUI = bPostGUI;
828+
Item.Circle.fSegments = fSegments;
829+
Item.Circle.fRatio = fRatio;
830+
Item.Circle.ulColor = ulColor;
831+
Item.Circle.ulColorCenter = ulColorCenter;
832+
// Add it to the queue
833+
AddQueueItem(Item, bPostGUI);
834+
835+
DrawCircleInternal(fX, fY, fRadius, fStartAngle, fStopAngle, ulColor, ulColorCenter, fSegments, fRatio, bPostGUI);
836+
837+
EndDrawBatch();
838+
}
839+
840+
struct stVertex
841+
{
842+
float x, y, z;
843+
D3DCOLOR color;
844+
};
845+
846+
void CGraphics::DrawCircleInternal(float fX, float fY, float fRadius, float fStartAngle, float fStopAngle, unsigned long ulColor, unsigned long ulColorCenter, ushort fSegments, float fRatio, bool bPostGUI)
847+
{
848+
fStartAngle = D3DXToRadian(fStartAngle);
849+
fStopAngle = D3DXToRadian(fStopAngle);
850+
851+
std::vector<stVertex> vecPoints;
852+
853+
// center
854+
stVertex vertCenter;
855+
vertCenter.x = fX;
856+
vertCenter.y = fY;
857+
vertCenter.z = 0;
858+
vertCenter.color = ulColorCenter;
859+
vecPoints.push_back(vertCenter);
860+
861+
// first
862+
stVertex vertFirst;
863+
vertFirst.x = fX + fRadius * cos(fStartAngle) * fRatio;
864+
vertFirst.y = fY + fRadius * sin(fStartAngle) / fRatio;
865+
vertFirst.z = 0;
866+
vertFirst.color = ulColor;
867+
vecPoints.push_back(vertFirst);
868+
869+
float fSegments2 = (float)fSegments + 1;
870+
float segmentAngle = ((fStopAngle - fStartAngle) / fSegments2);
871+
872+
for (float fAngle = fStartAngle; fAngle <= fStopAngle;)
873+
{
874+
stVertex vertex;
875+
vertex.x = fX + fRadius * cos(fAngle) * fRatio;
876+
vertex.y = fY + fRadius * sin(fAngle) / fRatio;
877+
vertex.z = 0;
878+
vertex.color = ulColor;
879+
vecPoints.push_back(vertex);
880+
fAngle = fAngle + segmentAngle;
881+
}
882+
883+
// last
884+
stVertex vertLast;
885+
vertLast.x = fX + fRadius * cos(fStopAngle) * fRatio;
886+
vertLast.y = fY + fRadius * sin(fStopAngle) / fRatio;
887+
vertLast.z = 0;
888+
vertLast.color = ulColor;
889+
vecPoints.push_back(vertLast);
890+
891+
if (vecPoints.size() >= 3)
892+
{
893+
m_pDevice->SetTexture(0, 0);
894+
m_pDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, vecPoints.size() - 2, &vecPoints[0], sizeof(stVertex));
895+
}
896+
}
897+
810898
void CGraphics::DrawTextureQueued(float fX, float fY, float fWidth, float fHeight, float fU, float fV, float fSizeU, float fSizeV, bool bRelativeUV,
811899
CMaterialItem* pMaterial, float fRotation, float fRotCenOffX, float fRotCenOffY, unsigned long ulColor, bool bPostGUI)
812900
{
@@ -1445,6 +1533,13 @@ void CGraphics::DrawQueueItem(const sDrawQueueItem& Item)
14451533
DrawRectangleInternal(Item.Rect.fX, Item.Rect.fY, Item.Rect.fWidth, Item.Rect.fHeight, Item.Rect.ulColor, Item.Rect.bSubPixelPositioning);
14461534
break;
14471535
}
1536+
case QUEUE_CIRCLE:
1537+
{
1538+
CheckModes(EDrawMode::DX_SPRITE, Item.blendMode);
1539+
DrawCircleInternal(Item.Circle.fX, Item.Circle.fY, Item.Circle.fRadius, Item.Circle.fStartAngle, Item.Circle.fStopAngle, Item.Circle.ulColor, Item.Circle.ulColorCenter, Item.Circle.fSegments, Item.Circle.fRatio, Item.Circle.bPostGUI);
1540+
break;
1541+
}
1542+
14481543
case QUEUE_TEXT:
14491544
{
14501545
RECT rect;

0 commit comments

Comments
 (0)