From f1a083cee50c1c4ca37a140320309fbd23362ea7 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 17 Mar 2003 01:35:50 +0000 Subject: [PATCH] autogenerate m_fLengthSeconds if not specified --- stepmania/src/BGAnimation.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 05412a376b..b98d171f48 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -64,9 +64,11 @@ void BGAnimation::LoadFromAniDir( CString sAniDir ) IniFile ini(sPathToIni); ini.ReadFile(); + m_fLengthSeconds = -1; ini.GetValueF( "BGAnimation", "LengthSeconds", m_fLengthSeconds ); - for( int i=0; true; i++ ) + unsigned i; + for( i=0; true; i++ ) { CString sLayer = ssprintf("Layer%d",i+1); const IniFile::key* pKey = ini.GetKey( sLayer ); @@ -76,6 +78,13 @@ void BGAnimation::LoadFromAniDir( CString sAniDir ) pLayer->LoadFromIni( sAniDir, sLayer ); m_Layers.push_back( pLayer ); } + + if(m_fLengthSeconds == -1) + { + m_fLengthSeconds = 0; + for( i=0; i < m_Layers.size(); i++ ) + m_fLengthSeconds = max(m_fLengthSeconds, m_Layers[i]->GetMaxTweenTimeLeft()); + } } else {