Random background movie support

This commit is contained in:
Chris Danford
2002-07-31 22:37:58 +00:00
parent 4ec08edf2d
commit 4f732aaa5b
11 changed files with 127 additions and 40 deletions
+30
View File
@@ -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 )