Skip to content

Commit 29fd04b

Browse files
authored
Merge branch 'master' into 050824_Async-dbConnect
2 parents 29be4e4 + 6e127fd commit 29fd04b

File tree

124 files changed

+1944
-1147
lines changed

Some content is hidden

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

124 files changed

+1944
-1147
lines changed

.github/workflows/dockerimage.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ on:
1212
- 'Dockerfile.i386'
1313
- 'Dockerfile.armhf'
1414
- 'Dockerfile.arm64'
15-
- 'Dockerfile.osx-x64'
16-
- 'Dockerfile.osx-arm64'
1715

1816
jobs:
1917
build:
@@ -28,10 +26,6 @@ jobs:
2826
dockerfile: Dockerfile.armhf
2927
- tag: arm64
3028
dockerfile: Dockerfile.arm64
31-
- tag: osx-x64
32-
dockerfile: Dockerfile.osx-x64
33-
- tag: osx-arm64
34-
dockerfile: Dockerfile.osx-arm64
3529
runs-on: ubuntu-latest
3630
steps:
3731
- uses: actions/checkout@v4

Client/core/CCore.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,11 +2181,6 @@ CModelCacheManager* CCore::GetModelCacheManager()
21812181
return m_pModelCacheManager;
21822182
}
21832183

2184-
void CCore::AddModelToPersistentCache(ushort usModelId)
2185-
{
2186-
return GetModelCacheManager()->AddModelToPersistentCache(usModelId);
2187-
}
2188-
21892184
void CCore::StaticIdleHandler()
21902185
{
21912186
g_pCore->IdleHandler();

Client/core/CCore.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
253253
EDiagnosticDebugType GetDiagnosticDebug();
254254
void SetDiagnosticDebug(EDiagnosticDebugType value);
255255
CModelCacheManager* GetModelCacheManager();
256-
void AddModelToPersistentCache(ushort usModelId);
257256

258257
static void StaticIdleHandler();
259258
void IdleHandler();

Client/core/CModelCacheManager.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class CModelCacheManagerImpl : public CModelCacheManager
4747
virtual void OnClientClose();
4848
virtual void UpdatePedModelCaching(const std::map<ushort, float>& newNeedCacheList);
4949
virtual void UpdateVehicleModelCaching(const std::map<ushort, float>& newNeedCacheList);
50-
virtual void AddModelToPersistentCache(ushort usModelId);
5150
virtual void SetCustomLimits(std::optional<size_t> numVehicles, std::optional<size_t> numPeds);
5251

5352
// CModelCacheManagerImpl methods
@@ -72,7 +71,6 @@ class CModelCacheManagerImpl : public CModelCacheManager
7271
bool m_IsUsingCustomVehicleCacheLimit{}; //< If `true` the value is set by the scripter, otherwise is calculated in `DoPulse()`
7372
std::map<ushort, SModelCacheInfo> m_PedModelCacheInfoMap{};
7473
std::map<ushort, SModelCacheInfo> m_VehicleModelCacheInfoMap{};
75-
std::set<ushort> m_PermoLoadedModels{};
7674
};
7775

7876
///////////////////////////////////////////////////////////////
@@ -266,22 +264,6 @@ void CModelCacheManagerImpl::DoPulse()
266264
}
267265
}
268266

