X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fimage.cpp;h=9d74d348fd637ebdfb16b578fddf335213fcdd94;hb=3e5ca8cc2ebb375e0502cb44446c633a810a5976;hp=c81b3617ab7fe5527d9c8c45ac2fc6c83623db2b;hpb=b7e36c120eb1546a6c6f97f30e42ab7f9a559c61;p=xonotic%2Fnetradiant.git diff --git a/radiant/image.cpp b/radiant/image.cpp index c81b3617..9d74d348 100644 --- a/radiant/image.cpp +++ b/radiant/image.cpp @@ -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 ){ @@ -50,7 +50,19 @@ public: StringOutputStream fullname( 256 ); fullname << m_name << '.' << name; ArchiveFile* file = GlobalFileSystem().openFile( fullname.c_str() ); + + // also look for .dds image in dds/ prefix like Doom3 or DarkPlaces + if ( file == 0 && !string_compare( name, "dds" ) ) + { + fullname.clear(); + fullname << name << '/' << m_name << '.' << name; + file = GlobalFileSystem().openFile( fullname.c_str() ); + } + if ( file != 0 ) { + // tell user which image file is found for the given texture path + globalOutputStream() << "Found image file: " << makeQuoted( fullname.c_str() ) << "\n"; + m_image = table.loadImage( *file ); file->release(); } @@ -60,5 +72,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; }