mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-29 23:23:07 +00:00
- fixed: FLightDefaults::ApplyProperties must always validate the light's radius.
This commit is contained in:
parent
4898bec12d
commit
46093cad14
1 changed files with 33 additions and 1 deletions
|
@ -181,7 +181,9 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const
|
|||
if (m_additive) light->flags4 |= MF4_ADDITIVE;
|
||||
if (m_dontlightself) light->flags4 |= MF4_DONTLIGHTSELF;
|
||||
light->m_tickCount = 0;
|
||||
if (m_type == PulseLight)
|
||||
switch (m_type)
|
||||
{
|
||||
case PulseLight:
|
||||
{
|
||||
float pulseTime = float(m_Param / TICRATE);
|
||||
|
||||
|
@ -190,6 +192,36 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const
|
|||
light->m_cycler.ShouldCycle(true);
|
||||
light->m_cycler.SetCycleType(CYCLE_Sin);
|
||||
light->m_currentRadius = light->m_cycler.GetVal();
|
||||
break;
|
||||
}
|
||||
|
||||
case FlickerLight:
|
||||
case RandomFlickerLight:
|
||||
{
|
||||
float minrad = float(MIN(light->m_Radius[0], light->m_Radius[1]));
|
||||
float maxrad = float(MAX(light->m_Radius[0], light->m_Radius[1]));
|
||||
light->m_currentRadius = clamp(light->m_currentRadius, minrad, maxrad);
|
||||
break;
|
||||
}
|
||||
|
||||
case PointLight:
|
||||
light->m_currentRadius = float(light->m_Radius[0]);
|
||||
break;
|
||||
|
||||
case SectorLight:
|
||||
{
|
||||
float intensity;
|
||||
float scale = light->args[LIGHT_SCALE] / 8.f;
|
||||
|
||||
if (scale == 0.f) scale = 1.f;
|
||||
|
||||
intensity = light->Sector->lightlevel * scale;
|
||||
intensity = clamp<float>(intensity, 0.f, 255.f);
|
||||
|
||||
light->m_currentRadius = intensity;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
switch (m_attenuate)
|
||||
|
|
Loading…
Reference in a new issue