From ec65ff9acb9d3b5502c28e82ba59ccf884fa0305 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 24 Sep 2025 18:26:39 +0200 Subject: [PATCH] corregit audio de timeStopItem --- source/sections/game.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/source/sections/game.cpp b/source/sections/game.cpp index 9688bc6..852e581 100644 --- a/source/sections/game.cpp +++ b/source/sections/game.cpp @@ -869,15 +869,27 @@ void Game::updateTimeStopped(float deltaTime) { // Fase de advertencia (últimos 2 segundos) if (time_stopped_timer_ <= WARNING_THRESHOLD_S) { static float last_sound_time = 0.0f; + static bool color_flash_sound_played = false; + static bool warning_phase_started = false; + + // CLAC al entrar en fase de advertencia + if (!warning_phase_started) { + playSound("clock.wav"); + warning_phase_started = true; + last_sound_time = 0.0f; // Reset para empezar el ciclo rápido + } + last_sound_time += deltaTime; if (last_sound_time >= CLOCK_SOUND_INTERVAL_S) { balloon_manager_->normalColorsToAllBalloons(); playSound("clock.wav"); last_sound_time = 0.0f; - } else if (last_sound_time >= COLOR_FLASH_INTERVAL_S) { + color_flash_sound_played = false; // Reset flag para el próximo intervalo + } else if (last_sound_time >= COLOR_FLASH_INTERVAL_S && !color_flash_sound_played) { balloon_manager_->reverseColorsToAllBalloons(); playSound("clock.wav"); + color_flash_sound_played = true; // Evita que suene múltiples veces } } else { // Fase normal - solo sonido ocasional @@ -888,8 +900,12 @@ void Game::updateTimeStopped(float deltaTime) { sound_timer = 0.0f; } } - } else { - disableTimeStopItem(); + + // Si el timer llega a 0 o menos, desactivar + if (time_stopped_timer_ <= 0) { + playSound("clock.wav"); // CLAC final + disableTimeStopItem(); + } } }