mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 18:19:43 +01:00
Fix squeak and save spam in gamepad menu
If you push a button to set a controller binding, you may either hear one Viridian squeak, two Viridian squeaks (a louder one), or Viridian doesn't stop squeaking until you let go of the button. While you hear the continuous squeaking, your save file is also repeatedly saved. There are two small bugs at play here: - the squeak is actually played in two different places at the same time (both in titleinput() whenever a button is pressed, and in updatebuttonmappings() when a mapping is succesfully changed) - titleinput() doesn't register that a button is held down and applies the button (and saves to file) every frame for as long as the button is held This commit fixes both these issues. Now a single button press always causes one squeak, and only if the bindings actually changed. Your save file is also no longer saved repeatedly from holding down the button.
This commit is contained in:
parent
f9f9f076b4
commit
d709db4b45
1 changed files with 12 additions and 3 deletions
|
@ -2377,17 +2377,26 @@ void titleinput(void)
|
|||
game.jumpheld = true;
|
||||
}
|
||||
|
||||
static bool controller_held = false;
|
||||
|
||||
if ( game.currentmenuname == Menu::controller &&
|
||||
game.currentmenuoption > 0 &&
|
||||
game.currentmenuoption < 6 &&
|
||||
(game.separate_interact || game.currentmenuoption < 5) &&
|
||||
key.controllerButtonDown() )
|
||||
{
|
||||
if (!controller_held)
|
||||
{
|
||||
controller_held = true;
|
||||
updatebuttonmappings(game.currentmenuoption);
|
||||
music.playef(Sound_VIRIDIAN);
|
||||
game.savestatsandsettings_menu();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
controller_held = false;
|
||||
}
|
||||
|
||||
if (game.menustart
|
||||
&& game.menucountdown <= 0
|
||||
|
|
Loading…
Reference in a new issue