2004-05-20 22:08:20 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
#include "Difficulty.h"
|
|
|
|
|
#include "GameState.h"
|
2005-02-02 06:53:31 +00:00
|
|
|
#include "ThemeMetric.h"
|
2005-02-23 05:02:47 +00:00
|
|
|
#include "LuaManager.h"
|
2006-01-07 04:11:29 +00:00
|
|
|
#include "LocalizedString.h"
|
2004-05-20 22:08:20 +00:00
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *DifficultyNames[] = {
|
2004-05-20 22:08:20 +00:00
|
|
|
"Beginner",
|
|
|
|
|
"Easy",
|
|
|
|
|
"Medium",
|
|
|
|
|
"Hard",
|
|
|
|
|
"Challenge",
|
|
|
|
|
"Edit",
|
|
|
|
|
};
|
2006-10-15 00:09:18 +00:00
|
|
|
XToString( Difficulty );
|
2006-01-07 04:11:29 +00:00
|
|
|
XToLocalizedString( Difficulty );
|
2006-09-26 07:13:54 +00:00
|
|
|
LuaXType( Difficulty );
|
2004-05-20 22:08:20 +00:00
|
|
|
|
2006-09-26 04:31:59 +00:00
|
|
|
LuaFunction( DifficultyToLocalizedString, DifficultyToLocalizedString( Enum::Check<Difficulty>(L, 1)) );
|
2005-04-02 06:13:58 +00:00
|
|
|
|
2004-05-20 22:08:20 +00:00
|
|
|
/* We prefer the above names; recognize a number of others, too. (They'l
|
|
|
|
|
* get normalized when written to SMs, etc.) */
|
2006-01-22 01:00:06 +00:00
|
|
|
Difficulty StringToDifficulty( const RString& sDC )
|
2004-05-20 22:08:20 +00:00
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s2 = sDC;
|
2004-05-20 22:08:20 +00:00
|
|
|
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;
|
2006-10-07 22:33:24 +00:00
|
|
|
else if( s2 == "challenge" )return DIFFICULTY_CHALLENGE;
|
2004-05-20 22:08:20 +00:00
|
|
|
else if( s2 == "expert" ) return DIFFICULTY_CHALLENGE;
|
|
|
|
|
else if( s2 == "oni" ) return DIFFICULTY_CHALLENGE;
|
|
|
|
|
else if( s2 == "edit" ) return DIFFICULTY_EDIT;
|
2006-10-07 22:33:24 +00:00
|
|
|
else return Difficulty_Invalid;
|
2004-05-20 22:08:20 +00:00
|
|
|
}
|
|
|
|
|
|
2006-10-07 22:34:31 +00:00
|
|
|
|
|
|
|
|
const RString &CourseDifficultyToLocalizedString( CourseDifficulty x )
|
|
|
|
|
{
|
2006-10-07 23:14:58 +00:00
|
|
|
static auto_ptr<LocalizedString> g_CourseDifficultyName[NUM_Difficulty];
|
2006-10-07 22:34:31 +00:00
|
|
|
if( g_CourseDifficultyName[0].get() == NULL )
|
|
|
|
|
{
|
2006-10-07 23:14:58 +00:00
|
|
|
FOREACH_Difficulty(i)
|
2006-10-07 22:34:31 +00:00
|
|
|
{
|
2006-10-07 23:14:58 +00:00
|
|
|
auto_ptr<LocalizedString> ap( new LocalizedString("CourseDifficulty", DifficultyToString(i)) );
|
2006-10-07 22:34:31 +00:00
|
|
|
g_CourseDifficultyName[i] = ap;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return g_CourseDifficultyName[x]->GetValue();
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-07 22:33:24 +00:00
|
|
|
LuaFunction( CourseDifficultyToLocalizedString, CourseDifficultyToLocalizedString(Enum::Check<Difficulty>(L, 1)) );
|
2005-04-02 06:13:58 +00:00
|
|
|
|
2004-05-20 22:12:01 +00:00
|
|
|
CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd )
|
2004-05-20 22:08:20 +00:00
|
|
|
{
|
2006-10-11 06:06:34 +00:00
|
|
|
for( CourseDifficulty d=(CourseDifficulty)(cd+1); d<NUM_Difficulty; enum_add(d, 1) )
|
2004-05-20 22:08:20 +00:00
|
|
|
{
|
|
|
|
|
if( GAMESTATE->IsCourseDifficultyShown(d) )
|
|
|
|
|
return d;
|
|
|
|
|
}
|
2006-10-07 22:33:24 +00:00
|
|
|
return Difficulty_Invalid;
|
2004-05-20 22:08:20 +00:00
|
|
|
}
|
2004-05-31 22:42:12 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2001-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.
|
|
|
|
|
*/
|