]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
fix some file name bugs
authorRudolf Polzer <divverent@alientrap.org>
Thu, 23 Dec 2010 09:23:53 +0000 (10:23 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 23 Dec 2010 09:23:53 +0000 (10:23 +0100)
tools/quake3/q3map2/convert_ase.c
tools/quake3/q3map2/convert_obj.c

index ca070630005bc433f4e654a0dd0c1ca3fd62b20f..dbb2fd48749718911e6442ce4fb0fed2845570fd 100644 (file)
@@ -322,13 +322,15 @@ int ConvertBSPToASE( char *bspName )
        entity_t                *e;
        vec3_t                  origin;
        const char              *key;
-       char                    name[ 1024 ], base[ 1024 ];
+       char                    name[ 1024 ], base[ 1024 ], dirname[ 1024 ];
        
        
        /* note it */
        Sys_Printf( "--- Convert BSP to ASE ---\n" );
 
        /* create the ase filename from the bsp name */
+       strcpy( dirname, bspName );
+       StripExtension( dirname );
        strcpy( name, bspName );
        StripExtension( name );
        strcat( name, ".ase" );
@@ -366,7 +368,7 @@ int ConvertBSPToASE( char *bspName )
                {
                        char buf[1024];
                        FILE *tmp;
-                       snprintf(buf, sizeof(buf), "%s/lm_%04d.tga", base, lightmapCount);
+                       snprintf(buf, sizeof(buf), "%s/lm_%04d.tga", dirname, lightmapCount);
                        buf[sizeof(buf) - 1] = 0;
                        tmp = fopen(buf, "rb");
                        if(!tmp)
index dd11537effd30fc960cf8a9691cf6c8ad157b479..25351cad62048ac22f2272b0bac4e64a39612dc0 100644 (file)
@@ -198,13 +198,15 @@ int ConvertBSPToOBJ( char *bspName )
        entity_t                *e;
        vec3_t                  origin;
        const char              *key;
-       char                    name[ 1024 ], base[ 1024 ], mtlname[ 1024 ];
+       char                    name[ 1024 ], base[ 1024 ], mtlname[ 1024 ], dirname[ 1024 ];
        
        
        /* note it */
        Sys_Printf( "--- Convert BSP to OBJ ---\n" );
 
        /* create the ase filename from the bsp name */
+       strcpy( dirname, bspName );
+       StripExtension( dirname );
        strcpy( name, bspName );
        StripExtension( name );
        strcat( name, ".obj" );
@@ -228,7 +230,7 @@ int ConvertBSPToOBJ( char *bspName )
        /* print header */
        fprintf( f, "o %s\r\n", base );
        fprintf( f, "# Generated by Q3Map2 (ydnar) -convert -format obj\r\n" );
-       fprintf( f, "mtllib %s\r\n", mtlname );
+       fprintf( f, "mtllib %s.mtl\r\n", base );
 
        fprintf( fmtl, "# Generated by Q3Map2 (ydnar) -convert -format obj\r\n" );
        if(lightmapsAsTexcoord)
@@ -240,7 +242,7 @@ int ConvertBSPToOBJ( char *bspName )
                {
                        char buf[1024];
                        FILE *tmp;
-                       snprintf(buf, sizeof(buf), "%s/lm_%04d.tga", base, lightmapCount);
+                       snprintf(buf, sizeof(buf), "%s/lm_%04d.tga", dirname, lightmapCount);
                        buf[sizeof(buf) - 1] = 0;
                        tmp = fopen(buf, "rb");
                        if(!tmp)