Optimization, and slightly more professional-looking behavior for the song progress meter.
This commit is contained in:
@@ -1065,6 +1065,12 @@ void ScreenGameplay::LoadNextSong()
|
|||||||
m_bZeroDeltaOnNextUpdate = true;
|
m_bZeroDeltaOnNextUpdate = true;
|
||||||
|
|
||||||
|
|
||||||
|
// (Re)Calculate the song position meter
|
||||||
|
m_fSongPosMeterOffset = GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat(
|
||||||
|
GAMESTATE->m_pCurSong->m_fFirstBeat );
|
||||||
|
m_fSongPosMeterEnd = ( GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat(
|
||||||
|
GAMESTATE->m_pCurSong->m_fLastBeat ) - m_fSongPosMeterOffset );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load cabinet lights data
|
// Load cabinet lights data
|
||||||
//
|
//
|
||||||
@@ -1592,19 +1598,13 @@ void ScreenGameplay::Update( float fDeltaTime )
|
|||||||
//
|
//
|
||||||
// update song position meter
|
// update song position meter
|
||||||
//
|
//
|
||||||
// Because most songs have a leadout, consider the last beat to be the
|
// IMHHO, The song position bar is best used to represent where in the
|
||||||
// end of the song as far as the meter is concerned. So, get the time of
|
// step sequence the players are. It looks "better" that way, showing a
|
||||||
// the last beat of the song.
|
// song "depleting" as the players wear on. So, it starts "ticking" at
|
||||||
//
|
// the first arrow and winds down to the very end.
|
||||||
// XXX My hunch tells me doing this every update will slow things down,
|
float fPercentPositionSong = ( GAMESTATE->m_fMusicSeconds - m_fSongPosMeterOffset ) /
|
||||||
// but at least it's somewhat accurate. We probably should do this
|
m_fSongPosMeterEnd;
|
||||||
// when the meter inits, shove it in a variable somewhere, and go by
|
|
||||||
// that. At least it's better than blind fudging...
|
|
||||||
float fMusicLengthSeconds =
|
|
||||||
GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat(
|
|
||||||
GAMESTATE->m_pCurSong->m_fLastBeat );
|
|
||||||
|
|
||||||
float fPercentPositionSong = GAMESTATE->m_fMusicSeconds / fMusicLengthSeconds;
|
|
||||||
CLAMP( fPercentPositionSong, 0, 1 );
|
CLAMP( fPercentPositionSong, 0, 1 );
|
||||||
m_meterSongPosition.SetPercent( fPercentPositionSong );
|
m_meterSongPosition.SetPercent( fPercentPositionSong );
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,10 @@ protected:
|
|||||||
BeginnerHelper m_BeginnerHelper;
|
BeginnerHelper m_BeginnerHelper;
|
||||||
|
|
||||||
NoteData m_CabinetLightsNoteData;
|
NoteData m_CabinetLightsNoteData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
float m_fSongPosMeterEnd;
|
||||||
|
float m_fSongPosMeterOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user