Skip to content

Commit 47b6107

Browse files
authored
Merge branch 'master' into feature/underwater-effect
2 parents b333f63 + fcbe3fd commit 47b6107

File tree

305 files changed

+9987
-6079
lines changed

Some content is hidden

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

305 files changed

+9987
-6079
lines changed

Client/cefweb/CWebView.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,8 +996,9 @@ bool CWebView::OnJSDialog(CefRefPtr<CefBrowser> browser, const CefString& origin
996996
// //
997997
// //
998998
////////////////////////////////////////////////////////////////////
999-
bool CWebView::OnFileDialog(CefRefPtr<CefBrowser> browser, CefDialogHandler::FileDialogMode mode, const CefString& title, const CefString& default_file_path,
1000-
const std::vector<CefString>& accept_filters, CefRefPtr<CefFileDialogCallback> callback)
999+
bool CWebView::OnFileDialog(CefRefPtr<CefBrowser> browser, FileDialogMode mode, const CefString& title, const CefString& default_file_path,
1000+
const std::vector<CefString>& accept_filters, const std::vector<CefString>& accept_extensions, const std::vector<CefString>& accept_descriptions,
1001+
CefRefPtr<CefFileDialogCallback> callback)
10011002
{
10021003
// Don't show the dialog
10031004
return true;

Client/cefweb/CWebView.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ class CWebView : public CWebViewInterface,
164164
bool& suppress_message) override;
165165

166166
// CefDialogHandler methods
167-
virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser, CefDialogHandler::FileDialogMode mode, const CefString& title, const CefString& default_file_path,
168-
const std::vector<CefString>& accept_filters, CefRefPtr<CefFileDialogCallback> callback) override;
167+
virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser, FileDialogMode mode, const CefString& title, const CefString& default_file_path,
168+
const std::vector<CefString>& accept_filters, const std::vector<CefString>& accept_extensions, const std::vector<CefString>& accept_descriptions,
169+
CefRefPtr<CefFileDialogCallback> callback) override;
169170

170171
// CefDisplayHandler methods
171172
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title) override;

Client/core/CCore.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,19 @@ void CCore::UpdateRecentlyPlayed()
17871787
CCore::GetSingleton().SaveConfig();
17881788
}
17891789

