From 1ad4a8305069643dceb1a9f21e06356b00c8a98e Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 25 Dec 2003 05:53:30 +0000 Subject: [PATCH] add song position meter to gameplay screen --- .../ScreenGameplay song position meter.redir | 1 + stepmania/Themes/default/metrics.ini | 5 ++++ stepmania/src/ScreenGameplay.cpp | 30 +++++++++++++++++++ stepmania/src/ScreenGameplay.h | 2 ++ 4 files changed, 38 insertions(+) create mode 100644 stepmania/Themes/default/Graphics/ScreenGameplay song position meter.redir diff --git a/stepmania/Themes/default/Graphics/ScreenGameplay song position meter.redir b/stepmania/Themes/default/Graphics/ScreenGameplay song position meter.redir new file mode 100644 index 0000000000..04b2ead777 --- /dev/null +++ b/stepmania/Themes/default/Graphics/ScreenGameplay song position meter.redir @@ -0,0 +1 @@ +_blank \ No newline at end of file diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index f150a590ce..6e7d9191bd 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1110,6 +1110,11 @@ SecondsBetweenComments=10 DemonstrationSeconds=30 TickEarlySeconds=0.05 ShowLifeMeterForDisabledPlayers=1 +SongPositionMeterWidth= +SongPositionMeterX= +SongPositionMeterY= +SongPositionMeterOnCommand=hidden,1 +SongPositionMeterOffCommand= [ScreenEvaluationStage] NextScreen=ScreenSelectMusic diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 335be6873c..0bf76ff8fe 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -57,6 +57,7 @@ #define SHOW_LIFE_METER_FOR_DISABLED_PLAYERS THEME->GetMetricB("ScreenGameplay","ShowLifeMeterForDisabledPlayers") #define EVAL_ON_FAIL THEME->GetMetricB("ScreenGameplay","ShowEvaluationOnFail") #define SHOW_SCORE_IN_RAVE THEME->GetMetricB("ScreenGameplay","ShowScoreInRave") +#define SONG_POSITION_METER_WIDTH THEME->GetMetricF("ScreenGameplay","SongPositionMeterWidth") CachedThemeMetricF SECONDS_BETWEEN_COMMENTS ("ScreenGameplay","SecondsBetweenComments"); CachedThemeMetricF G_TICK_EARLY_SECONDS ("ScreenGameplay","TickEarlySeconds"); @@ -270,11 +271,13 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S m_Background.SetDiffuse( RageColor(0.4f,0.4f,0.4f,1) ); + m_Background.SetZ( 2 ); // behind everything else this->AddChild( &m_Background ); m_sprStaticBackground.SetName( "StaticBG" ); m_sprStaticBackground.Load( THEME->GetPathToG("ScreenGameplay Static Background")); SET_XY( m_sprStaticBackground ); + m_sprStaticBackground.SetZ( 2 ); // behind everything else this->AddChild(&m_sprStaticBackground); if( !bDemonstration ) // only load if we're going to use it @@ -411,6 +414,13 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S SET_XY( m_textSongTitle ); this->AddChild( &m_textSongTitle ); + + m_meterSongPosition.Load( THEME->GetPathToG("ScreenGameplay song position meter"), SONG_POSITION_METER_WIDTH ); + m_meterSongPosition.SetName( "SongPositionMeter" ); + SET_XY( m_meterSongPosition ); + this->AddChild( &m_meterSongPosition ); + + m_MaxCombo.LoadFromNumbers( THEME->GetPathToN("ScreenGameplay max combo") ); m_MaxCombo.SetName( "MaxCombo" ); SET_XY( m_MaxCombo ); @@ -653,12 +663,14 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S } + /* LoadNextSong first, since that positions some elements which need to be * positioned before we TweenOnScreen. */ LoadNextSong(); TweenOnScreen(); + this->SortByZ(); if( !bDemonstration ) // only load if we're going to use it { @@ -1277,6 +1289,9 @@ void ScreenGameplay::Update( float fDeltaTime ) } } + // + // update give up timer + // if( !m_GiveUpTimer.IsZero() && m_GiveUpTimer.Ago() > 4.0f ) { m_GiveUpTimer.SetZero(); @@ -1292,6 +1307,9 @@ void ScreenGameplay::Update( float fDeltaTime ) this->PostScreenMessage( SM_NotesEnded, 0 ); } + // + // update assist ticks + // bool bPlayTicks = IsTimeToPlayTicks(); if( bPlayTicks ) { @@ -1299,6 +1317,9 @@ void ScreenGameplay::Update( float fDeltaTime ) m_soundAssistTick.Play(); } + // + // update lights + // static float s_fSecsLeftOnUpperLights = 0; if( bPlayTicks ) { @@ -1316,6 +1337,13 @@ void ScreenGameplay::Update( float fDeltaTime ) LIGHTSMAN->SetAllUpperLights( true ); else LIGHTSMAN->SetAllUpperLights( false ); + + // + // update song position meter + // + float fPercentPositionSong = GAMESTATE->m_fMusicSeconds / GAMESTATE->m_pCurSong->m_fMusicLengthSeconds; + CLAMP( fPercentPositionSong, 0, 1 ); + m_meterSongPosition.SetPercent( fPercentPositionSong ); } /* Set g_CurStageStats.bFailed for failed players. In, FAIL_ARCADE, send @@ -2191,6 +2219,7 @@ void ScreenGameplay::TweenOnScreen() ON_COMMAND( m_textSongOptions ); ON_COMMAND( m_sprScoreFrame ); ON_COMMAND( m_textSongTitle ); + ON_COMMAND( m_meterSongPosition ); if( m_pCombinedLifeMeter ) ON_COMMAND( *m_pCombinedLifeMeter ); for( int p=0; p