Fixed bug when looking for PBR image timestamp

This commit is contained in:
Robert Beckebans 2020-04-13 18:20:45 +02:00
parent 56a2ec0dfc
commit bc7d66a740
2 changed files with 10 additions and 3 deletions

View file

@ -976,13 +976,19 @@ retry:
//idLib::Warning( "image %s failed to load, using %s instead", origName.c_str(), name.c_str()); //idLib::Warning( "image %s failed to load, using %s instead", origName.c_str(), name.c_str());
break; break;
} }
if( !pic && timestamp && *timestamp != FILE_NOT_FOUND_TIMESTAMP )
{
// we are only interested in the timestamp and we got one
break;
}
} }
} }
} }
if( pbrImageLookup ) if( pbrImageLookup )
{ {
if( ( pic && *pic == NULL ) || ( timestamp && *timestamp == FILE_NOT_FOUND_TIMESTAMP ) ) if( ( pic && *pic == NULL ) || ( !pic && timestamp && *timestamp == FILE_NOT_FOUND_TIMESTAMP ) )
{ {
name = origName; name = origName;
name.ExtractFileExtension( ext ); name.ExtractFileExtension( ext );
@ -991,9 +997,9 @@ retry:
goto retry; goto retry;
} }
if( pic && *pic != NULL ) if( ( pic && *pic != NULL ) || ( !pic && timestamp && *timestamp != FILE_NOT_FOUND_TIMESTAMP ) )
{ {
idLib::Printf( "PBR hack: using '%s' instead of '%s'", name.c_str(), origName.c_str() ); idLib::Printf( "PBR hack: using '%s' instead of '%s'\n", name.c_str(), origName.c_str() );
*usage = TD_SPECULAR_PBR_RMAO; *usage = TD_SPECULAR_PBR_RMAO;
} }
} }

View file

@ -941,6 +941,7 @@ void idRenderSystemLocal::TakeScreenshot( int width, int height, const char* fil
R_StaticFree( shortBuffer ); R_StaticFree( shortBuffer );
r_jitter.SetBool( false ); r_jitter.SetBool( false );
} }
if( exten == PNG ) if( exten == PNG )
{ {
R_WritePNG( finalFileName, buffer, 3, width, height, false, "fs_basepath" ); R_WritePNG( finalFileName, buffer, 3, width, height, false, "fs_basepath" );