SongSortOrder -> SortOrder
save/restore last sort with Profile clean up GameConstants
This commit is contained in:
@@ -15,109 +15,106 @@
|
||||
#include "RageUtil.h"
|
||||
#include "ThemeManager.h"
|
||||
|
||||
const static CString EMPTY_STRING;
|
||||
|
||||
CString RadarCategoryToString( RadarCategory cat )
|
||||
{
|
||||
switch( cat )
|
||||
{
|
||||
case RADAR_STREAM: return "stream";
|
||||
case RADAR_VOLTAGE: return "voltage";
|
||||
case RADAR_AIR: return "air";
|
||||
case RADAR_FREEZE: return "freeze";
|
||||
case RADAR_CHAOS: return "chaos";
|
||||
case RADAR_NUM_TAPS_AND_HOLDS: return "taps";
|
||||
case RADAR_NUM_JUMPS: return "jumps";
|
||||
case RADAR_NUM_HOLDS: return "holds";
|
||||
case RADAR_NUM_MINES: return "mines";
|
||||
case RADAR_NUM_HANDS: return "hands";
|
||||
default: ASSERT(0); return ""; // invalid
|
||||
#define XToString(X) \
|
||||
const CString& X##ToString( X x ) \
|
||||
{ \
|
||||
if( x == ARRAYSIZE(X##Names)+1 ) \
|
||||
return EMPTY_STRING; \
|
||||
ASSERT(unsigned(x) < ARRAYSIZE(X##Names)); \
|
||||
return X##Names[x]; \
|
||||
}
|
||||
}
|
||||
|
||||
CString DifficultyToString( Difficulty dc )
|
||||
{
|
||||
switch( dc )
|
||||
{
|
||||
case DIFFICULTY_BEGINNER: return "beginner";
|
||||
case DIFFICULTY_EASY: return "easy";
|
||||
case DIFFICULTY_MEDIUM: return "medium";
|
||||
case DIFFICULTY_HARD: return "hard";
|
||||
case DIFFICULTY_CHALLENGE: return "challenge";
|
||||
case DIFFICULTY_EDIT: return "edit";
|
||||
default: ASSERT(0); return ""; // invalid Difficulty
|
||||
#define XToThemedString(X) \
|
||||
CString X##ToThemedString( X x ) \
|
||||
{ \
|
||||
return THEME->GetMetric( #X, X##ToString(x) ); \
|
||||
}
|
||||
}
|
||||
|
||||
#define StringToX(X) \
|
||||
X StringTo##X( const CString& s ) \
|
||||
{ \
|
||||
CString s2 = s; \
|
||||
s2.MakeLower(); \
|
||||
for( unsigned i = 0; i < ARRAYSIZE(X##Names); ++i ) \
|
||||
if( !s2.CompareNoCase(X##Names[i]) ) \
|
||||
return (X)i; \
|
||||
return (X)(i+1); /*invalid*/ \
|
||||
}
|
||||
|
||||
|
||||
static const CString RadarCategoryNames[NUM_RADAR_CATEGORIES] = {
|
||||
"stream",
|
||||
"voltage",
|
||||
"air",
|
||||
"freeze",
|
||||
"chaos",
|
||||
"taps",
|
||||
"jumps",
|
||||
"holds",
|
||||
"mines",
|
||||
"hands",
|
||||
};
|
||||
XToString( RadarCategory );
|
||||
|
||||
|
||||
static const CString DifficultyNames[NUM_RADAR_CATEGORIES] = {
|
||||
"beginner",
|
||||
"easy",
|
||||
"medium",
|
||||
"hard",
|
||||
"challenge",
|
||||
"edit",
|
||||
};
|
||||
XToString( Difficulty );
|
||||
|
||||
/* We prefer the above names; recognize a number of others, too. (They'l
|
||||
* get normalized when written to SMs, etc.) */
|
||||
Difficulty StringToDifficulty( CString sDC )
|
||||
Difficulty StringToDifficulty( const CString& sDC )
|
||||
{
|
||||
sDC.MakeLower();
|
||||
if( sDC == "beginner" ) return DIFFICULTY_BEGINNER;
|
||||
else if( sDC == "easy" ) return DIFFICULTY_EASY;
|
||||
else if( sDC == "basic" ) return DIFFICULTY_EASY;
|
||||
else if( sDC == "light" ) return DIFFICULTY_EASY;
|
||||
else if( sDC == "medium" ) return DIFFICULTY_MEDIUM;
|
||||
else if( sDC == "another" ) return DIFFICULTY_MEDIUM;
|
||||
else if( sDC == "trick" ) return DIFFICULTY_MEDIUM;
|
||||
else if( sDC == "standard" ) return DIFFICULTY_MEDIUM;
|
||||
else if( sDC == "difficult") return DIFFICULTY_MEDIUM;
|
||||
else if( sDC == "hard" ) return DIFFICULTY_HARD;
|
||||
else if( sDC == "ssr" ) return DIFFICULTY_HARD;
|
||||
else if( sDC == "maniac" ) return DIFFICULTY_HARD;
|
||||
else if( sDC == "heavy" ) return DIFFICULTY_HARD;
|
||||
else if( sDC == "smaniac" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( sDC == "challenge" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( sDC == "expert" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( sDC == "oni" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( sDC == "edit" ) return DIFFICULTY_EDIT;
|
||||
else return DIFFICULTY_INVALID;
|
||||
CString s2 = sDC;
|
||||
s2.MakeLower();
|
||||
if( sDC == "beginner" ) return DIFFICULTY_BEGINNER;
|
||||
else if( s2 == "easy" ) return DIFFICULTY_EASY;
|
||||
else if( s2 == "basic" ) return DIFFICULTY_EASY;
|
||||
else if( s2 == "light" ) return DIFFICULTY_EASY;
|
||||
else if( s2 == "medium" ) return DIFFICULTY_MEDIUM;
|
||||
else if( s2 == "another" ) return DIFFICULTY_MEDIUM;
|
||||
else if( s2 == "trick" ) return DIFFICULTY_MEDIUM;
|
||||
else if( s2 == "standard" ) return DIFFICULTY_MEDIUM;
|
||||
else if( s2 == "difficult") return DIFFICULTY_MEDIUM;
|
||||
else if( s2 == "hard" ) return DIFFICULTY_HARD;
|
||||
else if( s2 == "ssr" ) return DIFFICULTY_HARD;
|
||||
else if( s2 == "maniac" ) return DIFFICULTY_HARD;
|
||||
else if( s2 == "heavy" ) return DIFFICULTY_HARD;
|
||||
else if( s2 == "smaniac" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( s2 == "challenge" )return DIFFICULTY_CHALLENGE;
|
||||
else if( s2 == "expert" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( s2 == "oni" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( s2 == "edit" ) return DIFFICULTY_EDIT;
|
||||
else return DIFFICULTY_INVALID;
|
||||
}
|
||||
|
||||
|
||||
CString CourseDifficultyToString( CourseDifficulty dc )
|
||||
{
|
||||
switch( dc )
|
||||
{
|
||||
case COURSE_DIFFICULTY_REGULAR: return "regular";
|
||||
case COURSE_DIFFICULTY_DIFFICULT: return "difficult";
|
||||
default: ASSERT(0); return ""; // invalid Difficulty
|
||||
}
|
||||
}
|
||||
|
||||
/* We prefer the above names; recognize a number of others, too. (They'l
|
||||
* get normalized when written to SMs, etc.) */
|
||||
CourseDifficulty StringToCourseDifficulty( CString sDC )
|
||||
{
|
||||
sDC.MakeLower();
|
||||
if( sDC == "regular" ) return COURSE_DIFFICULTY_REGULAR;
|
||||
else if( sDC == "difficult" ) return COURSE_DIFFICULTY_DIFFICULT;
|
||||
else return COURSE_DIFFICULTY_INVALID;
|
||||
}
|
||||
static const CString CourseDifficultyNames[NUM_COURSE_DIFFICULTIES] = {
|
||||
"regular",
|
||||
"difficult",
|
||||
};
|
||||
XToString( CourseDifficulty );
|
||||
StringToX( CourseDifficulty );
|
||||
|
||||
|
||||
CString PlayModeToString( PlayMode pm )
|
||||
{
|
||||
switch( pm )
|
||||
{
|
||||
case PLAY_MODE_ARCADE: return "arcade";
|
||||
case PLAY_MODE_ONI: return "oni";
|
||||
case PLAY_MODE_NONSTOP: return "nonstop";
|
||||
case PLAY_MODE_ENDLESS: return "endless";
|
||||
case PLAY_MODE_BATTLE: return "battle";
|
||||
case PLAY_MODE_RAVE: return "rave";
|
||||
default: ASSERT(0); return "";
|
||||
}
|
||||
}
|
||||
|
||||
PlayMode StringToPlayMode( CString s )
|
||||
{
|
||||
for( int i=0; i<NUM_PLAY_MODES; i++ )
|
||||
if( PlayModeToString((PlayMode)i).CompareNoCase(s) == 0 )
|
||||
return (PlayMode)i;
|
||||
return PLAY_MODE_INVALID;
|
||||
}
|
||||
|
||||
static const CString PlayModeNames[NUM_PLAY_MODES] = {
|
||||
"arcade",
|
||||
"oni",
|
||||
"nonstop",
|
||||
"endless",
|
||||
"battle",
|
||||
"rave",
|
||||
};
|
||||
XToString( PlayMode );
|
||||
StringToX( PlayMode );
|
||||
|
||||
|
||||
RankingCategory AverageMeterToRankingCategory( float fAverageMeter )
|
||||
@@ -128,39 +125,26 @@ RankingCategory AverageMeterToRankingCategory( float fAverageMeter )
|
||||
else return RANKING_D;
|
||||
}
|
||||
|
||||
CString RankingCategoryToString( RankingCategory rc )
|
||||
{
|
||||
switch( rc )
|
||||
{
|
||||
case RANKING_A: return "A";
|
||||
case RANKING_B: return "B";
|
||||
case RANKING_C: return "C";
|
||||
case RANKING_D: return "D";
|
||||
default: FAIL_M( ssprintf("%i", rc) );
|
||||
}
|
||||
}
|
||||
|
||||
RankingCategory StringToRankingCategory( CString rc )
|
||||
{
|
||||
if( rc == "A" ) return RANKING_A;
|
||||
if( rc == "B" ) return RANKING_B;
|
||||
if( rc == "C" ) return RANKING_C;
|
||||
if( rc == "D" ) return RANKING_D;
|
||||
return RANKING_INVALID;
|
||||
}
|
||||
static const CString RankingCategoryNames[NUM_RANKING_CATEGORIES] = {
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
};
|
||||
XToString( RankingCategory );
|
||||
StringToX( RankingCategory );
|
||||
|
||||
CString CoinModeToString( CoinMode cm )
|
||||
{
|
||||
switch( cm )
|
||||
{
|
||||
case COIN_HOME: return "home";
|
||||
case COIN_PAY: return "pay";
|
||||
case COIN_FREE: return "free";
|
||||
default: ASSERT(0); return "";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *SongSortOrderNames[NUM_SORT_ORDERS] = {
|
||||
static const CString CoinModeNames[NUM_COIN_MODES] = {
|
||||
"home",
|
||||
"pay",
|
||||
"free",
|
||||
};
|
||||
XToString( CoinMode );
|
||||
|
||||
|
||||
static const CString SortOrderNames[NUM_SORT_ORDERS] = {
|
||||
"PREFERRED",
|
||||
"GROUP",
|
||||
"TITLE",
|
||||
@@ -180,78 +164,33 @@ static const char *SongSortOrderNames[NUM_SORT_ORDERS] = {
|
||||
"ENDLESS",
|
||||
"ROULETTE"
|
||||
};
|
||||
|
||||
CString SongSortOrderToString( SongSortOrder so )
|
||||
{
|
||||
ASSERT(so < NUM_SORT_ORDERS);
|
||||
return SongSortOrderNames[so];
|
||||
}
|
||||
|
||||
SongSortOrder StringToSongSortOrder( CString str )
|
||||
{
|
||||
for( unsigned i = 0; i < NUM_SORT_ORDERS; ++i)
|
||||
if( !str.CompareNoCase(SongSortOrderNames[i]) )
|
||||
return (SongSortOrder)i;
|
||||
|
||||
return SORT_INVALID;
|
||||
}
|
||||
XToString( SortOrder );
|
||||
StringToX( SortOrder );
|
||||
|
||||
|
||||
CString TapNoteScoreToString( TapNoteScore tns )
|
||||
{
|
||||
switch( tns )
|
||||
{
|
||||
case TNS_NONE: return "None";
|
||||
case TNS_HIT_MINE: return "HitMine";
|
||||
case TNS_MISS: return "Miss";
|
||||
case TNS_BOO: return "Boo";
|
||||
case TNS_GOOD: return "Good";
|
||||
case TNS_GREAT: return "Great";
|
||||
case TNS_PERFECT: return "Perfect";
|
||||
case TNS_MARVELOUS: return "Marvelous";
|
||||
default: ASSERT(0); return ""; // invalid
|
||||
}
|
||||
}
|
||||
|
||||
CString MemoryCardStateToString( MemoryCardState mcs )
|
||||
{
|
||||
switch( mcs )
|
||||
{
|
||||
case MEMORY_CARD_STATE_READY: return "ready";
|
||||
case MEMORY_CARD_STATE_TOO_LATE: return "late";
|
||||
case MEMORY_CARD_STATE_WRITE_ERROR: return "error";
|
||||
case MEMORY_CARD_STATE_NO_CARD: return "none";
|
||||
default: ASSERT(0); return "";
|
||||
}
|
||||
}
|
||||
static const CString TapNoteScoreNames[NUM_TAP_NOTE_SCORES] = {
|
||||
"None",
|
||||
"HitMine",
|
||||
"Miss",
|
||||
"Boo",
|
||||
"Good",
|
||||
"Great",
|
||||
"Perfect",
|
||||
"Marvelous",
|
||||
};
|
||||
XToString( TapNoteScore );
|
||||
|
||||
|
||||
|
||||
#define XToString(X) \
|
||||
CString X##ToString( X x ) \
|
||||
{ \
|
||||
ASSERT(unsigned(x) < ARRAYSIZE(X##Names)); \
|
||||
return X##Names[x]; \
|
||||
}
|
||||
|
||||
#define XToThemedString(X) \
|
||||
CString X##ToThemedString( X x ) \
|
||||
{ \
|
||||
return THEME->GetMetric( #X, X##ToString(x) ); \
|
||||
}
|
||||
|
||||
#define StringToX(X) \
|
||||
X StringTo##X( CString s ) \
|
||||
{ \
|
||||
unsigned i; \
|
||||
for( i = 0; i < ARRAYSIZE(X##Names); ++i ) \
|
||||
if( !s.CompareNoCase(X##Names[i]) ) \
|
||||
return (X)i; \
|
||||
return (X)i; \
|
||||
}
|
||||
static const CString MemoryCardStateNames[NUM_MEMORY_CARD_STATES] = {
|
||||
"ready",
|
||||
"late",
|
||||
"error",
|
||||
"none",
|
||||
};
|
||||
XToString( MemoryCardState );
|
||||
|
||||
|
||||
static const char *PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = {
|
||||
static const CString PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = {
|
||||
"FullComboGreats",
|
||||
"FullComboPerfects",
|
||||
"FullComboMarvelouses",
|
||||
@@ -261,15 +200,16 @@ static const char *PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = {
|
||||
"Greats90Percent",
|
||||
"Greats100Percent",
|
||||
};
|
||||
|
||||
XToString( PerDifficultyAward );
|
||||
XToThemedString( PerDifficultyAward );
|
||||
StringToX( PerDifficultyAward );
|
||||
|
||||
// The number is not at the front so that these strings can be used as XML entity names
|
||||
// The number is not at the back so that "1000" and "10000" don't conflict when
|
||||
// searching for theme elements.
|
||||
static const char *PeakComboAwardNames[NUM_PEAK_COMBO_AWARDS] = {
|
||||
|
||||
// Numbers are intentially not at the front of these strings so that the
|
||||
// strings can be used as XML entity names.
|
||||
// Numbers are intentially not at the back so that "1000" and "10000" don't
|
||||
// conflict when searching for theme elements.
|
||||
static const CString PeakComboAwardNames[NUM_PEAK_COMBO_AWARDS] = {
|
||||
"Peak1000Combo",
|
||||
"Peak2000Combo",
|
||||
"Peak3000Combo",
|
||||
@@ -281,7 +221,6 @@ static const char *PeakComboAwardNames[NUM_PEAK_COMBO_AWARDS] = {
|
||||
"Peak9000Combo",
|
||||
"Peak10000Combo",
|
||||
};
|
||||
|
||||
XToString( PeakComboAward );
|
||||
XToThemedString( PeakComboAward );
|
||||
StringToX( PeakComboAward );
|
||||
|
||||
Reference in New Issue
Block a user