#pragma once #include // Para Uint32, SDL_FRect #include // Para array #include // Para basic_string, string #include "color.h" // Para Color #include "defaults.h" // Para los valores por defecto #include "utils.h" // Para NotifyPosition, Zone // --- 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; }; // --- 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_delay = GameDefaults::Fade::RANDOM_SQUARES_DELAY; int random_squares_mult = GameDefaults::Fade::RANDOM_SQUARES_MULT; int post_duration = GameDefaults::Fade::POST_DURATION; 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; int 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; }; // --- 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; }; // --- Estructura principal para almacenar 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; // Constructor que inicializa las zonas que dependen de otros valores Param() { // Inicializar play_area usando los valores por defecto game.play_area.rect = { GameDefaults::Game::PLAY_AREA_X, GameDefaults::Game::PLAY_AREA_Y, GameDefaults::Game::PLAY_AREA_W, 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(); }; // --- Variable global con los parámetros del juego --- extern Param param; // --- Funciones globales --- void loadParamsFromFile(const std::string& file_path);