Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply element filter for buildings in engineApplyShaderToWorldTexture #3973

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
{
std::uint32_t poolIndex = (*m_ppBuildingPoolInterface)->GetObjectIndex(pGameInterface);

if (poolIndex == static_cast<std::uint32_t>(-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);
}
Loading