put focus on last selected profile
This commit is contained in:
@@ -805,7 +805,7 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
|
|||||||
INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_LEFT) );
|
INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_LEFT) );
|
||||||
if( bHoldingLeftAndRight )
|
if( bHoldingLeftAndRight )
|
||||||
{
|
{
|
||||||
MoveRow( pn, -1, type != IET_FIRST_PRESS );
|
MoveRowRelative( pn, -1, type != IET_FIRST_PRESS );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -907,7 +907,7 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type
|
|||||||
case NAV_FIVE_KEY:
|
case NAV_FIVE_KEY:
|
||||||
/* Jump to the exit row. (If everyone's already on the exit row, then
|
/* Jump to the exit row. (If everyone's already on the exit row, then
|
||||||
* we'll have already gone to the next screen above.) */
|
* we'll have already gone to the next screen above.) */
|
||||||
MoveRow( pn, m_pRows.size()-m_iCurrentRow[pn]-1, type != IET_FIRST_PRESS );
|
MoveRowRelative( pn, m_pRows.size()-m_iCurrentRow[pn]-1, type != IET_FIRST_PRESS );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -945,7 +945,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
|||||||
*
|
*
|
||||||
* XXX: Only allow repeats if the opposite key isn't pressed; otherwise, holding both
|
* XXX: Only allow repeats if the opposite key isn't pressed; otherwise, holding both
|
||||||
* directions will repeat in place continuously, which is weird. */
|
* directions will repeat in place continuously, which is weird. */
|
||||||
MoveRow( pn, iDelta, Repeat );
|
MoveRowRelative( pn, iDelta, Repeat );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1045,7 +1045,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
|||||||
|
|
||||||
|
|
||||||
/* Up/down */
|
/* Up/down */
|
||||||
void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat )
|
void ScreenOptions::MoveRowRelative( PlayerNumber pn, int iDir, bool Repeat )
|
||||||
{
|
{
|
||||||
const int iCurrentRow = m_iCurrentRow[pn];
|
const int iCurrentRow = m_iCurrentRow[pn];
|
||||||
OptionRow &row = *m_pRows[iCurrentRow];
|
OptionRow &row = *m_pRows[iCurrentRow];
|
||||||
@@ -1057,14 +1057,14 @@ void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat )
|
|||||||
row.SetChoiceInRowWithFocus( pn, 0 );
|
row.SetChoiceInRowWithFocus( pn, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG->Trace("move pn %i, dir %i, rep %i", pn, dir, Repeat);
|
LOG->Trace("move pn %i, dir %i, rep %i", pn, iDir, Repeat);
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
{
|
{
|
||||||
if( m_InputMode == INPUTMODE_INDIVIDUAL && p != pn )
|
if( m_InputMode == INPUTMODE_INDIVIDUAL && p != pn )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
int r = m_iCurrentRow[p] + dir;
|
int r = m_iCurrentRow[p] + iDir;
|
||||||
if( Repeat && ( r == -1 || r == (int) m_pRows.size() ) )
|
if( Repeat && ( r == -1 || r == (int) m_pRows.size() ) )
|
||||||
continue; // don't wrap while repeating
|
continue; // don't wrap while repeating
|
||||||
|
|
||||||
@@ -1106,13 +1106,19 @@ void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat )
|
|||||||
}
|
}
|
||||||
if( changed )
|
if( changed )
|
||||||
{
|
{
|
||||||
if( dir < 0 )
|
if( iDir < 0 )
|
||||||
m_SoundPrevRow.Play();
|
m_SoundPrevRow.Play();
|
||||||
else
|
else
|
||||||
m_SoundNextRow.Play();
|
m_SoundNextRow.Play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenOptions::MoveRowAbsolute( PlayerNumber pn, int iRow, bool bRepeat )
|
||||||
|
{
|
||||||
|
int iDir = iRow - m_iCurrentRow[pn];
|
||||||
|
MoveRowRelative( pn, iDir, bRepeat );
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenOptions::MenuUp( PlayerNumber pn, const InputEventType type )
|
void ScreenOptions::MenuUp( PlayerNumber pn, const InputEventType type )
|
||||||
{
|
{
|
||||||
MenuUpDown( pn, type, -1 );
|
MenuUpDown( pn, type, -1 );
|
||||||
@@ -1170,7 +1176,7 @@ void ScreenOptions::MenuUpDown( PlayerNumber pn, const InputEventType type, int
|
|||||||
|
|
||||||
if( row.GetRowDef().IsEnabledForPlayer(pn) )
|
if( row.GetRowDef().IsEnabledForPlayer(pn) )
|
||||||
{
|
{
|
||||||
MoveRow( pn, iDelta, bRepeat );
|
MoveRowRelative( pn, iDelta, bRepeat );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,9 +66,10 @@ protected:
|
|||||||
|
|
||||||
virtual void BeginFadingOut() { this->PostScreenMessage( SM_BeginFadingOut, 0 ); }
|
virtual void BeginFadingOut() { this->PostScreenMessage( SM_BeginFadingOut, 0 ); }
|
||||||
|
|
||||||
void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat );
|
void ChangeValueInRow( PlayerNumber pn, int iDelta, bool bRepeat );
|
||||||
virtual void AfterChangeValueInRow( PlayerNumber pn ) {} // override this to detect when the value in a row has changed
|
virtual void AfterChangeValueInRow( PlayerNumber pn ) {} // override this to detect when the value in a row has changed
|
||||||
void MoveRow( PlayerNumber pn, int dir, bool Repeat );
|
void MoveRowRelative( PlayerNumber pn, int iDir, bool bRepeat );
|
||||||
|
void MoveRowAbsolute( PlayerNumber pn, int iRow, bool bRepeat );
|
||||||
|
|
||||||
void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,-1,type != IET_FIRST_PRESS); }
|
void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,-1,type != IET_FIRST_PRESS); }
|
||||||
void MenuRight( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,+1,type != IET_FIRST_PRESS); }
|
void MenuRight( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,+1,type != IET_FIRST_PRESS); }
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ void ScreenOptionsSelectProfile::Init()
|
|||||||
|
|
||||||
|
|
||||||
vector<OptionRowDefinition> vDefs;
|
vector<OptionRowDefinition> vDefs;
|
||||||
vector<OptionRowHandler*> vHands;
|
|
||||||
|
|
||||||
OptionRowDefinition def;
|
OptionRowDefinition def;
|
||||||
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||||
@@ -66,6 +65,7 @@ void ScreenOptionsSelectProfile::Init()
|
|||||||
def.m_bAllowExplanation = false;
|
def.m_bAllowExplanation = false;
|
||||||
|
|
||||||
int iIndex = 0;
|
int iIndex = 0;
|
||||||
|
int iRowToSelect = -1;
|
||||||
|
|
||||||
{
|
{
|
||||||
def.m_sName = "";
|
def.m_sName = "";
|
||||||
@@ -77,13 +77,15 @@ void ScreenOptionsSelectProfile::Init()
|
|||||||
GameCommand &gc = pHand->m_gc;
|
GameCommand &gc = pHand->m_gc;
|
||||||
CString sCommand = "screen,ScreenOptionsEditProfile";
|
CString sCommand = "screen,ScreenOptionsEditProfile";
|
||||||
gc.Load( iIndex++, ParseCommands(sCommand) );
|
gc.Load( iIndex++, ParseCommands(sCommand) );
|
||||||
vHands.push_back( pHand );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<CString> vsProfileID;
|
vector<CString> vsProfileID;
|
||||||
PROFILEMAN->GetLocalProfileIDs( vsProfileID );
|
PROFILEMAN->GetLocalProfileIDs( vsProfileID );
|
||||||
FOREACH_CONST( CString, vsProfileID, s )
|
FOREACH_CONST( CString, vsProfileID, s )
|
||||||
{
|
{
|
||||||
|
if( *s == GAMESTATE->m_sLastSelectedProfileID )
|
||||||
|
iRowToSelect = iIndex;
|
||||||
|
|
||||||
Profile &pro = PROFILEMAN->GetLocalProfile( *s );
|
Profile &pro = PROFILEMAN->GetLocalProfile( *s );
|
||||||
def.m_sName = "";
|
def.m_sName = "";
|
||||||
def.m_vsChoices.clear();
|
def.m_vsChoices.clear();
|
||||||
@@ -94,10 +96,14 @@ void ScreenOptionsSelectProfile::Init()
|
|||||||
GameCommand &gc = pHand->m_gc;
|
GameCommand &gc = pHand->m_gc;
|
||||||
CString sCommand = "profileid," + *s;
|
CString sCommand = "profileid," + *s;
|
||||||
gc.Load( iIndex++, ParseCommands(sCommand) );
|
gc.Load( iIndex++, ParseCommands(sCommand) );
|
||||||
vHands.push_back( pHand );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InitMenu( vDefs, vHands );
|
InitMenu( vDefs, m_OptionRowHandlers );
|
||||||
|
|
||||||
|
if( iRowToSelect != -1 )
|
||||||
|
MoveRowAbsolute( PLAYER_1, iRowToSelect, false );
|
||||||
|
|
||||||
|
GAMESTATE->m_sLastSelectedProfileID = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenOptionsSelectProfile::~ScreenOptionsSelectProfile()
|
ScreenOptionsSelectProfile::~ScreenOptionsSelectProfile()
|
||||||
|
|||||||
Reference in New Issue
Block a user