Added theme metrics for controlling random bg behavior.

This commit is contained in:
Kyzentun Keeslala
2015-07-02 11:51:59 -06:00
parent 398fb8872f
commit f1f1bd5ca6
3 changed files with 54 additions and 25 deletions
+12
View File
@@ -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]
+3
View File
@@ -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.
+39 -25
View File
@@ -31,6 +31,9 @@ static ThemeMetric<float> BOTTOM_EDGE ("Background","BottomEdge");
static ThemeMetric<float> CLAMP_OUTPUT_PERCENT ("Background","ClampOutputPercent");
static ThemeMetric<bool> SHOW_DANCING_CHARACTERS ("Background","ShowDancingCharacters");
static ThemeMetric<bool> USE_STATIC_BG ("Background","UseStaticBackground");
static ThemeMetric<float> RAND_BG_START_BEAT("Background", "RandomBGStartBeat");
static ThemeMetric<float> RAND_BG_CHANGE_MEASURES("Background", "RandomBGChangeMeasures");
static ThemeMetric<bool> RAND_BG_CHANGES_WHEN_BPM_CHANGES("Background", "RandomBGChangesWhenBPMChangesAtMeasureStart");
static Preference<bool> 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;
j<min(iEndRow,iSegmentEndRow);
j+=4*ts->GetNoteRowsPerMeasure())
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<TimingSegment *> &bpms = timing.GetTimingSegments(SEGMENT_BPM);
for( unsigned i=0; i<bpms.size(); i++ )
if(RAND_BG_CHANGES_WHEN_BPM_CHANGES)
{
bool bAtBeginningOfMeasure = false;
for (unsigned j=0; j<tSigs.size(); j++)
// change BG every BPM change that is at the beginning of a measure
const vector<TimingSegment *> &bpms = timing.GetTimingSegments(SEGMENT_BPM);
for( unsigned i=0; i<bpms.size(); i++ )
{
TimeSignatureSegment *ts = static_cast<TimeSignatureSegment *>(tSigs[j]);
if ((bpms[i]->GetRow() - ts->GetRow()) % ts->GetNoteRowsPerMeasure() == 0)
bool bAtBeginningOfMeasure = false;
for (unsigned j=0; j<tSigs.size(); j++)
{
bAtBeginningOfMeasure = true;
break;
TimeSignatureSegment *ts = static_cast<TimeSignatureSegment *>(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 );
}
}
}
}