From f2f36df58fa55c9ea8096c0aaed41d8b5e4729f5 Mon Sep 17 00:00:00 2001 From: Garux Date: Thu, 25 Jul 2019 19:55:16 +0300 Subject: [PATCH] q3map2 * _maxlight worldspawn key (works unless exposure is used) (for those, who know, what they do) --- tools/quake3/q3map2/light.c | 7 +++++++ tools/quake3/q3map2/light_ydnar.c | 4 ++-- tools/quake3/q3map2/q3map2.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index e50d609a..02bae21c 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -1957,6 +1957,13 @@ void LightWorld( qboolean fastAllocate ){ } } + /* maxlight */ + value = ValueForKey( &entities[ 0 ], "_maxlight" ); + if ( value[ 0 ] != '\0' ) { + f = atof( value ); + maxLight = f > 255? 255 : f < 0? 0 : f; + } + /* create world lights */ Sys_FPrintf( SYS_VRB, "--- CreateLights ---\n" ); CreateEntityLights(); diff --git a/tools/quake3/q3map2/light_ydnar.c b/tools/quake3/q3map2/light_ydnar.c index a053368a..3234d14c 100644 --- a/tools/quake3/q3map2/light_ydnar.c +++ b/tools/quake3/q3map2/light_ydnar.c @@ -78,8 +78,8 @@ void ColorToBytes( const float *color, byte *colorBytes, float scale ){ if ( lightmapExposure == 0 ) { /* clamp with color normalization */ max = VectorMax( sample ); - if ( max > 255.0f ) { - VectorScale( sample, ( 255.0f / max ), sample ); + if ( max > maxLight ) { + VectorScale( sample, ( maxLight / max ), sample ); } } else diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index ad6985f8..e18f86df 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -2393,6 +2393,7 @@ Q_EXTERN int defaultLightSubdivide Q_ASSIGN( 999 ); Q_EXTERN vec3_t ambientColor; Q_EXTERN vec3_t minLight, minVertexLight, minGridLight; +Q_EXTERN float maxLight Q_ASSIGN( 255.f ); Q_EXTERN int *entitySurface; Q_EXTERN vec3_t *surfaceOrigin;