]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/bsp.c
-onlyents: keep gridsize as stored in the bsp
[xonotic/netradiant.git] / tools / quake3 / q3map2 / bsp.c
index e1b1e2fdc9c8ba19cf9906c124d34c4864e2a121..4f4c717269b136811d26493385614a36d13b6252 100644 (file)
@@ -456,6 +456,13 @@ void ProcessWorldModel( void )
                                else
                                        //%     VectorClear( normal );
                                        VectorSet( normal, 0, 0, -1 );
+
+                               if(colorsRGB)
+                               {
+                                       color[0] = Image_LinearFloatFromsRGBFloat(color[0]);
+                                       color[1] = Image_LinearFloatFromsRGBFloat(color[1]);
+                                       color[2] = Image_LinearFloatFromsRGBFloat(color[2]);
+                               }
                                
                                /* create the flare surface (note shader defaults automatically) */
                                DrawSurfaceForFlare( mapEntityNum, origin, normal, color, flareShader, lightStyle );
@@ -619,7 +626,7 @@ void OnlyEnts( void )
 {
        char out[ 1024 ];
 
-       char save_cmdline[1024], save_version[1024];
+       char save_cmdline[1024], save_version[1024], save_gridsize[1024];
        const char *p;
        
        /* note it */
@@ -635,6 +642,9 @@ void OnlyEnts( void )
        p = ValueForKey(&entities[0], "_q3map2_version");
        strncpy(save_version, p, sizeof(save_version));
        save_version[sizeof(save_version)-1] = 0;
+       p = ValueForKey(&entities[0], "gridsize");
+       strncpy(save_gridsize, p, sizeof(save_gridsize));
+       save_gridsize[sizeof(save_gridsize)-1] = 0;
 
        numEntities = 0;
 
@@ -647,6 +657,8 @@ void OnlyEnts( void )
                SetKeyValue(&entities[0], "_q3map2_cmdline", save_cmdline);
        if(*save_version)
                SetKeyValue(&entities[0], "_q3map2_version", save_version);
+       if(*save_gridsize)
+               SetKeyValue(&entities[0], "gridsize", save_gridsize);
        
        numBSPEntities = numEntities;
        UnparseEntities();
@@ -684,6 +696,7 @@ int BSPMain( int argc, char **argv )
        maxSurfaceIndexes = game->maxSurfaceIndexes;
        emitFlares = game->emitFlares;
        texturesRGB = game->texturesRGB;
+       colorsRGB = game->colorsRGB;
        
        /* process arguments */
        for( i = 1; i < (argc - 1); i++ )
@@ -934,6 +947,23 @@ int BSPMain( int argc, char **argv )
                        texturesRGB = qfalse;
                        Sys_Printf( "Textures are linear\n" );
                }
+               else if( !strcmp( argv[ i ], "-sRGBcolor" ) )
+               {
+                       colorsRGB = qtrue;
+                       Sys_Printf( "Colors are in sRGB\n" );
+               }
+               else if( !strcmp( argv[ i ], "-nosRGBcolor" ) )
+               {
+                       colorsRGB = qfalse;
+                       Sys_Printf( "Colors are linear\n" );
+               }
+               else if( !strcmp( argv[ i ], "-nosRGB" ) )
+               {
+                       texturesRGB = qfalse;
+                       Sys_Printf( "Textures are linear\n" );
+                       colorsRGB = qfalse;
+                       Sys_Printf( "Colors are linear\n" );
+               }
                else if( !strcmp( argv[ i ], "-altsplit" ) )
                {
                        Sys_Printf( "Alternate BSP splitting (by 27) enabled\n" );