Skip to content
Open
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
13 changes: 12 additions & 1 deletion Client/game_sa/CBuildingsPoolSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ CBuilding* CBuildingsPoolSA::AddBuilding(CClientBuilding* pClientBuilding, uint1
if (prevGroup != MODEL_PROPERTIES_GROUP_STATIC)
modelInfo->SetObjectPropertiesGroup(MODEL_PROPERTIES_GROUP_STATIC);

// Fix vehicle tuning models (e.g. exh_*) spinning endlessly. Their model info flags get misread as special types (like CRANE) in LoadObjectInstance,
// causing PreRender to rewrite their matrix each frame.
auto* pModelInterface = modelInfo->GetInterface();
const bool bVehicleTuningPart = pModelInterface && modelInfo->GetModelType() == eModelInfoType::ATOMIC && pModelInterface->bWetRoadReflection;
const auto prevSpecialType = bVehicleTuningPart ? pModelInterface->eSpecialModelType : eModelSpecialType::NONE;

if (prevSpecialType != eModelSpecialType::NONE)
pModelInterface->eSpecialModelType = eModelSpecialType::NONE;

// Load building
SFileObjectInstance instance{};
instance.modelID = modelId;
Expand All @@ -99,9 +108,11 @@ CBuilding* CBuildingsPoolSA::AddBuilding(CClientBuilding* pClientBuilding, uint1
pBuilding->m_pLod = nullptr;
pBuilding->m_iplIndex = 0;

// Restore changed properties group
// Restore changed properties group and special model type
if (prevGroup != MODEL_PROPERTIES_GROUP_STATIC)
modelInfo->SetObjectPropertiesGroup(prevGroup);
if (prevSpecialType != eModelSpecialType::NONE)
pModelInterface->eSpecialModelType = prevSpecialType;

// Always stream model collosion
// TODO We can setup collison bounding box and use GTA streamer for it
Expand Down
Loading