add courses to "total game DP" count
move RadarValues into a struct
This commit is contained in:
@@ -1044,6 +1044,27 @@ bool Course::IsRanking() const
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
RadarValues Course::GetRadarValues( StepsType st, CourseDifficulty cd ) const
|
||||
{
|
||||
RadarValues rv;
|
||||
|
||||
vector<Course::Info> ci;
|
||||
GAMESTATE->m_pCurCourse->GetCourseInfo( st, ci, cd );
|
||||
for( unsigned i = 0; i < ci.size(); ++i )
|
||||
{
|
||||
const Steps *pNotes = ci[i].pNotes;
|
||||
ASSERT( pNotes );
|
||||
rv += pNotes->GetRadarValues();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Sorting stuff
|
||||
//
|
||||
static map<const Course*, float> course_sort_val;
|
||||
|
||||
bool CompareCoursePointersBySortValueAscending(const Course *pSong1, const Course *pSong2)
|
||||
|
||||
@@ -140,6 +140,7 @@ public:
|
||||
void AutogenEndlessFromGroup( CString sGroupName, vector<Song*> &apSongsInGroup );
|
||||
void AutogenNonstopFromGroup( CString sGroupName, vector<Song*> &apSongsInGroup );
|
||||
|
||||
RadarValues GetRadarValues( StepsType st, CourseDifficulty cd ) const;
|
||||
|
||||
// sorting values
|
||||
int SortOrder_TotalDifficulty;
|
||||
|
||||
@@ -64,6 +64,27 @@ enum RadarCategory
|
||||
|
||||
CString RadarCategoryToString( RadarCategory cat );
|
||||
|
||||
struct RadarValues
|
||||
{
|
||||
float value[NUM_RADAR_CATEGORIES];
|
||||
|
||||
RadarValues()
|
||||
{
|
||||
FOREACH_RadarCategory( rc )
|
||||
value[rc] = 0;
|
||||
}
|
||||
|
||||
operator const float* () const { return value; };
|
||||
operator float* () { return value; };
|
||||
|
||||
RadarValues& operator+=( const RadarValues& other )
|
||||
{
|
||||
FOREACH_RadarCategory( rc )
|
||||
value[rc] += other.value[rc];
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
enum Difficulty
|
||||
{
|
||||
|
||||
@@ -59,23 +59,26 @@ GrooveGraph::GrooveGraph()
|
||||
|
||||
void GrooveGraph::SetFromSong( Song* pSong )
|
||||
{
|
||||
float fValues[NUM_SHOWN_RADAR_CATEGORIES][NUM_DIFFICULTIES];
|
||||
ZERO( fValues );
|
||||
RadarValues rvs[NUM_DIFFICULTIES];
|
||||
|
||||
if( pSong )
|
||||
{
|
||||
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
||||
{
|
||||
Steps* pNotes = pSong->GetStepsByDifficulty( GAMESTATE->GetCurrentStyleDef()->m_StepsType, (Difficulty)i );
|
||||
const float* fRadarValues = pNotes ? pNotes->GetRadarValues() : NULL;
|
||||
for( int j=0; j<NUM_SHOWN_RADAR_CATEGORIES; j++ )
|
||||
fValues[j][i] = fRadarValues ? fRadarValues[j] : 0;
|
||||
if( pNotes )
|
||||
rvs[i] = pNotes->GetRadarValues();
|
||||
}
|
||||
}
|
||||
|
||||
for( int j=0; j<NUM_SHOWN_RADAR_CATEGORIES; j++ )
|
||||
{
|
||||
m_Mountains[j].SetValues( fValues[j] );
|
||||
float fValues[NUM_DIFFICULTIES];
|
||||
FOREACH_Difficulty( dc )
|
||||
{
|
||||
fValues[dc] = rvs[j][dc];
|
||||
}
|
||||
m_Mountains[j].SetValues( fValues );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,23 +151,16 @@ void PaneDisplay::SetContent( PaneContents c )
|
||||
if( (g_Contents[c].req&NEED_PROFILE) && !PROFILEMAN->IsUsingProfile( m_PlayerNumber ) )
|
||||
return;
|
||||
|
||||
float fRadarValues[NUM_RADAR_CATEGORIES];
|
||||
memset( fRadarValues, 0, sizeof(fRadarValues) );
|
||||
RadarValues rv;
|
||||
|
||||
if( g_Contents[c].req&NEED_NOTES )
|
||||
memcpy( fRadarValues, GAMESTATE->m_pCurNotes[m_PlayerNumber]->GetRadarValues(), sizeof(fRadarValues) );
|
||||
rv = GAMESTATE->m_pCurNotes[m_PlayerNumber]->GetRadarValues();
|
||||
else if( g_Contents[c].req&NEED_COURSE )
|
||||
{
|
||||
vector<Course::Info> ci;
|
||||
GAMESTATE->m_pCurCourse->GetCourseInfo( GAMESTATE->GetCurrentStyleDef()->m_StepsType, ci, GAMESTATE->m_CourseDifficulty[m_PlayerNumber] );
|
||||
for( unsigned i = 0; i < ci.size(); ++i )
|
||||
{
|
||||
for( unsigned r = 0; r < NUM_RADAR_CATEGORIES; ++r )
|
||||
{
|
||||
const Steps *pNotes = ci[i].pNotes;
|
||||
fRadarValues[r] += pNotes->GetRadarValues()[r];
|
||||
}
|
||||
}
|
||||
CourseDifficulty cd = GAMESTATE->m_CourseDifficulty[m_PlayerNumber];
|
||||
StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
|
||||
rv = GAMESTATE->m_pCurCourse->GetRadarValues( st, cd );
|
||||
}
|
||||
|
||||
const Song *pSong = GAMESTATE->m_pCurSong;
|
||||
@@ -181,20 +174,20 @@ void PaneDisplay::SetContent( PaneContents c )
|
||||
switch( c )
|
||||
{
|
||||
case COURSE_NUM_STEPS:
|
||||
case SONG_NUM_STEPS: val = fRadarValues[RADAR_NUM_TAPS_AND_HOLDS]; break;
|
||||
case SONG_NUM_STEPS: val = rv[RADAR_NUM_TAPS_AND_HOLDS]; break;
|
||||
case COURSE_JUMPS:
|
||||
case SONG_JUMPS: val = fRadarValues[RADAR_NUM_JUMPS]; break;
|
||||
case SONG_JUMPS: val = rv[RADAR_NUM_JUMPS]; break;
|
||||
case COURSE_HOLDS:
|
||||
case SONG_HOLDS: val = fRadarValues[RADAR_NUM_HOLDS]; break;
|
||||
case SONG_HOLDS: val = rv[RADAR_NUM_HOLDS]; break;
|
||||
case COURSE_MINES:
|
||||
case SONG_MINES: val = fRadarValues[RADAR_NUM_MINES]; break;
|
||||
case SONG_MINES: val = rv[RADAR_NUM_MINES]; break;
|
||||
case COURSE_HANDS:
|
||||
case SONG_HANDS: val = fRadarValues[RADAR_NUM_HANDS]; break;
|
||||
case SONG_DIFFICULTY_RADAR_STREAM: val = fRadarValues[RADAR_STREAM]; break;
|
||||
case SONG_DIFFICULTY_RADAR_VOLTAGE: val = fRadarValues[RADAR_VOLTAGE]; break;
|
||||
case SONG_DIFFICULTY_RADAR_AIR: val = fRadarValues[RADAR_AIR]; break;
|
||||
case SONG_DIFFICULTY_RADAR_FREEZE: val = fRadarValues[RADAR_FREEZE]; break;
|
||||
case SONG_DIFFICULTY_RADAR_CHAOS: val = fRadarValues[RADAR_CHAOS]; break;
|
||||
case SONG_HANDS: val = rv[RADAR_NUM_HANDS]; break;
|
||||
case SONG_DIFFICULTY_RADAR_STREAM: val = rv[RADAR_STREAM]; break;
|
||||
case SONG_DIFFICULTY_RADAR_VOLTAGE: val = rv[RADAR_VOLTAGE]; break;
|
||||
case SONG_DIFFICULTY_RADAR_AIR: val = rv[RADAR_AIR]; break;
|
||||
case SONG_DIFFICULTY_RADAR_FREEZE: val = rv[RADAR_FREEZE]; break;
|
||||
case SONG_DIFFICULTY_RADAR_CHAOS: val = rv[RADAR_CHAOS]; break;
|
||||
case SONG_PROFILE_HIGH_SCORE:
|
||||
val = 100.0f * PROFILEMAN->GetProfile(m_PlayerNumber)->GetStepsHighScoreList(pSteps).GetTopScore().fPercentDP;
|
||||
break;
|
||||
|
||||
+35
-10
@@ -176,21 +176,46 @@ int Profile::GetTotalNumSongsPassed() const
|
||||
int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const
|
||||
{
|
||||
int iTotal = 0;
|
||||
for( std::map<const Steps*,HighScoresForASteps>::const_iterator iter = m_StepsHighScores.begin();
|
||||
iter != m_StepsHighScores.end();
|
||||
iter++ )
|
||||
|
||||
// add steps high scores
|
||||
{
|
||||
const Steps* pSteps = iter->first;
|
||||
ASSERT( pSteps );
|
||||
const HighScoresForASteps& h = iter->second;
|
||||
if( pSteps->m_StepsType == st )
|
||||
for( std::map<const Steps*,HighScoresForASteps>::const_iterator iter = m_StepsHighScores.begin();
|
||||
iter != m_StepsHighScores.end();
|
||||
iter++ )
|
||||
{
|
||||
const float* fRadars = pSteps->GetRadarValues();
|
||||
int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars );
|
||||
iTotal += (int)truncf( h.hs.GetTopScore().fPercentDP * iPossibleDP );
|
||||
const Steps* pSteps = iter->first;
|
||||
ASSERT( pSteps );
|
||||
const HighScoresForASteps& h = iter->second;
|
||||
const HighScoreList& hs = h.hs;
|
||||
if( pSteps->m_StepsType == st )
|
||||
{
|
||||
const float* fRadars = pSteps->GetRadarValues();
|
||||
int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars );
|
||||
iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add course high scores
|
||||
{
|
||||
for( std::map<const Course*,HighScoresForACourse>::const_iterator iter = m_CourseHighScores.begin();
|
||||
iter != m_CourseHighScores.end();
|
||||
iter++ )
|
||||
{
|
||||
const Course* pCourse = iter->first;
|
||||
ASSERT( pCourse );
|
||||
const HighScoresForACourse& h = iter->second;
|
||||
FOREACH_CourseDifficulty( cd )
|
||||
{
|
||||
const HighScoreList& hs = h.hs[st][cd];
|
||||
const float* fRadars = pCourse->GetRadarValues(st,cd);
|
||||
int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars );
|
||||
iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return iTotal;
|
||||
}
|
||||
|
||||
|
||||
@@ -668,7 +668,7 @@ float ScreenRanking::SetPage( PageToShow pts )
|
||||
case PageToShow::TYPE_CATEGORY:
|
||||
{
|
||||
m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) );
|
||||
m_textStepsType.SetText( GameManager::NotesTypeToString(pts.nt) );
|
||||
m_textStepsType.SetText( GameManager::NotesTypeToThemedString(pts.nt) );
|
||||
|
||||
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
||||
{
|
||||
|
||||
@@ -39,8 +39,6 @@ Steps::Steps()
|
||||
m_LoadedFromProfile = PROFILE_SLOT_INVALID;
|
||||
m_Difficulty = DIFFICULTY_INVALID;
|
||||
m_iMeter = 0;
|
||||
for(int i = 0; i < NUM_RADAR_CATEGORIES; ++i)
|
||||
m_fRadarValues[i] = -1; /* unknown */
|
||||
|
||||
notes = NULL;
|
||||
notes_comp = NULL;
|
||||
@@ -236,8 +234,7 @@ void Steps::DeAutogen()
|
||||
m_sDescription = Real()->m_sDescription;
|
||||
m_Difficulty = Real()->m_Difficulty;
|
||||
m_iMeter = Real()->m_iMeter;
|
||||
for(int i = 0; i < NUM_RADAR_CATEGORIES; ++i)
|
||||
m_fRadarValues[i] = Real()->m_fRadarValues[i];
|
||||
m_RadarValues = Real()->m_RadarValues;
|
||||
|
||||
parent = NULL;
|
||||
|
||||
@@ -309,7 +306,7 @@ void Steps::SetRadarValue(int r, float val)
|
||||
{
|
||||
DeAutogen();
|
||||
ASSERT(r < NUM_RADAR_CATEGORIES);
|
||||
m_fRadarValues[r] = val;
|
||||
m_RadarValues[r] = val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
CString GetDescription() const { return Real()->m_sDescription; }
|
||||
Difficulty GetDifficulty() const { return Real()->m_Difficulty; }
|
||||
int GetMeter() const { return Real()->m_iMeter; }
|
||||
const float *GetRadarValues() const { return Real()->m_fRadarValues; }
|
||||
const RadarValues& GetRadarValues() const { return Real()->m_RadarValues; }
|
||||
|
||||
void SetDescription(CString desc);
|
||||
void SetDifficulty(Difficulty d);
|
||||
@@ -80,8 +80,7 @@ protected:
|
||||
CString m_sDescription; // Step author, edit name, or something meaningful
|
||||
Difficulty m_Difficulty; // difficulty classification
|
||||
int m_iMeter; // difficulty rating from MIN_METER to MAX_METER
|
||||
float m_fRadarValues[NUM_RADAR_CATEGORIES]; // between 0.0-1.2 starting from 12-o'clock rotating clockwise
|
||||
|
||||
RadarValues m_RadarValues;
|
||||
};
|
||||
|
||||
bool CompareNotesPointersByRadarValues(const Steps* pNotes1, const Steps* pNotes2);
|
||||
|
||||
Reference in New Issue
Block a user