Fixed CanGoLeft logic in SMC.

This commit is contained in:
Kyzentun
2014-09-04 21:18:24 -06:00
parent 49d0066108
commit 8e9ec1053d
2 changed files with 21 additions and 13 deletions
+19 -13
View File
@@ -429,34 +429,29 @@ bool ScreenMapControllers::Input( const InputEventPlus &input )
} }
break; break;
case KEY_LEFT: // Move the selection left, wrapping up. case KEY_LEFT: // Move the selection left, wrapping up.
if(CursorOnAction()) if(!CursorCanGoLeft())
{ {
break; break;
} }
if( m_CurSlot == 0 && m_CurController == 0 )
{
break; // can't go left any more
}
BeforeChangeFocus(); BeforeChangeFocus();
m_CurSlot--; if(m_CurSlot == 0)
if( m_CurSlot < 0 )
{ {
m_CurSlot = NUM_CHANGABLE_SLOTS-1; m_CurSlot = NUM_CHANGABLE_SLOTS-1;
m_CurController--; --m_CurController;
}
else
{
--m_CurSlot;
} }
AfterChangeFocus(); AfterChangeFocus();
m_soundChange.Play(); m_soundChange.Play();
bHandled = true; bHandled = true;
break; break;
case KEY_RIGHT: // Move the selection right, wrapping down. case KEY_RIGHT: // Move the selection right, wrapping down.
if(CursorOnAction()) if(!CursorCanGoRight())
{ {
break; break;
} }
if( m_CurSlot == NUM_CHANGABLE_SLOTS-1 && m_CurController == NUM_GameController-1 )
{
break; // can't go right any more
}
BeforeChangeFocus(); BeforeChangeFocus();
m_CurSlot++; m_CurSlot++;
if( m_CurSlot > NUM_CHANGABLE_SLOTS-1 ) if( m_CurSlot > NUM_CHANGABLE_SLOTS-1 )
@@ -625,6 +620,17 @@ bool ScreenMapControllers::CursorCanGoDown()
return m_CurButton < m_KeysToMap.size() + m_Actions.size(); return m_CurButton < m_KeysToMap.size() + m_Actions.size();
} }
bool ScreenMapControllers::CursorCanGoLeft()
{
return !CursorOnAction() && (m_CurSlot > 0 || m_CurController > 0);
}
bool ScreenMapControllers::CursorCanGoRight()
{
return !CursorOnAction() && (m_CurSlot < NUM_CHANGABLE_SLOTS-1 ||
m_CurController < NUM_GameController-1);
}
int ScreenMapControllers::CurKeyIndex() int ScreenMapControllers::CurKeyIndex()
{ {
// The header row is at 0, so subtract 1 from m_CurButton. // The header row is at 0, so subtract 1 from m_CurButton.
+2
View File
@@ -34,6 +34,8 @@ private:
bool CursorOnKey(); bool CursorOnKey();
bool CursorCanGoUp(); bool CursorCanGoUp();
bool CursorCanGoDown(); bool CursorCanGoDown();
bool CursorCanGoLeft();
bool CursorCanGoRight();
int CurKeyIndex(); int CurKeyIndex();
int CurActionIndex(); int CurActionIndex();
void SetCursorFromSetListCurrent(); void SetCursorFromSetListCurrent();