[quake3-commits] r1954 - trunk/code/renderer

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon May 2 11:53:20 EDT 2011


Author: thilo
Date: 2011-05-02 11:53:20 -0400 (Mon, 02 May 2011)
New Revision: 1954

Modified:
   trunk/code/renderer/tr_image.c
Log:
Do not retry image loader for image that failed, patch by Zack Middleton (#4968)


Modified: trunk/code/renderer/tr_image.c
===================================================================
--- trunk/code/renderer/tr_image.c	2011-05-02 15:50:19 UTC (rev 1953)
+++ trunk/code/renderer/tr_image.c	2011-05-02 15:53:20 UTC (rev 1954)
@@ -860,8 +860,7 @@
 	{ "bmp",  R_LoadBMP }
 };
 
-static int numImageLoaders = sizeof( imageLoaders ) /
-		sizeof( imageLoaders[ 0 ] );
+static int numImageLoaders = ARRAY_LEN( imageLoaders );
 
 /*
 =================
@@ -874,9 +873,11 @@
 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 @@
 				// 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,8 +923,11 @@
 	// 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 );
 



More information about the quake3-commits mailing list