From bd9485f59783aca00946c964f8c9a69ab07ebc4e Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Mon, 2 May 2011 15:53:20 +0000 Subject: [PATCH] Do not retry image loader for image that failed, patch by Zack Middleton (#4968) --- code/renderer/tr_image.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/renderer/tr_image.c b/code/renderer/tr_image.c index 4dd12237..e91298ed 100644 --- a/code/renderer/tr_image.c +++ b/code/renderer/tr_image.c @@ -860,8 +860,7 @@ static imageExtToLoaderMap_t imageLoaders[ ] = { "bmp", R_LoadBMP } }; -static int numImageLoaders = sizeof( imageLoaders ) / - sizeof( imageLoaders[ 0 ] ); +static int numImageLoaders = ARRAY_LEN( imageLoaders ); /* ================= @@ -874,9 +873,11 @@ Loads any of the supported image types into a cannonical void R_LoadImage( const char *name, byte **pic, int *width, int *height ) { qboolean orgNameFailed = qfalse; + int orgLoader = -1; int i; char localName[ MAX_QPATH ]; const char *ext; + char *altName; *pic = NULL; *width = 0; @@ -907,6 +908,7 @@ void R_LoadImage( const char *name, byte **pic, int *width, int *height ) // Loader failed, most likely because the file isn't there; // try again without the extension orgNameFailed = qtrue; + orgLoader = i; COM_StripExtension( name, localName, MAX_QPATH ); } else @@ -921,7 +923,10 @@ void R_LoadImage( const char *name, byte **pic, int *width, int *height ) // the image formats supported for( i = 0; i < numImageLoaders; i++ ) { - char *altName = va( "%s.%s", localName, imageLoaders[ i ].ext ); + if (i == orgLoader) + continue; + + altName = va( "%s.%s", localName, imageLoaders[ i ].ext ); // Load imageLoaders[ i ].ImageLoader( altName, pic, width, height );