split out Difficulty and CourseDifficulty

add FOREACH_DisplayedCourseDifficulty
This commit is contained in:
Glenn Maynard
2004-05-20 22:08:20 +00:00
parent 6c89fc6878
commit c3426148de
4 changed files with 106 additions and 77 deletions
+63
View File
@@ -0,0 +1,63 @@
#include "global.h"
#include "Difficulty.h"
#include "GameState.h"
#include "ThemeManager.h"
static const CString DifficultyNames[NUM_RADAR_CATEGORIES] = {
"Beginner",
"Easy",
"Medium",
"Hard",
"Challenge",
"Edit",
};
XToString( Difficulty );
XToThemedString( Difficulty );
/* We prefer the above names; recognize a number of others, too. (They'l
* get normalized when written to SMs, etc.) */
Difficulty StringToDifficulty( const CString& sDC )
{
CString s2 = sDC;
s2.MakeLower();
if( s2 == "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;
}
static const CString CourseDifficultyNames[NUM_COURSE_DIFFICULTIES] =
{
"Regular",
"Difficult",
};
XToString( CourseDifficulty );
XToThemedString( CourseDifficulty );
StringToX( CourseDifficulty );
CourseDifficulty GetNextDisplayedCourseDifficulty( CourseDifficulty cd )
{
for( CourseDifficulty d=(CourseDifficulty)(cd+1); d<NUM_COURSE_DIFFICULTIES; ((int&)d)++ )
{
if( GAMESTATE->IsCourseDifficultyShown(d) )
return d;
}
return COURSE_DIFFICULTY_INVALID;
}
+42
View File
@@ -0,0 +1,42 @@
#ifndef DIFFICULTY_H
#define DIFFICULTY_H
#include "EnumHelper.h"
//
// Player number stuff
//
enum Difficulty
{
DIFFICULTY_BEGINNER, // corresponds to DDREX Beginner
DIFFICULTY_EASY, // corresponds to Basic, Easy
DIFFICULTY_MEDIUM, // corresponds to Trick, Another, Standard, Normal
DIFFICULTY_HARD, // corresponds to Maniac, SSR, Heavy, Crazy
DIFFICULTY_CHALLENGE, // corresponds to 5th SMANIAC, MAX2 Challenge, EX Challenge
DIFFICULTY_EDIT,
NUM_DIFFICULTIES,
DIFFICULTY_INVALID
};
#define FOREACH_Difficulty( dc ) FOREACH_ENUM( Difficulty, NUM_DIFFICULTIES, dc )
const CString& DifficultyToString( Difficulty dc );
CString DifficultyToThemedString( Difficulty dc );
Difficulty StringToDifficulty( const CString& sDC );
enum CourseDifficulty
{
COURSE_DIFFICULTY_REGULAR,
COURSE_DIFFICULTY_DIFFICULT,
NUM_COURSE_DIFFICULTIES,
COURSE_DIFFICULTY_INVALID
};
#define FOREACH_CourseDifficulty( cd ) FOREACH_ENUM( CourseDifficulty, NUM_COURSE_DIFFICULTIES, cd )
#define FOREACH_DisplayedCourseDifficulty( cd ) for( CourseDifficulty cd=GetNextDisplayedCourseDifficulty((CourseDifficulty)-1); cd!=COURSE_DIFFICULTY_INVALID; cd=GetNextDisplayedCourseDifficulty(cd) )
const CString& CourseDifficultyToString( CourseDifficulty dc );
CString CourseDifficultyToThemedString( CourseDifficulty dc );
CourseDifficulty StringToCourseDifficulty( const CString& sDC );
CourseDifficulty GetNextDisplayedCourseDifficulty( CourseDifficulty pn );
#endif
-48
View File
@@ -33,54 +33,6 @@ XToString( RadarCategory );
XToThemedString( RadarCategory );
static const CString DifficultyNames[NUM_RADAR_CATEGORIES] = {
"Beginner",
"Easy",
"Medium",
"Hard",
"Challenge",
"Edit",
};
XToString( Difficulty );
XToThemedString( Difficulty );
/* We prefer the above names; recognize a number of others, too. (They'l
* get normalized when written to SMs, etc.) */
Difficulty StringToDifficulty( const CString& sDC )
{
CString s2 = sDC;
s2.MakeLower();
if( s2 == "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;
}
static const CString CourseDifficultyNames[NUM_COURSE_DIFFICULTIES] = {
"Regular",
"Difficult",
};
XToString( CourseDifficulty );
XToThemedString( CourseDifficulty );
StringToX( CourseDifficulty );
static const CString PlayModeNames[NUM_PLAY_MODES] = {
"Arcade",
"Nonstop",
+1 -29
View File
@@ -14,6 +14,7 @@
*/
#include "PlayerNumber.h" // TODO: Get rid of this dependency. -Chris
#include "Difficulty.h" // TODO: Get rid of this dependency.
#include "EnumHelper.h"
//
@@ -84,35 +85,6 @@ struct RadarValues
};
enum Difficulty
{
DIFFICULTY_BEGINNER, // corresponds to DDREX Beginner
DIFFICULTY_EASY, // corresponds to Basic, Easy
DIFFICULTY_MEDIUM, // corresponds to Trick, Another, Standard, Normal
DIFFICULTY_HARD, // corresponds to Maniac, SSR, Heavy, Crazy
DIFFICULTY_CHALLENGE, // corresponds to 5th SMANIAC, MAX2 Challenge, EX Challenge
DIFFICULTY_EDIT,
NUM_DIFFICULTIES,
DIFFICULTY_INVALID
};
#define FOREACH_Difficulty( dc ) FOREACH_ENUM( Difficulty, NUM_DIFFICULTIES, dc )
const CString& DifficultyToString( Difficulty dc );
CString DifficultyToThemedString( Difficulty dc );
Difficulty StringToDifficulty( const CString& sDC );
enum CourseDifficulty
{
COURSE_DIFFICULTY_REGULAR,
COURSE_DIFFICULTY_DIFFICULT,
NUM_COURSE_DIFFICULTIES,
COURSE_DIFFICULTY_INVALID
};
#define FOREACH_CourseDifficulty( cd ) FOREACH_ENUM( CourseDifficulty, NUM_COURSE_DIFFICULTIES, cd )
const CString& CourseDifficultyToString( CourseDifficulty dc );
CString CourseDifficultyToThemedString( CourseDifficulty dc );
CourseDifficulty StringToCourseDifficulty( const CString& sDC );
enum StepsType
{