diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 967abc4c6a..984fa9237b 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -4,6 +4,18 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt. ________________________________________________________________________________ +2015/07/02 +---------- +* [Gameplay] Random background video behavior is now controlled by these + three metrics in the Background section: + RandomBGStartBeat sets the beat of the music the first random bg occurs on. + RandomBGChangeMeasures sets the number of measures between changes. + RandomBGChangesWhenBPMChangesAtMeasureStart toggles the behavior in its name. + +================================================================================ +StepMania 5.0.9 | 20150520 +-------------------------------------------------------------------------------- + 2015/06/10 ---------- * [global] get_music_file_length lua function added. [kyzentun] diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 7146285477..7a40ab4aa8 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -239,6 +239,9 @@ LeftEdge=SCREEN_LEFT RightEdge=SCREEN_RIGHT TopEdge=SCREEN_TOP BottomEdge=SCREEN_BOTTOM +RandomBGStartBeat=-1000 +RandomBGChangeMeasures=1 +RandomBGChangesWhenBPMChangesAtMeasureStart=true [Banner] # Scroll stuff when you roll over it, DDR Extreme style. diff --git a/src/Background.cpp b/src/Background.cpp index 60d39d93a9..dfbc56a469 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -31,6 +31,9 @@ static ThemeMetric BOTTOM_EDGE ("Background","BottomEdge"); static ThemeMetric CLAMP_OUTPUT_PERCENT ("Background","ClampOutputPercent"); static ThemeMetric SHOW_DANCING_CHARACTERS ("Background","ShowDancingCharacters"); static ThemeMetric USE_STATIC_BG ("Background","UseStaticBackground"); +static ThemeMetric RAND_BG_START_BEAT("Background", "RandomBGStartBeat"); +static ThemeMetric RAND_BG_CHANGE_MEASURES("Background", "RandomBGChangeMeasures"); +static ThemeMetric RAND_BG_CHANGES_WHEN_BPM_CHANGES("Background", "RandomBGChangesWhenBPMChangesAtMeasureStart"); static Preference g_bShowDanger( "ShowDanger", true ); @@ -440,9 +443,10 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac int iSegmentEndRow = (i + 1 == tSigs.size()) ? iEndRow : tSigs[i+1]->GetRow(); - for(int j=max(ts->GetRow(),iStartRow); + int time_signature_start= max(ts->GetRow(),iStartRow); + for(int j= time_signature_start; jGetNoteRowsPerMeasure()) + j+= RAND_BG_CHANGE_MEASURES * ts->GetNoteRowsPerMeasure()) { // Don't fade. It causes frame rate dip, especially on slower machines. BackgroundDef bd = m_Layer[0].CreateRandomBGA(m_pSong, @@ -452,43 +456,53 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac { BackgroundChange c = change; c.m_def = bd; - c.m_fStartBeat = NoteRowToBeat(j); + if(j == time_signature_start && i == 0) + { + c.m_fStartBeat = RAND_BG_START_BEAT; + } + else + { + c.m_fStartBeat = NoteRowToBeat(j); + } m_Layer[0].m_aBGChanges.push_back( c ); } } } - // change BG every BPM change that is at the beginning of a measure - const vector &bpms = timing.GetTimingSegments(SEGMENT_BPM); - for( unsigned i=0; i &bpms = timing.GetTimingSegments(SEGMENT_BPM); + for( unsigned i=0; i(tSigs[j]); - if ((bpms[i]->GetRow() - ts->GetRow()) % ts->GetNoteRowsPerMeasure() == 0) + bool bAtBeginningOfMeasure = false; + for (unsigned j=0; j(tSigs[j]); + if ((bpms[i]->GetRow() - ts->GetRow()) % ts->GetNoteRowsPerMeasure() == 0) + { + bAtBeginningOfMeasure = true; + break; + } } - } - if( !bAtBeginningOfMeasure ) + if( !bAtBeginningOfMeasure ) continue; // skip - // start so that we don't create a BGChange right on top of fEndBeat - bool bInRange = bpms[i]->GetRow() >= iStartRow && bpms[i]->GetRow() < iEndRow; - if( !bInRange ) + // start so that we don't create a BGChange right on top of fEndBeat + bool bInRange = bpms[i]->GetRow() >= iStartRow && bpms[i]->GetRow() < iEndRow; + if( !bInRange ) continue; // skip - BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this ); - if( !bd.IsEmpty() ) - { - BackgroundChange c = change; - c.m_def.m_sFile1 = bd.m_sFile1; - c.m_def.m_sFile2 = bd.m_sFile2; - c.m_fStartBeat = bpms[i]->GetBeat(); - m_Layer[0].m_aBGChanges.push_back( c ); + BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this ); + if( !bd.IsEmpty() ) + { + BackgroundChange c = change; + c.m_def.m_sFile1 = bd.m_sFile1; + c.m_def.m_sFile2 = bd.m_sFile2; + c.m_fStartBeat = bpms[i]->GetBeat(); + m_Layer[0].m_aBGChanges.push_back( c ); + } } } }