1790+
void CCore::OnPostColorFilterRender()
1791+
{
1792+
if (!CGraphics::GetSingleton().HasLine3DPostFXQueueItems() && !CGraphics::GetSingleton().HasPrimitive3DPostFXQueueItems())
1793+
return;
1794+
1795+
CGraphics::GetSingleton().EnteringMTARenderZone();
1796+
1797+
CGraphics::GetSingleton().DrawPrimitive3DPostFXQueue();
1798+
CGraphics::GetSingleton().DrawLine3DPostFXQueue();
1799+
1800+
CGraphics::GetSingleton().LeavingMTARenderZone();
1801+
}
1802+
17901803
void CCore::ApplyCoreInitSettings()
17911804
{
17921805
#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) // Windows Vista
@@ -2010,22 +2023,6 @@ void CCore::OnPreFxRender()
20102023
//
20112024
void CCore::OnPreHUDRender()
20122025
{
2013-
IDirect3DDevice9* pDevice = CGraphics::GetSingleton().GetDevice();
2014-
2015-
if (CGraphics::GetSingleton().HasLine3DPostFXQueueItems() || CGraphics::GetSingleton().HasPrimitive3DPostFXQueueItems())
2016-
{
2017-
/*
2018-
Although MTA render zones are expensive, we should use them twice in the bounds of the function
2019-
because some of render states from PostFX drain to the 2D part of the frame.
2020-
*/
2021-
CGraphics::GetSingleton().EnteringMTARenderZone();
2022-
2023-
CGraphics::GetSingleton().DrawPrimitive3DPostFXQueue();
2024-
CGraphics::GetSingleton().DrawLine3DPostFXQueue();
2025-
2026-
CGraphics::GetSingleton().LeavingMTARenderZone();
2027-
}
2028-
20292026
CGraphics::GetSingleton().EnteringMTARenderZone();
20302027

20312028
// Maybe capture screen and other stuff

Client/core/CCore.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
289289
const SString& GetLastConnectedServerName() const { return m_strLastConnectedServerName; }
290290
void SetLastConnectedServerName(const SString& strServerName) { m_strLastConnectedServerName = strServerName; }
291291

292+
void OnPostColorFilterRender() override;
293+
292294
private:
293295
void ApplyCoreInitSettings();
294296

Client/core/premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ project "Client Core"
1616
"../sdk",
1717
"../../vendor/tinygettext",
1818
"../../vendor/zlib",
19-
"../../vendor/jpeg-9e",
19+
"../../vendor/jpeg-9f",
2020
"../../vendor/pthreads/include",
2121
"../../vendor/sparsehash/src/",
2222
"../../vendor/detours/4.0.1/src",

Client/game_sa/CBuildingRemovalSA.cpp

Lines changed: 719 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto v1.0
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: game_sa/CBuildingRemovalSA.h
6+
* PURPOSE: Header file for building removal class
7+
*
8+
* Multi Theft Auto is available from http://www.multitheftauto.com/
9+
*
10+
*****************************************************************************/
11+
12+
#pragma once
13+
14+
#include <CVector.h>
15+
#include <CVector2D.h>
16+
17+
#include <game/CBuildingRemoval.h>
18+
19+
class CBuildingRemovalSA : public CBuildingRemoval
20+
{
21+
public:
22+
CBuildingRemovalSA();
23+
24+
SBuildingRemoval* GetBuildingRemoval(CEntitySAInterface* pInterface) override;
25+
26+
void RemoveBuilding(uint16_t usModelToRemove, float fDistance, float fX, float fY, float fZ, char cInterior, size_t* pOutAmount = NULL) override;
27+
bool RestoreBuilding(uint16_t usModelToRestore, float fDistance, float fX, float fY, float fZ, char cInterior, size_t* pOutAmount = NULL) override;
28+
bool IsRemovedModelInRadius(SIPLInst* pInst) override;
29+
bool IsModelRemoved(uint16_t modelID) override;
30+
void ClearRemovedBuildingLists(uint* pOutAmount = NULL) override;
31+
void AddDataBuilding(CEntitySAInterface* pInterface) override;
32+
void RemoveWorldBuildingFromLists(CEntitySAInterface* pInterface) override;
33+
void AddBinaryBuilding(CEntitySAInterface* pInterface) override;
34+
bool IsObjectRemoved(CEntitySAInterface* pInterface) override;
35+
bool IsDataModelRemoved(uint16_t usModelID) override;
36+
bool IsEntityRemoved(CEntitySAInterface* pInterface) override;
37+
void DropCaches();
38+
39+
private:
40+
std::multimap<uint16_t, SBuildingRemoval*>* m_pBuildingRemovals;
41+
std::multimap<uint16_t, sDataBuildingRemovalItem*>* m_pDataBuildings;
42+
std::multimap<uint16_t, sBuildingRemovalItem*>* m_pBinaryBuildings;
43+
std::map<DWORD, bool> m_pRemovedEntities;
44+
std::map<DWORD, bool> m_pAddedEntities;
45+
};

Client/game_sa/CBuildingsPoolSA.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ inline bool CBuildingsPoolSA::AddBuildingToPool(CClientBuilding* pClientBuilding
4040
if (dwElementIndexInPool == UINT_MAX)
4141
return false;
4242

43-
m_buildingPool.arrayOfClientEntities[dwElementIndexInPool] = {pBuilding, (CClientEntity*)pClientBuilding};
43+
m_buildingPool.entities[dwElementIndexInPool] = {pBuilding, (CClientEntity*)pClientBuilding};
4444

4545
// Increase the count of objects
46-
++m_buildingPool.ulCount;
46+
++m_buildingPool.count;
4747

4848
return true;
4949
}
@@ -108,8 +108,8 @@ void CBuildingsPoolSA::RemoveBuilding(CBuilding* pBuilding)
108108
modelInfo->RemoveColRef();
109109

110110
// Remove from BuildingSA pool
111-
auto* pBuildingSA = m_buildingPool.arrayOfClientEntities[dwElementIndexInPool].pEntity;
112-
m_buildingPool.arrayOfClientEntities[dwElementIndexInPool] = {nullptr, nullptr};
111+
auto* pBuildingSA = m_buildingPool.entities[dwElementIndexInPool].pEntity;
112+
m_buildingPool.entities[dwElementIndexInPool] = {nullptr, nullptr};
113113

114114
// Delete it from memory
115115
delete pBuildingSA;
@@ -118,7 +118,7 @@ void CBuildingsPoolSA::RemoveBuilding(CBuilding* pBuilding)
118118
(*m_ppBuildingPoolInterface)->Release(dwElementIndexInPool);
119119

120120
// Decrease the count of elements in the pool
121-
--m_buildingPool.ulCount;
121+
--m_buildingPool.count;
122122
}
123123

124124
void CBuildingsPoolSA::RemoveAllBuildings()
@@ -191,7 +191,9 @@ void CBuildingsPoolSA::RemoveBuildingFromWorld(CBuildingSAInterface* pBuilding)
191191
bool CBuildingsPoolSA::Resize(int size)
192192
{
193193
auto* pool = (*m_ppBuildingPoolInterface);
194-
const int curretnSize = pool->m_nSize;
194+
const int currentSize = pool->m_nSize;
195+
196+
m_buildingPool.entities.resize(size);
195197

196198
void* oldPool = pool->m_pObjects;
197199

@@ -210,15 +212,15 @@ bool CBuildingsPoolSA::Resize(int size)
210212
CBuildingSAInterface* newObjects = MemSA::malloc_struct<CBuildingSAInterface>(size);
211213
if (newObjects == nullptr)
212214
{
213-
Resize(curretnSize);
215+
Resize(currentSize);
214216
return false;
215217
}
216218

217219
tPoolObjectFlags* newBytemap = MemSA::malloc_struct<tPoolObjectFlags>(size);
218220
if (newBytemap == nullptr)
219221
{
220222
MemSA::free(newObjects);
221-
Resize(curretnSize);
223+
Resize(currentSize);
222224
return false;
223225
}
224226

@@ -322,6 +324,7 @@ void CBuildingsPoolSA::RemovePedsContactEnityLinks()
322324
CPedSAInterface* ped = pedLinks->pEntity->GetPedInterface();
323325
ped->m_pCollidedEntity = nullptr;
324326
ped->pContactEntity = nullptr;
327+
ped->pLastContactEntity = nullptr;
325328
ped->pLastContactedEntity[0] = nullptr;
326329
ped->pLastContactedEntity[1] = nullptr;
327330
ped->pLastContactedEntity[2] = nullptr;

Client/game_sa/CBuildingsPoolSA.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class CBuildingsPoolSA : public CBuildingsPool
4040
void RemovePedsContactEnityLinks();
4141

4242
private:
43-
SPoolData<CBuildingSA, CBuildingSAInterface, MAX_BUILDINGS> m_buildingPool;
44-
CPoolSAInterface<CBuildingSAInterface>** m_ppBuildingPoolInterface;
43+
SVectorPoolData<CBuildingSA> m_buildingPool{MAX_BUILDINGS};
44+
CPoolSAInterface<CBuildingSAInterface>** m_ppBuildingPoolInterface;
4545

4646
std::unique_ptr<std::array<std::pair<bool, CBuildingSAInterface>, MAX_BUILDINGS>> m_pOriginalBuildingsBackup;
4747
};

Client/game_sa/CFxSA.cpp

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,93 @@ void CFxSA::TriggerFootSplash(CVector& vecPosition)
239239
call dwFunc
240240
}
241241
}
242+
243+
void CFxSA::AddParticle(eFxParticleSystems eFxParticle, const CVector& vecPosition, const CVector& vecDirection, float fR, float fG, float fB, float fA, bool bRandomizeColors, std::uint32_t iCount, float fBrightness, float fSize, bool bRandomizeSizes, float fLife)
244+
{
245+
// Init our own FxPrtMult struct
246+
FxPrtMult_c fxPrt{{fR,fG,fB,fA}, fSize, 0, fLife};
247+
CVector newDirection;
248+
249+
FxSystem_c* fxParticleSystem;
250+
251+
switch (eFxParticle)
252+
{
253+
case eFxParticleSystems::PRT_BLOOD:
254+
fxParticleSystem = m_pInterface->m_fxSysBlood;
255+
break;
256+
case eFxParticleSystems::PRT_BOATSPLASH:
257+
fxParticleSystem = m_pInterface->m_fxSysBoatSplash;
258+
break;
259+
case eFxParticleSystems::PRT_BUBBLE:
260+
fxParticleSystem = m_pInterface->m_fxSysBubble;
261+
break;
262+
case eFxParticleSystems::PRT_DEBRIS:
263+
fxParticleSystem = m_pInterface->m_fxSysDebris;
264+
break;
265+
case eFxParticleSystems::PRT_GUNSHELL:
266+
fxParticleSystem = m_pInterface->m_fxSysGunshell;
267+
break;
268+
case eFxParticleSystems::PRT_SAND:
269+
fxParticleSystem = m_pInterface->m_fxSysSand;
270+
break;
271+
case eFxParticleSystems::PRT_SAND2:
272+
fxParticleSystem = m_pInterface->m_fxSysSand2;
273+
break;
274+
case eFxParticleSystems::PRT_SMOKE:
275+
fxParticleSystem = m_pInterface->m_fxSysSmoke;
276+
break;
277+
case eFxParticleSystems::PRT_SMOKEHUGE:
278+
fxParticleSystem = m_pInterface->m_fxSysSmokeHuge;
279+
break;
280+
case eFxParticleSystems::PRT_SMOKE2:
281+
fxParticleSystem = m_pInterface->m_fxSysSmoke2;
282+
break;
283+
case eFxParticleSystems::PRT_SPARK:
284+
fxParticleSystem = m_pInterface->m_fxSysSpark;
285+
break;
286+
case eFxParticleSystems::PRT_SPARK2:
287+
fxParticleSystem = m_pInterface->m_fxSysSpark2;
288+
break;
289+
case eFxParticleSystems::PRT_SPLASH:
290+
fxParticleSystem = m_pInterface->m_fxSysSplash;
291+
break;
292+
case eFxParticleSystems::PRT_WAKE:
293+
fxParticleSystem = m_pInterface->m_fxSysWake;
294+
break;
295+
case eFxParticleSystems::PRT_WATERSPLASH:
296+
fxParticleSystem = m_pInterface->m_fxSysWaterSplash;
297+
break;
298+
case eFxParticleSystems::PRT_WHEELDIRT:
299+
fxParticleSystem = m_pInterface->m_fxSysWheelDirt;
300+
break;
301+
case eFxParticleSystems::PRT_GLASS:
302+
fxParticleSystem = m_pInterface->m_fxSysGlass;
303+
break;
304+
default:
305+
fxParticleSystem = m_pInterface->m_fxSysBlood;
306+
}
307+
308+
for (size_t i = 0; i < iCount; i++)
309+
{
310+
if (bRandomizeColors)
311+
{
312+
// 0x49EECB
313+
fxPrt.m_color.red = (rand() % 10000) * 0.0001f * fR + 0.13f;
314+
fxPrt.m_color.green = (rand() % 10000) * 0.0001f * fG + 0.12f;
315+
fxPrt.m_color.blue = (rand() % 10000) * 0.0001f * fB + 0.04f;
316+
}
317+
318+
if (bRandomizeSizes)
319+
// 0x49EF21 - Calculate random size for each particle
320+
fxPrt.m_fSize = (rand() % 10000) * 0.0001f * fSize + 0.3f;
321+
322+
// 0x49EF4C - Calculate random direction for each particle
323+
newDirection = CVector(vecDirection.fX * 4, vecDirection.fY * 4, vecDirection.fZ * 4);
324+
newDirection.fX = (rand() % 10000) * 0.0001f * 4 - 2 + newDirection.fX;
325+
newDirection.fY = (rand() % 10000) * 0.0001f * 4 - 2 + newDirection.fY;
326+
newDirection.fZ = (rand() % 10000) * 0.0001f * 4 - 2 + newDirection.fZ;
327+
328+
// Call FxSystem_c::AddParticle
329+
((int(__thiscall*)(FxSystem_c*, const CVector*, const CVector*, float, FxPrtMult_c*, float, float, float, int))FUNC_FXSystem_c_AddParticle)(fxParticleSystem, &vecPosition, &newDirection, 0, &fxPrt, -1.0f, fBrightness, 0, 0);
330+
}
331+
}

0 commit comments

Comments
 (0)