xoffset -> addx

This commit is contained in:
Chris Danford
2003-04-14 05:22:33 +00:00
parent e22441b291
commit 71c57c1348
3 changed files with 9 additions and 9 deletions
+7 -4
View File
@@ -51,17 +51,18 @@ const int MAX_CODE_LENGTH = 10;
struct CodeCacheItem { struct CodeCacheItem {
int iNumButtons; int iNumButtons;
GameButton buttons[MAX_CODE_LENGTH]; GameButton buttons[MAX_CODE_LENGTH];
float fMaxSecondsBack;
}; };
CodeCacheItem g_CodeCacheItems[CodeDetector::NUM_CODES]; CodeCacheItem g_CodeCacheItems[CodeDetector::NUM_CODES];
bool CodeDetector::EnteredCode( GameController controller, Code code ) bool CodeDetector::EnteredCode( GameController controller, Code code )
{ {
if( g_CodeCacheItems[code].iNumButtons > 0 ) if( g_CodeCacheItems[code].iNumButtons == 0 )
if( INPUTQUEUE->MatchesPattern(controller, g_CodeCacheItems[code].buttons, g_CodeCacheItems[code].iNumButtons) ) return false;
return true;
return false; const CodeCacheItem& item = g_CodeCacheItems[code];
return INPUTQUEUE->MatchesPattern(controller, item.buttons, item.iNumButtons, item.fMaxSecondsBack);
} }
void RefreshCacheItem( int iIndex ) void RefreshCacheItem( int iIndex )
@@ -104,6 +105,8 @@ void RefreshCacheItem( int iIndex )
} }
} }
item.fMaxSecondsBack = item.iNumButtons*0.4f;
// 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
} }
-3
View File
@@ -67,9 +67,6 @@ bool InputQueue::MatchesPattern( const GameController c, const MenuButton* butto
bool InputQueue::MatchesPattern( const GameController c, const GameButton* 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;
float fOldestTimeAllowed = RageTimer::GetTimeSinceStart() - fMaxSecondsBack; float fOldestTimeAllowed = RageTimer::GetTimeSinceStart() - fMaxSecondsBack;
int sequence_index = iNumButtons-1; // count down int sequence_index = iNumButtons-1; // count down
+2 -2
View File
@@ -23,8 +23,8 @@ public:
InputQueue(); InputQueue();
void RememberInput( GameInput ); void RememberInput( GameInput );
bool MatchesPattern( const GameController c, const GameButton* button_sequence, const int iNumButtons, float fMaxSecondsBack = -1 ); bool MatchesPattern( const GameController c, const GameButton* button_sequence, const int iNumButtons, float fMaxSecondsBack );
bool MatchesPattern( const GameController c, const MenuButton* button_sequence, const int iNumButtons, float fMaxSecondsBack = -1 ); bool MatchesPattern( const GameController c, const MenuButton* button_sequence, const int iNumButtons, float fMaxSecondsBack );
protected: protected:
struct GameButtonAndTime struct GameButtonAndTime