From 76dd045925622ea3b35204df18f7fbd179b2ec51 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 1 Dec 2011 16:47:35 +0100 Subject: [PATCH] properly support -keeplights option. Current implementation never worked. --- tools/quake3/q3map2/bsp.c | 5 +++++ tools/quake3/q3map2/light.c | 11 ----------- tools/quake3/q3map2/writebsp.c | 4 ++++ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tools/quake3/q3map2/bsp.c b/tools/quake3/q3map2/bsp.c index f9fe902..e1b1e2f 100644 --- a/tools/quake3/q3map2/bsp.c +++ b/tools/quake3/q3map2/bsp.c @@ -702,6 +702,11 @@ int BSPMain( int argc, char **argv ) Sys_Printf( "Disabling water\n" ); nowater = qtrue; } + else if( !strcmp( argv[ i ], "-keeplights" )) + { + keepLights = qtrue; + Sys_Printf( "Leaving light entities on map after compile\n" ); + } else if( !strcmp( argv[ i ], "-nodetail" ) ) { Sys_Printf( "Ignoring detail brushes\n") ; diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index c7f1e72..f4a735c 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -2105,12 +2105,6 @@ int LightMain( int argc, char **argv ) else Sys_Printf( " shader lightstyles hack: enabled\n" ); - keepLights = game->keepLights; - if (keepLights == qtrue) - Sys_Printf( " keep lights: enabled\n" ); - else - Sys_Printf( " keep lights: disabled\n" ); - patchShadows = game->patchShadows; if (patchShadows == qtrue) Sys_Printf( " patch shadows: enabled\n" ); @@ -2730,11 +2724,6 @@ int LightMain( int argc, char **argv ) noStyles = qfalse; Sys_Printf( "Enabling lightstyles\n" ); } - else if( !strcmp( argv[ i ], "-keeplights" )) - { - keepLights = qtrue; - Sys_Printf( "Leaving light entities on map after compile\n" ); - } else if( !strcmp( argv[ i ], "-cpma" ) ) { cpmaHack = qtrue; diff --git a/tools/quake3/q3map2/writebsp.c b/tools/quake3/q3map2/writebsp.c index 2e6e67a..106e618 100644 --- a/tools/quake3/q3map2/writebsp.c +++ b/tools/quake3/q3map2/writebsp.c @@ -287,6 +287,10 @@ void SetLightStyles( void ) char lightTargets[ MAX_SWITCHED_LIGHTS ][ 64 ]; int lightStyles[ MAX_SWITCHED_LIGHTS ]; + /* -keeplights option: force lights to be kept and ignore what the map file says */ + if (keepLights) + SetKeyValue(&entities[0], "_keepLights", "1"); + /* ydnar: determine if we keep lights in the bsp */ if (KeyExists(&entities[ 0 ], "_keepLights") == qtrue) { -- 2.39.2