Skip to content

Commit 6fec59e

Browse files
committed
Merge remote-tracking branch 'mta_main/master' into TheNormalnij/create_building_server
2 parents e301a44 + f025ec1 commit 6fec59e

File tree

187 files changed

+6142
-2797
lines changed

Some content is hidden

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

187 files changed

+6142
-2797
lines changed

Client/cefweb/CWebView.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,10 +936,10 @@ void CWebView::OnBeforeClose(CefRefPtr<CefBrowser> browser)
936936
// //
937937
// //
938938
////////////////////////////////////////////////////////////////////
939-
bool CWebView::OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name,
940-
CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures,
941-
CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info,
942-
bool* no_javascript_access)
939+
bool CWebView::OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int popup_id, const CefString& target_url,
940+
const CefString& target_frame_name, CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture,
941+
const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings,
942+
CefRefPtr<CefDictionaryValue>& extra_info, bool* no_javascript_access)
943943
{
944944
// ATTENTION: This method is called on the IO thread
945945

Client/cefweb/CWebView.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ class CWebView : public CWebViewInterface,
152152

153153
// CefLifeSpawnHandler methods
154154
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
155-
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name,
156-
CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures,
157-
CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info,
158-
bool* no_javascript_access) override;
155+
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int popup_id, const CefString& target_url,
156+
const CefString& target_frame_name, CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture,
157+
const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings,
158+
CefRefPtr<CefDictionaryValue>& extra_info, bool* no_javascript_access) override;
159159
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
160160

161161
// CefJSDialogHandler methods

Client/core/CClientVariables.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ void CClientVariables::LoadDefaults()
274274
DEFAULT("host", _S("127.0.0.1")); // hostname
275275
DEFAULT("port", 22003); // port
276276
DEFAULT("password", _S("")); // password
277-
DEFAULT("qc_host", _S("127.0.0.1")); // quick connect hostname
278-
DEFAULT("qc_port", 22003); // quick connect port
279-
DEFAULT("qc_password", _S("")); // quick connect password
280277
DEFAULT("debugfile", _S("")); // debug filename
281278
DEFAULT("console_pos", CVector2D(0, 0)); // console position
282279
DEFAULT("console_size", CVector2D(200, 200)); // console size
@@ -359,7 +356,6 @@ void CClientVariables::LoadDefaults()
359356
DEFAULT("allow_discord_rpc", true); // Enable Discord Rich Presence
360357
DEFAULT("discord_rpc_share_data", false); // Consistent Rich Presence data sharing
361358
DEFAULT("discord_rpc_share_data_firsttime", false); // Display the user data sharing consent dialog box - for the first time
362-
DEFAULT("_beta_qc_rightclick_command", _S("reconnect")); // Command to run when right clicking quick connect (beta - can be removed at any time)
363359
DEFAULT("browser_enable_gpu", true); // Enable GPU in CEF? (allows stuff like WebGL to function)
364360

365361
if (!Exists("locale"))

Client/core/CCommandFuncs.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ void CCommandFuncs::Reconnect(const char* szParameters)
302302
unsigned int uiPort;
303303

304304
CVARS_GET("host", strHost);
305-
CVARS_GET("nick", strNick);
306305
CVARS_GET("password", strPassword);
307306
CVARS_GET("port", uiPort);
308307

@@ -315,7 +314,7 @@ void CCommandFuncs::Reconnect(const char* szParameters)
315314
// Verify and convert the port number
316315
if (uiPort <= 0 || uiPort > 0xFFFF)
317316
{
318-
CCore::GetSingleton().GetConsole()->Print(_("connect: Bad port number"));
317+
CCore::GetSingleton().GetConsole()->Print(_("reconnect: Bad port number"));
319318
return;
320319
}
321320

