Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
394df3a
Update
Moris-Onz Nov 8, 2024
b84fa60
Update 2
Moris-Onz Nov 8, 2024
6e8565e
Update 3
Moris-Onz Nov 8, 2024
203fb7c
Fix by TracerDS 1
Moris-Onz Nov 8, 2024
8ca57f0
Update 4
Moris-Onz Nov 9, 2024
1e6992d
Update 4 (mini fix)
Moris-Onz Nov 9, 2024
9610dbc
Fix crash
Moris-Onz Nov 9, 2024
b066bc3
Refactor AddVehicle and AddTrain
Moris-Onz Nov 10, 2024
e5113de
Update 5
Moris-Onz Nov 10, 2024
ffd2ba7
Update 5 (Fix)
Moris-Onz Nov 10, 2024
434457a
Update 6
Moris-Onz Nov 10, 2024
bea11d6
std::shared_ptr from CHandlingManagerSA
Moris-Onz Nov 10, 2024
96a3cc4
std::shared_ptr for CPoolsSA (Test)
Moris-Onz Nov 10, 2024
0f6246e
Revert "std::shared_ptr for CPoolsSA (Test)"
Moris-Onz Nov 10, 2024
3d0b407
std::unique_ptr for CPoolsSA
Moris-Onz Nov 10, 2024
f901042
Update 7
Moris-Onz Nov 11, 2024
bd79171
Add CModelInfoSA::IsVehicleModel
Moris-Onz Nov 11, 2024
0462828
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 12, 2024
4888066
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 15, 2024
1e87d4a
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 16, 2024
e3b6707
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 20, 2024
77efe2d
Merge branch 'master' into clean-eVehicleTypes
Dutchman101 Nov 21, 2024
55098d6
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 21, 2024
fcc2c93
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 22, 2024
8641aba
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 27, 2024
d46c9df
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 29, 2024
47068d4
Fixes by TheNormalnij
Moris-Onz Nov 29, 2024
b0cddf5
Merge branch 'clean-eVehicleTypes' of https://github.com/G-Moris/mtas…
Moris-Onz Nov 29, 2024
0486d25
Fix style
Moris-Onz Nov 29, 2024
ece4318
Merge branch 'master' into clean-eVehicleTypes
G-Moris Dec 4, 2024
bb37ae4
Merge branch 'master' into clean-eVehicleTypes
Dutchman101 Dec 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions Client/game_sa/CGameSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ CGameSA::CGameSA()
m_pAESoundManager = new CAESoundManagerSA((CAESoundManagerSAInterface*)CLASS_CAESoundManager);
m_pAudioContainer = new CAudioContainerSA();
m_pWorld = new CWorldSA();
m_pPools = new CPoolsSA();
m_Pools = std::make_unique<CPoolsSA>();
m_pClock = new CClockSA();
m_pRadar = new CRadarSA();
m_pCamera = new CCameraSA((CCameraSAInterface*)CLASS_CCamera);
Expand All @@ -125,7 +125,7 @@ CGameSA::CGameSA()
m_pControllerConfigManager = new CControllerConfigManagerSA();
m_pProjectileInfo = new CProjectileInfoSA();
m_pRenderWare = new CRenderWareSA();
m_pHandlingManager = new CHandlingManagerSA();
m_HandlingManager = std::make_unique<CHandlingManagerSA>();
m_pEventList = new CEventListSA();
m_pGarages = new CGaragesSA((CGaragesSAInterface*)CLASS_CGarages);
m_pTasks = new CTasksSA((CTaskManagementSystemSA*)m_pTaskManagementSystem);
Expand Down Expand Up @@ -208,17 +208,17 @@ CGameSA::CGameSA()
m_Cheats[CHEAT_HEALTARMORMONEY] = new SCheatSA((BYTE*)VAR_HealthArmorMoney, false);

