[client] Auto-detect light color range

Some mappers use 0-255 and others use 0-1. Detection method adapted from
ericw light (seems to be a good bet as it seems to be popular).
This commit is contained in:
Bill Currie 2022-05-27 12:20:31 +09:00
parent c6d73eaf64
commit 2e14300a11

View file

@ -204,7 +204,9 @@ parse_light (light_t *light, int *style, const plitem_t *entity,
} color = { .v = light->color };
sscanf (str, "%f %f %f", VectorExpandAddr (color.a));
light->color = color.v;
VectorScale (light->color, 1/255.0, light->color);
if (light->color[0] > 1 || light->color[1] > 1 || light->color[2] > 1) {
VectorScale (light->color, 1/255.0, light->color);
}
}
if ((str = PL_String (PL_ObjectForKey (entity, "wait")))) {