diff --git a/data/config/param_320x240.txt b/data/config/param_320x240.txt index 30e4496..340f644 100644 --- a/data/config/param_320x240.txt +++ b/data/config/param_320x240.txt @@ -43,14 +43,19 @@ title.title_c_c_position 80 # Posición Y del título principal background.attenuate_color FFFFFF00 # Color de atenuación del fondo (RGBA hexadecimal) ## --- BALLOONS --- -balloon_1.vel 2.75f # Velocidad inicial del globo 1 -balloon_1.grav 0.09f # Gravedad aplicada al globo 1 -balloon_2.vel 3.70f # Velocidad inicial del globo 2 -balloon_2.grav 0.10f # Gravedad aplicada al globo 2 -balloon_3.vel 4.70f # Velocidad inicial del globo 3 -balloon_3.grav 0.10f # Gravedad aplicada al globo 3 -balloon_4.vel 5.45f # Velocidad inicial del globo 4 -balloon_4.grav 0.10f # Gravedad aplicada al globo 4 +balloon.settings[0].vel 2.75f # Velocidad inicial del globo 1 +balloon.settings[0].grav 0.09f # Gravedad aplicada al globo 1 +balloon.settings[1].vel 3.70f # Velocidad inicial del globo 2 +balloon.settings[1].grav 0.10f # Gravedad aplicada al globo 2 +balloon.settings[2].vel 4.70f # Velocidad inicial del globo 3 +balloon.settings[2].grav 0.10f # Gravedad aplicada al globo 3 +balloon.settings[3].vel 5.45f # Velocidad inicial del globo 4 +balloon.settings[3].grav 0.10f # Gravedad aplicada al globo 4 + +balloon.color[0] blue # Color de creación del globo normal +balloon.color[1] orange # Color del globo normal +balloon.color[2] red # Color de creación del globo que rebota +balloon.color[3] green # Color del globo que rebota ## --- NOTIFICATION --- notification.pos_v TOP # Posición vertical de la notificación (TOP/BOTTOM) diff --git a/data/config/param_320x256.txt b/data/config/param_320x256.txt index b27ac6f..dd90d34 100644 --- a/data/config/param_320x256.txt +++ b/data/config/param_320x256.txt @@ -43,14 +43,19 @@ title.title_c_c_position 80 # Posición Y del título principal background.attenuate_color FFFFFF00 # Color de atenuación del fondo (RGBA hexadecimal) ## --- BALLOONS --- -balloon_1.vel 2.75f # Velocidad inicial del globo 1 -balloon_1.grav 0.09f # Gravedad aplicada al globo 1 -balloon_2.vel 3.70f # Velocidad inicial del globo 2 -balloon_2.grav 0.10f # Gravedad aplicada al globo 2 -balloon_3.vel 4.70f # Velocidad inicial del globo 3 -balloon_3.grav 0.10f # Gravedad aplicada al globo 3 -balloon_4.vel 5.45f # Velocidad inicial del globo 4 -balloon_4.grav 0.10f # Gravedad aplicada al globo 4 +balloon.settings[0].vel 2.75f # Velocidad inicial del globo 1 +balloon.settings[0].grav 0.09f # Gravedad aplicada al globo 1 +balloon.settings[1].vel 3.70f # Velocidad inicial del globo 2 +balloon.settings[1].grav 0.10f # Gravedad aplicada al globo 2 +balloon.settings[2].vel 4.70f # Velocidad inicial del globo 3 +balloon.settings[2].grav 0.10f # Gravedad aplicada al globo 3 +balloon.settings[3].vel 5.45f # Velocidad inicial del globo 4 +balloon.settings[3].grav 0.10f # Gravedad aplicada al globo 4 + +balloon.color[0] blue # Color de creación del globo normal +balloon.color[1] orange # Color del globo normal +balloon.color[2] red # Color de creación del globo que rebota +balloon.color[3] green # Color del globo que rebota ## --- NOTIFICATION --- notification.pos_v TOP # Posición vertical de la notificación (TOP/BOTTOM) diff --git a/data/gfx/balloon/balloon1.png b/data/gfx/balloon/balloon1.png index 6e4128a..d17d16a 100644 Binary files a/data/gfx/balloon/balloon1.png and b/data/gfx/balloon/balloon1.png differ diff --git a/data/gfx/balloon/balloon2.png b/data/gfx/balloon/balloon2.png index abc4290..7dfff30 100644 Binary files a/data/gfx/balloon/balloon2.png and b/data/gfx/balloon/balloon2.png differ diff --git a/data/gfx/balloon/balloon3.png b/data/gfx/balloon/balloon3.png index 360fec6..2eedfb4 100644 Binary files a/data/gfx/balloon/balloon3.png and b/data/gfx/balloon/balloon3.png differ diff --git a/data/gfx/balloon/balloon4.png b/data/gfx/balloon/balloon4.png index 445a857..4e0fadf 100644 Binary files a/data/gfx/balloon/balloon4.png and b/data/gfx/balloon/balloon4.png differ diff --git a/source/balloon.cpp b/source/balloon.cpp index 12e98b0..1691989 100644 --- a/source/balloon.cpp +++ b/source/balloon.cpp @@ -32,8 +32,8 @@ Balloon::Balloon(float x, float y, BalloonType type, BalloonSize size, float vel max_vy_ = 3.0f; const int index = static_cast(size_); - gravity_ = param.balloon.at(index).grav; - default_vy_ = param.balloon.at(index).vel; + gravity_ = param.balloon.settings.at(index).grav; + default_vy_ = param.balloon.settings.at(index).vel; h_ = w_ = BALLOON_SIZE[index]; power_ = BALLOON_POWER[index]; menace_ = BALLOON_MENACE[index]; @@ -67,8 +67,8 @@ Balloon::Balloon(float x, float y, BalloonType type, BalloonSize size, float vel vy_ = 0; max_vy_ = 3.0f; - gravity_ = param.balloon.at(index).grav; - default_vy_ = param.balloon.at(index).vel; + gravity_ = param.balloon.settings.at(index).grav; + default_vy_ = param.balloon.settings.at(index).vel; sprite_->setRotate(creation_timer <= 0); sprite_->setRotateAmount(vx_ > 0.0f ? 2.0 : -2.0); @@ -301,12 +301,12 @@ void Balloon::setAnimation() normal_animation = "powerball"; break; case BalloonType::FLOATER: - creating_animation = "red"; - normal_animation = "green"; + creating_animation = param.balloon.color.at(2); + normal_animation = param.balloon.color.at(3); break; default: - creating_animation = "blue"; - normal_animation = "orange"; + creating_animation = param.balloon.color.at(0); + normal_animation = param.balloon.color.at(1); break; } diff --git a/source/param.cpp b/source/param.cpp index d854e7a..ca870a5 100644 --- a/source/param.cpp +++ b/source/param.cpp @@ -58,10 +58,15 @@ void initParam() param.background.attenuate_color = Color(255, 255, 255, 0); // BALLOONS - param.balloon.emplace_back(0.09f, 2.60f); - param.balloon.emplace_back(0.10f, 3.50f); - param.balloon.emplace_back(0.10f, 4.50f); - param.balloon.emplace_back(0.10f, 4.95f); + param.balloon.settings.at(0) = ParamBalloon::Settings(0.09f, 2.60f); + param.balloon.settings.at(1) = ParamBalloon::Settings(0.10f, 3.50f); + param.balloon.settings.at(2) = ParamBalloon::Settings(0.10f, 4.50f); + param.balloon.settings.at(3) = ParamBalloon::Settings(0.10f, 4.95f); + + param.balloon.color.at(0) = "blue"; + param.balloon.color.at(1) = "orange"; + param.balloon.color.at(2) = "red"; + param.balloon.color.at(3) = "green"; // NOTIFICATION param.notification.pos_v = NotifyPosition::TOP; @@ -296,44 +301,64 @@ bool setParams(const std::string &var, const std::string &value) } // BALLOON - else if (var == "balloon_1.vel") + else if (var == "balloon.settings[0].vel") { - param.balloon.at(0).vel = std::stof(value); + param.balloon.settings.at(0).vel = std::stof(value); } - else if (var == "balloon_1.grav") + else if (var == "balloon.settings[0].grav") { - param.balloon.at(0).grav = std::stof(value); + param.balloon.settings.at(0).grav = std::stof(value); } - else if (var == "balloon_2.vel") + else if (var == "balloon.settings[1].vel") { - param.balloon.at(1).vel = std::stof(value); + param.balloon.settings.at(1).vel = std::stof(value); } - else if (var == "balloon_2.grav") + else if (var == "balloon.settings[1].grav") { - param.balloon.at(1).grav = std::stof(value); + param.balloon.settings.at(1).grav = std::stof(value); } - else if (var == "balloon_3.vel") + else if (var == "balloon.settings[2].vel") { - param.balloon.at(2).vel = std::stof(value); + param.balloon.settings.at(2).vel = std::stof(value); } - else if (var == "balloon_3.grav") + else if (var == "balloon.settings[2].grav") { - param.balloon.at(2).grav = std::stof(value); + param.balloon.settings.at(2).grav = std::stof(value); } - else if (var == "balloon_4.vel") + else if (var == "balloon.settings[3].vel") { - param.balloon.at(3).vel = std::stof(value); + param.balloon.settings.at(3).vel = std::stof(value); } - else if (var == "balloon_4.grav") + else if (var == "balloon.settings[3].grav") { - param.balloon.at(3).grav = std::stof(value); + param.balloon.settings.at(3).grav = std::stof(value); + } + + else if (var == "balloon.color[0]") + { + param.balloon.color.at(0) = value; + } + + else if (var == "balloon.color[1]") + { + param.balloon.color.at(1) = value; + } + + else if (var == "balloon.color[2]") + { + param.balloon.color.at(2) = value; + } + + else if (var == "balloon.color[3]") + { + param.balloon.color.at(3) = value; } // NOTIFICACIONES diff --git a/source/param.h b/source/param.h index fca3411..dd72f0e 100644 --- a/source/param.h +++ b/source/param.h @@ -46,15 +46,21 @@ struct ParamBackground Color attenuate_color; // Color para atenuar el fondo }; -// --- Parámetros de los globos (balloons) --- +// --- Parámetros de los globos --- struct ParamBalloon { - float grav; // Aceleración en el eje Y. Modifica la velocidad - float vel; // Velocidad inicial al rebotar contra el suelo + struct Settings + { + float grav; // Aceleración en el eje Y. Modifica la velocidad + float vel; // Velocidad inicial al rebotar contra el suelo - // Constructor - explicit ParamBalloon(float grav_val = 0.0f, float vel_val = 0.0f) - : grav(grav_val), vel(vel_val) {} + // Constructor + explicit Settings(float grav_val = 0.0f, float vel_val = 0.0f) + : grav(grav_val), vel(vel_val) {} + }; + + std::array settings; + std::array color; }; // --- Parámetros de las notificaciones --- @@ -113,23 +119,22 @@ struct ParamResource // --- Estructura principal para almacenar todos los parámetros del juego --- struct Param { - ParamGame game; // Parámetros del juego - ParamFade fade; // Parámetros del fade - ParamScoreboard scoreboard; // Rectángulo del marcador - ParamTitle title; // Parámetros de la pantalla de título - ParamBackground background; // Parámetros del fondo - std::vector balloon; // Parámetros de los globos - ParamNotification notification; // Parámetros de las notificaciones - ParamServiceMenu service_menu; // Parámetros del menú de servicio - ParamIntro intro; // Parámetros de la intro - ParamDebug debug; // Parámetros para Debug - ParamResource resource; // Parámetros para Resource + ParamGame game; // Parámetros del juego + ParamFade fade; // Parámetros del fade + ParamScoreboard scoreboard; // Rectángulo del marcador + ParamTitle title; // Parámetros de la pantalla de título + ParamBackground background; // Parámetros del fondo + ParamBalloon balloon; // Parámetros de los globos + ParamNotification notification; // Parámetros de las notificaciones + ParamServiceMenu service_menu; // Parámetros del menú de servicio + ParamIntro intro; // Parámetros de la intro + ParamDebug debug; // Parámetros para Debug + ParamResource resource; // Parámetros para Resource // Constructor - Param() : game(), fade(), scoreboard(), title(), background(), notification() - { - balloon.reserve(4); - } + Param() + : game(), fade(), scoreboard(), title(), background(), balloon(), + notification(), service_menu(), intro(), debug(), resource() {} }; // --- Variable global con los parámetros del juego ---