Random background movie support
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "GameManager.h"
|
||||
#include "RageException.h"
|
||||
#include "RageTimer.h"
|
||||
#include "InputMapper.h"
|
||||
|
||||
|
||||
InputQueue* INPUTQUEUE = NULL; // global and accessable from anywhere in our program
|
||||
@@ -34,6 +35,35 @@ void InputQueue::RememberInput( const GameInput GameI )
|
||||
m_aQueue[c].Add( GameButtonAndTime(GameI.button,TIMER->GetTimeSinceStart()) );
|
||||
};
|
||||
|
||||
bool InputQueue::MatchesPattern( const GameController c, const MenuButton* button_sequence, const int iNumButtons, float fMaxSecondsBack )
|
||||
{
|
||||
if( fMaxSecondsBack == -1 )
|
||||
fMaxSecondsBack = 0.4f + iNumButtons*0.15f;
|
||||
|
||||
float fOldestTimeAllowed = TIMER->GetTimeSinceStart() - fMaxSecondsBack;
|
||||
|
||||
int sequence_index = iNumButtons-1; // count down
|
||||
for( int queue_index=m_aQueue[c].GetSize()-1; queue_index>=0; queue_index-- ) // iterate newest to oldest
|
||||
{
|
||||
GameButtonAndTime BandT = m_aQueue[c][queue_index];
|
||||
GameInput GameI( c, BandT.button );
|
||||
MenuInput MenuI;
|
||||
INPUTMAPPER->GameToMenu( GameI, MenuI );
|
||||
if( MenuI.button != button_sequence[sequence_index] ||
|
||||
BandT.fTime < fOldestTimeAllowed )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if( sequence_index == 0 ) // we matched the whole pattern
|
||||
{
|
||||
m_aQueue[c].RemoveAll(); // empty the queue so we don't match on it again
|
||||
return true;
|
||||
}
|
||||
sequence_index--;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InputQueue::MatchesPattern( const GameController c, const GameButton* button_sequence, const int iNumButtons, float fMaxSecondsBack )
|
||||
{
|
||||
if( fMaxSecondsBack == -1 )
|
||||
|
||||
Reference in New Issue
Block a user