From 4853a12dc8178cfe2758869be901e03f89bda8b9 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 23 Dec 2010 10:23:53 +0100 Subject: [PATCH] fix some file name bugs --- tools/quake3/q3map2/convert_ase.c | 6 ++++-- tools/quake3/q3map2/convert_obj.c | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/quake3/q3map2/convert_ase.c b/tools/quake3/q3map2/convert_ase.c index ca070630..dbb2fd48 100644 --- a/tools/quake3/q3map2/convert_ase.c +++ b/tools/quake3/q3map2/convert_ase.c @@ -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) diff --git a/tools/quake3/q3map2/convert_obj.c b/tools/quake3/q3map2/convert_obj.c index dd11537e..25351cad 100644 --- a/tools/quake3/q3map2/convert_obj.c +++ b/tools/quake3/q3map2/convert_obj.c @@ -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) -- 2.39.2