From b09f07ef40b666c530b5acf69f91d2204e33474c Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 15 Aug 2024 12:53:17 +0200 Subject: [PATCH] =?UTF-8?q?afegit=20debug=20per=20avan=C3=A7ar=20rapidet?= =?UTF-8?q?=20per=20les=20fases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/game.cpp | 19 +++++++++++++++++-- source/game.h | 7 +++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/source/game.cpp b/source/game.cpp index 1a77e55..2a53fb7 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -194,6 +194,9 @@ void Game::init(int playerID) powerBallCounter = 0; coffeeMachineEnabled = false; balloonsPopped = 0; +#ifdef DEBUG + autoPopBalloons = false; +#endif // Inicializa las variables para el modo DEMO if (demo.enabled) @@ -1956,6 +1959,13 @@ void Game::update() return; } #endif +#ifdef DEBUG + if (autoPopBalloons && !gameCompleted) + { + balloonsPopped++; + increaseStageCurrentPower(1); + } +#endif // Comprueba si la música ha de estar sonando checkMusicStatus(); @@ -1970,7 +1980,7 @@ void Game::update() updatePlayers(); // Actualiza el marcador - checkPlayersStatus(); + checkPlayersStatusPlaying(); updateScoreboard(); // Actualiza el fondo @@ -2723,6 +2733,11 @@ void Game::checkEvents() } break; + case SDLK_3: + autoPopBalloons = !autoPopBalloons; + screen->showNotification("autoPopBalloons " + boolToString(autoPopBalloons)); + break; + default: break; } @@ -2859,7 +2874,7 @@ void Game::addScoreToScoreBoard(std::string name, int score) } // Comprueba el estado de los jugadores -void Game::checkPlayersStatus() +void Game::checkPlayersStatusPlaying() { for (auto player : players) { diff --git a/source/game.h b/source/game.h index e89ab64..bb0ac1f 100644 --- a/source/game.h +++ b/source/game.h @@ -200,6 +200,9 @@ private: int totalPowerToCompleteGame; // La suma del poder necesario para completar todas las fases bool paused; // Indica si el juego está pausado (no se deberia de poder utilizar en el modo arcade) int currentPower; // Poder actual almacenado para completar la fase +#ifdef DEBUG + bool autoPopBalloons; // Si es true, incrementa automaticamente los globos explotados +#endif // Actualiza el juego void update(); @@ -445,8 +448,8 @@ private: // Añade una puntuación a la tabla de records void addScoreToScoreBoard(std::string name, int score); - // Comprueba el estado de los jugadores - void checkPlayersStatus(); + // Comprueba el estado de juego de los jugadores + void checkPlayersStatusPlaying(); public: // Constructor