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
1 change: 1 addition & 0 deletions resource/dist/ModelExtras.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ CoronaDistanceMul = 0.1 # Scales coronas at distance
CoronaNearClip = 0.45 # Minimum camera clipping distance for coronas
LightShadowDistance = 120.0 # Maximum draw distance for vehicle ground light shadows
HighBeamPointLightMul = 2.0 # Multiplier for high beam point light reach (1.0 matches low beam, up to 4.0)
SirenPointLightMul = 1.0 # Multiplier for siren point light reach (up to 4.0)
LightHeightLimit = 1.4 # Light height limit (0.0 to disable)
MaterialAmbientMul = 1.0 # Multiplier for illuminated light material ambient brightness
LightCoronaSize = 0.3 # Standard base of coronas size for turn and other lights
Expand Down
5 changes: 5 additions & 0 deletions src/ModelExtrasAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,5 +427,10 @@ int ME_GetPedVariationCount(int modelIndex) {
return 0;
}

// Visual & Render Configuration
float ME_GetSirenPointLightMul() {
return LightsConfig::Get().fSirenPointLightMul;
}

} // extern "C"

3 changes: 3 additions & 0 deletions src/ModelExtrasAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ extern "C"
// Ped Colors
ME_WRAPPER int ME_GetPedVariationCount(int modelIndex);

// Visual & Render Configuration
ME_WRAPPER float ME_GetSirenPointLightMul();

#ifdef __cplusplus
}
#endif
4 changes: 4 additions & 0 deletions src/features/lights/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct LightsConfig {
bool bFoglightTiedToHeadlight = false;
bool bPlayerIdleBrakeLights = false;
float fHighBeamPointLightMul = 2.0f;
float fSirenPointLightMul = 1.0f;

void InitConfig() {
gbGlobalIndicatorLights = gConfig.ReadBoolean("LIGHTS", "StandardLights_GlobalIndicatorLights", gConfig.ReadBoolean("FEATURES", "StandardLights_GlobalIndicatorLights", false));
Expand Down Expand Up @@ -84,6 +85,9 @@ struct LightsConfig {

float rawMul = gConfig.ReadFloat("LIGHTS", "HighBeamPointLightMul", gConfig.ReadFloat("TWEAKS", "HighBeamPointLightMul", 2.0f));
fHighBeamPointLightMul = (rawMul < 1.0f) ? 1.0f : ((rawMul > 4.0f) ? 4.0f : rawMul);

float rawSirenMul = gConfig.ReadFloat("LIGHTS", "SirenPointLightMul", gConfig.ReadFloat("TWEAKS", "SirenPointLightMul", 1.0f));
fSirenPointLightMul = (rawSirenMul < 0.1f) ? 0.1f : ((rawSirenMul > 4.0f) ? 4.0f : rawSirenMul);
}

private:
Expand Down
7 changes: 4 additions & 3 deletions src/features/sirens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ void Sirens::ProcessPointLights(CVehicle *pVeh)
} else if (mat.second->Size > 0.0f) {
sirenRadius = mat.second->Size * 3.0f;
}
sirenRadius = std::clamp(sirenRadius, 5.0f, 15.0f);
sirenRadius = std::clamp(sirenRadius, 5.0f, 15.0f) * LightsConfig::Get().fSirenPointLightMul;

float r = std::clamp(activeColor.r / 255.0f, 0.0f, 1.0f);
float g = std::clamp(activeColor.g / 255.0f, 0.0f, 1.0f);
Expand Down Expand Up @@ -1369,21 +1369,22 @@ void Sirens::ProcessPointLights(CVehicle *pVeh)
{
uint32_t step = (CTimer::m_snTimeInMilliseconds / 120) % 4;
CMatrix vehMat = pVeh->GetMatrix();
float bikeSirenRadius = 8.5f * LightsConfig::Get().fSirenPointLightMul;
if (step == 0 || step == 1)
{
CVector localLeft(-0.35f, 0.70f, 0.45f);
CVector plightPos = pVeh->TransformFromObjectSpace(localLeft);
CVector worldDir = vehMat.up - vehMat.at * 0.25f;
worldDir.Normalize();
CPointLights::AddLight(PLTYPE_SPOTLIGHT, plightPos, worldDir, 8.5f, 1.0f, 0.1f, 0.1f, 0, false, nullptr);
CPointLights::AddLight(PLTYPE_SPOTLIGHT, plightPos, worldDir, bikeSirenRadius, 1.0f, 0.1f, 0.1f, 0, false, nullptr);
}
else if (step == 2 || step == 3)
{
CVector localRight(0.35f, 0.70f, 0.45f);
CVector plightPos = pVeh->TransformFromObjectSpace(localRight);
CVector worldDir = vehMat.up - vehMat.at * 0.25f;
worldDir.Normalize();
CPointLights::AddLight(PLTYPE_SPOTLIGHT, plightPos, worldDir, 8.5f, 0.1f, 0.1f, 1.0f, 0, false, nullptr);
CPointLights::AddLight(PLTYPE_SPOTLIGHT, plightPos, worldDir, bikeSirenRadius, 0.1f, 0.1f, 1.0f, 0, false, nullptr);
}
}
}
Expand Down