From: Glenn M. <gma...@us...> - 2003-06-30 08:06:52
|
Update of /cvsroot/stepmania/stepmania/src In directory sc8-pr-cvs1:/tmp/cvs-serv13890 Modified Files: Course.cpp Course.h ScreenEvaluation.cpp ScreenRanking.cpp SongManager.cpp Log Message: Fix RankingToInsert::CompareDescending. Store regular scores in nonstop, not oni. We only ever display those scores in that mdoe. Add Course::IsNonstop, Course::IsOni, Course::IsEndless. Index: Course.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Course.cpp,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- Course.cpp 15 Jun 2003 02:07:31 -0000 1.86 +++ Course.cpp 30 Jun 2003 08:06:47 -0000 1.87 @@ -35,13 +35,18 @@ m_bDifficult = false; m_iLives = -1; + SetDefaultScore(); +} + +void Course::SetDefaultScore() +{ // // Init high scores // for( unsigned i=0; i<NUM_NOTES_TYPES; i++ ) for( int j=0; j<NUM_RANKING_LINES; j++ ) { - m_RankingScores[i][j].iDancePoints = 573; + m_RankingScores[i][j].iScore = IsOni()? 573: 0; m_RankingScores[i][j].fSurviveTime = 57.3f; m_RankingScores[i][j].sName = DEFAULT_RANKING_NAME; } @@ -50,7 +55,7 @@ for( unsigned i=0; i<NUM_NOTES_TYPES; i++ ) { m_MemCardScores[m][i].iNumTimesPlayed = 0; - m_MemCardScores[m][i].iDancePoints = 0; + m_MemCardScores[m][i].iScore = 0; m_MemCardScores[m][i].fSurviveTime = 0; } } @@ -254,6 +259,8 @@ CString ignore; tsub.Subst(m_sName, ignore, ignore, ignore, ignore, ignore); + + SetDefaultScore(); } @@ -333,6 +340,8 @@ SONGMAN->GetSongs( vSongs, e.group_name ); for( unsigned i = 0; i < vSongs.size(); ++i) m_entries.push_back( e ); + + SetDefaultScore(); } void Course::AutogenNonstopFromGroup( CString sGroupName, vector<Song*> &apSongsInGroup ) @@ -348,6 +357,8 @@ m_entries.push_back( m_entries[0] ); while( m_entries.size() > 4 ) m_entries.pop_back(); + + SetDefaultScore(); } @@ -609,14 +620,12 @@ struct RankingToInsert { PlayerNumber pn; - int iDancePoints; + int iScore; float fSurviveTime; - static int CompareDescending( const RankingToInsert &hs1, const RankingToInsert &hs2 ) + static bool CompareDescending( const RankingToInsert &hs1, const RankingToInsert &hs2 ) { - if( hs1.iDancePoints > hs2.iDancePoints ) return -1; - else if( hs1.iDancePoints == hs2.iDancePoints ) return 0; - else return +1; + return hs1.iScore > hs2.iScore; } static void SortDescending( vector<RankingToInsert>& vHSout ) { @@ -624,7 +633,7 @@ } }; -void Course::AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS], int iDancePoints[NUM_PLAYERS], float fSurviveTime[NUM_PLAYERS], int iRankingIndexOut[NUM_PLAYERS], bool bNewRecordOut[NUM_PLAYERS] ) +void Course::AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS], int iScore[NUM_PLAYERS], float fSurviveTime[NUM_PLAYERS], int iRankingIndexOut[NUM_PLAYERS], bool bNewRecordOut[NUM_PLAYERS] ) { vector<RankingToInsert> vHS; for( int p=0; p<NUM_PLAYERS; p++ ) @@ -640,23 +649,23 @@ m_MemCardScores[p][nt].iNumTimesPlayed++; m_MemCardScores[MEMORY_CARD_MACHINE][nt].iNumTimesPlayed++; - if( iDancePoints[p] > m_MemCardScores[p][nt].iDancePoints ) + if( iScore[p] > m_MemCardScores[p][nt].iScore ) { - m_MemCardScores[p][nt].iDancePoints = iDancePoints[p]; + m_MemCardScores[p][nt].iScore = iScore[p]; m_MemCardScores[p][nt].fSurviveTime = fSurviveTime[p]; bNewRecordOut[p] = true; } - if( iDancePoints[p] > m_MemCardScores[MEMORY_CARD_MACHINE][nt].iDancePoints ) + if( iScore[p] > m_MemCardScores[MEMORY_CARD_MACHINE][nt].iScore ) { - m_MemCardScores[MEMORY_CARD_MACHINE][nt].iDancePoints = iDancePoints[p]; + m_MemCardScores[MEMORY_CARD_MACHINE][nt].iScore = iScore[p]; m_MemCardScores[MEMORY_CARD_MACHINE][nt].fSurviveTime = fSurviveTime[p]; } // Update Ranking RankingToInsert hs; - hs.iDancePoints = iDancePoints[p]; + hs.iScore = iScore[p]; hs.fSurviveTime = fSurviveTime[p]; hs.pn = (PlayerNumber)p; vHS.push_back( hs ); @@ -672,14 +681,14 @@ RankingScore* rankingScores = m_RankingScores[nt]; for( int i=0; i<NUM_RANKING_LINES; i++ ) { - if( newHS.iDancePoints > rankingScores[i].iDancePoints ) + if( newHS.iScore > rankingScores[i].iScore ) { // We found the insert point. Shift down. for( int j=NUM_RANKING_LINES-1; j>i; j-- ) rankingScores[j] = rankingScores[j-1]; // insert rankingScores[i].fSurviveTime = newHS.fSurviveTime; - rankingScores[i].iDancePoints = newHS.iDancePoints; + rankingScores[i].iScore = newHS.iScore; rankingScores[i].sName = DEFAULT_RANKING_NAME; iRankingIndexOut[newHS.pn] = i; break; Index: Course.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Course.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- Course.h 6 Jun 2003 19:42:53 -0000 1.37 +++ Course.h 30 Jun 2003 08:06:47 -0000 1.38 @@ -79,6 +79,9 @@ bool ContainsAnyMysterySongs() const; bool GetTotalSeconds( float& fSecondsOut ) const; + bool IsNonstop() const { return !m_bRepeat && m_iLives <= 0; } // use bar life meter + bool IsOni() const { return !m_bRepeat && m_iLives > 0; } // use battery life meter + bool IsEndless() const { return m_bRepeat; } void LoadFromCRSFile( CString sPath ); void Save(); @@ -89,14 +92,15 @@ // Statistics struct RankingScore { - int iDancePoints; + /* Dance points for oni, regular score for nonstop. */ + int iScore; float fSurviveTime; CString sName; } m_RankingScores[NUM_NOTES_TYPES][NUM_RANKING_LINES]; // sorted highest to lowest by iDancePoints struct MemCardScore { int iNumTimesPlayed; - int iDancePoints; + int iScore; float fSurviveTime; } m_MemCardScores[NUM_MEMORY_CARDS][NUM_NOTES_TYPES]; @@ -105,6 +109,7 @@ private: Song *FindSong(CString sGroup, CString sSong) const; + void SetDefaultScore(); }; Index: ScreenEvaluation.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenEvaluation.cpp,v retrieving revision 1.146 retrieving revision 1.147 diff -u -d -r1.146 -r1.147 --- ScreenEvaluation.cpp 18 Jun 2003 20:06:27 -0000 1.146 +++ ScreenEvaluation.cpp 30 Jun 2003 08:06:47 -0000 1.147 @@ -246,7 +246,13 @@ int iRankingIndex[NUM_PLAYERS]; Course* pCourse = GAMESTATE->m_pCurCourse; - pCourse->AddScores( nt, bIsHumanPlayer, stageStats.iActualDancePoints, stageStats.fAliveSeconds, iRankingIndex, bNewRecord ); + + int *score; + if( pCourse->IsOni() ) + score = stageStats.iActualDancePoints; + else + score = stageStats.iScore; + pCourse->AddScores( nt, bIsHumanPlayer, score, stageStats.fAliveSeconds, iRankingIndex, bNewRecord ); COPY( GAMESTATE->m_iRankingIndex, iRankingIndex ); GAMESTATE->m_pRankingCourse = pCourse; GAMESTATE->m_RankingNotesType = nt; Index: ScreenRanking.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenRanking.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- ScreenRanking.cpp 18 Jun 2003 20:06:27 -0000 1.22 +++ ScreenRanking.cpp 30 Jun 2003 08:06:47 -0000 1.23 @@ -245,15 +245,23 @@ { m_sprBullets[l].SetDiffuse( RageColor(1,1,1,1) ); CString sName = pts.pCourse->m_RankingScores[pts.nt][l].sName; - int iDancePoints = pts.pCourse->m_RankingScores[pts.nt][l].iDancePoints; - float fSurviveTime = pts.pCourse->m_RankingScores[pts.nt][l].fSurviveTime; + const int iScore = pts.pCourse->m_RankingScores[pts.nt][l].iScore; + const float fSurviveTime = pts.pCourse->m_RankingScores[pts.nt][l].fSurviveTime; m_textNames[l].SetText( sName ); - m_textScores[l].SetText( "" ); - m_textPoints[l].SetText( ssprintf("%04d",iDancePoints) ); - m_textTime[l].SetText( SecondsToTime(fSurviveTime) ); + if( pts.pCourse->IsOni() ) + { + m_textPoints[l].SetText( ssprintf("%04d",iScore) ); + m_textTime[l].SetText( SecondsToTime(fSurviveTime) ); + m_textScores[l].SetText( "" ); + } else { + m_textPoints[l].SetText( "" ); + m_textTime[l].SetText( "" ); + m_textScores[l].SetText( ssprintf("%10d",iScore) ); + } m_textNames[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) ); m_textPoints[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) ); m_textTime[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) ); + m_textScores[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) ); for( int p=0; p<NUM_PLAYERS; p++ ) { if( pts.pCourse == GAMESTATE->m_pRankingCourse && Index: SongManager.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/SongManager.cpp,v retrieving revision 1.140 retrieving revision 1.141 diff -u -d -r1.140 -r1.141 --- SongManager.cpp 30 Jun 2003 04:24:59 -0000 1.140 +++ SongManager.cpp 30 Jun 2003 08:06:47 -0000 1.141 @@ -324,13 +324,13 @@ if( !feof(fp) ) { int iNumTimesPlayed; - int iDancePoints; + int iScore; float fSurviveTime; - fscanf(fp, "%d %d %f\n", &iNumTimesPlayed, &iDancePoints, &fSurviveTime); + fscanf(fp, "%d %d %f\n", &iNumTimesPlayed, &iScore, &fSurviveTime); if( pCourse ) { pCourse->m_MemCardScores[c][i].iNumTimesPlayed = iNumTimesPlayed; - pCourse->m_MemCardScores[c][i].iDancePoints = iDancePoints; + pCourse->m_MemCardScores[c][i].iScore = iScore; pCourse->m_MemCardScores[c][i].fSurviveTime = fSurviveTime; } } @@ -385,13 +385,13 @@ for( int j=0; j<NUM_RANKING_LINES; j++ ) if( !feof(fp) ) { - int iDancePoints; + int iScore; float fSurviveTime; char szName[256]; - fscanf(fp, "%d %f %[^\n]\n", &iDancePoints, &fSurviveTime, szName); + fscanf(fp, "%d %f %[^\n]\n", &iScore, &fSurviveTime, szName); if( pCourse ) { - pCourse->m_RankingScores[i][j].iDancePoints = iDancePoints; + pCourse->m_RankingScores[i][j].iScore = iScore; pCourse->m_RankingScores[i][j].fSurviveTime = fSurviveTime; pCourse->m_RankingScores[i][j].sName = szName; } @@ -471,7 +471,7 @@ for( int j=0; j<NUM_RANKING_LINES; j++ ) { fprintf(fp, "%d %f %s\n", - pCourse->m_RankingScores[i][j].iDancePoints, + pCourse->m_RankingScores[i][j].iScore, pCourse->m_RankingScores[i][j].fSurviveTime, pCourse->m_RankingScores[i][j].sName.c_str()); } @@ -556,7 +556,7 @@ for( int nt=0; nt<NUM_NOTES_TYPES; nt++ ) fprintf(fp, "%d %d %f\n", pCourse->m_MemCardScores[c][nt].iNumTimesPlayed, - pCourse->m_MemCardScores[c][nt].iDancePoints, + pCourse->m_MemCardScores[c][nt].iScore, pCourse->m_MemCardScores[c][nt].fSurviveTime); } @@ -808,7 +808,7 @@ void SongManager::GetNonstopCourses( vector<Course*> &AddTo, bool bIncludeAutogen ) { for( unsigned i=0; i<m_pCourses.size(); i++ ) - if( !m_pCourses[i]->m_bRepeat && m_pCourses[i]->m_iLives <= 0 ) // use bar life meter + if( m_pCourses[i]->IsNonstop() ) if( bIncludeAutogen || !m_pCourses[i]->m_bIsAutogen ) AddTo.push_back( m_pCourses[i] ); } @@ -816,7 +816,7 @@ void SongManager::GetOniCourses( vector<Course*> &AddTo, bool bIncludeAutogen ) { for( unsigned i=0; i<m_pCourses.size(); i++ ) - if( !m_pCourses[i]->m_bRepeat && m_pCourses[i]->m_iLives > 0 ) // use battery life meter + if( m_pCourses[i]->IsOni() ) if( bIncludeAutogen || !m_pCourses[i]->m_bIsAutogen ) AddTo.push_back( m_pCourses[i] ); } @@ -824,7 +824,7 @@ void SongManager::GetEndlessCourses( vector<Course*> &AddTo, bool bIncludeAutogen ) { for( unsigned i=0; i<m_pCourses.size(); i++ ) - if( m_pCourses[i]->m_bRepeat ) + if( m_pCourses[i]->IsEndless() ) if( bIncludeAutogen || !m_pCourses[i]->m_bIsAutogen ) AddTo.push_back( m_pCourses[i] ); } |