diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index fe3f418482..a984776595 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1218,7 +1218,6 @@ Class=ScreenEvaluation FailedSoundTime=0 PassedSoundTime=0 NumSequenceSounds=0 -PeakComboAwardCommand= PlayerNameP1X= PlayerNameP1Y= @@ -1289,6 +1288,7 @@ ShowTimeArea=0 ShowGraphArea=0 ShowComboArea=0 ShowPerDifficultyAward=0 +ShowPeakComboAward=0 TimerSeconds=15 StyleIcon=1 MemoryCardIcons=1 @@ -1602,6 +1602,7 @@ ShowTimeArea=0 ShowGraphArea=0 ShowComboArea=0 ShowPerDifficultyAward=0 +ShowPeakComboAward=0 TimerSeconds=30 StyleIcon=1 MemoryCardIcons=1 @@ -1908,6 +1909,7 @@ ShowTimeArea=0 ShowGraphArea=0 ShowComboArea=0 ShowPerDifficultyAward=0 +ShowPeakComboAward=0 TimerSeconds=30 StyleIcon=1 ShowTotalScoreArea=0 @@ -2122,6 +2124,7 @@ ShowTimeArea=1 ShowGraphArea=0 ShowComboArea=0 ShowPerDifficultyAward=0 +ShowPeakComboAward=0 TimerSeconds=30 StyleIcon=1 ShowTotalScoreArea=0 @@ -2335,6 +2338,7 @@ ShowTimeArea=1 ShowGraphArea=0 ShowComboArea=0 ShowPerDifficultyAward=0 +ShowPeakComboAward=0 TimerSeconds=30 StyleIcon=1 ShowTotalScoreArea=0 @@ -2560,6 +2564,7 @@ ShowTimeArea=0 ShowGraphArea=0 ShowComboArea=0 ShowPerDifficultyAward=0 +ShowPeakComboAward=0 TimerSeconds=15 StyleIcon=1 ShowTotalScoreArea=0 diff --git a/stepmania/src/GameConstantsAndTypes.cpp b/stepmania/src/GameConstantsAndTypes.cpp index 2c311c3f66..148474f2ff 100644 --- a/stepmania/src/GameConstantsAndTypes.cpp +++ b/stepmania/src/GameConstantsAndTypes.cpp @@ -121,12 +121,12 @@ XToString( MemoryCardState ); static const CString PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = { "FullComboGreats", - "FullComboPerfects", - "FullComboMarvelouses", "SingleDigitGreats", - "SingleDigitPerfects", "OneGreat", + "FullComboPerfects", + "SingleDigitPerfects", "OnePerfect", + "FullComboMarvelouses", "Greats80Percent", "Greats90Percent", "Greats100Percent", diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index 6563a786ea..acd2095fc3 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -311,12 +311,12 @@ const CString& CoinModeToString( CoinMode cm ); enum PerDifficultyAward { AWARD_FULL_COMBO_GREATS, - AWARD_FULL_COMBO_PERFECTS, - AWARD_FULL_COMBO_MARVELOUSES, AWARD_SINGLE_DIGIT_GREATS, - AWARD_SINGLE_DIGIT_PERFECTS, AWARD_ONE_GREAT, + AWARD_FULL_COMBO_PERFECTS, + AWARD_SINGLE_DIGIT_PERFECTS, AWARD_ONE_PERFECT, + AWARD_FULL_COMBO_MARVELOUSES, AWARD_GREATS_80_PERCENT, AWARD_GREATS_90_PERCENT, AWARD_GREATS_100_PERCENT, diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 1d289317e3..fe0faab2b5 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -1783,6 +1783,7 @@ bool PlayerIsUsingModifier( PlayerNumber pn, const CString sModifier ) #include "LuaFunctions.h" LuaFunction_PlayerNumber( IsPlayerEnabled, GAMESTATE->IsPlayerEnabled(pn) ) LuaFunction_PlayerNumber( IsHumanPlayer, GAMESTATE->IsHumanPlayer(pn) ) +LuaFunction_PlayerNumber( IsPlayerUsingProfile, PROFILEMAN->IsUsingProfile(pn) ) LuaFunction_PlayerNumber( IsWinner, GAMESTATE->GetStageResult(pn)==RESULT_WIN ) LuaFunction_NoArgs( IsCourseMode, GAMESTATE->IsCourseMode() ) LuaFunction_NoArgs( IsDemonstration, GAMESTATE->m_bDemonstrationOrJukebox ) diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index b1df4f9ba8..ffa68e3d6f 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -169,12 +169,30 @@ CString Profile::GetDisplayName() const return "NoName"; } +static CString FormatCalories( float fCals ) +{ + return Commify((int)fCals) + " Cal"; +} + CString Profile::GetDisplayTotalCaloriesBurned() const { if( m_iWeightPounds == 0 ) // weight not entered return "N/A"; else - return Commify((int)m_fTotalCaloriesBurned) + " Cal"; + return FormatCalories( m_fTotalCaloriesBurned ); +} + +CString Profile::GetDisplayTotalCaloriesBurnedToday() const +{ + time_t now = time(NULL); + tm tNow; + localtime_r( &now, &tNow ); + Day today = { tNow.tm_yday, tNow.tm_year+1900 }; + float fCals = GetCaloriesBurnedForDay(today); + if( m_iWeightPounds == 0 ) // weight not entered + return "N/A"; + else + return FormatCalories( m_fTotalCaloriesBurned ); } int Profile::GetTotalNumSongsPlayed() const @@ -193,89 +211,91 @@ int Profile::GetTotalNumSongsPassed() const return iTotal; } -int Profile::GetPossibleSongDancePointsForStepsType( StepsType st ) const +int Profile::GetPossibleSongDancePoints( StepsType st, Difficulty dc ) const { int iTotal = 0; // add steps high scores + const vector vSongs = SONGMAN->GetAllSongs(); + for( unsigned i=0; i vSongs = SONGMAN->GetAllSongs(); - for( unsigned i=0; im_SelectionDisplay == Song::SHOW_NEVER ) + continue; // skip + + vector vSteps = pSong->GetAllSteps(); + for( unsigned j=0; jm_SelectionDisplay == Song::SHOW_NEVER ) + if( pSteps->m_StepsType != st ) continue; // skip - vector vSteps = pSong->GetAllSteps(); - for( unsigned j=0; jm_StepsType != st ) - continue; // skip + if( pSteps->GetDifficulty() != dc ) + continue; // skip - const RadarValues& fRadars = pSteps->GetRadarValues(); - iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); - } + const RadarValues& fRadars = pSteps->GetRadarValues(); + iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); } } return iTotal; } -int Profile::GetActualSongDancePointsForStepsType( StepsType st ) const +int Profile::GetActualSongDancePoints( StepsType st, Difficulty dc ) const { int iTotal = 0; // add steps high scores + for( std::map::const_iterator i = m_SongHighScores.begin(); + i != m_SongHighScores.end(); + ++i ) { - for( std::map::const_iterator i = m_SongHighScores.begin(); - i != m_SongHighScores.end(); - ++i ) + const SongID &id = i->first; + Song* pSong = id.ToSong(); + + // If the Song isn't loaded on the current machine, then we can't + // get radar values to compute dance points. + if( pSong == NULL ) + continue; + + if( pSong->m_SelectionDisplay == Song::SHOW_NEVER ) + continue; // skip + + const HighScoresForASong &hsfas = i->second; + + for( std::map::const_iterator j = hsfas.m_StepsHighScores.begin(); + j != hsfas.m_StepsHighScores.end(); + ++j ) { - const SongID &id = i->first; - Song* pSong = id.ToSong(); + const StepsID &id = j->first; + Steps* pSteps = id.ToSteps( pSong, true ); - // If the Song isn't loaded on the current machine, then we can't + // If the Steps isn't loaded on the current machine, then we can't // get radar values to compute dance points. - if( pSong == NULL ) + if( pSteps == NULL ) continue; - if( pSong->m_SelectionDisplay == Song::SHOW_NEVER ) + if( pSteps->m_StepsType != st ) + continue; + + if( pSteps->GetDifficulty() != dc ) continue; // skip - const HighScoresForASong &hsfas = i->second; + const HighScoresForASteps& h = j->second; + const HighScoreList& hs = h.hs; - for( std::map::const_iterator j = hsfas.m_StepsHighScores.begin(); - j != hsfas.m_StepsHighScores.end(); - ++j ) - { - const StepsID &id = j->first; - Steps* pSteps = id.ToSteps( pSong, true ); - - // If the Steps isn't loaded on the current machine, then we can't - // get radar values to compute dance points. - if( pSteps == NULL ) - continue; - - if( pSteps->m_StepsType != st ) - continue; - - const HighScoresForASteps& h = j->second; - const HighScoreList& hs = h.hs; - - const RadarValues& fRadars = pSteps->GetRadarValues(); - int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); - iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP ); - } + const RadarValues& fRadars = pSteps->GetRadarValues(); + int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); + iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP ); } } return iTotal; } -int Profile::GetPossibleCourseDancePointsForStepsType( StepsType st ) const +int Profile::GetPossibleCourseDancePoints( StepsType st, CourseDifficulty cd ) const { int iTotal = 0; @@ -290,84 +310,70 @@ int Profile::GetPossibleCourseDancePointsForStepsType( StepsType st ) const if( !pCourse->AllSongsAreFixed() ) continue; - FOREACH_ShownCourseDifficulty( cd ) - { - Trail* pTrail = pCourse->GetTrail(st,cd); - if( pTrail == NULL ) - continue; + Trail* pTrail = pCourse->GetTrail(st,cd); + if( pTrail == NULL ) + continue; - const RadarValues& fRadars = pTrail->GetRadarValues(); - iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); - } + const RadarValues& fRadars = pTrail->GetRadarValues(); + iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); } return iTotal; } -int Profile::GetActualCourseDancePointsForStepsType( StepsType st ) const +int Profile::GetActualCourseDancePoints( StepsType st, CourseDifficulty cd ) const { int iTotal = 0; // add course high scores + for( std::map::const_iterator i = m_CourseHighScores.begin(); + i != m_CourseHighScores.end(); + i++ ) { - for( std::map::const_iterator i = m_CourseHighScores.begin(); - i != m_CourseHighScores.end(); - i++ ) + CourseID id = i->first; + const Course* pCourse = id.ToCourse(); + + // If the Course isn't loaded on the current machine, then we can't + // get radar values to compute dance points. + if( pCourse == NULL ) + continue; + + // Don't count any course that has any entries that change over time. + if( !pCourse->AllSongsAreFixed() ) + continue; + + const HighScoresForACourse &hsfac = i->second; + + for( std::map::const_iterator j = hsfac.m_TrailHighScores.begin(); + j != hsfac.m_TrailHighScores.end(); + ++j ) { - CourseID id = i->first; - const Course* pCourse = id.ToCourse(); + const TrailID &id = j->first; + Trail* pTrail = id.ToTrail( pCourse, true ); - // If the Course isn't loaded on the current machine, then we can't + // If the Steps isn't loaded on the current machine, then we can't // get radar values to compute dance points. - if( pCourse == NULL ) - continue; - - // Don't count any course that has any entries that change over time. - if( !pCourse->AllSongsAreFixed() ) + if( pTrail == NULL ) continue; - const HighScoresForACourse &hsfac = i->second; + if( pTrail->m_StepsType != st ) + continue; - for( std::map::const_iterator j = hsfac.m_TrailHighScores.begin(); - j != hsfac.m_TrailHighScores.end(); - ++j ) - { - const TrailID &id = j->first; - Trail* pTrail = id.ToTrail( pCourse, true ); - - // If the Steps isn't loaded on the current machine, then we can't - // get radar values to compute dance points. - if( pTrail == NULL ) - continue; + if( pTrail->m_CourseDifficulty != cd ) + continue; - if( pTrail->m_StepsType != st ) - continue; + const HighScoresForATrail& h = j->second; + const HighScoreList& hs = h.hs; - const HighScoresForATrail& h = j->second; - const HighScoreList& hs = h.hs; - - const RadarValues& fRadars = pTrail->GetRadarValues(); - int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); - iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP ); - } + const RadarValues& fRadars = pTrail->GetRadarValues(); + int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); + iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP ); } } return iTotal; } -float Profile::GetPercentCompleteForStepsType( StepsType st ) const -{ - int iPossible = - GetPossibleSongDancePointsForStepsType( st ) + - GetPossibleCourseDancePointsForStepsType( st ); - int iActual = - GetActualSongDancePointsForStepsType( st ) + - GetActualCourseDancePointsForStepsType( st ); - - return float(iActual) / iPossible; -} - CString Profile::GetProfileDisplayNameFromDir( CString sDir ) { Profile profile; diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index a3ef25c909..3a31c64fde 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -59,13 +59,15 @@ public: // CString GetDisplayName() const; CString GetDisplayTotalCaloriesBurned() const; + CString GetDisplayTotalCaloriesBurnedToday() const; int GetTotalNumSongsPlayed() const; int GetTotalNumSongsPassed() const; - int GetActualSongDancePointsForStepsType( StepsType st ) const; - int GetActualCourseDancePointsForStepsType( StepsType st ) const; - int GetPossibleSongDancePointsForStepsType( StepsType st ) const; - int GetPossibleCourseDancePointsForStepsType( StepsType st ) const; - float GetPercentCompleteForStepsType( StepsType st ) const; + int GetActualSongDancePoints( StepsType st, Difficulty dc ) const; + int GetActualCourseDancePoints( StepsType st, CourseDifficulty cd ) const; + int GetPossibleSongDancePoints( StepsType st, Difficulty dc ) const; + int GetPossibleCourseDancePoints( StepsType st, CourseDifficulty cd ) const; + float GetSongsPercentComplete( StepsType st, Difficulty dc ) const { return (float)(GetActualSongDancePoints(st,dc))/GetPossibleSongDancePoints(st,dc); } + float GetCoursesPercentComplete( StepsType st, CourseDifficulty cd ) const { return (float)(GetActualCourseDancePoints(st,cd))/GetPossibleCourseDancePoints(st,cd); } static CString GetProfileDisplayNameFromDir( CString sDir ); int GetSongNumTimesPlayed( const Song* pSong ) const; int GetSongNumTimesPlayed( const SongID& songID ) const; diff --git a/stepmania/src/ProfileHtml.cpp b/stepmania/src/ProfileHtml.cpp index 2a48bb5a1a..baf4d1d6f6 100644 --- a/stepmania/src/ProfileHtml.cpp +++ b/stepmania/src/ProfileHtml.cpp @@ -771,20 +771,24 @@ bool PrintPercentCompleteForStepsType( RageFile &f, const Profile *pProfile, Ste PRINT_OPEN(f, GAMEMAN->NotesTypeToThemedString(st) ); { - BEGIN_TABLE(1); + FOREACH_Difficulty( dc ) { - const int iActualSong = pProfile->GetActualSongDancePointsForStepsType(st); - const int iActualCourse = pProfile->GetActualCourseDancePointsForStepsType(st); - const int iPossibleSong = pProfile->GetPossibleSongDancePointsForStepsType(st); - const int iPossibleCourse = pProfile->GetPossibleCourseDancePointsForStepsType(st); - const float fPercent = float(iActualSong+iActualCourse) / (iPossibleSong+iPossibleCourse); - TABLE_LINE2( "Percent Complete", ssprintf("%06.3f%%", fPercent*100) ); - TABLE_LINE2( "Actual Song Points", iActualSong ); - TABLE_LINE2( "Actual Course Points", iActualCourse ); - TABLE_LINE2( "Possible Song Points", iPossibleSong ); - TABLE_LINE2( "Possible Course Points", iPossibleCourse ); + if( dc == DIFFICULTY_EDIT ) + continue; // skip + if( !SHOW_DIFFICULTY(dc) ) + continue; + BEGIN_TABLE(1); + { + const int iActualSong = pProfile->GetActualSongDancePoints(st,dc); + const int iPossibleSong = pProfile->GetPossibleSongDancePoints(st,dc); + const float fPercent = float(iActualSong) / (iPossibleSong); + CString sDifficulty = DifficultyToThemedString(dc); + TABLE_LINE2( sDifficulty+" Percent Complete", ssprintf("%06.3f%%", fPercent*100) ); + TABLE_LINE2( sDifficulty+" Actual Song Points", iActualSong ); + TABLE_LINE2( sDifficulty+" Possible Song Points", iPossibleSong ); + } + END_TABLE; } - END_TABLE; PRINT_OPEN(f, "Songs" ); { @@ -851,6 +855,20 @@ bool PrintPercentCompleteForStepsType( RageFile &f, const Profile *pProfile, Ste } PRINT_CLOSE(f); + FOREACH_ShownCourseDifficulty( cd ) + { + BEGIN_TABLE(1); + { + const int iActualCourse = pProfile->GetActualCourseDancePoints(st,cd); + const int iPossibleCourse = pProfile->GetPossibleCourseDancePoints(st,cd); + const float fPercent = float(iActualCourse) / (iPossibleCourse); + TABLE_LINE2( CourseDifficultyToThemedString(cd)+" Percent Complete", ssprintf("%06.3f%%", fPercent*100) ); + TABLE_LINE2( CourseDifficultyToThemedString(cd)+" Actual Course Points", iActualCourse ); + TABLE_LINE2( CourseDifficultyToThemedString(cd)+" Possible Course Points", iPossibleCourse ); + } + END_TABLE; + } + PRINT_OPEN(f, "Courses" ); { TranslatedWrite(f, "\n" ); diff --git a/stepmania/src/ScreenEnding.cpp b/stepmania/src/ScreenEnding.cpp index 06a2427629..9b8f8cf005 100644 --- a/stepmania/src/ScreenEnding.cpp +++ b/stepmania/src/ScreenEnding.cpp @@ -14,6 +14,8 @@ #include "GameManager.h" #include "SongUtil.h" #include "ScreenManager.h" +#include "PrefsManager.h" +#include "StageStats.h" #define SCROLL_DELAY THEME->GetMetricF("ScreenEnding","ScrollDelay") @@ -22,30 +24,75 @@ -CString GetStatsLineTitle( PlayerNumber pn, int iLine ) +CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line ) { - static const CString s[NUM_ENDING_STATS_LINES] = { - "%s %% Complete", - "Total Calories", - "Total Played", - "Current Combo", - }; - StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType; - return ssprintf( s[iLine], GAMEMAN->NotesTypeToThemedString(st).c_str() ); + switch( line ) + { + case CALORIES_TODAY: return "Calories Today"; + case CURRENT_COMBO: return "Current Combo"; + case PERCENT_COMPLETE_EASY: + case PERCENT_COMPLETE_MEDIUM: + case PERCENT_COMPLETE_HARD: + case PERCENT_COMPLETE_CHALLENGE: + // Ugly... + { + StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType; + CString sStepsType = GAMEMAN->NotesTypeToThemedString(st); + if( GAMESTATE->IsCourseMode() ) + { + CourseDifficulty cd = (CourseDifficulty)line; + if( !GAMESTATE->IsCourseDifficultyShown(cd) ) + return ""; + CString sDifficulty = CourseDifficultyToThemedString(cd); + return ssprintf( "%s %% Complete", sStepsType.c_str() ); + } + else + { + Difficulty dc = (Difficulty)line; + CString sDifficulty = DifficultyToThemedString(dc); + return ssprintf( "%s %% Complete", sStepsType.c_str() ); + } + } + default: ASSERT(0); return ""; + } } -CString GetStatsLineValue( PlayerNumber pn, int iLine ) +CString GetStatsLineValue( PlayerNumber pn, EndingStatsLine line ) { Profile* pProfile = PROFILEMAN->GetProfile( pn ); ASSERT( pProfile ); - StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType; - switch( iLine ) + switch( line ) { - case PERCENT_COMPLETE: return ssprintf( "%06.3f%%", pProfile->GetPercentCompleteForStepsType(st)*100 ); - case TOTAL_CALORIES: return pProfile->GetDisplayTotalCaloriesBurned(); - case TOTAL_SONGS_PLAYED: return Commify( pProfile->GetTotalNumSongsPlayed() ); + case CALORIES_TODAY: return pProfile->GetDisplayTotalCaloriesBurned(); case CURRENT_COMBO: return Commify( pProfile->m_iCurrentCombo ); + case PERCENT_COMPLETE_EASY: + case PERCENT_COMPLETE_MEDIUM: + case PERCENT_COMPLETE_HARD: + case PERCENT_COMPLETE_CHALLENGE: + { + StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType; + Difficulty dc = (Difficulty)(line-1); + } + // Ugly... + { + StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType; + CString sStepsType = GAMEMAN->NotesTypeToThemedString(st); + if( GAMESTATE->IsCourseMode() ) + { + CourseDifficulty cd = (CourseDifficulty)line; + if( !GAMESTATE->IsCourseDifficultyShown(cd) ) + return ""; + CString sDifficulty = CourseDifficultyToThemedString(cd); + return ssprintf( "%06.3f%%", pProfile->GetCoursesPercentComplete(st,cd)*100 ); + } + else + { + Difficulty dc = (Difficulty)line; + CString sDifficulty = DifficultyToThemedString(dc); + return ssprintf( "%06.3f%%", pProfile->GetSongsPercentComplete(st,dc)*100 ); + } + } default: ASSERT(0); return ""; } } @@ -53,6 +100,59 @@ CString GetStatsLineValue( PlayerNumber pn, int iLine ) ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, false/*dont reset GAMESTATE*/ ) { + if( PREFSMAN->m_bScreenTestMode ) + { + PROFILEMAN->LoadFirstAvailableProfile(PLAYER_1, false); + PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2, false); + + GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; + GAMESTATE->m_CurStyle = STYLE_DANCE_VERSUS; + GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; + GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; + GAMESTATE->m_MasterPlayerNumber = PLAYER_1; + GAMESTATE->m_pCurSong = SONGMAN->GetRandomSong(); + GAMESTATE->m_pCurCourse = SONGMAN->GetRandomCourse(); + GAMESTATE->m_pCurSteps[PLAYER_1] = GAMESTATE->m_pCurSong->GetAllSteps()[0]; + GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0]; + g_CurStageStats.pSteps[PLAYER_1] = GAMESTATE->m_pCurSteps[PLAYER_1]; + g_CurStageStats.pSteps[PLAYER_2] = GAMESTATE->m_pCurSteps[PLAYER_2]; + GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed = 2; + GAMESTATE->m_PlayerOptions[PLAYER_2].m_fScrollSpeed = 2; + GAMESTATE->m_iCurrentStageIndex = 0; + GAMESTATE->m_PlayerOptions[PLAYER_1].ChooseRandomMofifiers(); + GAMESTATE->m_PlayerOptions[PLAYER_2].ChooseRandomMofifiers(); + + for( float f = 0; f < 100.0f; f += 1.0f ) + { + float fP1 = fmodf(f/100*4+.3f,1); + g_CurStageStats.SetLifeRecord( PLAYER_1, fP1, f ); + g_CurStageStats.SetLifeRecord( PLAYER_2, 1-fP1, f ); + } + + g_CurStageStats.iActualDancePoints[PLAYER_1] = rand()%3; + g_CurStageStats.iPossibleDancePoints[PLAYER_1] = 2; + g_CurStageStats.iActualDancePoints[PLAYER_2] = rand()%2; + g_CurStageStats.iPossibleDancePoints[PLAYER_2] = 1; + g_CurStageStats.iCurCombo[PLAYER_1] = 0; + g_CurStageStats.UpdateComboList( PLAYER_1, 0, false ); + g_CurStageStats.iCurCombo[PLAYER_1] = 1; + g_CurStageStats.UpdateComboList( PLAYER_1, 1, false ); + g_CurStageStats.iCurCombo[PLAYER_1] = 50; + g_CurStageStats.UpdateComboList( PLAYER_1, 25, false ); + g_CurStageStats.iCurCombo[PLAYER_1] = 250; + g_CurStageStats.UpdateComboList( PLAYER_1, 100, false ); + + g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_MARVELOUS] = rand()%2; + g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_PERFECT] = rand()%2; + g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_GREAT] = rand()%2; + g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_MARVELOUS] = rand()%2; + g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_PERFECT] = rand()%2; + g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_GREAT] = rand()%2; + + g_vPlayedStageStats.clear(); + } + + vector arraySongs; SONGMAN->GetSongs( arraySongs ); SongUtil::SortSongPointerArrayByTitle( arraySongs ); @@ -72,24 +172,24 @@ ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, fa SET_XY_AND_ON_COMMAND( m_textPlayerName[p] ); this->AddChild( &m_textPlayerName[p] ); - m_bWaitingForRemoveCard[p] = MEMCARDMAN->GetCardState((PlayerNumber)p)!=MEMORY_CARD_STATE_NO_CARD; + m_bWaitingForRemoveCard[p] = MEMCARDMAN->GetCardState(p)!=MEMORY_CARD_STATE_NO_CARD; if( pProfile == NULL ) continue; // don't show the stats lines - for( int i=0; iGetPathToF("ScreenEnding stats title") ); - m_textStatsTitle[p][i].SetText( GetStatsLineTitle((PlayerNumber)p, i) ); - m_textStatsTitle[p][i].SetName( ssprintf("StatsTitleP%dLine%d",p+1,i+1) ); - SET_XY_AND_ON_COMMAND( m_textStatsTitle[p][i] ); - this->AddChild( &m_textStatsTitle[p][i] ); + m_Lines[i][p].title.LoadFromFont( THEME->GetPathToF("ScreenEnding stats title") ); + m_Lines[i][p].title.SetText( GetStatsLineTitle(p, i) ); + m_Lines[i][p].title.SetName( ssprintf("StatsTitleP%dLine%d",p+1,i+1) ); + SET_XY_AND_ON_COMMAND( m_Lines[i][p].title ); + this->AddChild( &m_Lines[i][p].title ); - m_textStatsValue[p][i].LoadFromFont( THEME->GetPathToF("ScreenEnding stats value") ); - m_textStatsValue[p][i].SetText( GetStatsLineValue((PlayerNumber)p, i) ); - m_textStatsValue[p][i].SetName( ssprintf("StatsValueP%dLine%d",p+1,i+1) ); - SET_XY_AND_ON_COMMAND( m_textStatsValue[p][i] ); - this->AddChild( &m_textStatsValue[p][i] ); + m_Lines[i][p].value.LoadFromFont( THEME->GetPathToF("ScreenEnding stats value") ); + m_Lines[i][p].value.SetText( GetStatsLineValue(p, i) ); + m_Lines[i][p].value.SetName( ssprintf("StatsValueP%dLine%d",p+1,i+1) ); + SET_XY_AND_ON_COMMAND( m_Lines[i][p].value ); + this->AddChild( &m_Lines[i][p].value ); } m_sprRemoveMemoryCard[p].SetName( ssprintf("RemoveCardP%d",p+1) ); @@ -132,7 +232,7 @@ void ScreenEnding::Update( float fDeltaTime ) { if( m_bWaitingForRemoveCard[p] ) { - m_bWaitingForRemoveCard[p] = MEMCARDMAN->GetCardState((PlayerNumber)p)!=MEMORY_CARD_STATE_NO_CARD; + m_bWaitingForRemoveCard[p] = MEMCARDMAN->GetCardState(p)!=MEMORY_CARD_STATE_NO_CARD; if( !m_bWaitingForRemoveCard[p] ) m_sprRemoveMemoryCard[p].SetHidden( true ); } diff --git a/stepmania/src/ScreenEnding.h b/stepmania/src/ScreenEnding.h index 2e93db413d..ca013b114c 100644 --- a/stepmania/src/ScreenEnding.h +++ b/stepmania/src/ScreenEnding.h @@ -8,12 +8,15 @@ enum EndingStatsLine { - PERCENT_COMPLETE, - TOTAL_CALORIES, - TOTAL_SONGS_PLAYED, + CALORIES_TODAY, CURRENT_COMBO, + PERCENT_COMPLETE_EASY, + PERCENT_COMPLETE_MEDIUM, + PERCENT_COMPLETE_HARD, + PERCENT_COMPLETE_CHALLENGE, NUM_ENDING_STATS_LINES }; +#define FOREACH_EndingStatsLine( l ) FOREACH_ENUM( EndingStatsLine, NUM_ENDING_STATS_LINES, l ) class ScreenEnding : public ScreenAttract { @@ -27,8 +30,11 @@ public: private: BitmapText m_textPlayerName[NUM_PLAYERS]; - BitmapText m_textStatsTitle[NUM_PLAYERS][NUM_ENDING_STATS_LINES]; - BitmapText m_textStatsValue[NUM_PLAYERS][NUM_ENDING_STATS_LINES]; + struct Line + { + BitmapText title; + BitmapText value; + } m_Lines[NUM_ENDING_STATS_LINES][NUM_PLAYERS]; Sprite m_sprRemoveMemoryCard[NUM_PLAYERS]; bool m_bWaitingForRemoveCard[NUM_PLAYERS]; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index f0c89fecd0..fb92b6fd8a 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -65,6 +65,7 @@ const char* STATS_STRING[NUM_STATS_LINES] = #define SHOW_GRAPH_AREA THEME->GetMetricB(m_sName,"ShowGraphArea") #define SHOW_COMBO_AREA THEME->GetMetricB(m_sName,"ShowComboArea") #define SHOW_PER_DIFFICULTY_AWARD THEME->GetMetricB(m_sName,"ShowPerDifficultyAward") +#define SHOW_PEAK_COMBO_AWARD THEME->GetMetricB(m_sName,"ShowPeakComboAward") #define GRAPH_START_HEIGHT THEME->GetMetricF(m_sName,"GraphStartHeight") #define TYPE THEME->GetMetric (m_sName,"Type") #define PASSED_SOUND_TIME THEME->GetMetricF(m_sName,"PassedSoundTime") @@ -72,7 +73,6 @@ const char* STATS_STRING[NUM_STATS_LINES] = #define NUM_SEQUENCE_SOUNDS THEME->GetMetricI(m_sName,"NumSequenceSounds") #define SOUNDSEQ_TIME( i ) THEME->GetMetricF(m_sName,ssprintf("SoundSeqTime%d", i+1)) #define SOUNDSEQ_NAME( i ) THEME->GetMetric (m_sName,ssprintf("SoundSeqName%d", i+1)) -#define PEAK_COMBO_AWARD_COMMAND THEME->GetMetric (m_sName,"PeakComboAwardCommand") #define MAX_COMBO_NUM_DIGITS THEME->GetMetricI(m_sName,"MaxComboNumDigits") #define PLAYER_OPTIONS_SEPARATOR THEME->GetMetric (m_sName,"PlayerOptionsSeparator") @@ -136,13 +136,31 @@ void ScreenEvaluation::Init() g_CurStageStats.UpdateComboList( PLAYER_1, 25, false ); g_CurStageStats.iCurCombo[PLAYER_1] = 250; g_CurStageStats.UpdateComboList( PLAYER_1, 100, false ); + if( rand()%2 ) + { + g_CurStageStats.iCurCombo[PLAYER_1] = rand()%11000; + g_CurStageStats.UpdateComboList( PLAYER_1, 110, false ); + } + g_CurStageStats.iCurCombo[PLAYER_2] = 0; + g_CurStageStats.UpdateComboList( PLAYER_2, 0, false ); + g_CurStageStats.iCurCombo[PLAYER_2] = 1; + g_CurStageStats.UpdateComboList( PLAYER_2, 1, false ); + g_CurStageStats.iCurCombo[PLAYER_2] = 50; + g_CurStageStats.UpdateComboList( PLAYER_2, 25, false ); + g_CurStageStats.iCurCombo[PLAYER_2] = 250; + g_CurStageStats.UpdateComboList( PLAYER_2, 100, false ); + if( rand()%2 ) + { + g_CurStageStats.iCurCombo[PLAYER_2] = rand()%11000; + g_CurStageStats.UpdateComboList( PLAYER_2, 110, false ); + } - g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_MARVELOUS] = rand()%2; - g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_PERFECT] = rand()%2; - g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_GREAT] = rand()%2; - g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_MARVELOUS] = rand()%2; - g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_PERFECT] = rand()%2; - g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_GREAT] = rand()%2; + g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_MARVELOUS] = rand()%3; + g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_PERFECT] = rand()%3; + g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_GREAT] = rand()%3; + g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_MARVELOUS] = rand()%3; + g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_PERFECT] = rand()%3; + g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_GREAT] = rand()%3; g_vPlayedStageStats.clear(); } @@ -625,7 +643,7 @@ void ScreenEvaluation::Init() case boo: iValue = stageStats.iTapNoteScores[p][TNS_BOO]; break; case miss: iValue = stageStats.iTapNoteScores[p][TNS_MISS]; break; case ok: iValue = stageStats.iHoldNoteScores[p][HNS_OK]; break; - case max_combo: iValue = stageStats.iMaxCombo[p]; break; + case max_combo: iValue = stageStats.GetMaxCombo(p).cnt; break; case error: iValue = stageStats.iTotalError[p]; break; default: iValue = 0; ASSERT(0); } @@ -637,12 +655,6 @@ void ScreenEvaluation::Init() } } - FOREACH_EnabledPlayer( pn ) - { - if( pcaToShow[pn] != PEAK_COMBO_AWARD_INVALID ) - m_textJudgeNumbers[max_combo][pn].Command( PEAK_COMBO_AWARD_COMMAND ); - } - for( l=0; lAddChild( m_sprPersonalRecord[p] ); } - if( SHOW_PER_DIFFICULTY_AWARD && pdaToShow[p]!=PER_DIFFICULTY_AWARD_INVALID ) { CString sAward = PerDifficultyAwardToString( pdaToShow[p] ); - m_PerDifficultyAward[p].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation award %s",sAward.c_str())) ); + m_PerDifficultyAward[p].Load( THEME->GetPathG(m_sName,"PerDifficultyAward "+sAward) ); m_PerDifficultyAward[p]->SetName( ssprintf("PerDifficultyAwardP%d",p+1) ); SET_XY_AND_ON_COMMAND( m_PerDifficultyAward[p] ); this->AddChild( m_PerDifficultyAward[p] ); } + if( SHOW_PEAK_COMBO_AWARD && pcaToShow[p]!=PEAK_COMBO_AWARD_INVALID ) + { + CString sAward = PeakComboAwardToString( pcaToShow[p] ); + + m_PeakComboAward[p].Load( THEME->GetPathG(m_sName,"PeakComboAward "+sAward) ); + m_PeakComboAward[p]->SetName( ssprintf("PeakComboAwardP%d",p+1) ); + SET_XY_AND_ON_COMMAND( m_PeakComboAward[p] ); + this->AddChild( m_PeakComboAward[p] ); + } } bool bOneHasNewTopRecord = false; @@ -1306,6 +1326,8 @@ void ScreenEvaluation::TweenOffScreen() OFF_COMMAND( m_sprPersonalRecord[p] ); if( m_PerDifficultyAward[p].IsLoaded() ) OFF_COMMAND( m_PerDifficultyAward[p] ); + if( m_PeakComboAward[p].IsLoaded() ) + OFF_COMMAND( m_PeakComboAward[p] ); } } OFF_COMMAND( m_sprTryExtraStage ); diff --git a/stepmania/src/ScreenEvaluation.h b/stepmania/src/ScreenEvaluation.h index 838948ccbc..ec193435a1 100644 --- a/stepmania/src/ScreenEvaluation.h +++ b/stepmania/src/ScreenEvaluation.h @@ -137,6 +137,7 @@ protected: bool m_bTryExtraStage; AutoActor m_sprTryExtraStage; AutoActor m_PerDifficultyAward[NUM_PLAYERS]; + AutoActor m_PeakComboAward[NUM_PLAYERS]; bool m_bFailed; RageSound m_soundStart; // sound played if the player passes or fails