fix some file name bugs

This commit is contained in:
Rudolf Polzer
2010-12-23 10:23:53 +01:00
parent 6e456106a3
commit 4853a12dc8
2 changed files with 9 additions and 5 deletions

View 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)

View 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)