From f4ef92ab81356bd42e77afc3799b891d4999437e Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 7 Oct 2002 05:45:59 +0000 Subject: [PATCH] Fixed Grade display on MusicWheel not corresponding to top score --- stepmania/src/MusicWheel.cpp | 15 +++++++++++---- stepmania/src/NotesWriterDWI.cpp | 17 ++++++++++++----- stepmania/src/Song.cpp | 7 +++++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index bb1b15578d..63e121e939 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -185,10 +185,17 @@ void WheelItemDisplay::RefreshGrades() if( m_pSong ) // this is a song display { - const Difficulty dc = GAMESTATE->m_PreferredDifficulty[p]; - const Grade grade = m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), p, dc ); - m_GradeDisplay[p].SetGrade( (PlayerNumber)p, grade ); - //m_GradeDisplay[p].SetDiffuse( PlayerToColor((PlayerNumber)p) ); + if( m_pSong == GAMESTATE->m_pCurSong ) + { + Notes* pNotes = GAMESTATE->m_pCurNotes[p]; + m_GradeDisplay[p].SetGrade( (PlayerNumber)p, pNotes->m_TopGrade ); + } + else + { + const Difficulty dc = GAMESTATE->m_PreferredDifficulty[p]; + const Grade grade = m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), p, dc ); + m_GradeDisplay[p].SetGrade( (PlayerNumber)p, grade ); + } } else // this is a section display { diff --git a/stepmania/src/NotesWriterDWI.cpp b/stepmania/src/NotesWriterDWI.cpp index 7957221c6b..0ee6839652 100644 --- a/stepmania/src/NotesWriterDWI.cpp +++ b/stepmania/src/NotesWriterDWI.cpp @@ -187,12 +187,19 @@ bool NotesWriterDWI::WriteDWINotesTag( FILE* fp, const Notes &out ) default: return false; // not a type supported by DWI } - switch( out.m_Difficulty ) + if( 0==out.m_sDescription.CompareNoCase("challenge") ) + fprintf( fp, "SMANIAC:" ); + else if( 0==out.m_sDescription.CompareNoCase("smaniac") ) + fprintf( fp, "SMANIAC:" ); + else { - case DIFFICULTY_EASY: fprintf( fp, "BASIC:" ); break; - case DIFFICULTY_MEDIUM: fprintf( fp, "ANOTHER:" ); break; - case DIFFICULTY_HARD: fprintf( fp, "MANIAC:" ); break; - default: ASSERT(0); return false; + switch( out.m_Difficulty ) + { + case DIFFICULTY_EASY: fprintf( fp, "BASIC:" ); break; + case DIFFICULTY_MEDIUM: fprintf( fp, "ANOTHER:" ); break; + case DIFFICULTY_HARD: fprintf( fp, "MANIAC:" ); break; + default: ASSERT(0); return false; + } } fprintf( fp, "%d:\n", out.m_iMeter ); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 68a00ffa40..8c1070ca86 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -799,17 +799,20 @@ void Song::AddAutoGenNotes() Grade Song::GetGradeForDifficulty( const StyleDef *st, int p, Difficulty dc ) const { + // return max grade of notes in difficulty class CArray aNotes; this->GetNotesThatMatch( st, p, aNotes ); SortNotesArrayByDifficulty( aNotes ); + Grade grade = GRADE_NO_DATA; + for( int i=0; im_Difficulty == dc ) - return pNotes->m_TopGrade; + grade = max( grade, pNotes->m_TopGrade ); } - return GRADE_NO_DATA; + return grade; }