show high score list on ScreenNameEntryTraditional

This commit is contained in:
Chris Danford
2004-03-08 02:21:22 +00:00
parent 840434dd49
commit 0262ae76f3
11 changed files with 282 additions and 108 deletions
+21 -13
View File
@@ -11,6 +11,8 @@
*/
/* Obsolete: use DifficultyClass. */
/* DifficultyClass was the old name for enum Difficulty, right? -Chris */
#include "DifficultyIcon.h"
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
@@ -43,21 +45,27 @@ bool DifficultyIcon::Load( CString sPath )
void DifficultyIcon::SetFromNotes( PlayerNumber pn, Steps* pNotes )
{
if( pNotes == NULL )
{
SetDiffuse( RageColor(1,1,1,0) );
return;
}
SetHidden(true);
else
SetFromDifficulty( pn, pNotes->GetDifficulty() );
}
void DifficultyIcon::SetFromDifficulty( PlayerNumber pn, Difficulty dc )
{
switch( GetNumStates() )
{
SetDiffuse( RageColor(1,1,1,1) );
case NUM_DIFFICULTIES: SetState( dc ); break;
case NUM_DIFFICULTIES*2: SetState( dc*2+pn ); break;
default: ASSERT(0);
}
}
int iStateNo = pNotes->GetDifficulty();
switch( GetNumStates() )
{
case NUM_DIFFICULTIES: SetState( iStateNo ); break;
case NUM_DIFFICULTIES*2: SetState( iStateNo*2+pn ); break;
default: SetState( 0 ); break;
}
void DifficultyIcon::SetFromCourseDifficulty( PlayerNumber pn, CourseDifficulty cd )
{
switch( cd )
{
case COURSE_DIFFICULTY_REGULAR: SetFromDifficulty(pn,DIFFICULTY_MEDIUM); break;
case COURSE_DIFFICULTY_DIFFICULT: SetFromDifficulty(pn,DIFFICULTY_HARD); break;
default: ASSERT(0);
}
}
+3
View File
@@ -13,6 +13,7 @@
#include "Sprite.h"
#include "PlayerNumber.h"
#include "GameConstantsAndTypes.h"
class Steps;
@@ -22,6 +23,8 @@ public:
bool Load( CString sFilePath );
void SetFromNotes( PlayerNumber pn, Steps* pNotes );
void SetFromDifficulty( PlayerNumber pn, Difficulty dc );
void SetFromCourseDifficulty( PlayerNumber pn, CourseDifficulty cd );
};
#endif
+20 -14
View File
@@ -1105,7 +1105,7 @@ struct SongAndSteps
bool operator<( const SongAndSteps& other ) const { return pSong<=other.pSong && pSteps<=other.pSteps; }
};
void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsOut ) const
void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOut ) const
{
if( !IsHumanPlayer(pn) )
return;
@@ -1162,8 +1162,10 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] )
continue;
RankingFeats feat;
feat.Type = RankingFeats::SONG;
RankingFeat feat;
feat.Type = RankingFeat::SONG;
feat.pSong = pSong;
feat.pSteps = pSteps;
feat.Feat = ssprintf("MR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() );
feat.pStringToFill = &hs.sName;
feat.grade = hs.grade;
@@ -1188,8 +1190,10 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] )
continue;
RankingFeats feat;
feat.Type = RankingFeats::SONG;
RankingFeat feat;
feat.pSong = pSong;
feat.pSteps = pSteps;
feat.Type = RankingFeat::SONG;
feat.Feat = ssprintf("PR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() );
feat.pStringToFill = &hs.sName;
feat.grade = hs.grade;
@@ -1224,8 +1228,8 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] )
continue;
RankingFeats feat;
feat.Type = RankingFeats::CATEGORY;
RankingFeat feat;
feat.Type = RankingFeat::CATEGORY;
feat.Feat = ssprintf("MR #%d in Type %c (%d)", j+1, 'A'+i, stats.iMeter[pn] );
feat.pStringToFill = &hs.sName;
feat.grade = GRADE_NO_DATA;
@@ -1248,8 +1252,8 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] )
continue;
RankingFeats feat;
feat.Type = RankingFeats::CATEGORY;
RankingFeat feat;
feat.Type = RankingFeat::CATEGORY;
feat.Feat = ssprintf("PR #%d in Type %c (%d)", j+1, 'A'+i, stats.iMeter[pn] );
feat.pStringToFill = &hs.sName;
feat.grade = GRADE_NO_DATA;
@@ -1284,8 +1288,9 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] )
continue;
RankingFeats feat;
feat.Type = RankingFeats::COURSE;
RankingFeat feat;
feat.Type = RankingFeat::COURSE;
feat.pCourse = pCourse;
feat.Feat = ssprintf("MR #%d in %s", i+1, pCourse->m_sName.c_str() );
feat.pStringToFill = &hs.sName;
feat.grade = GRADE_NO_DATA;
@@ -1307,8 +1312,9 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
if( hs.sName != RANKING_TO_FILL_IN_MARKER[pn] )
continue;
RankingFeats feat;
feat.Type = RankingFeats::COURSE;
RankingFeat feat;
feat.Type = RankingFeat::COURSE;
feat.pCourse = pCourse;
feat.Feat = ssprintf("PR #%d in %s", i+1, pCourse->m_sName.c_str() );
feat.pStringToFill = &hs.sName;
feat.grade = GRADE_NO_DATA;
@@ -1351,7 +1357,7 @@ void GameState::StoreRankingName( PlayerNumber pn, CString name )
}
}
vector<RankingFeats> aFeats;
vector<RankingFeat> aFeats;
GetRankingFeats( pn, aFeats );
for( unsigned i=0; i<aFeats.size(); i++ )
+5 -3
View File
@@ -232,10 +232,12 @@ public:
//
// Ranking Stuff
//
struct RankingFeats
struct RankingFeat
{
enum { SONG, COURSE, CATEGORY } Type;
Song* pSong; // valid if Type == SONG
Steps* pSteps; // valid if Type == SONG
Course* pCourse; // valid if Type == COURSE
Grade grade;
int iScore;
float fPercentDP;
@@ -244,7 +246,7 @@ public:
CString *pStringToFill;
};
void GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsOut ) const;
void GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &vFeatsOut ) const;
void StoreRankingName( PlayerNumber pn, CString name ); // Called by name entry screens
vector<CString*> m_vpsNamesThatWereFilled; // filled on StoreRankingName,
+4 -3
View File
@@ -88,12 +88,13 @@ void HighScoreList::AddHighScore( HighScore hs, int &iIndexOut )
if( hs >= vHighScores[i] )
break;
}
if( i < NUM_RANKING_LINES )
const int iMaxScores = PREFSMAN->m_iMaxHighScoresPerList;
if( i < iMaxScores )
{
vHighScores.insert( vHighScores.begin()+i, hs );
iIndexOut = i;
if( vHighScores.size() > unsigned(NUM_RANKING_LINES) )
vHighScores.erase( vHighScores.begin()+NUM_RANKING_LINES, vHighScores.end() );
if( vHighScores.size() > unsigned(iMaxScores) )
vHighScores.erase( vHighScores.begin()+iMaxScores, vHighScores.end() );
}
}
+3
View File
@@ -215,6 +215,7 @@ PrefsManager::PrefsManager()
m_bAllowExtraStage = true;
m_bLockWheelAfterRandom = true;
m_bHideDefaultNoteSkin = false;
m_iMaxHighScoresPerList = 10;
m_fPadStickSeconds = 0;
g_bAutoRestart = false;
m_bSignProfileData = false;
@@ -495,6 +496,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
ini.GetValue( "Options", "LockWheelAfterRandom", m_bLockWheelAfterRandom );
ini.GetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin );
ini.GetValue( "Options", "MaxHighScoresPerList", m_iMaxHighScoresPerList );
ini.GetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
ini.GetValue( "Options", "AutoRestart", g_bAutoRestart );
ini.GetValue( "Options", "SignProfileData", m_bSignProfileData );
@@ -709,6 +711,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
ini.SetValue( "Options", "LockWheelAfterRandom", m_bLockWheelAfterRandom );
ini.SetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin );
ini.SetValue( "Options", "MaxHighScoresPerList", m_iMaxHighScoresPerList );
ini.SetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
ini.SetValue( "Options", "AutoRestart", g_bAutoRestart );
ini.SetValue( "Options", "SignProfileData", m_bSignProfileData );
+1
View File
@@ -190,6 +190,7 @@ public:
bool m_bAllowExtraStage;
bool m_bLockWheelAfterRandom;
bool m_bHideDefaultNoteSkin;
int m_iMaxHighScoresPerList;
// Number of seconds it takes for a button on the controller to release
// after pressed.
+1 -1
View File
@@ -875,7 +875,7 @@ void ScreenEvaluation::CommitScores( const StageStats &stageStats, int iPersonal
ASSERT( GAMESTATE->m_pCurNotes[p] );
if( hs.fPercentDP > PREFSMAN->m_fMinPercentageForHighScore )
if( hs.fPercentDP >= PREFSMAN->m_fMinPercentageForHighScore )
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, iPersonalHighScoreIndex[p], iMachineHighScoreIndex[p] );
if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) )
+1 -1
View File
@@ -137,7 +137,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
int p;
vector<GameState::RankingFeats> aFeats[NUM_PLAYERS];
vector<GameState::RankingFeat> aFeats[NUM_PLAYERS];
// Find out if players deserve to enter their name
for( p=0; p<NUM_PLAYERS; p++ )
+187 -67
View File
@@ -41,22 +41,86 @@
#define NUM_ALPHABET_DISPLAYED THEME->GetMetricI(m_sName,"NumAlphabetDisplayed")
#define MAX_RANKING_NAME_LENGTH THEME->GetMetricI(m_sName,"MaxRankingNameLength")
#define FEAT_INTERVAL THEME->GetMetricF(m_sName,"FeatInterval")
#define KEYBOARD_LETTERS THEME->GetMetric (m_sName,"KeyboardLetters")
#define KEYBOARD_LETTERS THEME->GetMetric (m_sName,"KeyboardLetters")
#define NEXT_SCREEN THEME->GetMetric(m_sName,"NextScreen")
#define COMMAND_OPTIONAL( actor, command_name ) \
if( !actor.GetName().empty() ) \
COMMAND( actor, command_name );
const ScreenMessage SM_ChangeDisplayedFeat = ScreenMessage(SM_User+0);
static const int CHAR_OK = -1;
static const int CHAR_BACK = -2;
void HighScoreWheelItem::Load( int iRankIndex, const HighScore& hs )
{
SetName( "HighScoreWheelItem" );
m_textRank.SetName( "Rank" );
m_textRank.LoadFromFont( THEME->GetPathF(m_sName,"rank") );
m_textRank.SetText( ssprintf("%d", iRankIndex+1) );
this->AddChild( &m_textRank );
SET_XY_AND_ON_COMMAND( m_textRank );
m_textName.SetName( "Name" );
m_textName.LoadFromFont( THEME->GetPathF(m_sName,"name") );
m_textName.SetText( hs.sName );
this->AddChild( &m_textName );
SET_XY_AND_ON_COMMAND( m_textName );
m_textScore.SetName( "Score" );
m_textScore.LoadFromFont( THEME->GetPathF(m_sName,"score") );
if( PREFSMAN->m_bPercentageScoring )
m_textScore.SetText( ssprintf("%.2f%%", hs.fPercentDP*100) );
else
m_textScore.SetText( ssprintf("%i", hs.iScore) );
this->AddChild( &m_textScore );
SET_XY_AND_ON_COMMAND( m_textScore );
}
void HighScoreWheelItem::ShowFocus()
{
CString sCommand = "diffuseshift;EffectColor1,1,1,0,1;EffectColor2,0,1,1,1";
m_textRank.Command( sCommand );
m_textName.Command( sCommand );
m_textScore.Command( sCommand );
}
void HighScoreWheel::Load( const HighScoreList& hsl, int iIndexToFocus )
{
int iSize = hsl.vHighScores.size();
m_Items.resize( iSize );
for( int i=0; i<iSize; i++ )
{
m_Items[i].Load( i, hsl.vHighScores[i] );
this->AddChild( &m_Items[i] );
}
m_iIndexToFocus = iIndexToFocus;
if( m_iIndexToFocus >= 0 && m_iIndexToFocus < iSize )
m_Items[m_iIndexToFocus].ShowFocus();
ActorScroller::Load(
0.2f, // fSecondsPerItem
8, // iNumItemsToDraw
RageVector3(18,0,0), // vRotationDegrees
RageVector3(0,0,90), // vTranslateTerm0
RageVector3(0,0,0), // vTranslateTerm1
RageVector3(0,0,0) // vTranslateTerm2
);
Scroll();
}
float HighScoreWheel::Scroll()
{
SetCurrentAndDestinationItem( m_SubActors.size()+5 );
int iIndexToFocus = max( m_iIndexToFocus, 3 );
SetDestinationItem( iIndexToFocus );
return GetTweenTimeLeft();
}
ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : Screen( sClassName )
{
LOG->Trace( "ScreenNameEntryTraditional::ScreenNameEntryTraditional()" );
@@ -73,27 +137,32 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
for( int z = 0; z < 3; ++z )
{
st.pSong = SONGMAN->GetRandomSong();
st.iPossibleDancePoints[PLAYER_1] = 100;
st.iActualDancePoints[PLAYER_1] = 100;
st.iScore[PLAYER_1] = 100;
st.iPossibleDancePoints[PLAYER_2] = 100;
st.iActualDancePoints[PLAYER_2] = 100;
st.iScore[PLAYER_2] = 100;
ASSERT( st.pSong );
ASSERT( st.pSong->m_apNotes.size() );
for( int i = 0; i < 2; ++i )
for( int p = 0; p < NUM_PLAYERS; ++p )
{
GAMESTATE->m_pCurNotes[i] = st.pSteps[i] = st.pSong->m_apNotes[0];
st.iPossibleDancePoints[i] = 1000;
st.iActualDancePoints[i] = 985;
GAMESTATE->m_pCurNotes[p] = st.pSteps[p] = st.pSong->m_apNotes[0];
st.iPossibleDancePoints[p] = 1000;
st.iActualDancePoints[p] = 985;
HighScore hs;
hs.grade = GRADE_TIER_3;
hs.iScore = 42;
hs.fPercentDP = st.GetPercentDancePoints((PlayerNumber)p);
hs.iScore = st.iScore[p];
StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
int a, b;
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[i], (PlayerNumber)i, hs, a, b );
if( i == 0 )
{
HighScore hs;
hs.iScore = 1234567;
StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
PROFILEMAN->AddCategoryHighScore( nt, RANKING_A, (PlayerNumber)i, hs, a, b );
}
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
PROFILEMAN->AddCategoryHighScore( nt, RANKING_A, (PlayerNumber)p, hs, a, b );
}
g_vPlayedStageStats.push_back( st );
@@ -103,13 +172,13 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
int p;
vector<GameState::RankingFeats> aFeats[NUM_PLAYERS];
// Find out if players deserve to enter their name
for( p=0; p<NUM_PLAYERS; p++ )
{
GAMESTATE->GetRankingFeats( (PlayerNumber)p, aFeats[p] );
m_bStillEnteringName[p] = aFeats[p].size()>0;
vector<GameState::RankingFeat> aFeats;
GAMESTATE->GetRankingFeats( (PlayerNumber)p, aFeats );
m_bStillEnteringName[p] = aFeats.size()>0;
}
if( !AnyStillEntering() )
@@ -124,7 +193,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
for( p=0; p<NUM_PLAYERS; p++ )
{
m_NumFeats[p] = aFeats[p].size();
m_NumFeats[p] = g_vPlayedStageStats.size();
m_CurFeat[p] = 0;
if( !m_bStillEnteringName[p] )
@@ -229,53 +298,97 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
actor.FinishTweening(); \
}
for( i = 0; i < aFeats[p].size(); ++i )
m_FeatDisplay[p].resize( m_NumFeats[p] );
for( i = 0; i < m_NumFeats[p]; ++i )
{
const GameState::RankingFeats &feat = aFeats[p][i];
if( feat.Banner != "" )
StageStats &ss = g_vPlayedStageStats[i];
Song* pSong = ss.pSong;
Steps* pSteps = ss.pSteps[p];
Course* pCourse = GAMESTATE->m_pCurCourse;
int iHighScoreIndex = -1; // -1 means "out of ranking"
Grade grade = ss.GetGrade((PlayerNumber)p);
int iScore = ss.iScore[p];
float fPercentDP = ss.GetPercentDancePoints((PlayerNumber)p);
const HighScoreList& hsl =
GAMESTATE->IsCourseMode() ?
PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse, GAMESTATE->GetCurrentStyleDef()->m_StepsType, GAMESTATE->m_CourseDifficulty[p]) :
PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSteps);
for( int h=0; h<hsl.vHighScores.size(); h++ )
{
m_sprBanner[p][i].SetName( ssprintf("BannerP%i",p+1) );
m_sprBanner[p][i].Load( feat.Banner );
SET_ON( m_sprBanner[p][i] );
this->AddChild( &m_sprBanner[p][i] );
const HighScore &hs = hsl.vHighScores[h];
if( hs.sName == RANKING_TO_FILL_IN_MARKER[p] &&
hs.fPercentDP == fPercentDP &&
hs.iScore == iScore )
{
iHighScoreIndex = h;
break;
}
}
if( feat.grade != GRADE_NO_DATA )
{
m_Grade[p][i].SetName( ssprintf("GradeP%i",p+1) );
m_Grade[p][i].Load( THEME->GetPathToG("ScreenNameEntryTraditional grades") );
m_Grade[p][i].SetGrade( (PlayerNumber)p, feat.grade );
SET_ON( m_Grade[p][i] );
this->AddChild( &m_Grade[p][i] );
}
m_FeatDisplay[p][i].m_Wheel.SetName( ssprintf("WheelP%i",p+1) );
m_FeatDisplay[p][i].m_Wheel.Load( hsl, iHighScoreIndex );
SET_ON( m_FeatDisplay[p][i].m_Wheel );
this->AddChild( &m_FeatDisplay[p][i].m_Wheel );
m_textScore[p][i].SetName( ssprintf("ScoreP%i",p+1) );
m_textScore[p][i].LoadFromNumbers( THEME->GetPathToN("ScreenNameEntryTraditional score") );
if( PREFSMAN->m_bPercentageScoring )
m_textScore[p][i].SetText( ssprintf("%.2f%%", feat.fPercentDP*100) );
CString sBanner;
if( GAMESTATE->IsCourseMode() )
sBanner = pCourse->m_sBannerPath;
else
m_textScore[p][i].SetText( ssprintf("%i", feat.iScore) );
SET_ON( m_textScore[p][i] );
this->AddChild( &m_textScore[p][i] );
if( feat.Feat != "" )
sBanner = pSong->GetBannerPath();
if( !sBanner.empty() )
{
m_textCategory[p][i].SetName( ssprintf("CategoryP%i", p+1) );
m_textCategory[p][i].LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional category") );
m_textCategory[p][i].SetText( feat.Feat );
SET_ON( m_textCategory[p][i] );
this->AddChild( &m_textCategory[p][i] );
m_FeatDisplay[p][i].m_sprBanner.SetName( ssprintf("BannerP%i",p+1) );
m_FeatDisplay[p][i].m_sprBanner.Load( sBanner );
SET_ON( m_FeatDisplay[p][i].m_sprBanner );
this->AddChild( &m_FeatDisplay[p][i].m_sprBanner );
}
if( grade != GRADE_NO_DATA )
{
m_FeatDisplay[p][i].m_Grade.SetName( ssprintf("GradeP%i",p+1) );
m_FeatDisplay[p][i].m_Grade.Load( THEME->GetPathToG("ScreenNameEntryTraditional grades") );
m_FeatDisplay[p][i].m_Grade.SetGrade( (PlayerNumber)p, grade );
SET_ON( m_FeatDisplay[p][i].m_Grade );
this->AddChild( &m_FeatDisplay[p][i].m_Grade );
}
m_FeatDisplay[p][i].m_Difficulty.SetName( ssprintf("DifficultyP%i",p+1) );
m_FeatDisplay[p][i].m_Difficulty.Load( THEME->GetPathToG(ssprintf("ScreenNameEntryTraditional difficulty icons 1x%d",NUM_DIFFICULTIES)) );
if( GAMESTATE->IsCourseMode() )
m_FeatDisplay[p][i].m_Difficulty.SetFromCourseDifficulty( (PlayerNumber)p, GAMESTATE->m_CourseDifficulty[p] );
else
m_FeatDisplay[p][i].m_Difficulty.SetFromNotes( (PlayerNumber)p, pSteps );
SET_ON( m_FeatDisplay[p][i].m_Difficulty );
this->AddChild( &m_FeatDisplay[p][i].m_Difficulty );
m_FeatDisplay[p][i].m_textScore.SetName( ssprintf("ScoreP%i",p+1) );
m_FeatDisplay[p][i].m_textScore.LoadFromNumbers( THEME->GetPathToN("ScreenNameEntryTraditional score") );
if( PREFSMAN->m_bPercentageScoring )
m_FeatDisplay[p][i].m_textScore.SetText( ssprintf("%.2f%%", fPercentDP*100) );
else
m_FeatDisplay[p][i].m_textScore.SetText( ssprintf("%i", iScore) );
SET_ON( m_FeatDisplay[p][i].m_textScore );
this->AddChild( &m_FeatDisplay[p][i].m_textScore );
// if( feat.Feat != "" )
// {
// m_FeatDisplay[p][i].m_textCategory.SetName( ssprintf("CategoryP%i", p+1) );
// m_FeatDisplay[p][i].m_textCategory.LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional category") );
// m_FeatDisplay[p][i].m_textCategory.SetText( feat.Feat );
// SET_ON( m_FeatDisplay[p][i].m_textCategory );
// this->AddChild( &m_FeatDisplay[p][i].m_textCategory );
// }
/* We always show the banner frame (if any), because fading from a graphic to
* itself is ugly. */
m_FeatDisplay[p][i].m_sprBannerFrame.SetName( ssprintf("BannerFrameP%i",p+1) );
m_FeatDisplay[p][i].m_sprBannerFrame.Load( THEME->GetPathToG(ssprintf("ScreenNameEntryTraditional banner frame p%i",p+1)) );
SET_XY_AND_ON_COMMAND( m_FeatDisplay[p][i].m_sprBannerFrame );
this->AddChild( &m_FeatDisplay[p][i].m_sprBannerFrame );
}
#undef SET_ON
/* We always show the banner frame (if any), because fading from a graphic to
* itself is ugly. */
m_sprBannerFrame[p].SetName( ssprintf("BannerFrameP%i",p+1) );
m_sprBannerFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenNameEntryTraditional banner frame p%i",p+1)) );
SET_XY_AND_ON_COMMAND( m_sprBannerFrame[p] );
this->AddChild( &m_sprBannerFrame[p] );
}
this->PostScreenMessage( SM_ChangeDisplayedFeat, FEAT_INTERVAL );
@@ -367,14 +480,21 @@ void ScreenNameEntryTraditional::ChangeDisplayedFeat()
int OldFeat = m_CurFeat[pn];
m_CurFeat[pn] = NewFeat;
COMMAND_OPTIONAL( m_Grade[pn][OldFeat], "Hide" );
COMMAND_OPTIONAL( m_Grade[pn][NewFeat], "Unhide" );
COMMAND_OPTIONAL( m_sprBanner[pn][OldFeat], "Hide" );
COMMAND_OPTIONAL( m_sprBanner[pn][NewFeat], "Unhide" );
COMMAND_OPTIONAL( m_textScore[pn][OldFeat], "Hide" );
COMMAND_OPTIONAL( m_textScore[pn][NewFeat], "Unhide" );
COMMAND_OPTIONAL( m_textCategory[pn][OldFeat], "Hide" );
COMMAND_OPTIONAL( m_textCategory[pn][NewFeat], "Unhide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_Wheel, "Hide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_Wheel, "Unhide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_Grade, "Hide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_Grade, "Unhide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_Difficulty, "Hide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_Difficulty, "Unhide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_sprBanner, "Hide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_sprBanner, "Unhide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_textScore, "Hide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_textScore, "Unhide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][OldFeat].m_textCategory, "Hide" );
COMMAND_OPTIONAL( m_FeatDisplay[pn][NewFeat].m_textCategory, "Unhide" );
float fSecUntilDoneScrolling = m_FeatDisplay[pn][NewFeat].m_Wheel.Scroll();
}
}
+36 -6
View File
@@ -16,6 +16,30 @@
#include "MenuElements.h"
#include "GradeDisplay.h"
#include "Banner.h"
#include "HighScore.h"
#include "DifficultyIcon.h"
class HighScoreWheelItem : public ActorFrame
{
public:
void Load( int iRankIndex, const HighScore& hs );
void ShowFocus();
BitmapText m_textRank;
BitmapText m_textName;
BitmapText m_textScore;
};
class HighScoreWheel : public ActorScroller
{
public:
void Load( const HighScoreList& hsl, int iIndexToFocus );
float Scroll(); // return seconds until done scrolling
vector<HighScoreWheelItem> m_Items;
int m_iIndexToFocus;
};
class ScreenNameEntryTraditional : public Screen
{
@@ -31,7 +55,6 @@ public:
void MenuLeft( PlayerNumber pn, const InputEventType type );
void MenuRight( PlayerNumber pn, const InputEventType type );
enum { MAX_DISPLAYED_FEATS=16 };
private:
bool AnyStillEntering() const;
void PositionCharsAndCursor( int pn );
@@ -52,11 +75,18 @@ private:
int m_SelectedChar[NUM_PLAYERS];
/* Feat display: */
GradeDisplay m_Grade[NUM_PLAYERS][MAX_DISPLAYED_FEATS];
BitmapText m_textCategory[NUM_PLAYERS][MAX_DISPLAYED_FEATS];
BitmapText m_textScore[NUM_PLAYERS][MAX_DISPLAYED_FEATS];
Banner m_sprBanner[NUM_PLAYERS][MAX_DISPLAYED_FEATS];
Sprite m_sprBannerFrame[NUM_PLAYERS];
struct FeatDisplay
{
HighScoreWheel m_Wheel;
GradeDisplay m_Grade;
DifficultyIcon m_Difficulty;
BitmapText m_textCategory;
BitmapText m_textScore;
Banner m_sprBanner;
Sprite m_sprBannerFrame;
};
vector<FeatDisplay> m_FeatDisplay[NUM_PLAYERS];
Sprite m_sprNameFrame[NUM_PLAYERS];