From f154a00e3a2867ddd0b367deb14339f71753bb85 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Fri, 20 Nov 2015 14:19:05 -0800 Subject: [PATCH] light: fix "_mincolor" bmodel key which was only accepting 0-255 now accepts 0-1 or 0-255. --- include/light/entities.h | 3 +++ light/entities.c | 2 +- light/light.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/light/entities.h b/include/light/entities.h index 4f6d8828..99acfcc5 100644 --- a/include/light/entities.h +++ b/include/light/entities.h @@ -112,6 +112,9 @@ typedef struct entity_s { #define MAX_LIGHTS 65536 extern entity_t *lights[MAX_LIGHTS]; +/* detect colors with components in 0-1 and scale them to 0-255 */ +void normalize_color_format(vec3_t color); + entity_t *FindEntityWithKeyPair(const char *key, const char *value); const char *ValueForKey(const entity_t *ent, const char *key); void GetVectorForKey(const entity_t *ent, const char *key, vec3_t vec); diff --git a/light/entities.c b/light/entities.c index ec026ac4..1eb0cac1 100644 --- a/light/entities.c +++ b/light/entities.c @@ -190,7 +190,7 @@ vec_from_mangle(vec3_t v, const vec3_t m) } /* detect colors with components in 0-1 and scale them to 0-255 */ -static void +void normalize_color_format(vec3_t color) { if (color[0] >= 0 && color[0] <= 1 && diff --git a/light/light.c b/light/light.c index 7e28930a..75738094 100644 --- a/light/light.c +++ b/light/light.c @@ -195,6 +195,7 @@ FindModelInfo(const bsp2_t *bsp) if (attribute[0]) info->minlight.light = atoi(attribute); GetVectorForKey(entity, "_mincolor", info->minlight.color); + normalize_color_format(info->minlight.color); if (!VectorCompare(info->minlight.color, vec3_origin)) { if (!write_litfile) write_litfile = true;