more progress on Ranking
This commit is contained in:
@@ -381,37 +381,37 @@ MarvelousP1X=230
|
|||||||
MarvelousP2X=410
|
MarvelousP2X=410
|
||||||
MarvelousOniP1X=230
|
MarvelousOniP1X=230
|
||||||
MarvelousOniP2X=410
|
MarvelousOniP2X=410
|
||||||
MarvelousY=176
|
MarvelousY=160
|
||||||
PerfectP1X=230
|
PerfectP1X=230
|
||||||
PerfectP2X=410
|
PerfectP2X=410
|
||||||
PerfectOniP1X=230
|
PerfectOniP1X=230
|
||||||
PerfectOniP2X=410
|
PerfectOniP2X=410
|
||||||
PerfectY=176
|
PerfectY=192
|
||||||
GreatP1X=230
|
GreatP1X=230
|
||||||
GreatP2X=410
|
GreatP2X=410
|
||||||
GreatOniP1X=230
|
GreatOniP1X=230
|
||||||
GreatOniP2X=410
|
GreatOniP2X=410
|
||||||
GreatY=208
|
GreatY=224
|
||||||
GoodP1X=230
|
GoodP1X=230
|
||||||
GoodP2X=410
|
GoodP2X=410
|
||||||
GoodOniP1X=230
|
GoodOniP1X=230
|
||||||
GoodOniP2X=410
|
GoodOniP2X=410
|
||||||
GoodY=240
|
GoodY=256
|
||||||
BooP1X=230
|
BooP1X=230
|
||||||
BooP2X=410
|
BooP2X=410
|
||||||
BooOniP1X=230
|
BooOniP1X=230
|
||||||
BooOniP2X=410
|
BooOniP2X=410
|
||||||
BooY=272
|
BooY=288
|
||||||
MissP1X=230
|
MissP1X=230
|
||||||
MissP2X=410
|
MissP2X=410
|
||||||
MissOniP1X=230
|
MissOniP1X=230
|
||||||
MissOniP2X=410
|
MissOniP2X=410
|
||||||
MissY=304
|
MissY=320
|
||||||
OKP1X=230
|
OKP1X=230
|
||||||
OKP2X=410
|
OKP2X=410
|
||||||
OKOniP1X=230
|
OKOniP1X=230
|
||||||
OKOniP2X=410
|
OKOniP2X=410
|
||||||
OKY=336
|
OKY=352
|
||||||
MaxComboP1X=134
|
MaxComboP1X=134
|
||||||
MaxComboP2X=578
|
MaxComboP2X=578
|
||||||
MaxComboOniP1X=1000 // off screen
|
MaxComboOniP1X=1000 // off screen
|
||||||
@@ -774,11 +774,11 @@ LineSpacingX=0
|
|||||||
LineSpacingY=60
|
LineSpacingY=60
|
||||||
BulletsStartX=100
|
BulletsStartX=100
|
||||||
BulletsStartY=140
|
BulletsStartY=140
|
||||||
NamesStartX=250
|
NamesStartX=180
|
||||||
NamesStartY=140
|
NamesStartY=140
|
||||||
NamesZoom=1.2
|
NamesZoom=1.2
|
||||||
NamesColor=0.8,0.8,1,1
|
NamesColor=0.8,0.8,1,1
|
||||||
ScoresStartX=450
|
ScoresStartX=520
|
||||||
ScoresStartY=140
|
ScoresStartY=140
|
||||||
ScoresZoom=1.2
|
ScoresZoom=1.2
|
||||||
ScoresColor=0.8,0.8,1,1
|
ScoresColor=0.8,0.8,1,1
|
||||||
|
|||||||
+21
-29
@@ -36,7 +36,7 @@ Course::Course()
|
|||||||
//
|
//
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
for( i=0; i<NUM_NOTES_TYPES; i++ )
|
for( i=0; i<NUM_NOTES_TYPES; i++ )
|
||||||
for( j=0; j<NUM_HIGH_SCORE_LINES; j++ )
|
for( j=0; j<NUM_RANKING_LINES; j++ )
|
||||||
{
|
{
|
||||||
m_MachineScores[i][j].iDancePoints = 0;
|
m_MachineScores[i][j].iDancePoints = 0;
|
||||||
m_MachineScores[i][j].fSurviveTime = 0;
|
m_MachineScores[i][j].fSurviveTime = 0;
|
||||||
@@ -305,77 +305,69 @@ int Course::GetNumStages() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Course::IsNewMachineRecord( PlayerNumber pn, int iDancePoints, float fSurviveTime ) const // return true if this would be a new machine record
|
struct CourseScoreToInsert
|
||||||
{
|
|
||||||
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
|
|
||||||
{
|
|
||||||
const MachineScore& hs = m_MachineScores[GAMESTATE->m_CurStyle][i];
|
|
||||||
if( iDancePoints > hs.iDancePoints )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct MachineScoreAndPlayerNumber : public Course::MachineScore
|
|
||||||
{
|
{
|
||||||
PlayerNumber pn;
|
PlayerNumber pn;
|
||||||
|
int iDancePoints;
|
||||||
|
float fSurviveTime;
|
||||||
|
|
||||||
static int CompareDescending( const MachineScoreAndPlayerNumber &hs1, const MachineScoreAndPlayerNumber &hs2 )
|
static int CompareDescending( const CourseScoreToInsert &hs1, const CourseScoreToInsert &hs2 )
|
||||||
{
|
{
|
||||||
if( hs1.iDancePoints > hs2.iDancePoints ) return -1;
|
if( hs1.iDancePoints > hs2.iDancePoints ) return -1;
|
||||||
else if( hs1.iDancePoints == hs2.iDancePoints ) return 0;
|
else if( hs1.iDancePoints == hs2.iDancePoints ) return 0;
|
||||||
else return +1;
|
else return +1;
|
||||||
}
|
}
|
||||||
static void SortDescending( vector<MachineScoreAndPlayerNumber>& vHSout )
|
static void SortDescending( vector<CourseScoreToInsert>& vHSout )
|
||||||
{
|
{
|
||||||
sort( vHSout.begin(), vHSout.end(), CompareDescending );
|
sort( vHSout.begin(), vHSout.end(), CompareDescending );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void Course::AddMachineRecord( int iDancePoints[NUM_PLAYERS], float fSurviveTime[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ) // set iNewRecordIndex = -1 if not a new record
|
void Course::AddMachineRecords( NotesType nt, int iDancePoints[NUM_PLAYERS], float fSurviveTime[NUM_PLAYERS], int iRankingIndexOut[NUM_PLAYERS] ) // set iNewRecordIndex = -1 if not a new record
|
||||||
{
|
{
|
||||||
vector<MachineScoreAndPlayerNumber> vHS;
|
vector<CourseScoreToInsert> vHS;
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
iNewRecordIndexOut[p] = -1;
|
iRankingIndexOut[p] = -1;
|
||||||
|
|
||||||
if( !GAMESTATE->IsPlayerEnabled(p) )
|
if( !GAMESTATE->IsPlayerEnabled(p) )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
MachineScoreAndPlayerNumber hs;
|
CourseScoreToInsert hs;
|
||||||
hs.iDancePoints = iDancePoints[p];
|
hs.iDancePoints = iDancePoints[p];
|
||||||
hs.fSurviveTime = fSurviveTime[p];
|
hs.fSurviveTime = fSurviveTime[p];
|
||||||
hs.sName = ""; // this must be filled in later!
|
|
||||||
hs.pn = (PlayerNumber)p;
|
hs.pn = (PlayerNumber)p;
|
||||||
vHS.push_back( hs );
|
vHS.push_back( hs );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort descending before inserting.
|
// Sort descending before inserting.
|
||||||
// This guarantees that a high score will not switch poitions on us when we later insert scores for the other player
|
// This guarantees that a high score will not switch poitions on us when we later insert scores for the other player
|
||||||
MachineScoreAndPlayerNumber::SortDescending( vHS );
|
CourseScoreToInsert::SortDescending( vHS );
|
||||||
|
|
||||||
for( unsigned i=0; i<vHS.size(); i++ )
|
for( unsigned i=0; i<vHS.size(); i++ )
|
||||||
{
|
{
|
||||||
MachineScoreAndPlayerNumber& newHS = vHS[i];
|
CourseScoreToInsert& newHS = vHS[i];
|
||||||
MachineScore* machineScores = m_MachineScores[GAMESTATE->m_CurStyle];
|
MachineScore* machineScores = m_MachineScores[nt];
|
||||||
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
|
for( int i=0; i<NUM_RANKING_LINES; i++ )
|
||||||
{
|
{
|
||||||
if( newHS.iDancePoints > machineScores[i].iDancePoints )
|
if( newHS.iDancePoints > machineScores[i].iDancePoints )
|
||||||
{
|
{
|
||||||
// We found the insert point. Shift down.
|
// We found the insert point. Shift down.
|
||||||
for( int j=i+1; j<NUM_HIGH_SCORE_LINES; j++ )
|
for( int j=i+1; j<NUM_RANKING_LINES; j++ )
|
||||||
machineScores[j] = machineScores[j-1];
|
machineScores[j] = machineScores[j-1];
|
||||||
// insert
|
// insert
|
||||||
machineScores[i] = newHS;
|
machineScores[i].fSurviveTime = newHS.fSurviveTime;
|
||||||
iNewRecordIndexOut[newHS.pn] = i;
|
machineScores[i].iDancePoints = newHS.iDancePoints;
|
||||||
|
machineScores[i].sName = "STEP";
|
||||||
|
iRankingIndexOut[newHS.pn] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Course::AddMemCardRecord( PlayerNumber pn, int iDancePoints, float fSurviveTime ) // return true if new record
|
bool Course::AddMemCardRecord( PlayerNumber pn, NotesType nt, int iDancePoints, float fSurviveTime ) // return true if new record
|
||||||
{
|
{
|
||||||
MemCardScore& hs = m_MemCardScores[GAMESTATE->m_CurStyle][pn];
|
MemCardScore& hs = m_MemCardScores[nt][pn];
|
||||||
if( iDancePoints > hs.iDancePoints )
|
if( iDancePoints > hs.iDancePoints )
|
||||||
{
|
{
|
||||||
hs.iDancePoints = iDancePoints;
|
hs.iDancePoints = iDancePoints;
|
||||||
|
|||||||
@@ -64,18 +64,15 @@ public:
|
|||||||
int iDancePoints;
|
int iDancePoints;
|
||||||
float fSurviveTime;
|
float fSurviveTime;
|
||||||
CString sName;
|
CString sName;
|
||||||
} m_MachineScores[NUM_NOTES_TYPES][NUM_HIGH_SCORE_LINES]; // sorted highest to lowest by iDancePoints
|
} m_MachineScores[NUM_NOTES_TYPES][NUM_RANKING_LINES]; // sorted highest to lowest by iDancePoints
|
||||||
|
void AddMachineRecords( NotesType nt, int iDancePoints[NUM_PLAYERS], float fSurviveTime[NUM_PLAYERS], int iLineIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
|
||||||
bool IsNewMachineRecord( PlayerNumber pn, int iDancePoints, float fSurviveTime ) const; // return true if this is would be a new machine record
|
|
||||||
void AddMachineRecord( int iDancePoints[NUM_PLAYERS], float fSurviveTime[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
|
|
||||||
|
|
||||||
struct MemCardScore
|
struct MemCardScore
|
||||||
{
|
{
|
||||||
int iDancePoints;
|
int iDancePoints;
|
||||||
float fSurviveTime;
|
float fSurviveTime;
|
||||||
} m_MemCardScores[NUM_NOTES_TYPES][NUM_PLAYERS];
|
} m_MemCardScores[NUM_NOTES_TYPES][NUM_PLAYERS];
|
||||||
|
bool AddMemCardRecord( PlayerNumber pn, NotesType nt, int iDancePoints, float fSurviveTime ); // return true if this is a new record
|
||||||
bool AddMemCardRecord( PlayerNumber pn, int iDancePoints, float fSurviveTime ); // return true if this is a new record
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ inline int HoldNoteScoreToDancePoints( HoldNoteScore hns )
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// High Score stuff
|
// Ranking stuff
|
||||||
//
|
//
|
||||||
enum RankingCategory
|
enum RankingCategory
|
||||||
{
|
{
|
||||||
@@ -187,6 +187,7 @@ enum RankingCategory
|
|||||||
|
|
||||||
RankingCategory AverageMeterToRankingCategory( float fAverageMeter );
|
RankingCategory AverageMeterToRankingCategory( float fAverageMeter );
|
||||||
|
|
||||||
const int NUM_HIGH_SCORE_LINES = 5;
|
const int NUM_RANKING_LINES = 5;
|
||||||
|
const int MAX_RANKING_NAME_LENGTH = 4;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void GameState::Reset()
|
|||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
for( p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
m_LastRankingCategory[p] = (RankingCategory)-1;
|
m_LastRankingCategory[p] = (RankingCategory)-1;
|
||||||
m_iLastHighScoreIndex[p] = -1;
|
m_iLastRankingIndex[p] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,3 +250,16 @@ bool GameState::HasEarnedExtraStage()
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameState::GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut )
|
||||||
|
{
|
||||||
|
statsOut = StageStats();
|
||||||
|
|
||||||
|
// Show stats only for the latest 3 normal songs + passed extra stages
|
||||||
|
int iNumSongsToThrowAway = max( 0, PREFSMAN->m_iNumArcadeStages-3 );
|
||||||
|
for( unsigned i=iNumSongsToThrowAway; i<GAMESTATE->m_vPassedStageStats.size(); i++ )
|
||||||
|
{
|
||||||
|
statsOut += GAMESTATE->m_vPassedStageStats[i];
|
||||||
|
vSongsOut.push_back( GAMESTATE->m_vPassedStageStats[i].pSong );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public:
|
|||||||
vector<StageStats> m_vPassedStageStats; // Only useful in Arcade for final evaluation
|
vector<StageStats> m_vPassedStageStats; // Only useful in Arcade for final evaluation
|
||||||
// A song is only inserted here if at least one player passed.
|
// A song is only inserted here if at least one player passed.
|
||||||
// StageStats are added by the Evaluation screen
|
// StageStats are added by the Evaluation screen
|
||||||
|
void GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut ); // shown on arcade final evaluation
|
||||||
Grade GetCurrentGrade( PlayerNumber pn ); // grade so far
|
Grade GetCurrentGrade( PlayerNumber pn ); // grade so far
|
||||||
|
|
||||||
|
|
||||||
@@ -117,10 +118,11 @@ public:
|
|||||||
bool HasEarnedExtraStage();
|
bool HasEarnedExtraStage();
|
||||||
|
|
||||||
|
|
||||||
// High score stuff.
|
// Filled in by ScreenNameEntry and used by ScreenRanking to flash the recent high scores
|
||||||
// These should be set by final evaluation, and used by ScreenNameEntry and ScreenRanking
|
NotesType m_LastRankingNotesType; // meaningless if a course was played
|
||||||
RankingCategory m_LastRankingCategory[NUM_PLAYERS]; // meaningless if a course was played
|
RankingCategory m_LastRankingCategory[NUM_PLAYERS]; // meaningless if a course was played
|
||||||
int m_iLastHighScoreIndex[NUM_PLAYERS]; // -1 if no new high score
|
Course* m_pLastPlayedCourse; // meaningless if arcade was played
|
||||||
|
int m_iLastRankingIndex[NUM_PLAYERS]; // -1 if no new high score
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ void GrayArrow::Update( float fDeltaTime )
|
|||||||
int OnState = (GetNumStates() == 3)? 1: 0;
|
int OnState = (GetNumStates() == 3)? 1: 0;
|
||||||
int OffState = (GetNumStates() == 3)? 2: 1;
|
int OffState = (GetNumStates() == 3)? 2: 1;
|
||||||
|
|
||||||
if( !GAMESTATE->m_bPastHereWeGo )
|
if( !GAMESTATE->m_fSongBeat > 0 )
|
||||||
{
|
{
|
||||||
SetState( IdleState );
|
SetState( IdleState );
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -105,10 +105,10 @@ float JUDGE_Y( int l ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ScreenMessage SM_GoToSelectMusic = ScreenMessage(SM_User+1);
|
const ScreenMessage SM_GoToSelectMusic = ScreenMessage(SM_User+1);
|
||||||
const ScreenMessage SM_GoToSelectCourse = ScreenMessage(SM_User+2);
|
const ScreenMessage SM_GoToSelectCourse = ScreenMessage(SM_User+3);
|
||||||
const ScreenMessage SM_GoToFinalEvaluation = ScreenMessage(SM_User+3);
|
const ScreenMessage SM_GoToFinalEvaluation = ScreenMessage(SM_User+4);
|
||||||
const ScreenMessage SM_GoToMusicScroll = ScreenMessage(SM_User+4);
|
const ScreenMessage SM_GoToGameFinished = ScreenMessage(SM_User+5);
|
||||||
const ScreenMessage SM_PlayCheer = ScreenMessage(SM_User+5);
|
const ScreenMessage SM_PlayCheer = ScreenMessage(SM_User+6);
|
||||||
|
|
||||||
|
|
||||||
ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||||
@@ -140,15 +140,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
|||||||
switch( m_ResultMode )
|
switch( m_ResultMode )
|
||||||
{
|
{
|
||||||
case RM_ARCADE_SUMMARY:
|
case RM_ARCADE_SUMMARY:
|
||||||
{
|
GAMESTATE->GetFinalEvalStatsAndSongs( stageStats, vSongsToShow );
|
||||||
// Show stats only for the latest 3 normal songs + passed extra stages
|
|
||||||
int iNumSongsToThrowAway = max( 0, PREFSMAN->m_iNumArcadeStages-3 );
|
|
||||||
for( unsigned i=iNumSongsToThrowAway; i<GAMESTATE->m_vPassedStageStats.size(); i++ )
|
|
||||||
{
|
|
||||||
stageStats += GAMESTATE->m_vPassedStageStats[i];
|
|
||||||
vSongsToShow.push_back( GAMESTATE->m_vPassedStageStats[i].pSong );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case RM_ARCADE_STAGE:
|
case RM_ARCADE_STAGE:
|
||||||
case RM_COURSE:
|
case RM_COURSE:
|
||||||
@@ -256,7 +248,6 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
|||||||
//
|
//
|
||||||
bool bNewRecord[NUM_PLAYERS];
|
bool bNewRecord[NUM_PLAYERS];
|
||||||
memset( bNewRecord, 0, sizeof(bNewRecord) );
|
memset( bNewRecord, 0, sizeof(bNewRecord) );
|
||||||
m_bGoToNameEntry = false;
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
for( p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
if( !GAMESTATE->IsPlayerEnabled(p) || grade[p] == GRADE_E )
|
if( !GAMESTATE->IsPlayerEnabled(p) || grade[p] == GRADE_E )
|
||||||
@@ -273,16 +264,13 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
|||||||
break;
|
break;
|
||||||
case RM_ARCADE_SUMMARY:
|
case RM_ARCADE_SUMMARY:
|
||||||
{
|
{
|
||||||
float fAverageMeter = stageStats.iMeter[p] / (float)PREFSMAN->m_iNumArcadeStages; // intentional: doesn't count extra stage
|
|
||||||
RankingCategory hsc = AverageMeterToRankingCategory( fAverageMeter );
|
|
||||||
m_bGoToNameEntry |= SONGMAN->IsNewMachineRecord( hsc, stageStats.fScore[p] );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RM_COURSE:
|
case RM_COURSE:
|
||||||
{
|
{
|
||||||
Course* pCourse = GAMESTATE->m_pCurCourse;
|
Course* pCourse = GAMESTATE->m_pCurCourse;
|
||||||
pCourse->IsNewMachineRecord( (PlayerNumber)p, stageStats.iActualDancePoints[p], stageStats.fAliveSeconds[p] );
|
NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType;
|
||||||
m_bGoToNameEntry |= true;
|
pCourse->AddMemCardRecord( (PlayerNumber)p, nt, stageStats.iActualDancePoints[p], stageStats.fAliveSeconds[p] );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -758,8 +746,8 @@ void ScreenEvaluation::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
case SM_GoToSelectCourse:
|
case SM_GoToSelectCourse:
|
||||||
SCREENMAN->SetNewScreen( "ScreenSelectCourse" );
|
SCREENMAN->SetNewScreen( "ScreenSelectCourse" );
|
||||||
break;
|
break;
|
||||||
case SM_GoToMusicScroll:
|
case SM_GoToGameFinished:
|
||||||
SCREENMAN->SetNewScreen( "ScreenMusicScroll" );
|
SCREENMAN->SetNewScreen( "ScreenNameEntry" );
|
||||||
break;
|
break;
|
||||||
case SM_GoToFinalEvaluation:
|
case SM_GoToFinalEvaluation:
|
||||||
SCREENMAN->SetNewScreen( "ScreenFinalEvaluation" );
|
SCREENMAN->SetNewScreen( "ScreenFinalEvaluation" );
|
||||||
@@ -830,7 +818,7 @@ void ScreenEvaluation::MenuStart( PlayerNumber pn )
|
|||||||
else if( m_ResultMode == RM_ARCADE_STAGE && GAMESTATE->m_iCurrentStageIndex < PREFSMAN->m_iNumArcadeStages-1 )
|
else if( m_ResultMode == RM_ARCADE_STAGE && GAMESTATE->m_iCurrentStageIndex < PREFSMAN->m_iNumArcadeStages-1 )
|
||||||
m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic );
|
m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic );
|
||||||
else
|
else
|
||||||
m_Menu.TweenOffScreenToBlack( SM_GoToMusicScroll, false );
|
m_Menu.TweenOffScreenToBlack( SM_GoToGameFinished, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
GAMESTATE->m_iCurrentStageIndex++; // Increment the stage counter.
|
GAMESTATE->m_iCurrentStageIndex++; // Increment the stage counter.
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ protected:
|
|||||||
|
|
||||||
Sprite m_sprNewRecord[NUM_PLAYERS];
|
Sprite m_sprNewRecord[NUM_PLAYERS];
|
||||||
|
|
||||||
bool m_bGoToNameEntry;
|
|
||||||
|
|
||||||
bool m_bTryExtraStage;
|
bool m_bTryExtraStage;
|
||||||
Sprite m_sprTryExtraStage;
|
Sprite m_sprTryExtraStage;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ ScreenNameEntry::ScreenNameEntry()
|
|||||||
{
|
{
|
||||||
LOG->Trace( "ScreenNameEntry::ScreenNameEntry()" );
|
LOG->Trace( "ScreenNameEntry::ScreenNameEntry()" );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// update cache
|
// update cache
|
||||||
g_fCharsZoomSmall = CHARS_ZOOM_SMALL;
|
g_fCharsZoomSmall = CHARS_ZOOM_SMALL;
|
||||||
g_fCharsZoomLarge = CHARS_ZOOM_LARGE;
|
g_fCharsZoomLarge = CHARS_ZOOM_LARGE;
|
||||||
@@ -103,6 +105,7 @@ ScreenNameEntry::ScreenNameEntry()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// DEBUGGING STUFF
|
// DEBUGGING STUFF
|
||||||
// GAMESTATE->m_CurGame = GAME_DANCE;
|
// GAMESTATE->m_CurGame = GAME_DANCE;
|
||||||
// GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE;
|
// GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE;
|
||||||
@@ -110,11 +113,71 @@ ScreenNameEntry::ScreenNameEntry()
|
|||||||
// GAMESTATE->m_bSideIsJoined[PLAYER_1] = true;
|
// GAMESTATE->m_bSideIsJoined[PLAYER_1] = true;
|
||||||
// GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
// GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
||||||
// GAMESTATE->m_LastRankingCategory[PLAYER_1] = RANKING_A;
|
// GAMESTATE->m_LastRankingCategory[PLAYER_1] = RANKING_A;
|
||||||
// GAMESTATE->m_iLastHighScoreIndex[PLAYER_1] = 0;
|
// GAMESTATE->m_iLastRankingIndex[PLAYER_1] = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Find out if any of the players deserve to enter their name
|
||||||
|
switch( GAMESTATE->m_PlayMode )
|
||||||
|
{
|
||||||
|
case PLAY_MODE_ARCADE:
|
||||||
|
{
|
||||||
|
StageStats stageStats;
|
||||||
|
vector<Song*> vSongs;
|
||||||
|
GAMESTATE->GetFinalEvalStatsAndSongs( stageStats, vSongs );
|
||||||
|
|
||||||
|
float fAverageMeter[NUM_PLAYERS];
|
||||||
|
RankingCategory cat[NUM_PLAYERS];
|
||||||
|
float fScore[NUM_PLAYERS];
|
||||||
|
int iRankingIndex[NUM_PLAYERS];
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
{
|
||||||
|
fAverageMeter[p] = stageStats.iMeter[p] / (float)PREFSMAN->m_iNumArcadeStages;
|
||||||
|
cat[p] = AverageMeterToRankingCategory( fAverageMeter[p] );
|
||||||
|
fScore[p] = stageStats.fScore[p];
|
||||||
|
}
|
||||||
|
|
||||||
|
NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType;
|
||||||
|
SONGMAN->AddMachineRecords( nt, cat, fScore, iRankingIndex );
|
||||||
|
|
||||||
|
GAMESTATE->m_LastRankingNotesType = nt;
|
||||||
|
COPY( GAMESTATE->m_LastRankingCategory, cat );
|
||||||
|
COPY( GAMESTATE->m_iLastRankingIndex, iRankingIndex );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PLAY_MODE_NONSTOP:
|
||||||
|
case PLAY_MODE_ONI:
|
||||||
|
case PLAY_MODE_ENDLESS:
|
||||||
|
{
|
||||||
|
StageStats stageStats;
|
||||||
|
vector<Song*> vSongs;
|
||||||
|
GAMESTATE->GetFinalEvalStatsAndSongs( stageStats, vSongs );
|
||||||
|
|
||||||
|
Course* pCourse = GAMESTATE->m_pCurCourse;
|
||||||
|
|
||||||
|
int iDancePoints[NUM_PLAYERS];
|
||||||
|
float fAliveSeconds[NUM_PLAYERS];
|
||||||
|
int iRankingIndex[NUM_PLAYERS];
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
{
|
||||||
|
iDancePoints[p] = stageStats.iActualDancePoints[p];
|
||||||
|
fAliveSeconds[p] = stageStats.fAliveSeconds[p];
|
||||||
|
}
|
||||||
|
|
||||||
|
NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType;
|
||||||
|
pCourse->AddMachineRecords( nt, iDancePoints, fAliveSeconds, iRankingIndex );
|
||||||
|
|
||||||
|
GAMESTATE->m_LastRankingNotesType = nt;
|
||||||
|
GAMESTATE->m_pLastPlayedCourse = pCourse;
|
||||||
|
COPY( GAMESTATE->m_iLastRankingIndex, iRankingIndex );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GAMESTATE->m_bPastHereWeGo = true; // enable the gray arrows
|
GAMESTATE->m_bPastHereWeGo = true; // enable the gray arrows
|
||||||
|
|
||||||
m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations","name entry") );
|
m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations","name entry") );
|
||||||
@@ -122,8 +185,10 @@ ScreenNameEntry::ScreenNameEntry()
|
|||||||
|
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
bool bNewHighScore = GAMESTATE->m_iLastHighScoreIndex[p] != -1;
|
bool bNewHighScore = GAMESTATE->m_iLastRankingIndex[p] != -1;
|
||||||
m_bConfirmedName[p] = !bNewHighScore; // false if they made a new high score
|
m_bStillEnteringName[p] = bNewHighScore; // false if they made a new high score
|
||||||
|
for( int i=0; i<MAX_RANKING_NAME_LENGTH; i++ )
|
||||||
|
m_sSelectedName[p] += ' ';
|
||||||
|
|
||||||
if( !bNewHighScore )
|
if( !bNewHighScore )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
@@ -158,7 +223,7 @@ ScreenNameEntry::ScreenNameEntry()
|
|||||||
m_textCategory[p].LoadFromFont( THEME->GetPathTo("Fonts","header2") );
|
m_textCategory[p].LoadFromFont( THEME->GetPathTo("Fonts","header2") );
|
||||||
m_textCategory[p].SetX( (float)GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] );
|
m_textCategory[p].SetX( (float)GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] );
|
||||||
m_textCategory[p].SetY( CATEGORY_Y );
|
m_textCategory[p].SetY( CATEGORY_Y );
|
||||||
CString sCategoryText = ssprintf("No. %d", GAMESTATE->m_iLastHighScoreIndex[p]+1);
|
CString sCategoryText = ssprintf("No. %d", GAMESTATE->m_iLastRankingIndex[p]+1);
|
||||||
switch( GAMESTATE->m_PlayMode )
|
switch( GAMESTATE->m_PlayMode )
|
||||||
{
|
{
|
||||||
case PLAY_MODE_ARCADE:
|
case PLAY_MODE_ARCADE:
|
||||||
@@ -176,6 +241,19 @@ ScreenNameEntry::ScreenNameEntry()
|
|||||||
this->AddChild( &m_textCategory[p] );
|
this->AddChild( &m_textCategory[p] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool bAnyStillEntering = false;
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
bAnyStillEntering |= m_bStillEnteringName[p];
|
||||||
|
if( !bAnyStillEntering )
|
||||||
|
{
|
||||||
|
this->SendScreenMessage( SM_GoToNextScreen, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_Timer.SetTimer(TIMER_SECONDS);
|
m_Timer.SetTimer(TIMER_SECONDS);
|
||||||
m_Timer.SetXY( TIMER_X, TIMER_Y );
|
m_Timer.SetXY( TIMER_X, TIMER_Y );
|
||||||
this->AddChild( &m_Timer );
|
this->AddChild( &m_Timer );
|
||||||
@@ -217,8 +295,8 @@ void ScreenNameEntry::DrawPrimitives()
|
|||||||
|
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
if( m_bConfirmedName[p] )
|
if( !m_bStillEnteringName[p] )
|
||||||
continue; // don't draw scrolling arrows. They already confirmed.
|
continue; // don't draw scrolling arrows
|
||||||
|
|
||||||
float fY = GRAY_ARROWS_Y + GetClosestCharYPos(m_fFakeBeat) - g_iNumCharsToDrawBehind*g_fCharsSpacingY;
|
float fY = GRAY_ARROWS_Y + GetClosestCharYPos(m_fFakeBeat) - g_iNumCharsToDrawBehind*g_fCharsSpacingY;
|
||||||
int iCharIndex = iStartDrawingIndex % NUM_NAME_CHARS;
|
int iCharIndex = iStartDrawingIndex % NUM_NAME_CHARS;
|
||||||
@@ -267,29 +345,14 @@ void ScreenNameEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if( StyleI.IsValid() )
|
if( StyleI.IsValid() )
|
||||||
|
{
|
||||||
|
if( StyleI.col < MAX_RANKING_NAME_LENGTH )
|
||||||
{
|
{
|
||||||
m_GrayArrowRow[StyleI.player].Step( StyleI.col );
|
m_GrayArrowRow[StyleI.player].Step( StyleI.col );
|
||||||
m_soundStep.Play();
|
m_soundStep.Play();
|
||||||
char c = NAME_CHARS[GetClosestCharIndex(m_fFakeBeat)];
|
char c = NAME_CHARS[GetClosestCharIndex(m_fFakeBeat)];
|
||||||
m_textSelectedChars[StyleI.player][StyleI.col].SetText( ssprintf("%c",c) );
|
m_textSelectedChars[StyleI.player][StyleI.col].SetText( ssprintf("%c",c) );
|
||||||
}
|
m_sSelectedName[StyleI.player][StyleI.col] = c;
|
||||||
|
|
||||||
if( MenuI.IsValid() )
|
|
||||||
{
|
|
||||||
if( MenuI.button == MENU_BUTTON_START )
|
|
||||||
{
|
|
||||||
m_soundStep.Play();
|
|
||||||
|
|
||||||
m_bConfirmedName[MenuI.player] = true;
|
|
||||||
|
|
||||||
bool bAllConfirmed = true;
|
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
||||||
bAllConfirmed &= m_bConfirmedName[p];
|
|
||||||
if( bAllConfirmed )
|
|
||||||
{
|
|
||||||
if( !m_Fade.IsClosing() )
|
|
||||||
m_Fade.CloseWipingRight( SM_GoToNextScreen );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,10 +365,52 @@ void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
case SM_MenuTimer:
|
case SM_MenuTimer:
|
||||||
if( !m_Fade.IsClosing() )
|
if( !m_Fade.IsClosing() )
|
||||||
|
{
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
this->MenuStart( (PlayerNumber)p );
|
||||||
m_Fade.CloseWipingRight( SM_GoToNextScreen );
|
m_Fade.CloseWipingRight( SM_GoToNextScreen );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SM_GoToNextScreen:
|
case SM_GoToNextScreen:
|
||||||
SCREENMAN->SetNewScreen( "ScreenMusicScroll" );
|
SCREENMAN->SetNewScreen( "ScreenMusicScroll" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ScreenNameEntry::MenuStart( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
if( m_bStillEnteringName[pn] )
|
||||||
|
{
|
||||||
|
m_soundStep.Play();
|
||||||
|
|
||||||
|
m_bStillEnteringName[pn] = false;
|
||||||
|
|
||||||
|
TrimRight( m_sSelectedName[pn], " " );
|
||||||
|
TrimLeft( m_sSelectedName[pn], " " );
|
||||||
|
|
||||||
|
if( m_sSelectedName[pn] == "" )
|
||||||
|
m_sSelectedName[pn] = "STEP";
|
||||||
|
|
||||||
|
|
||||||
|
switch( GAMESTATE->m_PlayMode )
|
||||||
|
{
|
||||||
|
case PLAY_MODE_ARCADE:
|
||||||
|
SONGMAN->m_MachineScores[GAMESTATE->m_LastRankingNotesType][GAMESTATE->m_LastRankingCategory[pn]][GAMESTATE->m_iLastRankingIndex[pn]].sName = m_sSelectedName[pn];
|
||||||
|
break;
|
||||||
|
case PLAY_MODE_NONSTOP:
|
||||||
|
case PLAY_MODE_ONI:
|
||||||
|
case PLAY_MODE_ENDLESS:
|
||||||
|
GAMESTATE->m_pLastPlayedCourse->m_MachineScores[GAMESTATE->m_LastRankingNotesType][GAMESTATE->m_iLastRankingIndex[pn]].sName = m_sSelectedName[pn];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool bAnyStillEntering = false;
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
bAnyStillEntering |= m_bStillEnteringName[p];
|
||||||
|
if( !bAnyStillEntering && !m_Fade.IsClosing() )
|
||||||
|
m_Fade.CloseWipingRight( SM_GoToNextScreen );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include "RandomSample.h"
|
#include "RandomSample.h"
|
||||||
#include "GrayArrowRow.h"
|
#include "GrayArrowRow.h"
|
||||||
|
|
||||||
const int MAX_COLS_IN_NAME_ENTRY = 12;
|
|
||||||
|
|
||||||
class ScreenNameEntry : public Screen
|
class ScreenNameEntry : public Screen
|
||||||
{
|
{
|
||||||
@@ -29,13 +28,15 @@ public:
|
|||||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
|
virtual void MenuStart( PlayerNumber pn );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
BGAnimation m_Background;
|
BGAnimation m_Background;
|
||||||
|
|
||||||
GrayArrowRow m_GrayArrowRow[NUM_PLAYERS];
|
GrayArrowRow m_GrayArrowRow[NUM_PLAYERS];
|
||||||
BitmapText m_textSelectedChars[NUM_PLAYERS][MAX_COLS_IN_NAME_ENTRY];
|
BitmapText m_textSelectedChars[NUM_PLAYERS][MAX_RANKING_NAME_LENGTH];
|
||||||
BitmapText m_textScrollingChars[NUM_PLAYERS][MAX_COLS_IN_NAME_ENTRY];
|
BitmapText m_textScrollingChars[NUM_PLAYERS][MAX_RANKING_NAME_LENGTH];
|
||||||
BitmapText m_textCategory[NUM_PLAYERS];
|
BitmapText m_textCategory[NUM_PLAYERS];
|
||||||
MenuTimer m_Timer;
|
MenuTimer m_Timer;
|
||||||
|
|
||||||
@@ -44,7 +45,8 @@ private:
|
|||||||
RageSound m_soundStep;
|
RageSound m_soundStep;
|
||||||
|
|
||||||
float m_fFakeBeat;
|
float m_fFakeBeat;
|
||||||
bool m_bConfirmedName[NUM_PLAYERS];
|
CString m_sSelectedName[NUM_PLAYERS];
|
||||||
|
bool m_bStillEnteringName[NUM_PLAYERS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking")
|
|||||||
m_textType.SetXY( TYPE_X, TYPE_Y );
|
m_textType.SetXY( TYPE_X, TYPE_Y );
|
||||||
this->AddChild( &m_textType );
|
this->AddChild( &m_textType );
|
||||||
|
|
||||||
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
|
for( int i=0; i<NUM_RANKING_LINES; i++ )
|
||||||
{
|
{
|
||||||
m_sprBullets[i].Load( THEME->GetPathTo("Graphics",("ranking bullets 1x5")) );
|
m_sprBullets[i].Load( THEME->GetPathTo("Graphics",("ranking bullets 1x5")) );
|
||||||
m_sprBullets[i].SetXY( BULLETS_START_X+LINE_SPACING_X*i, BULLETS_START_Y+LINE_SPACING_Y*i );
|
m_sprBullets[i].SetXY( BULLETS_START_X+LINE_SPACING_X*i, BULLETS_START_Y+LINE_SPACING_Y*i );
|
||||||
@@ -69,6 +69,7 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking")
|
|||||||
m_textNames[i].SetXY( NAMES_START_X+LINE_SPACING_X*i, NAMES_START_Y+LINE_SPACING_Y*i );
|
m_textNames[i].SetXY( NAMES_START_X+LINE_SPACING_X*i, NAMES_START_Y+LINE_SPACING_Y*i );
|
||||||
m_textNames[i].SetZoom( NAMES_ZOOM );
|
m_textNames[i].SetZoom( NAMES_ZOOM );
|
||||||
m_textNames[i].SetDiffuse( NAMES_COLOR );
|
m_textNames[i].SetDiffuse( NAMES_COLOR );
|
||||||
|
m_textNames[i].SetHorizAlign( Actor::align_left );
|
||||||
this->AddChild( &m_textNames[i] );
|
this->AddChild( &m_textNames[i] );
|
||||||
|
|
||||||
m_textScores[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") );
|
m_textScores[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") );
|
||||||
@@ -76,6 +77,7 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking")
|
|||||||
m_textScores[i].SetXY( SCORES_START_X+LINE_SPACING_X*i, SCORES_START_Y+LINE_SPACING_Y*i );
|
m_textScores[i].SetXY( SCORES_START_X+LINE_SPACING_X*i, SCORES_START_Y+LINE_SPACING_Y*i );
|
||||||
m_textScores[i].SetZoom( SCORES_ZOOM );
|
m_textScores[i].SetZoom( SCORES_ZOOM );
|
||||||
m_textScores[i].SetDiffuse( SCORES_COLOR );
|
m_textScores[i].SetDiffuse( SCORES_COLOR );
|
||||||
|
m_textScores[i].SetHorizAlign( Actor::align_right );
|
||||||
this->AddChild( &m_textScores[i] );
|
this->AddChild( &m_textScores[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,12 +179,29 @@ void ScreenRanking::SetPage( PageToShow pts )
|
|||||||
{
|
{
|
||||||
m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) );
|
m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) );
|
||||||
m_textType.SetText( GameManager::NotesTypeToString(pts.nt) );
|
m_textType.SetText( GameManager::NotesTypeToString(pts.nt) );
|
||||||
for( int l=0; l<NUM_HIGH_SCORE_LINES; l++ )
|
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
||||||
{
|
{
|
||||||
CString sName = SONGMAN->m_MachineScores[pts.nt][pts.category][l].sName;
|
CString sName = SONGMAN->m_MachineScores[pts.nt][pts.category][l].sName;
|
||||||
float fScore = SONGMAN->m_MachineScores[pts.nt][pts.category][l].fScore;
|
float fScore = SONGMAN->m_MachineScores[pts.nt][pts.category][l].fScore;
|
||||||
m_textNames[l].SetText( sName );
|
m_textNames[l].SetText( sName );
|
||||||
m_textScores[l].SetText( ssprintf("%.0f",fScore) );
|
m_textScores[l].SetText( ssprintf("%.0f",fScore) );
|
||||||
|
m_textNames[l].SetDiffuse( NAMES_COLOR );
|
||||||
|
m_textScores[l].SetDiffuse( SCORES_COLOR );
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
{
|
||||||
|
if( pts.nt == GAMESTATE->m_LastRankingNotesType &&
|
||||||
|
GAMESTATE->m_LastRankingCategory[p] == pts.category &&
|
||||||
|
GAMESTATE->m_iLastRankingIndex[p] == l )
|
||||||
|
{
|
||||||
|
m_textNames[l].SetEffectBlinking();
|
||||||
|
m_textScores[l].SetEffectBlinking();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_textNames[l].SetEffectNone();
|
||||||
|
m_textScores[l].SetEffectNone();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -190,12 +209,29 @@ void ScreenRanking::SetPage( PageToShow pts )
|
|||||||
{
|
{
|
||||||
m_textCategory.SetText( pts.pCourse->m_sName );
|
m_textCategory.SetText( pts.pCourse->m_sName );
|
||||||
m_textType.SetText( GameManager::NotesTypeToString(pts.nt) );
|
m_textType.SetText( GameManager::NotesTypeToString(pts.nt) );
|
||||||
for( int l=0; l<NUM_HIGH_SCORE_LINES; l++ )
|
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
||||||
{
|
{
|
||||||
CString sName = pts.pCourse->m_MachineScores[pts.nt][l].sName;
|
CString sName = pts.pCourse->m_MachineScores[pts.nt][l].sName;
|
||||||
int iDancePoints = pts.pCourse->m_MachineScores[pts.nt][l].iDancePoints;
|
int iDancePoints = pts.pCourse->m_MachineScores[pts.nt][l].iDancePoints;
|
||||||
m_textNames[l].SetText( sName );
|
m_textNames[l].SetText( sName );
|
||||||
m_textScores[l].SetText( ssprintf("%d",iDancePoints) );
|
m_textScores[l].SetText( ssprintf("%d",iDancePoints) );
|
||||||
|
m_textNames[l].SetDiffuse( NAMES_COLOR );
|
||||||
|
m_textScores[l].SetDiffuse( SCORES_COLOR );
|
||||||
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
{
|
||||||
|
if( pts.pCourse == GAMESTATE->m_pLastPlayedCourse &&
|
||||||
|
pts.nt == GAMESTATE->m_LastRankingNotesType &&
|
||||||
|
GAMESTATE->m_iLastRankingIndex[p] == l )
|
||||||
|
{
|
||||||
|
m_textNames[l].SetEffectBlinking();
|
||||||
|
m_textScores[l].SetEffectBlinking();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_textNames[l].SetEffectNone();
|
||||||
|
m_textScores[l].SetEffectNone();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -211,7 +247,7 @@ void ScreenRanking::TweenPageOnScreen()
|
|||||||
m_textType.SetDiffuse( RageColor(1,1,1,1) );
|
m_textType.SetDiffuse( RageColor(1,1,1,1) );
|
||||||
m_textType.FadeOn(0.1f,"bounce right",0.5f);
|
m_textType.FadeOn(0.1f,"bounce right",0.5f);
|
||||||
|
|
||||||
for( int l=0; l<NUM_HIGH_SCORE_LINES; l++ )
|
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
||||||
{
|
{
|
||||||
m_sprBullets[l].SetDiffuse( RageColor(1,1,1,1) );
|
m_sprBullets[l].SetDiffuse( RageColor(1,1,1,1) );
|
||||||
m_sprBullets[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
|
m_sprBullets[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
|
||||||
@@ -227,7 +263,7 @@ void ScreenRanking::TweenPageOffScreen()
|
|||||||
m_textCategory.FadeOff(0,"fade",0.25f);
|
m_textCategory.FadeOff(0,"fade",0.25f);
|
||||||
m_textType.FadeOff(0.1f,"fade",0.25f);
|
m_textType.FadeOff(0.1f,"fade",0.25f);
|
||||||
|
|
||||||
for( int l=0; l<NUM_HIGH_SCORE_LINES; l++ )
|
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
||||||
{
|
{
|
||||||
m_sprBullets[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
m_sprBullets[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
||||||
m_textNames[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
m_textNames[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ScreenAttract.h"
|
#include "ScreenAttract.h"
|
||||||
#include "GameConstantsAndTypes.h" // for NUM_HIGH_SCORE_LINES
|
#include "GameConstantsAndTypes.h" // for NUM_RANKING_LINES
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -40,9 +40,9 @@ protected:
|
|||||||
|
|
||||||
BitmapText m_textCategory;
|
BitmapText m_textCategory;
|
||||||
BitmapText m_textType;
|
BitmapText m_textType;
|
||||||
Sprite m_sprBullets[NUM_HIGH_SCORE_LINES];
|
Sprite m_sprBullets[NUM_RANKING_LINES];
|
||||||
BitmapText m_textNames[NUM_HIGH_SCORE_LINES];
|
BitmapText m_textNames[NUM_RANKING_LINES];
|
||||||
BitmapText m_textScores[NUM_HIGH_SCORE_LINES];
|
BitmapText m_textScores[NUM_RANKING_LINES];
|
||||||
|
|
||||||
vector<PageToShow> m_vPagesToShow;
|
vector<PageToShow> m_vPagesToShow;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ void SongManager::InitMachineScoresFromDisk()
|
|||||||
{
|
{
|
||||||
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
||||||
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
||||||
for( int k=0; k<NUM_HIGH_SCORE_LINES; k++ )
|
for( int k=0; k<NUM_RANKING_LINES; k++ )
|
||||||
{
|
{
|
||||||
m_MachineScores[i][j][k].fScore = 573000;
|
m_MachineScores[i][j][k].fScore = 573000;
|
||||||
m_MachineScores[i][j][k].sName = "STEP";
|
m_MachineScores[i][j][k].sName = "STEP";
|
||||||
@@ -228,7 +228,7 @@ void SongManager::InitMachineScoresFromDisk()
|
|||||||
{
|
{
|
||||||
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
||||||
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
||||||
for( int k=0; k<NUM_HIGH_SCORE_LINES; k++ )
|
for( int k=0; k<NUM_RANKING_LINES; k++ )
|
||||||
if( fp && !feof(fp) )
|
if( fp && !feof(fp) )
|
||||||
{
|
{
|
||||||
char szName[256];
|
char szName[256];
|
||||||
@@ -257,7 +257,7 @@ void SongManager::InitMachineScoresFromDisk()
|
|||||||
Course* pCourse = GetCourseFromPath( szPath );
|
Course* pCourse = GetCourseFromPath( szPath );
|
||||||
|
|
||||||
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
||||||
for( int j=0; j<NUM_HIGH_SCORE_LINES; j++ )
|
for( int j=0; j<NUM_RANKING_LINES; j++ )
|
||||||
if( fp && !feof(fp) )
|
if( fp && !feof(fp) )
|
||||||
{
|
{
|
||||||
int iDancePoints;
|
int iDancePoints;
|
||||||
@@ -288,7 +288,7 @@ void SongManager::SaveMachineScoresToDisk()
|
|||||||
fprintf(fp,"%d",CATEGORY_TOP_SCORE_VERSION);
|
fprintf(fp,"%d",CATEGORY_TOP_SCORE_VERSION);
|
||||||
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
||||||
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
||||||
for( int k=0; k<NUM_HIGH_SCORE_LINES; k++ )
|
for( int k=0; k<NUM_RANKING_LINES; k++ )
|
||||||
if( fp )
|
if( fp )
|
||||||
fprintf(fp, "%f %s\n", m_MachineScores[i][j][k].fScore, m_MachineScores[i][j][k].sName.c_str());
|
fprintf(fp, "%f %s\n", m_MachineScores[i][j][k].fScore, m_MachineScores[i][j][k].sName.c_str());
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -309,7 +309,7 @@ void SongManager::SaveMachineScoresToDisk()
|
|||||||
fprintf(fp, "%s\n", pCourse->m_sPath.c_str());
|
fprintf(fp, "%s\n", pCourse->m_sPath.c_str());
|
||||||
|
|
||||||
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
||||||
for( int j=0; j<NUM_HIGH_SCORE_LINES; j++ )
|
for( int j=0; j<NUM_RANKING_LINES; j++ )
|
||||||
fprintf(fp, "%d %f %s\n",
|
fprintf(fp, "%d %f %s\n",
|
||||||
pCourse->m_MachineScores[i][j].iDancePoints,
|
pCourse->m_MachineScores[i][j].iDancePoints,
|
||||||
pCourse->m_MachineScores[i][j].fSurviveTime,
|
pCourse->m_MachineScores[i][j].fSurviveTime,
|
||||||
@@ -630,36 +630,27 @@ bool SongManager::IsUsingMemoryCard( PlayerNumber pn )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SongManager::IsNewMachineRecord( RankingCategory hsc, float fScore ) const // return true if this is would be a new machine record
|
struct CategoryScoreToInsert
|
||||||
{
|
|
||||||
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
|
|
||||||
{
|
|
||||||
const MachineScore& hs = m_MachineScores[GAMESTATE->m_CurStyle][hsc][i];
|
|
||||||
if( fScore > hs.fScore )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct MachineScoreAndPlayerNumber : public SongManager::MachineScore
|
|
||||||
{
|
{
|
||||||
PlayerNumber pn;
|
PlayerNumber pn;
|
||||||
|
RankingCategory cat;
|
||||||
|
float fScore;
|
||||||
|
|
||||||
static int CompareDescending( const MachineScoreAndPlayerNumber &hs1, const MachineScoreAndPlayerNumber &hs2 )
|
static int CompareDescending( const CategoryScoreToInsert &hs1, const CategoryScoreToInsert &hs2 )
|
||||||
{
|
{
|
||||||
if( hs1.fScore > hs2.fScore ) return -1;
|
if( hs1.fScore > hs2.fScore ) return -1;
|
||||||
else if( hs1.fScore == hs2.fScore ) return 0;
|
else if( hs1.fScore == hs2.fScore ) return 0;
|
||||||
else return +1;
|
else return +1;
|
||||||
}
|
}
|
||||||
static void SortDescending( vector<MachineScoreAndPlayerNumber>& vHSout )
|
static void SortDescending( vector<CategoryScoreToInsert>& vHSout )
|
||||||
{
|
{
|
||||||
sort( vHSout.begin(), vHSout.end(), CompareDescending );
|
sort( vHSout.begin(), vHSout.end(), CompareDescending );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void SongManager::AddMachineRecord( RankingCategory hsc, float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ) // set iNewRecordIndex = -1 if not a new record
|
void SongManager::AddMachineRecords( NotesType nt, RankingCategory hsc[NUM_PLAYERS], float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ) // set iNewRecordIndex = -1 if not a new record
|
||||||
{
|
{
|
||||||
vector<MachineScoreAndPlayerNumber> vHS;
|
vector<CategoryScoreToInsert> vHS;
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
iNewRecordIndexOut[p] = -1;
|
iNewRecordIndexOut[p] = -1;
|
||||||
@@ -667,31 +658,33 @@ void SongManager::AddMachineRecord( RankingCategory hsc, float fScore[NUM_PLAYER
|
|||||||
if( !GAMESTATE->IsPlayerEnabled(p) )
|
if( !GAMESTATE->IsPlayerEnabled(p) )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
MachineScoreAndPlayerNumber hs;
|
CategoryScoreToInsert hs;
|
||||||
hs.fScore = fScore[p];
|
|
||||||
hs.sName = ""; // this must be filled in later!
|
|
||||||
hs.pn = (PlayerNumber)p;
|
hs.pn = (PlayerNumber)p;
|
||||||
|
hs.cat = hsc[p];
|
||||||
|
hs.fScore = fScore[p];
|
||||||
vHS.push_back( hs );
|
vHS.push_back( hs );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort descending before inserting.
|
// Sort descending before inserting.
|
||||||
// This guarantees that a high score will not switch poitions on us when we later insert scores for the other player
|
// This guarantees that a high score will not switch poitions on us when we later insert scores for the other player
|
||||||
MachineScoreAndPlayerNumber::SortDescending( vHS );
|
CategoryScoreToInsert::SortDescending( vHS );
|
||||||
|
|
||||||
for( unsigned i=0; i<vHS.size(); i++ )
|
for( unsigned i=0; i<vHS.size(); i++ )
|
||||||
{
|
{
|
||||||
MachineScoreAndPlayerNumber& newHS = vHS[i];
|
CategoryScoreToInsert& newHS = vHS[i];
|
||||||
MachineScore* machineScores = m_MachineScores[GAMESTATE->m_CurStyle][GAMESTATE->m_PreferredDifficulty[newHS.pn]];
|
MachineScore* machineScores = m_MachineScores[nt][newHS.cat];
|
||||||
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
|
for( int i=0; i<NUM_RANKING_LINES; i++ )
|
||||||
{
|
{
|
||||||
if( newHS.fScore > machineScores[i].fScore )
|
if( newHS.fScore > machineScores[i].fScore )
|
||||||
{
|
{
|
||||||
// We found the insert point. Shift down.
|
// We found the insert point. Shift down.
|
||||||
for( int j=i+1; j<NUM_HIGH_SCORE_LINES; j++ )
|
for( int j=i+1; j<NUM_RANKING_LINES; j++ )
|
||||||
machineScores[j] = machineScores[j-1];
|
machineScores[j] = machineScores[j-1];
|
||||||
// insert
|
// insert
|
||||||
machineScores[i] = newHS;
|
machineScores[i].fScore = newHS.fScore;
|
||||||
|
machineScores[i].sName = "STEP";
|
||||||
iNewRecordIndexOut[newHS.pn] = i;
|
iNewRecordIndexOut[newHS.pn] = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,10 +84,8 @@ public:
|
|||||||
{
|
{
|
||||||
float fScore;
|
float fScore;
|
||||||
CString sName;
|
CString sName;
|
||||||
} m_MachineScores[NUM_NOTES_TYPES][NUM_RANKING_CATEGORIES][NUM_HIGH_SCORE_LINES];
|
} m_MachineScores[NUM_NOTES_TYPES][NUM_RANKING_CATEGORIES][NUM_RANKING_LINES];
|
||||||
|
void AddMachineRecords( NotesType nt, RankingCategory hsc[NUM_PLAYERS], float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
|
||||||
bool IsNewMachineRecord( RankingCategory hsc, float fScore ) const; // return true if this is would be a new machine record
|
|
||||||
void AddMachineRecord( RankingCategory hsc, float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void LoadStepManiaSongDir( CString sDir, LoadingWindow *ld );
|
void LoadStepManiaSongDir( CString sDir, LoadingWindow *ld );
|
||||||
|
|||||||
Reference in New Issue
Block a user