From 331fdab2f88f6a23b07f8945b431f5cfaa9ee6ff Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 17 Mar 2003 03:24:12 +0000 Subject: [PATCH] Fix UseSongBG Hmm. Need some way of using rendering masks in BGAs. Not full access to the zbuffer, of course, just a way to implement things like the masked-off stage scroll on top of an unmasked song background. Being able to do this based on the alpha values of another image would have a whole lot of bonuses for background animations, too; eg the canonical trick of rendering things masked by a silhouette. This is tricky to implement, though. It'd be even better if we could do this with full alpha. Most multipass algorithms I can think of would require an alpha channel on the framebuffer, though, and we very often don't have that. I'll keep thinking about it (and perhaps randomly brainstorming into the nearest edit window, such as WinCVS ...) --- stepmania/src/BGAnimationLayer.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 8ba053f6a9..8ac05b04e5 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -461,9 +461,6 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath ) void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) { - Song* pSong = GAMESTATE->m_pCurSong; - CString sSongBGPath = pSong && pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","Common fallback background"); - Init(); if( sAniDir.Right(1) != "/" ) sAniDir += "/"; @@ -475,20 +472,26 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) IniFile ini(sPathToIni); ini.ReadFile(); - CString sFile; - ini.GetValue( sLayer, "File", sFile ); + CString sPath; + ini.GetValue( sLayer, "File", sPath ); bool bUseSongBG = false; ini.GetValueB( sLayer, "UseSongBG", bUseSongBG ); - if( bUseSongBG ) - sFile = sSongBGPath; + if( bUseSongBG ) { + /* Don't throw for missing song backgrounds. */ + Song *pSong = GAMESTATE->m_pCurSong; + if(pSong && pSong->HasBackground()) + sPath = pSong->GetBackgroundPath(); + else + sPath = THEME->GetPathTo("Graphics","Common fallback background"); + } else { + if( sPath == "" ) + RageException::Throw( "In the ini file for BGAnimation '%s', '%s' is missing a the line 'File='.", sAniDir.GetString(), sLayer.GetString() ); - if( sFile == "" ) - RageException::Throw( "In the ini file for BGAnimation '%s', '%s' is missing a the line 'File='.", sAniDir.GetString(), sLayer.GetString() ); - - CString sPath = sAniDir+sFile; - if( !DoesFileExist(sPath) ) - RageException::Throw( "In the ini file for BGAnimation '%s', the specified File '%s' does not exist.", sAniDir.GetString(), sFile.GetString() ); + if( !DoesFileExist(sAniDir+sPath) ) + RageException::Throw( "In the ini file for BGAnimation '%s', the specified File '%s' does not exist.", sAniDir.GetString(), sPath.GetString() ); + sPath = sAniDir+sPath; + } ini.GetValueI( sLayer, "Type", (int&)m_Type ); ini.GetValue ( sLayer, "Command", m_sCommand );