]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/main.c
properly support -keeplights option. Current implementation never worked.
[xonotic/netradiant.git] / tools / quake3 / q3map2 / main.c
index 325235fa57a0e66cdf8c432a970a1a35b2fabd67..5ee35cd5f88049cc7ec097515570c29984c3d97b 100644 (file)
@@ -989,8 +989,8 @@ int AnalyzeBSP( int argc, char **argv )
                lump = (byte*) header + offset;
                lumpInt = LittleLong( (int) *((int*) lump) );
                lumpFloat = LittleFloat( (float) *((float*) lump) );
-               memcpy( lumpString, (char*) lump, (length < 1024 ? length : 1024) );
-               lumpString[ 1024 ] = '\0';
+               memcpy( lumpString, (char*) lump, ((size_t)length < sizeof(lumpString) ? (size_t)length : sizeof(lumpString)-1) );
+               lumpString[ sizeof(lumpString)-1 ] = '\0';
                
                /* print basic lump info */
                Sys_Printf( "Lump:          %d\n", i );
@@ -1537,19 +1537,20 @@ int ConvertBSPMain( int argc, char **argv )
        int             (*convertFunc)( char * );
        game_t  *convertGame;
        char            ext[1024];
-       qboolean        map_allowed, force_bsp;
+       qboolean        map_allowed, force_bsp, force_map;
        
        
        /* set default */
        convertFunc = ConvertBSPToASE;
        convertGame = NULL;
-       map_allowed = qtrue;
+       map_allowed = qfalse;
        force_bsp = qfalse;
+       force_map = qfalse;
        
        /* arg checking */
        if( argc < 1 )
        {
-               Sys_Printf( "Usage: q3map -scale <value> [-v] <mapname>\n" );
+               Sys_Printf( "Usage: q3map -convert -format <ase|obj|map_bp|map> [-shadesasbitmap|-lightmapsastexcoord|-deluxemapsastexcoord] [-readbsp|-readmap [-meta|-patchmeta]] <mapname>\n" );
                return 0;
        }
        
@@ -1604,8 +1605,15 @@ int ConvertBSPMain( int argc, char **argv )
                        shadersAsBitmap = qtrue;
                else if( !strcmp( argv[ i ],  "-lightmapsastexcoord" ) )
                        lightmapsAsTexcoord = qtrue;
-               else if( !strcmp( argv[ i ],  "-forcereadbsp" ) )
+               else if( !strcmp( argv[ i ],  "-deluxemapsastexcoord" ) )
+               {
+                       lightmapsAsTexcoord = qtrue;
+                       deluxemap = qtrue;
+               }
+               else if( !strcmp( argv[ i ],  "-readbsp" ) )
                        force_bsp = qtrue;
+               else if( !strcmp( argv[ i ],  "-readmap" ) )
+                       force_map = qtrue;
                else if( !strcmp( argv[ i ],  "-meta" ) )
                        meta = qtrue;
                else if( !strcmp( argv[ i ],  "-patchmeta" ) )
@@ -1620,7 +1628,11 @@ int ConvertBSPMain( int argc, char **argv )
        /* clean up map name */
        strcpy(source, ExpandArg(argv[i]));
        ExtractFileExtension(source, ext);
-       if(!Q_stricmp(ext, "map") && !force_bsp)
+
+       if(!map_allowed && !force_map)
+               force_bsp = qtrue;
+
+       if(force_map || (!force_bsp && !Q_stricmp(ext, "map") && map_allowed))
        {
                if(!map_allowed)
                        Sys_Printf("WARNING: the requested conversion should not be done from .map files. Compile a .bsp first.\n");