From 52545966e60720463085dccbd990baed3476b923 Mon Sep 17 00:00:00 2001 From: Charles Lohr Date: Sat, 18 Dec 2004 08:15:19 +0000 Subject: [PATCH] Fix: Make BPM Display work. --- stepmania/src/BPMDisplay.cpp | 7 +++++++ stepmania/src/BPMDisplay.h | 1 + stepmania/src/ScreenGameplay.cpp | 22 ++++++++++------------ stepmania/src/ScreenGameplay.h | 1 + 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/stepmania/src/BPMDisplay.cpp b/stepmania/src/BPMDisplay.cpp index 987fd67d7b..97be7f3892 100644 --- a/stepmania/src/BPMDisplay.cpp +++ b/stepmania/src/BPMDisplay.cpp @@ -202,6 +202,13 @@ void BPMDisplay::SetBPM( const Course* pCourse ) m_fCycleTime = 0.2f; } +void BPMDisplay::SetBPM( float fBPM ) +{ + DisplayBpms bpms; + bpms.Add( fBPM ); + SetBPMRange( bpms ); +} + void BPMDisplay::DrawPrimitives() { ActorFrame::DrawPrimitives(); diff --git a/stepmania/src/BPMDisplay.h b/stepmania/src/BPMDisplay.h index 11d898860d..ab2eded9eb 100644 --- a/stepmania/src/BPMDisplay.h +++ b/stepmania/src/BPMDisplay.h @@ -21,6 +21,7 @@ public: virtual void DrawPrimitives(); void SetBPM( const Song* pSong ); void SetBPM( const Course* pCourse ); + void SetBPM( float fBPM ); void CycleRandomly(); void NoBPM(); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 5778febd93..0dc4bab98a 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -640,6 +640,7 @@ void ScreenGameplay::Init() m_BPMDisplay.Load(); SET_XY( m_BPMDisplay ); this->AddChild( &m_BPMDisplay ); + m_fLastBPS = 0; ZERO( m_pInventory ); FOREACH_PlayerNumber(p) @@ -983,18 +984,6 @@ void ScreenGameplay::LoadNextSong() m_textSongTitle.SetText( GAMESTATE->m_pCurSong->m_sMainTitle ); - /* XXX: set it to the current BPM, not the range */ - /* What does this comment mean? -Chris - * - * We're in gameplay. A BPM display should display the current BPM, updating - * it as it changes, instead of the "BPM preview" of ScreenSelectMusic. That'd - * be used in IIDX, anyway. (Havn't done this since I don't know what this is - * currently actually used for and don't feel like investigating it until it's - * needed.) - * -glenn - */ - m_BPMDisplay.SetBPM( GAMESTATE->m_pCurSong ); - const bool bReverse[NUM_PLAYERS] = { GAMESTATE->m_PlayerOptions[0].m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1, GAMESTATE->m_PlayerOptions[1].m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1 @@ -1502,6 +1491,15 @@ void ScreenGameplay::Update( float fDeltaTime ) this->PostScreenMessage( SM_NotesEnded, 0 ); } + // + // update bpm display + // + if ( m_fLastBPS != GAMESTATE->m_fCurBPS ) + { + m_fLastBPS = GAMESTATE->m_fCurBPS; + m_BPMDisplay.SetBPM( GAMESTATE->m_fCurBPS * 60.0 ); + } + // // play assist ticks // diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index e87d99797b..10b740fb44 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -119,6 +119,7 @@ protected: BitmapText m_textStepsDescription[NUM_PLAYERS]; BPMDisplay m_BPMDisplay; + float m_fLastBPS; Sprite m_sprScoreFrame; ScoreDisplay* m_pPrimaryScoreDisplay[NUM_PLAYERS];