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. 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 2015/06/10
---------- ----------
* [global] get_music_file_length lua function added. [kyzentun] * [global] get_music_file_length lua function added. [kyzentun]
+3
View File
@@ -239,6 +239,9 @@ LeftEdge=SCREEN_LEFT
RightEdge=SCREEN_RIGHT RightEdge=SCREEN_RIGHT
TopEdge=SCREEN_TOP TopEdge=SCREEN_TOP
BottomEdge=SCREEN_BOTTOM BottomEdge=SCREEN_BOTTOM
RandomBGStartBeat=-1000
RandomBGChangeMeasures=1
RandomBGChangesWhenBPMChangesAtMeasureStart=true
[Banner] [Banner]
# Scroll stuff when you roll over it, DDR Extreme style. # Scroll stuff when you roll over it, DDR Extreme style.
+16 -2
View File
@@ -31,6 +31,9 @@ static ThemeMetric<float> BOTTOM_EDGE ("Background","BottomEdge");
static ThemeMetric<float> CLAMP_OUTPUT_PERCENT ("Background","ClampOutputPercent"); static ThemeMetric<float> CLAMP_OUTPUT_PERCENT ("Background","ClampOutputPercent");
static ThemeMetric<bool> SHOW_DANCING_CHARACTERS ("Background","ShowDancingCharacters"); static ThemeMetric<bool> SHOW_DANCING_CHARACTERS ("Background","ShowDancingCharacters");
static ThemeMetric<bool> USE_STATIC_BG ("Background","UseStaticBackground"); 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 ); 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(); 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<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. // Don't fade. It causes frame rate dip, especially on slower machines.
BackgroundDef bd = m_Layer[0].CreateRandomBGA(m_pSong, BackgroundDef bd = m_Layer[0].CreateRandomBGA(m_pSong,
@@ -452,12 +456,21 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac
{ {
BackgroundChange c = change; BackgroundChange c = change;
c.m_def = bd; c.m_def = bd;
if(j == time_signature_start && i == 0)
{
c.m_fStartBeat = RAND_BG_START_BEAT;
}
else
{
c.m_fStartBeat = NoteRowToBeat(j); c.m_fStartBeat = NoteRowToBeat(j);
}
m_Layer[0].m_aBGChanges.push_back( c ); m_Layer[0].m_aBGChanges.push_back( c );
} }
} }
} }
if(RAND_BG_CHANGES_WHEN_BPM_CHANGES)
{
// change BG every BPM change that is at the beginning of a measure // change BG every BPM change that is at the beginning of a measure
const vector<TimingSegment *> &bpms = timing.GetTimingSegments(SEGMENT_BPM); const vector<TimingSegment *> &bpms = timing.GetTimingSegments(SEGMENT_BPM);
for( unsigned i=0; i<bpms.size(); i++ ) for( unsigned i=0; i<bpms.size(); i++ )
@@ -492,6 +505,7 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac
} }
} }
} }
}
void BackgroundImpl::LoadFromSong( const Song* pSong ) void BackgroundImpl::LoadFromSong( const Song* pSong )
{ {