diff --git a/source/game.cpp b/source/game.cpp index 97f7f0e..3ead1e2 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -1845,7 +1845,7 @@ void Game::updateGameStateEnteringPlayer() updatePlayers(); updateScoreboard(); updateBackground(); - for (auto player : players_) + for (const auto &player : players_) { if (player->isPlaying()) { @@ -2026,7 +2026,7 @@ void Game::checkDebugEvents(const SDL_Event &event) } case SDLK_8: { - for (auto player : players_) + for (const auto &player : players_) { if (player->isPlaying()) { diff --git a/source/intro.cpp b/source/intro.cpp index 5deaa91..3ff8e86 100644 --- a/source/intro.cpp +++ b/source/intro.cpp @@ -327,7 +327,7 @@ void Intro::initSprites() sprites_.at(0)->addPath(-SPRITE_WIDTH - 10, X_DEST, PathType::HORIZONTAL, Y_DEST, 100, easeInOutExpo, 0); sprites_.at(1)->addPath(param.game.width, X_DEST, PathType::HORIZONTAL, Y_DEST, 100, easeOutBounce, 0); sprites_.at(2)->addPath(-SPRITE_HEIGHT, Y_DEST, PathType::VERTICAL, X_DEST, 40, easeOutQuint, 0); - sprites_.at(3)->addPath(param.game.height, Y_DEST, PathType::VERTICAL, X_DEST, 800, easeOutQuint, 0); + sprites_.at(3)->addPath(param.game.height, Y_DEST, PathType::VERTICAL, X_DEST, 600, easeOutQuint, 0); sprites_.at(4)->addPath(-SPRITE_HEIGHT, Y_DEST, PathType::VERTICAL, X_DEST, 70, easeOutElastic, 0); sprites_.at(5)->addPath(param.game.width, X_DEST, PathType::HORIZONTAL, Y_DEST, 400, easeOutQuad, 300); sprites_.at(5)->addPath(X_DEST, -SPRITE_WIDTH, PathType::HORIZONTAL, Y_DEST, 80, easeInElastic, 0); @@ -377,7 +377,7 @@ void Intro::initSprites() shadow_sprites_.at(0)->addPath(param.game.height + 10, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 100, easeInOutExpo, 0); shadow_sprites_.at(1)->addPath(-SHADOW_SPRITE_HEIGHT, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 100, easeOutBounce, 0); shadow_sprites_.at(2)->addPath(-SHADOW_SPRITE_WIDTH, S_X_DEST, PathType::HORIZONTAL, S_Y_DEST, 40, easeOutQuint, 0); - shadow_sprites_.at(3)->addPath(param.game.width, S_X_DEST, PathType::HORIZONTAL, S_Y_DEST, 800, easeOutQuint, 0); + shadow_sprites_.at(3)->addPath(param.game.width, S_X_DEST, PathType::HORIZONTAL, S_Y_DEST, 600, easeOutQuint, 0); shadow_sprites_.at(4)->addPath(param.game.height, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 70, easeOutElastic, 0); shadow_sprites_.at(5)->addPath(-SHADOW_SPRITE_HEIGHT, S_Y_DEST, PathType::VERTICAL, S_X_DEST, 400, easeOutQuad, 300); shadow_sprites_.at(5)->addPath(S_X_DEST, param.game.width, PathType::HORIZONTAL, S_Y_DEST, 80, easeInElastic, 0); @@ -493,11 +493,15 @@ void Intro::updatePostState() tiled_bg_->stopGracefully(); // Modifica el color del fondo hasta llegar a blanco - if (bg_color_ < 255) + if (bg_color_ <= 253) // Garantiza que no se exceda de 255 al incrementar de 2 en 2 { - ++bg_color_; - tiled_bg_->setColor(Color(bg_color_, bg_color_, bg_color_)); + bg_color_ += 2; } + else + { + bg_color_ = 255; // Asegura que bg_color_ no exceda el límite máximo + } + tiled_bg_->setColor(Color(bg_color_, bg_color_, bg_color_)); } // Cambia de estado si el fondo se ha detenido y recuperado el color @@ -509,7 +513,7 @@ void Intro::updatePostState() break; case IntroPostState::END: - // Finaliza la intro después de 3 segundos + // Finaliza la intro después de 2 segundos if (ELAPSED_TIME >= 2000) { JA_StopMusic(); diff --git a/source/intro.h b/source/intro.h index 39bb2e7..4b1c132 100644 --- a/source/intro.h +++ b/source/intro.h @@ -40,7 +40,7 @@ private: IntroState state_ = IntroState::SCENES; // Estado IntroPostState post_state_ = IntroPostState::STOP_BG; // Estado Uint32 state_start_time_; - Uint8 bg_color_ = 96; + Uint8 bg_color_ = 112; // Actualiza las variables del objeto void update(); diff --git a/source/texture.cpp b/source/texture.cpp index 303b696..3d34254 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -348,15 +348,15 @@ std::vector Texture::loadPaletteFromFile(const std::string &file_path) throw std::runtime_error("Error al leer el fichero: " + getFileName(file_path)); } - const auto pal = LoadPalette(buffer.data()); - if (!pal) + const auto *PAL = LoadPalette(buffer.data()); + if (!PAL) { return palette; } for (int i = 0; i < 256; ++i) { - palette.push_back((pal[i] << 8) + 255); + palette.push_back((PAL[i] << 8) + 255); } return palette; diff --git a/source/tiled_bg.cpp b/source/tiled_bg.cpp index fab5de6..b367789 100644 --- a/source/tiled_bg.cpp +++ b/source/tiled_bg.cpp @@ -31,7 +31,6 @@ TiledBG::TiledBG(SDL_Rect pos, TiledBGMode mode) break; case TiledBGMode::CIRCLE: window_ = {128, 128, pos_.w, pos_.h}; - speed_ = 0.8f; break; default: window_ = {0, 0, pos_.w, pos_.h}; diff --git a/source/tiled_bg.h b/source/tiled_bg.h index 58a0ea5..9508dde 100644 --- a/source/tiled_bg.h +++ b/source/tiled_bg.h @@ -34,7 +34,6 @@ private: // Variables SDL_Rect pos_; // Posición y tamaño del mosaico SDL_Rect window_; // Ventana visible para la textura de fondo del titulo - int counter_ = 0; // Contador TiledBGMode mode_; // Tipo de movimiento del mosaico double sin_[360]; // Vector con los valores del seno precalculados float desp_ = 0.0f; // Desplazamiento aplicado