Files
itgmania212121/stepmania/src/HighScore.h
T

133 lines
3.5 KiB
C
Raw Normal View History

2004-05-31 22:42:12 +00:00
/* HighScore - Player scoring data that persists between sessions. */
2004-02-10 09:42:01 +00:00
#ifndef HighScore_H
#define HighScore_H
#include "Grade.h"
#include "GameConstantsAndTypes.h"
2004-07-11 07:21:33 +00:00
#include "RadarValues.h"
2004-07-19 08:05:14 +00:00
#include "DateTime.h"
2004-02-10 09:42:01 +00:00
2004-05-22 01:35:08 +00:00
struct XNode;
2004-07-11 07:21:33 +00:00
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-07-19 08:05:14 +00:00
DateTime dateTime; // 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
int iProductID;
int iTapNoteScores[NUM_TAP_NOTE_SCORES];
int iHoldNoteScores[NUM_HOLD_NOTE_SCORES];
2004-07-11 07:21:33 +00:00
RadarValues radarValues;
2004-03-08 02:50:46 +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;
sModifiers = "";
2004-07-19 08:05:14 +00:00
dateTime.Init();
2004-04-22 22:56:38 +00:00
sPlayerGuid = "";
sMachineGuid = "";
iProductID = 0;
ZERO( iTapNoteScores );
ZERO( iHoldNoteScores );
2004-07-11 07:21:33 +00:00
radarValues.Init();
2004-02-10 09:42:01 +00:00
}
bool operator>=( const HighScore& other ) const;
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 );
2004-07-19 08:05:14 +00:00
COMPARE( dateTime );
COMPARE( sPlayerGuid );
COMPARE( sMachineGuid );
COMPARE( iProductID );
FOREACH_TapNoteScore( tns )
COMPARE( iTapNoteScores[tns] );
FOREACH_HoldNoteScore( hns )
COMPARE( iHoldNoteScores[hns] );
2004-07-11 07:21:33 +00:00
COMPARE( radarValues );
#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();
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
};
2004-06-12 07:01:07 +00:00
struct Screenshot
{
CString sFileName; // no directory part - just the file name
CString sMD5; // MD5 hash of the screenshot file
HighScore highScore;
XNode* CreateNode() const;
void LoadFromNode( const XNode* pNode );
};
2004-02-10 09:42:01 +00:00
#endif
2004-05-31 22:42:12 +00:00
/*
* (c) 2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/