From fc18dbd342a6ff12383d08d1a7153c4eec1f2db2 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 8 Jan 2006 18:40:20 +0000 Subject: [PATCH] make more strings localizable --- stepmania/src/CatalogXml.cpp | 4 +- stepmania/src/CommonMetrics.cpp | 2 +- stepmania/src/EnumHelper.cpp | 2 +- stepmania/src/GameConstantsAndTypes.cpp | 3 +- stepmania/src/GameConstantsAndTypes.h | 2 +- stepmania/src/GameManager.cpp | 4 +- stepmania/src/Grade.cpp | 2 +- stepmania/src/IniFile.cpp | 2 +- stepmania/src/LocalizedString.cpp | 3 + stepmania/src/MusicWheel.cpp | 2 +- stepmania/src/MusicWheelItem.cpp | 6 +- stepmania/src/OptionRow.cpp | 2 +- stepmania/src/OptionRowHandler.cpp | 5 +- stepmania/src/ScreenDebugOverlay.cpp | 10 +- stepmania/src/ScreenEdit.cpp | 2 +- stepmania/src/ScreenEditMenu.cpp | 2 +- stepmania/src/ScreenEz2SelectMusic.cpp | 2 +- stepmania/src/ScreenEz2SelectPlayer.cpp | 2 +- stepmania/src/ScreenMapControllers.cpp | 14 +-- stepmania/src/ScreenOptions.cpp | 2 +- stepmania/src/ScreenOptionsManageProfiles.cpp | 2 +- stepmania/src/ScreenOptionsMasterPrefs.cpp | 6 +- stepmania/src/ScreenPrompt.cpp | 2 +- stepmania/src/ScreenSelectGroup.cpp | 6 +- stepmania/src/ScreenSyncOverlay.cpp | 108 +++++++++--------- stepmania/src/ScreenTextEntry.cpp | 2 +- stepmania/src/StepMania.dsp | 4 +- stepmania/src/ThemeManager.cpp | 2 +- 28 files changed, 108 insertions(+), 97 deletions(-) diff --git a/stepmania/src/CatalogXml.cpp b/stepmania/src/CatalogXml.cpp index 2c8193ead6..6cd7e048bc 100644 --- a/stepmania/src/CatalogXml.cpp +++ b/stepmania/src/CatalogXml.cpp @@ -20,6 +20,7 @@ #include "CommonMetrics.h" #include "UnlockManager.h" #include "arch/LoadingWindow/LoadingWindow.h" +#include "LocalizedString.h" #define SHOW_PLAY_MODE(pm) THEME->GetMetricB("CatalogXml",ssprintf("ShowPlayMode%s",PlayModeToString(pm).c_str())) #define SHOW_STYLE(ps) THEME->GetMetricB("CatalogXml",ssprintf("ShowStyle%s",Capitalize((ps)->m_szName).c_str())) @@ -34,13 +35,14 @@ const CString CATALOG_XML = "Catalog.xml"; const CString CATALOG_XSL = "Catalog.xsl"; const CString CATALOG_XML_FILE = "Save/" + CATALOG_XML; +static LocalizedString SAVING_CATALOG_XML( "CatalogXml", "Saving Catalog.xml ..." ); void SaveCatalogXml( LoadingWindow *loading_window ) { ASSERT( SONGMAN ); ASSERT( UNLOCKMAN ); if( loading_window ) - loading_window->SetText( "Saving Catalog.xml ..." ); + loading_window->SetText( SAVING_CATALOG_XML ); CString fn = CATALOG_XML_FILE; diff --git a/stepmania/src/CommonMetrics.cpp b/stepmania/src/CommonMetrics.cpp index f7ae2a5642..d62ebe1a9d 100644 --- a/stepmania/src/CommonMetrics.cpp +++ b/stepmania/src/CommonMetrics.cpp @@ -125,7 +125,7 @@ CString CommonMetrics::ThemeOptionItem( CString s, bool bOptional ) { if( bOptional && !THEME->HasMetric("OptionNames",s) ) return s; - return THEME->GetMetric( "OptionNames", s ); + return THEME->GetString( "OptionNames", s ); } diff --git a/stepmania/src/EnumHelper.cpp b/stepmania/src/EnumHelper.cpp index 51776c33ff..42da6f9414 100644 --- a/stepmania/src/EnumHelper.cpp +++ b/stepmania/src/EnumHelper.cpp @@ -5,7 +5,7 @@ CString GetThemedString( const CString &sClass, const CString &sValue ) { - return THEME->GetMetric( sClass, sValue ); + return THEME->GetString( sClass, sValue ); } /* diff --git a/stepmania/src/GameConstantsAndTypes.cpp b/stepmania/src/GameConstantsAndTypes.cpp index 5912ba234f..ba6aab32de 100644 --- a/stepmania/src/GameConstantsAndTypes.cpp +++ b/stepmania/src/GameConstantsAndTypes.cpp @@ -96,7 +96,8 @@ static const char *PlayerControllerNames[] = { "Autoplay", "Cpu", }; -XToString( PlayerController, NUM_PLAYER_CONTROLLERS ); +XToString( PlayerController, NUM_PlayerController ); +XToLocalizedString( PlayerController ); static const char *CoinModeNames[] = { diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index 0375b27fa6..a954a8180d 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -256,7 +256,7 @@ enum PlayerController PC_HUMAN, PC_AUTOPLAY, PC_CPU, - NUM_PLAYER_CONTROLLERS + NUM_PlayerController }; const CString& PlayerControllerToString( PlayerController pc ); diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 73daf34c80..60d3dfd2d3 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -2754,7 +2754,7 @@ CString GameManager::StepsTypeToLocalizedString( StepsType st ) { CString s = StepsTypeToString( st ); if( THEME->HasMetric( "StepsType", s ) ) - return THEME->GetMetric( "StepsType", s ); + return THEME->GetString( "StepsType", s ); else return s; } @@ -2764,7 +2764,7 @@ CString GameManager::StyleToLocalizedString( const Style* style ) CString s = style->m_szName; s = Capitalize( s ); if( THEME->HasMetric( "Style", s ) ) - return THEME->GetMetric( "Style", s ); + return THEME->GetString( "Style", s ); else return s; } diff --git a/stepmania/src/Grade.cpp b/stepmania/src/Grade.cpp index 1149a25572..4b2d91c940 100644 --- a/stepmania/src/Grade.cpp +++ b/stepmania/src/Grade.cpp @@ -14,7 +14,7 @@ CString GradeToLocalizedString( Grade g ) CString s = GradeToString(g); if( !THEME->HasMetric("Grade",s) ) return "???"; - return THEME->GetMetric( "Grade",s ); + return THEME->GetString( "Grade",s ); } CString GradeToOldString( Grade g ) diff --git a/stepmania/src/IniFile.cpp b/stepmania/src/IniFile.cpp index 7330b494b8..722c01a4d4 100644 --- a/stepmania/src/IniFile.cpp +++ b/stepmania/src/IniFile.cpp @@ -64,7 +64,7 @@ bool IniFile::ReadFile( RageFileBasic &f ) RString valuename = line.Left( (int) iEqualIndex ); RString value = line.Right( line.size()-valuename.size()-1 ); if( keyname.size() && valuename.size() ) - SetValue(keyname,valuename,value); + SetValue( keyname, valuename, value ); } } } diff --git a/stepmania/src/LocalizedString.cpp b/stepmania/src/LocalizedString.cpp index 8c3e6f427e..72f67a37fa 100644 --- a/stepmania/src/LocalizedString.cpp +++ b/stepmania/src/LocalizedString.cpp @@ -12,6 +12,9 @@ public: LocalizedStringImpl( const RString& sGroup, const RString& sName ) : ThemeMetric( sGroup, sName ) { + // Ugly. Our virtual method Read() isn't yet set up when Read gets + // called through the constructor. Read again explicitly. + Read(); } virtual void Read() diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 96815ce5fd..5efa6bd838 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -23,7 +23,7 @@ #include "PlayerState.h" #define NUM_WHEEL_ITEMS ((int)ceil(NUM_WHEEL_ITEMS_TO_DRAW+2)) -#define WHEEL_TEXT(s) THEME->GetMetric( "MusicWheel", ssprintf("%sText",s.c_str()) ); +#define WHEEL_TEXT(s) THEME->GetString( "MusicWheel", ssprintf("%sText",s.c_str()) ); static CString SECTION_COLORS_NAME( size_t i ) { return ssprintf("SectionColor%d",int(i+1)); } static CString CHOICE_NAME( CString s ) { return ssprintf("Choice%s",s.c_str()); } diff --git a/stepmania/src/MusicWheelItem.cpp b/stepmania/src/MusicWheelItem.cpp index 895f33a0c0..005d491ed7 100644 --- a/stepmania/src/MusicWheelItem.cpp +++ b/stepmania/src/MusicWheelItem.cpp @@ -214,17 +214,17 @@ void MusicWheelItem::LoadFromWheelItemData( WheelItemData* pWID, bool bExpanded } break; case TYPE_ROULETTE: - m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Roulette") ); + m_textRoulette.SetText( THEME->GetString("MusicWheel","Roulette") ); m_textRoulette.SetHidden( false ); break; case TYPE_RANDOM: - m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Random") ); + m_textRoulette.SetText( THEME->GetString("MusicWheel","Random") ); m_textRoulette.SetHidden( false ); break; case TYPE_PORTAL: - m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Portal") ); + m_textRoulette.SetText( THEME->GetString("MusicWheel","Portal") ); m_textRoulette.SetHidden( false ); break; diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index 2f85950527..e42ce5974c 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -66,7 +66,7 @@ CString OptionRow::OptionTitle( CString s ) const if( s.empty() ) return s; - return bTheme ? THEME->GetMetric("OptionTitles",s) : s; + return bTheme ? THEME->GetString("OptionTitles",s) : s; } CString ITEMS_LONG_ROW_X_NAME( size_t p ) { return ssprintf("ItemsLongRowP%dX",int(p+1)); } diff --git a/stepmania/src/OptionRowHandler.cpp b/stepmania/src/OptionRowHandler.cpp index 47ada0b0b0..f3de27cc5d 100644 --- a/stepmania/src/OptionRowHandler.cpp +++ b/stepmania/src/OptionRowHandler.cpp @@ -54,6 +54,7 @@ static int GetOneSelection( const vector &vbSelected ) return iRet; } +static LocalizedString OFF ( "OptionRowHandler", "Off" ); class OptionRowHandlerList : public OptionRowHandler { @@ -281,8 +282,6 @@ public: NOTESKIN->GetNoteSkinNames( arraySkinNames ); for( unsigned skin=0; skinGetDefaultCharacter(); { - defOut.m_vsChoices.push_back( "Off" ); + defOut.m_vsChoices.push_back( OFF ); GameCommand mc; mc.m_pCharacter = NULL; ListEntries.push_back( mc ); diff --git a/stepmania/src/ScreenDebugOverlay.cpp b/stepmania/src/ScreenDebugOverlay.cpp index fe773718f2..16569fe77d 100644 --- a/stepmania/src/ScreenDebugOverlay.cpp +++ b/stepmania/src/ScreenDebugOverlay.cpp @@ -100,14 +100,16 @@ struct MapDebugToDI }; static MapDebugToDI g_Mappings; +static LocalizedString IN_GAMEPLAY( "ScreenDebugOverlay", "%s in gameplay" ); +static LocalizedString OR( "ScreenDebugOverlay", "or" ); static CString GetDebugButtonName( int i ) { vector v; if( g_Mappings.debugButton[i].IsValid() ) v.push_back( INPUTMAN->GetDeviceSpecificInputString(g_Mappings.debugButton[i]) ); if( g_Mappings.gameplayButton[i].IsValid() ) - v.push_back( INPUTMAN->GetDeviceSpecificInputString(g_Mappings.gameplayButton[i])+" in gameplay" ); - return join( " or ", v ); + v.push_back( ssprintf(IN_GAMEPLAY.GetValue(),INPUTMAN->GetDeviceSpecificInputString(g_Mappings.gameplayButton[i]).c_str()) ); + return join( " "+OR.GetValue()+" ", v ); } void ScreenDebugOverlay::Init() @@ -396,7 +398,7 @@ class DebugLineAutoplay : public IDebugLine virtual void Do( CString &sMessageOut ) { PlayerController pc = (PlayerController)(PREFSMAN->m_AutoPlay+1); - wrap( (int&)pc, NUM_PLAYER_CONTROLLERS ); + wrap( (int&)pc, NUM_PlayerController ); PREFSMAN->m_AutoPlay.Set( pc ); FOREACH_HumanPlayer(p) GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_AutoPlay; @@ -661,7 +663,7 @@ class DebugLineWriteProfiles : public IDebugLine class DebugLineWritePreferences : public IDebugLine { - virtual CString GetDescription() { return "Write Preferences"; } + virtual CString GetDescription() { return WRITE_PREFERENCES; } virtual CString GetValue() { return NULL; } virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index e6d9c1f45e..6a49c1068d 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -54,7 +54,7 @@ const float RECORD_HOLD_SECONDS = 0.3f; #define RECORD_X (SCREEN_CENTER_X) #define RECORD_Y (SCREEN_CENTER_Y) -#define PLAY_RECORD_HELP_TEXT THEME->GetMetric(m_sName,"PlayRecordHelpText") +#define PLAY_RECORD_HELP_TEXT THEME->GetString(m_sName,"PlayRecordHelpText") AutoScreenMessage( SM_UpdateTextInfo ) AutoScreenMessage( SM_BackFromMainMenu ) diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index c2ff303220..ea7248ce07 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -16,7 +16,7 @@ #include "ScreenPrompt.h" #include "LocalizedString.h" -#define EXPLANATION_TEXT( row ) THEME->GetMetric(m_sName,"Explanation"+EditMenuRowToString(row)) +#define EXPLANATION_TEXT( row ) THEME->GetString(m_sName,"Explanation"+EditMenuRowToString(row)) #define EDIT_MENU_TYPE THEME->GetMetric(m_sName,"EditMenuType") AutoScreenMessage( SM_RefreshSelector ) diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index 94c233a7b4..f1ab19c2fb 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -30,7 +30,7 @@ #define SCROLLING_LIST_ROT THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListRotation") #define PUMP_DIFF_X THEME->GetMetricF("ScreenEz2SelectMusic","PumpDifficultyX") #define PUMP_DIFF_Y THEME->GetMetricF("ScreenEz2SelectMusic","PumpDifficultyY") -#define HELP_TEXT THEME->GetMetric("ScreenSelectMusic","HelpText") +#define HELP_TEXT THEME->GetString("ScreenSelectMusic","HelpText") #define TIMER_SECONDS THEME->GetMetricI("ScreenSelectMusic","TimerSeconds") #define METER_X( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("MeterP%dX",p+1)) #define METER_Y( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("MeterP%dY",p+1)) diff --git a/stepmania/src/ScreenEz2SelectPlayer.cpp b/stepmania/src/ScreenEz2SelectPlayer.cpp index 5057e4f8d9..0af4666333 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.cpp +++ b/stepmania/src/ScreenEz2SelectPlayer.cpp @@ -18,7 +18,7 @@ #define JOIN_FRAME_Y( i ) THEME->GetMetricF("ScreenEz2SelectPlayer",ssprintf("JoinFrameP%dY",i+1)) #define JOIN_MESSAGE_X( p ) THEME->GetMetricF("ScreenEz2SelectPlayer",ssprintf("JoinMessageP%dX",p+1)) #define JOIN_MESSAGE_Y( i ) THEME->GetMetricF("ScreenEz2SelectPlayer",ssprintf("JoinMessageP%dY",i+1)) -#define HELP_TEXT THEME->GetMetric("ScreenEz2SelectPlayer","HelpText") +#define HELP_TEXT THEME->GetString("ScreenEz2SelectPlayer","HelpText") #define TIMER_SECONDS THEME->GetMetricI("ScreenEz2SelectPlayer","TimerSeconds") #define SILENT_WAIT THEME->GetMetricB("ScreenEz2SelectPlayer","SilentWait") #define BOUNCE_JOIN_MESSAGE THEME->GetMetricB("ScreenEz2SelectPlayer","BounceJoinMessage") diff --git a/stepmania/src/ScreenMapControllers.cpp b/stepmania/src/ScreenMapControllers.cpp index 0b0410c54a..c95607abfe 100644 --- a/stepmania/src/ScreenMapControllers.cpp +++ b/stepmania/src/ScreenMapControllers.cpp @@ -13,12 +13,10 @@ #include "Command.h" #include "InputEventPlus.h" -#define BUTTONS_TO_MAP THEME->GetMetric( m_sName, "ButtonsToMap" ) -#define INVALID_BUTTON THEME->GetMetric( m_sName, "InvalidButton" ) +#define BUTTONS_TO_MAP THEME->GetMetric ( m_sName, "ButtonsToMap" ) +#define INVALID_BUTTON THEME->GetMetric ( m_sName, "InvalidButton" ) #define MAPPED_TO_COMMAND(gc,slot) THEME->GetMetricA( m_sName, ssprintf("MappedToP%iS%iCommand", gc+1, slot+1) ) -#define THEME_BUTTON_NAMES THEME->GetMetricB( m_sName, "ThemeButtonNames" ) -#define THEME_SECONDARY_NAMES THEME->GetMetricB( m_sName, "ThemeSecondaryNames" ) -#define BUTTON_NAME(s) THEME->GetMetric ( m_sName, ssprintf("Button%s",s) ) +#define BUTTON_NAME(s) THEME->GetString ( m_sName, s ) static const float g_fSecondsToWaitForInput = 0.05f; @@ -70,8 +68,7 @@ void ScreenMapControllers::Init() pName->SetName( "Title" ); pName->LoadFromFont( THEME->GetPathF("Common","title") ); CString sText = GAMESTATE->GetCurrentGame()->m_szButtonNames[pKey->m_GameButton]; - if( THEME_BUTTON_NAMES ) - sText = BUTTON_NAME(sText.c_str()); + sText = BUTTON_NAME(sText.c_str()); pName->SetText( sText ); ActorUtil::LoadAllCommands( *pName, m_sName ); m_Line[b].AddChild( pName ); @@ -80,8 +77,7 @@ void ScreenMapControllers::Init() pSecondary->SetName( "Secondary" ); pSecondary->LoadFromFont( THEME->GetPathF("Common","title") ); sText = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), pKey->m_GameButton ); - if( THEME_SECONDARY_NAMES ) - sText = BUTTON_NAME(sText.c_str()); + sText = BUTTON_NAME(sText.c_str()); ActorUtil::LoadAllCommands( *pSecondary, m_sName ); pSecondary->SetText( sText ); m_Line[b].AddChild( pSecondary ); diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index e74e7806fa..942053a3de 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -69,7 +69,7 @@ static CString EXPLANATION_ON_COMMAND_NAME( size_t p ) { return ssprintf("Explan static CString OPTION_EXPLANATION( CString s ) { - return THEME->GetMetric("OptionExplanations",s); + return THEME->GetString("OptionExplanations",s); } //REGISTER_SCREEN_CLASS( ScreenOptions ); // can't be instantiated diff --git a/stepmania/src/ScreenOptionsManageProfiles.cpp b/stepmania/src/ScreenOptionsManageProfiles.cpp index 26f3ba0ed2..6f55cc5913 100644 --- a/stepmania/src/ScreenOptionsManageProfiles.cpp +++ b/stepmania/src/ScreenOptionsManageProfiles.cpp @@ -12,7 +12,7 @@ #include "OptionRowHandler.h" #include "LocalizedString.h" -static ThemeMetric NEW_PROFILE_DEFAULT_NAME( "ScreenOptionsManageProfiles", "NewProfileDefaultName" ); +static LocalizedString NEW_PROFILE_DEFAULT_NAME( "ScreenOptionsManageProfiles", "NewProfileDefaultName" ); #define SHOW_CREATE_NEW (!PROFILEMAN->FixedProfiles()) diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index a0541e7079..1a951fd3b7 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -15,6 +15,7 @@ #include "Foreach.h" #include "GameConstantsAndTypes.h" #include "DisplayResolutions.h" +#include "LocalizedString.h" static void GetPrefsDefaultModifiers( PlayerOptions &po, SongOptions &so ) { @@ -210,10 +211,11 @@ static void Theme( int &sel, bool ToSel, const ConfOption *pConfOption ) } } +static LocalizedString OFF ("ScreenOptionsMasterPrefs","Off"); static void AnnouncerChoices( vector &out ) { ANNOUNCER->GetAnnouncerNames( out ); - out.insert( out.begin(), "Off" ); + out.insert( out.begin(), OFF ); } static void Announcer( int &sel, bool ToSel, const ConfOption *pConfOption ) @@ -236,8 +238,6 @@ static void Announcer( int &sel, bool ToSel, const ConfOption *pConfOption ) static void DefaultNoteSkinChoices( vector &out ) { NOTESKIN->GetNoteSkinNames( out ); - for( unsigned i = 0; i < out.size(); ++i ) - out[i].MakeUpper(); } static void DefaultNoteSkin( int &sel, bool ToSel, const ConfOption *pConfOption ) diff --git a/stepmania/src/ScreenPrompt.cpp b/stepmania/src/ScreenPrompt.cpp index 33dae9c2a7..78d0148b5a 100644 --- a/stepmania/src/ScreenPrompt.cpp +++ b/stepmania/src/ScreenPrompt.cpp @@ -13,7 +13,7 @@ PromptAnswer ScreenPrompt::s_LastAnswer = ANSWER_YES; bool ScreenPrompt::s_bCancelledLast = false; -#define ANSWER_TEXT( elem ) THEME->GetMetric(m_sName,elem+"Text") +#define ANSWER_TEXT( elem ) THEME->GetString(m_sName,elem+"Text") /* Settings: */ namespace diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index 94d8b6fbe3..bf6d91c107 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -16,6 +16,7 @@ #include "UnlockManager.h" #include "MenuTimer.h" #include "SongUtil.h" +#include "LocalizedString.h" #define BANNER_WIDTH THEME->GetMetricF("ScreenSelectGroup","BannerWidth") #define BANNER_HEIGHT THEME->GetMetricF("ScreenSelectGroup","BannerHeight") @@ -149,13 +150,14 @@ void ScreenSelectGroup::HandleScreenMessage( const ScreenMessage SM ) Screen::HandleScreenMessage( SM ); } +static LocalizedString ALL_MUSIC_STRING( "ScreenSelectGroup", "ALL MUSIC" ); void ScreenSelectGroup::AfterChange() { int sel = m_GroupList.GetSelection(); m_MusicList.SetGroupNo(sel); CString sSelectedGroupName = m_GroupList.GetSelectionName(); - if( sSelectedGroupName == "ALL MUSIC" ) + if( sSelectedGroupName == ALL_MUSIC_STRING.GetValue() ) m_Banner.LoadAllMusic(); else m_Banner.LoadFromSongGroup( sSelectedGroupName ); @@ -210,7 +212,7 @@ void ScreenSelectGroup::MenuStart( PlayerNumber pn ) m_bChosen = true; GAMESTATE->m_pCurSong.Set( NULL ); - GAMESTATE->m_sPreferredSongGroup.Set( m_GroupList.GetSelectionName()=="ALL MUSIC" ? GROUP_ALL : m_GroupList.GetSelectionName() ); + GAMESTATE->m_sPreferredSongGroup.Set( m_GroupList.GetSelectionName()==ALL_MUSIC_STRING.GetValue() ? GROUP_ALL : m_GroupList.GetSelectionName() ); if( GAMESTATE->m_sPreferredSongGroup == GROUP_ALL ) SOUND->PlayOnceFromAnnouncer( "select group comment all music" ); diff --git a/stepmania/src/ScreenSyncOverlay.cpp b/stepmania/src/ScreenSyncOverlay.cpp index 0814377d16..2760cc2843 100644 --- a/stepmania/src/ScreenSyncOverlay.cpp +++ b/stepmania/src/ScreenSyncOverlay.cpp @@ -78,82 +78,88 @@ void ScreenSyncOverlay::Update( float fDeltaTime ) UpdateText(); } +static LocalizedString AUTO_PLAY ( "ScreenSyncOverlay", "AutoPlay" ); +static LocalizedString AUTO_PLAY_CPU ( "ScreenSyncOverlay", "AutoPlayCPU" ); +static LocalizedString AUTO_SYNC_SONG ( "ScreenSyncOverlay", "AutoSync Song" ); +static LocalizedString AUTO_SYNC_MACHINE ( "ScreenSyncOverlay", "AutoSync Machine" ); +static LocalizedString EARLIER ( "ScreenSyncOverlay", "earlier" ); +static LocalizedString LATER ( "ScreenSyncOverlay", "later" ); +static LocalizedString GLOBAL_OFFSET_FROM ( "ScreenSyncOverlay", "Global Offset from %+.3f to %+.3f (notes %s)" ); +static LocalizedString SONG_OFFSET_FROM ( "ScreenSyncOverlay", "Song offset from %+.3f to %+.3f (notes %s)" ); +static LocalizedString TEMPO_SEGMENT_FROM ( "ScreenSyncOverlay", "%s tempo segment from %+.3f BPM to %+.3f BPM." ); void ScreenSyncOverlay::UpdateText() { - CString s; + vector vs; switch( PREFSMAN->m_AutoPlay ) { - case PC_HUMAN: break; - case PC_AUTOPLAY: s+="AutoPlay\n"; break; - case PC_CPU: s+="AutoPlayCPU\n"; break; + case PC_HUMAN: break; + case PC_AUTOPLAY: vs.push_back(AUTO_PLAY); break; + case PC_CPU: vs.push_back(AUTO_PLAY_CPU); break; default: ASSERT(0); } switch( GAMESTATE->m_SongOptions.m_AutosyncType ) { - case SongOptions::AUTOSYNC_OFF: break; - case SongOptions::AUTOSYNC_SONG: s+="AutoSync Song\n"; break; - case SongOptions::AUTOSYNC_MACHINE: s+="AutoSync Machine\n";break; + case SongOptions::AUTOSYNC_OFF: break; + case SongOptions::AUTOSYNC_SONG: vs.push_back(AUTO_SYNC_SONG); break; + case SongOptions::AUTOSYNC_MACHINE: vs.push_back(AUTO_SYNC_MACHINE); break; default: ASSERT(0); } - if( GAMESTATE->m_pCurSong == NULL || GAMESTATE->IsCourseMode() ) // sync controls not available + if( GAMESTATE->m_pCurSong != NULL && !GAMESTATE->IsCourseMode() ) // sync controls not available { - m_textStatus.SetText( s ); - return; - } - { - float fOld = GAMESTATE->m_fGlobalOffsetSecondsOriginal; - float fNew = PREFSMAN->m_fGlobalOffsetSeconds; - float fDelta = fNew - fOld; - - if( fabsf(fDelta) > 0.00001f ) { - s += ssprintf( - "Global Offset from %+.3f to %+.3f (notes %s)\n", - fOld, - fNew, - fDelta > 0 ? "earlier":"later" ); + float fOld = GAMESTATE->m_fGlobalOffsetSecondsOriginal; + float fNew = PREFSMAN->m_fGlobalOffsetSeconds; + float fDelta = fNew - fOld; + + if( fabsf(fDelta) > 0.00001f ) + { + vs.push_back( ssprintf( + GLOBAL_OFFSET_FROM.GetValue(), + fOld, + fNew, + fDelta > 0 ? EARLIER:LATER ).c_str() ); + } } - } - { - float fOld = GAMESTATE->m_pTimingDataOriginal->m_fBeat0OffsetInSeconds; - float fNew = GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds; - float fDelta = fNew - fOld; - - if( fabsf(fDelta) > 0.00001f ) { - s += ssprintf( - "Song offset from %+.3f to %+.3f (notes %s)\n", - fOld, - fNew, - fDelta > 0 ? "earlier":"later" ); + float fOld = GAMESTATE->m_pTimingDataOriginal->m_fBeat0OffsetInSeconds; + float fNew = GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds; + float fDelta = fNew - fOld; + + if( fabsf(fDelta) > 0.00001f ) + { + vs.push_back( ssprintf( + SONG_OFFSET_FROM.GetValue(), + fOld, + fNew, + fDelta > 0 ? EARLIER:LATER ).c_str() ); + } } - } - ASSERT( GAMESTATE->m_pTimingDataOriginal->m_BPMSegments.size() == GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments.size() ); + ASSERT( GAMESTATE->m_pTimingDataOriginal->m_BPMSegments.size() == GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments.size() ); - for( unsigned i=0; im_pCurSong->m_Timing.m_BPMSegments.size(); i++ ) - { - float fOld = GAMESTATE->m_pTimingDataOriginal->m_BPMSegments[i].m_fBPS; - float fNew = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments[i].m_fBPS; - float fDelta = fNew - fOld; - - if( fabsf(fDelta) > 0.00001f ) + for( unsigned i=0; im_pCurSong->m_Timing.m_BPMSegments.size(); i++ ) { - s += ssprintf( - "%s tempo segment from %+.3f BPS to %+.3f BPS\n", - FormatNumberAndSuffix(i+1).c_str(), - fOld, - fNew ); - } + float fOldBpm = GAMESTATE->m_pTimingDataOriginal->m_BPMSegments[i].m_fBPS; + float fNewBpm = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments[i].m_fBPS; + float fDelta = fNewBpm - fOldBpm; + + if( fabsf(fDelta) > 0.00001f ) + { + vs.push_back( ssprintf( + TEMPO_SEGMENT_FROM.GetValue(), + FormatNumberAndSuffix(i+1).c_str(), + fOldBpm, + fNewBpm ) ); + } + } } - - m_textStatus.SetText( s ); + m_textStatus.SetText( join("\n",vs) ); } static LocalizedString CANT_SYNC_WHILE_PLAYING_A_COURSE ("ScreenSyncOverlay","Can't sync while playing a course."); diff --git a/stepmania/src/ScreenTextEntry.cpp b/stepmania/src/ScreenTextEntry.cpp index 793e9066d0..61ab526409 100644 --- a/stepmania/src/ScreenTextEntry.cpp +++ b/stepmania/src/ScreenTextEntry.cpp @@ -172,7 +172,7 @@ void ScreenTextEntry::UpdateKeyboardText() { CString s = g_szKeys[r][x]; if( !s.empty() && r == KEYBOARD_ROW_SPECIAL ) - s = THEME->GetMetric( "ScreenTextEntry", s ); + s = THEME->GetString( "ScreenTextEntry", s ); BitmapText &bt = *m_ptextKeys[r][x]; bt.SetText( s ); } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 1aea98285f..e404fb63f2 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -62,7 +62,7 @@ IntDir=.\../Debug6 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 @@ -99,7 +99,7 @@ IntDir=.\../Release6 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 diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 2e5c24cbc8..f4c49600fb 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -734,7 +734,7 @@ try_metric_again: return ret; - RString sMessage = ssprintf( "The theme metric '%s-%s' is missing. Correct this and click Retry, or Cancel to break.",sClassName.c_str(),sValueName.c_str() ); + RString sMessage = ssprintf( "The theme metric '%s' - '%s' is missing. Correct this and click Retry, or Cancel to break.",sClassName.c_str(),sValueName.c_str() ); switch( Dialog::AbortRetryIgnore(sMessage) ) { case Dialog::abort: