Skip to content

Commit 1217853

Browse files
authored
Merge branch 'master' into bugfix/fire_task
2 parents b0a85be + 63be6db commit 1217853

File tree

30 files changed

+1112
-312
lines changed

30 files changed

+1112
-312
lines changed

.github/workflows/dockerimage.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Docker Image
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- master

Client/core/CMainMenu.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,14 @@ bool CMainMenu::OnMenuClick(CGUIMouseEventArgs Args)
842842
case MENU_ITEM_MAP_EDITOR:
843843
AskUserIfHeWantsToDisconnect(m_pHoveredItem->menuType);
844844
return true;
845+
case MENU_ITEM_DISCONNECT:
846+
if (g_pCore->GetCVars()->GetValue("ask_before_disconnect", true))
847+
{
848+
AskUserIfHeWantsToDisconnect(m_pHoveredItem->menuType);
849+
return true;
850+
}
851+
852+
break;
845853
default:
846854
break;
847855
}
@@ -863,7 +871,7 @@ bool CMainMenu::OnMenuClick(CGUIMouseEventArgs Args)
863871
switch (m_pHoveredItem->menuType)
864872
{
865873
case MENU_ITEM_DISCONNECT:
866-
OnDisconnectButtonClick(pElement);
874+
OnDisconnectButtonClick();
867875
break;
868876
case MENU_ITEM_QUICK_CONNECT:
869877
OnQuickConnectButtonClick(pElement, Args.button == LeftButton);
@@ -948,7 +956,7 @@ void CMainMenu::HideServerInfo()
948956
m_ServerInfo.Hide();
949957
}
950958

951-
bool CMainMenu::OnDisconnectButtonClick(CGUIElement* pElement)
959+
bool CMainMenu::OnDisconnectButtonClick()
952960
{
953961
// Return if we haven't faded in yet
954962
if (m_ucFade != FADE_VISIBLE)
@@ -1251,6 +1259,9 @@ void CMainMenu::WantsToDisconnectCallBack(void* pData, uint uiButton)
12511259
case MENU_ITEM_MAP_EDITOR:
12521260
OnEditorButtonClick();
12531261
break;
1262+
case MENU_ITEM_DISCONNECT:
1263+
OnDisconnectButtonClick();
1264+
break;
12541265
default:
12551266
break;
12561267
}

Client/core/CMainMenu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class CMainMenu
8989
bool OnResumeButtonClick(CGUIElement* pElement);
9090
bool OnBrowseServersButtonClick(CGUIElement* pElement);
9191
bool OnHostGameButtonClick();
92-
bool OnDisconnectButtonClick(CGUIElement* pElement);
92+
bool OnDisconnectButtonClick();
9393
bool OnEditorButtonClick();
9494
bool OnSettingsButtonClick(CGUIElement* pElement);
9595
bool OnAboutButtonClick(CGUIElement* pElement);

Client/core/CSettings.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ void CSettings::CreateGUI()
411411
m_pPhotoSavingCheckbox->GetPosition(vecTemp, false);
412412
m_pPhotoSavingCheckbox->AutoSize(NULL, 20.0f);
413413

414+
m_pCheckBoxAskBeforeDisconnect = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Ask before disconnecting from server using main menu"), true));
415+
m_pCheckBoxAskBeforeDisconnect->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
416+
m_pCheckBoxAskBeforeDisconnect->GetPosition(vecTemp, false);
417+
m_pCheckBoxAskBeforeDisconnect->AutoSize(NULL, 20.0f);
418+
414419
m_pCheckBoxCustomizedSAFiles = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Use customized GTA:SA files"), true));
415420
m_pCheckBoxCustomizedSAFiles->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
416421
m_pCheckBoxCustomizedSAFiles->GetPosition(vecTemp, false);
@@ -3080,6 +3085,10 @@ void CSettings::LoadData()
30803085
CVARS_GET("allow_discord_rpc", bAllowDiscordRPC);
30813086
m_pCheckBoxAllowDiscordRPC->SetSelected(bAllowDiscordRPC);
30823087

