From: Thomas Debesse Date: Thu, 18 Feb 2021 19:46:01 +0000 (+0100) Subject: q3map2: also look for .dds file in dds/ prefix like Doom3 or Darkplaces X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6c135d59c0b59e4a17ba6988ae0b2d39c2165ff5;p=xonotic%2Fnetradiant.git q3map2: also look for .dds file in dds/ prefix like Doom3 or Darkplaces also tell user which image file is found for the given texture path --- diff --git a/tools/quake3/q3map2/image.c b/tools/quake3/q3map2/image.c index 36658b86..93f1b6ed 100644 --- a/tools/quake3/q3map2/image.c +++ b/tools/quake3/q3map2/image.c @@ -461,6 +461,16 @@ image_t *ImageLoad( const char *filename ){ StripExtension( name ); strcat( name, ".dds" ); size = vfsLoadFile( (const char*) name, (void**) &buffer, 0 ); + + /* also look for .dds image in dds/ prefix like Doom3 or DarkPlaces */ + if ( size <= 0 ) { + strcpy( name, "dds/" ); + strcat( name, image->name ); + StripExtension( name ); + strcat( name, ".dds" ); + size = vfsLoadFile( (const char*) name, (void**) &buffer, 0 ); + } + if ( size > 0 ) { LoadDDSBuffer( buffer, size, &image->pixels, &image->width, &image->height ); goto image_load_success; @@ -497,6 +507,9 @@ image_t *ImageLoad( const char *filename ){ image_load_success: + /* tell user which image file is found for the given texture path */ + Sys_FPrintf( SYS_VRB, "Loaded image: \"%s\"\n", name ); + /* free file buffer */ free( buffer );