add themed StepsType name

add "TotalHighScoreDancePoints" calculation to ScreenEnding
This commit is contained in:
Chris Danford
2004-03-11 06:31:30 +00:00
parent 61dd2dd425
commit 1090dcd2a0
9 changed files with 84 additions and 27 deletions
+6
View File
@@ -20,6 +20,7 @@
#include "RageUtil.h"
#include "NoteSkinManager.h"
#include "SDL_keysym.h" // for SDLKeys
#include "ThemeManager.h"
GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program
@@ -2319,6 +2320,11 @@ CString GameManager::NotesTypeToString( StepsType nt )
return NotesTypes[nt].name;
}
CString GameManager::NotesTypeToThemedString( StepsType nt )
{
return THEME->GetMetric( "StepsType", NotesTypeToString(nt) );
}
Game GameManager::StringToGameType( CString sGameType )
{
for( int i=0; i<NUM_GAMES; i++ )
+1
View File
@@ -37,6 +37,7 @@ public:
static int NotesTypeToNumTracks( StepsType nt );
static StepsType StringToNotesType( CString sNotesType );
static CString NotesTypeToString( StepsType nt );
static CString NotesTypeToThemedString( StepsType nt );
static Game StringToGameType( CString sGameType );
Style GameAndStringToStyle( Game game, CString sStyle );
+26
View File
@@ -29,6 +29,7 @@
#include "ProfileHtml.h"
#include "ProfileManager.h"
#include "RageFileManager.h"
#include "ScoreKeeperMAX2.h"
//
// Old file versions for backward compatibility
@@ -172,6 +173,27 @@ int Profile::GetTotalNumSongsPassed() const
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 )
{
Profile profile;
@@ -197,6 +219,7 @@ int Profile::GetSongNumTimesPlayed( const Song* pSong ) const
//
void Profile::AddStepsHighScore( const Steps* pSteps, HighScore hs, int &iIndexOut )
{
ASSERT(pSteps);
std::map<const Steps*,HighScoresForASteps>::iterator iter = m_StepsHighScores.find( pSteps );
if( iter == m_StepsHighScores.end() )
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
{
ASSERT(pSteps);
/* We're const, but insert a blank entry anyway if the requested pointer doesn't exist. */
return ((Profile *) this)->m_StepsHighScores[pSteps].hs;
}
HighScoreList& Profile::GetStepsHighScoreList( const Steps* pSteps )
{
ASSERT(pSteps);
std::map<const Steps*,HighScoresForASteps>::iterator iter = m_StepsHighScores.find( pSteps );
if( iter == m_StepsHighScores.end() )
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
{
ASSERT(pSteps);
std::map<const Steps*,HighScoresForASteps>::const_iterator iter = m_StepsHighScores.find( pSteps );
if( iter == m_StepsHighScores.end() )
return 0;
+1
View File
@@ -70,6 +70,7 @@ public:
CString GetDisplayTotalCaloriesBurned() const;
int GetTotalNumSongsPlayed() const;
int GetTotalNumSongsPassed() const;
int GetTotalHighScoreDancePointsForStepsType( StepsType st ) const;
static CString GetProfileDisplayNameFromDir( CString sDir );
int GetSongNumTimesPlayed( const Song* pSong ) const;
+1 -1
View File
@@ -485,7 +485,7 @@ HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const StyleD
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();
else
return HighScore();
+19 -7
View File
@@ -37,6 +37,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
int iTotalPossibleDancePoints = 0;
for( unsigned i=0; i<apNotes.size(); i++ )
{
Song* pSong = apSongs[i];
Steps* pSteps = apNotes[i];
NoteData notedata;
pSteps->GetNoteData( &notedata );
@@ -65,12 +66,16 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
po.FromString( mod.sModifier );
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 );
}
float fRadarValuesPostModifiers[NUM_RADAR_CATEGORIES];
FOREACH_RadarCategory( rc )
fRadarValuesPostModifiers[rc] += NoteDataUtil::GetRadarValue( playerNoteDataPostModifiers, rc, pSong->m_fMusicLengthSeconds );
iTotalPossibleDancePoints += this->GetPossibleDancePoints( playerNoteData, playerNoteDataPostModifiers );
iTotalPossibleDancePoints += this->GetPossibleDancePoints( pSteps->GetRadarValues(), fRadarValuesPostModifiers );
}
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),
* 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
* hit the new notes to get a high grade. However, if you use one that removes notes,
* they should simply be counted as misses. */
int NumTaps = max( preNoteData.GetNumRowsWithTapOrHoldHead(), postNoteData.GetNumRowsWithTapOrHoldHead() );
int NumHolds = max( preNoteData.GetNumHoldNotes(), postNoteData.GetNumHoldNotes() );
return NumTaps*TapNoteScoreToDancePoints(TNS_MARVELOUS)+
NumHolds*HoldNoteScoreToDancePoints(HNS_OK);
return max(
GetPossibleDancePoints(fOriginalRadars),
GetPossibleDancePoints(fPostRadars) );
}
+8 -3
View File
@@ -47,10 +47,15 @@ public:
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
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:
int TapNoteScoreToDancePoints( TapNoteScore tns );
int HoldNoteScoreToDancePoints( HoldNoteScore hns );
int GetPossibleDancePoints( const NoteData &preNoteData, const NoteData &postNoteData );
static int TapNoteScoreToDancePoints( TapNoteScore tns );
static int HoldNoteScoreToDancePoints( HoldNoteScore hns );
};
#endif
+21 -15
View File
@@ -23,6 +23,8 @@
#include "GameState.h"
#include "MemoryCardManager.h"
#include "RageLog.h"
#include "StyleDef.h"
#include "GameManager.h"
#define SCROLL_DELAY THEME->GetMetricF("ScreenEnding","ScrollDelay")
@@ -30,28 +32,32 @@
#define TEXT_ZOOM THEME->GetMetricF("ScreenEnding","TextZoom")
CString STATS_LINE_TITLE[NUM_ENDING_STATS_LINES] = {
"Total Calories",
"Total Songs Played",
"Current Combo",
};
CString GetStatsLineTitle( PlayerNumber pn, int iLine )
{
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 )
{
Profile* pProfile = PROFILEMAN->GetProfile( pn );
ASSERT( pProfile );
StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
switch( iLine )
{
case 0:
return pProfile->GetDisplayTotalCaloriesBurned();
case 1:
return ssprintf( "%d", pProfile->GetTotalNumSongsPlayed() ); // fixme
case 2:
return ssprintf( "%d", pProfile->m_iCurrentCombo );
default:
ASSERT(0);
return "";
case 0: return Commify( pProfile->GetTotalHighScoreDancePointsForStepsType(st) );
case 1: return pProfile->GetDisplayTotalCaloriesBurned();
case 2: return Commify( pProfile->GetTotalNumSongsPlayed() );
case 3: return Commify( 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++ )
{
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) );
SET_XY_AND_ON_COMMAND( m_textStatsTitle[p][i] );
this->AddChild( &m_textStatsTitle[p][i] );
+1 -1
View File
@@ -24,7 +24,7 @@ public:
private:
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_textStatsValue[NUM_PLAYERS][NUM_ENDING_STATS_LINES];