@@ -330,16 +329,16 @@ void CCommandFuncs::Reconnect(const char* szParameters)
330329
// Start the connect
331330
if (CCore::GetSingleton().GetConnectManager()->Reconnect(strHost.c_str(), usPort, strPassword.c_str(), false))
332331
{
333-
CCore::GetSingleton().GetConsole()->Printf(_("connect: Connecting to %s:%u..."), strHost.c_str(), usPort);
332+
CCore::GetSingleton().GetConsole()->Printf(_("reconnect: Reconnecting to %s:%u..."), strHost.c_str(), usPort);
334333
}
335334
else
336335
{
337-
CCore::GetSingleton().GetConsole()->Printf(_("connect: could not connect to %s:%u!"), strHost.c_str(), usPort);
336+
CCore::GetSingleton().GetConsole()->Printf(_("reconnect: could not connect to %s:%u!"), strHost.c_str(), usPort);
338337
}
339338
}
340339
else
341340
{
342-
CCore::GetSingleton().GetConsole()->Print("connect: Failed to unload current mod");
341+
CCore::GetSingleton().GetConsole()->Print("reconnect: Failed to unload current mod");
343342
}
344343
}
345344

Client/core/CConnectManager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ bool CConnectManager::Connect(const char* szHost, unsigned short usPort, const c
145145

146146
// Display the status box
147147
SString strBuffer(_("Connecting to %s:%u ..."), m_strHost.c_str(), m_usPort);
148+
if (m_bReconnect)
149+
strBuffer = SString(_("Reconnecting to %s:%u ..."), m_strHost.c_str(), m_usPort);
148150
CCore::GetSingleton().ShowMessageBox(_("CONNECTING"), strBuffer, MB_BUTTON_CANCEL | MB_ICON_INFO, m_pOnCancelClick);
149151
WriteDebugEvent(SString("Connecting to %s:%u ...", m_strHost.c_str(), m_usPort));
150152

Client/core/CMainMenu.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -912,17 +912,13 @@ bool CMainMenu::OnQuickConnectButtonClick(CGUIElement* pElement, bool left)
912912
if (m_ucFade != FADE_VISIBLE)
913913
return false;
914914

915-
// If we're right clicking, execute special command
916-
if (!left)
915+
if (left)
916+
g_pCore->GetCommands()->Execute("reconnect", "");
917+
else
917918
{
918-
std::string command;
919-
CVARS_GET("_beta_qc_rightclick_command", command);
920-
g_pCore->GetCommands()->Execute(command.data());
921-
return true;
919+
m_ServerBrowser.SetVisible(true);
920+
m_ServerBrowser.OnQuickConnectButtonClick();
922921
}
923-
924-
m_ServerBrowser.SetVisible(true);
925-
m_ServerBrowser.OnQuickConnectButtonClick();
926922
return true;
927923
}
928924

Client/core/CQueryReceiver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ SQueryInfo CQueryReceiver::GetServerResponse()
183183

184184
// Recover server ping status if present
185185
const SString strPingStatus = strBuildNumber.Right(strBuildNumber.length() - strlen(strBuildNumber) - 1);
186-
CCore::GetSingleton().GetNetwork()->UpdatePingStatus(*strPingStatus, info.players, info.isStatusVerified);
186+
CCore::GetSingleton().GetNetwork()->UpdatePingStatus(strPingStatus.c_str(), strPingStatus.length(), info.players, info.isStatusVerified);
187187

188188
// Recover server http port if present
189189
const SString strNetRoute = strPingStatus.Right(strPingStatus.length() - strlen(strPingStatus) - 1);

Client/core/CScreenShot.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ static bool ms_bIsSaving = false;
3535
static uint ms_uiWidth = 0;
3636
static uint ms_uiHeight = 0;
3737

