prettier test input

don't show secondary mappings if OnlyDedicatedMenuButtons is on
This commit is contained in:
Chris Danford
2005-04-23 22:50:13 +00:00
parent 0f9b2793f2
commit a29ac7a5fc
2 changed files with 25 additions and 28 deletions
+11 -20
View File
@@ -2703,11 +2703,8 @@ CString GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButt
* it) and/or map to a menu button (if m_DedicatedMenuButton or m_SecondaryMenuButton
* map to it).
*
* If a button is only used in gameplay, return ""; the primary description is
* sufficient.
*
* If a button is only used in menus, return "(dedicated)" if any other button
* maps to the same MenuButton; otherwise return "".
* If a button is only used in gameplay or is only used in menus, return ""; the
* primary description is sufficient.
*
* If a button is used in both gameplay and menus, return szSecondaryNames[] for
* the MenuButton.
@@ -2728,26 +2725,20 @@ CString GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButt
static const char *szSecondaryNames[NUM_MENU_BUTTONS] =
{
"(MenuLeft)",
"(MenuRight)",
"(MenuUp)",
"(MenuDown)",
"(MenuStart)",
"(MenuBack)",
"(Coin)",
"(Operator)"
"MenuLeft",
"MenuRight",
"MenuUp",
"MenuDown",
"MenuStart",
"MenuBack",
"Coin",
"Operator"
};
FOREACH_MenuButton(m)
{
if( !bUsedInGameplay && pGame->m_DedicatedMenuButton[m] == gb )
{
if( pGame->m_SecondaryMenuButton[m] == pGame->m_DedicatedMenuButton[m] ||
pGame->m_SecondaryMenuButton[m] == GAME_BUTTON_INVALID )
return "";
else
return "(dedicated)";
}
return "";
else if( bUsedInGameplay && pGame->m_SecondaryMenuButton[m] == gb )
return szSecondaryNames[m];
}
+14 -8
View File
@@ -9,6 +9,7 @@
#include "Game.h"
#include "ScreenDimensions.h"
#include "GameManager.h"
#include "PrefsManager.h"
REGISTER_SCREEN_CLASS( ScreenTestInput );
@@ -22,10 +23,10 @@ void ScreenTestInput::Init()
ScreenWithMenuElements::Init();
m_textInputs.LoadFromFont( THEME->GetPathF("Common","normal") );
m_textInputs.SetText( "" );
m_textInputs.SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y );
m_textInputs.SetXY( SCREEN_CENTER_X-250, SCREEN_CENTER_Y );
m_textInputs.SetDiffuse( RageColor(1,1,1,1) );
m_textInputs.SetZoom( 0.8f );
m_textInputs.SetZoom( 0.7f );
m_textInputs.SetHorizAlign( Actor::align_left );
this->AddChild( &m_textInputs );
SOUND->PlayMusic( THEME->GetPathS("ScreenTestInput","music") );
@@ -63,13 +64,18 @@ void ScreenTestInput::Update( float fDeltaTime )
if( INPUTMAPPER->DeviceToGame(di,gi) )
{
CString sName = GAMESTATE->GetCurrentGame()->m_szButtonNames[gi.button];
CString sSecondary = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), gi.button );
sTemp += ssprintf(" (Controller %d %s) %s", gi.controller+1, sName.c_str(), sSecondary.c_str() );
sTemp += ssprintf(" - Controller %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() );
}
}
else
{
sTemp += " (not mapped)";
sTemp += " - not mapped";
}
asInputs.push_back( sTemp );
@@ -77,7 +83,7 @@ void ScreenTestInput::Update( float fDeltaTime )
}
}
m_textInputs.SetText( join( "\n ", asInputs ) );
m_textInputs.SetText( join( "\n", asInputs ) );
}