Files
itgmania212121/stepmania/src/GameConstantsAndTypes.cpp
T

221 lines
4.9 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-07-27 19:29:51 +00:00
/*
-----------------------------------------------------------------------------
File: GameConstantsAndTypes.cpp
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "GameConstantsAndTypes.h"
#include "GameState.h"
#include "RageUtil.h"
2004-03-07 04:34:49 +00:00
#include "ThemeManager.h"
2004-03-29 09:44:00 +00:00
#include "EnumHelper.h"
2004-03-12 08:31:40 +00:00
static const CString RadarCategoryNames[NUM_RADAR_CATEGORIES] = {
2004-03-25 06:21:58 +00:00
"Stream",
"Voltage",
"Air",
"Freeze",
"Chaos",
"Taps",
"Jumps",
"Holds",
"Mines",
"Hands",
2004-03-12 08:31:40 +00:00
};
XToString( RadarCategory );
XToThemedString( RadarCategory );
2004-03-12 08:31:40 +00:00
static const CString DifficultyNames[NUM_RADAR_CATEGORIES] = {
2004-03-25 06:21:58 +00:00
"Beginner",
"Easy",
"Medium",
"Hard",
"Challenge",
"Edit",
2004-03-12 08:31:40 +00:00
};
XToString( Difficulty );
2004-03-25 06:21:58 +00:00
XToThemedString( Difficulty );
/* We prefer the above names; recognize a number of others, too. (They'l
* get normalized when written to SMs, etc.) */
2004-03-12 08:31:40 +00:00
Difficulty StringToDifficulty( const CString& sDC )
{
2004-03-12 08:31:40 +00:00
CString s2 = sDC;
s2.MakeLower();
2004-03-29 21:08:12 +00:00
if( s2 == "beginner" ) return DIFFICULTY_BEGINNER;
2004-03-12 08:31:40 +00:00
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;
}
2004-03-12 08:31:40 +00:00
static const CString CourseDifficultyNames[NUM_COURSE_DIFFICULTIES] = {
2004-03-25 06:21:58 +00:00
"Regular",
"Difficult",
2004-03-12 08:31:40 +00:00
};
XToString( CourseDifficulty );
2004-03-25 06:21:58 +00:00
XToThemedString( CourseDifficulty );
2004-03-12 08:31:40 +00:00
StringToX( CourseDifficulty );
2002-07-27 19:29:51 +00:00
2004-03-12 08:31:40 +00:00
static const CString PlayModeNames[NUM_PLAY_MODES] = {
2004-03-25 06:21:58 +00:00
"Arcade",
"Nonstop",
"Oni",
"Endless",
"Battle",
"Rave",
2004-03-12 08:31:40 +00:00
};
XToString( PlayMode );
XToThemedString( PlayMode );
2004-03-12 08:31:40 +00:00
StringToX( PlayMode );
2003-01-26 07:33:03 +00:00
RankingCategory AverageMeterToRankingCategory( float fAverageMeter )
{
2003-01-26 07:33:03 +00:00
if( fAverageMeter <= 3 ) return RANKING_A;
else if( fAverageMeter <= 6 ) return RANKING_B;
else if( fAverageMeter <= 9 ) return RANKING_C;
else return RANKING_D;
}
2004-03-12 08:31:40 +00:00
static const CString RankingCategoryNames[NUM_RANKING_CATEGORIES] = {
"a",
"b",
"c",
"d",
};
XToString( RankingCategory );
StringToX( RankingCategory );
2003-06-16 17:28:58 +00:00
2004-03-12 08:31:40 +00:00
static const CString CoinModeNames[NUM_COIN_MODES] = {
"home",
"pay",
"free",
};
XToString( CoinMode );
static const CString SortOrderNames[NUM_SORT_ORDERS] = {
2003-07-20 06:26:29 +00:00
"PREFERRED",
"GROUP",
"TITLE",
"BPM",
"PLAYERS BEST",
"TOP GRADE",
"ARTIST",
"EASY METER",
"MEDIUM METER",
"HARD METER",
2004-01-27 05:37:43 +00:00
"CHALLENGE METER",
2003-07-20 06:26:29 +00:00
"SORT",
2004-01-23 04:40:38 +00:00
"MODE",
2003-07-20 06:26:29 +00:00
"COURSES",
"NONSTOP",
"ONI",
"ENDLESS",
2003-07-20 06:26:29 +00:00
"ROULETTE"
};
2004-03-12 08:31:40 +00:00
XToString( SortOrder );
StringToX( SortOrder );
static const CString TapNoteScoreNames[NUM_TAP_NOTE_SCORES] = {
"None",
"HitMine",
"Miss",
"Boo",
"Good",
"Great",
"Perfect",
"Marvelous",
};
XToString( TapNoteScore );
2004-03-07 04:34:49 +00:00
2004-03-12 08:31:40 +00:00
static const CString MemoryCardStateNames[NUM_MEMORY_CARD_STATES] = {
"ready",
"late",
"error",
"none",
};
XToString( MemoryCardState );
2004-03-07 04:34:49 +00:00
2004-03-12 08:31:40 +00:00
static const CString PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = {
2004-03-07 04:34:49 +00:00
"FullComboGreats",
"FullComboPerfects",
"FullComboMarvelouses",
"SingleDigitGreats",
"SingleDigitPerfects",
2004-03-25 08:32:47 +00:00
"OneGreat",
"OnePerfect",
2004-03-07 04:34:49 +00:00
"Greats80Percent",
"Greats90Percent",
"Greats100Percent",
};
XToString( PerDifficultyAward );
XToThemedString( PerDifficultyAward );
StringToX( PerDifficultyAward );
2004-03-12 08:31:40 +00:00
// 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] = {
2004-03-07 04:34:49 +00:00
"Peak1000Combo",
"Peak2000Combo",
"Peak3000Combo",
"Peak4000Combo",
"Peak5000Combo",
"Peak6000Combo",
"Peak7000Combo",
"Peak8000Combo",
"Peak9000Combo",
"Peak10000Combo",
};
XToString( PeakComboAward );
XToThemedString( PeakComboAward );
StringToX( PeakComboAward );
#include "LuaFunctions.h"
#define LuaXToString(X) \
CString Lua##X##ToString( int n ) \
{ return X##ToString( (X) n ); } \
LuaFunction_Int( X##ToString, Lua##X##ToString(a1) ); /* register it */
#define LuaStringToX(X) \
X LuaStringTo##X( CString s ) \
{ return (X) StringTo##X( s ); } \
LuaFunction_Str( StringTo##X, LuaStringTo##X(str) ); /* register it */
LuaXToString( Difficulty );
LuaStringToX( Difficulty );