Skip to content

Commit 15db2a6

Browse files
authored
Merge branch 'master' into nitro
2 parents e2d1cbe + 361e1e2 commit 15db2a6

Some content is hidden

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

47 files changed

+2328
-2195
lines changed

Client/game_sa/CBuildingsPoolSA.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "CPtrNodeSingleListSA.h"
1919
#include "MemSA.h"
2020
#include "CVehicleSA.h"
21+
#include "CBuildingRemovalSA.h"
2122

2223
extern CGameSA* pGame;
2324

@@ -48,6 +49,16 @@ inline bool CBuildingsPoolSA::AddBuildingToPool(CClientBuilding* pClientBuilding
4849
return true;
4950
}
5051

52+
CClientEntity* CBuildingsPoolSA::GetClientBuilding(CBuildingSAInterface* pGameInterface) const noexcept
53+
{
54+
std::uint32_t poolIndex = (*m_ppBuildingPoolInterface)->GetObjectIndex(pGameInterface);
55+
56+
if (poolIndex == static_cast<std::uint32_t>(-1))
57+
return nullptr;
58+
59+
return m_buildingPool.entities[poolIndex].pClientEntity;
60+
}
61+
5162
CBuilding* CBuildingsPoolSA::AddBuilding(CClientBuilding* pClientBuilding, uint16_t modelId, CVector* vPos, CVector4D* vRot, uint8_t interior)
5263
{
5364
if (!HasFreeBuildingSlot())
@@ -174,6 +185,9 @@ void CBuildingsPoolSA::RestoreBackup()
174185
if (!m_pOriginalBuildingsBackup)
175186
return;
176187

188+
auto* worldSA = pGame->GetWorld();
189+
auto* buildingRemovealSA = static_cast<CBuildingRemovalSA*>(pGame->GetBuildingRemoval());
190+
177191
auto& originalData = *m_pOriginalBuildingsBackup;
178192
auto pBuildsingsPool = (*m_ppBuildingPoolInterface);
179193
for (size_t i = 0; i < MAX_BUILDINGS; i++)
@@ -184,7 +198,8 @@ void CBuildingsPoolSA::RestoreBackup()
184198
auto pBuilding = pBuildsingsPool->GetObject(i);
185199
*pBuilding = originalData[i].second;
186200

187-
pGame->GetWorld()->Add(pBuilding, CBuildingPool_Constructor);
201+
worldSA->Add(pBuilding, CBuildingPool_Constructor);
202+
buildingRemovealSA->AddDataBuilding(pBuilding);
188203
}
189204
}
190205

Client/game_sa/CBuildingsPoolSA.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class CBuildingsPoolSA : public CBuildingsPool
3030
void RestoreBackup() override;
3131
bool Resize(int size) override;
3232
int GetSize() const override { return (*m_ppBuildingPoolInterface)->m_nSize; };
33+
CClientEntity* GetClientBuilding(CBuildingSAInterface* pGameInterface) const noexcept;
3334

3435
private:
3536
void RemoveBuildingFromWorld(CBuildingSAInterface* pBuilding);

Client/game_sa/CHudSA.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ void __fastcall CHudSA::RenderWeaponIcon_Sprite(void* sprite, void*, CRect* rect
837837
color->a = properties.fillColorSecondary.a;
838838

839839
// Call CSprite2d::Draw
840-
((void(__thiscall*)(void*, CRect*, RwColor*))FUNC_CSprie2d_Draw)(sprite, rect, color);
840+
((void(__thiscall*)(void*, CRect*, RwColor*))FUNC_CSprite2d_Draw)(sprite, rect, color);
841841
}
842842

843843
void CHudSA::RenderWeaponIcon_XLU(CVector pos, CVector2D halfSize, std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint16_t intensity, float rhw, std::uint8_t a, std::uint8_t uDir, std::uint8_t vDir)

Client/game_sa/CHudSA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
#define FUNC_CStats_GetFatAndMuscleModifier 0x559AF0
4848
#define FUNC_CSprite2d_DrawBarChart 0x728640
49-
#define FUNC_CSprie2d_Draw 0x728350
49+
#define FUNC_CSprite2d_Draw 0x728350
5050
#define FUNC_CSprite_RenderOneXLUSprite 0x70D000
5151

5252
#define CODE_ShowMoney 0x58F47D

Client/game_sa/CPedSA.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ void CPedSA::SetHealth(float fHealth)
259259
GetPedInterface()->fHealth = fHealth;
260260
}
261261

262-
float CPedSA::GetArmor()
262+
float CPedSA::GetArmor() noexcept
263263
{
264264
return GetPedInterface()->fArmor;
265265
}
266266

