Fix: En la secuencia del final, al pulsar ESC se cerraba el juego. Ahora vuelve al logo

This commit is contained in:
2022-12-29 15:26:02 +01:00
parent 48b8ae049a
commit 4c3c844ccf
4 changed files with 10 additions and 9 deletions

View File

@@ -161,7 +161,8 @@ void Ending::checkEventHandler()
switch (eventHandler->key.keysym.scancode)
{
case SDL_SCANCODE_ESCAPE:
section->name = SECTION_PROG_QUIT;
section->name = SECTION_PROG_LOGO;
section->subsection = SUBSECTION_LOGO_TO_INTRO;
break;
case SDL_SCANCODE_B:

View File

@@ -195,7 +195,8 @@ void Ending2::checkEventHandler()
switch (eventHandler->key.keysym.scancode)
{
case SDL_SCANCODE_ESCAPE:
section->name = SECTION_PROG_QUIT;
section->name = SECTION_PROG_LOGO;
section->subsection = SUBSECTION_LOGO_TO_INTRO;
break;
case SDL_SCANCODE_B:

View File

@@ -127,7 +127,7 @@ void Game::checkEventHandler()
reLoadTextures();
}
if ((eventHandler->type == SDL_KEYDOWN) and (eventHandler->key.repeat == 0))
if (eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0)
{
switch (eventHandler->key.keysym.scancode)
{
@@ -577,10 +577,9 @@ void Game::setScoreBoardColor()
// Comprueba si ha finalizado el juego
bool Game::checkEndGame()
{
const bool isOnTheRoom = room->getName() == "THE JAIL"; // Estar en la habitación que toca
// const bool haveTheItems = board.items >= int(totalItems * 0.9f) || options->cheat.jailEnabled; // Con mas del 90% de los items recogidos
const bool haveTheItems = board.items == 2;
const bool isOnTheDoor = player->getRect().x <= 128; // Y en la ubicación que toca (En la puerta)
const bool isOnTheRoom = room->getName() == "THE JAIL"; // Estar en la habitación que toca
const bool haveTheItems = board.items >= int(totalItems * 0.9f) || options->cheat.jailEnabled; // Con mas del 90% de los items recogidos
const bool isOnTheDoor = player->getRect().x <= 128; // Y en la ubicación que toca (En la puerta)
if (haveTheItems)
{
@@ -666,7 +665,7 @@ void Game::checkRestoringJail()
JA_PlaySound(deathSound);
// Invalida el logro de completar el juego sin entrar a la jail
const bool haveTheItems = board.items == 2;
const bool haveTheItems = board.items >= int(totalItems * 0.9f);
if (!haveTheItems)
{
cheevos->invalidate(9);

View File

@@ -82,7 +82,7 @@ void Logo::checkEventHandler()
}
// Comprueba las teclas que se han pulsado
if ((eventHandler->type == SDL_KEYUP && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONUP))
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONUP))
{
switch (eventHandler->key.keysym.scancode)
{