CustomDifficulty fixup
This commit is contained in:
@@ -11,14 +11,14 @@ function PlayerScoreColor( pn )
|
||||
end
|
||||
|
||||
local CustomDifficultyColors = {
|
||||
"Beginner" = color("#ff32f8"),
|
||||
"Easy" = color("#2cff00"),
|
||||
"Medium" = color("#fee600"),
|
||||
"Hard" = color("#ff2f39"),
|
||||
"Challenge" = color("#1cd8ff"),
|
||||
"Edit" = color("0.8,0.8,0.8,1"), -- gray
|
||||
"Couple" = color("#ff9a00"), -- orange
|
||||
"Routine" = color("#ff9a00"), -- orange
|
||||
Beginner = color("#ff32f8"),
|
||||
Easy = color("#2cff00"),
|
||||
Medium = color("#fee600"),
|
||||
Hard = color("#ff2f39"),
|
||||
Challenge = color("#1cd8ff"),
|
||||
Edit = color("0.8,0.8,0.8,1"), -- gray
|
||||
Couple = color("#ff9a00"), -- orange
|
||||
Routine = color("#ff9a00"), -- orange
|
||||
};
|
||||
|
||||
local CourseDifficultyColors = {
|
||||
|
||||
@@ -4617,4 +4617,16 @@ PointsCheckpointHit=+1000
|
||||
PointsCheckpointMiss=-200
|
||||
PointsNone=0
|
||||
PointsHoldHeld=+1000
|
||||
PointsHoldLetGo=-500
|
||||
PointsHoldLetGo=-500
|
||||
|
||||
[CustomDifficulty]
|
||||
Names="1,2,3"
|
||||
1StepsType="StepsType_dance-single"
|
||||
1Difficulty="Difficulty_Easy"
|
||||
1String="Easy"
|
||||
2StepsType="StepsType_pump-single"
|
||||
2Difficulty="Difficulty_Hard"
|
||||
2String="Crazy"
|
||||
3StepsType="StepsType_pump-halfdouble"
|
||||
3Difficulty="Difficulty_Invalid"
|
||||
3String="HalfDouble"
|
||||
|
||||
@@ -3,7 +3,3 @@ Center=Center
|
||||
DownLeft=DownLeft
|
||||
DownRight=DownRight
|
||||
|
||||
[DifficultyAndStepsType]
|
||||
Difficulty_Easy-StepsType_Pump_Single=Easy
|
||||
Difficulty_Medium-StepsType_Pump_Single=Medium
|
||||
Difficulty_Hard-StepsType_Pump_Single=Hard
|
||||
|
||||
@@ -280,7 +280,8 @@ void CatalogXml::Save( LoadingWindow *loading_window )
|
||||
FOREACH_CONST( Difficulty, vDifficultiesToShow, iter )
|
||||
{
|
||||
XNode* pNode3 = pNode2->AppendChild( "Difficulty", DifficultyToString(*iter) );
|
||||
pNode3->AppendAttr( "DisplayAs", GetLocalizedCustomDifficulty( *iter, StepsTypeCategory_Single ) ); // TODO: Fix use of Single
|
||||
StepsType st = GameManager::GetHowToPlayStyleForGame( GAMESTATE->m_pCurGame )->m_StepsType; // TODO: Is this the best thing we can do here?
|
||||
pNode3->AppendAttr( "DisplayAs", GetLocalizedCustomDifficulty( st, *iter ) ); // TODO: Fix use of Single
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "ThemeMetric.h"
|
||||
#include "LuaManager.h"
|
||||
#include "LocalizedString.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "GameManager.h"
|
||||
|
||||
static const char *DifficultyNames[] = {
|
||||
"Beginner",
|
||||
@@ -76,12 +78,13 @@ CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd )
|
||||
|
||||
static ThemeMetric<RString> NAMES("CustomDifficulty","Names");
|
||||
|
||||
RString GetCustomDifficulty( Difficulty dc, StepsTypeCategory stc )
|
||||
RString GetCustomDifficulty( StepsType st, Difficulty dc )
|
||||
{
|
||||
RString s;
|
||||
switch( stc )
|
||||
const StepsTypeInfo &sti = GameManager::GetStepsTypeInfo( st );
|
||||
|
||||
switch( sti.m_StepsTypeCategory )
|
||||
{
|
||||
DEFAULT_FAIL(stc);
|
||||
DEFAULT_FAIL(sti.m_StepsTypeCategory);
|
||||
case StepsTypeCategory_Single:
|
||||
case StepsTypeCategory_Double:
|
||||
if( dc == Difficulty_Edit )
|
||||
@@ -90,16 +93,22 @@ RString GetCustomDifficulty( Difficulty dc, StepsTypeCategory stc )
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
// OPTIMIZATION OPPORTUNITY: cache these metrics.
|
||||
// OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting
|
||||
vector<RString> vsNames;
|
||||
split( NAMES, ",", vsNames );
|
||||
FOREACH( RString, vsNames, s )
|
||||
FOREACH( RString, vsNames, sName )
|
||||
{
|
||||
if( STEPS_TYPE
|
||||
|
||||
ThemeMetric<StepsType> STEPS_TYPE("CustomDifficulty",(*sName)+"StepsType");
|
||||
if( STEPS_TYPE == StepsType_Invalid || st == STEPS_TYPE ) // match
|
||||
{
|
||||
ThemeMetric<Difficulty> DIFFICULTY("CustomDifficulty",(*sName)+"Difficulty");
|
||||
if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match
|
||||
{
|
||||
ThemeMetric<RString> STRING("CustomDifficulty",(*sName)+"String");
|
||||
return STRING;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return DifficultyToString( dc );
|
||||
}
|
||||
case StepsTypeCategory_Couple:
|
||||
|
||||
@@ -35,11 +35,9 @@ Difficulty GetNextShownCourseDifficulty( Difficulty pn );
|
||||
|
||||
// CustomDifficulty is a themeable difficulty name based on Difficulty, string matching on StepsType, and bCourse.
|
||||
// It is used to look up localized strings and look up colors.
|
||||
RString GetCustomDifficulty( Difficulty dc, StepsTypeCategory stc );
|
||||
RString GetCustomDifficulty( StepsType st, Difficulty dc );
|
||||
RString GetLocalizedCustomDifficulty( const RString &sCustomDifficulty );
|
||||
static inline RString GetLocalizedCustomDifficulty( Difficulty dc, StepsTypeCategory stc ) { return GetLocalizedCustomDifficulty( GetCustomDifficulty( dc, stc ) ); }
|
||||
|
||||
|
||||
static inline RString GetLocalizedCustomDifficulty( StepsType st, Difficulty dc ) { return GetLocalizedCustomDifficulty( GetCustomDifficulty(st,dc) ); }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -476,7 +476,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
||||
// fall through
|
||||
case ROW_STEPS:
|
||||
{
|
||||
RString s = GetLocalizedCustomDifficulty( GetSelectedDifficulty(), GameManager::GetStepsTypeInfo(GetSelectedStepsType()).m_StepsTypeCategory );
|
||||
RString s = GetLocalizedCustomDifficulty( GetSelectedStepsType(), GetSelectedDifficulty() );
|
||||
|
||||
m_textValue[ROW_STEPS].SetText( s );
|
||||
}
|
||||
@@ -525,7 +525,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
||||
}
|
||||
else
|
||||
{
|
||||
s = GetLocalizedCustomDifficulty( GetSelectedSourceDifficulty(), GameManager::GetStepsTypeInfo(GetSelectedSourceStepsType()).m_StepsTypeCategory );
|
||||
s = GetLocalizedCustomDifficulty( GetSelectedSourceStepsType(), GetSelectedSourceDifficulty() );
|
||||
}
|
||||
m_textValue[ROW_SOURCE_STEPS].SetText( s );
|
||||
}
|
||||
|
||||
@@ -45,14 +45,7 @@ LuaXType( RadarCategory );
|
||||
|
||||
RString StepsTypeToString( StepsType st )
|
||||
{
|
||||
RString s = GameManager::GetStepsTypeInfo( st ).szName;
|
||||
/* foo-bar -> Foo_Bar */
|
||||
s.Replace('-','_');
|
||||
for( size_t i = 0; i < s.size(); ++i )
|
||||
{
|
||||
if( i == 0 || s[i-1] == '_' )
|
||||
s[i] = toupper( s[i] );
|
||||
}
|
||||
RString s = GameManager::GetStepsTypeInfo( st ).szName; // "dance-single"
|
||||
return s;
|
||||
}
|
||||
namespace StringConversion { template<> RString ToString<StepsType>( const StepsType &value ) { return StepsTypeToString(value); } }
|
||||
|
||||
@@ -2288,7 +2288,7 @@ public:
|
||||
for( unsigned i=0; i<vpStepsToShow.size(); i++ )
|
||||
{
|
||||
const Steps* pSteps = vpStepsToShow[i];
|
||||
RString sDifficulty = GetLocalizedCustomDifficulty( pSteps->GetDifficulty(), GameManager::GetStepsTypeInfo(pSteps->m_StepsType).m_StepsTypeCategory );
|
||||
RString sDifficulty = GetLocalizedCustomDifficulty( pSteps->m_StepsType, pSteps->GetDifficulty() );
|
||||
|
||||
lua_pushstring( L, sDifficulty );
|
||||
lua_pushstring( L, pSteps->GetDescription() );
|
||||
|
||||
@@ -447,7 +447,7 @@ class OptionRowHandlerListSteps : public OptionRowHandlerList
|
||||
if( pSteps->IsAnEdit() )
|
||||
s = pSteps->GetDescription();
|
||||
else
|
||||
s = GetLocalizedCustomDifficulty( pSteps->GetDifficulty(), GameManager::GetStepsTypeInfo(pSteps->m_StepsType).m_StepsTypeCategory );
|
||||
s = GetLocalizedCustomDifficulty( pSteps->m_StepsType, pSteps->GetDifficulty() );
|
||||
}
|
||||
s += ssprintf( " %d", pSteps->GetMeter() );
|
||||
m_Def.m_vsChoices.push_back( s );
|
||||
@@ -560,7 +560,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
s = GetLocalizedCustomDifficulty( dc, GameManager::GetStepsTypeInfo( GAMESTATE->m_stEdit ).m_StepsTypeCategory );
|
||||
s = GetLocalizedCustomDifficulty( GAMESTATE->m_stEdit, dc );
|
||||
}
|
||||
m_Def.m_vsChoices.push_back( s );
|
||||
}
|
||||
@@ -736,7 +736,8 @@ class OptionRowHandlerListDifficulties: public OptionRowHandlerList
|
||||
|
||||
FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), d )
|
||||
{
|
||||
RString s = GetLocalizedCustomDifficulty( *d, StepsTypeCategory_Single ); // TODO: Fix use of Single
|
||||
StepsType st = GameManager::GetHowToPlayStyleForGame( GAMESTATE->m_pCurGame )->m_StepsType; // TODO: Is this the best thing we can do here?
|
||||
RString s = GetLocalizedCustomDifficulty( st, *d );
|
||||
|
||||
m_Def.m_vsChoices.push_back( s );
|
||||
GameCommand mc;
|
||||
|
||||
@@ -2889,7 +2889,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
||||
g_StepsInformation.rows[difficulty].choices.clear();
|
||||
FOREACH_ENUM( Difficulty, dc )
|
||||
{
|
||||
g_StepsInformation.rows[difficulty].choices.push_back( "|" + GetLocalizedCustomDifficulty( dc, GameManager::GetStepsTypeInfo( pSteps->m_StepsType ).m_StepsTypeCategory ) );
|
||||
g_StepsInformation.rows[difficulty].choices.push_back( "|" + GetLocalizedCustomDifficulty( pSteps->m_StepsType, dc ) );
|
||||
}
|
||||
g_StepsInformation.rows[difficulty].iDefaultChoice = pSteps->GetDifficulty();
|
||||
g_StepsInformation.rows[difficulty].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full);
|
||||
|
||||
@@ -127,7 +127,7 @@ void ScreenOptionsEditCourseEntry::Init()
|
||||
pHand->m_Def.m_vsChoices.push_back( "(any)" );
|
||||
FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), dc )
|
||||
{
|
||||
pHand->m_Def.m_vsChoices.push_back( GetLocalizedCustomDifficulty( *dc, GameManager::GetStepsTypeInfo( GAMESTATE->m_stEdit ).m_StepsTypeCategory ) );
|
||||
pHand->m_Def.m_vsChoices.push_back( GetLocalizedCustomDifficulty(GAMESTATE->m_stEdit, *dc) );
|
||||
}
|
||||
vHands.push_back( pHand );
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ void ScreenRanking::Init()
|
||||
POINTS_START_Y.Load( m_sName, "PointsStartY" );
|
||||
TIME_START_X.Load( m_sName, "TimeStartX" );
|
||||
TIME_START_Y.Load( m_sName, "TimeStartY" );
|
||||
STEPS_TYPE_COLOR.Load( m_sName,STEPS_TYPE_COLOR_NAME,5 );
|
||||
STEPS_TYPE_COLOR.Load( m_sName,STEPS_TYPE_COLOR_NAME,NUM_RANKING_LINES );
|
||||
|
||||
if( RANKING_TYPE == RankingType_Category )
|
||||
{
|
||||
|
||||
@@ -183,7 +183,7 @@ void StepsDisplay::SetInternal( const SetParams ¶ms )
|
||||
{
|
||||
RString sCustomDifficulty ;
|
||||
if( params.st != StepsType_Invalid )
|
||||
sCustomDifficulty = GetCustomDifficulty( params.dc, GameManager::GetStepsTypeInfo(params.st).m_StepsTypeCategory );
|
||||
sCustomDifficulty = GetCustomDifficulty( params.st, params.dc );
|
||||
|
||||
Message msg( "Set" );
|
||||
if( params.pSteps )
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <float.h>
|
||||
#include "CommonMetrics.h"
|
||||
#include "LuaManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "Style.h"
|
||||
|
||||
UnlockManager* UNLOCKMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -360,7 +362,8 @@ RString UnlockEntry::GetDescription() const
|
||||
return pSong ? pSong->GetDisplayFullTitle() : "";
|
||||
case UnlockRewardType_Steps:
|
||||
{
|
||||
return (pSong ? pSong->GetDisplayFullTitle() : "") + ", " + GetLocalizedCustomDifficulty( m_dc, StepsTypeCategory_Single ); // TODO: Is using "Single" the best thing we can do here?
|
||||
StepsType st = GameManager::GetHowToPlayStyleForGame( GAMESTATE->m_pCurGame )->m_StepsType; // TODO: Is this the best thing we can do here?
|
||||
return (pSong ? pSong->GetDisplayFullTitle() : "") + ", " + GetLocalizedCustomDifficulty( st, m_dc );
|
||||
}
|
||||
case UnlockRewardType_Course:
|
||||
return m_Course.IsValid() ? m_Course.ToCourse()->GetDisplayFullTitle() : "";
|
||||
|
||||
Reference in New Issue
Block a user