cleanup
This commit is contained in:
@@ -69,6 +69,8 @@ CodeItem g_CodeItems[CodeDetector::NUM_CODES];
|
|||||||
|
|
||||||
bool CodeItem::EnteredCode( GameController controller ) const
|
bool CodeItem::EnteredCode( GameController controller ) const
|
||||||
{
|
{
|
||||||
|
if( controller == GAME_CONTROLLER_INVALID )
|
||||||
|
return false;
|
||||||
if( buttons.size() == 0 )
|
if( buttons.size() == 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -97,7 +99,7 @@ bool CodeItem::EnteredCode( GameController controller ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeItem::Load( CString sButtonsNames )
|
bool CodeItem::Load( CString sButtonsNames )
|
||||||
{
|
{
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
|
|
||||||
@@ -127,7 +129,7 @@ void CodeItem::Load( CString sButtonsNames )
|
|||||||
{
|
{
|
||||||
if( sButtonsNames != "" )
|
if( sButtonsNames != "" )
|
||||||
LOG->Trace( "The code '%s' is less than 2 buttons, so it will be ignored.", sButtonsNames.c_str() );
|
LOG->Trace( "The code '%s' is less than 2 buttons, so it will be ignored.", sButtonsNames.c_str() );
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned i=0; i<asButtonNames.size(); i++ ) // for each button in this code
|
for( unsigned i=0; i<asButtonNames.size(); i++ ) // for each button in this code
|
||||||
@@ -140,7 +142,7 @@ void CodeItem::Load( CString sButtonsNames )
|
|||||||
{
|
{
|
||||||
LOG->Trace( "The code '%s' contains an unrecognized button '%s'.", sButtonsNames.c_str(), sButtonName.c_str() );
|
LOG->Trace( "The code '%s' contains an unrecognized button '%s'.", sButtonsNames.c_str(), sButtonName.c_str() );
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons.push_back( gb );
|
buttons.push_back( gb );
|
||||||
@@ -162,6 +164,7 @@ void CodeItem::Load( CString sButtonsNames )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we make it here, we found all the buttons in the code
|
// if we make it here, we found all the buttons in the code
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CodeDetector::EnteredCode( GameController controller, Code code )
|
bool CodeDetector::EnteredCode( GameController controller, Code code )
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
struct CodeItem
|
struct CodeItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Load( CString sButtonsNames );
|
bool Load( CString sButtonsNames );
|
||||||
bool EnteredCode( GameController controller ) const;
|
bool EnteredCode( GameController controller ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ void InputQueue::RememberInput( const GameInput GameI )
|
|||||||
|
|
||||||
bool InputQueue::MatchesSequence( GameController c, const MenuButton* button_sequence, const int iNumButtons, float fMaxSecondsBack )
|
bool InputQueue::MatchesSequence( GameController c, const MenuButton* button_sequence, const int iNumButtons, float fMaxSecondsBack )
|
||||||
{
|
{
|
||||||
|
if( c == GAME_CONTROLLER_INVALID )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( fMaxSecondsBack == -1 )
|
if( fMaxSecondsBack == -1 )
|
||||||
fMaxSecondsBack = 0.4f + iNumButtons*0.15f;
|
fMaxSecondsBack = 0.4f + iNumButtons*0.15f;
|
||||||
|
|
||||||
@@ -66,6 +69,9 @@ bool InputQueue::MatchesSequence( GameController c, const MenuButton* button_seq
|
|||||||
|
|
||||||
bool InputQueue::MatchesSequence( GameController c, const GameButton* button_sequence, const int iNumButtons, float fMaxSecondsBack )
|
bool InputQueue::MatchesSequence( GameController c, const GameButton* button_sequence, const int iNumButtons, float fMaxSecondsBack )
|
||||||
{
|
{
|
||||||
|
if( c == GAME_CONTROLLER_INVALID )
|
||||||
|
return false;
|
||||||
|
|
||||||
float fOldestTimeAllowed = RageTimer::GetTimeSinceStart() - fMaxSecondsBack;
|
float fOldestTimeAllowed = RageTimer::GetTimeSinceStart() - fMaxSecondsBack;
|
||||||
|
|
||||||
int sequence_index = iNumButtons-1; // count down
|
int sequence_index = iNumButtons-1; // count down
|
||||||
|
|||||||
Reference in New Issue
Block a user