Holds are now fixed!
1. a new variable is introduced "lastDownId". 2. This variable is used to track the last pressed button. In case of "holds" the button HAS to be the last one pressed, this is the case on all the official games. 3. This will fix the syndrome "just hold R2 / L2 to get the full hold score".
This commit is contained in:
@@ -19,10 +19,14 @@ namespace TLAC::Input
|
||||
|
||||
bool Binding::AnyDown()
|
||||
{
|
||||
int i = 0;
|
||||
for (const auto& binding : InputBindings)
|
||||
{
|
||||
if (binding->IsDown())
|
||||
// If an old input is still held down, don't register it, only a new input is allowed.
|
||||
if (binding->IsDown() && this->lastDownId == i)
|
||||
return true;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -30,10 +34,16 @@ namespace TLAC::Input
|
||||
|
||||
bool Binding::AnyTapped()
|
||||
{
|
||||
int i = 0;
|
||||
for (const auto& binding : InputBindings)
|
||||
{
|
||||
if (binding->IsTapped())
|
||||
if (binding->IsTapped()) {
|
||||
// This saves the last button id to a variable, so that it's known as the last input registered (see AnyDown()).
|
||||
this->lastDownId = i;
|
||||
return true;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace TLAC::Input
|
||||
{
|
||||
class Binding
|
||||
{
|
||||
// Used in down & tapped events
|
||||
int lastDownId = -1;
|
||||
|
||||
public:
|
||||
std::vector<IInputBinding*> InputBindings;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user