]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/writebsp.c
properly support -keeplights option. Current implementation never worked.
[xonotic/netradiant.git] / tools / quake3 / q3map2 / writebsp.c
index 7d63e357dc003d03cde7653be05ae910f563ef2a..106e618f23ae88158f8562106820783dca90bc78 100644 (file)
@@ -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)
        {
@@ -399,7 +403,7 @@ EndBSPFile()
 finishes a new bsp and writes to disk
 */
 
-void EndBSPFile( void )
+void EndBSPFile(qboolean do_write)
 {
        char    path[ 1024 ];
        
@@ -411,13 +415,16 @@ void EndBSPFile( void )
        numBSPEntities = numEntities;
        UnparseEntities();
        
-       /* write the surface extra file */
-       WriteSurfaceExtraFile( source );
-       
-       /* write the bsp */
-       sprintf( path, "%s.bsp", source );
-       Sys_Printf( "Writing %s\n", path );
-       WriteBSPFile( path );
+       if(do_write)
+       {
+               /* write the surface extra file */
+               WriteSurfaceExtraFile( source );
+
+               /* write the bsp */
+               sprintf( path, "%s.bsp", source );
+               Sys_Printf( "Writing %s\n", path );
+               WriteBSPFile( path );
+       }
 }
 
 
@@ -630,8 +637,7 @@ void EndModel( entity_t *e, node_t *headnode )
        
        /* emit the bsp */
        mod = &bspModels[ numBSPModels ];
-       if(headnode)
-               EmitDrawNode_r( headnode );
+       EmitDrawNode_r( headnode );
        
        /* set surfaces and brushes */
        mod->numBSPSurfaces = numBSPDrawSurfaces - mod->firstBSPSurface;