Skip to content

Commit 608973b

Browse files
committed
Fix conflicts
1 parent ced8a40 commit 608973b

File tree

6 files changed

+17
-23
lines changed

6 files changed

+17
-23
lines changed

Client/game_sa/CBuildingSA.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ void CBuildingSA::AllocateMatrix()
7474
{
7575
auto* newMatrix = g_matrixPool.AllocateItem();
7676
std::memset(newMatrix, 0, sizeof(CMatrixLinkSAInterface));
77-
newMatrix->SetTranslateOnly(m_pInterface->Placeable.m_transform.m_translate);
77+
newMatrix->SetTranslateOnly(m_pInterface->m_transform.m_translate);
7878

79-
m_pInterface->Placeable.matrix = reinterpret_cast<CMatrix_Padded*>(newMatrix);
79+
m_pInterface->matrix = reinterpret_cast<CMatrix_Padded*>(newMatrix);
8080
}
8181

8282
void CBuildingSA::ReallocateMatrix()
@@ -85,26 +85,26 @@ void CBuildingSA::ReallocateMatrix()
8585
return;
8686

8787
auto* newMatrix = g_matrixPool.AllocateItem();
88-
std::memcpy(newMatrix, m_pInterface->Placeable.matrix, sizeof(CMatrixLinkSAInterface));
88+
std::memcpy(newMatrix, m_pInterface->matrix, sizeof(CMatrixLinkSAInterface));
8989
newMatrix->m_pOwner = nullptr;
9090
newMatrix->m_pPrev = nullptr;
9191
newMatrix->m_pNext = nullptr;
9292

9393
m_pInterface->RemoveMatrix();
94-
m_pInterface->Placeable.matrix = reinterpret_cast<CMatrix_Padded*>(newMatrix);
94+
m_pInterface->matrix = reinterpret_cast<CMatrix_Padded*>(newMatrix);
9595
}
9696

9797
void CBuildingSA::RemoveAllocatedMatrix()
9898
{
9999
if (!m_pInterface->HasMatrix())
100100
return;
101101

102-
CMatrixLinkSAInterface* pMatrix = reinterpret_cast<CMatrixLinkSAInterface*>(m_pInterface->Placeable.matrix);
102+
CMatrixLinkSAInterface* pMatrix = reinterpret_cast<CMatrixLinkSAInterface*>(m_pInterface->matrix);
103103

104104
if (pMatrix->m_pOwner || (pMatrix->m_pNext && pMatrix->m_pPrev))
105105
return;
106106

107-
g_matrixPool.RemoveItem(reinterpret_cast<CMatrixLinkSAInterface*>(m_pInterface->Placeable.matrix));
107+
g_matrixPool.RemoveItem(reinterpret_cast<CMatrixLinkSAInterface*>(m_pInterface->matrix));
108108
g_matrixPool.SetCapacity(0);
109-
m_pInterface->Placeable.matrix = nullptr;
109+
m_pInterface->matrix = nullptr;
110110
}

Client/game_sa/CDummyPoolSA.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void CDummyPoolSA::RemoveAllWithBackup()
4343
pDummyPool->Release(i);
4444

