Skip to content
Open
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
18 changes: 12 additions & 6 deletions src/features/sirens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,13 +611,19 @@ void Sirens::Init()
int matIdx = GetSirenIndex(pVeh, pMat);

if (matIdx != - 1) {
if (!vehicleData.contains(pVeh)) {
vehicleData[pVeh] = new VehicleSiren(pVeh);
}
Comment on lines +614 to +616
int curState = vehicleData[pVeh]->GetCurrentState();
auto& state = modelData[pVeh->m_nModelIndex]->States[curState];
if (state->Materials.contains(matIdx)) {
if (modelData[pVeh->m_nModelIndex]->isImVehFtSiren) {
return MatStateColor{state->Materials[matIdx]->Color, state->Materials[matIdx]->Color};
} else {
return MatStateColor{state->Materials[matIdx]->Color, DEFAULT_MAT_COL};

if (curState >= 0 && curState < modelData[pVeh->m_nModelIndex]->States.size()) {
auto& state = modelData[pVeh->m_nModelIndex]->States[curState];
if (state->Materials.contains(matIdx)) {
if (modelData[pVeh->m_nModelIndex]->isImVehFtSiren) {
return MatStateColor{state->Materials[matIdx]->Color, state->Materials[matIdx]->Color};
} else {
return MatStateColor{state->Materials[matIdx]->Color, DEFAULT_MAT_COL};
}
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/utils/modelinfomgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,6 @@ RpMaterial *ModelInfoMgr::SetEditableMaterialsCB(RpMaterial *material, void *dat
{
auto &data = m_VehData.Get(pCurVeh);

// Sirens crash fix TODO: remove this and fix it
if (iLightIndex == eMaterialType::SirenLight && data.nFrameCount <= 10)
{
return material;
}

bool lightOn = false;
data.m_MatAvail[iLightIndex] = true;

Expand Down
Loading