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

@@ -75,9 +75,6 @@ void Player::init() {
// Establece la posición del sprite // Establece la posición del sprite
player_sprite_->clear(); player_sprite_->clear();
shiftSprite(); shiftSprite();
// Selecciona un frame para pintar
// player_sprite_->setCurrentAnimation("stand");
} }
// Actua en consecuencia de la entrada recibida // Actua en consecuencia de la entrada recibida
@@ -228,8 +225,6 @@ void Player::handleRollingGroundCollision() {
return; return;
} }
// const float VEL_Y = player_sprite_->getVelY();
// if (VEL_Y >= 0.0F && VEL_Y < 2.0F) {
if (player_sprite_->getVelY() < 2.0F) { if (player_sprite_->getVelY() < 2.0F) {
handleRollingStop(); handleRollingStop();
} else { } else {

View File

@@ -140,7 +140,6 @@ class Resource {
void loadEssentialResources(); // Carga recursos esenciales en modo lazy void loadEssentialResources(); // Carga recursos esenciales en modo lazy
void loadEssentialTextures(); // Carga solo las texturas esenciales (fuentes) void loadEssentialTextures(); // Carga solo las texturas esenciales (fuentes)
void loadTextFilesQuiet(); // Carga ficheros de texto sin mostrar progreso (para modo lazy) void loadTextFilesQuiet(); // Carga ficheros de texto sin mostrar progreso (para modo lazy)
// void addPalettes(); // Añade paletas a las texturas
void createPlayerTextures(); // Crea las texturas de jugadores con todas sus variantes de paleta void createPlayerTextures(); // Crea las texturas de jugadores con todas sus variantes de paleta
void createTextTextures(); // Crea las texturas a partir de los datos cargados void createTextTextures(); // Crea las texturas a partir de los datos cargados
void createText(); // Crea los objetos de texto void createText(); // Crea los objetos de texto

View File

@@ -310,9 +310,6 @@ void Scoreboard::renderShowNameMode(size_t panel_index) {
/* TEXTO CENTRADO */ /* TEXTO CENTRADO */
text_scoreboard_->writeDX(Text::CENTER | Text::COLOR, slot4_4_.x, slot4_4_.y, record_name_.at(panel_index), 1, getColorLikeKnightRider(name_colors_, loop_counter_ / 5)); text_scoreboard_->writeDX(Text::CENTER | Text::COLOR, slot4_4_.x, slot4_4_.y, record_name_.at(panel_index), 1, getColorLikeKnightRider(name_colors_, loop_counter_ / 5));
/* TEXTO A LA IZQUIERDA */
// text_scoreboard_->writeColored(enter_name_pos_.x, enter_name_pos_.y, record_name_.at(panelIndex), getColorLikeKnightRider(name_colors_, loop_counter_ / 5));
} }
void Scoreboard::renderGameCompletedMode(size_t panel_index) { void Scoreboard::renderGameCompletedMode(size_t panel_index) {

View File

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

View File

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

View File

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

View File

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

View File

@@ -73,8 +73,6 @@ auto Texture::loadFromFile(const std::string &file_path) -> bool {
int pitch; int pitch;
SDL_PixelFormat pixel_format; SDL_PixelFormat pixel_format;
// STBI_rgb_alpha (RGBA)
pitch = 4 * width; pitch = 4 * width;
pixel_format = SDL_PIXELFORMAT_RGBA32; pixel_format = SDL_PIXELFORMAT_RGBA32;

View File

@@ -127,7 +127,6 @@ void ServiceMenu::moveBack() {
} }
// Si estamos en la pantalla principal, llamamos a toggle() para cerrar con animación. // Si estamos en la pantalla principal, llamamos a toggle() para cerrar con animación.
// toggle() ya reproduce el sonido, por lo que no es necesario aquí.
toggle(); toggle();
} }
@@ -566,7 +565,6 @@ void ServiceMenu::handleEvent(const SDL_Event &event) {
// Si DefineButtons está activo, que maneje todos los eventos // Si DefineButtons está activo, que maneje todos los eventos
if (define_buttons_ && define_buttons_->isEnabled()) { if (define_buttons_ && define_buttons_->isEnabled()) {
define_buttons_->handleEvents(event); define_buttons_->handleEvents(event);
// return; // No procesar otros eventos mientras DefineButtons está activo
} }
} }