#ifndef SERVER
-// Length of LIGHT_MAX + 1 means LIGHT_MAX is the last value.
-// LIGHT_SUN is read as LIGHT_MAX from here.
-u8 light_LUT[LIGHT_MAX + 1];
+static u8 light_LUT[LIGHT_SUN + 1];
// The const ref to light_LUT is what is actually used in the code
const u8 *light_decode_table = light_LUT;
// Gamma correction
gamma = rangelim(gamma, 0.5f, 3.0f);
- for (size_t i = 0; i < LIGHT_MAX; i++) {
+ for (size_t i = 0; i < LIGHT_SUN; i++) {
float x = i;
- x /= LIGHT_MAX;
+ x /= LIGHT_SUN;
float brightness = a * x * x * x + b * x * x + c * x;
float boost = d * std::exp(-((x - e) * (x - e)) / (2.0f * f * f));
brightness = powf(brightness + boost, 1.0f / gamma);
if (i > 1 && light_LUT[i] <= light_LUT[i - 1])
light_LUT[i] = light_LUT[i - 1] + 1;
}
- light_LUT[LIGHT_MAX] = 255;
+ light_LUT[LIGHT_SUN] = 255;
}
#endif