demo: en saltar amb tecla torna a TITLE_3 (menu visible) en lloc de instructions/TITLE_1, reseteja el comptador de demo
This commit is contained in:
@@ -864,6 +864,11 @@ void Title::iterate() {
|
||||
if (demo_game_->hasFinished()) {
|
||||
// cppcheck-suppress knownConditionTrueFalse ; fals positiu: iterate() pot escriure section_->name=SECTION_PROG_QUIT (Alt+F4), cppcheck no creua la crida
|
||||
const bool WAS_QUIT = (section_->name == SECTION_PROG_QUIT);
|
||||
// Game::processDemoInput posa subsection=TITLE_INSTRUCTIONS només
|
||||
// quan la demo s'acaba de manera natural (esgotat el playback).
|
||||
// Si l'usuari l'ha saltat amb una tecla, la subsection queda en
|
||||
// GAME_PLAY i tornem directament al titol, sense instructions.
|
||||
const bool DEMO_ENDED_NATURALLY = (section_->subsection == SUBSECTION_TITLE_INSTRUCTIONS);
|
||||
delete demo_game_;
|
||||
demo_game_ = nullptr;
|
||||
demo_game_active_ = false;
|
||||
@@ -871,15 +876,19 @@ void Title::iterate() {
|
||||
// cppcheck-suppress knownConditionTrueFalse ; fals positiu: WAS_QUIT depèn de iterate() que pot mutar section_->name
|
||||
if (WAS_QUIT) {
|
||||
section_->name = SECTION_PROG_QUIT;
|
||||
} else if (demo_then_instructions_) {
|
||||
} else if (demo_then_instructions_ && DEMO_ENDED_NATURALLY) {
|
||||
section_->name = SECTION_PROG_TITLE;
|
||||
section_->subsection = SUBSECTION_TITLE_3;
|
||||
demo_then_instructions_ = false;
|
||||
runInstructions(Instructions::Mode::AUTO);
|
||||
} else {
|
||||
// Demo saltada: tornem a l'estat final del titol (TITLE_3, menu
|
||||
// visible i musica) i reiniciem el comptador de demo perque no
|
||||
// salti immediatament una altra vegada.
|
||||
section_->name = SECTION_PROG_TITLE;
|
||||
section_->subsection = SUBSECTION_TITLE_1;
|
||||
section_->subsection = SUBSECTION_TITLE_3;
|
||||
demo_remaining_s_ = DEMO_TIMEOUT_S;
|
||||
}
|
||||
demo_then_instructions_ = false;
|
||||
// Reset del rellotge per evitar un dt enorme al tornar al Title.
|
||||
DeltaTime::reset();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user