Skip to content

Commit

Permalink
guard RestartGameplay behind the DelayedBack preference
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Aug 25, 2021
1 parent 7a3d4ea commit e3de4d1
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Themes/_fallback/Languages/de.ini
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ Create New Profile=Create a new player profile.
DefaultFailType=IMMEDIATE stops play when all players run out of life. 30 MISSES stops play after 30 consecutive misses. END OF SONG stops play at the end of the song if all players have run out of life. OFF disables fail.
DefaultFailTypeNoOff=IMMEDIATE stops play when all players run out of life. 30 MISSES stops play after 30 consecutive misses. END OF SONG stops play at the end of the song if all players have run out of life.
DefaultNoteSkin=Choose the default noteskin to use when playing.
DelayedBack=If &oq;On&cq;, requires holding the Back button for 0.5 seconds to quit. Useful if you find yourself accidentally pressing the Back button on your controller.
DelayedBack=If On, requires holding the Back button for 1 second to quit. Useful if you find yourself accidentally pressing the Back button. Also applies to RestartGameplay.
DelayedTextureDeletion=Set to ON hold textures in memory instead of freeing them. This will eliminate the time needed to load the texture next from disk next time this is needed. This will cause slightly more memory accumulation.
Delete=
Difficulty=
Expand Down
2 changes: 1 addition & 1 deletion Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ Create New Profile=Create a new player profile.
DefaultFailType=IMMEDIATE stops play when all players run out of life. IMMEDIATE CONTINUE fails players when they run out of life, but allows play to continue. END OF SONG evaluates pass/fail at the end of the current stage. OFF disables fail.
DefaultFailTypeNoOff=IMMEDIATE stops play when all players run out of life. IMMEDIATE CONTINUE fails players when they run out of life, but allows play to continue. END OF SONG evaluates pass/fail at the end of the current stage.
DefaultNoteSkin=Choose the default noteskin to use when playing.
DelayedBack=If &oq;On&cq;, requires holding the Back button for 0.5 seconds to quit. Useful if you find yourself accidentally pressing the Back button on your controller.
DelayedBack=If On, requires holding the Back button for 1 second to quit. Useful if you find yourself accidentally pressing the Back button. Also applies to RestartGameplay.
DelayedTextureDeletion=Set to ON hold textures in memory instead of freeing them. This will eliminate the time needed to load the texture next from disk next time this is needed. This will cause slightly more memory accumulation.
Delete=
Difficulty=
Expand Down
2 changes: 1 addition & 1 deletion Themes/_fallback/Languages/es.ini
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ Create New Profile=Crear un perfil de jugador nuevo.
DefaultFailType=Cuando los jugadores se quedan sin vida, INMEDIATO detiene el juego inmediatamente; FIN DE CANCIÓN al final, y APAGADO desactiva la pantalla de fallo.
DefaultFailTypeNoOff=Cuando los jugadores se quedan sin vida, INMEDIATO detiene el juego inmediatamente, y FIN DE CANCIÓN al final.
DefaultNoteSkin=Elige el diseño de las flechas que se muestra por defecto al jugar.
DelayedBack=Si está activado, se necesita sostener el botón Atrás durante 0,5 segundos para salir. Resulta útil si pulsas el botón Atrás accidentalmente en la plataforma.
DelayedBack=Si está activado, se necesita sostener el botón Atrás durante 1 segundo para salir. Resulta útil si pulsas el botón Atrás accidentalmente.
DelayedTextureDeletion=Al activarlo, las texturas se mantienen en memoria en lugar de liberarlas. Esto reduce el tiempo de carga de texturas desde el disco duro la próxima vez que necesiten. No lo actives a menos que dispongas de, al menos, 512 MB de memoria RAM.
Delete=
Difficulty=
Expand Down
2 changes: 1 addition & 1 deletion Themes/_fallback/Languages/fr.ini
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ Create New Profile=Create a new player profile.
DefaultFailType=IMMEDIATE stops play when all players run out of life. 30 MISSES stops play after 30 consecutive misses. END OF SONG stops play at the end of the song if all players have run out of life. OFF disables fail.
DefaultFailTypeNoOff=IMMEDIATE stops play when all players run out of life. 30 MISSES stops play after 30 consecutive misses. END OF SONG stops play at the end of the song if all players have run out of life.
DefaultNoteSkin=Choose the default noteskin to use when playing.
DelayedBack=If &oq;On&cq;, requires holding the Back button for 0.5 seconds to quit. Useful if you find yourself accidentally pressing the Back button on your controller.
DelayedBack=If On, requires holding the Back button for 1 second to quit. Useful if you find yourself accidentally pressing the Back button. Also applies to RestartGameplay.
DelayedTextureDeletion=Set to ON hold textures in memory instead of freeing them. This will eliminate the time needed to load the texture next from disk next time this is needed. This will cause slightly more memory accumulation.
Delete=
Difficulty=
Expand Down
2 changes: 1 addition & 1 deletion Themes/_fallback/Languages/ja.ini
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ Select Profile=プロファイルを選択してください。
//メニュー→オプション→インプット
ArcadeOptionsNavigation=&oq;SM style&cq;では&START;を押すと項目の終わりに行き、各項目は&MENUUP;か&MENUDOWN;で移動します。 &oq;Arcade style&cq;では&START;で次の項目に移動し、&SELECT;で前の項目に戻ります。
AutoMapOnJoyChange=&oq;On&cq;にすると、接続されたことのない操作デバイスは\n自動的にキーマッピングが行われます。
DelayedBack=&oq;On&cq;にすると、&BACK;ボタンを0.5秒押さないと戻らなくなります。\nボタンを押し間違いやすい場合に有効です。
DelayedBack=Onにすると、&BACK;ボタンを1秒押さないと戻らなくなります。\nボタンを押し間違いやすい場合に有効です。
InputDebounceTime=キー入力後同じキーの入力を受け付けない時間を設定します。\nキー入力の誤検知が起きる場合は調整してください。
MusicWheelSwitchSpeed=ミュージックホイールの回転する速さを設定します。
OnlyDedicatedMenuButtons=&oq;Only dedicated buttons&cq;に設定すると、ゲームプレイ用ボタンが\nメニューなどの選択に使用できなくなります。
Expand Down
2 changes: 1 addition & 1 deletion Themes/_fallback/Languages/nl.ini
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ CreateNew=
DefaultFailType=METEEN stopt het spelen als alle spelers door hun leven zijn. 30 MISSEN stopt als er 30 keer achtereenvolgend word gemist. EIND VAN NUMMER stopt aan het eind van een nummer als de spelers geen leven meer hebben. UIT maakt falen onmogelijk.
DefaultFailTypeNoOff=METEEN stopt het spelen als alle spelers door hun leven zijn. 30 MISSEN stopt als er 30 keer achtereenvolgend word gemist. EIND VAN NUMMER stopt aan het eind van een nummer als de spelers geen leven meer hebben.
DefaultNoteSkin=Kies een standaard uiterlijk van de noten voor tijdens het spelen.
DelayedBack=Als dit op &oq;Aan&cq; staat moet je de Terug knop 0.5 seconden ingedrukt houden. Dit kan handig zijn als je de Terug knop makkelijk per ongeluk indrukt.
DelayedBack=Als dit op Aan staat moet je de Terug knop 1 seconden ingedrukt houden. Dit kan handig zijn als je de Terug knop makkelijk per ongeluk indrukt.
DelayedTextureDeletion=Als dit AAN staat worden de texturen in het geheugen gehouden in plaats van dat het geheugen wordt vrijgegeven. Dit elimineert de tijd voor het laden van de texturen van de harde schijf de volgende keer dat dit nodig is. Zet dit niet AAN als je minder dan 512MB geheugen hebt.
Delete=
Difficulty=
Expand Down
2 changes: 1 addition & 1 deletion Themes/_fallback/Languages/pl.ini
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ DancePointsForOni=Decyduje czy w trybie Oni wyświetlane są punkty czy procenty
DefaultFailType=NATYCHMIAST przerywa grę kiedy graczowi skończy się energia. 30 spudłowań przerywa grę po następujących po sobie 30 niezaliczonych strzałkach. NA KONIEC PIOSENKI przerywa grę dopiero na koniec piosenki nawet jeśli graczowi skończy się wcześniej energia. OFF wyłącza przerywanie gry.
DefaultFailTypeNoOff=NATYCHMIAST przerywa grę kiedy graczowi skończy się energia. 30 spudłowań przerywa grę po następujących po sobie 30 niezaliczonych strzałkach. NA KONIEC PIOSENKI przerywa grę dopiero na koniec piosenki nawet jeśli graczowi skończy się wcześniej energia.
DefaultNoteSkin=Ustala domyślny wygląd strzałek używanych podczas gry.
DelayedBack=Jeśli jest &oq;On&cq;, do przerwania gry jest koniecznie przytrzymanie klawisza BACK na 0.5 sekundy. Użyteczne jeśli ktoś często przypadkowo naciska ten klawisz na swojej macie.
DelayedBack=Jeśli jest On, do przerwania gry jest koniecznie przytrzymanie klawisza BACK na 1 sekundy. Użyteczne jeśli ktoś często przypadkowo naciska ten klawisz na swojej macie.
DelayedTextureDeletion=Włączona opcja powoduje że tekstury zostaną zatrzymane w pamięci. To eliminuje czas potrzebny na załadowanie ich ponownie. Nie ustawiać jeśli komputer posiada mniej niż 512MB RAM.
Delete=
Difficulty=
Expand Down
2 changes: 1 addition & 1 deletion Themes/_fallback/Languages/zh.ini
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Create New Profile=建立新的個人資料.
DefaultFailType=選擇遊戲結束的方式. 立即結束會在玩家生命歸零時立即結束遊玩. 繼續遊玩會在玩家生命歸零時判定失敗, 但仍可繼續. 歌曲結尾會在歌曲結束后判定失敗與否. 關會取消失敗判定.
DefaultFailTypeNoOff=選擇遊戲結束的方式. 立即結束會在玩家生命歸零時立即結束遊玩. 繼續遊玩會在玩家生命歸零時判定失敗, 但仍可繼續. 歌曲結尾會在歌曲結束后判定失敗與否.
DefaultNoteSkin=選擇預設按鍵樣式.
DelayedBack=如果選擇為長按, 在退出畫面時需要按 <返回> 0.5秒後才離開.
DelayedBack=如果選擇為長按, 在退出畫面時需要按 <返回> 1秒後才離開.
DelayedTextureDeletion=選擇是否將材質保留在記憶體中, 一般選擇為開.
Delete=譜面的刪除設定.
Difficulty=譜面的難易度設定.
Expand Down
35 changes: 20 additions & 15 deletions src/Etterna/Screen/Gameplay/ScreenGameplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1355,19 +1355,7 @@ ScreenGameplay::Input(const InputEventPlus& input) -> bool
if (!input.GameI.IsValid()) {
return false;
}

