Skip to content

Commit 2a5520f

Browse files
committed
Merge branch 'master' into feature/queryColShapePosition
2 parents 3ed17df + d28eb11 commit 2a5520f

File tree

411 files changed

+6261
-2535
lines changed

Some content is hidden

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

411 files changed

+6261
-2535
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
5151
ConstructorInitializerIndentWidth: 4
5252
ContinuationIndentWidth: 4
5353
Cpp11BracedListStyle: true
54-
DerivePointerAlignment: true
54+
DerivePointerAlignment: false
5555
DisableFormat: false
5656
ExperimentalAutoDetectBinPacking: false
5757
FixNamespaceComments: true

Client/cefweb/CWebCore.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ void CWebCore::InitialiseWhiteAndBlacklist(bool bAddHardcoded, bool bAddDynamic)
265265
if (bAddDynamic)
266266
{
267267
// Hardcoded whitelist
268-
static SString whitelist[] = {"google.com", "youtube.com", "www.youtube-nocookie.com", "vimeo.com", "player.vimeo.com", "code.jquery.com",
269-
"myvideo.com", "mtasa.com", "multitheftauto.com", "mtavc.com", "www.googleapis.com", "ajax.googleapis.com",
270-
"localhost", "127.0.0.1"};
268+
static SString whitelist[] = {
269+
"google.com", "youtube.com", "www.youtube-nocookie.com", "vimeo.com", "player.vimeo.com", "code.jquery.com", "mtasa.com",
270+
"multitheftauto.com", "mtavc.com", "www.googleapis.com", "ajax.googleapis.com", "localhost", "127.0.0.1"};
271271

272272
// Hardcoded blacklist
273273
static SString blacklist[] = {"nobrain.dk"};

Client/core/CChat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void CChat::Draw(bool bUseCacheTexture, bool bAllowOutline)
215215
// If we can't get a rendertarget for some reason, just render the text directly to the screen
216216
if (!m_pCacheTexture)
217217
{
218-
drawList.bOutline = false; // Outline too slow without cache texture
218+
drawList.bOutline = false; // Outline too slow without cache texture
219219
DrawDrawList(drawList, chatTopLeft);
220220
return;
221221
}

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/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/CJoystickManager.cpp

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ enum eDir
6262
{
6363
eDirNeg,
6464
eDirPos,
65+
eDirNegToPos,
6566
eDirMax
6667
};
6768

@@ -79,7 +80,7 @@ enum eStick
7980
struct SMappingLine
8081
{
8182
eJoy SourceAxisIndex; // 0 - 7
82-
eDir SourceAxisDir; // 0 - 1
83+
eDir SourceAxisDir; // 0 - 2
8384
eStick OutputAxisIndex; // 0/1 2/3 4 5
8485
eDir OutputAxisDir; // 0 - 1
8586
bool bEnabled;
@@ -363,36 +364,44 @@ BOOL CJoystickManager::DoEnumObjectsCallback(const DIDEVICEOBJECTINSTANCE* pdido
363364
int axisIndex = -1;
364365

365366
if (pdidoi->guidType == GUID_XAxis)
366-
axisIndex = 0;
367+
axisIndex = eJoyX;
367368
if (pdidoi->guidType == GUID_YAxis)
368-
axisIndex = 1;
369+
axisIndex = eJoyY;
369370
if (pdidoi->guidType == GUID_ZAxis)
370-
axisIndex = 2;
371+
axisIndex = eJoyZ;
371372
if (pdidoi->guidType == GUID_RxAxis)
372-
axisIndex = 3;
373+
axisIndex = eJoyRx;
373374
if (pdidoi->guidType == GUID_RyAxis)
374-
axisIndex = 4;
375+
axisIndex = eJoyRy;
375376
if (pdidoi->guidType == GUID_RzAxis)
376-
axisIndex = 5;
377+
axisIndex = eJoyRz;
377378
if (pdidoi->guidType == GUID_Slider)
378-
axisIndex = 6;
379+
axisIndex = eJoyS1;
379380

381+
SString strStatus;
380382
// Save the range and the axis index
381383
if (axisIndex >= 0 && axisIndex < NUMELMS(m_DevInfo.axis) && range.lMin < range.lMax)
382384
{
383-
m_DevInfo.axis[axisIndex].lMin = range.lMin;
384-
m_DevInfo.axis[axisIndex].lMax = range.lMax;
385-
m_DevInfo.axis[axisIndex].bEnabled = true;
386-
m_DevInfo.axis[axisIndex].dwType = pdidoi->dwType;
387-
388-
m_DevInfo.iAxisCount++;
389-
WriteDebugEvent(
390-
SString(" Added axis index %d. lMin:%d lMax:%d (iAxisCount:%d)", axisIndex, range.lMin, range.lMax, m_DevInfo.iAxisCount));
385+
if (!m_DevInfo.axis[axisIndex].bEnabled)
386+
{
387+
m_DevInfo.axis[axisIndex].lMin = range.lMin;
388+
m_DevInfo.axis[axisIndex].lMax = range.lMax;
389+
m_DevInfo.axis[axisIndex].bEnabled = true;
390+
m_DevInfo.axis[axisIndex].dwType = pdidoi->dwType;
391+
392+
m_DevInfo.iAxisCount++;
393+
strStatus = SString("Added axis index %d. lMin:%d lMax:%d (iAxisCount:%d)", axisIndex, range.lMin, range.lMax, m_DevInfo.iAxisCount);
394+
}
395+
else
396+
{
397+
strStatus = SString("Ignoring duplicate axis index %d", axisIndex);
398+
}
391399
}
392400
else
393401
{
394-
WriteDebugEvent(SStringX(" Failed to recognise axis"));
402+
strStatus = "Failed to recognise axis";
395403
}
404+
WriteDebugEvent(" " + strStatus);
396405

397406
#ifdef MTA_DEBUG
398407
#if 0
@@ -644,6 +653,7 @@ void CJoystickManager::DoPulse(void)
644653
// See if any axes have changed to over 0.75
645654
for (int i = 0; i < NUMELMS(m_JoystickState.rgfAxis); i++)
646655
{
656+
// Half axis movement (0 to 1)
647657
if (fabs(m_JoystickState.rgfAxis[i]) > 0.75f)
648658
if (fabs(m_PreBindJoystickState.rgfAxis[i]) < 0.75f)
649659
{
@@ -654,6 +664,18 @@ void CJoystickManager::DoPulse(void)
654664
m_currentMapping[m_iCaptureOutputIndex].SourceAxisDir = m_JoystickState.rgfAxis[i] < 0.f ? eDirNeg : eDirPos;
655665
m_SettingsRevision++;
656666
}
667+
668+
// Full axis movement (-1 to 1)
669+
if (m_JoystickState.rgfAxis[i] > 0.75f)
670+
if (m_PreBindJoystickState.rgfAxis[i] < -0.75f)
671+
{
672+
m_bCaptureAxis = false;
673+
// Save the mapping
674+
m_currentMapping[m_iCaptureOutputIndex].bEnabled = true;
675+
m_currentMapping[m_iCaptureOutputIndex].SourceAxisIndex = (eJoy)i;
676+
m_currentMapping[m_iCaptureOutputIndex].SourceAxisDir = eDirNegToPos;
677+
m_SettingsRevision++;
678+
}
657679
}
658680
}
659681
}
@@ -1028,8 +1050,10 @@ void CJoystickManager::ApplyAxes(CControllerState& cs, bool bInVehicle)
10281050

10291051
if (line.SourceAxisDir == eDirPos)
10301052
value = std::max(0.f, value);
1031-
else
1053+
else if (line.SourceAxisDir == eDirNeg)
10321054
value = -std::min(0.f, value);
1055+
else if (line.SourceAxisDir == eDirNegToPos)
1056+
value = value * 0.5f + 0.5f;
10331057

10341058
if (line.OutputAxisDir == eDirNeg)
10351059
value = -value;
@@ -1567,6 +1591,8 @@ static string ToString(eDir value)
15671591
return "-";
15681592
if (value == eDirPos)
15691593
return "+";
1594+
if (value == eDirNegToPos)
1595+
return " ";
15701596
return "unknown";
15711597
}
15721598

0 commit comments

Comments
 (0)