Mini-rewrite of input mapping, theme support, and added KSF reader.

This commit is contained in:
Chris Danford
2002-07-31 19:40:40 +00:00
parent 488798fef6
commit 4ec08edf2d
88 changed files with 1444 additions and 851 deletions
+9 -8
View File
@@ -26,14 +26,15 @@ InputQueue::InputQueue()
m_aQueue[p].SetSize( MAX_INPUT_QUEUE_LENGTH );
}
void InputQueue::HandleInput( const PlayerNumber p, const MenuButton b )
void InputQueue::RememberInput( const GameInput GameI )
{
if( m_aQueue[p].GetSize() >= MAX_INPUT_QUEUE_LENGTH ) // full
m_aQueue[p].RemoveAt( 0, m_aQueue[p].GetSize()-MAX_INPUT_QUEUE_LENGTH+1 );
m_aQueue[p].Add( MenuButtonAndTime(b,TIMER->GetTimeSinceStart()) );
int c = GameI.controller;
if( m_aQueue[c].GetSize() >= MAX_INPUT_QUEUE_LENGTH ) // full
m_aQueue[c].RemoveAt( 0, m_aQueue[c].GetSize()-MAX_INPUT_QUEUE_LENGTH+1 );
m_aQueue[c].Add( GameButtonAndTime(GameI.button,TIMER->GetTimeSinceStart()) );
};
bool InputQueue::MatchesPattern( const PlayerNumber p, const MenuButton* button_sequence, const int iNumButtons, float fMaxSecondsBack )
bool InputQueue::MatchesPattern( const GameController c, const GameButton* button_sequence, const int iNumButtons, float fMaxSecondsBack )
{
if( fMaxSecondsBack == -1 )
fMaxSecondsBack = 0.4f + iNumButtons*0.15f;
@@ -41,9 +42,9 @@ bool InputQueue::MatchesPattern( const PlayerNumber p, const MenuButton* button_
float fOldestTimeAllowed = TIMER->GetTimeSinceStart() - fMaxSecondsBack;
int sequence_index = iNumButtons-1; // count down
for( int queue_index=m_aQueue[p].GetSize()-1; queue_index>=0; queue_index-- ) // iterate newest to oldest
for( int queue_index=m_aQueue[c].GetSize()-1; queue_index>=0; queue_index-- ) // iterate newest to oldest
{
MenuButtonAndTime BandT = m_aQueue[p][queue_index];
GameButtonAndTime BandT = m_aQueue[c][queue_index];
if( BandT.button != button_sequence[sequence_index] ||
BandT.fTime < fOldestTimeAllowed )
{
@@ -51,7 +52,7 @@ bool InputQueue::MatchesPattern( const PlayerNumber p, const MenuButton* button_
}
if( sequence_index == 0 ) // we matched the whole pattern
{
m_aQueue[p].RemoveAll(); // empty the queue so we don't match on it again
m_aQueue[c].RemoveAll(); // empty the queue so we don't match on it again
return true;
}
sequence_index--;