From 5ca4ee0bb8c9a365a6bc8bf38ee0d03c6794dbee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Thu, 26 Sep 2024 22:50:46 +0200 Subject: [PATCH] Afegit estat pre-logo per a poder fer reset mes millor --- source/const.h | 1 + source/director.cpp | 6 +++++- source/intro.cpp | 2 +- source/logo.cpp | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/source/const.h b/source/const.h index 1d3731b..8cd55f6 100644 --- a/source/const.h +++ b/source/const.h @@ -11,6 +11,7 @@ #define PLAY_AREA_TOP 0 // Secciones del programa +#define SECTION_PROG_INIT 8 #define SECTION_PROG_LOGO 0 #define SECTION_PROG_INTRO 1 #define SECTION_PROG_TITLE 2 diff --git a/source/director.cpp b/source/director.cpp index f2ba32a..0a3957f 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -950,6 +950,10 @@ int Director::run() { switch (section->name) { + case SECTION_PROG_INIT: + section->name = SECTION_PROG_LOGO; + break; + case SECTION_PROG_LOGO: runLogo(); break; @@ -1194,7 +1198,7 @@ std::string Director::getLangFile(lang::lang_e lang) case lang::en_UK: return asset->get("en_UK.txt"); break; - + default: break; } diff --git a/source/intro.cpp b/source/intro.cpp index 2edbd45..632287c 100644 --- a/source/intro.cpp +++ b/source/intro.cpp @@ -220,7 +220,7 @@ void Intro::checkInput() // Comprueba si se va a resetear el juego if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i)) { - section->name = SECTION_PROG_LOGO; + section->name = SECTION_PROG_INIT; screen->showNotification("Reset"); return; } diff --git a/source/logo.cpp b/source/logo.cpp index a713d0b..7d65a7f 100644 --- a/source/logo.cpp +++ b/source/logo.cpp @@ -111,6 +111,14 @@ void Logo::checkInput() return; } + // Comprueba si se va a resetear el juego + if (input->checkInput(input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD)) + { + section->name = SECTION_PROG_INIT; + screen->showNotification("Reset"); + return; + } + // Comprueba si se ha pulsado cualquier botón (de los usados para jugar) if (input->checkAnyButtonPressed()) { @@ -129,6 +137,14 @@ void Logo::checkInput() return; } + // Comprueba si se va a resetear el juego + if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i)) + { + section->name = SECTION_PROG_INIT; + screen->showNotification("Reset"); + return; + } + // Comprueba si se va a activar o desactivar el audio if (input->checkModInput(input_service, input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i)) {