localize more strings

This commit is contained in:
Chris Danford
2006-01-08 19:38:33 +00:00
parent fc18dbd342
commit 9122e2f935
11 changed files with 90 additions and 41 deletions
+2 -2
View File
@@ -48,8 +48,8 @@ public:
int m_iButtonsPerController;
int GetNumGameplayButtons() const;
char m_szButtonNames[MAX_GAME_BUTTONS][60]; // The name used by the button graphics system. e.g. "left", "right", "middle C", "snare"
GameButton m_DedicatedMenuButton[NUM_MENU_BUTTONS];
GameButton m_SecondaryMenuButton[NUM_MENU_BUTTONS];
GameButton m_DedicatedMenuButton[NUM_MenuButton];
GameButton m_SecondaryMenuButton[NUM_MenuButton];
DeviceButton m_iDefaultKeyboardKey[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS]; // default keyboard keys only have an effect the current game is this game
GameButton ButtonNameToIndex( const CString &sButtonName ) const;
+6
View File
@@ -3,6 +3,7 @@
#include "RageLog.h"
#include "RageUtil.h"
#include "Game.h"
#include "ThemeManager.h"
static const char *GameControllerNames[] = {
@@ -18,6 +19,11 @@ CString GameButtonToString( const Game* pGame, GameButton i )
return pGame->m_szButtonNames[i];
}
CString GameButtonToLocalizedString( const Game* pGame, GameButton i )
{
return THEME->GetString( "GameButton", GameButtonToString(pGame,i) );
}
GameButton StringToGameButton( const Game* pGame, const CString& s )
{
for( int i=0; i<pGame->m_iButtonsPerController; i++ )
+2 -1
View File
@@ -17,7 +17,8 @@ enum GameController
#define FOREACH_GameController( gc ) FOREACH_ENUM( GameController, MAX_GAME_CONTROLLERS, gc )
typedef int GameButton;
CString GameButtonToString( GameButton i );
CString GameButtonToString( const Game* pGame, GameButton i );
CString GameButtonToLocalizedString( const Game* pGame, GameButton i );
GameButton StringToGameButton( const Game* pGame, const CString& s );
const GameButton MAX_GAME_BUTTONS = 20;
+4 -16
View File
@@ -2794,7 +2794,7 @@ const Style* GameManager::GameAndStringToStyle( const Game *game, CString sStyle
}
CString GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButton gb ) const
MenuButton GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButton gb ) const
{
/*
* Each GameButton can be used in gameplay (if any gameplay style maps to
@@ -2821,28 +2821,16 @@ CString GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButt
}
}
static const char *szSecondaryNames[] =
{
"MenuLeft",
"MenuRight",
"MenuUp",
"MenuDown",
"MenuStart",
"MenuSelect",
"MenuBack",
"Coin",
"Operator"
};
FOREACH_MenuButton(m)
{
if( !bUsedInGameplay && pGame->m_DedicatedMenuButton[m] == gb )
return CString();
return MenuButton_INVALID;
else if( bUsedInGameplay && pGame->m_SecondaryMenuButton[m] == gb )
return szSecondaryNames[m];
return m;
}
return CString(); // only used in gameplay
return MenuButton_INVALID; // only used in gameplay
}
+2 -1
View File
@@ -9,6 +9,7 @@ struct lua_State;
#include "GameConstantsAndTypes.h"
#include "GameInput.h"
#include "MenuInput.h"
class GameManager
{
@@ -35,7 +36,7 @@ public:
static const Game* StringToGameType( CString sGameType );
const Style* GameAndStringToStyle( const Game* pGame, CString sStyle );
static CString StyleToLocalizedString( const Style* s );
CString GetMenuButtonSecondaryFunction( const Game *pGame, GameButton gb ) const;
MenuButton GetMenuButtonSecondaryFunction( const Game *pGame, GameButton gb ) const;
// Lua
void PushSelf( lua_State *L );
+2 -1
View File
@@ -108,7 +108,8 @@ LocalizedString.cpp LocalizedString.h \
LuaFunctions.h \
LuaReference.cpp LuaReference.h \
LuaExpressionTransform.cpp LuaExpressionTransform.h \
LyricsLoader.cpp LyricsLoader.h MenuInput.h \
LyricsLoader.cpp LyricsLoader.h
MenuInput.cpp MenuInput.h \
NoteData.cpp NoteData.h NoteDataUtil.cpp NoteDataUtil.h NoteDataWithScoring.cpp NoteDataWithScoring.h \
NoteFieldPositioning.cpp NoteFieldPositioning.h NoteTypes.cpp NoteTypes.h NotesLoader.cpp NotesLoader.h \
NotesLoaderBMS.cpp NotesLoaderBMS.h NotesLoaderDWI.cpp NotesLoaderDWI.h NotesLoaderKSF.cpp NotesLoaderKSF.h \
+46
View File
@@ -0,0 +1,46 @@
#include "global.h"
#include "MenuInput.h"
#include "EnumHelper.h"
#include "RageUtil.h"
#include "LocalizedString.h"
static const char *MenuButtonNames[] =
{
"MenuLeft",
"MenuRight",
"MenuUp",
"MenuDown",
"MenuStart",
"MenuSelect",
"MenuBack",
"Coin",
"Operator"
};
XToString( MenuButton, NUM_MenuButton );
XToLocalizedString( MenuButton );
/*
* (c) 2006 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+7 -4
View File
@@ -16,10 +16,13 @@ enum MenuButton
MENU_BUTTON_BACK,
MENU_BUTTON_COIN,
MENU_BUTTON_OPERATOR,
NUM_MENU_BUTTONS, // leave this at the end
MENU_BUTTON_INVALID
NUM_MenuButton, // leave this at the end
MenuButton_INVALID
};
#define FOREACH_MenuButton( m ) FOREACH_ENUM( MenuButton, NUM_MENU_BUTTONS, m )
#define FOREACH_MenuButton( m ) FOREACH_ENUM( MenuButton, NUM_MenuButton, m )
const CString &MenuButtonToString( MenuButton mb );
const CString &MenuButtonToLocalizedString( MenuButton mb );
struct MenuInput
{
@@ -33,7 +36,7 @@ struct MenuInput
bool operator!=( const MenuInput &other ) { return !operator==(other); };
inline bool IsValid() const { return player != PLAYER_INVALID; };
inline void MakeInvalid() { player = PLAYER_INVALID; button = MENU_BUTTON_INVALID; };
inline void MakeInvalid() { player = PLAYER_INVALID; button = MenuButton_INVALID; };
};
#endif
+8 -8
View File
@@ -12,11 +12,11 @@
#include "ScreenDimensions.h"
#include "Command.h"
#include "InputEventPlus.h"
#include "LocalizedString.h"
#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 BUTTON_NAME(s) THEME->GetString ( m_sName, s )
#define BUTTONS_TO_MAP THEME->GetMetric ( m_sName, "ButtonsToMap" )
static LocalizedString INVALID_BUTTON ( "ScreenMapControllers", "InvalidButton" );
#define MAPPED_TO_COMMAND(gc,slot) THEME->GetMetricA( m_sName, ssprintf("MappedToP%iS%iCommand", gc+1, slot+1) )
static const float g_fSecondsToWaitForInput = 0.05f;
@@ -67,8 +67,7 @@ void ScreenMapControllers::Init()
BitmapText *pName = new BitmapText;
pName->SetName( "Title" );
pName->LoadFromFont( THEME->GetPathF("Common","title") );
CString sText = GAMESTATE->GetCurrentGame()->m_szButtonNames[pKey->m_GameButton];
sText = BUTTON_NAME(sText.c_str());
CString sText = GameButtonToLocalizedString( GAMESTATE->GetCurrentGame(), pKey->m_GameButton );
pName->SetText( sText );
ActorUtil::LoadAllCommands( *pName, m_sName );
m_Line[b].AddChild( pName );
@@ -76,8 +75,9 @@ void ScreenMapControllers::Init()
BitmapText *pSecondary = new BitmapText;
pSecondary->SetName( "Secondary" );
pSecondary->LoadFromFont( THEME->GetPathF("Common","title") );
sText = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), pKey->m_GameButton );
sText = BUTTON_NAME(sText.c_str());
MenuButton mb = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), pKey->m_GameButton );
if( mb != MenuButton_INVALID )
sText = MenuButtonToLocalizedString( mb );
ActorUtil::LoadAllCommands( *pSecondary, m_sName );
pSecondary->SetText( sText );
m_Line[b].AddChild( pSecondary );
+10 -7
View File
@@ -11,6 +11,7 @@
#include "PrefsManager.h"
#include "RageInput.h"
#include "InputEventPlus.h"
#include "LocalizedString.h"
REGISTER_SCREEN_CLASS( ScreenTestInput );
@@ -47,7 +48,9 @@ ScreenTestInput::~ScreenTestInput()
LOG->Trace( "ScreenTestInput::~ScreenTestInput()" );
}
static LocalizedString CONTROLLER ( "ScreenTestInput", "Controller" );
static LocalizedString SECONDARY ( "ScreenTestInput", "secondary" );
static LocalizedString NOT_MAPPED ( "ScreenTestInput", "not mapped" );
void ScreenTestInput::Update( float fDeltaTime )
{
Screen::Update( fDeltaTime );
@@ -88,19 +91,19 @@ void ScreenTestInput::Update( float fDeltaTime )
GameInput gi;
if( INPUTMAPPER->DeviceToGame(*di,gi) )
{
CString sName = GAMESTATE->GetCurrentGame()->m_szButtonNames[gi.button];
sTemp += ssprintf(" - Controller %d %s", gi.controller+1, sName.c_str() );
CString sName = GameButtonToLocalizedString( GAMESTATE->GetCurrentGame(), gi.button );
sTemp += ssprintf(" - "+CONTROLLER.GetValue()+" %d %s", gi.controller+1, sName.c_str() );
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
{
CString sSecondary = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), gi.button );
if( !sSecondary.empty() )
sTemp += ssprintf(" - (%s secondary)", sSecondary.c_str() );
MenuButton mb = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), gi.button );
if( mb != MenuButton_INVALID )
sTemp += ssprintf( " - (%s %s)", MenuButtonToLocalizedString(mb).c_str(), SECONDARY.GetValue().c_str() );
}
}
else
{
sTemp += " - not mapped";
sTemp += " - "+NOT_MAPPED.GetValue();
}
CString sComment = INPUTFILTER->GetButtonComment( *di );
+1 -1
View File
@@ -80,7 +80,7 @@ void ScreenTestLights::Update( float fDeltaTime )
}
else
{
CString sGameButton = GAMESTATE->GetCurrentGame()->m_szButtonNames[gb];
CString sGameButton = GameButtonToLocalizedString( GAMESTATE->GetCurrentGame(), gb );
s += ssprintf( "controller light: P%d %d %s\n", gc+1, gb, sGameButton.c_str() );
}