// Change pool sizes here
m_pPools->SetPoolCapacity(TASK_POOL, 5000); // Default is 500
m_pPools->SetPoolCapacity(OBJECT_POOL, MAX_OBJECTS); // Default is 350
m_pPools->SetPoolCapacity(EVENT_POOL, 5000); // Default is 200
m_pPools->SetPoolCapacity(COL_MODEL_POOL, 12000); // Default is 10150
m_pPools->SetPoolCapacity(ENV_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_pPools->SetPoolCapacity(ENV_MAP_ATOMIC_POOL, 4000); // Default is 1024
m_pPools->SetPoolCapacity(SPEC_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_pPools->SetPoolCapacity(ENTRY_INFO_NODE_POOL, MAX_ENTRY_INFO_NODES); // Default is 500
m_pPools->SetPoolCapacity(POINTER_SINGLE_LINK_POOL, MAX_POINTER_SINGLE_LINKS); // Default is 70000
m_pPools->SetPoolCapacity(POINTER_DOUBLE_LINK_POOL, MAX_POINTER_DOUBLE_LINKS); // Default is 3200
dassert(m_pPools->GetPoolCapacity(POINTER_SINGLE_LINK_POOL) == MAX_POINTER_SINGLE_LINKS);
m_Pools->SetPoolCapacity(TASK_POOL, 5000); // Default is 500
m_Pools->SetPoolCapacity(OBJECT_POOL, MAX_OBJECTS); // Default is 350
m_Pools->SetPoolCapacity(EVENT_POOL, 5000); // Default is 200
m_Pools->SetPoolCapacity(COL_MODEL_POOL, 12000); // Default is 10150
m_Pools->SetPoolCapacity(ENV_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_Pools->SetPoolCapacity(ENV_MAP_ATOMIC_POOL, 4000); // Default is 1024
m_Pools->SetPoolCapacity(SPEC_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_Pools->SetPoolCapacity(ENTRY_INFO_NODE_POOL, MAX_ENTRY_INFO_NODES); // Default is 500
m_Pools->SetPoolCapacity(POINTER_SINGLE_LINK_POOL, MAX_POINTER_SINGLE_LINKS); // Default is 70000
m_Pools->SetPoolCapacity(POINTER_DOUBLE_LINK_POOL, MAX_POINTER_DOUBLE_LINKS); // Default is 3200
dassert(m_Pools->GetPoolCapacity(POINTER_SINGLE_LINK_POOL) == MAX_POINTER_SINGLE_LINKS);

// Increase streaming object instances list size
MemPut<WORD>(0x05B8E55, MAX_RWOBJECT_INSTANCES * 12); // Default is 1000 * 12
Expand Down Expand Up @@ -261,7 +261,6 @@ CGameSA::~CGameSA()
delete reinterpret_cast<CAnimManagerSA*>(m_pAnimManager);
delete reinterpret_cast<CTasksSA*>(m_pTasks);
delete reinterpret_cast<CTaskManagementSystemSA*>(m_pTaskManagementSystem);
delete reinterpret_cast<CHandlingManagerSA*>(m_pHandlingManager);
delete reinterpret_cast<CStatsSA*>(m_pStats);
delete reinterpret_cast<CWeatherSA*>(m_pWeather);
delete reinterpret_cast<CAERadioTrackManagerSA*>(m_pCAERadioTrackManager);
Expand All @@ -276,7 +275,6 @@ CGameSA::~CGameSA()
delete reinterpret_cast<CCameraSA*>(m_pCamera);
delete reinterpret_cast<CRadarSA*>(m_pRadar);
delete reinterpret_cast<CClockSA*>(m_pClock);
delete reinterpret_cast<CPoolsSA*>(m_pPools);
delete reinterpret_cast<CWorldSA*>(m_pWorld);
delete reinterpret_cast<CAudioEngineSA*>(m_pAudioEngine);
delete reinterpret_cast<CAEAudioHardwareSA*>(m_pAEAudioHardware);
Expand Down Expand Up @@ -1039,8 +1037,8 @@ void CGameSA::RemoveAllBuildings()
{
m_pIplStore->SetDynamicIplStreamingEnabled(false);

m_pPools->GetDummyPool().RemoveAllBuildingLods();
m_pPools->GetBuildingsPool().RemoveAllBuildings();
m_Pools->GetDummyPool().RemoveAllBuildingLods();
m_Pools->GetBuildingsPool().RemoveAllBuildings();

auto pBuildingRemoval = static_cast<CBuildingRemovalSA*>(m_pBuildingRemoval);
pBuildingRemoval->DropCaches();
Expand All @@ -1050,8 +1048,8 @@ void CGameSA::RemoveAllBuildings()

void CGameSA::RestoreGameBuildings()
{
m_pPools->GetBuildingsPool().RestoreAllBuildings();
m_pPools->GetDummyPool().RestoreAllBuildingsLods();
m_Pools->GetBuildingsPool().RestoreAllBuildings();
m_Pools->GetDummyPool().RestoreAllBuildingsLods();

m_pIplStore->SetDynamicIplStreamingEnabled(true, [](CIplSAInterface* ipl) { return memcmp("barriers", ipl->name, 8) != 0; });
m_isBuildingsRemoved = false;
Expand All @@ -1069,7 +1067,7 @@ bool CGameSA::SetBuildingPoolSize(size_t size)
static_cast<CBuildingRemovalSA*>(m_pBuildingRemoval)->DropCaches();
}

bool status = m_pPools->GetBuildingsPool().Resize(size);
bool status = m_Pools->GetBuildingsPool().Resize(size);

if (shouldRemoveBuilding)
{
Expand Down
76 changes: 38 additions & 38 deletions Client/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class CGameSA : public CGame
CGameSA();
~CGameSA();

CPools* GetPools() { return m_pPools; }
CPools* GetPools() const noexcept { return m_Pools.get(); }
CPlayerInfo* GetPlayerInfo() { return m_pPlayerInfo; }
CProjectileInfo* GetProjectileInfo() { return m_pProjectileInfo; }
CRadar* GetRadar() { return m_pRadar; }
Expand Down Expand Up @@ -155,7 +155,7 @@ class CGameSA : public CGame
CCarEnterExit* GetCarEnterExit() { return m_pCarEnterExit; }
CControllerConfigManager* GetControllerConfigManager() { return m_pControllerConfigManager; }
CRenderWare* GetRenderWare() { return m_pRenderWare; }
CHandlingManager* GetHandlingManager() { return m_pHandlingManager; }
CHandlingManager* GetHandlingManager() const noexcept { return m_HandlingManager.get(); }
CAnimManager* GetAnimManager() { return m_pAnimManager; }
CStreaming* GetStreaming() { return m_pStreaming; }
CVisibilityPlugins* GetVisibilityPlugins() { return m_pVisibilityPlugins; }
Expand Down Expand Up @@ -313,42 +313,42 @@ class CGameSA : public CGame
bool SetBuildingPoolSize(size_t size);

private:
CPools* m_pPools;
CPlayerInfo* m_pPlayerInfo;
CProjectileInfo* m_pProjectileInfo;
CRadar* m_pRadar;
CClock* m_pClock;
CCoronas* m_pCoronas;
CCheckpoints* m_pCheckpoints;
CEventList* m_pEventList;
CFireManager* m_pFireManager;
CGarages* m_pGarages;
CHud* m_pHud;
CWeather* m_pWeather;
CWorld* m_pWorld;
CCamera* m_pCamera;
CModelInfo* m_pModelInfo;
CPickups* m_pPickups;
CWeaponInfo* m_pWeaponInfo;
CExplosionManager* m_pExplosionManager;
C3DMarkers* m_p3DMarkers;
CRenderWareSA* m_pRenderWare;
CHandlingManager* m_pHandlingManager;
CAnimManager* m_pAnimManager;
CStreaming* m_pStreaming;
CVisibilityPlugins* m_pVisibilityPlugins;
CKeyGen* m_pKeyGen;
CRopes* m_pRopes;
CFx* m_pFx;
CFxManagerSA* m_pFxManager;
CWaterManager* m_pWaterManager;
CWeaponStatManager* m_pWeaponStatsManager;
CPointLights* m_pPointLights;
CColStore* m_collisionStore;
CObjectGroupPhysicalProperties* m_pObjectGroupPhysicalProperties;
CCoverManagerSA* m_pCoverManager;
CPlantManagerSA* m_pPlantManager;
CBuildingRemoval* m_pBuildingRemoval;
std::unique_ptr<CPools> m_Pools;
CPlayerInfo* m_pPlayerInfo;
CProjectileInfo* m_pProjectileInfo;
CRadar* m_pRadar;
CClock* m_pClock;
CCoronas* m_pCoronas;
CCheckpoints* m_pCheckpoints;
CEventList* m_pEventList;
CFireManager* m_pFireManager;
CGarages* m_pGarages;
CHud* m_pHud;
CWeather* m_pWeather;
CWorld* m_pWorld;
CCamera* m_pCamera;
CModelInfo* m_pModelInfo;
CPickups* m_pPickups;
CWeaponInfo* m_pWeaponInfo;
CExplosionManager* m_pExplosionManager;
C3DMarkers* m_p3DMarkers;
CRenderWareSA* m_pRenderWare;
std::unique_ptr<CHandlingManager> m_HandlingManager;
CAnimManager* m_pAnimManager;
CStreaming* m_pStreaming;
CVisibilityPlugins* m_pVisibilityPlugins;
CKeyGen* m_pKeyGen;
CRopes* m_pRopes;
CFx* m_pFx;
CFxManagerSA* m_pFxManager;
CWaterManager* m_pWaterManager;
CWeaponStatManager* m_pWeaponStatsManager;
CPointLights* m_pPointLights;
CColStore* m_collisionStore;
CObjectGroupPhysicalProperties* m_pObjectGroupPhysicalProperties;
CCoverManagerSA* m_pCoverManager;
CPlantManagerSA* m_pPlantManager;
CBuildingRemoval* m_pBuildingRemoval;

std::unique_ptr<CRendererSA> m_pRenderer;

Expand Down
43 changes: 22 additions & 21 deletions Client/game_sa/CHandlingEntrySA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,48 @@ extern CGameSA* pGame;
CHandlingEntrySA::CHandlingEntrySA()
{
// Create a new interface and zero it
m_pHandlingSA = new tHandlingDataSA;
memset(m_pHandlingSA, 0, sizeof(tHandlingDataSA));
m_bDeleteInterface = true;
if (m_HandlingSA = std::make_unique<tHandlingDataSA>())
{
MemSet(m_HandlingSA.get(), 0, sizeof(tHandlingDataSA));
}
}

CHandlingEntrySA::CHandlingEntrySA(tHandlingDataSA* pOriginal)
CHandlingEntrySA::CHandlingEntrySA(const tHandlingDataSA* const pOriginal)
{
// Store gta's pointer
m_pHandlingSA = nullptr;
m_bDeleteInterface = false;
memcpy(&m_Handling, pOriginal, sizeof(tHandlingDataSA));
}

CHandlingEntrySA::~CHandlingEntrySA()
{
if (m_bDeleteInterface)
m_HandlingSA = nullptr;
if (pOriginal)
{
SAFE_DELETE(m_pHandlingSA);
MemCpy(&m_Handling, pOriginal, sizeof(tHandlingDataSA));
}
}

// Apply the handlingdata from another data
void CHandlingEntrySA::Assign(const CHandlingEntry* pEntry)
void CHandlingEntrySA::Assign(const CHandlingEntry* const pEntry) noexcept
{
if (!pEntry)
return;

// Copy the data
const CHandlingEntrySA* pEntrySA = static_cast<const CHandlingEntrySA*>(pEntry);
const CHandlingEntrySA* const pEntrySA = static_cast<const CHandlingEntrySA const*>(pEntry);
m_Handling = pEntrySA->m_Handling;
}

void CHandlingEntrySA::Recalculate()
void CHandlingEntrySA::Recalculate() noexcept
{
// Real GTA class?
if (!m_pHandlingSA)
if (!m_HandlingSA)
return;

// Copy our stored field to GTA's
memcpy(m_pHandlingSA, &m_Handling, sizeof(m_Handling));
((void(_stdcall*)(tHandlingDataSA*))FUNC_HandlingDataMgr_ConvertDataToGameUnits)(m_pHandlingSA);
try
{
// Copy our stored field to GTA's
MemCpy(m_HandlingSA.get(), &m_Handling, sizeof(m_Handling));
((void(_stdcall*)(tHandlingDataSA*))FUNC_HandlingDataMgr_ConvertDataToGameUnits)(m_HandlingSA.get());
}
catch (...)
{
}
}

void CHandlingEntrySA::SetSuspensionForceLevel(float fForce) noexcept
Expand Down Expand Up @@ -104,7 +105,7 @@ void CHandlingEntrySA::SetSuspensionAntiDiveMultiplier(float fAntidive) noexcept
m_Handling.fSuspensionAntiDiveMultiplier = fAntidive;
}

void CHandlingEntrySA::CheckSuspensionChanges() noexcept
void CHandlingEntrySA::CheckSuspensionChanges() const noexcept
{
pGame->GetHandlingManager()->CheckSuspensionChanges(this);
}
Loading
Loading