38+
// whether we want to actually save photo in documents folder
39+
static bool savePhotoInDocuments = false;
40+
3841
void CScreenShot::InitiateScreenShot(bool bIsCameraShot)
3942
{
4043
if (ms_bScreenShot || ms_bIsSaving || IsRateLimited(bIsCameraShot))
@@ -48,8 +51,11 @@ void CScreenShot::InitiateScreenShot(bool bIsCameraShot)
4851

4952
if (bIsCameraShot)
5053
{
51-
// Set the screenshot path to camera gallery path
52-
ms_strScreenDirectoryPath = PathJoin(GetSystemPersonalPath(), "GTA San Andreas User Files", "Gallery");
54+
if (savePhotoInDocuments)
55+
{
56+
// Set the screenshot path to camera gallery path
57+
ms_strScreenDirectoryPath = PathJoin(GetSystemPersonalPath(), "GTA San Andreas User Files", "Gallery");
58+
}
5359
}
5460
else
5561
{
@@ -82,6 +88,13 @@ void CScreenShot::CheckForScreenShot(bool bBeforeGUI)
8288
// Update last time of taken screenshot of given type
8389
ms_lLastSaveTime[ms_bIsCameraShot] = GetTickCount64_();
8490

91+
if (ms_bIsCameraShot && !savePhotoInDocuments)
92+
{
93+
ClearBuffer();
94+
ms_bScreenShot = false;
95+
return;
96+
}
97+
8598
ms_strScreenShotPath = GetScreenshotPath();
8699
ms_uiWidth = CDirect3DData::GetSingleton().GetViewportWidth();
87100
ms_uiHeight = CDirect3DData::GetSingleton().GetViewportHeight();
@@ -205,3 +218,8 @@ void CScreenShot::ClearBuffer()
205218
{
206219
ms_ScreenShotBuffer.Clear();
207220
}
221+
222+
void CScreenShot::SetPhotoSavingInsideDocuments(bool savePhoto) noexcept
223+
{
224+
savePhotoInDocuments = savePhoto;
225+
}

Client/core/CScreenShot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class CScreenShot
1919
public:
2020
static void InitiateScreenShot(bool bIsCameraShot);
2121
static void CheckForScreenShot(bool bBeforeGUI);
22+
static void SetPhotoSavingInsideDocuments(bool bSavePhoto) noexcept;
2223

2324
protected:
2425
static void StartSaveThread();

Client/core/CSettings.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,12 @@ void CSettings::CreateGUI()
12011201
m_pCachePathValue->AutoSize();
12021202
vecTemp.fY += fLineHeight;
12031203

1204+
// Enable camera photos getting saved to documents folder
1205+
m_pPhotoSavingCheckbox = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabAdvanced, _("Save photos taken by camera weapon to GTA San Andreas User Files folder"), true));
1206+
m_pPhotoSavingCheckbox->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY));
1207+
m_pPhotoSavingCheckbox->AutoSize(NULL, 20.0f);
1208+
vecTemp.fY += fLineHeight;
1209+
12041210
// Auto updater section label
12051211
m_pAdvancedUpdaterLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabAdvanced, _("Auto updater")));
12061212
m_pAdvancedUpdaterLabel->SetPosition(CVector2D(vecTemp.fX - 10.0f, vecTemp.fY));
@@ -3218,6 +3224,10 @@ void CSettings::LoadData()
32183224
iVar = GetApplicationSettingInt("Win8MouseFix");
32193225
m_pWin8MouseCheckBox->SetSelected(iVar != 0);
32203226

3227+
// Save camera photos inside user documents folder
3228+
CVARS_GET("photosaving", bVar);
3229+
m_pPhotoSavingCheckbox->SetSelected(bVar);
3230+
32213231
// Update build type
32223232
CVARS_GET("update_build_type", iVar);
32233233
if (iVar == 0 || iVar == 1)
@@ -3609,6 +3619,11 @@ void CSettings::SaveData()
36093619
// Windows 8 mouse fix
36103620
SetApplicationSettingInt("Win8MouseFix", m_pWin8MouseCheckBox->GetSelected());
36113621

3622+
// Save photos in documents folder
3623+
bool photoSaving = m_pPhotoSavingCheckbox->GetSelected();
3624+
CVARS_SET("photosaving", photoSaving);
3625+
CScreenShot::SetPhotoSavingInsideDocuments(photoSaving);
3626+
36123627
// Debug setting
36133628
if (CGUIListItem* pSelected = m_pDebugSettingCombo->GetSelectedItem())
36143629
{

0 commit comments

Comments
 (0)