3088+
bool bAskBeforeDisconnect;
3089+
CVARS_GET("ask_before_disconnect", bAskBeforeDisconnect);
3090+
m_pCheckBoxAskBeforeDisconnect->SetSelected(bAskBeforeDisconnect);
3091+
30833092
// Customized sa files
30843093
m_pCheckBoxCustomizedSAFiles->SetSelected(GetApplicationSettingInt("customized-sa-files-request") != 0);
30853094
m_pCheckBoxCustomizedSAFiles->SetVisible(GetApplicationSettingInt("customized-sa-files-show") != 0);
@@ -3557,6 +3566,9 @@ void CSettings::SaveData()
35573566
}
35583567
}
35593568

3569+
bool bAskBeforeDisconnect = m_pCheckBoxAskBeforeDisconnect->GetSelected();
3570+
CVARS_SET("ask_before_disconnect", bAskBeforeDisconnect);
3571+
35603572
// Grass
35613573
bool bGrassEnabled = m_pCheckBoxGrass->GetSelected();
35623574
CVARS_SET("grass", bGrassEnabled);

Client/core/CSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ class CSettings
216216
CGUICheckBox* m_pWin8ColorCheckBox;
217217
CGUICheckBox* m_pWin8MouseCheckBox;
218218
CGUICheckBox* m_pPhotoSavingCheckbox;
219+
CGUICheckBox* m_pCheckBoxAskBeforeDisconnect;
219220
CGUICheckBox* m_pProcessAffinityCheckbox;
220221
CGUILabel* m_pUpdateBuildTypeLabel;
221222
CGUIComboBox* m_pUpdateBuildTypeCombo;

Client/game_sa/CGameSA.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,9 @@ void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
890890
MemSet((void*)0x64F3DB, 0x90, 14); // CCarEnterExit::IsPlayerToQuitCarEnter
891891

892892
MemSet((void*)0x685A7F, 0x90, 14); // CTaskSimplePlayerOnFoot::ProcessPlayerWeapon
893+
894+
MemSet((void*)0x53A899, 0x90, 5); // CFire::ProcessFire
895+
MemSet((void*)0x53A990, 0x90, 5); // CFire::ProcessFire
893896
}
894897
else
895898
{
@@ -900,6 +903,9 @@ void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
900903
MemCpy((void*)0x64F3DB, "\x8B\x85\x90\x04\x00\x00\x85\xC0\x0F\x85\x1B\x01\x00\x00", 14);
901904

902905
MemCpy((void*)0x685A7F, "\x8B\x86\x30\x07\x00\x00\x85\xC0\x0F\x85\x1D\x01\x00\x00", 14);
906+
907+
MemCpy((void*)0x53A899, "\xE8\x82\xF7\x0C\x00", 5);
908+
MemCpy((void*)0x53A990, "\xE8\x8B\xF6\x0C\x00", 5);
903909
}
904910

905911
m_isIgnoreFireStateEnabled = isEnabled;

Client/mods/deathmatch/StdInc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
#include "CLatentTransferManager.h"
155155
#include "CDebugHookManager.h"
156156
#include "lua/CLuaShared.h"
157+
#include "CStringName.h"
157158

158159
// Deathmatch includes
159160
#include "ClientCommands.h"

Client/mods/deathmatch/logic/CClientStreamElement.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void CClientStreamElement::InternalStreamIn(bool bInstantly)
6161
}
6262
}
6363

64-
void CClientStreamElement::InternalStreamOut()
64+
void CClientStreamElement::InternalStreamOut(bool ignoreSendingEvent)
6565
{
6666
if (m_bStreamedIn)
6767
{
@@ -83,13 +83,24 @@ void CClientStreamElement::InternalStreamOut()
8383
}
8484
}
8585

86-
CLuaArguments Arguments;
87-
CallEvent("onClientElementStreamOut", Arguments, true);
86+
if (!ignoreSendingEvent)
87+
{
88+
CLuaArguments Arguments;
89+
CallEvent("onClientElementStreamOut", Arguments, true);
90+
}
8891
}
8992
}
9093

