From 89c8c7355d0673b4739e152580d201a95024f3ef Mon Sep 17 00:00:00 2001 From: neumond Date: Sat, 10 May 2014 13:48:39 +0400 Subject: [PATCH] Proper working with noradiosity 1 lights --- tools/quake3/q3map2/light.c | 7 +++++++ tools/quake3/q3map2/map.c | 13 ++++++++++--- tools/quake3/q3map2/writebsp.c | 7 ++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index fa3d4476..0de8ac15 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -226,6 +226,7 @@ void CreateEntityLights( void ){ entity_t *e, *e2; const char *name; const char *target; + const char *noradiosity; vec3_t dest; const char *_color; float intensity, scale, deviance, filterRadius; @@ -251,6 +252,12 @@ void CreateEntityLights( void ){ continue; } + /* neumond: skip dynamic lights */ + noradiosity = ValueForKey( e, "noradiosity" ); + if ( noradiosity[ 0 ] == '1' ) { + continue; + } + /* lights with target names (and therefore styles) are only parsed from BSP */ target = ValueForKey( e, "targetname" ); if ( target[ 0 ] != '\0' && i >= numBSPEntities ) { diff --git a/tools/quake3/q3map2/map.c b/tools/quake3/q3map2/map.c index f491b7b7..9b123626 100644 --- a/tools/quake3/q3map2/map.c +++ b/tools/quake3/q3map2/map.c @@ -1644,9 +1644,16 @@ static qboolean ParseMapEntity( qboolean onlyLights ){ classname = ValueForKey( mapEnt, "classname" ); /* ydnar: only lights? */ - if ( onlyLights && Q_strncasecmp( classname, "light", 5 ) ) { - numEntities--; - return qtrue; + if ( onlyLights ) { + if ( Q_strncasecmp( classname, "light", 5 ) ) { + numEntities--; + return qtrue; + } + value = ValueForKey( mapEnt, "noradiosity" ); + if ( value[ 0 ] == '1' ) { + numEntities--; + return qtrue; + } } /* ydnar: determine if this is a func_group */ diff --git a/tools/quake3/q3map2/writebsp.c b/tools/quake3/q3map2/writebsp.c index fecd7855..74de2cb8 100644 --- a/tools/quake3/q3map2/writebsp.c +++ b/tools/quake3/q3map2/writebsp.c @@ -281,6 +281,7 @@ void SetModelNumbers( void ){ void SetLightStyles( void ){ int i, j, style, numStyles; qboolean keepLights; + qboolean noRadiosityLight; const char *t; entity_t *e; epair_t *ep, *next; @@ -303,10 +304,14 @@ void SetLightStyles( void ){ if ( Q_strncasecmp( t, "light", 5 ) ) { continue; } + t = ValueForKey( e, "noradiosity" ); + noRadiosityLight = ( t[ 0 ] == '1' ) ? qtrue : qfalse; t = ValueForKey( e, "targetname" ); if ( t[ 0 ] == '\0' ) { /* ydnar: strip the light from the BSP file */ - if ( keepLights == qfalse ) { + /* neumond: pass all dynamic lights to BSP regardless of keepLights. + pass all lights (radiosity+dynamic) to BSP if keepLights */ + if ( keepLights == qfalse && noRadiosityLight == qfalse ) { ep = e->epairs; while ( ep != NULL ) {