diff --git a/stepmania/src/BPMDisplay.h b/stepmania/src/BPMDisplay.h index 308978a37e..502bd42dac 100644 --- a/stepmania/src/BPMDisplay.h +++ b/stepmania/src/BPMDisplay.h @@ -8,6 +8,7 @@ #include "Quad.h" #include "AutoActor.h" #include "ThemeMetric.h" +#include "LocalizedString.h" class Song; class Course; struct DisplayBpms; @@ -34,8 +35,8 @@ protected: ThemeMetric CHANGE_COLOR; ThemeMetric EXTRA_COLOR; ThemeMetric CYCLE; - ThemeMetric SEPARATOR; - ThemeMetric NO_BPM_TEXT; + LocalizedString SEPARATOR; + LocalizedString NO_BPM_TEXT; BitmapText m_textBPM; AutoActor m_sprLabel; diff --git a/stepmania/src/CatalogXml.cpp b/stepmania/src/CatalogXml.cpp index c8209fff4b..2c8193ead6 100644 --- a/stepmania/src/CatalogXml.cpp +++ b/stepmania/src/CatalogXml.cpp @@ -75,7 +75,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) XNode* p3 = p2->AppendChild( "StepsType" ); p3->AppendAttr( "StepsType", GAMEMAN->StepsTypeToString(*st) ); - int iNumStepsInGroupAndStepsType[NUM_DIFFICULTIES]; + int iNumStepsInGroupAndStepsType[NUM_Difficulty]; ZERO( iNumStepsInGroupAndStepsType ); FOREACH_CONST( Song*, vpSongsInGroup, i ) { @@ -250,7 +250,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), iter ) { XNode* pNode3 = pNode2->AppendChild( "Difficulty", DifficultyToString(*iter) ); - pNode3->AppendAttr( "DisplayAs", DifficultyToThemedString(*iter) ); + pNode3->AppendAttr( "DisplayAs", DifficultyToLocalizedString(*iter) ); } } @@ -259,7 +259,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) FOREACH_CONST( CourseDifficulty, CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW.GetValue(), iter ) { XNode* pNode3 = pNode2->AppendChild( "CourseDifficulty", CourseDifficultyToString(*iter) ); - pNode3->AppendAttr( "DisplayAs", CourseDifficultyToThemedString(*iter) ); + pNode3->AppendAttr( "DisplayAs", CourseDifficultyToLocalizedString(*iter) ); } } @@ -268,7 +268,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) FOREACH_CONST( StepsType, vStepsTypesToShow, iter ) { XNode* pNode3 = pNode2->AppendChild( "StepsType", GAMEMAN->StepsTypeToString(*iter) ); - pNode3->AppendAttr( "DisplayAs", GAMEMAN->StepsTypeToThemedString(*iter) ); + pNode3->AppendAttr( "DisplayAs", GAMEMAN->StepsTypeToLocalizedString(*iter) ); } } @@ -279,7 +279,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) if( !SHOW_PLAY_MODE(pm) ) continue; XNode* pNode3 = pNode2->AppendChild( "PlayMode", PlayModeToString(pm) ); - pNode3->AppendAttr( "DisplayAs", PlayModeToThemedString(pm) ); + pNode3->AppendAttr( "DisplayAs", PlayModeToLocalizedString(pm) ); } } @@ -294,7 +294,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) StyleID sID; sID.FromStyle( (*pStyle) ); XNode* pNode3 = pNode2->AppendChild( sID.CreateNode() ); - pNode3->AppendAttr( "DisplayAs", GAMEMAN->StyleToThemedString(*pStyle) ); + pNode3->AppendAttr( "DisplayAs", GAMEMAN->StyleToLocalizedString(*pStyle) ); } } @@ -312,7 +312,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) FOREACH_UsedGrade( g ) { XNode* pNode3 = pNode2->AppendChild( "Grade", GradeToString(g) ); - pNode3->AppendAttr( "DisplayAs", GradeToThemedString(g) ); + pNode3->AppendAttr( "DisplayAs", GradeToLocalizedString(g) ); } } @@ -321,7 +321,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) FOREACH_TapNoteScore( tns ) { XNode* pNode3 = pNode2->AppendChild( "TapNoteScore", TapNoteScoreToString(tns) ); - pNode3->AppendAttr( "DisplayAs", TapNoteScoreToThemedString(tns) ); + pNode3->AppendAttr( "DisplayAs", TapNoteScoreToLocalizedString(tns) ); } } @@ -330,7 +330,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) FOREACH_HoldNoteScore( hns ) { XNode* pNode3 = pNode2->AppendChild( "HoldNoteScore", HoldNoteScoreToString(hns) ); - pNode3->AppendAttr( "DisplayAs", HoldNoteScoreToThemedString(hns) ); + pNode3->AppendAttr( "DisplayAs", HoldNoteScoreToLocalizedString(hns) ); } } @@ -339,7 +339,7 @@ void SaveCatalogXml( LoadingWindow *loading_window ) FOREACH_RadarCategory( rc ) { XNode* pNode3 = pNode2->AppendChild( "RadarValue", RadarCategoryToString(rc) ); - pNode3->AppendAttr( "DisplayAs", RadarCategoryToThemedString(rc) ); + pNode3->AppendAttr( "DisplayAs", RadarCategoryToLocalizedString(rc) ); } } diff --git a/stepmania/src/CommonMetrics.cpp b/stepmania/src/CommonMetrics.cpp index 7b427faf1b..f7ae2a5642 100644 --- a/stepmania/src/CommonMetrics.cpp +++ b/stepmania/src/CommonMetrics.cpp @@ -14,7 +14,7 @@ ThemeMetric CommonMetrics::FIRST_ATTRACT_SCREEN ("Common","FirstA ThemeMetric CommonMetrics::DEFAULT_MODIFIERS ("Common","DefaultModifiers" ); ThemeMetric CommonMetrics::DEFAULT_CPU_MODIFIERS ("Common","DefaultCpuModifiers" ); ThemeMetric1D CommonMetrics::PLAYER_COLOR ("Common",PLAYER_COLOR_NAME,NUM_PLAYERS); -ThemeMetric CommonMetrics::WINDOW_TITLE ("Common","WindowTitle"); +LocalizedString CommonMetrics::WINDOW_TITLE ("Common","WindowTitle"); ThemeMetric CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS("Common","MaxCourseEntriesBeforeShowVarious"); ThemeMetric CommonMetrics::TICK_EARLY_SECONDS ("ScreenGameplay","TickEarlySeconds"); ThemeMetricDifficultiesToShow CommonMetrics::DIFFICULTIES_TO_SHOW ("Common","DifficultiesToShow"); diff --git a/stepmania/src/CommonMetrics.h b/stepmania/src/CommonMetrics.h index 6c4903edaf..7ac143ed67 100644 --- a/stepmania/src/CommonMetrics.h +++ b/stepmania/src/CommonMetrics.h @@ -7,6 +7,7 @@ #include "PlayerNumber.h" #include "Difficulty.h" #include "GameConstantsAndTypes.h" +#include "LocalizedString.h" // @@ -54,7 +55,7 @@ namespace CommonMetrics extern ThemeMetric DEFAULT_MODIFIERS; extern ThemeMetric DEFAULT_CPU_MODIFIERS; extern ThemeMetric1D PLAYER_COLOR; - extern ThemeMetric WINDOW_TITLE; + extern LocalizedString WINDOW_TITLE; extern ThemeMetric MAX_COURSE_ENTRIES_BEFORE_VARIOUS; extern ThemeMetric TICK_EARLY_SECONDS; extern ThemeMetricDifficultiesToShow DIFFICULTIES_TO_SHOW; diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 742be14f0b..750e5b4e07 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -22,6 +22,7 @@ #include #include "CourseLoaderCRS.h" #include "LuaFunctions.h" +#include "LocalizedString.h" static const char *CourseTypeNames[] = { @@ -31,9 +32,9 @@ static const char *CourseTypeNames[] = { "Survival", }; XToString( CourseType, NUM_CourseType ); -XToThemedString( CourseType, NUM_CourseType ); +XToLocalizedString( CourseType ); -LuaFunction( CourseTypeToThemedString, CourseTypeToThemedString((CourseType) IArg(1)) ); +LuaFunction( CourseTypeToLocalizedString, CourseTypeToLocalizedString((CourseType) IArg(1)) ); static const char *SongSortNames[] = { @@ -44,7 +45,7 @@ static const char *SongSortNames[] = { "LowestGrades", }; XToString( SongSort, NUM_SongSort ); -XToThemedString( SongSort, NUM_SongSort ); +XToLocalizedString( SongSort ); /* Maximum lower value of ranges when difficult: */ @@ -67,13 +68,13 @@ CString CourseEntry::GetTextDescription() const if( !sSongGroup.empty() ) vsEntryDescription.push_back( sSongGroup ); if( baseDifficulty != DIFFICULTY_INVALID && baseDifficulty != DIFFICULTY_MEDIUM ) - vsEntryDescription.push_back( DifficultyToThemedString(baseDifficulty) ); + vsEntryDescription.push_back( DifficultyToLocalizedString(baseDifficulty) ); if( iLowMeter != -1 ) vsEntryDescription.push_back( ssprintf("Low meter: %d", iLowMeter) ); if( iHighMeter != -1 ) vsEntryDescription.push_back( ssprintf("High meter: %d", iHighMeter) ); if( songSort != SongSort_Randomize ) - vsEntryDescription.push_back( "Sort: %d" + SongSortToThemedString(songSort) ); + vsEntryDescription.push_back( "Sort: %d" + SongSortToLocalizedString(songSort) ); if( songSort != SongSort_Randomize && iChooseIndex != 0 ) vsEntryDescription.push_back( "Choose " + FormatNumberAndSuffix(iChooseIndex) + " match" ); int iNumModChanges = GetNumModChanges(); diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 1d47a1fc4c..ea9d9d1bcb 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -31,7 +31,7 @@ enum CourseType }; #define FOREACH_CourseType( i ) FOREACH_ENUM( CourseType, NUM_CourseType, i ) const CString& CourseTypeToString( CourseType i ); -const CString& CourseTypeToThemedString( CourseType i ); +const CString& CourseTypeToLocalizedString( CourseType i ); inline PlayMode CourseTypeToPlayMode( CourseType ct ) { return (PlayMode)(PLAY_MODE_NONSTOP+ct); } inline CourseType PlayModeToCourseType( PlayMode pm ) { return (CourseType)(pm-PLAY_MODE_NONSTOP); } @@ -48,7 +48,7 @@ enum SongSort }; #define FOREACH_SongSort( i ) FOREACH_ENUM( SongSort, NUM_SongSort, i ) const CString& SongSortToString( SongSort ss ); -const CString& SongSortToThemedString( SongSort ss ); +const CString& SongSortToLocalizedString( SongSort ss ); class CourseEntry { @@ -125,7 +125,7 @@ public: bool m_bRepeat; // repeat after last song? "Endless" bool m_bShuffle; // play the songs in a random order int m_iLives; // -1 means use bar life meter - int m_iCustomMeter[NUM_DIFFICULTIES]; // -1 = no meter specified + int m_iCustomMeter[NUM_Difficulty]; // -1 = no meter specified bool m_bSortByMeter; vector m_vEntries; diff --git a/stepmania/src/CourseWriterCRS.cpp b/stepmania/src/CourseWriterCRS.cpp index c10301eb29..b8d125be0b 100644 --- a/stepmania/src/CourseWriterCRS.cpp +++ b/stepmania/src/CourseWriterCRS.cpp @@ -60,7 +60,7 @@ bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavin vector asRadarValues; const RadarValues &rv = it->second; - for( int r=0; r < NUM_RADAR_CATEGORIES; r++ ) + for( int r=0; r < NUM_RadarCategory; r++ ) asRadarValues.push_back( ssprintf("%.3f", rv[r]) ); CString sLine = ssprintf( "#RADAR:%i:%i:", st, cd ); sLine += join( ",", asRadarValues ) + ";"; diff --git a/stepmania/src/DateTime.cpp b/stepmania/src/DateTime.cpp index 1a663c2413..609568091f 100644 --- a/stepmania/src/DateTime.cpp +++ b/stepmania/src/DateTime.cpp @@ -207,7 +207,7 @@ CString LastWeekToString( int iLastWeekIndex ) } } -CString LastDayToThemedString( int iLastDayIndex ) +CString LastDayToLocalizedString( int iLastDayIndex ) { CString s = LastDayToString( iLastDayIndex ); s.Replace( "Day", "" ); @@ -215,7 +215,7 @@ CString LastDayToThemedString( int iLastDayIndex ) return s; } -CString LastWeekToThemedString( int iLastWeekIndex ) +CString LastWeekToLocalizedString( int iLastWeekIndex ) { CString s = LastWeekToString( iLastWeekIndex ); s.Replace( "Week", "" ); @@ -223,7 +223,7 @@ CString LastWeekToThemedString( int iLastWeekIndex ) return s; } -CString HourInDayToThemedString( int iHourIndex ) +CString HourInDayToLocalizedString( int iHourIndex ) { int iBeginHour = iHourIndex; iBeginHour--; diff --git a/stepmania/src/DateTime.h b/stepmania/src/DateTime.h index e3d1fb9258..a65e76bd53 100644 --- a/stepmania/src/DateTime.h +++ b/stepmania/src/DateTime.h @@ -12,15 +12,15 @@ enum Month { NUM_Month = 12 }; CString DayInYearToString( int iDayInYearIndex ); CString LastDayToString( int iLastDayIndex ); -CString LastDayToThemedString( int iLastDayIndex ); +CString LastDayToLocalizedString( int iLastDayIndex ); CString DayOfWeekToString( int iDayOfWeekIndex ); -CString DayOfWeekToThemedString( int iDayOfWeekIndex ); +CString DayOfWeekToLocalizedString( int iDayOfWeekIndex ); CString HourInDayToString( int iHourIndex ); -CString HourInDayToThemedString( int iHourIndex ); +CString HourInDayToLocalizedString( int iHourIndex ); const CString &MonthToString( Month month ); const CString &MonthToLocalizedString( Month month ); CString LastWeekToString( int iLastWeekIndex ); -CString LastWeekToThemedString( int iLastWeekIndex ); +CString LastWeekToLocalizedString( int iLastWeekIndex ); tm AddDays( tm start, int iDaysToMove ); tm GetYesterday( tm start ); diff --git a/stepmania/src/Difficulty.cpp b/stepmania/src/Difficulty.cpp index d54b41ea99..2da0374b8f 100644 --- a/stepmania/src/Difficulty.cpp +++ b/stepmania/src/Difficulty.cpp @@ -4,6 +4,7 @@ #include "ThemeMetric.h" #include "LuaManager.h" #include "LuaFunctions.h" +#include "LocalizedString.h" static const char *DifficultyNames[] = { @@ -14,10 +15,10 @@ static const char *DifficultyNames[] = { "Challenge", "Edit", }; -XToString( Difficulty, NUM_DIFFICULTIES ); -XToThemedString( Difficulty, NUM_DIFFICULTIES ); +XToString( Difficulty, NUM_Difficulty ); +XToLocalizedString( Difficulty ); -LuaFunction( DifficultyToThemedString, DifficultyToThemedString((Difficulty) IArg(1)) ); +LuaFunction( DifficultyToLocalizedString, DifficultyToLocalizedString((Difficulty) IArg(1)) ); /* We prefer the above names; recognize a number of others, too. (They'l * get normalized when written to SMs, etc.) */ @@ -54,7 +55,7 @@ static void LuaDifficulty(lua_State* L) s.MakeUpper(); LUA->SetGlobal( "DIFFICULTY_"+s, d ); } - LUA->SetGlobal( "NUM_DIFFICULTIES", NUM_DIFFICULTIES ); + LUA->SetGlobal( "NUM_Difficulty", NUM_Difficulty ); } REGISTER_WITH_LUA_FUNCTION( LuaDifficulty ); @@ -69,15 +70,15 @@ static const char *CourseDifficultyNames[] = "Challenge", "Edit", }; -XToString( CourseDifficulty, NUM_DIFFICULTIES ); -XToThemedString( CourseDifficulty, NUM_DIFFICULTIES ); +XToString( CourseDifficulty, NUM_Difficulty ); +XToLocalizedString( CourseDifficulty ); StringToX( CourseDifficulty ); -LuaFunction( CourseDifficultyToThemedString, CourseDifficultyToThemedString((CourseDifficulty)IArg(1)) ); +LuaFunction( CourseDifficultyToLocalizedString, CourseDifficultyToLocalizedString((CourseDifficulty)IArg(1)) ); CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd ) { - for( CourseDifficulty d=(CourseDifficulty)(cd+1); dIsCourseDifficultyShown(d) ) return d; @@ -93,7 +94,7 @@ static void LuaCourseDifficulty(lua_State* L) s.MakeUpper(); LUA->SetGlobal( "COURSE_DIFFICULTY_"+s, d ); } - LUA->SetGlobal( "NUM_COURSE_DIFFICULTIES", NUM_COURSE_DIFFICULTIES ); + LUA->SetGlobal( "NUM_CourseDifficulty", NUM_CourseDifficulty ); } REGISTER_WITH_LUA_FUNCTION( LuaCourseDifficulty ); diff --git a/stepmania/src/Difficulty.h b/stepmania/src/Difficulty.h index ecd51346bd..144924e34f 100644 --- a/stepmania/src/Difficulty.h +++ b/stepmania/src/Difficulty.h @@ -14,22 +14,22 @@ enum Difficulty DIFFICULTY_HARD, DIFFICULTY_CHALLENGE, DIFFICULTY_EDIT, - NUM_DIFFICULTIES, + NUM_Difficulty, DIFFICULTY_INVALID }; -#define FOREACH_Difficulty( dc ) FOREACH_ENUM( Difficulty, NUM_DIFFICULTIES, dc ) +#define FOREACH_Difficulty( dc ) FOREACH_ENUM( Difficulty, NUM_Difficulty, dc ) const CString& DifficultyToString( Difficulty dc ); -const CString& DifficultyToThemedString( Difficulty dc ); +const CString& DifficultyToLocalizedString( Difficulty dc ); Difficulty StringToDifficulty( const CString& sDC ); typedef Difficulty CourseDifficulty; -#define NUM_COURSE_DIFFICULTIES NUM_DIFFICULTIES +#define NUM_CourseDifficulty NUM_Difficulty #define FOREACH_CourseDifficulty FOREACH_Difficulty #define FOREACH_ShownCourseDifficulty( cd ) for( Difficulty cd=GetNextShownCourseDifficulty((CourseDifficulty)-1); cd!=DIFFICULTY_INVALID; cd=GetNextShownCourseDifficulty(cd) ) const CString& CourseDifficultyToString( Difficulty dc ); -const CString& CourseDifficultyToThemedString( Difficulty dc ); +const CString& CourseDifficultyToLocalizedString( Difficulty dc ); Difficulty StringToCourseDifficulty( const CString& sDC ); Difficulty GetNextShownCourseDifficulty( Difficulty pn ); diff --git a/stepmania/src/DifficultyDisplay.cpp b/stepmania/src/DifficultyDisplay.cpp index c13b211908..daca51ca37 100644 --- a/stepmania/src/DifficultyDisplay.cpp +++ b/stepmania/src/DifficultyDisplay.cpp @@ -14,7 +14,7 @@ DifficultyDisplay::DifficultyDisplay() int diff; for( diff = DIFFICULTY_BEGINNER; diff <= DIFFICULTY_CHALLENGE; ++diff ) { - m_difficulty[diff].Load( THEME->GetPathG("DifficultyDisplay",ssprintf("bar %dx1",NUM_DIFFICULTIES)) ); + m_difficulty[diff].Load( THEME->GetPathG("DifficultyDisplay",ssprintf("bar %dx1",NUM_Difficulty)) ); m_difficulty[diff].SetState(diff); m_difficulty[diff].StopAnimating(); this->AddChild( &m_difficulty[diff] ); diff --git a/stepmania/src/DifficultyDisplay.h b/stepmania/src/DifficultyDisplay.h index a0ea311bcb..6901040237 100644 --- a/stepmania/src/DifficultyDisplay.h +++ b/stepmania/src/DifficultyDisplay.h @@ -16,7 +16,7 @@ public: void UnsetDifficulties(); protected: - Sprite m_difficulty[NUM_DIFFICULTIES]; + Sprite m_difficulty[NUM_Difficulty]; }; #endif diff --git a/stepmania/src/DifficultyIcon.cpp b/stepmania/src/DifficultyIcon.cpp index 1c7422612a..398689f361 100644 --- a/stepmania/src/DifficultyIcon.cpp +++ b/stepmania/src/DifficultyIcon.cpp @@ -22,7 +22,7 @@ bool DifficultyIcon::Load( CString sPath ) { Sprite::Load( sPath ); int iStates = GetNumStates(); - bool bWarn = iStates != NUM_DIFFICULTIES && iStates != NUM_DIFFICULTIES*2; + bool bWarn = iStates != NUM_Difficulty && iStates != NUM_Difficulty*2; if( sPath.find("_blank") != string::npos ) bWarn = false; if( bWarn ) @@ -30,8 +30,8 @@ bool DifficultyIcon::Load( CString sPath ) CString sError = ssprintf( "The difficulty icon graphic '%s' must have %d or %d frames. It has %d states.", sPath.c_str(), - NUM_DIFFICULTIES, - NUM_DIFFICULTIES*2, + NUM_Difficulty, + NUM_Difficulty*2, iStates ); Dialog::OK( sError ); } @@ -75,8 +75,8 @@ void DifficultyIcon::SetFromDifficulty( PlayerNumber pn, Difficulty dc ) m_bBlank = false; switch( GetNumStates() ) { - case NUM_DIFFICULTIES: SetState( dc ); break; - case NUM_DIFFICULTIES*2: SetState( dc*2+pn ); break; + case NUM_Difficulty: SetState( dc ); break; + case NUM_Difficulty*2: SetState( dc*2+pn ); break; default: m_bBlank = true; break; } } diff --git a/stepmania/src/DifficultyList.cpp b/stepmania/src/DifficultyList.cpp index 550884156a..d3b503c4d8 100644 --- a/stepmania/src/DifficultyList.cpp +++ b/stepmania/src/DifficultyList.cpp @@ -14,7 +14,7 @@ #include "Command.h" #include "Foreach.h" -#define MAX_METERS NUM_DIFFICULTIES + MAX_EDITS_PER_SONG +#define MAX_METERS NUM_Difficulty + MAX_EDITS_PER_SONG DifficultyList::DifficultyList() { diff --git a/stepmania/src/DifficultyMeter.cpp b/stepmania/src/DifficultyMeter.cpp index 15d62e6718..06740ab6ec 100644 --- a/stepmania/src/DifficultyMeter.cpp +++ b/stepmania/src/DifficultyMeter.cpp @@ -64,7 +64,7 @@ void DifficultyMeter::Load( const CString &sType ) CString Feet; if( !m_bAutoColorFeet ) { - for( unsigned i = 0; i < NUM_DIFFICULTIES; ++i ) + for( unsigned i = 0; i < NUM_Difficulty; ++i ) Feet += char(i + '0'); // 01234 Feet += 'X'; // Off } diff --git a/stepmania/src/EditMenu.cpp b/stepmania/src/EditMenu.cpp index c5e0643bb5..b1a3a21d89 100644 --- a/stepmania/src/EditMenu.cpp +++ b/stepmania/src/EditMenu.cpp @@ -24,8 +24,8 @@ static const char *EditMenuRowNames[] = { "SourceSteps", "Action" }; -XToString( EditMenuRow, NUM_EDIT_MENU_ROWS ); -XToThemedString( EditMenuRow, NUM_EDIT_MENU_ROWS ); +XToString( EditMenuRow, NUM_EditMenuRow ); +XToLocalizedString( EditMenuRow ); static const char *EditMenuActionNames[] = { "Edit", @@ -34,7 +34,7 @@ static const char *EditMenuActionNames[] = { "Practice", }; XToString( EditMenuAction, NUM_EditMenuAction ); -XToThemedString( EditMenuAction, NUM_EditMenuAction ); +XToLocalizedString( EditMenuAction ); StringToX( EditMenuAction ); static CString ARROWS_X_NAME( size_t i ) { return ssprintf("Arrows%dX",int(i+1)); } @@ -109,9 +109,9 @@ void EditMenu::Load( const CString &sType ) GROUP_BANNER_HEIGHT.Load(sType,"GroupBannerHeight"); ROW_LABELS_X.Load(sType,"RowLabelsX"); ROW_LABEL_ON_COMMAND.Load(sType,"RowLabelOnCommand"); - ROW_VALUE_X.Load(sType,ROW_VALUE_X_NAME,NUM_EDIT_MENU_ROWS); + ROW_VALUE_X.Load(sType,ROW_VALUE_X_NAME,NUM_EditMenuRow); ROW_VALUE_ON_COMMAND.Load(sType,"RowValueOnCommand"); - ROW_Y.Load(sType,ROW_Y_NAME,NUM_EDIT_MENU_ROWS); + ROW_Y.Load(sType,ROW_Y_NAME,NUM_EditMenuRow); EDIT_MODE.Load(sType,"EditMode"); for( int i=0; i<2; i++ ) @@ -130,7 +130,7 @@ void EditMenu::Load( const CString &sType ) { m_textLabel[r].LoadFromFont( THEME->GetPathF(sType,"title") ); m_textLabel[r].SetXY( ROW_LABELS_X, ROW_Y.GetValue(r) ); - m_textLabel[r].SetText( EditMenuRowToThemedString(r) ); + m_textLabel[r].SetText( EditMenuRowToLocalizedString(r) ); m_textLabel[r].RunCommands( ROW_LABEL_ON_COMMAND ); m_textLabel[r].SetHorizAlign( Actor::align_left ); this->AddChild( &m_textLabel[r] ); @@ -238,7 +238,7 @@ bool EditMenu::CanGoUp() bool EditMenu::CanGoDown() { - return m_SelectedRow != NUM_EDIT_MENU_ROWS-1; + return m_SelectedRow != NUM_EditMenuRow-1; } bool EditMenu::CanGoLeft() @@ -359,7 +359,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row ) m_SongTextBanner.LoadFromSong( GetSelectedSong() ); // fall through case ROW_STEPS_TYPE: - m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToThemedString(GetSelectedStepsType()) ); + m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToLocalizedString(GetSelectedStepsType()) ); m_vpSteps.clear(); @@ -437,11 +437,11 @@ void EditMenu::OnRowValueChanged( EditMenuRow row ) s += "-no name-"; else s += pSteps->GetDescription(); - s += " (" + DifficultyToThemedString(DIFFICULTY_EDIT) + ")"; + s += " (" + DifficultyToLocalizedString(DIFFICULTY_EDIT) + ")"; } else { - s = DifficultyToThemedString(GetSelectedDifficulty()); + s = DifficultyToLocalizedString(GetSelectedDifficulty()); // UGLY. "Edit" -> "New Edit" switch( EDIT_MODE.GetValue() ) @@ -466,7 +466,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row ) case ROW_SOURCE_STEPS_TYPE: m_textLabel[ROW_SOURCE_STEPS_TYPE].SetHidden( GetSelectedSteps() ? true : false ); m_textValue[ROW_SOURCE_STEPS_TYPE].SetHidden( GetSelectedSteps() ? true : false ); - m_textValue[ROW_SOURCE_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToThemedString(GetSelectedSourceStepsType()) ); + m_textValue[ROW_SOURCE_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToLocalizedString(GetSelectedSourceStepsType()) ); m_vpSourceSteps.clear(); m_vpSourceSteps.push_back( StepsAndDifficulty(NULL,DIFFICULTY_INVALID) ); // "blank" @@ -501,9 +501,9 @@ void EditMenu::OnRowValueChanged( EditMenuRow row ) if( GetSelectedSourceDifficulty() == DIFFICULTY_INVALID ) s = "Blank"; else if( pSourceSteps && GetSelectedSourceDifficulty() == DIFFICULTY_EDIT ) - s = pSourceSteps->GetDescription() + " (" + DifficultyToThemedString(DIFFICULTY_EDIT) + ")"; + s = pSourceSteps->GetDescription() + " (" + DifficultyToLocalizedString(DIFFICULTY_EDIT) + ")"; else - s = DifficultyToThemedString(GetSelectedSourceDifficulty()); + s = DifficultyToLocalizedString(GetSelectedSourceDifficulty()); m_textValue[ROW_SOURCE_STEPS].SetText( s ); } bool bHideMeter = false; @@ -540,7 +540,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row ) } // fall through case ROW_ACTION: - m_textValue[ROW_ACTION].SetText( EditMenuActionToThemedString(GetSelectedAction()) ); + m_textValue[ROW_ACTION].SetText( EditMenuActionToLocalizedString(GetSelectedAction()) ); break; default: ASSERT(0); // invalid row diff --git a/stepmania/src/EditMenu.h b/stepmania/src/EditMenu.h index ec250d6f07..4e719a342a 100644 --- a/stepmania/src/EditMenu.h +++ b/stepmania/src/EditMenu.h @@ -23,11 +23,11 @@ enum EditMenuRow ROW_SOURCE_STEPS_TYPE, ROW_SOURCE_STEPS, ROW_ACTION, - NUM_EDIT_MENU_ROWS + NUM_EditMenuRow }; -#define FOREACH_EditMenuRow( r ) FOREACH_ENUM( EditMenuRow, NUM_EDIT_MENU_ROWS, r ) +#define FOREACH_EditMenuRow( r ) FOREACH_ENUM( EditMenuRow, NUM_EditMenuRow, r ) const CString& EditMenuRowToString( EditMenuRow r ); -const CString& EditMenuRowToThemedString( EditMenuRow r ); +const CString& EditMenuRowToLocalizedString( EditMenuRow r ); enum EditMenuAction { @@ -39,7 +39,7 @@ enum EditMenuAction }; #define FOREACH_EditMenuAction( ema ) FOREACH_ENUM( EditMenuAction, NUM_EditMenuAction, ema ) const CString& EditMenuActionToString( EditMenuAction ema ); -const CString& EditMenuActionToThemedString( EditMenuAction ema ); +const CString& EditMenuActionToLocalizedString( EditMenuAction ema ); const int NUM_ARROWS = 2; @@ -84,9 +84,9 @@ private: EditMenuRow m_SelectedRow; EditMenuRow GetFirstRow() const { return SHOW_GROUPS.GetValue()? ROW_GROUP:ROW_SONG; } int GetRowSize( EditMenuRow er ) const; - int m_iSelection[NUM_EDIT_MENU_ROWS]; - BitmapText m_textLabel[NUM_EDIT_MENU_ROWS]; - BitmapText m_textValue[NUM_EDIT_MENU_ROWS]; + int m_iSelection[NUM_EditMenuRow]; + BitmapText m_textLabel[NUM_EditMenuRow]; + BitmapText m_textValue[NUM_EditMenuRow]; FadingBanner m_GroupBanner; FadingBanner m_SongBanner; diff --git a/stepmania/src/EnumHelper.h b/stepmania/src/EnumHelper.h index c24356e1c5..189d414033 100644 --- a/stepmania/src/EnumHelper.h +++ b/stepmania/src/EnumHelper.h @@ -68,19 +68,6 @@ static const CString EMPTY_STRING; return *as_##X##Name[x]; \ } -#define XToThemedString(X, CNT) \ - static ThemeMetric g_##X##Name[CNT]; \ - const CString &X##ToThemedString( X x ) \ - { \ - static bool bInitted = false; \ - if( !bInitted ) { \ - bInitted = true; \ - for( unsigned i = 0; i < CNT; ++i ) \ - g_##X##Name[i].Load( #X, X##ToString((X)i) ); \ - } \ - return g_##X##Name[x]; \ - } - #define XToLocalizedString(X) \ const CString &X##ToLocalizedString( X x ) \ { \ diff --git a/stepmania/src/GameConstantsAndTypes.cpp b/stepmania/src/GameConstantsAndTypes.cpp index 8d0b13e392..5912ba234f 100644 --- a/stepmania/src/GameConstantsAndTypes.cpp +++ b/stepmania/src/GameConstantsAndTypes.cpp @@ -10,6 +10,7 @@ #include #include "LuaFunctions.h" +#include "LocalizedString.h" const CString RANKING_TO_FILL_IN_MARKER[NUM_PLAYERS] = {"#P1#","#P2#"}; @@ -28,9 +29,9 @@ static const char *RadarCategoryNames[] = { "Hands", "Rolls" }; -XToString( RadarCategory, NUM_RADAR_CATEGORIES ); -XToThemedString( RadarCategory, NUM_RADAR_CATEGORIES ); -LuaFunction( RadarCategoryToThemedString, RadarCategoryToThemedString((RadarCategory) IArg(1)) ); +XToString( RadarCategory, NUM_RadarCategory ); +XToLocalizedString( RadarCategory ); +LuaFunction( RadarCategoryToLocalizedString, RadarCategoryToLocalizedString((RadarCategory) IArg(1)) ); static void LuaRadarCategory(lua_State* L) { @@ -64,12 +65,12 @@ static const char *PlayModeNames[] = { "Battle", "Rave", }; -XToString( PlayMode, NUM_PLAY_MODES ); -XToThemedString( PlayMode, NUM_PLAY_MODES ); +XToString( PlayMode, NUM_PlayMode ); +XToLocalizedString( PlayMode ); StringToX( PlayMode ); LuaXToString( PlayMode ); -LuaFunction( PlayModeToThemedString, PlayModeToThemedString((PlayMode) IArg(1)) ); -LuaXType( PlayMode, NUM_PLAY_MODES, "PLAY_MODE_", true ) +LuaFunction( PlayModeToLocalizedString, PlayModeToLocalizedString((PlayMode) IArg(1)) ); +LuaXType( PlayMode, NUM_PlayMode, "PLAY_MODE_", true ) RankingCategory AverageMeterToRankingCategory( int iAverageMeter ) { @@ -214,8 +215,8 @@ TapNoteScore StringToTapNoteScore( const CString &s ) return TNS_INVALID; } -XToThemedString( TapNoteScore, NUM_TapNoteScore ); -LuaFunction( TapNoteScoreToThemedString, TapNoteScoreToThemedString((TapNoteScore) IArg(1)) ); +XToLocalizedString( TapNoteScore ); +LuaFunction( TapNoteScoreToLocalizedString, TapNoteScoreToLocalizedString((TapNoteScore) IArg(1)) ); static void LuaTapNoteScores( lua_State* L ) { FOREACH_TapNoteScore( i ) @@ -246,7 +247,7 @@ HoldNoteScore StringToHoldNoteScore( const CString &s ) return HNS_INVALID; } -XToThemedString( HoldNoteScore, NUM_HoldNoteScore ); +XToLocalizedString( HoldNoteScore ); static void LuaHoldNoteScores( lua_State* L ) { FOREACH_HoldNoteScore( i ) @@ -281,10 +282,10 @@ static const char *PerDifficultyAwardNames[] = { "Percent90W3", "Percent100W3", }; -XToString( PerDifficultyAward, NUM_PER_DIFFICULTY_AWARDS ); -XToThemedString( PerDifficultyAward, NUM_PER_DIFFICULTY_AWARDS ); +XToString( PerDifficultyAward, NUM_PerDifficultyAward ); +XToLocalizedString( PerDifficultyAward ); StringToX( PerDifficultyAward ); -LuaFunction( PerDifficultyAwardToThemedString, PerDifficultyAwardToThemedString((PerDifficultyAward) IArg(1)) ); +LuaFunction( PerDifficultyAwardToLocalizedString, PerDifficultyAwardToLocalizedString((PerDifficultyAward) IArg(1)) ); static void LuaPerDifficultyAward( lua_State* L ) { FOREACH_PerDifficultyAward( i ) @@ -308,10 +309,10 @@ static const char *PeakComboAwardNames[] = { "Peak9000Combo", "Peak10000Combo", }; -XToString( PeakComboAward, NUM_PEAK_COMBO_AWARDS ); -XToThemedString( PeakComboAward, NUM_PEAK_COMBO_AWARDS ); +XToString( PeakComboAward, NUM_PeakComboAward ); +XToLocalizedString( PeakComboAward ); StringToX( PeakComboAward ); -LuaFunction( PeakComboAwardToThemedString, PeakComboAwardToThemedString((PeakComboAward) IArg(1)) ); +LuaFunction( PeakComboAwardToLocalizedString, PeakComboAwardToLocalizedString((PeakComboAward) IArg(1)) ); static void LuaPeakComboAward( lua_State* L ) { FOREACH_PeakComboAward( i ) diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index eee26ee67a..0375b27fa6 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -29,11 +29,11 @@ enum RadarCategory RadarCategory_Mines, RadarCategory_Hands, RadarCategory_Rolls, - NUM_RADAR_CATEGORIES // leave this at the end + NUM_RadarCategory // leave this at the end }; -#define FOREACH_RadarCategory( rc ) FOREACH_ENUM( RadarCategory, NUM_RADAR_CATEGORIES, rc ) +#define FOREACH_RadarCategory( rc ) FOREACH_ENUM( RadarCategory, NUM_RadarCategory, rc ) const CString& RadarCategoryToString( RadarCategory cat ); -const CString& RadarCategoryToThemedString( RadarCategory cat ); +const CString& RadarCategoryToLocalizedString( RadarCategory cat ); enum StepsType @@ -82,12 +82,12 @@ enum PlayMode PLAY_MODE_ENDLESS, PLAY_MODE_BATTLE, // manually launched attacks PLAY_MODE_RAVE, // automatically launched attacks - NUM_PLAY_MODES, + NUM_PlayMode, PLAY_MODE_INVALID }; -#define FOREACH_PlayMode( pm ) FOREACH_ENUM( PlayMode, NUM_PLAY_MODES, pm ) +#define FOREACH_PlayMode( pm ) FOREACH_ENUM( PlayMode, NUM_PlayMode, pm ) const CString& PlayModeToString( PlayMode pm ); -const CString& PlayModeToThemedString( PlayMode pm ); +const CString& PlayModeToLocalizedString( PlayMode pm ); PlayMode StringToPlayMode( const CString& s ); @@ -142,7 +142,7 @@ enum TapNoteScore { }; #define FOREACH_TapNoteScore( tns ) FOREACH_ENUM( TapNoteScore, NUM_TapNoteScore, tns ) const CString& TapNoteScoreToString( TapNoteScore tns ); -const CString& TapNoteScoreToThemedString( TapNoteScore tns ); +const CString& TapNoteScoreToLocalizedString( TapNoteScore tns ); TapNoteScore StringToTapNoteScore( const CString& str ); @@ -156,7 +156,7 @@ enum HoldNoteScore }; #define FOREACH_HoldNoteScore( hns ) FOREACH_ENUM( HoldNoteScore, NUM_HoldNoteScore, hns ) const CString& HoldNoteScoreToString( HoldNoteScore hns ); -const CString& HoldNoteScoreToThemedString( HoldNoteScore hns ); +const CString& HoldNoteScoreToLocalizedString( HoldNoteScore hns ); HoldNoteScore StringToHoldNoteScore( const CString& str ); @@ -333,12 +333,12 @@ enum PerDifficultyAward AWARD_PERCENT_80_W3, AWARD_PERCENT_90_W3, AWARD_PERCENT_100_W3, - NUM_PER_DIFFICULTY_AWARDS, + NUM_PerDifficultyAward, PER_DIFFICULTY_AWARD_INVALID, }; -#define FOREACH_PerDifficultyAward( pma ) FOREACH_ENUM( PerDifficultyAward, NUM_PER_DIFFICULTY_AWARDS, pma ) +#define FOREACH_PerDifficultyAward( pma ) FOREACH_ENUM( PerDifficultyAward, NUM_PerDifficultyAward, pma ) const CString& PerDifficultyAwardToString( PerDifficultyAward pma ); -const CString& PerDifficultyAwardToThemedString( PerDifficultyAward pma ); +const CString& PerDifficultyAwardToLocalizedString( PerDifficultyAward pma ); PerDifficultyAward StringToPerDifficultyAward( const CString& pma ); @@ -354,12 +354,12 @@ enum PeakComboAward AWARD_8000_PEAK_COMBO, AWARD_9000_PEAK_COMBO, AWARD_10000_PEAK_COMBO, - NUM_PEAK_COMBO_AWARDS, + NUM_PeakComboAward, PEAK_COMBO_AWARD_INVALID, }; -#define FOREACH_PeakComboAward( pca ) FOREACH_ENUM( PeakComboAward, NUM_PEAK_COMBO_AWARDS, pca ) +#define FOREACH_PeakComboAward( pca ) FOREACH_ENUM( PeakComboAward, NUM_PeakComboAward, pca ) const CString& PeakComboAwardToString( PeakComboAward pma ); -const CString& PeakComboAwardToThemedString( PeakComboAward pma ); +const CString& PeakComboAwardToLocalizedString( PeakComboAward pma ); PeakComboAward StringToPeakComboAward( const CString& pma ); diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index eda20f92f6..73daf34c80 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -2750,7 +2750,7 @@ CString GameManager::StepsTypeToString( StepsType st ) return StepsTypes[st].name; } -CString GameManager::StepsTypeToThemedString( StepsType st ) +CString GameManager::StepsTypeToLocalizedString( StepsType st ) { CString s = StepsTypeToString( st ); if( THEME->HasMetric( "StepsType", s ) ) @@ -2759,7 +2759,7 @@ CString GameManager::StepsTypeToThemedString( StepsType st ) return s; } -CString GameManager::StyleToThemedString( const Style* style ) +CString GameManager::StyleToLocalizedString( const Style* style ) { CString s = style->m_szName; s = Capitalize( s ); @@ -2854,7 +2854,7 @@ class LunaGameManager: public Luna public: LunaGameManager() { LUA->Register( Register ); } - static int StepsTypeToThemedString( T* p, lua_State *L ) { lua_pushstring(L, p->StepsTypeToThemedString((StepsType)IArg(1)) ); return 1; } + static int StepsTypeToLocalizedString( T* p, lua_State *L ) { lua_pushstring(L, p->StepsTypeToLocalizedString((StepsType)IArg(1)) ); return 1; } static int GetFirstStepsTypeForCurrentGame( T* p, lua_State *L ) { vector vstAddTo; @@ -2867,7 +2867,7 @@ public: static void Register(lua_State *L) { - ADD_METHOD( StepsTypeToThemedString ); + ADD_METHOD( StepsTypeToLocalizedString ); ADD_METHOD( GetFirstStepsTypeForCurrentGame ); Luna::Register( L ); diff --git a/stepmania/src/GameManager.h b/stepmania/src/GameManager.h index d039dcfeb7..a3c730886b 100644 --- a/stepmania/src/GameManager.h +++ b/stepmania/src/GameManager.h @@ -31,10 +31,10 @@ public: static int StepsTypeToNumTracks( StepsType st ); static StepsType StringToStepsType( CString sStepsType ); static CString StepsTypeToString( StepsType st ); - static CString StepsTypeToThemedString( StepsType st ); + static CString StepsTypeToLocalizedString( StepsType st ); static const Game* StringToGameType( CString sGameType ); const Style* GameAndStringToStyle( const Game* pGame, CString sStyle ); - static CString StyleToThemedString( const Style* s ); + static CString StyleToLocalizedString( const Style* s ); CString GetMenuButtonSecondaryFunction( const Game *pGame, GameButton gb ) const; // Lua diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 3645daadc9..e60d2fbeea 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -1519,7 +1519,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector &asFeatsOu feat.pCourse = pCourse; feat.Feat = ssprintf("MR #%d in %s", i+1, pCourse->GetDisplayFullTitle().c_str() ); if( cd != DIFFICULTY_MEDIUM ) - feat.Feat += " " + CourseDifficultyToThemedString(cd); + feat.Feat += " " + CourseDifficultyToLocalizedString(cd); feat.pStringToFill = hs.GetNameMutable(); feat.grade = Grade_NoData; feat.iScore = hs.GetScore(); @@ -1735,7 +1735,7 @@ bool GameState::ChangePreferredDifficulty( PlayerNumber pn, int dir ) while( 1 ) { d = (Difficulty)(d+dir); - if( d < 0 || d >= NUM_DIFFICULTIES ) + if( d < 0 || d >= NUM_Difficulty ) return false; if( find(v.begin(), v.end(), d) != v.end() ) break; // found @@ -1767,7 +1767,7 @@ bool GameState::ChangePreferredCourseDifficulty( PlayerNumber pn, int dir ) while( 1 ) { cd = (CourseDifficulty)(cd+dir); - if( cd < 0 || cd >= NUM_DIFFICULTIES ) + if( cd < 0 || cd >= NUM_Difficulty ) return false; if( find(v.begin(),v.end(),cd) == v.end() ) continue; /* not available */ @@ -2103,7 +2103,7 @@ public: for( unsigned i=0; iGetDifficulty() ); + CString sDifficulty = DifficultyToLocalizedString( pSteps->GetDifficulty() ); // HACK: reset capitalization sDifficulty.MakeLower(); diff --git a/stepmania/src/Grade.cpp b/stepmania/src/Grade.cpp index d39de4388d..1149a25572 100644 --- a/stepmania/src/Grade.cpp +++ b/stepmania/src/Grade.cpp @@ -9,7 +9,7 @@ LuaFunction( GradeToString, GradeToString((Grade)IArg(1)) ) -CString GradeToThemedString( Grade g ) +CString GradeToLocalizedString( Grade g ) { CString s = GradeToString(g); if( !THEME->HasMetric("Grade",s) ) diff --git a/stepmania/src/Grade.h b/stepmania/src/Grade.h index 4e95fed431..94647cbecd 100644 --- a/stepmania/src/Grade.h +++ b/stepmania/src/Grade.h @@ -49,7 +49,7 @@ static inline CString GradeToString( Grade g ) } CString GradeToOldString( Grade g ); // "AAA", "B", etc for backward compatibility. Used in announcer -CString GradeToThemedString( Grade g ); +CString GradeToLocalizedString( Grade g ); Grade StringToGrade( const CString &s ); #define FOREACH_Grade( g ) FOREACH_ENUM( Grade, NUM_Grade, g ) #define FOREACH_UsedGrade( g ) FOREACH_ENUM( Grade, THEME->GetMetricI("PlayerStageStats","NumGradeTiersUsed"), g ) diff --git a/stepmania/src/GrooveRadar.h b/stepmania/src/GrooveRadar.h index c7a06c9f7e..6bed6d2f34 100644 --- a/stepmania/src/GrooveRadar.h +++ b/stepmania/src/GrooveRadar.h @@ -45,15 +45,15 @@ protected: bool m_bValuesVisible; float m_PercentTowardNew; - float m_fValuesNew[NUM_RADAR_CATEGORIES]; - float m_fValuesOld[NUM_RADAR_CATEGORIES]; + float m_fValuesNew[NUM_RadarCategory]; + float m_fValuesOld[NUM_RadarCategory]; PlayerNumber m_PlayerNumber; }; Sprite m_sprRadarBase; GrooveRadarValueMap m_GrooveRadarValueMap[NUM_PLAYERS]; - Sprite m_sprRadarLabels[NUM_RADAR_CATEGORIES]; + Sprite m_sprRadarLabels[NUM_RadarCategory]; ActorFrame m_Frame; }; diff --git a/stepmania/src/LocalizedString.cpp b/stepmania/src/LocalizedString.cpp index 54a910a561..b774c649a2 100644 --- a/stepmania/src/LocalizedString.cpp +++ b/stepmania/src/LocalizedString.cpp @@ -29,14 +29,15 @@ RString LocalizedString::LocalizeString( const RString &sSection, const RString return g_pfnLocalizer( sSection, sName ); } +LocalizedString::LocalizedString() +{ + g_Subscribers.Subscribe( this ); +} + LocalizedString::LocalizedString( const RString &sSection, const RString &sName ) { - m_sSection = sSection; - m_sName = sName; - m_sValue = sName; - + Load( sSection, sName ); g_Subscribers.Subscribe( this ); - Refresh(); } @@ -46,6 +47,12 @@ LocalizedString::~LocalizedString() g_Subscribers.Unsubscribe( this ); } +void LocalizedString::Load( const RString &sSection, const RString &sName ) +{ + m_sSection = sSection; + m_sName = sName; + m_sValue = sName; +} LocalizedString::operator RString() const { @@ -54,6 +61,7 @@ LocalizedString::operator RString() const const RString &LocalizedString::GetValue() const { + ASSERT( IsLoaded() ); return m_sValue; } @@ -62,6 +70,11 @@ void LocalizedString::Refresh() m_sValue = LocalizeString( m_sSection, m_sName ); } +bool LocalizedString::IsLoaded() const +{ + return !m_sSection.empty() && !m_sName.empty(); +} + LuaFunction( LocalizeString, LocalizedString::LocalizeString( SArg(1), SArg(2) ) ) /* diff --git a/stepmania/src/LocalizedString.h b/stepmania/src/LocalizedString.h index 785cc78a44..b6e53ed4d8 100644 --- a/stepmania/src/LocalizedString.h +++ b/stepmania/src/LocalizedString.h @@ -11,11 +11,14 @@ public: static RString LocalizeString( const RString &sSection, const RString &sName ); + LocalizedString(); LocalizedString( const RString &sSection, const RString &sName ); ~LocalizedString(); + void Load( const RString &sSection, const RString &sName ); void Refresh(); operator RString() const; const RString &GetValue() const; + bool IsLoaded() const; private: RString m_sSection; RString m_sName; diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index 40e6c061ae..c56c82df05 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -49,7 +49,7 @@ void SMLoader::LoadFromSMTokens( out.SetMeter(atoi(sMeter)); vector saValues; split( sRadarValues, ",", saValues, true ); - if( saValues.size() == NUM_RADAR_CATEGORIES ) + if( saValues.size() == NUM_RadarCategory ) { RadarValues v; FOREACH_RadarCategory(rc) diff --git a/stepmania/src/NotesWriterSM.cpp b/stepmania/src/NotesWriterSM.cpp index b716fc36f5..58b8a7926f 100644 --- a/stepmania/src/NotesWriterSM.cpp +++ b/stepmania/src/NotesWriterSM.cpp @@ -169,7 +169,7 @@ CString NotesWriterSM::GetSMNotesTag( const Song &song, const Steps &in, bool bS lines.push_back( ssprintf( " %s:", DifficultyToString(in.GetDifficulty()).c_str() ) ); lines.push_back( ssprintf( " %d:", in.GetMeter() ) ); - int MaxRadar = bSavingCache? NUM_RADAR_CATEGORIES:5; + int MaxRadar = bSavingCache? NUM_RadarCategory:5; vector asRadarValues; for( int r=0; r < MaxRadar; r++ ) asRadarValues.push_back( ssprintf("%.3f", in.GetRadarValues()[r]) ); diff --git a/stepmania/src/OptionRowHandler.cpp b/stepmania/src/OptionRowHandler.cpp index 1f2654ba1f..47ada0b0b0 100644 --- a/stepmania/src/OptionRowHandler.cpp +++ b/stepmania/src/OptionRowHandler.cpp @@ -317,7 +317,7 @@ public: { Trail* pTrail = vTrails[i]; - CString s = CourseDifficultyToThemedString( pTrail->m_CourseDifficulty ); + CString s = CourseDifficultyToLocalizedString( pTrail->m_CourseDifficulty ); s += ssprintf( " %d", pTrail->GetMeter() ); defOut.m_vsChoices.push_back( s ); GameCommand mc; @@ -340,7 +340,7 @@ public: if( pSteps->GetDifficulty() == DIFFICULTY_EDIT ) s = pSteps->GetDescription(); else - s = DifficultyToThemedString( pSteps->GetDifficulty() ); + s = DifficultyToLocalizedString( pSteps->GetDifficulty() ); s += ssprintf( " %d", pSteps->GetMeter() ); defOut.m_vsChoices.push_back( s ); GameCommand mc; @@ -401,7 +401,7 @@ public: ASSERT( vStyles.size() ); FOREACH_CONST( const Style*, vStyles, s ) { - defOut.m_vsChoices.push_back( GAMEMAN->StyleToThemedString(*s) ); + defOut.m_vsChoices.push_back( GAMEMAN->StyleToLocalizedString(*s) ); GameCommand mc; mc.m_pStyle = *s; ListEntries.push_back( mc ); @@ -463,7 +463,7 @@ public: FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), d ) { - CString s = DifficultyToThemedString( *d ); + CString s = DifficultyToLocalizedString( *d ); defOut.m_vsChoices.push_back( s ); GameCommand mc; @@ -950,7 +950,7 @@ public: FOREACH_CONST( StepsType, m_vStepsTypesToShow, st ) { - CString s = GAMEMAN->StepsTypeToThemedString( *st ); + CString s = GAMEMAN->StepsTypeToLocalizedString( *st ); defOut.m_vsChoices.push_back( s ); } @@ -1085,7 +1085,7 @@ public: } else { - s = DifficultyToThemedString( dc ); + s = DifficultyToLocalizedString( dc ); } defOut.m_vsChoices.push_back( s ); } diff --git a/stepmania/src/PaneDisplay.h b/stepmania/src/PaneDisplay.h index 3df39d5758..fd09168229 100644 --- a/stepmania/src/PaneDisplay.h +++ b/stepmania/src/PaneDisplay.h @@ -11,6 +11,7 @@ #include "GameConstantsAndTypes.h" #include "ThemeMetric.h" class XNode; +#include "LocalizedString.h" enum PaneTypes { @@ -75,8 +76,8 @@ private: PaneTypes m_CurPane; PlayerNumber m_PlayerNumber; - ThemeMetric EMPTY_MACHINE_HIGH_SCORE_NAME; - ThemeMetric NOT_AVAILABLE; + LocalizedString EMPTY_MACHINE_HIGH_SCORE_NAME; + LocalizedString NOT_AVAILABLE; }; #endif diff --git a/stepmania/src/PlayerNumber.cpp b/stepmania/src/PlayerNumber.cpp index 6faef68a51..92a9bc244b 100644 --- a/stepmania/src/PlayerNumber.cpp +++ b/stepmania/src/PlayerNumber.cpp @@ -2,14 +2,14 @@ #include "PlayerNumber.h" #include "GameState.h" #include "LuaManager.h" -#include "ThemeMetric.h" +#include "LocalizedString.h" static const char *PlayerNumberNames[] = { "P1", "P2", }; XToString( PlayerNumber, NUM_PLAYERS ); -XToThemedString( PlayerNumber, NUM_PLAYERS ); +XToLocalizedString( PlayerNumber ); void LuaPlayerNumber(lua_State* L) { @@ -31,7 +31,7 @@ static const char *MultiPlayerNames[] = { "P8", }; XToString( MultiPlayer, NUM_MultiPlayer ); -XToThemedString( MultiPlayer, NUM_MultiPlayer ); +XToLocalizedString( MultiPlayer ); PlayerNumber GetNextHumanPlayer( PlayerNumber pn ) diff --git a/stepmania/src/PlayerNumber.h b/stepmania/src/PlayerNumber.h index d29e5ee5fa..eafb8d8a8f 100644 --- a/stepmania/src/PlayerNumber.h +++ b/stepmania/src/PlayerNumber.h @@ -13,11 +13,12 @@ enum PlayerNumber { PLAYER_1 = 0, PLAYER_2, - NUM_PLAYERS, // leave this at the end + NUM_PlayerNumber, // leave this at the end PLAYER_INVALID }; +const int NUM_PLAYERS = NUM_PlayerNumber; const CString& PlayerNumberToString( PlayerNumber pn ); -const CString& PlayerNumberToThemedString( PlayerNumber pn ); +const CString& PlayerNumberToLocalizedString( PlayerNumber pn ); #define FOREACH_PlayerNumber( pn ) FOREACH_ENUM( PlayerNumber, NUM_PLAYERS, pn ) #define FOREACH_HumanPlayer( pn ) for( PlayerNumber pn=GetNextHumanPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextHumanPlayer(pn) ) @@ -47,7 +48,7 @@ enum MultiPlayer MultiPlayer_INVALID }; const CString& MultiPlayerToString( MultiPlayer mp ); -const CString& MultiPlayerToThemedString( MultiPlayer mp ); +const CString& MultiPlayerToLocalizedString( MultiPlayer mp ); #define FOREACH_MultiPlayer( pn ) FOREACH_ENUM( MultiPlayer, NUM_MultiPlayer, pn ) diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index 9ce0f4ff80..0f9b441df3 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -137,13 +137,13 @@ public: mutable DateTime m_LastPlayedDate; /* These stats count twice in the machine profile if two players are playing; * that's the only approach that makes sense for ByDifficulty and ByMeter. */ - int m_iNumSongsPlayedByPlayMode[NUM_PLAY_MODES]; + int m_iNumSongsPlayedByPlayMode[NUM_PlayMode]; map m_iNumSongsPlayedByStyle; - int m_iNumSongsPlayedByDifficulty[NUM_DIFFICULTIES]; + int m_iNumSongsPlayedByDifficulty[NUM_Difficulty]; int m_iNumSongsPlayedByMeter[MAX_METER+1]; /* This stat counts once per song, even if two players are active. */ int m_iNumTotalSongsPlayed; - int m_iNumStagesPassedByPlayMode[NUM_PLAY_MODES]; + int m_iNumStagesPassedByPlayMode[NUM_PlayMode]; int m_iNumStagesPassedByGrade[NUM_Grade]; // diff --git a/stepmania/src/RadarValues.cpp b/stepmania/src/RadarValues.cpp index a650998e8c..d9ba618bb5 100644 --- a/stepmania/src/RadarValues.cpp +++ b/stepmania/src/RadarValues.cpp @@ -63,8 +63,8 @@ void RadarValues::LoadFromNode( const XNode* pNode ) CString RadarValues::ToString( int iMaxValues ) const { if( iMaxValues == -1 ) - iMaxValues = NUM_RADAR_CATEGORIES; - iMaxValues = min( iMaxValues, (int)NUM_RADAR_CATEGORIES ); + iMaxValues = NUM_RadarCategory; + iMaxValues = min( iMaxValues, (int)NUM_RadarCategory ); vector asRadarValues; for( int r=0; r < iMaxValues; r++ ) @@ -78,7 +78,7 @@ void RadarValues::FromString( CString sRadarValues ) vector saValues; split( sRadarValues, ",", saValues, true ); - if( saValues.size() != NUM_RADAR_CATEGORIES ) + if( saValues.size() != NUM_RadarCategory ) { MakeUnknown(); return; diff --git a/stepmania/src/RadarValues.h b/stepmania/src/RadarValues.h index 9ded5a7cca..179d71feb9 100644 --- a/stepmania/src/RadarValues.h +++ b/stepmania/src/RadarValues.h @@ -27,7 +27,7 @@ struct RadarValues float fNumHands; float fNumRolls; } v; - float f[NUM_RADAR_CATEGORIES]; + float f[NUM_RadarCategory]; } m_Values; operator const float* () const { return m_Values.f; }; diff --git a/stepmania/src/ScreenBookkeeping.cpp b/stepmania/src/ScreenBookkeeping.cpp index a72f095d02..19544075ee 100644 --- a/stepmania/src/ScreenBookkeeping.cpp +++ b/stepmania/src/ScreenBookkeeping.cpp @@ -134,7 +134,7 @@ void ScreenBookkeeping::ChangeView( View newView ) CString sTitle, sData; for( int i=0; i &iAns g_StepsInformation.rows[difficulty].choices.clear(); FOREACH_Difficulty( dc ) - g_StepsInformation.rows[difficulty].choices.push_back( "|" + DifficultyToThemedString(pSteps->GetDifficulty()) ); + g_StepsInformation.rows[difficulty].choices.push_back( "|" + DifficultyToLocalizedString(pSteps->GetDifficulty()) ); g_StepsInformation.rows[difficulty].iDefaultChoice = pSteps->GetDifficulty(); g_StepsInformation.rows[difficulty].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full); g_StepsInformation.rows[meter].iDefaultChoice = clamp( pSteps->GetMeter()-1, 0, MAX_METER+1 ); diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index 65a7fd6aca..c2ff303220 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -139,7 +139,7 @@ static CString GetCopyDescription( const Steps *pSourceSteps ) if( pSourceSteps->GetDifficulty() == DIFFICULTY_EDIT ) s = pSourceSteps->GetDescription(); else - s = DifficultyToThemedString( pSourceSteps->GetDifficulty() ); + s = DifficultyToLocalizedString( pSourceSteps->GetDifficulty() ); return s; } diff --git a/stepmania/src/ScreenEnding.cpp b/stepmania/src/ScreenEnding.cpp index 817db21844..afa07064fe 100644 --- a/stepmania/src/ScreenEnding.cpp +++ b/stepmania/src/ScreenEnding.cpp @@ -30,7 +30,7 @@ CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line ) case PERCENT_COMPLETE: { StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; - CString sStepsType = GAMEMAN->StepsTypeToThemedString(st); + CString sStepsType = GAMEMAN->StepsTypeToLocalizedString(st); CString sType = GAMESTATE->IsCourseMode() ? "Courses" : "Songs"; return ssprintf( "%s %s %%", sStepsType.c_str(), sType.c_str() ); } @@ -42,16 +42,16 @@ CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line ) if( GAMESTATE->IsCourseMode() ) { CourseDifficulty cd = (CourseDifficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY); - ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES ); + ASSERT( cd >= 0 && cd < NUM_CourseDifficulty ); if( !GAMESTATE->IsCourseDifficultyShown(cd) ) return CString(); - return CourseDifficultyToThemedString(cd); + return CourseDifficultyToLocalizedString(cd); } else { Difficulty dc = (Difficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY); - ASSERT( dc >= 0 && dc < NUM_DIFFICULTIES ); - return DifficultyToThemedString(dc); + ASSERT( dc >= 0 && dc < NUM_Difficulty ); + return DifficultyToLocalizedString(dc); } } default: ASSERT(0); return CString(); @@ -101,22 +101,22 @@ CString GetStatsLineValue( PlayerNumber pn, EndingStatsLine line ) case PERCENT_COMPLETE_CHALLENGE: // Ugly... { - CString sStepsType = GAMEMAN->StepsTypeToThemedString(st); + CString sStepsType = GAMEMAN->StepsTypeToLocalizedString(st); float fPercent = 0; if( GAMESTATE->IsCourseMode() ) { CourseDifficulty cd = (CourseDifficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY); - ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES ); + ASSERT( cd >= 0 && cd < NUM_CourseDifficulty ); if( !GAMESTATE->IsCourseDifficultyShown(cd) ) return CString(); - CString sDifficulty = CourseDifficultyToThemedString(cd); + CString sDifficulty = CourseDifficultyToLocalizedString(cd); fPercent = pProfile->GetCoursesPercentComplete(st,cd); } else { Difficulty dc = (Difficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY); - ASSERT( dc >= 0 && dc < NUM_DIFFICULTIES ); - CString sDifficulty = DifficultyToThemedString(dc); + ASSERT( dc >= 0 && dc < NUM_Difficulty ); + CString sDifficulty = DifficultyToLocalizedString(dc); fPercent = pProfile->GetSongsPercentComplete(st,dc); } return ssprintf( "%05.2f%%", fPercent*100 ); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index b5f57f0fdf..5f9977cb52 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -206,7 +206,7 @@ void ScreenEvaluation::Init() // { FOREACH_PlayerNumber( p ) // foreach line - for( int r=0; rm_CurStageStats.radarPossible[p][r] = 0.5f + r/10.0f; STATSMAN->m_CurStageStats.radarActual[p][r] = 0.5f + r/10.0f; diff --git a/stepmania/src/ScreenEvaluation.h b/stepmania/src/ScreenEvaluation.h index 12e99b56a8..2d37faa25e 100644 --- a/stepmania/src/ScreenEvaluation.h +++ b/stepmania/src/ScreenEvaluation.h @@ -76,8 +76,8 @@ protected: // bonus area AutoActor m_sprBonusFrame[NUM_PLAYERS]; - Sprite m_sprPossibleBar[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; - Sprite m_sprActualBar[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; + Sprite m_sprPossibleBar[NUM_PLAYERS][NUM_RadarCategory]; + Sprite m_sprActualBar[NUM_PLAYERS][NUM_RadarCategory]; // survived area AutoActor m_sprSurvivedFrame[NUM_PLAYERS]; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 118930f6e4..0d5c0ffcff 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -702,7 +702,7 @@ void ScreenGameplay::Init() { ASSERT( pi->m_pDifficultyIcon == NULL ); pi->m_pDifficultyIcon = new DifficultyIcon; - pi->m_pDifficultyIcon->Load( THEME->GetPathG(m_sName,ssprintf("difficulty icons %dx%d",NUM_PLAYERS,NUM_DIFFICULTIES)) ); + pi->m_pDifficultyIcon->Load( THEME->GetPathG(m_sName,ssprintf("difficulty icons %dx%d",NUM_PLAYERS,NUM_Difficulty)) ); /* Position it in LoadNextSong. */ this->AddChild( pi->m_pDifficultyIcon ); diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index af3dfb81b8..ce1433093e 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -119,8 +119,8 @@ public: protected: ThemeMetric PLAYER_TYPE; - ThemeMetric GIVE_UP_TEXT; - ThemeMetric GIVE_UP_ABORTED_TEXT; + LocalizedString GIVE_UP_TEXT; + LocalizedString GIVE_UP_ABORTED_TEXT; ThemeMetric MUSIC_FADE_OUT_SECONDS; ThemeMetric START_GIVES_UP; ThemeMetric BACK_GIVES_UP; diff --git a/stepmania/src/ScreenNameEntryTraditional.h b/stepmania/src/ScreenNameEntryTraditional.h index ec46722646..1f35809b57 100644 --- a/stepmania/src/ScreenNameEntryTraditional.h +++ b/stepmania/src/ScreenNameEntryTraditional.h @@ -14,6 +14,7 @@ #include "ThemeMetric.h" #include "DifficultyMeter.h" #include "RageSound.h" +#include "LocalizedString.h" class HighScoreWheelItem : public ActorFrame @@ -70,7 +71,7 @@ private: ThemeMetric NUM_ALPHABET_DISPLAYED; ThemeMetric MAX_RANKING_NAME_LENGTH; ThemeMetric FEAT_INTERVAL; - ThemeMetric KEYBOARD_LETTERS; + LocalizedString KEYBOARD_LETTERS; ActorFrame m_Keyboard[NUM_PLAYERS]; Sprite m_sprCursor[NUM_PLAYERS]; diff --git a/stepmania/src/ScreenNetSelectMusic.cpp b/stepmania/src/ScreenNetSelectMusic.cpp index 0643acdd97..3dcd4988bc 100644 --- a/stepmania/src/ScreenNetSelectMusic.cpp +++ b/stepmania/src/ScreenNetSelectMusic.cpp @@ -61,7 +61,7 @@ void ScreenNetSelectMusic::Init() m_DifficultyIcon[p].SetName( ssprintf("DifficultyIconP%d",p+1) ); m_DifficultyIcon[p].Load( THEME->GetPathG( "ScreenSelectMusic", ssprintf("difficulty icons 1x%d", - NUM_DIFFICULTIES)) ); + NUM_Difficulty)) ); SET_XY( m_DifficultyIcon[p] ); this->AddChild( &m_DifficultyIcon[p] ); ON_COMMAND( m_DifficultyIcon[p] ); @@ -365,20 +365,20 @@ void ScreenNetSelectMusic::MenuDown( const InputEventPlus &input ) vector MultiSteps; MultiSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st ); if (MultiSteps.size() == 0) - m_DC[pn] = NUM_DIFFICULTIES; + m_DC[pn] = NUM_Difficulty; else { int i; - bool dcs[NUM_DIFFICULTIES]; + bool dcs[NUM_Difficulty]; - for ( i=0; iGetDifficulty()] = true; - for ( i=0; i m_DC[pn]) ) { @@ -387,8 +387,8 @@ void ScreenNetSelectMusic::MenuDown( const InputEventPlus &input ) } } //If failed to go up, loop - if ( i == NUM_DIFFICULTIES ) - for (i = 0;im_pCurSong->GetStepsByDifficulty( st, m_DC[pn] ); GAMESTATE->m_pCurSteps[pn].Set( pSteps ); - if ( ( m_DC[pn] < NUM_DIFFICULTIES ) && ( m_DC[pn] >= DIFFICULTY_BEGINNER ) ) + if ( ( m_DC[pn] < NUM_Difficulty ) && ( m_DC[pn] >= DIFFICULTY_BEGINNER ) ) m_DifficultyMeters[pn].SetFromSteps( pSteps ); else m_DifficultyMeters[pn].SetFromMeterAndDifficulty( 0, DIFFICULTY_BEGINNER ); @@ -525,21 +525,21 @@ void ScreenNetSelectMusic::MusicChanged() vector MultiSteps; MultiSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st ); if (MultiSteps.size() == 0) - m_DC[pn] = NUM_DIFFICULTIES; + m_DC[pn] = NUM_Difficulty; else { int i; Difficulty Target = DIFFICULTY_EASY; - bool dcs[NUM_DIFFICULTIES]; + bool dcs[NUM_Difficulty]; - for ( i=0; iGetDifficulty()] = true; - for ( i=0; iGetCourseType() ); + def.m_sName = CourseTypeToLocalizedString( (*c)->GetCourseType() ); break; case EditMode_Full: if( (*c)->IsAnEdit() ) diff --git a/stepmania/src/ScreenOptionsManageEditSteps.cpp b/stepmania/src/ScreenOptionsManageEditSteps.cpp index e9836ce4e9..53ae320a51 100644 --- a/stepmania/src/ScreenOptionsManageEditSteps.cpp +++ b/stepmania/src/ScreenOptionsManageEditSteps.cpp @@ -104,7 +104,7 @@ void ScreenOptionsManageEditSteps::BeginScreen() def.m_bAllowThemeTitle = false; // not themable def.m_sExplanationName = "Edit Steps"; def.m_vsChoices.clear(); - CString sType = GAMEMAN->StepsTypeToThemedString( (*s)->m_StepsType ); + CString sType = GAMEMAN->StepsTypeToLocalizedString( (*s)->m_StepsType ); def.m_vsChoices.push_back( sType ); def.m_bAllowThemeItems = false; // already themed vDefs.push_back( def ); diff --git a/stepmania/src/ScreenOptionsManageProfiles.cpp b/stepmania/src/ScreenOptionsManageProfiles.cpp index 1fc76f46b7..26f3ba0ed2 100644 --- a/stepmania/src/ScreenOptionsManageProfiles.cpp +++ b/stepmania/src/ScreenOptionsManageProfiles.cpp @@ -41,7 +41,7 @@ static const char *ProfileActionNames[] = { "Clear", }; XToString( ProfileAction, NUM_ProfileAction ); -XToThemedString( ProfileAction, NUM_ProfileAction ); +XToLocalizedString( ProfileAction ); #define FOREACH_ProfileAction( i ) FOREACH_ENUM( ProfileAction, NUM_ProfileAction, i ) static MenuDef g_TempMenu( @@ -344,7 +344,7 @@ void ScreenOptionsManageProfiles::ProcessMenuStart( const InputEventPlus &input g_TempMenu.rows.clear(); #define ADD_ACTION( i ) \ - g_TempMenu.rows.push_back( MenuRowDef( i, ProfileActionToThemedString(i), true, EditMode_Home, true, 0, "" ) ); + g_TempMenu.rows.push_back( MenuRowDef( i, ProfileActionToLocalizedString(i), true, EditMode_Home, true, 0, "" ) ); ADD_ACTION( ProfileAction_SetDefaultP1 ); ADD_ACTION( ProfileAction_SetDefaultP2 ); diff --git a/stepmania/src/ScreenRanking.cpp b/stepmania/src/ScreenRanking.cpp index 06fa656251..96d045b07c 100644 --- a/stepmania/src/ScreenRanking.cpp +++ b/stepmania/src/ScreenRanking.cpp @@ -196,7 +196,7 @@ float ScreenRanking::SetPage( const PageToShow &pts ) // // init page // - m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.st) ); + m_textStepsType.SetText( GameManager::StepsTypeToLocalizedString(pts.st) ); return 0; } @@ -351,7 +351,7 @@ void ScoreScroller::Load( ItemTemplate.m_textTitle.LoadFromFont( THEME->GetPathF(sClassName,"list title") ); ActorUtil::LoadAllCommands( ItemTemplate.m_textTitle, sClassName ); - ItemTemplate.m_textScore.resize( NUM_DIFFICULTIES ); + ItemTemplate.m_textScore.resize( NUM_Difficulty ); FOREACH_CONST( Difficulty, m_DifficultiesToShow, d ) { ItemTemplate.m_textScore[*d].SetName( "Score" ); diff --git a/stepmania/src/ScreenRanking.h b/stepmania/src/ScreenRanking.h index 79d3628ae5..ea9c7b7b86 100644 --- a/stepmania/src/ScreenRanking.h +++ b/stepmania/src/ScreenRanking.h @@ -83,7 +83,7 @@ protected: ThemeMetric SHOW_ONLY_MOST_RECENT_SCORES; ThemeMetric SECONDS_PER_PAGE; ThemeMetric PAGE_FADE_SECONDS; - ThemeMetric NO_SCORE_NAME; + LocalizedString NO_SCORE_NAME; ThemeMetric MANUAL_SCROLLING; }; @@ -128,7 +128,7 @@ protected: ThemeMetric SCORE_OFFSET_START_X; ThemeMetric SCORE_OFFSET_Y; ThemeMetric SHOW_SURVIVAL_TIME; - ThemeMetric NO_SCORE_NAME; + LocalizedString NO_SCORE_NAME; ThemeMetric COL_SPACING_X; ThemeMetric SONG_SCORE_SECONDS_PER_ROW; ThemeMetric m_metricSongScoreRowsToDraw; @@ -151,7 +151,7 @@ private: ScoreScroller m_ListScoreRowItems; - AutoActor m_sprDifficulty[NUM_DIFFICULTIES]; // for all_steps + AutoActor m_sprDifficulty[NUM_Difficulty]; // for all_steps ThemeMetricDifficultiesToShow DIFFICULTIES_TO_SHOW; ThemeMetric COL_SPACING_X; diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 53ce2b21b5..2c40e1142e 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -223,7 +223,7 @@ void ScreenSelectMusic::Init() this->AddChild( &m_sprDifficultyFrame[p] ); m_DifficultyIcon[p].SetName( ssprintf("DifficultyIconP%d",p+1) ); - m_DifficultyIcon[p].Load( THEME->GetPathG(m_sName,ssprintf("difficulty icons 1x%d",NUM_DIFFICULTIES)) ); + m_DifficultyIcon[p].Load( THEME->GetPathG(m_sName,ssprintf("difficulty icons 1x%d",NUM_Difficulty)) ); SET_XY( m_DifficultyIcon[p] ); this->AddChild( &m_DifficultyIcon[p] ); diff --git a/stepmania/src/ScreenSystemLayer.h b/stepmania/src/ScreenSystemLayer.h index e1946b1df3..a2e0fa0210 100644 --- a/stepmania/src/ScreenSystemLayer.h +++ b/stepmania/src/ScreenSystemLayer.h @@ -8,6 +8,7 @@ #include "Quad.h" #include "ThemeMetric.h" #include "AutoActor.h" +#include "LocalizedString.h" class ScreenSystemLayer : public Screen { @@ -28,18 +29,18 @@ private: CString GetCreditsMessage( PlayerNumber pn ) const; - ThemeMetric CREDITS_PRESS_START; - ThemeMetric CREDITS_INSERT_CARD; - ThemeMetric CREDITS_CARD_TOO_LATE; - ThemeMetric CREDITS_CARD_NO_NAME; - ThemeMetric CREDITS_CARD_READY; - ThemeMetric CREDITS_CARD_CHECKING; - ThemeMetric CREDITS_CARD_REMOVED; - ThemeMetric CREDITS_FREE_PLAY; - ThemeMetric CREDITS_CREDITS; - ThemeMetric CREDITS_NOT_PRESENT; - ThemeMetric CREDITS_LOAD_FAILED; - ThemeMetric CREDITS_LOADED_FROM_LAST_GOOD_APPEND; + LocalizedString CREDITS_PRESS_START; + LocalizedString CREDITS_INSERT_CARD; + LocalizedString CREDITS_CARD_TOO_LATE; + LocalizedString CREDITS_CARD_NO_NAME; + LocalizedString CREDITS_CARD_READY; + LocalizedString CREDITS_CARD_CHECKING; + LocalizedString CREDITS_CARD_REMOVED; + LocalizedString CREDITS_FREE_PLAY; + LocalizedString CREDITS_CREDITS; + LocalizedString CREDITS_NOT_PRESENT; + LocalizedString CREDITS_LOAD_FAILED; + LocalizedString CREDITS_LOADED_FROM_LAST_GOOD_APPEND; ThemeMetric CREDITS_JOIN_ONLY; }; diff --git a/stepmania/src/SongUtil.cpp b/stepmania/src/SongUtil.cpp index e56a504831..06370917b6 100644 --- a/stepmania/src/SongUtil.cpp +++ b/stepmania/src/SongUtil.cpp @@ -12,9 +12,10 @@ #include "Foreach.h" #include "UnlockManager.h" #include "ThemeMetric.h" +#include "LocalizedString.h" -static ThemeMetric SORT_NOT_AVAILABLE( "Sort", "NotAvailable" ); -static ThemeMetric SORT_OTHER ( "Sort", "Other" ); +static LocalizedString SORT_NOT_AVAILABLE( "Sort", "NotAvailable" ); +static LocalizedString SORT_OTHER ( "Sort", "Other" ); ///////////////////////////////////// // Sorting @@ -273,9 +274,9 @@ CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so { Grade g = (Grade)i; if( iCounts[i] > 0 ) - return ssprintf( "%4s x %d", GradeToThemedString(g).c_str(), iCounts[i] ); + return ssprintf( "%4s x %d", GradeToLocalizedString(g).c_str(), iCounts[i] ); } - return GradeToThemedString( Grade_NoData ); + return GradeToLocalizedString( Grade_NoData ); } case SORT_EASY_METER: { diff --git a/stepmania/src/StageStats.cpp b/stepmania/src/StageStats.cpp index 1578a61184..543deed35f 100644 --- a/stepmania/src/StageStats.cpp +++ b/stepmania/src/StageStats.cpp @@ -42,9 +42,9 @@ void StageStats::AssertValid( PlayerNumber pn ) const CHECKPOINT_M( vpPlayedSongs[0]->GetTranslitFullTitle() ); ASSERT( m_player[pn].vpPlayedSteps.size() != 0 ); ASSERT( m_player[pn].vpPlayedSteps[0] ); - ASSERT_M( playMode < NUM_PLAY_MODES, ssprintf("playmode %i", playMode) ); + ASSERT_M( playMode < NUM_PlayMode, ssprintf("playmode %i", playMode) ); ASSERT( pStyle != NULL ); - ASSERT_M( m_player[pn].vpPlayedSteps[0]->GetDifficulty() < NUM_DIFFICULTIES, ssprintf("difficulty %i", m_player[pn].vpPlayedSteps[0]->GetDifficulty()) ); + ASSERT_M( m_player[pn].vpPlayedSteps[0]->GetDifficulty() < NUM_Difficulty, ssprintf("difficulty %i", m_player[pn].vpPlayedSteps[0]->GetDifficulty()) ); ASSERT( vpPlayedSongs.size() == m_player[pn].vpPlayedSteps.size() ); ASSERT( vpPossibleSongs.size() == m_player[pn].vpPossibleSteps.size() ); } @@ -57,9 +57,9 @@ void StageStats::AssertValid( MultiPlayer pn ) const CHECKPOINT_M( vpPlayedSongs[0]->GetTranslitFullTitle() ); ASSERT( m_multiPlayer[pn].vpPlayedSteps.size() != 0 ); ASSERT( m_multiPlayer[pn].vpPlayedSteps[0] ); - ASSERT_M( playMode < NUM_PLAY_MODES, ssprintf("playmode %i", playMode) ); + ASSERT_M( playMode < NUM_PlayMode, ssprintf("playmode %i", playMode) ); ASSERT( pStyle != NULL ); - ASSERT_M( m_player[pn].vpPlayedSteps[0]->GetDifficulty() < NUM_DIFFICULTIES, ssprintf("difficulty %i", m_player[pn].vpPlayedSteps[0]->GetDifficulty()) ); + ASSERT_M( m_player[pn].vpPlayedSteps[0]->GetDifficulty() < NUM_Difficulty, ssprintf("difficulty %i", m_player[pn].vpPlayedSteps[0]->GetDifficulty()) ); ASSERT( vpPlayedSongs.size() == m_player[pn].vpPlayedSteps.size() ); ASSERT( vpPossibleSongs.size() == m_player[pn].vpPossibleSteps.size() ); } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index b0b6274b2d..ccfac4e842 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -59,10 +59,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\SM Source\stepmania\Program +TargetDir=\cvs\stepmania\Program TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -96,10 +96,10 @@ LINK32=link.exe # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool IntDir=.\../Release6 -TargetDir=\SM Source\stepmania\Program +TargetDir=\cvs\stepmania\Program TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -1220,6 +1220,10 @@ SOURCE=.\StyleUtil.h # End Source File # Begin Source File +SOURCE=.\ThemeMetric.h +# End Source File +# Begin Source File + SOURCE=.\TimingData.cpp # End Source File # Begin Source File diff --git a/stepmania/src/Steps.cpp b/stepmania/src/Steps.cpp index 4d9ac9575e..2b768b895a 100644 --- a/stepmania/src/Steps.cpp +++ b/stepmania/src/Steps.cpp @@ -104,15 +104,15 @@ float Steps::PredictMeter() const { float pMeter = 0.775f; - const float RadarCoeffs[NUM_RADAR_CATEGORIES] = + const float RadarCoeffs[NUM_RadarCategory] = { 10.1f, 5.27f,-0.905f, -1.10f, 2.86f, 0,0,0,0,0,0 }; - for( int r = 0; r < NUM_RADAR_CATEGORIES; ++r ) + for( int r = 0; r < NUM_RadarCategory; ++r ) pMeter += this->GetRadarValues()[r] * RadarCoeffs[r]; - const float DifficultyCoeffs[NUM_DIFFICULTIES] = + const float DifficultyCoeffs[NUM_Difficulty] = { -0.877f, -0.877f, 0, 0.722f, 0.722f, 0 };