grading error fixes, ranking calculation and display fixes, set default difficulty back to same level as 3.0 final

This commit is contained in:
Chris Danford
2003-02-03 05:53:59 +00:00
parent f34705a495
commit d12e090808
23 changed files with 182 additions and 113 deletions
+3 -2
View File
@@ -358,7 +358,7 @@ StatusIconsX=320
StatusIconsY=400 StatusIconsY=400
SecondsBetweenComments=10 SecondsBetweenComments=10
DemonstrationSeconds=30 DemonstrationSeconds=30
TickEarlySeconds=0.058 TickEarlySeconds=0.05
[ScreenEvaluation] [ScreenEvaluation]
SongSelectScreen=ScreenSelectMusic SongSelectScreen=ScreenSelectMusic
@@ -450,6 +450,7 @@ GradesGlowColor2=1,1,1,0.3
ScrollDelay=0.2 ScrollDelay=0.2
ScrollSpeed=1.0 ScrollSpeed=1.0
TextZoom=0.8 TextZoom=0.8
NextScreen=ScreenRanking
[ScreenEditMenu] [ScreenEditMenu]
ExplanationX=320 ExplanationX=320
@@ -813,7 +814,7 @@ VersionX=590
VersionY=20 VersionY=20
SongsX=20 SongsX=20
SongsY=20 SongsY=20
SecondsToShow=5 SecondsToShow=10
NextScreen=ScreenDemonstration NextScreen=ScreenDemonstration
[ScreenDemonstration] [ScreenDemonstration]
+1 -2
View File
@@ -41,8 +41,6 @@ float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat )
*/ */
/* Boost and wave can no longer be used at the same time. -Chris */ /* Boost and wave can no longer be used at the same time. -Chris */
if( fYOffset < 0 )
return fYOffset; // don't mess with it after crossing the receptors
switch( GAMESTATE->m_PlayerOptions[pn].m_AccelType ) switch( GAMESTATE->m_PlayerOptions[pn].m_AccelType )
{ {
@@ -50,6 +48,7 @@ float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat )
fYOffset *= 1.5f / ((fYOffset+SCREEN_HEIGHT/1.2f)/SCREEN_HEIGHT); fYOffset *= 1.5f / ((fYOffset+SCREEN_HEIGHT/1.2f)/SCREEN_HEIGHT);
break; break;
case PlayerOptions::ACCEL_LAND: case PlayerOptions::ACCEL_LAND:
if( fYOffset > 0 ) // speed the arrows back to normal after they cross 0
fYOffset *= SCALE( fYOffset, 0.f, SCREEN_HEIGHT, 0.25f, 1.5f ); fYOffset *= SCALE( fYOffset, 0.f, SCREEN_HEIGHT, 0.25f, 1.5f );
break; break;
case PlayerOptions::ACCEL_WAVE: case PlayerOptions::ACCEL_WAVE:
+7 -43
View File
@@ -43,6 +43,8 @@ GameState::GameState()
m_CurGame = GAME_DANCE; m_CurGame = GAME_DANCE;
m_iCoins = 0; m_iCoins = 0;
Reset(); Reset();
ResetLastRanking();
} }
GameState::~GameState() GameState::~GameState()
@@ -83,8 +85,11 @@ void GameState::Reset()
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
m_PlayerOptions[p] = PlayerOptions(); m_PlayerOptions[p] = PlayerOptions();
m_SongOptions = SongOptions(); m_SongOptions = SongOptions();
}
for( p=0; p<NUM_PLAYERS; p++ ) void GameState::ResetLastRanking()
{
for( int p=0; p<NUM_PLAYERS; p++ )
{ {
m_LastRankingCategory[p] = (RankingCategory)-1; m_LastRankingCategory[p] = (RankingCategory)-1;
m_iLastRankingIndex[p] = -1; m_iLastRankingIndex[p] = -1;
@@ -197,47 +202,6 @@ bool GameState::IsPlayerEnabled( PlayerNumber pn )
} }
} }
Grade GameState::GetCurrentGrade( PlayerNumber pn )
{
ASSERT( GAMESTATE->IsPlayerEnabled(pn) ); // should be calling this is player isn't joined!
if( m_CurStageStats.bFailed[pn] )
return GRADE_E;
/* Based on the percentage of your total "Dance Points" to the maximum
* possible number, the following rank is assigned:
*
* 100% - AAA
* 93% - AA
* 80% - A
* 65% - B
* 45% - C
* Less - D
* Fail - E
*/
float fPercentDancePoints = m_CurStageStats.iActualDancePoints[pn] / (float)m_CurStageStats.iPossibleDancePoints[pn];
fPercentDancePoints = max( 0, fPercentDancePoints );
LOG->Trace( "iActualDancePoints: %i", m_CurStageStats.iActualDancePoints[pn] );
LOG->Trace( "iPossibleDancePoints: %i", m_CurStageStats.iPossibleDancePoints[pn] );
LOG->Trace( "fPercentDancePoints: %f", fPercentDancePoints );
// check for "AAAA"
if( m_CurStageStats.iTapNoteScores[pn][TNS_MARVELOUS] > 0 &&
m_CurStageStats.iTapNoteScores[pn][TNS_PERFECT] == 0 &&
m_CurStageStats.iTapNoteScores[pn][TNS_GREAT] == 0 &&
m_CurStageStats.iTapNoteScores[pn][TNS_GOOD] == 0 &&
m_CurStageStats.iTapNoteScores[pn][TNS_BOO] == 0 &&
m_CurStageStats.iTapNoteScores[pn][TNS_MISS] == 0 )
return GRADE_AAAA;
if ( fPercentDancePoints == 1.00 ) return GRADE_AAA;
else if( fPercentDancePoints >= 0.93 ) return GRADE_AA;
else if( fPercentDancePoints >= 0.80 ) return GRADE_A;
else if( fPercentDancePoints >= 0.65 ) return GRADE_B;
else if( fPercentDancePoints >= 0.45 ) return GRADE_C;
else return GRADE_D;
}
bool GameState::HasEarnedExtraStage() bool GameState::HasEarnedExtraStage()
{ {
if( (GAMESTATE->IsFinalStage() || GAMESTATE->IsExtraStage()) ) if( (GAMESTATE->IsFinalStage() || GAMESTATE->IsExtraStage()) )
@@ -247,7 +211,7 @@ bool GameState::HasEarnedExtraStage()
if( !GAMESTATE->IsPlayerEnabled(p) ) if( !GAMESTATE->IsPlayerEnabled(p) )
continue; // skip continue; // skip
if( GAMESTATE->m_pCurNotes[p]->GetDifficulty()==DIFFICULTY_HARD && GetCurrentGrade((PlayerNumber)p)==GRADE_AA ) if( GAMESTATE->m_pCurNotes[p]->GetDifficulty()==DIFFICULTY_HARD && m_CurStageStats.GetGrade((PlayerNumber)p)==GRADE_AA )
return true; return true;
} }
} }
+1 -1
View File
@@ -33,6 +33,7 @@ public:
GameState(); GameState();
~GameState(); ~GameState();
void Reset(); void Reset();
void ResetLastRanking();
// //
// Main State Info // Main State Info
@@ -106,7 +107,6 @@ public:
// 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 void GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut ); // shown on arcade final evaluation
Grade GetCurrentGrade( PlayerNumber pn ); // grade so far
PlayerOptions m_PlayerOptions[NUM_PLAYERS]; // The currently active options PlayerOptions m_PlayerOptions[NUM_PLAYERS]; // The currently active options
+1 -1
View File
@@ -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_fSongBeat<0 ) if( !GAMESTATE->m_bPastHereWeGo )
{ {
SetState( IdleState ); SetState( IdleState );
return; return;
+7 -1
View File
@@ -32,7 +32,6 @@ void GroupList::DoneAddingGroups()
{ {
m_screenLabels[i].LoadFromFont( THEME->GetPathTo("Fonts","select group button label") ); m_screenLabels[i].LoadFromFont( THEME->GetPathTo("Fonts","select group button label") );
m_screenLabels[i].SetXY( BUTTON_X, BUTTON_START_Y + i*BUTTON_SPACING_Y ); m_screenLabels[i].SetXY( BUTTON_X, BUTTON_START_Y + i*BUTTON_SPACING_Y );
m_screenLabels[i].SetZoom( 0.8f );
m_screenLabels[i].SetShadowLength( 2 ); m_screenLabels[i].SetShadowLength( 2 );
CString sGroupName = m_textLabels[i]; CString sGroupName = m_textLabels[i];
@@ -48,6 +47,13 @@ void GroupList::SetLabels()
{ {
CString &label = m_textLabels[m_iTop+i]; CString &label = m_textLabels[m_iTop+i];
m_screenLabels[i].SetText( SONGMAN->ShortenGroupName( label ) ); m_screenLabels[i].SetText( SONGMAN->ShortenGroupName( label ) );
float fTextWidth = (float)m_screenLabels[i].GetWidestLineWidthInSourcePixels();
float fButtonWidth = m_sprButton[i].GetZoomedWidth();
float fZoom = fButtonWidth/fTextWidth;
fZoom = min( fZoom, 0.8f );
m_screenLabels[i].SetZoomX( fZoom );
m_screenLabels[i].SetZoomY( 0.8f );
if( m_iTop+i == 0 ) m_screenLabels[i].TurnRainbowOn(); if( m_iTop+i == 0 ) m_screenLabels[i].TurnRainbowOn();
else { else {
+6 -7
View File
@@ -52,23 +52,22 @@ MusicBannerWheel::MusicBannerWheel()
if( 0 == stricmp(GAMESTATE->m_sPreferredGroup, "All Music") ) if( 0 == stricmp(GAMESTATE->m_sPreferredGroup, "All Music") )
{ {
arraySongs = SONGMAN->m_pSongs; SONGMAN->GetAllSongs( arraySongs );
} }
else // Get the Group They Want else // Get the Group They Want
{ {
for( unsigned i=0; i< SONGMAN->m_pSongs.size(); i++ ) vector<Song*> apAllSongs;
SONGMAN->GetAllSongs( apAllSongs );
for( unsigned i=0; i<apAllSongs.size(); i++ )
{ {
Song* pSong = SONGMAN->m_pSongs[i]; Song* pSong = apAllSongs[i];
if( GAMESTATE->m_sPreferredGroup != "ALL MUSIC" && pSong->m_sGroupName != GAMESTATE->m_sPreferredGroup ) if( GAMESTATE->m_sPreferredGroup != "ALL MUSIC" && pSong->m_sGroupName != GAMESTATE->m_sPreferredGroup )
{
continue; continue;
}
else else
{
arraySongs.push_back(pSong); arraySongs.push_back(pSong);
} }
}
} }
+7 -3
View File
@@ -330,7 +330,8 @@ MusicWheel::MusicWheel()
// init m_mapGroupNameToBannerColor // init m_mapGroupNameToBannerColor
vector<Song*> arraySongs = SONGMAN->m_pSongs; vector<Song*> arraySongs;
SONGMAN->GetAllSongs( arraySongs );
SortSongPointerArrayByGroup( arraySongs ); SortSongPointerArrayByGroup( arraySongs );
m_iSelection = 0; m_iSelection = 0;
@@ -477,10 +478,13 @@ bool MusicWheel::SelectCourse( const Course *p )
void MusicWheel::GetSongList(vector<Song*> &arraySongs, bool bRoulette ) void MusicWheel::GetSongList(vector<Song*> &arraySongs, bool bRoulette )
{ {
vector<Song*> apAllSongs;
SONGMAN->GetAllSongs( apAllSongs );
// copy only songs that have at least one Notes for the current GameMode // copy only songs that have at least one Notes for the current GameMode
for( unsigned i=0; i<SONGMAN->m_pSongs.size(); i++ ) for( unsigned i=0; i<apAllSongs.size(); i++ )
{ {
Song* pSong = SONGMAN->m_pSongs[i]; Song* pSong = apAllSongs[i];
/* If we're on an extra stage, and this song is selected, ignore /* If we're on an extra stage, and this song is selected, ignore
* #SELECTABLE. */ * #SELECTABLE. */
+1 -1
View File
@@ -40,7 +40,7 @@ OptionIcon::OptionIcon()
void OptionIcon::Load( PlayerNumber pn, CString sText, bool bHeader ) void OptionIcon::Load( PlayerNumber pn, CString sText, bool bHeader )
{ {
static CString sStopWords[] = { "OFF", "VISIBLE", "VIVID", "STANDARD", "X1" }; static CString sStopWords[] = { "OFF", "VISIBLE", "VIVID", "STANDARD", "X1", "HOLDS" };
const int iNumStopWords = sizeof(sStopWords)/sizeof(sStopWords[0]); const int iNumStopWords = sizeof(sStopWords)/sizeof(sStopWords[0]);
for( int i=0; i<iNumStopWords; i++ ) for( int i=0; i<iNumStopWords; i++ )
+5 -5
View File
@@ -55,11 +55,11 @@ PrefsManager::PrefsManager()
m_iNumArcadeStages = 3; m_iNumArcadeStages = 3;
m_bAutoPlay = false; m_bAutoPlay = false;
m_fJudgeWindowScale = 1.0f; m_fJudgeWindowScale = 1.0f;
m_fJudgeWindowMarvelousSeconds = 0.025f; m_fJudgeWindowMarvelousSeconds = 0.02f;
m_fJudgeWindowPerfectSeconds = 0.05f; m_fJudgeWindowPerfectSeconds = 0.04f;
m_fJudgeWindowGreatSeconds = 0.10f; m_fJudgeWindowGreatSeconds = 0.08f;
m_fJudgeWindowGoodSeconds = 0.15f; m_fJudgeWindowGoodSeconds = 0.12f;
m_fJudgeWindowBooSeconds = 0.2f; m_fJudgeWindowBooSeconds = 0.16f;
m_fLifeDifficultyScale = 1.0f; m_fLifeDifficultyScale = 1.0f;
m_iMovieDecodeMS = 2; m_iMovieDecodeMS = 2;
m_bUseBGIfNoBanner = false; m_bUseBGIfNoBanner = false;
+1
View File
@@ -258,6 +258,7 @@ void ScreenDemonstration::HandleScreenMessage( const ScreenMessage SM )
m_Fade.CloseWipingRight( SM_GoToNextScreen ); m_Fade.CloseWipingRight( SM_GoToNextScreen );
return; return;
case SM_GoToNextScreen: case SM_GoToNextScreen:
m_soundMusic.Stop();
SCREENMAN->SetNewScreen( NEXT_SCREEN ); SCREENMAN->SetNewScreen( NEXT_SCREEN );
return; return;
} }
+18 -3
View File
@@ -232,10 +232,10 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
Grade grade[NUM_PLAYERS]; Grade grade[NUM_PLAYERS];
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
{ {
if( !GAMESTATE->IsPlayerEnabled(p) || GAMESTATE->m_CurStageStats.bFailed[p] ) if( GAMESTATE->IsPlayerEnabled(p) )
grade[p] = GRADE_E; grade[p] = stageStats.GetGrade( (PlayerNumber)p );
else else
grade[p] = GAMESTATE->GetCurrentGrade( (PlayerNumber)p ); grade[p] = GRADE_E;
} }
Grade max_grade = GRADE_NO_DATA; Grade max_grade = GRADE_NO_DATA;
@@ -832,7 +832,22 @@ void ScreenEvaluation::MenuStart( PlayerNumber pn )
m_Menu.TweenOffScreenToBlack( SM_GoToGameFinished, false ); m_Menu.TweenOffScreenToBlack( SM_GoToGameFinished, false );
} }
switch( m_ResultMode )
{
case RM_ARCADE_STAGE:
GAMESTATE->m_iCurrentStageIndex++; // Increment the stage counter. GAMESTATE->m_iCurrentStageIndex++; // Increment the stage counter.
// add current stage stats to accumulated total only if this song was passed
{
bool bOnePassed = false;
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) )
bOnePassed |= !GAMESTATE->m_CurStageStats.bFailed[p];
if( bOnePassed )
GAMESTATE->m_vPassedStageStats.push_back( GAMESTATE->m_CurStageStats ); // Save this stage's stats GAMESTATE->m_vPassedStageStats.push_back( GAMESTATE->m_CurStageStats ); // Save this stage's stats
}
break;
}
} }
+1 -1
View File
@@ -49,7 +49,7 @@
#define PREVIEWMUSICMODE THEME->GetMetricI("ScreenEz2SelectMusic","PreviewMusicMode") #define PREVIEWMUSICMODE THEME->GetMetricI("ScreenEz2SelectMusic","PreviewMusicMode")
#define DIFFICULTYRATING_X THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingX") #define DIFFICULTYRATING_X THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingX")
#define DIFFICULTYRATING_Y THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingY") #define DIFFICULTYRATING_Y THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingY")
#define DIFFICULTYRATING_ORIENTATION THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingOrientation") #define DIFFICULTYRATING_ORIENTATION THEME->GetMetricI("ScreenEz2SelectMusic","DifficultyRatingOrientation")
#define INFOFRAME_X THEME->GetMetricF("ScreenEz2SelectMusic","InfoFrameX") #define INFOFRAME_X THEME->GetMetricF("ScreenEz2SelectMusic","InfoFrameX")
#define INFOFRAME_Y THEME->GetMetricF("ScreenEz2SelectMusic","InfoFrameY") #define INFOFRAME_Y THEME->GetMetricF("ScreenEz2SelectMusic","InfoFrameY")
+1 -1
View File
@@ -49,7 +49,7 @@ ScreenLogo::ScreenLogo() : ScreenAttract("ScreenLogo","logo")
m_textSongs.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); m_textSongs.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
m_textSongs.SetHorizAlign( Actor::align_left ); m_textSongs.SetHorizAlign( Actor::align_left );
m_textSongs.SetText( ssprintf("Found %u Songs", SONGMAN->m_pSongs.size()) ); m_textSongs.SetText( ssprintf("%d songs in %d groups", SONGMAN->GetNumSongs(), SONGMAN->GetNumGroups()) );
m_textSongs.SetDiffuse( RageColor(0.6f,0.6f,0.6f,1) ); // light gray m_textSongs.SetDiffuse( RageColor(0.6f,0.6f,0.6f,1) ); // light gray
m_textSongs.SetXY( SONGS_X, SONGS_Y ); m_textSongs.SetXY( SONGS_X, SONGS_Y );
m_textSongs.SetZoom( 0.5f ); m_textSongs.SetZoom( 0.5f );
+6 -6
View File
@@ -26,8 +26,7 @@
#define SCROLL_DELAY THEME->GetMetricF("ScreenMusicScroll","ScrollDelay") #define SCROLL_DELAY THEME->GetMetricF("ScreenMusicScroll","ScrollDelay")
#define SCROLL_SPEED THEME->GetMetricF("ScreenMusicScroll","ScrollSpeed") #define SCROLL_SPEED THEME->GetMetricF("ScreenMusicScroll","ScrollSpeed")
#define TEXT_ZOOM THEME->GetMetricF("ScreenMusicScroll","TextZoom") #define TEXT_ZOOM THEME->GetMetricF("ScreenMusicScroll","TextZoom")
#define NEXT_SCREEN THEME->GetMetric("ScreenMusicScroll","NextScreen")
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1);
const CString CREDIT_LINES[] = const CString CREDIT_LINES[] =
@@ -150,7 +149,8 @@ ScreenMusicScroll::ScreenMusicScroll()
this->AddChild( &m_Background ); this->AddChild( &m_Background );
vector<Song*> arraySongs = SONGMAN->m_pSongs; vector<Song*> arraySongs;
SONGMAN->GetAllSongs( arraySongs );
SortSongPointerArrayByTitle( arraySongs ); SortSongPointerArrayByTitle( arraySongs );
m_iNumLines = 0; m_iNumLines = 0;
@@ -183,7 +183,7 @@ ScreenMusicScroll::ScreenMusicScroll()
m_textLines[i].SetTweenXY( CENTER_X, SCREEN_TOP - 40 ); m_textLines[i].SetTweenXY( CENTER_X, SCREEN_TOP - 40 );
} }
this->SendScreenMessage( SM_StartFadingOut, 0.2f * i + 3.0f ); this->SendScreenMessage( SM_BeginFadingOut, 0.2f * i + 3.0f );
this->AddChild( &m_Fade ); this->AddChild( &m_Fade );
@@ -233,12 +233,12 @@ void ScreenMusicScroll::HandleScreenMessage( const ScreenMessage SM )
{ {
switch( SM ) switch( SM )
{ {
case SM_StartFadingOut: case SM_BeginFadingOut:
m_Fade.CloseWipingRight( SM_GoToNextScreen ); m_Fade.CloseWipingRight( SM_GoToNextScreen );
break; break;
case SM_GoToNextScreen: case SM_GoToNextScreen:
SONGMAN->SaveMachineScoresToDisk(); SONGMAN->SaveMachineScoresToDisk();
SCREENMAN->SetNewScreen( "ScreenCompany" ); SCREENMAN->SetNewScreen( NEXT_SCREEN );
break; break;
} }
} }
+14 -13
View File
@@ -59,16 +59,15 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking")
{ {
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 );
m_sprBullets[i].SetDiffuse( RageColor(1,1,1,0) );
m_sprBullets[i].StopAnimating(); m_sprBullets[i].StopAnimating();
m_sprBullets[i].SetState(i); m_sprBullets[i].SetState(i);
m_sprBullets[i].SetDiffuse( RageColor(1,1,1,0) );
this->AddChild( &m_sprBullets[i] ); this->AddChild( &m_sprBullets[i] );
m_textNames[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") ); m_textNames[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") );
m_textNames[i].TurnShadowOff(); m_textNames[i].TurnShadowOff();
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].SetHorizAlign( Actor::align_left ); m_textNames[i].SetHorizAlign( Actor::align_left );
this->AddChild( &m_textNames[i] ); this->AddChild( &m_textNames[i] );
@@ -76,7 +75,6 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking")
m_textScores[i].TurnShadowOff(); m_textScores[i].TurnShadowOff();
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].SetHorizAlign( Actor::align_right ); m_textScores[i].SetHorizAlign( Actor::align_right );
this->AddChild( &m_textScores[i] ); this->AddChild( &m_textScores[i] );
} }
@@ -177,24 +175,33 @@ void ScreenRanking::SetPage( PageToShow pts )
{ {
case PageToShow::TYPE_CATEGORY: case PageToShow::TYPE_CATEGORY:
{ {
m_textCategory.SetDiffuse( RageColor(1,1,1,1) );
m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) ); m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) );
m_textType.SetDiffuse( RageColor(1,1,1,1) );
m_textType.SetText( GameManager::NotesTypeToString(pts.nt) ); m_textType.SetText( GameManager::NotesTypeToString(pts.nt) );
for( int l=0; l<NUM_RANKING_LINES; l++ ) for( int l=0; l<NUM_RANKING_LINES; l++ )
{ {
m_sprBullets[l].SetDiffuse( RageColor(1,1,1,1) );
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_textNames[l].SetDiffuse( NAMES_COLOR );
m_textScores[l].SetDiffuse( SCORES_COLOR ); m_textScores[l].SetDiffuse( SCORES_COLOR );
bool bRecentHighScore = false;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( pts.nt == GAMESTATE->m_LastRankingNotesType && bRecentHighScore |=
pts.nt == GAMESTATE->m_LastRankingNotesType &&
GAMESTATE->m_LastRankingCategory[p] == pts.category && GAMESTATE->m_LastRankingCategory[p] == pts.category &&
GAMESTATE->m_iLastRankingIndex[p] == l ) GAMESTATE->m_iLastRankingIndex[p] == l;
}
if( bRecentHighScore )
{ {
m_textNames[l].SetEffectBlinking(); m_textNames[l].SetEffectBlinking( 10, NAMES_COLOR, RageColor(1,1,1,1) );
m_textScores[l].SetEffectBlinking(); m_textScores[l].SetEffectBlinking( 10, SCORES_COLOR, RageColor(1,1,1,1) );
} }
else else
{ {
@@ -203,7 +210,6 @@ void ScreenRanking::SetPage( PageToShow pts )
} }
} }
} }
}
break; break;
case PageToShow::TYPE_COURSE: case PageToShow::TYPE_COURSE:
{ {
@@ -242,18 +248,13 @@ void ScreenRanking::SetPage( PageToShow pts )
void ScreenRanking::TweenPageOnScreen() void ScreenRanking::TweenPageOnScreen()
{ {
m_textCategory.SetDiffuse( RageColor(1,1,1,1) );
m_textCategory.FadeOn(0,"bounce right",0.5f); m_textCategory.FadeOn(0,"bounce right",0.5f);
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_RANKING_LINES; l++ ) for( int l=0; l<NUM_RANKING_LINES; l++ )
{ {
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);
m_textNames[l].SetDiffuse( RageColor(1,1,1,1) );
m_textNames[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f); m_textNames[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
m_textScores[l].SetDiffuse( RageColor(1,1,1,1) );
m_textScores[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f); m_textScores[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
} }
} }
+2 -1
View File
@@ -82,7 +82,8 @@ ScreenSelectGroup::ScreenSelectGroup()
// This will simply the code a bit, and fix a weird case that // This will simply the code a bit, and fix a weird case that
// causes a crash when there are duplicate song names. // causes a crash when there are duplicate song names.
vector<Song*> aAllSongs = SONGMAN->m_pSongs; vector<Song*> aAllSongs;
SONGMAN->GetAllSongs( aAllSongs );
// Filter out Songs that can't be played by the current Style // Filter out Songs that can't be played by the current Style
for( j=aAllSongs.size()-1; j>=0; j-- ) // foreach Song, back to front for( j=aAllSongs.size()-1; j>=0; j-- ) // foreach Song, back to front
+6 -2
View File
@@ -199,6 +199,9 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
// fall through // fall through
case PrefsManager::COIN_HOME: case PrefsManager::COIN_HOME:
case PrefsManager::COIN_FREE: case PrefsManager::COIN_FREE:
if( m_Fade.IsClosing() )
break;
GAMESTATE->m_bSideIsJoined[MenuI.player] = true; GAMESTATE->m_bSideIsJoined[MenuI.player] = true;
GAMESTATE->m_MasterPlayerNumber = MenuI.player; GAMESTATE->m_MasterPlayerNumber = MenuI.player;
GAMESTATE->m_bPlayersCanJoin = false; GAMESTATE->m_bPlayersCanJoin = false;
@@ -209,17 +212,18 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
case CHOICE_SELECT_GAME: case CHOICE_SELECT_GAME:
case CHOICE_MAP_KEY_JOY: case CHOICE_MAP_KEY_JOY:
case CHOICE_OPTIONS: case CHOICE_OPTIONS:
case CHOICE_JUKEBOX:
#ifdef _DEBUG #ifdef _DEBUG
case CHOICE_SANDBOX: case CHOICE_SANDBOX:
#endif #endif
m_soundSelect.PlayRandom(); m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToNextScreen ); m_Fade.CloseWipingRight( SM_GoToNextScreen );
break; break;
case CHOICE_JUKEBOX:
case CHOICE_EDIT: case CHOICE_EDIT:
if( SONGMAN->m_pSongs.empty() ) if( SONGMAN->GetNumSongs() == 0 )
{ {
m_soundInvalid.PlayRandom(); m_soundInvalid.PlayRandom();
SCREENMAN->SystemMessage( "No songs are installed" );
} }
else else
{ {
+25 -5
View File
@@ -38,14 +38,15 @@ const int COURSE_TOP_SCORE_VERSION = 1;
#define GROUP_COLOR( i ) THEME->GetMetricC("SongManager",ssprintf("GroupColor%d",i+1)) #define GROUP_COLOR( i ) THEME->GetMetricC("SongManager",ssprintf("GroupColor%d",i+1))
#define EXTRA_COLOR THEME->GetMetricC("SongManager","ExtraColor") #define EXTRA_COLOR THEME->GetMetricC("SongManager","ExtraColor")
RageColor g_GroupColors[30]; vector<RageColor> g_vGroupColors;
RageColor g_ExtraColor; RageColor g_ExtraColor;
SongManager::SongManager( LoadingWindow *ld ) SongManager::SongManager( LoadingWindow *ld )
{ {
g_vGroupColors.clear();
for( int i=0; i<NUM_GROUP_COLORS; i++ ) for( int i=0; i<NUM_GROUP_COLORS; i++ )
g_GroupColors[i] = GROUP_COLOR( i ); g_vGroupColors.push_back( GROUP_COLOR(i) );
g_ExtraColor = EXTRA_COLOR; g_ExtraColor = EXTRA_COLOR;
InitSongArrayFromDisk( ld ); InitSongArrayFromDisk( ld );
@@ -285,7 +286,7 @@ void SongManager::SaveMachineScoresToDisk()
FILE* fp = fopen( CATEGORY_TOP_SCORE_FILE, "w" ); FILE* fp = fopen( CATEGORY_TOP_SCORE_FILE, "w" );
if( fp ) if( fp )
{ {
fprintf(fp,"%d",CATEGORY_TOP_SCORE_VERSION); fprintf(fp,"%d\n",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_RANKING_LINES; k++ ) for( int k=0; k<NUM_RANKING_LINES; k++ )
@@ -351,7 +352,7 @@ RageColor SongManager::GetGroupColor( const CString &sGroupName )
} }
ASSERT( i != m_arrayGroupNames.size() ); // this is not a valid group ASSERT( i != m_arrayGroupNames.size() ); // this is not a valid group
return g_GroupColors[i%NUM_GROUP_COLORS]; return g_vGroupColors[i%g_vGroupColors.size()];
} }
RageColor SongManager::GetSongColor( const Song* pSong ) RageColor SongManager::GetSongColor( const Song* pSong )
@@ -368,8 +369,15 @@ RageColor SongManager::GetSongColor( const Song* pSong )
} }
void SongManager::GetAllSongs( vector<Song*> &AddTo )
{
AddTo = m_pSongs;
}
void SongManager::GetSongsInGroup( const CString sGroupName, vector<Song*> &AddTo ) void SongManager::GetSongsInGroup( const CString sGroupName, vector<Song*> &AddTo )
{ {
AddTo.clear();
for( unsigned i=0; i<m_pSongs.size(); i++ ) for( unsigned i=0; i<m_pSongs.size(); i++ )
{ {
Song* pSong = m_pSongs[i]; Song* pSong = m_pSongs[i];
@@ -378,6 +386,16 @@ void SongManager::GetSongsInGroup( const CString sGroupName, vector<Song*> &AddT
} }
} }
int SongManager::GetNumSongs()
{
return m_pSongs.size();
}
int SongManager::GetNumGroups()
{
return m_arrayGroupNames.size();
}
CString SongManager::ShortenGroupName( const CString &sOrigGroupName ) CString SongManager::ShortenGroupName( const CString &sOrigGroupName )
{ {
CString sShortName = sOrigGroupName; CString sShortName = sOrigGroupName;
@@ -678,7 +696,7 @@ void SongManager::AddMachineRecords( NotesType nt, RankingCategory hsc[NUM_PLAYE
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_RANKING_LINES; j++ ) for( int j=NUM_RANKING_LINES-1; j>i; j-- )
machineScores[j] = machineScores[j-1]; machineScores[j] = machineScores[j-1];
// insert // insert
machineScores[i].fScore = newHS.fScore; machineScores[i].fScore = newHS.fScore;
@@ -689,3 +707,5 @@ void SongManager::AddMachineRecords( NotesType nt, RankingCategory hsc[NUM_PLAYE
} }
} }
} }
+4 -2
View File
@@ -26,8 +26,6 @@ public:
SongManager( LoadingWindow *ld ); SongManager( LoadingWindow *ld );
~SongManager(); ~SongManager();
vector<Song*> m_pSongs; // all songs that can be played
void InitSongArrayFromDisk( LoadingWindow *ld ); void InitSongArrayFromDisk( LoadingWindow *ld );
void FreeSongArray(); void FreeSongArray();
void ReloadSongArray(); void ReloadSongArray();
@@ -54,7 +52,10 @@ public:
// Lookup // Lookup
void GetAllSongs( vector<Song*> &AddTo );
void GetSongsInGroup( const CString sGroupName, vector<Song*> &AddTo ); void GetSongsInGroup( const CString sGroupName, vector<Song*> &AddTo );
int GetNumSongs();
int GetNumGroups();
Song* GetRandomSong(); Song* GetRandomSong();
void GetNonstopCourses( vector<Course*> &AddTo ); // add to if life meter type is BAR. void GetNonstopCourses( vector<Course*> &AddTo ); // add to if life meter type is BAR.
@@ -95,6 +96,7 @@ protected:
void SanityCheckGroupDir( CString sDir ) const; void SanityCheckGroupDir( CString sDir ) const;
void AddGroup( CString sDir, CString sGroupDirName ); void AddGroup( CString sDir, CString sGroupDirName );
vector<Song*> m_pSongs; // all songs that can be played
CStringArray m_arrayGroupNames; CStringArray m_arrayGroupNames;
CStringArray m_GroupBannerPaths; // each song group has a banner associated with it CStringArray m_GroupBannerPaths; // each song group has a banner associated with it
}; };
+45 -2
View File
@@ -11,6 +11,9 @@
*/ */
#include "StageStats.h" #include "StageStats.h"
#include "GameState.h"
#include "RageLog.h"
StageStats::StageStats() StageStats::StageStats()
{ {
@@ -28,12 +31,12 @@ void StageStats::operator+=( const StageStats& other )
fAliveSeconds[p] += other.fAliveSeconds[p]; fAliveSeconds[p] += other.fAliveSeconds[p];
bFailed[p] |= other.bFailed[p]; bFailed[p] |= other.bFailed[p];
iPossibleDancePoints[p] += other.iPossibleDancePoints[p]; iPossibleDancePoints[p] += other.iPossibleDancePoints[p];
iActualDancePoints[p] += other.iPossibleDancePoints[p]; iActualDancePoints[p] += other.iActualDancePoints[p];
for( int t=0; t<NUM_TAP_NOTE_SCORES; t++ ) for( int t=0; t<NUM_TAP_NOTE_SCORES; t++ )
iTapNoteScores[p][t] += other.iTapNoteScores[p][t]; iTapNoteScores[p][t] += other.iTapNoteScores[p][t];
for( int h=0; h<NUM_HOLD_NOTE_SCORES; h++ ) for( int h=0; h<NUM_HOLD_NOTE_SCORES; h++ )
iHoldNoteScores[p][h] += iHoldNoteScores[p][h]; iHoldNoteScores[p][h] += other.iHoldNoteScores[p][h];
iMaxCombo[p] += other.iMaxCombo[p]; iMaxCombo[p] += other.iMaxCombo[p];
fScore[p] += other.fScore[p]; fScore[p] += other.fScore[p];
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ ) for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
@@ -46,3 +49,43 @@ void StageStats::operator+=( const StageStats& other )
} }
} }
Grade StageStats::GetGrade( PlayerNumber pn )
{
ASSERT( GAMESTATE->IsPlayerEnabled(pn) ); // should be calling this is player isn't joined!
if( bFailed[pn] )
return GRADE_E;
/* Based on the percentage of your total "Dance Points" to the maximum
* possible number, the following rank is assigned:
*
* 100% - AAA
* 93% - AA
* 80% - A
* 65% - B
* 45% - C
* Less - D
* Fail - E
*/
float fPercentDancePoints = iActualDancePoints[pn] / (float)iPossibleDancePoints[pn];
fPercentDancePoints = max( 0.f, fPercentDancePoints );
LOG->Trace( "iActualDancePoints: %i", iActualDancePoints[pn] );
LOG->Trace( "iPossibleDancePoints: %i", iPossibleDancePoints[pn] );
LOG->Trace( "fPercentDancePoints: %f", fPercentDancePoints );
// check for "AAAA"
if( iTapNoteScores[pn][TNS_MARVELOUS] > 0 &&
iTapNoteScores[pn][TNS_PERFECT] == 0 &&
iTapNoteScores[pn][TNS_GREAT] == 0 &&
iTapNoteScores[pn][TNS_GOOD] == 0 &&
iTapNoteScores[pn][TNS_BOO] == 0 &&
iTapNoteScores[pn][TNS_MISS] == 0 )
return GRADE_AAAA;
if ( fPercentDancePoints == 1.00 ) return GRADE_AAA;
else if( fPercentDancePoints >= 0.93 ) return GRADE_AA;
else if( fPercentDancePoints >= 0.80 ) return GRADE_A;
else if( fPercentDancePoints >= 0.65 ) return GRADE_B;
else if( fPercentDancePoints >= 0.45 ) return GRADE_C;
else return GRADE_D;
}
+4
View File
@@ -11,14 +11,18 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "GameConstantsAndTypes.h" // for NUM_PLAYERS #include "GameConstantsAndTypes.h" // for NUM_PLAYERS
#include "Grade.h"
class Song; class Song;
struct StageStats struct StageStats
{ {
StageStats(); StageStats();
void operator+=( const StageStats& other ); // accumulate void operator+=( const StageStats& other ); // accumulate
Grade GetGrade( PlayerNumber pn );
Song* pSong; Song* pSong;
int iMeter[NUM_PLAYERS]; int iMeter[NUM_PLAYERS];
+6 -1
View File
@@ -422,7 +422,11 @@ static void HandleInputEvents(float fDeltaTime)
continue; continue;
} }
} }
else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5)) /* Hitting F5, then waiting 5 seconds while my monitor is black
* is really making me angry.
* Do any users even know about this hotkey or think it's useful?
* Probably not... -Chris
/* else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5))
{ {
if(type != IET_FIRST_PRESS) continue; if(type != IET_FIRST_PRESS) continue;
@@ -439,6 +443,7 @@ static void HandleInputEvents(float fDeltaTime)
} }
ApplyGraphicOptions(); ApplyGraphicOptions();
} }
*/
else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F6)) else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F6))
{ {
if(type != IET_FIRST_PRESS) continue; if(type != IET_FIRST_PRESS) continue;