Skip to content

Commit fe1dd06

Browse files
authored
Apply element filter for buildings in engineApplyShaderToWorldTexture (PR #3973)
1 parent c60f8a2 commit fe1dd06

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

Client/game_sa/CBuildingsPoolSA.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ inline bool CBuildingsPoolSA::AddBuildingToPool(CClientBuilding* pClientBuilding
4949
return true;
5050
}
5151

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+
5262
CBuilding* CBuildingsPoolSA::AddBuilding(CClientBuilding* pClientBuilding, uint16_t modelId, CVector* vPos, CVector4D* vRot, uint8_t interior)
5363
{
5464
if (!HasFreeBuildingSlot())

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/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/CClientGame.cpp

Lines changed: 3 additions & 0 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;

Client/multiplayer_sa/multiplayersa_init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const c
8282

8383
void CallGameEntityRenderHandler(CEntitySAInterface* pEntity)
8484
{
85-
// Only call if not a building or a dummy
86-
if (!pEntity || (pEntity->nType != ENTITY_TYPE_BUILDING && pEntity->nType != ENTITY_TYPE_DUMMY))
85+
// Only call if not a dummy
86+
if (!pEntity || pEntity->nType != ENTITY_TYPE_DUMMY)
8787
if (pGameEntityRenderHandler)
8888
pGameEntityRenderHandler(pEntity);
8989
}

0 commit comments

Comments
 (0)