269-
///////////////////////////////////////////////////////////////
270-
//
271-
// CModelCacheManagerImpl::AddModelToPersistentCache
272-
//
273-
// Keep this model around 4 evar now
274-
//
275-
///////////////////////////////////////////////////////////////
276-
void CModelCacheManagerImpl::AddModelToPersistentCache(ushort usModelId)
277-
{
278-
if (!MapContains(m_PermoLoadedModels, usModelId))
279-
{
280-
AddModelRefCount(usModelId);
281-
MapInsert(m_PermoLoadedModels, usModelId);
282-
}
283-
}
284-
285267
///////////////////////////////////////////////////////////////
286268
//
287269
// CModelCacheManagerImpl::UpdatePedModelCaching
@@ -542,13 +524,5 @@ void CModelCacheManagerImpl::OnRestreamModel(ushort usModelId)
542524
OutputDebugLine(SString("[Cache] End caching model %d (OnRestreamModel)", usModelId));
543525
}
544526
}
545-
}
546-
547-
// Also check the permo list
548-
if (MapContains(m_PermoLoadedModels, usModelId))
549-
{
550-
SubModelRefCount(usModelId);
551-
MapRemove(m_PermoLoadedModels, usModelId);
552-
OutputDebugLine(SString("[Cache] End permo-caching model %d (OnRestreamModel)", usModelId));
553-
}
527+
}
554528
}

Client/core/CModelCacheManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class CModelCacheManager
2424
virtual void OnClientClose() = 0;
2525
virtual void UpdatePedModelCaching(const std::map<ushort, float>& newNeedCacheList) = 0;
2626
virtual void UpdateVehicleModelCaching(const std::map<ushort, float>& newNeedCacheList) = 0;
27-
virtual void AddModelToPersistentCache(ushort usModelId) = 0;
2827
virtual void SetCustomLimits(std::optional<size_t> numVehicles, std::optional<size_t> numPeds) = 0;
2928
};
3029

Client/game_sa/CBuildingsPoolSA.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ void CBuildingsPoolSA::RemoveBuilding(CBuilding* pBuilding)
101101
// Remove plant
102102
pGame->GetPlantManager()->RemovePlant(pInterface);
103103

104-
RemoveBuildingFromWorld(pInterface);
104+
// Remove shadow
105+
pInterface->RemoveShadows();
106+
107+
// Remove building from world
108+
pGame->GetWorld()->Remove(pInterface, CBuildingPool_Destructor);
109+
110+
// Call virtual destructor
111+
((void*(__thiscall*)(void*, char))pInterface->vtbl->SCALAR_DELETING_DESTRUCTOR)(pInterface, 0);
105112

106113
// Remove col reference
107114
auto modelInfo = pGame->GetModelInfo(pBuilding->GetModelIndex());

Client/game_sa/CEntitySA.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,28 @@ bool CEntitySA::GetBoneRotation(eBone boneId, float& yaw, float& pitch, float& r
603603
return false;
604604
}
605605

