00001 /* HighScore - Player scoring data that persists between sessions. */ 00002 00003 #ifndef HighScore_H 00004 #define HighScore_H 00005 00006 #include "Grade.h" 00007 #include "GameConstantsAndTypes.h" 00008 #include "RadarValues.h" 00009 #include "DateTime.h" 00010 00011 struct XNode; 00012 00013 struct HighScore 00014 { 00015 CString sName; // name that shows in the machine's ranking screen 00016 Grade grade; 00017 int iScore; 00018 float fPercentDP; 00019 float fSurviveSeconds; 00020 CString sModifiers; 00021 DateTime dateTime; // return value of time() when screenshot was taken 00022 CString sPlayerGuid; // who made this high score 00023 CString sMachineGuid; // where this high score was made 00024 int iProductID; 00025 int iTapNoteScores[NUM_TAP_NOTE_SCORES]; 00026 int iHoldNoteScores[NUM_HOLD_NOTE_SCORES]; 00027 RadarValues radarValues; 00028 00029 HighScore() { Unset(); } 00030 void Unset() 00031 { 00032 sName = ""; 00033 grade = GRADE_NO_DATA; 00034 iScore = 0; 00035 fPercentDP = 0; 00036 fSurviveSeconds = 0; 00037 sModifiers = ""; 00038 dateTime.Init(); 00039 sPlayerGuid = ""; 00040 sMachineGuid = ""; 00041 iProductID = 0; 00042 ZERO( iTapNoteScores ); 00043 ZERO( iHoldNoteScores ); 00044 radarValues.MakeUnknown(); 00045 } 00046 00047 bool operator>=( const HighScore& other ) const; 00048 bool operator==( const HighScore& other ) const 00049 { 00050 #define COMPARE(x) if( x!=other.x ) return false; 00051 COMPARE( sName ); 00052 COMPARE( grade ); 00053 COMPARE( iScore ); 00054 COMPARE( fPercentDP ); 00055 COMPARE( fSurviveSeconds ); 00056 COMPARE( sModifiers ); 00057 COMPARE( dateTime ); 00058 COMPARE( sPlayerGuid ); 00059 COMPARE( sMachineGuid ); 00060 COMPARE( iProductID ); 00061 FOREACH_TapNoteScore( tns ) 00062 COMPARE( iTapNoteScores[tns] ); 00063 FOREACH_HoldNoteScore( hns ) 00064 COMPARE( iHoldNoteScores[hns] ); 00065 COMPARE( radarValues ); 00066 #undef COMPARE 00067 return true; 00068 } 00069 00070 XNode* CreateNode() const; 00071 void LoadFromNode( const XNode* pNode ); 00072 00073 CString GetDisplayName() const; 00074 }; 00075 00076 struct HighScoreList 00077 { 00078 int iNumTimesPlayed; 00079 vector<HighScore> vHighScores; 00080 00081 00082 HighScoreList() 00083 { 00084 iNumTimesPlayed = 0; 00085 } 00086 00087 void Init(); 00088 00089 void AddHighScore( HighScore hs, int &iIndexOut, bool bIsMachine ); 00090 00091 const HighScore& GetTopScore() const; 00092 00093 XNode* CreateNode() const; 00094 void LoadFromNode( const XNode* pNode ); 00095 }; 00096 00097 struct Screenshot 00098 { 00099 CString sFileName; // no directory part - just the file name 00100 CString sMD5; // MD5 hash of the screenshot file 00101 HighScore highScore; 00102 00103 XNode* CreateNode() const; 00104 void LoadFromNode( const XNode* pNode ); 00105 }; 00106 00107 #endif 00108 00109 /* 00110 * (c) 2004 Chris Danford 00111 * All rights reserved. 00112 * 00113 * Permission is hereby granted, free of charge, to any person obtaining a 00114 * copy of this software and associated documentation files (the 00115 * "Software"), to deal in the Software without restriction, including 00116 * without limitation the rights to use, copy, modify, merge, publish, 00117 * distribute, and/or sell copies of the Software, and to permit persons to 00118 * whom the Software is furnished to do so, provided that the above 00119 * copyright notice(s) and this permission notice appear in all copies of 00120 * the Software and that both the above copyright notice(s) and this 00121 * permission notice appear in supporting documentation. 00122 * 00123 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00124 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00125 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00126 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00127 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00128 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00129 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00130 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00131 * PERFORMANCE OF THIS SOFTWARE. 00132 */