From 6c135d59c0b59e4a17ba6988ae0b2d39c2165ff5 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Thu, 18 Feb 2021 20:46:01 +0100 Subject: [PATCH] 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 --- tools/quake3/q3map2/image.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 ); -- 2.39.2