eliminat codi mort

This commit is contained in:
2025-08-16 09:33:40 +02:00
parent 960ee367df
commit 5c708fc60a
9 changed files with 16 additions and 38 deletions

View File

@@ -258,7 +258,6 @@ void Credits::fillCanvas() {
SDL_RenderFillRect(Screen::get()->getRenderer(), &right_black_rect_);
// Dibuja el rectangulo rojo
// SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0xFF, 0, 0, 0xFF);
const Color COLOR = color_.LIGHTEN();
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), COLOR.r, COLOR.g, COLOR.b, 0xFF);
SDL_RenderRect(Screen::get()->getRenderer(), &border_rect_);
@@ -474,9 +473,6 @@ void Credits::resetVolume() const {
// Cambia el color del fondo
void Credits::cycleColors() {
// constexpr int UPPER_LIMIT = 255; // Límite superior
// constexpr int LOWER_LIMIT = 80; // Límite inferior
constexpr int UPPER_LIMIT = 140; // Límite superior
constexpr int LOWER_LIMIT = 30; // Límite inferior

View File

@@ -424,7 +424,6 @@ void Game::updateGameStateCompleted() {
// Comprueba el estado del juego
void Game::checkState() {
// if (state_ != State::COMPLETED && Stage::number == 10) {
if (state_ != State::COMPLETED && stage_manager_->isGameCompleted()) {
setState(State::COMPLETED);
background_->setState(Background::State::COMPLETED);
@@ -1478,7 +1477,6 @@ void Game::initDemo(Player::Id player_id) {
constexpr auto NUM_DEMOS = 3;
const auto DEMO = rand() % NUM_DEMOS;
constexpr std::array<int, NUM_DEMOS> STAGES = {0, 3, 5};
// Stage::number = STAGES[DEMO];
stage_manager_->jumpToStage(STAGES.at(DEMO));
}
@@ -1735,7 +1733,6 @@ void Game::updateGameStateShowingGetReadyMessage() {
void Game::updateGameStatePlaying() {
#ifdef _DEBUG
if (auto_pop_balloons_) {
// Stage::addPower(5);
stage_manager_->addPower(5);
}
#endif
@@ -1884,7 +1881,6 @@ void Game::handleDebugEvents(const SDL_Event &event) {
case SDLK_1: // Crea una powerball
{
balloon_manager_->createPowerBall();
// throwCoffee(players_.at(0)->getPosX() + (players_.at(0)->getWidth() / 2), players_.at(0)->getPosY() + (players_.at(0)->getHeight() / 2));
break;
}
case SDLK_2: // Activa o desactiva la aparición de globos

View File

@@ -190,7 +190,7 @@ void Intro::updateScene5() {
// Acaba la ultima imagen
if (card_sprites_.at(5)->hasFinished() && texts_.at(8)->hasFinished()) {
state_ = IntroState::POST;
state_ = State::POST;
state_start_time_ = SDL_GetTicks();
}
}
@@ -215,13 +215,13 @@ void Intro::update() {
tiled_bg_->update(); // Actualiza el fondo
switch (state_) {
case IntroState::SCENES:
case State::SCENES:
updateSprites();
updateTexts();
updateScenes();
break;
case IntroState::POST:
case State::POST:
updatePostState();
break;
}
@@ -240,13 +240,13 @@ void Intro::render() {
tiled_bg_->render(); // Dibuja el fondo
switch (state_) {
case IntroState::SCENES: {
case State::SCENES: {
renderTextRect();
renderSprites();
renderTexts();
break;
}
case IntroState::POST:
case State::POST:
break;
}
@@ -479,7 +479,7 @@ void Intro::updatePostState() {
const Uint32 ELAPSED_TIME = SDL_GetTicks() - state_start_time_;
switch (post_state_) {
case IntroPostState::STOP_BG:
case PostState::STOP_BG:
// EVENTO: Detiene el fondo después de 1 segundo
if (ELAPSED_TIME >= 1000) {
tiled_bg_->stopGracefully();
@@ -493,12 +493,12 @@ void Intro::updatePostState() {
// Cambia de estado si el fondo se ha detenido y recuperado el color
if (tiled_bg_->isStopped() && bg_color_.IS_EQUAL_TO(param.title.bg_color)) {
post_state_ = IntroPostState::END;
post_state_ = PostState::END;
state_start_time_ = SDL_GetTicks();
}
break;
case IntroPostState::END:
case PostState::END:
// Finaliza la intro después de 1 segundo
if (ELAPSED_TIME >= 1000) {
Audio::get()->stopMusic();

View File

@@ -28,12 +28,12 @@ class Intro {
private:
// --- Estados internos ---
enum class IntroState {
enum class State {
SCENES,
POST,
};
enum class IntroPostState {
enum class PostState {
STOP_BG,
END,
};
@@ -43,15 +43,14 @@ class Intro {
std::vector<std::unique_ptr<PathSprite>> shadow_sprites_; // Vector con los sprites inteligentes para las sombras
std::vector<std::unique_ptr<Writer>> texts_; // Textos de la intro
std::unique_ptr<TiledBG> tiled_bg_; // Fondo en mosaico
// std::unique_ptr<Sprite> shadow_square_for_text_; // Sprite
// --- Variables ---
Uint64 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
int scene_ = 0; // Indica qué escena está activa
IntroState state_ = IntroState::SCENES; // Estado principal de la intro
IntroPostState post_state_ = IntroPostState::STOP_BG; // Estado POST
Uint32 state_start_time_; // Tiempo de inicio del estado actual
Color bg_color_ = param.intro.bg_color; // Color de fondo
Uint64 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
int scene_ = 0; // Indica qué escena está activa
State state_ = State::SCENES; // Estado principal de la intro
PostState post_state_ = PostState::STOP_BG; // Estado POST
Uint32 state_start_time_; // Tiempo de inicio del estado actual
Color bg_color_ = param.intro.bg_color; // Color de fondo
// --- Métodos internos ---
void update(); // Actualiza las variables del objeto