From d12e09080827c49205d7d7667d06d3398afcd0b9 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 3 Feb 2003 05:53:59 +0000 Subject: [PATCH] grading error fixes, ranking calculation and display fixes, set default difficulty back to same level as 3.0 final --- stepmania/Themes/default/metrics.ini | 5 +-- stepmania/src/ArrowEffects.cpp | 5 ++- stepmania/src/GameState.cpp | 50 ++++---------------------- stepmania/src/GameState.h | 2 +- stepmania/src/GrayArrow.cpp | 2 +- stepmania/src/GroupList.cpp | 10 ++++-- stepmania/src/MusicBannerWheel.cpp | 13 ++++--- stepmania/src/MusicWheel.cpp | 10 ++++-- stepmania/src/OptionIcon.cpp | 2 +- stepmania/src/PrefsManager.cpp | 10 +++--- stepmania/src/ScreenDemonstration.cpp | 1 + stepmania/src/ScreenEvaluation.cpp | 25 ++++++++++--- stepmania/src/ScreenEz2SelectMusic.cpp | 2 +- stepmania/src/ScreenLogo.cpp | 2 +- stepmania/src/ScreenMusicScroll.cpp | 12 +++---- stepmania/src/ScreenRanking.cpp | 39 ++++++++++---------- stepmania/src/ScreenSelectGroup.cpp | 3 +- stepmania/src/ScreenTitleMenu.cpp | 8 +++-- stepmania/src/SongManager.cpp | 30 +++++++++++++--- stepmania/src/SongManager.h | 6 ++-- stepmania/src/StageStats.cpp | 47 ++++++++++++++++++++++-- stepmania/src/StageStats.h | 4 +++ stepmania/src/StepMania.cpp | 7 +++- 23 files changed, 182 insertions(+), 113 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 82a3df0434..405c1e3639 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -358,7 +358,7 @@ StatusIconsX=320 StatusIconsY=400 SecondsBetweenComments=10 DemonstrationSeconds=30 -TickEarlySeconds=0.058 +TickEarlySeconds=0.05 [ScreenEvaluation] SongSelectScreen=ScreenSelectMusic @@ -450,6 +450,7 @@ GradesGlowColor2=1,1,1,0.3 ScrollDelay=0.2 ScrollSpeed=1.0 TextZoom=0.8 +NextScreen=ScreenRanking [ScreenEditMenu] ExplanationX=320 @@ -813,7 +814,7 @@ VersionX=590 VersionY=20 SongsX=20 SongsY=20 -SecondsToShow=5 +SecondsToShow=10 NextScreen=ScreenDemonstration [ScreenDemonstration] diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index 6e9b21ad21..6200007eb6 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -41,8 +41,6 @@ float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat ) */ /* Boost and wave can no longer be used at the same time. -Chris */ - if( fYOffset < 0 ) - return fYOffset; // don't mess with it after crossing the receptors switch( GAMESTATE->m_PlayerOptions[pn].m_AccelType ) { @@ -50,7 +48,8 @@ float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat ) fYOffset *= 1.5f / ((fYOffset+SCREEN_HEIGHT/1.2f)/SCREEN_HEIGHT); break; case PlayerOptions::ACCEL_LAND: - fYOffset *= SCALE( fYOffset, 0.f, SCREEN_HEIGHT, 0.25f, 1.5f ); + if( fYOffset > 0 ) // speed the arrows back to normal after they cross 0 + fYOffset *= SCALE( fYOffset, 0.f, SCREEN_HEIGHT, 0.25f, 1.5f ); break; case PlayerOptions::ACCEL_WAVE: fYOffset += 20.0f*sinf( fYOffset/38.0f ); diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 2fd7659640..5aa523e205 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -43,6 +43,8 @@ GameState::GameState() m_CurGame = GAME_DANCE; m_iCoins = 0; Reset(); + + ResetLastRanking(); } GameState::~GameState() @@ -83,8 +85,11 @@ void GameState::Reset() for( p=0; pIsPlayerEnabled(pn) ); // should be calling this is player isn't joined! - - if( m_CurStageStats.bFailed[pn] ) - return GRADE_E; - - /* Based on the percentage of your total "Dance Points" to the maximum - * possible number, the following rank is assigned: - * - * 100% - AAA - * 93% - AA - * 80% - A - * 65% - B - * 45% - C - * Less - D - * Fail - E - */ - float fPercentDancePoints = m_CurStageStats.iActualDancePoints[pn] / (float)m_CurStageStats.iPossibleDancePoints[pn]; - fPercentDancePoints = max( 0, fPercentDancePoints ); - LOG->Trace( "iActualDancePoints: %i", m_CurStageStats.iActualDancePoints[pn] ); - LOG->Trace( "iPossibleDancePoints: %i", m_CurStageStats.iPossibleDancePoints[pn] ); - LOG->Trace( "fPercentDancePoints: %f", fPercentDancePoints ); - - // check for "AAAA" - if( m_CurStageStats.iTapNoteScores[pn][TNS_MARVELOUS] > 0 && - m_CurStageStats.iTapNoteScores[pn][TNS_PERFECT] == 0 && - m_CurStageStats.iTapNoteScores[pn][TNS_GREAT] == 0 && - m_CurStageStats.iTapNoteScores[pn][TNS_GOOD] == 0 && - m_CurStageStats.iTapNoteScores[pn][TNS_BOO] == 0 && - m_CurStageStats.iTapNoteScores[pn][TNS_MISS] == 0 ) - return GRADE_AAAA; - - if ( fPercentDancePoints == 1.00 ) return GRADE_AAA; - else if( fPercentDancePoints >= 0.93 ) return GRADE_AA; - else if( fPercentDancePoints >= 0.80 ) return GRADE_A; - else if( fPercentDancePoints >= 0.65 ) return GRADE_B; - else if( fPercentDancePoints >= 0.45 ) return GRADE_C; - else return GRADE_D; -} - bool GameState::HasEarnedExtraStage() { if( (GAMESTATE->IsFinalStage() || GAMESTATE->IsExtraStage()) ) @@ -247,7 +211,7 @@ bool GameState::HasEarnedExtraStage() if( !GAMESTATE->IsPlayerEnabled(p) ) continue; // skip - if( GAMESTATE->m_pCurNotes[p]->GetDifficulty()==DIFFICULTY_HARD && GetCurrentGrade((PlayerNumber)p)==GRADE_AA ) + if( GAMESTATE->m_pCurNotes[p]->GetDifficulty()==DIFFICULTY_HARD && m_CurStageStats.GetGrade((PlayerNumber)p)==GRADE_AA ) return true; } } diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 5453ef60f5..9f98094322 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -33,6 +33,7 @@ public: GameState(); ~GameState(); void Reset(); + void ResetLastRanking(); // // Main State Info @@ -106,7 +107,6 @@ public: // A song is only inserted here if at least one player passed. // StageStats are added by the Evaluation screen void GetFinalEvalStatsAndSongs( StageStats& statsOut, vector& vSongsOut ); // shown on arcade final evaluation - Grade GetCurrentGrade( PlayerNumber pn ); // grade so far PlayerOptions m_PlayerOptions[NUM_PLAYERS]; // The currently active options diff --git a/stepmania/src/GrayArrow.cpp b/stepmania/src/GrayArrow.cpp index 4c5ad8ed74..1f881a3eb2 100644 --- a/stepmania/src/GrayArrow.cpp +++ b/stepmania/src/GrayArrow.cpp @@ -44,7 +44,7 @@ void GrayArrow::Update( float fDeltaTime ) int OnState = (GetNumStates() == 3)? 1: 0; int OffState = (GetNumStates() == 3)? 2: 1; - if( GAMESTATE->m_fSongBeat<0 ) + if( !GAMESTATE->m_bPastHereWeGo ) { SetState( IdleState ); return; diff --git a/stepmania/src/GroupList.cpp b/stepmania/src/GroupList.cpp index e16a3bdfba..5d57bc3984 100644 --- a/stepmania/src/GroupList.cpp +++ b/stepmania/src/GroupList.cpp @@ -32,7 +32,6 @@ void GroupList::DoneAddingGroups() { m_screenLabels[i].LoadFromFont( THEME->GetPathTo("Fonts","select group button label") ); m_screenLabels[i].SetXY( BUTTON_X, BUTTON_START_Y + i*BUTTON_SPACING_Y ); - m_screenLabels[i].SetZoom( 0.8f ); m_screenLabels[i].SetShadowLength( 2 ); CString sGroupName = m_textLabels[i]; @@ -48,7 +47,14 @@ void GroupList::SetLabels() { CString &label = m_textLabels[m_iTop+i]; m_screenLabels[i].SetText( SONGMAN->ShortenGroupName( label ) ); - + float fTextWidth = (float)m_screenLabels[i].GetWidestLineWidthInSourcePixels(); + float fButtonWidth = m_sprButton[i].GetZoomedWidth(); + + float fZoom = fButtonWidth/fTextWidth; + fZoom = min( fZoom, 0.8f ); + m_screenLabels[i].SetZoomX( fZoom ); + m_screenLabels[i].SetZoomY( 0.8f ); + if( m_iTop+i == 0 ) m_screenLabels[i].TurnRainbowOn(); else { m_screenLabels[i].TurnRainbowOff(); diff --git a/stepmania/src/MusicBannerWheel.cpp b/stepmania/src/MusicBannerWheel.cpp index 44d4945404..e3cfc95d51 100644 --- a/stepmania/src/MusicBannerWheel.cpp +++ b/stepmania/src/MusicBannerWheel.cpp @@ -52,22 +52,21 @@ MusicBannerWheel::MusicBannerWheel() if( 0 == stricmp(GAMESTATE->m_sPreferredGroup, "All Music") ) { - arraySongs = SONGMAN->m_pSongs; + SONGMAN->GetAllSongs( arraySongs ); } else // Get the Group They Want { - for( unsigned i=0; i< SONGMAN->m_pSongs.size(); i++ ) + vector apAllSongs; + SONGMAN->GetAllSongs( apAllSongs ); + + for( unsigned i=0; im_pSongs[i]; + Song* pSong = apAllSongs[i]; if( GAMESTATE->m_sPreferredGroup != "ALL MUSIC" && pSong->m_sGroupName != GAMESTATE->m_sPreferredGroup ) - { continue; - } else - { arraySongs.push_back(pSong); - } } } diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 3a3112cbb7..3fea5fc2d8 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -330,7 +330,8 @@ MusicWheel::MusicWheel() // init m_mapGroupNameToBannerColor - vector arraySongs = SONGMAN->m_pSongs; + vector arraySongs; + SONGMAN->GetAllSongs( arraySongs ); SortSongPointerArrayByGroup( arraySongs ); m_iSelection = 0; @@ -477,10 +478,13 @@ bool MusicWheel::SelectCourse( const Course *p ) void MusicWheel::GetSongList(vector &arraySongs, bool bRoulette ) { + vector apAllSongs; + SONGMAN->GetAllSongs( apAllSongs ); + // copy only songs that have at least one Notes for the current GameMode - for( unsigned i=0; im_pSongs.size(); i++ ) + for( unsigned i=0; im_pSongs[i]; + Song* pSong = apAllSongs[i]; /* If we're on an extra stage, and this song is selected, ignore * #SELECTABLE. */ diff --git a/stepmania/src/OptionIcon.cpp b/stepmania/src/OptionIcon.cpp index 002c3a82fc..856e3ab13f 100644 --- a/stepmania/src/OptionIcon.cpp +++ b/stepmania/src/OptionIcon.cpp @@ -40,7 +40,7 @@ OptionIcon::OptionIcon() void OptionIcon::Load( PlayerNumber pn, CString sText, bool bHeader ) { - static CString sStopWords[] = { "OFF", "VISIBLE", "VIVID", "STANDARD", "X1" }; + static CString sStopWords[] = { "OFF", "VISIBLE", "VIVID", "STANDARD", "X1", "HOLDS" }; const int iNumStopWords = sizeof(sStopWords)/sizeof(sStopWords[0]); for( int i=0; iSetNewScreen( NEXT_SCREEN ); return; } diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 8c9b2245bb..2d4fc315d0 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -232,10 +232,10 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) Grade grade[NUM_PLAYERS]; for( p=0; pIsPlayerEnabled(p) || GAMESTATE->m_CurStageStats.bFailed[p] ) - grade[p] = GRADE_E; + if( GAMESTATE->IsPlayerEnabled(p) ) + grade[p] = stageStats.GetGrade( (PlayerNumber)p ); else - grade[p] = GAMESTATE->GetCurrentGrade( (PlayerNumber)p ); + grade[p] = GRADE_E; } Grade max_grade = GRADE_NO_DATA; @@ -832,7 +832,22 @@ void ScreenEvaluation::MenuStart( PlayerNumber pn ) m_Menu.TweenOffScreenToBlack( SM_GoToGameFinished, false ); } - GAMESTATE->m_iCurrentStageIndex++; // Increment the stage counter. - GAMESTATE->m_vPassedStageStats.push_back( GAMESTATE->m_CurStageStats ); // Save this stage's stats + switch( m_ResultMode ) + { + case RM_ARCADE_STAGE: + GAMESTATE->m_iCurrentStageIndex++; // Increment the stage counter. + + // add current stage stats to accumulated total only if this song was passed + { + bool bOnePassed = false; + for( int p=0; pIsPlayerEnabled(p) ) + bOnePassed |= !GAMESTATE->m_CurStageStats.bFailed[p]; + + if( bOnePassed ) + GAMESTATE->m_vPassedStageStats.push_back( GAMESTATE->m_CurStageStats ); // Save this stage's stats + } + break; + } } diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index 5f0387353e..cc9f831517 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -49,7 +49,7 @@ #define PREVIEWMUSICMODE THEME->GetMetricI("ScreenEz2SelectMusic","PreviewMusicMode") #define DIFFICULTYRATING_X THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingX") #define DIFFICULTYRATING_Y THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingY") -#define DIFFICULTYRATING_ORIENTATION THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingOrientation") +#define DIFFICULTYRATING_ORIENTATION THEME->GetMetricI("ScreenEz2SelectMusic","DifficultyRatingOrientation") #define INFOFRAME_X THEME->GetMetricF("ScreenEz2SelectMusic","InfoFrameX") #define INFOFRAME_Y THEME->GetMetricF("ScreenEz2SelectMusic","InfoFrameY") diff --git a/stepmania/src/ScreenLogo.cpp b/stepmania/src/ScreenLogo.cpp index 2230216702..e10449029b 100644 --- a/stepmania/src/ScreenLogo.cpp +++ b/stepmania/src/ScreenLogo.cpp @@ -49,7 +49,7 @@ ScreenLogo::ScreenLogo() : ScreenAttract("ScreenLogo","logo") m_textSongs.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); m_textSongs.SetHorizAlign( Actor::align_left ); - m_textSongs.SetText( ssprintf("Found %u Songs", SONGMAN->m_pSongs.size()) ); + m_textSongs.SetText( ssprintf("%d songs in %d groups", SONGMAN->GetNumSongs(), SONGMAN->GetNumGroups()) ); m_textSongs.SetDiffuse( RageColor(0.6f,0.6f,0.6f,1) ); // light gray m_textSongs.SetXY( SONGS_X, SONGS_Y ); m_textSongs.SetZoom( 0.5f ); diff --git a/stepmania/src/ScreenMusicScroll.cpp b/stepmania/src/ScreenMusicScroll.cpp index 61846b05a5..8cd49aa0bd 100644 --- a/stepmania/src/ScreenMusicScroll.cpp +++ b/stepmania/src/ScreenMusicScroll.cpp @@ -26,8 +26,7 @@ #define SCROLL_DELAY THEME->GetMetricF("ScreenMusicScroll","ScrollDelay") #define SCROLL_SPEED THEME->GetMetricF("ScreenMusicScroll","ScrollSpeed") #define TEXT_ZOOM THEME->GetMetricF("ScreenMusicScroll","TextZoom") - -const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1); +#define NEXT_SCREEN THEME->GetMetric("ScreenMusicScroll","NextScreen") const CString CREDIT_LINES[] = @@ -150,7 +149,8 @@ ScreenMusicScroll::ScreenMusicScroll() this->AddChild( &m_Background ); - vector arraySongs = SONGMAN->m_pSongs; + vector arraySongs; + SONGMAN->GetAllSongs( arraySongs ); SortSongPointerArrayByTitle( arraySongs ); m_iNumLines = 0; @@ -183,7 +183,7 @@ ScreenMusicScroll::ScreenMusicScroll() m_textLines[i].SetTweenXY( CENTER_X, SCREEN_TOP - 40 ); } - this->SendScreenMessage( SM_StartFadingOut, 0.2f * i + 3.0f ); + this->SendScreenMessage( SM_BeginFadingOut, 0.2f * i + 3.0f ); this->AddChild( &m_Fade ); @@ -233,12 +233,12 @@ void ScreenMusicScroll::HandleScreenMessage( const ScreenMessage SM ) { switch( SM ) { - case SM_StartFadingOut: + case SM_BeginFadingOut: m_Fade.CloseWipingRight( SM_GoToNextScreen ); break; case SM_GoToNextScreen: SONGMAN->SaveMachineScoresToDisk(); - SCREENMAN->SetNewScreen( "ScreenCompany" ); + SCREENMAN->SetNewScreen( NEXT_SCREEN ); break; } } diff --git a/stepmania/src/ScreenRanking.cpp b/stepmania/src/ScreenRanking.cpp index 36d64861bb..a7ec2b57c9 100644 --- a/stepmania/src/ScreenRanking.cpp +++ b/stepmania/src/ScreenRanking.cpp @@ -59,16 +59,15 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking") { m_sprBullets[i].Load( THEME->GetPathTo("Graphics",("ranking bullets 1x5")) ); m_sprBullets[i].SetXY( BULLETS_START_X+LINE_SPACING_X*i, BULLETS_START_Y+LINE_SPACING_Y*i ); + m_sprBullets[i].SetDiffuse( RageColor(1,1,1,0) ); m_sprBullets[i].StopAnimating(); m_sprBullets[i].SetState(i); - m_sprBullets[i].SetDiffuse( RageColor(1,1,1,0) ); this->AddChild( &m_sprBullets[i] ); m_textNames[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") ); m_textNames[i].TurnShadowOff(); m_textNames[i].SetXY( NAMES_START_X+LINE_SPACING_X*i, NAMES_START_Y+LINE_SPACING_Y*i ); m_textNames[i].SetZoom( NAMES_ZOOM ); - m_textNames[i].SetDiffuse( NAMES_COLOR ); m_textNames[i].SetHorizAlign( Actor::align_left ); this->AddChild( &m_textNames[i] ); @@ -76,7 +75,6 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking") m_textScores[i].TurnShadowOff(); m_textScores[i].SetXY( SCORES_START_X+LINE_SPACING_X*i, SCORES_START_Y+LINE_SPACING_Y*i ); m_textScores[i].SetZoom( SCORES_ZOOM ); - m_textScores[i].SetDiffuse( SCORES_COLOR ); m_textScores[i].SetHorizAlign( Actor::align_right ); this->AddChild( &m_textScores[i] ); } @@ -177,30 +175,38 @@ void ScreenRanking::SetPage( PageToShow pts ) { case PageToShow::TYPE_CATEGORY: { + m_textCategory.SetDiffuse( RageColor(1,1,1,1) ); m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) ); + m_textType.SetDiffuse( RageColor(1,1,1,1) ); m_textType.SetText( GameManager::NotesTypeToString(pts.nt) ); for( int l=0; lm_MachineScores[pts.nt][pts.category][l].sName; float fScore = SONGMAN->m_MachineScores[pts.nt][pts.category][l].fScore; m_textNames[l].SetText( sName ); m_textScores[l].SetText( ssprintf("%.0f",fScore) ); m_textNames[l].SetDiffuse( NAMES_COLOR ); m_textScores[l].SetDiffuse( SCORES_COLOR ); + + bool bRecentHighScore = false; for( int p=0; pm_LastRankingNotesType && + bRecentHighScore |= + pts.nt == GAMESTATE->m_LastRankingNotesType && GAMESTATE->m_LastRankingCategory[p] == pts.category && - GAMESTATE->m_iLastRankingIndex[p] == l ) - { - m_textNames[l].SetEffectBlinking(); - m_textScores[l].SetEffectBlinking(); - } - else - { - m_textNames[l].SetEffectNone(); - m_textScores[l].SetEffectNone(); - } + GAMESTATE->m_iLastRankingIndex[p] == l; + } + + if( bRecentHighScore ) + { + m_textNames[l].SetEffectBlinking( 10, NAMES_COLOR, RageColor(1,1,1,1) ); + m_textScores[l].SetEffectBlinking( 10, SCORES_COLOR, RageColor(1,1,1,1) ); + } + else + { + m_textNames[l].SetEffectNone(); + m_textScores[l].SetEffectNone(); } } } @@ -242,18 +248,13 @@ void ScreenRanking::SetPage( PageToShow pts ) void ScreenRanking::TweenPageOnScreen() { - m_textCategory.SetDiffuse( RageColor(1,1,1,1) ); m_textCategory.FadeOn(0,"bounce right",0.5f); - m_textType.SetDiffuse( RageColor(1,1,1,1) ); m_textType.FadeOn(0.1f,"bounce right",0.5f); for( int l=0; l aAllSongs = SONGMAN->m_pSongs; + vector aAllSongs; + SONGMAN->GetAllSongs( aAllSongs ); // Filter out Songs that can't be played by the current Style for( j=aAllSongs.size()-1; j>=0; j-- ) // foreach Song, back to front diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 8e8d2987e8..33077a88df 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -199,6 +199,9 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty // fall through case PrefsManager::COIN_HOME: case PrefsManager::COIN_FREE: + if( m_Fade.IsClosing() ) + break; + GAMESTATE->m_bSideIsJoined[MenuI.player] = true; GAMESTATE->m_MasterPlayerNumber = MenuI.player; GAMESTATE->m_bPlayersCanJoin = false; @@ -209,17 +212,18 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty case CHOICE_SELECT_GAME: case CHOICE_MAP_KEY_JOY: case CHOICE_OPTIONS: - case CHOICE_JUKEBOX: #ifdef _DEBUG case CHOICE_SANDBOX: #endif m_soundSelect.PlayRandom(); m_Fade.CloseWipingRight( SM_GoToNextScreen ); break; + case CHOICE_JUKEBOX: case CHOICE_EDIT: - if( SONGMAN->m_pSongs.empty() ) + if( SONGMAN->GetNumSongs() == 0 ) { m_soundInvalid.PlayRandom(); + SCREENMAN->SystemMessage( "No songs are installed" ); } else { diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index d4dfae6e2c..c2501ff3c4 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -38,14 +38,15 @@ const int COURSE_TOP_SCORE_VERSION = 1; #define GROUP_COLOR( i ) THEME->GetMetricC("SongManager",ssprintf("GroupColor%d",i+1)) #define EXTRA_COLOR THEME->GetMetricC("SongManager","ExtraColor") -RageColor g_GroupColors[30]; +vector g_vGroupColors; RageColor g_ExtraColor; SongManager::SongManager( LoadingWindow *ld ) { + g_vGroupColors.clear(); for( int i=0; i &AddTo ) +{ + AddTo = m_pSongs; +} + void SongManager::GetSongsInGroup( const CString sGroupName, vector &AddTo ) { + AddTo.clear(); + for( unsigned i=0; i &AddT } } +int SongManager::GetNumSongs() +{ + return m_pSongs.size(); +} + +int SongManager::GetNumGroups() +{ + return m_arrayGroupNames.size(); +} + CString SongManager::ShortenGroupName( const CString &sOrigGroupName ) { CString sShortName = sOrigGroupName; @@ -678,7 +696,7 @@ void SongManager::AddMachineRecords( NotesType nt, RankingCategory hsc[NUM_PLAYE if( newHS.fScore > machineScores[i].fScore ) { // We found the insert point. Shift down. - for( int j=i+1; ji; j-- ) machineScores[j] = machineScores[j-1]; // insert machineScores[i].fScore = newHS.fScore; @@ -689,3 +707,5 @@ void SongManager::AddMachineRecords( NotesType nt, RankingCategory hsc[NUM_PLAYE } } } + + diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index 7b7d8a1ca8..03fe80ee84 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -26,8 +26,6 @@ public: SongManager( LoadingWindow *ld ); ~SongManager(); - vector m_pSongs; // all songs that can be played - void InitSongArrayFromDisk( LoadingWindow *ld ); void FreeSongArray(); void ReloadSongArray(); @@ -54,7 +52,10 @@ public: // Lookup + void GetAllSongs( vector &AddTo ); void GetSongsInGroup( const CString sGroupName, vector &AddTo ); + int GetNumSongs(); + int GetNumGroups(); Song* GetRandomSong(); void GetNonstopCourses( vector &AddTo ); // add to if life meter type is BAR. @@ -95,6 +96,7 @@ protected: void SanityCheckGroupDir( CString sDir ) const; void AddGroup( CString sDir, CString sGroupDirName ); + vector m_pSongs; // all songs that can be played CStringArray m_arrayGroupNames; CStringArray m_GroupBannerPaths; // each song group has a banner associated with it }; diff --git a/stepmania/src/StageStats.cpp b/stepmania/src/StageStats.cpp index 72efe9226c..c9405eb1e1 100644 --- a/stepmania/src/StageStats.cpp +++ b/stepmania/src/StageStats.cpp @@ -11,6 +11,9 @@ */ #include "StageStats.h" +#include "GameState.h" +#include "RageLog.h" + StageStats::StageStats() { @@ -28,12 +31,12 @@ void StageStats::operator+=( const StageStats& other ) fAliveSeconds[p] += other.fAliveSeconds[p]; bFailed[p] |= other.bFailed[p]; iPossibleDancePoints[p] += other.iPossibleDancePoints[p]; - iActualDancePoints[p] += other.iPossibleDancePoints[p]; + iActualDancePoints[p] += other.iActualDancePoints[p]; for( int t=0; tIsPlayerEnabled(pn) ); // should be calling this is player isn't joined! + + if( bFailed[pn] ) + return GRADE_E; + + /* Based on the percentage of your total "Dance Points" to the maximum + * possible number, the following rank is assigned: + * + * 100% - AAA + * 93% - AA + * 80% - A + * 65% - B + * 45% - C + * Less - D + * Fail - E + */ + float fPercentDancePoints = iActualDancePoints[pn] / (float)iPossibleDancePoints[pn]; + fPercentDancePoints = max( 0.f, fPercentDancePoints ); + LOG->Trace( "iActualDancePoints: %i", iActualDancePoints[pn] ); + LOG->Trace( "iPossibleDancePoints: %i", iPossibleDancePoints[pn] ); + LOG->Trace( "fPercentDancePoints: %f", fPercentDancePoints ); + + // check for "AAAA" + if( iTapNoteScores[pn][TNS_MARVELOUS] > 0 && + iTapNoteScores[pn][TNS_PERFECT] == 0 && + iTapNoteScores[pn][TNS_GREAT] == 0 && + iTapNoteScores[pn][TNS_GOOD] == 0 && + iTapNoteScores[pn][TNS_BOO] == 0 && + iTapNoteScores[pn][TNS_MISS] == 0 ) + return GRADE_AAAA; + + if ( fPercentDancePoints == 1.00 ) return GRADE_AAA; + else if( fPercentDancePoints >= 0.93 ) return GRADE_AA; + else if( fPercentDancePoints >= 0.80 ) return GRADE_A; + else if( fPercentDancePoints >= 0.65 ) return GRADE_B; + else if( fPercentDancePoints >= 0.45 ) return GRADE_C; + else return GRADE_D; +} diff --git a/stepmania/src/StageStats.h b/stepmania/src/StageStats.h index b616b82841..449f110cca 100644 --- a/stepmania/src/StageStats.h +++ b/stepmania/src/StageStats.h @@ -11,14 +11,18 @@ ----------------------------------------------------------------------------- */ + #include "GameConstantsAndTypes.h" // for NUM_PLAYERS +#include "Grade.h" class Song; + struct StageStats { StageStats(); void operator+=( const StageStats& other ); // accumulate + Grade GetGrade( PlayerNumber pn ); Song* pSong; int iMeter[NUM_PLAYERS]; diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index f712b0c023..e3519f505a 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -422,7 +422,11 @@ static void HandleInputEvents(float fDeltaTime) continue; } } - else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5)) + /* Hitting F5, then waiting 5 seconds while my monitor is black + * is really making me angry. + * Do any users even know about this hotkey or think it's useful? + * Probably not... -Chris +/* else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5)) { if(type != IET_FIRST_PRESS) continue; @@ -439,6 +443,7 @@ static void HandleInputEvents(float fDeltaTime) } ApplyGraphicOptions(); } + */ else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F6)) { if(type != IET_FIRST_PRESS) continue;