const auto iCol =
GAMESTATE->GetCurrentStyle(input.pn)->GameInputToColumn(input.GameI);

// Don't pass on any inputs to Player that aren't a press or a release.
switch (input.type) {
case IET_FIRST_PRESS:
case IET_RELEASE:
break;
default:
return false;
}


/* Restart gameplay button moved from theme to allow for rebinding for
* people who dont want to edit lua files :)
*/
Expand All @@ -1377,8 +1365,25 @@ ScreenGameplay::Input(const InputEventPlus& input) -> bool
bHoldingRestart |= input.MenuI == GAME_BUTTON_RESTART;
}
if (bHoldingRestart && (m_DancingState != STATE_OUTRO || AllAreFailing())) {
RestartGameplay();
}
// delayedback pref will work, or if it's off just go immediately
// but also just let it be instant if you failed
if ((PREFSMAN->m_bDelayedBack &&
INPUTFILTER->GetSecsHeld(input.DeviceI) >= 1.0F) ||
!PREFSMAN->m_bDelayedBack || AllAreFailing())
RestartGameplay();
}

// Don't pass on any inputs to Player that aren't a press or a release.
switch (input.type) {
case IET_FIRST_PRESS:
case IET_RELEASE:
break;
default:
return false;
}

const auto iCol =
GAMESTATE->GetCurrentStyle(input.pn)->GameInputToColumn(input.GameI);

// handle a step or battle item activate
if (GAMESTATE->IsHumanPlayer(input.pn)) {
Expand Down
7 changes: 6 additions & 1 deletion src/Etterna/Screen/Gameplay/ScreenGameplayReplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ ScreenGameplayReplay::Input(const InputEventPlus& input) -> bool
bHoldingRestart |= input.MenuI == GAME_BUTTON_RESTART;
}
if (bHoldingRestart) {
RestartGameplay();
// delayedback pref will work, or if it's off just go immediately
// but also just let it be instant if you failed
if ((PREFSMAN->m_bDelayedBack &&
INPUTFILTER->GetSecsHeld(input.DeviceI) >= 1.0F) ||
!PREFSMAN->m_bDelayedBack || AllAreFailing())
RestartGameplay();
}

return false;
Expand Down

0 comments on commit e3de4d1

Please sign in to comment.