From 2764ff2e93c17de1f7ddaeffdbb0a5cfb48cc526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Fri, 5 Jul 2024 23:20:19 +0200 Subject: [PATCH] deshabilitados los sonidos en el modo demo --- Makefile | 4 ++++ source/game.cpp | 30 ++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index f93997e..f5cd8ff 100644 --- a/Makefile +++ b/Makefile @@ -172,6 +172,10 @@ macos: $(CXX) $(SOURCES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)" +macos_fast: + $(CXX) $(SOURCES) -D VERBOSE -std=c++11 -Wall -lSDL2 -Wno-deprecated -framework OpenGL -o "$(TARGET_FILE)" + + macos_debug: $(CXX) $(SOURCES) -D DEBUG $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)_debug" diff --git a/source/game.cpp b/source/game.cpp index e0252fd..137e9f5 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -245,6 +245,7 @@ void Game::init(int playerID) if (demo.enabled) { + // Selecciona una pantalla al azar const int num = rand() % 2; if (num == 0) { @@ -256,6 +257,15 @@ void Game::init(int playerID) balloonsPopped = 1800; currentStage = 6; } + + // Añade 0, 1 o 2 cafes al jugador + // for (int i = 0; i < rand() % 4; ++i) + { + players[0]->hasExtraHit(); + } + + // Deshabilita los sonidos + JA_EnableSound(false); } initPaths(); @@ -277,9 +287,10 @@ void Game::init(int playerID) } // Modo demo - demo.recording = false; #ifdef RECORDING demo.recording = true; +#else + demo.recording = false; #endif demo.counter = 0; @@ -2118,18 +2129,15 @@ void Game::checkBulletBalloonCollision() // Explota el globo popBalloon(balloon); - // Si no es el modo demo, genera un sonido - if (!demo.enabled) - { - JA_PlaySound(balloonSound); - } + // Sonido de explosión + JA_PlaySound(balloonSound); // Deshabilita la bala bullet->disable(); // Suelta el item en caso de que salga uno const Uint8 droppeditem = dropItem(); - //if ((droppeditem != NO_KIND) && !(demo.enabled) && !(demo.recording)) + // if ((droppeditem != NO_KIND) && !(demo.enabled) && !(demo.recording)) if ((droppeditem != NO_KIND) && !(demo.recording)) { if (droppeditem != ITEM_COFFEE_MACHINE) @@ -2536,7 +2544,7 @@ void Game::update() #ifdef RECORDING checkInput(); - + if (demo.recording) { if (demo.counter >= TOTAL_DEMO_DATA) @@ -3034,6 +3042,12 @@ void Game::run() checkEvents(); // Tiene que ir antes del render render(); } + + // Vuelve a dejar el sonido como estaba + if (demo.enabled) + { + JA_EnableSound(options->audio.sound.enabled); + } } // Indica si se puede crear una powerball