267-
void CPedSA::SetArmor(float fArmor)
267+
void CPedSA::SetArmor(float armor) noexcept
268268
{
269-
GetPedInterface()->fArmor = fArmor;
269+
GetPedInterface()->fArmor = armor;
270270
}
271271

272272
float CPedSA::GetOxygenLevel()

Client/game_sa/CPedSA.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ class CPedSA : public virtual CPed, public virtual CPhysicalSA
313313
float GetHealth();
314314
void SetHealth(float fHealth);
315315

316-
float GetArmor();
317-
void SetArmor(float fArmor);
316+
float GetArmor() noexcept;
317+
void SetArmor(float armor) noexcept;
318318

319319
float GetOxygenLevel();
320320
void SetOxygenLevel(float fOxygen);

Client/game_sa/CPoolsSA.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,12 @@ CClientEntity* CPoolsSA::GetClientEntity(DWORD* pGameInterface)
566566
{
567567
return pThePedEntity->pClientEntity;
568568
}
569+
570+
auto clientBuilding = m_BuildingsPool.GetClientBuilding(reinterpret_cast<CBuildingSAInterface*>(pGameInterface));
571+
if (clientBuilding)
572+
return clientBuilding;
569573
}
570-
return NULL;
574+
return nullptr;
571575
}
572576

573577
static void CreateMissionTrain(const CVector& vecPos, bool bDirection, std::uint32_t uiTrainType, CTrainSAInterface** ppTrainBeginning,

Client/mods/deathmatch/logic/CClientBuilding.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ void CClientBuilding::Create()
133133

134134
m_pBuilding = g_pGame->GetPools()->GetBuildingsPool().AddBuilding(this, m_usModelId, &m_vPos, &vRot4D, m_interior);
135135

136+
if (!m_pBuilding)
137+
return;
138+
139+
m_pBuilding->SetBackfaceCulled(!m_bDoubleSided);
140+
136141
if (!m_usesCollision)
137142
{
138143
m_pBuilding->SetUsesCollision(m_usesCollision);

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,6 +3734,9 @@ void CClientGame::StaticGameEntityRenderHandler(CEntitySAInterface* pGameEntity)
37343734
case CCLIENTOBJECT:
37353735
iTypeMask = TYPE_MASK_OBJECT;
37363736
break;
3737+
case CCLIENTBUILDING:
3738+
iTypeMask = TYPE_MASK_WORLD;
3739+
break;
37373740
default:
37383741
iTypeMask = TYPE_MASK_OTHER;
37393742
break;
@@ -4368,7 +4371,7 @@ bool CClientGame::ApplyPedDamageFromGame(eWeaponType weaponUsed, float fDamage,
43684371
{
43694372
float fPreviousHealth = pDamagedPed->m_fHealth;
43704373
float fCurrentHealth = pDamagedPed->GetGamePlayer()->GetHealth();
4371-
float fPreviousArmor = pDamagedPed->m_fArmor;
4374+
float fPreviousArmor = pDamagedPed->m_armor;
43724375
float fCurrentArmor = pDamagedPed->GetGamePlayer()->GetArmor();
43734376

43744377
// Have we taken any damage here?
@@ -4404,7 +4407,7 @@ bool CClientGame::ApplyPedDamageFromGame(eWeaponType weaponUsed, float fDamage,
44044407
{
44054408
// Reget values in case they have been changed during onClientPlayerDamage event (Avoid AC#1 kick)
44064409
fPreviousHealth = pDamagedPed->m_fHealth;
4407-
fPreviousArmor = pDamagedPed->m_fArmor;
4410+
fPreviousArmor = pDamagedPed->m_armor;
44084411
}
44094412
pDamagedPed->GetGamePlayer()->SetHealth(fPreviousHealth);
44104413
pDamagedPed->GetGamePlayer()->SetArmor(fPreviousArmor);
@@ -4450,7 +4453,7 @@ bool CClientGame::ApplyPedDamageFromGame(eWeaponType weaponUsed, float fDamage,
44504453

44514454
// Update our stored health/armor
44524455
pDamagedPed->m_fHealth = fCurrentHealth;
4453-
pDamagedPed->m_fArmor = fCurrentArmor;
4456+
pDamagedPed->m_armor = fCurrentArmor;
44544457

44554458
ElementID damagerID = INVALID_ELEMENT_ID;
44564459
if (pInflictingEntity && !pInflictingEntity->IsLocalEntity())

Client/mods/deathmatch/logic/CClientManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ void CClientManager::DoPulse(bool bDoStandardPulses, bool bDoVehicleManagerPulse
218218
m_pColManager->DoPulse();
219219
m_pGUIManager->DoPulse();
220220
m_pWeaponManager->DoPulse();
221+
m_pRenderElementManager->DoPulse();
221222
}
222223
else
223224
{

0 commit comments

Comments
 (0)