diff --git a/stepmania/Themes/default/Fonts/ScreenNameEntry category.redir b/stepmania/Themes/default/Fonts/ScreenNameEntry category.redir new file mode 100644 index 0000000000..ba41a9d72b --- /dev/null +++ b/stepmania/Themes/default/Fonts/ScreenNameEntry category.redir @@ -0,0 +1 @@ +_shared2 diff --git a/stepmania/Themes/default/Graphics/BPMDisplay label.png b/stepmania/Themes/default/Graphics/BPMDisplay label.png index 1d26f38876..e587afc677 100644 Binary files a/stepmania/Themes/default/Graphics/BPMDisplay label.png and b/stepmania/Themes/default/Graphics/BPMDisplay label.png differ diff --git a/stepmania/src/BPMDisplay.cpp b/stepmania/src/BPMDisplay.cpp index 2ac9fe4425..e706c56973 100644 --- a/stepmania/src/BPMDisplay.cpp +++ b/stepmania/src/BPMDisplay.cpp @@ -25,9 +25,8 @@ BPMDisplay::BPMDisplay() { m_fCurrentBPM = m_fLowBPM = m_fHighBPM = 0; - m_CountingState = holding_down; m_fTimeLeftInState = 0; - m_bExtraStage = GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2(); + m_CountingState = holding_down; m_textBPM.LoadFromNumbers( THEME->GetPathTo("Numbers","BPMDisplay") ); m_textBPM.EnableShadow( false ); @@ -50,40 +49,64 @@ void BPMDisplay::Update( float fDeltaTime ) { ActorFrame::Update( fDeltaTime ); - if( m_bExtraStage ) + m_fTimeLeftInState -= fDeltaTime; + if( m_fTimeLeftInState < 0 ) { - m_fTimeLeftInState -= fDeltaTime; - if( m_fTimeLeftInState < 0 ) - { - // XXX: the numbers font doesn't have "?". - m_textBPM.SetText( (RandomFloat(0,1)>0.90) ? "xxx" : ssprintf("%03.0f",RandomFloat(0,600)) ); - m_fTimeLeftInState = 0.2f; // reset timer - } - } - else // !m_bExtraStage - { - m_fTimeLeftInState -= fDeltaTime; - if( m_fTimeLeftInState < 0 ) - { - // go to next state - switch( m_CountingState ) - { - case counting_up: m_CountingState = holding_up; break; - case holding_up: m_CountingState = counting_down; break; - case counting_down: m_CountingState = holding_down; break; - case holding_down: m_CountingState = counting_up; break; - } - m_fTimeLeftInState = 1; // reset timer - } - + // go to next state switch( m_CountingState ) { - case counting_down: m_fCurrentBPM = m_fLowBPM + (m_fHighBPM-m_fLowBPM)*m_fTimeLeftInState; break; - case counting_up: m_fCurrentBPM = m_fHighBPM + (m_fLowBPM-m_fHighBPM)*m_fTimeLeftInState; break; - case holding_up: m_fCurrentBPM = m_fHighBPM; break; - case holding_down: m_fCurrentBPM = m_fLowBPM; break; + case counting_up: + m_CountingState = holding_up; + m_fTimeLeftInState = 1; // reset timer + break; + case holding_up: + m_CountingState = counting_down; + m_fTimeLeftInState = 1; // reset timer + break; + case counting_down: + m_CountingState = holding_down; + m_fTimeLeftInState = 1; // reset timer + break; + case holding_down: + m_CountingState = counting_up; + m_fTimeLeftInState = 1; // reset timer + break; + case cycle_randomly: + m_textBPM.SetText( (RandomFloat(0,1)>0.90) ? "xxx" : ssprintf("%03.0f",RandomFloat(0,600)) ); + m_fTimeLeftInState = 0.2f; // reset timer + break; + case no_bpm: + m_fTimeLeftInState = 0; + break; + default: + ASSERT(0); } - m_textBPM.SetText( ssprintf("%03.0f", m_fCurrentBPM) ); + } + + // update m_fCurrentBPM + int iLastCurBPM = (int)m_fCurrentBPM; + switch( m_CountingState ) + { + case counting_down: m_fCurrentBPM = m_fLowBPM + (m_fHighBPM-m_fLowBPM)*m_fTimeLeftInState; break; + case counting_up: m_fCurrentBPM = m_fHighBPM + (m_fLowBPM-m_fHighBPM)*m_fTimeLeftInState; break; + case holding_up: m_fCurrentBPM = m_fHighBPM; break; + case holding_down: m_fCurrentBPM = m_fLowBPM; break; + case cycle_randomly: break; + case no_bpm: break; + default: + ASSERT(0); + } + + // update text + switch( m_CountingState ) + { + case counting_down: + case counting_up: + case holding_up: + case holding_down: + if( (int)m_fCurrentBPM != iLastCurBPM ) + m_textBPM.SetText( ssprintf("%03.0f", m_fCurrentBPM) ); + break; } } @@ -120,3 +143,15 @@ void BPMDisplay::SetBPMRange( float fLowBPM, float fHighBPM ) } } + +void BPMDisplay::CycleRandomly() +{ + m_CountingState = cycle_randomly; + m_fTimeLeftInState = 0; +} + +void BPMDisplay::NoBPM() +{ + m_CountingState = no_bpm; + m_textBPM.SetText( "..." ); +} diff --git a/stepmania/src/BPMDisplay.h b/stepmania/src/BPMDisplay.h index a14342965e..33a08121b0 100644 --- a/stepmania/src/BPMDisplay.h +++ b/stepmania/src/BPMDisplay.h @@ -24,6 +24,8 @@ public: BPMDisplay(); virtual void Update( float fDeltaTime ); void SetBPMRange( float fLowBPM, float fHighBPM ); + void CycleRandomly(); + void NoBPM(); protected: BitmapText m_textBPM; @@ -31,11 +33,15 @@ protected: float m_fCurrentBPM; float m_fLowBPM, m_fHighBPM; - enum CountingState{ counting_up, holding_up, counting_down, holding_down }; - CountingState m_CountingState; + enum CountingState { + counting_up, + holding_up, + counting_down, + holding_down, + cycle_randomly, + no_bpm // show dashes + } m_CountingState; float m_fTimeLeftInState; - - bool m_bExtraStage; // cycle BPM through random values if extra stage }; #endif diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index 4d7ce0f023..5dd77c034a 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -186,7 +186,7 @@ ScreenNameEntry::ScreenNameEntry() //this->AddChild( &m_textScrollingChars[p][t] ); // draw these manually } - m_textCategory[p].LoadFromFont( THEME->GetPathTo("Fonts","header2") ); + m_textCategory[p].LoadFromFont( THEME->GetPathTo("Fonts","ScreenNameEntry category") ); m_textCategory[p].SetX( (float)GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] ); m_textCategory[p].SetY( CATEGORY_Y ); CString sCategoryText = ssprintf("No. %d in\n", GAMESTATE->m_iRankingIndex[p]+1); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 4fde2b1830..5f18d58092 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -770,7 +770,7 @@ void ScreenSelectMusic::AfterMusicChange() if(!no_banner_change) m_Banner.LoadFromGroup( sGroup ); // if this isn't a group, it'll default to the fallback banner - m_BPMDisplay.SetBPMRange( 0, 0 ); + m_BPMDisplay.NoBPM(); m_sprCDTitle.UnloadTexture(); } break; @@ -791,9 +791,16 @@ void ScreenSelectMusic::AfterMusicChange() if(!no_banner_change) m_Banner.LoadFromSong( pSong ); - float fMinBPM, fMaxBPM; - pSong->GetMinMaxBPM( fMinBPM, fMaxBPM ); - m_BPMDisplay.SetBPMRange( fMinBPM, fMaxBPM ); + if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) + { + m_BPMDisplay.CycleRandomly(); + } + else + { + float fMinBPM, fMaxBPM; + pSong->GetMinMaxBPM( fMinBPM, fMaxBPM ); + m_BPMDisplay.SetBPMRange( fMinBPM, fMaxBPM ); + } if( pSong->HasCDTitle() ) m_sprCDTitle.Load( pSong->GetCDTitlePath() ); @@ -837,7 +844,7 @@ void ScreenSelectMusic::AfterMusicChange() case TYPE_ROULETTE: if(!no_banner_change) m_Banner.LoadRoulette(); - m_BPMDisplay.SetBPMRange( 0, 0 ); + m_BPMDisplay.NoBPM(); m_sprCDTitle.UnloadTexture(); SOUNDMAN->StopMusic(); @@ -850,7 +857,7 @@ void ScreenSelectMusic::AfterMusicChange() case TYPE_RANDOM: if(!no_banner_change) m_Banner.LoadRandom(); - m_BPMDisplay.SetBPMRange( 0, 0 ); + m_BPMDisplay.NoBPM(); m_sprCDTitle.UnloadTexture(); SOUNDMAN->StopMusic(); diff --git a/stepmania/src/TipDisplay.cpp b/stepmania/src/TipDisplay.cpp deleted file mode 100644 index 470a06a7b0..0000000000 --- a/stepmania/src/TipDisplay.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "global.h" -/* ------------------------------------------------------------------------------ - Class: TipDisplay - - Desc: See header - - Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. - Chris Danford ------------------------------------------------------------------------------ -*/ - -#include "TipDisplay.h" -#include "RageUtil.h" -#include "PrefsManager.h" -#include "RageLog.h" -#include "ThemeManager.h" - - -const float TIP_SHOW_TIME = 3.5f; - - -TipDisplay::TipDisplay() -{ - LOG->Trace( "TipDisplay::TipDisplay()" ); - - m_textTip.LoadFromFont( THEME->GetPathTo("Fonts","help") ); - m_textTip.SetEffectDiffuseBlink(); - m_textTip.EnableShadow( false ); - this->AddChild( &m_textTip ); - - m_iCurTipIndex = 0; - m_fSecsUntilSwitch = TIP_SHOW_TIME; -} - - -void TipDisplay::SetTips( CStringArray &arrayTips ) -{ - m_arrayTips = arrayTips; - if( !m_arrayTips.empty() ) - m_textTip.SetText( m_arrayTips[0] ); -} - - -void TipDisplay::Update( float fDeltaTime ) -{ - ActorFrame::Update( fDeltaTime ); - - if( !m_arrayTips.empty() ) - { - m_fSecsUntilSwitch -= fDeltaTime; - if( m_fSecsUntilSwitch < 0 ) // time to switch states - { - m_iCurTipIndex++; - m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.size(); - m_fSecsUntilSwitch = TIP_SHOW_TIME; - m_textTip.SetText( m_arrayTips[m_iCurTipIndex] ); - } - } -} diff --git a/stepmania/src/TipDisplay.h b/stepmania/src/TipDisplay.h deleted file mode 100644 index da926f1398..0000000000 --- a/stepmania/src/TipDisplay.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef TIPDISPLAY_H -#define TIPDISPLAY_H -/* ------------------------------------------------------------------------------ - Class: TipDisplay - - Desc: A BitmapText that cycles through messages. - - Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. - Chris Danford ------------------------------------------------------------------------------ -*/ - -#include "Sprite.h" -#include "song.h" -#include "ActorFrame.h" -#include "BitmapText.h" - - -class TipDisplay : public ActorFrame -{ -public: - TipDisplay(); - void SetTips( CStringArray &arrayTips ); - - virtual void Update( float fDeltaTime ); - -protected: - BitmapText m_textTip; - - CStringArray m_arrayTips; - int m_iCurTipIndex; - - float m_fSecsUntilSwitch; -}; - -#endif