Fix light fades being unable to lower light levels

This commit is contained in:
spherallic 2023-05-14 16:26:34 +02:00
parent b99ecde7b8
commit b487a71533

View file

@ -353,8 +353,8 @@ void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean
else
{
// Speed means increment per tic (literally speed).
ll->timer = FixedDiv((destvalue<<FRACBITS) - ll->fixedcurlevel, speed<<FRACBITS)>>FRACBITS;
ll->fixedpertic = speed<<FRACBITS;
ll->timer = abs(FixedDiv((destvalue<<FRACBITS) - ll->fixedcurlevel, speed<<FRACBITS)>>FRACBITS);
ll->fixedpertic = ll->destlevel < ll->sourcelevel ? -speed<<FRACBITS : speed<<FRACBITS;
}
}