#pragma once #include // Para Uint32, SDL_FRect #include // Para array #include // Para basic_string, string #include "color.h" // Para Color, Zone #include "defaults.h" // Para los valores por defecto #include "ui/notifier.h" // Para Notifier::Position #include "utils.h" // --- Parámetros del juego --- struct ParamGame { float width = GameDefaults::Game::WIDTH; float height = GameDefaults::Game::HEIGHT; float item_size = GameDefaults::Game::ITEM_SIZE; Zone play_area{}; // Se inicializa en el constructor de Param Zone game_area{}; // Se inicializa en el constructor de Param int name_entry_idle_time = GameDefaults::Game::NAME_ENTRY_IDLE_TIME; int name_entry_total_time = GameDefaults::Game::NAME_ENTRY_TOTAL_TIME; Uint32 speed = 15; // Este valor no estaba en el archivo de configuración bool hit_stop = GameDefaults::Game::HIT_STOP; Uint32 hit_stop_ms = GameDefaults::Game::HIT_STOP_MS; Color item_text_outline_color; }; // --- Parámetros del fade --- struct ParamFade { Color color = Color::fromHex(GameDefaults::Fade::COLOR); float num_squares_width = GameDefaults::Fade::NUM_SQUARES_WIDTH; float num_squares_height = GameDefaults::Fade::NUM_SQUARES_HEIGHT; int random_squares_duration_ms = GameDefaults::Fade::RANDOM_SQUARES_DURATION_MS; int post_duration_ms = GameDefaults::Fade::POST_DURATION_MS; float venetian_size = GameDefaults::Fade::VENETIAN_SIZE; }; // --- Parámetros de la pantalla de título --- struct ParamTitle { int press_start_position = GameDefaults::Title::PRESS_START_POSITION; float title_duration = GameDefaults::Title::DURATION; int arcade_edition_position = GameDefaults::Title::ARCADE_EDITION_POSITION; int title_c_c_position = GameDefaults::Title::TITLE_C_C_POSITION; Color bg_color = Color::fromHex(GameDefaults::Title::BG_COLOR); }; // --- Parámetros del fondo --- struct ParamBackground { Color attenuate_color = Color::fromHex(GameDefaults::Background::ATTENUATE_COLOR); }; // --- Parámetros de los globos --- struct ParamBalloon { struct Settings { float grav; float vel; // Constructor por defecto constexpr Settings(float grav_val = 0.0F, float vel_val = 0.0F) : grav(grav_val), vel(vel_val) {} }; // Inicialización con los valores por defecto desde GameDefaults std::array settings = {{Settings(GameDefaults::Balloon::SETTINGS[0].grav, GameDefaults::Balloon::SETTINGS[0].vel), Settings(GameDefaults::Balloon::SETTINGS[1].grav, GameDefaults::Balloon::SETTINGS[1].vel), Settings(GameDefaults::Balloon::SETTINGS[2].grav, GameDefaults::Balloon::SETTINGS[2].vel), Settings(GameDefaults::Balloon::SETTINGS[3].grav, GameDefaults::Balloon::SETTINGS[3].vel)}}; std::array color = {{GameDefaults::Balloon::COLORS[0], GameDefaults::Balloon::COLORS[1], GameDefaults::Balloon::COLORS[2], GameDefaults::Balloon::COLORS[3]}}; bool bouncing_sound = GameDefaults::Balloon::BOUNCING_SOUND; }; // --- Parámetros de las notificaciones --- struct ParamNotification { Notifier::Position pos_h = GameDefaults::Notification::POS_H; Notifier::Position pos_v = GameDefaults::Notification::POS_V; bool sound = GameDefaults::Notification::SOUND; Color color = Color::fromHex(GameDefaults::Notification::COLOR); }; // --- Parámetros del marcador --- struct ParamScoreboard { SDL_FRect rect = { GameDefaults::Scoreboard::RECT_X, GameDefaults::Scoreboard::RECT_Y, GameDefaults::Scoreboard::RECT_W, GameDefaults::Scoreboard::RECT_H}; bool separator_autocolor = GameDefaults::Scoreboard::SEPARATOR_AUTOCOLOR; Color separator_color = Color::fromHex(GameDefaults::Scoreboard::SEPARATOR_COLOR); Color easy_color = Color::fromHex(GameDefaults::Scoreboard::EASY_COLOR); Color normal_color = Color::fromHex(GameDefaults::Scoreboard::NORMAL_COLOR); Color hard_color = Color::fromHex(GameDefaults::Scoreboard::HARD_COLOR); bool text_autocolor = GameDefaults::Scoreboard::TEXT_AUTOCOLOR; Color text_color1 = Color::fromHex(GameDefaults::Scoreboard::TEXT_COLOR1); Color text_color2 = Color::fromHex(GameDefaults::Scoreboard::TEXT_COLOR2); int skip_countdown_value = GameDefaults::Scoreboard::SKIP_COUNTDOWN_VALUE; }; // --- Parámetros del menú de servicio --- struct ParamServiceMenu { Color title_color = Color::fromHex(GameDefaults::ServiceMenu::TITLE_COLOR); Color text_color = Color::fromHex(GameDefaults::ServiceMenu::TEXT_COLOR); Color selected_color = Color::fromHex(GameDefaults::ServiceMenu::SELECTED_COLOR); Color bg_color = Color::fromHex(GameDefaults::ServiceMenu::BG_COLOR); bool drop_shadow = GameDefaults::ServiceMenu::DROP_SHADOW; // Configuración para ventanas de mensaje struct WindowMessage { Color bg_color = Color::fromHex(GameDefaults::ServiceMenu::WindowMessage::BG_COLOR); Color border_color = Color::fromHex(GameDefaults::ServiceMenu::WindowMessage::BORDER_COLOR); Color title_color = Color::fromHex(GameDefaults::ServiceMenu::WindowMessage::TITLE_COLOR); Color text_color = Color::fromHex(GameDefaults::ServiceMenu::WindowMessage::TEXT_COLOR); float padding = GameDefaults::ServiceMenu::WindowMessage::PADDING; float line_spacing = GameDefaults::ServiceMenu::WindowMessage::LINE_SPACING; float title_separator_spacing = GameDefaults::ServiceMenu::WindowMessage::TITLE_SEPARATOR_SPACING; float min_width = GameDefaults::ServiceMenu::WindowMessage::MIN_WIDTH; float min_height = GameDefaults::ServiceMenu::WindowMessage::MIN_HEIGHT; float max_width_ratio = GameDefaults::ServiceMenu::WindowMessage::MAX_WIDTH_RATIO; float max_height_ratio = GameDefaults::ServiceMenu::WindowMessage::MAX_HEIGHT_RATIO; float text_safety_margin = GameDefaults::ServiceMenu::WindowMessage::TEXT_SAFETY_MARGIN; float animation_duration = GameDefaults::ServiceMenu::WindowMessage::ANIMATION_DURATION; } window_message; }; // --- Parámetros de la intro --- struct ParamIntro { Color bg_color = Color::fromHex(GameDefaults::Intro::BG_COLOR); Color card_color = Color::fromHex(GameDefaults::Intro::CARD_COLOR); Color shadow_color = Color::fromHex(GameDefaults::Intro::SHADOW_COLOR); int text_distance_from_bottom = GameDefaults::Intro::TEXT_DISTANCE_FROM_BOTTOM; }; // --- Parámetros para Debug --- struct ParamDebug { Color color = Color::fromHex(GameDefaults::Debug::COLOR); }; // --- Parámetros para Resource --- struct ParamResource { Color color = Color::fromHex(GameDefaults::Resource::COLOR); }; // --- Parámetros para Tabe --- struct ParamTabe { float min_spawn_time = GameDefaults::Tabe::MIN_SPAWN_TIME; float max_spawn_time = GameDefaults::Tabe::MAX_SPAWN_TIME; }; // --- Parámetros del Jugador --- struct ParamPlayer { // Configuración de camisetas del jugador struct Shirt { Color darkest; // Tono más oscuro - bordes y contornos Color dark; // Tono oscuro - sombras Color base; // Tono principal - color base de la camiseta Color light; // Tono claro - zonas iluminadas/highlights // Constructor por defecto Shirt() = default; // Constructor con tonalidades específicas Shirt(const Color& darkest_tone, const Color& dark_tone, const Color& base_tone, const Color& light_tone) : darkest(darkest_tone), dark(dark_tone), base(base_tone), light(light_tone) {} }; // Inicialización con valores por defecto const Shirt default_player0_shirt = Shirt( Color::fromHex(GameDefaults::Player::DefaultShirt::PLAYER0_DARKEST), Color::fromHex(GameDefaults::Player::DefaultShirt::PLAYER0_DARK), Color::fromHex(GameDefaults::Player::DefaultShirt::PLAYER0_BASE), Color::fromHex(GameDefaults::Player::DefaultShirt::PLAYER0_LIGHT)); const Shirt default_player1_shirt = Shirt( Color::fromHex(GameDefaults::Player::DefaultShirt::PLAYER1_DARKEST), Color::fromHex(GameDefaults::Player::DefaultShirt::PLAYER1_DARK), Color::fromHex(GameDefaults::Player::DefaultShirt::PLAYER1_BASE), Color::fromHex(GameDefaults::Player::DefaultShirt::PLAYER1_LIGHT)); std::array default_shirt = {default_player0_shirt, default_player1_shirt}; const Shirt one_coffee_player0_shirt = Shirt( Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER0_DARKEST), Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER0_DARK), Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER0_BASE), Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER0_LIGHT)); const Shirt one_coffee_player1_shirt = Shirt( Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER1_DARKEST), Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER1_DARK), Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER1_BASE), Color::fromHex(GameDefaults::Player::OneCoffeeShirt::PLAYER1_LIGHT)); std::array one_coffee_shirt = {one_coffee_player0_shirt, one_coffee_player1_shirt}; const Shirt two_coffee_player0_shirt = Shirt( Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER0_DARKEST), Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER0_DARK), Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER0_BASE), Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER0_LIGHT)); const Shirt two_coffee_player1_shirt = Shirt( Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER1_DARKEST), Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER1_DARK), Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER1_BASE), Color::fromHex(GameDefaults::Player::TwoCoffeeShirt::PLAYER1_LIGHT)); std::array two_coffee_shirt = {two_coffee_player0_shirt, two_coffee_player1_shirt}; const Color outline_player0_color = Color::fromHex(GameDefaults::Player::OutlineColor::PLAYER0); const Color outline_player1_color = Color::fromHex(GameDefaults::Player::OutlineColor::PLAYER1); std::array outline_color = {outline_player0_color, outline_player1_color}; }; // --- Estructura Param: almacena todos los parámetros del juego --- struct Param { ParamGame game; ParamFade fade; ParamScoreboard scoreboard; ParamTitle title; ParamBackground background; ParamBalloon balloon; ParamNotification notification; ParamServiceMenu service_menu; ParamIntro intro; ParamDebug debug; ParamResource resource; ParamTabe tabe; ParamPlayer player; // Constructor que inicializa las zonas que dependen de otros valores Param() { // Inicializar play_area usando los valores por defecto game.play_area.rect = { .x = GameDefaults::Game::PLAY_AREA_X, .y = GameDefaults::Game::PLAY_AREA_Y, .w = GameDefaults::Game::PLAY_AREA_W, .h = GameDefaults::Game::PLAY_AREA_H}; // Las zonas calculadas se inicializarán en precalculateZones() precalculateZones(); } // Función pública para recalcular zonas (necesaria después de cambiar parámetros) void precalculateZones(); }; // --- Variables --- extern Param param; // Variable global con los parámetros del juego // --- Funciones --- void loadParamsFromFile(const std::string& file_path); // Carga parámetros desde archivo