From 6c24615123077b2f70929a7c5e9ccfd3a0f95633 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 8 Sep 2006 04:19:42 +0000 Subject: [PATCH] fix "Right-Left" hold_and_press code triggering when left is pressed first --- stepmania/src/CodeDetector.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/stepmania/src/CodeDetector.cpp b/stepmania/src/CodeDetector.cpp index f52f713101..6fe74434cc 100644 --- a/stepmania/src/CodeDetector.cpp +++ b/stepmania/src/CodeDetector.cpp @@ -10,6 +10,7 @@ #include "Style.h" #include "RageUtil.h" #include "PlayerState.h" +#include "InputEventPlus.h" const char *CodeNames[] = { "Easier1", @@ -70,15 +71,19 @@ bool CodeItem::EnteredCode( GameController controller ) const return INPUTQUEUE->MatchesSequence( controller, &buttons[0], buttons.size(), fMaxSecondsBack ); case hold_and_press: { - // check that all but the last are being held + RageTimer OldestTimeAllowed = RageTimer() - 0.05f; + InputEventPlus iep; + if( !INPUTQUEUE->WasPressedRecently(controller, buttons[buttons.size()-1], OldestTimeAllowed, &iep) ) + return false; + + // Check that all but the last were being held when the last button was pressed. for( unsigned i=0; iIsBeingPressed(gi) ) + if( !INPUTMAPPER->IsBeingPressed(gi, MultiPlayer_INVALID, &iep.InputList) ) return false; } - // just pressed the last button - return INPUTQUEUE->MatchesSequence( controller, &buttons[buttons.size()-1], 1, 0.05f ); + return true; } break; case tap: