add themed StepsType name
add "TotalHighScoreDancePoints" calculation to ScreenEnding
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "NoteSkinManager.h"
|
#include "NoteSkinManager.h"
|
||||||
#include "SDL_keysym.h" // for SDLKeys
|
#include "SDL_keysym.h" // for SDLKeys
|
||||||
|
#include "ThemeManager.h"
|
||||||
|
|
||||||
|
|
||||||
GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program
|
GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program
|
||||||
@@ -2319,6 +2320,11 @@ CString GameManager::NotesTypeToString( StepsType nt )
|
|||||||
return NotesTypes[nt].name;
|
return NotesTypes[nt].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CString GameManager::NotesTypeToThemedString( StepsType nt )
|
||||||
|
{
|
||||||
|
return THEME->GetMetric( "StepsType", NotesTypeToString(nt) );
|
||||||
|
}
|
||||||
|
|
||||||
Game GameManager::StringToGameType( CString sGameType )
|
Game GameManager::StringToGameType( CString sGameType )
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_GAMES; i++ )
|
for( int i=0; i<NUM_GAMES; i++ )
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public:
|
|||||||
static int NotesTypeToNumTracks( StepsType nt );
|
static int NotesTypeToNumTracks( StepsType nt );
|
||||||
static StepsType StringToNotesType( CString sNotesType );
|
static StepsType StringToNotesType( CString sNotesType );
|
||||||
static CString NotesTypeToString( StepsType nt );
|
static CString NotesTypeToString( StepsType nt );
|
||||||
|
static CString NotesTypeToThemedString( StepsType nt );
|
||||||
static Game StringToGameType( CString sGameType );
|
static Game StringToGameType( CString sGameType );
|
||||||
Style GameAndStringToStyle( Game game, CString sStyle );
|
Style GameAndStringToStyle( Game game, CString sStyle );
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "ProfileHtml.h"
|
#include "ProfileHtml.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
#include "RageFileManager.h"
|
#include "RageFileManager.h"
|
||||||
|
#include "ScoreKeeperMAX2.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Old file versions for backward compatibility
|
// Old file versions for backward compatibility
|
||||||
@@ -172,6 +173,27 @@ int Profile::GetTotalNumSongsPassed() const
|
|||||||
return iTotal;
|
return iTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const
|
||||||
|
{
|
||||||
|
int iTotal = 0;
|
||||||
|
for( std::map<const Steps*,HighScoresForASteps>::const_iterator iter = m_StepsHighScores.begin();
|
||||||
|
iter != m_StepsHighScores.end();
|
||||||
|
iter++ )
|
||||||
|
{
|
||||||
|
const Steps* pSteps = iter->first;
|
||||||
|
ASSERT( pSteps );
|
||||||
|
const HighScoresForASteps& h = iter->second;
|
||||||
|
if( pSteps->m_StepsType == st )
|
||||||
|
{
|
||||||
|
const float* fRadars = pSteps->GetRadarValues();
|
||||||
|
int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars );
|
||||||
|
iTotal += (int)truncf( h.hs.GetTopScore().fPercentDP * iPossibleDP );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return iTotal;
|
||||||
|
}
|
||||||
|
|
||||||
CString Profile::GetProfileDisplayNameFromDir( CString sDir )
|
CString Profile::GetProfileDisplayNameFromDir( CString sDir )
|
||||||
{
|
{
|
||||||
Profile profile;
|
Profile profile;
|
||||||
@@ -197,6 +219,7 @@ int Profile::GetSongNumTimesPlayed( const Song* pSong ) const
|
|||||||
//
|
//
|
||||||
void Profile::AddStepsHighScore( const Steps* pSteps, HighScore hs, int &iIndexOut )
|
void Profile::AddStepsHighScore( const Steps* pSteps, HighScore hs, int &iIndexOut )
|
||||||
{
|
{
|
||||||
|
ASSERT(pSteps);
|
||||||
std::map<const Steps*,HighScoresForASteps>::iterator iter = m_StepsHighScores.find( pSteps );
|
std::map<const Steps*,HighScoresForASteps>::iterator iter = m_StepsHighScores.find( pSteps );
|
||||||
if( iter == m_StepsHighScores.end() )
|
if( iter == m_StepsHighScores.end() )
|
||||||
m_StepsHighScores[pSteps].hs.AddHighScore( hs, iIndexOut ); // operator[] inserts into map
|
m_StepsHighScores[pSteps].hs.AddHighScore( hs, iIndexOut ); // operator[] inserts into map
|
||||||
@@ -206,12 +229,14 @@ void Profile::AddStepsHighScore( const Steps* pSteps, HighScore hs, int &iIndexO
|
|||||||
|
|
||||||
const HighScoreList& Profile::GetStepsHighScoreList( const Steps* pSteps ) const
|
const HighScoreList& Profile::GetStepsHighScoreList( const Steps* pSteps ) const
|
||||||
{
|
{
|
||||||
|
ASSERT(pSteps);
|
||||||
/* We're const, but insert a blank entry anyway if the requested pointer doesn't exist. */
|
/* We're const, but insert a blank entry anyway if the requested pointer doesn't exist. */
|
||||||
return ((Profile *) this)->m_StepsHighScores[pSteps].hs;
|
return ((Profile *) this)->m_StepsHighScores[pSteps].hs;
|
||||||
}
|
}
|
||||||
|
|
||||||
HighScoreList& Profile::GetStepsHighScoreList( const Steps* pSteps )
|
HighScoreList& Profile::GetStepsHighScoreList( const Steps* pSteps )
|
||||||
{
|
{
|
||||||
|
ASSERT(pSteps);
|
||||||
std::map<const Steps*,HighScoresForASteps>::iterator iter = m_StepsHighScores.find( pSteps );
|
std::map<const Steps*,HighScoresForASteps>::iterator iter = m_StepsHighScores.find( pSteps );
|
||||||
if( iter == m_StepsHighScores.end() )
|
if( iter == m_StepsHighScores.end() )
|
||||||
return m_StepsHighScores[pSteps].hs; // operator[] inserts into map
|
return m_StepsHighScores[pSteps].hs; // operator[] inserts into map
|
||||||
@@ -221,6 +246,7 @@ HighScoreList& Profile::GetStepsHighScoreList( const Steps* pSteps )
|
|||||||
|
|
||||||
int Profile::GetStepsNumTimesPlayed( const Steps* pSteps ) const
|
int Profile::GetStepsNumTimesPlayed( const Steps* pSteps ) const
|
||||||
{
|
{
|
||||||
|
ASSERT(pSteps);
|
||||||
std::map<const Steps*,HighScoresForASteps>::const_iterator iter = m_StepsHighScores.find( pSteps );
|
std::map<const Steps*,HighScoresForASteps>::const_iterator iter = m_StepsHighScores.find( pSteps );
|
||||||
if( iter == m_StepsHighScores.end() )
|
if( iter == m_StepsHighScores.end() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public:
|
|||||||
CString GetDisplayTotalCaloriesBurned() const;
|
CString GetDisplayTotalCaloriesBurned() const;
|
||||||
int GetTotalNumSongsPlayed() const;
|
int GetTotalNumSongsPlayed() const;
|
||||||
int GetTotalNumSongsPassed() const;
|
int GetTotalNumSongsPassed() const;
|
||||||
|
int GetTotalHighScoreDancePointsForStepsType( StepsType st ) const;
|
||||||
static CString GetProfileDisplayNameFromDir( CString sDir );
|
static CString GetProfileDisplayNameFromDir( CString sDir );
|
||||||
int GetSongNumTimesPlayed( const Song* pSong ) const;
|
int GetSongNumTimesPlayed( const Song* pSong ) const;
|
||||||
|
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const StyleD
|
|||||||
|
|
||||||
const Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc );
|
const Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc );
|
||||||
|
|
||||||
if( PROFILEMAN->IsUsingProfile(slot) )
|
if( pSteps && PROFILEMAN->IsUsingProfile(slot) )
|
||||||
return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSteps).GetTopScore();
|
return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSteps).GetTopScore();
|
||||||
else
|
else
|
||||||
return HighScore();
|
return HighScore();
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
|
|||||||
int iTotalPossibleDancePoints = 0;
|
int iTotalPossibleDancePoints = 0;
|
||||||
for( unsigned i=0; i<apNotes.size(); i++ )
|
for( unsigned i=0; i<apNotes.size(); i++ )
|
||||||
{
|
{
|
||||||
|
Song* pSong = apSongs[i];
|
||||||
Steps* pSteps = apNotes[i];
|
Steps* pSteps = apNotes[i];
|
||||||
NoteData notedata;
|
NoteData notedata;
|
||||||
pSteps->GetNoteData( ¬edata );
|
pSteps->GetNoteData( ¬edata );
|
||||||
@@ -65,12 +66,16 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
|
|||||||
po.FromString( mod.sModifier );
|
po.FromString( mod.sModifier );
|
||||||
|
|
||||||
float fStartBeat, fEndBeat;
|
float fStartBeat, fEndBeat;
|
||||||
mod.GetAttackBeats( apSongs[i], m_PlayerNumber, fStartBeat, fEndBeat );
|
mod.GetAttackBeats( pSong, m_PlayerNumber, fStartBeat, fEndBeat );
|
||||||
|
|
||||||
NoteDataUtil::TransformNoteData( playerNoteDataPostModifiers, po, GAMESTATE->GetCurrentStyleDef()->m_StepsType, fStartBeat, fEndBeat );
|
NoteDataUtil::TransformNoteData( playerNoteDataPostModifiers, po, GAMESTATE->GetCurrentStyleDef()->m_StepsType, fStartBeat, fEndBeat );
|
||||||
}
|
}
|
||||||
|
|
||||||
iTotalPossibleDancePoints += this->GetPossibleDancePoints( playerNoteData, playerNoteDataPostModifiers );
|
float fRadarValuesPostModifiers[NUM_RADAR_CATEGORIES];
|
||||||
|
FOREACH_RadarCategory( rc )
|
||||||
|
fRadarValuesPostModifiers[rc] += NoteDataUtil::GetRadarValue( playerNoteDataPostModifiers, rc, pSong->m_fMusicLengthSeconds );
|
||||||
|
|
||||||
|
iTotalPossibleDancePoints += this->GetPossibleDancePoints( pSteps->GetRadarValues(), fRadarValuesPostModifiers );
|
||||||
}
|
}
|
||||||
g_CurStageStats.iPossibleDancePoints[pn_] = iTotalPossibleDancePoints;
|
g_CurStageStats.iPossibleDancePoints[pn_] = iTotalPossibleDancePoints;
|
||||||
|
|
||||||
@@ -413,19 +418,26 @@ void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tap
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ScoreKeeperMAX2::GetPossibleDancePoints( const NoteData &preNoteData, const NoteData &postNoteData )
|
int ScoreKeeperMAX2::GetPossibleDancePoints( const float* fRadars )
|
||||||
{
|
{
|
||||||
/* Note that, if Marvelous timing is disabled or not active (not course mode),
|
/* Note that, if Marvelous timing is disabled or not active (not course mode),
|
||||||
* PERFECT will be used instead. */
|
* PERFECT will be used instead. */
|
||||||
|
|
||||||
|
int NumTaps = fRadars[RADAR_NUM_TAPS_AND_HOLDS];
|
||||||
|
int NumHolds = fRadars[RADAR_NUM_HOLDS];
|
||||||
|
return NumTaps*TapNoteScoreToDancePoints(TNS_MARVELOUS)+
|
||||||
|
NumHolds*HoldNoteScoreToDancePoints(HNS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ScoreKeeperMAX2::GetPossibleDancePoints( const float* fOriginalRadars, const float* fPostRadars )
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* The logic here is that if you use a modifier that adds notes, you should have to
|
* The logic here is that if you use a modifier that adds notes, you should have to
|
||||||
* hit the new notes to get a high grade. However, if you use one that removes notes,
|
* hit the new notes to get a high grade. However, if you use one that removes notes,
|
||||||
* they should simply be counted as misses. */
|
* they should simply be counted as misses. */
|
||||||
int NumTaps = max( preNoteData.GetNumRowsWithTapOrHoldHead(), postNoteData.GetNumRowsWithTapOrHoldHead() );
|
return max(
|
||||||
int NumHolds = max( preNoteData.GetNumHoldNotes(), postNoteData.GetNumHoldNotes() );
|
GetPossibleDancePoints(fOriginalRadars),
|
||||||
return NumTaps*TapNoteScoreToDancePoints(TNS_MARVELOUS)+
|
GetPossibleDancePoints(fPostRadars) );
|
||||||
NumHolds*HoldNoteScoreToDancePoints(HNS_OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,10 +47,15 @@ public:
|
|||||||
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
|
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
|
||||||
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
|
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
|
||||||
|
|
||||||
|
// This must be calculated using only cached radar values so that we can
|
||||||
|
// do it quickly.
|
||||||
|
static int GetPossibleDancePoints( const float* fRadars );
|
||||||
|
static int GetPossibleDancePoints( const float* fOriginalRadars, const float* fPostRadars );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int TapNoteScoreToDancePoints( TapNoteScore tns );
|
static int TapNoteScoreToDancePoints( TapNoteScore tns );
|
||||||
int HoldNoteScoreToDancePoints( HoldNoteScore hns );
|
static int HoldNoteScoreToDancePoints( HoldNoteScore hns );
|
||||||
int GetPossibleDancePoints( const NoteData &preNoteData, const NoteData &postNoteData );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "MemoryCardManager.h"
|
#include "MemoryCardManager.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
#include "StyleDef.h"
|
||||||
|
#include "GameManager.h"
|
||||||
|
|
||||||
|
|
||||||
#define SCROLL_DELAY THEME->GetMetricF("ScreenEnding","ScrollDelay")
|
#define SCROLL_DELAY THEME->GetMetricF("ScreenEnding","ScrollDelay")
|
||||||
@@ -30,28 +32,32 @@
|
|||||||
#define TEXT_ZOOM THEME->GetMetricF("ScreenEnding","TextZoom")
|
#define TEXT_ZOOM THEME->GetMetricF("ScreenEnding","TextZoom")
|
||||||
|
|
||||||
|
|
||||||
CString STATS_LINE_TITLE[NUM_ENDING_STATS_LINES] = {
|
|
||||||
"Total Calories",
|
CString GetStatsLineTitle( PlayerNumber pn, int iLine )
|
||||||
"Total Songs Played",
|
{
|
||||||
"Current Combo",
|
static const CString s[NUM_ENDING_STATS_LINES] = {
|
||||||
};
|
"Total %s Points",
|
||||||
|
"Total Calories",
|
||||||
|
"Total Songs Played",
|
||||||
|
"Current Combo",
|
||||||
|
};
|
||||||
|
StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
|
||||||
|
return ssprintf( s[iLine], GAMEMAN->NotesTypeToThemedString(st).c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
CString GetStatsLineValue( PlayerNumber pn, int iLine )
|
CString GetStatsLineValue( PlayerNumber pn, int iLine )
|
||||||
{
|
{
|
||||||
Profile* pProfile = PROFILEMAN->GetProfile( pn );
|
Profile* pProfile = PROFILEMAN->GetProfile( pn );
|
||||||
ASSERT( pProfile );
|
ASSERT( pProfile );
|
||||||
|
|
||||||
|
StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
|
||||||
switch( iLine )
|
switch( iLine )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: return Commify( pProfile->GetTotalHighScoreDancePointsForStepsType(st) );
|
||||||
return pProfile->GetDisplayTotalCaloriesBurned();
|
case 1: return pProfile->GetDisplayTotalCaloriesBurned();
|
||||||
case 1:
|
case 2: return Commify( pProfile->GetTotalNumSongsPlayed() );
|
||||||
return ssprintf( "%d", pProfile->GetTotalNumSongsPlayed() ); // fixme
|
case 3: return Commify( pProfile->m_iCurrentCombo );
|
||||||
case 2:
|
default: ASSERT(0); return "";
|
||||||
return ssprintf( "%d", pProfile->m_iCurrentCombo );
|
|
||||||
default:
|
|
||||||
ASSERT(0);
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +91,7 @@ ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, fa
|
|||||||
for( int i=0; i<NUM_ENDING_STATS_LINES; i++ )
|
for( int i=0; i<NUM_ENDING_STATS_LINES; i++ )
|
||||||
{
|
{
|
||||||
m_textStatsTitle[p][i].LoadFromFont( THEME->GetPathToF("ScreenEnding stats title") );
|
m_textStatsTitle[p][i].LoadFromFont( THEME->GetPathToF("ScreenEnding stats title") );
|
||||||
m_textStatsTitle[p][i].SetText( STATS_LINE_TITLE[i] );
|
m_textStatsTitle[p][i].SetText( GetStatsLineTitle((PlayerNumber)p, i) );
|
||||||
m_textStatsTitle[p][i].SetName( ssprintf("StatsTitleP%dLine%d",p+1,i+1) );
|
m_textStatsTitle[p][i].SetName( ssprintf("StatsTitleP%dLine%d",p+1,i+1) );
|
||||||
SET_XY_AND_ON_COMMAND( m_textStatsTitle[p][i] );
|
SET_XY_AND_ON_COMMAND( m_textStatsTitle[p][i] );
|
||||||
this->AddChild( &m_textStatsTitle[p][i] );
|
this->AddChild( &m_textStatsTitle[p][i] );
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BitmapText m_textPlayerName[NUM_PLAYERS];
|
BitmapText m_textPlayerName[NUM_PLAYERS];
|
||||||
#define NUM_ENDING_STATS_LINES 3 // Total calories burned, total songs played, current combo
|
#define NUM_ENDING_STATS_LINES 4
|
||||||
BitmapText m_textStatsTitle[NUM_PLAYERS][NUM_ENDING_STATS_LINES];
|
BitmapText m_textStatsTitle[NUM_PLAYERS][NUM_ENDING_STATS_LINES];
|
||||||
BitmapText m_textStatsValue[NUM_PLAYERS][NUM_ENDING_STATS_LINES];
|
BitmapText m_textStatsValue[NUM_PLAYERS][NUM_ENDING_STATS_LINES];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user