make the stage count work if the eval screen isn't shown at all

This commit is contained in:
Glenn Maynard
2004-01-22 03:11:40 +00:00
parent e76d268c8e
commit 6021c6e7da
6 changed files with 41 additions and 13 deletions
+27 -7
View File
@@ -420,10 +420,15 @@ float GameState::GetSongPercent( float beat ) const
return (beat - m_pCurSong->m_fFirstBeat) / m_pCurSong->m_fLastBeat;
}
void GameState::IncrementStageIndex()
/* Called by ScreenGameplay. Set the length of the current song. */
void GameState::BeginStage()
{
// Increment the stage counter.
int iNumStagesOfLastSong = SongManager::GetNumStagesForSong( GAMESTATE->m_pCurSong );
if( m_pCurSong )
m_iNumStagesOfThisSong = SongManager::GetNumStagesForSong( GAMESTATE->m_pCurSong );
else if( m_pCurCourse )
m_iNumStagesOfThisSong = 1;
else
FAIL_M("fail"); /* what are we playing? */
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
{
@@ -433,10 +438,23 @@ void GameState::IncrementStageIndex()
*
* We can't simply not choose long songs as extra stages: if there are no
* regular songs to choose, we'll end up with no song to use as an extra stage. */
iNumStagesOfLastSong = 1;
m_iNumStagesOfThisSong = 1;
}
}
m_iCurrentStageIndex += iNumStagesOfLastSong;
/* Called by ScreenSelectMusic (etc). Increment the stage counter if we just played a
* song. Might be called more than once. */
void GameState::FinishStage()
{
/* If m_iNumStagesOfThisSong is 0, we've been called more than once before calling
* BeginStage. This can happen when backing out of the player options screen. */
if( !m_iNumStagesOfThisSong )
return;
// Increment the stage counter.
m_iCurrentStageIndex += m_iNumStagesOfThisSong;
m_iNumStagesOfThisSong = 0;
}
int GameState::GetStageIndex() const
@@ -457,11 +475,13 @@ bool GameState::IsFinalStage() const
{
if( PREFSMAN->m_bEventMode )
return false;
/* This changes dynamically on ScreenSelectMusic as the wheel turns. */
int iPredictedStageForCurSong = 1;
if( m_pCurSong != NULL )
iPredictedStageForCurSong = SongManager::GetNumStagesForSong( m_pCurSong );
return m_iCurrentStageIndex + iPredictedStageForCurSong == PREFSMAN->m_iNumArcadeStages;
return m_iCurrentStageIndex + m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages;
}
bool GameState::IsExtraStage() const
@@ -708,7 +728,7 @@ StageResult GameState::GetStageResult( PlayerNumber pn )
return win;
}
void GameState::GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut )
void GameState::GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut ) const
{
statsOut = StageStats();
+5 -3
View File
@@ -106,10 +106,12 @@ public:
bool m_bEditing; // NoteField does special stuff when this is true
bool m_bDemonstrationOrJukebox; // ScreenGameplay does special stuff when this is true
bool m_bJukeboxUsesModifiers;
int m_iCurrentStageIndex; // incremented on Eval screen. For a Course, this is always 0
int m_iNumStagesOfThisSong;
int m_iCurrentStageIndex;
int GetStageIndex() const;
void IncrementStageIndex();
void BeginStage();
void FinishStage();
int GetNumStagesLeft() const;
bool IsFinalStage() const;
bool IsExtraStage() const;
@@ -191,7 +193,7 @@ public:
StageResult GetStageResult( PlayerNumber pn );
void ResetStageStatistics(); // Call this when it's time to play a new stage.
void GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut ); // shown on arcade final evaluation
void GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut ) const; // shown on arcade final evaluation
//
-3
View File
@@ -1355,8 +1355,5 @@ void ScreenEvaluation::EndScreen()
break;
}
}
if( m_Type == stage )
GAMESTATE->IncrementStageIndex();
}
+3
View File
@@ -75,6 +75,9 @@ const ScreenMessage SM_NoSongs = ScreenMessage(SM_User+3);
ScreenEz2SelectMusic::ScreenEz2SelectMusic( CString sName ) : Screen( sName )
{
/* Finish any previous stage. It's OK to call this when we havn't played a stage yet. */
GAMESTATE->FinishStage();
i_SkipAheadOffset = 0;
LastInputTime = 0;
ScrollStartTime = 0;
+3
View File
@@ -60,6 +60,9 @@ ScreenSelectCourse::ScreenSelectCourse( CString sClassName ) : Screen( sClassNam
{
LOG->Trace( "ScreenSelectCourse::ScreenSelectCourse()" );
/* Finish any previous stage. It's OK to call this when we havn't played a stage yet. */
GAMESTATE->FinishStage();
CodeDetector::RefreshCacheItems();
SOUND->PlayMusic( THEME->GetPathToS("ScreenSelectCourse music") );
+3
View File
@@ -86,6 +86,9 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : Screen( sClassName
m_bInCourseDisplayMode = GAMESTATE->IsCourseMode();
/* Finish any previous stage. It's OK to call this when we havn't played a stage yet. */
GAMESTATE->FinishStage();
/* Cache: */
g_sFallbackCDTitlePath = THEME->GetPathToG("ScreenSelectMusic fallback cdtitle");