adding CustomDifficulty stuff (themable difficulty /StepsType combinations). Doesn't compile - fixing
This commit is contained in:
@@ -35,17 +35,12 @@ The following packages were exported to your Desktop:=The following packages wer
|
||||
[CatalogXml]
|
||||
Saving %s ...=Saving %s ...
|
||||
|
||||
[DifficultyDisplayType]
|
||||
Single_Beginner=Beginner
|
||||
Single_Easy=Easy
|
||||
Single_Medium=Medium
|
||||
Single_Hard=Hard
|
||||
Single_Challenge=Expert
|
||||
Double_Beginner=Beginner
|
||||
Double_Easy=Easy
|
||||
Double_Medium=Medium
|
||||
Double_Hard=Hard
|
||||
Double_Challenge=Expert
|
||||
[CustomDifficulty]
|
||||
Beginner=Novice
|
||||
Easy=Easy
|
||||
Medium=Medium
|
||||
Hard=Hard
|
||||
Challenge=Expert
|
||||
Edit=Edit
|
||||
Couple=Couple
|
||||
Routine=Routine
|
||||
|
||||
@@ -10,20 +10,15 @@ function PlayerScoreColor( pn )
|
||||
return color("1,1,1,1")
|
||||
end
|
||||
|
||||
local DifficultyDisplayTypeColors = {
|
||||
DifficultyDisplayType_Single_Beginner = color("#ff32f8"),
|
||||
DifficultyDisplayType_Single_Easy = color("#2cff00"),
|
||||
DifficultyDisplayType_Single_Medium = color("#fee600"),
|
||||
DifficultyDisplayType_Single_Hard = color("#ff2f39"),
|
||||
DifficultyDisplayType_Single_Challenge = color("#1cd8ff"),
|
||||
DifficultyDisplayType_Double_Beginner = color("0.0,0.9,1.0,1"), -- light blue
|
||||
DifficultyDisplayType_Double_Easy = color("0.9,0.9,0.0,1"), -- yellow
|
||||
DifficultyDisplayType_Double_Medium = color("1.0,0.1,0.1,1"), -- light red
|
||||
DifficultyDisplayType_Double_Hard = color("0.2,1.0,0.2,1"), -- light green
|
||||
DifficultyDisplayType_Double_Challenge = color("0.2,0.6,1.0,1"), -- blue
|
||||
Difficulty_Edit = color("0.8,0.8,0.8,1"), -- gray
|
||||
Difficulty_Couple = color("#ff9a00"), -- orange
|
||||
Difficulty_Routine = color("#ff9a00"), -- orange
|
||||
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
|
||||
};
|
||||
|
||||
local CourseDifficultyColors = {
|
||||
@@ -34,8 +29,8 @@ local CourseDifficultyColors = {
|
||||
Difficulty_Challenge = color("0.2,0.6,1.0,1"), -- blue
|
||||
};
|
||||
|
||||
function DifficultyDisplayTypeToColor( ddt )
|
||||
local c = DifficultyDisplayTypeColors[ddt]
|
||||
function CustomDifficultyToColor( sCustomDifficulty )
|
||||
local c = CustomDifficultyColors[sCustomDifficulty]
|
||||
if c then return c end
|
||||
return color("#000000");
|
||||
end
|
||||
|
||||
@@ -280,8 +280,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
|
||||
FOREACH_CONST( Difficulty, vDifficultiesToShow, iter )
|
||||
{
|
||||
XNode* pNode3 = pNode2->AppendChild( "Difficulty", DifficultyToString(*iter) );
|
||||
DifficultyDisplayType ddt = MakeDifficultyDisplayType( *iter, StepsTypeCategory_Single ); // TODO: Fix use of Single
|
||||
pNode3->AppendAttr( "DisplayAs", DifficultyDisplayTypeToLocalizedString(ddt) );
|
||||
pNode3->AppendAttr( "DisplayAs", GetLocalizedCustomDifficulty( *iter, StepsTypeCategory_Single ) ); // TODO: Fix use of Single
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "LuaManager.h"
|
||||
#include "LocalizedString.h"
|
||||
|
||||
|
||||
static const char *DifficultyNames[] = {
|
||||
"Beginner",
|
||||
"Easy",
|
||||
@@ -18,26 +17,6 @@ XToString( Difficulty );
|
||||
StringToX( Difficulty );
|
||||
LuaXType( Difficulty );
|
||||
|
||||
static const char *DifficultyDisplayTypeNames[] = {
|
||||
"Single_Beginner",
|
||||
"Single_Easy",
|
||||
"Single_Medium",
|
||||
"Single_Hard",
|
||||
"Single_Challenge",
|
||||
"Double_Beginner",
|
||||
"Double_Easy",
|
||||
"Double_Medium",
|
||||
"Double_Hard",
|
||||
"Double_Challenge",
|
||||
"Edit",
|
||||
"Couple",
|
||||
"Routine",
|
||||
};
|
||||
XToString( DifficultyDisplayType );
|
||||
XToLocalizedString( DifficultyDisplayType );
|
||||
LuaXType( DifficultyDisplayType );
|
||||
LuaFunction( DifficultyDisplayTypeToLocalizedString, DifficultyDisplayTypeToLocalizedString( Enum::Check<DifficultyDisplayType>(L, 1)) );
|
||||
|
||||
/* We prefer the above names; recognize a number of others, too. (They'll
|
||||
* get normalized when written to SMs, etc.) */
|
||||
/* TODO: Format specific hacks should be moved into the file loader for
|
||||
@@ -95,26 +74,46 @@ CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd )
|
||||
return Difficulty_Invalid;
|
||||
}
|
||||
|
||||
DifficultyDisplayType MakeDifficultyDisplayType( Difficulty dc, StepsTypeCategory stc )
|
||||
static ThemeMetric<RString> NAMES("CustomDifficulty","Names");
|
||||
|
||||
RString GetCustomDifficulty( Difficulty dc, StepsTypeCategory stc )
|
||||
{
|
||||
|
||||
RString s;
|
||||
switch( stc )
|
||||
{
|
||||
DEFAULT_FAIL(stc);
|
||||
case StepsTypeCategory_Single:
|
||||
if( dc == Difficulty_Edit )
|
||||
return DifficultyDisplayType_Edit;
|
||||
return (DifficultyDisplayType)(DifficultyDisplayType_Single_Beginner + dc);
|
||||
case StepsTypeCategory_Double:
|
||||
if( dc == Difficulty_Edit )
|
||||
return DifficultyDisplayType_Edit;
|
||||
return (DifficultyDisplayType)(DifficultyDisplayType_Double_Beginner + dc);
|
||||
return "Edit";
|
||||
else
|
||||
{
|
||||
/*
|
||||
// OPTIMIZATION OPPORTUNITY: cache these metrics.
|
||||
vector<RString> vsNames;
|
||||
split( NAMES, ",", vsNames );
|
||||
FOREACH( RString, vsNames, s )
|
||||
{
|
||||
if( STEPS_TYPE
|
||||
|
||||
}
|
||||
*/
|
||||
return DifficultyToString( dc );
|
||||
}
|
||||
case StepsTypeCategory_Couple:
|
||||
return DifficultyDisplayType_Couple;
|
||||
return "Couple";
|
||||
case StepsTypeCategory_Routine:
|
||||
return DifficultyDisplayType_Routine;
|
||||
return "Routine";
|
||||
}
|
||||
}
|
||||
|
||||
const RString& GetLocalizedCustomDifficulty( RString &sCustomDifficulty )
|
||||
{
|
||||
return THEME:GetString( "CustomDifficulty", sCustomDifficultyString );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
@@ -33,31 +33,14 @@ const RString& CourseDifficultyToLocalizedString( Difficulty dc );
|
||||
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.
|
||||
const RString& GetCustomDifficulty( Difficulty dc, StepsTypeCategory stc );
|
||||
const RString& GetLocalizedCustomDifficulty( const RString &sCustomDifficultyString );
|
||||
RString GetLocalizedCustomDifficulty( Difficulty dc, StepsTypeCategory stc ) { return GetLocalizedCustomDifficulty( GetCustomDifficulty( dc, stc ) ); }
|
||||
|
||||
|
||||
enum DifficultyDisplayType // ID for coloring and localized strings in StepsDisplay
|
||||
{
|
||||
DifficultyDisplayType_Single_Beginner,
|
||||
DifficultyDisplayType_Single_Easy,
|
||||
DifficultyDisplayType_Single_Medium,
|
||||
DifficultyDisplayType_Single_Hard,
|
||||
DifficultyDisplayType_Single_Challenge,
|
||||
DifficultyDisplayType_Double_Beginner,
|
||||
DifficultyDisplayType_Double_Easy,
|
||||
DifficultyDisplayType_Double_Medium,
|
||||
DifficultyDisplayType_Double_Hard,
|
||||
DifficultyDisplayType_Double_Challenge,
|
||||
DifficultyDisplayType_Edit,
|
||||
DifficultyDisplayType_Couple, // color this specially (don't color by difficulty) because there isn't usually more than one per song
|
||||
DifficultyDisplayType_Routine, // color this specially (don't color by difficulty) because there isn't usually more than one per song
|
||||
NUM_DifficultyDisplayType,
|
||||
DifficultyDisplayType_Invalid
|
||||
};
|
||||
const RString& DifficultyDisplayTypeToString( DifficultyDisplayType dc );
|
||||
const RString& DifficultyDisplayTypeToLocalizedString( DifficultyDisplayType dc );
|
||||
DifficultyDisplayType StringToDifficultyDisplayType( const RString& s );
|
||||
LuaDeclareType( DifficultyDisplayType );
|
||||
|
||||
DifficultyDisplayType MakeDifficultyDisplayType( Difficulty dc, StepsTypeCategory stc );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -476,8 +476,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
||||
// fall through
|
||||
case ROW_STEPS:
|
||||
{
|
||||
DifficultyDisplayType ddt = MakeDifficultyDisplayType( GetSelectedDifficulty(), GameManager::GetStepsTypeInfo(GetSelectedStepsType()).m_StepsTypeCategory );
|
||||
RString s = DifficultyDisplayTypeToLocalizedString( ddt );
|
||||
RString s = GetLocalizedCustomDifficulty( GetSelectedDifficulty(), GameManager::GetStepsTypeInfo(GetSelectedStepsType()).m_StepsTypeCategory );
|
||||
|
||||
m_textValue[ROW_STEPS].SetText( s );
|
||||
}
|
||||
@@ -526,8 +525,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
||||
}
|
||||
else
|
||||
{
|
||||
DifficultyDisplayType ddt = MakeDifficultyDisplayType( GetSelectedSourceDifficulty(), GameManager::GetStepsTypeInfo(GetSelectedSourceStepsType()).m_StepsTypeCategory );
|
||||
s = DifficultyDisplayTypeToLocalizedString( ddt );
|
||||
s = GetLocalizedCustomDifficulty( GetSelectedSourceDifficulty(), GameManager::GetStepsTypeInfo(GetSelectedSourceStepsType()).m_StepsTypeCategory );
|
||||
}
|
||||
m_textValue[ROW_SOURCE_STEPS].SetText( s );
|
||||
}
|
||||
|
||||
@@ -2288,8 +2288,7 @@ public:
|
||||
for( unsigned i=0; i<vpStepsToShow.size(); i++ )
|
||||
{
|
||||
const Steps* pSteps = vpStepsToShow[i];
|
||||
DifficultyDisplayType ddt = MakeDifficultyDisplayType( pSteps->GetDifficulty(), GameManager::GetStepsTypeInfo(pSteps->m_StepsType).m_StepsTypeCategory );
|
||||
RString sDifficulty = DifficultyDisplayTypeToLocalizedString( ddt );
|
||||
RString sDifficulty = GetLocalizedCustomDifficulty( pSteps->GetDifficulty(), GameManager::GetStepsTypeInfo(pSteps->m_StepsType).m_StepsTypeCategory );
|
||||
|
||||
lua_pushstring( L, sDifficulty );
|
||||
lua_pushstring( L, pSteps->GetDescription() );
|
||||
|
||||
@@ -444,11 +444,10 @@ class OptionRowHandlerListSteps : public OptionRowHandlerList
|
||||
}
|
||||
else
|
||||
{
|
||||
DifficultyDisplayType ddt = MakeDifficultyDisplayType( pSteps->GetDifficulty(), GameManager::GetStepsTypeInfo(pSteps->m_StepsType).m_StepsTypeCategory );
|
||||
if( ddt == DifficultyDisplayType_Edit )
|
||||
s = pSteps->GetDescription();
|
||||
else
|
||||
s = DifficultyDisplayTypeToLocalizedString( ddt );
|
||||
s = GetLocalizedCustomDifficulty( pSteps->GetDifficulty(), GameManager::GetStepsTypeInfo(pSteps->m_StepsType).m_StepsTypeCategory ) );
|
||||
}
|
||||
s += ssprintf( " %d", pSteps->GetMeter() );
|
||||
m_Def.m_vsChoices.push_back( s );
|
||||
@@ -561,8 +560,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
DifficultyDisplayType ddt = MakeDifficultyDisplayType( dc, GameManager::GetStepsTypeInfo( GAMESTATE->m_stEdit ).m_StepsTypeCategory );
|
||||
s = DifficultyDisplayTypeToLocalizedString( ddt );
|
||||
s = DifficultyDisplayTypeToLocalizedString( GetLocalizedCustomDifficulty( dc, GameManager::GetStepsTypeInfo( GAMESTATE->m_stEdit ).m_StepsTypeCategory ) );
|
||||
}
|
||||
m_Def.m_vsChoices.push_back( s );
|
||||
}
|
||||
|
||||
@@ -2889,8 +2889,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
||||
g_StepsInformation.rows[difficulty].choices.clear();
|
||||
FOREACH_ENUM( Difficulty, dc )
|
||||
{
|
||||
DifficultyDisplayType ddt = MakeDifficultyDisplayType( dc, GameManager::GetStepsTypeInfo( pSteps->m_StepsType ).m_StepsTypeCategory );
|
||||
g_StepsInformation.rows[difficulty].choices.push_back( "|" + DifficultyDisplayTypeToString(ddt) );
|
||||
g_StepsInformation.rows[difficulty].choices.push_back( "|" + GetLocalizedCustomDifficulty( dc, GameManager::GetStepsTypeInfo( pSteps->m_StepsType ).m_StepsTypeCategory ) );
|
||||
}
|
||||
g_StepsInformation.rows[difficulty].iDefaultChoice = pSteps->GetDifficulty();
|
||||
g_StepsInformation.rows[difficulty].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full);
|
||||
|
||||
@@ -127,8 +127,7 @@ void ScreenOptionsEditCourseEntry::Init()
|
||||
pHand->m_Def.m_vsChoices.push_back( "(any)" );
|
||||
FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), dc )
|
||||
{
|
||||
DifficultyDisplayType ddt = MakeDifficultyDisplayType( *dc, GameManager::GetStepsTypeInfo( GAMESTATE->m_stEdit ).m_StepsTypeCategory );
|
||||
pHand->m_Def.m_vsChoices.push_back( DifficultyDisplayTypeToLocalizedString(ddt) );
|
||||
pHand->m_Def.m_vsChoices.push_back( GetLocalizedCustomDifficulty( *dc, GameManager::GetStepsTypeInfo( GAMESTATE->m_stEdit ).m_StepsTypeCategory ) );
|
||||
}
|
||||
vHands.push_back( pHand );
|
||||
|
||||
|
||||
@@ -181,9 +181,9 @@ void StepsDisplay::SetFromStepsTypeAndMeterAndCourseDifficulty( StepsType st, in
|
||||
|
||||
void StepsDisplay::SetInternal( const SetParams ¶ms )
|
||||
{
|
||||
DifficultyDisplayType ddt = DifficultyDisplayType_Invalid;
|
||||
RString sCustomDifficulty ;
|
||||
if( params.st != StepsType_Invalid )
|
||||
ddt = MakeDifficultyDisplayType( params.dc, GameManager::GetStepsTypeInfo(params.st).m_StepsTypeCategory );
|
||||
sCustomDifficulty = GetCustomDifficulty( params.dc, GameManager::GetStepsTypeInfo(params.st).m_StepsTypeCategory );
|
||||
|
||||
Message msg( "Set" );
|
||||
if( params.pSteps )
|
||||
@@ -195,7 +195,7 @@ void StepsDisplay::SetInternal( const SetParams ¶ms )
|
||||
msg.SetParam( "Difficulty", params.dc );
|
||||
msg.SetParam( "IsCourseDifficulty", params.bIsCourseDifficulty );
|
||||
msg.SetParam( "Description", params.sDescription );
|
||||
msg.SetParam( "DifficultyDisplayType", ddt );
|
||||
msg.SetParam( "CustomDifficulty", sCustomDifficulty );
|
||||
|
||||
m_sprFrame->HandleMessage( msg );
|
||||
|
||||
@@ -234,18 +234,10 @@ void StepsDisplay::SetInternal( const SetParams ¶ms )
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( ddt )
|
||||
{
|
||||
case DifficultyDisplayType_Invalid:
|
||||
// empty string
|
||||
break;
|
||||
case DifficultyDisplayType_Edit:
|
||||
if( pSteps && pSteps->IsAnEdit() )
|
||||
s = params.sDescription;
|
||||
break;
|
||||
default:
|
||||
s = DifficultyDisplayTypeToLocalizedString( ddt );
|
||||
break;
|
||||
}
|
||||
else
|
||||
s = GetLocalizedCustomDifficulty( sCustomDifficulty );
|
||||
}
|
||||
|
||||
m_textDescription.SetText( s );
|
||||
|
||||
@@ -360,8 +360,7 @@ RString UnlockEntry::GetDescription() const
|
||||
return pSong ? pSong->GetDisplayFullTitle() : "";
|
||||
case UnlockRewardType_Steps:
|
||||
{
|
||||
DifficultyDisplayType ddt = MakeDifficultyDisplayType( m_dc, StepsTypeCategory_Single ); // TODO: Is using "Single" the best thing we can do here?
|
||||
return (pSong ? pSong->GetDisplayFullTitle() : "") + ", " + DifficultyDisplayTypeToLocalizedString( ddt );
|
||||
return (pSong ? pSong->GetDisplayFullTitle() : "") + ", " + GetLocalizedCustomDifficulty( m_dc, StepsTypeCategory_Single ); // TODO: Is using "Single" the best thing we can do here?
|
||||
}
|
||||
case UnlockRewardType_Course:
|
||||
return m_Course.IsValid() ? m_Course.ToCourse()->GetDisplayFullTitle() : "";
|
||||
|
||||
Reference in New Issue
Block a user