posat orden en defaults i defines

This commit is contained in:
2025-11-21 09:30:33 +01:00
parent 0fb986d7c4
commit 6bf26f7470
18 changed files with 307 additions and 297 deletions

View File

@@ -5,7 +5,7 @@
#include "external/fkyaml_node.hpp" // Para fkyaml::node
#include "core/resources/resource_helper.hpp" // Para Resource::Helper
#include "utils/defines.hpp" // Para TILE_SIZE
#include "utils/defines.hpp" // Para Tile::SIZE
#include "utils/utils.hpp" // Para stringToColor
// Convierte room connection de YAML a formato interno
@@ -153,34 +153,34 @@ void RoomLoader::parseEnemyBoundaries(const fkyaml::node& bounds_node, Enemy::Da
if (bounds_node.contains("position1")) {
const auto& pos1 = bounds_node["position1"];
if (pos1.contains("x")) {
enemy.x1 = pos1["x"].get_value<int>() * TILE_SIZE;
enemy.x1 = pos1["x"].get_value<int>() * Tile::SIZE;
}
if (pos1.contains("y")) {
enemy.y1 = pos1["y"].get_value<int>() * TILE_SIZE;
enemy.y1 = pos1["y"].get_value<int>() * Tile::SIZE;
}
}
if (bounds_node.contains("position2")) {
const auto& pos2 = bounds_node["position2"];
if (pos2.contains("x")) {
enemy.x2 = pos2["x"].get_value<int>() * TILE_SIZE;
enemy.x2 = pos2["x"].get_value<int>() * Tile::SIZE;
}
if (pos2.contains("y")) {
enemy.y2 = pos2["y"].get_value<int>() * TILE_SIZE;
enemy.y2 = pos2["y"].get_value<int>() * Tile::SIZE;
}
}
// Formato antiguo: x1/y1/x2/y2 (compatibilidad)
if (bounds_node.contains("x1")) {
enemy.x1 = bounds_node["x1"].get_value<int>() * TILE_SIZE;
enemy.x1 = bounds_node["x1"].get_value<int>() * Tile::SIZE;
}
if (bounds_node.contains("y1")) {
enemy.y1 = bounds_node["y1"].get_value<int>() * TILE_SIZE;
enemy.y1 = bounds_node["y1"].get_value<int>() * Tile::SIZE;
}
if (bounds_node.contains("x2")) {
enemy.x2 = bounds_node["x2"].get_value<int>() * TILE_SIZE;
enemy.x2 = bounds_node["x2"].get_value<int>() * Tile::SIZE;
}
if (bounds_node.contains("y2")) {
enemy.y2 = bounds_node["y2"].get_value<int>() * TILE_SIZE;
enemy.y2 = bounds_node["y2"].get_value<int>() * Tile::SIZE;
}
}
@@ -197,10 +197,10 @@ auto RoomLoader::parseEnemyData(const fkyaml::node& enemy_node) -> Enemy::Data {
if (enemy_node.contains("position")) {
const auto& pos = enemy_node["position"];
if (pos.contains("x")) {
enemy.x = pos["x"].get_value<float>() * TILE_SIZE;
enemy.x = pos["x"].get_value<float>() * Tile::SIZE;
}
if (pos.contains("y")) {
enemy.y = pos["y"].get_value<float>() * TILE_SIZE;
enemy.y = pos["y"].get_value<float>() * Tile::SIZE;
}
}
@@ -276,10 +276,10 @@ auto RoomLoader::parseItemData(const fkyaml::node& item_node, const Room::Data&
if (item_node.contains("position")) {
const auto& pos = item_node["position"];
if (pos.contains("x")) {
item.x = pos["x"].get_value<float>() * TILE_SIZE;
item.x = pos["x"].get_value<float>() * Tile::SIZE;
}
if (pos.contains("y")) {
item.y = pos["y"].get_value<float>() * TILE_SIZE;
item.y = pos["y"].get_value<float>() * Tile::SIZE;
}
}