]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/image.cpp
radiant/image: load fallback images with png loader even if game does not support...
[xonotic/netradiant.git] / radiant / image.cpp
index c81b3617ab7fe5527d9c8c45ac2fc6c83623db2b..c9014294f639c0dc07c762355b414b0a87b310cc 100644 (file)
@@ -30,9 +30,9 @@
 #include "os/path.h"
 #include "stream/stringstream.h"
 
-
 typedef Modules<_QERPlugImageTable> ImageModules;
 ImageModules& Textures_getImageModules();
+ImageModules& Textures_getFallbackImageModules();
 
 /// \brief Returns a new image for the first file matching \p name in one of the available texture formats, or 0 if no file is found.
 Image* QERApp_LoadImage( void* environment, const char* name ){
@@ -60,5 +60,12 @@ public:
 
        Textures_getImageModules().foreachModule( LoadImageVisitor( name, image ) );
 
+       // Games can provide their own fallback, so only do this when previous
+       // loading attempt did not work.
+       if ( image == 0 && !!string_compare_nocase( name, "textures/radiant" ) )
+       {
+               Textures_getFallbackImageModules().foreachModule( LoadImageVisitor( name, image ) );
+       }
+
        return image;
 }