606+
bool CEntitySA::GetBoneRotationQuat(eBone boneId, float& x, float& y, float& z, float& w)
607+
{
608+
RpClump* clump = GetRpClump();
609+
if (clump)
610+
{
611+
// updating the bone frame orientation will also update its children
612+
// This rotation is only applied when UpdateElementRpHAnim is called
613+
CAnimBlendClumpDataSAInterface* clumpDataInterface = *pGame->GetClumpData(clump);
614+
AnimBlendFrameData* frameData = clumpDataInterface->GetFrameDataByNodeId(boneId);
615+
if (frameData)
616+
{
617+
RtQuat* boneOrientation = &frameData->m_pIFrame->orientation;
618+
x = boneOrientation->imag.x;
619+
y = boneOrientation->imag.y;
620+
z = boneOrientation->imag.z;
621+
w = boneOrientation->real;
622+
return true;
623+
}
624+
}
625+
return false;
626+
}
627+
606628
bool CEntitySA::SetBoneRotation(eBone boneId, float yaw, float pitch, float roll)
607629
{
608630
RpClump* clump = GetRpClump();
@@ -628,6 +650,33 @@ bool CEntitySA::SetBoneRotation(eBone boneId, float yaw, float pitch, float roll
628650
return false;
629651
}
630652

653+
bool CEntitySA::SetBoneRotationQuat(eBone boneId, float x, float y, float z, float w)
654+
{
655+
RpClump* clump = GetRpClump();
656+
if (clump)
657+
{
658+
// updating the bone frame orientation will also update its children
659+
// This rotation is only applied when UpdateElementRpHAnim is called
660+
CAnimBlendClumpDataSAInterface* clumpDataInterface = *pGame->GetClumpData(clump);
661+
AnimBlendFrameData* frameData = clumpDataInterface->GetFrameDataByNodeId(boneId);
662+
if (frameData)
663+
{
664+
RtQuat* boneOrientation = &frameData->m_pIFrame->orientation;
665+
boneOrientation->imag.x = x;
666+
boneOrientation->imag.y = y;
667+
boneOrientation->imag.z = z;
668+
boneOrientation->real = w;
669+
CEntitySAInterface* theInterface = GetInterface();
670+
if (theInterface)
671+
{
672+
theInterface->bDontUpdateHierarchy = false;
673+
}
674+
return true;
675+
}
676+
}
677+
return false;
678+
}
679+
631680
bool CEntitySA::GetBonePosition(eBone boneId, CVector& position)
632681
{
633682
RwMatrix* rwBoneMatrix = GetBoneRwMatrix(boneId);

Client/game_sa/CEntitySA.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ class CEntitySA : public virtual CEntity
324324
bool SetBoneMatrix(eBone boneId, const CMatrix& matrix);
325325

326326
bool GetBoneRotation(eBone boneId, float& yaw, float& pitch, float& roll);
327+
bool GetBoneRotationQuat(eBone boneId, float& x, float& y, float& z, float& w);
327328
bool SetBoneRotation(eBone boneId, float yaw, float pitch, float roll);
329+
bool SetBoneRotationQuat(eBone boneId, float x, float y, float z, float w);
328330
bool GetBonePosition(eBone boneId, CVector& position);
329331
bool SetBonePosition(eBone boneId, const CVector& position);
330332

Client/game_sa/CGameSA.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ CGameSA::CGameSA()
145145
m_pPlantManager = new CPlantManagerSA();
146146
m_pBuildingRemoval = new CBuildingRemovalSA();
147147

148+
m_pRenderer = std::make_unique<CRendererSA>();
149+
148150
// Normal weapon types (WEAPONSKILL_STD)
149151
for (int i = 0; i < NUM_WeaponInfosStdSkill; i++)
150152
{

Client/game_sa/CGameSA.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "CStreamingSA.h"
1818
#include "CCoverManagerSA.h"
1919
#include "CPlantManagerSA.h"
20+
#include "CRendererSA.h"
2021

2122
class CAnimBlendClumpDataSAInterface;
2223
class CObjectGroupPhysicalPropertiesSA;
@@ -172,7 +173,8 @@ class CGameSA : public CGame
172173
CCoverManagerSA* GetCoverManager() const noexcept { return m_pCoverManager; };
173174
CPlantManagerSA* GetPlantManager() const noexcept { return m_pPlantManager; };
174175
CBuildingRemoval* GetBuildingRemoval() { return m_pBuildingRemoval; }
175-
176+
CRenderer* GetRenderer() const noexcept override { return m_pRenderer.get(); }
177+
176178
CWeaponInfo* GetWeaponInfo(eWeaponType weapon, eWeaponSkill skill = WEAPONSKILL_STD);
177179
CModelInfo* GetModelInfo(DWORD dwModelID, bool bCanBeInvalid = false);
178180
CObjectGroupPhysicalProperties* GetObjectGroupPhysicalProperties(unsigned char ucObjectGroup);
@@ -346,6 +348,8 @@ class CGameSA : public CGame
346348
CPlantManagerSA* m_pPlantManager;
347349
CBuildingRemoval* m_pBuildingRemoval;
348350

351+
std::unique_ptr<CRendererSA> m_pRenderer;
352+
349353
CPad* m_pPad;
350354
CAERadioTrackManager* m_pCAERadioTrackManager;
351355
CAudioEngine* m_pAudioEngine;

0 commit comments

Comments
 (0)