diff --git a/CMakeLists.txt b/CMakeLists.txt index 51b10a6..5201096 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,7 +232,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3) # --- 4. CONFIGURACIÓN PLATAFORMAS Y COMPILADOR --- # Configuración de flags de compilación -target_compile_options(${PROJECT_NAME} PRIVATE -Wall) +target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic) target_compile_options(${PROJECT_NAME} PRIVATE $<$:-Os -ffunction-sections -fdata-sections>) # Definir _DEBUG en modo Debug @@ -393,7 +393,7 @@ if(NOT EMSCRIPTEN) source/core/resources/resource_pack.cpp ) target_include_directories(pack_resources PRIVATE "${CMAKE_SOURCE_DIR}/source") - target_compile_options(pack_resources PRIVATE -Wall) + target_compile_options(pack_resources PRIVATE -Wall -Wextra -Wpedantic) # Regeneració automàtica de resources.pack en cada build si canvia data/. file(GLOB_RECURSE DATA_FILES CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/data/*") diff --git a/source/core/rendering/background.cpp b/source/core/rendering/background.cpp index 73416ae..53fb90c 100644 --- a/source/core/rendering/background.cpp +++ b/source/core/rendering/background.cpp @@ -83,11 +83,11 @@ void Background::initializeSprites() { const float TOP_CLOUDS_Y = base_ - 165; const float BOTTOM_CLOUDS_Y = base_ - 101; - top_clouds_sprite_a_ = std::make_unique(top_clouds_texture_, (SDL_FRect){.x = 0, .y = TOP_CLOUDS_Y, .w = rect_.w, .h = static_cast(top_clouds_texture_->getHeight())}); - top_clouds_sprite_b_ = std::make_unique(top_clouds_texture_, (SDL_FRect){.x = rect_.w, .y = TOP_CLOUDS_Y, .w = rect_.w, .h = static_cast(top_clouds_texture_->getHeight())}); + top_clouds_sprite_a_ = std::make_unique(top_clouds_texture_, SDL_FRect{.x = 0, .y = TOP_CLOUDS_Y, .w = rect_.w, .h = static_cast(top_clouds_texture_->getHeight())}); + top_clouds_sprite_b_ = std::make_unique(top_clouds_texture_, SDL_FRect{.x = rect_.w, .y = TOP_CLOUDS_Y, .w = rect_.w, .h = static_cast(top_clouds_texture_->getHeight())}); - bottom_clouds_sprite_a_ = std::make_unique(bottom_clouds_texture_, (SDL_FRect){.x = 0, .y = BOTTOM_CLOUDS_Y, .w = rect_.w, .h = static_cast(bottom_clouds_texture_->getHeight())}); - bottom_clouds_sprite_b_ = std::make_unique(bottom_clouds_texture_, (SDL_FRect){.x = rect_.w, .y = BOTTOM_CLOUDS_Y, .w = rect_.w, .h = static_cast(bottom_clouds_texture_->getHeight())}); + bottom_clouds_sprite_a_ = std::make_unique(bottom_clouds_texture_, SDL_FRect{.x = 0, .y = BOTTOM_CLOUDS_Y, .w = rect_.w, .h = static_cast(bottom_clouds_texture_->getHeight())}); + bottom_clouds_sprite_b_ = std::make_unique(bottom_clouds_texture_, SDL_FRect{.x = rect_.w, .y = BOTTOM_CLOUDS_Y, .w = rect_.w, .h = static_cast(bottom_clouds_texture_->getHeight())}); buildings_sprite_ = std::make_unique(buildings_texture_); gradient_sprite_ = std::make_unique(gradients_texture_, 0, 0, rect_.w, rect_.h); diff --git a/source/core/rendering/fade.cpp b/source/core/rendering/fade.cpp index 6d2faa8..a77869e 100644 --- a/source/core/rendering/fade.cpp +++ b/source/core/rendering/fade.cpp @@ -68,7 +68,7 @@ void Fade::render() { } // Actualiza las variables internas -void Fade::update(float delta_time) { +void Fade::update(float /*delta_time*/) { switch (state_) { case State::PRE: updatePreState(); diff --git a/source/core/rendering/gif.cpp b/source/core/rendering/gif.cpp index c15872d..1418eaa 100644 --- a/source/core/rendering/gif.cpp +++ b/source/core/rendering/gif.cpp @@ -141,7 +141,7 @@ namespace GIF { } // Procesa el Image Descriptor y retorna el vector de datos sin comprimir. - auto processImageDescriptor(const uint8_t *&buffer, const std::vector &gct, int resolution_bits) -> std::vector { + auto processImageDescriptor(const uint8_t *&buffer, const std::vector & /*gct*/, int /*resolution_bits*/) -> std::vector { ImageDescriptor image_descriptor; readBytes(buffer, &image_descriptor, sizeof(ImageDescriptor)); diff --git a/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp b/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp index 8de2e6c..17a5515 100644 --- a/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp +++ b/source/core/rendering/sdl3gpu/sdl3gpu_shader.hpp @@ -72,7 +72,7 @@ namespace Rendering { const std::string& fragment_source) -> bool override; void render() override; - void setTextureSize(float width, float height) override {} + void setTextureSize(float /*width*/, float /*height*/) override {} void cleanup() final; void destroy(); [[nodiscard]] auto isHardwareAccelerated() const -> bool override { return is_initialized_; } @@ -117,8 +117,40 @@ namespace Rendering { SDL_GPUTransferBuffer* upload_buffer_ = nullptr; SDL_GPUSampler* sampler_ = nullptr; - PostFXUniforms uniforms_{.vignette_strength = 0.6F, .chroma_min = 0.15F, .scanline_strength = 0.7F, .screen_height = 192.0F, .pixel_scale = 1.0F, .chroma_max = 0.15F, .scan_dark_ratio = 0.333F, .scan_dark_floor = 0.42F, .scan_edge_soft = 1.0F}; - CrtPiUniforms crtpi_uniforms_{.scanline_weight = 6.0F, .scanline_gap_brightness = 0.12F, .bloom_factor = 3.5F, .input_gamma = 2.4F, .output_gamma = 2.2F, .mask_brightness = 0.80F, .curvature_x = 0.05F, .curvature_y = 0.10F, .mask_type = 2, .enable_scanlines = 1, .enable_multisample = 1, .enable_gamma = 1}; + PostFXUniforms uniforms_{ + .vignette_strength = 0.6F, + .chroma_min = 0.15F, + .scanline_strength = 0.7F, + .screen_height = 192.0F, + .mask_strength = 0.0F, + .gamma_strength = 0.0F, + .curvature = 0.0F, + .bleeding = 0.0F, + .pixel_scale = 1.0F, + .time = 0.0F, + .flicker = 0.0F, + .chroma_max = 0.15F, + .scan_dark_ratio = 0.333F, + .scan_dark_floor = 0.42F, + .scan_edge_soft = 1.0F, + .pad3 = 0.0F}; + CrtPiUniforms crtpi_uniforms_{ + .scanline_weight = 6.0F, + .scanline_gap_brightness = 0.12F, + .bloom_factor = 3.5F, + .input_gamma = 2.4F, + .output_gamma = 2.2F, + .mask_brightness = 0.80F, + .curvature_x = 0.05F, + .curvature_y = 0.10F, + .mask_type = 2, + .enable_scanlines = 1, + .enable_multisample = 1, + .enable_gamma = 1, + .enable_curvature = 0, + .enable_sharper = 0, + .texture_width = 0.0F, + .texture_height = 0.0F}; ShaderType active_shader_ = ShaderType::POSTFX; int game_width_ = 0; diff --git a/source/core/rendering/sprite/sprite.cpp b/source/core/rendering/sprite/sprite.cpp index 7a64677..4df5b63 100644 --- a/source/core/rendering/sprite/sprite.cpp +++ b/source/core/rendering/sprite/sprite.cpp @@ -8,13 +8,13 @@ // Constructor Sprite::Sprite(std::shared_ptr texture, float pos_x, float pos_y, float width, float height) : textures_{std::move(texture)}, - pos_((SDL_FRect){.x = pos_x, .y = pos_y, .w = width, .h = height}), - sprite_clip_((SDL_FRect){.x = 0, .y = 0, .w = pos_.w, .h = pos_.h}) {} + pos_(SDL_FRect{.x = pos_x, .y = pos_y, .w = width, .h = height}), + sprite_clip_(SDL_FRect{.x = 0, .y = 0, .w = pos_.w, .h = pos_.h}) {} Sprite::Sprite(std::shared_ptr texture, SDL_FRect rect) : textures_{std::move(texture)}, pos_(rect), - sprite_clip_((SDL_FRect){.x = 0, .y = 0, .w = pos_.w, .h = pos_.h}) {} + sprite_clip_(SDL_FRect{.x = 0, .y = 0, .w = pos_.w, .h = pos_.h}) {} Sprite::Sprite(std::shared_ptr texture) : textures_{std::move(texture)}, diff --git a/source/core/rendering/text.cpp b/source/core/rendering/text.cpp index b2fb772..71ffc06 100644 --- a/source/core/rendering/text.cpp +++ b/source/core/rendering/text.cpp @@ -32,7 +32,7 @@ Text::Text(const std::shared_ptr& texture, const std::string& text_file } // Crea los objetos - sprite_ = std::make_unique(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); + sprite_ = std::make_unique(texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); // Inicializa variables fixed_width_ = false; @@ -50,7 +50,7 @@ Text::Text(const std::shared_ptr& texture, const std::shared_ptr(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); + sprite_ = std::make_unique(texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); // Inicializa variables fixed_width_ = false; @@ -71,8 +71,8 @@ Text::Text(const std::shared_ptr& texture, const std::shared_ptr(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); - white_sprite_ = std::make_unique(white_texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); + sprite_ = std::make_unique(texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); + white_sprite_ = std::make_unique(white_texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); // Inicializa variables fixed_width_ = false; @@ -90,8 +90,8 @@ Text::Text(const std::shared_ptr& texture, const std::shared_ptr(texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); - white_sprite_ = std::make_unique(white_texture, (SDL_FRect){.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); + sprite_ = std::make_unique(texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); + white_sprite_ = std::make_unique(white_texture, SDL_FRect{.x = 0, .y = 0, .w = static_cast(box_width_), .h = static_cast(box_height_)}); // Inicializa variables fixed_width_ = false; @@ -137,7 +137,7 @@ void Text::write2X(int x, int y, const std::string& text, int kerning, int lengt } // Escribe el texto en una textura -auto Text::writeToTexture(const std::string& text, int zoom, int kerning, int length) -> std::shared_ptr { +auto Text::writeToTexture(const std::string& text, int zoom, int kerning, int /*length*/) -> std::shared_ptr { auto* renderer = Screen::get()->getRenderer(); auto texture = std::make_shared(renderer); auto width = Text::length(text, kerning) * zoom; @@ -342,7 +342,7 @@ void Text::writeDX(Uint8 flags, int x, int y, const std::string& text, int kerni } // Escribe texto a partir de un TextStyle -void Text::writeStyle(int x, int y, const std::string& text, const Style& style, int length) { +void Text::writeStyle(int x, int y, const std::string& text, const Style& style, int /*length*/) { writeDX(style.flags, x, y, text, style.kerning, style.text_color, style.shadow_distance, style.shadow_color); } diff --git a/source/core/rendering/tiled_bg.cpp b/source/core/rendering/tiled_bg.cpp index 635a6c9..1a97a6e 100644 --- a/source/core/rendering/tiled_bg.cpp +++ b/source/core/rendering/tiled_bg.cpp @@ -50,7 +50,7 @@ TiledBG::~TiledBG() { // Rellena la textura con el contenido void TiledBG::fillTexture() { // Crea los objetos para pintar en la textura de fondo - auto tile = std::make_unique(Resource::get()->getTexture("title_bg_tile.png"), (SDL_FRect){.x = 0, .y = 0, .w = TILE_WIDTH, .h = TILE_HEIGHT}); + auto tile = std::make_unique(Resource::get()->getTexture("title_bg_tile.png"), SDL_FRect{.x = 0, .y = 0, .w = TILE_WIDTH, .h = TILE_HEIGHT}); // Prepara para dibujar sobre la textura auto* temp = SDL_GetRenderTarget(renderer_); diff --git a/source/core/system/shutdown.cpp b/source/core/system/shutdown.cpp index 2ec3d7c..ebf367d 100644 --- a/source/core/system/shutdown.cpp +++ b/source/core/system/shutdown.cpp @@ -50,7 +50,7 @@ namespace SystemShutdown { return shutdownSystem(config); } - auto shutdownSystem(const ShutdownConfig& config) -> ShutdownResult { + auto shutdownSystem([[maybe_unused]] const ShutdownConfig& config) -> ShutdownResult { #ifdef _WIN32 // Windows: Usar CreateProcess STARTUPINFOA si = {0}; diff --git a/source/core/system/system_utils.cpp b/source/core/system/system_utils.cpp index c32a034..ba56a60 100644 --- a/source/core/system/system_utils.cpp +++ b/source/core/system/system_utils.cpp @@ -22,7 +22,7 @@ namespace SystemUtils { // Función auxiliar para crear una carpeta individual auto createSingleFolder(const std::string& path, int permissions) -> Result { - struct stat st = {.st_dev = 0}; + struct stat st{}; // Verificar si ya existe if (stat(path.c_str(), &st) == 0) { @@ -131,7 +131,7 @@ namespace SystemUtils { } auto folderExists(const std::string& path) -> bool { - struct stat st = {.st_dev = 0}; + struct stat st{}; return (stat(path.c_str(), &st) == 0 && S_ISDIR(st.st_mode)); } diff --git a/source/game/gameplay/balloon_manager.cpp b/source/game/gameplay/balloon_manager.cpp index c73bde6..125177d 100644 --- a/source/game/gameplay/balloon_manager.cpp +++ b/source/game/gameplay/balloon_manager.cpp @@ -114,7 +114,9 @@ void BalloonManager::deployRandomFormation(int stage) { .size = balloon.size, .vel_x = balloon.vel_x, .game_tempo = balloon_speed_, - .creation_counter = creation_time_enabled_ ? balloon.creation_counter : 0.0F}; + .creation_counter = creation_time_enabled_ ? balloon.creation_counter : 0.0F, + .animation = {}, + .sound = {}}; createBalloon(config); } @@ -135,7 +137,9 @@ void BalloonManager::deployFormation(int formation_id) { .size = balloon.size, .vel_x = balloon.vel_x, .game_tempo = balloon_speed_, - .creation_counter = balloon.creation_counter}; + .creation_counter = balloon.creation_counter, + .animation = {}, + .sound = {}}; createBalloon(config); } } @@ -151,7 +155,9 @@ void BalloonManager::deployFormation(int formation_id, float y) { .size = balloon.size, .vel_x = balloon.vel_x, .game_tempo = balloon_speed_, - .creation_counter = balloon.creation_counter}; + .creation_counter = balloon.creation_counter, + .animation = {}, + .sound = {}}; createBalloon(config); } } @@ -213,7 +219,9 @@ void BalloonManager::createChildBalloon(const std::shared_ptr& parent_b .size = static_cast(static_cast(parent_balloon->getSize()) - 1), .vel_x = direction == "LEFT" ? Balloon::VELX_NEGATIVE : Balloon::VELX_POSITIVE, .game_tempo = balloon_speed_, - .creation_counter = 0}; + .creation_counter = 0, + .animation = {}, + .sound = {}}; // Crea el globo hijo auto child_balloon = createBalloon(config); @@ -267,6 +275,8 @@ void BalloonManager::createPowerBall() { .texture = balloon_textures_.at(4), .animation = balloon_animations_.at(4), .sound = { + .bouncing_file = {}, + .popping_file = {}, .bouncing_enabled = bouncing_sound_enabled_, .poping_enabled = poping_sound_enabled_, .enabled = sound_enabled_}}; diff --git a/source/game/options.hpp b/source/game/options.hpp index faf8f60..ea0bc8c 100644 --- a/source/game/options.hpp +++ b/source/game/options.hpp @@ -262,7 +262,7 @@ namespace Options { void clearPlayers() { players_.clear(); } // Limpia la lista de jugadores // Asigna el mando a un jugador - void assignTo(const Input::Gamepad& gamepad, Player::Id player_id) { + void assignTo(const Input::Gamepad& /*gamepad*/, Player::Id /*player_id*/) { } // Asigna los mandos físicos basándose en la configuración actual de nombres. diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index 5d0da54..c953bb0 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -800,7 +800,7 @@ void Game::renderPathSprites() { } // Acciones a realizar cuando el jugador colisiona con un globo -void Game::handlePlayerCollision(std::shared_ptr& player, const std::shared_ptr& balloon) { +void Game::handlePlayerCollision(std::shared_ptr& player, const std::shared_ptr& /*balloon*/) { if (!player->isPlaying() || player->isInvulnerable()) { return; // Si no está jugando o tiene inmunidad, no hace nada } diff --git a/source/game/scenes/instructions.cpp b/source/game/scenes/instructions.cpp index eccf352..1134b76 100644 --- a/source/game/scenes/instructions.cpp +++ b/source/game/scenes/instructions.cpp @@ -84,7 +84,7 @@ void Instructions::iniSprites() { // Inicializa los sprites for (int i = 0; std::cmp_less(i, item_textures_.size()); ++i) { auto sprite = std::make_unique(item_textures_[i], 0, 0, Item::WIDTH, Item::HEIGHT); - sprite->setPosition((SDL_FPoint){.x = sprite_pos_.x, .y = sprite_pos_.y + ((Item::HEIGHT + item_space_) * i)}); + sprite->setPosition(SDL_FPoint{.x = sprite_pos_.x, .y = sprite_pos_.y + ((Item::HEIGHT + item_space_) * i)}); sprites_.push_back(std::move(sprite)); } } diff --git a/source/game/ui/menu_option.hpp b/source/game/ui/menu_option.hpp index 8e817ba..79b91e2 100644 --- a/source/game/ui/menu_option.hpp +++ b/source/game/ui/menu_option.hpp @@ -39,11 +39,11 @@ class MenuOption { [[nodiscard]] virtual auto getBehavior() const -> Behavior = 0; [[nodiscard]] virtual auto getValueAsString() const -> std::string { return ""; } - virtual void adjustValue(bool adjust_up) {} + virtual void adjustValue(bool /*adjust_up*/) {} [[nodiscard]] virtual auto getTargetGroup() const -> ServiceMenu::SettingsGroup { return ServiceMenu::SettingsGroup::MAIN; } virtual void executeAction() {} - virtual auto getMaxValueWidth(Text* text_renderer) const -> int { return 0; } // Método virtual para que cada opción calcule el ancho de su valor más largo + virtual auto getMaxValueWidth(Text* /*text_renderer*/) const -> int { return 0; } // Método virtual para que cada opción calcule el ancho de su valor más largo protected: // --- Variables --- diff --git a/source/game/ui/menu_renderer.cpp b/source/game/ui/menu_renderer.cpp index 15daf71..6730016 100644 --- a/source/game/ui/menu_renderer.cpp +++ b/source/game/ui/menu_renderer.cpp @@ -45,7 +45,7 @@ void MenuRenderer::ShowHideAnimation::stop() { elapsed = 0.0F; } -MenuRenderer::MenuRenderer(const ServiceMenu* menu_state, std::shared_ptr element_text, std::shared_ptr title_text) +MenuRenderer::MenuRenderer(const ServiceMenu* /*menu_state*/, std::shared_ptr element_text, std::shared_ptr title_text) : element_text_(std::move(element_text)), title_text_(std::move(title_text)) { initializeMaxSizes(); @@ -145,7 +145,7 @@ void MenuRenderer::render(const ServiceMenu* menu_state) { } } -void MenuRenderer::update(const ServiceMenu* menu_state, float delta_time) { +void MenuRenderer::update(const ServiceMenu* /*menu_state*/, float delta_time) { updateAnimations(delta_time); if (visible_) { diff --git a/source/game/ui/notifier.cpp b/source/game/ui/notifier.cpp index 3eb0dce..17717c4 100644 --- a/source/game/ui/notifier.cpp +++ b/source/game/ui/notifier.cpp @@ -259,7 +259,7 @@ void Notifier::show(std::vector texts, int icon, const std::string& // Dibuja el icono de la notificación if (has_icons_ && icon >= 0 && texts.size() >= 2) { - auto sp = std::make_unique(icon_texture_, (SDL_FRect){.x = 0, .y = 0, .w = ICON_SIZE, .h = ICON_SIZE}); + auto sp = std::make_unique(icon_texture_, SDL_FRect{.x = 0, .y = 0, .w = ICON_SIZE, .h = ICON_SIZE}); sp->setPosition({.x = PADDING_IN_H, .y = PADDING_IN_V, .w = ICON_SIZE, .h = ICON_SIZE}); sp->setSpriteClip(SDL_FRect{ .x = static_cast(ICON_SIZE * (icon % 10)),