Added video banner logic in ScreenSelectMusic
Currently, video banners are treated the same as still-image banners, where we assume we need to let the low-res banner fade in before swapping it out with the high-res banner. This isn't the correct way to handle video banners, since we don't make low-res placeholders for them, so we now check the banner's extension to see if it's a video or not, and directly load the video if so.
This commit is contained in:
@@ -1743,6 +1743,15 @@ void ScreenSelectMusic::SwitchToPreferredDifficulty()
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsVideoFile(const RString& path) {
|
||||
const RString extension = GetExtension(path);
|
||||
return extension == "mp4" ||
|
||||
extension == "avi" ||
|
||||
extension == "mov" ||
|
||||
extension == "mkv" ||
|
||||
extension == "mpg";
|
||||
}
|
||||
|
||||
void ScreenSelectMusic::AfterMusicChange()
|
||||
{
|
||||
if( !m_MusicWheel.IsRouletting() )
|
||||
@@ -2004,14 +2013,23 @@ void ScreenSelectMusic::AfterMusicChange()
|
||||
if( bWantBanner )
|
||||
{
|
||||
LOG->Trace("LoadFromCachedBanner(%s)",g_sBannerPath .c_str());
|
||||
if( m_Banner.LoadFromCachedBanner( g_sBannerPath ) )
|
||||
if( IsVideoFile(g_sBannerPath) )
|
||||
{
|
||||
/* If the high-res banner is already loaded, just delay before
|
||||
* loading it, so the low-res one has time to fade in. */
|
||||
if( !TEXTUREMAN->IsTextureRegistered( Sprite::SongBannerTexture(g_sBannerPath) ) )
|
||||
m_BackgroundLoader.CacheFile( g_sBannerPath );
|
||||
// Directly load the video file.
|
||||
m_Banner.LoadFromCachedBanner(g_sBannerPath);
|
||||
g_bBannerWaiting = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_Banner.LoadFromCachedBanner( g_sBannerPath ) )
|
||||
{
|
||||
/* If the high-res banner is already loaded, just delay before
|
||||
* loading it, so the low-res one has time to fade in. */
|
||||
if( !TEXTUREMAN->IsTextureRegistered( Sprite::SongBannerTexture(g_sBannerPath) ) )
|
||||
m_BackgroundLoader.CacheFile( g_sBannerPath );
|
||||
|
||||
g_bBannerWaiting = true;
|
||||
g_bBannerWaiting = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user