2004-02-10 09:42:01 +00:00
|
|
|
#ifndef HighScore_H
|
|
|
|
|
#define HighScore_H
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: HighScore
|
|
|
|
|
|
|
|
|
|
Desc: Player data that persists between sessions. Can be stored on a local
|
|
|
|
|
disk or on a memory card.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "Grade.h"
|
2004-05-27 07:59:46 +00:00
|
|
|
#include "GameConstantsAndTypes.h"
|
2004-02-10 09:42:01 +00:00
|
|
|
|
2004-05-22 01:35:08 +00:00
|
|
|
struct XNode;
|
2004-02-10 09:42:01 +00:00
|
|
|
struct HighScore
|
|
|
|
|
{
|
2004-04-22 22:56:38 +00:00
|
|
|
CString sName; // name that shows in the machine's ranking screen
|
2004-02-10 09:42:01 +00:00
|
|
|
Grade grade;
|
|
|
|
|
int iScore;
|
|
|
|
|
float fPercentDP;
|
|
|
|
|
float fSurviveSeconds;
|
|
|
|
|
CString sModifiers;
|
2004-04-18 19:49:45 +00:00
|
|
|
time_t time; // return value of time() when screenshot was taken
|
2004-04-22 22:56:38 +00:00
|
|
|
CString sPlayerGuid; // who made this high score
|
|
|
|
|
CString sMachineGuid; // where this high score was made
|
2004-05-25 06:50:04 +00:00
|
|
|
int iProductID;
|
2004-05-27 07:59:46 +00:00
|
|
|
int iTapNoteScores[NUM_TAP_NOTE_SCORES];
|
|
|
|
|
int iHoldNoteScores[NUM_HOLD_NOTE_SCORES];
|
|
|
|
|
float fRadarActual[NUM_RADAR_CATEGORIES];
|
2004-03-08 02:50:46 +00:00
|
|
|
|
2004-04-22 07:59:42 +00:00
|
|
|
HighScore() { Unset(); }
|
|
|
|
|
void Unset()
|
2004-02-10 09:42:01 +00:00
|
|
|
{
|
2004-04-22 22:56:38 +00:00
|
|
|
sName = "";
|
2004-02-10 09:42:01 +00:00
|
|
|
grade = GRADE_NO_DATA;
|
|
|
|
|
iScore = 0;
|
|
|
|
|
fPercentDP = 0;
|
|
|
|
|
fSurviveSeconds = 0;
|
2004-05-02 11:35:13 +00:00
|
|
|
sModifiers = "";
|
2004-04-18 19:49:45 +00:00
|
|
|
time = 0;
|
2004-04-22 22:56:38 +00:00
|
|
|
sPlayerGuid = "";
|
|
|
|
|
sMachineGuid = "";
|
2004-05-25 06:50:04 +00:00
|
|
|
iProductID = 0;
|
2004-05-27 07:59:46 +00:00
|
|
|
ZERO( iTapNoteScores );
|
|
|
|
|
ZERO( iHoldNoteScores );
|
|
|
|
|
ZERO( fRadarActual );
|
2004-02-10 09:42:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool operator>=( const HighScore& other ) const;
|
2004-05-02 11:35:13 +00:00
|
|
|
bool operator==( const HighScore& other ) const
|
|
|
|
|
{
|
|
|
|
|
#define COMPARE(x) if( x!=other.x ) return false;
|
|
|
|
|
COMPARE( sName );
|
|
|
|
|
COMPARE( grade );
|
|
|
|
|
COMPARE( iScore );
|
|
|
|
|
COMPARE( fPercentDP );
|
|
|
|
|
COMPARE( fSurviveSeconds );
|
|
|
|
|
COMPARE( sModifiers );
|
|
|
|
|
COMPARE( time );
|
|
|
|
|
COMPARE( sPlayerGuid );
|
|
|
|
|
COMPARE( sMachineGuid );
|
2004-05-25 06:50:04 +00:00
|
|
|
COMPARE( iProductID );
|
2004-05-27 07:59:46 +00:00
|
|
|
FOREACH_TapNoteScore( tns )
|
|
|
|
|
COMPARE( iTapNoteScores[tns] );
|
|
|
|
|
FOREACH_HoldNoteScore( hns )
|
|
|
|
|
COMPARE( iHoldNoteScores[hns] );
|
|
|
|
|
FOREACH_RadarCategory( rc )
|
|
|
|
|
COMPARE( fRadarActual[rc] );
|
2004-05-02 11:35:13 +00:00
|
|
|
#undef COMPARE
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2004-02-10 09:42:01 +00:00
|
|
|
|
|
|
|
|
XNode* CreateNode() const;
|
2004-02-19 03:19:41 +00:00
|
|
|
void LoadFromNode( const XNode* pNode );
|
2004-03-08 02:50:46 +00:00
|
|
|
|
|
|
|
|
CString GetDisplayName() const;
|
2004-02-10 09:42:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct HighScoreList
|
|
|
|
|
{
|
|
|
|
|
int iNumTimesPlayed;
|
|
|
|
|
vector<HighScore> vHighScores;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HighScoreList()
|
|
|
|
|
{
|
|
|
|
|
iNumTimesPlayed = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Init();
|
|
|
|
|
|
2004-05-28 04:46:43 +00:00
|
|
|
void AddHighScore( HighScore hs, int &iIndexOut, bool bIsMachine );
|
2004-02-10 09:42:01 +00:00
|
|
|
|
|
|
|
|
const HighScore& GetTopScore() const;
|
|
|
|
|
|
|
|
|
|
XNode* CreateNode() const;
|
2004-02-19 03:19:41 +00:00
|
|
|
void LoadFromNode( const XNode* pNode );
|
2004-02-10 09:42:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|