fPercentDP, fSurviveSeconds
This commit is contained in:
@@ -614,8 +614,8 @@ static HighScore MakeRandomHighScore( float fPercentDP )
|
||||
hs.SetName( "FAKE" );
|
||||
hs.SetGrade( (Grade)SCALE( rand()%5, 0, 4, GRADE_TIER01, GRADE_TIER05 ) );
|
||||
hs.SetScore( rand()%100*1000 );
|
||||
hs.fPercentDP = fPercentDP;
|
||||
hs.fSurviveSeconds = randomf( 30.0f, 100.0f );
|
||||
hs.SetPercentDP( fPercentDP );
|
||||
hs.SetSurviveSeconds( randomf(30.0f, 100.0f) );
|
||||
PlayerOptions po;
|
||||
po.ChooseRandomMofifiers();
|
||||
hs.sModifiers = po.GetString();
|
||||
|
||||
@@ -1392,7 +1392,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
|
||||
feat.Feat = ssprintf("MR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() );
|
||||
feat.pStringToFill = hs.GetNameMutable();
|
||||
feat.grade = hs.GetGrade();
|
||||
feat.fPercentDP = hs.fPercentDP;
|
||||
feat.fPercentDP = hs.GetPercentDP();
|
||||
feat.iScore = hs.GetScore();
|
||||
|
||||
if( pSong->HasBanner() )
|
||||
@@ -1420,7 +1420,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
|
||||
feat.Feat = ssprintf("PR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() );
|
||||
feat.pStringToFill = hs.GetNameMutable();
|
||||
feat.grade = hs.GetGrade();
|
||||
feat.fPercentDP = hs.fPercentDP;
|
||||
feat.fPercentDP = hs.GetPercentDP();
|
||||
feat.iScore = hs.GetScore();
|
||||
|
||||
// XXX: temporary hack
|
||||
@@ -1455,7 +1455,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
|
||||
feat.pStringToFill = hs.GetNameMutable();
|
||||
feat.grade = GRADE_NO_DATA;
|
||||
feat.iScore = hs.GetScore();
|
||||
feat.fPercentDP = hs.fPercentDP;
|
||||
feat.fPercentDP = hs.GetPercentDP();
|
||||
asFeatsOut.push_back( feat );
|
||||
}
|
||||
}
|
||||
@@ -1478,7 +1478,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
|
||||
feat.pStringToFill = hs.GetNameMutable();
|
||||
feat.grade = GRADE_NO_DATA;
|
||||
feat.iScore = hs.GetScore();
|
||||
feat.fPercentDP = hs.fPercentDP;
|
||||
feat.fPercentDP = hs.GetPercentDP();
|
||||
asFeatsOut.push_back( feat );
|
||||
}
|
||||
}
|
||||
@@ -1515,7 +1515,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
|
||||
feat.pStringToFill = hs.GetNameMutable();
|
||||
feat.grade = GRADE_NO_DATA;
|
||||
feat.iScore = hs.GetScore();
|
||||
feat.fPercentDP = hs.fPercentDP;
|
||||
feat.fPercentDP = hs.GetPercentDP();
|
||||
if( pCourse->HasBanner() )
|
||||
feat.Banner = pCourse->m_sBannerPath;
|
||||
asFeatsOut.push_back( feat );
|
||||
@@ -1539,7 +1539,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
|
||||
feat.pStringToFill = hs.GetNameMutable();
|
||||
feat.grade = GRADE_NO_DATA;
|
||||
feat.iScore = hs.GetScore();
|
||||
feat.fPercentDP = hs.fPercentDP;
|
||||
feat.fPercentDP = hs.GetPercentDP();
|
||||
if( pCourse->HasBanner() )
|
||||
feat.Banner = pCourse->m_sBannerPath;
|
||||
asFeatsOut.push_back( feat );
|
||||
|
||||
+17
-10
@@ -14,6 +14,8 @@ struct HighScoreImpl
|
||||
CString sName; // name that shows in the machine's ranking screen
|
||||
Grade grade;
|
||||
int iScore;
|
||||
float fPercentDP;
|
||||
float fSurviveSeconds;
|
||||
|
||||
void Unset();
|
||||
void AppendChildren( XNode *pNode ) const;
|
||||
@@ -29,6 +31,8 @@ bool HighScoreImpl::operator==( const HighScoreImpl& other ) const
|
||||
COMPARE( sName );
|
||||
COMPARE( grade );
|
||||
COMPARE( iScore );
|
||||
COMPARE( fPercentDP );
|
||||
COMPARE( fSurviveSeconds );
|
||||
#undef COMPARE
|
||||
|
||||
return true;
|
||||
@@ -39,6 +43,8 @@ void HighScoreImpl::Unset()
|
||||
sName = "";
|
||||
grade = GRADE_NO_DATA;
|
||||
iScore = 0;
|
||||
fPercentDP = 0;
|
||||
fSurviveSeconds = 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +53,8 @@ void HighScoreImpl::AppendChildren( XNode *pNode ) const
|
||||
pNode->AppendChild( "Name", IsRankingToFillIn(sName) ? CString("") : sName );
|
||||
pNode->AppendChild( "Grade", GradeToString(grade) );
|
||||
pNode->AppendChild( "Score", iScore );
|
||||
pNode->AppendChild( "PercentDP", fPercentDP );
|
||||
pNode->AppendChild( "SurviveSeconds", fSurviveSeconds );
|
||||
}
|
||||
|
||||
void HighScoreImpl::LoadFromNode( const XNode *pNode )
|
||||
@@ -57,6 +65,8 @@ void HighScoreImpl::LoadFromNode( const XNode *pNode )
|
||||
pNode->GetChildValue( "Grade", s );
|
||||
grade = StringToGrade( s );
|
||||
pNode->GetChildValue( "Score", iScore );
|
||||
pNode->GetChildValue( "PercentDP", fPercentDP );
|
||||
pNode->GetChildValue( "SurviveSeconds", fSurviveSeconds );
|
||||
|
||||
/* Validate input. */
|
||||
grade = clamp( grade, GRADE_TIER01, GRADE_FAILED );
|
||||
@@ -73,8 +83,6 @@ HighScore::HighScore()
|
||||
void HighScore::Unset()
|
||||
{
|
||||
m_Impl->Unset();
|
||||
fPercentDP = 0;
|
||||
fSurviveSeconds = 0;
|
||||
sModifiers = "";
|
||||
dateTime.Init();
|
||||
sPlayerGuid = "";
|
||||
@@ -92,6 +100,11 @@ Grade HighScore::GetGrade() const { return m_Impl->grade; }
|
||||
void HighScore::SetGrade( Grade g ) { m_Impl->grade = g; }
|
||||
int HighScore::GetScore() const { return m_Impl->iScore; }
|
||||
void HighScore::SetScore( int iScore ) { m_Impl->iScore = iScore; }
|
||||
float HighScore::GetPercentDP() const { return m_Impl->fPercentDP; }
|
||||
void HighScore::SetPercentDP( float f ) { m_Impl->fPercentDP = f; }
|
||||
float HighScore::GetSurviveSeconds() const { return m_Impl->fSurviveSeconds; }
|
||||
void HighScore::SetSurviveSeconds( float f ) { m_Impl->fSurviveSeconds = f; }
|
||||
float HighScore::GetSurvivalSeconds() const { return GetSurviveSeconds() + fLifeRemainingSeconds; }
|
||||
|
||||
/* We normally don't give direct access to the members. We need this one
|
||||
* for NameToFillIn; use a special accessor so it's easy to find where this
|
||||
@@ -104,10 +117,10 @@ bool HighScore::operator>=( const HighScore& other ) const
|
||||
* is the same. */
|
||||
if( PREFSMAN->m_bPercentageScoring )
|
||||
{
|
||||
if( fPercentDP == other.fPercentDP )
|
||||
if( GetPercentDP() == other.GetPercentDP() )
|
||||
return GetGrade() >= other.GetGrade();
|
||||
else
|
||||
return fPercentDP >= other.fPercentDP;
|
||||
return GetPercentDP() >= other.GetPercentDP();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -123,8 +136,6 @@ bool HighScore::operator==( const HighScore& other ) const
|
||||
if( *m_Impl != *other.m_Impl )
|
||||
return false;
|
||||
#define COMPARE(x) if( x!=other.x ) return false;
|
||||
COMPARE( fPercentDP );
|
||||
COMPARE( fSurviveSeconds );
|
||||
COMPARE( sModifiers );
|
||||
COMPARE( dateTime );
|
||||
COMPARE( sPlayerGuid );
|
||||
@@ -147,8 +158,6 @@ XNode* HighScore::CreateNode() const
|
||||
|
||||
// TRICKY: Don't write "name to fill in" markers.
|
||||
m_Impl->AppendChildren( pNode );
|
||||
pNode->AppendChild( "PercentDP", fPercentDP );
|
||||
pNode->AppendChild( "SurviveSeconds", fSurviveSeconds );
|
||||
pNode->AppendChild( "Modifiers", sModifiers );
|
||||
pNode->AppendChild( "DateTime", dateTime );
|
||||
pNode->AppendChild( "PlayerGuid", sPlayerGuid );
|
||||
@@ -172,8 +181,6 @@ void HighScore::LoadFromNode( const XNode* pNode )
|
||||
ASSERT( pNode->m_sName == "HighScore" );
|
||||
|
||||
m_Impl->LoadFromNode( pNode );
|
||||
pNode->GetChildValue( "PercentDP", fPercentDP );
|
||||
pNode->GetChildValue( "SurviveSeconds", fSurviveSeconds );
|
||||
pNode->GetChildValue( "Modifiers", sModifiers );
|
||||
pNode->GetChildValue( "DateTime", dateTime );
|
||||
pNode->GetChildValue( "PlayerGuid", sPlayerGuid );
|
||||
|
||||
@@ -23,8 +23,11 @@ struct HighScore
|
||||
void SetGrade( Grade g );
|
||||
int GetScore() const;
|
||||
void SetScore( int iScore );
|
||||
float fPercentDP;
|
||||
float fSurviveSeconds;
|
||||
float GetPercentDP() const;
|
||||
void SetPercentDP( float f );
|
||||
float GetSurviveSeconds() const;
|
||||
void SetSurviveSeconds( float f );
|
||||
float GetSurvivalSeconds() const;
|
||||
CString sModifiers;
|
||||
DateTime dateTime; // return value of time() when screenshot was taken
|
||||
CString sPlayerGuid; // who made this high score
|
||||
@@ -42,8 +45,6 @@ struct HighScore
|
||||
bool operator>=( const HighScore& other ) const;
|
||||
bool operator==( const HighScore& other ) const;
|
||||
|
||||
float GetSurvivalSeconds() const { return fSurviveSeconds + fLifeRemainingSeconds; }
|
||||
|
||||
XNode* CreateNode() const;
|
||||
void LoadFromNode( const XNode* pNode );
|
||||
|
||||
|
||||
@@ -181,22 +181,22 @@ void PaneDisplay::SetContent( PaneContents c )
|
||||
case COURSE_HANDS:
|
||||
case SONG_HANDS: val = rv[RADAR_NUM_HANDS]; break;
|
||||
case SONG_PROFILE_HIGH_SCORE:
|
||||
val = PROFILEMAN->GetProfile(m_PlayerNumber)->GetStepsHighScoreList(pSong,pSteps).GetTopScore().fPercentDP;
|
||||
val = PROFILEMAN->GetProfile(m_PlayerNumber)->GetStepsHighScoreList(pSong,pSteps).GetTopScore().GetPercentDP();
|
||||
break;
|
||||
|
||||
case SONG_MACHINE_HIGH_NAME: /* set val for color */
|
||||
case SONG_MACHINE_HIGH_SCORE:
|
||||
CHECKPOINT;
|
||||
val = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps).GetTopScore().fPercentDP;
|
||||
val = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps).GetTopScore().GetPercentDP();
|
||||
break;
|
||||
|
||||
case COURSE_MACHINE_HIGH_NAME: /* set val for color */
|
||||
case COURSE_MACHINE_HIGH_SCORE:
|
||||
val = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse,pTrail).GetTopScore().fPercentDP;
|
||||
val = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse,pTrail).GetTopScore().GetPercentDP();
|
||||
break;
|
||||
|
||||
case COURSE_PROFILE_HIGH_SCORE:
|
||||
val = PROFILEMAN->GetProfile(m_PlayerNumber)->GetCourseHighScoreList(pCourse,pTrail).GetTopScore().fPercentDP;
|
||||
val = PROFILEMAN->GetProfile(m_PlayerNumber)->GetCourseHighScoreList(pCourse,pTrail).GetTopScore().GetPercentDP();
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
@@ -375,7 +375,7 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
|
||||
const HighScoresForASteps& h = j->second;
|
||||
const HighScoreList& hsl = h.hsl;
|
||||
|
||||
fTotalPercents += hsl.GetTopScore().fPercentDP;
|
||||
fTotalPercents += hsl.GetTopScore().GetPercentDP();
|
||||
}
|
||||
CHECKPOINT;
|
||||
}
|
||||
@@ -454,7 +454,7 @@ float Profile::GetCoursesActual( StepsType st, CourseDifficulty cd ) const
|
||||
const HighScoresForATrail& h = j->second;
|
||||
const HighScoreList& hsl = h.hsl;
|
||||
|
||||
fTotalPercents += hsl.GetTopScore().fPercentDP;
|
||||
fTotalPercents += hsl.GetTopScore().GetPercentDP();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -530,7 +530,7 @@ int ProfileManager::GetSongNumTimesPlayed( const Song* pSong, ProfileSlot slot )
|
||||
void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, PlayerNumber pn, const HighScore &hs_, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||
{
|
||||
HighScore hs = hs_;
|
||||
hs.fPercentDP = max( 0, hs.fPercentDP ); // bump up negative scores
|
||||
hs.SetPercentDP( max(0, hs.GetPercentDP()) ); // bump up negative scores
|
||||
|
||||
iPersonalIndexOut = -1;
|
||||
iMachineIndexOut = -1;
|
||||
@@ -556,7 +556,7 @@ void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, Play
|
||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
||||
PROFILEMAN->GetProfile(pn)->AddStepsHighScore( pSong, pSteps, hs, iPersonalIndexOut );
|
||||
|
||||
if( hs.fPercentDP >= PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
||||
if( hs.GetPercentDP() >= PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
||||
{
|
||||
// don't leave machine high scores for edits loaded from the player's card
|
||||
if( !pSteps->IsAPlayerEdit() )
|
||||
@@ -600,7 +600,7 @@ void ProfileManager::GetHighScoreForDifficulty( const Song *s, const Style *st,
|
||||
void ProfileManager::AddCourseScore( const Course* pCourse, const Trail* pTrail, PlayerNumber pn, const HighScore &hs_, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||
{
|
||||
HighScore hs = hs_;
|
||||
hs.fPercentDP = max( 0, hs.fPercentDP ); // bump up negative scores
|
||||
hs.SetPercentDP(max( 0, hs.GetPercentDP()) ); // bump up negative scores
|
||||
|
||||
iPersonalIndexOut = -1;
|
||||
iMachineIndexOut = -1;
|
||||
@@ -626,7 +626,7 @@ void ProfileManager::AddCourseScore( const Course* pCourse, const Trail* pTrail,
|
||||
//
|
||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
||||
PROFILEMAN->GetProfile(pn)->AddCourseHighScore( pCourse, pTrail, hs, iPersonalIndexOut );
|
||||
if( hs.fPercentDP >= PREFSMAN->m_fMinPercentageForMachineCourseHighScore )
|
||||
if( hs.GetPercentDP() >= PREFSMAN->m_fMinPercentageForMachineCourseHighScore )
|
||||
PROFILEMAN->GetMachineProfile()->AddCourseHighScore( pCourse, pTrail, hs, iMachineIndexOut );
|
||||
|
||||
//
|
||||
@@ -654,7 +654,7 @@ void ProfileManager::AddCategoryScore( StepsType st, RankingCategory rc, PlayerN
|
||||
hs.SetName( RANKING_TO_FILL_IN_MARKER[pn] );
|
||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
||||
PROFILEMAN->GetProfile(pn)->AddCategoryHighScore( st, rc, hs, iPersonalIndexOut );
|
||||
if( hs.fPercentDP > PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
||||
if( hs.GetPercentDP() > PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
||||
PROFILEMAN->GetMachineProfile()->AddCategoryHighScore( st, rc, hs, iMachineIndexOut );
|
||||
}
|
||||
|
||||
|
||||
@@ -899,8 +899,8 @@ void ScreenEvaluation::CommitScores(
|
||||
hs.SetName( RANKING_TO_FILL_IN_MARKER[p] );
|
||||
hs.SetGrade( stageStats.m_player[p].GetGrade() );
|
||||
hs.SetScore( stageStats.m_player[p].iScore );
|
||||
hs.fPercentDP = stageStats.m_player[p].GetPercentDancePoints();
|
||||
hs.fSurviveSeconds = stageStats.m_player[p].fAliveSeconds;
|
||||
hs.SetPercentDP( stageStats.m_player[p].GetPercentDancePoints() );
|
||||
hs.SetSurviveSeconds( stageStats.m_player[p].fAliveSeconds );
|
||||
hs.sModifiers = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.GetString();
|
||||
hs.dateTime = DateTime::GetNowDateTime();
|
||||
hs.sPlayerGuid = PROFILEMAN->IsPersistentProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : CString("");
|
||||
|
||||
@@ -61,7 +61,7 @@ void HighScoreWheelItem::Load( int iRankIndex, const HighScore& hs )
|
||||
m_textScore.SetName( "Score" );
|
||||
m_textScore.LoadFromFont( THEME->GetPathF(m_sName,"score") );
|
||||
if( PREFSMAN->m_bPercentageScoring )
|
||||
m_textScore.SetText( PercentageDisplay::FormatPercentScore(hs.fPercentDP) );
|
||||
m_textScore.SetText( PercentageDisplay::FormatPercentScore(hs.GetPercentDP()) );
|
||||
else
|
||||
m_textScore.SetText( ssprintf("%i", hs.GetScore()) );
|
||||
m_textScore.SetShadowLength( 2 );
|
||||
@@ -170,7 +170,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
|
||||
|
||||
HighScore hs;
|
||||
hs.SetGrade( GRADE_TIER03 );
|
||||
hs.fPercentDP = ss.m_player[p].GetPercentDancePoints();
|
||||
hs.SetPercentDP( ss.m_player[p].GetPercentDancePoints() );
|
||||
hs.SetScore( ss.m_player[p].iScore );
|
||||
hs.dateTime = DateTime::GetNowDateTime();
|
||||
int a, b;
|
||||
@@ -360,7 +360,7 @@ void ScreenNameEntryTraditional::Init()
|
||||
{
|
||||
const HighScore &hs = hsl.vHighScores[h];
|
||||
if( hs.GetName() == RANKING_TO_FILL_IN_MARKER[p] &&
|
||||
hs.fPercentDP == fPercentDP &&
|
||||
hs.GetPercentDP() == fPercentDP &&
|
||||
hs.GetScore() == iScore )
|
||||
{
|
||||
iHighScoreIndex = h;
|
||||
|
||||
@@ -812,7 +812,7 @@ float ScreenRanking::SetPage( PageToShow pts )
|
||||
if( pts.pCourse->IsOni() )
|
||||
{
|
||||
m_textPoints[l].SetText( ssprintf("%04d",hs.GetScore()) );
|
||||
m_textTime[l].SetText( SecondsToMMSSMsMs(hs.fSurviveSeconds) );
|
||||
m_textTime[l].SetText( SecondsToMMSSMsMs(hs.GetSurviveSeconds()) );
|
||||
m_textScores[l].SetText( "" );
|
||||
} else {
|
||||
m_textPoints[l].SetText( "" );
|
||||
@@ -876,7 +876,7 @@ float ScreenRanking::SetPage( PageToShow pts )
|
||||
hs.SetName( NO_SCORE_NAME );
|
||||
}
|
||||
|
||||
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.fPercentDP );
|
||||
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.GetPercentDP() );
|
||||
if( SHOW_SURVIVAL_TIME )
|
||||
s += " " + SecondsToMSSMsMs(hs.GetSurvivalSeconds());
|
||||
pTextStepsScore->SetText( s );
|
||||
@@ -923,7 +923,7 @@ float ScreenRanking::SetPage( PageToShow pts )
|
||||
hs.SetName( NO_SCORE_NAME );
|
||||
}
|
||||
|
||||
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.fPercentDP );
|
||||
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.GetPercentDP() );
|
||||
if( SHOW_SURVIVAL_TIME )
|
||||
s += " " + SecondsToMSSMsMs(hs.GetSurvivalSeconds());
|
||||
pTextStepsScore->SetText( s );
|
||||
|
||||
Reference in New Issue
Block a user