Skip to content

Commit

Permalink
Apply element filter for buildings in engineApplyShaderToWorldTexture
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNormalnij committed Jan 22, 2025
1 parent bf689fd commit c738383
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
10 changes: 10 additions & 0 deletions Client/game_sa/CBuildingsPoolSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ inline bool CBuildingsPoolSA::AddBuildingToPool(CClientBuilding* pClientBuilding
return true;
}

CClientEntity* CBuildingsPoolSA::GetClientBuilding(CBuildingSAInterface* pGameInterface) const noexcept
{
auto poolIndex = (*m_ppBuildingPoolInterface)->GetObjectIndex(pGameInterface);

if (poolIndex == -1)
return nullptr;

return m_buildingPool.entities[poolIndex].pClientEntity;
}

CBuilding* CBuildingsPoolSA::AddBuilding(CClientBuilding* pClientBuilding, uint16_t modelId, CVector* vPos, CVector4D* vRot, uint8_t interior)
{
if (!HasFreeBuildingSlot())
Expand Down
1 change: 1 addition & 0 deletions Client/game_sa/CBuildingsPoolSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CBuildingsPoolSA : public CBuildingsPool
void RestoreBackup() override;
bool Resize(int size) override;
int GetSize() const override { return (*m_ppBuildingPoolInterface)->m_nSize; };
CClientEntity* GetClientBuilding(CBuildingSAInterface* pGameInterface) const noexcept;

private:
void RemoveBuildingFromWorld(CBuildingSAInterface* pBuilding);
Expand Down
6 changes: 5 additions & 1 deletion Client/game_sa/CPoolsSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,12 @@ CClientEntity* CPoolsSA::GetClientEntity(DWORD* pGameInterface)
{
return pThePedEntity->pClientEntity;
}

auto clientBuilding = m_BuildingsPool.GetClientBuilding(reinterpret_cast<CBuildingSAInterface*>(pGameInterface));
if (clientBuilding)
return clientBuilding;
}
return NULL;
return nullptr;
}

static void CreateMissionTrain(const CVector& vecPos, bool bDirection, std::uint32_t uiTrainType, CTrainSAInterface** ppTrainBeginning,
Expand Down
3 changes: 3 additions & 0 deletions Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3734,6 +3734,9 @@ void CClientGame::StaticGameEntityRenderHandler(CEntitySAInterface* pGameEntity)
case CCLIENTOBJECT:
iTypeMask = TYPE_MASK_OBJECT;
break;
case CCLIENTBUILDING:
iTypeMask = TYPE_MASK_WORLD;
break;
default:
iTypeMask = TYPE_MASK_OTHER;
break;
Expand Down
4 changes: 2 additions & 2 deletions Client/multiplayer_sa/multiplayersa_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const c

void CallGameEntityRenderHandler(CEntitySAInterface* pEntity)
{
// Only call if not a building or a dummy
if (!pEntity || (pEntity->nType != ENTITY_TYPE_BUILDING && pEntity->nType != ENTITY_TYPE_DUMMY))
// Only call if not a dummy
if (!pEntity || pEntity->nType != ENTITY_TYPE_DUMMY)
if (pGameEntityRenderHandler)
pGameEntityRenderHandler(pEntity);
}

0 comments on commit c738383

Please sign in to comment.