From eaa888e2c9411d5d47d41bc033d6364f290b4e24 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 30 Mar 2003 19:30:54 +0000 Subject: [PATCH] cleanup edges on graphics --- .../Fonts/ScreenNameEntry category.redir | 1 + .../default/Graphics/BPMDisplay label.png | Bin 915 -> 1125 bytes stepmania/src/BPMDisplay.cpp | 99 ++++++++++++------ stepmania/src/BPMDisplay.h | 14 ++- stepmania/src/ScreenNameEntry.cpp | 2 +- stepmania/src/ScreenSelectMusic.cpp | 19 ++-- stepmania/src/TipDisplay.cpp | 60 ----------- stepmania/src/TipDisplay.h | 37 ------- 8 files changed, 92 insertions(+), 140 deletions(-) create mode 100644 stepmania/Themes/default/Fonts/ScreenNameEntry category.redir delete mode 100644 stepmania/src/TipDisplay.cpp delete mode 100644 stepmania/src/TipDisplay.h 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 1d26f388767563c171831e4ade52d689c00e7769..e587afc6779e78529fe4dcf3100359d54c38757d 100644 GIT binary patch literal 1125 zcmeAS@N?(olHy`uVBq!ia0vp^dO*y>!3-p|nCmTo6lZ})WHAE+w=f7ZGR&GI0Tg6O zcl32+VA$AK^E+@dkgt&J5#-CjP^HSi(9q1l@bf>Ae#yX4YQVtoDuIE)Y6b&?c>bjL zqizfg%nSiOA+A6@|NsBLaN)w4GiQz-J$mHGk;8`%A2@Je|Ni~^_U+rVXU~ouJGO7% zzIE%?EnBv1-n@C!rcE0*Y*@Q??V2@fR<2yRV#SJO%a$!&x^(g4#fug#TDWlGf&~la z&!0bU-n_YU=gyuzd)BO3GiT16F=NK`>C>l9ojPU8l*yAPcXf4jc6PS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/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