9194
void CClientStreamElement::NotifyCreate()
9295
{
96+
// If the dimensions are different, stream out and do not continue
97+
if (GetDimension() != m_pStreamer->m_usDimension)
98+
{
99+
m_bStreamedIn = true; // InternalStreamOut need it
100+
InternalStreamOut(true);
101+
return;
102+
}
103+
93104
// Update common atrributes
94105
if (!m_bDoubleSidedInit)
95106
m_bDoubleSided = IsDoubleSided();

Client/mods/deathmatch/logic/CClientStreamElement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CClientStreamElement : public CClientEntity
3030
CClientStreamSector* GetStreamSector() { return m_pStreamSector; }
3131
bool IsStreamedIn() { return m_bStreamedIn; }
3232
void InternalStreamIn(bool bInstantly);
33-
void InternalStreamOut();
33+
void InternalStreamOut(bool ignoreSendingEvent = false);
3434
virtual void StreamIn(bool bInstantly) = 0;
3535
virtual void StreamOut() = 0;
3636
virtual void NotifyCreate();

Client/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,13 +1767,13 @@ int CLuaElementDefs::SetElementData(lua_State* luaVM)
17671767
{
17681768
// bool setElementData ( element theElement, string key, var value, [bool synchronize = true] )
17691769
CClientEntity* pEntity;
1770-
SString strKey;
1770+
CStringName key;
17711771
CLuaArgument value;
17721772
bool bSynchronize;
17731773

17741774
CScriptArgReader argStream(luaVM);
17751775
argStream.ReadUserData(pEntity);
1776-
argStream.ReadString(strKey);
1776+
argStream.ReadStringName(key);
17771777
argStream.ReadLuaArgument(value);
17781778
argStream.ReadBool(bSynchronize, true);
17791779

@@ -1782,15 +1782,16 @@ int CLuaElementDefs::SetElementData(lua_State* luaVM)
17821782
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
17831783
if (pLuaMain)
17841784
{
1785-
if (strKey.length() > MAX_CUSTOMDATA_NAME_LENGTH)
1785+
if (key->length() > MAX_CUSTOMDATA_NAME_LENGTH)
17861786
{
17871787
// Warn and truncate if key is too long
17881788
m_pScriptDebugging->LogCustom(luaVM, SString("Truncated argument @ '%s' [%s]", lua_tostring(luaVM, lua_upvalueindex(1)),
17891789
*SString("string length reduced to %d characters at argument 2", MAX_CUSTOMDATA_NAME_LENGTH)));
1790-
strKey = strKey.Left(MAX_CUSTOMDATA_NAME_LENGTH);
1790+
1791+
key = key->substr(0, MAX_CUSTOMDATA_NAME_LENGTH);
17911792
}
17921793

1793-
if (CStaticFunctionDefinitions::SetElementData(*pEntity, strKey, value, bSynchronize))
1794+
if (CStaticFunctionDefinitions::SetElementData(*pEntity, key.ToCString(), value, bSynchronize))
17941795
{
17951796
lua_pushboolean(luaVM, true);
17961797
return 1;
@@ -1809,26 +1810,27 @@ int CLuaElementDefs::RemoveElementData(lua_State* luaVM)
18091810
{
18101811
// bool removeElementData ( element theElement, string key )
18111812
CClientEntity* pEntity;
1812-
SString strKey;
1813+
CStringName key;
18131814

18141815
CScriptArgReader argStream(luaVM);
18151816
argStream.ReadUserData(pEntity);
1816-
argStream.ReadString(strKey);
1817+
argStream.ReadStringName(key);
18171818

18181819
if (!argStream.HasErrors())
18191820
{
18201821
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
18211822
if (pLuaMain)
18221823
{
1823-
if (strKey.length() > MAX_CUSTOMDATA_NAME_LENGTH)
1824+
if (key->length() > MAX_CUSTOMDATA_NAME_LENGTH)
18241825
{
18251826
// Warn and truncate if key is too long
18261827
m_pScriptDebugging->LogCustom(luaVM, SString("Truncated argument @ '%s' [%s]", lua_tostring(luaVM, lua_upvalueindex(1)),
18271828
*SString("string length reduced to %d characters at argument 2", MAX_CUSTOMDATA_NAME_LENGTH)));
1828-
strKey = strKey.Left(MAX_CUSTOMDATA_NAME_LENGTH);
1829+
1830+
key = key->substr(0, MAX_CUSTOMDATA_NAME_LENGTH);
18291831
}
18301832

1831-
if (CStaticFunctionDefinitions::RemoveElementData(*pEntity, strKey))
1833+
if (CStaticFunctionDefinitions::RemoveElementData(*pEntity, key.ToCString()))
18321834
{
18331835
lua_pushboolean(luaVM, true);
18341836
return 1;

0 commit comments

Comments
 (0)