4545
(*m_pOriginalElementsBackup)[i].first = true;
46-
(*m_pOriginalElementsBackup)[i].second = *building;
46+
std::memcpy((*m_pOriginalElementsBackup)[i].second, building, sizeof(CEntitySAInterface));
4747
}
4848
else
4949
{
@@ -63,9 +63,9 @@ void CDummyPoolSA::RestoreBackup()
6363
{
6464
if (originalData[i].first)
6565
{
66-
pDummyPool->AllocateAt(i);
66+
pDummyPool->AllocateAtNoInit(i);
6767
auto pDummy = pDummyPool->GetObject(i);
68-
*pDummy = originalData[i].second;
68+
std::memcpy(pDummy, &originalData[i].second, sizeof(CEntitySAInterface));
6969

7070
pGame->GetWorld()->Add(pDummy, CDummyPool_Constructor);
7171
}
@@ -88,7 +88,7 @@ void CDummyPoolSA::UpdateBackupLodOffset(const std::uint32_t offset)
8888
{
8989
if (it.first)
9090
{
91-
CEntitySAInterface* object = &it.second;
91+
CEntitySAInterface* object = reinterpret_cast<CEntitySAInterface*>(&it.second);
9292
CEntitySAInterface* lod = object->GetLod();
9393
if (lod)
9494
object->SetLod((CEntitySAInterface*)((std::uint32_t)lod + offset));

Client/game_sa/CDummyPoolSA.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class CDummyPoolSA final : public CDummyPool
3535
private:
3636
CPoolSAInterface<CEntitySAInterface>** m_ppDummyPoolInterface;
3737

38-
using pool_backup_t = std::array<std::pair<bool, CEntitySAInterface>, MAX_DUMMIES_DEFAULT>;
38+
using building_buffer_t = std::uint8_t[sizeof(CEntitySAInterface)];
39+
using pool_backup_t = std::array<std::pair<bool, building_buffer_t>, MAX_DUMMIES_DEFAULT>;
3940
std::unique_ptr<pool_backup_t> m_pOriginalElementsBackup;
4041
};

Client/game_sa/CEntitySA.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,11 @@ class CEntitySAInterface : public CPlaceableSAInterface
219219
((CStencilShadow_dtorByOwner)0x711730)(this);
220220
};
221221

222-
void SetOrientation(float x, float y, float z) {
223-
using CPlacetable_SetOrientation = void(__thiscall*)(CEntitySAInterface * pEntity, float, float, float);
224-
((CPlacetable_SetOrientation)0x439A80)(this, x, y, z);
225-
}
226-
227222
void RemoveRWObjectWithReferencesCleanup() {
228223
DeleteRwObject();
229224
ResolveReferences();
230225
RemoveShadows();
231226
}
232-
233-
bool HasMatrix() const noexcept { return Placeable.matrix != nullptr; }
234-
235-
void RemoveMatrix() { ((void(__thiscall*)(void*))0x54F3B0)(this); }
236227
};
237228

238229
static_assert(sizeof(CEntitySAInterface) == 0x38, "Invalid size for CEntitySAInterface");

Client/game_sa/CPlaceableSA.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class CPlaceableSAInterface
2929
bool HasMatrix() const noexcept { return matrix != nullptr; }
3030
void RemoveMatrix() { ((void(__thiscall*)(void*))0x54F3B0)(this); }
3131

32+
void SetOrientation(float x, float y, float z) { ((void(__thiscall*)(CPlaceableSAInterface * pEntity, float, float, float))0x439A80)(this, x, y, z); }
33+
3234
public:
3335
CSimpleTransformSAInterface m_transform;
3436
CMatrix_Padded* matrix; // This is actually XYZ*, change later

Client/game_sa/CWorldSA.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,8 @@ CEntity* CWorldSA::TestSphereAgainstWorld(const CVector& sphereCenter, float rad
536536

537537
result.collisionDetected = true;
538538
result.modelID = entity->m_nModelIndex;
539-
result.entityPosition = entity->Placeable.matrix->vPos;
540-
ConvertMatrixToEulerAngles(*entity->Placeable.matrix, result.entityRotation.fX, result.entityRotation.fY, result.entityRotation.fZ);
539+
result.entityPosition = entity->matrix->vPos;
540+
ConvertMatrixToEulerAngles(*entity->matrix, result.entityRotation.fX, result.entityRotation.fY, result.entityRotation.fZ);
541541
result.entityRotation = -result.entityRotation;
542542
result.lodID = entity->m_pLod ? entity->m_pLod->m_nModelIndex : 0;
543543
result.type = static_cast<eEntityType>(entity->nType);

0 commit comments

Comments
 (0)